Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7659fa0cf4 | ||
|
|
314ef5c2ff |
3
dist/homeassistant.js
vendored
3
dist/homeassistant.js
vendored
@@ -1,2 +1 @@
|
|||||||
"use strict";
|
export {};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
|
|||||||
47
dist/index.js
vendored
47
dist/index.js
vendored
@@ -1,43 +1,4 @@
|
|||||||
"use strict";
|
export * from "./homeassistant";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
export * as Logger from "./logger";
|
||||||
if (k2 === undefined) k2 = k;
|
export * from "./tidal";
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
export * as TimeHelper from "./timehelper";
|
||||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
||||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
||||||
}
|
|
||||||
Object.defineProperty(o, k2, desc);
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
||||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || (function () {
|
|
||||||
var ownKeys = function(o) {
|
|
||||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
||||||
var ar = [];
|
|
||||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
||||||
return ar;
|
|
||||||
};
|
|
||||||
return ownKeys(o);
|
|
||||||
};
|
|
||||||
return function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.TimeHelper = exports.Logger = void 0;
|
|
||||||
__exportStar(require("./homeassistant"), exports);
|
|
||||||
exports.Logger = __importStar(require("./logger"));
|
|
||||||
__exportStar(require("./tidal"), exports);
|
|
||||||
exports.TimeHelper = __importStar(require("./timehelper"));
|
|
||||||
|
|||||||
34
dist/logger.js
vendored
34
dist/logger.js
vendored
@@ -1,29 +1,19 @@
|
|||||||
"use strict";
|
import axios from "axios";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
import chalk from "chalk";
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
export function logError(...args) {
|
||||||
};
|
console.error(chalk.red("ERROR:"), ...args);
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.logError = logError;
|
|
||||||
exports.logWarning = logWarning;
|
|
||||||
exports.logSuccess = logSuccess;
|
|
||||||
exports.logInfo = logInfo;
|
|
||||||
exports.printNetworkError = printNetworkError;
|
|
||||||
const axios_1 = __importDefault(require("axios"));
|
|
||||||
const chalk_1 = __importDefault(require("chalk"));
|
|
||||||
function logError(...args) {
|
|
||||||
console.error(chalk_1.default.red("ERROR:"), ...args);
|
|
||||||
}
|
}
|
||||||
function logWarning(...args) {
|
export function logWarning(...args) {
|
||||||
console.warn(chalk_1.default.yellow("WARNING:"), ...args);
|
console.warn(chalk.yellow("WARNING:"), ...args);
|
||||||
}
|
}
|
||||||
function logSuccess(...args) {
|
export function logSuccess(...args) {
|
||||||
console.info(chalk_1.default.green("SUCCESS:"), ...args);
|
console.info(chalk.green("SUCCESS:"), ...args);
|
||||||
}
|
}
|
||||||
function logInfo(...args) {
|
export function logInfo(...args) {
|
||||||
console.info(chalk_1.default.cyan("INFO:"), ...args);
|
console.info(chalk.cyan("INFO:"), ...args);
|
||||||
}
|
}
|
||||||
function printNetworkError(error) {
|
export function printNetworkError(error) {
|
||||||
if (axios_1.default.isAxiosError(error)) {
|
if (axios.isAxiosError(error)) {
|
||||||
logError("Axios error details:", {
|
logError("Axios error details:", {
|
||||||
message: error.message,
|
message: error.message,
|
||||||
status: error.response?.status,
|
status: error.response?.status,
|
||||||
|
|||||||
3
dist/tidal.js
vendored
3
dist/tidal.js
vendored
@@ -1,2 +1 @@
|
|||||||
"use strict";
|
export {};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
|
|||||||
14
dist/timehelper.js
vendored
14
dist/timehelper.js
vendored
@@ -1,9 +1,6 @@
|
|||||||
"use strict";
|
export class TimeSpan {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
start;
|
||||||
exports.TimeSpan = void 0;
|
end;
|
||||||
exports.calculateSecondsBetween = calculateSecondsBetween;
|
|
||||||
exports.secondsToReadable = secondsToReadable;
|
|
||||||
class TimeSpan {
|
|
||||||
constructor(timeSpanStr) {
|
constructor(timeSpanStr) {
|
||||||
const [startStr, endStr] = timeSpanStr.split("-");
|
const [startStr, endStr] = timeSpanStr.split("-");
|
||||||
this.start = this.parseTime(startStr);
|
this.start = this.parseTime(startStr);
|
||||||
@@ -28,15 +25,14 @@ class TimeSpan {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.TimeSpan = TimeSpan;
|
export function calculateSecondsBetween(start, end) {
|
||||||
function calculateSecondsBetween(start, end) {
|
|
||||||
const seconds = Math.max(60, (end - start) / 1000);
|
const seconds = Math.max(60, (end - start) / 1000);
|
||||||
return {
|
return {
|
||||||
seconds,
|
seconds,
|
||||||
toReadable: (roundToMinutes) => secondsToReadable(seconds, roundToMinutes),
|
toReadable: (roundToMinutes) => secondsToReadable(seconds, roundToMinutes),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function secondsToReadable(secs, roundToMinutes = false) {
|
export function secondsToReadable(secs, roundToMinutes = false) {
|
||||||
const totalSeconds = roundToMinutes ? Math.round(secs / 60) * 60 : secs;
|
const totalSeconds = roundToMinutes ? Math.round(secs / 60) * 60 : secs;
|
||||||
var days = Math.floor(totalSeconds / (3600 * 24));
|
var days = Math.floor(totalSeconds / (3600 * 24));
|
||||||
var hours = Math.floor((totalSeconds % (3600 * 24)) / 3600);
|
var hours = Math.floor((totalSeconds % (3600 * 24)) / 3600);
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@dpu/shared",
|
"name": "@dpu/shared",
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@dpu/shared",
|
"name": "@dpu/shared",
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"chalk": "^5.6.2"
|
"chalk": "^5.6.2"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dpu/shared",
|
"name": "@dpu/shared",
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020",
|
"target": "ES2022",
|
||||||
"module": "commonjs",
|
"module": "ES2022",
|
||||||
"lib": ["ES2020"],
|
"lib": ["ES2022"],
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user