const path = require ( "path" ) ; module . exports = require ( "node-gyp-build" ) ( path . join ( __dirname , ".." ) ) ; interface SpecializedMethods { send : Function ; receive : Function ; join : Function ; leave : Function ; } const sack = { } ; const target = module . exports . Socket . prototype ; for ( const key of [ "send" , "receive" , "join" , "leave" ] as const ) { sack [ key ] = target [ key ] ; delete target [ key ] ; } module . exports . methods = sack ; export declare const methods ; /**
 * The version of the ØMQ library the bindings were built with. Formatted as
 * `(major).(minor).(patch)`. For example: `"4.3.2"`.
 */ export declare const version ; /**
 * Exposes some of the optionally available ØMQ capabilities, which may depend
 * on the library version and platform.
 *
 * This is an object with keys corresponding to supported ØMQ features and
 * transport protocols. Available capabilities will be set to `true`.
 * Unavailable capabilities will be absent or set to `false`.
 *
 * Possible keys include:
 * * `ipc` – Support for the `ipc://` protocol.
 * * `pgm` – Support for the `pgm://` protocol.
 * * `tipc` – Support for the `tipc://` protocol.
 * * `norm` – Support for the `norm://` protocol.
 * * `curve` – Support for the CURVE security mechanism.
 * * `gssapi` – Support for the GSSAPI security mechanism.
 * * `draft` – Wether the library is built with support for DRAFT sockets.
 */ export declare const capability ; /**
 * Returns a new random key pair to be used with the CURVE security mechanism.
 *
 * To correctly connect two sockets with this mechanism:
 *
 * * Generate a **client** keypair with  curveKeyPair ().
 *   * Assign the private and public key on the client socket with
 *      Socket . curveSecretKey and  Socket . curvePublicKey .
 * * Generate a **server** keypair with  curveKeyPair ().
 *   * Assign the private key on the server socket with  Socket . curveSecretKey .
 *   * Assign the public key **on the client socket** with
 *      Socket . curveServerKey . The server does *not* need to know its own
 *     public key. Key distribution is *not* handled by the CURVE security
 *     mechanism.
 *
 *
 *  returns export declare function curveKeyPair ( ) ; /**
 * A ØMQ context. Contexts manage the background I/O to send and receive
 * messages of their associated sockets.
 *
 * It is usually not necessary to instantiate a new context – the global
 *  context is used for new sockets by default. The global context is the
 * only context that is shared between threads (when using
 * [worker_threads](https://nodejs.org/api/worker_threads.html)). Custom
 * contexts can only be used in the same thread.
 *
 * ```typescript
 * // Use default context (recommended).
 * const socket = new Dealer()
 * ```
 *
 * ```typescript
 * // Use custom context.
 * const context = new Context()
 * const socket = new Dealer({context})
 * ```
 *
 * **Note:** By default all contexts (including the global context) will prevent
 * the process from terminating if there are any messages in an outgoing queue,
 * even if the associated socket was closed. For some applications this is
 * unnecessary or unwanted. Consider setting  Context . blocky to `false`
 * or setting  Socket . linger for each new socket.
  export declare class Context { param options constructor ( options ? ) ; protected getBoolOption ( option ) ; protected setBoolOption ( option , value ) ; protected getInt32Option ( option ) ; protected setInt32Option ( option , value ) ; } /**
 * Any socket that has no explicit context passed in during construction will
 * be associated with this context. The default context is exposed in order to
 * be able to change its behaviour with  Context options.
  export declare const context ; interface ErrnoError extends Error { code : string ; errno : number ; } interface AuthError extends Error { status : 300 | 400 | 500 ; } interface ProtoError extends Error { code : "ERR_ZMTP_UNSPECIFIED" | "ERR_ZMTP_UNEXPECTED_COMMAND" | "ERR_ZMTP_INVALID_SEQUENCE" | "ERR_ZMTP_KEY_EXCHANGE" | "ERR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED" | "ERR_ZMTP_MALFORMED_COMMAND_MESSAGE" | "ERR_ZMTP_MALFORMED_COMMAND_HELLO" | "ERR_ZMTP_MALFORMED_COMMAND_INITIATE" | "ERR_ZMTP_MALFORMED_COMMAND_ERROR" | "ERR_ZMTP_MALFORMED_COMMAND_READY" | "ERR_ZMTP_MALFORMED_COMMAND_WELCOME" | "ERR_ZMTP_INVALID_METADATA" | "ERR_ZMTP_CRYPTOGRAPHIC" | "ERR_ZMTP_MECHANISM_MISMATCH" | "ERR_ZAP_UNSPECIFIED" | "ERR_ZAP_MALFORMED_REPLY" | "ERR_ZAP_BAD_REQUEST_ID" | "ERR_ZAP_BAD_VERSION" | "ERR_ZAP_INVALID_STATUS_CODE" | "ERR_ZAP_INVALID_METADATA" ; } interface EventAddress { address : string ; } interface EventInterval { interval : number ; } interface EventError < E = ErrnoError > { error : E ; } type EventFor < T extends string , D = { } > = Expand < { type : T ; } & D > ; /**
 * A union type that represents all possible even types and the associated data.
 * Events always have a `type` property with an  EventType value.
 *
 * The following socket events can be generated. This list may be different
 * depending on the ZeroMQ version that is used.
 *
 * Note that the **error** event is avoided by design, since this has a [special
 * behaviour](https://nodejs.org/api/events.html#events_error_events) in Node.js
 * causing an exception to be thrown if it is unhandled.
 *
 * Other error names are adjusted to be as close to possible as other
 * [networking related](https://nodejs.org/api/net.html) event names in Node.js
 * and/or to the corresponding ZeroMQ.js method call. Events (including any
 * errors) that correspond to a specific operation are namespaced with a colon
 * `:`, e.g. `bind:error` or `connect:retry`.
 *
 * * **accept** – ZMQ_EVENT_ACCEPTED The socket has accepted a connection from a
 *   remote peer.
 *
 * * **accept:error** – ZMQ_EVENT_ACCEPT_FAILED The socket has rejected a
 *   connection from a remote peer.
 *
 *   The following additional details will be included with this event:
 *
 *   * `error` – An error object that describes the specific error
 *     that occurred.
 *
 * * **bind** – ZMQ_EVENT_LISTENING The socket was successfully bound to a
 *   network interface.
 *
 * * **bind:error** – ZMQ_EVENT_BIND_FAILED The socket could not bind to a given
 *   interface.
 *
 *   The following additional details will be included with this event:
 *
 *   * `error` – An error object that describes the specific error
 *     that occurred.
 *
 * * **connect** – ZMQ_EVENT_CONNECTED The socket has successfully connected to
 *   a remote peer.
 *
 * * **connect:delay** – ZMQ_EVENT_CONNECT_DELAYED A connect request on the
 *   socket is pending.
 *
 * * **connect:retry** – ZMQ_EVENT_CONNECT_RETRIED A connection attempt is being
 *   handled by reconnect timer. Note that the reconnect interval is
 *   recalculated at each retry.
 *
 *   The following additional details will be included with this event:
 *
 *   * `interval` – The current reconnect interval.
 *
 * * **close** – ZMQ_EVENT_CLOSED The socket was closed.
 *
 * * **close:error** – ZMQ_EVENT_CLOSE_FAILED The socket close failed. Note that
 *   this event occurs **only on IPC** transports..
 *
 *   The following additional details will be included with this event:
 *
 *   * `error` – An error object that describes the specific error
 *     that occurred.
 *
 * * **disconnect** – ZMQ_EVENT_DISCONNECTED The socket was disconnected
 *   unexpectedly.
 *
 * * **handshake** – ZMQ_EVENT_HANDSHAKE_SUCCEEDED The ZMTP security mechanism
 *   handshake succeeded. NOTE: This event may still be in DRAFT statea and not
 *   yet available in stable releases.
 *
 * * **handshake:error:protocol** – ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL The ZMTP
 *   security mechanism handshake failed due to some mechanism protocol error,
 *   either between the ZMTP mechanism peers, or between the mechanism server
 *   and the ZAP handler. This indicates a configuration or implementation error
 *   in either peer resp. the ZAP handler. NOTE: This event may still be in
 *   DRAFT state and not yet available in stable releases.
 *
 * * **handshake:error:auth** – ZMQ_EVENT_HANDSHAKE_FAILED_AUTH The ZMTP
 *   security mechanism handshake failed due to an authentication failure. NOTE:
 *   This event may still be in DRAFT state and not yet available in stable
 *   releases.
 *
 * * **handshake:error:other** – ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL
 *   Unspecified error during handshake. NOTE: This event may still be in DRAFT
 *   state and not yet available in stable releases.
 *
 * * **end** – ZMQ_EVENT_MONITOR_STOPPED Monitoring on this socket ended.
 *
 * * **unknown** An event was generated by ZeroMQ that the Node.js library could
 *   not interpret. Please submit a pull request for new event types if they are
 *   not yet included.
  export type Event = EventFor < "accept" , EventAddress > | EventFor < "accept:error" , EventAddress & EventError > | EventFor < "bind" , EventAddress > | EventFor < "bind:error" , EventAddress & EventError > | EventFor < "connect" , EventAddress > | EventFor < "connect:delay" , EventAddress > | EventFor < "connect:retry" , EventAddress & EventInterval > | EventFor < "close" , EventAddress > | EventFor < "close:error" , EventAddress & EventError > | EventFor < "disconnect" , EventAddress > | EventFor < "end" > | EventFor < "handshake" , EventAddress > | EventFor < "handshake:error:protocol" , EventAddress & EventError < ProtoError > > | EventFor < "handshake:error:auth" , EventAddress & EventError < AuthError > > | EventFor < "handshake:error:other" , EventAddress & EventError > | EventFor < "unknown" > ; /**
 * A union type of all available event types. See  Event for an overview
 * of the events that can be observed.
  export type EventType = Event [ "type" ] ; typeparam export type EventOfType < E extends EventType = EventType > = Expand < Extract < Event , Event & EventFor < E > > > ; /**
 * An event observer for ØMQ sockets. This starts up a ZMQ monitoring socket
 * internally that receives all socket events. The event observer can be used in
 * one of two ways, which are **mutually exclusive**: with  receive () or
 * with event listeners attached with  on ().
  export declare class Observer { readonly readonly closed : boolean ; /**
     * Creates a new ØMQ observer. It should not be necessary to instantiate a new
     * observer. Access an existing observer for a socket with
     *  Socket . events .
     *
     * ```typescript
     * const socket = new Publisher()
     * const events = socket.events
     * ```
     *
     *  param socket constructor ( socket ) ; /**
     * Closes the observer. Afterwards no new events will be received or emitted.
     * Calling this method is optional.
     */ close ( ) ; /**
     * Waits for the next event to become availeble on the observer. Reads an
     * event immediately if possible. If no events are queued, it will wait
     * asynchonously. The promise will be resolved with the next event when
     * available.
     *
     * When reading events with  receive () the observer may **not** be in
     * event emitter mode. Avoid mixing calls to  receive () with event
     * handlers via attached with  on ().
     *
     * ```typescript
     * for await (event of socket.events) {
     *   switch (event.type) {
     *     case "bind":
     *       console.log(`Socket bound to ${event.address}`)
     *       break
     *     // ...
     *   }
     * }
     * ```
     *
     *  returns Resolved with the next event and its details. See  Event .
      receive ( ) ; } typeparam typeparam export declare class Proxy < F extends Socket = Socket , B extends Socket = Socket > { readonly readonly frontEnd : F ; readonly readonly backEnd : B ; /**
     * Creates a new ØMQ proxy. Proxying will start between the front-end and
     * back-end sockets when  run () is called after both sockets have been
     * bound or connected.
     *
     *  param frontEnd param backEnd constructor ( frontEnd , backEnd ) ; returns run ( ) ; /**
     * Temporarily suspends any proxy activity. Resume activity with
     *  resume ().
      pause ( ) ; /**
     * Resumes proxy activity after suspending it with  pause ().
      resume ( ) ; /**
     * Gracefully shuts down the proxy. The front-end and back-end sockets will be
     * closed automatically. There might be a slight delay between terminating and
     * the  run () method resolving.
      terminate ( ) ; } /**
 * A ØMQ socket. This class should generally not be used directly. Instead,
 * create one of its subclasses that corresponds to the socket type you want to
 * use.
 *
 * ```typescript
 * new zmq.Pair(...)
 * new zmq.Publisher(...)
 * new zmq.Subscriber(...)
 * new zmq.Request(...)
 * new zmq.Reply(...)
 * new zmq.Dealer(...)
 * new zmq.Router(...)
 * new zmq.Pull(...)
 * new zmq.Push(...)
 * new zmq.XPublisher(...)
 * new zmq.XSubscriber(...)
 * new zmq.Stream(...)
 * ```
 *
 * Socket options can be set during construction or via a property after the
 * socket was created. Most socket options do not take effect until the next
 *  bind () or  connect () call. Setting such an option after the
 * socket is already connected or bound will display a warning.
  export declare abstract class Socket { /**
     * Event  Observer for this socket. This starts up a ØMQ monitoring
     * socket internally that receives all socket events.
     *
     *  readonly readonly events : Observer ; /**
     *  Context that this socket belongs to.
     *
     *  readonly readonly context : Context ; /**
     * Whether this socket was previously closed with  close ().
     *
     *  readonly readonly closed : boolean ; /**
     * Whether any messages are currently available. If `true`, the next call to
     *  Readable . receive () will immediately read a message from the socket.
     * For sockets that cannot receive messsages this is always `false`.
     *
     *  readonly readonly readable : boolean ; /**
     * Whether any messages can be queued for sending. If `true`, the next call to
     *  Writable . send () will immediately queue a message on the socket.
     * For sockets that cannot send messsages this is always `false`.
     *
     *  readonly readonly writable : boolean ; param type param options protected constructor ( type , options ? ) ; /**
     * Closes the socket and disposes of all resources. Any messages that are
     * queued may be discarded or sent in the background depending on the
     *  linger setting.
     *
     * After this method is called, it is no longer possible to call any other
     * methods on this socket.
     *
     * Sockets that go out of scope and have no  Readable . receive () or
     *  Writable . send () operations in progress will automatically be
     * closed. Therefore it is not necessary in most applications to call
     *  close () manually.
     *
     * Calling this method on a socket that is already closed is a no-op.
      close ( ) ; /**
     * Binds the socket to the given address. During  bind () the socket
     * cannot be used. Do not call any other methods until the returned promise
     * resolves. Make sure to use `await`.
     *
     * You can use `*` in place of a hostname to bind on all interfaces/addresses,
     * and you can use `*` in place of a port to bind to a random port (which can
     * be retrieved with  lastEndpoint later).
     *
     * ```typescript
     * await socket.bind("tcp://127.0.0.1:3456")
     * await socket.bind("tcp://*:3456")         // binds on all interfaces
     * await socket.bind("tcp://127.0.0.1:*")    // binds on random port
     * ```
     *
     *  param address returns bind ( address ) ; /**
     * Unbinds the socket to the given address. During  unbind () the socket
     * cannot be used. Do not call any other methods until the returned promise
     * resolves. Make sure to use `await`.
     *
     *  param address returns unbind ( address ) ; param address connect ( address ) ; param address disconnect ( address ) ; protected getBoolOption ( option ) ; protected setBoolOption ( option , value ) ; protected getInt32Option ( option ) ; protected setInt32Option ( option , value ) ; protected getUint32Option ( option ) ; protected setUint32Option ( option , value ) ; protected getInt64Option ( option ) ; protected setInt64Option ( option , value ) ; protected getUint64Option ( option ) ; protected setUint64Option ( option , value ) ; protected getStringOption ( option ) ; protected setStringOption ( option , value ) ; } export const enum SocketType { Pair = 0 , Publisher = 1 , Subscriber = 2 , Request = 3 , Reply = 4 , Dealer = 5 , Router = 6 , Pull = 7 , Push = 8 , XPublisher = 9 , XSubscriber = 10 , Stream = 11 , Server = 12 , Client = 13 , Radio = 14 , Dish = 15 , Gather = 16 , Scatter = 17 , Datagram = 18 } type IfEquals < X , Y , A , B = never > = ( < T > ( ) => T extends X ? 1 : 2 ) extends < T > ( ) => T extends Y ? 1 : 2 ? A : B ; type Expand < T > = T extends infer O ? { [ K in keyof O ] : O [ K ] ; } : never ; internal export type ReadableKeys < T > = { [ P in keyof T ] - ? : T [ P ] extends Function ? never : P ; } [ keyof T ] ; internal export type WritableKeys < T > = { [ P in keyof T ] - ? : T [ P ] extends Function ? never : IfEquals < { [ Q in P ] : T [ P ] ; } , { - readonly [ Q in P ] : T [ P ] ; } , P > ; } [ keyof T ] ; export type Options < T , E = { } > = Expand < Partial < E & Pick < T , WritableKeys < T > > > > ;