New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

matrix-appservice

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matrix-appservice - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

19

CHANGELOG.md

@@ -1,7 +0,24 @@

0.4.2 (2020-07-24)
0.5.0 (2020-09-14)
===================
Features
--------
- Expose `AppService.app` so that services may add their own Express request handlers. ([\#26](https://github.com/matrix-org/matrix-appservice-node/issues/26))
- Expose `AppService.expressApp` ([\#27](https://github.com/matrix-org/matrix-appservice-node/issues/27))
- Documentation is now generated for Typescript files ([\#28](https://github.com/matrix-org/matrix-appservice-node/issues/28))
Internal Changes
----------------
- Remove `request` dependency ([\#25](https://github.com/matrix-org/matrix-appservice-node/issues/25))
0.4.2 (2020-07-24)
===================
Internal Changes
----------------
- Start using towncrier for changelogs ([\#23](https://github.com/matrix-org/matrix-appservice-node/issues/23))

@@ -8,0 +25,0 @@ - Update packages. ([\#24](https://github.com/matrix-org/matrix-appservice-node/issues/24))

53

lib/app-service.d.ts
/// <reference types="node" />
import { Application } from "express";
import { EventEmitter } from "events";
export declare class AppService extends EventEmitter {
private config;
export declare interface AppService {
/**
* An HTTP log line.
* @event AppService#http-log
* @type {String}
* Emitted when an event is pushed to the appservice.
* The format of the event object is documented at
* https://matrix.org/docs/spec/application_service/r0.1.2#put-matrix-app-v1-transactions-txnid
* @event
* @example
* appService.on("http-log", function(logLine) {
* console.log(logLine);
* appService.on("event", function(ev) {
* console.log("ID: %s", ev.event_id);
* });
*/
on(event: "event", cb: (event: Record<string, unknown>) => void): this;
/**
* An incoming Matrix JSON event.
* @event AppService#event
* @type {Object}
* Emitted when the HTTP listener logs some information.
* `access_tokens` are stripped from requests
* @event
* @example
* appService.on("event", function(ev) {
* console.log("ID: %s", ev.event_id);
* appService.on("http-log", function(line) {
* console.log(line);
* });
*/
on(event: "http-log", cb: (line: string) => void): this;
/**
* An incoming Matrix JSON event, filtered by <code>event.type</code>
* @event AppService#type:event
* @type {Object}
* Emitted when an event of a particular type is pushed
* to the appservice. This will be emitted *in addition*
* to "event", so ensure your bridge deduplicates events.
* @event
* @param event Should start with "type:"
* @example
* appService.on("type:m.room.message", function(ev) {
* console.log("Body: %s", ev.content.body);
* appService.on("type:m.room.message", function(event) {
* console.log("ID: %s", ev.content.body);
* });
*/
private app;
on(event: string, cb: (event: Record<string, unknown>) => void): this;
}
export declare class AppService extends EventEmitter {
private config;
/**
* @deprecated Use `AppService.expressApp`
*/
readonly app: Application;
private server?;

@@ -83,2 +95,7 @@ private lastProcessedTxnId;

setHomeserverToken(hsToken: string): void;
/**
* The Express App instance for the appservice, which
* can be extended with paths.
*/
get expressApp(): Application;
private onMorganLog;

@@ -85,0 +102,0 @@ private isInvalidToken;

@@ -14,2 +14,3 @@ "use strict";

const https_1 = __importDefault(require("https"));
const http_1 = __importDefault(require("http"));
const MAX_SIZE_BYTES = 5000000; // 5MB

@@ -77,3 +78,3 @@ class AppService extends events_1.EventEmitter {

else {
serverApp = this.app;
serverApp = http_1.default.createServer({}, this.app);
}

@@ -85,10 +86,9 @@ if (callback) {

return new Promise((resolve, reject) => {
this.server = serverApp.listen(port, hostname, backlog, (err) => {
if (err) {
reject(err);
}
else {
resolve();
}
serverApp.on("error", (err) => {
reject(err);
});
serverApp.on("listening", () => {
resolve();
});
this.server = serverApp.listen(port, hostname, backlog);
});

@@ -134,2 +134,9 @@ }

}
/**
* The Express App instance for the appservice, which
* can be extended with paths.
*/
get expressApp() {
return this.app;
}
onMorganLog(str) {

@@ -136,0 +143,0 @@ const redactedStr = str.replace(/access_token=.*?(&|\s|$)/, "access_token=<REDACTED>$1");

{
"name": "matrix-appservice",
"version": "0.4.2",
"version": "0.5.0",
"description": "Matrix Application Service Framework",

@@ -11,7 +11,7 @@ "main": "lib/index.js",

"scripts": {
"gendoc": "jsdoc -r lib -R README.md -P package.json -d .jsdoc",
"gendoc": "typedoc",
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint -c .eslintrc --max-warnings 0 src/**/*.ts",
"prepublishOnly": "npm run build",
"build": "tsc --project tsconfig.json"
"build": "tsc --project tsconfig.json",
"prepare": "npm run build"
},

@@ -27,20 +27,19 @@ "repository": {

"dependencies": {
"@types/express": "^4.17.8",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"js-yaml": "^3.14.0",
"morgan": "^1.10.0",
"request": "^2.88.2"
"morgan": "^1.10.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.7.0",
"@typescript-eslint/parser": "^3.7.0",
"@types/body-parser": "^1.19.0",
"@types/express": "^4.17.7",
"@types/js-yaml": "^3.12.5",
"@types/morgan": "^1.9.1",
"@types/node": "^10.17.0",
"eslint": "^7.5.0",
"jsdoc": "^3.6.4",
"@types/node": "^10.17.29",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"eslint": "^7.8.1",
"typedoc": "^0.19.1",
"typescript": "^3.9.7"
}
}

@@ -8,38 +8,48 @@ import {Application, Request, Response, default as express} from "express";

import https from "https";
import { Server } from "http";
import { Server, default as http } from "http";
const MAX_SIZE_BYTES = 5000000; // 5MB
export class AppService extends EventEmitter {
export declare interface AppService {
/**
* An HTTP log line.
* @event AppService#http-log
* @type {String}
* Emitted when an event is pushed to the appservice.
* The format of the event object is documented at
* https://matrix.org/docs/spec/application_service/r0.1.2#put-matrix-app-v1-transactions-txnid
* @event
* @example
* appService.on("http-log", function(logLine) {
* console.log(logLine);
* appService.on("event", function(ev) {
* console.log("ID: %s", ev.event_id);
* });
*/
on(event: "event", cb: (event: Record<string, unknown>) => void): this;
/**
* An incoming Matrix JSON event.
* @event AppService#event
* @type {Object}
* Emitted when the HTTP listener logs some information.
* `access_tokens` are stripped from requests
* @event
* @example
* appService.on("event", function(ev) {
* console.log("ID: %s", ev.event_id);
* appService.on("http-log", function(line) {
* console.log(line);
* });
*/
on(event: "http-log", cb: (line: string) => void): this;
/**
* An incoming Matrix JSON event, filtered by <code>event.type</code>
* @event AppService#type:event
* @type {Object}
* Emitted when an event of a particular type is pushed
* to the appservice. This will be emitted *in addition*
* to "event", so ensure your bridge deduplicates events.
* @event
* @param event Should start with "type:"
* @example
* appService.on("type:m.room.message", function(ev) {
* console.log("Body: %s", ev.content.body);
* appService.on("type:m.room.message", function(event) {
* console.log("ID: %s", ev.content.body);
* });
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
on(event: string, cb: (event: Record<string, unknown>) => void): this;
}
private app: Application;
export class AppService extends EventEmitter {
/**
* @deprecated Use `AppService.expressApp`
*/
public readonly app: Application;
private server?: Server;

@@ -91,3 +101,3 @@ private lastProcessedTxnId = "";

const tlsCert = process.env.MATRIX_AS_TLS_CERT;
let serverApp: Server|Application;
let serverApp: Server;
if (tlsKey || tlsCert) {

@@ -113,3 +123,3 @@ if (!(tlsKey && tlsCert)) {

else {
serverApp = this.app;
serverApp = http.createServer({}, this.app);
}

@@ -121,9 +131,9 @@ if (callback) {

return new Promise((resolve, reject) => {
this.server = serverApp.listen(port, hostname, backlog, (err: Error|null) => {
if (err) {
reject(err);
} else {
resolve();
}
serverApp.on("error", (err) => {
reject(err)
});
serverApp.on("listening", () => {
resolve();
});
this.server = serverApp.listen(port, hostname, backlog);
});

@@ -175,2 +185,10 @@ }

/**
* The Express App instance for the appservice, which
* can be extended with paths.
*/
public get expressApp() {
return this.app;
}
private onMorganLog(str: string) {

@@ -177,0 +195,0 @@ const redactedStr = str.replace(/access_token=.*?(&|\s|$)/, "access_token=<REDACTED>$1");

@@ -20,3 +20,10 @@ {

"index.js"
]
],
"typedocOptions": {
"mode": "library",
"out": ".typedoc",
"excludePrivate": true,
"excludeNotExported": false,
"exclude": ["**/index.ts"]
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc