@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 | The error thrown by the amqp adapter's channel |
KyooBullMQNativeWorkerRanError | The error thrown when the data from the broker cannot be coercced into an EnqueueableKyooJob |
KyooCleanupFailedError | The error thrown when the data from the broker cannot be coercced into an EnqueueableKyooJob |
KyooConnection | The main class for interacting with a Queue Broker. |
KyooInvalidBrokerPayloadError | The error thrown when the data from the broker cannot be coercced 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 which is thrown when attempting to call the enqueue method while the connection to the queue broker is not established. |
KyooNothingToEnqueueError | Represents an error which is thrown when attempting to call the enqueue method without a job |
KyooQueue | An instance of a queue created by Kyoo with the queue broker. A queue is created by calling the get method of KyooConnection.queues |
KyooSQLAdapterCannotAccessKnexInteralsToReconnectError | The error thrown when the SQL adapter cannot access the 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 the data from the broker cannot be coercced into an EnqueueableKyooJob |
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 | - |
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 and pgboss . |
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 |
---|---|
defineAdapterConfiguration | Validates, sanitizes, and returns the configuration object for the adapter. |
getSqlAdapterLockManager | - |
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. |