diff --git a/docs/classes/Child.html b/docs/classes/Child.html index fff268a..c299e0d 100644 --- a/docs/classes/Child.html +++ b/docs/classes/Child.html @@ -1,6 +1,6 @@ Child | status-sharding

Child class.

Export

Child

-

Constructors

Constructors

Properties

file process processOptions @@ -11,17 +11,17 @@

Constructors

Properties

file: string

The file to run.

-
process: null | ChildProcess = null

The child process.

-
processOptions: ForkOptions & {
    args?: string[];
} = {}

The options for the child process.

-

Type declaration

  • Optional args?: string[]

Methods

  • Kills the child process.

    +

Returns Child

Properties

file: string

The file to run.

+
process: null | ChildProcess = null

The child process.

+
processOptions: ForkOptions & {
    args?: string[];
} = {}

The options for the child process.

+

Type declaration

  • Optional args?: string[]

Methods

  • Kills the child process.

    Returns Promise<boolean>

    If the child process was killed.

    -
  • Respawns the child process.

    Returns Promise<ChildProcess>

    The child process.

    -
  • Spawns the child process.

    Returns ChildProcess

    The child process.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/ChildClient.html b/docs/classes/ChildClient.html index 7f870aa..9ecf1e8 100644 --- a/docs/classes/ChildClient.html +++ b/docs/classes/ChildClient.html @@ -1,15 +1,15 @@ ChildClient | status-sharding

Child client class.

Export

ChildClient

-

Constructors

Constructors

Properties

Methods

Constructors

Properties

ipc: Process

The IPC process.

-

Methods

Properties

ipc: Process

The IPC process.

+

Methods

  • Gets the data of the child process.

    Returns ProcessEnv

    The data.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/Cluster.html b/docs/classes/Cluster.html index 60fbbd3..6fe7888 100644 --- a/docs/classes/Cluster.html +++ b/docs/classes/Cluster.html @@ -2,7 +2,7 @@ Each one has a Child that contains an instance of the bot and its Client. When its child process/worker exits for any reason, the cluster will spawn a new one to replace it as necessary.

Export

Cluster

-

Type Parameters

Hierarchy

Constructors

Type Parameters

Hierarchy

  • EventEmitter
    • Cluster

Constructors

Properties

emit envData id @@ -58,20 +58,20 @@

Type Parameters

Parameters

  • manager: InternalManager

    The ClusterManager instance that manages this cluster.

  • id: number

    The ID of the cluster.

  • shardList: number[]

    The list of shards assigned to this cluster.

    -

Returns Cluster<InternalManager, InternalClient>

Properties

emit: (<K>(event, ...args) => boolean) & (<S>(event, ...args) => boolean)

Emit an event.

-

Type declaration

Type declaration

    • <S>(event, ...args): boolean
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns boolean

envData: ProcessEnv & {
    CLUSTER: number;
    CLUSTER_COUNT: number;
    CLUSTER_MANAGER_MODE: "worker" | "process";
    CLUSTER_QUEUE_MODE: "auto" | "manual";
    SHARD_LIST: number[];
    TOTAL_SHARDS: number;
}

Represents the environment data of the cluster.

-

Type declaration

  • CLUSTER: number
  • CLUSTER_COUNT: number
  • CLUSTER_MANAGER_MODE: "worker" | "process"
  • CLUSTER_QUEUE_MODE: "auto" | "manual"
  • SHARD_LIST: number[]
  • TOTAL_SHARDS: number
id: number

The ID of the cluster.

-
lastHeartbeatReceived?: number

Represents the last time the cluster received a heartbeat.

-

The ClusterManager instance that manages this cluster.

-
messageHandler?: ClusterHandler

Message processor that handles messages from the child process/worker/manager.

-
off: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Remove an event listener.

-

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

on: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event.

-

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

once: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event once.

-

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

ready: boolean

Represents whether the cluster is ready.

-
removeAllListeners: (<K>(event?) => this) & (<S>(event?) => this)

Remove all listeners for an event.

-

Type declaration

    • <K>(event?): this
    • Type Parameters

      Parameters

      • Optional event: K

      Returns this

Type declaration

    • <S>(event?): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns this

shardList: number[]

The list of shards assigned to this cluster.

-
thread: null | Worker | Child

Represents the child process/worker of the cluster.

-
captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

+

Returns Cluster<InternalManager, InternalClient>

Properties

emit: (<K>(event, ...args) => boolean) & (<S>(event, ...args) => boolean)

Emit an event.

+

Type declaration

Type declaration

    • <S>(event, ...args): boolean
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns boolean

envData: ProcessEnv & {
    CLUSTER: number;
    CLUSTER_COUNT: number;
    CLUSTER_MANAGER_MODE: "worker" | "process";
    CLUSTER_QUEUE_MODE: "auto" | "manual";
    SHARD_LIST: number[];
    TOTAL_SHARDS: number;
}

Represents the environment data of the cluster.

+

Type declaration

  • CLUSTER: number
  • CLUSTER_COUNT: number
  • CLUSTER_MANAGER_MODE: "worker" | "process"
  • CLUSTER_QUEUE_MODE: "auto" | "manual"
  • SHARD_LIST: number[]
  • TOTAL_SHARDS: number
id: number

The ID of the cluster.

+
lastHeartbeatReceived?: number

Represents the last time the cluster received a heartbeat.

+

The ClusterManager instance that manages this cluster.

+
messageHandler?: ClusterHandler

Message processor that handles messages from the child process/worker/manager.

+
off: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Remove an event listener.

+

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

on: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event.

+

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

once: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event once.

+

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

ready: boolean

Represents whether the cluster is ready.

+
removeAllListeners: (<K>(event?) => this) & (<S>(event?) => this)

Remove all listeners for an event.

+

Type declaration

    • <K>(event?): this
    • Type Parameters

      Parameters

      • Optional event: K

      Returns this

Type declaration

    • <S>(event?): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns this

shardList: number[]

The list of shards assigned to this cluster.

+
thread: null | Worker | Child

Represents the child process/worker of the cluster.

+
captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

See how to write a custom rejection handler.

Since

v13.4.0, v12.16.0

captureRejections: boolean

Value: boolean

@@ -106,17 +106,17 @@ regular 'error' listener is installed.

Since

v13.6.0, v12.17.0

Accessors

Methods

Methods

  • Eval function that evaluates a script on the current cluster.

    Type Parameters

    Parameters

    • script: string | ((cluster, context) => Awaitable<T>)

      The script to evaluate.

      @@ -144,7 +144,7 @@

      Example

      cluster
       

    Returns Promise<ValidIfSerializable<T>>

    The promise that resolves with the result of the script.

    Async

    Example

    cluster.eval('this.manager.clusters.size'); // 1
     
    -
  • EvalOnClient function that evaluates a script on a specific cluster.

    Type Parameters

    • T

      The type of the result of the script.

    • P extends object

      The type of the context of the script.

    • C = InternalClient

      The type of the client to use.

      @@ -156,7 +156,7 @@

      Example

      cluster
       

    Example

    cluster.evalOnClient((client) => client.cluster.id); // 0
    cluster.evalOnClient((client, context) => client.cluster.id + context, { context: 1 }); // 0 + 1
    -
  • EvalOnCluster function that evaluates a script on a specific cluster.

    Type Parameters

    • T

      The type of the result of the script.

    • P extends object

      The type of the context of the script.

    • C = InternalClient

      The type of the client to use.

      @@ -173,7 +173,7 @@

      Throws

      Example

      cluster.evalOnGuild('945340723425837066', (client, context, guild) => guild.name); // Digital's Basement
      cluster.evalOnGuild('945340723425837066', (client, context, guild) => guild.name + context, { context: ' is cool!' }); // Digital's Basement is cool!
      -
    • Returns an array listing the events for which the emitter has registered +

    • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

      import { EventEmitter } from 'node:events';

      const myEE = new EventEmitter();
      myEE.on('foo', () => {});
      myEE.on('bar', () => {});

      const sym = Symbol('symbol');
      myEE.on(sym, () => {});

      console.log(myEE.eventNames());
      // Prints: [ 'foo', 'bar', Symbol(symbol) ]
      @@ -187,7 +187,7 @@

      Example

      cluster
       

      Async

      Throws

      • If the cluster does not have a child process/worker.
      -
    • Returns the number of listeners listening for the event named eventName. +

    • Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event being listened for

        @@ -255,14 +255,14 @@

        Example

        cluster
         

      Example

      cluster.request({ customMessage: 'Hello world!' });
       
      -
    • Respawn function that respawns the cluster's child process/worker.

      +
    • Respawn function that respawns the cluster's child process/worker.

      Parameters

      • Optional delay: number = ...

        The amount of time to wait before respawning the cluster.

      • Optional timeout: number = ...

        The amount of time to wait for the cluster to become ready before killing it.

      Returns Promise<Worker | ChildProcess>

      The child process/worker of the cluster.

      Async

      Throws

      • If the cluster does not have a child process/worker.
      -
    • Send function that sends a message to the cluster's child process/worker.

      +
    • Send function that sends a message to the cluster's child process/worker.

      Type Parameters

      Parameters

      Returns Promise<void>

      The promise that resolves once the message has been sent.

      @@ -271,7 +271,7 @@

      Example

      cluster
       

    Example

    cluster.send({ id: '797012765352001557', username: 'Digital', discriminator: '3999' });
     
    -
  • By default EventEmitters will print a warning if more than 10 listeners are +

  • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

    @@ -286,7 +286,7 @@

    Example

    cluster
     

    Throws

    • If the cluster does not have a file provided.
    -
  • Function that enables maintenance mode on the cluster.

    +
  • Function that enables maintenance mode on the cluster.

    Parameters

    • Optional reason: string

      The reason for enabling maintenance mode.

    Returns Promise<void>

    The promise that resolves once maintenance mode has been enabled.

    Throws

      @@ -294,7 +294,7 @@

      Throws

      Example

      cluster.triggerMaintenance('Updating dependencies...');
      cluster.triggerMaintenance();
      -
  • Experimental

    Listens once to the abort event on the provided signal.

    +
  • Experimental

    Listens once to the abort event on the provided signal.

    Listening to the abort event on abort signals is unsafe and may lead to resource leaks since another third party with the signal can call e.stopImmediatePropagation(). Unfortunately Node.js cannot change diff --git a/docs/classes/ClusterClient.html b/docs/classes/ClusterClient.html index 5651950..7d976be 100644 --- a/docs/classes/ClusterClient.html +++ b/docs/classes/ClusterClient.html @@ -3,7 +3,7 @@

    Template: InternalCluster

    The cluster to use for the cluster.

Type Parameters

Hierarchy

  • EventEmitter
    • ClusterClient

Constructors

Hierarchy

  • EventEmitter
    • ClusterClient

Constructors

Properties

broker client emit @@ -59,19 +59,19 @@

Template: InternalCluster

The cluster to use for the cluster.

setMaxListeners

Constructors

Properties

broker: IPCBrokerClient

Client that manages broker tunnels.

-

The client to use for the sharding.

-
emit: (<K>(event, ...args) => boolean) & (<S>(event, ...args) => boolean)

Emit an event.

-

Type declaration

Type declaration

    • <S>(event, ...args): boolean
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns boolean

maintenance: string

Maintenance state of the cluster.

-

Handler that handles messages from the ClusterManager and the Cluster.

