File tree Expand file tree Collapse file tree 6 files changed +56
-50
lines changed Expand file tree Collapse file tree 6 files changed +56
-50
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 2.6.1] - 2025-08-21
9+
10+ - Fix: disable venue header in ws connection
11+
812## [ 2.6.0] - 2025-07-25
913
1014- Feat: device code authorization support
Original file line number Diff line number Diff line change 11{
22 "name" : " @orderingstack/pos-integrator-core" ,
3- "version" : " 2.6.0 " ,
3+ "version" : " 2.6.1 " ,
44 "description" : " Ordering Stack POS integrator core - library for easy developing POS integrations with Ordering Stack platform." ,
55 "scripts" : {
66 "test" : " jest" ,
Original file line number Diff line number Diff line change 1+ import axios from 'axios' ;
2+
3+ export enum AlertSeverity {
4+ DEBUG ,
5+ INFO ,
6+ WARN ,
7+ ERROR ,
8+ CRITICAL ,
9+ }
10+
11+ export async function sendAlertMessage (
12+ accessToken : string ,
13+ message : {
14+ source : string ;
15+ eventName : string ;
16+ severity : AlertSeverity ;
17+ dateTime ?: string ;
18+ user ?: string ;
19+ tenant ?: string ;
20+ orderId ?: string ;
21+ venues ?: string [ ] ;
22+ params ?: Record < string , string > ;
23+ } ,
24+ ) {
25+ if ( ! message . dateTime ) message . dateTime = new Date ( ) . toISOString ( ) ;
26+ try {
27+ const response = await axios . post (
28+ `${ process . env . BASE_URL } /alert-service/message` ,
29+ message ,
30+ {
31+ headers : {
32+ 'Content-Type' : 'application/json' ,
33+ Authorization : `Bearer ${ accessToken } ` ,
34+ } ,
35+ } ,
36+ ) ;
37+ return { data : response . data } ;
38+ } catch ( error ) {
39+ return {
40+ data : null ,
41+ error : error ,
42+ } ;
43+ }
44+ }
Original file line number Diff line number Diff line change @@ -461,46 +461,3 @@ export const checkAndOptionallyAskForCredentials =
461461export async function savePasswordForUser ( user : string , password : string ) {
462462 await keytar . setPassword ( authService . service , user , password ) ;
463463}
464-
465- export enum AlertSeverity {
466- DEBUG ,
467- INFO ,
468- WARN ,
469- ERROR ,
470- CRITICAL ,
471- }
472-
473- export async function sendAlertMessage (
474- accessToken : string ,
475- message : {
476- source : string ;
477- eventName : string ;
478- severity : AlertSeverity ;
479- dateTime ?: string ;
480- user ?: string ;
481- tenant ?: string ;
482- orderId ?: string ;
483- venues ?: string [ ] ;
484- params ?: Record < string , string > ;
485- } ,
486- ) {
487- if ( ! message . dateTime ) message . dateTime = new Date ( ) . toISOString ( ) ;
488- try {
489- const response = await axios . post (
490- `${ process . env . BASE_URL } /alert-service/message` ,
491- message ,
492- {
493- headers : {
494- 'Content-Type' : 'application/json' ,
495- Authorization : `Bearer ${ accessToken } ` ,
496- } ,
497- } ,
498- ) ;
499- return { data : response . data } ;
500- } catch ( error ) {
501- return {
502- data : null ,
503- error : error ,
504- } ;
505- }
506- }
Original file line number Diff line number Diff line change @@ -5,4 +5,5 @@ export * as helpers from './helpers';
55export { orderService } from './orders-service' ;
66export { getOrdersQueue } from './orders-local-queue-service' ;
77export * as productService from './products-service' ;
8+ export * from './alerts' ;
89export { setLogger , logger } from './logger' ;
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ export async function connectWebSockets({
4040 onNotificationAsync,
4141 onSteeringCommandAsync,
4242} : WebsocketConnectParams ) {
43+ const includeVenueHeader = process . env . WS_INCLUDE_VENUE_HEADER === 'true' ;
44+
4345 const stompConfig = {
4446 brokerURL : `${ process . env . BASE_URL } /ws` ,
4547 connectHeaders : {
@@ -79,27 +81,25 @@ export async function connectWebSockets({
7981 } ,
8082 ) ;
8183 if ( onOrdersUpdateAsync ) {
84+ const headers = includeVenueHeader ? { 'x-venue' : venue } : { } ;
8285 var subscriptionForOrdersUpdate = client . subscribe (
8386 `/order-changes/${ tenant } /${ stompConfig . userUUID } ` ,
8487 async function ( data : any ) {
8588 var message = JSON . parse ( data . body ) ;
8689 await onOrdersUpdateAsync ( message ) ;
8790 } ,
88- {
89- 'x-venue' : venue ,
90- } ,
91+ headers ,
9192 ) ;
9293 }
9394 if ( onNotificationAsync ) {
95+ const headers = includeVenueHeader ? { 'x-venue' : venue } : { } ;
9496 var subscriptionForNotifications = client . subscribe (
9597 `/notifications/${ tenant } /${ stompConfig . userUUID } ` ,
9698 async function ( data : any ) {
9799 var message = JSON . parse ( data . body ) ;
98100 await onNotificationAsync ( message ) ;
99101 } ,
100- {
101- 'x-venue' : venue ,
102- } ,
102+ headers ,
103103 ) ;
104104 }
105105 if ( onSteeringCommandAsync ) {
You can’t perform that action at this time.
0 commit comments