Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## AppCommandHandler

<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="149" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/app/handlers/AppCommandHandler.ts" sourceLine="150" packageName="commandkit" />

Handles application commands for CommandKit, including loading, registration, and execution.
Manages both slash commands and message commands with middleware support.
Expand Down
89 changes: 89 additions & 0 deletions apps/website/docs/api-reference/commandkit/classes/async-queue.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: "AsyncQueue"
isDefaultIndex: false
generated: true
---

import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## AsyncQueue

<GenerationInfo sourceFile="packages/commandkit/src/utils/useful-stuff/async-queue.ts" sourceLine="17" packageName="commandkit" />



```ts title="Signature"
class AsyncQueue {
constructor(options: AsyncQueueOptions = {})
add(task: AsyncQueueTask<T>, signal?: AbortSignal) => Promise<T>;
pause() => ;
resume() => ;
abort() => ;
clear() => ;
getRunning() => number;
getPending() => number;
isPaused() => boolean;
isAborted() => boolean;
}
```

<div className="members-wrapper">

### constructor

<MemberInfo kind="method" type={`(options: <a href='/docs/next/api-reference/commandkit/interfaces/async-queue-options#asyncqueueoptions'>AsyncQueueOptions</a> = {}) => AsyncQueue`} />


### add

<MemberInfo kind="method" type={`(task: <a href='/docs/next/api-reference/commandkit/types/async-queue-task#asyncqueuetask'>AsyncQueueTask</a>&#60;T&#62;, signal?: AbortSignal) => Promise&#60;T&#62;`} />

Adds a task to the queue.
### pause

<MemberInfo kind="method" type={`() => `} />

Pauses the queue. No new tasks will be started until resumed.
### resume

<MemberInfo kind="method" type={`() => `} />

Resumes the queue and processes pending tasks.
### abort

<MemberInfo kind="method" type={`() => `} />

Aborts the queue, rejecting all pending tasks.
### clear

<MemberInfo kind="method" type={`() => `} />

Clears all pending tasks from the queue.
### getRunning

<MemberInfo kind="method" type={`() => number`} />

Returns the number of running tasks.
### getPending

<MemberInfo kind="method" type={`() => number`} />

Returns the number of pending tasks in the queue.
### isPaused

<MemberInfo kind="method" type={`() => boolean`} />

Returns true if the queue is currently paused.
### isAborted

<MemberInfo kind="method" type={`() => boolean`} />

Returns true if the queue has been aborted.


</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CompilerPluginRuntime

<GenerationInfo sourceFile="packages/commandkit/src/plugins/plugin-runtime/CompilerPluginRuntime.ts" sourceLine="42" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/plugins/plugin-runtime/CompilerPluginRuntime.ts" sourceLine="44" packageName="commandkit" />

CompilerPluginRuntime is a runtime for managing compiler plugins in CommandKit.

Expand Down Expand Up @@ -66,7 +66,7 @@ This method must be called inside the activate() method of a plugin.

<MemberInfo kind="method" type={`(name: string) => `} />

Unregisters a template handler for a given name.
Unregister a template handler for a given name.
This method must be called inside the deactivate() method of a plugin.
### getTemplate

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "MemoryMutexStorage"
isDefaultIndex: false
generated: true
---

import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## MemoryMutexStorage

<GenerationInfo sourceFile="packages/commandkit/src/utils/useful-stuff/mutex.ts" sourceLine="53" packageName="commandkit" />

In-memory storage implementation for mutex locks.
Suitable for single-instance applications.

```ts title="Signature"
class MemoryMutexStorage implements MutexStorage {
acquire(key: string, timeout: number = 30000, signal?: AbortSignal) => Promise<boolean>;
release(key: string) => Promise<void>;
isLocked(key: string) => Promise<boolean>;
}
```
* Implements: <code><a href='/docs/next/api-reference/commandkit/interfaces/mutex-storage#mutexstorage'>MutexStorage</a></code>



<div className="members-wrapper">

### acquire

<MemberInfo kind="method" type={`(key: string, timeout: number = 30000, signal?: AbortSignal) => Promise&#60;boolean&#62;`} />

Attempts to acquire a lock for a given key
### release

<MemberInfo kind="method" type={`(key: string) => Promise&#60;void&#62;`} />

Releases the lock for a given key
### isLocked

<MemberInfo kind="method" type={`(key: string) => Promise&#60;boolean&#62;`} />

Checks if a lock is currently held for a given key


</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "MemoryRateLimitStorage"
isDefaultIndex: false
generated: true
---

import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## MemoryRateLimitStorage

<GenerationInfo sourceFile="packages/commandkit/src/utils/useful-stuff/ratelimiter.ts" sourceLine="55" packageName="commandkit" />

In-memory storage implementation for rate limiting.
Suitable for single-instance applications.

```ts title="Signature"
class MemoryRateLimitStorage implements RateLimitStorage {
get(key: string) => Promise<number>;
set(key: string, value: number) => Promise<void>;
delete(key: string) => Promise<void>;
}
```
* Implements: <code><a href='/docs/next/api-reference/commandkit/interfaces/rate-limit-storage#ratelimitstorage'>RateLimitStorage</a></code>