-
off: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Remove an event listener.

-

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterClientEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

on: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event.

-

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterClientEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

once: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event once.

-

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterClientEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

process: null | WorkerClient | ChildClient

Client that manages the cluster process.

-

Handler that resolves sent messages and requests.

-
ready: boolean

Ready state of the cluster.

-
removeAllListeners: (<K>(event?) => this) & (<S>(event?) => this)

Remove all listeners for an event.

-

Type declaration

    • <K>(event?): this
    • Type Parameters

      Parameters

      • Optional event: K

      Returns this

Type declaration

    • <S>(event?): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns this

captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

+

Returns ClusterClient<InternalClient, InternalManager>

Properties

broker: IPCBrokerClient

Client that manages broker tunnels.

+

The client to use for the sharding.

+
emit: (<K>(event, ...args) => boolean) & (<S>(event, ...args) => boolean)

Emit an event.

+

Type declaration

Type declaration

    • <S>(event, ...args): boolean
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns boolean

maintenance: string

Maintenance state of the cluster.

+

Handler that handles messages from the ClusterManager and the Cluster.

+
off: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Remove an event listener.

+

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterClientEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

on: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event.

+

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterClientEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

once: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event once.

+

Type declaration

    • <K>(event, listener): this
    • Type Parameters

      Parameters

      • event: K
      • listener: ((...args) => void)

      Returns this

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterClientEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

process: null | WorkerClient | ChildClient

Client that manages the cluster process.

+

Handler that resolves sent messages and requests.

+
ready: boolean

Ready state of the cluster.

+
removeAllListeners: (<K>(event?) => this) & (<S>(event?) => this)

Remove all listeners for an event.

+

Type declaration

    • <K>(event?): this
    • Type Parameters

      Parameters

      • Optional event: K

      Returns this

Type declaration

    • <S>(event?): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns this

captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

See how to write a custom rejection handler.

Since

v13.4.0, v12.16.0

captureRejections: boolean

Value: boolean

@@ -106,16 +106,16 @@

Template: InternalCluster

The cluster to use for the cluster.

regular 'error' listener is installed.

Since

v13.6.0, v12.17.0

Accessors

Methods

  • Type Parameters

    • K

    Parameters

    • error: Error
    • event: string | symbol
    • Rest ...args: AnyRest

    Returns void

Methods

  • Type Parameters

    • K

    Parameters

    • error: Error
    • event: string | symbol
    • Rest ...args: AnyRest

    Returns void

  • Kills the cluster.

    Parameters

    • message: string

      The message to send to the ClusterManager.

    Returns void

    A promise that resolves when the message was sent.

    -
  • Private

    Handles a message from the ClusterManager.

    Parameters

    • message: BrokerMessage | BaseMessage<"normal">

      The message to handle.

    Returns void

    A promise that resolves when the message was sent.

    -
  • Sends a message to the master process.

    Type Parameters

    • D extends DataType

      The type of the message.

    • A = Serializable

      The type of the message.

    • P extends object = object

      The type of the message.

      @@ -124,7 +124,7 @@

      Template: InternalCluster

      The cluster to use for the cluster.

      Throws

      • When there is no process to send the message to.
      -
    • Sends a message to the Cluster.

      Type Parameters

      • D extends DataType

        The type of the message.

      • A = Serializable

        The type of the message.

      • P extends object = object

        The type of the message.

        @@ -138,7 +138,7 @@

        Throws

        Example

        client.cluster.sendInstance({ _type: MessageTypes.CustomMessage, _nonce: '1234567890', data: { id: '797012765352001557', username: 'Digital', discriminator: '3999' } });
         
        -
      • Alias for emitter.on(eventName, listener).

        Type Parameters

        • K

        Parameters

        • eventName: string | symbol
        • listener: ((...args) => void)
            • (...args): void
            • Parameters

              • Rest ...args: any[]

              Returns void

        Returns this

        Since

        v0.1.26

      • Broadcasts a message to all clusters.

        Type Parameters

        • T extends Serializable

          The type of the message.

          @@ -153,7 +153,7 @@

          Throws

          Example

          client.cluster.broadcast({ type: 'ping' });
          client.cluster.broadcast('ping');
          client.cluster.broadcast(123);
          client.cluster.broadcast(true);
          client.cluster.broadcast({ type: 'ping' }, true);
          -
        • Evaluates a script on all clusters in parallel.

          Type Parameters

          • T

            The type of the result.

          • P extends object

            The type of the context.

          • C = InternalClient

            The type of the client.

            @@ -171,7 +171,7 @@

            Throws

            Example

            client.cluster.broadcastEval((client, context) => {
            return client.guilds.cache.size;
            }); // [ 23, 23, 23, 23, 23, 23, 23, 23 ] (8 clusters)
            -
          • Evaluates a script on a current client, in the context of the ShardingClient.

            Type Parameters

            • T

              The type of the result.

            • P extends object

              The type of the context.

            • C = InternalClient

              The type of the client.

              @@ -180,7 +180,7 @@

              Example

              client<
               

            Returns Promise<ValidIfSerializable<T>>

            A promise that resolves with the result of the eval.

            Async

            Example

            client.cluster.evalOnClient((client, context) => {
            return client.guilds.cache.size;
            }); // 23
            -
          • Evaluates a script on specific guild.

            Type Parameters

            • T

              The type of the result.

            • P extends object

              The type of the context.

            • C = InternalClient

              The type of the client.

              @@ -203,7 +203,7 @@

              Throws

              Example

              client.cluster.evalOnGuild('945340723425837066', (client, context, guild) => {
              return guild.name;
              }); // Digital's Basement
              -
            • Evaluates a script on the master process, in the context of the ClusterManager.

              Type Parameters

              • T

                The type of the result.

              • P extends object

                The type of the context.

              • M = InternalManager

                The type of the manager.

                @@ -221,7 +221,7 @@

                Throws

                Example

                client.cluster.evalOnManager((manager, context) => {
                return manager.clusters.size;
                }); // 8 (8 clusters)
                -
              • Returns an array listing the events for which the emitter has registered +

              • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

                import { EventEmitter } from 'node:events';

                const myEE = new EventEmitter();
                myEE.on('foo', () => {});
                myEE.on('bar', () => {});

                const sym = Symbol('symbol');
                myEE.on(sym, () => {});

                console.log(myEE.eventNames());
                // Prints: [ 'foo', 'bar', Symbol(symbol) ]
                @@ -299,10 +299,10 @@

                Throws

                Example

                client.cluster.request({ type: 'ping' });
                client.cluster.request('ping');
                client.cluster.request(123);
                -
              • Respawns all clusters.

                Parameters

                • Optional options: {
                      clusterDelay?: number;
                      respawnDelay?: number;
                      timeout?: number;
                  } = {}

                  The options for the respawn.

                  • Optional clusterDelay?: number
                  • Optional respawnDelay?: number
                  • Optional timeout?: number

                Returns Promise<void>

                A promise that resolves when the message was sent.

                -
              • Sends a message to the Cluster as child. (goes to Cluster on _handleMessage).

                +
              • Sends a message to the Cluster as child. (goes to Cluster on _handleMessage).

                Type Parameters

                • T extends Serializable

                  The type of the message.

                Parameters

                Returns Promise<void>

                A promise that resolves when the message was sent.

                @@ -314,7 +314,7 @@

                Throws

                Example

                client.cluster.send({ type: 'ping' });
                client.cluster.send('ping');
                client.cluster.send(123);
                client.cluster.send(true);
                client.cluster.send({ type: 'ping' }, { timeout: 5000 });
                -
              • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

                @@ -333,16 +333,16 @@

                Throws

                Example

                client.cluster.spawnNextCluster();
                client.cluster.spawnNextCluster().catch(console.error);
                -
              • Triggers the maintenance event.

                Parameters

                • maintenance: string

                  The maintenance message.

                • Optional all: boolean = false

                  Whether to send the maintenance message to all clusters.

                Returns string

                The maintenance message.

                Throws

                • When there is no process to send the message to.
                -
              • Triggers the ready event, do not use this unless you know what you are doing.

                Returns boolean

                Whether the cluster is ready or not.

                -
              • Experimental

                Listens once to the abort event on the provided signal.

                +
              • Experimental

                Listens once to the abort event on the provided signal.

                Listening to the abort event on abort signals is unsafe and may lead to resource leaks since another third party with the signal can call e.stopImmediatePropagation(). Unfortunately Node.js cannot change diff --git a/docs/classes/ClusterClientHandler.html b/docs/classes/ClusterClientHandler.html index 7c87b7d..86f8e64 100644 --- a/docs/classes/ClusterClientHandler.html +++ b/docs/classes/ClusterClientHandler.html @@ -1,16 +1,16 @@ ClusterClientHandler | status-sharding

                Class ClusterClientHandler<InternalClient>

                Handles messages for the cluster client.

                Export

                ClusterClientHandler

                Type Parameters

                Constructors

              Constructors

              Properties

              Methods

              Constructors

              Properties

              The cluster client.

              -

              Methods

              • Handles the message received, and executes the callback. (Not meant to be used by the user.)

                +

              Returns ClusterClientHandler<InternalClient>

          Properties

          The cluster client.

          +

          Methods

          • Handles the message received, and executes the callback. (Not meant to be used by the user.)

            Type Parameters

            • D extends DataType

              The type of the message.

            • A = Serializable

              The type of the message data.

            • P extends object = object

              The type of the message options.

            Parameters

            Returns Promise<void>

            The promise.

            -

            Async

          \ No newline at end of file +

          Async

      \ No newline at end of file diff --git a/docs/classes/ClusterHandler.html b/docs/classes/ClusterHandler.html index 853a62d..b3b94f8 100644 --- a/docs/classes/ClusterHandler.html +++ b/docs/classes/ClusterHandler.html @@ -1,18 +1,18 @@ ClusterHandler | status-sharding

      Class ClusterHandler

      Handles messages for the cluster.

      Export

      ClusterHandler

      -

      Constructors

      Constructors

      Properties

      Methods

      Constructors

      Properties

      The cluster.

      -
      ipc: Worker | Child

      The IPC process.

      -

      Methods

      • Handles the message received, and executes the callback. (Not meant to be used by the user.)

        +

      Returns ClusterHandler

Properties

The cluster.

+
ipc: Worker | Child

The IPC process.

+

Methods

  • Handles the message received, and executes the callback. (Not meant to be used by the user.)

    Type Parameters

    • D extends DataType

      The type of the message.

    • A = Serializable

      The type of the message data.

    • P extends object = object

      The type of the message options.

    Parameters

    Returns Promise<void>

    The promise.

    -

    Async

\ No newline at end of file +

Async

\ No newline at end of file diff --git a/docs/classes/ClusterManager.html b/docs/classes/ClusterManager.html index b576065..5a1f8d0 100644 --- a/docs/classes/ClusterManager.html +++ b/docs/classes/ClusterManager.html @@ -1,6 +1,6 @@ ClusterManager | status-sharding

Class ClusterManager<InternalClient, InternalCluster>

Manager for the Clusters.

Export

ClusterManager

-

Type Parameters

Hierarchy

  • EventEmitter
    • ClusterManager

Constructors

Type Parameters

Hierarchy

  • EventEmitter
    • ClusterManager

Constructors

Properties

broker clusterQueue clusters @@ -52,22 +52,22 @@

Constructors

Properties

broker: IPCBrokerManager

