Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@node-ts/bus-core

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-ts/bus-core - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

4

dist/message-handling-context/message-handling-context.d.ts

@@ -17,2 +17,6 @@ import { Namespace } from 'cls-hooked';

/**
* Executes a function within a context of cls-hooked and returns a promise
*/
runPromise: <T>(fn: () => Promise<T>) => Promise<T>;
/**
* Sets a new handling context for the current execution async id. Child asyncs should

@@ -19,0 +23,0 @@ * only call this if they want to create a new context with themselves at the root.

@@ -21,2 +21,6 @@ "use strict";

/**
* Executes a function within a context of cls-hooked and returns a promise
*/
runPromise: (fn) => namespace.runPromise(fn),
/**
* Sets a new handling context for the current execution async id. Child asyncs should

@@ -23,0 +27,0 @@ * only call this if they want to create a new context with themselves at the root.

2

dist/service-bus/bus-instance.js

@@ -211,3 +211,3 @@ "use strict";

// Run the loop in a cls-hooked namespace to provide the message handling context to all async operations
message_handling_context_1.messageHandlingContext.run(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
yield message_handling_context_1.messageHandlingContext.runPromise(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
while (this.internalState === bus_state_1.BusState.Started) {

@@ -214,0 +214,0 @@ const messageHandled = yield this.handleNextMessage();

@@ -136,3 +136,3 @@ "use strict";

// Extend the current message handling context, and augment with workflow-specific context data
message_handling_context_1.messageHandlingContext.run(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
yield message_handling_context_1.messageHandlingContext.runPromise(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.logger.debug('Starting new workflow instance', {

@@ -193,3 +193,3 @@ workflow: options.workflowCtor,

// Extend the current message handling context, and augment with workflow-specific context data
message_handling_context_1.messageHandlingContext.run(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
yield message_handling_context_1.messageHandlingContext.runPromise(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.startWorkflowHandlingContext(state);

@@ -196,0 +196,0 @@ yield this.dispatchMessageToWorkflow(message, attributes, workflowCtor, state, mapper.workflowStateCtor, handler.workflowHandler, container);

{
"name": "@node-ts/bus-core",
"version": "1.1.3",
"version": "1.1.4",
"description": "A service bus for message-based, distributed node applications",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -21,3 +21,3 @@ import { TransportMessage } from '../transport'

describe('when a message is added', () => {
it('should retrieve the message from within the same context', async () => {
it('should retrieve the message from within the same context', () => {
messageHandlingContext.run(() => {

@@ -32,3 +32,3 @@ const message = buildTransportMessage()

it('should not retrieve a message from a different context', async () => {
messageHandlingContext.run(async () => {
await messageHandlingContext.runPromise(async () => {
const context1 = new Promise<void>(resolve => {

@@ -53,3 +53,3 @@ const message = buildTransportMessage()

it('should retrieve a message from a nested async chain', async () => {
messageHandlingContext.run(async () => {
await messageHandlingContext.runPromise(async () => {
const message = buildTransportMessage()

@@ -56,0 +56,0 @@ messageHandlingContext.set(message)

@@ -25,3 +25,9 @@ import {

run: (fn: (...args: any[]) => void) => namespace.run(fn),
/**
* Executes a function within a context of cls-hooked and returns a promise
*/
runPromise: <T>(fn: () => Promise<T>) => namespace.runPromise(fn),
/**
* Sets a new handling context for the current execution async id. Child asyncs should

@@ -28,0 +34,0 @@ * only call this if they want to create a new context with themselves at the root.

@@ -288,3 +288,3 @@ import { Transport, TransportMessage } from '../transport'

// Run the loop in a cls-hooked namespace to provide the message handling context to all async operations
messageHandlingContext.run(async () => {
await messageHandlingContext.runPromise(async () => {
while (this.internalState === BusState.Started) {

@@ -291,0 +291,0 @@ const messageHandled = await this.handleNextMessage()

@@ -184,3 +184,3 @@ import { WorkflowState, WorkflowStatus } from '../workflow-state'

// Extend the current message handling context, and augment with workflow-specific context data
messageHandlingContext.run(async () => {
await messageHandlingContext.runPromise(async () => {
this.logger.debug('Starting new workflow instance', {

@@ -278,3 +278,3 @@ workflow: options.workflowCtor,

// Extend the current message handling context, and augment with workflow-specific context data
messageHandlingContext.run(async () => {
await messageHandlingContext.runPromise(async () => {
this.startWorkflowHandlingContext(state)

@@ -281,0 +281,0 @@ await this.dispatchMessageToWorkflow(

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