@crowbartools/firebot-types 5.67.0-alpha19 → 5.67.0-alpha20

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.
Files changed (71) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +1 -1
  3. package/backend/bonjour-manager.d.ts +11 -0
  4. package/backend/common/settings-manager.d.ts +7 -2
  5. package/backend/control-deck/control-deck-manager.d.ts +13 -0
  6. package/backend/effects/builtin/set-active-control-deck.d.ts +6 -0
  7. package/backend/effects/builtin/set-default-control-deck.d.ts +5 -0
  8. package/backend/plugin-log-names.d.ts +3 -0
  9. package/backend/plugins/executors/legacy-effect-script-executor.d.ts +15 -0
  10. package/backend/plugins/executors/legacy-startup-script-executor.d.ts +15 -0
  11. package/backend/plugins/executors/plugin-executor.d.ts +18 -0
  12. package/backend/{scripts/executors/script-executor.interface.d.ts → plugins/executors/plugin-executor.interface.d.ts} +9 -12
  13. package/backend/{scripts/script-api → plugins/plugin-api}/context.d.ts +12 -17
  14. package/backend/plugins/plugin-api/index.d.ts +8 -0
  15. package/backend/plugins/plugin-api/internal/define-namespace.d.ts +3 -0
  16. package/backend/{scripts/script-api → plugins/plugin-api}/internal/dispose-bag.d.ts +1 -1
  17. package/backend/{scripts/script-api → plugins/plugin-api}/internal/name-normalizer.d.ts +1 -1
  18. package/backend/plugins/plugin-api/internal/plugin-data-dir.d.ts +1 -0
  19. package/backend/plugins/plugin-api/namespaces/effects.d.ts +2 -0
  20. package/backend/plugins/plugin-api/namespaces/event-filter-factory.d.ts +2 -0
  21. package/backend/plugins/plugin-api/namespaces/events.d.ts +2 -0
  22. package/backend/plugins/plugin-api/namespaces/frontend-communicator.d.ts +2 -0
  23. package/backend/plugins/plugin-api/namespaces/http-server.d.ts +2 -0
  24. package/backend/plugins/plugin-api/namespaces/logger.d.ts +2 -0
  25. package/backend/plugins/plugin-api/namespaces/notifications.d.ts +2 -0
  26. package/backend/plugins/plugin-api/namespaces/parameters.d.ts +2 -0
  27. package/backend/plugins/plugin-api/namespaces/plugins.d.ts +2 -0
  28. package/backend/plugins/plugin-api/namespaces/settings.d.ts +2 -0
  29. package/backend/plugins/plugin-api/namespaces/storage.d.ts +6 -0
  30. package/backend/plugins/plugin-api/namespaces/twitch.d.ts +2 -0
  31. package/backend/plugins/plugin-api/namespaces/variable-factory.d.ts +2 -0
  32. package/backend/plugins/plugin-api/namespaces/webhooks.d.ts +2 -0
  33. package/backend/{scripts/script-manager.d.ts → plugins/plugin-manager.d.ts} +26 -29
  34. package/backend/variables/builtin/metadata/control-deck-input.d.ts +3 -0
  35. package/index.d.ts +2 -2
  36. package/package.json +2 -2
  37. package/server/http-server-manager.d.ts +1 -0
  38. package/server/websocket-client.d.ts +1 -1
  39. package/server/websocket-server-manager.d.ts +1 -0
  40. package/types/control-deck.d.ts +146 -0
  41. package/types/index.d.ts +1 -0
  42. package/types/notifications.d.ts +2 -2
  43. package/types/{script-api.d.ts → plugin-api.d.ts} +48 -48
  44. package/types/plugins.d.ts +15 -25
  45. package/types/settings.d.ts +4 -0
  46. package/types/triggers.d.ts +1 -1
  47. package/types/ui/object-copy-helper.d.ts +1 -0
  48. package/backend/script-log-names.d.ts +0 -3
  49. package/backend/scripts/executors/effect-script-executor.d.ts +0 -22
  50. package/backend/scripts/executors/legacy-effect-script-executor.d.ts +0 -12
  51. package/backend/scripts/executors/legacy-startup-script-executor.d.ts +0 -15
  52. package/backend/scripts/executors/plugin-executor.d.ts +0 -18
  53. package/backend/scripts/script-api/index.d.ts +0 -8
  54. package/backend/scripts/script-api/internal/define-namespace.d.ts +0 -3
  55. package/backend/scripts/script-api/internal/script-data-dir.d.ts +0 -1
  56. package/backend/scripts/script-api/namespaces/effects.d.ts +0 -2
  57. package/backend/scripts/script-api/namespaces/event-filter-factory.d.ts +0 -2
  58. package/backend/scripts/script-api/namespaces/events.d.ts +0 -2
  59. package/backend/scripts/script-api/namespaces/frontend-communicator.d.ts +0 -2
  60. package/backend/scripts/script-api/namespaces/http-server.d.ts +0 -2
  61. package/backend/scripts/script-api/namespaces/logger.d.ts +0 -2
  62. package/backend/scripts/script-api/namespaces/notifications.d.ts +0 -2
  63. package/backend/scripts/script-api/namespaces/parameters.d.ts +0 -2
  64. package/backend/scripts/script-api/namespaces/plugins.d.ts +0 -2
  65. package/backend/scripts/script-api/namespaces/settings.d.ts +0 -2
  66. package/backend/scripts/script-api/namespaces/storage.d.ts +0 -6
  67. package/backend/scripts/script-api/namespaces/twitch.d.ts +0 -2
  68. package/backend/scripts/script-api/namespaces/variable-factory.d.ts +0 -2
  69. package/backend/scripts/script-api/namespaces/webhooks.d.ts +0 -2
  70. /package/backend/{scripts → plugins}/plugin-config-manager.d.ts +0 -0
  71. /package/backend/{scripts → plugins}/plugin-manifest-utils.d.ts +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @crowbartools/firebot-types