IPC Broker for the ClusterManager.

-
clusterQueue: Queue

Queue for the ClusterManager

-
clusters: default<number, InternalCluster>

A collection of all clusters the manager spawned.

-
emit: (<K>(event, ...args) => boolean) & (<S>(event, ...args) => boolean)

Emit an event.

-

Type declaration

Type declaration

    • <S>(event, ...args): boolean
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns boolean

file: string

Path to the file that will be spawned.

-
heartbeat: null | HeartbeatManager

Heartbeat Manager for the ClusterManager

-
maintenance: string

Maintenance mode reason

-
off: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Remove an event listener.

-

Type declaration

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterManagerEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

on: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event.

-

Type declaration

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterManagerEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

once: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event once.

-

Type declaration

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterManagerEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

Options for the ClusterManager

-

Promise Handler for the ClusterManager

-
reCluster: ReClusterManager

ReCluster Manager for the ClusterManager

-
ready: boolean

Check if all clusters are ready.

-
removeAllListeners: (<K>(event?) => this) & (<S>(event?) => this)

Remove all listeners for an event.

-

Type declaration

Type declaration

    • <S>(event?): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns this

captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

+

Returns ClusterManager<InternalClient, InternalCluster>

Properties

broker: IPCBrokerManager

IPC Broker for the ClusterManager.

+
clusterQueue: Queue

Queue for the ClusterManager

+
clusters: default<number, InternalCluster>

A collection of all clusters the manager spawned.

+
emit: (<K>(event, ...args) => boolean) & (<S>(event, ...args) => boolean)

Emit an event.

+

Type declaration

Type declaration

    • <S>(event, ...args): boolean
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns boolean

file: string

Path to the file that will be spawned.

+
heartbeat: null | HeartbeatManager

Heartbeat Manager for the ClusterManager

+
maintenance: string

Maintenance mode reason

+
off: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Remove an event listener.

+

Type declaration

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterManagerEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

on: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event.

+

Type declaration

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterManagerEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

once: (<K>(event, listener) => this) & (<S>(event, listener) => this)

Listen for an event once.

+

Type declaration

Type declaration

    • <S>(event, listener): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      • event: Exclude<S, keyof ClusterManagerEvents>
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: unknown[]

            Returns void

      Returns this

Options for the ClusterManager

+

Promise Handler for the ClusterManager

+
reCluster: ReClusterManager

ReCluster Manager for the ClusterManager

+
ready: boolean

Check if all clusters are ready.

+
removeAllListeners: (<K>(event?) => this) & (<S>(event?) => this)

Remove all listeners for an event.

+

Type declaration

Type declaration

    • <S>(event?): this
    • Type Parameters

      • S extends string | symbol

      Parameters

      Returns this

captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

See how to write a custom rejection handler.

Since

v13.4.0, v12.16.0

captureRejections: boolean

Value: boolean

@@ -104,26 +104,26 @@

Methods

  • Type Parameters

    • K

    Parameters

    • error: Error
    • event: string | symbol
    • Rest ...args: AnyRest

    Returns void

  • Logs out the Debug Messages.

    Parameters

    • message: string

      The message to log.

    Returns void

    Nothing.

    -
  • Alias for emitter.on(eventName, listener).

    Type Parameters

    • K

    Parameters

    • eventName: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

    Since

    v0.1.26

  • Sends a message to all clusters.

    Type Parameters

    Parameters

    • message: SerializableInput<T, false>

      The message to send.

    • Optional ignoreClusters: number[]

      An array of cluster ids to ignore.

    Returns Promise<void>

    Resolves once all clusters have received the message.

    -

    Async

  • Evaluates a script on all clusters, or a given cluster, in the context of the Client.

    Type Parameters

    • T

      The type of the result.

    • P extends object

      The type of the context.

    • C = InternalClient

      The type of the client.

    Parameters

    • script: string | ((client, context) => Awaitable<T>)

      The script to evaluate.

    • Optional options: EvalOptions<P>

      The options for the evaluation.

    Returns Promise<ValidIfSerializable<T>[]>

    The result of the evaluation.

    -

    Async

  • Evaluates a script on the Manager.

    Type Parameters

Returns Promise<{
    error: undefined | Error;
    result: undefined | Serialized<T>;
}>

The result of the evaluation.

Async

Example

manager.eval('this.options.token').then((result) => console.log(result));
manager.eval((manager) => manager.options.token).then((result) => console.log(result));
-
  • Evaluates a script on a given Cluster's Client.

    Type Parameters

    • T

      The type of the result.

    • P extends object

      The type of the context.

    • C = InternalClient

      The type of the client.

      @@ -147,7 +147,7 @@
    • script: ((client, context) => Awaitable<T>)

      The script to evaluate.

    • Optional options: EvalOptions<P>

      The options for the evaluation.

Returns Promise<ValidIfSerializable<T>>

The result of the evaluation.

-

Async

  • Evaluates a script on specific guild.

    Type Parameters

    • T

      The type of the result.

    • P extends object

      The type of the context.

    • C = InternalClient

      The type of the client.

      @@ -156,7 +156,7 @@
    • script: ((client, context, guild) => Awaitable<T>)

      The script to evaluate.

    • Optional options: {
          context?: P;
          experimental?: E;
          timeout?: number;
      }

      The options for the eval.

      • Optional context?: P
      • Optional experimental?: E
      • Optional timeout?: number

    Returns Promise<ValidIfSerializable<T>>

    The result of the evaluation.

    -

    Async

  • Returns an array listing the events for which the emitter has registered +

    Async

  • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

    import { EventEmitter } from 'node:events';

    const myEE = new EventEmitter();
    myEE.on('foo', () => {});
    myEE.on('bar', () => {});

    const sym = Symbol('symbol');
    myEE.on(sym, () => {});

    console.log(myEE.eventNames());
    // Prints: [ 'foo', 'bar', Symbol(symbol) ]
    @@ -226,7 +226,7 @@
  • Optional respawnDelay: number = 5500

    The delay between each shard respawn.

  • Optional timeout: number = -1

    The timeout for each respawn.

Returns Promise<Map<number, InternalCluster>>

The clusters after the respawn.

-

Async

  • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

    @@ -234,10 +234,10 @@

    Parameters

    • n: number

    Returns this

    Since

    v0.3.5

  • Triggers a maintenance mode for all clusters.

    Parameters

    • reason: string

      The reason for the maintenance mode.

    Returns void

    Nothing.

    -
  • Experimental

    Listens once to the abort event on the provided signal.

    +

Properties

beats: Map<number, HeartbeatData>

The list of heartbeat data per cluster.

+
interval: Timeout

The interval of the heartbeat.

+

The instance of the cluster manager.

+

Methods

  • Adds a missed beat to a cluster.

    Parameters

    • id: number

      The id of the cluster.

    Returns Promise<void>

    Nothing.

    -
  • Removes a cluster from the heartbeat.

    Parameters

    • id: number

      The id of the cluster.

    Returns void

    Nothing.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/ProcessMessage.html b/docs/classes/ProcessMessage.html index 8f36330..142e21e 100644 --- a/docs/classes/ProcessMessage.html +++ b/docs/classes/ProcessMessage.html @@ -3,7 +3,7 @@

Type Parameters

  • D extends DataType = "normal"

    The type of the message.

  • A extends Serializable = Serializable

    The type of the message data.

  • P extends object = object

    The type of the message options.

    -

Constructors

Constructors

Properties

_instance _nonce data @@ -11,11 +11,11 @@

Constructors

Properties

Instance of the cluster client or cluster.

-
_nonce: string

The nonce of the message.

-
data: DataTypes<A, object>[D]

The data of the message.

-

Methods

  • Replies to the message.

    +

Returns ProcessMessage<D, A, P>

Properties

Instance of the cluster client or cluster.

+
_nonce: string

The nonce of the message.

+
data: DataTypes<A, object>[D]

The data of the message.

+

Methods

\ No newline at end of file +

Async

\ No newline at end of file diff --git a/docs/classes/PromiseHandler.html b/docs/classes/PromiseHandler.html index f55ba8a..8d396d7 100644 --- a/docs/classes/PromiseHandler.html +++ b/docs/classes/PromiseHandler.html @@ -1,23 +1,23 @@ PromiseHandler | status-sharding

Class PromiseHandler

Handles promises by storing them in a map and resolving them when the response is received.

Export

PromiseHandler

-

Constructors

Constructors

Properties

Methods

Constructors

Properties

The instance of the Promise Handler.

-
nonces: Map<string, StoredPromise> = ...

List of promises and their unique identifiers.

-

Methods

  • Creates a promise and stores it in the map.

    +

Returns PromiseHandler

Properties

The instance of the Promise Handler.

+
nonces: Map<string, StoredPromise> = ...

List of promises and their unique identifiers.

+

Methods

  • Creates a promise and stores it in the map.

    Type Parameters

    • T

      The return type of the promise.

    Parameters

    • nonce: string

      The unique identifier of the promise.

    • Optional timeout: number

      How long to wait before rejecting the promise.

    Returns Promise<T>

    The promise.

    -

    Async

  • Resolves the promise with the data received.

    Type Parameters

    • D extends DataType

      The type of the message.

    • A = Serializable

      The type of the message data.

    • P extends object = object

      The type of the message options.

    Parameters

    Returns void

    Nothing.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/Queue.html b/docs/classes/Queue.html index 7d0ef37..e1eac16 100644 --- a/docs/classes/Queue.html +++ b/docs/classes/Queue.html @@ -1,6 +1,6 @@ Queue | status-sharding

Queue class.

Export

Queue

-

Constructors

Constructors

Properties

options paused queue @@ -11,18 +11,18 @@ stop

Constructors

Properties

options: QueueOptions

The options for the queue.

-
paused: boolean = false

Whether the queue is paused.

-
queue: QueueItem<unknown[]>[] = []

List of items in the queue.

-

Methods

  • Adds an item to the queue.

    +

Returns Queue

Properties

options: QueueOptions

The options for the queue.

+
paused: boolean = false

Whether the queue is paused.

+
queue: QueueItem<unknown[]>[] = []

List of items in the queue.

+

Methods

  • Runs the next item in the queue.

    Returns Promise<unknown>

    The result of the item.

    -

    Async

\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/ReClusterManager.html b/docs/classes/ReClusterManager.html index 1387e77..10069ab 100644 --- a/docs/classes/ReClusterManager.html +++ b/docs/classes/ReClusterManager.html @@ -1,14 +1,14 @@ ReClusterManager | status-sharding

Class ReClusterManager

Handles re-clustering for the cluster manager.

Export

ReClusterManager

-

Constructors

Constructors

Properties

Methods

Constructors

Properties

inProgress: boolean = false

If re-clustering is in progress.

-

The cluster manager.

-

Methods

  • Starts re-clustering.

    +

Returns ReClusterManager

Properties

inProgress: boolean = false

If re-clustering is in progress.

+

The cluster manager.

+

Methods

  • Starts re-clustering.

    Parameters

    Returns Promise<boolean>

    If re-clustering was successful.

    -

    Async

\ No newline at end of file +

Async

\ No newline at end of file diff --git a/docs/classes/ShardingClient.html b/docs/classes/ShardingClient.html index da21bfe..884cf1b 100644 --- a/docs/classes/ShardingClient.html +++ b/docs/classes/ShardingClient.html @@ -2,7 +2,7 @@

Export

