edilkamin 1.7.3 → 1.7.4

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.
Files changed (59) hide show
  1. package/.github/workflows/cli-tests.yml +6 -0
  2. package/dist/cjs/package.json +84 -0
  3. package/dist/cjs/src/browser-bundle.test.js +64 -0
  4. package/dist/cjs/src/buffer-utils.js +78 -0
  5. package/dist/cjs/src/buffer-utils.test.js +186 -0
  6. package/dist/cjs/src/cli.js +253 -0
  7. package/dist/cjs/src/configureAmplify.test.js +42 -0
  8. package/dist/cjs/src/constants.js +9 -0
  9. package/dist/cjs/src/index.js +22 -0
  10. package/dist/cjs/src/library.js +324 -0
  11. package/dist/cjs/src/library.test.js +547 -0
  12. package/dist/cjs/src/serial-utils.js +50 -0
  13. package/dist/cjs/src/serial-utils.test.js +50 -0
  14. package/dist/cjs/src/token-storage.js +119 -0
  15. package/dist/cjs/src/types.js +2 -0
  16. package/dist/esm/package.json +84 -0
  17. package/dist/esm/{browser-bundle.test.js → src/browser-bundle.test.js} +1 -1
  18. package/dist/esm/src/buffer-utils.d.ts +25 -0
  19. package/dist/esm/src/buffer-utils.test.d.ts +1 -0
  20. package/dist/esm/src/cli.d.ts +3 -0
  21. package/dist/esm/src/configureAmplify.test.d.ts +1 -0
  22. package/dist/esm/src/constants.d.ts +4 -0
  23. package/dist/esm/src/index.d.ts +6 -0
  24. package/dist/esm/src/library.d.ts +55 -0
  25. package/dist/esm/src/library.test.d.ts +1 -0
  26. package/dist/esm/src/serial-utils.d.ts +33 -0
  27. package/dist/esm/src/serial-utils.test.d.ts +1 -0
  28. package/dist/esm/src/token-storage.d.ts +14 -0
  29. package/dist/esm/src/types.d.ts +73 -0
  30. package/dist/esm/src/types.js +1 -0
  31. package/package.json +10 -10
  32. package/src/browser-bundle.test.ts +1 -1
  33. package/tsconfig.cjs.json +2 -2
  34. package/tsconfig.json +2 -3
  35. /package/dist/{esm → cjs/src}/browser-bundle.test.d.ts +0 -0
  36. /package/dist/{esm → cjs/src}/buffer-utils.d.ts +0 -0
  37. /package/dist/{esm → cjs/src}/buffer-utils.test.d.ts +0 -0
  38. /package/dist/{esm → cjs/src}/cli.d.ts +0 -0
  39. /package/dist/{esm → cjs/src}/configureAmplify.test.d.ts +0 -0
  40. /package/dist/{esm → cjs/src}/constants.d.ts +0 -0
  41. /package/dist/{esm → cjs/src}/index.d.ts +0 -0
  42. /package/dist/{esm → cjs/src}/library.d.ts +0 -0
  43. /package/dist/{esm → cjs/src}/library.test.d.ts +0 -0
  44. /package/dist/{esm → cjs/src}/serial-utils.d.ts +0 -0
  45. /package/dist/{esm → cjs/src}/serial-utils.test.d.ts +0 -0
  46. /package/dist/{esm → cjs/src}/token-storage.d.ts +0 -0
  47. /package/dist/{esm → cjs/src}/types.d.ts +0 -0
  48. /package/dist/esm/{types.js → src/browser-bundle.test.d.ts} +0 -0
  49. /package/dist/esm/{buffer-utils.js → src/buffer-utils.js} +0 -0
  50. /package/dist/esm/{buffer-utils.test.js → src/buffer-utils.test.js} +0 -0
  51. /package/dist/esm/{cli.js → src/cli.js} +0 -0
  52. /package/dist/esm/{configureAmplify.test.js → src/configureAmplify.test.js} +0 -0
  53. /package/dist/esm/{constants.js → src/constants.js} +0 -0
  54. /package/dist/esm/{index.js → src/index.js} +0 -0
  55. /package/dist/esm/{library.js → src/library.js} +0 -0
  56. /package/dist/esm/{library.test.js → src/library.test.js} +0 -0
  57. /package/dist/esm/{serial-utils.js → src/serial-utils.js} +0 -0
  58. /package/dist/esm/{serial-utils.test.js → src/serial-utils.test.js} +0 -0
  59. /package/dist/esm/{token-storage.js → src/token-storage.js} +0 -0
