Compare commits

..

No commits in common. "b4e1847bd1b49047090c4cd59c40392f1b17a322" and "f0a124bee668f7fb271241819f113eb0f995cbdc" have entirely different histories.

3 changed files with 7 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@navy.gif/wrappers",
"version": "1.5.2",
"version": "1.5.0",
"description": "Various wrapper classes I use in my projects",
"repository": "https://git.corgi.wtf/Navy.gif/wrappers.git",
"author": "Navy.gif",

View File

@ -13,11 +13,8 @@ type Credentials = {
host: string,
port: number,
database: string,
}
type ExtendedCredentials = {
node: string
} & Credentials
}
export type MariaOptions = {
load?: boolean,
@ -89,7 +86,7 @@ class MariaDB
#load: boolean;
#config: MariaOptions;
#credentials: ExtendedCredentials[];
#credentials: Credentials[];
#cluster: boolean;
#pool: PoolCluster | null;
#nodes: Node[];

View File

@ -255,7 +255,7 @@ class MessageBroker
}
// Subscribe to exchange, ensures messages aren't lost by binding it to a queue
async subscribe<T> (name: string, listener: Subscriber<T>)
async subscribe<T> (name: string, listener: Subscriber<T | Buffer>)
{
if (!this.#channel)
throw new Error('Channel does not exist');
@ -270,7 +270,7 @@ class MessageBroker
}
private async _subscribe<T> (name: string, listener: Subscriber<T>): Promise<void>
private async _subscribe<T> (name: string, listener: Subscriber<T | Buffer>): Promise<void>
{
if (!this.#channel)
return Promise.reject(new Error('Channel doesn\'t exist'));
@ -284,9 +284,7 @@ class MessageBroker
if (msg.content && msg.content.toString().startsWith('{'))
await listener(JSON.parse(msg.content.toString()), msg);
else
// TODO: Figure out how to do this and remaing logically consistent
throw new Error('Malformed content');
// await listener(msg.content, msg);
await listener(msg.content, msg);
this.#channel?.ack(msg);
});
}