ShardingClient

Type Parameters

Hierarchy

  • Client<Ready>
    • ShardingClient

Constructors

Hierarchy

  • Client<Ready>
    • ShardingClient

Constructors

Properties

Constructors

Properties

application: If<Ready, ClientApplication, null>
channels: ChannelManager

Cluster associated with this client.

-
fetchPrefix: SapphirePrefixHook
guilds: GuildManager
id: null | string
logger: ILogger
options: Omit<ClientOptions, "intents"> & {
    intents: IntentsBitField;
}

Type declaration

  • intents: IntentsBitField
readyTimestamp: If<Ready, number, null>
rest: REST
shard: null | ShardClientUtil
stores: StoreRegistry
sweepers: Sweepers
token: If<Ready, string, null | string>
user: If<Ready, ClientUser, null>
users: UserManager
voice: ClientVoiceManager
ws: WebSocketManager
captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

+

Returns ShardingClient<Ready, InternalManager>

Properties

application: If<Ready, ClientApplication, null>
channels: ChannelManager

Cluster associated with this client.

+
fetchPrefix: SapphirePrefixHook
guilds: GuildManager
id: null | string
logger: ILogger
options: Omit<ClientOptions, "intents"> & {
    intents: IntentsBitField;
}

Type declaration

  • intents: IntentsBitField
readyTimestamp: If<Ready, number, null>
rest: REST
shard: null | ShardClientUtil
stores: StoreRegistry
sweepers: Sweepers
token: If<Ready, string, null | string>
user: If<Ready, ClientUser, null>
users: UserManager
voice: ClientVoiceManager
ws: WebSocketManager
captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

See how to write a custom rejection handler.

Since

v13.4.0, v12.16.0

captureRejections: boolean

Value: boolean

@@ -107,7 +107,7 @@

Since

v13.6.0, v12.17.0

Accessors

  • get _censoredToken(): null | string
  • Returns null | string

  • get emojis(): BaseGuildEmojiManager
  • Returns BaseGuildEmojiManager

  • get readyAt(): If<Ready, Date, null>
  • Returns If<Ready, Date, null>

  • get uptime(): If<Ready, number, null>
  • Returns If<Ready, number, null>

Methods

  • Returns Promise<void>

  • Type Parameters

    • K

    Parameters

    • error: Error
    • event: string | symbol
    • Rest ...args: AnyRest

    Returns void

  • Alias for emitter.on(eventName, listener).

    Type Parameters

    • K

    Parameters

    • eventName: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

    Since

    v0.1.26

    -
  • Parameters

    • id: string
    • Optional options: WebhookDeleteOptions

    Returns Promise<void>

  • Returns Promise<void>

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • Rest ...args: ClientEventsModifiable[K]

    Returns boolean

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • Rest ...args: unknown[]

    Returns boolean

  • Returns an array listing the events for which the emitter has registered +

  • Parameters

    • id: string
    • Optional options: WebhookDeleteOptions

    Returns Promise<void>

  • Returns Promise<void>

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • Rest ...args: ClientEventsModifiable[K]

    Returns boolean

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • Rest ...args: unknown[]

    Returns boolean

  • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

    import { EventEmitter } from 'node:events';

    const myEE = new EventEmitter();
    myEE.on('foo', () => {});
    myEE.on('bar', () => {});

    const sym = Symbol('symbol');
    myEE.on(sym, () => {});

    console.log(myEE.eventNames());
    // Prints: [ 'foo', 'bar', Symbol(symbol) ]
    @@ -126,7 +126,7 @@
    server.on('connection', (stream) => {
    console.log('someone connected!');
    });
    console.log(util.inspect(server.listeners('connection')));
    // Prints: [ [Function] ]

    Type Parameters

    • K

    Parameters

    • eventName: string | symbol

    Returns Function[]

    Since

    v0.1.26

    -
  • Parameters

    • Optional token: string

    Returns Promise<string>

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Adds the listener function to the beginning of the listeners array for the +

  • Parameters

    • Optional token: string

    Returns Promise<string>

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

    diff --git a/docs/classes/ShardingClientSapphire.html b/docs/classes/ShardingClientSapphire.html index 7607e08..644738a 100644 --- a/docs/classes/ShardingClientSapphire.html +++ b/docs/classes/ShardingClientSapphire.html @@ -2,7 +2,7 @@

    Export

    ShardingClient

Type Parameters

Hierarchy

  • SapphireClient<Ready>
    • ShardingClientSapphire

Constructors

Hierarchy

  • SapphireClient<Ready>
    • ShardingClientSapphire

Constructors

Properties

application channels cluster @@ -73,8 +73,8 @@ use

Constructors

Properties

application: If<Ready, ClientApplication, null>
channels: ChannelManager

Cluster associated with this client.

-
disableMentionPrefix?: boolean

Whether the bot has mention as a prefix disabled

+

Returns ShardingClientSapphire<Ready, InternalManager>

Properties

application: If<Ready, ClientApplication, null>
channels: ChannelManager

Cluster associated with this client.

+
disableMentionPrefix?: boolean

Whether the bot has mention as a prefix disabled

Default

false
 

Example

client.disableMentionPrefix = false;
@@ -131,7 +131,7 @@ 

Example

// Ret
 

Since

v13.6.0, v12.17.0

plugins: PluginManager

Accessors

  • get _censoredToken(): null | string
  • Returns null | string

  • get emojis(): BaseGuildEmojiManager
  • Returns BaseGuildEmojiManager

  • get readyAt(): If<Ready, Date, null>
  • Returns If<Ready, Date, null>

  • get uptime(): If<Ready, number, null>
  • Returns If<Ready, number, null>

Methods

  • Returns Promise<void>

  • Type Parameters

    • K

    Parameters

    • error: Error
    • event: string | symbol
    • Rest ...args: AnyRest

    Returns void

  • Alias for emitter.on(eventName, listener).

    Type Parameters

    • K

    Parameters

    • eventName: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

    Since

    v0.1.26

    -
  • Parameters

    • id: string
    • Optional options: WebhookDeleteOptions

    Returns Promise<void>

  • Returns Promise<void>

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • Rest ...args: ClientEventsModifiable[K]

    Returns boolean

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • Rest ...args: unknown[]

    Returns boolean

  • Returns an array listing the events for which the emitter has registered +

  • Parameters

    • id: string
    • Optional options: WebhookDeleteOptions

    Returns Promise<void>

  • Returns Promise<void>

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • Rest ...args: ClientEventsModifiable[K]

    Returns boolean

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • Rest ...args: unknown[]

    Returns boolean

  • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

    import { EventEmitter } from 'node:events';

    const myEE = new EventEmitter();
    myEE.on('foo', () => {});
    myEE.on('bar', () => {});

    const sym = Symbol('symbol');
    myEE.on(sym, () => {});

    console.log(myEE.eventNames());
    // Prints: [ 'foo', 'bar', Symbol(symbol) ]
    @@ -154,7 +154,7 @@

    Example

    // Ret
     

    Parameters

    • Optional token: string

      Token of the account to log in with.

    Returns Promise<string>

    Token of the account used.

    Since

    1.0.0

    -
  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Adds the listener function to the beginning of the listeners array for the +

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Type Parameters

    • K extends keyof ClientEvents

    Parameters

    • event: K
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ClientEventsModifiable[K]

          Returns void

    Returns this

  • Type Parameters

    • S extends string | symbol

    Parameters

    • event: Exclude<S, keyof ClientEvents>
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

    diff --git a/docs/classes/ShardingUtils.html b/docs/classes/ShardingUtils.html index b0d8f15..8ac50ab 100644 --- a/docs/classes/ShardingUtils.html +++ b/docs/classes/ShardingUtils.html @@ -1,6 +1,6 @@ ShardingUtils | status-sharding

    Class ShardingUtils

    Sharding utils.

    Export

    ShardingUtils

    -

    Constructors

    Constructors

    Methods

  • chunkSize: number

    The size of the chunks.

  • Optional equalize: boolean = false

    Whether to equalize items per chunk or to fill them up and last one possibly being smaller.

Returns T[][]

The chunked array.

-
  • Gets the cluster id for a guild id.

    Parameters

    • guildId: string

      The guild id to get the cluster id for.

    • totalShards: number

      The total amount of shards.

    • totalClusters: number

      The total amount of clusters.

    Returns number

    The cluster id.

    -
  • Gets the cluster id for a shard id.

    Parameters

    • shardId: string

      The shard id to get the cluster id for.

    • totalShards: number

      The total amount of shards.

    • totalClusters: number

      The total amount of clusters.

    Returns number

    The cluster id.

    -
  • Delays for a certain amount of time.

    Parameters

    • ms: number

      The amount of time to delay for.

    Returns Promise<void>

    Nothing.

    -
  • Gets the cluster id for a shard id.

    Parameters

    • token: string

      The token to use.

    • Optional guildsPerShard: number = 1000

      The amount of guilds per shard.

    Returns Promise<number>

    The recommended amount of shards.

    -

    Async

  • Parses a function to a string.

    Type Parameters

    • R

      The return type of the function.

    • A extends never[]

      The arguments of the function.

    Parameters

    • func: string | ((...args) => R)

      The function to parse.

    Returns string

    The parsed function.

    -
  • Makes an error plain.

    +
  • Makes an error plain.

    Parameters

    • err: Error

      The error to make plain.

    Returns {
        message: string;
        name: string;
        stack: string;
    }

    The plain error.

    -
    • message: string
    • name: string
    • stack: string
  • Merges two objects.

    Type Parameters

    • T extends object

      The type of the objects.

    Parameters

    • main: Partial<T>

      The main object.

    • toMerge: Partial<T>

      The object to merge.

    Returns T

    The merged object.

    -
  • Removes all non-existing values from an array.

    Type Parameters

    • T

      The type of the array.

    Parameters

    • array: (undefined | T)[]

      The array to remove the non-existing values from.

    Returns undefined | T[]

    The array without the non-existing values.

    -
  • Gets the shard id for a guild id.

    Parameters

    • guildId: string

      The guild id to get the shard id for.

    • totalShards: number

      The total amount of shards.

    Returns number

    The shard id.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/Worker.html b/docs/classes/Worker.html index facb4c4..e25aaa8 100644 --- a/docs/classes/Worker.html +++ b/docs/classes/Worker.html @@ -1,6 +1,6 @@ Worker | status-sharding

Worker class.

Export

Worker

-

Constructors

Constructors

Properties

file process workerOptions @@ -11,17 +11,17 @@

Constructors

Properties

file: string

The file to run.

-
process: null | Worker = null

The worker process.

-
workerOptions: WorkerOptions

The options for the worker process.

-

Methods

  • Kills the worker.

    +

Returns Worker

Properties

file: string

The file to run.

+
process: null | Worker = null

The worker process.

+
workerOptions: WorkerOptions

The options for the worker process.

+

Methods

  • Sends a message to the worker.

    Type Parameters

    Parameters

    • message: unknown

      The message to send.

    Returns Promise<void>

    The promise.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/WorkerClient.html b/docs/classes/WorkerClient.html index f882705..62b4e99 100644 --- a/docs/classes/WorkerClient.html +++ b/docs/classes/WorkerClient.html @@ -1,15 +1,15 @@ WorkerClient | status-sharding

Class WorkerClient

Worker client class.

Export

WorkerClient

-

Constructors

Constructors

Properties

Methods

Constructors

