serve-socket 1.0.24 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,138 +30,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
30
30
  }] });
31
31
 
32
32
  const defaultRealtimeStoreEnvironment = {
33
- // apiUrl: `http://${window.location.hostname}:3030`,
34
33
  apiUrl: `http://${window.location.hostname}:3030`,
34
+ socketEvents: {}
35
35
  };
36
36
 
37
37
  const REALTIME_STORE_ENVIRONMENT = new InjectionToken('REALTIME_STORE_ENVIRONMENT');
38
38
 
39
- /**
40
- * API Gateway
41
- *
42
- *
43
- *
44
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
45
- * https://openapi-generator.tech
46
- * Do not edit the class manually.
47
- */
48
- var SocketGateways;
49
- (function (SocketGateways) {
50
- SocketGateways.ResponseEnum = {
51
- CustomerCreateCartSuccess: 'customer:create:cart:success',
52
- CustomerRemoveFromCartSuccess: 'customer:remove:from:cart:success',
53
- CustomerGetMenuSuccess: 'customer:get:menu:success',
54
- TableJoinRequestSuccess: 'table:join:request:success',
55
- TableJoinRequestApprovedSuccess: 'table:join:request:approved:success',
56
- ErrorMessageSuccess: 'error:message:success',
57
- SuccessMessageSuccess: 'success:message:success',
58
- WarningMessageSuccess: 'warning:message:success',
59
- AuthCustomerLoginPendingGetSuccess: 'auth:customer:login:pending:get:success',
60
- CustomerUpdateIsPaidSuccess: 'customer:update:is-paid:success',
61
- TableCreatedSuccess: 'table:created:success',
62
- TableAssignedSuccess: 'table:assigned:success',
63
- TableStatusUpdatedSuccess: 'table:status:updated:success',
64
- TableReleasedSuccess: 'table:released:success'
65
- };
66
- SocketGateways.RequestEnum = {
67
- AuthCustomerLogin: 'auth:customer:login',
68
- AuthCustomerLoginReconnect: 'auth:customer:login:reconnect',
69
- PosLogin: 'pos:login',
70
- CustomerGetCart: 'customer:get:cart',
71
- CustomerGetOneCart: 'customer:get-one:cart',
72
- CustomerRemoveFromCart: 'customer:remove:from:cart',
73
- CustomerUpdateCart: 'customer:update:cart',
74
- GetCartByWaiter: 'get:cart:by:waiter',
75
- GetAllCarts: 'get:all:carts',
76
- CustomerGetMenu: 'customer:get:menu',
77
- ErrorMessage: 'error:message',
78
- SuccessMessage: 'success:message',
79
- JoinRoom: 'join:room',
80
- GetTheming: 'get:theming',
81
- CustomerCartItemStatusUpdate: 'customer:cart:item:status:update',
82
- CustomerGetMenuItemReviews: 'customer:get:menu-item:reviews',
83
- CustomerCreateMenuItemReview: 'customer:create:menu-item:review',
84
- CustomerGetRequestsByTable: 'customer:get:requests:by:table',
85
- WaiterGetRequestsByTable: 'waiter:get:requests:by:table',
86
- CustomerCallWaiter: 'customer:call:waiter',
87
- WaiterReceiveCall: 'waiter:receive:call',
88
- WaiterCallAcknowledged: 'waiter:call:acknowledged',
89
- CustomerGetCallWaiterRequests: 'customer:get:call:waiter:requests',
90
- WaiterGetCalls: 'waiter:get:calls',
91
- WaiterGetAvailable: 'waiter:get:available',
92
- WaiterCallCreate: 'waiter:call:create',
93
- WaiterCallResolve: 'waiter:call:resolve',
94
- TableAssignToWaiter: 'table:assign:to:waiter',
95
- AuthCustomerLoginApprove: 'auth:customer:login:approve',
96
- AuthCustomerLoginPendingGet: 'auth:customer:login:pending:get',
97
- AuthCustomerApprovalPendingGetSuccess: 'auth:customer:approval:pending:get:success',
98
- AuthCustomerApprovalPendingGetForWaiter: 'auth:customer:approval:pending:get:for:waiter',
99
- PosLogin2: 'pos:login',
100
- PosValidateBranchCode: 'pos:validate:branch:code',
101
- PosWaiterLogin: 'pos:waiter:login',
102
- WaiterGetTables: 'waiter:get:tables',
103
- WaiterGetLoggedIn: 'waiter:get:logged:in',
104
- TableGetAll: 'table:get:all',
105
- TableCreate: 'table:create',
106
- TableAssign: 'table:assign',
107
- TableUpdateStatus: 'table:update:status',
108
- TableRelease: 'table:release',
109
- WaiterGetTablesDetails: 'waiter:get:tables:details',
110
- TableGetDetails: 'table:get:details',
111
- PosWaiterCreate: 'pos:waiter:create'
112
- };
113
- })(SocketGateways || (SocketGateways = {}));
114
-
115
- // Define string constants instead of enum to avoid type errors with string values
116
- const SocketEvents = {
117
- CUSTOMER_CONNECT: SocketGateways.RequestEnum.AuthCustomerLogin,
118
- CUSTOMER_RECONNECT: SocketGateways.RequestEnum.AuthCustomerLoginReconnect,
119
- CUSTOMER_GET_CART: SocketGateways.RequestEnum.CustomerGetCart,
120
- CUSTOMER_GET_ONE_CART: SocketGateways.RequestEnum.CustomerGetOneCart,
121
- CUSTOMER_REMOVE_FROM_CART: SocketGateways.RequestEnum.CustomerRemoveFromCart,
122
- CUSTOMER_CREATE_UPDATE_CART: SocketGateways.RequestEnum.CustomerUpdateCart,
123
- CUSTOMER_GET_MENU: SocketGateways.RequestEnum.CustomerGetMenu,
124
- ERROR_MESSAGE: SocketGateways.RequestEnum.ErrorMessage,
125
- SUCCESS_MESSAGE: SocketGateways.RequestEnum.SuccessMessage,
126
- JOIN_ROOM: SocketGateways.RequestEnum.JoinRoom,
127
- GET_THEMING: SocketGateways.RequestEnum.GetTheming,
128
- CUSTOMER_CART_ITEM_STATUS_UPDATE: SocketGateways.RequestEnum.CustomerCartItemStatusUpdate,
129
- CUSTOMER_GET_MENU_ITEM_REVIEWS: SocketGateways.RequestEnum.CustomerGetMenuItemReviews,
130
- CUSTOMER_CREATE_MENU_ITEM_REVIEW: SocketGateways.RequestEnum.CustomerCreateMenuItemReview,
131
- CUSTOMER_GET_REQUESTS_BY_TABLE: SocketGateways.RequestEnum.CustomerGetRequestsByTable,
132
- WAITER_GET_REQUESTS_BY_TABLE: SocketGateways.RequestEnum.WaiterGetRequestsByTable,
133
- CUSTOMER_CALL_WAITER: SocketGateways.RequestEnum.CustomerCallWaiter,
134
- WAITER_RECEIVE_CALL: SocketGateways.RequestEnum.WaiterReceiveCall,
135
- WAITER_CALL_ACKNOWLEDGED: SocketGateways.RequestEnum.WaiterCallAcknowledged,
136
- CUSTOMER_GET_CALL_WAITER_REQUESTS: SocketGateways.RequestEnum.CustomerGetCallWaiterRequests,
137
- APPROVE_CUSTOMER_LOGIN: SocketGateways.RequestEnum.AuthCustomerLoginApprove,
138
- GET_PENDING_CUSTOMER_LOGINS: SocketGateways.RequestEnum.AuthCustomerLoginPendingGet,
139
- POS_LOGIN: SocketGateways.RequestEnum.PosLogin,
140
- GET_ALL_TABLES: SocketGateways.RequestEnum.TableGetAll,
141
- CREATE_TABLE: SocketGateways.RequestEnum.TableCreate,
142
- ASSIGN_TABLE: SocketGateways.RequestEnum.TableAssign,
143
- UPDATE_TABLE_STATUS: SocketGateways.RequestEnum.TableUpdateStatus,
144
- RELEASE_TABLE: SocketGateways.RequestEnum.TableRelease
145
- };
146
- const SocketSuccessEvents = {
147
- // Map to SocketGateways.ResponseEnum
148
- CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS: SocketGateways.ResponseEnum.CustomerCreateCartSuccess,
149
- CUSTOMER_REMOVE_FROM_CART_SUCCESS: SocketGateways.ResponseEnum.CustomerRemoveFromCartSuccess,
150
- CUSTOMER_GET_MENU_SUCCESS: SocketGateways.ResponseEnum.CustomerGetMenuSuccess,
151
- TABLE_JOIN_REQUEST_SENT_SUCCESS: SocketGateways.ResponseEnum.TableJoinRequestSuccess,
152
- TABLE_JOIN_REQUEST_APPROVED_SUCCESS: SocketGateways.ResponseEnum.TableJoinRequestApprovedSuccess,
153
- ERROR_MESSAGE_SUCCESS: SocketGateways.ResponseEnum.ErrorMessageSuccess,
154
- SUCCESS_MESSAGE_SUCCESS: SocketGateways.ResponseEnum.SuccessMessageSuccess,
155
- WARNING_MESSAGE_SUCCESS: SocketGateways.ResponseEnum.WarningMessageSuccess,
156
- GET_PENDING_CUSTOMER_LOGINS_SUCCESS: SocketGateways.ResponseEnum.AuthCustomerLoginPendingGetSuccess,
157
- CUSTOMER_UPDATE_IS_PAID_SUCCESS: SocketGateways.ResponseEnum.CustomerUpdateIsPaidSuccess,
158
- TABLE_CREATED: SocketGateways.ResponseEnum.TableCreatedSuccess,
159
- TABLE_ASSIGNED: SocketGateways.ResponseEnum.TableAssignedSuccess,
160
- TABLE_STATUS_UPDATED: SocketGateways.ResponseEnum.TableStatusUpdatedSuccess,
161
- TABLE_RELEASED: SocketGateways.ResponseEnum.TableReleasedSuccess,
162
- // Add WAITER_RECEIVE_CALL which appears to be missing from the ResponseEnum
163
- WAITER_RECEIVE_CALL: 'waiter:receive:call'
164
- };
39
+ var SocketSuccessEventKeys;
40
+ (function (SocketSuccessEventKeys) {
41
+ SocketSuccessEventKeys["CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS"] = "CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS";
42
+ SocketSuccessEventKeys["CUSTOMER_REMOVE_FROM_CART_SUCCESS"] = "CUSTOMER_REMOVE_FROM_CART_SUCCESS";
43
+ SocketSuccessEventKeys["CUSTOMER_GET_MENU_SUCCESS"] = "CUSTOMER_GET_MENU_SUCCESS";
44
+ SocketSuccessEventKeys["TABLE_JOIN_REQUEST_SENT_SUCCESS"] = "TABLE_JOIN_REQUEST_SENT_SUCCESS";
45
+ SocketSuccessEventKeys["TABLE_JOIN_REQUEST_APPROVED_SUCCESS"] = "TABLE_JOIN_REQUEST_APPROVED_SUCCESS";
46
+ SocketSuccessEventKeys["ERROR_MESSAGE_SUCCESS"] = "ERROR_MESSAGE_SUCCESS";
47
+ SocketSuccessEventKeys["SUCCESS_MESSAGE_SUCCESS"] = "SUCCESS_MESSAGE_SUCCESS";
48
+ SocketSuccessEventKeys["WARNING_MESSAGE_SUCCESS"] = "WARNING_MESSAGE_SUCCESS";
49
+ SocketSuccessEventKeys["GET_PENDING_CUSTOMER_LOGINS_SUCCESS"] = "GET_PENDING_CUSTOMER_LOGINS_SUCCESS";
50
+ SocketSuccessEventKeys["CUSTOMER_UPDATE_IS_PAID_SUCCESS"] = "CUSTOMER_UPDATE_IS_PAID_SUCCESS";
51
+ SocketSuccessEventKeys["TABLE_CREATED"] = "TABLE_CREATED";
52
+ SocketSuccessEventKeys["TABLE_ASSIGNED"] = "TABLE_ASSIGNED";
53
+ SocketSuccessEventKeys["TABLE_STATUS_UPDATED"] = "TABLE_STATUS_UPDATED";
54
+ SocketSuccessEventKeys["TABLE_RELEASED"] = "TABLE_RELEASED";
55
+ SocketSuccessEventKeys["WAITER_RECEIVE_CALL"] = "WAITER_RECEIVE_CALL";
56
+ })(SocketSuccessEventKeys || (SocketSuccessEventKeys = {}));
57
+ ;
58
+ const SocketSuccessEvents = {};
165
59
  class SocketService {
166
60
  environment;
167
61
  socket;
@@ -176,6 +70,13 @@ class SocketService {
176
70
  constructor(environment = defaultRealtimeStoreEnvironment) {
177
71
  this.environment = environment;
178
72
  this.url = this.environment.apiUrl;
73
+ // Populate SocketSuccessEvents from environment configuration
74
+ if (this.environment.socketEvents) {
75
+ Object.keys(SocketSuccessEventKeys).forEach(key => {
76
+ const eventKey = key;
77
+ SocketSuccessEvents[eventKey] = this.environment.socketEvents[eventKey];
78
+ });
79
+ }
179
80
  }
180
81
  setupSocketConnection() {
181
82
  const socketOptions = {
@@ -372,22 +273,19 @@ class BaseStore {
372
273
  console.log('setting', items);
373
274
  this.dataSubject.next(items);
374
275
  }
375
- addItem(item) {
376
- console.log('adding', item);
377
- const currentItems = this.dataSubject.value;
378
- this.dataSubject.next([...currentItems, item]);
379
- }
380
- updateItem(updatedItem, idField) {
276
+ updateItem(updatedItem) {
381
277
  console.log('updating', updatedItem);
382
278
  const currentItems = this.dataSubject.value;
279
+ const idField = 'id';
383
280
  const updatedItems = currentItems.map(item => item[idField] === updatedItem[idField]
384
281
  ? { ...item, ...updatedItem }
385
282
  : item);
386
283
  this.dataSubject.next(updatedItems);
387
284
  }
388
- removeItem(id, idField) {
285
+ removeItem(id) {
389
286
  console.log('removing', id);
390
287
  const currentItems = this.dataSubject.value;
288
+ const idField = 'id';
391
289
  const filteredItems = currentItems.filter(item => item[idField] !== id);
392
290
  this.dataSubject.next(filteredItems);
393
291
  }
@@ -404,8 +302,8 @@ class BaseStore {
404
302
  getAll() {
405
303
  return this.dataSubject.value;
406
304
  }
407
- getById(id, idField) {
408
- const field = idField || 'id';
305
+ getById(id) {
306
+ const field = 'id';
409
307
  return this.dataSubject.value.find(item => item[field] === id);
410
308
  }
411
309
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: BaseStore, deps: [{ token: SocketService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -422,10 +320,10 @@ class TableStore extends BaseStore {
422
320
  this.socketService = socketService;
423
321
  }
424
322
  setupSocketSubscriptions() {
425
- this.subscribeToEvent(SocketSuccessEvents.TABLE_CREATED, (table) => this.addItem(table));
426
- this.subscribeToEvent(SocketSuccessEvents.TABLE_ASSIGNED, (table) => this.updateItem(table, 'id'));
427
- this.subscribeToEvent(SocketSuccessEvents.TABLE_STATUS_UPDATED, (table) => this.updateItem(table, 'id'));
428
- this.subscribeToEvent(SocketSuccessEvents.TABLE_RELEASED, (table) => this.updateItem(table, 'id'));
323
+ this.subscribeToEvent(SocketSuccessEvents.TABLE_CREATED, (table) => this.updateItem(table));
324
+ this.subscribeToEvent(SocketSuccessEvents.TABLE_ASSIGNED, (table) => this.updateItem(table));
325
+ this.subscribeToEvent(SocketSuccessEvents.TABLE_STATUS_UPDATED, (table) => this.updateItem(table));
326
+ this.subscribeToEvent(SocketSuccessEvents.TABLE_RELEASED, (table) => this.updateItem(table));
429
327
  }
430
328
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStore, deps: [{ token: SocketService }], target: i0.ɵɵFactoryTarget.Injectable });
431
329
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStore });
@@ -441,9 +339,9 @@ class CartStore extends BaseStore {
441
339
  this.socketService = socketService;
442
340
  }
443
341
  setupSocketSubscriptions() {
444
- this.subscribeToEvent(SocketSuccessEvents.CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS, (cart) => this.updateItem(cart, 'id'));
342
+ this.subscribeToEvent(SocketSuccessEvents.CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS, (cart) => this.updateItem(cart));
445
343
  this.subscribeToEvent(SocketSuccessEvents.CUSTOMER_REMOVE_FROM_CART_SUCCESS, (data) => {
446
- this.removeItem(data.cartId, 'id');
344
+ this.removeItem(data.cartId);
447
345
  });
448
346
  }
449
347
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CartStore, deps: [{ token: SocketService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -453,37 +351,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
453
351
  type: Injectable
454
352
  }], ctorParameters: () => [{ type: SocketService }] });
455
353
 
456
- class MenuStore extends BaseStore {
457
- socketService;
458
- menuGroups$ = new BehaviorSubject([]);
459
- allMenuItems = [];
460
- constructor(socketService) {
461
- super(socketService);
462
- this.socketService = socketService;
463
- }
464
- setupSocketSubscriptions() {
465
- this.subscribeToEvent(SocketSuccessEvents.CUSTOMER_GET_MENU_SUCCESS, (menuItems) => this.updateItems(menuItems));
466
- }
467
- async getMenu(branchId) {
468
- this.socketService.emit(SocketEvents.CUSTOMER_GET_MENU, { branchId });
469
- }
470
- async getMenuItemReviews(menuItemId) {
471
- this.socketService.emit(SocketEvents.CUSTOMER_GET_MENU_ITEM_REVIEWS, { menuItemId });
472
- }
473
- async createMenuItemReview(menuItemId, rating, comment) {
474
- this.socketService.emit(SocketEvents.CUSTOMER_CREATE_MENU_ITEM_REVIEW, {
475
- menuItemId,
476
- rating,
477
- comment
478
- });
479
- }
480
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: MenuStore, deps: [{ token: SocketService }], target: i0.ɵɵFactoryTarget.Injectable });
481
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: MenuStore });
482
- }
483
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: MenuStore, decorators: [{
484
- type: Injectable
485
- }], ctorParameters: () => [{ type: SocketService }] });
486
-
487
354
  class CallWaiterStore extends BaseStore {
488
355
  socketService;
489
356
  constructor(socketService) {
@@ -491,7 +358,7 @@ class CallWaiterStore extends BaseStore {
491
358
  this.socketService = socketService;
492
359
  }
493
360
  setupSocketSubscriptions() {
494
- this.subscribeToEvent(SocketSuccessEvents.WAITER_RECEIVE_CALL, (request) => this.addItem(request));
361
+ this.subscribeToEvent(SocketSuccessEvents.WAITER_RECEIVE_CALL, (request) => this.updateItem(request));
495
362
  }
496
363
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CallWaiterStore, deps: [{ token: SocketService }], target: i0.ɵɵFactoryTarget.Injectable });
497
364
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CallWaiterStore });
@@ -509,9 +376,6 @@ class CustomerLoginStore extends BaseStore {
509
376
  setupSocketSubscriptions() {
510
377
  this.subscribeToEvent(SocketSuccessEvents.GET_PENDING_CUSTOMER_LOGINS_SUCCESS, (logins) => this.updateItems(logins));
511
378
  }
512
- getPendingLogins() {
513
- this.socketService.emit(SocketEvents.GET_PENDING_CUSTOMER_LOGINS);
514
- }
515
379
  async approveCustomerLogin(customerId, tableId, customerAuthControllerApproveCustomerLogin) {
516
380
  const approveData = {
517
381
  customerId,
@@ -519,7 +383,7 @@ class CustomerLoginStore extends BaseStore {
519
383
  };
520
384
  try {
521
385
  await firstValueFrom(customerAuthControllerApproveCustomerLogin(approveData));
522
- this.removeItem(customerId, 'id');
386
+ this.removeItem(customerId);
523
387
  }
524
388
  catch (error) {
525
389
  console.error(`Failed to approve customer login for ${customerId}:`, error);
@@ -567,5 +431,5 @@ function provideRealtimeStoreEnvironment(environment) {
567
431
  * Generated bundle index. Do not edit.
568
432
  */
569
433
 
570
- export { BaseStore, CallWaiterStore, CartStore, CustomerLoginStore, MenuStore, REALTIME_STORE_ENVIRONMENT, RealtimeStoreModule, SocketEvents, SocketService, SocketSuccessEvents, TableStore, defaultRealtimeStoreEnvironment, provideRealtimeStore, provideRealtimeStoreEnvironment };
434
+ export { BaseStore, CallWaiterStore, CartStore, CustomerLoginStore, REALTIME_STORE_ENVIRONMENT, RealtimeStoreModule, SocketService, SocketSuccessEventKeys, SocketSuccessEvents, TableStore, defaultRealtimeStoreEnvironment, provideRealtimeStore, provideRealtimeStoreEnvironment };
571
435
  //# sourceMappingURL=serve-socket.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve-socket.mjs","sources":["../../../projects/serve-socket/src/lib/realtime-store.module.ts","../../../projects/serve-socket/src/lib/environment/realtime-store-environment.interface.ts","../../../projects/serve-socket/src/lib/environment/realtime-store-environment.token.ts","../../../projects/serve-socket/src/lib/model/socketGateways.ts","../../../projects/serve-socket/src/lib/socket.service.ts","../../../projects/serve-socket/src/lib/base-store.ts","../../../projects/serve-socket/src/lib/stores/table.store.ts","../../../projects/serve-socket/src/lib/stores/cart.store.ts","../../../projects/serve-socket/src/lib/stores/menu.store.ts","../../../projects/serve-socket/src/lib/stores/call-waiter.store.ts","../../../projects/serve-socket/src/lib/stores/customer-login.store.ts","../../../projects/serve-socket/src/lib/providers.ts","../../../projects/serve-socket/src/lib/providers/realtime-store-environment.provider.ts","../../../projects/serve-socket/src/public-api.ts","../../../projects/serve-socket/src/serve-socket.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\n\n/**\n * @deprecated Use provideRealtimeStore() with standalone components instead\n */\n@NgModule({\n declarations: [],\n imports: [\n CommonModule,\n HttpClientModule // Kept for backward compatibility with Angular <14\n ],\n exports: []\n})\nexport class RealtimeStoreModule { }\n","export interface RealtimeStoreEnvironment {\n apiUrl: string;\n}\n\nexport const defaultRealtimeStoreEnvironment: RealtimeStoreEnvironment = {\n // apiUrl: `http://${window.location.hostname}:3030`,\n apiUrl: `http://${window.location.hostname}:3030`,\n};","import { InjectionToken } from '@angular/core';\nimport { RealtimeStoreEnvironment } from './realtime-store-environment.interface';\n\nexport const REALTIME_STORE_ENVIRONMENT = new InjectionToken<RealtimeStoreEnvironment>('REALTIME_STORE_ENVIRONMENT');","/**\n * API Gateway\n *\n * \n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nexport interface SocketGateways { \n /**\n * All possible socket success events emitted by the server\n */\n response: SocketGateways.ResponseEnum;\n /**\n * Auth message patterns for the socket gateway\n */\n request: SocketGateways.RequestEnum;\n}\nexport namespace SocketGateways {\n export const ResponseEnum = {\n CustomerCreateCartSuccess: 'customer:create:cart:success',\n CustomerRemoveFromCartSuccess: 'customer:remove:from:cart:success',\n CustomerGetMenuSuccess: 'customer:get:menu:success',\n TableJoinRequestSuccess: 'table:join:request:success',\n TableJoinRequestApprovedSuccess: 'table:join:request:approved:success',\n ErrorMessageSuccess: 'error:message:success',\n SuccessMessageSuccess: 'success:message:success',\n WarningMessageSuccess: 'warning:message:success',\n AuthCustomerLoginPendingGetSuccess: 'auth:customer:login:pending:get:success',\n CustomerUpdateIsPaidSuccess: 'customer:update:is-paid:success',\n TableCreatedSuccess: 'table:created:success',\n TableAssignedSuccess: 'table:assigned:success',\n TableStatusUpdatedSuccess: 'table:status:updated:success',\n TableReleasedSuccess: 'table:released:success'\n } as const;\n export type ResponseEnum = typeof ResponseEnum[keyof typeof ResponseEnum];\n export const RequestEnum = {\n AuthCustomerLogin: 'auth:customer:login',\n AuthCustomerLoginReconnect: 'auth:customer:login:reconnect',\n PosLogin: 'pos:login',\n CustomerGetCart: 'customer:get:cart',\n CustomerGetOneCart: 'customer:get-one:cart',\n CustomerRemoveFromCart: 'customer:remove:from:cart',\n CustomerUpdateCart: 'customer:update:cart',\n GetCartByWaiter: 'get:cart:by:waiter',\n GetAllCarts: 'get:all:carts',\n CustomerGetMenu: 'customer:get:menu',\n ErrorMessage: 'error:message',\n SuccessMessage: 'success:message',\n JoinRoom: 'join:room',\n GetTheming: 'get:theming',\n CustomerCartItemStatusUpdate: 'customer:cart:item:status:update',\n CustomerGetMenuItemReviews: 'customer:get:menu-item:reviews',\n CustomerCreateMenuItemReview: 'customer:create:menu-item:review',\n CustomerGetRequestsByTable: 'customer:get:requests:by:table',\n WaiterGetRequestsByTable: 'waiter:get:requests:by:table',\n CustomerCallWaiter: 'customer:call:waiter',\n WaiterReceiveCall: 'waiter:receive:call',\n WaiterCallAcknowledged: 'waiter:call:acknowledged',\n CustomerGetCallWaiterRequests: 'customer:get:call:waiter:requests',\n WaiterGetCalls: 'waiter:get:calls',\n WaiterGetAvailable: 'waiter:get:available',\n WaiterCallCreate: 'waiter:call:create',\n WaiterCallResolve: 'waiter:call:resolve',\n TableAssignToWaiter: 'table:assign:to:waiter',\n AuthCustomerLoginApprove: 'auth:customer:login:approve',\n AuthCustomerLoginPendingGet: 'auth:customer:login:pending:get',\n AuthCustomerApprovalPendingGetSuccess: 'auth:customer:approval:pending:get:success',\n AuthCustomerApprovalPendingGetForWaiter: 'auth:customer:approval:pending:get:for:waiter',\n PosLogin2: 'pos:login',\n PosValidateBranchCode: 'pos:validate:branch:code',\n PosWaiterLogin: 'pos:waiter:login',\n WaiterGetTables: 'waiter:get:tables',\n WaiterGetLoggedIn: 'waiter:get:logged:in',\n TableGetAll: 'table:get:all',\n TableCreate: 'table:create',\n TableAssign: 'table:assign',\n TableUpdateStatus: 'table:update:status',\n TableRelease: 'table:release',\n WaiterGetTablesDetails: 'waiter:get:tables:details',\n TableGetDetails: 'table:get:details',\n PosWaiterCreate: 'pos:waiter:create'\n } as const;\n export type RequestEnum = typeof RequestEnum[keyof typeof RequestEnum];\n}\n\n\n","import { Injectable, Inject } from '@angular/core';\nimport { BehaviorSubject, Observable, Subject } from 'rxjs';\nimport { io, Socket } from 'socket.io-client';\n// import { SocketGateways } from '@serve-plus/client-api';\nimport { REALTIME_STORE_ENVIRONMENT, RealtimeStoreEnvironment, defaultRealtimeStoreEnvironment } from './environment';\nimport { SocketGateways } from './model/socketGateways';\n\n// Define string constants instead of enum to avoid type errors with string values\nexport const SocketEvents = {\n CUSTOMER_CONNECT: SocketGateways.RequestEnum.AuthCustomerLogin,\n CUSTOMER_RECONNECT: SocketGateways.RequestEnum.AuthCustomerLoginReconnect,\n CUSTOMER_GET_CART: SocketGateways.RequestEnum.CustomerGetCart,\n CUSTOMER_GET_ONE_CART: SocketGateways.RequestEnum.CustomerGetOneCart,\n CUSTOMER_REMOVE_FROM_CART: SocketGateways.RequestEnum.CustomerRemoveFromCart,\n CUSTOMER_CREATE_UPDATE_CART: SocketGateways.RequestEnum.CustomerUpdateCart,\n CUSTOMER_GET_MENU: SocketGateways.RequestEnum.CustomerGetMenu,\n ERROR_MESSAGE: SocketGateways.RequestEnum.ErrorMessage,\n SUCCESS_MESSAGE: SocketGateways.RequestEnum.SuccessMessage,\n JOIN_ROOM: SocketGateways.RequestEnum.JoinRoom,\n GET_THEMING: SocketGateways.RequestEnum.GetTheming,\n CUSTOMER_CART_ITEM_STATUS_UPDATE: SocketGateways.RequestEnum.CustomerCartItemStatusUpdate,\n CUSTOMER_GET_MENU_ITEM_REVIEWS: SocketGateways.RequestEnum.CustomerGetMenuItemReviews,\n CUSTOMER_CREATE_MENU_ITEM_REVIEW: SocketGateways.RequestEnum.CustomerCreateMenuItemReview,\n CUSTOMER_GET_REQUESTS_BY_TABLE: SocketGateways.RequestEnum.CustomerGetRequestsByTable,\n WAITER_GET_REQUESTS_BY_TABLE: SocketGateways.RequestEnum.WaiterGetRequestsByTable,\n CUSTOMER_CALL_WAITER: SocketGateways.RequestEnum.CustomerCallWaiter,\n WAITER_RECEIVE_CALL: SocketGateways.RequestEnum.WaiterReceiveCall,\n WAITER_CALL_ACKNOWLEDGED: SocketGateways.RequestEnum.WaiterCallAcknowledged,\n CUSTOMER_GET_CALL_WAITER_REQUESTS: SocketGateways.RequestEnum.CustomerGetCallWaiterRequests,\n APPROVE_CUSTOMER_LOGIN: SocketGateways.RequestEnum.AuthCustomerLoginApprove,\n GET_PENDING_CUSTOMER_LOGINS: SocketGateways.RequestEnum.AuthCustomerLoginPendingGet,\n POS_LOGIN: SocketGateways.RequestEnum.PosLogin,\n GET_ALL_TABLES: SocketGateways.RequestEnum.TableGetAll,\n CREATE_TABLE: SocketGateways.RequestEnum.TableCreate,\n ASSIGN_TABLE: SocketGateways.RequestEnum.TableAssign,\n UPDATE_TABLE_STATUS: SocketGateways.RequestEnum.TableUpdateStatus,\n RELEASE_TABLE: SocketGateways.RequestEnum.TableRelease\n};\n\nexport const SocketSuccessEvents = {\n // Map to SocketGateways.ResponseEnum\n CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS: SocketGateways.ResponseEnum.CustomerCreateCartSuccess,\n CUSTOMER_REMOVE_FROM_CART_SUCCESS: SocketGateways.ResponseEnum.CustomerRemoveFromCartSuccess,\n CUSTOMER_GET_MENU_SUCCESS: SocketGateways.ResponseEnum.CustomerGetMenuSuccess,\n TABLE_JOIN_REQUEST_SENT_SUCCESS: SocketGateways.ResponseEnum.TableJoinRequestSuccess,\n TABLE_JOIN_REQUEST_APPROVED_SUCCESS: SocketGateways.ResponseEnum.TableJoinRequestApprovedSuccess,\n ERROR_MESSAGE_SUCCESS: SocketGateways.ResponseEnum.ErrorMessageSuccess,\n SUCCESS_MESSAGE_SUCCESS: SocketGateways.ResponseEnum.SuccessMessageSuccess,\n WARNING_MESSAGE_SUCCESS: SocketGateways.ResponseEnum.WarningMessageSuccess,\n GET_PENDING_CUSTOMER_LOGINS_SUCCESS: SocketGateways.ResponseEnum.AuthCustomerLoginPendingGetSuccess,\n CUSTOMER_UPDATE_IS_PAID_SUCCESS: SocketGateways.ResponseEnum.CustomerUpdateIsPaidSuccess,\n TABLE_CREATED: SocketGateways.ResponseEnum.TableCreatedSuccess,\n TABLE_ASSIGNED: SocketGateways.ResponseEnum.TableAssignedSuccess,\n TABLE_STATUS_UPDATED: SocketGateways.ResponseEnum.TableStatusUpdatedSuccess,\n TABLE_RELEASED: SocketGateways.ResponseEnum.TableReleasedSuccess,\n\n // Add WAITER_RECEIVE_CALL which appears to be missing from the ResponseEnum\n WAITER_RECEIVE_CALL: 'waiter:receive:call'\n};\n\n\n@Injectable()\nexport class SocketService {\n private socket!: Socket;\n private url: string;\n private authToken?: string;\n private connectionKey?: string;\n private eventSubjects = new Map<string, Subject<any>>();\n\n private connectionStatusSubject = new BehaviorSubject<boolean>(false);\n public connectionStatus$ = this.connectionStatusSubject.asObservable();\n\n private reconnectSubject = new Subject<void>();\n public reconnect$ = this.reconnectSubject.asObservable();\n\n constructor(\n @Inject(REALTIME_STORE_ENVIRONMENT) private environment: RealtimeStoreEnvironment = defaultRealtimeStoreEnvironment\n ) {\n this.url = this.environment.apiUrl;\n }\n\n private setupSocketConnection(): void {\n const socketOptions: any = {\n transports: ['websocket'],\n autoConnect: true\n };\n\n // Add auth if token is available\n if (this.authToken) {\n socketOptions.auth = {\n token: this.authToken\n };\n }\n\n this.socket = io(this.url, socketOptions);\n\n this.socket.on('connect', () => {\n console.log('Socket connected');\n this.connectionStatusSubject.next(true);\n this.reestablishListeners();\n });\n\n this.socket.on('disconnect', () => {\n console.log('Socket disconnected');\n this.connectionStatusSubject.next(false);\n });\n\n this.socket.on('reconnect', () => {\n console.log('Socket reconnected');\n this.connectionStatusSubject.next(true);\n this.reconnectSubject.next();\n this.reestablishListeners();\n });\n\n this.socket.on('connect_error', (err) => {\n console.error('Connection error:', err.message);\n });\n\n this.socket.on('reconnect_error', (err) => {\n console.error('Reconnection error:', err.message);\n });\n }\n\n private reestablishListeners(): void {\n console.log('Re-establishing listeners for', this.eventSubjects.size, 'events');\n this.eventSubjects.forEach((subject, eventName) => {\n this.socket.on(eventName, (data) => {\n subject.next(data);\n });\n });\n }\n\n /**\n * Set authentication token for socket connection\n */\n public setAuthToken(token: string): void {\n this.authToken = token;\n }\n\n /**\n * Set connection key for socket connection\n */\n public setConnectionKey(key: string): void {\n this.connectionKey = key;\n }\n\n /**\n * Reset connection with new token\n */\n public resetWithNewToken(token?: string): void {\n if (token) {\n this.authToken = token;\n }\n\n if (this.socket) {\n this.socket.disconnect();\n }\n\n this.setupSocketConnection();\n }\n\n public connect(): Promise<void> {\n return new Promise((resolve) => {\n this.setupSocketConnection();\n\n if (this.socket.connected) {\n resolve();\n return;\n }\n\n // Wait for the connect event and verify connection\n this.socket.once('connect', () => {\n // Poll until socket.connected is true\n const checkConnection = () => {\n if (this.socket.connected) {\n resolve();\n } else {\n setTimeout(checkConnection, 10);\n }\n };\n checkConnection();\n });\n\n if (!this.socket.connected) {\n this.socket.connect();\n }\n });\n }\n\n public disconnect(): void {\n if (this.socket && this.socket.connected) {\n this.socket.disconnect();\n }\n }\n\n /**\n * Emit event with optional authentication headers\n */\n public emit(event: string, data?: any): void {\n if (!this.socket || this.socket.disconnected) {\n console.warn('Socket not connected. Call connect() first.');\n return;\n }\n\n // If auth token or connection key exists, wrap data with headers\n if (this.authToken || this.connectionKey) {\n const payload = {\n payload: data || {},\n headers: {\n ...(this.authToken && { _authToken: this.authToken }),\n ...(this.connectionKey && { connectionKey: this.connectionKey })\n }\n };\n this.socket.emit(event, payload);\n } else {\n this.socket.emit(event, data);\n }\n }\n\n /**\n * Listen to events with persistent subjects that survive reconnections\n */\n public on<T>(event: string): Observable<T> {\n if (!this.eventSubjects.has(event)) {\n const subject = new Subject<T>();\n this.eventSubjects.set(event, subject);\n\n // Set up initial listener if socket is connected\n if (this.socket && this.socket.connected) {\n this.socket.on(event, (data: T) => {\n subject.next(data);\n });\n }\n }\n\n return this.eventSubjects.get(event)!.asObservable();\n }\n\n /**\n * Listen to event once and return as Promise\n */\n public once<T>(event: string): Promise<T> {\n if (!this.socket || this.socket.disconnected) {\n return Promise.reject(new Error('Socket not connected. Call connect() first.'));\n }\n\n return new Promise((resolve) => {\n this.socket.once(event, (data: T) => {\n resolve(data);\n });\n });\n }\n}\n\n","import { BehaviorSubject, Observable } from 'rxjs';\nimport { SocketService } from './socket.service';\nimport { Injectable } from '@angular/core';\n\n@Injectable()\nexport abstract class BaseStore<T> {\n protected dataSubject = new BehaviorSubject<T[]>([]);\n public data$: Observable<T[]> = this.dataSubject.asObservable();\n\n protected loadingSubject = new BehaviorSubject<boolean>(false);\n public loading$: Observable<boolean> = this.loadingSubject.asObservable();\n\n protected errorSubject = new BehaviorSubject<string | null>(null);\n public error$: Observable<string | null> = this.errorSubject.asObservable();\n\n constructor(\n protected socketService: SocketService\n ) {\n this.initialize().then(() => { });\n }\n\n private async initialize(): Promise<void> {\n await this.delayPreloadUntil();\n this.setupSocketSubscriptions();\n this.refresh();\n\n this.socketService.reconnect$.subscribe(async () => {\n await this.delayPreloadUntil();\n this.refresh();\n });\n }\n\n private refresh() {\n this.preload().then(x => this.dataSubject.next(x));\n }\n\n // Abstract methods to be implemented by specific stores\n public abstract preload(): Promise<T[]>;\n\n protected abstract setupSocketSubscriptions(): void;\n\n /**\n * Hook subclasses can override to delay initial preload and reconnect refreshes.\n * By default it resolves immediately. Subclasses that need to wait for authentication\n * can override this to await their auth observable (e.g. wait for authenticatedUser$).\n */\n protected async delayPreloadUntil(): Promise<void> {\n return Promise.resolve();\n }\n\n // Helper methods for stores\n protected updateItems(items: T[]): void {\n console.log('setting', items);\n\n this.dataSubject.next(items);\n }\n\n protected addItem(item: T): void {\n console.log('adding', item);\n const currentItems = this.dataSubject.value;\n this.dataSubject.next([...currentItems, item]);\n }\n\n protected updateItem(updatedItem: Partial<T>, idField: keyof T): void {\n console.log('updating', updatedItem);\n\n const currentItems = this.dataSubject.value;\n const updatedItems = currentItems.map(item =>\n item[idField] === updatedItem[idField]\n ? { ...item, ...updatedItem }\n : item\n );\n this.dataSubject.next(updatedItems);\n }\n\n protected removeItem(id: any, idField: keyof T): void {\n console.log('removing', id);\n\n const currentItems = this.dataSubject.value;\n const filteredItems = currentItems.filter(item => item[idField] !== id);\n this.dataSubject.next(filteredItems);\n }\n\n protected setLoading(isLoading: boolean): void {\n this.loadingSubject.next(isLoading);\n }\n\n protected setError(error: string | null): void {\n this.errorSubject.next(error);\n }\n\n // Helper to subscribe to socket events with typesafety\n protected subscribeToEvent<R>(\n event: string,\n handler: (data: R) => void\n ): void {\n this.socketService.on<R>(event).subscribe(handler);\n }\n\n getAll(): T[] {\n return this.dataSubject.value;\n }\n\n getById(id: any, idField?: keyof T): T | undefined {\n const field = idField || ('id' as keyof T);\n return this.dataSubject.value.find(item => item[field] === id);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseStore } from '../base-store';\nimport { SocketService, SocketSuccessEvents } from '../socket.service';\nimport { TableResponseDto } from '../model/tableResponseDto';\n\n@Injectable()\nexport abstract class TableStore extends BaseStore<TableResponseDto> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<TableResponseDto>(\n SocketSuccessEvents.TABLE_CREATED,\n (table) => this.addItem(table)\n );\n\n this.subscribeToEvent<TableResponseDto>(\n SocketSuccessEvents.TABLE_ASSIGNED,\n (table) => this.updateItem(table, 'id')\n );\n\n this.subscribeToEvent<TableResponseDto>(\n SocketSuccessEvents.TABLE_STATUS_UPDATED,\n (table) => this.updateItem(table, 'id')\n );\n\n this.subscribeToEvent<TableResponseDto>(\n SocketSuccessEvents.TABLE_RELEASED,\n (table) => this.updateItem(table, 'id')\n );\n }\n\n public abstract override preload(): Promise<TableResponseDto[]>;\n}\n","import { Injectable } from '@angular/core';\nimport { BaseStore } from '../base-store';\nimport { SocketService, SocketSuccessEvents } from '../socket.service';\nimport { CartDto } from '../model/cartDto';\n\n@Injectable()\nexport abstract class CartStore extends BaseStore<CartDto> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<CartDto>(\n SocketSuccessEvents.CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS,\n (cart) => this.updateItem(cart, 'id')\n );\n\n this.subscribeToEvent<{ cartId: string, itemId: string }>(\n SocketSuccessEvents.CUSTOMER_REMOVE_FROM_CART_SUCCESS,\n (data) => {\n this.removeItem(data.cartId, 'id');\n }\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, firstValueFrom } from 'rxjs';\nimport { BaseStore } from '../base-store';\nimport { SocketService } from '../socket.service';\nimport { SocketEvents, SocketSuccessEvents } from '../socket.service';\nimport { MenuItemDto } from '../model/menuItemDto';\nimport { MenuGroupDto } from '../model/menuGroupDto';\n\n@Injectable()\nexport abstract class MenuStore extends BaseStore<MenuItemDto> {\n menuGroups$ = new BehaviorSubject<MenuGroupDto[]>([]);\n allMenuItems: (MenuItemDto | undefined)[] = [];\n\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<MenuItemDto[]>(\n SocketSuccessEvents.CUSTOMER_GET_MENU_SUCCESS,\n (menuItems) => this.updateItems(menuItems)\n );\n }\n\n public async getMenu(branchId: string): Promise<void> {\n this.socketService.emit(SocketEvents.CUSTOMER_GET_MENU, { branchId });\n }\n\n public async getMenuItemReviews(menuItemId: string): Promise<void> {\n this.socketService.emit(SocketEvents.CUSTOMER_GET_MENU_ITEM_REVIEWS, { menuItemId });\n }\n\n public async createMenuItemReview(menuItemId: string, rating: number, comment: string): Promise<void> {\n this.socketService.emit(SocketEvents.CUSTOMER_CREATE_MENU_ITEM_REVIEW, {\n menuItemId,\n rating,\n comment\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseStore } from '../base-store';\nimport { SocketService } from '../socket.service';\nimport { SocketSuccessEvents } from '../socket.service';\nimport { WaiterCallResponseDto } from '../model/waiterCallResponseDto';\n\n@Injectable()\nexport abstract class CallWaiterStore extends BaseStore<WaiterCallResponseDto> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<WaiterCallResponseDto>(\n SocketSuccessEvents.WAITER_RECEIVE_CALL,\n (request) => this.addItem(request)\n );\n }\n\n public abstract override preload(): Promise<WaiterCallResponseDto[]>;\n}\n","import { Injectable } from '@angular/core';\nimport { firstValueFrom, Observable } from 'rxjs';\nimport { BaseStore } from '../base-store';\nimport { SocketService } from '../socket.service';\nimport { SocketEvents, SocketSuccessEvents } from '../socket.service';\nimport { CustomerAuthControllerApproveCustomerLoginRequest } from '../model/customerAuthControllerApproveCustomerLoginRequest';\nimport { CustomerLoginRequestDto } from '../model/customerLoginRequestDto';\n\n@Injectable()\nexport abstract class CustomerLoginStore extends BaseStore<CustomerLoginRequestDto> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<CustomerLoginRequestDto[]>(\n SocketSuccessEvents.GET_PENDING_CUSTOMER_LOGINS_SUCCESS,\n (logins) => this.updateItems(logins)\n );\n }\n\n public getPendingLogins(): void {\n this.socketService.emit(SocketEvents.GET_PENDING_CUSTOMER_LOGINS);\n }\n\n public async approveCustomerLogin(customerId: string,\n tableId: string,\n customerAuthControllerApproveCustomerLogin: (payload: CustomerAuthControllerApproveCustomerLoginRequest)\n => Observable<CustomerAuthControllerApproveCustomerLoginRequest>\n ): Promise<void> {\n const approveData: CustomerAuthControllerApproveCustomerLoginRequest = {\n customerId,\n tableId\n };\n\n try {\n await firstValueFrom(\n customerAuthControllerApproveCustomerLogin(approveData)\n );\n\n this.removeItem(customerId, 'id');\n } catch (error) {\n console.error(`Failed to approve customer login for ${customerId}:`, error);\n this.setError(`Failed to approve customer login`);\n }\n }\n}\n","import { EnvironmentProviders, importProvidersFrom } from '@angular/core';\nimport { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';\n\n/**\n * Provides all services needed for the realtime store to function.\n * Use this function in your standalone application's bootstrapApplication providers array.\n * \n * @example\n * ```typescript\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideRealtimeStore()\n * ]\n * });\n * ```\n */\nexport function provideRealtimeStore(): EnvironmentProviders[] {\n return [\n provideHttpClient(withInterceptorsFromDi())\n ];\n}\n","import { Provider } from '@angular/core';\nimport { REALTIME_STORE_ENVIRONMENT, RealtimeStoreEnvironment } from '../environment';\n\nexport function provideRealtimeStoreEnvironment(environment: RealtimeStoreEnvironment): Provider {\n return {\n provide: REALTIME_STORE_ENVIRONMENT,\n useValue: environment\n };\n}","/*\n * Public API Surface of realtime-store\n */\n\nexport * from './lib/realtime-store.module';\nexport * from './lib/socket.service';\nexport * from './lib/base-store';\nexport * from './lib/stores/table.store';\nexport * from './lib/stores/cart.store';\nexport * from './lib/stores/menu.store';\nexport * from './lib/stores/call-waiter.store';\nexport * from './lib/stores/customer-login.store';\nexport * from './lib/providers';\nexport * from './lib/environment';\nexport * from './lib/providers/realtime-store-environment.provider';\nexport * from './lib/model/waiterCallResponseDto';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.SocketService"],"mappings":";;;;;;;AAIA;;AAEG;MASU,mBAAmB,CAAA;wGAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YALxB,YAAY;AACZ,YAAA,gBAAgB;;AAIX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EA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AQ,EAAE;KACb;AACL;;ACRA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"serve-socket.mjs","sources":["../../../projects/serve-socket/src/lib/realtime-store.module.ts","../../../projects/serve-socket/src/lib/environment/realtime-store-environment.interface.ts","../../../projects/serve-socket/src/lib/environment/realtime-store-environment.token.ts","../../../projects/serve-socket/src/lib/socket.service.ts","../../../projects/serve-socket/src/lib/base-store.ts","../../../projects/serve-socket/src/lib/stores/table.store.ts","../../../projects/serve-socket/src/lib/stores/cart.store.ts","../../../projects/serve-socket/src/lib/stores/call-waiter.store.ts","../../../projects/serve-socket/src/lib/stores/customer-login.store.ts","../../../projects/serve-socket/src/lib/providers.ts","../../../projects/serve-socket/src/lib/providers/realtime-store-environment.provider.ts","../../../projects/serve-socket/src/public-api.ts","../../../projects/serve-socket/src/serve-socket.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\n\n/**\n * @deprecated Use provideRealtimeStore() with standalone components instead\n */\n@NgModule({\n declarations: [],\n imports: [\n CommonModule,\n HttpClientModule // Kept for backward compatibility with Angular <14\n ],\n exports: []\n})\nexport class RealtimeStoreModule { }\n","import { SocketSuccessEventKeys } from '../socket.service';\n\nexport interface RealtimeStoreEnvironment {\n apiUrl: string;\n socketEvents: Record<SocketSuccessEventKeys, string>;\n}\n\nexport const defaultRealtimeStoreEnvironment: RealtimeStoreEnvironment = {\n apiUrl: `http://${window.location.hostname}:3030`,\n socketEvents: {} as Record<SocketSuccessEventKeys, string>\n};","import { InjectionToken } from '@angular/core';\nimport { RealtimeStoreEnvironment } from './realtime-store-environment.interface';\n\nexport const REALTIME_STORE_ENVIRONMENT = new InjectionToken<RealtimeStoreEnvironment>('REALTIME_STORE_ENVIRONMENT');","import { Injectable, Inject } from '@angular/core';\nimport { BehaviorSubject, Observable, Subject } from 'rxjs';\nimport { io, Socket } from 'socket.io-client';\nimport { REALTIME_STORE_ENVIRONMENT, RealtimeStoreEnvironment, defaultRealtimeStoreEnvironment } from './environment';\n\nexport enum SocketSuccessEventKeys {\n CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS = 'CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS',\n CUSTOMER_REMOVE_FROM_CART_SUCCESS = 'CUSTOMER_REMOVE_FROM_CART_SUCCESS',\n CUSTOMER_GET_MENU_SUCCESS = 'CUSTOMER_GET_MENU_SUCCESS',\n TABLE_JOIN_REQUEST_SENT_SUCCESS = 'TABLE_JOIN_REQUEST_SENT_SUCCESS',\n TABLE_JOIN_REQUEST_APPROVED_SUCCESS = 'TABLE_JOIN_REQUEST_APPROVED_SUCCESS',\n ERROR_MESSAGE_SUCCESS = 'ERROR_MESSAGE_SUCCESS',\n SUCCESS_MESSAGE_SUCCESS = 'SUCCESS_MESSAGE_SUCCESS',\n WARNING_MESSAGE_SUCCESS = 'WARNING_MESSAGE_SUCCESS',\n GET_PENDING_CUSTOMER_LOGINS_SUCCESS = 'GET_PENDING_CUSTOMER_LOGINS_SUCCESS',\n CUSTOMER_UPDATE_IS_PAID_SUCCESS = 'CUSTOMER_UPDATE_IS_PAID_SUCCESS',\n TABLE_CREATED = 'TABLE_CREATED',\n TABLE_ASSIGNED = 'TABLE_ASSIGNED',\n TABLE_STATUS_UPDATED = 'TABLE_STATUS_UPDATED',\n TABLE_RELEASED = 'TABLE_RELEASED',\n WAITER_RECEIVE_CALL = 'WAITER_RECEIVE_CALL'\n};\n\nexport const SocketSuccessEvents: Record<SocketSuccessEventKeys, string> = {} as Record<SocketSuccessEventKeys, string>;\n\n\n@Injectable()\nexport class SocketService {\n private socket!: Socket;\n private readonly url: string;\n private authToken?: string;\n private connectionKey?: string;\n private readonly eventSubjects = new Map<string, Subject<any>>();\n\n private readonly connectionStatusSubject = new BehaviorSubject<boolean>(false);\n public connectionStatus$ = this.connectionStatusSubject.asObservable();\n\n private readonly reconnectSubject = new Subject<void>();\n public reconnect$ = this.reconnectSubject.asObservable();\n\n constructor(\n @Inject(REALTIME_STORE_ENVIRONMENT) private readonly environment: RealtimeStoreEnvironment = defaultRealtimeStoreEnvironment\n ) {\n this.url = this.environment.apiUrl;\n\n // Populate SocketSuccessEvents from environment configuration\n if (this.environment.socketEvents) {\n Object.keys(SocketSuccessEventKeys).forEach(key => {\n const eventKey = key as SocketSuccessEventKeys;\n (SocketSuccessEvents as any)[eventKey] = this.environment.socketEvents[eventKey];\n });\n }\n }\n\n private setupSocketConnection(): void {\n const socketOptions: any = {\n transports: ['websocket'],\n autoConnect: true\n };\n\n // Add auth if token is available\n if (this.authToken) {\n socketOptions.auth = {\n token: this.authToken\n };\n }\n\n this.socket = io(this.url, socketOptions);\n\n this.socket.on('connect', () => {\n console.log('Socket connected');\n this.connectionStatusSubject.next(true);\n this.reestablishListeners();\n });\n\n this.socket.on('disconnect', () => {\n console.log('Socket disconnected');\n this.connectionStatusSubject.next(false);\n });\n\n this.socket.on('reconnect', () => {\n console.log('Socket reconnected');\n this.connectionStatusSubject.next(true);\n this.reconnectSubject.next();\n this.reestablishListeners();\n });\n\n this.socket.on('connect_error', (err) => {\n console.error('Connection error:', err.message);\n });\n\n this.socket.on('reconnect_error', (err) => {\n console.error('Reconnection error:', err.message);\n });\n }\n\n private reestablishListeners(): void {\n console.log('Re-establishing listeners for', this.eventSubjects.size, 'events');\n this.eventSubjects.forEach((subject, eventName) => {\n this.socket.on(eventName, (data) => {\n subject.next(data);\n });\n });\n }\n\n /**\n * Set authentication token for socket connection\n */\n public setAuthToken(token: string): void {\n this.authToken = token;\n }\n\n /**\n * Set connection key for socket connection\n */\n public setConnectionKey(key: string): void {\n this.connectionKey = key;\n }\n\n /**\n * Reset connection with new token\n */\n public resetWithNewToken(token?: string): void {\n if (token) {\n this.authToken = token;\n }\n\n if (this.socket) {\n this.socket.disconnect();\n }\n\n this.setupSocketConnection();\n }\n\n public connect(): Promise<void> {\n return new Promise((resolve) => {\n this.setupSocketConnection();\n\n if (this.socket.connected) {\n resolve();\n return;\n }\n\n // Wait for the connect event and verify connection\n this.socket.once('connect', () => {\n // Poll until socket.connected is true\n const checkConnection = () => {\n if (this.socket.connected) {\n resolve();\n } else {\n setTimeout(checkConnection, 10);\n }\n };\n checkConnection();\n });\n\n if (!this.socket.connected) {\n this.socket.connect();\n }\n });\n }\n\n public disconnect(): void {\n if (this.socket && this.socket.connected) {\n this.socket.disconnect();\n }\n }\n\n /**\n * Emit event with optional authentication headers\n */\n public emit(event: string, data?: any): void {\n if (!this.socket || this.socket.disconnected) {\n console.warn('Socket not connected. Call connect() first.');\n return;\n }\n\n // If auth token or connection key exists, wrap data with headers\n if (this.authToken || this.connectionKey) {\n const payload = {\n payload: data || {},\n headers: {\n ...(this.authToken && { _authToken: this.authToken }),\n ...(this.connectionKey && { connectionKey: this.connectionKey })\n }\n };\n this.socket.emit(event, payload);\n } else {\n this.socket.emit(event, data);\n }\n }\n\n /**\n * Listen to events with persistent subjects that survive reconnections\n */\n public on<T>(event: string): Observable<T> {\n if (!this.eventSubjects.has(event)) {\n const subject = new Subject<T>();\n this.eventSubjects.set(event, subject);\n\n // Set up initial listener if socket is connected\n if (this.socket && this.socket.connected) {\n this.socket.on(event, (data: T) => {\n subject.next(data);\n });\n }\n }\n\n return this.eventSubjects.get(event)!.asObservable();\n }\n\n /**\n * Listen to event once and return as Promise\n */\n public once<T>(event: string): Promise<T> {\n if (!this.socket || this.socket.disconnected) {\n return Promise.reject(new Error('Socket not connected. Call connect() first.'));\n }\n\n return new Promise((resolve) => {\n this.socket.once(event, (data: T) => {\n resolve(data);\n });\n });\n }\n}\n\n","import { BehaviorSubject, Observable } from 'rxjs';\nimport { SocketService } from './socket.service';\nimport { Injectable } from '@angular/core';\n\n@Injectable()\nexport abstract class BaseStore<T> {\n protected dataSubject = new BehaviorSubject<T[]>([]);\n public data$: Observable<T[]> = this.dataSubject.asObservable();\n\n protected loadingSubject = new BehaviorSubject<boolean>(false);\n public loading$: Observable<boolean> = this.loadingSubject.asObservable();\n\n protected errorSubject = new BehaviorSubject<string | null>(null);\n public error$: Observable<string | null> = this.errorSubject.asObservable();\n\n constructor(\n protected socketService: SocketService\n ) {\n this.initialize().then(() => { });\n }\n\n private async initialize(): Promise<void> {\n await this.delayPreloadUntil();\n this.setupSocketSubscriptions();\n this.refresh();\n\n this.socketService.reconnect$.subscribe(async () => {\n await this.delayPreloadUntil();\n this.refresh();\n });\n }\n\n private refresh() {\n this.preload().then(x => this.dataSubject.next(x));\n }\n\n // Abstract methods to be implemented by specific stores\n public abstract preload(): Promise<T[]>;\n\n protected abstract setupSocketSubscriptions(): void;\n\n /**\n * Hook subclasses can override to delay initial preload and reconnect refreshes.\n * By default it resolves immediately. Subclasses that need to wait for authentication\n * can override this to await their auth observable (e.g. wait for authenticatedUser$).\n */\n protected async delayPreloadUntil(): Promise<void> {\n return Promise.resolve();\n }\n\n // Helper methods for stores\n protected updateItems(items: T[]): void {\n console.log('setting', items);\n\n this.dataSubject.next(items);\n }\n\n protected updateItem(updatedItem: Partial<T>): void {\n console.log('updating', updatedItem);\n\n const currentItems = this.dataSubject.value;\n const idField = 'id' as keyof T;\n const updatedItems = currentItems.map(item =>\n item[idField] === updatedItem[idField]\n ? { ...item, ...updatedItem }\n : item\n );\n this.dataSubject.next(updatedItems);\n }\n\n protected removeItem(id: any): void {\n console.log('removing', id);\n\n const currentItems = this.dataSubject.value;\n const idField = 'id' as keyof T;\n const filteredItems = currentItems.filter(item => item[idField] !== id);\n this.dataSubject.next(filteredItems);\n }\n\n protected setLoading(isLoading: boolean): void {\n this.loadingSubject.next(isLoading);\n }\n\n protected setError(error: string | null): void {\n this.errorSubject.next(error);\n }\n\n // Helper to subscribe to socket events with typesafety\n protected subscribeToEvent<R>(\n event: string,\n handler: (data: R) => void\n ): void {\n this.socketService.on<R>(event).subscribe(handler);\n }\n\n getAll(): T[] {\n return this.dataSubject.value;\n }\n\n getById(id: any): T | undefined {\n const field = 'id' as keyof T;\n return this.dataSubject.value.find(item => item[field] === id);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseStore } from '../base-store';\nimport { SocketService, SocketSuccessEvents } from '../socket.service';\n\n@Injectable()\nexport abstract class TableStore<T> extends BaseStore<T> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<T>(\n SocketSuccessEvents.TABLE_CREATED,\n (table) => this.updateItem(table)\n );\n\n this.subscribeToEvent<T>(\n SocketSuccessEvents.TABLE_ASSIGNED,\n (table) => this.updateItem(table)\n );\n\n this.subscribeToEvent<T>(\n SocketSuccessEvents.TABLE_STATUS_UPDATED,\n (table) => this.updateItem(table)\n );\n\n this.subscribeToEvent<T>(\n SocketSuccessEvents.TABLE_RELEASED,\n (table) => this.updateItem(table)\n );\n }\n\n public abstract override preload(): Promise<T[]>;\n}\n","import { Injectable } from '@angular/core';\nimport { BaseStore } from '../base-store';\nimport { SocketService, SocketSuccessEvents } from '../socket.service';\n\n@Injectable()\nexport abstract class CartStore<T> extends BaseStore<T> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<T>(\n SocketSuccessEvents.CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS,\n (cart) => this.updateItem(cart)\n );\n\n this.subscribeToEvent<{ cartId: string, itemId: string }>(\n SocketSuccessEvents.CUSTOMER_REMOVE_FROM_CART_SUCCESS,\n (data) => {\n this.removeItem(data.cartId);\n }\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseStore } from '../base-store';\nimport { SocketService, SocketSuccessEvents } from '../socket.service';\n\n@Injectable()\nexport abstract class CallWaiterStore<T> extends BaseStore<T> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<T>(\n SocketSuccessEvents.WAITER_RECEIVE_CALL,\n (request) => this.updateItem(request)\n );\n }\n\n public abstract override preload(): Promise<T[]>;\n}\n","import { Injectable } from '@angular/core';\nimport { firstValueFrom, Observable } from 'rxjs';\nimport { BaseStore } from '../base-store';\nimport { SocketService, SocketSuccessEvents } from '../socket.service';\n\n@Injectable()\nexport abstract class CustomerLoginStore<T> extends BaseStore<T> {\n constructor(\n protected override socketService: SocketService\n ) {\n super(socketService);\n }\n\n protected override setupSocketSubscriptions(): void {\n this.subscribeToEvent<T[]>(\n SocketSuccessEvents.GET_PENDING_CUSTOMER_LOGINS_SUCCESS,\n (logins) => this.updateItems(logins)\n );\n }\n\n public async approveCustomerLogin<R>(customerId: string,\n tableId: string,\n customerAuthControllerApproveCustomerLogin: (payload: R)\n => Observable<R>\n ): Promise<void> {\n const approveData = {\n customerId,\n tableId\n } as R;\n\n try {\n await firstValueFrom(\n customerAuthControllerApproveCustomerLogin(approveData)\n );\n\n this.removeItem(customerId);\n } catch (error) {\n console.error(`Failed to approve customer login for ${customerId}:`, error);\n this.setError(`Failed to approve customer login`);\n }\n }\n}\n","import { EnvironmentProviders, importProvidersFrom } from '@angular/core';\nimport { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';\n\n/**\n * Provides all services needed for the realtime store to function.\n * Use this function in your standalone application's bootstrapApplication providers array.\n * \n * @example\n * ```typescript\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideRealtimeStore()\n * ]\n * });\n * ```\n */\nexport function provideRealtimeStore(): EnvironmentProviders[] {\n return [\n provideHttpClient(withInterceptorsFromDi())\n ];\n}\n","import { Provider } from '@angular/core';\nimport { REALTIME_STORE_ENVIRONMENT, RealtimeStoreEnvironment } from '../environment';\n\nexport function provideRealtimeStoreEnvironment(environment: RealtimeStoreEnvironment): Provider {\n return {\n provide: REALTIME_STORE_ENVIRONMENT,\n useValue: environment\n };\n}","/*\n * Public API Surface of realtime-store\n */\n\nexport * from './lib/realtime-store.module';\nexport * from './lib/socket.service';\nexport * from './lib/socket.service';\nexport * from './lib/base-store';\nexport * from './lib/stores/table.store';\nexport * from './lib/stores/cart.store';\nexport * from './lib/stores/call-waiter.store';\nexport * from './lib/stores/customer-login.store';\nexport * from './lib/providers';\nexport * from './lib/environment';\nexport * from './lib/providers/realtime-store-environment.provider';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.SocketService"],"mappings":";;;;;;;AAIA;;AAEG;MASU,mBAAmB,CAAA;wGAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YALxB,YAAY;AACZ,YAAA,gBAAgB;;AAIX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YALxB,YAAY;AACZ,YAAA,gBAAgB;;;4FAIX,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAR/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACL,YAAY;AACZ,wBAAA,gBAAgB;AACnB,qBAAA;AACD,oBAAA,OAAO,EAAE;AACZ,iBAAA;;;ACPM,MAAM,+BAA+B,GAA6B;AACrE,IAAA,MAAM,EAAE,CAAA,OAAA,EAAU,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAA,KAAA,CAAO;AACjD,IAAA,YAAY,EAAE;;;MCNL,0BAA0B,GAAG,IAAI,cAAc,CAA2B,4BAA4B;;ICEvG;AAAZ,CAAA,UAAY,sBAAsB,EAAA;AAC9B,IAAA,sBAAA,CAAA,wCAAA,CAAA,GAAA,wCAAiF;AACjF,IAA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AAC,KAAK,CAAC,CAAA,qCAAA,EAAwC,UAAU,CAAA,CAAA,CAAG,EAAE,KAAK,CAAC;AAC3E,YAAA,IAAI,CAAC,QAAQ,CAAC,CAAA,gCAAA,CAAkC,CAAC;QACrD;IACJ;wGAlCkB,kBAAkB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAA,aAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAAlB,kBAAkB,EAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBADvC;;;ACFD;;;;;;;;;;;;AAYG;SACa,oBAAoB,GAAA;IAChC,OAAO;QACH,iBAAiB,CAAC,sBAAsB,EAAE;KAC7C;AACL;;ACjBM,SAAU,+BAA+B,CAAC,WAAqC,EAAA;IACjF,OAAO;AACH,QAAA,OAAO,EAAE,0BAA0B;AACnC,QAAA,QAAQ,EAAE;KACb;AACL;;ACRA;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -15,68 +15,40 @@ declare class RealtimeStoreModule {
15
15
 
16
16
  interface RealtimeStoreEnvironment {
17
17
  apiUrl: string;
18
+ socketEvents: Record<SocketSuccessEventKeys, string>;
18
19
  }
19
20
  declare const defaultRealtimeStoreEnvironment: RealtimeStoreEnvironment;
20
21
 
21
22
  declare const REALTIME_STORE_ENVIRONMENT: InjectionToken<RealtimeStoreEnvironment>;
22
23
 
23
- declare const SocketEvents: {
24
- CUSTOMER_CONNECT: "auth:customer:login";
25
- CUSTOMER_RECONNECT: "auth:customer:login:reconnect";
26
- CUSTOMER_GET_CART: "customer:get:cart";
27
- CUSTOMER_GET_ONE_CART: "customer:get-one:cart";
28
- CUSTOMER_REMOVE_FROM_CART: "customer:remove:from:cart";
29
- CUSTOMER_CREATE_UPDATE_CART: "customer:update:cart";
30
- CUSTOMER_GET_MENU: "customer:get:menu";
31
- ERROR_MESSAGE: "error:message";
32
- SUCCESS_MESSAGE: "success:message";
33
- JOIN_ROOM: "join:room";
34
- GET_THEMING: "get:theming";
35
- CUSTOMER_CART_ITEM_STATUS_UPDATE: "customer:cart:item:status:update";
36
- CUSTOMER_GET_MENU_ITEM_REVIEWS: "customer:get:menu-item:reviews";
37
- CUSTOMER_CREATE_MENU_ITEM_REVIEW: "customer:create:menu-item:review";
38
- CUSTOMER_GET_REQUESTS_BY_TABLE: "customer:get:requests:by:table";
39
- WAITER_GET_REQUESTS_BY_TABLE: "waiter:get:requests:by:table";
40
- CUSTOMER_CALL_WAITER: "customer:call:waiter";
41
- WAITER_RECEIVE_CALL: "waiter:receive:call";
42
- WAITER_CALL_ACKNOWLEDGED: "waiter:call:acknowledged";
43
- CUSTOMER_GET_CALL_WAITER_REQUESTS: "customer:get:call:waiter:requests";
44
- APPROVE_CUSTOMER_LOGIN: "auth:customer:login:approve";
45
- GET_PENDING_CUSTOMER_LOGINS: "auth:customer:login:pending:get";
46
- POS_LOGIN: "pos:login";
47
- GET_ALL_TABLES: "table:get:all";
48
- CREATE_TABLE: "table:create";
49
- ASSIGN_TABLE: "table:assign";
50
- UPDATE_TABLE_STATUS: "table:update:status";
51
- RELEASE_TABLE: "table:release";
52
- };
53
- declare const SocketSuccessEvents: {
54
- CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS: "customer:create:cart:success";
55
- CUSTOMER_REMOVE_FROM_CART_SUCCESS: "customer:remove:from:cart:success";
56
- CUSTOMER_GET_MENU_SUCCESS: "customer:get:menu:success";
57
- TABLE_JOIN_REQUEST_SENT_SUCCESS: "table:join:request:success";
58
- TABLE_JOIN_REQUEST_APPROVED_SUCCESS: "table:join:request:approved:success";
59
- ERROR_MESSAGE_SUCCESS: "error:message:success";
60
- SUCCESS_MESSAGE_SUCCESS: "success:message:success";
61
- WARNING_MESSAGE_SUCCESS: "warning:message:success";
62
- GET_PENDING_CUSTOMER_LOGINS_SUCCESS: "auth:customer:login:pending:get:success";
63
- CUSTOMER_UPDATE_IS_PAID_SUCCESS: "customer:update:is-paid:success";
64
- TABLE_CREATED: "table:created:success";
65
- TABLE_ASSIGNED: "table:assigned:success";
66
- TABLE_STATUS_UPDATED: "table:status:updated:success";
67
- TABLE_RELEASED: "table:released:success";
68
- WAITER_RECEIVE_CALL: string;
69
- };
24
+ declare enum SocketSuccessEventKeys {
25
+ CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS = "CUSTOMER_CREATE_OR_UPDATE_CART_SUCCESS",
26
+ CUSTOMER_REMOVE_FROM_CART_SUCCESS = "CUSTOMER_REMOVE_FROM_CART_SUCCESS",
27
+ CUSTOMER_GET_MENU_SUCCESS = "CUSTOMER_GET_MENU_SUCCESS",
28
+ TABLE_JOIN_REQUEST_SENT_SUCCESS = "TABLE_JOIN_REQUEST_SENT_SUCCESS",
29
+ TABLE_JOIN_REQUEST_APPROVED_SUCCESS = "TABLE_JOIN_REQUEST_APPROVED_SUCCESS",
30
+ ERROR_MESSAGE_SUCCESS = "ERROR_MESSAGE_SUCCESS",
31
+ SUCCESS_MESSAGE_SUCCESS = "SUCCESS_MESSAGE_SUCCESS",
32
+ WARNING_MESSAGE_SUCCESS = "WARNING_MESSAGE_SUCCESS",
33
+ GET_PENDING_CUSTOMER_LOGINS_SUCCESS = "GET_PENDING_CUSTOMER_LOGINS_SUCCESS",
34
+ CUSTOMER_UPDATE_IS_PAID_SUCCESS = "CUSTOMER_UPDATE_IS_PAID_SUCCESS",
35
+ TABLE_CREATED = "TABLE_CREATED",
36
+ TABLE_ASSIGNED = "TABLE_ASSIGNED",
37
+ TABLE_STATUS_UPDATED = "TABLE_STATUS_UPDATED",
38
+ TABLE_RELEASED = "TABLE_RELEASED",
39
+ WAITER_RECEIVE_CALL = "WAITER_RECEIVE_CALL"
40
+ }
41
+ declare const SocketSuccessEvents: Record<SocketSuccessEventKeys, string>;
70
42
  declare class SocketService {
71
- private environment;
43
+ private readonly environment;
72
44
  private socket;
73
- private url;
45
+ private readonly url;
74
46
  private authToken?;
75
47
  private connectionKey?;
76
- private eventSubjects;
77
- private connectionStatusSubject;
48
+ private readonly eventSubjects;
49
+ private readonly connectionStatusSubject;
78
50
  connectionStatus$: Observable<boolean>;
79
- private reconnectSubject;
51
+ private readonly reconnectSubject;
80
52
  reconnect$: Observable<void>;
81
53
  constructor(environment?: RealtimeStoreEnvironment);
82
54
  private setupSocketConnection;
@@ -131,564 +103,50 @@ declare abstract class BaseStore<T> {
131
103
  */
132
104
  protected delayPreloadUntil(): Promise<void>;
133
105
  protected updateItems(items: T[]): void;
134
- protected addItem(item: T): void;
135
- protected updateItem(updatedItem: Partial<T>, idField: keyof T): void;
136
- protected removeItem(id: any, idField: keyof T): void;
106
+ protected updateItem(updatedItem: Partial<T>): void;
107
+ protected removeItem(id: any): void;
137
108
  protected setLoading(isLoading: boolean): void;
138
109
  protected setError(error: string | null): void;
139
110
  protected subscribeToEvent<R>(event: string, handler: (data: R) => void): void;
140
111
  getAll(): T[];
141
- getById(id: any, idField?: keyof T): T | undefined;
112
+ getById(id: any): T | undefined;
142
113
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseStore<any>, never>;
143
114
  static ɵprov: i0.ɵɵInjectableDeclaration<BaseStore<any>>;
144
115
  }
145
116
 
146
- /**
147
- * API Gateway
148
- *
149
- *
150
- *
151
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
152
- * https://openapi-generator.tech
153
- * Do not edit the class manually.
154
- */
155
- interface WaiterDto {
156
- /**
157
- * Unique identifier of the waiter
158
- */
159
- id: string;
160
- /**
161
- * Name of the waiter
162
- */
163
- name: string;
164
- /**
165
- * Unique username for the waiter
166
- */
167
- username: string;
168
- /**
169
- * Encrypted password for the waiter
170
- */
171
- password?: string;
172
- /**
173
- * Socket key for real-time communication
174
- */
175
- socketKey?: string;
176
- /**
177
- * Tables assigned to this waiter
178
- */
179
- tables?: Array<string>;
180
- }
181
-
182
- /**
183
- * API Gateway
184
- *
185
- *
186
- *
187
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
188
- * https://openapi-generator.tech
189
- * Do not edit the class manually.
190
- */
191
- interface CallWaiterDtoCustomer {
192
- id: string;
193
- name: string;
194
- verified: boolean;
195
- isHost: boolean;
196
- tableId: string;
197
- }
198
-
199
- /**
200
- * API Gateway
201
- *
202
- *
203
- *
204
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
205
- * https://openapi-generator.tech
206
- * Do not edit the class manually.
207
- */
208
-
209
- interface CallWaiterDto {
210
- /**
211
- * Unique identifier of the call waiter request
212
- */
213
- id?: string;
214
- /**
215
- * ID of the customer making the waiter call
216
- */
217
- customerId: string;
218
- /**
219
- * Whether the waiter call has been resolved
220
- */
221
- isResolved: boolean;
222
- /**
223
- * Message or reason for calling the waiter
224
- */
225
- message?: string;
226
- customer?: CallWaiterDtoCustomer;
227
- }
228
-
229
- /**
230
- * API Gateway
231
- *
232
- *
233
- *
234
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
235
- * https://openapi-generator.tech
236
- * Do not edit the class manually.
237
- */
238
-
239
- interface CartDto {
240
- /**
241
- * UUID of the cart
242
- */
243
- id?: string;
244
- /**
245
- * UUID of the table associated with this cart
246
- */
247
- tableId: string;
248
- /**
249
- * UUID of the menu item for this cart
250
- */
251
- menuItemId: string;
252
- /**
253
- * Customer cart items within this cart
254
- */
255
- customerCarts?: Array<CustomerCartDto>;
256
- }
257
-
258
- /**
259
- * API Gateway
260
- *
261
- *
262
- *
263
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
264
- * https://openapi-generator.tech
265
- * Do not edit the class manually.
266
- */
267
-
268
- interface CustomerCartDto {
269
- /**
270
- * UUID of the customer cart item
271
- */
272
- id?: string;
273
- /**
274
- * UUID of the customer placing the order
275
- */
276
- customerId: string;
277
- /**
278
- * Customer details
279
- */
280
- customer?: CustomerDto;
281
- /**
282
- * UUID of the main cart this item belongs to
283
- */
284
- cartItemId: string;
285
- /**
286
- * Cart item details
287
- */
288
- cartItem?: CartDto;
289
- /**
290
- * Quantity of the item ordered by this customer
291
- */
292
- quantity: number;
293
- /**
294
- * Current status of this customer\'s cart item
295
- */
296
- status?: CustomerCartDto.StatusEnum;
297
- /**
298
- * Timestamp of when the customer cart item was added
299
- */
300
- time?: string;
301
- }
302
- declare namespace CustomerCartDto {
303
- const StatusEnum: {
304
- readonly CheckedOut: "checked_out";
305
- readonly Preparing: "preparing";
306
- readonly Prepared: "PREPARED";
307
- readonly Delivered: "delivered";
308
- readonly Cancelled: "cancelled";
309
- readonly New: "new";
310
- };
311
- type StatusEnum = typeof StatusEnum[keyof typeof StatusEnum];
312
- }
313
-
314
- /**
315
- * API Gateway
316
- *
317
- *
318
- *
319
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
320
- * https://openapi-generator.tech
321
- * Do not edit the class manually.
322
- */
323
-
324
- interface CustomerDto {
325
- /**
326
- * Unique identifier of the customer
327
- */
328
- id: string;
329
- /**
330
- * Name of the customer
331
- */
332
- name: string;
333
- /**
334
- * Whether the customer is verified
335
- */
336
- verified: boolean;
337
- /**
338
- * Whether the customer is the host
339
- */
340
- isHost: boolean;
341
- /**
342
- * Table information where the customer is seated
343
- */
344
- table?: TableResponseDto;
345
- /**
346
- * Unique identifier of the table
347
- */
348
- tableId: string;
349
- /**
350
- * Customer cart items
351
- */
352
- carts?: Array<CustomerCartDto>;
353
- /**
354
- * Waiter call requests made by this customer
355
- */
356
- waiterCalls?: Array<CallWaiterDto>;
357
- }
358
-
359
- /**
360
- * API Gateway
361
- *
362
- *
363
- *
364
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
365
- * https://openapi-generator.tech
366
- * Do not edit the class manually.
367
- */
368
-
369
- interface TableResponseDto {
370
- /**
371
- * Unique table identifier
372
- */
373
- id: string;
374
- /**
375
- * Host ID (customer who created the table)
376
- */
377
- hostId?: string;
378
- /**
379
- * Host customer information
380
- */
381
- host?: CustomerDto;
382
- /**
383
- * Tip amount for the table
384
- */
385
- tip: number;
386
- /**
387
- * Table number
388
- */
389
- number: number;
390
- /**
391
- * Seating capacity of the table
392
- */
393
- capacity: number;
394
- /**
395
- * Current status of the table
396
- */
397
- status: TableResponseDto.StatusEnum;
398
- /**
399
- * Branch ID where the table belongs
400
- */
401
- branchId: string;
402
- /**
403
- * Whether the table is waiter-managed
404
- */
405
- waiterManaged?: boolean;
406
- /**
407
- * Assigned waiter information
408
- */
409
- waiter?: WaiterDto;
410
- /**
411
- * Carts associated with this table
412
- */
413
- carts?: Array<CartDto>;
414
- customers: Array<Array<CustomerDto>>;
415
- /**
416
- * Whether the waiter is being called by the table
417
- */
418
- callingWaiter?: boolean;
419
- }
420
- declare namespace TableResponseDto {
421
- const StatusEnum: {
422
- readonly Free: "free";
423
- readonly Occupied: "occupied";
424
- readonly Reserved: "reserved";
425
- };
426
- type StatusEnum = typeof StatusEnum[keyof typeof StatusEnum];
427
- }
428
-
429
- declare abstract class TableStore extends BaseStore<TableResponseDto> {
117
+ declare abstract class TableStore<T> extends BaseStore<T> {
430
118
  protected socketService: SocketService;
431
119
  constructor(socketService: SocketService);
432
120
  protected setupSocketSubscriptions(): void;
433
- abstract preload(): Promise<TableResponseDto[]>;
434
- static ɵfac: i0.ɵɵFactoryDeclaration<TableStore, never>;
435
- static ɵprov: i0.ɵɵInjectableDeclaration<TableStore>;
436
- }
437
-
438
- declare abstract class CartStore extends BaseStore<CartDto> {
439
- protected socketService: SocketService;
440
- constructor(socketService: SocketService);
441
- protected setupSocketSubscriptions(): void;
442
- static ɵfac: i0.ɵɵFactoryDeclaration<CartStore, never>;
443
- static ɵprov: i0.ɵɵInjectableDeclaration<CartStore>;
444
- }
445
-
446
- /**
447
- * API Gateway
448
- *
449
- *
450
- *
451
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
452
- * https://openapi-generator.tech
453
- * Do not edit the class manually.
454
- */
455
- interface MenuItemReviewStatsDto {
456
- /**
457
- * Average star rating for the menu item, or null if there are no reviews.
458
- */
459
- average: number | null;
460
- /**
461
- * Total number of reviews for the menu item.
462
- */
463
- count: number;
464
- }
465
-
466
- /**
467
- * API Gateway
468
- *
469
- *
470
- *
471
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
472
- * https://openapi-generator.tech
473
- * Do not edit the class manually.
474
- */
475
- interface MenuItemReviewDto {
476
- /**
477
- * Menu Item ID
478
- */
479
- menuItemId: string;
480
- /**
481
- * Customer ID
482
- */
483
- customerId?: string;
484
- /**
485
- * Star rating
486
- */
487
- starRating: number;
488
- /**
489
- * Review message
490
- */
491
- message?: string;
492
- }
493
-
494
- /**
495
- * API Gateway
496
- *
497
- *
498
- *
499
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
500
- * https://openapi-generator.tech
501
- * Do not edit the class manually.
502
- */
503
-
504
- interface MenuItemDto {
505
- /**
506
- * Id of the menu item
507
- */
508
- id: string;
509
- /**
510
- * Name of the menu item
511
- */
512
- name: string;
513
- /**
514
- * Image URL or base64 string
515
- */
516
- image: string;
517
- /**
518
- * Price of the menu item
519
- */
520
- price: number;
521
- /**
522
- * Indicates if the menu item is prepared in the kitchen
523
- */
524
- isKitchenPrepared: boolean;
525
- /**
526
- * Description of the menu item
527
- */
528
- description: string;
529
- /**
530
- * UUID of the menu group this item belongs to
531
- */
532
- menuGroupId: string;
533
- /**
534
- * List of reviews for the menu item
535
- */
536
- reviews?: Array<MenuItemReviewDto>;
537
- /**
538
- * Review statistics for the menu item
539
- */
540
- reviewStats?: MenuItemReviewStatsDto;
541
- }
542
-
543
- /**
544
- * API Gateway
545
- *
546
- *
547
- *
548
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
549
- * https://openapi-generator.tech
550
- * Do not edit the class manually.
551
- */
552
-
553
- interface MenuGroupDto {
554
- id: string;
555
- name: string;
556
- image?: string;
557
- restaurantId: string;
558
- /**
559
- * Indicates if the menu item is prepared in the kitchen
560
- */
561
- isKitchenPrepared: boolean;
562
- menuItems?: Array<MenuItemDto>;
121
+ abstract preload(): Promise<T[]>;
122
+ static ɵfac: i0.ɵɵFactoryDeclaration<TableStore<any>, never>;
123
+ static ɵprov: i0.ɵɵInjectableDeclaration<TableStore<any>>;
563
124
  }
564
125
 
565
- declare abstract class MenuStore extends BaseStore<MenuItemDto> {
126
+ declare abstract class CartStore<T> extends BaseStore<T> {
566
127
  protected socketService: SocketService;
567
- menuGroups$: BehaviorSubject<MenuGroupDto[]>;
568
- allMenuItems: (MenuItemDto | undefined)[];
569
128
  constructor(socketService: SocketService);
570
129
  protected setupSocketSubscriptions(): void;
571
- getMenu(branchId: string): Promise<void>;
572
- getMenuItemReviews(menuItemId: string): Promise<void>;
573
- createMenuItemReview(menuItemId: string, rating: number, comment: string): Promise<void>;
574
- static ɵfac: i0.ɵɵFactoryDeclaration<MenuStore, never>;
575
- static ɵprov: i0.ɵɵInjectableDeclaration<MenuStore>;
130
+ static ɵfac: i0.ɵɵFactoryDeclaration<CartStore<any>, never>;
131
+ static ɵprov: i0.ɵɵInjectableDeclaration<CartStore<any>>;
576
132
  }
577
133
 
578
- /**
579
- * API Gateway
580
- *
581
- *
582
- *
583
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
584
- * https://openapi-generator.tech
585
- * Do not edit the class manually.
586
- */
587
-
588
- interface WaiterCallResponseDto {
589
- /**
590
- * Unique identifier of the waiter call
591
- */
592
- id: string;
593
- /**
594
- * ID of the customer making the call
595
- */
596
- customerId: string;
597
- /**
598
- * Whether the call has been resolved
599
- */
600
- isResolved: boolean;
601
- /**
602
- * Message or reason for the call
603
- */
604
- message: string;
605
- /**
606
- * ID of the table where the call was made
607
- */
608
- tableId: string;
609
- /**
610
- * Table number for easy identification
611
- */
612
- tableNumber: number;
613
- /**
614
- * Customer information who made the call
615
- */
616
- customer?: CustomerDto;
617
- }
618
-
619
- declare abstract class CallWaiterStore extends BaseStore<WaiterCallResponseDto> {
134
+ declare abstract class CallWaiterStore<T> extends BaseStore<T> {
620
135
  protected socketService: SocketService;
621
136
  constructor(socketService: SocketService);
622
137
  protected setupSocketSubscriptions(): void;
623
- abstract preload(): Promise<WaiterCallResponseDto[]>;
624
- static ɵfac: i0.ɵɵFactoryDeclaration<CallWaiterStore, never>;
625
- static ɵprov: i0.ɵɵInjectableDeclaration<CallWaiterStore>;
626
- }
627
-
628
- /**
629
- * API Gateway
630
- *
631
- *
632
- *
633
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
634
- * https://openapi-generator.tech
635
- * Do not edit the class manually.
636
- */
637
- interface CustomerAuthControllerApproveCustomerLoginRequest {
638
- /**
639
- * Customer ID to approve
640
- */
641
- customerId: string;
642
- /**
643
- * Table ID for the customer
644
- */
645
- tableId: string;
646
- }
647
-
648
- /**
649
- * API Gateway
650
- *
651
- *
652
- *
653
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
654
- * https://openapi-generator.tech
655
- * Do not edit the class manually.
656
- */
657
- interface CustomerLoginRequestDto {
658
- /**
659
- * Id of the customer.
660
- */
661
- id?: string;
662
- /**
663
- * Name of the customer.
664
- */
665
- name: string;
666
- /**
667
- * Unique identifier for the restaurant where the customer is located.
668
- */
669
- restaurantId: string;
670
- /**
671
- * Unique identifier for the branch of the restaurant.
672
- */
673
- branchId: string;
674
- /**
675
- * The table number assigned to the customer.
676
- */
677
- tableNo: number;
678
- /**
679
- * The table id assigned to the customer.
680
- */
681
- tableId: string;
138
+ abstract preload(): Promise<T[]>;
139
+ static ɵfac: i0.ɵɵFactoryDeclaration<CallWaiterStore<any>, never>;
140
+ static ɵprov: i0.ɵɵInjectableDeclaration<CallWaiterStore<any>>;
682
141
  }
683
142
 
684
- declare abstract class CustomerLoginStore extends BaseStore<CustomerLoginRequestDto> {
143
+ declare abstract class CustomerLoginStore<T> extends BaseStore<T> {
685
144
  protected socketService: SocketService;
686
145
  constructor(socketService: SocketService);
687
146
  protected setupSocketSubscriptions(): void;
688
- getPendingLogins(): void;
689
- approveCustomerLogin(customerId: string, tableId: string, customerAuthControllerApproveCustomerLogin: (payload: CustomerAuthControllerApproveCustomerLoginRequest) => Observable<CustomerAuthControllerApproveCustomerLoginRequest>): Promise<void>;
690
- static ɵfac: i0.ɵɵFactoryDeclaration<CustomerLoginStore, never>;
691
- static ɵprov: i0.ɵɵInjectableDeclaration<CustomerLoginStore>;
147
+ approveCustomerLogin<R>(customerId: string, tableId: string, customerAuthControllerApproveCustomerLogin: (payload: R) => Observable<R>): Promise<void>;
148
+ static ɵfac: i0.ɵɵFactoryDeclaration<CustomerLoginStore<any>, never>;
149
+ static ɵprov: i0.ɵɵInjectableDeclaration<CustomerLoginStore<any>>;
692
150
  }
693
151
 
694
152
  /**
@@ -708,5 +166,5 @@ declare function provideRealtimeStore(): EnvironmentProviders[];
708
166
 
709
167
  declare function provideRealtimeStoreEnvironment(environment: RealtimeStoreEnvironment): Provider;
710
168
 
711
- export { BaseStore, CallWaiterStore, CartStore, CustomerLoginStore, MenuStore, REALTIME_STORE_ENVIRONMENT, RealtimeStoreModule, SocketEvents, SocketService, SocketSuccessEvents, TableStore, defaultRealtimeStoreEnvironment, provideRealtimeStore, provideRealtimeStoreEnvironment };
712
- export type { RealtimeStoreEnvironment, WaiterCallResponseDto };
169
+ export { BaseStore, CallWaiterStore, CartStore, CustomerLoginStore, REALTIME_STORE_ENVIRONMENT, RealtimeStoreModule, SocketService, SocketSuccessEventKeys, SocketSuccessEvents, TableStore, defaultRealtimeStoreEnvironment, provideRealtimeStore, provideRealtimeStoreEnvironment };
170
+ export type { RealtimeStoreEnvironment };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serve-socket",
3
- "version": "1.0.24",
3
+ "version": "1.0.27",
4
4
  "description": "Real-time WebSocket service for restaurant waiter coordination",
5
5
  "license": "MIT",
6
6
  "author": "Serve+ Team",