@crowbartools/firebot-types 5.67.0-alpha13 → 5.67.0-alpha14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -674
- package/backend/scripts/executors/plugin-executor.d.ts +2 -1
- package/backend/scripts/executors/script-executor.interface.d.ts +2 -1
- package/backend/webhooks/webhook-config-manager.d.ts +12 -1
- package/package.json +1 -1
- package/types/plugins.d.ts +2 -0
- package/types/script-api.d.ts +0 -8
- package/types/webhooks.d.ts +5 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ScriptBase, LegacyCustomScript, Plugin, InstalledPluginConfig, ScriptDetails } from "../../../types";
|
|
2
2
|
import { IPluginExecutor, PluginRegistrations, PluginExecutionResult } from "./script-executor.interface";
|
|
3
|
+
import { ScriptApiContext } from "../script-api";
|
|
3
4
|
/**
|
|
4
5
|
* Executor for new-spec Plugins (manifest.type === "plugin")
|
|
5
6
|
*/
|
|
@@ -7,7 +8,7 @@ export declare class PluginExecutor extends IPluginExecutor {
|
|
|
7
8
|
constructor();
|
|
8
9
|
canHandle(script: ScriptBase | LegacyCustomScript): script is Plugin<import("../../../types").FirebotParams>;
|
|
9
10
|
getScriptDetails(script: ScriptBase | LegacyCustomScript): ScriptDetails | null;
|
|
10
|
-
executePlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean): Promise<PluginExecutionResult>;
|
|
11
|
+
executePlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean, ctx?: ScriptApiContext): Promise<PluginExecutionResult>;
|
|
11
12
|
unloadPlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, registrations?: PluginRegistrations, isUninstalling?: boolean): Promise<void>;
|
|
12
13
|
updateParameters(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<void>;
|
|
13
14
|
private registerAll;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InstalledPluginConfig, LegacyCustomScript, ScriptBase, ScriptContext, Awaitable, ScriptDetails } from "../../../types";
|
|
2
|
+
import type { ScriptApiContext } from "../script-api";
|
|
2
3
|
declare abstract class IBaseScriptExecutor {
|
|
3
4
|
abstract canHandle(script: ScriptBase | LegacyCustomScript): Awaitable<boolean>;
|
|
4
5
|
abstract getScriptDetails(script: ScriptBase | LegacyCustomScript): Awaitable<ScriptDetails | null>;
|
|
@@ -25,7 +26,7 @@ export type PluginExecutionResult = {
|
|
|
25
26
|
error: string;
|
|
26
27
|
};
|
|
27
28
|
export declare abstract class IPluginExecutor extends IBaseScriptExecutor {
|
|
28
|
-
abstract executePlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean): Awaitable<PluginExecutionResult>;
|
|
29
|
+
abstract executePlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean, ctx?: ScriptApiContext): Awaitable<PluginExecutionResult>;
|
|
29
30
|
abstract unloadPlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, registrations?: PluginRegistrations, isUninstalling?: boolean): Awaitable<void>;
|
|
30
31
|
updateParameters?(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig): Awaitable<void>;
|
|
31
32
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { WebhookConfig } from "../../types";
|
|
1
|
+
import type { ScriptWebhook, WebhookConfig } from "../../types";
|
|
2
|
+
import type { ScriptWebhookEventHandler } from "../../types/script-api";
|
|
2
3
|
import JsonDbManager from "../database/json-db-manager";
|
|
3
4
|
type ExtraEvents = {
|
|
4
5
|
"webhook-received": (data: {
|
|
@@ -9,8 +10,18 @@ type ExtraEvents = {
|
|
|
9
10
|
}) => void;
|
|
10
11
|
};
|
|
11
12
|
declare class WebhookConfigManager extends JsonDbManager<WebhookConfig, ExtraEvents> {
|
|
13
|
+
private _registeredPlugins;
|
|
12
14
|
constructor();
|
|
13
15
|
getWebhookUrlById(webhookId: string): string;
|
|
16
|
+
private toPublic;
|
|
17
|
+
findPluginWebhookByName(pluginId: string, webhookName: string): WebhookConfig;
|
|
18
|
+
getPluginWebhook(pluginId: string, webhookName: string): ScriptWebhook;
|
|
19
|
+
getAllPluginWebhooks(pluginId: string): ScriptWebhook[];
|
|
20
|
+
savePluginWebhook(pluginId: string, webhookName: string): ScriptWebhook;
|
|
21
|
+
deletePluginWebhook(pluginId: string, webhookName: string): boolean;
|
|
22
|
+
getPluginWebhookUrl(pluginId: string, webhookName: string): string;
|
|
23
|
+
registerPluginHandler(pluginId: string, handler: ScriptWebhookEventHandler): boolean;
|
|
24
|
+
unregisterPluginHandler(pluginId: string): boolean;
|
|
14
25
|
}
|
|
15
26
|
declare const webhookConfigManager: WebhookConfigManager;
|
|
16
27
|
export = webhookConfigManager;
|
package/package.json
CHANGED
package/types/plugins.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { UIExtension } from "./ui-extensions";
|
|
|
12
12
|
import type { OverlayWidgetType } from "./overlay-widgets";
|
|
13
13
|
import type { PluginHttpRouteDefinition } from "./http-server";
|
|
14
14
|
import type { CustomWebSocketHandler } from "./websocket";
|
|
15
|
+
import type { PluginWebhooks } from "./webhooks";
|
|
15
16
|
type NoResult = Awaitable<void>;
|
|
16
17
|
type GenericParameters = Record<string, unknown>;
|
|
17
18
|
export type InstalledPluginConfig<Params extends GenericParameters = GenericParameters> = {
|
|
@@ -107,6 +108,7 @@ export interface Plugin<Params extends FirebotParams = FirebotParams> extends Sc
|
|
|
107
108
|
overlayWidgets?: DynamicArray<OverlayWidgetType<any, any>>;
|
|
108
109
|
httpRoutes?: DynamicObject<PluginHttpRouteDefinition>;
|
|
109
110
|
websocketListener?: DynamicObject<CustomWebSocketHandler>;
|
|
111
|
+
webhooks?: DynamicObject<PluginWebhooks>;
|
|
110
112
|
};
|
|
111
113
|
/** Called when the plugin is loaded */
|
|
112
114
|
onLoad?: (context: ScriptContext<Params>, isInstalling?: boolean) => NoResult;
|
package/types/script-api.d.ts
CHANGED
|
@@ -24,20 +24,12 @@ export interface ScriptWebhookEvent {
|
|
|
24
24
|
}
|
|
25
25
|
export type ScriptWebhookEventHandler = (event: ScriptWebhookEvent) => void;
|
|
26
26
|
export interface ScriptWebhooksApi {
|
|
27
|
-
/** Create a new webhook (or return the existing one with the same name). */
|
|
28
|
-
save(name: string): ScriptWebhook | null;
|
|
29
27
|
/** Look up a webhook by name. */
|
|
30
28
|
get(name: string): ScriptWebhook | null;
|
|
31
|
-
/** Delete a webhook by name. Returns true if one was removed. */
|
|
32
|
-
delete(name: string): boolean;
|
|
33
29
|
/** All webhooks owned by this script. */
|
|
34
30
|
list(): ScriptWebhook[];
|
|
35
31
|
/** Public URL for a webhook by name, or null if not found. */
|
|
36
32
|
getUrl(name: string): string | null;
|
|
37
|
-
/**
|
|
38
|
-
* Subscribe to webhook events for this script. Returns an `unsubscribe` func
|
|
39
|
-
*/
|
|
40
|
-
onReceived(handler: ScriptWebhookEventHandler): () => void;
|
|
41
33
|
}
|
|
42
34
|
/**
|
|
43
35
|
* Simple per-script storage scoped to the script's data directory.
|
package/types/webhooks.d.ts
CHANGED