Properties

ipc: null | MessagePort

The IPC port of the worker.

-

Methods

Properties

ipc: null | MessagePort

The IPC port of the worker.

+

Methods

  • Respawns the worker.

    Type Parameters

    Parameters

    • message: unknown

      The message to send.

    Returns Promise<void>

    The promise.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/enums/MessageTypes.html b/docs/enums/MessageTypes.html index 49e87cc..3296505 100644 --- a/docs/enums/MessageTypes.html +++ b/docs/enums/MessageTypes.html @@ -1,5 +1,5 @@ MessageTypes | status-sharding

Enumeration MessageTypes

The types of data that can be sent.

-

Export

Enumeration Members

Export

Enumeration Members

ClientBroadcast: 6
ClientBroadcastRequest: 7
ClientBroadcastResponse: 8
ClientBroadcastResponseError: 9
ClientEvalRequest: 18
ClientEvalResponse: 19
ClientEvalResponseError: 20
ClientMaintenance: 12
ClientMaintenanceAll: 15
ClientMaintenanceDisable: 14
ClientMaintenanceEnable: 13
ClientManagerEvalRequest: 21
ClientManagerEvalResponse: 22
ClientManagerEvalResponseError: 23
ClientReady: 17
ClientRespawn: 10
ClientRespawnAll: 11
ClientSpawnNextCluster: 16
CustomMessage: 2
CustomReply: 3
CustomRequest: 1
Heartbeat: 4
HeartbeatAck: 5
Kill: 25
ManagerReady: 24
MissingType: 0
\ No newline at end of file +

Enumeration Members

ClientBroadcast: 6
ClientBroadcastRequest: 7
ClientBroadcastResponse: 8
ClientBroadcastResponseError: 9
ClientEvalRequest: 18
ClientEvalResponse: 19
ClientEvalResponseError: 20
ClientMaintenance: 12
ClientMaintenanceAll: 15
ClientMaintenanceDisable: 14
ClientMaintenanceEnable: 13
ClientManagerEvalRequest: 21
ClientManagerEvalResponse: 22
ClientManagerEvalResponseError: 23
ClientReady: 17
ClientRespawn: 10
ClientRespawnAll: 11
ClientSpawnNextCluster: 16
CustomMessage: 2
CustomReply: 3
CustomRequest: 1
Heartbeat: 4
HeartbeatAck: 5
Kill: 25
ManagerReady: 24
MissingType: 0
\ No newline at end of file diff --git a/docs/functions/getInfo.html b/docs/functions/getInfo.html index a742cfc..f8982fd 100644 --- a/docs/functions/getInfo.html +++ b/docs/functions/getInfo.html @@ -1,3 +1,3 @@ getInfo | status-sharding

Function getInfo

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/interfaces/ChildProcessOptions.html b/docs/interfaces/ChildProcessOptions.html index c759029..673cc8d 100644 --- a/docs/interfaces/ChildProcessOptions.html +++ b/docs/interfaces/ChildProcessOptions.html @@ -1,6 +1,6 @@ ChildProcessOptions | status-sharding

Interface ChildProcessOptions

Options for the child process.

Export

ChildProcessOptions

-
interface ChildProcessOptions {
    args?: string[];
    clusterData?: ProcessEnv;
    cwd?: string | URL;
    detached?: boolean;
    env?: ProcessEnv;
    execArgv?: string[];
    execPath?: string;
    gid?: number;
    killSignal?: number | Signals;
    serialization?: SerializationType;
    signal?: AbortSignal;
    silent?: boolean;
    stdio?: StdioOptions;
    timeout?: number;
    uid?: number;
    windowsVerbatimArguments?: boolean;
}

Hierarchy

  • ForkOptions
    • ChildProcessOptions

Properties

interface ChildProcessOptions {
    args?: string[];
    clusterData?: ProcessEnv;
    cwd?: string | URL;
    detached?: boolean;
    env?: ProcessEnv;
    execArgv?: string[];
    execPath?: string;
    gid?: number;
    killSignal?: number | Signals;
    serialization?: SerializationType;
    signal?: AbortSignal;
    silent?: boolean;
    stdio?: StdioOptions;
    timeout?: number;
    uid?: number;
    windowsVerbatimArguments?: boolean;
}

Hierarchy

  • ForkOptions
    • ChildProcessOptions

Properties

args?: string[]

The arguments to pass to the child process.

-
clusterData?: ProcessEnv

Data to send to the cluster.

-
cwd?: string | URL
detached?: boolean
env?: ProcessEnv
execArgv?: string[]
execPath?: string
gid?: number
killSignal?: number | Signals

The signal value to be used when the spawned process will be killed by the abort signal.

+
clusterData?: ProcessEnv

Data to send to the cluster.

+
cwd?: string | URL
detached?: boolean
env?: ProcessEnv
execArgv?: string[]
execPath?: string
gid?: number
killSignal?: number | Signals

The signal value to be used when the spawned process will be killed by the abort signal.

Default

'SIGTERM'
 
serialization?: SerializationType

Specify the kind of serialization used for sending messages between processes.

diff --git a/docs/interfaces/ClusterClientData.html b/docs/interfaces/ClusterClientData.html index 7137294..f544b3f 100644 --- a/docs/interfaces/ClusterClientData.html +++ b/docs/interfaces/ClusterClientData.html @@ -1,6 +1,6 @@ ClusterClientData | status-sharding

Interface ClusterClientData

Data of ClusterClient.

Export

ClusterClientData

-
interface ClusterClientData {
    ClusterCount: number;
    ClusterId: number;
    ClusterManagerMode: ClusteringMode;
    ClusterQueueMode?: "auto" | "manual";
    FirstShardId: number;
    LastShardId: number;
    ShardList: number[];
    TotalShards: number;
}

Properties

interface ClusterClientData {
    ClusterCount: number;
    ClusterId: number;
    ClusterManagerMode: ClusteringMode;
    ClusterQueueMode?: "auto" | "manual";
    FirstShardId: number;
    LastShardId: number;
    ShardList: number[];
    TotalShards: number;
}

Properties

ClusterCount: number

The total amount of clusters.

-
ClusterId: number

The id of the cluster.

-
ClusterManagerMode: ClusteringMode

Mode of the manager.

-
ClusterQueueMode?: "auto" | "manual"

Mode of the queue.

-
FirstShardId: number

First shard id of the cluster.

-
LastShardId: number

Last shard id of the cluster.

-
ShardList: number[]

List of shards that are assigned to this cluster.

-
TotalShards: number

The total amount of shards.

-
\ No newline at end of file +
ClusterId: number

The id of the cluster.

+
ClusterManagerMode: ClusteringMode

Mode of the manager.

+
ClusterQueueMode?: "auto" | "manual"

Mode of the queue.

+
FirstShardId: number

First shard id of the cluster.

+
LastShardId: number

Last shard id of the cluster.

+
ShardList: number[]

List of shards that are assigned to this cluster.

+
TotalShards: number

The total amount of shards.

+
\ No newline at end of file diff --git a/docs/interfaces/ClusterClientEvents.html b/docs/interfaces/ClusterClientEvents.html index 66b339b..f92fc7f 100644 --- a/docs/interfaces/ClusterClientEvents.html +++ b/docs/interfaces/ClusterClientEvents.html @@ -1,11 +1,11 @@ ClusterClientEvents | status-sharding

Interface ClusterClientEvents

Events that cluster client emits.

Export

ClusterClientEvents

-
interface ClusterClientEvents {
    debug: [message: string];
    managerReady: [];
    message: [message: ProcessMessage<"normal", Serializable, object>];
    ready: [clusterClient: ClusterClient<RefShardingClient, RefClusterManager>];
}

Properties

interface ClusterClientEvents {
    debug: [message: string];
    managerReady: [];
    message: [message: ProcessMessage<"normal", Serializable, object>];
    ready: [clusterClient: ClusterClient<RefShardingClient, RefClusterManager>];
}

Properties

debug: [message: string]

Emits when debug message is sent.

-
managerReady: []

Emits when all clusters are ready.

-
message: [message: ProcessMessage<"normal", Serializable, object>]

Emits when message is sent from IPC.

-

Emits when cluster is ready.

-
\ No newline at end of file +
managerReady: []

Emits when all clusters are ready.

+
message: [message: ProcessMessage<"normal", Serializable, object>]

Emits when message is sent from IPC.

+

Emits when cluster is ready.

+
\ No newline at end of file diff --git a/docs/interfaces/ClusterEvents.html b/docs/interfaces/ClusterEvents.html index d2acfe0..1773c8d 100644 --- a/docs/interfaces/ClusterEvents.html +++ b/docs/interfaces/ClusterEvents.html @@ -1,15 +1,15 @@ ClusterEvents | status-sharding

Interface ClusterEvents

Events that cluster emits.

Export

ClusterEvents

-
interface ClusterEvents {
    death: [cluster: Cluster<RefClusterManager, RefShardingClient>, thread: null | Worker | ChildProcess];
    debug: [message: string];
    error: [error: Error];
    message: [message: ProcessMessage<"normal", Serializable, object>];
    ready: [cluster: Cluster<RefClusterManager, RefShardingClient>];
    spawn: [thread: null | Worker | ChildProcess];
}

Properties

interface ClusterEvents {
    death: [cluster: Cluster<RefClusterManager, RefShardingClient>, thread: null | Worker | ChildProcess];
    debug: [message: string];
    error: [error: Error];
    message: [message: ProcessMessage<"normal", Serializable, object>];
    ready: [cluster: Cluster<RefClusterManager, RefShardingClient>];
    spawn: [thread: null | Worker | ChildProcess];
}

Properties

death: [cluster: Cluster<RefClusterManager, RefShardingClient>, thread: null | Worker | ChildProcess]

Emits when cluster dies.

-
debug: [message: string]

Emits when debug message is sent.

-
error: [error: Error]

Emits when there is an error.

-
message: [message: ProcessMessage<"normal", Serializable, object>]

Emits when any message is sent from IPC.

-

Emits when cluster is ready.

-
spawn: [thread: null | Worker | ChildProcess]

Emits when cluster is spawned.

-
\ No newline at end of file +
debug: [message: string]

Emits when debug message is sent.

+
error: [error: Error]

Emits when there is an error.

+
message: [message: ProcessMessage<"normal", Serializable, object>]

Emits when any message is sent from IPC.

+

Emits when cluster is ready.

+
spawn: [thread: null | Worker | ChildProcess]

Emits when cluster is spawned.

+
\ No newline at end of file diff --git a/docs/interfaces/ClusterHeartbeatOptions.html b/docs/interfaces/ClusterHeartbeatOptions.html index 6534754..2cb34be 100644 --- a/docs/interfaces/ClusterHeartbeatOptions.html +++ b/docs/interfaces/ClusterHeartbeatOptions.html @@ -1,13 +1,13 @@ ClusterHeartbeatOptions | status-sharding

Interface ClusterHeartbeatOptions

Data for the heartbeat system.

Export

ClusterHeartbeatOptions

-
interface ClusterHeartbeatOptions {
    enabled: boolean;
    interval?: number;
    maxMissedHeartbeats?: number;
    maxRestarts?: number;
    timeout?: number;
}

Properties

interface ClusterHeartbeatOptions {
    enabled: boolean;
    interval?: number;
    maxMissedHeartbeats?: number;
    maxRestarts?: number;
    timeout?: number;
}

Properties

