Refactor all the things

This commit is contained in:
Zef Hemel
2023-08-28 17:12:15 +02:00
parent 54d2deea15
commit 5ff1a8bae3
87 changed files with 930 additions and 896 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { syscall } from "$sb/plugos-syscall/syscall.ts";
import { QueueStats } from "$sb/types.ts";
import { MQStats } from "$sb/types.ts";
export function send(queue: string, body: any) {
return syscall("mq.send", queue, body);
@@ -17,6 +17,6 @@ export function batchAck(queue: string, ids: string[]) {
return syscall("mq.batchAck", queue, ids);
}
export function getQueueStats(queue: string): Promise<QueueStats> {
export function getQueueStats(queue: string): Promise<MQStats> {
return syscall("mq.getQueueStats", queue);
}
+1 -10
View File
@@ -1,20 +1,11 @@
import type { CommandDef } from "../../web/hooks/command.ts";
import { syscall } from "./syscall.ts";
export function invoke(
name: string,
...args: any[]
): Promise<any> {
return syscall("system.invoke", name, ...args);
}
// @deprecated use invoke instead
export function invokeFunction(
env: string,
name: string,
...args: any[]
): Promise<any> {
return syscall("system.invokeFunction", env, name, ...args);
return syscall("system.invokeFunction", name, ...args);
}
// Only available on the client
+2
View File
@@ -0,0 +1,2 @@
export * from "$sb/silverbullet-syscall/mod.ts";
export * from "$sb/plugos-syscall/mod.ts";
+7 -2
View File
@@ -1,16 +1,21 @@
export type Message = {
export type MQMessage = {
id: string;
queue: string;
body: any;
retries?: number;
};
export type QueueStats = {
export type MQStats = {
queued: number;
processing: number;
dlq: number;
};
export type MQSubscribeOptions = {
batchSize?: number;
pollInterval?: number;
};
export type FileMeta = {
name: string;
lastModified: number;