@spinajs/queue-stomp-transport
Advanced tools
Comparing version 2.0.46 to 2.0.50
import { IQueueMessage, IQueueConnectionOptions, QueueClient, QueueMessage } from '@spinajs/queue'; | ||
import { Client, StompSubscription } from '@stomp/stompjs'; | ||
import Stomp from '@stomp/stompjs'; | ||
import { Constructor } from '@spinajs/di'; | ||
export declare class StompQueueClient extends QueueClient { | ||
protected Client: Client; | ||
protected Subscriptions: Map<string, StompSubscription>; | ||
protected Client: Stomp.Client; | ||
protected Subscriptions: Map<string, Stomp.StompSubscription>; | ||
constructor(options: IQueueConnectionOptions); | ||
@@ -14,1 +14,2 @@ resolve(): Promise<void>; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -11,14 +10,10 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StompQueueClient = void 0; | ||
const exceptions_1 = require("@spinajs/exceptions"); | ||
const queue_1 = require("@spinajs/queue"); | ||
const stompjs_1 = require("@stomp/stompjs"); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const di_1 = require("@spinajs/di"); | ||
Object.assign(global, { WebSocket: require('websocket').w3cwebsocket }); | ||
let StompQueueClient = class StompQueueClient extends queue_1.QueueClient { | ||
import { UnexpectedServerError, InvalidArgument } from '../../exceptions/lib/index.js'; | ||
import { QueueClient } from '@spinajs/queue'; | ||
import Stomp from '@stomp/stompjs'; | ||
import _ from 'lodash'; | ||
import { Injectable, PerInstanceCheck } from '@spinajs/di'; | ||
import websocket from 'websocket'; | ||
Object.assign(global, { WebSocket: websocket.w3cwebsocket }); | ||
let StompQueueClient = class StompQueueClient extends QueueClient { | ||
constructor(options) { | ||
@@ -29,7 +24,15 @@ super(options); | ||
async resolve() { | ||
this.Client = new stompjs_1.Client(Object.assign({ brokerURL: this.Options.host, connectHeaders: { | ||
this.Client = new Stomp.Client({ | ||
brokerURL: this.Options.host, | ||
connectHeaders: { | ||
login: this.Options.login, | ||
passcode: this.Options.password, | ||
'client-id': this.Options.name, | ||
}, reconnectDelay: 5000, heartbeatIncoming: 4000, heartbeatOutgoing: 4000 }, this.Options.options)); | ||
}, | ||
reconnectDelay: 5000, | ||
heartbeatIncoming: 4000, | ||
heartbeatOutgoing: 4000, | ||
// additional options | ||
...this.Options.options, | ||
}); | ||
if (this.Options.debug) { | ||
@@ -42,3 +45,3 @@ this.Client.debug = (str) => { | ||
this.Client.onStompError = (frame) => { | ||
reject(new exceptions_1.UnexpectedServerError(`Cannot connect to queue server at ${this.Options.host}`, frame)); | ||
reject(new UnexpectedServerError(`Cannot connect to queue server at ${this.Options.host}`, frame)); | ||
}; | ||
@@ -68,3 +71,3 @@ this.Client.onConnect = () => { | ||
this.Client.onWebSocketError = (err) => { | ||
reject(new exceptions_1.UnexpectedServerError(`Cannot connect to queue server at ${this.Options.host}, websocket error`, err)); | ||
reject(new UnexpectedServerError(`Cannot connect to queue server at ${this.Options.host}, websocket error`, err)); | ||
}; | ||
@@ -115,3 +118,3 @@ this.Client.activate(); | ||
unsubscribe(channelOrMessage) { | ||
const channels = lodash_1.default.isString(channelOrMessage) ? [channelOrMessage] : this.getChannelForMessage(channelOrMessage); | ||
const channels = _.isString(channelOrMessage) ? [channelOrMessage] : this.getChannelForMessage(channelOrMessage); | ||
channels.forEach((c) => { | ||
@@ -126,3 +129,3 @@ if (!this.Subscriptions.has(c)) { | ||
async subscribe(channelOrMessage, callback, subscriptionId, durable) { | ||
const channels = lodash_1.default.isString(channelOrMessage) ? [channelOrMessage] : this.getChannelForMessage(channelOrMessage); | ||
const channels = _.isString(channelOrMessage) ? [channelOrMessage] : this.getChannelForMessage(channelOrMessage); | ||
channels.forEach((c) => { | ||
@@ -139,3 +142,3 @@ if (this.Subscriptions.has(c)) { | ||
if (!subscriptionId) { | ||
throw new exceptions_1.InvalidArgument(`subscriptionId cannot be empty if using durable subscriptions`); | ||
throw new InvalidArgument(`subscriptionId cannot be empty if using durable subscriptions`); | ||
} | ||
@@ -160,7 +163,7 @@ headers['activemq.subscriptionName'] = subscriptionId; | ||
StompQueueClient = __decorate([ | ||
(0, di_1.PerInstanceCheck)(), | ||
(0, di_1.Injectable)(queue_1.QueueClient), | ||
PerInstanceCheck(), | ||
Injectable(QueueClient), | ||
__metadata("design:paramtypes", [Object]) | ||
], StompQueueClient); | ||
exports.StompQueueClient = StompQueueClient; | ||
export { StompQueueClient }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@spinajs/queue-stomp-transport", | ||
"version": "2.0.46", | ||
"version": "2.0.50", | ||
"description": "simple job transport based on sqlite. Reads & writes jobs to execute in local sqlite database. used for testing & simple projects", | ||
"main": "lib/index.js", | ||
"exports": "./lib/index.js", | ||
"type": "module", | ||
"private": false, | ||
"engines": { | ||
"node": ">=16.11" | ||
}, | ||
"scripts": { | ||
"build": "npm run clean && npm run compile && cpx src/views/**/* lib/views && cpx src/static/**/* lib/static", | ||
"compile": "tsc -p tsconfig.build.json", | ||
"clean": "", | ||
"build": "npm run clean && npm run compile", | ||
"compile": "tsc -b tsconfig.json", | ||
"rimraf": "./node_modules/rimraf/bin.js", | ||
"clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo", | ||
"test": "ts-mocha -p tsconfig.json test/**/*.test.ts", | ||
"coverage": "nyc npm run test", | ||
"build-docs": "rimraf docs && typedoc --options typedoc.json src/", | ||
"prepare": "npm run build", | ||
"format": "prettier --write \"src/**/*.ts\"", | ||
"lint": "eslint -c .eslintrc.js --ext .ts src --fix", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"lint": "eslint -c .eslintrc.cjs --ext .ts src --fix", | ||
"preversion": "npm run lint", | ||
"version": "npm run format && git add -A src", | ||
"postversion": "git push && git push --tags" | ||
"postinstall": "npm run build" | ||
}, | ||
@@ -41,4 +44,4 @@ "files": [ | ||
"devDependencies": { | ||
"@types/luxon": "^2.3.1", | ||
"@types/node": "^16.11.11" | ||
"@types/luxon": "^3.2.0", | ||
"@types/node": "^18.11.18" | ||
}, | ||
@@ -54,3 +57,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "bd560afd6c9a156071102cc6b4f36115b5498e9d" | ||
"gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee" | ||
} |
@@ -0,0 +0,0 @@ # `@spinajs/jobs-orm-connection` |
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
16346
6
173
Yes
1