@@ -0,0 +1,119 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.clearSession = exports.createFileStorage = void 0;
46
+ const fs_1 = require("fs");
47
+ const os = __importStar(require("os"));
48
+ const path = __importStar(require("path"));
49
+ const TOKEN_DIR = path.join(os.homedir(), ".edilkamin");
50
+ const TOKEN_FILE = path.join(TOKEN_DIR, "session.json");
51
+ /**
52
+ * Custom storage adapter for AWS Amplify that persists to file system.
53
+ * Used for CLI to maintain sessions between invocations.
54
+ */
55
+ const createFileStorage = () => {
56
+ let cache = {};
57
+ let loaded = false;
58
+ const ensureDir = () => __awaiter(void 0, void 0, void 0, function* () {
59
+ try {
60
+ yield fs_1.promises.mkdir(TOKEN_DIR, { recursive: true, mode: 0o700 });
61
+ }
62
+ catch (_a) {
63
+ // Directory may already exist
64
+ }
65
+ });
66
+ const load = () => __awaiter(void 0, void 0, void 0, function* () {
67
+ if (loaded)
68
+ return;
69
+ try {
70
+ const data = yield fs_1.promises.readFile(TOKEN_FILE, "utf-8");
71
+ cache = JSON.parse(data);
72
+ }
73
+ catch (_a) {
74
+ cache = {};
75
+ }
76
+ loaded = true;
77
+ });
78
+ const save = () => __awaiter(void 0, void 0, void 0, function* () {
79
+ yield ensureDir();
80
+ yield fs_1.promises.writeFile(TOKEN_FILE, JSON.stringify(cache), {
81
+ encoding: "utf-8",
82
+ mode: 0o600,
83
+ });
84
+ });
85
+ return {
86
+ setItem: (key, value) => __awaiter(void 0, void 0, void 0, function* () {
87
+ yield load();
88
+ cache[key] = value;
89
+ yield save();
90
+ }),
91
+ getItem: (key) => __awaiter(void 0, void 0, void 0, function* () {
92
+ var _a;
93
+ yield load();
94
+ return (_a = cache[key]) !== null && _a !== void 0 ? _a : null;
95
+ }),
96
+ removeItem: (key) => __awaiter(void 0, void 0, void 0, function* () {
97
+ yield load();
98
+ delete cache[key];
99
+ yield save();
100
+ }),
101
+ clear: () => __awaiter(void 0, void 0, void 0, function* () {
102
+ cache = {};
103
+ yield save();
104
+ }),
105
+ };
106
+ };
107
+ exports.createFileStorage = createFileStorage;
108
+ /**
109
+ * Clears all stored session data.
110
+ */
111
+ const clearSession = () => __awaiter(void 0, void 0, void 0, function* () {
112
+ try {
113
+ yield fs_1.promises.unlink(TOKEN_FILE);
114
+ }
115
+ catch (_a) {
116
+ // File may not exist
117
+ }
118
+ });
119
+ exports.clearSession = clearSession;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "edilkamin",
3
+ "version": "1.7.4",
4
+ "description": "",
5
+ "main": "dist/cjs/src/index.js",
6
+ "module": "dist/esm/src/index.js",
7
+ "types": "dist/esm/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/esm/src/index.d.ts",
12
+ "default": "./dist/esm/src/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/cjs/src/index.d.ts",
16
+ "default": "./dist/cjs/src/index.js"
17
+ }
18
+ }
19
+ },
20
+ "scripts": {
21
+ "cli": "ts-node src/cli.ts",
22
+ "cli:debug": "node --inspect --require ts-node/register/transpile-only src/cli.ts",
23
+ "test": "nyc mocha --require ts-node/register src/*.test.ts",
24
+ "test:debug": "nyc mocha --require ts-node/register/transpile-only --inspect src/*.test.ts",
25
+ "lint:prettier": "prettier --check src docs .github *.json *.md *.mjs",
26
+ "format:prettier": "prettier --write src docs .github *.json *.md *.mjs",
27
+ "lint:eslint": "eslint src",
28
+ "format:eslint": "eslint --fix src",
29
+ "lint": "yarn lint:prettier && yarn lint:eslint",
30
+ "format": "yarn format:prettier && yarn format:eslint",
31
+ "build:cjs": "tsc -p tsconfig.cjs.json",
32
+ "build:esm": "tsc -p tsconfig.esm.json",
33
+ "build": "npm run build:cjs && npm run build:esm"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/AndreMiras/edilkamin.js.git"
38
+ },
39
+ "author": "Andre Miras",
40
+ "license": "MIT",
41
+ "bugs": {
42
+ "url": "https://github.com/AndreMiras/edilkamin.js/issues"
43
+ },
44
+ "homepage": "https://github.com/AndreMiras/edilkamin.js#readme",
45
+ "bin": {
46
+ "edilkamin": "dist/cjs/src/cli.js"
47
+ },
48
+ "nyc": {
49
+ "reporter": [
50
+ "html",
51
+ "lcov",
52
+ "text"
53
+ ]
54
+ },
55
+ "dependencies": {
56
+ "aws-amplify": "^6.10.0",
57
+ "pako": "^2.1.0"
58
+ },
59
+ "devDependencies": {
60
+ "@eslint/eslintrc": "^3.2.0",
61
+ "@eslint/js": "^9.16.0",
62
+ "@types/mocha": "^10.0.10",
63
+ "@types/node": "^25.0.2",
64
+ "@types/pako": "^2.0.4",
65
+ "@types/sinon": "^17.0.3",
66
+ "@typescript-eslint/eslint-plugin": "^8.17.0",
67
+ "@typescript-eslint/parser": "^8.17.0",
68
+ "esbuild": "^0.27.1",
69
+ "eslint": "^9.16.0",
70
+ "eslint-config-prettier": "^10.1.8",
71
+ "eslint-plugin-prettier": "^5.2.1",
72
+ "eslint-plugin-simple-import-sort": "^12.1.1",
73
+ "mocha": "^11.7.5",
74
+ "nyc": "^17.1.0",
75
+ "prettier": "^3.7.4",
76
+ "sinon": "^19.0.2",
77
+ "ts-node": "^10.9.1",
78
+ "typedoc": "^0.28.15",
79
+ "typescript": "^5.7.2"
80
+ },
81
+ "optionalDependencies": {
82
+ "commander": "^12.1.0"
83
+ }
84
+ }
@@ -15,7 +15,7 @@ describe("browser-bundle", () => {
15
15
  // without requiring Node.js built-in modules (fs, os, path).
16
16
  // If this test fails, it means Node.js-only code has leaked into the main exports.
17
17
  const result = yield esbuild.build({
18
- entryPoints: ["dist/esm/index.js"],
18
+ entryPoints: ["dist/esm/src/index.js"],
19
19
  platform: "browser",
20
20
  bundle: true,
21
21
  write: false,
@@ -0,0 +1,25 @@
1
+ import { BufferEncodedType } from "./types";
2
+ /**
3
+ * Type guard to check if a value is a serialized Node.js Buffer.
4
+ * Node.js Buffers serialize to JSON as: {type: "Buffer", data: [...]}
5
+ *
6
+ * @param value - The value to check
7
+ * @returns True if the value is a Buffer-encoded object
8
+ */
9
+ declare const isBuffer: (value: unknown) => value is BufferEncodedType;
10
+ /**
11
+ * Decompresses a Buffer-encoded gzip object and parses the resulting JSON.
12
+ *
13
+ * @param bufferObj - A serialized Buffer object containing gzip data
14
+ * @returns The decompressed and parsed JSON data, or the original object on failure
15
+ */
16
+ declare const decompressBuffer: (bufferObj: BufferEncodedType) => unknown;
17
+ /**
18
+ * Recursively processes an API response to decompress any Buffer-encoded fields.
19
+ * Handles nested objects and arrays, preserving structure while decompressing.
20
+ *
21
+ * @param data - The API response data to process
22
+ * @returns The processed data with all Buffer fields decompressed
23
+ */
24
+ declare const processResponse: <T>(data: T) => T;
25
+ export { decompressBuffer, isBuffer, processResponse };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ declare const main: () => void;
3
+ export { main };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ declare const OLD_API_URL = "https://fxtj7xkgc6.execute-api.eu-central-1.amazonaws.com/prod/";
2
+ declare const NEW_API_URL = "https://the-mind-api.edilkamin.com/";
3
+ declare const API_URL = "https://the-mind-api.edilkamin.com/";
4
+ export { API_URL, NEW_API_URL, OLD_API_URL };
@@ -0,0 +1,6 @@
1
+ export { decompressBuffer, isBuffer, processResponse } from "./buffer-utils";
2
+ export { API_URL, NEW_API_URL, OLD_API_URL } from "./constants";
3
+ export { configure, getSession, signIn } from "./library";
4
+ export { serialNumberDisplay, serialNumberFromHex, serialNumberToHex, } from "./serial-utils";
5
+ export { BufferEncodedType, CommandsType, DeviceAssociationBody, DeviceAssociationResponse, DeviceInfoRawType, DeviceInfoType, EditDeviceAssociationBody, StatusType, TemperaturesType, UserParametersType, } from "./types";
6
+ export declare const deviceInfo: (jwtToken: string, macAddress: string) => Promise<import("./types").DeviceInfoType>, registerDevice: (jwtToken: string, macAddress: string, serialNumber: string, deviceName?: string, deviceRoom?: string) => Promise<import("./types").DeviceAssociationResponse>, editDevice: (jwtToken: string, macAddress: string, deviceName?: string, deviceRoom?: string) => Promise<import("./types").DeviceAssociationResponse>, setPower: (jwtToken: string, macAddress: string, value: number) => Promise<unknown>, setPowerOff: (jwtToken: string, macAddress: string) => Promise<unknown>, setPowerOn: (jwtToken: string, macAddress: string) => Promise<unknown>, getPower: (jwtToken: string, macAddress: string) => Promise<boolean>, getEnvironmentTemperature: (jwtToken: string, macAddress: string) => Promise<number>, getTargetTemperature: (jwtToken: string, macAddress: string) => Promise<number>, setTargetTemperature: (jwtToken: string, macAddress: string, temperature: number) => Promise<unknown>;
@@ -0,0 +1,55 @@
1
+ import * as amplifyAuth from "aws-amplify/auth";
2
+ import { DeviceAssociationResponse, DeviceInfoType } from "./types";
3
+ /**
4
+ * Generates headers with a JWT token for authenticated requests.
5
+ * @param {string} jwtToken - The JWT token for authorization.
6
+ * @returns {object} - The headers object with the Authorization field.
7
+ */
8
+ declare const headers: (jwtToken: string) => {
9
+ Authorization: string;
10
+ };
11
+ /**
12
+ * Configures Amplify if not already configured.
13
+ * Uses a local flag to avoid calling getConfig() which prints a warning.
14
+ * @param {object} [storage] - Optional custom storage adapter for token persistence
15
+ */
16
+ declare const configureAmplify: (storage?: {
17
+ setItem: (key: string, value: string) => Promise<void>;
18
+ getItem: (key: string) => Promise<string | null>;
19
+ removeItem: (key: string) => Promise<void>;
20
+ clear: () => Promise<void>;
21
+ }) => void;
22
+ /**
23
+ * Creates an authentication service with sign-in functionality.
24
+ * @param {typeof amplifyAuth} auth - The authentication module to use.
25
+ * @returns {object} - An object containing authentication-related methods.
26
+ */
27
+ declare const createAuthService: (auth: typeof amplifyAuth) => {
28
+ signIn: (username: string, password: string, legacy?: boolean) => Promise<string>;
29
+ getSession: (forceRefresh?: boolean, legacy?: boolean) => Promise<string>;
30
+ };
31
+ declare const signIn: (username: string, password: string, legacy?: boolean) => Promise<string>, getSession: (forceRefresh?: boolean, legacy?: boolean) => Promise<string>;
32
+ /**
33
+ * Configures the library for API interactions.
34
+ * Initializes API methods with a specified base URL.
35
+ *
36
+ * @param {string} [baseURL=API_URL] - The base URL for the API.
37
+ * @returns {object} - An object containing methods for interacting with the API.
38
+ *
39
+ * @example
40
+ * const api = configure();
41
+ * const power = await api.getPower(jwtToken, macAddress);
42
+ */
43
+ declare const configure: (baseURL?: string) => {
44
+ deviceInfo: (jwtToken: string, macAddress: string) => Promise<DeviceInfoType>;
45
+ registerDevice: (jwtToken: string, macAddress: string, serialNumber: string, deviceName?: string, deviceRoom?: string) => Promise<DeviceAssociationResponse>;
46
+ editDevice: (jwtToken: string, macAddress: string, deviceName?: string, deviceRoom?: string) => Promise<DeviceAssociationResponse>;
47
+ setPower: (jwtToken: string, macAddress: string, value: number) => Promise<unknown>;
48
+ setPowerOff: (jwtToken: string, macAddress: string) => Promise<unknown>;
49
+ setPowerOn: (jwtToken: string, macAddress: string) => Promise<unknown>;
50
+ getPower: (jwtToken: string, macAddress: string) => Promise<boolean>;
51
+ getEnvironmentTemperature: (jwtToken: string, macAddress: string) => Promise<number>;
52
+ getTargetTemperature: (jwtToken: string, macAddress: string) => Promise<number>;
53
+ setTargetTemperature: (jwtToken: string, macAddress: string, temperature: number) => Promise<unknown>;
54
+ };
55
+ export { configure, configureAmplify, createAuthService, getSession, headers, signIn, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Converts a raw serial number string to hex-encoded format.
3
+ * This is useful when serial numbers contain non-printable characters.
4
+ *
5
+ * @param serial - The raw serial number string
6
+ * @returns Hex-encoded string representation
7
+ *
8
+ * @example
9
+ * serialNumberToHex("EDK123") // returns "45444b313233"
10
+ */
11
+ declare const serialNumberToHex: (serial: string) => string;
12
+ /**
13
+ * Converts a hex-encoded serial number back to raw string format.
14
+ *
15
+ * @param hex - The hex-encoded serial number
16
+ * @returns Raw serial number string
17
+ *
18
+ * @example
19
+ * serialNumberFromHex("45444b313233") // returns "EDK123"
20
+ */
21
+ declare const serialNumberFromHex: (hex: string) => string;
22
+ /**
23
+ * Produces a display-friendly version of a serial number by removing
24
+ * non-printable characters and collapsing whitespace.
25
+ *
26
+ * @param serial - The raw serial number string
27
+ * @returns Display-friendly serial number
28
+ *
29
+ * @example
30
+ * serialNumberDisplay("EDK\x00123\x1F") // returns "EDK123"
31
+ */
32
+ declare const serialNumberDisplay: (serial: string) => string;
33
+ export { serialNumberDisplay, serialNumberFromHex, serialNumberToHex };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Custom storage adapter for AWS Amplify that persists to file system.
3
+ * Used for CLI to maintain sessions between invocations.
4
+ */
5
+ export declare const createFileStorage: () => {
6
+ setItem: (key: string, value: string) => Promise<void>;
7
+ getItem: (key: string) => Promise<string | null>;
8
+ removeItem: (key: string) => Promise<void>;
9
+ clear: () => Promise<void>;
10
+ };
11
+ /**
12
+ * Clears all stored session data.
13
+ */
14
+ export declare const clearSession: () => Promise<void>;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Represents a Node.js Buffer object serialized to JSON.
3
+ * This format is used by the Edilkamin API for gzip-compressed fields.
4
+ */
5
+ interface BufferEncodedType {
6
+ type: "Buffer";
7
+ data: number[];
8
+ }
9
+ interface CommandsType {
10
+ power: boolean;
11
+ }
12
+ interface TemperaturesType {
13
+ board: number;
14
+ enviroment: number;
15
+ }
16
+ interface StatusType {
17
+ commands: CommandsType;
18
+ temperatures: TemperaturesType;
19
+ }
20
+ interface UserParametersType {
21
+ enviroment_1_temperature: number;
22
+ enviroment_2_temperature: number;
23
+ enviroment_3_temperature: number;
24
+ is_auto: boolean;
25
+ is_sound_active: boolean;
26
+ }
27
+ interface DeviceInfoType {
28
+ status: StatusType;
29
+ nvm: {
30
+ user_parameters: UserParametersType;
31
+ };
32
+ }
33
+ /**
34
+ * Raw device info response that may contain Buffer-encoded compressed fields.
35
+ * Used internally before processing; external callers receive DeviceInfoType.
36
+ */
37
+ interface DeviceInfoRawType {
38
+ status: StatusType | BufferEncodedType;
39
+ nvm: {
40
+ user_parameters: UserParametersType;
41
+ } | BufferEncodedType;
42
+ component_info?: BufferEncodedType | Record<string, unknown>;
43
+ }
44
+ /**
45
+ * Request body for registering a device with a user account.
46
+ * All fields are required by the API.
47
+ */
48
+ interface DeviceAssociationBody {
49
+ macAddress: string;
50
+ deviceName: string;
51
+ deviceRoom: string;
52
+ serialNumber: string;
53
+ }
54
+ /**
55
+ * Request body for editing a device's name and room.
56
+ * MAC address is specified in the URL path, not the body.
57
+ * Serial number cannot be changed after registration.
58
+ */
59
+ interface EditDeviceAssociationBody {
60
+ deviceName: string;
61
+ deviceRoom: string;
62
+ }
63
+ /**
64
+ * Response from device registration endpoint.
65
+ * Structure based on Android app behavior - may need adjustment after testing.
66
+ */
67
+ interface DeviceAssociationResponse {
68
+ macAddress: string;
69
+ deviceName: string;
70
+ deviceRoom: string;
71
+ serialNumber: string;
72
+ }
73
+ export type { BufferEncodedType, CommandsType, DeviceAssociationBody, DeviceAssociationResponse, DeviceInfoRawType, DeviceInfoType, EditDeviceAssociationBody, StatusType, TemperaturesType, UserParametersType, };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "edilkamin",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "",
5
- "main": "dist/cjs/index.js",
6
- "module": "dist/esm/index.js",
7
- "types": "dist/esm/index.d.ts",
5
+ "main": "dist/cjs/src/index.js",
6
+ "module": "dist/esm/src/index.js",
7
+ "types": "dist/esm/src/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": {
11
- "types": "./dist/esm/index.d.ts",
12
- "default": "./dist/esm/index.js"
11
+ "types": "./dist/esm/src/index.d.ts",
12
+ "default": "./dist/esm/src/index.js"
13
13
  },
14
14
  "require": {
15
- "types": "./dist/cjs/index.d.ts",
16
- "default": "./dist/cjs/index.js"
15
+ "types": "./dist/cjs/src/index.d.ts",
16
+ "default": "./dist/cjs/src/index.js"
17
17
  }
18
18
  }
19
19
  },
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "homepage": "https://github.com/AndreMiras/edilkamin.js#readme",
45
45
  "bin": {
46
- "edilkamin": "dist/cjs/cli.js"
46
+ "edilkamin": "dist/cjs/src/cli.js"
47
47
  },
48
48
  "nyc": {
49
49
  "reporter": [
@@ -57,10 +57,10 @@
57
57
  "pako": "^2.1.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@aws-amplify/cli": "^7.6.21",
61
60
  "@eslint/eslintrc": "^3.2.0",
62
61
  "@eslint/js": "^9.16.0",
63
62
  "@types/mocha": "^10.0.10",
63
+ "@types/node": "^25.0.2",
64
64
  "@types/pako": "^2.0.4",
65
65
  "@types/sinon": "^17.0.3",
66
66
  "@typescript-eslint/eslint-plugin": "^8.17.0",
@@ -7,7 +7,7 @@ describe("browser-bundle", () => {
7
7
  // without requiring Node.js built-in modules (fs, os, path).
8
8
  // If this test fails, it means Node.js-only code has leaked into the main exports.
9
9
  const result = await esbuild.build({
10
- entryPoints: ["dist/esm/index.js"],
10
+ entryPoints: ["dist/esm/src/index.js"],
11
11
  platform: "browser",
12
12
  bundle: true,
13
13
  write: false,
package/tsconfig.cjs.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
3
  "compilerOptions": {
4
- "outDir": "dist/esm",
5
- "module": "es6"
4
+ "outDir": "dist/cjs",
5
+ "module": "commonjs"
6
6
  }
7
7
  }
package/tsconfig.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es6",
4
3
  "target": "es6",
5
4
  "moduleResolution": "node",
6
5
  "outDir": "dist",
7
- "rootDir": "src",
6
+ "rootDir": ".",
8
7
  "strict": true,
9
8
  "declaration": true,
10
9
  "esModuleInterop": true,
@@ -13,5 +12,5 @@
13
12
  "noUnusedParameters": true,
14
13
  "preserveConstEnums": true
15
14
  },
16
- "include": ["src/**/*.ts"]
15
+ "include": ["src/**/*.ts", "package.json"]
17
16
  }
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
File without changes
File without changes