@elevasis/ui 1.28.0 → 1.28.1
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.
- package/dist/features/operations/index.d.ts +7 -49
- package/dist/hooks/index.d.ts +5 -47
- package/dist/hooks/published.d.ts +5 -47
- package/dist/index.d.ts +7 -49
- package/dist/provider/index.d.ts +3 -45
- package/dist/provider/published.d.ts +3 -45
- package/dist/sse/index.d.ts +10 -2
- package/package.json +1 -1
|
@@ -1585,51 +1585,9 @@ interface FetchEventSourceWithTokenRefreshOptions {
|
|
|
1585
1585
|
onclose?: () => void;
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
|
-
interface
|
|
1589
|
-
/** Grace period in ms before closing idle connections. Defaults to 5000. */
|
|
1590
|
-
closeGracePeriodMs?: number;
|
|
1591
|
-
}
|
|
1592
|
-
/**
|
|
1593
|
-
* SSE Connection Manager
|
|
1594
|
-
*
|
|
1595
|
-
* Ensures only ONE SSE connection exists per endpoint, preventing duplicate
|
|
1596
|
-
* connections when components re-render or remount.
|
|
1597
|
-
*
|
|
1598
|
-
* Benefits:
|
|
1599
|
-
* - Prevents resource waste from duplicate connections
|
|
1600
|
-
* - Eliminates race conditions from overlapping connections
|
|
1601
|
-
* - Automatically manages connection lifecycle
|
|
1602
|
-
* - Shares single connection across multiple subscribers
|
|
1603
|
-
*/
|
|
1604
|
-
declare class SSEConnectionManager {
|
|
1605
|
-
private connections;
|
|
1606
|
-
private closeGracePeriodMs;
|
|
1607
|
-
constructor(options?: SSEConnectionManagerOptions);
|
|
1608
|
-
/**
|
|
1609
|
-
* Subscribe to an SSE endpoint
|
|
1610
|
-
*
|
|
1611
|
-
* If a connection already exists for this endpoint, reuses it.
|
|
1612
|
-
* Otherwise, creates a new connection.
|
|
1613
|
-
*
|
|
1614
|
-
* @param key - Unique identifier for the connection (e.g., 'notifications', 'resource-executive-agent')
|
|
1615
|
-
* @param subscriberId - Unique identifier for this subscriber (usually component instance)
|
|
1616
|
-
* @param options - SSE connection options
|
|
1617
|
-
* @returns Unsubscribe function to call when component unmounts
|
|
1618
|
-
*/
|
|
1588
|
+
interface SSEConnectionManagerLike {
|
|
1619
1589
|
subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
|
|
1620
|
-
/**
|
|
1621
|
-
* Unsubscribe from an SSE endpoint
|
|
1622
|
-
*
|
|
1623
|
-
* If this is the last subscriber, closes the connection after grace period.
|
|
1624
|
-
*/
|
|
1625
|
-
private unsubscribe;
|
|
1626
|
-
/**
|
|
1627
|
-
* Force close a connection and all its subscribers
|
|
1628
|
-
*/
|
|
1629
1590
|
closeConnection(key: string): void;
|
|
1630
|
-
/**
|
|
1631
|
-
* Get current connection status
|
|
1632
|
-
*/
|
|
1633
1591
|
getConnectionInfo(): Map<string, {
|
|
1634
1592
|
url: string;
|
|
1635
1593
|
subscribers: number;
|
|
@@ -1638,7 +1596,7 @@ declare class SSEConnectionManager {
|
|
|
1638
1596
|
|
|
1639
1597
|
interface UseExecutionPanelStateOptions {
|
|
1640
1598
|
resourceId: string;
|
|
1641
|
-
manager:
|
|
1599
|
+
manager: SSEConnectionManagerLike;
|
|
1642
1600
|
/**
|
|
1643
1601
|
* Base URL of the API server (e.g. 'https://api.elevasis.io' or 'http://localhost:5170').
|
|
1644
1602
|
* Provided by the consuming app -- the library does not read environment variables directly.
|
|
@@ -1809,7 +1767,7 @@ interface CalibrationRunDetailPageProps {
|
|
|
1809
1767
|
run: CalibrationRun;
|
|
1810
1768
|
}) => ReactNode;
|
|
1811
1769
|
/** SSE connection manager instance for live calibration progress updates. */
|
|
1812
|
-
manager:
|
|
1770
|
+
manager: SSEConnectionManagerLike;
|
|
1813
1771
|
/** Base API URL used by CalibrationProgress to connect to the SSE endpoint. */
|
|
1814
1772
|
apiUrl: string;
|
|
1815
1773
|
}
|
|
@@ -1817,7 +1775,7 @@ declare function CalibrationRunDetailPage({ runId, onNavigateToProject, renderSe
|
|
|
1817
1775
|
|
|
1818
1776
|
interface CalibrationProgressProps {
|
|
1819
1777
|
runId: string;
|
|
1820
|
-
manager:
|
|
1778
|
+
manager: SSEConnectionManagerLike;
|
|
1821
1779
|
apiUrl: string;
|
|
1822
1780
|
}
|
|
1823
1781
|
declare function CalibrationProgress({ runId, manager, apiUrl }: CalibrationProgressProps): react_jsx_runtime.JSX.Element;
|
|
@@ -1841,7 +1799,7 @@ interface ExecutionPanelProps extends ExecutionSelectionControlProps$2 {
|
|
|
1841
1799
|
resourceType: ResourceType$1;
|
|
1842
1800
|
resourceName?: string;
|
|
1843
1801
|
resourceDefinition: AIResourceDefinition;
|
|
1844
|
-
sseManager:
|
|
1802
|
+
sseManager: SSEConnectionManagerLike;
|
|
1845
1803
|
apiUrl: string;
|
|
1846
1804
|
onConnectionStatus?: (connected: boolean, runningCount: number) => void;
|
|
1847
1805
|
}
|
|
@@ -1852,7 +1810,7 @@ interface WorkflowExecutionPanelProps extends ExecutionSelectionControlProps$1 {
|
|
|
1852
1810
|
resourceId: string;
|
|
1853
1811
|
resourceName?: string;
|
|
1854
1812
|
resourceDefinition: SerializedWorkflowDefinition;
|
|
1855
|
-
sseManager:
|
|
1813
|
+
sseManager: SSEConnectionManagerLike;
|
|
1856
1814
|
apiUrl: string;
|
|
1857
1815
|
onConnectionStatus?: (connected: boolean, runningCount: number) => void;
|
|
1858
1816
|
}
|
|
@@ -1863,7 +1821,7 @@ interface AgentExecutionPanelProps extends ExecutionSelectionControlProps {
|
|
|
1863
1821
|
resourceId: string;
|
|
1864
1822
|
resourceName?: string;
|
|
1865
1823
|
resourceDefinition: SerializedAgentDefinition;
|
|
1866
|
-
sseManager:
|
|
1824
|
+
sseManager: SSEConnectionManagerLike;
|
|
1867
1825
|
apiUrl: string;
|
|
1868
1826
|
onConnectionStatus?: (connected: boolean, runningCount: number) => void;
|
|
1869
1827
|
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -9573,51 +9573,9 @@ interface FetchEventSourceWithTokenRefreshOptions {
|
|
|
9573
9573
|
onclose?: () => void;
|
|
9574
9574
|
}
|
|
9575
9575
|
|
|
9576
|
-
interface
|
|
9577
|
-
/** Grace period in ms before closing idle connections. Defaults to 5000. */
|
|
9578
|
-
closeGracePeriodMs?: number;
|
|
9579
|
-
}
|
|
9580
|
-
/**
|
|
9581
|
-
* SSE Connection Manager
|
|
9582
|
-
*
|
|
9583
|
-
* Ensures only ONE SSE connection exists per endpoint, preventing duplicate
|
|
9584
|
-
* connections when components re-render or remount.
|
|
9585
|
-
*
|
|
9586
|
-
* Benefits:
|
|
9587
|
-
* - Prevents resource waste from duplicate connections
|
|
9588
|
-
* - Eliminates race conditions from overlapping connections
|
|
9589
|
-
* - Automatically manages connection lifecycle
|
|
9590
|
-
* - Shares single connection across multiple subscribers
|
|
9591
|
-
*/
|
|
9592
|
-
declare class SSEConnectionManager {
|
|
9593
|
-
private connections;
|
|
9594
|
-
private closeGracePeriodMs;
|
|
9595
|
-
constructor(options?: SSEConnectionManagerOptions);
|
|
9596
|
-
/**
|
|
9597
|
-
* Subscribe to an SSE endpoint
|
|
9598
|
-
*
|
|
9599
|
-
* If a connection already exists for this endpoint, reuses it.
|
|
9600
|
-
* Otherwise, creates a new connection.
|
|
9601
|
-
*
|
|
9602
|
-
* @param key - Unique identifier for the connection (e.g., 'notifications', 'resource-executive-agent')
|
|
9603
|
-
* @param subscriberId - Unique identifier for this subscriber (usually component instance)
|
|
9604
|
-
* @param options - SSE connection options
|
|
9605
|
-
* @returns Unsubscribe function to call when component unmounts
|
|
9606
|
-
*/
|
|
9576
|
+
interface SSEConnectionManagerLike {
|
|
9607
9577
|
subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
|
|
9608
|
-
/**
|
|
9609
|
-
* Unsubscribe from an SSE endpoint
|
|
9610
|
-
*
|
|
9611
|
-
* If this is the last subscriber, closes the connection after grace period.
|
|
9612
|
-
*/
|
|
9613
|
-
private unsubscribe;
|
|
9614
|
-
/**
|
|
9615
|
-
* Force close a connection and all its subscribers
|
|
9616
|
-
*/
|
|
9617
9578
|
closeConnection(key: string): void;
|
|
9618
|
-
/**
|
|
9619
|
-
* Get current connection status
|
|
9620
|
-
*/
|
|
9621
9579
|
getConnectionInfo(): Map<string, {
|
|
9622
9580
|
url: string;
|
|
9623
9581
|
subscribers: number;
|
|
@@ -9625,7 +9583,7 @@ declare class SSEConnectionManager {
|
|
|
9625
9583
|
}
|
|
9626
9584
|
|
|
9627
9585
|
interface UseSSEConnectionOptions {
|
|
9628
|
-
manager:
|
|
9586
|
+
manager: SSEConnectionManagerLike;
|
|
9629
9587
|
/** Shared connection key — all subscribers with the same key share ONE connection. */
|
|
9630
9588
|
connectionKey: string;
|
|
9631
9589
|
url: string;
|
|
@@ -10193,7 +10151,7 @@ declare const operationsKeys: {
|
|
|
10193
10151
|
session: (org: string, sessionId: string) => readonly ["operations", "session", string, string];
|
|
10194
10152
|
};
|
|
10195
10153
|
|
|
10196
|
-
declare function useExecutionLogSSE(resourceId: string, manager:
|
|
10154
|
+
declare function useExecutionLogSSE(resourceId: string, manager: SSEConnectionManagerLike, apiUrl: string): {
|
|
10197
10155
|
liveExecutions: Set<string>;
|
|
10198
10156
|
connected: boolean;
|
|
10199
10157
|
error: string | null;
|
|
@@ -10204,7 +10162,7 @@ declare function useExecutionLogSSE(resourceId: string, manager: SSEConnectionMa
|
|
|
10204
10162
|
|
|
10205
10163
|
interface UseExecutionPanelStateOptions {
|
|
10206
10164
|
resourceId: string;
|
|
10207
|
-
manager:
|
|
10165
|
+
manager: SSEConnectionManagerLike;
|
|
10208
10166
|
/**
|
|
10209
10167
|
* Base URL of the API server (e.g. 'https://api.elevasis.io' or 'http://localhost:5170').
|
|
10210
10168
|
* Provided by the consuming app -- the library does not read environment variables directly.
|
|
@@ -10647,7 +10605,7 @@ interface CalibrationProgress {
|
|
|
10647
10605
|
}
|
|
10648
10606
|
interface UseCalibrationSSEOptions {
|
|
10649
10607
|
runId: string;
|
|
10650
|
-
manager:
|
|
10608
|
+
manager: SSEConnectionManagerLike;
|
|
10651
10609
|
apiUrl: string;
|
|
10652
10610
|
enabled?: boolean;
|
|
10653
10611
|
}
|
|
@@ -6765,51 +6765,9 @@ interface FetchEventSourceWithTokenRefreshOptions {
|
|
|
6765
6765
|
onclose?: () => void;
|
|
6766
6766
|
}
|
|
6767
6767
|
|
|
6768
|
-
interface
|
|
6769
|
-
/** Grace period in ms before closing idle connections. Defaults to 5000. */
|
|
6770
|
-
closeGracePeriodMs?: number;
|
|
6771
|
-
}
|
|
6772
|
-
/**
|
|
6773
|
-
* SSE Connection Manager
|
|
6774
|
-
*
|
|
6775
|
-
* Ensures only ONE SSE connection exists per endpoint, preventing duplicate
|
|
6776
|
-
* connections when components re-render or remount.
|
|
6777
|
-
*
|
|
6778
|
-
* Benefits:
|
|
6779
|
-
* - Prevents resource waste from duplicate connections
|
|
6780
|
-
* - Eliminates race conditions from overlapping connections
|
|
6781
|
-
* - Automatically manages connection lifecycle
|
|
6782
|
-
* - Shares single connection across multiple subscribers
|
|
6783
|
-
*/
|
|
6784
|
-
declare class SSEConnectionManager {
|
|
6785
|
-
private connections;
|
|
6786
|
-
private closeGracePeriodMs;
|
|
6787
|
-
constructor(options?: SSEConnectionManagerOptions);
|
|
6788
|
-
/**
|
|
6789
|
-
* Subscribe to an SSE endpoint
|
|
6790
|
-
*
|
|
6791
|
-
* If a connection already exists for this endpoint, reuses it.
|
|
6792
|
-
* Otherwise, creates a new connection.
|
|
6793
|
-
*
|
|
6794
|
-
* @param key - Unique identifier for the connection (e.g., 'notifications', 'resource-executive-agent')
|
|
6795
|
-
* @param subscriberId - Unique identifier for this subscriber (usually component instance)
|
|
6796
|
-
* @param options - SSE connection options
|
|
6797
|
-
* @returns Unsubscribe function to call when component unmounts
|
|
6798
|
-
*/
|
|
6768
|
+
interface SSEConnectionManagerLike {
|
|
6799
6769
|
subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
|
|
6800
|
-
/**
|
|
6801
|
-
* Unsubscribe from an SSE endpoint
|
|
6802
|
-
*
|
|
6803
|
-
* If this is the last subscriber, closes the connection after grace period.
|
|
6804
|
-
*/
|
|
6805
|
-
private unsubscribe;
|
|
6806
|
-
/**
|
|
6807
|
-
* Force close a connection and all its subscribers
|
|
6808
|
-
*/
|
|
6809
6770
|
closeConnection(key: string): void;
|
|
6810
|
-
/**
|
|
6811
|
-
* Get current connection status
|
|
6812
|
-
*/
|
|
6813
6771
|
getConnectionInfo(): Map<string, {
|
|
6814
6772
|
url: string;
|
|
6815
6773
|
subscribers: number;
|
|
@@ -6817,7 +6775,7 @@ declare class SSEConnectionManager {
|
|
|
6817
6775
|
}
|
|
6818
6776
|
|
|
6819
6777
|
interface UseSSEConnectionOptions {
|
|
6820
|
-
manager:
|
|
6778
|
+
manager: SSEConnectionManagerLike;
|
|
6821
6779
|
/** Shared connection key — all subscribers with the same key share ONE connection. */
|
|
6822
6780
|
connectionKey: string;
|
|
6823
6781
|
url: string;
|
|
@@ -7027,7 +6985,7 @@ declare const operationsKeys: {
|
|
|
7027
6985
|
session: (org: string, sessionId: string) => readonly ["operations", "session", string, string];
|
|
7028
6986
|
};
|
|
7029
6987
|
|
|
7030
|
-
declare function useExecutionLogSSE(resourceId: string, manager:
|
|
6988
|
+
declare function useExecutionLogSSE(resourceId: string, manager: SSEConnectionManagerLike, apiUrl: string): {
|
|
7031
6989
|
liveExecutions: Set<string>;
|
|
7032
6990
|
connected: boolean;
|
|
7033
6991
|
error: string | null;
|
|
@@ -7038,7 +6996,7 @@ declare function useExecutionLogSSE(resourceId: string, manager: SSEConnectionMa
|
|
|
7038
6996
|
|
|
7039
6997
|
interface UseExecutionPanelStateOptions {
|
|
7040
6998
|
resourceId: string;
|
|
7041
|
-
manager:
|
|
6999
|
+
manager: SSEConnectionManagerLike;
|
|
7042
7000
|
/**
|
|
7043
7001
|
* Base URL of the API server (e.g. 'https://api.elevasis.io' or 'http://localhost:5170').
|
|
7044
7002
|
* Provided by the consuming app -- the library does not read environment variables directly.
|
|
@@ -7481,7 +7439,7 @@ interface CalibrationProgress {
|
|
|
7481
7439
|
}
|
|
7482
7440
|
interface UseCalibrationSSEOptions {
|
|
7483
7441
|
runId: string;
|
|
7484
|
-
manager:
|
|
7442
|
+
manager: SSEConnectionManagerLike;
|
|
7485
7443
|
apiUrl: string;
|
|
7486
7444
|
enabled?: boolean;
|
|
7487
7445
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6843,51 +6843,9 @@ interface FetchEventSourceWithTokenRefreshOptions {
|
|
|
6843
6843
|
onclose?: () => void;
|
|
6844
6844
|
}
|
|
6845
6845
|
|
|
6846
|
-
interface
|
|
6847
|
-
/** Grace period in ms before closing idle connections. Defaults to 5000. */
|
|
6848
|
-
closeGracePeriodMs?: number;
|
|
6849
|
-
}
|
|
6850
|
-
/**
|
|
6851
|
-
* SSE Connection Manager
|
|
6852
|
-
*
|
|
6853
|
-
* Ensures only ONE SSE connection exists per endpoint, preventing duplicate
|
|
6854
|
-
* connections when components re-render or remount.
|
|
6855
|
-
*
|
|
6856
|
-
* Benefits:
|
|
6857
|
-
* - Prevents resource waste from duplicate connections
|
|
6858
|
-
* - Eliminates race conditions from overlapping connections
|
|
6859
|
-
* - Automatically manages connection lifecycle
|
|
6860
|
-
* - Shares single connection across multiple subscribers
|
|
6861
|
-
*/
|
|
6862
|
-
declare class SSEConnectionManager {
|
|
6863
|
-
private connections;
|
|
6864
|
-
private closeGracePeriodMs;
|
|
6865
|
-
constructor(options?: SSEConnectionManagerOptions);
|
|
6866
|
-
/**
|
|
6867
|
-
* Subscribe to an SSE endpoint
|
|
6868
|
-
*
|
|
6869
|
-
* If a connection already exists for this endpoint, reuses it.
|
|
6870
|
-
* Otherwise, creates a new connection.
|
|
6871
|
-
*
|
|
6872
|
-
* @param key - Unique identifier for the connection (e.g., 'notifications', 'resource-executive-agent')
|
|
6873
|
-
* @param subscriberId - Unique identifier for this subscriber (usually component instance)
|
|
6874
|
-
* @param options - SSE connection options
|
|
6875
|
-
* @returns Unsubscribe function to call when component unmounts
|
|
6876
|
-
*/
|
|
6846
|
+
interface SSEConnectionManagerLike {
|
|
6877
6847
|
subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
|
|
6878
|
-
/**
|
|
6879
|
-
* Unsubscribe from an SSE endpoint
|
|
6880
|
-
*
|
|
6881
|
-
* If this is the last subscriber, closes the connection after grace period.
|
|
6882
|
-
*/
|
|
6883
|
-
private unsubscribe;
|
|
6884
|
-
/**
|
|
6885
|
-
* Force close a connection and all its subscribers
|
|
6886
|
-
*/
|
|
6887
6848
|
closeConnection(key: string): void;
|
|
6888
|
-
/**
|
|
6889
|
-
* Get current connection status
|
|
6890
|
-
*/
|
|
6891
6849
|
getConnectionInfo(): Map<string, {
|
|
6892
6850
|
url: string;
|
|
6893
6851
|
subscribers: number;
|
|
@@ -6924,7 +6882,7 @@ interface ElevasisFeaturesProviderProps {
|
|
|
6924
6882
|
features: FeatureModule[];
|
|
6925
6883
|
timeRange?: TimeRange;
|
|
6926
6884
|
operationsApiUrl?: string;
|
|
6927
|
-
operationsSSEManager?:
|
|
6885
|
+
operationsSSEManager?: SSEConnectionManagerLike;
|
|
6928
6886
|
children: ReactNode;
|
|
6929
6887
|
}
|
|
6930
6888
|
interface ElevasisFeaturesContextValue {
|
|
@@ -6933,7 +6891,7 @@ interface ElevasisFeaturesContextValue {
|
|
|
6933
6891
|
allFeatures: FeatureModule[];
|
|
6934
6892
|
timeRange?: TimeRange;
|
|
6935
6893
|
operationsApiUrl?: string;
|
|
6936
|
-
operationsSSEManager?:
|
|
6894
|
+
operationsSSEManager?: SSEConnectionManagerLike;
|
|
6937
6895
|
isFeatureEnabled: (key: string) => boolean;
|
|
6938
6896
|
getFeature: (key: string) => FeatureModule | undefined;
|
|
6939
6897
|
}
|
|
@@ -11142,7 +11100,7 @@ declare function createUseFeatureAccess({ useInitialization, useOrganization }:
|
|
|
11142
11100
|
};
|
|
11143
11101
|
|
|
11144
11102
|
interface UseSSEConnectionOptions {
|
|
11145
|
-
manager:
|
|
11103
|
+
manager: SSEConnectionManagerLike;
|
|
11146
11104
|
/** Shared connection key — all subscribers with the same key share ONE connection. */
|
|
11147
11105
|
connectionKey: string;
|
|
11148
11106
|
url: string;
|
|
@@ -11689,7 +11647,7 @@ declare const operationsKeys: {
|
|
|
11689
11647
|
session: (org: string, sessionId: string) => readonly ["operations", "session", string, string];
|
|
11690
11648
|
};
|
|
11691
11649
|
|
|
11692
|
-
declare function useExecutionLogSSE(resourceId: string, manager:
|
|
11650
|
+
declare function useExecutionLogSSE(resourceId: string, manager: SSEConnectionManagerLike, apiUrl: string): {
|
|
11693
11651
|
liveExecutions: Set<string>;
|
|
11694
11652
|
connected: boolean;
|
|
11695
11653
|
error: string | null;
|
|
@@ -11700,7 +11658,7 @@ declare function useExecutionLogSSE(resourceId: string, manager: SSEConnectionMa
|
|
|
11700
11658
|
|
|
11701
11659
|
interface UseExecutionPanelStateOptions {
|
|
11702
11660
|
resourceId: string;
|
|
11703
|
-
manager:
|
|
11661
|
+
manager: SSEConnectionManagerLike;
|
|
11704
11662
|
/**
|
|
11705
11663
|
* Base URL of the API server (e.g. 'https://api.elevasis.io' or 'http://localhost:5170').
|
|
11706
11664
|
* Provided by the consuming app -- the library does not read environment variables directly.
|
|
@@ -12143,7 +12101,7 @@ interface CalibrationProgress {
|
|
|
12143
12101
|
}
|
|
12144
12102
|
interface UseCalibrationSSEOptions {
|
|
12145
12103
|
runId: string;
|
|
12146
|
-
manager:
|
|
12104
|
+
manager: SSEConnectionManagerLike;
|
|
12147
12105
|
apiUrl: string;
|
|
12148
12106
|
enabled?: boolean;
|
|
12149
12107
|
}
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -297,51 +297,9 @@ interface FetchEventSourceWithTokenRefreshOptions {
|
|
|
297
297
|
onclose?: () => void;
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
interface
|
|
301
|
-
/** Grace period in ms before closing idle connections. Defaults to 5000. */
|
|
302
|
-
closeGracePeriodMs?: number;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* SSE Connection Manager
|
|
306
|
-
*
|
|
307
|
-
* Ensures only ONE SSE connection exists per endpoint, preventing duplicate
|
|
308
|
-
* connections when components re-render or remount.
|
|
309
|
-
*
|
|
310
|
-
* Benefits:
|
|
311
|
-
* - Prevents resource waste from duplicate connections
|
|
312
|
-
* - Eliminates race conditions from overlapping connections
|
|
313
|
-
* - Automatically manages connection lifecycle
|
|
314
|
-
* - Shares single connection across multiple subscribers
|
|
315
|
-
*/
|
|
316
|
-
declare class SSEConnectionManager {
|
|
317
|
-
private connections;
|
|
318
|
-
private closeGracePeriodMs;
|
|
319
|
-
constructor(options?: SSEConnectionManagerOptions);
|
|
320
|
-
/**
|
|
321
|
-
* Subscribe to an SSE endpoint
|
|
322
|
-
*
|
|
323
|
-
* If a connection already exists for this endpoint, reuses it.
|
|
324
|
-
* Otherwise, creates a new connection.
|
|
325
|
-
*
|
|
326
|
-
* @param key - Unique identifier for the connection (e.g., 'notifications', 'resource-executive-agent')
|
|
327
|
-
* @param subscriberId - Unique identifier for this subscriber (usually component instance)
|
|
328
|
-
* @param options - SSE connection options
|
|
329
|
-
* @returns Unsubscribe function to call when component unmounts
|
|
330
|
-
*/
|
|
300
|
+
interface SSEConnectionManagerLike {
|
|
331
301
|
subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
|
|
332
|
-
/**
|
|
333
|
-
* Unsubscribe from an SSE endpoint
|
|
334
|
-
*
|
|
335
|
-
* If this is the last subscriber, closes the connection after grace period.
|
|
336
|
-
*/
|
|
337
|
-
private unsubscribe;
|
|
338
|
-
/**
|
|
339
|
-
* Force close a connection and all its subscribers
|
|
340
|
-
*/
|
|
341
302
|
closeConnection(key: string): void;
|
|
342
|
-
/**
|
|
343
|
-
* Get current connection status
|
|
344
|
-
*/
|
|
345
303
|
getConnectionInfo(): Map<string, {
|
|
346
304
|
url: string;
|
|
347
305
|
subscribers: number;
|
|
@@ -378,7 +336,7 @@ interface ElevasisFeaturesProviderProps {
|
|
|
378
336
|
features: FeatureModule[];
|
|
379
337
|
timeRange?: TimeRange;
|
|
380
338
|
operationsApiUrl?: string;
|
|
381
|
-
operationsSSEManager?:
|
|
339
|
+
operationsSSEManager?: SSEConnectionManagerLike;
|
|
382
340
|
children: ReactNode;
|
|
383
341
|
}
|
|
384
342
|
interface ElevasisFeaturesContextValue {
|
|
@@ -387,7 +345,7 @@ interface ElevasisFeaturesContextValue {
|
|
|
387
345
|
allFeatures: FeatureModule[];
|
|
388
346
|
timeRange?: TimeRange;
|
|
389
347
|
operationsApiUrl?: string;
|
|
390
|
-
operationsSSEManager?:
|
|
348
|
+
operationsSSEManager?: SSEConnectionManagerLike;
|
|
391
349
|
isFeatureEnabled: (key: string) => boolean;
|
|
392
350
|
getFeature: (key: string) => FeatureModule | undefined;
|
|
393
351
|
}
|
|
@@ -296,51 +296,9 @@ interface FetchEventSourceWithTokenRefreshOptions {
|
|
|
296
296
|
onclose?: () => void;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
interface
|
|
300
|
-
/** Grace period in ms before closing idle connections. Defaults to 5000. */
|
|
301
|
-
closeGracePeriodMs?: number;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* SSE Connection Manager
|
|
305
|
-
*
|
|
306
|
-
* Ensures only ONE SSE connection exists per endpoint, preventing duplicate
|
|
307
|
-
* connections when components re-render or remount.
|
|
308
|
-
*
|
|
309
|
-
* Benefits:
|
|
310
|
-
* - Prevents resource waste from duplicate connections
|
|
311
|
-
* - Eliminates race conditions from overlapping connections
|
|
312
|
-
* - Automatically manages connection lifecycle
|
|
313
|
-
* - Shares single connection across multiple subscribers
|
|
314
|
-
*/
|
|
315
|
-
declare class SSEConnectionManager {
|
|
316
|
-
private connections;
|
|
317
|
-
private closeGracePeriodMs;
|
|
318
|
-
constructor(options?: SSEConnectionManagerOptions);
|
|
319
|
-
/**
|
|
320
|
-
* Subscribe to an SSE endpoint
|
|
321
|
-
*
|
|
322
|
-
* If a connection already exists for this endpoint, reuses it.
|
|
323
|
-
* Otherwise, creates a new connection.
|
|
324
|
-
*
|
|
325
|
-
* @param key - Unique identifier for the connection (e.g., 'notifications', 'resource-executive-agent')
|
|
326
|
-
* @param subscriberId - Unique identifier for this subscriber (usually component instance)
|
|
327
|
-
* @param options - SSE connection options
|
|
328
|
-
* @returns Unsubscribe function to call when component unmounts
|
|
329
|
-
*/
|
|
299
|
+
interface SSEConnectionManagerLike {
|
|
330
300
|
subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
|
|
331
|
-
/**
|
|
332
|
-
* Unsubscribe from an SSE endpoint
|
|
333
|
-
*
|
|
334
|
-
* If this is the last subscriber, closes the connection after grace period.
|
|
335
|
-
*/
|
|
336
|
-
private unsubscribe;
|
|
337
|
-
/**
|
|
338
|
-
* Force close a connection and all its subscribers
|
|
339
|
-
*/
|
|
340
301
|
closeConnection(key: string): void;
|
|
341
|
-
/**
|
|
342
|
-
* Get current connection status
|
|
343
|
-
*/
|
|
344
302
|
getConnectionInfo(): Map<string, {
|
|
345
303
|
url: string;
|
|
346
304
|
subscribers: number;
|
|
@@ -377,7 +335,7 @@ interface ElevasisFeaturesProviderProps {
|
|
|
377
335
|
features: FeatureModule[];
|
|
378
336
|
timeRange?: TimeRange;
|
|
379
337
|
operationsApiUrl?: string;
|
|
380
|
-
operationsSSEManager?:
|
|
338
|
+
operationsSSEManager?: SSEConnectionManagerLike;
|
|
381
339
|
children: ReactNode;
|
|
382
340
|
}
|
|
383
341
|
interface ElevasisFeaturesContextValue {
|
|
@@ -386,7 +344,7 @@ interface ElevasisFeaturesContextValue {
|
|
|
386
344
|
allFeatures: FeatureModule[];
|
|
387
345
|
timeRange?: TimeRange;
|
|
388
346
|
operationsApiUrl?: string;
|
|
389
|
-
operationsSSEManager?:
|
|
347
|
+
operationsSSEManager?: SSEConnectionManagerLike;
|
|
390
348
|
isFeatureEnabled: (key: string) => boolean;
|
|
391
349
|
getFeature: (key: string) => FeatureModule | undefined;
|
|
392
350
|
}
|
package/dist/sse/index.d.ts
CHANGED
|
@@ -32,6 +32,14 @@ interface SSEConnectionManagerOptions {
|
|
|
32
32
|
/** Grace period in ms before closing idle connections. Defaults to 5000. */
|
|
33
33
|
closeGracePeriodMs?: number;
|
|
34
34
|
}
|
|
35
|
+
interface SSEConnectionManagerLike {
|
|
36
|
+
subscribe(key: string, subscriberId: string, options: Omit<FetchEventSourceWithTokenRefreshOptions, 'signal'>): () => void;
|
|
37
|
+
closeConnection(key: string): void;
|
|
38
|
+
getConnectionInfo(): Map<string, {
|
|
39
|
+
url: string;
|
|
40
|
+
subscribers: number;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
35
43
|
/**
|
|
36
44
|
* SSE Connection Manager
|
|
37
45
|
*
|
|
@@ -44,7 +52,7 @@ interface SSEConnectionManagerOptions {
|
|
|
44
52
|
* - Automatically manages connection lifecycle
|
|
45
53
|
* - Shares single connection across multiple subscribers
|
|
46
54
|
*/
|
|
47
|
-
declare class SSEConnectionManager {
|
|
55
|
+
declare class SSEConnectionManager implements SSEConnectionManagerLike {
|
|
48
56
|
private connections;
|
|
49
57
|
private closeGracePeriodMs;
|
|
50
58
|
constructor(options?: SSEConnectionManagerOptions);
|
|
@@ -80,4 +88,4 @@ declare class SSEConnectionManager {
|
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
export { SSEConnectionManager, fetchEventSourceWithTokenRefresh };
|
|
83
|
-
export type { FetchEventSourceWithTokenRefreshOptions, SSEConnectionManagerOptions };
|
|
91
|
+
export type { FetchEventSourceWithTokenRefreshOptions, SSEConnectionManagerLike, SSEConnectionManagerOptions };
|