@crowbartools/firebot-types 5.67.0-alpha14 → 5.67.0-alpha16

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.
@@ -32,7 +32,7 @@ declare class ScriptManager {
32
32
  * Handle a config change. Starts/stops as needed, and on a still-enabled plugin
33
33
  * either re-loads (if file may have changed) or invokes onParameterUpdate.
34
34
  */
35
- reloadPluginConfig(pluginConfig: InstalledPluginConfig): Promise<void>;
35
+ reloadPluginConfig(pluginConfig: InstalledPluginConfig, isNewInstall?: boolean): Promise<void>;
36
36
  setPluginEnabled(pluginId: string, enabled: boolean): Promise<void>;
37
37
  getInstalledPlugins(): Promise<InstalledPlugin[]>;
38
38
  /**
@@ -1,5 +1,4 @@
1
- import type { ScriptWebhook, WebhookConfig } from "../../types";
2
- import type { ScriptWebhookEventHandler } from "../../types/script-api";
1
+ import type { PluginWebhook, PluginWebhookEventHandler, WebhookConfig } from "../../types";
3
2
  import JsonDbManager from "../database/json-db-manager";
4
3
  type ExtraEvents = {
5
4
  "webhook-received": (data: {
@@ -15,12 +14,12 @@ declare class WebhookConfigManager extends JsonDbManager<WebhookConfig, ExtraEve
15
14
  getWebhookUrlById(webhookId: string): string;
16
15
  private toPublic;
17
16
  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;
17
+ getPluginWebhook(pluginId: string, webhookName: string): PluginWebhook;
18
+ getAllPluginWebhooks(pluginId: string): PluginWebhook[];
19
+ savePluginWebhook(pluginId: string, webhookName: string): PluginWebhook;
21
20
  deletePluginWebhook(pluginId: string, webhookName: string): boolean;
22
21
  getPluginWebhookUrl(pluginId: string, webhookName: string): string;
23
- registerPluginHandler(pluginId: string, handler: ScriptWebhookEventHandler): boolean;
22
+ registerPluginHandler(pluginId: string, handler: PluginWebhookEventHandler): boolean;
24
23
  unregisterPluginHandler(pluginId: string): boolean;
25
24
  }
26
25
  declare const webhookConfigManager: WebhookConfigManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowbartools/firebot-types",
3
- "version": "5.67.0-alpha14",
3
+ "version": "5.67.0-alpha16",
4
4
  "description": "Type definitions and script API for Firebot plugins and custom scripts.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -38,11 +38,35 @@ interface ManifestFirebotVersion {
38
38
  minor?: number;
39
39
  patch?: number;
40
40
  }
41
+ type FontAwesomeIcon = {
42
+ type: "font-awesome";
43
+ /**
44
+ * A FontAwesome icon name shown in the UI (eg. "fa-cogs").
45
+ */
46
+ name: `fa-${string}`;
47
+ /**
48
+ * A css color value (eg. "#FF0000") used for the icon.
49
+ */
50
+ color?: string;
51
+ };
52
+ type CustomIcon = {
53
+ type: "custom";
54
+ url: string;
55
+ /**
56
+ * A css color value (eg. "#FF0000") used for the background of the icon.
57
+ */
58
+ backgroundColor?: string;
59
+ };
60
+ export type PluginIcon = FontAwesomeIcon | CustomIcon;
41
61
  export interface Manifest {
42
62
  name: string;
43
63
  version: string;
44
64
  author: string;
45
65
  description: string | ManifestDescription;
66
+ /**
67
+ * An array of strings that describe or categorize your plugin
68
+ */
69
+ tags?: string[];
46
70
  /**
47
71
  * A link to the plugin's source code repository
48
72
  */
@@ -60,13 +84,9 @@ export interface Manifest {
60
84
  minimumFirebotVersion?: ManifestFirebotVersion;
61
85
  maximumFirebotVersion?: ManifestFirebotVersion;
62
86
  /**
63
- * A FontAwesome icon name shown in the UI (eg. "fa-cogs").
64
- */
65
- icon?: `fa-${string}`;
66
- /**
67
- * A hex color code (eg. "#FF0000") used for the icon.
87
+ * The icon to be displayed for the plugin.
68
88
  */
69
- color?: string;
89
+ icon?: PluginIcon;
70
90
  /**
71
91
  * If true, the plugin will be initialized before parameters are shown to the user,
72
92
  * allowing the plugin to provide custom parameter types that can be used in its own parametersSchema.
@@ -183,4 +203,4 @@ export type LegacyCustomScript = {
183
203
  stop?: () => Awaitable<void>;
184
204
  };
185
205
  export type FirebotScriptApi = import("./script-api").FirebotScriptApi;
186
- export type { ScriptLoggerApi, ScriptWebhooksApi, ScriptWebhook, ScriptWebhookEvent } from "./script-api";
206
+ export type { ScriptLoggerApi, ScriptWebhooksApi } from "./script-api";
@@ -5,6 +5,7 @@ import type { Notification } from "./notifications";
5
5
  import type { FirebotAccount } from "./accounts";
6
6
  import type { FirebotSettingsTypes } from "./settings";
7
7
  import type { InstalledPlugin } from "./plugins";
8
+ import type { PluginWebhook } from "./webhooks";
8
9
  export type ScriptLogMethod = (message: string, ...meta: unknown[]) => void;
9
10
  export interface ScriptLoggerApi {
10
11
  debug: ScriptLogMethod;
@@ -12,22 +13,11 @@ export interface ScriptLoggerApi {
12
13
  warn: ScriptLogMethod;
13
14
  error: ScriptLogMethod;
14
15
  }
15
- export interface ScriptWebhook {
16
- id: string;
17
- name: string;
18
- }
19
- export interface ScriptWebhookEvent {
20
- webhook: ScriptWebhook;
21
- payload: unknown;
22
- rawPayload?: string;
23
- headers: Record<string, string>;
24
- }
25
- export type ScriptWebhookEventHandler = (event: ScriptWebhookEvent) => void;
26
16
  export interface ScriptWebhooksApi {
27
17
  /** Look up a webhook by name. */
28
- get(name: string): ScriptWebhook | null;
18
+ get(name: string): PluginWebhook | null;
29
19
  /** All webhooks owned by this script. */
30
- list(): ScriptWebhook[];
20
+ list(): PluginWebhook[];
31
21
  /** Public URL for a webhook by name, or null if not found. */
32
22
  getUrl(name: string): string | null;
33
23
  }
@@ -1,10 +1,20 @@
1
- import type { ScriptWebhookEventHandler } from "./script-api";
2
1
  export type WebhookConfig = {
3
2
  id: string;
4
3
  name: string;
5
4
  scriptId?: string;
6
5
  };
6
+ export interface PluginWebhook {
7
+ id: string;
8
+ name: string;
9
+ }
10
+ export interface PluginWebhookEvent {
11
+ webhook: PluginWebhook;
12
+ payload: unknown;
13
+ rawPayload?: string;
14
+ headers: Record<string, string>;
15
+ }
16
+ export type PluginWebhookEventHandler = (event: PluginWebhookEvent) => void;
7
17
  export type PluginWebhooks = {
8
18
  webhookNames: string[];
9
- handler: ScriptWebhookEventHandler;
19
+ handler: PluginWebhookEventHandler;
10
20
  };