quidproquo-web-react 0.1.7 → 0.1.9

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.
Files changed (97) hide show
  1. package/lib/commonjs/api/hooks/useApiRequestActionProcessor.d.ts +1 -0
  2. package/lib/commonjs/api/hooks/useApiRequestActionProcessor.js +6 -1
  3. package/lib/commonjs/api/hooks/useApiRequestActionProcessor.js.map +1 -1
  4. package/lib/commonjs/webSocketQueue/WebSocketAuthSync/WebSocketAuthContext.js.map +1 -0
  5. package/lib/{esm/websocket → commonjs/webSocketQueue}/WebSocketAuthSync/WebSocketAuthSync.d.ts +1 -0
  6. package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/WebSocketAuthSync.js +2 -2
  7. package/lib/commonjs/webSocketQueue/WebSocketAuthSync/WebSocketAuthSync.js.map +1 -0
  8. package/lib/commonjs/webSocketQueue/WebSocketAuthSync/hooks/index.js.map +1 -0
  9. package/lib/commonjs/webSocketQueue/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.js.map +1 -0
  10. package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketAuthSync.d.ts +1 -1
  11. package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketAuthSync.js +11 -9
  12. package/lib/commonjs/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketAuthSync.js.map +1 -0
  13. package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketPingPong.js +3 -3
  14. package/lib/commonjs/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketPingPong.js.map +1 -0
  15. package/lib/commonjs/webSocketQueue/WebSocketAuthSync/index.js.map +1 -0
  16. package/lib/commonjs/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.d.ts +1 -1
  17. package/lib/commonjs/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.js +2 -2
  18. package/lib/commonjs/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.js.map +1 -1
  19. package/lib/commonjs/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.d.ts +1 -1
  20. package/lib/commonjs/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js +2 -2
  21. package/lib/commonjs/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js.map +1 -1
  22. package/lib/commonjs/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.d.ts +1 -1
  23. package/lib/commonjs/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.js.map +1 -1
  24. package/lib/commonjs/webSocketQueue/hooks/useWebsocketQueueSendEvent.d.ts +1 -1
  25. package/lib/commonjs/webSocketQueue/hooks/useWebsocketQueueSendEvent.js +2 -2
  26. package/lib/commonjs/webSocketQueue/hooks/useWebsocketQueueSendEvent.js.map +1 -1
  27. package/lib/commonjs/webSocketQueue/index.d.ts +1 -0
  28. package/lib/commonjs/webSocketQueue/index.js +1 -0
  29. package/lib/commonjs/webSocketQueue/index.js.map +1 -1
  30. package/lib/commonjs/websocket/index.d.ts +0 -1
  31. package/lib/commonjs/websocket/index.js +0 -1
  32. package/lib/commonjs/websocket/index.js.map +1 -1
  33. package/lib/esm/api/hooks/useApiRequestActionProcessor.d.ts +1 -0
  34. package/lib/esm/api/hooks/useApiRequestActionProcessor.js +6 -1
  35. package/lib/esm/api/hooks/useApiRequestActionProcessor.js.map +1 -1
  36. package/lib/esm/webSocketQueue/WebSocketAuthSync/WebSocketAuthContext.js.map +1 -0
  37. package/lib/{commonjs/websocket → esm/webSocketQueue}/WebSocketAuthSync/WebSocketAuthSync.d.ts +1 -0
  38. package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/WebSocketAuthSync.js +2 -2
  39. package/lib/esm/webSocketQueue/WebSocketAuthSync/WebSocketAuthSync.js.map +1 -0
  40. package/lib/esm/webSocketQueue/WebSocketAuthSync/hooks/index.js.map +1 -0
  41. package/lib/esm/webSocketQueue/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.js.map +1 -0
  42. package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketAuthSync.d.ts +1 -1
  43. package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketAuthSync.js +7 -5
  44. package/lib/esm/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketAuthSync.js.map +1 -0
  45. package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketPingPong.js +2 -2
  46. package/lib/esm/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketPingPong.js.map +1 -0
  47. package/lib/esm/webSocketQueue/WebSocketAuthSync/index.js.map +1 -0
  48. package/lib/esm/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.d.ts +1 -1
  49. package/lib/esm/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.js +1 -1
  50. package/lib/esm/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.js.map +1 -1
  51. package/lib/esm/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.d.ts +1 -1
  52. package/lib/esm/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js +1 -1
  53. package/lib/esm/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js.map +1 -1
  54. package/lib/esm/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.d.ts +1 -1
  55. package/lib/esm/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.js.map +1 -1
  56. package/lib/esm/webSocketQueue/hooks/useWebsocketQueueSendEvent.d.ts +1 -1
  57. package/lib/esm/webSocketQueue/hooks/useWebsocketQueueSendEvent.js +1 -1
  58. package/lib/esm/webSocketQueue/hooks/useWebsocketQueueSendEvent.js.map +1 -1
  59. package/lib/esm/webSocketQueue/index.d.ts +1 -0
  60. package/lib/esm/webSocketQueue/index.js +1 -0
  61. package/lib/esm/webSocketQueue/index.js.map +1 -1
  62. package/lib/esm/websocket/index.d.ts +0 -1
  63. package/lib/esm/websocket/index.js +0 -1
  64. package/lib/esm/websocket/index.js.map +1 -1
  65. package/package.json +8 -7
  66. package/lib/commonjs/websocket/WebSocketAuthSync/WebSocketAuthContext.js.map +0 -1
  67. package/lib/commonjs/websocket/WebSocketAuthSync/WebSocketAuthSync.js.map +0 -1
  68. package/lib/commonjs/websocket/WebSocketAuthSync/hooks/index.js.map +0 -1
  69. package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.js.map +0 -1
  70. package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.js.map +0 -1
  71. package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.js.map +0 -1
  72. package/lib/commonjs/websocket/WebSocketAuthSync/index.js.map +0 -1
  73. package/lib/esm/websocket/WebSocketAuthSync/WebSocketAuthContext.js.map +0 -1
  74. package/lib/esm/websocket/WebSocketAuthSync/WebSocketAuthSync.js.map +0 -1
  75. package/lib/esm/websocket/WebSocketAuthSync/hooks/index.js.map +0 -1
  76. package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.js.map +0 -1
  77. package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.js.map +0 -1
  78. package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.js.map +0 -1
  79. package/lib/esm/websocket/WebSocketAuthSync/index.js.map +0 -1
  80. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/WebSocketAuthContext.d.ts +0 -0
  81. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/WebSocketAuthContext.js +0 -0
  82. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/index.d.ts +0 -0
  83. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/index.js +0 -0
  84. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.d.ts +0 -0
  85. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.js +0 -0
  86. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketPingPong.d.ts +0 -0
  87. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/index.d.ts +0 -0
  88. /package/lib/commonjs/{websocket → webSocketQueue}/WebSocketAuthSync/index.js +0 -0
  89. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/WebSocketAuthContext.d.ts +0 -0
  90. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/WebSocketAuthContext.js +0 -0
  91. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/index.d.ts +0 -0
  92. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/index.js +0 -0
  93. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.d.ts +0 -0
  94. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.js +0 -0
  95. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/hooks/useWebsocketPingPong.d.ts +0 -0
  96. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/index.d.ts +0 -0
  97. /package/lib/esm/{websocket → webSocketQueue}/WebSocketAuthSync/index.js +0 -0
@@ -1,5 +1,6 @@
1
1
  import { ActionProcessorListResolver } from 'quidproquo-core';
2
2
  export type UseApiRequestActionProcessorOptions = {
3
3
  resolveServiceBaseUrl?: (service: string) => string;
4
+ getExtraHeaders?: () => Record<string, string>;
4
5
  };
5
6
  export declare const useApiRequestActionProcessor: (options?: UseApiRequestActionProcessorOptions) => ActionProcessorListResolver;
@@ -11,10 +11,15 @@ const useApiRequestActionProcessor = (options) => {
11
11
  // Hold the token in a ref so the processor closure always reads the current value.
12
12
  const tokenRef = (0, react_1.useRef)(accessToken);
13
13
  tokenRef.current = accessToken;
14
+ const getExtraHeadersRef = (0, react_1.useRef)(options === null || options === void 0 ? void 0 : options.getExtraHeaders);
15
+ getExtraHeadersRef.current = options === null || options === void 0 ? void 0 : options.getExtraHeaders;
14
16
  return (0, react_1.useMemo)(() => {
15
17
  var _a;
16
18
  return (0, quidproquo_actionprocessor_web_1.createApiRequestActionProcessor)({
17
- getHeaders: () => (tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {}),
19
+ getHeaders: () => {
20
+ var _a;
21
+ return (Object.assign(Object.assign({}, (_a = getExtraHeadersRef.current) === null || _a === void 0 ? void 0 : _a.call(getExtraHeadersRef)), (tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {})));
22
+ },
18
23
  resolveServiceBaseUrl: (_a = options === null || options === void 0 ? void 0 : options.resolveServiceBaseUrl) !== null && _a !== void 0 ? _a : (() => getApiUrl()),
19
24
  });
20
25
  }, [options === null || options === void 0 ? void 0 : options.resolveServiceBaseUrl, getApiUrl]);
@@ -1 +1 @@
1
- {"version":3,"file":"useApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../src/api/hooks/useApiRequestActionProcessor.ts"],"names":[],"mappings":";;;AAAA,mFAAiF;AAGjF,iCAAwC;AAExC,4CAAsD;AACtD,+CAA0D;AAMnD,MAAM,4BAA4B,GAAG,CAAC,OAA6C,EAA+B,EAAE;IACzH,MAAM,WAAW,GAAG,IAAA,0BAAkB,GAAE,CAAC;IACzC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAE5C,mFAAmF;IACnF,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAC,WAAW,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,GAAG,WAAW,CAAC;IAE/B,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE;;QACH,OAAA,IAAA,gEAA+B,EAAC;YAC9B,UAAU,EAAE,GAA2B,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnH,qBAAqB,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,mCAAI,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;SAC7E,CAAC,CAAA;KAAA,EACJ,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,EAAE,SAAS,CAAC,CAC5C,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,4BAA4B,gCAgBvC","sourcesContent":["import { createApiRequestActionProcessor } from 'quidproquo-actionprocessor-web';\nimport { ActionProcessorListResolver } from 'quidproquo-core';\n\nimport { useMemo, useRef } from 'react';\n\nimport { useAuthAccessToken } from '../../auth/hooks';\nimport { useBaseUrlResolvers } from '../../baseUrl/hooks';\n\nexport type UseApiRequestActionProcessorOptions = {\n resolveServiceBaseUrl?: (service: string) => string;\n};\n\nexport const useApiRequestActionProcessor = (options?: UseApiRequestActionProcessorOptions): ActionProcessorListResolver => {\n const accessToken = useAuthAccessToken();\n const { getApiUrl } = useBaseUrlResolvers();\n\n // Hold the token in a ref so the processor closure always reads the current value.\n const tokenRef = useRef(accessToken);\n tokenRef.current = accessToken;\n\n return useMemo(\n () =>\n createApiRequestActionProcessor({\n getHeaders: (): Record<string, string> => (tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {}),\n resolveServiceBaseUrl: options?.resolveServiceBaseUrl ?? (() => getApiUrl()),\n }),\n [options?.resolveServiceBaseUrl, getApiUrl],\n );\n};\n"]}
1
+ {"version":3,"file":"useApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../src/api/hooks/useApiRequestActionProcessor.ts"],"names":[],"mappings":";;;AAAA,mFAAiF;AAGjF,iCAAwC;AAExC,4CAAsD;AACtD,+CAA0D;AAYnD,MAAM,4BAA4B,GAAG,CAAC,OAA6C,EAA+B,EAAE;IACzH,MAAM,WAAW,GAAG,IAAA,0BAAkB,GAAE,CAAC;IACzC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAE5C,mFAAmF;IACnF,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAC,WAAW,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,GAAG,WAAW,CAAC;IAE/B,MAAM,kBAAkB,GAAG,IAAA,cAAM,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAC,CAAC;IAC5D,kBAAkB,CAAC,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAC;IAEtD,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE;;QACH,OAAA,IAAA,gEAA+B,EAAC;YAC9B,UAAU,EAAE,GAA2B,EAAE;;gBAAC,OAAA,iCACrC,MAAA,kBAAkB,CAAC,OAAO,kEAAI,GAC9B,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC5E,CAAA;aAAA;YACF,qBAAqB,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,mCAAI,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;SAC7E,CAAC,CAAA;KAAA,EACJ,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,EAAE,SAAS,CAAC,CAC5C,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,4BAA4B,gCAsBvC","sourcesContent":["import { createApiRequestActionProcessor } from 'quidproquo-actionprocessor-web';\nimport { ActionProcessorListResolver } from 'quidproquo-core';\n\nimport { useMemo, useRef } from 'react';\n\nimport { useAuthAccessToken } from '../../auth/hooks';\nimport { useBaseUrlResolvers } from '../../baseUrl/hooks';\n\nexport type UseApiRequestActionProcessorOptions = {\n resolveServiceBaseUrl?: (service: string) => string;\n\n // Extra headers to send on EVERY request (tenant ids, tracing, ...). Called\n // per request; held in a ref so the caller may pass a fresh closure each\n // render without recreating the processor. Merged UNDER the auth header, so\n // it can never clobber Authorization.\n getExtraHeaders?: () => Record<string, string>;\n};\n\nexport const useApiRequestActionProcessor = (options?: UseApiRequestActionProcessorOptions): ActionProcessorListResolver => {\n const accessToken = useAuthAccessToken();\n const { getApiUrl } = useBaseUrlResolvers();\n\n // Hold the token in a ref so the processor closure always reads the current value.\n const tokenRef = useRef(accessToken);\n tokenRef.current = accessToken;\n\n const getExtraHeadersRef = useRef(options?.getExtraHeaders);\n getExtraHeadersRef.current = options?.getExtraHeaders;\n\n return useMemo(\n () =>\n createApiRequestActionProcessor({\n getHeaders: (): Record<string, string> => ({\n ...getExtraHeadersRef.current?.(),\n ...(tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {}),\n }),\n resolveServiceBaseUrl: options?.resolveServiceBaseUrl ?? (() => getApiUrl()),\n }),\n [options?.resolveServiceBaseUrl, getApiUrl],\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocketAuthContext.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/WebSocketAuthSync/WebSocketAuthContext.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAEzB,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAAU,KAAK,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport const WebSocketAuthContext = createContext<boolean>(false);\n"]}
@@ -2,5 +2,6 @@ import { AuthenticationInfo } from 'quidproquo-core';
2
2
  export type WebSocketAuthSyncProps = {
3
3
  children: React.ReactNode;
4
4
  accessToken: AuthenticationInfo['accessToken'];
5
+ activeScope?: string | null;
5
6
  };
