export const $accessType: s.Schema<"r" | "rw" | null>; export function hasReadAccess(accessType?: AccessType): accessType is "r" | "rw"; export function hasWriteAccess(accessType?: AccessType): accessType is "rw"; /** * # Asset * * Types of content we deal with (v1 encoded ydocs, v2 encoded ydocs, v1 encoded contentmaps, ..) * * # AssetIds * * Describe how to retrieve any asset. */ export const $ydocAssetId: s.Schema<{ type: "id:ydoc:v1"; org: string; docid: string; branch: string; t: string; gc: boolean; }>; export const $contentMapAssetId: s.Schema<{ type: "id:contentmap:v1"; org: string; docid: string; branch: string; t: string; }>; export const $contentidsAssetId: s.Schema<{ type: "id:contentids:v1"; org: string; docid: string; branch: string; t: string; }>; export const $contentMapAsset: s.Schema<{ type: "asset:contentmap:v1"; contentmap: Uint8Array; }>; export const $contentidsAsset: s.Schema<{ type: "asset:contentids:v1"; contentids: Uint8Array; }>; export const $ydocAsset: s.Schema<{ type: "asset:ydoc:v1"; update: Uint8Array; }>; export const $retrievableAsset: s.Schema<{ type: "asset:retrievable:v1"; plugin: string; }>; export const $assetId: s.Schema<{ type: "id:ydoc:v1"; org: string; docid: string; branch: string; t: string; gc: boolean; } | { type: "id:contentmap:v1"; org: string; docid: string; branch: string; t: string; } | { type: "id:contentids:v1"; org: string; docid: string; branch: string; t: string; }>; export const $asset: s.Schema<{ type: "asset:contentmap:v1"; contentmap: Uint8Array; } | { type: "asset:contentids:v1"; contentids: Uint8Array; } | { type: "asset:ydoc:v1"; update: Uint8Array; } | { type: "asset:retrievable:v1"; plugin: string; }>; export function assetIdToString(assetId: AssetId): string; export function assetIdFromString(assetIdString: string): AssetId; export const $updateMessage: s.Schema<{ type: "ydoc:update:v1"; update: Uint8Array; contentmap: Uint8Array; }>; export const $awarenessMessage: s.Schema<{ type: "awareness:v1"; update: Uint8Array; }>; /** * Directive to permanently prune churned history. `prune` is an `IdSet` (serialized with * `Y.encodeIdSet`) of content that was inserted and later deleted; it is garbage-collected * from the nongc doc and removed from the contentmap when documents are merged. */ export const $pruneMessage: s.Schema<{ type: "prune:v1"; prune: Uint8Array; }>; /** * A Message contains information w want to distribute to clients. They are usually put on the * distribution stream. */ export const $message: s.Schema<{ type: "ydoc:update:v1"; update: Uint8Array; contentmap: Uint8Array; } | { type: "awareness:v1"; update: Uint8Array; } | { type: "prune:v1"; prune: Uint8Array; }>; /** * @typedef {s.Unwrap} Message */ export const $room: s.Schema<{ org: string; docid: string; branch: string; }>; /** * @typedef {s.Unwrap} Room */ export const $compactTask: s.Schema<{ type: "compact"; room: { org: string; docid: string; branch: string; }; }>; export const $task: s.Schema<{ type: "compact"; room: { org: string; docid: string; branch: string; }; }>; /** * @typedef {s.Unwrap} Task */ /** * @template {{[K:string]:any}} Conf * @template {string} Key * @template Result * @typedef {(Conf[Key] extends true ? Result : (Conf[Key] extends boolean ? (Result|null) : null))} IfHasConf */ /** * @template {{ gc?: boolean, nongc?: boolean, contentmap?: boolean, references?: boolean, contentids?: boolean, awareness?: boolean }} [Include=any] * @typedef {import('lib0/ts').Prettify<{ * lastClock: string, * lastPersistedClock: string, * gcDoc: IfHasConf>, * nongcDoc: IfHasConf>, * contentmap: IfHasConf>, * references: IfHasConf>, * contentids: IfHasConf>, * awareness: IfHasConf> * }, 1>} DocTable */ /** * @typedef {object} PersistencePlugin * @property {null|((api: import('./index.js').YHub)=>Promise?)} [PersistPlugin.init] * @property {null|((assetId: AssetId, asset: Asset)=>Promise)} [PersistPlugin.store] * @property {null|((assetId: AssetId, assetInfo: Asset)=>Promise)} [PersistPlugin.retrieve] * @property {null|((assetId: AssetId, assetInfo: Asset)=>Promise)} [PersistPlugin.delete] */ /** * @type {s.Schema} */ export const $persistencePlugin: s.Schema; export const $authPlugin: s.Schema>; export function createAuthPlugin(authDef: AuthPlugin): AuthPlugin; export const $config: s.Schema<{ events?: { docUpdate: (args_0: any, args_1: Y.Doc, args_2: { inserts: Y.IdMap; deletes: Y.IdMap; }) => undefined; } | undefined; worker?: { events?: { docUpdate?: ((doctable: DocTable<{ gc: true; nongc: true; contentmap: true; contentids: true; }>) => void) | undefined; taskStart?: ((event: { room: Room; timestamp: number; }) => void) | undefined; taskComplete?: ((event: { room: Room; duration: number; error: Error | null; }) => void) | undefined; } | undefined; taskConcurrency: number; } | null | undefined; server?: { maxDocSize?: number | undefined; port: number; auth: AuthPlugin; } | null | undefined; redis: { taskDebounce?: number | undefined; minMessageLifetime?: number | undefined; cacheTtl?: number | undefined; clientOptions?: Omit, "url"> | undefined; socket?: import("@redis/client/dist/lib/client/socket.js").RedisSocketOptions | undefined; url: string; prefix: string; }; postgres: string; persistence: PersistencePlugin[]; }>; export type AccessType = s.Unwrap; export type RetrievableAsset = s.Unwrap; export type Asset = s.Unwrap; export type AssetId = s.Unwrap; export type Message = s.Unwrap; export type Room = s.Unwrap; export type Task = s.Unwrap; export type IfHasConf = (Conf[Key] extends true ? Result : (Conf[Key] extends boolean ? (Result | null) : null)); export type DocTable = import("lib0/ts").Prettify<{ lastClock: string; lastPersistedClock: string; gcDoc: IfHasConf>; nongcDoc: IfHasConf>; contentmap: IfHasConf>; references: IfHasConf>; contentids: IfHasConf>; awareness: IfHasConf>; }, 1>; export type PersistencePlugin = { init?: ((api: import("./index.js").YHub) => Promise | null) | null | undefined; store?: ((assetId: AssetId, asset: Asset) => Promise) | null | undefined; retrieve?: ((assetId: AssetId, assetInfo: Asset) => Promise) | null | undefined; delete?: ((assetId: AssetId, assetInfo: Asset) => Promise) | null | undefined; }; export type UserAuthInfo = { userid: string; }; export type AuthPlugin = { readAuthInfo: (req: import("uws").HttpRequest) => Promise; /** * : */ getAccessType: (authInfo: AuthInfo, room: Room) => Promise; }; export type YHubConfig = s.Unwrap; import * as s from 'lib0/schema'; import * as Y from '@y/y'; //# sourceMappingURL=types.d.ts.map