2
2
 
3
- Type definitions and the script API contract for [Firebot](https://firebot.app) custom scripts and plugins.
3
+ Type definitions and the plugin API contract for [Firebot](https://firebot.app) plugins.
4
4
 
5
5
  This package is **type-only**. At runtime the `@crowbartools/firebot-types` module is provided by the Firebot host application via a `require()` interceptor (installing this package in a standalone Node project and importing it will throw).
6
6
 
@@ -0,0 +1,11 @@
1
+ declare class BonjourManager {
2
+ private logger;
3
+ private bonjour;
4
+ private service;
5
+ constructor();
6
+ start(): void;
7
+ stop(): void;
8
+ getHost(): string;
9
+ }
10
+ declare const manager: BonjourManager;
11
+ export { manager as BonjourManager };
@@ -1,6 +1,11 @@
1
- import { EventEmitter } from "events";
1
+ import { TypedEmitter } from "tiny-typed-emitter";
2
2
  import type { FirebotAutoUpdateLevel, FirebotSettingsTypes } from "../../types";
3
- declare class SettingsManager extends EventEmitter {
3
+ type Events = {
4
+ [settingName in keyof FirebotSettingsTypes as `settings:setting-updated:${settingName}`]: (data: FirebotSettingsTypes[settingName]) => void;
5
+ } & {
6
+ [settingName in keyof FirebotSettingsTypes as `settings:setting-deleted:${settingName}`]: () => void;
7
+ };
8
+ declare class SettingsManager extends TypedEmitter<Events> {
4
9
  private logger;
5
10
  settingsCache: Partial<Record<keyof FirebotSettingsTypes, unknown>>;
6
11
  constructor();
@@ -0,0 +1,13 @@
1
+ import { ControlDeck, ControlDeckControl } from "../../types";
2
+ import JsonDbManager from "../database/json-db-manager";
3
+ declare class ControlDeckManager extends JsonDbManager<ControlDeck> {
4
+ constructor();
5
+ saveDeck(deck: ControlDeck, notify?: boolean): ControlDeck;
6
+ deleteDeck(deckId: string): void;
7
+ getControl(deckId: string, controlId: string): ControlDeckControl | null;
8
+ triggerControl(deckId: string, controlId: string, inputValues?: Record<string, string | number | boolean>): boolean;
9
+ private broadcastToControlDecks;
10
+ triggerUiRefresh(): void;
11
+ }
12
+ declare const controlDeckManager: ControlDeckManager;
13
+ export { controlDeckManager as ControlDeckManager };
@@ -0,0 +1,6 @@
1
+ import type { EffectType } from "../../../types";
2
+ declare const effect: EffectType<{
3
+ deckId: string;
4
+ pageId?: string;
5
+ }>;
6
+ export = effect;
@@ -0,0 +1,5 @@
1
+ import type { EffectType } from "../../../types";
2
+ declare const effect: EffectType<{
3
+ deckId: string;
4
+ }>;
5
+ export = effect;
@@ -0,0 +1,3 @@
1
+ export declare function registerPluginLogName(pluginId: string, displayName: string): void;
2
+ export declare function unregisterPluginLogName(pluginId: string): void;
3
+ export declare function getPluginLogName(pluginId: string): string | undefined;
@@ -0,0 +1,15 @@
1
+ import type { PluginBase, LegacyCustomScript, PluginContext, PluginDetails } from "../../../types";
2
+ import type { EffectScriptExecutionResult } from "./plugin-executor.interface";
3
+ /**
4
+ * Executor for legacy effect scripts (run function with no manifest or startupOnly !== true)
5
+ */
6
+ export declare class LegacyEffectScriptExecutor {
7
+ canHandle(script: PluginBase | LegacyCustomScript): Promise<boolean>;
8
+ getScriptDetails(script: PluginBase | LegacyCustomScript): Promise<PluginDetails | null>;
9
+ executeScript(script: PluginBase | LegacyCustomScript, context: PluginContext): Promise<EffectScriptExecutionResult>;
10
+ private isLegacy;
11
+ /**
12
+ * Runs effects returned by a custom script and returns flow-control flags.
13
+ */
14
+ private runEffectsResult;
15
+ }
@@ -0,0 +1,15 @@
1
+ import { PluginBase, LegacyCustomScript, InstalledPluginConfig, PluginDetails } from "../../../types";
2
+ import { IPluginExecutor, PluginExecutionResult } from "./plugin-executor.interface";
3
+ /**
4
+ * Executor for legacy startup scripts (scripts that export a getScriptManifest function that returns an object with startupOnly: true)
5
+ */
6
+ export declare class LegacyStartUpScript extends IPluginExecutor {
7
+ constructor();
8
+ canHandle(script: PluginBase | LegacyCustomScript): Promise<boolean>;
9
+ executePlugin(script: PluginBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<PluginExecutionResult>;
10
+ unloadPlugin(script: PluginBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<void>;
11
+ updateParameters(script: PluginBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<void>;
12
+ getPluginDetails(script: PluginBase | LegacyCustomScript): Promise<PluginDetails>;
13
+ private buildParameters;
14
+ private isLegacyScript;
15
+ }
@@ -0,0 +1,18 @@
1
+ import { PluginBase, LegacyCustomScript, Plugin, InstalledPluginConfig, PluginDetails } from "../../../types";
2
+ import { IPluginExecutor, PluginRegistrations, PluginExecutionResult } from "./plugin-executor.interface";
3
+ import { PluginApiContext } from "../plugin-api";
4
+ /**
5
+ * Executor for new-spec Plugins (manifest.type === "plugin")
6
+ */
7
+ export declare class PluginExecutor extends IPluginExecutor {
8
+ constructor();
9
+ canHandle(plugin: PluginBase | LegacyCustomScript): plugin is Plugin<import("../../../types").FirebotParams>;
10
+ getPluginDetails(plugin: PluginBase | LegacyCustomScript): PluginDetails | null;
11
+ executePlugin(plugin: PluginBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean, ctx?: PluginApiContext): Promise<PluginExecutionResult>;
12
+ unloadPlugin(plugin: PluginBase | LegacyCustomScript, config: InstalledPluginConfig, registrations?: PluginRegistrations, isUninstalling?: boolean): Promise<void>;
13
+ updateParameters(plugin: PluginBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<void>;
14
+ private registerAll;
15
+ private runUnregistrations;
16
+ private buildParameters;
17
+ private isPlugin;
18
+ }
@@ -1,8 +1,8 @@
1
- import { InstalledPluginConfig, LegacyCustomScript, ScriptBase, ScriptContext, Awaitable, ScriptDetails, AdditionalVariableEvent, AdditionalEffectEvent } from "../../../types";
2
- import type { ScriptApiContext } from "../script-api";
3
- declare abstract class IBaseScriptExecutor {
4
- abstract canHandle(script: ScriptBase | LegacyCustomScript): Awaitable<boolean>;
5
- abstract getScriptDetails(script: ScriptBase | LegacyCustomScript): Awaitable<ScriptDetails | null>;
1
+ import { InstalledPluginConfig, LegacyCustomScript, PluginBase, Awaitable, PluginDetails, AdditionalVariableEvent, AdditionalEffectEvent } from "../../../types";
2
+ import type { PluginApiContext } from "../plugin-api";
3
+ declare abstract class IBasePluginExecutor {
4
+ abstract canHandle(plugin: PluginBase | LegacyCustomScript): Awaitable<boolean>;
5
+ abstract getPluginDetails(plugin: PluginBase | LegacyCustomScript): Awaitable<PluginDetails | null>;
6
6
  }
7
7
  export interface PluginRegistrations {
8
8
  effectIds?: string[];
@@ -27,10 +27,10 @@ export type PluginExecutionResult = {
27
27
  success: false;
28
28
  error: string;
29
29
  };
30
- export declare abstract class IPluginExecutor extends IBaseScriptExecutor {
31
- abstract executePlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean, ctx?: ScriptApiContext): Awaitable<PluginExecutionResult>;
32
- abstract unloadPlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, registrations?: PluginRegistrations, isUninstalling?: boolean): Awaitable<void>;
33
- updateParameters?(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig): Awaitable<void>;
30
+ export declare abstract class IPluginExecutor extends IBasePluginExecutor {
31
+ abstract executePlugin(plugin: PluginBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean, ctx?: PluginApiContext): Awaitable<PluginExecutionResult>;
32
+ abstract unloadPlugin(plugin: PluginBase | LegacyCustomScript, config: InstalledPluginConfig, registrations?: PluginRegistrations, isUninstalling?: boolean): Awaitable<void>;
33
+ updateParameters?(plugin: PluginBase | LegacyCustomScript, config: InstalledPluginConfig): Awaitable<void>;
34
34
  }
35
35
  export type EffectScriptExecutionResult = {
36
36
  success: true;
@@ -42,7 +42,4 @@ export type EffectScriptExecutionResult = {
42
42
  success: false;
43
43
  error: string;
44
44
  };
45
- export declare abstract class IEffectScriptExecutor extends IBaseScriptExecutor {
46
- abstract executeScript(script: ScriptBase | LegacyCustomScript, context: ScriptContext): Awaitable<EffectScriptExecutionResult>;
47
- }
48
45
  export {};
@@ -3,47 +3,42 @@ import { DisposeBag, DisposeFn } from "./internal/dispose-bag";
3
3
  import { normalizeName } from "./internal/name-normalizer";
4
4
  declare const logger: import("winston").Logger;
5
5
  /**
6
- * The per-script context handed to every namespace factory.
6
+ * The per-plugin context handed to every namespace factory.
7
7
  *
8
- * `manifest` is populated after the script is first loaded. Shim methods should read `ctx.manifest`
8
+ * `manifest` is populated after the plugin is first loaded. Shim methods should read `ctx.manifest`
9
9
  * lazily (inside method bodies) instead of at factory time.
10
10
  */
11
- export interface ScriptApiContext {
11
+ export interface PluginApiContext {
12
12
  /** If a plugin, the installed config id. */
13
13
  readonly pluginId?: string;
14
14
  /**
15
- * Normalized, filesystem-safe scope id for this plugin/script.
15
+ * Normalized, filesystem-safe scope id for this plugin.
16
16
  */
17
17
  readonly scriptId: string;
18
- /** The on-disk filename of the script. */
18
+ /** The on-disk filename of the plugin. */
19
19
  readonly fileName: string;
20
20
  /** Manifest, once known. Undefined during very-early loading. */
21
21
  readonly manifest: Manifest | undefined;
22
22
  /** Human-friendly display name. Manifest name when available, else fileName. */
23
23
  readonly displayName: string;
24
- /** Absolute path to this script's data directory. */
24
+ /** Absolute path to this plugin's data directory. */
25
25
  readonly scriptDataDir: string;
26
- /** Winston child logger pre-tagged with `{ script: scriptId }`. */
26
+ /** Winston child logger pre-tagged with `{ plugin: pluginId }`. */
27
27
  readonly logger: typeof logger;
28
- /** True when script is being inspected (e.g. during early detail / manifest retrieval). */
28
+ /** True when plugin is being inspected (e.g. during early detail / manifest retrieval). */
29
29
  readonly isInspecting: boolean;
30
30
  /** Register a teardown callback fired when the plugin is unloaded. */
31
31
  onDispose(fn: DisposeFn): void;
32
32
  }
33
- export interface ScriptApiContextHandle {
34
- readonly context: ScriptApiContext;
33
+ export interface PluginApiContextHandle {
34
+ readonly context: PluginApiContext;
35
35
  readonly disposeBag: DisposeBag;
36
36
  }
37
- export type ScriptApiContextSource = {
37
+ export type PluginApiContextSource = {
38
38
  kind: "plugin";
39
39
  config: InstalledPluginConfig;
40
40
  manifest: Manifest;
41
41
  isInspecting: boolean;
42
- } | {
43
- kind: "effect-script";
44
- fileName: string;
45
- manifest: Manifest;
46
- isInspecting: boolean;
47
42
  };
48
- export declare function createScriptApiContext(source: ScriptApiContextSource): ScriptApiContextHandle;
43
+ export declare function createPluginApiContext(source: PluginApiContextSource): PluginApiContextHandle;
49
44
  export { normalizeName };
@@ -0,0 +1,8 @@
1
+ import type { FirebotPluginApi } from "../../../types/plugin-api";
2
+ import type { PluginApiContext } from "./context";
3
+ /**
4
+ * Composition root for the Firebot Plugin API
5
+ */
6
+ export declare function buildPluginApi(ctx: PluginApiContext): FirebotPluginApi;
7
+ export type { PluginApiContext, PluginApiContextSource } from "./context";
8
+ export { createPluginApiContext } from "./context";
@@ -0,0 +1,3 @@
1
+ import type { PluginApiContext } from "../context";
2
+ export type PluginApiNamespaceFactory<TApi> = (ctx: PluginApiContext) => TApi;
3
+ export declare function definePluginApiNamespace<TApi>(factory: PluginApiNamespaceFactory<TApi>): PluginApiNamespaceFactory<TApi>;
@@ -1,6 +1,6 @@
1
1
  export type DisposeFn = () => void | Promise<void>;
2
2
  /**
3
- * Collects teardown callbacks registered by script-api namespaces during plugin
3
+ * Collects teardown callbacks registered by plugin-api namespaces during plugin
4
4
  * startup, and drains them (in reverse order / LIFO) when the plugin is unloaded.
5
5
  */
6
6
  export declare class DisposeBag {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Normalizes a script name or file name into a slug safe for use
2
+ * Normalizes a plugin name or file name into a slug safe for use
3
3
  * as a stable identifier.
4
4
  */
5
5
  export declare function normalizeName(value: string | undefined | null): string;
@@ -0,0 +1 @@
1
+ export declare function resolvePluginDataDir(pluginId: string): string;
@@ -0,0 +1,2 @@
1
+ import type { PluginEffectsApi } from "../../../../types/plugin-api";
2
+ export declare const createEffectsApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginEffectsApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginEventFilterFactoryApi } from "../../../../types/plugin-api";
2
+ export declare const createEventFilterFactoryApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginEventFilterFactoryApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginEventsApi } from "../../../../types/plugin-api";
2
+ export declare const createEventsApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginEventsApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginFrontendCommunicatorApi } from "../../../../types/plugin-api";
2
+ export declare const createFrontendCommunicatorApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginFrontendCommunicatorApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginWebServerApi } from "../../../../types/plugin-api";
2
+ export declare const createWebServerApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginWebServerApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginLoggerApi } from "../../../../types/plugin-api";
2
+ export declare const createLoggerApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginLoggerApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginNotificationsApi } from "../../../../types/plugin-api";
2
+ export declare const createNotificationsApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginNotificationsApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginParametersApi } from "../../../../types/plugin-api";
2
+ export declare const createParametersApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginParametersApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginPluginsApi } from "../../../../types/plugin-api";
2
+ export declare const createPluginsApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginPluginsApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginSettingsApi } from "../../../../types/plugin-api";
2
+ export declare const createSettingsApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginSettingsApi>;
@@ -0,0 +1,6 @@
1
+ import type { PluginStorageApi } from "../../../../types/plugin-api";
2
+ /**
3
+ * Simple per-plugin storage. Lets a plugin easily save/load JSON values or
4
+ * arbitrary files inside its own data directory.
5
+ */
6
+ export declare const createStorageApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginStorageApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginTwitchApi } from "../../../../types/plugin-api";
2
+ export declare const createTwitchApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginTwitchApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginVariableFactoryApi } from "../../../../types/plugin-api";
2
+ export declare const createVariableFactoryApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginVariableFactoryApi>;
@@ -0,0 +1,2 @@
1
+ import type { PluginWebhooksApi } from "../../../../types/plugin-api";
2
+ export declare const createWebhooksApi: import("../internal/define-namespace").PluginApiNamespaceFactory<PluginWebhooksApi>;
@@ -1,29 +1,28 @@
1
- import { InstalledPlugin, InstalledPluginConfig, ScriptDetails, ScriptType, Trigger } from "../../types";
2
- import { EffectScriptExecutionResult } from "./executors/script-executor.interface";
3
- type GetScriptDetailsResult = {
1
+ import type { InstalledPlugin, InstalledPluginConfig, PluginDetails, PluginType, Trigger } from "../../types";
2
+ import { EffectScriptExecutionResult } from "./executors/plugin-executor.interface";
3
+ type GetPluginDetailsResult = {
4
4
  success: true;
5
5
  fileName: string;
6
- scriptType: "plugin" | "script";
7
- details: ScriptDetails;
6
+ pluginType: "plugin" | "script";
7
+ details: PluginDetails;
8
8
  } | {
9
9
  success: false;
10
10
  error: string;
11
11
  };
12
- declare class ScriptManager {
12
+ declare class PluginManager {
13
13
  private startingPlugins;
14
14
  private activePlugins;
15
15
  private pendingApiInstances;
16
- private effectScriptApiInstances;
17
16
  private requireInterceptorInstalled;
18
17
  private pluginExecutors;
19
- private effectScriptExecutors;
18
+ private legacyEffectScriptExecutor;
20
19
  constructor();
21
20
  startPlugin(pluginConfig: InstalledPluginConfig, installing?: boolean): Promise<void>;
22
21
  private doStartPlugin;
23
22
  startPlugins(): Promise<void>;
24
23
  stopPlugin(pluginId: string, uninstalling?: boolean): Promise<void>;
25
24
  /**
26
- * Convenience helper for hot-reloading. Finds an active plugin by its script file
25
+ * Convenience helper for hot-reloading. Finds an active plugin by its plugin file
27
26
  * name and restarts it (stop then start). Does nothing if no active plugin matches.
28
27
  */
29
28
  restartPluginByFileName(fileName: string): Promise<void>;
@@ -35,23 +34,23 @@ declare class ScriptManager {
35
34
  reloadPluginConfig(pluginConfig: InstalledPluginConfig, isNewInstall?: boolean): Promise<void>;
36
35
  setPluginEnabled(pluginId: string, enabled: boolean): Promise<void>;
37
36
  getInstalledPlugins(): Promise<InstalledPlugin[]>;
38
- private doGetScriptDetailsByFileName;
37
+ private doGetPluginDetailsByFileName;
39
38
  /**
40
- * Loads a script file (without persisting a config) and returns its details for
39
+ * Loads a plugin file (without persisting a config) and returns its details for
41
40
  * the install / edit UI.
42
41
  */
43
- getScriptDetailsByFileName(fileName: string, expectedScriptType?: ScriptType): Promise<GetScriptDetailsResult>;
42
+ getPluginDetailsByFileName(fileName: string, expectedPluginType?: PluginType): Promise<GetPluginDetailsResult>;
44
43
  /**
45
44
  * Validates a file at any path on disk and copies it into the scripts folder.
46
45
  * Does NOT persist an InstalledPluginConfig — caller does that on save.
47
46
  */
48
- installScriptFromPath(sourcePath: string, overwrite?: boolean): Promise<GetScriptDetailsResult | {
47
+ installPluginFromPath(sourcePath: string, overwrite?: boolean): Promise<GetPluginDetailsResult | {
49
48
  success: false;
50
49
  error: string;
51
50
  conflict?: boolean;
52
51
  }>;
53
52
  /**
54
- * Delete a copied script file that the user cancelled installing, but only
53
+ * Delete a copied plugin file that the user cancelled installing, but only
55
54
  * when no config currently references it.
56
55
  */
57
56
  cancelInstall(fileName: string): Promise<void>;
@@ -60,17 +59,17 @@ declare class ScriptManager {
60
59
  * plugin.
61
60
  */
62
61
  onPluginConfigDeleted(pluginConfig: InstalledPluginConfig): Promise<void>;
63
- deleteScriptFileIfUnreferenced(fileName: string): Promise<void>;
62
+ deletePluginFileIfUnreferenced(fileName: string): Promise<void>;
64
63
  /**
65
64
  * Remove an installed plugin. Stops the plugin and deletes its config, and
66
- * optionally deletes the underlying script file from the scripts folder.
65
+ * optionally deletes the underlying plugin file from the scripts folder.
67
66
  */
68
- deletePlugin(pluginId: string, deleteScriptFile?: boolean): Promise<boolean>;
67
+ deletePlugin(pluginId: string, deletePluginFile?: boolean): Promise<boolean>;
69
68
  /**
70
- * Replace the underlying script file for an existing plugin config with a new file
69
+ * Replace the underlying plugin file for an existing plugin config with a new file
71
70
  * chosen on disk.
72
71
  */
73
- updatePluginFromPath(pluginId: string, sourcePath: string, overwrite?: boolean): Promise<GetScriptDetailsResult | {
72
+ updatePluginFromPath(pluginId: string, sourcePath: string, overwrite?: boolean): Promise<GetPluginDetailsResult | {
74
73
  success: false;
75
74
  error: string;
76
75
  conflict?: boolean;
@@ -79,23 +78,21 @@ declare class ScriptManager {
79
78
  scriptName: string;
80
79
  parameters?: Record<string, unknown>;
81
80
  }, trigger?: Trigger): Promise<EffectScriptExecutionResult | undefined>;
82
- private disposeEffectScriptApi;
83
- private getScriptFilePath;
81
+ private getPluginFilePath;
84
82
  private getActivePluginByFileName;
85
83
  private findPluginExecutor;
86
84
  private installRequireInterceptor;
87
85
  private createApiInstance;
88
- private loadScript;
86
+ private loadPlugin;
89
87
  /**
90
- * Hack to load a script without registering it in `require.cache`.
88
+ * Hack to load a plugin without registering it in `require.cache`.
91
89
  *
92
90
  * Used for read-only inspection (manifest / parameter schema lookup) so that
93
- * loading a fresh copy of a script does not evict or replace the cached module
91
+ * loading a fresh copy of a plugin does not evict or replace the cached module
94
92
  * of a currently-running plugin is holding a reference to.
95
93
  */
96
- private loadScriptIsolated;
97
- private scriptCanBePlugin;
94
+ private loadPluginIsolated;
95
+ private isValidPlugin;
98
96
  }
99
- declare const scriptManager: ScriptManager;
100
- export default scriptManager;
101
- export { ScriptManager };
97
+ declare const pluginManager: PluginManager;
98
+ export { pluginManager as PluginManager };
@@ -0,0 +1,3 @@
1
+ import type { ReplaceVariable } from "../../../../types/variables";
2
+ declare const model: ReplaceVariable;
3
+ export default model;
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Auto-generated by grunt build-types. Do not edit by hand.
2
- import { FirebotScriptApi } from "./types/script-api";
2
+ import { FirebotPluginApi } from "./types/plugin-api";
3
3
 
4
4
  export * from "./types";
5
5
 
6
- declare const firebot: FirebotScriptApi;
6
+ declare const firebot: FirebotPluginApi;
7
7
  export default firebot;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@crowbartools/firebot-types",
3
- "version": "5.67.0-alpha19",
4
- "description": "Type definitions and script API for Firebot plugins and custom scripts.",
3
+ "version": "5.67.0-alpha20",
4
+ "description": "Type definitions and plugin API for Firebot plugins.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "exports": {
@@ -42,6 +42,7 @@ declare class HttpServerManager extends EventEmitter {
42
42
  * @param overlayInstance the instance to refresh, leave undefined to refresh default
43
43
  */
44
44
  refreshOverlayInstance(overlayInstance?: string): void;
45
+ sendToControlDecks(eventName: string, data?: unknown): void;
45
46
  triggerCustomWebSocketEvent(eventType: string, payload: object): void;
46
47
  createServerInstance(): Express;
47
48
  startHttpServer(name: string, port: number, instance: Express): http.Server;
@@ -1,5 +1,5 @@
1
1
  import WebSocket from "ws";
2
2
  export declare class WebSocketClient extends WebSocket {
3
3
  registrationTimeout: ReturnType<typeof setTimeout>;
4
- type?: "overlay" | "events";
4
+ type?: "overlay" | "events" | "control-deck";
5
5
  }
@@ -11,6 +11,7 @@ declare class WebSocketServerManager extends EventEmitter {
11
11
  sendToOverlay(eventName: string, meta?: Record<string, unknown>, overlayInstance?: string): void;
12
12
  sendWidgetEventToOverlay(event: WidgetOverlayEvent): void;
13
13
  refreshAllOverlays(): void;
14
+ sendToControlDecks(eventName: string, data?: unknown): void;
14
15
  triggerEvent(eventType: string, payload: unknown): void;
15
16
  reportClientsToFrontend(isDefaultServerStarted: boolean): void;
16
17
  getNumberOfOverlayClients(): number;