import type { AssetManager } from "../AssetManager"; import type { SharedConnectionDataManager } from "../multiplayer"; import type { PolicyAuthContext } from "../multiplayerPolicies"; import type { NoyaManager } from "../NoyaManager"; import type { PipelineManager } from "../PipelineManager"; import type { SecretManager } from "../SecretManager"; import type { Task } from "../tasks"; import type { UserManager } from "../UserManager"; import type { ParentFrameMessageHandler } from "./parentFrameMessages"; export type MultiplayerUser = { id: string; connectionId: string; clientId: string; authId?: string; name?: string; image?: string; inactive?: boolean; }; export type AccessType = "read" | "write" | "none"; export type TokenPayload = Omit & { fileId: string; access: AccessType; writeTo?: string; baseUrl: string; }; export type Destructor = () => void; export type SyncAdapterOptions< S, M extends object, E extends object, MenuT extends string = string, I extends Record = Record, > = { noyaManager: NoyaManager; }; export type SyncAdapter< S, M extends object, E extends object, MenuT extends string = string, I extends Record = Record, > = (options: SyncAdapterOptions) => Destructor; export type SyncURLOption = string | URL | (() => Promise); export type SyncOptionsBase = { url: SyncURLOption; debug?: boolean; }; export type WebSocketSyncOptions = SyncURLOption | SyncOptionsBase; export type ParentFrameSyncOptions = { origin?: string; messageHandler?: ParentFrameMessageHandler; debug?: boolean; policyAuthContext?: PolicyAuthContext; }; export type SyncConfig = { url: URL; tokenString: string; tokenPayload: TokenPayload; }; export type AdapterHandlers = { assetManager?: AssetManager; sharedConnectionDataManager?: SharedConnectionDataManager; pipelineManager?: PipelineManager; secretManager?: SecretManager; userManager?: UserManager; onChangeTasks?: (tasks: Task[]) => void; }; export type ConnectionMessage = { type: "connection"; state: "connected" | "disconnected"; };