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

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.
@@ -6,7 +6,7 @@ declare class ProfileManager {
6
6
  constructor();
7
7
  private restartApp;
8
8
  logInProfile(profileId: string, restart?: boolean): void;
9
- createNewProfile(profileId?: string, restart?: boolean): void;
9
+ createNewProfile(profileId: string, restart?: boolean): void;
10
10
  getLoggedInProfile(restartIfNotLoggedIn?: boolean): string;
11
11
  renameProfile(newProfileId: string): void;
12
12
  deleteProfile(): void;
@@ -8,6 +8,7 @@ declare class SettingsManager extends EventEmitter {
8
8
  private getSettingsFile;
9
9
  private getGlobalSettingsFile;
10
10
  private handleCorruptSettingsFile;
11
+ private handleCorruptGlobalSettingsFile;
11
12
  private migrateUserSettingsToGlobal;
12
13
  private userSettingExists;
13
14
  private globalSettingExists;
@@ -1,4 +1,4 @@
1
- import { InstalledPluginConfig, LegacyCustomScript, ScriptBase, ScriptContext, Awaitable, ScriptDetails, AdditionalVariableEvent } from "../../../types";
1
+ import { InstalledPluginConfig, LegacyCustomScript, ScriptBase, ScriptContext, Awaitable, ScriptDetails, AdditionalVariableEvent, AdditionalEffectEvent } from "../../../types";
2
2
  import type { ScriptApiContext } from "../script-api";
3
3
  declare abstract class IBaseScriptExecutor {
4
4
  abstract canHandle(script: ScriptBase | LegacyCustomScript): Awaitable<boolean>;
@@ -7,7 +7,6 @@ declare abstract class IBaseScriptExecutor {
7
7
  export interface PluginRegistrations {
8
8
  effectIds?: string[];
9
9
  variableHandles?: string[];
10
- additionalVariableEvents?: AdditionalVariableEvent[];
11
10
  eventSourceIds?: string[];
12
11
  filterIds?: string[];
13
12
  systemCommandIds?: string[];
@@ -18,6 +17,8 @@ export interface PluginRegistrations {
18
17
  overlayWidgetIds?: string[];
19
18
  httpRoutePrefix?: string;
20
19
  websocketListenerName?: string;
20
+ additionalVariableEvents?: AdditionalVariableEvent[];
21
+ additionalEffectEvents?: AdditionalEffectEvent[];
21
22
  }
22
23
  export type PluginExecutionResult = {
23
24
  success: true;
@@ -25,6 +25,8 @@ export interface ScriptApiContext {
25
25
  readonly scriptDataDir: string;
26
26
  /** Winston child logger pre-tagged with `{ script: scriptId }`. */
27
27
  readonly logger: typeof logger;
28
+ /** True when script is being inspected (e.g. during early detail / manifest retrieval). */
29
+ readonly isInspecting: boolean;
28
30
  /** Register a teardown callback fired when the plugin is unloaded. */
29
31
  onDispose(fn: DisposeFn): void;
30
32
  }
@@ -36,10 +38,12 @@ export type ScriptApiContextSource = {
36
38
  kind: "plugin";
37
39
  config: InstalledPluginConfig;
38
40
  manifest: Manifest;
41
+ isInspecting: boolean;
39
42
  } | {
40
43
  kind: "effect-script";
41
44
  fileName: string;
42
45
  manifest: Manifest;
46
+ isInspecting: boolean;
43
47
  };
44
48
  export declare function createScriptApiContext(source: ScriptApiContextSource): ScriptApiContextHandle;
45
49
  export { normalizeName };
@@ -35,6 +35,7 @@ declare class ScriptManager {
35
35
  reloadPluginConfig(pluginConfig: InstalledPluginConfig, isNewInstall?: boolean): Promise<void>;
36
36
  setPluginEnabled(pluginId: string, enabled: boolean): Promise<void>;
37
37
  getInstalledPlugins(): Promise<InstalledPlugin[]>;
38
+ private doGetScriptDetailsByFileName;
38
39
  /**
39
40
  * Loads a script file (without persisting a config) and returns its details for
40
41
  * the install / edit UI.
@@ -1,11 +1,2 @@
1
- import type { ReplaceVariable } from "../../types/variables";
2
- export type VariableConfig = {
3
- handle: string;
4
- description: string;
5
- events: string[];
6
- eventMetaKey: string;
7
- usage?: string;
8
- defaultValue?: unknown;
9
- type: ReplaceVariable["definition"]["possibleDataOutput"][number] | ReplaceVariable["definition"]["possibleDataOutput"];
10
- };
1
+ import type { ReplaceVariable, VariableConfig } from "../../types/variables";
11
2
  export declare function createEventDataVariable({ events, eventMetaKey, type, defaultValue, ...definition }: VariableConfig): ReplaceVariable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowbartools/firebot-types",
3
- "version": "5.67.0-alpha17",
3
+ "version": "5.67.0-alpha19",
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",
@@ -1,6 +1,7 @@
1
1
  import ng from "angular";
2
2
  import type { TriggerType, TriggersObject, Trigger } from "./triggers";
3
3
  import type { Awaitable } from "./util-types";
4
+ import { EventSourceAndId } from "./events";
4
5
  type Func<T> = (...args: unknown[]) => T;
5
6
  export interface EffectScope<EffectModel> extends ng.IScope {
6
7
  effect: EffectModel;
@@ -187,4 +188,13 @@ export type QueueState = {
187
188
  mode: QueueMode;
188
189
  runEffectsImmediatelyWhenPaused?: boolean;
189
190
  };
191
+ export type AdditionalEffectEvent = {
192
+ effectId: string;
193
+ eventSourceId: string;
194
+ eventId: string;
195
+ };
196
+ export type PluginAdditionalEffectEvents = {
197
+ effectId: string;
198
+ events: EventSourceAndId[];
199
+ };
190
200
  export {};
@@ -1,7 +1,7 @@
1
- import type { EffectInstance, EffectList, EffectType } from "./effects";
1
+ import type { EffectInstance, EffectList, EffectType, PluginAdditionalEffectEvents } from "./effects";
2
2
  import type { Trigger } from "./triggers";
3
3
  import type { Awaitable } from "./util-types";
4
- import type { PluginAdditonalVariableEvents, ReplaceVariable } from "./variables";
4
+ import type { PluginAdditionalVariableEvents, ReplaceVariable } from "./variables";
5
5
  import type { EventFilter, EventSource } from "./events";
6
6
  import type { SystemCommand } from "./commands";
7
7
  import type { RestrictionType } from "./restrictions";
@@ -119,7 +119,6 @@ export interface Plugin<Params extends FirebotParams = FirebotParams> extends Sc
119
119
  effects?: DynamicArray<EffectType<any, any>>;
120
120
  eventSources?: DynamicArray<EventSource>;
121
121
  variables?: DynamicArray<ReplaceVariable>;
122
- additionalVariableEvents?: DynamicArray<PluginAdditonalVariableEvents>;
123
122
  integrations?: DynamicArray<Integration<any>>;
124
123
  filters?: DynamicArray<EventFilter>;
125
124
  restrictions?: DynamicArray<RestrictionType<any>>;
@@ -130,6 +129,8 @@ export interface Plugin<Params extends FirebotParams = FirebotParams> extends Sc
130
129
  httpRoutes?: DynamicObject<PluginHttpRouteDefinition>;
131
130
  websocketListener?: DynamicObject<CustomWebSocketHandler>;
132
131
  webhooks?: DynamicObject<PluginWebhooks>;
132
+ additionalEffectEvents?: DynamicArray<PluginAdditionalEffectEvents>;
133
+ additionalVariableEvents?: DynamicArray<PluginAdditionalVariableEvents>;
133
134
  };
134
135
  /** Called when the plugin is loaded */
135
136
  onLoad?: (context: ScriptContext<Params>, isInstalling?: boolean) => NoResult;
@@ -6,8 +6,7 @@ import type { FirebotAccount } from "./accounts";
6
6
  import type { FirebotSettingsTypes } from "./settings";
7
7
  import type { InstalledPlugin } from "./plugins";
8
8
  import type { PluginWebhook } from "./webhooks";
9
- import { ReplaceVariable } from "./variables";
10
- import type { VariableConfig } from "../backend/variables/variable-factory";
9
+ import type { ReplaceVariable, VariableConfig } from "./variables";
11
10
  import type { FilterConfig, PresetFilterConfig, TextFilterConfig } from "../backend/events/filters/filter-factory";
12
11
  export type ScriptLogMethod = (message: string, ...meta: unknown[]) => void;
13
12
  export interface ScriptLoggerApi {
@@ -65,13 +64,6 @@ export interface ScriptEventsApi {
65
64
  trigger(sourceId: string, eventId: string, meta?: Record<string, unknown>): Promise<void>;
66
65
  }
67
66
  export interface ScriptEffectsApi {
68
- /**
69
- * Register an existing effect to be available for an event.
70
- * Useful for surfacing built-in effects on script provided events.
71
- */
72
- addEventToEffect(effectId: string, eventSourceId: string, eventId: string): void;
73
- /** Reverse of `addEventToEffect`. */
74
- removeEventFromEffect(effectId: string, eventSourceId: string, eventId: string): void;
75
67
  /**
76
68
  * Run an effect list. Respects the list's run mode and effect queue, if any.
77
69
  * Resolves once the effects have been run (queued lists resolve
@@ -49,7 +49,16 @@ export type AdditionalVariableEvent = {
49
49
  eventSourceId: string;
50
50
  eventId: string;
51
51
  };
52
- export type PluginAdditonalVariableEvents = {
52
+ export type PluginAdditionalVariableEvents = {
53
53
  handle: string;
54
54
  events: Array<EventSourceAndId>;
55
55
  };
56
+ export type VariableConfig = {
57
+ handle: string;
58
+ description: string;
59
+ events: string[];
60
+ eventMetaKey: string;
61
+ usage?: string;
62
+ defaultValue?: unknown;
63
+ type: ReplaceVariable["definition"]["possibleDataOutput"][number] | ReplaceVariable["definition"]["possibleDataOutput"];
64
+ };