create-fluxstack 1.14.0 → 1.15.0
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/LLMD/resources/live-components.md +207 -12
- package/app/client/.live-stubs/LiveAdminPanel.js +5 -0
- package/app/client/.live-stubs/LiveChat.js +7 -0
- package/app/client/.live-stubs/LiveCounter.js +9 -0
- package/app/client/.live-stubs/LiveForm.js +11 -0
- package/app/client/.live-stubs/LiveLocalCounter.js +8 -0
- package/app/client/.live-stubs/LiveRoomChat.js +10 -0
- package/app/client/.live-stubs/LiveTodoList.js +9 -0
- package/app/client/.live-stubs/LiveUpload.js +15 -0
- package/app/client/src/App.tsx +11 -0
- package/app/client/src/components/AppLayout.tsx +16 -8
- package/app/client/src/live/LiveDebuggerPanel.tsx +1 -1
- package/app/client/src/live/TodoListDemo.tsx +158 -0
- package/app/server/auth/DevAuthProvider.ts +2 -2
- package/app/server/auth/JWTAuthProvider.example.ts +2 -2
- package/app/server/index.ts +2 -2
- package/app/server/live/LiveAdminPanel.ts +1 -1
- package/app/server/live/LiveProtectedChat.ts +1 -1
- package/app/server/live/LiveTodoList.ts +110 -0
- package/app/server/routes/room.routes.ts +1 -2
- package/core/build/live-components-generator.ts +1 -1
- package/core/build/vite-plugins.ts +28 -0
- package/core/client/components/LiveDebugger.tsx +1 -1
- package/core/client/hooks/useLiveUpload.ts +3 -4
- package/core/client/index.ts +37 -31
- package/core/framework/server.ts +1 -1
- package/core/server/index.ts +1 -2
- package/core/server/live/auto-generated-components.ts +6 -3
- package/core/server/live/index.ts +95 -21
- package/core/server/live/websocket-plugin.ts +27 -1087
- package/core/types/types.ts +76 -1025
- package/core/utils/version.ts +1 -1
- package/create-fluxstack.ts +1 -1
- package/package.json +5 -1
- package/plugins/crypto-auth/index.ts +1 -1
- package/plugins/crypto-auth/server/CryptoAuthLiveProvider.ts +2 -2
- package/vite.config.ts +40 -12
- package/core/client/LiveComponentsProvider.tsx +0 -531
- package/core/client/components/Live.tsx +0 -111
- package/core/client/hooks/AdaptiveChunkSizer.ts +0 -215
- package/core/client/hooks/state-validator.ts +0 -130
- package/core/client/hooks/useChunkedUpload.ts +0 -359
- package/core/client/hooks/useLiveChunkedUpload.ts +0 -87
- package/core/client/hooks/useLiveComponent.ts +0 -853
- package/core/client/hooks/useLiveDebugger.ts +0 -392
- package/core/client/hooks/useRoom.ts +0 -409
- package/core/client/hooks/useRoomProxy.ts +0 -382
- package/core/server/live/ComponentRegistry.ts +0 -1128
- package/core/server/live/FileUploadManager.ts +0 -446
- package/core/server/live/LiveComponentPerformanceMonitor.ts +0 -931
- package/core/server/live/LiveDebugger.ts +0 -462
- package/core/server/live/LiveLogger.ts +0 -144
- package/core/server/live/LiveRoomManager.ts +0 -278
- package/core/server/live/RoomEventBus.ts +0 -234
- package/core/server/live/RoomStateManager.ts +0 -172
- package/core/server/live/SingleConnectionManager.ts +0 -0
- package/core/server/live/StateSignature.ts +0 -705
- package/core/server/live/WebSocketConnectionManager.ts +0 -710
- package/core/server/live/auth/LiveAuthContext.ts +0 -71
- package/core/server/live/auth/LiveAuthManager.ts +0 -304
- package/core/server/live/auth/index.ts +0 -19
- package/core/server/live/auth/types.ts +0 -179
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// LiveTodoList - Lista de tarefas colaborativa em tempo real
|
|
2
|
+
// Testa: state mutations, room events, multiple actions, arrays no state
|
|
3
|
+
|
|
4
|
+
import { LiveComponent, type FluxStackWebSocket } from '@core/types/types'
|
|
5
|
+
|
|
6
|
+
// Componente Cliente (Ctrl+Click para navegar)
|
|
7
|
+
import type { TodoListDemo as _Client } from '@client/src/live/TodoListDemo'
|
|
8
|
+
|
|
9
|
+
interface TodoItem {
|
|
10
|
+
id: string
|
|
11
|
+
text: string
|
|
12
|
+
done: boolean
|
|
13
|
+
createdBy: string
|
|
14
|
+
createdAt: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class LiveTodoList extends LiveComponent<typeof LiveTodoList.defaultState> {
|
|
18
|
+
static componentName = 'LiveTodoList'
|
|
19
|
+
static publicActions = ['addTodo', 'toggleTodo', 'removeTodo', 'clearCompleted'] as const
|
|
20
|
+
static defaultState = {
|
|
21
|
+
todos: [] as TodoItem[],
|
|
22
|
+
totalCreated: 0,
|
|
23
|
+
connectedUsers: 0
|
|
24
|
+
}
|
|
25
|
+
protected roomType = 'todo'
|
|
26
|
+
|
|
27
|
+
constructor(initialState: Partial<typeof LiveTodoList.defaultState> = {}, ws: FluxStackWebSocket, options?: { room?: string; userId?: string }) {
|
|
28
|
+
super(initialState, ws, options)
|
|
29
|
+
|
|
30
|
+
this.onRoomEvent<{ todos: TodoItem[]; totalCreated: number }>('TODOS_CHANGED', (data) => {
|
|
31
|
+
this.setState({ todos: data.todos, totalCreated: data.totalCreated })
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
this.onRoomEvent<{ connectedUsers: number }>('USER_COUNT_CHANGED', (data) => {
|
|
35
|
+
this.setState({ connectedUsers: data.connectedUsers })
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const newCount = this.state.connectedUsers + 1
|
|
39
|
+
this.emitRoomEventWithState('USER_COUNT_CHANGED', { connectedUsers: newCount }, { connectedUsers: newCount })
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async addTodo(payload: { text: string }) {
|
|
43
|
+
if (!payload.text?.trim()) {
|
|
44
|
+
return { success: false, error: 'Text is required' }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const todo: TodoItem = {
|
|
48
|
+
id: `todo-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
49
|
+
text: payload.text.trim(),
|
|
50
|
+
done: false,
|
|
51
|
+
createdBy: this.userId || 'anonymous',
|
|
52
|
+
createdAt: Date.now()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const nextTodos = [...this.state.todos, todo]
|
|
56
|
+
const nextTotal = this.state.totalCreated + 1
|
|
57
|
+
|
|
58
|
+
this.emitRoomEventWithState(
|
|
59
|
+
'TODOS_CHANGED',
|
|
60
|
+
{ todos: nextTodos, totalCreated: nextTotal },
|
|
61
|
+
{ todos: nextTodos, totalCreated: nextTotal }
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return { success: true, todo }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async toggleTodo(payload: { id: string }) {
|
|
68
|
+
const nextTodos = this.state.todos.map(t =>
|
|
69
|
+
t.id === payload.id ? { ...t, done: !t.done } : t
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
this.emitRoomEventWithState(
|
|
73
|
+
'TODOS_CHANGED',
|
|
74
|
+
{ todos: nextTodos, totalCreated: this.state.totalCreated },
|
|
75
|
+
{ todos: nextTodos }
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return { success: true }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async removeTodo(payload: { id: string }) {
|
|
82
|
+
const nextTodos = this.state.todos.filter(t => t.id !== payload.id)
|
|
83
|
+
|
|
84
|
+
this.emitRoomEventWithState(
|
|
85
|
+
'TODOS_CHANGED',
|
|
86
|
+
{ todos: nextTodos, totalCreated: this.state.totalCreated },
|
|
87
|
+
{ todos: nextTodos }
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
return { success: true }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async clearCompleted() {
|
|
94
|
+
const nextTodos = this.state.todos.filter(t => !t.done)
|
|
95
|
+
|
|
96
|
+
this.emitRoomEventWithState(
|
|
97
|
+
'TODOS_CHANGED',
|
|
98
|
+
{ todos: nextTodos, totalCreated: this.state.totalCreated },
|
|
99
|
+
{ todos: nextTodos }
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return { success: true, removed: this.state.todos.length - nextTodos.length }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
destroy() {
|
|
106
|
+
const newCount = Math.max(0, this.state.connectedUsers - 1)
|
|
107
|
+
this.emitRoomEvent('USER_COUNT_CHANGED', { connectedUsers: newCount })
|
|
108
|
+
super.destroy()
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
// enviem mensagens para salas de chat via API REST
|
|
5
5
|
|
|
6
6
|
import { Elysia, t } from 'elysia'
|
|
7
|
-
import { liveRoomManager } from '@core/server/live
|
|
8
|
-
import { roomEvents } from '@core/server/live/RoomEventBus'
|
|
7
|
+
import { liveRoomManager, roomEvents } from '@core/server/live'
|
|
9
8
|
|
|
10
9
|
export const roomRoutes = new Elysia({ prefix: '/rooms' })
|
|
11
10
|
|
|
@@ -116,7 +116,7 @@ export class LiveComponentsGenerator {
|
|
|
116
116
|
// Generated at: ${new Date().toISOString()}
|
|
117
117
|
|
|
118
118
|
${imports}
|
|
119
|
-
import { componentRegistry } from "@core/server/live
|
|
119
|
+
import { componentRegistry } from "@core/server/live"
|
|
120
120
|
|
|
121
121
|
// Register all components statically for production bundle
|
|
122
122
|
function registerAllComponents() {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FluxStack internal Vite plugins.
|
|
3
|
+
*
|
|
4
|
+
* Returns all framework-level Vite plugins that should be registered
|
|
5
|
+
* automatically. Consumers just call `fluxstackVitePlugins()` in their
|
|
6
|
+
* vite.config.ts — no need to know about individual internal plugins.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Plugin } from 'vite'
|
|
10
|
+
import { resolve } from 'path'
|
|
11
|
+
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
12
|
+
import checker from 'vite-plugin-checker'
|
|
13
|
+
import { liveStripPlugin } from '@fluxstack/live/build'
|
|
14
|
+
import { helpers } from '../utils/env'
|
|
15
|
+
|
|
16
|
+
export function fluxstackVitePlugins(): Plugin[] {
|
|
17
|
+
return [
|
|
18
|
+
liveStripPlugin({ verbose: false }),
|
|
19
|
+
tsconfigPaths({
|
|
20
|
+
projects: [resolve(import.meta.dirname, '..', '..', 'tsconfig.json')]
|
|
21
|
+
}),
|
|
22
|
+
// Only run type checker in development (saves ~5+ minutes in Docker builds)
|
|
23
|
+
helpers.isDevelopment() && checker({
|
|
24
|
+
typescript: true,
|
|
25
|
+
overlay: true
|
|
26
|
+
}),
|
|
27
|
+
].filter(Boolean) as Plugin[]
|
|
28
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// <LiveDebugger />
|
|
9
9
|
|
|
10
10
|
import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react'
|
|
11
|
-
import { useLiveDebugger, type DebugEvent, type DebugEventType, type ComponentSnapshot } from '
|
|
11
|
+
import { useLiveDebugger, type DebugEvent, type DebugEventType, type ComponentSnapshot } from '@fluxstack/live-react'
|
|
12
12
|
|
|
13
13
|
// ===== Debugger Settings =====
|
|
14
14
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
|
-
import { Live } from '
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
5
|
-
import type { FileUploadCompleteResponse } from '@core/types/types'
|
|
2
|
+
import { Live, useLiveChunkedUpload } from '@fluxstack/live-react'
|
|
3
|
+
import type { LiveChunkedUploadOptions } from '@fluxstack/live-react'
|
|
4
|
+
import type { FileUploadCompleteResponse } from '@fluxstack/live'
|
|
6
5
|
import { LiveUpload } from '@server/live/LiveUpload'
|
|
7
6
|
|
|
8
7
|
export interface UseLiveUploadOptions {
|
package/core/client/index.ts
CHANGED
|
@@ -1,39 +1,27 @@
|
|
|
1
|
-
//
|
|
1
|
+
// FluxStack Client Core - Main Export
|
|
2
|
+
// Re-exports from @fluxstack/live-react + FluxStack-specific code
|
|
2
3
|
|
|
3
|
-
//
|
|
4
|
-
export {
|
|
5
|
-
createEdenClient,
|
|
6
|
-
getErrorMessage,
|
|
7
|
-
getDefaultBaseUrl,
|
|
8
|
-
treaty,
|
|
9
|
-
type EdenClientOptions
|
|
10
|
-
} from './api'
|
|
4
|
+
// === Re-exports from @fluxstack/live-react ===
|
|
11
5
|
|
|
12
|
-
//
|
|
13
|
-
export {
|
|
14
|
-
LiveComponentsProvider,
|
|
15
|
-
useLiveComponents
|
|
16
|
-
} from './LiveComponentsProvider'
|
|
6
|
+
// Provider
|
|
7
|
+
export { LiveComponentsProvider, useLiveComponents } from '@fluxstack/live-react'
|
|
17
8
|
export type {
|
|
18
9
|
LiveComponentsProviderProps,
|
|
19
10
|
LiveComponentsContextValue,
|
|
20
|
-
|
|
21
|
-
} from '
|
|
22
|
-
|
|
23
|
-
// Chunked Upload Hook
|
|
24
|
-
export { useChunkedUpload } from './hooks/useChunkedUpload'
|
|
25
|
-
export type { ChunkedUploadOptions, ChunkedUploadState } from './hooks/useChunkedUpload'
|
|
26
|
-
export { useLiveChunkedUpload } from './hooks/useLiveChunkedUpload'
|
|
27
|
-
export type { LiveChunkedUploadOptions } from './hooks/useLiveChunkedUpload'
|
|
28
|
-
export { useLiveUpload } from './hooks/useLiveUpload'
|
|
11
|
+
} from '@fluxstack/live-react'
|
|
12
|
+
export type { LiveAuthOptions } from '@fluxstack/live-react'
|
|
29
13
|
|
|
30
|
-
// Live
|
|
31
|
-
export { Live } from '
|
|
14
|
+
// Live.use() API
|
|
15
|
+
export { Live } from '@fluxstack/live-react'
|
|
32
16
|
|
|
33
|
-
//
|
|
34
|
-
export {
|
|
35
|
-
export type {
|
|
36
|
-
export {
|
|
17
|
+
// Upload Hooks
|
|
18
|
+
export { useChunkedUpload } from '@fluxstack/live-react'
|
|
19
|
+
export type { ChunkedUploadOptions, ChunkedUploadState } from '@fluxstack/live-react'
|
|
20
|
+
export { useLiveChunkedUpload } from '@fluxstack/live-react'
|
|
21
|
+
export type { LiveChunkedUploadOptions } from '@fluxstack/live-react'
|
|
22
|
+
|
|
23
|
+
// Debugger Hook
|
|
24
|
+
export { useLiveDebugger } from '@fluxstack/live-react'
|
|
37
25
|
export type {
|
|
38
26
|
DebugEvent,
|
|
39
27
|
DebugEventType,
|
|
@@ -41,5 +29,23 @@ export type {
|
|
|
41
29
|
DebugSnapshot,
|
|
42
30
|
DebugFilter,
|
|
43
31
|
UseLiveDebuggerReturn,
|
|
44
|
-
UseLiveDebuggerOptions
|
|
45
|
-
} from '
|
|
32
|
+
UseLiveDebuggerOptions,
|
|
33
|
+
} from '@fluxstack/live-react'
|
|
34
|
+
|
|
35
|
+
// === FluxStack-specific (stays here) ===
|
|
36
|
+
|
|
37
|
+
// Eden Treaty API client
|
|
38
|
+
export {
|
|
39
|
+
createEdenClient,
|
|
40
|
+
getErrorMessage,
|
|
41
|
+
getDefaultBaseUrl,
|
|
42
|
+
treaty,
|
|
43
|
+
type EdenClientOptions
|
|
44
|
+
} from './api'
|
|
45
|
+
|
|
46
|
+
// LiveDebugger UI component (React component, 1325 lines - not extracted to lib)
|
|
47
|
+
export { LiveDebugger } from './components/LiveDebugger'
|
|
48
|
+
export type { LiveDebuggerProps } from './components/LiveDebugger'
|
|
49
|
+
|
|
50
|
+
// useLiveUpload (FluxStack-specific convenience wrapper)
|
|
51
|
+
export { useLiveUpload } from './hooks/useLiveUpload'
|
package/core/framework/server.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { fluxStackConfig } from "@config"
|
|
|
7
7
|
import { getEnvironmentInfo } from "@core/config"
|
|
8
8
|
import { logger } from "@core/utils/logger"
|
|
9
9
|
import { displayStartupBanner, type StartupInfo } from "@core/utils/logger/startup-banner"
|
|
10
|
-
import { componentRegistry } from "@core/server/live
|
|
10
|
+
import { componentRegistry } from "@core/server/live"
|
|
11
11
|
import { FluxStackError } from "@core/utils/errors"
|
|
12
12
|
import { createTimer, formatBytes, isProduction, isDevelopment } from "@core/utils/helpers"
|
|
13
13
|
import type { Plugin } from "@core/plugins"
|
package/core/server/index.ts
CHANGED
|
@@ -6,8 +6,7 @@ export { PluginRegistry } from "../plugins/registry"
|
|
|
6
6
|
export * from "../types"
|
|
7
7
|
|
|
8
8
|
// Live Components exports
|
|
9
|
-
export { liveComponentsPlugin } from "./live
|
|
10
|
-
export { componentRegistry } from "./live/ComponentRegistry"
|
|
9
|
+
export { liveComponentsPlugin, componentRegistry } from "./live"
|
|
11
10
|
export { LiveComponent } from "../types/types"
|
|
12
11
|
|
|
13
12
|
// Static Files Plugin
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 🔥 Auto-generated Live Components Registration
|
|
2
2
|
// This file is automatically generated during build time - DO NOT EDIT MANUALLY
|
|
3
|
-
// Generated at: 2026-
|
|
3
|
+
// Generated at: 2026-03-01T19:00:29.650Z
|
|
4
4
|
|
|
5
5
|
import { LiveAdminPanel } from "@app/server/live/LiveAdminPanel"
|
|
6
6
|
import { LiveChat } from "@app/server/live/LiveChat"
|
|
@@ -9,8 +9,9 @@ import { LiveForm } from "@app/server/live/LiveForm"
|
|
|
9
9
|
import { LiveLocalCounter } from "@app/server/live/LiveLocalCounter"
|
|
10
10
|
import { LiveProtectedChat } from "@app/server/live/LiveProtectedChat"
|
|
11
11
|
import { LiveRoomChat } from "@app/server/live/LiveRoomChat"
|
|
12
|
+
import { LiveTodoList } from "@app/server/live/LiveTodoList"
|
|
12
13
|
import { LiveUpload } from "@app/server/live/LiveUpload"
|
|
13
|
-
import { componentRegistry } from "@core/server/live
|
|
14
|
+
import { componentRegistry } from "@core/server/live"
|
|
14
15
|
|
|
15
16
|
// Register all components statically for production bundle
|
|
16
17
|
function registerAllComponents() {
|
|
@@ -23,9 +24,10 @@ function registerAllComponents() {
|
|
|
23
24
|
componentRegistry.registerComponentClass('LiveLocalCounter', LiveLocalCounter)
|
|
24
25
|
componentRegistry.registerComponentClass('LiveProtectedChat', LiveProtectedChat)
|
|
25
26
|
componentRegistry.registerComponentClass('LiveRoomChat', LiveRoomChat)
|
|
27
|
+
componentRegistry.registerComponentClass('LiveTodoList', LiveTodoList)
|
|
26
28
|
componentRegistry.registerComponentClass('LiveUpload', LiveUpload)
|
|
27
29
|
|
|
28
|
-
console.log('📝 Live components registered successfully! (
|
|
30
|
+
console.log('📝 Live components registered successfully! (9 components)')
|
|
29
31
|
} catch (error) {
|
|
30
32
|
console.warn('⚠️ Error registering components:', error)
|
|
31
33
|
}
|
|
@@ -43,5 +45,6 @@ export {
|
|
|
43
45
|
LiveLocalCounter,
|
|
44
46
|
LiveProtectedChat,
|
|
45
47
|
LiveRoomChat,
|
|
48
|
+
LiveTodoList,
|
|
46
49
|
LiveUpload
|
|
47
50
|
}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
|
|
1
|
+
// FluxStack Live - Server Exports
|
|
2
|
+
// Re-exports from @fluxstack/live + backward-compatible singleton accessors
|
|
3
|
+
|
|
4
|
+
export { liveComponentsPlugin, liveServer } from './websocket-plugin'
|
|
5
|
+
|
|
6
|
+
// Re-export classes and types from @fluxstack/live
|
|
7
|
+
export { RoomStateManager, createTypedRoomState } from '@fluxstack/live'
|
|
8
|
+
export type { RoomStateData, RoomInfo } from '@fluxstack/live'
|
|
9
|
+
|
|
10
|
+
export { RoomEventBus, createTypedRoomEventBus } from '@fluxstack/live'
|
|
11
|
+
export type { EventHandler, RoomSubscription } from '@fluxstack/live'
|
|
12
|
+
|
|
13
|
+
export { ComponentRegistry } from '@fluxstack/live'
|
|
14
|
+
export { WebSocketConnectionManager } from '@fluxstack/live'
|
|
15
|
+
export { FileUploadManager } from '@fluxstack/live'
|
|
16
|
+
export { StateSignatureManager } from '@fluxstack/live'
|
|
17
|
+
export { PerformanceMonitor } from '@fluxstack/live'
|
|
18
|
+
export { liveLog, liveWarn, registerComponentLogging, unregisterComponentLogging } from '@fluxstack/live'
|
|
19
|
+
export type { LiveLogCategory, LiveLogConfig } from '@fluxstack/live'
|
|
20
|
+
|
|
21
|
+
// Auth system
|
|
22
|
+
export { LiveAuthManager } from '@fluxstack/live'
|
|
23
|
+
export { AuthenticatedContext, AnonymousContext, ANONYMOUS_CONTEXT } from '@fluxstack/live'
|
|
21
24
|
export type {
|
|
22
25
|
LiveAuthProvider,
|
|
23
26
|
LiveAuthCredentials,
|
|
@@ -27,4 +30,75 @@ export type {
|
|
|
27
30
|
LiveActionAuth,
|
|
28
31
|
LiveActionAuthMap,
|
|
29
32
|
LiveAuthResult,
|
|
30
|
-
} from '
|
|
33
|
+
} from '@fluxstack/live'
|
|
34
|
+
|
|
35
|
+
// Backward-compatible singleton accessors
|
|
36
|
+
// These lazily access the LiveServer instance created by the plugin
|
|
37
|
+
import { liveServer, pendingAuthProviders } from './websocket-plugin'
|
|
38
|
+
import type { LiveAuthProvider as _LiveAuthProvider } from '@fluxstack/live'
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Backward-compatible liveAuthManager.
|
|
42
|
+
* Buffers register() calls that happen before the plugin setup(),
|
|
43
|
+
* then delegates to liveServer.authManager once available.
|
|
44
|
+
* @deprecated Access via liveServer.authManager instead
|
|
45
|
+
*/
|
|
46
|
+
export const liveAuthManager = {
|
|
47
|
+
register(provider: _LiveAuthProvider) {
|
|
48
|
+
if (liveServer) {
|
|
49
|
+
liveServer.useAuth(provider)
|
|
50
|
+
} else {
|
|
51
|
+
pendingAuthProviders.push(provider)
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
get authenticate() { return liveServer!.authManager.authenticate.bind(liveServer!.authManager) },
|
|
55
|
+
get hasProviders() { return liveServer!.authManager.hasProviders.bind(liveServer!.authManager) },
|
|
56
|
+
get authorizeRoom() { return liveServer!.authManager.authorizeRoom.bind(liveServer!.authManager) },
|
|
57
|
+
get authorizeAction() { return liveServer!.authManager.authorizeAction.bind(liveServer!.authManager) },
|
|
58
|
+
get authorizeComponent() { return liveServer!.authManager.authorizeComponent.bind(liveServer!.authManager) },
|
|
59
|
+
} as any
|
|
60
|
+
|
|
61
|
+
/** @deprecated Access via liveServer.registry instead */
|
|
62
|
+
export const componentRegistry = new Proxy({} as any, {
|
|
63
|
+
get(_, prop) { return (liveServer!.registry as any)[prop] }
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
/** @deprecated Access via liveServer.connectionManager instead */
|
|
67
|
+
export const connectionManager = new Proxy({} as any, {
|
|
68
|
+
get(_, prop) { return (liveServer!.connectionManager as any)[prop] }
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
/** @deprecated Access via liveServer.roomManager instead */
|
|
72
|
+
export const liveRoomManager = new Proxy({} as any, {
|
|
73
|
+
get(_, prop) { return (liveServer!.roomManager as any)[prop] }
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
/** @deprecated Access via liveServer.roomEvents instead */
|
|
77
|
+
export const roomEvents = new Proxy({} as any, {
|
|
78
|
+
get(_, prop) { return (liveServer!.roomEvents as any)[prop] }
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
/** @deprecated Access via liveServer.fileUploadManager instead */
|
|
82
|
+
export const fileUploadManager = new Proxy({} as any, {
|
|
83
|
+
get(_, prop) { return (liveServer!.fileUploadManager as any)[prop] }
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
/** @deprecated Access via liveServer.performanceMonitor instead */
|
|
87
|
+
export const performanceMonitor = new Proxy({} as any, {
|
|
88
|
+
get(_, prop) { return (liveServer!.performanceMonitor as any)[prop] }
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
/** @deprecated Access via liveServer.stateSignature instead */
|
|
92
|
+
export const stateSignature = new Proxy({} as any, {
|
|
93
|
+
get(_, prop) { return (liveServer!.stateSignature as any)[prop] }
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
/** @deprecated Access via liveServer.debugger instead */
|
|
97
|
+
export const liveDebugger = new Proxy({} as any, {
|
|
98
|
+
get(_, prop) { return (liveServer!.debugger as any)[prop] }
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// Room state backward compat
|
|
102
|
+
export const roomState = new Proxy({} as any, {
|
|
103
|
+
get(_, prop) { return (liveServer!.roomManager as any)[prop] }
|
|
104
|
+
})
|