enabled: boolean

Whether the heartbeat system is enabled.

-
interval?: number

Interval in milliseconds between each heartbeat.

-
maxMissedHeartbeats?: number

Maximum amount of missed heartbeats a cluster can have in the interval.

-
maxRestarts?: number

Maximum amount of restarts a cluster can have in the interval.

-
timeout?: number

Timeout in milliseconds after which a cluster will be considered as unresponsive.

-
\ No newline at end of file +
interval?: number

Interval in milliseconds between each heartbeat.

+
maxMissedHeartbeats?: number

Maximum amount of missed heartbeats a cluster can have in the interval.

+
maxRestarts?: number

Maximum amount of restarts a cluster can have in the interval.

+
timeout?: number

Timeout in milliseconds after which a cluster will be considered as unresponsive.

+
\ No newline at end of file diff --git a/docs/interfaces/ClusterKillOptions.html b/docs/interfaces/ClusterKillOptions.html index c295e3f..e0b9e9c 100644 --- a/docs/interfaces/ClusterKillOptions.html +++ b/docs/interfaces/ClusterKillOptions.html @@ -1,5 +1,5 @@ ClusterKillOptions | status-sharding

Interface ClusterKillOptions

Kill options for the cluster.

Export

ClusterKillOptions

-
interface ClusterKillOptions {
    reason: string;
}

Properties

interface ClusterKillOptions {
    reason: string;
}

Properties

Properties

reason: string

The reason for killing the cluster.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/interfaces/ClusterManagerCreateOptions.html b/docs/interfaces/ClusterManagerCreateOptions.html index c3a98e7..91dddb1 100644 --- a/docs/interfaces/ClusterManagerCreateOptions.html +++ b/docs/interfaces/ClusterManagerCreateOptions.html @@ -1,7 +1,7 @@ ClusterManagerCreateOptions | status-sharding

Interface ClusterManagerCreateOptions<T>

Options for the cluster manager.

Export

ClusterManagerCreateOptions

interface ClusterManagerCreateOptions<T> {
    clusterData?: object;
    clusterOptions?: T extends "worker"
        ? WorkerThreadOptions
        : ChildProcessOptions;
    execArgv?: string[];
    heartbeat?: ClusterHeartbeatOptions;
    mode?: T;
    queueOptions?: QueueOptions;
    respawn?: boolean;
    shardArgs?: string[];
    shardsPerClusters?: number;
    spawnOptions?: ClusterSpawnOptions;
    token?: string;
    totalClusters?: number;
    totalShards?: number;
}

Type Parameters

Hierarchy (view full)

Properties

Hierarchy (view full)

Properties

clusterData?: object

Data, which is passed to the Cluster.

-
clusterOptions?: T extends "worker"
    ? WorkerThreadOptions
    : ChildProcessOptions

Options, which is passed when forking a child or creating a thread.

-
execArgv?: string[]

Arguments to pass to the clustered script executable when spawning.

-

Heartbeat options.

-
mode?: T

What mode to use for clustering.

-
queueOptions?: QueueOptions

Control the Spawn Queue.

-
respawn?: boolean

Whether clusters should automatically respawn upon exiting.

-
shardArgs?: string[]

Arguments to pass to the clustered script when spawning (only available when using the process mode).

-
shardsPerClusters?: number

Number of shards per cluster.

-
spawnOptions?: ClusterSpawnOptions

Options to pass to the spawn, respawn method.

-
token?: string

The token of the discord bot.

-
totalClusters?: number

Number of total Clusters/Process to spawn.

-
totalShards?: number

Number of total internal shards or -1.

-
\ No newline at end of file +
clusterOptions?: T extends "worker"
    ? WorkerThreadOptions
    : ChildProcessOptions

Options, which is passed when forking a child or creating a thread.

+
execArgv?: string[]

Arguments to pass to the clustered script executable when spawning.

+

Heartbeat options.

+
mode?: T

What mode to use for clustering.

+
queueOptions?: QueueOptions

Control the Spawn Queue.

+
respawn?: boolean

Whether clusters should automatically respawn upon exiting.

+
shardArgs?: string[]

Arguments to pass to the clustered script when spawning (only available when using the process mode).

+
shardsPerClusters?: number

Number of shards per cluster.

+
spawnOptions?: ClusterSpawnOptions

Options to pass to the spawn, respawn method.

+
token?: string

The token of the discord bot.

+
totalClusters?: number

Number of total Clusters/Process to spawn.

+
totalShards?: number

Number of total internal shards or -1.

+
\ No newline at end of file diff --git a/docs/interfaces/ClusterManagerEvents.html b/docs/interfaces/ClusterManagerEvents.html index eb63157..633fb47 100644 --- a/docs/interfaces/ClusterManagerEvents.html +++ b/docs/interfaces/ClusterManagerEvents.html @@ -1,15 +1,15 @@ ClusterManagerEvents | status-sharding

Interface ClusterManagerEvents

Events that manager emits.

Export

ClusterManagerEvents

-
interface ClusterManagerEvents {
    clientRequest: [message: ProcessMessage<"normal", Serializable, object>];
    clusterCreate: [cluster: Cluster<RefClusterManager, RefShardingClient>];
    clusterReady: [cluster: Cluster<RefClusterManager, RefShardingClient>];
    debug: [debugMessage: string];
    message: [message: ProcessMessage<"normal", Serializable, object>];
    ready: [manager: ClusterManager<RefShardingClient, RefCluster>];
}

Properties

interface ClusterManagerEvents {
    clientRequest: [message: ProcessMessage<"normal", Serializable, object>];
    clusterCreate: [cluster: Cluster<RefClusterManager, RefShardingClient>];
    clusterReady: [cluster: Cluster<RefClusterManager, RefShardingClient>];
    debug: [debugMessage: string];
    message: [message: ProcessMessage<"normal", Serializable, object>];
    ready: [manager: ClusterManager<RefShardingClient, RefCluster>];
}

Properties

clientRequest: [message: ProcessMessage<"normal", Serializable, object>]

Emits when client sends a request via IPC.

-
clusterCreate: [cluster: Cluster<RefClusterManager, RefShardingClient>]

Emits when cluster is created.

-
clusterReady: [cluster: Cluster<RefClusterManager, RefShardingClient>]

Emits when cluster is ready.

-
debug: [debugMessage: string]

Debug events.

-
message: [message: ProcessMessage<"normal", Serializable, object>]

Emits when any message is sent from IPC.

-

When all manager's clsuters are ready.

-
\ No newline at end of file +
clusterCreate: [cluster: Cluster<RefClusterManager, RefShardingClient>]

Emits when cluster is created.

+
clusterReady: [cluster: Cluster<RefClusterManager, RefShardingClient>]

Emits when cluster is ready.

+
debug: [debugMessage: string]

Debug events.

+
message: [message: ProcessMessage<"normal", Serializable, object>]

Emits when any message is sent from IPC.

+

When all manager's clsuters are ready.

+
\ No newline at end of file diff --git a/docs/interfaces/ClusterManagerOptions.html b/docs/interfaces/ClusterManagerOptions.html index eb9fd7a..b0ae52d 100644 --- a/docs/interfaces/ClusterManagerOptions.html +++ b/docs/interfaces/ClusterManagerOptions.html @@ -1,7 +1,7 @@ ClusterManagerOptions | status-sharding

Interface ClusterManagerOptions<T>

Options for the cluster manager.

Export

ClusterManagerOptions

interface ClusterManagerOptions<T> {
    clusterData?: object;
    clusterList: number[];
    clusterOptions?: T extends "worker"
        ? WorkerThreadOptions
        : ChildProcessOptions;
    execArgv?: string[];
    heartbeat: Required<ClusterHeartbeatOptions>;
    mode: T;
    queueOptions?: QueueOptions;
    respawn?: boolean;
    shardArgs?: string[];
    shardList: number[];
    shardsPerClusters: number;
    spawnOptions: Required<ClusterSpawnOptions>;
    token?: string;
    totalClusters: number;
    totalShards: number;
}

Type Parameters

Hierarchy (view full)

Properties

Hierarchy (view full)

Properties

clusterData?: object

Data, which is passed to the Cluster.

-
clusterList: number[]

An Array of Ids to assign to the spawned Clusters, when the default id scheme is not wanted.

-
clusterOptions?: T extends "worker"
    ? WorkerThreadOptions
    : ChildProcessOptions

Options, which is passed when forking a child or creating a thread.

-
execArgv?: string[]

Arguments to pass to the clustered script executable when spawning.

-
heartbeat: Required<ClusterHeartbeatOptions>

Heartbeat options.

-
mode: T

Which mode to use for clustering.

-
queueOptions?: QueueOptions

Control the Spawn Queue.

-
respawn?: boolean

Whether clusters should automatically respawn upon exiting.

-
shardArgs?: string[]

Arguments to pass to the clustered script when spawning (only available when using the process mode).

-
shardList: number[]

An Array of Internal Shards Ids, which should get spawned.

-
shardsPerClusters: number

Number of shards per cluster.

-
spawnOptions: Required<ClusterSpawnOptions>

Options to pass to the spawn, respawn method.

-
token?: string

The token of the discord bot.

-
totalClusters: number

Number of total Clusters/Process to spawn.

-
totalShards: number

Number of total internal shards or -1.

-
\ No newline at end of file +
clusterList: number[]

An Array of Ids to assign to the spawned Clusters, when the default id scheme is not wanted.

+
clusterOptions?: T extends "worker"
    ? WorkerThreadOptions
    : ChildProcessOptions

Options, which is passed when forking a child or creating a thread.

+
execArgv?: string[]

Arguments to pass to the clustered script executable when spawning.

+
heartbeat: Required<ClusterHeartbeatOptions>

Heartbeat options.

+
mode: T

Which mode to use for clustering.

+
queueOptions?: QueueOptions

Control the Spawn Queue.

+
respawn?: boolean

Whether clusters should automatically respawn upon exiting.

+
shardArgs?: string[]

Arguments to pass to the clustered script when spawning (only available when using the process mode).

+
shardList: number[]

An Array of Internal Shards Ids, which should get spawned.

+
shardsPerClusters: number

Number of shards per cluster.

+
spawnOptions: Required<ClusterSpawnOptions>

Options to pass to the spawn, respawn method.

+
token?: string

The token of the discord bot.

+
totalClusters: number

Number of total Clusters/Process to spawn.

+
totalShards: number

Number of total internal shards or -1.

+
\ No newline at end of file diff --git a/docs/interfaces/ClusterSpawnOptions.html b/docs/interfaces/ClusterSpawnOptions.html index 549b71d..69315bf 100644 --- a/docs/interfaces/ClusterSpawnOptions.html +++ b/docs/interfaces/ClusterSpawnOptions.html @@ -1,7 +1,7 @@ ClusterSpawnOptions | status-sharding

Interface ClusterSpawnOptions

Spawn options for the cluster.

Export

ClusterSpawnOptions

-
interface ClusterSpawnOptions {
    delay?: number;
    timeout?: number;
}

Properties

interface ClusterSpawnOptions {
    delay?: number;
    timeout?: number;
}

Properties

Properties

delay?: number

How long to wait between spawning each cluster.

-
timeout?: number

How long to wait for a cluster to become ready before killing it and retrying.

-
\ No newline at end of file +
timeout?: number

How long to wait for a cluster to become ready before killing it and retrying.