<div className="members-wrapper">

### get

<MemberInfo kind="method" type={`(key: string) => Promise&#60;number&#62;`} />

Retrieves the current request count for a given key
### set

<MemberInfo kind="method" type={`(key: string, value: number) => Promise&#60;void&#62;`} />

Sets the request count for a given key
### delete

<MemberInfo kind="method" type={`(key: string) => Promise&#60;void&#62;`} />

Deletes the rate limit entry for a given key


</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: "MemorySemaphoreStorage"
isDefaultIndex: false
generated: true
---

import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## MemorySemaphoreStorage

<GenerationInfo sourceFile="packages/commandkit/src/utils/useful-stuff/semaphore.ts" sourceLine="62" packageName="commandkit" />

In-memory storage implementation for semaphore permits.
Suitable for single-instance applications.

```ts title="Signature"
class MemorySemaphoreStorage implements SemaphoreStorage {
acquire(key: string, timeout: number = 30000, signal?: AbortSignal) => Promise<boolean>;
release(key: string) => Promise<void>;
getAvailablePermits(key: string) => Promise<number>;
getTotalPermits(key: string) => Promise<number>;
initialize(key: string, permits: number) => void;
}
```
* Implements: <code><a href='/docs/next/api-reference/commandkit/interfaces/semaphore-storage#semaphorestorage'>SemaphoreStorage</a></code>



<div className="members-wrapper">

### acquire

<MemberInfo kind="method" type={`(key: string, timeout: number = 30000, signal?: AbortSignal) => Promise&#60;boolean&#62;`} />

Attempts to acquire a permit for a given key
### release

<MemberInfo kind="method" type={`(key: string) => Promise&#60;void&#62;`} />

Releases a permit for a given key
### getAvailablePermits

<MemberInfo kind="method" type={`(key: string) => Promise&#60;number&#62;`} />

Gets the number of available permits for a given key
### getTotalPermits

<MemberInfo kind="method" type={`(key: string) => Promise&#60;number&#62;`} />

Gets the total number of permits for a given key
### initialize

<MemberInfo kind="method" type={`(key: string, permits: number) => void`} />

Initializes a semaphore with the specified number of permits


</div>
78 changes: 78 additions & 0 deletions apps/website/docs/api-reference/commandkit/classes/mutex.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: "Mutex"
isDefaultIndex: false
generated: true
---

import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## Mutex

<GenerationInfo sourceFile="packages/commandkit/src/utils/useful-stuff/mutex.ts" sourceLine="121" packageName="commandkit" />

Async mutex implementation that provides mutual exclusion for shared resources.
Ensures only one task can access a protected resource at a time.

```ts title="Signature"
class Mutex {
constructor(options: MutexOptions = {})
setStorage(storage: MutexStorage) => ;
getStorage() => MutexStorage;
acquire(key: string, timeout?: number, signal?: AbortSignal) => Promise<boolean>;
release(key: string) => Promise<void>;
isLocked(key: string) => Promise<boolean>;
withLock(key: string, fn: () => Promise<T> | T, timeout?: number, signal?: AbortSignal) => Promise<T>;
getConfig() => Omit<MutexOptions, 'storage'>;
}
```

<div className="members-wrapper">

### constructor

<MemberInfo kind="method" type={`(options: <a href='/docs/next/api-reference/commandkit/interfaces/mutex-options#mutexoptions'>MutexOptions</a> = {}) => Mutex`} />

Creates a new mutex instance
### setStorage

<MemberInfo kind="method" type={`(storage: <a href='/docs/next/api-reference/commandkit/interfaces/mutex-storage#mutexstorage'>MutexStorage</a>) => `} />

Sets the storage implementation for the mutex
### getStorage

<MemberInfo kind="method" type={`() => <a href='/docs/next/api-reference/commandkit/interfaces/mutex-storage#mutexstorage'>MutexStorage</a>`} />

Gets the storage implementation for the mutex
### acquire

<MemberInfo kind="method" type={`(key: string, timeout?: number, signal?: AbortSignal) => Promise&#60;boolean&#62;`} />

Acquires a lock for the given key
### release

<MemberInfo kind="method" type={`(key: string) => Promise&#60;void&#62;`} />

Releases the lock for the given key
### isLocked

<MemberInfo kind="method" type={`(key: string) => Promise&#60;boolean&#62;`} />

Checks if a lock is currently held for the given key
### withLock

<MemberInfo kind="method" type={`(key: string, fn: () =&#62; Promise&#60;T&#62; | T, timeout?: number, signal?: AbortSignal) => Promise&#60;T&#62;`} />

Executes a function with exclusive access to the resource
### getConfig

<MemberInfo kind="method" type={`() => Omit&#60;<a href='/docs/next/api-reference/commandkit/interfaces/mutex-options#mutexoptions'>MutexOptions</a>, 'storage'&#62;`} />

Gets the current configuration of the mutex


</div>
Loading