6
7
  export declare const WebSocketAuthSync: import("react").NamedExoticComponent<WebSocketAuthSyncProps>;
@@ -5,8 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const hooks_1 = require("./hooks");
7
7
  const WebSocketAuthContext_1 = require("./WebSocketAuthContext");
8
- const WebSocketAuthSyncComponent = ({ children, accessToken }) => {
9
- const isAuthenticated = (0, hooks_1.useWebsocketAuthSync)(accessToken);
8
+ const WebSocketAuthSyncComponent = ({ children, accessToken, activeScope }) => {
9
+ const isAuthenticated = (0, hooks_1.useWebsocketAuthSync)(accessToken, activeScope);
10
10
  // Keep the active websocket alive
11
11
  (0, hooks_1.useWebsocketPingPong)();
12
12
  return (0, jsx_runtime_1.jsx)(WebSocketAuthContext_1.WebSocketAuthContext.Provider, { value: isAuthenticated, children: children });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocketAuthSync.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/WebSocketAuthSync/WebSocketAuthSync.tsx"],"names":[],"mappings":";;;;AAEA,iCAA6B;AAE7B,mCAAqE;AACrE,iEAA8D;AAW9D,MAAM,0BAA0B,GAAqC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;IAC9G,MAAM,eAAe,GAAG,IAAA,4BAAoB,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAEvE,kCAAkC;IAClC,IAAA,4BAAoB,GAAE,CAAC;IAEvB,OAAO,uBAAC,2CAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAAG,QAAQ,GAAiC,CAAC;AAC3G,CAAC,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAA,YAAI,EAAC,0BAA0B,CAAC,CAAC","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\n\nimport { memo } from 'react';\n\nimport { useWebsocketAuthSync, useWebsocketPingPong } from './hooks';\nimport { WebSocketAuthContext } from './WebSocketAuthContext';\n\nexport type WebSocketAuthSyncProps = {\n children: React.ReactNode;\n accessToken: AuthenticationInfo['accessToken'];\n\n // Active storage scope (e.g. tenant id) to claim on the connection; the\n // server validates it before any scoped work runs. Null/undefined = Personal.\n activeScope?: string | null;\n};\n\nconst WebSocketAuthSyncComponent: React.FC<WebSocketAuthSyncProps> = ({ children, accessToken, activeScope }) => {\n const isAuthenticated = useWebsocketAuthSync(accessToken, activeScope);\n\n // Keep the active websocket alive\n useWebsocketPingPong();\n\n return <WebSocketAuthContext.Provider value={isAuthenticated}>{children}</WebSocketAuthContext.Provider>;\n};\n\nexport const WebSocketAuthSync = memo(WebSocketAuthSyncComponent);\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,gEAA8C;AAC9C,yDAAuC","sourcesContent":["export * from './useWebsocketAuthSync';\nexport * from './useWebSocketIsAuthenticated';\nexport * from './useWebsocketPingPong';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebSocketIsAuthenticated.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,kEAA+D;AAExD,MAAM,2BAA2B,GAAG,GAAY,EAAE;IACvD,OAAO,IAAA,kBAAU,EAAC,2CAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC;AAFW,QAAA,2BAA2B,+BAEtC","sourcesContent":["import { useContext } from 'react';\n\nimport { WebSocketAuthContext } from '../WebSocketAuthContext';\n\nexport const useWebSocketIsAuthenticated = (): boolean => {\n return useContext(WebSocketAuthContext);\n};\n"]}
@@ -1,2 +1,2 @@
1
1
  import { AuthenticationInfo } from 'quidproquo-core';
2
- export declare const useWebsocketAuthSync: (accessToken: AuthenticationInfo["accessToken"]) => boolean;
2
+ export declare const useWebsocketAuthSync: (accessToken: AuthenticationInfo["accessToken"], activeScope?: string | null) => boolean;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useWebsocketAuthSync = void 0;
4
+ const quidproquo_features_1 = require("quidproquo-features");
4
5
  const quidproquo_web_1 = require("quidproquo-web");
5
- const quidproquo_webserver_1 = require("quidproquo-webserver");
6
6
  const react_1 = require("react");
7
7
  const hooks_1 = require("../../../hooks");
8
- const hooks_2 = require("../../hooks");
9
- const useWebsocketAuthSync = (accessToken) => {
8
+ const hooks_2 = require("../../../websocket/hooks");
9
+ const useWebsocketAuthSync = (accessToken, activeScope) => {
10
10
  const sendMessage = (0, hooks_2.useWebsocketSendEvent)();
11
11
  const websocketApi = (0, hooks_2.useWebsocketApi)();
12
12
  const [isAuthenticated, setIsAuthenticated] = (0, react_1.useState)(false);
@@ -16,25 +16,27 @@ const useWebsocketAuthSync = (accessToken) => {
16
16
  }
17
17
  if (accessToken) {
18
18
  sendMessage({
19
- type: quidproquo_webserver_1.WebSocketQueueClientMessageEventType.Authenticate,
19
+ type: quidproquo_features_1.WebSocketQueueClientMessageEventType.Authenticate,
20
20
  payload: {
21
21
  accessToken: accessToken,
22
+ scope: activeScope || undefined,
22
23
  },
23
24
  });
24
25
  }
25
26
  else if (isAuthenticated) {
26
27
  sendMessage({
27
- type: quidproquo_webserver_1.WebSocketQueueClientMessageEventType.Unauthenticate,
28
+ type: quidproquo_features_1.WebSocketQueueClientMessageEventType.Unauthenticate,
28
29
  });
29
30
  }
30
31
  });
31
- (0, hooks_2.useSubscribeToWebSocketEvent)(quidproquo_webserver_1.WebSocketQueueServerMessageEventType.Authenticated, () => setIsAuthenticated(true));
32
- (0, hooks_2.useSubscribeToWebSocketEvent)(quidproquo_webserver_1.WebSocketQueueServerMessageEventType.Unauthenticated, () => setIsAuthenticated(false));
32
+ (0, hooks_2.useSubscribeToWebSocketEvent)(quidproquo_features_1.WebSocketQueueServerMessageEventType.Authenticated, () => setIsAuthenticated(true));
33
+ (0, hooks_2.useSubscribeToWebSocketEvent)(quidproquo_features_1.WebSocketQueueServerMessageEventType.Unauthenticated, () => setIsAuthenticated(false));
33
34
  // Sync the tokens in on open
34
35
  (0, hooks_2.useSubscribeToWebsocket)(quidproquo_web_1.WebsocketServiceEvent.OPEN, updateAuthTokens);
35
36
  (0, hooks_2.useSubscribeToWebsocket)(quidproquo_web_1.WebsocketServiceEvent.CLOSE, () => setIsAuthenticated(false));
36
- // Sync the tokens when they change
37
- (0, react_1.useEffect)(updateAuthTokens, [updateAuthTokens, accessToken, websocketApi, isAuthenticated]);
37
+ // Sync the tokens when they change (a tenant change re-authenticates, which
38
+ // the server treats as a fresh scope claim)
39
+ (0, react_1.useEffect)(updateAuthTokens, [updateAuthTokens, accessToken, activeScope, websocketApi, isAuthenticated]);
38
40
  return isAuthenticated;
39
41
  };
40
42
  exports.useWebsocketAuthSync = useWebsocketAuthSync;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebsocketAuthSync.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketAuthSync.ts"],"names":[],"mappings":";;;AACA,6DAO6B;AAC7B,mDAAuD;AAEvD,iCAA4C;AAE5C,0CAAiD;AACjD,oDAAyI;AAElI,MAAM,oBAAoB,GAAG,CAAC,WAA8C,EAAE,WAA2B,EAAE,EAAE;IAClH,MAAM,WAAW,GAAG,IAAA,6BAAqB,GAAE,CAAC;IAC5C,MAAM,YAAY,GAAG,IAAA,uBAAe,GAAE,CAAC;IACvC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,IAAA,uBAAe,EAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,EAAE,CAAA,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC;gBACV,IAAI,EAAE,0DAAoC,CAAC,YAAY;gBACvD,OAAO,EAAE;oBACP,WAAW,EAAE,WAAW;oBACxB,KAAK,EAAE,WAAW,IAAI,SAAS;iBAChC;aACqD,CAAC,CAAC;QAC5D,CAAC;aAAM,IAAI,eAAe,EAAE,CAAC;YAC3B,WAAW,CAAC;gBACV,IAAI,EAAE,0DAAoC,CAAC,cAAc;aACD,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAA,oCAA4B,EAAgD,0DAAoC,CAAC,aAAa,EAAE,GAAG,EAAE,CACnI,kBAAkB,CAAC,IAAI,CAAC,CACzB,CAAC;IACF,IAAA,oCAA4B,EAAkD,0DAAoC,CAAC,eAAe,EAAE,GAAG,EAAE,CACvI,kBAAkB,CAAC,KAAK,CAAC,CAC1B,CAAC;IAEF,6BAA6B;IAC7B,IAAA,+BAAuB,EAAC,sCAAqB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACtE,IAAA,+BAAuB,EAAC,sCAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtF,4EAA4E;IAC5E,4CAA4C;IAC5C,IAAA,iBAAS,EAAC,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IAEzG,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAzCW,QAAA,oBAAoB,wBAyC/B","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\nimport {\n WebSocketQueueClientEventMessageAuthenticate,\n WebSocketQueueClientEventMessageUnauthenticate,\n WebSocketQueueClientMessageEventType,\n WebSocketQueueServerEventMessageAuthenticated,\n WebSocketQueueServerEventMessageUnauthenticated,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-features';\nimport { WebsocketServiceEvent } from 'quidproquo-web';\n\nimport { useEffect, useState } from 'react';\n\nimport { useFastCallback } from '../../../hooks';\nimport { useSubscribeToWebsocket, useSubscribeToWebSocketEvent, useWebsocketApi, useWebsocketSendEvent } from '../../../websocket/hooks';\n\nexport const useWebsocketAuthSync = (accessToken: AuthenticationInfo['accessToken'], activeScope?: string | null) => {\n const sendMessage = useWebsocketSendEvent();\n const websocketApi = useWebsocketApi();\n const [isAuthenticated, setIsAuthenticated] = useState(false);\n\n const updateAuthTokens = useFastCallback(() => {\n if (!websocketApi?.isConnected()) {\n return;\n }\n\n if (accessToken) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Authenticate,\n payload: {\n accessToken: accessToken,\n scope: activeScope || undefined,\n },\n } satisfies WebSocketQueueClientEventMessageAuthenticate);\n } else if (isAuthenticated) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Unauthenticate,\n } satisfies WebSocketQueueClientEventMessageUnauthenticate);\n }\n });\n\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageAuthenticated>(WebSocketQueueServerMessageEventType.Authenticated, () =>\n setIsAuthenticated(true),\n );\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageUnauthenticated>(WebSocketQueueServerMessageEventType.Unauthenticated, () =>\n setIsAuthenticated(false),\n );\n\n // Sync the tokens in on open\n useSubscribeToWebsocket(WebsocketServiceEvent.OPEN, updateAuthTokens);\n useSubscribeToWebsocket(WebsocketServiceEvent.CLOSE, () => setIsAuthenticated(false));\n\n // Sync the tokens when they change (a tenant change re-authenticates, which\n // the server treats as a fresh scope claim)\n useEffect(updateAuthTokens, [updateAuthTokens, accessToken, activeScope, websocketApi, isAuthenticated]);\n\n return isAuthenticated;\n};\n"]}
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useWebsocketPingPong = void 0;
4
- const quidproquo_webserver_1 = require("quidproquo-webserver");
4
+ const quidproquo_features_1 = require("quidproquo-features");
5
5
  const hooks_1 = require("../../../hooks");
6
- const hooks_2 = require("../../hooks");
6
+ const hooks_2 = require("../../../websocket/hooks");
7
7
  const useWebsocketPingPong = () => {
8
8
  const sendMessage = (0, hooks_2.useWebsocketSendEvent)();
9
9
  (0, hooks_1.useRunEvery)(() => {
10
10
  const pingEvent = {
11
- type: quidproquo_webserver_1.WebSocketQueueClientMessageEventType.Ping,
11
+ type: quidproquo_features_1.WebSocketQueueClientMessageEventType.Ping,
12
12
  };
13
13
  sendMessage(pingEvent);
14
14
  }, 8 * 60);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebsocketPingPong.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketPingPong.ts"],"names":[],"mappings":";;;AAAA,6DAAiH;AAEjH,0CAA6C;AAC7C,oDAAiE;AAE1D,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,WAAW,GAAG,IAAA,6BAAqB,GAAE,CAAC;IAE5C,IAAA,mBAAW,EAAC,GAAG,EAAE;QACf,MAAM,SAAS,GAAyC;YACtD,IAAI,EAAE,0DAAoC,CAAC,IAAI;SAChD,CAAC;QAEF,WAAW,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACb,CAAC,CAAC;AAVW,QAAA,oBAAoB,wBAU/B","sourcesContent":["import { WebSocketQueueClientEventMessagePing, WebSocketQueueClientMessageEventType } from 'quidproquo-features';\n\nimport { useRunEvery } from '../../../hooks';\nimport { useWebsocketSendEvent } from '../../../websocket/hooks';\n\nexport const useWebsocketPingPong = () => {\n const sendMessage = useWebsocketSendEvent();\n\n useRunEvery(() => {\n const pingEvent: WebSocketQueueClientEventMessagePing = {\n type: WebSocketQueueClientMessageEventType.Ping,\n };\n\n sendMessage(pingEvent);\n }, 8 * 60);\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/WebSocketAuthSync/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,sDAAoC","sourcesContent":["export * from './hooks/useWebSocketIsAuthenticated';\nexport * from './WebSocketAuthSync';\n"]}
@@ -1,4 +1,4 @@
1
1
  import { ActionProcessorList } from 'quidproquo-core';
2
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
2
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
3
3
  import { RefObject } from 'react';
4
4
  export declare const getServiceRequestActionProcessor: (sendEventRef: RefObject<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, "correlationId">) => Promise<any>) | null>) => ActionProcessorList;
@@ -11,9 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getServiceRequestActionProcessor = void 0;
13
13
  const quidproquo_core_1 = require("quidproquo-core");
14
- const quidproquo_webserver_1 = require("quidproquo-webserver");
14
+ const quidproquo_features_1 = require("quidproquo-features");
15
15
  const getServiceRequestActionProcessor = (sendEventRef) => ({
16
- [quidproquo_webserver_1.ServiceActionType.Request]: (_a) => __awaiter(void 0, [_a], void 0, function* ({ serviceName, method, payload }) {
16
+ [quidproquo_features_1.ServiceActionType.Request]: (_a) => __awaiter(void 0, [_a], void 0, function* ({ serviceName, method, payload }) {
17
17
  var _b;
18
18
  const response = yield ((_b = sendEventRef.current) === null || _b === void 0 ? void 0 : _b.call(sendEventRef, { type: `qpq/serviceRequest/${serviceName}/${method}`, payload }));
19
19
  if (response && !response.success) {
@@ -1 +1 @@
1
- {"version":3,"file":"getServiceRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuF;AACvF,+DAAuG;AAIhG,MAAM,gCAAgC,GAAG,CAC9C,YAA8H,EACzG,EAAE,CAAC,CAAC;IACzB,CAAC,wCAAiB,CAAC,OAAO,CAAC,EAAE,KAAgG,EAAE,4CAA3F,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAyD;;QACzH,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,YAAY,CAAC,OAAO,6DAAG,EAAE,IAAI,EAAE,sBAAsB,WAAW,IAAI,MAAM,EAAE,EAAE,OAAO,EAAS,CAAC,CAAA,CAAC;QAEvH,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,IAAA,mCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1G,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAC;IACxC,CAAC,CAAA;CACF,CAAC,CAAC;AAZU,QAAA,gCAAgC,oCAY1C","sourcesContent":["import { ActionProcessorList, actionResult, actionResultError } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, ServiceActionType } from 'quidproquo-webserver';\n\nimport { RefObject } from 'react';\n\nexport const getServiceRequestActionProcessor = (\n sendEventRef: RefObject<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>,\n): ActionProcessorList => ({\n [ServiceActionType.Request]: async ({ serviceName, method, payload }: { serviceName: string; method: string; payload: any }) => {\n const response = await sendEventRef.current?.({ type: `qpq/serviceRequest/${serviceName}/${method}`, payload } as any);\n\n if (response && !response.success) {\n return actionResultError(response.error.errorType, response.error.errorText, response.error.errorStack);\n }\n\n return actionResult(response?.result);\n },\n});\n"]}
1
+ {"version":3,"file":"getServiceRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuF;AACvF,6DAAsG;AAI/F,MAAM,gCAAgC,GAAG,CAC9C,YAA8H,EACzG,EAAE,CAAC,CAAC;IACzB,CAAC,uCAAiB,CAAC,OAAO,CAAC,EAAE,KAAgG,EAAE,4CAA3F,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAyD;;QACzH,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,YAAY,CAAC,OAAO,6DAAG,EAAE,IAAI,EAAE,sBAAsB,WAAW,IAAI,MAAM,EAAE,EAAE,OAAO,EAAS,CAAC,CAAA,CAAC;QAEvH,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,IAAA,mCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1G,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAC;IACxC,CAAC,CAAA;CACF,CAAC,CAAC;AAZU,QAAA,gCAAgC,oCAY1C","sourcesContent":["import { ActionProcessorList, actionResult, actionResultError } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, ServiceActionType } from 'quidproquo-features';\n\nimport { RefObject } from 'react';\n\nexport const getServiceRequestActionProcessor = (\n sendEventRef: RefObject<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>,\n): ActionProcessorList => ({\n [ServiceActionType.Request]: async ({ serviceName, method, payload }: { serviceName: string; method: string; payload: any }) => {\n const response = await sendEventRef.current?.({ type: `qpq/serviceRequest/${serviceName}/${method}`, payload } as any);\n\n if (response && !response.success) {\n return actionResultError(response.error.errorType, response.error.errorText, response.error.errorStack);\n }\n\n return actionResult(response?.result);\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Story } from 'quidproquo-core';
2
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
2
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
3
3
  import { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';
4
4
  import { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';
5
5
  import { ActionProcessorListResolverFactory } from '../../hooks/asmj/useQpqRuntime';
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.useQpqWebsocketQueueRuntime = useQpqWebsocketQueueRuntime;
13
- const quidproquo_webserver_1 = require("quidproquo-webserver");
13
+ const quidproquo_features_1 = require("quidproquo-features");
14
14
  const react_1 = require("react");
15
15
  const useQpqRuntime_1 = require("../../hooks/asmj/useQpqRuntime");
16
16
  const getServiceRequestActionProcessor_1 = require("./actionProcessor/getServiceRequestActionProcessor");
@@ -26,7 +26,7 @@ function useQpqWebsocketQueueRuntime(atom, mainStory, name, getActionProcessors)
26
26
  };
27
27
  const [api, state, dispatch] = (0, useQpqRuntime_1.useQpqRuntime)(atom, mainStory, name, mergedFactory);
28
28
  const sendEvent = (0, useWebsocketQueueSendEvent_1.useWebsocketQueueSendEvent)((event) => {
29
- if (event.type === quidproquo_webserver_1.WebSocketQueueServerMessageEventType.StateDispatch) {
29
+ if (event.type === quidproquo_features_1.WebSocketQueueServerMessageEventType.StateDispatch) {
30
30
  dispatch(event.payload);
31
31
  }
32
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useQpqWebsocketQueueRuntime.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,kEA6BC;AAvCD,+DAA0H;AAE1H,iCAA+B;AAI/B,kEAAmG;AACnG,yGAAsG;AACtG,6EAA0E;AAE1E,SAAgB,2BAA2B,CACzC,IAAiD,EACjD,SAA2B,EAC3B,IAAa,EACb,mBAAgE;IAEhE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAwG,IAAI,CAAC,CAAC;IAEzI,MAAM,aAAa,GAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;QAC9F,MAAM,eAAe,GAAG,GAAS,EAAE,gDAAC,OAAA,IAAA,mEAAgC,EAAC,YAAY,CAAC,CAAA,GAAA,CAAC;QACnF,MAAM,cAAc,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,QAAQ,EAAE,eAAe,CAAC,CAAC;QAExE,OAAO,CAAO,SAAS,EAAE,mBAAmB,EAAE,EAAE;YAAC,OAAA,iCAC5C,CAAC,MAAM,eAAe,EAAE,CAAC,GACzB,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/E,CAAA;UAAA,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,6BAAa,EAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAEnF,MAAM,SAAS,GAAG,IAAA,uDAA0B,EAAC,CAAC,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,2DAAoC,CAAC,aAAa,EAAE,CAAC;YACtE,QAAQ,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAEjC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { Story } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, WebSocketQueueServerMessageEventType } from 'quidproquo-webserver';\n\nimport { useRef } from 'react';\n\nimport { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';\nimport { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';\nimport { ActionProcessorListResolverFactory, useQpqRuntime } from '../../hooks/asmj/useQpqRuntime';\nimport { getServiceRequestActionProcessor } from './actionProcessor/getServiceRequestActionProcessor';\nimport { useWebsocketQueueSendEvent } from './useWebsocketQueueSendEvent';\n\nexport function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(\n atom: QpqRuntimeDefinition<TState, TAction, TApi>,\n mainStory?: Story<any, any>,\n name?: string,\n getActionProcessors?: ActionProcessorListResolverFactory<TState>,\n): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>] {\n const sendEventRef = useRef<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>(null);\n\n const mergedFactory: ActionProcessorListResolverFactory<TState> = (dispatch, getCurrentState) => {\n const serviceResolver = async () => getServiceRequestActionProcessor(sendEventRef);\n const callerResolver = getActionProcessors?.(dispatch, getCurrentState);\n\n return async (qpqConfig, dynamicModuleLoader) => ({\n ...(await serviceResolver()),\n ...(callerResolver ? await callerResolver(qpqConfig, dynamicModuleLoader) : {}),\n });\n };\n\n const [api, state, dispatch] = useQpqRuntime(atom, mainStory, name, mergedFactory);\n\n const sendEvent = useWebsocketQueueSendEvent((event) => {\n if (event.type === WebSocketQueueServerMessageEventType.StateDispatch) {\n dispatch((event as any).payload);\n }\n });\n\n sendEventRef.current = sendEvent;\n\n return [api, state, dispatch, sendEvent];\n}\n"]}
1
+ {"version":3,"file":"useQpqWebsocketQueueRuntime.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,kEA6BC;AAvCD,6DAAyH;AAEzH,iCAA+B;AAI/B,kEAAmG;AACnG,yGAAsG;AACtG,6EAA0E;AAE1E,SAAgB,2BAA2B,CACzC,IAAiD,EACjD,SAA2B,EAC3B,IAAa,EACb,mBAAgE;IAEhE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAwG,IAAI,CAAC,CAAC;IAEzI,MAAM,aAAa,GAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;QAC9F,MAAM,eAAe,GAAG,GAAS,EAAE,gDAAC,OAAA,IAAA,mEAAgC,EAAC,YAAY,CAAC,CAAA,GAAA,CAAC;QACnF,MAAM,cAAc,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,QAAQ,EAAE,eAAe,CAAC,CAAC;QAExE,OAAO,CAAO,SAAS,EAAE,mBAAmB,EAAE,EAAE;YAAC,OAAA,iCAC5C,CAAC,MAAM,eAAe,EAAE,CAAC,GACzB,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/E,CAAA;UAAA,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,6BAAa,EAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAEnF,MAAM,SAAS,GAAG,IAAA,uDAA0B,EAAC,CAAC,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,0DAAoC,CAAC,aAAa,EAAE,CAAC;YACtE,QAAQ,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAEjC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { Story } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, WebSocketQueueServerMessageEventType } from 'quidproquo-features';\n\nimport { useRef } from 'react';\n\nimport { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';\nimport { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';\nimport { ActionProcessorListResolverFactory, useQpqRuntime } from '../../hooks/asmj/useQpqRuntime';\nimport { getServiceRequestActionProcessor } from './actionProcessor/getServiceRequestActionProcessor';\nimport { useWebsocketQueueSendEvent } from './useWebsocketQueueSendEvent';\n\nexport function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(\n atom: QpqRuntimeDefinition<TState, TAction, TApi>,\n mainStory?: Story<any, any>,\n name?: string,\n getActionProcessors?: ActionProcessorListResolverFactory<TState>,\n): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>] {\n const sendEventRef = useRef<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>(null);\n\n const mergedFactory: ActionProcessorListResolverFactory<TState> = (dispatch, getCurrentState) => {\n const serviceResolver = async () => getServiceRequestActionProcessor(sendEventRef);\n const callerResolver = getActionProcessors?.(dispatch, getCurrentState);\n\n return async (qpqConfig, dynamicModuleLoader) => ({\n ...(await serviceResolver()),\n ...(callerResolver ? await callerResolver(qpqConfig, dynamicModuleLoader) : {}),\n });\n };\n\n const [api, state, dispatch] = useQpqRuntime(atom, mainStory, name, mergedFactory);\n\n const sendEvent = useWebsocketQueueSendEvent((event) => {\n if (event.type === WebSocketQueueServerMessageEventType.StateDispatch) {\n dispatch((event as any).payload);\n }\n });\n\n sendEventRef.current = sendEvent;\n\n return [api, state, dispatch, sendEvent];\n}\n"]}
@@ -1,3 +1,3 @@
1
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
1
2
  import { WebSocketServiceEventSubscriptionFunction } from 'quidproquo-web';
2
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
3
3
  export declare const useSubscribeToWebSocketQueueEvent: <E extends AnyWebSocketQueueEventMessageWithCorrelation>(subscriptionType: E["type"], callback: WebSocketServiceEventSubscriptionFunction<E>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useSubscribeToWebSocketQueueEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.ts"],"names":[],"mappings":";;;AAGA,+CAA+D;AAExD,MAAM,iCAAiC,GAAG,CAC/C,gBAA2B,EAC3B,QAAsD,EACtD,EAAE;IACF,IAAA,wCAA4B,EAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AALW,QAAA,iCAAiC,qCAK5C","sourcesContent":["import { WebSocketServiceEventSubscriptionFunction } from 'quidproquo-web';\nimport { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';\n\nimport { useSubscribeToWebSocketEvent } from '../../websocket';\n\nexport const useSubscribeToWebSocketQueueEvent = <E extends AnyWebSocketQueueEventMessageWithCorrelation>(\n subscriptionType: E['type'],\n callback: WebSocketServiceEventSubscriptionFunction<E>,\n) => {\n useSubscribeToWebSocketEvent(subscriptionType, callback);\n};\n"]}
1
+ {"version":3,"file":"useSubscribeToWebSocketQueueEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.ts"],"names":[],"mappings":";;;AAGA,+CAA+D;AAExD,MAAM,iCAAiC,GAAG,CAC/C,gBAA2B,EAC3B,QAAsD,EACtD,EAAE;IACF,IAAA,wCAA4B,EAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AALW,QAAA,iCAAiC,qCAK5C","sourcesContent":["import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';\nimport { WebSocketServiceEventSubscriptionFunction } from 'quidproquo-web';\n\nimport { useSubscribeToWebSocketEvent } from '../../websocket';\n\nexport const useSubscribeToWebSocketQueueEvent = <E extends AnyWebSocketQueueEventMessageWithCorrelation>(\n subscriptionType: E['type'],\n callback: WebSocketServiceEventSubscriptionFunction<E>,\n) => {\n useSubscribeToWebSocketEvent(subscriptionType, callback);\n};\n"]}
@@ -1,2 +1,2 @@
1
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
1
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
2
2
  export declare const useWebsocketQueueSendEvent: <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void) => (event: Omit<TSend, "correlationId">) => Promise<any>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useWebsocketQueueSendEvent = void 0;
4
+ const quidproquo_features_1 = require("quidproquo-features");
4
5
  const quidproquo_web_1 = require("quidproquo-web");
5
- const quidproquo_webserver_1 = require("quidproquo-webserver");
6
6
  const react_1 = require("react");
7
7
  const hooks_1 = require("../../hooks");
8
8
  const websocket_1 = require("../../websocket");
@@ -19,7 +19,7 @@ const useWebsocketQueueSendEvent = (onCorrelatedMessage) => {
19
19
  if (!parsed.correlationId || !activeCorrelationsRef.current.has(parsed.correlationId)) {
20
20
  return;
21
21
  }
22
- if (parsed.type === quidproquo_webserver_1.WebSocketQueueServerMessageEventType.ServiceRequestResponse) {
22
+ if (parsed.type === quidproquo_features_1.WebSocketQueueServerMessageEventType.ServiceRequestResponse) {
23
23
  const resolve = pendingResolversRef.current.get(parsed.correlationId);
24
24
  if (resolve) {
25
25
  resolve(parsed.payload);
@@ -1 +1 @@
1
- {"version":3,"file":"useWebsocketQueueSendEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useWebsocketQueueSendEvent.ts"],"names":[],"mappings":";;;AAAA,mDAAyE;AACzE,+DAI8B;AAE9B,iCAA+B;AAE/B,uCAA8C;AAC9C,+CAA2E;AAEpE,MAAM,0BAA0B,GAAG,CACxC,mBAAmF,EACnF,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,2BAAe,GAAE,CAAC;IACvC,MAAM,qBAAqB,GAAG,IAAA,cAAM,EAAc,IAAI,GAAG,EAAE,CAAC,CAAC;IAC7D,MAAM,mBAAmB,GAAG,IAAA,cAAM,EAAsC,IAAI,GAAG,EAAE,CAAC,CAAC;IAEnF,6DAA6D;IAC7D,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC,CAAC,GAAqB,EAAE,QAAgB,EAAE,EAAE;QAChF,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,IAAI,CAAC;YACH,MAAM,MAAM,GAAiD,IAAI,CAAC,KAAK,CAAE,QAAyB,CAAC,IAAI,CAAC,CAAC;YACzG,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;gBACtF,OAAO;YACT,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,KAAK,2DAAoC,CAAC,sBAAsB,EAAE,CAAC;gBAChF,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACtE,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,CAAE,MAAiE,CAAC,OAAO,CAAC,CAAC;oBAEpF,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBACzD,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,2CAA2C;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAA,mCAAuB,EAAC,sCAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAEtE,gEAAgE;IAChE,MAAM,SAAS,GAAG,IAAA,uBAAe,EAAC,CAAC,KAAmC,EAAgB,EAAE;QACtF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAEtE,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,EAAE;gBAC3C,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;YAE7D,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA9DW,QAAA,0BAA0B,8BA8DrC","sourcesContent":["import { WebsocketService, WebsocketServiceEvent } from 'quidproquo-web';\nimport {\n AnyWebSocketQueueEventMessageWithCorrelation,\n WebSocketQueueServerEventMessageServiceRequestResponse,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-webserver';\n\nimport { useRef } from 'react';\n\nimport { useFastCallback } from '../../hooks';\nimport { useSubscribeToWebsocket, useWebsocketApi } from '../../websocket';\n\nexport const useWebsocketQueueSendEvent = <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(\n onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void,\n) => {\n const websocketApi = useWebsocketApi();\n const activeCorrelationsRef = useRef<Set<string>>(new Set());\n const pendingResolversRef = useRef<Map<string, (payload: any) => void>>(new Map());\n\n // Subscribe to ALL messages, filter by active correlationIds\n const handleMessage = useFastCallback((_ws: WebsocketService, rawEvent?: Event) => {\n if (!rawEvent) return;\n\n try {\n const parsed: AnyWebSocketQueueEventMessageWithCorrelation = JSON.parse((rawEvent as MessageEvent).data);\n if (!parsed.correlationId || !activeCorrelationsRef.current.has(parsed.correlationId)) {\n return;\n }\n\n if (parsed.type === WebSocketQueueServerMessageEventType.ServiceRequestResponse) {\n const resolve = pendingResolversRef.current.get(parsed.correlationId);\n if (resolve) {\n resolve((parsed as WebSocketQueueServerEventMessageServiceRequestResponse).payload);\n\n pendingResolversRef.current.delete(parsed.correlationId);\n activeCorrelationsRef.current.delete(parsed.correlationId);\n }\n } else {\n onCorrelatedMessage?.(parsed);\n }\n } catch {\n // Not JSON or not a queue message — ignore\n }\n });\n\n useSubscribeToWebsocket(WebsocketServiceEvent.MESSAGE, handleMessage);\n\n // Send with auto-generated correlationId, register it as active\n const sendEvent = useFastCallback((event: Omit<TSend, 'correlationId'>): Promise<any> => {\n if (!websocketApi) {\n return Promise.resolve(undefined);\n }\n\n const correlationId = crypto.randomUUID();\n activeCorrelationsRef.current.add(correlationId);\n\n const isServiceRequest = event.type.startsWith('qpq/serviceRequest/');\n\n if (isServiceRequest) {\n const promise = new Promise<any>((resolve) => {\n pendingResolversRef.current.set(correlationId, resolve);\n });\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return promise;\n }\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return Promise.resolve(undefined);\n });\n\n return sendEvent;\n};\n"]}
1
+ {"version":3,"file":"useWebsocketQueueSendEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useWebsocketQueueSendEvent.ts"],"names":[],"mappings":";;;AAAA,6DAI6B;AAC7B,mDAAyE;AAEzE,iCAA+B;AAE/B,uCAA8C;AAC9C,+CAA2E;AAEpE,MAAM,0BAA0B,GAAG,CACxC,mBAAmF,EACnF,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,2BAAe,GAAE,CAAC;IACvC,MAAM,qBAAqB,GAAG,IAAA,cAAM,EAAc,IAAI,GAAG,EAAE,CAAC,CAAC;IAC7D,MAAM,mBAAmB,GAAG,IAAA,cAAM,EAAsC,IAAI,GAAG,EAAE,CAAC,CAAC;IAEnF,6DAA6D;IAC7D,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC,CAAC,GAAqB,EAAE,QAAgB,EAAE,EAAE;QAChF,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,IAAI,CAAC;YACH,MAAM,MAAM,GAAiD,IAAI,CAAC,KAAK,CAAE,QAAyB,CAAC,IAAI,CAAC,CAAC;YACzG,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;gBACtF,OAAO;YACT,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,KAAK,0DAAoC,CAAC,sBAAsB,EAAE,CAAC;gBAChF,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACtE,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,CAAE,MAAiE,CAAC,OAAO,CAAC,CAAC;oBAEpF,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBACzD,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,2CAA2C;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAA,mCAAuB,EAAC,sCAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAEtE,gEAAgE;IAChE,MAAM,SAAS,GAAG,IAAA,uBAAe,EAAC,CAAC,KAAmC,EAAgB,EAAE;QACtF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAEtE,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,EAAE;gBAC3C,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;YAE7D,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA9DW,QAAA,0BAA0B,8BA8DrC","sourcesContent":["import {\n AnyWebSocketQueueEventMessageWithCorrelation,\n WebSocketQueueServerEventMessageServiceRequestResponse,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-features';\nimport { WebsocketService, WebsocketServiceEvent } from 'quidproquo-web';\n\nimport { useRef } from 'react';\n\nimport { useFastCallback } from '../../hooks';\nimport { useSubscribeToWebsocket, useWebsocketApi } from '../../websocket';\n\nexport const useWebsocketQueueSendEvent = <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(\n onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void,\n) => {\n const websocketApi = useWebsocketApi();\n const activeCorrelationsRef = useRef<Set<string>>(new Set());\n const pendingResolversRef = useRef<Map<string, (payload: any) => void>>(new Map());\n\n // Subscribe to ALL messages, filter by active correlationIds\n const handleMessage = useFastCallback((_ws: WebsocketService, rawEvent?: Event) => {\n if (!rawEvent) return;\n\n try {\n const parsed: AnyWebSocketQueueEventMessageWithCorrelation = JSON.parse((rawEvent as MessageEvent).data);\n if (!parsed.correlationId || !activeCorrelationsRef.current.has(parsed.correlationId)) {\n return;\n }\n\n if (parsed.type === WebSocketQueueServerMessageEventType.ServiceRequestResponse) {\n const resolve = pendingResolversRef.current.get(parsed.correlationId);\n if (resolve) {\n resolve((parsed as WebSocketQueueServerEventMessageServiceRequestResponse).payload);\n\n pendingResolversRef.current.delete(parsed.correlationId);\n activeCorrelationsRef.current.delete(parsed.correlationId);\n }\n } else {\n onCorrelatedMessage?.(parsed);\n }\n } catch {\n // Not JSON or not a queue message — ignore\n }\n });\n\n useSubscribeToWebsocket(WebsocketServiceEvent.MESSAGE, handleMessage);\n\n // Send with auto-generated correlationId, register it as active\n const sendEvent = useFastCallback((event: Omit<TSend, 'correlationId'>): Promise<any> => {\n if (!websocketApi) {\n return Promise.resolve(undefined);\n }\n\n const correlationId = crypto.randomUUID();\n activeCorrelationsRef.current.add(correlationId);\n\n const isServiceRequest = event.type.startsWith('qpq/serviceRequest/');\n\n if (isServiceRequest) {\n const promise = new Promise<any>((resolve) => {\n pendingResolversRef.current.set(correlationId, resolve);\n });\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return promise;\n }\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return Promise.resolve(undefined);\n });\n\n return sendEvent;\n};\n"]}
@@ -1 +1,2 @@
1
1
  export * from './hooks';
2
+ export * from './WebSocketAuthSync';
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./hooks"), exports);
18
+ __exportStar(require("./WebSocketAuthSync"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webSocketQueue/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB","sourcesContent":["export * from './hooks';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webSocketQueue/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,sDAAoC","sourcesContent":["export * from './hooks';\nexport * from './WebSocketAuthSync';\n"]}
@@ -1,3 +1,2 @@
1
1
  export * from './hooks';
2
- export * from './WebSocketAuthSync';
3
2
  export * from './WebsocketProvider';
@@ -15,6 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./hooks"), exports);
18
- __exportStar(require("./WebSocketAuthSync"), exports);
19
18
  __exportStar(require("./WebsocketProvider"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websocket/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,sDAAoC;AACpC,sDAAoC","sourcesContent":["export * from './hooks';\nexport * from './WebSocketAuthSync';\nexport * from './WebsocketProvider';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websocket/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,sDAAoC","sourcesContent":["export * from './hooks';\nexport * from './WebsocketProvider';\n"]}
@@ -1,5 +1,6 @@
1
1
  import { ActionProcessorListResolver } from 'quidproquo-core';
2
2
  export type UseApiRequestActionProcessorOptions = {
3
3
  resolveServiceBaseUrl?: (service: string) => string;
4
+ getExtraHeaders?: () => Record<string, string>;
4
5
  };
5
6
  export declare const useApiRequestActionProcessor: (options?: UseApiRequestActionProcessorOptions) => ActionProcessorListResolver;
@@ -8,8 +8,13 @@ export const useApiRequestActionProcessor = (options) => {
8
8
  // Hold the token in a ref so the processor closure always reads the current value.
9
9
  const tokenRef = useRef(accessToken);
10
10
  tokenRef.current = accessToken;
11
+ const getExtraHeadersRef = useRef(options?.getExtraHeaders);
12
+ getExtraHeadersRef.current = options?.getExtraHeaders;
11
13
  return useMemo(() => createApiRequestActionProcessor({
12
- getHeaders: () => (tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {}),
14
+ getHeaders: () => ({
15
+ ...getExtraHeadersRef.current?.(),
16
+ ...(tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {}),
17
+ }),
13
18
  resolveServiceBaseUrl: options?.resolveServiceBaseUrl ?? (() => getApiUrl()),
14
19
  }), [options?.resolveServiceBaseUrl, getApiUrl]);
15
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../src/api/hooks/useApiRequestActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAGjF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAM1D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,OAA6C,EAA+B,EAAE;IACzH,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;IACzC,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAE5C,mFAAmF;IACnF,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,GAAG,WAAW,CAAC;IAE/B,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,+BAA+B,CAAC;QAC9B,UAAU,EAAE,GAA2B,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnH,qBAAqB,EAAE,OAAO,EAAE,qBAAqB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;KAC7E,CAAC,EACJ,CAAC,OAAO,EAAE,qBAAqB,EAAE,SAAS,CAAC,CAC5C,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { createApiRequestActionProcessor } from 'quidproquo-actionprocessor-web';\nimport { ActionProcessorListResolver } from 'quidproquo-core';\n\nimport { useMemo, useRef } from 'react';\n\nimport { useAuthAccessToken } from '../../auth/hooks';\nimport { useBaseUrlResolvers } from '../../baseUrl/hooks';\n\nexport type UseApiRequestActionProcessorOptions = {\n resolveServiceBaseUrl?: (service: string) => string;\n};\n\nexport const useApiRequestActionProcessor = (options?: UseApiRequestActionProcessorOptions): ActionProcessorListResolver => {\n const accessToken = useAuthAccessToken();\n const { getApiUrl } = useBaseUrlResolvers();\n\n // Hold the token in a ref so the processor closure always reads the current value.\n const tokenRef = useRef(accessToken);\n tokenRef.current = accessToken;\n\n return useMemo(\n () =>\n createApiRequestActionProcessor({\n getHeaders: (): Record<string, string> => (tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {}),\n resolveServiceBaseUrl: options?.resolveServiceBaseUrl ?? (() => getApiUrl()),\n }),\n [options?.resolveServiceBaseUrl, getApiUrl],\n );\n};\n"]}
1
+ {"version":3,"file":"useApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../src/api/hooks/useApiRequestActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAGjF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAY1D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,OAA6C,EAA+B,EAAE;IACzH,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;IACzC,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAE5C,mFAAmF;IACnF,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,GAAG,WAAW,CAAC;IAE/B,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC5D,kBAAkB,CAAC,OAAO,GAAG,OAAO,EAAE,eAAe,CAAC;IAEtD,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,+BAA+B,CAAC;QAC9B,UAAU,EAAE,GAA2B,EAAE,CAAC,CAAC;YACzC,GAAG,kBAAkB,CAAC,OAAO,EAAE,EAAE;YACjC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7E,CAAC;QACF,qBAAqB,EAAE,OAAO,EAAE,qBAAqB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;KAC7E,CAAC,EACJ,CAAC,OAAO,EAAE,qBAAqB,EAAE,SAAS,CAAC,CAC5C,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { createApiRequestActionProcessor } from 'quidproquo-actionprocessor-web';\nimport { ActionProcessorListResolver } from 'quidproquo-core';\n\nimport { useMemo, useRef } from 'react';\n\nimport { useAuthAccessToken } from '../../auth/hooks';\nimport { useBaseUrlResolvers } from '../../baseUrl/hooks';\n\nexport type UseApiRequestActionProcessorOptions = {\n resolveServiceBaseUrl?: (service: string) => string;\n\n // Extra headers to send on EVERY request (tenant ids, tracing, ...). Called\n // per request; held in a ref so the caller may pass a fresh closure each\n // render without recreating the processor. Merged UNDER the auth header, so\n // it can never clobber Authorization.\n getExtraHeaders?: () => Record<string, string>;\n};\n\nexport const useApiRequestActionProcessor = (options?: UseApiRequestActionProcessorOptions): ActionProcessorListResolver => {\n const accessToken = useAuthAccessToken();\n const { getApiUrl } = useBaseUrlResolvers();\n\n // Hold the token in a ref so the processor closure always reads the current value.\n const tokenRef = useRef(accessToken);\n tokenRef.current = accessToken;\n\n const getExtraHeadersRef = useRef(options?.getExtraHeaders);\n getExtraHeadersRef.current = options?.getExtraHeaders;\n\n return useMemo(\n () =>\n createApiRequestActionProcessor({\n getHeaders: (): Record<string, string> => ({\n ...getExtraHeadersRef.current?.(),\n ...(tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : {}),\n }),\n resolveServiceBaseUrl: options?.resolveServiceBaseUrl ?? (() => getApiUrl()),\n }),\n [options?.resolveServiceBaseUrl, getApiUrl],\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocketAuthContext.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/WebSocketAuthSync/WebSocketAuthContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAU,KAAK,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport const WebSocketAuthContext = createContext<boolean>(false);\n"]}
@@ -2,5 +2,6 @@ import { AuthenticationInfo } from 'quidproquo-core';
2
2
  export type WebSocketAuthSyncProps = {
3
3
  children: React.ReactNode;
4
4
  accessToken: AuthenticationInfo['accessToken'];
5
+ activeScope?: string | null;
5
6
  };
6
7
  export declare const WebSocketAuthSync: import("react").NamedExoticComponent<WebSocketAuthSyncProps>;
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { useWebsocketAuthSync, useWebsocketPingPong } from './hooks';
4
4
  import { WebSocketAuthContext } from './WebSocketAuthContext';
5
- const WebSocketAuthSyncComponent = ({ children, accessToken }) => {
6
- const isAuthenticated = useWebsocketAuthSync(accessToken);
5
+ const WebSocketAuthSyncComponent = ({ children, accessToken, activeScope }) => {
6
+ const isAuthenticated = useWebsocketAuthSync(accessToken, activeScope);
7
7
  // Keep the active websocket alive
8
8
  useWebsocketPingPong();
9
9
  return _jsx(WebSocketAuthContext.Provider, { value: isAuthenticated, children: children });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocketAuthSync.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/WebSocketAuthSync/WebSocketAuthSync.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAW9D,MAAM,0BAA0B,GAAqC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;IAC9G,MAAM,eAAe,GAAG,oBAAoB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAEvE,kCAAkC;IAClC,oBAAoB,EAAE,CAAC;IAEvB,OAAO,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAAG,QAAQ,GAAiC,CAAC;AAC3G,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,0BAA0B,CAAC,CAAC","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\n\nimport { memo } from 'react';\n\nimport { useWebsocketAuthSync, useWebsocketPingPong } from './hooks';\nimport { WebSocketAuthContext } from './WebSocketAuthContext';\n\nexport type WebSocketAuthSyncProps = {\n children: React.ReactNode;\n accessToken: AuthenticationInfo['accessToken'];\n\n // Active storage scope (e.g. tenant id) to claim on the connection; the\n // server validates it before any scoped work runs. Null/undefined = Personal.\n activeScope?: string | null;\n};\n\nconst WebSocketAuthSyncComponent: React.FC<WebSocketAuthSyncProps> = ({ children, accessToken, activeScope }) => {\n const isAuthenticated = useWebsocketAuthSync(accessToken, activeScope);\n\n // Keep the active websocket alive\n useWebsocketPingPong();\n\n return <WebSocketAuthContext.Provider value={isAuthenticated}>{children}</WebSocketAuthContext.Provider>;\n};\n\nexport const WebSocketAuthSync = memo(WebSocketAuthSyncComponent);\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './useWebsocketAuthSync';\nexport * from './useWebSocketIsAuthenticated';\nexport * from './useWebsocketPingPong';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebSocketIsAuthenticated.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAY,EAAE;IACvD,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["import { useContext } from 'react';\n\nimport { WebSocketAuthContext } from '../WebSocketAuthContext';\n\nexport const useWebSocketIsAuthenticated = (): boolean => {\n return useContext(WebSocketAuthContext);\n};\n"]}
@@ -1,2 +1,2 @@
1
1
  import { AuthenticationInfo } from 'quidproquo-core';
2
- export declare const useWebsocketAuthSync: (accessToken: AuthenticationInfo["accessToken"]) => boolean;
2
+ export declare const useWebsocketAuthSync: (accessToken: AuthenticationInfo["accessToken"], activeScope?: string | null) => boolean;
@@ -1,9 +1,9 @@
1
+ import { WebSocketQueueClientMessageEventType, WebSocketQueueServerMessageEventType, } from 'quidproquo-features';
1
2
  import { WebsocketServiceEvent } from 'quidproquo-web';
2
- import { WebSocketQueueClientMessageEventType, WebSocketQueueServerMessageEventType, } from 'quidproquo-webserver';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { useFastCallback } from '../../../hooks';
5
- import { useSubscribeToWebsocket, useSubscribeToWebSocketEvent, useWebsocketApi, useWebsocketSendEvent } from '../../hooks';
6
- export const useWebsocketAuthSync = (accessToken) => {
5
+ import { useSubscribeToWebsocket, useSubscribeToWebSocketEvent, useWebsocketApi, useWebsocketSendEvent } from '../../../websocket/hooks';
6
+ export const useWebsocketAuthSync = (accessToken, activeScope) => {
7
7
  const sendMessage = useWebsocketSendEvent();
8
8
  const websocketApi = useWebsocketApi();
9
9
  const [isAuthenticated, setIsAuthenticated] = useState(false);
@@ -16,6 +16,7 @@ export const useWebsocketAuthSync = (accessToken) => {
16
16
  type: WebSocketQueueClientMessageEventType.Authenticate,
17
17
  payload: {
18
18
  accessToken: accessToken,
19
+ scope: activeScope || undefined,
19
20
  },
20
21
  });
21
22
  }
@@ -30,8 +31,9 @@ export const useWebsocketAuthSync = (accessToken) => {
30
31
  // Sync the tokens in on open
31
32
  useSubscribeToWebsocket(WebsocketServiceEvent.OPEN, updateAuthTokens);
32
33
  useSubscribeToWebsocket(WebsocketServiceEvent.CLOSE, () => setIsAuthenticated(false));
33
- // Sync the tokens when they change
34
- useEffect(updateAuthTokens, [updateAuthTokens, accessToken, websocketApi, isAuthenticated]);
34
+ // Sync the tokens when they change (a tenant change re-authenticates, which
35
+ // the server treats as a fresh scope claim)
36
+ useEffect(updateAuthTokens, [updateAuthTokens, accessToken, activeScope, websocketApi, isAuthenticated]);
35
37
  return isAuthenticated;
36
38
  };
37
39
  //# sourceMappingURL=useWebsocketAuthSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebsocketAuthSync.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketAuthSync.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oCAAoC,EAGpC,oCAAoC,GACrC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEzI,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAA8C,EAAE,WAA2B,EAAE,EAAE;IAClH,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC;gBACV,IAAI,EAAE,oCAAoC,CAAC,YAAY;gBACvD,OAAO,EAAE;oBACP,WAAW,EAAE,WAAW;oBACxB,KAAK,EAAE,WAAW,IAAI,SAAS;iBAChC;aACqD,CAAC,CAAC;QAC5D,CAAC;aAAM,IAAI,eAAe,EAAE,CAAC;YAC3B,WAAW,CAAC;gBACV,IAAI,EAAE,oCAAoC,CAAC,cAAc;aACD,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,4BAA4B,CAAgD,oCAAoC,CAAC,aAAa,EAAE,GAAG,EAAE,CACnI,kBAAkB,CAAC,IAAI,CAAC,CACzB,CAAC;IACF,4BAA4B,CAAkD,oCAAoC,CAAC,eAAe,EAAE,GAAG,EAAE,CACvI,kBAAkB,CAAC,KAAK,CAAC,CAC1B,CAAC;IAEF,6BAA6B;IAC7B,uBAAuB,CAAC,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACtE,uBAAuB,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtF,4EAA4E;IAC5E,4CAA4C;IAC5C,SAAS,CAAC,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IAEzG,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\nimport {\n WebSocketQueueClientEventMessageAuthenticate,\n WebSocketQueueClientEventMessageUnauthenticate,\n WebSocketQueueClientMessageEventType,\n WebSocketQueueServerEventMessageAuthenticated,\n WebSocketQueueServerEventMessageUnauthenticated,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-features';\nimport { WebsocketServiceEvent } from 'quidproquo-web';\n\nimport { useEffect, useState } from 'react';\n\nimport { useFastCallback } from '../../../hooks';\nimport { useSubscribeToWebsocket, useSubscribeToWebSocketEvent, useWebsocketApi, useWebsocketSendEvent } from '../../../websocket/hooks';\n\nexport const useWebsocketAuthSync = (accessToken: AuthenticationInfo['accessToken'], activeScope?: string | null) => {\n const sendMessage = useWebsocketSendEvent();\n const websocketApi = useWebsocketApi();\n const [isAuthenticated, setIsAuthenticated] = useState(false);\n\n const updateAuthTokens = useFastCallback(() => {\n if (!websocketApi?.isConnected()) {\n return;\n }\n\n if (accessToken) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Authenticate,\n payload: {\n accessToken: accessToken,\n scope: activeScope || undefined,\n },\n } satisfies WebSocketQueueClientEventMessageAuthenticate);\n } else if (isAuthenticated) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Unauthenticate,\n } satisfies WebSocketQueueClientEventMessageUnauthenticate);\n }\n });\n\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageAuthenticated>(WebSocketQueueServerMessageEventType.Authenticated, () =>\n setIsAuthenticated(true),\n );\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageUnauthenticated>(WebSocketQueueServerMessageEventType.Unauthenticated, () =>\n setIsAuthenticated(false),\n );\n\n // Sync the tokens in on open\n useSubscribeToWebsocket(WebsocketServiceEvent.OPEN, updateAuthTokens);\n useSubscribeToWebsocket(WebsocketServiceEvent.CLOSE, () => setIsAuthenticated(false));\n\n // Sync the tokens when they change (a tenant change re-authenticates, which\n // the server treats as a fresh scope claim)\n useEffect(updateAuthTokens, [updateAuthTokens, accessToken, activeScope, websocketApi, isAuthenticated]);\n\n return isAuthenticated;\n};\n"]}
@@ -1,6 +1,6 @@
1
- import { WebSocketQueueClientMessageEventType } from 'quidproquo-webserver';
1
+ import { WebSocketQueueClientMessageEventType } from 'quidproquo-features';
2
2
  import { useRunEvery } from '../../../hooks';
3
- import { useWebsocketSendEvent } from '../../hooks';
3
+ import { useWebsocketSendEvent } from '../../../websocket/hooks';
4
4
  export const useWebsocketPingPong = () => {
5
5
  const sendMessage = useWebsocketSendEvent();
6
6
  useRunEvery(() => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebsocketPingPong.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/WebSocketAuthSync/hooks/useWebsocketPingPong.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,oCAAoC,EAAE,MAAM,qBAAqB,CAAC;AAEjH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAE5C,WAAW,CAAC,GAAG,EAAE;QACf,MAAM,SAAS,GAAyC;YACtD,IAAI,EAAE,oCAAoC,CAAC,IAAI;SAChD,CAAC;QAEF,WAAW,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { WebSocketQueueClientEventMessagePing, WebSocketQueueClientMessageEventType } from 'quidproquo-features';\n\nimport { useRunEvery } from '../../../hooks';\nimport { useWebsocketSendEvent } from '../../../websocket/hooks';\n\nexport const useWebsocketPingPong = () => {\n const sendMessage = useWebsocketSendEvent();\n\n useRunEvery(() => {\n const pingEvent: WebSocketQueueClientEventMessagePing = {\n type: WebSocketQueueClientMessageEventType.Ping,\n };\n\n sendMessage(pingEvent);\n }, 8 * 60);\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/WebSocketAuthSync/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './hooks/useWebSocketIsAuthenticated';\nexport * from './WebSocketAuthSync';\n"]}
@@ -1,4 +1,4 @@
1
1
  import { ActionProcessorList } from 'quidproquo-core';
2
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
2
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
3
3
  import { RefObject } from 'react';
4
4
  export declare const getServiceRequestActionProcessor: (sendEventRef: RefObject<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, "correlationId">) => Promise<any>) | null>) => ActionProcessorList;
@@ -1,5 +1,5 @@
1
1
  import { actionResult, actionResultError } from 'quidproquo-core';
2
- import { ServiceActionType } from 'quidproquo-webserver';
2
+ import { ServiceActionType } from 'quidproquo-features';
3
3
  export const getServiceRequestActionProcessor = (sendEventRef) => ({
4
4
  [ServiceActionType.Request]: async ({ serviceName, method, payload }) => {
5
5
  const response = await sendEventRef.current?.({ type: `qpq/serviceRequest/${serviceName}/${method}`, payload });
@@ -1 +1 @@
1
- {"version":3,"file":"getServiceRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAgD,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIvG,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,YAA8H,EACzG,EAAE,CAAC,CAAC;IACzB,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAyD,EAAE,EAAE;QAC7H,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAsB,WAAW,IAAI,MAAM,EAAE,EAAE,OAAO,EAAS,CAAC,CAAC;QAEvH,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1G,CAAC;QAED,OAAO,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, actionResult, actionResultError } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, ServiceActionType } from 'quidproquo-webserver';\n\nimport { RefObject } from 'react';\n\nexport const getServiceRequestActionProcessor = (\n sendEventRef: RefObject<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>,\n): ActionProcessorList => ({\n [ServiceActionType.Request]: async ({ serviceName, method, payload }: { serviceName: string; method: string; payload: any }) => {\n const response = await sendEventRef.current?.({ type: `qpq/serviceRequest/${serviceName}/${method}`, payload } as any);\n\n if (response && !response.success) {\n return actionResultError(response.error.errorType, response.error.errorText, response.error.errorStack);\n }\n\n return actionResult(response?.result);\n },\n});\n"]}
1
+ {"version":3,"file":"getServiceRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/webSocketQueue/hooks/actionProcessor/getServiceRequestActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAgD,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAItG,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,YAA8H,EACzG,EAAE,CAAC,CAAC;IACzB,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAyD,EAAE,EAAE;QAC7H,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAsB,WAAW,IAAI,MAAM,EAAE,EAAE,OAAO,EAAS,CAAC,CAAC;QAEvH,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1G,CAAC;QAED,OAAO,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, actionResult, actionResultError } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, ServiceActionType } from 'quidproquo-features';\n\nimport { RefObject } from 'react';\n\nexport const getServiceRequestActionProcessor = (\n sendEventRef: RefObject<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>,\n): ActionProcessorList => ({\n [ServiceActionType.Request]: async ({ serviceName, method, payload }: { serviceName: string; method: string; payload: any }) => {\n const response = await sendEventRef.current?.({ type: `qpq/serviceRequest/${serviceName}/${method}`, payload } as any);\n\n if (response && !response.success) {\n return actionResultError(response.error.errorType, response.error.errorText, response.error.errorStack);\n }\n\n return actionResult(response?.result);\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Story } from 'quidproquo-core';
2
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
2
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
3
3
  import { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';
4
4
  import { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';
5
5
  import { ActionProcessorListResolverFactory } from '../../hooks/asmj/useQpqRuntime';
@@ -1,4 +1,4 @@
1
- import { WebSocketQueueServerMessageEventType } from 'quidproquo-webserver';
1
+ import { WebSocketQueueServerMessageEventType } from 'quidproquo-features';
2
2
  import { useRef } from 'react';
3
3
  import { useQpqRuntime } from '../../hooks/asmj/useQpqRuntime';
4
4
  import { getServiceRequestActionProcessor } from './actionProcessor/getServiceRequestActionProcessor';
@@ -1 +1 @@
1
- {"version":3,"file":"useQpqWebsocketQueueRuntime.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.ts"],"names":[],"mappings":"AACA,OAAO,EAAgD,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAE1H,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAsC,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AACtG,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,UAAU,2BAA2B,CACzC,IAAiD,EACjD,SAA2B,EAC3B,IAAa,EACb,mBAAgE;IAEhE,MAAM,YAAY,GAAG,MAAM,CAAwG,IAAI,CAAC,CAAC;IAEzI,MAAM,aAAa,GAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;QAC9F,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC,gCAAgC,CAAC,YAAY,CAAC,CAAC;QACnF,MAAM,cAAc,GAAG,mBAAmB,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAExE,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC;YAChD,GAAG,CAAC,MAAM,eAAe,EAAE,CAAC;YAC5B,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAChF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAEnF,MAAM,SAAS,GAAG,0BAA0B,CAAC,CAAC,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,oCAAoC,CAAC,aAAa,EAAE,CAAC;YACtE,QAAQ,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAEjC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { Story } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, WebSocketQueueServerMessageEventType } from 'quidproquo-webserver';\n\nimport { useRef } from 'react';\n\nimport { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';\nimport { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';\nimport { ActionProcessorListResolverFactory, useQpqRuntime } from '../../hooks/asmj/useQpqRuntime';\nimport { getServiceRequestActionProcessor } from './actionProcessor/getServiceRequestActionProcessor';\nimport { useWebsocketQueueSendEvent } from './useWebsocketQueueSendEvent';\n\nexport function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(\n atom: QpqRuntimeDefinition<TState, TAction, TApi>,\n mainStory?: Story<any, any>,\n name?: string,\n getActionProcessors?: ActionProcessorListResolverFactory<TState>,\n): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>] {\n const sendEventRef = useRef<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>(null);\n\n const mergedFactory: ActionProcessorListResolverFactory<TState> = (dispatch, getCurrentState) => {\n const serviceResolver = async () => getServiceRequestActionProcessor(sendEventRef);\n const callerResolver = getActionProcessors?.(dispatch, getCurrentState);\n\n return async (qpqConfig, dynamicModuleLoader) => ({\n ...(await serviceResolver()),\n ...(callerResolver ? await callerResolver(qpqConfig, dynamicModuleLoader) : {}),\n });\n };\n\n const [api, state, dispatch] = useQpqRuntime(atom, mainStory, name, mergedFactory);\n\n const sendEvent = useWebsocketQueueSendEvent((event) => {\n if (event.type === WebSocketQueueServerMessageEventType.StateDispatch) {\n dispatch((event as any).payload);\n }\n });\n\n sendEventRef.current = sendEvent;\n\n return [api, state, dispatch, sendEvent];\n}\n"]}
1
+ {"version":3,"file":"useQpqWebsocketQueueRuntime.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.ts"],"names":[],"mappings":"AACA,OAAO,EAAgD,oCAAoC,EAAE,MAAM,qBAAqB,CAAC;AAEzH,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAsC,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AACtG,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,UAAU,2BAA2B,CACzC,IAAiD,EACjD,SAA2B,EAC3B,IAAa,EACb,mBAAgE;IAEhE,MAAM,YAAY,GAAG,MAAM,CAAwG,IAAI,CAAC,CAAC;IAEzI,MAAM,aAAa,GAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;QAC9F,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC,gCAAgC,CAAC,YAAY,CAAC,CAAC;QACnF,MAAM,cAAc,GAAG,mBAAmB,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAExE,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC;YAChD,GAAG,CAAC,MAAM,eAAe,EAAE,CAAC;YAC5B,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAChF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAEnF,MAAM,SAAS,GAAG,0BAA0B,CAAC,CAAC,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,oCAAoC,CAAC,aAAa,EAAE,CAAC;YACtE,QAAQ,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAEjC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { Story } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, WebSocketQueueServerMessageEventType } from 'quidproquo-features';\n\nimport { useRef } from 'react';\n\nimport { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';\nimport { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';\nimport { ActionProcessorListResolverFactory, useQpqRuntime } from '../../hooks/asmj/useQpqRuntime';\nimport { getServiceRequestActionProcessor } from './actionProcessor/getServiceRequestActionProcessor';\nimport { useWebsocketQueueSendEvent } from './useWebsocketQueueSendEvent';\n\nexport function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(\n atom: QpqRuntimeDefinition<TState, TAction, TApi>,\n mainStory?: Story<any, any>,\n name?: string,\n getActionProcessors?: ActionProcessorListResolverFactory<TState>,\n): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>] {\n const sendEventRef = useRef<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>(null);\n\n const mergedFactory: ActionProcessorListResolverFactory<TState> = (dispatch, getCurrentState) => {\n const serviceResolver = async () => getServiceRequestActionProcessor(sendEventRef);\n const callerResolver = getActionProcessors?.(dispatch, getCurrentState);\n\n return async (qpqConfig, dynamicModuleLoader) => ({\n ...(await serviceResolver()),\n ...(callerResolver ? await callerResolver(qpqConfig, dynamicModuleLoader) : {}),\n });\n };\n\n const [api, state, dispatch] = useQpqRuntime(atom, mainStory, name, mergedFactory);\n\n const sendEvent = useWebsocketQueueSendEvent((event) => {\n if (event.type === WebSocketQueueServerMessageEventType.StateDispatch) {\n dispatch((event as any).payload);\n }\n });\n\n sendEventRef.current = sendEvent;\n\n return [api, state, dispatch, sendEvent];\n}\n"]}
@@ -1,3 +1,3 @@
1
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
1
2
  import { WebSocketServiceEventSubscriptionFunction } from 'quidproquo-web';
2
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
3
3
  export declare const useSubscribeToWebSocketQueueEvent: <E extends AnyWebSocketQueueEventMessageWithCorrelation>(subscriptionType: E["type"], callback: WebSocketServiceEventSubscriptionFunction<E>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useSubscribeToWebSocketQueueEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,gBAA2B,EAC3B,QAAsD,EACtD,EAAE;IACF,4BAA4B,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC","sourcesContent":["import { WebSocketServiceEventSubscriptionFunction } from 'quidproquo-web';\nimport { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';\n\nimport { useSubscribeToWebSocketEvent } from '../../websocket';\n\nexport const useSubscribeToWebSocketQueueEvent = <E extends AnyWebSocketQueueEventMessageWithCorrelation>(\n subscriptionType: E['type'],\n callback: WebSocketServiceEventSubscriptionFunction<E>,\n) => {\n useSubscribeToWebSocketEvent(subscriptionType, callback);\n};\n"]}
1
+ {"version":3,"file":"useSubscribeToWebSocketQueueEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,gBAA2B,EAC3B,QAAsD,EACtD,EAAE;IACF,4BAA4B,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC","sourcesContent":["import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';\nimport { WebSocketServiceEventSubscriptionFunction } from 'quidproquo-web';\n\nimport { useSubscribeToWebSocketEvent } from '../../websocket';\n\nexport const useSubscribeToWebSocketQueueEvent = <E extends AnyWebSocketQueueEventMessageWithCorrelation>(\n subscriptionType: E['type'],\n callback: WebSocketServiceEventSubscriptionFunction<E>,\n) => {\n useSubscribeToWebSocketEvent(subscriptionType, callback);\n};\n"]}
@@ -1,2 +1,2 @@
1
- import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-webserver';
1
+ import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
2
2
  export declare const useWebsocketQueueSendEvent: <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void) => (event: Omit<TSend, "correlationId">) => Promise<any>;
@@ -1,5 +1,5 @@
1
+ import { WebSocketQueueServerMessageEventType, } from 'quidproquo-features';
1
2
  import { WebsocketServiceEvent } from 'quidproquo-web';
2
- import { WebSocketQueueServerMessageEventType, } from 'quidproquo-webserver';
3
3
  import { useRef } from 'react';
4
4
  import { useFastCallback } from '../../hooks';
5
5
  import { useSubscribeToWebsocket, useWebsocketApi } from '../../websocket';
@@ -1 +1 @@
1
- {"version":3,"file":"useWebsocketQueueSendEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useWebsocketQueueSendEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAGL,oCAAoC,GACrC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE3E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,mBAAmF,EACnF,EAAE;IACF,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,qBAAqB,GAAG,MAAM,CAAc,IAAI,GAAG,EAAE,CAAC,CAAC;IAC7D,MAAM,mBAAmB,GAAG,MAAM,CAAsC,IAAI,GAAG,EAAE,CAAC,CAAC;IAEnF,6DAA6D;IAC7D,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,GAAqB,EAAE,QAAgB,EAAE,EAAE;QAChF,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,IAAI,CAAC;YACH,MAAM,MAAM,GAAiD,IAAI,CAAC,KAAK,CAAE,QAAyB,CAAC,IAAI,CAAC,CAAC;YACzG,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;gBACtF,OAAO;YACT,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,KAAK,oCAAoC,CAAC,sBAAsB,EAAE,CAAC;gBAChF,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACtE,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,CAAE,MAAiE,CAAC,OAAO,CAAC,CAAC;oBAEpF,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBACzD,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,mBAAmB,EAAE,CAAC,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,2CAA2C;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,uBAAuB,CAAC,qBAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAEtE,gEAAgE;IAChE,MAAM,SAAS,GAAG,eAAe,CAAC,CAAC,KAAmC,EAAgB,EAAE;QACtF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAEtE,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,EAAE;gBAC3C,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAW,CAAC,CAAC;YAE7D,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAW,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { WebsocketService, WebsocketServiceEvent } from 'quidproquo-web';\nimport {\n AnyWebSocketQueueEventMessageWithCorrelation,\n WebSocketQueueServerEventMessageServiceRequestResponse,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-webserver';\n\nimport { useRef } from 'react';\n\nimport { useFastCallback } from '../../hooks';\nimport { useSubscribeToWebsocket, useWebsocketApi } from '../../websocket';\n\nexport const useWebsocketQueueSendEvent = <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(\n onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void,\n) => {\n const websocketApi = useWebsocketApi();\n const activeCorrelationsRef = useRef<Set<string>>(new Set());\n const pendingResolversRef = useRef<Map<string, (payload: any) => void>>(new Map());\n\n // Subscribe to ALL messages, filter by active correlationIds\n const handleMessage = useFastCallback((_ws: WebsocketService, rawEvent?: Event) => {\n if (!rawEvent) return;\n\n try {\n const parsed: AnyWebSocketQueueEventMessageWithCorrelation = JSON.parse((rawEvent as MessageEvent).data);\n if (!parsed.correlationId || !activeCorrelationsRef.current.has(parsed.correlationId)) {\n return;\n }\n\n if (parsed.type === WebSocketQueueServerMessageEventType.ServiceRequestResponse) {\n const resolve = pendingResolversRef.current.get(parsed.correlationId);\n if (resolve) {\n resolve((parsed as WebSocketQueueServerEventMessageServiceRequestResponse).payload);\n\n pendingResolversRef.current.delete(parsed.correlationId);\n activeCorrelationsRef.current.delete(parsed.correlationId);\n }\n } else {\n onCorrelatedMessage?.(parsed);\n }\n } catch {\n // Not JSON or not a queue message — ignore\n }\n });\n\n useSubscribeToWebsocket(WebsocketServiceEvent.MESSAGE, handleMessage);\n\n // Send with auto-generated correlationId, register it as active\n const sendEvent = useFastCallback((event: Omit<TSend, 'correlationId'>): Promise<any> => {\n if (!websocketApi) {\n return Promise.resolve(undefined);\n }\n\n const correlationId = crypto.randomUUID();\n activeCorrelationsRef.current.add(correlationId);\n\n const isServiceRequest = event.type.startsWith('qpq/serviceRequest/');\n\n if (isServiceRequest) {\n const promise = new Promise<any>((resolve) => {\n pendingResolversRef.current.set(correlationId, resolve);\n });\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return promise;\n }\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return Promise.resolve(undefined);\n });\n\n return sendEvent;\n};\n"]}
1
+ {"version":3,"file":"useWebsocketQueueSendEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useWebsocketQueueSendEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oCAAoC,GACrC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAoB,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE3E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,mBAAmF,EACnF,EAAE;IACF,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,qBAAqB,GAAG,MAAM,CAAc,IAAI,GAAG,EAAE,CAAC,CAAC;IAC7D,MAAM,mBAAmB,GAAG,MAAM,CAAsC,IAAI,GAAG,EAAE,CAAC,CAAC;IAEnF,6DAA6D;IAC7D,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,GAAqB,EAAE,QAAgB,EAAE,EAAE;QAChF,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,IAAI,CAAC;YACH,MAAM,MAAM,GAAiD,IAAI,CAAC,KAAK,CAAE,QAAyB,CAAC,IAAI,CAAC,CAAC;YACzG,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;gBACtF,OAAO;YACT,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,KAAK,oCAAoC,CAAC,sBAAsB,EAAE,CAAC;gBAChF,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACtE,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,CAAE,MAAiE,CAAC,OAAO,CAAC,CAAC;oBAEpF,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBACzD,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,mBAAmB,EAAE,CAAC,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,2CAA2C;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,uBAAuB,CAAC,qBAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAEtE,gEAAgE;IAChE,MAAM,SAAS,GAAG,eAAe,CAAC,CAAC,KAAmC,EAAgB,EAAE;QACtF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAEtE,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,EAAE;gBAC3C,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAW,CAAC,CAAC;YAE7D,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAW,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import {\n AnyWebSocketQueueEventMessageWithCorrelation,\n WebSocketQueueServerEventMessageServiceRequestResponse,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-features';\nimport { WebsocketService, WebsocketServiceEvent } from 'quidproquo-web';\n\nimport { useRef } from 'react';\n\nimport { useFastCallback } from '../../hooks';\nimport { useSubscribeToWebsocket, useWebsocketApi } from '../../websocket';\n\nexport const useWebsocketQueueSendEvent = <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(\n onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void,\n) => {\n const websocketApi = useWebsocketApi();\n const activeCorrelationsRef = useRef<Set<string>>(new Set());\n const pendingResolversRef = useRef<Map<string, (payload: any) => void>>(new Map());\n\n // Subscribe to ALL messages, filter by active correlationIds\n const handleMessage = useFastCallback((_ws: WebsocketService, rawEvent?: Event) => {\n if (!rawEvent) return;\n\n try {\n const parsed: AnyWebSocketQueueEventMessageWithCorrelation = JSON.parse((rawEvent as MessageEvent).data);\n if (!parsed.correlationId || !activeCorrelationsRef.current.has(parsed.correlationId)) {\n return;\n }\n\n if (parsed.type === WebSocketQueueServerMessageEventType.ServiceRequestResponse) {\n const resolve = pendingResolversRef.current.get(parsed.correlationId);\n if (resolve) {\n resolve((parsed as WebSocketQueueServerEventMessageServiceRequestResponse).payload);\n\n pendingResolversRef.current.delete(parsed.correlationId);\n activeCorrelationsRef.current.delete(parsed.correlationId);\n }\n } else {\n onCorrelatedMessage?.(parsed);\n }\n } catch {\n // Not JSON or not a queue message — ignore\n }\n });\n\n useSubscribeToWebsocket(WebsocketServiceEvent.MESSAGE, handleMessage);\n\n // Send with auto-generated correlationId, register it as active\n const sendEvent = useFastCallback((event: Omit<TSend, 'correlationId'>): Promise<any> => {\n if (!websocketApi) {\n return Promise.resolve(undefined);\n }\n\n const correlationId = crypto.randomUUID();\n activeCorrelationsRef.current.add(correlationId);\n\n const isServiceRequest = event.type.startsWith('qpq/serviceRequest/');\n\n if (isServiceRequest) {\n const promise = new Promise<any>((resolve) => {\n pendingResolversRef.current.set(correlationId, resolve);\n });\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return promise;\n }\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return Promise.resolve(undefined);\n });\n\n return sendEvent;\n};\n"]}
@@ -1 +1,2 @@
1
1
  export * from './hooks';
2
+ export * from './WebSocketAuthSync';
@@ -1,2 +1,3 @@
1
1
  export * from './hooks';
2
+ export * from './WebSocketAuthSync';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webSocketQueue/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC","sourcesContent":["export * from './hooks';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webSocketQueue/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './hooks';\nexport * from './WebSocketAuthSync';\n"]}
@@ -1,3 +1,2 @@
1
1
  export * from './hooks';
2
- export * from './WebSocketAuthSync';
3
2
  export * from './WebsocketProvider';
@@ -1,4 +1,3 @@
1
1
  export * from './hooks';
2
- export * from './WebSocketAuthSync';
3
2
  export * from './WebsocketProvider';
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websocket/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './hooks';\nexport * from './WebSocketAuthSync';\nexport * from './WebsocketProvider';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websocket/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './hooks';\nexport * from './WebsocketProvider';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-web-react",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -34,8 +34,8 @@
34
34
  "devDependencies": {
35
35
  "@testing-library/dom": "^10.4.1",
36
36
  "@testing-library/react": "^16.3.2",
37
- "quidproquo-core": "0.1.7",
38
- "quidproquo-tsconfig": "0.1.7",
37
+ "quidproquo-core": "0.1.9",
38
+ "quidproquo-tsconfig": "0.1.9",
39
39
  "typescript": "^5.8.2"
40
40
  },
41
41
  "peerDependencies": {
@@ -43,10 +43,11 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "jotai": "^2.12.1",
46
- "quidproquo-actionprocessor-node": "0.1.7",
47
- "quidproquo-actionprocessor-web": "0.1.7",
48
- "quidproquo-web": "0.1.7",
49
- "quidproquo-webserver": "0.1.7",
46
+ "quidproquo-actionprocessor-node": "0.1.9",
47
+ "quidproquo-actionprocessor-web": "0.1.9",
48
+ "quidproquo-features": "0.1.9",
49
+ "quidproquo-web": "0.1.9",
50
+ "quidproquo-webserver": "0.1.9",
50
51
  "symbol-observable": "^4.0.0"
51
52
  }
52
53
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebSocketAuthContext.js","sourceRoot":"","sources":["../../../../src/websocket/WebSocketAuthSync/WebSocketAuthContext.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAEzB,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAAU,KAAK,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport const WebSocketAuthContext = createContext<boolean>(false);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebSocketAuthSync.js","sourceRoot":"","sources":["../../../../src/websocket/WebSocketAuthSync/WebSocketAuthSync.tsx"],"names":[],"mappings":";;;;AAEA,iCAA6B;AAE7B,mCAAqE;AACrE,iEAA8D;AAO9D,MAAM,0BAA0B,GAAqC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE;IACjG,MAAM,eAAe,GAAG,IAAA,4BAAoB,EAAC,WAAW,CAAC,CAAC;IAE1D,kCAAkC;IAClC,IAAA,4BAAoB,GAAE,CAAC;IAEvB,OAAO,uBAAC,2CAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAAG,QAAQ,GAAiC,CAAC;AAC3G,CAAC,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAA,YAAI,EAAC,0BAA0B,CAAC,CAAC","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\n\nimport { memo } from 'react';\n\nimport { useWebsocketAuthSync, useWebsocketPingPong } from './hooks';\nimport { WebSocketAuthContext } from './WebSocketAuthContext';\n\nexport type WebSocketAuthSyncProps = {\n children: React.ReactNode;\n accessToken: AuthenticationInfo['accessToken'];\n};\n\nconst WebSocketAuthSyncComponent: React.FC<WebSocketAuthSyncProps> = ({ children, accessToken }) => {\n const isAuthenticated = useWebsocketAuthSync(accessToken);\n\n // Keep the active websocket alive\n useWebsocketPingPong();\n\n return <WebSocketAuthContext.Provider value={isAuthenticated}>{children}</WebSocketAuthContext.Provider>;\n};\n\nexport const WebSocketAuthSync = memo(WebSocketAuthSyncComponent);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,gEAA8C;AAC9C,yDAAuC","sourcesContent":["export * from './useWebsocketAuthSync';\nexport * from './useWebSocketIsAuthenticated';\nexport * from './useWebsocketPingPong';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebSocketIsAuthenticated.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,kEAA+D;AAExD,MAAM,2BAA2B,GAAG,GAAY,EAAE;IACvD,OAAO,IAAA,kBAAU,EAAC,2CAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC;AAFW,QAAA,2BAA2B,+BAEtC","sourcesContent":["import { useContext } from 'react';\n\nimport { WebSocketAuthContext } from '../WebSocketAuthContext';\n\nexport const useWebSocketIsAuthenticated = (): boolean => {\n return useContext(WebSocketAuthContext);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebsocketAuthSync.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AACvD,+DAO8B;AAE9B,iCAA4C;AAE5C,0CAAiD;AACjD,uCAA4H;AAErH,MAAM,oBAAoB,GAAG,CAAC,WAA8C,EAAE,EAAE;IACrF,MAAM,WAAW,GAAG,IAAA,6BAAqB,GAAE,CAAC;IAC5C,MAAM,YAAY,GAAG,IAAA,uBAAe,GAAE,CAAC;IACvC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,IAAA,uBAAe,EAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,EAAE,CAAA,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC;gBACV,IAAI,EAAE,2DAAoC,CAAC,YAAY;gBACvD,OAAO,EAAE;oBACP,WAAW,EAAE,WAAW;iBACzB;aACqD,CAAC,CAAC;QAC5D,CAAC;aAAM,IAAI,eAAe,EAAE,CAAC;YAC3B,WAAW,CAAC;gBACV,IAAI,EAAE,2DAAoC,CAAC,cAAc;aACD,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAA,oCAA4B,EAAgD,2DAAoC,CAAC,aAAa,EAAE,GAAG,EAAE,CACnI,kBAAkB,CAAC,IAAI,CAAC,CACzB,CAAC;IACF,IAAA,oCAA4B,EAAkD,2DAAoC,CAAC,eAAe,EAAE,GAAG,EAAE,CACvI,kBAAkB,CAAC,KAAK,CAAC,CAC1B,CAAC;IAEF,6BAA6B;IAC7B,IAAA,+BAAuB,EAAC,sCAAqB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACtE,IAAA,+BAAuB,EAAC,sCAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtF,mCAAmC;IACnC,IAAA,iBAAS,EAAC,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IAE5F,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAvCW,QAAA,oBAAoB,wBAuC/B","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\nimport { WebsocketServiceEvent } from 'quidproquo-web';\nimport {\n WebSocketQueueClientEventMessageAuthenticate,\n WebSocketQueueClientEventMessageUnauthenticate,\n WebSocketQueueClientMessageEventType,\n WebSocketQueueServerEventMessageAuthenticated,\n WebSocketQueueServerEventMessageUnauthenticated,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-webserver';\n\nimport { useEffect, useState } from 'react';\n\nimport { useFastCallback } from '../../../hooks';\nimport { useSubscribeToWebsocket, useSubscribeToWebSocketEvent, useWebsocketApi, useWebsocketSendEvent } from '../../hooks';\n\nexport const useWebsocketAuthSync = (accessToken: AuthenticationInfo['accessToken']) => {\n const sendMessage = useWebsocketSendEvent();\n const websocketApi = useWebsocketApi();\n const [isAuthenticated, setIsAuthenticated] = useState(false);\n\n const updateAuthTokens = useFastCallback(() => {\n if (!websocketApi?.isConnected()) {\n return;\n }\n\n if (accessToken) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Authenticate,\n payload: {\n accessToken: accessToken,\n },\n } satisfies WebSocketQueueClientEventMessageAuthenticate);\n } else if (isAuthenticated) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Unauthenticate,\n } satisfies WebSocketQueueClientEventMessageUnauthenticate);\n }\n });\n\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageAuthenticated>(WebSocketQueueServerMessageEventType.Authenticated, () =>\n setIsAuthenticated(true),\n );\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageUnauthenticated>(WebSocketQueueServerMessageEventType.Unauthenticated, () =>\n setIsAuthenticated(false),\n );\n\n // Sync the tokens in on open\n useSubscribeToWebsocket(WebsocketServiceEvent.OPEN, updateAuthTokens);\n useSubscribeToWebsocket(WebsocketServiceEvent.CLOSE, () => setIsAuthenticated(false));\n\n // Sync the tokens when they change\n useEffect(updateAuthTokens, [updateAuthTokens, accessToken, websocketApi, isAuthenticated]);\n\n return isAuthenticated;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebsocketPingPong.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.ts"],"names":[],"mappings":";;;AAAA,+DAAkH;AAElH,0CAA6C;AAC7C,uCAAoD;AAE7C,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,WAAW,GAAG,IAAA,6BAAqB,GAAE,CAAC;IAE5C,IAAA,mBAAW,EAAC,GAAG,EAAE;QACf,MAAM,SAAS,GAAyC;YACtD,IAAI,EAAE,2DAAoC,CAAC,IAAI;SAChD,CAAC;QAEF,WAAW,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACb,CAAC,CAAC;AAVW,QAAA,oBAAoB,wBAU/B","sourcesContent":["import { WebSocketQueueClientEventMessagePing, WebSocketQueueClientMessageEventType } from 'quidproquo-webserver';\n\nimport { useRunEvery } from '../../../hooks';\nimport { useWebsocketSendEvent } from '../../hooks';\n\nexport const useWebsocketPingPong = () => {\n const sendMessage = useWebsocketSendEvent();\n\n useRunEvery(() => {\n const pingEvent: WebSocketQueueClientEventMessagePing = {\n type: WebSocketQueueClientMessageEventType.Ping,\n };\n\n sendMessage(pingEvent);\n }, 8 * 60);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/websocket/WebSocketAuthSync/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,sDAAoC","sourcesContent":["export * from './hooks/useWebSocketIsAuthenticated';\nexport * from './WebSocketAuthSync';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebSocketAuthContext.js","sourceRoot":"","sources":["../../../../src/websocket/WebSocketAuthSync/WebSocketAuthContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAU,KAAK,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport const WebSocketAuthContext = createContext<boolean>(false);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebSocketAuthSync.js","sourceRoot":"","sources":["../../../../src/websocket/WebSocketAuthSync/WebSocketAuthSync.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO9D,MAAM,0BAA0B,GAAqC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE;IACjG,MAAM,eAAe,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAE1D,kCAAkC;IAClC,oBAAoB,EAAE,CAAC;IAEvB,OAAO,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAAG,QAAQ,GAAiC,CAAC;AAC3G,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,0BAA0B,CAAC,CAAC","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\n\nimport { memo } from 'react';\n\nimport { useWebsocketAuthSync, useWebsocketPingPong } from './hooks';\nimport { WebSocketAuthContext } from './WebSocketAuthContext';\n\nexport type WebSocketAuthSyncProps = {\n children: React.ReactNode;\n accessToken: AuthenticationInfo['accessToken'];\n};\n\nconst WebSocketAuthSyncComponent: React.FC<WebSocketAuthSyncProps> = ({ children, accessToken }) => {\n const isAuthenticated = useWebsocketAuthSync(accessToken);\n\n // Keep the active websocket alive\n useWebsocketPingPong();\n\n return <WebSocketAuthContext.Provider value={isAuthenticated}>{children}</WebSocketAuthContext.Provider>;\n};\n\nexport const WebSocketAuthSync = memo(WebSocketAuthSyncComponent);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './useWebsocketAuthSync';\nexport * from './useWebSocketIsAuthenticated';\nexport * from './useWebsocketPingPong';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebSocketIsAuthenticated.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/useWebSocketIsAuthenticated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAY,EAAE;IACvD,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["import { useContext } from 'react';\n\nimport { WebSocketAuthContext } from '../WebSocketAuthContext';\n\nexport const useWebSocketIsAuthenticated = (): boolean => {\n return useContext(WebSocketAuthContext);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebsocketAuthSync.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAGL,oCAAoC,EAGpC,oCAAoC,GACrC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5H,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAA8C,EAAE,EAAE;IACrF,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC;gBACV,IAAI,EAAE,oCAAoC,CAAC,YAAY;gBACvD,OAAO,EAAE;oBACP,WAAW,EAAE,WAAW;iBACzB;aACqD,CAAC,CAAC;QAC5D,CAAC;aAAM,IAAI,eAAe,EAAE,CAAC;YAC3B,WAAW,CAAC;gBACV,IAAI,EAAE,oCAAoC,CAAC,cAAc;aACD,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,4BAA4B,CAAgD,oCAAoC,CAAC,aAAa,EAAE,GAAG,EAAE,CACnI,kBAAkB,CAAC,IAAI,CAAC,CACzB,CAAC;IACF,4BAA4B,CAAkD,oCAAoC,CAAC,eAAe,EAAE,GAAG,EAAE,CACvI,kBAAkB,CAAC,KAAK,CAAC,CAC1B,CAAC;IAEF,6BAA6B;IAC7B,uBAAuB,CAAC,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACtE,uBAAuB,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtF,mCAAmC;IACnC,SAAS,CAAC,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IAE5F,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { AuthenticationInfo } from 'quidproquo-core';\nimport { WebsocketServiceEvent } from 'quidproquo-web';\nimport {\n WebSocketQueueClientEventMessageAuthenticate,\n WebSocketQueueClientEventMessageUnauthenticate,\n WebSocketQueueClientMessageEventType,\n WebSocketQueueServerEventMessageAuthenticated,\n WebSocketQueueServerEventMessageUnauthenticated,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-webserver';\n\nimport { useEffect, useState } from 'react';\n\nimport { useFastCallback } from '../../../hooks';\nimport { useSubscribeToWebsocket, useSubscribeToWebSocketEvent, useWebsocketApi, useWebsocketSendEvent } from '../../hooks';\n\nexport const useWebsocketAuthSync = (accessToken: AuthenticationInfo['accessToken']) => {\n const sendMessage = useWebsocketSendEvent();\n const websocketApi = useWebsocketApi();\n const [isAuthenticated, setIsAuthenticated] = useState(false);\n\n const updateAuthTokens = useFastCallback(() => {\n if (!websocketApi?.isConnected()) {\n return;\n }\n\n if (accessToken) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Authenticate,\n payload: {\n accessToken: accessToken,\n },\n } satisfies WebSocketQueueClientEventMessageAuthenticate);\n } else if (isAuthenticated) {\n sendMessage({\n type: WebSocketQueueClientMessageEventType.Unauthenticate,\n } satisfies WebSocketQueueClientEventMessageUnauthenticate);\n }\n });\n\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageAuthenticated>(WebSocketQueueServerMessageEventType.Authenticated, () =>\n setIsAuthenticated(true),\n );\n useSubscribeToWebSocketEvent<WebSocketQueueServerEventMessageUnauthenticated>(WebSocketQueueServerMessageEventType.Unauthenticated, () =>\n setIsAuthenticated(false),\n );\n\n // Sync the tokens in on open\n useSubscribeToWebsocket(WebsocketServiceEvent.OPEN, updateAuthTokens);\n useSubscribeToWebsocket(WebsocketServiceEvent.CLOSE, () => setIsAuthenticated(false));\n\n // Sync the tokens when they change\n useEffect(updateAuthTokens, [updateAuthTokens, accessToken, websocketApi, isAuthenticated]);\n\n return isAuthenticated;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebsocketPingPong.js","sourceRoot":"","sources":["../../../../../src/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAElH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAE5C,WAAW,CAAC,GAAG,EAAE;QACf,MAAM,SAAS,GAAyC;YACtD,IAAI,EAAE,oCAAoC,CAAC,IAAI;SAChD,CAAC;QAEF,WAAW,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { WebSocketQueueClientEventMessagePing, WebSocketQueueClientMessageEventType } from 'quidproquo-webserver';\n\nimport { useRunEvery } from '../../../hooks';\nimport { useWebsocketSendEvent } from '../../hooks';\n\nexport const useWebsocketPingPong = () => {\n const sendMessage = useWebsocketSendEvent();\n\n useRunEvery(() => {\n const pingEvent: WebSocketQueueClientEventMessagePing = {\n type: WebSocketQueueClientMessageEventType.Ping,\n };\n\n sendMessage(pingEvent);\n }, 8 * 60);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/websocket/WebSocketAuthSync/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './hooks/useWebSocketIsAuthenticated';\nexport * from './WebSocketAuthSync';\n"]}