import { t as NodeCG } from "./nodecg.js"; import { r as LoggerInterface } from "./logger-interface.js"; import { ErrorObject } from "ajv"; import { EventEmitter } from "events"; //#region src/shared/typed-emitter.d.ts interface Builtins { newListener(event: string, listener: EventReceiver): void; } type EventMap = Record; type EventKey = string & keyof T; type EventReceiver = (params: T) => void; declare class TypedEmitter { readonly _emitter: EventEmitter<[never]>; addListener>(eventName: K, fn: (T & Builtins)[K]): void; on>(eventName: K, fn: (T & Builtins)[K]): void; off>(eventName: K, fn: (T & Builtins)[K]): void; removeListener>(eventName: K, fn: (T & Builtins)[K]): void; emit>(eventName: K, ...params: Parameters<(T & Builtins)[K]>): void; once>(eventName: K, fn: (T & Builtins)[K]): void; setMaxListeners(max: number): void; listenerCount(eventName: string): number; listeners>(eventName: K): (T & Builtins)[K][]; } //#endregion //#region src/shared/replicants.shared.d.ts type ReplicantValue

= P extends "server" ? S extends true ? V : O extends { defaultValue: infer D extends V; } ? D : V | undefined : (O extends { defaultValue: infer D extends V; } ? D : V) | undefined; interface Events

{ change: (newVal: ReplicantValue, oldVal: ReplicantValue | undefined, operations: NodeCG.Replicant.Operation>[]) => void; declared: (data: { value: ReplicantValue; revision: number; } | { value: ReplicantValue; revision: number; schemaSum: string; schema: Record; }) => void; declarationRejected: (rejectReason: string) => void; operations: (params: { name: string; namespace: string; operations: NodeCG.Replicant.Operation>[]; revision: number; }) => void; operationsRejected: (rejectReason: string) => void; fullUpdate: (data: ReplicantValue) => void; } /** * If you're wondering why some things are prefixed with "_", * but not marked as protected or private, this is because our Proxy * trap handlers need to access these parts of the Replicant internals, * but don't have access to private or protected members. * * So, we code this like its 2010 and just use "_" on some public members. */ declare abstract class AbstractReplicant

= NodeCG.Replicant.Options, S extends boolean = false> extends TypedEmitter> { name: string; namespace: string; opts: O; revision: number; log: LoggerInterface; schema?: Record; schemaSum?: string; status: "undeclared" | "declared" | "declaring"; validationErrors?: null | ErrorObject[]; protected _value: ReplicantValue | undefined; protected _oldValue: ReplicantValue | undefined; protected _operationQueue: NodeCG.Replicant.Operation>[]; protected _pendingOperationFlush: boolean; constructor(name: string, namespace: string, opts?: O); abstract get value(): ReplicantValue; abstract set value(newValue: ReplicantValue); /** * If the operation is an array mutator method, call it on the target array with the operation arguments. * Else, handle it with objectPath. */ _applyOperation(operation: NodeCG.Replicant.Operation): boolean; /** * Used to validate the new value of a replicant. * * This is a stub that will be replaced if a Schema is available. */ validate: Validator; /** * Adds an operation to the operation queue, to be flushed at the end of the current tick. * @private */ abstract _addOperation(operation: NodeCG.Replicant.Operation): void; /** * Emits all queued operations via Socket.IO & empties this._operationQueue. * @private */ abstract _flushOperations(): void; /** * Generates a JSON Schema validator function from the `schema` property of the provided replicant. * @param replicant {object} - The Replicant to perform the operation on. * @returns {function} - The generated validator function. */ protected _generateValidator(): Validator; } interface ValidatorOptions { throwOnInvalid?: boolean; } type Validator = (newValue: any, opts?: ValidatorOptions) => boolean; declare const ARRAY_MUTATOR_METHODS: string[]; declare function ignoreProxy(replicant: AbstractReplicant, any>): void; declare function resumeProxy(replicant: AbstractReplicant, any>): void; declare function isIgnoringProxy(replicant: AbstractReplicant, any>): boolean; /** * Recursively Proxies an Array or Object. Does nothing to primitive values. * @param replicant {object} - The Replicant in which to do the work. * @param value {*} - The value to recursively Proxy. * @param path {string} - The objectPath to this value. * @returns {*} - The recursively Proxied value (or just `value` unchanged, if `value` is a primitive) * @private */ declare function proxyRecursive(replicant: AbstractReplicant, any>, value: T, path: string): T; //#endregion export { ValidatorOptions as a, proxyRecursive as c, EventKey as d, EventMap as f, Validator as i, resumeProxy as l, AbstractReplicant as n, ignoreProxy as o, TypedEmitter as p, ReplicantValue as r, isIgnoringProxy as s, ARRAY_MUTATOR_METHODS as t, Builtins as u }; //# sourceMappingURL=replicants.shared.d.ts.map