@djangocfg/centrifugo 2.1.41 → 2.1.43
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/package.json +5 -5
- package/src/components/CentrifugoMonitor/CentrifugoMonitor.tsx +4 -1
- package/src/components/CentrifugoMonitor/CentrifugoMonitorDialog.tsx +5 -8
- package/src/components/CentrifugoMonitor/CentrifugoMonitorFAB.tsx +3 -2
- package/src/components/CentrifugoMonitor/CentrifugoMonitorWidget.tsx +5 -3
- package/src/components/ConnectionStatus/ConnectionStatus.tsx +6 -4
- package/src/components/ConnectionStatus/ConnectionStatusCard.tsx +4 -2
- package/src/components/MessagesFeed/MessageFilters.tsx +4 -2
- package/src/components/MessagesFeed/MessagesFeed.tsx +57 -60
- package/src/components/SubscriptionsList/SubscriptionsList.tsx +7 -11
- package/src/core/client/CentrifugoRPCClient.ts +2 -1
- package/src/core/logger/consolaLogger.ts +1 -0
- package/src/core/logger/createLogger.ts +2 -1
- package/src/debug/ConnectionTab/ConnectionTab.tsx +4 -8
- package/src/debug/DebugPanel/DebugPanel.tsx +5 -10
- package/src/debug/LogsTab/LogsTab.tsx +7 -16
- package/src/debug/SubscriptionsTab/SubscriptionsTab.tsx +4 -9
- package/src/hooks/useCodegenTip.ts +1 -0
- package/src/hooks/useNamedRPC.ts +3 -2
- package/src/hooks/useRPC.ts +3 -2
- package/src/hooks/useSubscription.ts +3 -2
- package/src/index.ts +2 -3
- package/src/providers/CentrifugoProvider/CentrifugoProvider.tsx +11 -5
- package/src/providers/LogsProvider/LogsProvider.tsx +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/centrifugo",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.43",
|
|
4
4
|
"description": "Production-ready Centrifugo WebSocket client for React with real-time subscriptions, RPC patterns, and connection state management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"centrifugo",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"centrifuge": "^5.2.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@djangocfg/api": "^2.1.
|
|
55
|
-
"@djangocfg/ui-nextjs": "^2.1.
|
|
56
|
-
"@djangocfg/layouts": "^2.1.
|
|
54
|
+
"@djangocfg/api": "^2.1.43",
|
|
55
|
+
"@djangocfg/ui-nextjs": "^2.1.43",
|
|
56
|
+
"@djangocfg/layouts": "^2.1.43",
|
|
57
57
|
"consola": "^3.4.2",
|
|
58
58
|
"lucide-react": "^0.545.0",
|
|
59
59
|
"moment": "^2.30.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react-dom": "^19.1.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
64
|
+
"@djangocfg/typescript-config": "^2.1.43",
|
|
65
65
|
"@types/react": "^19.1.0",
|
|
66
66
|
"@types/react-dom": "^19.1.0",
|
|
67
67
|
"moment": "^2.30.1",
|
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@djangocfg/ui-nextjs';
|
|
13
|
+
|
|
12
14
|
import { ConnectionStatus } from '../ConnectionStatus';
|
|
13
15
|
import { MessagesFeed } from '../MessagesFeed';
|
|
14
16
|
import { SubscriptionsList } from '../SubscriptionsList';
|
|
17
|
+
|
|
15
18
|
import type { CentrifugoMessage } from '../MessagesFeed';
|
|
16
19
|
|
|
17
20
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -7,18 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
+
import { Activity } from 'lucide-react';
|
|
10
11
|
import React, { useState } from 'react';
|
|
12
|
+
|
|
11
13
|
import {
|
|
12
|
-
|
|
13
|
-
SheetContent,
|
|
14
|
-
SheetHeader,
|
|
15
|
-
SheetTitle,
|
|
16
|
-
SheetDescription,
|
|
17
|
-
useEventListener,
|
|
14
|
+
Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, useEventListener
|
|
18
15
|
} from '@djangocfg/ui-nextjs';
|
|
19
|
-
|
|
16
|
+
|
|
17
|
+
import { CENTRIFUGO_MONITOR_EVENTS, OpenMonitorDialogPayload} from '../../events';
|
|
20
18
|
import { CentrifugoMonitor } from './CentrifugoMonitor';
|
|
21
|
-
import { CENTRIFUGO_MONITOR_EVENTS, type OpenMonitorDialogPayload } from '../../events';
|
|
22
19
|
|
|
23
20
|
// ─────────────────────────────────────────────────────────────────────────
|
|
24
21
|
// Component
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import React from 'react';
|
|
11
10
|
import { Activity } from 'lucide-react';
|
|
12
|
-
import
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
import { emitOpenMonitorDialog, OpenMonitorDialogPayload} from '../../events';
|
|
13
14
|
|
|
14
15
|
// ─────────────────────────────────────────────────────────────────────────
|
|
15
16
|
// Types
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import { Card, CardContent, CardHeader, CardTitle, Button } from '@djangocfg/ui-nextjs';
|
|
12
10
|
import { Activity, Maximize2 } from 'lucide-react';
|
|
13
|
-
import
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
import { Button, Card, CardContent, CardHeader, CardTitle } from '@djangocfg/ui-nextjs';
|
|
14
|
+
|
|
14
15
|
import { emitOpenMonitorDialog } from '../../events';
|
|
16
|
+
import { ConnectionStatus } from '../ConnectionStatus';
|
|
15
17
|
|
|
16
18
|
// ─────────────────────────────────────────────────────────────────────────
|
|
17
19
|
// Types
|
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import { Badge } from '@djangocfg/ui-nextjs';
|
|
12
|
-
import { Wifi, WifiOff, Radio, Clock } from 'lucide-react';
|
|
10
|
+
import { Clock, Radio, Wifi, WifiOff } from 'lucide-react';
|
|
13
11
|
import moment from 'moment';
|
|
14
|
-
import {
|
|
12
|
+
import React, { useEffect, useState } from 'react';
|
|
13
|
+
|
|
14
|
+
import { Badge } from '@djangocfg/ui-nextjs';
|
|
15
|
+
|
|
15
16
|
import { getConsolaLogger } from '../../core/logger/consolaLogger';
|
|
17
|
+
import { useCentrifugo } from '../../providers/CentrifugoProvider';
|
|
16
18
|
|
|
17
19
|
const logger = getConsolaLogger('ConnectionStatus');
|
|
18
20
|
|
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
+
import { Wifi, WifiOff } from 'lucide-react';
|
|
10
11
|
import React from 'react';
|
|
12
|
+
|
|
11
13
|
import { Card, CardContent, CardHeader, CardTitle } from '@djangocfg/ui-nextjs';
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
import { emitOpenMonitorDialog } from '../../events';
|
|
13
16
|
import { useCentrifugo } from '../../providers/CentrifugoProvider';
|
|
14
17
|
import { ConnectionStatus } from './ConnectionStatus';
|
|
15
|
-
import { emitOpenMonitorDialog } from '../../events';
|
|
16
18
|
|
|
17
19
|
// ─────────────────────────────────────────────────────────────────────────
|
|
18
20
|
// Types
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
'use client';
|
|
8
8
|
|
|
9
|
+
import { Filter, Search, X } from 'lucide-react';
|
|
9
10
|
import React from 'react';
|
|
10
|
-
|
|
11
|
-
import {
|
|
11
|
+
|
|
12
|
+
import { Badge, Button, Input } from '@djangocfg/ui-nextjs';
|
|
13
|
+
|
|
12
14
|
import type { MessageFilters as MessageFiltersType } from './types';
|
|
13
15
|
|
|
14
16
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -7,30 +7,19 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
11
10
|
import {
|
|
12
|
-
|
|
13
|
-
CardContent,
|
|
14
|
-
CardHeader,
|
|
15
|
-
CardTitle,
|
|
16
|
-
Badge,
|
|
17
|
-
Button,
|
|
18
|
-
ScrollArea,
|
|
19
|
-
} from '@djangocfg/ui-nextjs';
|
|
20
|
-
import {
|
|
21
|
-
Trash2,
|
|
22
|
-
Pause,
|
|
23
|
-
Play,
|
|
24
|
-
Download,
|
|
25
|
-
Activity,
|
|
26
|
-
AlertCircle,
|
|
27
|
-
CheckCircle2,
|
|
28
|
-
Info,
|
|
29
|
-
Circle,
|
|
11
|
+
Activity, AlertCircle, CheckCircle2, Circle, Download, Info, Pause, Play, Trash2
|
|
30
12
|
} from 'lucide-react';
|
|
31
13
|
import moment from 'moment';
|
|
14
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
Badge, Button, Card, CardContent, CardHeader, CardTitle, ScrollArea
|
|
18
|
+
} from '@djangocfg/ui-nextjs';
|
|
19
|
+
|
|
32
20
|
import { useCentrifugo } from '../../providers/CentrifugoProvider';
|
|
33
21
|
import { MessageFilters as MessageFiltersComponent } from './MessageFilters';
|
|
22
|
+
|
|
34
23
|
import type { CentrifugoMessage, MessageFilters, MessagesFeedProps } from './types';
|
|
35
24
|
|
|
36
25
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -182,44 +171,52 @@ export function MessagesFeed({
|
|
|
182
171
|
}
|
|
183
172
|
}, [messages, autoScroll]);
|
|
184
173
|
|
|
185
|
-
// Filter messages
|
|
186
|
-
const filteredMessages =
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
174
|
+
// Filter and prepare messages with pre-computed values
|
|
175
|
+
const filteredMessages = useMemo(() => {
|
|
176
|
+
return messages
|
|
177
|
+
.filter((msg) => {
|
|
178
|
+
if (filters.channels && filters.channels.length > 0) {
|
|
179
|
+
if (!msg.channel || !filters.channels.includes(msg.channel)) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (filters.types && filters.types.length > 0) {
|
|
185
|
+
if (!filters.types.includes(msg.type)) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (filters.levels && filters.levels.length > 0) {
|
|
191
|
+
if (!filters.levels.includes(msg.level)) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (filters.searchQuery) {
|
|
197
|
+
const query = filters.searchQuery.toLowerCase();
|
|
198
|
+
const searchableText = [
|
|
199
|
+
msg.message,
|
|
200
|
+
msg.channel,
|
|
201
|
+
JSON.stringify(msg.data),
|
|
202
|
+
]
|
|
203
|
+
.filter(Boolean)
|
|
204
|
+
.join(' ')
|
|
205
|
+
.toLowerCase();
|
|
206
|
+
|
|
207
|
+
if (!searchableText.includes(query)) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return true;
|
|
213
|
+
})
|
|
214
|
+
.map((msg) => ({
|
|
215
|
+
...msg,
|
|
216
|
+
formattedTime: moment.utc(msg.timestamp).format('HH:mm:ss'),
|
|
217
|
+
formattedData: msg.data ? JSON.stringify(msg.data, null, 2) : null,
|
|
218
|
+
}));
|
|
219
|
+
}, [messages, filters]);
|
|
223
220
|
|
|
224
221
|
// Clear messages
|
|
225
222
|
const handleClear = () => {
|
|
@@ -353,19 +350,19 @@ export function MessagesFeed({
|
|
|
353
350
|
</Badge>
|
|
354
351
|
)}
|
|
355
352
|
<span className="text-xs text-muted-foreground">
|
|
356
|
-
{
|
|
353
|
+
{msg.formattedTime}
|
|
357
354
|
</span>
|
|
358
355
|
</div>
|
|
359
356
|
{msg.message && (
|
|
360
357
|
<p className="text-sm break-words">{msg.message}</p>
|
|
361
358
|
)}
|
|
362
|
-
{msg.
|
|
359
|
+
{msg.formattedData && (
|
|
363
360
|
<details className="text-xs">
|
|
364
361
|
<summary className="cursor-pointer text-muted-foreground hover:text-foreground">
|
|
365
362
|
View data
|
|
366
363
|
</summary>
|
|
367
364
|
<pre className="mt-2 p-2 bg-muted rounded overflow-x-auto">
|
|
368
|
-
{
|
|
365
|
+
{msg.formattedData}
|
|
369
366
|
</pre>
|
|
370
367
|
</details>
|
|
371
368
|
)}
|
|
@@ -6,20 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
'use client';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import { Subscription, SubscriptionState } from 'centrifuge';
|
|
10
|
+
import { Radio, RefreshCw, Trash2 } from 'lucide-react';
|
|
11
|
+
import React, { useEffect, useState } from 'react';
|
|
12
|
+
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
CardContent,
|
|
13
|
-
CardHeader,
|
|
14
|
-
CardTitle,
|
|
15
|
-
Badge,
|
|
16
|
-
Button,
|
|
17
|
-
ScrollArea,
|
|
14
|
+
Badge, Button, Card, CardContent, CardHeader, CardTitle, ScrollArea
|
|
18
15
|
} from '@djangocfg/ui-nextjs';
|
|
19
|
-
|
|
20
|
-
import { Subscription, SubscriptionState } from 'centrifuge';
|
|
21
|
-
import { useCentrifugo } from '../../providers/CentrifugoProvider';
|
|
16
|
+
|
|
22
17
|
import { getConsolaLogger } from '../../core/logger/consolaLogger';
|
|
18
|
+
import { useCentrifugo } from '../../providers/CentrifugoProvider';
|
|
23
19
|
|
|
24
20
|
const logger = getConsolaLogger('SubscriptionsList');
|
|
25
21
|
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Centrifuge } from 'centrifuge';
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
import { getConsolaLogger } from '../logger/consolaLogger';
|
|
11
11
|
|
|
12
|
+
import type { Logger } from '../logger';
|
|
12
13
|
export interface CentrifugoClientOptions {
|
|
13
14
|
url: string;
|
|
14
15
|
token: string;
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { createConsola } from 'consola';
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
import { getGlobalLogsStore } from './LogsStore';
|
|
11
11
|
|
|
12
|
+
import type { LogEntry, LogLevel } from '../types';
|
|
12
13
|
export interface Logger {
|
|
13
14
|
debug: (message: string, data?: unknown) => void;
|
|
14
15
|
info: (message: string, data?: unknown) => void;
|
|
@@ -6,16 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
'use client';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Clock, RefreshCw, Wifi, WifiOff } from 'lucide-react';
|
|
10
|
+
|
|
10
11
|
import {
|
|
11
|
-
|
|
12
|
-
CardContent,
|
|
13
|
-
CardHeader,
|
|
14
|
-
CardTitle,
|
|
15
|
-
Badge,
|
|
16
|
-
Button,
|
|
17
|
-
Separator,
|
|
12
|
+
Badge, Button, Card, CardContent, CardHeader, CardTitle, Separator
|
|
18
13
|
} from '@djangocfg/ui-nextjs';
|
|
14
|
+
|
|
19
15
|
import { useCentrifugo } from '../../providers/CentrifugoProvider';
|
|
20
16
|
|
|
21
17
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -7,19 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import { useState } from 'react';
|
|
11
10
|
import { Bug } from 'lucide-react';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
|
|
12
13
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
SheetHeader,
|
|
16
|
-
SheetTitle,
|
|
17
|
-
SheetDescription,
|
|
18
|
-
Tabs,
|
|
19
|
-
TabsList,
|
|
20
|
-
TabsTrigger,
|
|
21
|
-
TabsContent,
|
|
14
|
+
Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, Tabs, TabsContent, TabsList,
|
|
15
|
+
TabsTrigger
|
|
22
16
|
} from '@djangocfg/ui-nextjs';
|
|
17
|
+
|
|
23
18
|
import { ConnectionTab } from '../ConnectionTab';
|
|
24
19
|
import { LogsTab } from '../LogsTab';
|
|
25
20
|
import { SubscriptionsTab } from '../SubscriptionsTab';
|
|
@@ -7,26 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { Trash2, Search, Filter } from 'lucide-react';
|
|
10
|
+
import { Filter, Search, Trash2 } from 'lucide-react';
|
|
12
11
|
import moment from 'moment';
|
|
12
|
+
import { useEffect, useRef, useState } from 'react';
|
|
13
|
+
|
|
13
14
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
CardHeader,
|
|
17
|
-
CardTitle,
|
|
18
|
-
Button,
|
|
19
|
-
Input,
|
|
20
|
-
Select,
|
|
21
|
-
SelectContent,
|
|
22
|
-
SelectItem,
|
|
23
|
-
SelectTrigger,
|
|
24
|
-
SelectValue,
|
|
25
|
-
ScrollArea,
|
|
26
|
-
Badge,
|
|
27
|
-
PrettyCode,
|
|
15
|
+
Badge, Button, Card, CardContent, CardHeader, CardTitle, Input, PrettyCode, ScrollArea, Select,
|
|
16
|
+
SelectContent, SelectItem, SelectTrigger, SelectValue
|
|
28
17
|
} from '@djangocfg/ui-nextjs';
|
|
18
|
+
|
|
29
19
|
import { useLogs } from '../../providers/LogsProvider';
|
|
20
|
+
|
|
30
21
|
import type { LogLevel, LogEntry } from '../../core/types';
|
|
31
22
|
|
|
32
23
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -6,18 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
'use client';
|
|
8
8
|
|
|
9
|
-
import { Fragment } from 'react';
|
|
10
9
|
import { Radio, Trash2 } from 'lucide-react';
|
|
10
|
+
import { Fragment } from 'react';
|
|
11
|
+
|
|
11
12
|
import {
|
|
12
|
-
|
|
13
|
-
CardContent,
|
|
14
|
-
CardHeader,
|
|
15
|
-
CardTitle,
|
|
16
|
-
Badge,
|
|
17
|
-
Button,
|
|
18
|
-
ScrollArea,
|
|
19
|
-
Separator,
|
|
13
|
+
Badge, Button, Card, CardContent, CardHeader, CardTitle, ScrollArea, Separator
|
|
20
14
|
} from '@djangocfg/ui-nextjs';
|
|
15
|
+
|
|
21
16
|
import { useCentrifugo } from '../../providers/CentrifugoProvider';
|
|
22
17
|
|
|
23
18
|
// ─────────────────────────────────────────────────────────────────────────
|
package/src/hooks/useNamedRPC.ts
CHANGED
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
|
|
26
26
|
'use client';
|
|
27
27
|
|
|
28
|
-
import {
|
|
29
|
-
|
|
28
|
+
import { useCallback, useRef, useState } from 'react';
|
|
29
|
+
|
|
30
30
|
import { getConsolaLogger } from '../core/logger/consolaLogger';
|
|
31
|
+
import { useCentrifugo } from '../providers/CentrifugoProvider';
|
|
31
32
|
|
|
32
33
|
export interface UseNamedRPCOptions {
|
|
33
34
|
onError?: (error: Error) => void;
|
package/src/hooks/useRPC.ts
CHANGED
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
'use client';
|
|
22
22
|
|
|
23
|
-
import {
|
|
24
|
-
|
|
23
|
+
import { useCallback, useRef, useState } from 'react';
|
|
24
|
+
|
|
25
25
|
import { getConsolaLogger } from '../core/logger/consolaLogger';
|
|
26
|
+
import { useCentrifugo } from '../providers/CentrifugoProvider';
|
|
26
27
|
|
|
27
28
|
export interface UseRPCOptions {
|
|
28
29
|
timeout?: number;
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
'use client';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
15
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
16
|
+
|
|
17
17
|
import { getConsolaLogger } from '../core/logger/consolaLogger';
|
|
18
18
|
import { logChannelWarnings } from '../core/utils/channelValidator';
|
|
19
|
+
import { useCentrifugo } from '../providers/CentrifugoProvider';
|
|
19
20
|
|
|
20
21
|
export interface UseSubscriptionOptions<T = any> {
|
|
21
22
|
channel: string;
|
package/src/index.ts
CHANGED
|
@@ -41,11 +41,10 @@
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
// ─────────────────────────────────────────────────────────────────────────
|
|
44
|
-
// Re-export
|
|
44
|
+
// Re-export everything from centrifuge for advanced usage
|
|
45
45
|
// ─────────────────────────────────────────────────────────────────────────
|
|
46
46
|
|
|
47
|
-
export
|
|
48
|
-
export type { Subscription } from 'centrifuge';
|
|
47
|
+
export * from 'centrifuge';
|
|
49
48
|
|
|
50
49
|
// ─────────────────────────────────────────────────────────────────────────
|
|
51
50
|
// Core (Platform-agnostic)
|
|
@@ -7,16 +7,22 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState
|
|
12
|
+
} from 'react';
|
|
13
|
+
|
|
11
14
|
import { useAuth } from '@djangocfg/api/auth';
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
CentrifugoMonitorDialog
|
|
18
|
+
} from '../../components/CentrifugoMonitor/CentrifugoMonitorDialog';
|
|
19
|
+
import { isDevelopment, isStaticBuild, reconnectConfig } from '../../config';
|
|
12
20
|
import { CentrifugoRPCClient } from '../../core/client';
|
|
13
21
|
import { getConsolaLogger } from '../../core/logger/consolaLogger';
|
|
14
|
-
import type { ConnectionState, CentrifugoToken, ActiveSubscription } from '../../core/types';
|
|
15
|
-
import { LogsProvider } from '../LogsProvider';
|
|
16
|
-
import { isStaticBuild, isDevelopment, reconnectConfig } from '../../config';
|
|
17
|
-
import { CentrifugoMonitorDialog } from '../../components/CentrifugoMonitor/CentrifugoMonitorDialog';
|
|
18
22
|
import { useCodegenTip } from '../../hooks/useCodegenTip';
|
|
23
|
+
import { LogsProvider } from '../LogsProvider';
|
|
19
24
|
|
|
25
|
+
import type { ConnectionState, CentrifugoToken, ActiveSubscription } from '../../core/types';
|
|
20
26
|
// ─────────────────────────────────────────────────────────────────────────
|
|
21
27
|
// Context
|
|
22
28
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -7,10 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
'use client';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
createContext, ReactNode, useCallback, useContext, useEffect, useState
|
|
12
|
+
} from 'react';
|
|
13
|
+
|
|
12
14
|
import { getGlobalLogsStore } from '../../core/logger';
|
|
13
15
|
|
|
16
|
+
import type { LogEntry, LogLevel } from '../../core/types';
|
|
14
17
|
// ─────────────────────────────────────────────────────────────────────────
|
|
15
18
|
// Context
|
|
16
19
|
// ─────────────────────────────────────────────────────────────────────────
|