import IProviderNodeCallbacks from "./providernodecallbacks"; import IResult from "./result.js"; import IVariant from "./variant.js"; /** * The IProvider interface. */ interface IProvider { /** * Returns a value indicating whether the provider is connected. * * @return {boolean} - True if the Provider is connected, else false. */ isConnected(): boolean; /** * Gets the authentication token. * * @return {IVariant} - The authentication token (JWT) as flatbuffers 'Token' while processing requests. */ getAuthToken(): IVariant; /** * Gets the current registered node paths. * * @return {Promise} - The list of current registered node paths. */ getRegisteredNodePaths(): Promise; /** * Gets the current rejected node paths. * * @return {Promise} - The list of current rejected node paths. */ getRejectedNodePaths(): Promise; /** * Get the variant of a registered type (flatbuffers). * @param {string} address - Address of the type. * @return {Promise} - The registered type (flatbuffers). */ getRegisteredType(address: string): Promise; /** * Publishes an event. * * @param {Uint8Array} eventInfoFlatbuffers - The event info (flatbuffers). Set timestamp [FILETIME (64 bit (BigInt) - 100ns since 1.1.1601 UTC))]/sequenceNumber property to Zero for automatic creation/increment. * @param {any} data - The event data. * @param {string} dataVariantType (optional) - VariantType of the data to be converted. * @return {Promise} The result. */ publishEvent(eventInfoFlatbuffers: Uint8Array, data: any, dataVariantType?: string): Promise; /** * Registers the type to the ctrlX Data Layer. * * @param {string} address - The address of the node. * @param {string} bfbsPath - Path to flatbuffers type binary bfbs file. * @return {Promise} The result. */ registerType(address: string, bfbsPath: string): Promise; /** * Registers the type to the ctrlX Data Layer. * * @param {string} address - The address of the node. * @param {string} flatbuffers - The flatbuffers type. * @return {Promise} The result. */ registerTypeVariant(address: string, flatbuffers: Uint8Array): Promise; /** * Unregisters the type from the ctrlX Data Layer. * * @param {string} address - The address of the node. * @return {Promise} The result. */ unregisterType(address: string): Promise; /** * Registers the node to the ctrlX Data Layer. * * @param {string} address - The address of the node. * @param {IProviderNodeCallbacks} providerNodeCallbacks - The provider callbacks interface. * @param {number} timeout (optional) - The timeout for asynchron requests to the node in milliseconds (default value is 10000 ms). * @return {Promise} The result. */ registerNode(address: string, providerNodeCallbacks: IProviderNodeCallbacks, timeout?: number): Promise; /** * Unregisters the node from the ctrlX Data Layer. * * @param {string} address - The address of the node. * @return {Promise} The result. */ unregisterNode(address: string): Promise; /** * Starts the provider. * * @return {Promise} The result. */ start(): Promise; /** * Stops the provider. * * @return {Promise} The result. */ stop(): Promise; } /** * The Provider. */ declare class Provider implements IProvider { /** * Creates an instance of Provider. * * INTERNAL USAGE ONLY - NOT TO BE INSTANTIATED BY JAVASCRIPT CODE */ constructor(); /** * Returns a value indicating whether the provider is connected. * * @return {boolean} - True if the Provider is connected, else false. */ isConnected(): boolean; /** * Gets the authentication token. * * @return {IVariant} - The authentication token (JWT) as flatbuffers 'Token' while processing requests. */ getAuthToken(): IVariant; /** * Gets the current registered node paths. * * @return {IVariant} - The list of current registered node paths. */ getRegisteredNodePaths(): Promise; /** * Gets the current rejected node paths. * * @return {IVariant} - The list of current rejected node paths. */ getRejectedNodePaths(): Promise; /** * Get the variant of a registered type (flatbuffers). * @param {string} address - Address of the type. * @return {Promise} - The registered type (flatbuffers). */ getRegisteredType(address: string): Promise; /** * Publishes an event. * * @param {Uint8Array} eventInfoFlatbuffers - The event info (flatbuffers). Set timestamp [FILETIME (64 bit (BigInt) - 100ns since 1.1.1601 UTC))]/sequenceNumber property to Zero for automatic creation/increment. * @param {any} data - The event data. * @param {string} dataVariantType (optional) - VariantType of the data to be converted. * @return {Promise} The result. */ publishEvent(eventInfoFlatbuffers: Uint8Array, data: any, dataVariantType?: string): Promise; /** * Registers the type to the ctrlX Data Layer. * * @param {string} address - The address of the node. * @param {string} bfbsPath Path to flatbuffer bfbs. * @return {Promise} The result. */ registerType(address: string, bfbsPath: string): Promise; /** * Registers the type to the ctrlX Data Layer. * * @param {string} address - The address of the node. * @param {string} flatbuffers - The flatbuffers type. * @return {Promise} The result. */ registerTypeVariant(address: string, flatbuffers: Uint8Array): Promise; /** * Unregisters the type from the ctrlX Data Layer. * * @param {string} address - The address of the node. * @return {Promise} The result. */ unregisterType(address: string): Promise; /** * Registers the node to the ctrlX Data Layer. * * @param {string} address - The address of the node. * @param {IProviderNodeCallbacks} providerNodeCallbacks - The provider node callbacks. * @param {number} timeout (optional) - The timeout for asynchron requests to the node in milliseconds (default value is 10000 ms). * @return {Promise} The result. */ registerNode(address: string, providerNodeCallbacks: IProviderNodeCallbacks, timeout?: number): Promise; /** * Unregisters the node from the ctrlX Data Layer. * * @param {string} address - The address of the node. * @return {Promise} The result. */ unregisterNode(address: string): Promise; /** * Starts the provider. * * @return {Promise} The result. */ start(): Promise; /** * Stops the provider. * * @return {Promise} The result. */ stop(): Promise; private _addonInstance; } export = Provider;