fritz-callmonitor
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -7,4 +7,3 @@ /// <reference types="node" /> | ||
private readonly _socket; | ||
constructor(host: string); | ||
constructor(host: string, port: number); | ||
constructor(host: string, port?: number); | ||
connect(): void; | ||
@@ -11,0 +10,0 @@ end(): void; |
@@ -5,4 +5,4 @@ "use strict"; | ||
const net_1 = require("net"); | ||
const moment = require("moment"); | ||
const events_1 = require("events"); | ||
const datePattern = /(\d+?)\.(\d+?)\.(\d+?)\s+?(\d+?):(\d+?):(\d+?)/gi; | ||
class CallMonitor extends events_1.EventEmitter { | ||
@@ -17,3 +17,2 @@ constructor(host, port = 1012) { | ||
const s = this._socket; | ||
s.connect(this.port, this.host); | ||
s.on("connect", () => { | ||
@@ -29,2 +28,3 @@ const reader = byline_1.createStream(this._socket, { encoding: "utf-8" }); | ||
s.on("close", had_error => this.emit("close", had_error)); | ||
s.connect(this.port, this.host); | ||
} | ||
@@ -73,4 +73,11 @@ end() { | ||
return null; | ||
const d = moment(sp[0], "DD.MM.YY HH:mm:ss"); | ||
const date = d.isValid() ? d.toDate() : new Date(); | ||
const dateMatch = datePattern.exec(sp[0]); | ||
let date; | ||
if (dateMatch !== null) { | ||
const [, dayOfMonth, month1Based, year, hours, minutes, seconds] = dateMatch; | ||
date = new Date(Number(year), Number(month1Based) - 1, Number(dayOfMonth), Number(hours), Number(minutes), Number(seconds), 0); | ||
} | ||
else { | ||
date = new Date(); | ||
} | ||
const evt = CallMonitor.eventTypeFromString(sp[1]); | ||
@@ -77,0 +84,0 @@ if (evt === undefined) |
{ | ||
"name": "fritz-callmonitor", | ||
"version": "3.1.1", | ||
"description": "Provides a node.js wrapper for the call monitor api of the AVM Fritz!Box. Written in TypeScript.", | ||
"version": "3.1.2", | ||
"description": "Provides a TypeScript Node.js wrapper for the call monitor api of the AVM Fritz!Box.", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"repository": "nikeee/fritz-callmonitor", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nikeee/fritz-callmonitor" | ||
}, | ||
"author": { | ||
@@ -12,17 +15,17 @@ "name": "Niklas Mollenhauer", | ||
}, | ||
"dependencies": { | ||
"byline": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^2.9.1" | ||
"@types/byline": "^4.2.31", | ||
"rimraf": "^2.6.3", | ||
"typescript": "^3.3.3333" | ||
}, | ||
"scripts": { | ||
"test": "tsc --noEmit", | ||
"clean": "rm -rv -- lib/* || true", | ||
"clean": "rimraf lib", | ||
"compile": "tsc", | ||
"prepare": "npm run compile" | ||
"prepare": "npm run clean && npm run compile" | ||
}, | ||
"license": "LGPL-3.0", | ||
"dependencies": { | ||
"@types/byline": "^4.2.31", | ||
"byline": "^4.2.2", | ||
"moment": "^2.22.2" | ||
} | ||
"license": "LGPL-3.0" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
1
0
1
15513
3
7
161
+ Addedbyline@5.0.0(transitive)
- Removed@types/byline@^4.2.31
- Removedmoment@^2.22.2
- Removed@types/byline@4.2.36(transitive)
- Removed@types/node@22.13.1(transitive)
- Removedbyline@4.2.2(transitive)
- Removedmoment@2.30.1(transitive)
- Removedundici-types@6.20.0(transitive)
Updatedbyline@^5.0.0