+
\ No newline at end of file diff --git a/docs/interfaces/EvalOptions.html b/docs/interfaces/EvalOptions.html index d7ae3c2..7dc33ac 100644 --- a/docs/interfaces/EvalOptions.html +++ b/docs/interfaces/EvalOptions.html @@ -1,16 +1,16 @@ EvalOptions | status-sharding

Interface EvalOptions<T>

Eval options for the cluster.

Export

EvalOptions

interface EvalOptions<T> {
    cluster?: number | number[];
    context?: T;
    guildId?: string;
    shard?: number | number[];
    timeout?: number;
    useAllSettled?: boolean;
}

Type Parameters

  • T extends object = object

    The type of the context.

    -

Properties

Properties

cluster?: number | number[]

Only run the script in a single cluster or set of clusters.

-
context?: T

Context to use for the script.

-
guildId?: string

On what guild to run the script.

-
shard?: number | number[]

On what shard to run the script.

-
timeout?: number

Timeout before the script is cancelled.

-
useAllSettled?: boolean

Whether to continue running the script even if one of the clusters returns an error.

-
\ No newline at end of file +
context?: T

Context to use for the script.

+
guildId?: string

On what guild to run the script.

+
shard?: number | number[]

On what shard to run the script.

+
timeout?: number

Timeout before the script is cancelled.

+
useAllSettled?: boolean

Whether to continue running the script even if one of the clusters returns an error.

+
\ No newline at end of file diff --git a/docs/interfaces/QueueItem.html b/docs/interfaces/QueueItem.html index 7af0f37..8b321da 100644 --- a/docs/interfaces/QueueItem.html +++ b/docs/interfaces/QueueItem.html @@ -1,13 +1,13 @@ QueueItem | status-sharding

Interface QueueItem<A>

Item of the queue.

Export

QueueItem

-
interface QueueItem<A> {
    args: A;
    time?: number;
    timeout: number;
    run(...args): Promise<unknown>;
}

Type Parameters

  • A = unknown[]

Properties

interface QueueItem<A> {
    args: A;
    time?: number;
    timeout: number;
    run(...args): Promise<unknown>;
}

Type Parameters

  • A = unknown[]

Properties

Methods

Properties

args: A

Arguments to pass to the item.

-
time?: number

Time when the item was added to the queue.

-
timeout: number

Time to wait until next item.

-

Methods

time?: number

Time when the item was added to the queue.

+
timeout: number

Time to wait until next item.

+

Methods

  • Runs the item.

    Parameters

    • Rest ...args: unknown[]

      The arguments to pass to the item.

    Returns Promise<unknown>

    The result of the item.

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/interfaces/QueueOptions.html b/docs/interfaces/QueueOptions.html index 5efb0ea..ec4fae1 100644 --- a/docs/interfaces/QueueOptions.html +++ b/docs/interfaces/QueueOptions.html @@ -1,7 +1,7 @@ QueueOptions | status-sharding

Interface QueueOptions

Options for the queue.

Export

QueueOptions

-
interface QueueOptions {
    mode?: "auto" | "manual";
    timeout?: number;
}

Properties

interface QueueOptions {
    mode?: "auto" | "manual";
    timeout?: number;
}

Properties

Properties

mode?: "auto" | "manual"

Whether the spawn queue be automatically managed.

-
timeout?: number

Time to wait until next item.

-
\ No newline at end of file +
timeout?: number

Time to wait until next item.

+
\ No newline at end of file diff --git a/docs/interfaces/ReClusterOptions.html b/docs/interfaces/ReClusterOptions.html index 8df7d43..bf3e158 100644 --- a/docs/interfaces/ReClusterOptions.html +++ b/docs/interfaces/ReClusterOptions.html @@ -1,11 +1,11 @@ ReClusterOptions | status-sharding

Interface ReClusterOptions

Options for reclustering.

Export

ReClusterOptions

-
interface ReClusterOptions {
    restartMode?: ReClusterRestartMode;
    shardsPerClusters?: number;
    totalClusters?: number;
    totalShards?: number;
}

Properties

interface ReClusterOptions {
    restartMode?: ReClusterRestartMode;
    shardsPerClusters?: number;
    totalClusters?: number;
    totalShards?: number;
}

Properties

restartMode?: ReClusterRestartMode

The restartMode of the clusterManager, gracefulSwitch = waits until all new clusters have spawned with maintenance mode, rolling = Once the Cluster is Ready, the old cluster will be killed.

-
shardsPerClusters?: number

The amount of shards per cluster.

-
totalClusters?: number

The amount of totalClusters to spread the shards over all clusters.

-
totalShards?: number

The new totalShards of the bot.

-
\ No newline at end of file +
shardsPerClusters?: number

The amount of shards per cluster.

+
totalClusters?: number

The amount of totalClusters to spread the shards over all clusters.

+
totalShards?: number

The new totalShards of the bot.

+
\ No newline at end of file diff --git a/docs/interfaces/StoredPromise.html b/docs/interfaces/StoredPromise.html index c1fa8fc..ac5c442 100644 --- a/docs/interfaces/StoredPromise.html +++ b/docs/interfaces/StoredPromise.html @@ -1,11 +1,11 @@ StoredPromise | status-sharding

Interface StoredPromise

Options for storing promises.

Export

StoredPromise

-
interface StoredPromise {
    timeout?: Timeout;
    reject(error): void;
    resolve(value): void;
}

Properties

interface StoredPromise {
    timeout?: Timeout;
    reject(error): void;
    resolve(value): void;
}

Properties

Methods

Properties

timeout?: Timeout

Timeout before promise is canceled.

-

Methods

Methods

  • Return an error if failed.

    Parameters

    • error: Error

      Error to return.

      -

    Returns void

  • Resolves the promise.

    +

Returns void

  • Resolves the promise.

    Parameters

    • value: unknown

      Data that resolves the promise.

      -

    Returns void

\ No newline at end of file +

Returns void

\ No newline at end of file diff --git a/docs/interfaces/WorkerThreadOptions.html b/docs/interfaces/WorkerThreadOptions.html index 73365d9..a3bf4fd 100644 --- a/docs/interfaces/WorkerThreadOptions.html +++ b/docs/interfaces/WorkerThreadOptions.html @@ -1,6 +1,6 @@ WorkerThreadOptions | status-sharding

Interface WorkerThreadOptions

Options for the worker.

Export

WorkerThreadOptions

-
interface WorkerThreadOptions {
    argv?: any[];
    clusterData?: ProcessEnv;
    env?: Dict<string> | typeof SHARE_ENV;
    eval?: boolean;
    execArgv?: string[];
    name?: string;
    resourceLimits?: ResourceLimits;
    stderr?: boolean;
    stdin?: boolean;
    stdout?: boolean;
    trackUnmanagedFds?: boolean;
    transferList?: TransferListItem[];
    workerData?: any;
}

Hierarchy

  • WorkerOptions
    • WorkerThreadOptions

Properties

interface WorkerThreadOptions {
    argv?: any[];
    clusterData?: ProcessEnv;
    env?: Dict<string> | typeof SHARE_ENV;
    eval?: boolean;
    execArgv?: string[];
    name?: string;
    resourceLimits?: ResourceLimits;
    stderr?: boolean;
    stdin?: boolean;
    stdout?: boolean;
    trackUnmanagedFds?: boolean;
    transferList?: TransferListItem[];
    workerData?: any;
}

Hierarchy

  • WorkerOptions
    • WorkerThreadOptions

Properties

argv? clusterData? env? eval? @@ -18,7 +18,7 @@ but the values will be available on the global process.argv as if they were passed as CLI options to the script.

clusterData?: ProcessEnv

Data to send to the cluster.

-
env?: Dict<string> | typeof SHARE_ENV
eval?: boolean
execArgv?: string[]
name?: string

An optional name to be appended to the worker title +

env?: Dict<string> | typeof SHARE_ENV
eval?: boolean
execArgv?: string[]
name?: string

An optional name to be appended to the worker title for debuggin/identification purposes, making the final title as [worker ${id}] ${name}.

resourceLimits?: ResourceLimits
stderr?: boolean
stdin?: boolean
stdout?: boolean
trackUnmanagedFds?: boolean

Default

true
diff --git a/docs/types/Awaitable.html b/docs/types/Awaitable.html
index a415e68..af228d3 100644
--- a/docs/types/Awaitable.html
+++ b/docs/types/Awaitable.html
@@ -1,3 +1,3 @@
 Awaitable | status-sharding

Type alias Awaitable<T>

Awaitable<T>: T | PromiseLike<T>

Awaitable type.

Type Parameters

  • T

    The type to await.

    -

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/BaseMessage.html b/docs/types/BaseMessage.html index 7c3a87b..3dddcd5 100644 --- a/docs/types/BaseMessage.html +++ b/docs/types/BaseMessage.html @@ -2,4 +2,4 @@

Type Parameters

  • D extends DataType

    The type of the message.

  • A = Serializable

    The type of the message data.

  • P extends object = object

    The type of the message options.

    -

Type declaration

Export

\ No newline at end of file +

Type declaration

Export

\ No newline at end of file diff --git a/docs/types/BaseMessageInput.html b/docs/types/BaseMessageInput.html index c75dd7f..9c2b387 100644 --- a/docs/types/BaseMessageInput.html +++ b/docs/types/BaseMessageInput.html @@ -1,4 +1,4 @@ BaseMessageInput | status-sharding

Type alias BaseMessageInput<D, A>

BaseMessageInput<D, A>: Omit<BaseMessage<D, A>, "_nonce">

Serializable input.

Type Parameters

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/ClusteringMode.html b/docs/types/ClusteringMode.html index 8a15171..df29772 100644 --- a/docs/types/ClusteringMode.html +++ b/docs/types/ClusteringMode.html @@ -1,2 +1,2 @@ ClusteringMode | status-sharding

Type alias ClusteringMode

ClusteringMode: "worker" | "process"

Mode for clustering.

-

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/DataType.html b/docs/types/DataType.html index 961db97..1c38e5d 100644 --- a/docs/types/DataType.html +++ b/docs/types/DataType.html @@ -1,2 +1,2 @@ DataType | status-sharding

Type alias DataType

DataType: "normal" | "eval" | "respawn" | "maintenance" | "evalResult" | "readyOrSpawn" | "heartbeat" | "error" | "reply"

The type of the maintenance message.

-

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/DataTypes.html b/docs/types/DataTypes.html index e28d6cc..499d748 100644 --- a/docs/types/DataTypes.html +++ b/docs/types/DataTypes.html @@ -1,4 +1,4 @@ DataTypes | status-sharding

Type alias DataTypes<A, P>

DataTypes<A, P>: {
    error: {
        message: string;
        name: string;
        script: string;
        stack?: string;
    };
    eval: EvalMessage<P>;
    evalResult: EvalResultMessage;
    heartbeat: undefined;
    maintenance: MaintenanceMessage;
    normal: A extends never
        ? Serializable
        : A;
    readyOrSpawn: undefined;
    reply: DataTypes<A, P>["normal"];
    respawn: RespawnMessage;
}

The type of the message.

Type Parameters

  • A = object

    The type of the message data.

  • P extends object = object

    The type of the message options.

    -

Type declaration

Export

\ No newline at end of file +

Type declaration

Export

