Comparing version 1.0.2 to 1.0.3
@@ -0,3 +1,4 @@ | ||
import debug from "debug"; | ||
import { performance } from "node:perf_hooks"; | ||
import { Roarr as log } from "roarr"; | ||
const log = debug('tvt:perf'); | ||
/** | ||
@@ -20,3 +21,3 @@ * A method decorator that measures the execution time of the decorated method. | ||
const finish = performance.now(); | ||
log(`[${methodName}] Execution time: ${finish - start} milliseconds`); | ||
log(`[${methodName}] execution time: ${finish - start} ms`); | ||
return result; | ||
@@ -23,0 +24,0 @@ } |
import { type DeviceInfo } from './lib/types.js'; | ||
export type Settings = { | ||
connectionTimeoutMs?: number; | ||
maxRetries?: number; | ||
reconnectIntervalMs?: number; | ||
isReconnectEnabled?: boolean; | ||
}; | ||
export type VersionInfo = { | ||
sdk: { | ||
version: string; | ||
build: string; | ||
}; | ||
device: { | ||
name: string; | ||
model: string; | ||
SN: string; | ||
firmware: string; | ||
kernel: string; | ||
hardware: string; | ||
MCU: string; | ||
software: number; | ||
}; | ||
}; | ||
import type { Settings, VersionInfo } from './types.js'; | ||
/** | ||
@@ -29,2 +8,5 @@ * Represents a generic TVT Device. | ||
#private; | ||
readonly uuid: `${string}-${string}-${string}-${string}-${string}`; | ||
readonly ip: string; | ||
readonly port: number; | ||
userId: number; | ||
@@ -31,0 +13,0 @@ /** |
@@ -374,2 +374,4 @@ function applyDecs2203RFactory() { | ||
var _initProto; | ||
import debug from "debug"; | ||
import { randomUUID } from "node:crypto"; | ||
import { existsSync, mkdirSync } from "node:fs"; | ||
@@ -382,2 +384,3 @@ import { dirname } from "node:path"; | ||
import { NET_SDK_ERROR } from "./lib/types.js"; | ||
const log = debug('tvt:device'); | ||
/** | ||
@@ -420,4 +423,5 @@ * Represents a generic TVT Device. | ||
} | ||
#ip; | ||
#port; | ||
uuid; | ||
ip; | ||
port; | ||
#connectionTimeoutMs = 5 * 1000; | ||
@@ -444,4 +448,5 @@ #maxRetries = 3; | ||
_initProto(this); | ||
this.#ip = validateIp(ip); | ||
this.#port = validatePort(port); | ||
this.ip = validateIp(ip); | ||
this.port = validatePort(port); | ||
this.uuid = settings?.uuid ?? randomUUID(); | ||
if (settings) { | ||
@@ -454,3 +459,3 @@ this.#connectionTimeoutMs = settings.connectionTimeoutMs ?? this.#connectionTimeoutMs; | ||
if (this.init()) { | ||
console.log('Device initialized successfully!'); | ||
log(`${this.uuid} device initialized successfully!`); | ||
const sdkVersion = sdk.getSDKVersion(); | ||
@@ -529,3 +534,3 @@ const buildVersion = sdk.getSDKBuildVersion(); | ||
*/ login(user, pass) { | ||
this.userId = sdk.login(this.#ip, this.#port, user, pass, this.#deviceInfo); | ||
this.userId = sdk.login(this.ip, this.port, user, pass, this.#deviceInfo); | ||
if (this.userId === -1) { | ||
@@ -549,2 +554,3 @@ throw new Error(this.getLastError()); | ||
*/ triggerAlarm(value) { | ||
// @TODO: get alarm channels from device info | ||
const alarmChannels = [ | ||
@@ -551,0 +557,0 @@ 0 |
{ | ||
"name": "@2bad/tvt", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -61,3 +61,3 @@ "keywords": [ | ||
"dependencies": { | ||
"debug": "4.3.4", | ||
"debug": "4.3.5", | ||
"easy-buffer": "1.2.0", | ||
@@ -70,9 +70,10 @@ "koffi": "2.8.9", | ||
"@swc/cli": "0.3.12", | ||
"@swc/core": "1.5.7", | ||
"@types/node": "20.12.12", | ||
"@swc/core": "1.5.24", | ||
"@types/debug": "4.1.12", | ||
"@types/node": "20.12.13", | ||
"@vitest/coverage-v8": "1.6.0", | ||
"eslint-config-love": "51.0.1", | ||
"eslint-config-love": "52.0.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-import-resolver-typescript": "3.6.1", | ||
"eslint-plugin-jsdoc": "48.2.6", | ||
"eslint-plugin-jsdoc": "48.2.7", | ||
"eslint-plugin-prettier": "5.1.3", | ||
@@ -94,4 +95,4 @@ "eslint-plugin-vitest": "0.5.4", | ||
"node": "22.2.0", | ||
"npm": "10.8.0" | ||
"npm": "10.8.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7925693
36
1362
19
+ Addeddebug@4.3.5(transitive)
- Removeddebug@4.3.4(transitive)
Updateddebug@4.3.5