Skip to content

Commit

Permalink
chore: export AccessCallback type from type exports
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Aug 27, 2024
1 parent 20d6213 commit e1c3aba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 1 addition & 5 deletions src/stream_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
import { Stream } from './stream.js'
import { Storage } from './storage.js'
import type { IncomingMessage, ServerResponse } from 'node:http'

export type AccessCallback<T extends unknown, U extends Record<string, string>> = (
context: T,
params: U
) => Promise<boolean> | boolean
import type { AccessCallback } from './types/main.js'

interface OnConnectParams<T> {
uid: string
Expand Down
9 changes: 2 additions & 7 deletions src/transmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ import string from '@poppinss/utils/string'
import { StreamManager } from './stream_manager.js'
import { TransportMessageType } from './transport_message_type.js'
import type { Transport } from '@boringnode/bus/types/main'
import type { Broadcastable, TransmitConfig } from './types/main.js'
import type {
AccessCallback,
CreateStreamParams,
SubscribeParams,
UnsubscribeParams,
} from './stream_manager.js'
import type { AccessCallback, Broadcastable, TransmitConfig } from './types/main.js'
import type { CreateStreamParams, SubscribeParams, UnsubscribeParams } from './stream_manager.js'

export interface TransmitLifecycleHooks<T> {
connect: { uid: string; context: T }
Expand Down
5 changes: 5 additions & 0 deletions src/types/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ export interface TransmitConfig {
channel?: string
}
}

export type AccessCallback<T extends unknown, U extends Record<string, string>> = (
context: T,
params: U
) => Promise<boolean> | boolean

0 comments on commit e1c3aba

Please sign in to comment.