\ No newline at end of file diff --git a/docs/types/DeconstructedFunction.html b/docs/types/DeconstructedFunction.html index c17e2fb..ea727e7 100644 --- a/docs/types/DeconstructedFunction.html +++ b/docs/types/DeconstructedFunction.html @@ -1,2 +1,2 @@ DeconstructedFunction | status-sharding

Type alias DeconstructedFunction

DeconstructedFunction: {
    args: (string | string[])[];
    body: string;
    isAsync: boolean;
    wrapArgs: boolean;
    wrapScope: boolean;
}

Output of guild function parser.

-

Type declaration

  • args: (string | string[])[]
  • body: string
  • isAsync: boolean
  • wrapArgs: boolean
  • wrapScope: boolean

Export

\ No newline at end of file +

Type declaration

  • args: (string | string[])[]
  • body: string
  • isAsync: boolean
  • wrapArgs: boolean
  • wrapScope: boolean

Export

\ No newline at end of file diff --git a/docs/types/DeepNonNullable.html b/docs/types/DeepNonNullable.html index 4d522c7..06071e2 100644 --- a/docs/types/DeepNonNullable.html +++ b/docs/types/DeepNonNullable.html @@ -1,3 +1,3 @@ DeepNonNullable | status-sharding

Type alias DeepNonNullable<T>

DeepNonNullable<T>: T extends NonNullable<T>
    ? T
    : DeepNonNullable<NonNullable<T>>

Type that removes null and undefined from a type.

Type Parameters

  • T

    The type to remove null and undefined from.

    -

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/EvalMessage.html b/docs/types/EvalMessage.html index 7332c3d..864a2a2 100644 --- a/docs/types/EvalMessage.html +++ b/docs/types/EvalMessage.html @@ -1,3 +1,3 @@ EvalMessage | status-sharding

Type alias EvalMessage<P>

EvalMessage<P>: {
    options?: EvalOptions<P>;
    script: string;
}

Eval message type.

Type Parameters

  • P extends object = object

    The type of the message options.

    -

Type declaration

Export

\ No newline at end of file +

Type declaration

Export

\ No newline at end of file diff --git a/docs/types/EvalResultMessage.html b/docs/types/EvalResultMessage.html index 338f4b6..dd81013 100644 --- a/docs/types/EvalResultMessage.html +++ b/docs/types/EvalResultMessage.html @@ -1,2 +1,2 @@ EvalResultMessage | status-sharding

Type alias EvalResultMessage

EvalResultMessage: unknown

Result of an eval message.

-

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/HeartbeatData.html b/docs/types/HeartbeatData.html index 566aff9..f634534 100644 --- a/docs/types/HeartbeatData.html +++ b/docs/types/HeartbeatData.html @@ -1,2 +1,2 @@ HeartbeatData | status-sharding

Type alias HeartbeatData

HeartbeatData: {
    killing: boolean;
    missedBeats: number;
    restarts: number;
}

Data for restart sysytem.

-

Type declaration

  • killing: boolean
  • missedBeats: number
  • restarts: number

Export

\ No newline at end of file +

Type declaration

  • killing: boolean
  • missedBeats: number
  • restarts: number

Export

\ No newline at end of file diff --git a/docs/types/MaintenanceMessage.html b/docs/types/MaintenanceMessage.html index 131637e..5d2094f 100644 --- a/docs/types/MaintenanceMessage.html +++ b/docs/types/MaintenanceMessage.html @@ -1,2 +1,2 @@ MaintenanceMessage | status-sharding

Type alias MaintenanceMessage

MaintenanceMessage: string

The type of the maintenace message.

-

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/ReClusterRestartMode.html b/docs/types/ReClusterRestartMode.html index 475ab71..74b7eed 100644 --- a/docs/types/ReClusterRestartMode.html +++ b/docs/types/ReClusterRestartMode.html @@ -1,2 +1,2 @@ ReClusterRestartMode | status-sharding

Type alias ReClusterRestartMode

ReClusterRestartMode: "gracefulSwitch" | "rolling"

Mode for reclustering.

-

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/RecursiveStringArray.html b/docs/types/RecursiveStringArray.html index e035488..1009f50 100644 --- a/docs/types/RecursiveStringArray.html +++ b/docs/types/RecursiveStringArray.html @@ -1,2 +1,2 @@ RecursiveStringArray | status-sharding

Type alias RecursiveStringArray

RecursiveStringArray: (RecursiveStringArray | string)[]

Recursive array of strings.

-

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/RefCluster.html b/docs/types/RefCluster.html index 4594792..cca1a2a 100644 --- a/docs/types/RefCluster.html +++ b/docs/types/RefCluster.html @@ -1 +1 @@ -RefCluster | status-sharding

Type alias RefCluster

RefCluster: Cluster
\ No newline at end of file +RefCluster | status-sharding

Type alias RefCluster

RefCluster: Cluster
\ No newline at end of file diff --git a/docs/types/RefClusterClient.html b/docs/types/RefClusterClient.html index 720906c..f025873 100644 --- a/docs/types/RefClusterClient.html +++ b/docs/types/RefClusterClient.html @@ -1 +1 @@ -RefClusterClient | status-sharding

Type alias RefClusterClient

RefClusterClient: ClusterClient
\ No newline at end of file +RefClusterClient | status-sharding

Type alias RefClusterClient

RefClusterClient: ClusterClient
\ No newline at end of file diff --git a/docs/types/RefClusterManager.html b/docs/types/RefClusterManager.html index 202e87a..2f2a984 100644 --- a/docs/types/RefClusterManager.html +++ b/docs/types/RefClusterManager.html @@ -1 +1 @@ -RefClusterManager | status-sharding

Type alias RefClusterManager

RefClusterManager: ClusterManager
\ No newline at end of file +RefClusterManager | status-sharding

Type alias RefClusterManager

RefClusterManager: ClusterManager
\ No newline at end of file diff --git a/docs/types/RefShardingClient.html b/docs/types/RefShardingClient.html index c4f6aa2..bbb966c 100644 --- a/docs/types/RefShardingClient.html +++ b/docs/types/RefShardingClient.html @@ -1 +1 @@ -RefShardingClient | status-sharding

Type alias RefShardingClient

RefShardingClient: ShardingClient
\ No newline at end of file +RefShardingClient | status-sharding
\ No newline at end of file diff --git a/docs/types/RespawnMessage.html b/docs/types/RespawnMessage.html index 7a9e93a..204aad7 100644 --- a/docs/types/RespawnMessage.html +++ b/docs/types/RespawnMessage.html @@ -1,2 +1,2 @@ RespawnMessage | status-sharding

Type alias RespawnMessage

RespawnMessage: {
    clusterDelay?: number;
    respawnDelay?: number;
    timeout?: number;
}

Respawn message type.

-

Type declaration

  • Optional clusterDelay?: number
  • Optional respawnDelay?: number
  • Optional timeout?: number

Export

\ No newline at end of file +

Type declaration

  • Optional clusterDelay?: number
  • Optional respawnDelay?: number
  • Optional timeout?: number

Export

\ No newline at end of file diff --git a/docs/types/Serializable.html b/docs/types/Serializable.html index 9a744fa..7effc1c 100644 --- a/docs/types/Serializable.html +++ b/docs/types/Serializable.html @@ -1,2 +1,2 @@ Serializable | status-sharding

Type alias Serializable

Serializable: string | number | boolean | null | undefined | Serializable[] | {
    [key: string]: Serializable;
} | object | ChildSerializable

Any object or data.

-

Type declaration

Export

\ No newline at end of file +

Type declaration

Export

\ No newline at end of file diff --git a/docs/types/SerializableInput.html b/docs/types/SerializableInput.html index 3b8cea3..a379931 100644 --- a/docs/types/SerializableInput.html +++ b/docs/types/SerializableInput.html @@ -1,4 +1,4 @@ SerializableInput | status-sharding

Type alias SerializableInput<T, U>

SerializableInput<T, U>: T extends Serializable
    ? T
    : T extends unknown
        ? U
        : never

Check if input is serializable.

Type Parameters

  • T

    The type to check.

  • U = false

    Whether to allow unknown types.

    -

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/Serialized.html b/docs/types/Serialized.html index b7b7e36..d8c2f6d 100644 --- a/docs/types/Serialized.html +++ b/docs/types/Serialized.html @@ -1,3 +1,3 @@ Serialized | status-sharding

Type alias Serialized<T>

Serialized<T>: T extends symbol | bigint | UnknownFunction
    ? never
    : T extends ValidIfSerializable<T>
        ? T
        : T extends {
                toJSON(): R;
            }
            ? R
            : T extends ReadonlyArray<infer V>
                ? Serialized<V>[]
                : T extends ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>
                    ? object
                    : T extends object
                        ? {
                            [K in keyof (...)]: Serialized<(...)>
                        }
                        : T

Already serialized data.

Type Parameters

  • T

    The type to serialize.

    -

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/types/UnknownFunction.html b/docs/types/UnknownFunction.html index b762254..3e714c4 100644 --- a/docs/types/UnknownFunction.html +++ b/docs/types/UnknownFunction.html @@ -1,2 +1,2 @@ UnknownFunction | status-sharding

Type alias UnknownFunction

UnknownFunction: ((...args) => unknown)

Any function.

-

Type declaration

    • (...args): unknown
    • Parameters

      • Rest ...args: unknown[]

      Returns unknown

Export

\ No newline at end of file +

Type declaration

    • (...args): unknown
    • Parameters

      • Rest ...args: unknown[]

      Returns unknown

Export

\ No newline at end of file diff --git a/docs/types/ValidIfSerializable.html b/docs/types/ValidIfSerializable.html index d58ff02..955ad44 100644 --- a/docs/types/ValidIfSerializable.html +++ b/docs/types/ValidIfSerializable.html @@ -1,3 +1,3 @@ ValidIfSerializable | status-sharding

Type alias ValidIfSerializable<T>

ValidIfSerializable<T>: T extends NonNullable<Serializable>
    ? T | undefined
    : never

Check for function's outputs.

Type Parameters

  • T

    The type to check.

    -

Export

\ No newline at end of file +

Export

\ No newline at end of file diff --git a/docs/variables/DefaultOptions.html b/docs/variables/DefaultOptions.html index 2b85b71..9a756ab 100644 --- a/docs/variables/DefaultOptions.html +++ b/docs/variables/DefaultOptions.html @@ -1,2 +1,2 @@ DefaultOptions | status-sharding

Variable DefaultOptionsConst

DefaultOptions: {
    http: {
        api: string;
        version: string;
    };
} = ...

Default options for fetching the bot gateway.

-

Type declaration

  • http: {
        api: string;
        version: string;
    }
    • api: string
    • version: string
\ No newline at end of file +

Type declaration

  • http: {
        api: string;
        version: string;
    }
    • api: string
    • version: string
\ No newline at end of file diff --git a/docs/variables/Endpoints.html b/docs/variables/Endpoints.html index a3a0be8..fa91f00 100644 --- a/docs/variables/Endpoints.html +++ b/docs/variables/Endpoints.html @@ -1,2 +1,2 @@ Endpoints | status-sharding

Variable EndpointsConst

Endpoints: {
    botGateway: string;
} = ...

Endpoints for the discord api.

-

Type declaration

  • botGateway: string
\ No newline at end of file +

Type declaration

  • botGateway: string
\ No newline at end of file diff --git a/package.json b/package.json index b9cdf85..e9f32aa 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.8.1", + "version": "1.8.2", "name": "status-sharding", "author": "Digital39999", "scripts": {