@nhtio/kyoo
A unified SDK for interacting with multiple types of queue brokers
Classes
| Class | Description |
|---|---|
| AMQPError | An error, can be both AMQP level errors or socket errors |
| KyooAMQPChannelError | Reserved; not currently thrown by the library. It represents an AMQP channel error. |
| KyooBullMQNativeWorkerRanError | Reserved; not currently thrown by the library. It indicates that BullMQ's native processor ran a job instead of Kyoo's processor. |
| KyooCleanupFailedError | Emitted as a process warning when connection cleanup leaves registered connections. |
| KyooConnection | The main class for interacting with a Queue Broker. |
| KyooInvalidBrokerPayloadError | The error thrown when broker data cannot be coerced into an EnqueueableKyooJob. |
| KyooInvalidConfigurationError | The error thrown when the Kyoo connection configuration passed is not valid |
| KyooInvalidFetchCountError | The error thrown when "count" argument for the KyooQueue.jobs.fetch method is invalid |
| KyooNoackError | The error thrown when Kyoo fails to automatically disposition a job as acknowledged |
| KyooNotConnectedError | Represents an error thrown when a broker operation requires a connection that is not established. |
| KyooNothingToEnqueueError | Represents an error which is thrown when attempting to call the enqueue method without a job |
| KyooQueue | Provides queue operations and worker creation through a configured broker adapter. |
| KyooSQLAdapterCannotAccessKnexInteralsToReconnectError | The error thrown when the SQL adapter cannot access Knex internals to reconnect. |
| KyooSQLAdapterLockAcquisitionError | The error thrown when the SQL adapter cannot acquire a lock in order to perform an operation on a specific queue |
| KyooSQLAdapterNeedsMigrationError | Thrown by the SQL adapter when the database schema needs to be migrated |
| KyooTerminatedWorkerError | The error thrown when an operation is attempted on a terminated worker. |
| KyooUnacceptableWorkerOptionsError | Represents an error which is thrown when attempting to create a worker with invalid options. |
| KyooUnenqueueableError | The error thrown when attempting to add a job with an invalid configuration |
| KyooWorker | The class responsible for receiving and processing jobs from a queue. A worker can be created by using KyooQueue.worker. |
| SQLAdapterLockManager | Manages Verrou-backed distributed locks for queue rows and queue lifecycle operations. |
| SQLAdapterMigrator | A class that wraps Knex's migration API for use with Kyoo's SQL adapter, providing a consistent interface for running and managing migrations. |
Interfaces
| Interface | Description |
|---|---|
| AMQPAdapterConfiguration | Describes the shape of the object used to configure the AMQP adapter. |
| AMQPClientOptionsObject | Describes the shape of an object used for connecting to an AMQP server. |
| BullMQAdapterConfiguration | Describes the overall shape of the configuration which should be passed to the BullMQ adapter. |
| BullMQRedisConnectionExtraOptions | Describes additional options which are used to configure the BullMQ adapter. |
| KyooConfiguration | KyooConfiguration is a generic type that represents the configuration for a specific queue adapter. It includes the adapter type and its corresponding configuration, as well as Kyoo-specific options. |
| KyooConfigurationOptions | Options for Kyoo behavior which is not related to an adapter. |
| KyooConnectionEvents | Describes the events and their callbacks for a KyooConnection instance |
| KyooJob | A job is a unit of work that can be processed by a worker. It contains a payload and optional metadata. |
| KyooJobAck | Shape of the job acknowledgment function. |
| KyooJobMessage | Describes the shape of the object that is passed to the job processor function. |
| KyooJobNack | Shape of the job negative acknowledgment function. |
| KyooJobProcessor | Describes the shape of a function which is used in the KyooWorker class to process jobs. |
| KyooJobToEnqueue | Describes the shape of a job which should be enqueued. |
| KyooQueueWorkerOptions | Represents the options for the creation of a queue worker |
| KyooWorkable | A workable job is a job that can be processed by a worker. It contains the job and methods for acknowledging or rejecting the job. |
| KyooWorkerControls | An object containing the controls for the worker. |
| KyooWorkerDispositioners | An object containing the dispositioners for the job. |
| KyooWorkerEvents | Describes the events and their callbacks for a KyooWorker instance |
| PGBossAdapterConfiguration | Configuration for the PGBoss adapter. |
| PoolConfig | Defines the settings for the database connection pool, controlling how many connections can be opened, reused, and managed concurrently. This type is a subset of the Knex PoolConfig type, excluding keys that are not relevant for the SQL Adapter. |
| PostgreSQLConnectionObject | A configuration object for connecting to a PostgreSQL database. |
| PostgreSQLDatabaseOptions | - |
| PostgreSQLExpirationOptions | - |
| PostgreSQLJobPollingOptions | - |
| PostgreSQLMaintenanceOptions | - |
| PostgreSQLQueueOptions | - |
| PostgreSQLRetentionOptions | - |
| PostgreSQLRetryOptions | - |
| PostgreSQLSchedulingOptions | - |
| SQLAdapterConfiguration | Configuration schema for the SQL Adapter. |
| SQLAdapterMigatorType | A type representing the public migration methods available on a Knex Migrator, but with all methods as zero-argument functions returning the same type as the original. This omits the 'make' method, which is internal to Knex. |
| SQSAdapterConfiguration | The configuration interface of SQSClient class constructor that set the region, credentials and other options. |
Type Aliases
| Type Alias | Description |
|---|---|
| AMQPUrl | A URL using either the "amqp" or "amqps" protocol. |
| ConnectionStatus | A string literal type representing the connection status of the adapter. It can be one of the following values: - "connected": The adapter is connected and ready to use. - "disconnected": The adapter is not connected. - "connecting": The adapter is in the process of connecting. |
| KnexSQLClient | The KnexSQLClient type represents the Knex Client type, which is used to interact with SQL databases in a type-safe manner. |
| KyooClient | KyooClient is a union type representing the supported queue adapters in the Kyoo library. The possible choices are amqp, bullmq, sqs, pgboss and sql. |
| KyooJobPriority | Defines the possible job priority values. The priority is a number between 1 and 255. The higher the number, the higher the priority. |
| KyooPrimitive | Defines the union of all serializable primitive types. |
| KyooSerializable | Defines all the types which can be be serialized |
| KyooTypedArray | Defines a union for all the serializable typed arrays. |
| SQLClient | The SQL Adapter is a Kyoo adapter that uses SQL databases to store and manage jobs. See KnexSQLClient for more details on the shape of an SQL client class provided in the runtime. |
Variables
| Variable | Description |
|---|---|
| canSerialize | Checks if a value is serializable |
| version | The current version of the Kyoo library. |
Functions
| Function | Description |
|---|---|
| compressPayload | Gzip a buffer and prepend the "gz:" prefix. Passthrough if disabled. |
| compressPayloadSync | Compresses bytes synchronously and prepends the gz: marker unless disabled. |
| decompressPayload | Strip "gz:" prefix and gunzip if present. Always auto-detects regardless of options. |
| decompressPayloadSync | Decompresses gzip-prefixed bytes synchronously, preserving plain bytes unchanged. |
| defineAdapterConfiguration | Validates an adapter configuration while preserving its inferred adapter type. |
| getSqlAdapterLockManager | Validates configuration and returns a configured SQL lock manager. |
| getSqlAdapterMigrator | Validates and constructs a SQLAdapterMigrator instance from a configuration object. Throws a KyooInvalidConfigurationError if the configuration is invalid. |
| isAKyooWorker | Checks if the given object is an instance of KyooWorker |
| isKyooQueue | Checks if the given object is an instance of KyooQueue |
| sanitizeKnexConfigForKyoo | Sanitizes a Knex configuration object for use with Kyoo. |
