@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.
- package/LICENSE +674 -674
- package/README.md +1 -1
- package/backend/bonjour-manager.d.ts +11 -0
- package/backend/common/settings-manager.d.ts +7 -2
- package/backend/control-deck/control-deck-manager.d.ts +13 -0
- package/backend/effects/builtin/set-active-control-deck.d.ts +6 -0
- package/backend/effects/builtin/set-default-control-deck.d.ts +5 -0
- package/backend/plugin-log-names.d.ts +3 -0
- package/backend/plugins/executors/legacy-effect-script-executor.d.ts +15 -0
- package/backend/plugins/executors/legacy-startup-script-executor.d.ts +15 -0
- package/backend/plugins/executors/plugin-executor.d.ts +18 -0
- package/backend/{scripts/executors/script-executor.interface.d.ts → plugins/executors/plugin-executor.interface.d.ts} +9 -12
- package/backend/{scripts/script-api → plugins/plugin-api}/context.d.ts +12 -17
- package/backend/plugins/plugin-api/index.d.ts +8 -0
- package/backend/plugins/plugin-api/internal/define-namespace.d.ts +3 -0
- package/backend/{scripts/script-api → plugins/plugin-api}/internal/dispose-bag.d.ts +1 -1
- package/backend/{scripts/script-api → plugins/plugin-api}/internal/name-normalizer.d.ts +1 -1
- package/backend/plugins/plugin-api/internal/plugin-data-dir.d.ts +1 -0
- package/backend/plugins/plugin-api/namespaces/effects.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/event-filter-factory.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/events.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/frontend-communicator.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/http-server.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/logger.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/notifications.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/parameters.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/plugins.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/settings.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/storage.d.ts +6 -0
- package/backend/plugins/plugin-api/namespaces/twitch.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/variable-factory.d.ts +2 -0
- package/backend/plugins/plugin-api/namespaces/webhooks.d.ts +2 -0
- package/backend/{scripts/script-manager.d.ts → plugins/plugin-manager.d.ts} +26 -29
- package/backend/variables/builtin/metadata/control-deck-input.d.ts +3 -0
- package/index.d.ts +2 -2
- package/package.json +2 -2
- package/server/http-server-manager.d.ts +1 -0
- package/server/websocket-client.d.ts +1 -1
- package/server/websocket-server-manager.d.ts +1 -0
- package/types/control-deck.d.ts +146 -0
- package/types/index.d.ts +1 -0
- package/types/notifications.d.ts +2 -2
- package/types/{script-api.d.ts → plugin-api.d.ts} +48 -48
- package/types/plugins.d.ts +15 -25
- package/types/settings.d.ts +4 -0
- package/types/triggers.d.ts +1 -1
- package/types/ui/object-copy-helper.d.ts +1 -0
- package/backend/script-log-names.d.ts +0 -3
- package/backend/scripts/executors/effect-script-executor.d.ts +0 -22
- package/backend/scripts/executors/legacy-effect-script-executor.d.ts +0 -12
- package/backend/scripts/executors/legacy-startup-script-executor.d.ts +0 -15
- package/backend/scripts/executors/plugin-executor.d.ts +0 -18
- package/backend/scripts/script-api/index.d.ts +0 -8
- package/backend/scripts/script-api/internal/define-namespace.d.ts +0 -3
- package/backend/scripts/script-api/internal/script-data-dir.d.ts +0 -1
- package/backend/scripts/script-api/namespaces/effects.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/event-filter-factory.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/events.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/frontend-communicator.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/http-server.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/logger.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/notifications.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/parameters.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/plugins.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/settings.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/storage.d.ts +0 -6
- package/backend/scripts/script-api/namespaces/twitch.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/variable-factory.d.ts +0 -2
- package/backend/scripts/script-api/namespaces/webhooks.d.ts +0 -2
- /package/backend/{scripts → plugins}/plugin-config-manager.d.ts +0 -0
- /package/backend/{scripts → plugins}/plugin-manifest-utils.d.ts +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { EffectList } from "./effects";
|
|
2
|
+
/**
|
|
3
|
+
* Reserved page id for the "Pinned" shadow page. Buttons with this pageId are
|
|
4
|
+
* replicated onto every real page (unless a page button overrides the slot)
|
|
5
|
+
*/
|
|
6
|
+
export declare const CONTROL_DECK_PINNED_PAGE_ID = "pinned";
|
|
7
|
+
export type ControlDeckControlType = "button" | "folder";
|
|
8
|
+
/** An image icon — either a local file path or a URL. */
|
|
9
|
+
export type ControlDeckImageIcon = {
|
|
10
|
+
type: "image";
|
|
11
|
+
/** Whether `path` is a local file path or a URL */
|
|
12
|
+
source: "local" | "url";
|
|
13
|
+
/** Local file path (source "local") or URL (source "url") */
|
|
14
|
+
path: string;
|
|
15
|
+
};
|
|
16
|
+
/** A Lucide icon referenced by name. */
|
|
17
|
+
export type ControlDeckGlyphIcon = {
|
|
18
|
+
type: "glyph";
|
|
19
|
+
/** The Lucide icon name */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Optional CSS color; defaults to the control's text color */
|
|
22
|
+
color?: string;
|
|
23
|
+
};
|
|
24
|
+
export type ControlDeckNoneIcon = {
|
|
25
|
+
type: "none";
|
|
26
|
+
};
|
|
27
|
+
/** An emoji icon referenced by its unicode character. */
|
|
28
|
+
export type ControlDeckEmojiIcon = {
|
|
29
|
+
type: "emoji";
|
|
30
|
+
/** The emoji character (eg "🔥") */
|
|
31
|
+
emoji: string;
|
|
32
|
+
};
|
|
33
|
+
export type ControlDeckIcon = ControlDeckImageIcon | ControlDeckGlyphIcon | ControlDeckEmojiIcon | ControlDeckNoneIcon;
|
|
34
|
+
export type ControlDeckInputType = "text" | "number" | "toggle" | "preset";
|
|
35
|
+
type ControlDeckInputBase = {
|
|
36
|
+
/** Unique name of the input, used to access the value in effects */
|
|
37
|
+
name: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
};
|
|
40
|
+
export type ControlDeckTextInput = ControlDeckInputBase & {
|
|
41
|
+
type: "text";
|
|
42
|
+
};
|
|
43
|
+
export type ControlDeckNumberInput = ControlDeckInputBase & {
|
|
44
|
+
type: "number";
|
|
45
|
+
};
|
|
46
|
+
export type ControlDeckToggleInput = ControlDeckInputBase & {
|
|
47
|
+
type: "toggle";
|
|
48
|
+
};
|
|
49
|
+
export type ControlDeckPresetInput = ControlDeckInputBase & {
|
|
50
|
+
type: "preset";
|
|
51
|
+
options: string[];
|
|
52
|
+
};
|
|
53
|
+
export type ControlDeckUserInput = ControlDeckInputBase & {
|
|
54
|
+
type: "user";
|
|
55
|
+
};
|
|
56
|
+
export type ControlDeckControlInput = ControlDeckTextInput | ControlDeckNumberInput | ControlDeckToggleInput | ControlDeckPresetInput | ControlDeckUserInput;
|
|
57
|
+
export type ControlDeckControlPosition = {
|
|
58
|
+
col: number;
|
|
59
|
+
row: number;
|
|
60
|
+
};
|
|
61
|
+
export type ControlDeckControlSize = {
|
|
62
|
+
/** Number of grid columns the control spans (default 1) */
|
|
63
|
+
width: number;
|
|
64
|
+
/** Number of grid rows the control spans (default 1) */
|
|
65
|
+
height: number;
|
|
66
|
+
};
|
|
67
|
+
export type ControlDeckControl = {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
type: ControlDeckControlType;
|
|
71
|
+
/** The page this control belongs to */
|
|
72
|
+
pageId: string;
|
|
73
|
+
/** The parent folder control id, or null when placed at the page root */
|
|
74
|
+
parentId: string | null;
|
|
75
|
+
/** The icon shown on the control */
|
|
76
|
+
icon: ControlDeckIcon;
|
|
77
|
+
backgroundColor?: string;
|
|
78
|
+
/** Placement within the deck's grid */
|
|
79
|
+
position?: ControlDeckControlPosition;
|
|
80
|
+
/** How many grid cells the control spans (default 1x1) */
|
|
81
|
+
size?: ControlDeckControlSize;
|
|
82
|
+
/** Effects to run when the control is pressed. Only used when type is "button" */
|
|
83
|
+
effectList?: EffectList;
|
|
84
|
+
/**
|
|
85
|
+
* Inputs the user is prompted for when the control is pressed on the hosted
|
|
86
|
+
* page. The provided values are sent with the press and are available to
|
|
87
|
+
* effects via $controlDeckInput
|
|
88
|
+
*/
|
|
89
|
+
inputs?: ControlDeckControlInput[];
|
|
90
|
+
/**
|
|
91
|
+
* Whether a folder control should automatically return to the parent page after a button within it is pressed. Only used when type is "folder".
|
|
92
|
+
*/
|
|
93
|
+
autoReturn?: boolean;
|
|
94
|
+
};
|
|
95
|
+
export type ControlDeckGrid = {
|
|
96
|
+
cols: number;
|
|
97
|
+
rows: number;
|
|
98
|
+
};
|
|
99
|
+
export type ControlDeckPage = {
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
};
|
|
103
|
+
export type ControlDeck = {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
grid: ControlDeckGrid;
|
|
107
|
+
/** Ordered list of pages. A deck always has at least one page. */
|
|
108
|
+
pages: ControlDeckPage[];
|
|
109
|
+
controls: ControlDeckControl[];
|
|
110
|
+
};
|
|
111
|
+
export type ControlDeckOrientationMode = "dynamic" | "fixed";
|
|
112
|
+
export type ControlDeckSettings = {
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
/** Optional global PIN required to access the hosted page and trigger controls */
|
|
115
|
+
pin?: string;
|
|
116
|
+
/**
|
|
117
|
+
* How the hosted grid responds to device rotation.
|
|
118
|
+
* - "fixed": grid keeps its designed dimensions regardless of orientation
|
|
119
|
+
* - "dynamic": grid rotates to best fill the screen for the current orientation
|
|
120
|
+
*/
|
|
121
|
+
orientationMode?: ControlDeckOrientationMode;
|
|
122
|
+
};
|
|
123
|
+
export type ControlDeckResolvedIcon = {
|
|
124
|
+
type: "image";
|
|
125
|
+
url: string;
|
|
126
|
+
} | {
|
|
127
|
+
type: "glyph";
|
|
128
|
+
name: string;
|
|
129
|
+
color?: string;
|
|
130
|
+
} | {
|
|
131
|
+
type: "emoji";
|
|
132
|
+
emoji: string;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* A control as projected to the hosted Control Deck page. Server-only fields
|
|
136
|
+
* (the raw effect list and local icon path) are removed, and the resolved
|
|
137
|
+
* `icon` the page should render is added.
|
|
138
|
+
*/
|
|
139
|
+
export type ControlDeckControlView = Omit<ControlDeckControl, "icon" | "effectList"> & {
|
|
140
|
+
icon?: ControlDeckResolvedIcon;
|
|
141
|
+
};
|
|
142
|
+
/** A deck as projected to the hosted Control Deck page. */
|
|
143
|
+
export type ControlDeckView = Omit<ControlDeck, "controls"> & {
|
|
144
|
+
controls: ControlDeckControlView[];
|
|
145
|
+
};
|
|
146
|
+
export {};
|
package/types/index.d.ts
CHANGED
package/types/notifications.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type NotificationSource = "external" | "internal" | "
|
|
1
|
+
export type NotificationSource = "external" | "internal" | "plugin";
|
|
2
2
|
export type NotificationType = "info" | "tip" | "update" | "alert";
|
|
3
3
|
export type ExternalNotification = {
|
|
4
4
|
id: string;
|
|
@@ -11,7 +11,7 @@ export type NotificationBase = {
|
|
|
11
11
|
message: string;
|
|
12
12
|
type: NotificationType;
|
|
13
13
|
source?: NotificationSource;
|
|
14
|
-
|
|
14
|
+
pluginName?: string;
|
|
15
15
|
externalId?: string;
|
|
16
16
|
metadata?: Record<string, unknown>;
|
|
17
17
|
};
|
|
@@ -8,28 +8,28 @@ import type { InstalledPlugin } from "./plugins";
|
|
|
8
8
|
import type { PluginWebhook } from "./webhooks";
|
|
9
9
|
import type { ReplaceVariable, VariableConfig } from "./variables";
|
|
10
10
|
import type { FilterConfig, PresetFilterConfig, TextFilterConfig } from "../backend/events/filters/filter-factory";
|
|
11
|
-
export type
|
|
12
|
-
export interface
|
|
13
|
-
debug:
|
|
14
|
-
info:
|
|
15
|
-
warn:
|
|
16
|
-
error:
|
|
17
|
-
}
|
|
18
|
-
export interface
|
|
11
|
+
export type PluginLogMethod = (message: string, ...meta: unknown[]) => void;
|
|
12
|
+
export interface PluginLoggerApi {
|
|
13
|
+
debug: PluginLogMethod;
|
|
14
|
+
info: PluginLogMethod;
|
|
15
|
+
warn: PluginLogMethod;
|
|
16
|
+
error: PluginLogMethod;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginWebhooksApi {
|
|
19
19
|
/** Look up a webhook by name. */
|
|
20
20
|
get(name: string): PluginWebhook | null;
|
|
21
|
-
/** All webhooks owned by this
|
|
21
|
+
/** All webhooks owned by this plugin. */
|
|
22
22
|
list(): PluginWebhook[];
|
|
23
23
|
/** Public URL for a webhook by name, or null if not found. */
|
|
24
24
|
getUrl(name: string): string | null;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Simple per-
|
|
27
|
+
* Simple per-plugin storage scoped to the plugin's data directory.
|
|
28
28
|
* Provides helpers for storing/loading JSON values
|
|
29
29
|
* plus generic file read/write for anything else.
|
|
30
30
|
*/
|
|
31
|
-
export interface
|
|
32
|
-
/** Absolute path to this
|
|
31
|
+
export interface PluginStorageApi {
|
|
32
|
+
/** Absolute path to this plugin's data directory. */
|
|
33
33
|
readonly path: string;
|
|
34
34
|
/** Save a value as JSON under the given key. The key becomes the filename with a `.json` extension. */
|
|
35
35
|
setJson(key: string, value: unknown): Promise<void>;
|
|
@@ -51,19 +51,19 @@ export interface ScriptStorageApi {
|
|
|
51
51
|
/** Delete a file. No-op if it doesn't exist. */
|
|
52
52
|
deleteFile(name: string): Promise<void>;
|
|
53
53
|
}
|
|
54
|
-
export type
|
|
55
|
-
export interface
|
|
54
|
+
export type PluginEventHandler = (event: TriggeredEvent) => void;
|
|
55
|
+
export interface PluginEventsApi {
|
|
56
56
|
/**
|
|
57
57
|
* Subscribe to all Firebot events as they trigger. Returns an `unsubscribe`
|
|
58
58
|
* function.
|
|
59
59
|
*/
|
|
60
|
-
onTriggered(handler:
|
|
60
|
+
onTriggered(handler: PluginEventHandler): () => void;
|
|
61
61
|
/**
|
|
62
62
|
* Manually trigger a Firebot event.
|
|
63
63
|
*/
|
|
64
64
|
trigger(sourceId: string, eventId: string, meta?: Record<string, unknown>): Promise<void>;
|
|
65
65
|
}
|
|
66
|
-
export interface
|
|
66
|
+
export interface PluginEffectsApi {
|
|
67
67
|
/**
|
|
68
68
|
* Run an effect list. Respects the list's run mode and effect queue, if any.
|
|
69
69
|
* Resolves once the effects have been run (queued lists resolve
|
|
@@ -71,7 +71,7 @@ export interface ScriptEffectsApi {
|
|
|
71
71
|
*/
|
|
72
72
|
processEffects(context: RunEffectsContext): Promise<unknown>;
|
|
73
73
|
}
|
|
74
|
-
export interface
|
|
74
|
+
export interface PluginTwitchApi {
|
|
75
75
|
/** The full Twitch API surface. See {@linkcode TwitchApi}. */
|
|
76
76
|
api: typeof TwitchApi;
|
|
77
77
|
}
|
|
@@ -79,25 +79,25 @@ export interface ScriptTwitchApi {
|
|
|
79
79
|
* Access to this plugin's saved parameter values (the settings configured by
|
|
80
80
|
* the user)
|
|
81
81
|
*/
|
|
82
|
-
export interface
|
|
82
|
+
export interface PluginParametersApi {
|
|
83
83
|
getAll<T extends Record<string, unknown> = Record<string, unknown>>(): T;
|
|
84
84
|
}
|
|
85
|
-
export interface
|
|
85
|
+
export interface PluginNotificationsApi {
|
|
86
86
|
/**
|
|
87
87
|
* Create a new notification. Pass `permanentlySave` as `true` to persist it
|
|
88
88
|
* across restarts.
|
|
89
89
|
*/
|
|
90
90
|
add(notification: Pick<Notification, "title" | "message" | "type" | "metadata">, permanentlySave?: boolean): Notification;
|
|
91
|
-
/** Look up one of this
|
|
91
|
+
/** Look up one of this plugin's notifications by id. */
|
|
92
92
|
get(id: string): Notification | null;
|
|
93
|
-
/** All notifications owned by this
|
|
93
|
+
/** All notifications owned by this plugin. */
|
|
94
94
|
getAll(): Notification[];
|
|
95
|
-
/** Delete one of this
|
|
95
|
+
/** Delete one of this plugin's notifications by id. */
|
|
96
96
|
delete(id: string): void;
|
|
97
|
-
/** Delete all of this
|
|
97
|
+
/** Delete all of this plugin's notifications. */
|
|
98
98
|
clearAll(): void;
|
|
99
99
|
}
|
|
100
|
-
export interface
|
|
100
|
+
export interface PluginFrontendCommunicatorApi {
|
|
101
101
|
/** Send a synchronous event to the frontend. */
|
|
102
102
|
send<ExpectedArg = unknown>(eventName: string, data?: ExpectedArg): void;
|
|
103
103
|
/**
|
|
@@ -116,7 +116,7 @@ export interface ScriptFrontendCommunicatorApi {
|
|
|
116
116
|
*/
|
|
117
117
|
onAsync<ExpectedArgs extends Array<unknown> = [], ReturnPayload = void>(eventName: string, callback: (...args: ExpectedArgs) => Promise<ReturnPayload>): () => void;
|
|
118
118
|
}
|
|
119
|
-
export interface
|
|
119
|
+
export interface PluginSettingsApi {
|
|
120
120
|
/**
|
|
121
121
|
* Get a Firebot setting value or its default
|
|
122
122
|
*
|
|
@@ -125,7 +125,7 @@ export interface ScriptSettingsApi {
|
|
|
125
125
|
*/
|
|
126
126
|
getSetting<SettingName extends keyof FirebotSettingsTypes>(settingName: SettingName): FirebotSettingsTypes[SettingName];
|
|
127
127
|
}
|
|
128
|
-
export interface
|
|
128
|
+
export interface PluginPluginsApi {
|
|
129
129
|
/**
|
|
130
130
|
* Get a list of currently installed plugins installed by the user
|
|
131
131
|
*/
|
|
@@ -135,7 +135,7 @@ export interface Accounts {
|
|
|
135
135
|
streamer: FirebotAccount;
|
|
136
136
|
bot: FirebotAccount;
|
|
137
137
|
}
|
|
138
|
-
export interface
|
|
138
|
+
export interface PluginWebServerApi {
|
|
139
139
|
/**
|
|
140
140
|
* Sends a custom event over the internal Firebot WebSocket server
|
|
141
141
|
* @param name Name of the event to send. Full event name will be `custom-event:{name}`
|
|
@@ -143,46 +143,46 @@ export interface ScriptWebServerApi {
|
|
|
143
143
|
*/
|
|
144
144
|
sendWebSocketEvent(name: string, data?: unknown): any;
|
|
145
145
|
}
|
|
146
|
-
export interface
|
|
146
|
+
export interface PluginVariableFactoryApi {
|
|
147
147
|
createEventDataVariable(config: VariableConfig): ReplaceVariable;
|
|
148
148
|
}
|
|
149
|
-
export interface
|
|
149
|
+
export interface PluginEventFilterFactoryApi {
|
|
150
150
|
createTextFilter(config: TextFilterConfig): EventFilter;
|
|
151
151
|
createNumberFilter(config: FilterConfig): EventFilter;
|
|
152
152
|
createTextOrNumberFilter(config: TextFilterConfig): EventFilter;
|
|
153
153
|
createPresetFilter(config: PresetFilterConfig): EventFilter;
|
|
154
154
|
}
|
|
155
|
-
export interface
|
|
155
|
+
export interface FirebotPluginApi {
|
|
156
156
|
/** Running Firebot version, e.g. `"5.67.0"`. */
|
|
157
157
|
version: string;
|
|
158
158
|
/** The streamer and bot accounts currently in use. */
|
|
159
159
|
accounts: Accounts;
|
|
160
160
|
/** Scoped logger. */
|
|
161
|
-
logger:
|
|
161
|
+
logger: PluginLoggerApi;
|
|
162
162
|
/** Access to Firebot settings. */
|
|
163
|
-
settings:
|
|
164
|
-
/** Webhooks owned by this
|
|
165
|
-
webhooks:
|
|
166
|
-
/** Simple persistent storage rooted at this
|
|
167
|
-
storage:
|
|
163
|
+
settings: PluginSettingsApi;
|
|
164
|
+
/** Webhooks owned by this plugin. */
|
|
165
|
+
webhooks: PluginWebhooksApi;
|
|
166
|
+
/** Simple persistent storage rooted at this plugin's data directory. */
|
|
167
|
+
storage: PluginStorageApi;
|
|
168
168
|
/** Subscribe to and trigger Firebot events + register event sources. */
|
|
169
|
-
events:
|
|
169
|
+
events: PluginEventsApi;
|
|
170
170
|
/** Run effect lists. */
|
|
171
|
-
effects:
|
|
171
|
+
effects: PluginEffectsApi;
|
|
172
172
|
/** Access to Firebot's Twitch API wrappers (Helix, chat, auth, etc). */
|
|
173
|
-
twitch:
|
|
173
|
+
twitch: PluginTwitchApi;
|
|
174
174
|
/** This plugin's saved parameter values. */
|
|
175
|
-
parameters:
|
|
176
|
-
/** Two-way messaging between the
|
|
177
|
-
frontendCommunicator:
|
|
178
|
-
/** Notifications owned by this
|
|
179
|
-
notifications:
|
|
175
|
+
parameters: PluginParametersApi;
|
|
176
|
+
/** Two-way messaging between the plugin and the frontend. */
|
|
177
|
+
frontendCommunicator: PluginFrontendCommunicatorApi;
|
|
178
|
+
/** Notifications owned by this plugin. */
|
|
179
|
+
notifications: PluginNotificationsApi;
|
|
180
180
|
/** Access to installed plugins. */
|
|
181
|
-
plugins:
|
|
181
|
+
plugins: PluginPluginsApi;
|
|
182
182
|
/** Firebot internal web server functions. */
|
|
183
|
-
webServer:
|
|
183
|
+
webServer: PluginWebServerApi;
|
|
184
184
|
/** Factory for creating variables based on event data. */
|
|
185
|
-
variableFactory:
|
|
185
|
+
variableFactory: PluginVariableFactoryApi;
|
|
186
186
|
/** Factory for creating event filters. */
|
|
187
|
-
eventFilterFactory:
|
|
187
|
+
eventFilterFactory: PluginEventFilterFactoryApi;
|
|
188
188
|
}
|
package/types/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EffectType, PluginAdditionalEffectEvents } from "./effects";
|
|
2
2
|
import type { Trigger } from "./triggers";
|
|
3
3
|
import type { Awaitable } from "./util-types";
|
|
4
4
|
import type { PluginAdditionalVariableEvents, ReplaceVariable } from "./variables";
|
|
@@ -22,13 +22,13 @@ export type InstalledPluginConfig<Params extends GenericParameters = GenericPara
|
|
|
22
22
|
legacyImport?: boolean;
|
|
23
23
|
parameters: Params;
|
|
24
24
|
};
|
|
25
|
-
export type
|
|
25
|
+
export type PluginContext<Params extends FirebotParams = FirebotParams> = {
|
|
26
26
|
trigger?: Trigger;
|
|
27
27
|
parameters: Params;
|
|
28
28
|
};
|
|
29
|
-
type DynamicObject<T> = T | ((context:
|
|
30
|
-
type DynamicArray<T> = Array<T | ((context:
|
|
31
|
-
export type
|
|
29
|
+
type DynamicObject<T> = T | ((context: PluginContext) => Awaitable<T>);
|
|
30
|
+
type DynamicArray<T> = Array<T | ((context: PluginContext) => Awaitable<T>)>;
|
|
31
|
+
export type PluginType = "script" | "plugin";
|
|
32
32
|
interface ManifestDescription {
|
|
33
33
|
short: string;
|
|
34
34
|
long?: string;
|
|
@@ -92,25 +92,15 @@ export interface Manifest {
|
|
|
92
92
|
* allowing the plugin to provide custom parameter types that can be used in its own parametersSchema.
|
|
93
93
|
*/
|
|
94
94
|
initBeforeShowingParams?: boolean;
|
|
95
|
-
type: ScriptType;
|
|
96
95
|
}
|
|
97
|
-
|
|
98
|
-
success: boolean;
|
|
99
|
-
errorMessage?: string;
|
|
100
|
-
effects?: EffectList | Array<EffectInstance>;
|
|
101
|
-
onEffectsDone?: () => Awaitable<void>;
|
|
102
|
-
};
|
|
103
|
-
export interface ScriptBase<Params extends FirebotParams = FirebotParams> {
|
|
96
|
+
export interface PluginBase<Params extends FirebotParams = FirebotParams> {
|
|
104
97
|
manifest: Manifest;
|
|
105
98
|
parametersSchema?: FirebotParameterArray<Params>;
|
|
106
99
|
}
|
|
107
|
-
export interface
|
|
108
|
-
run: (context: ScriptContext<Params>) => Awaitable<void | EffectScriptResult>;
|
|
109
|
-
}
|
|
110
|
-
export interface Plugin<Params extends FirebotParams = FirebotParams> extends ScriptBase<Params> {
|
|
100
|
+
export interface Plugin<Params extends FirebotParams = FirebotParams> extends PluginBase<Params> {
|
|
111
101
|
/**
|
|
112
102
|
* Automatically handles registration with appropriate managers for definitions
|
|
113
|
-
* when the
|
|
103
|
+
* when the plugin is unloaded, definitions will automagically be unregistered.
|
|
114
104
|
*
|
|
115
105
|
* Array entries can be direct definitions or functions that return definitions
|
|
116
106
|
* (or promises of definitions) for dynamic registration based on context (e.g. parameter values).
|
|
@@ -133,16 +123,16 @@ export interface Plugin<Params extends FirebotParams = FirebotParams> extends Sc
|
|
|
133
123
|
additionalVariableEvents?: DynamicArray<PluginAdditionalVariableEvents>;
|
|
134
124
|
};
|
|
135
125
|
/** Called when the plugin is loaded */
|
|
136
|
-
onLoad?: (context:
|
|
126
|
+
onLoad?: (context: PluginContext<Params>, isInstalling?: boolean) => NoResult;
|
|
137
127
|
/** Called when Firebot is closing or plugin is disabled / removed */
|
|
138
|
-
onUnload?: (context:
|
|
128
|
+
onUnload?: (context: PluginContext<Params>, isUninstalling?: boolean) => NoResult;
|
|
139
129
|
/** Called when the user updates plugin-specific parameters */
|
|
140
|
-
onParameterUpdate?: (context:
|
|
130
|
+
onParameterUpdate?: (context: PluginContext<Params>) => NoResult;
|
|
141
131
|
}
|
|
142
|
-
export type
|
|
132
|
+
export type PluginDetails = Pick<PluginBase, "manifest" | "parametersSchema">;
|
|
143
133
|
export type InstalledPlugin = {
|
|
144
134
|
config: InstalledPluginConfig;
|
|
145
|
-
details:
|
|
135
|
+
details: PluginDetails;
|
|
146
136
|
};
|
|
147
137
|
type LegacyScriptParameters = Record<string, {
|
|
148
138
|
type: any;
|
|
@@ -204,5 +194,5 @@ export type LegacyCustomScript = {
|
|
|
204
194
|
parametersUpdated?: (parameters: Record<string, unknown>) => Awaitable<void>;
|
|
205
195
|
stop?: () => Awaitable<void>;
|
|
206
196
|
};
|
|
207
|
-
export type
|
|
208
|
-
export type {
|
|
197
|
+
export type FirebotPluginApi = import("./plugin-api").FirebotPluginApi;
|
|
198
|
+
export type { PluginLoggerApi as PluginLoggerApi, PluginWebhooksApi as PluginWebhooksApi } from "./plugin-api";
|
package/types/settings.d.ts
CHANGED
|
@@ -57,6 +57,10 @@ export type FirebotSettingsTypes = {
|
|
|
57
57
|
ClearChatFeedMode: "never" | "onlyStreamer" | "always";
|
|
58
58
|
ClearCustomScriptCache: boolean;
|
|
59
59
|
ConnectOnLaunch: boolean;
|
|
60
|
+
ControlDeckEnabled: boolean;
|
|
61
|
+
ControlDeckPin?: string;
|
|
62
|
+
ControlDeckOrientationMode: "dynamic" | "fixed";
|
|
63
|
+
ControlDeckDefaultDeckId?: string | null;
|
|
60
64
|
CopiedOverlayVersion: string;
|
|
61
65
|
DashboardLayout: {
|
|
62
66
|
dashboardViewerList: string;
|
package/types/triggers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FirebotChatMessage } from "./chat";
|
|
2
2
|
import type { CommandDefinition, SubCommand } from "./commands";
|
|
3
|
-
export type TriggerType = "command" | "custom_script" | "startup_script" | "api" | "event" | "hotkey" | "timer" | "scheduled_task" | "counter" | "preset" | "quick_action" | "manual" | "channel_reward" | "power_up" | "overlay_widget";
|
|
3
|
+
export type TriggerType = "command" | "custom_script" | "startup_script" | "api" | "event" | "hotkey" | "timer" | "scheduled_task" | "counter" | "preset" | "quick_action" | "control_deck" | "manual" | "channel_reward" | "power_up" | "overlay_widget";
|
|
4
4
|
export type TriggerMeta = {
|
|
5
5
|
triggerId?: string;
|
|
6
6
|
[x: string]: unknown;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ScriptBase, LegacyCustomScript, ScriptContext, ScriptDetails, EffectList } from "../../../types";
|
|
2
|
-
import { IEffectScriptExecutor, EffectScriptExecutionResult } from "./script-executor.interface";
|
|
3
|
-
/**
|
|
4
|
-
* Executor for new-spec EffectScripts (manifest.type === "script")
|
|
5
|
-
*/
|
|
6
|
-
export declare class EffectScriptExecutor extends IEffectScriptExecutor {
|
|
7
|
-
constructor();
|
|
8
|
-
canHandle(script: ScriptBase | LegacyCustomScript): boolean;
|
|
9
|
-
getScriptDetails(script: ScriptBase | LegacyCustomScript): ScriptDetails | null;
|
|
10
|
-
executeScript(script: ScriptBase | LegacyCustomScript, context: ScriptContext): Promise<EffectScriptExecutionResult>;
|
|
11
|
-
private isEffectScript;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Runs effects returned by a custom script and returns flow-control flags.
|
|
15
|
-
*/
|
|
16
|
-
export declare function runEffectsResult(effects: EffectList | Array<{
|
|
17
|
-
id?: string;
|
|
18
|
-
type?: string;
|
|
19
|
-
}>, context: ScriptContext, onEffectsDone?: () => unknown): Promise<{
|
|
20
|
-
stop: boolean;
|
|
21
|
-
bubbleStop: boolean;
|
|
22
|
-
} | undefined>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ScriptBase, LegacyCustomScript, ScriptContext, ScriptDetails } from "../../../types";
|
|
2
|
-
import { IEffectScriptExecutor, EffectScriptExecutionResult } from "./script-executor.interface";
|
|
3
|
-
/**
|
|
4
|
-
* Executor for legacy effect scripts (run function with no manifest or startupOnly !== true)
|
|
5
|
-
*/
|
|
6
|
-
export declare class LegacyEffectScriptExecutor extends IEffectScriptExecutor {
|
|
7
|
-
constructor();
|
|
8
|
-
canHandle(script: ScriptBase | LegacyCustomScript): Promise<boolean>;
|
|
9
|
-
getScriptDetails(script: ScriptBase | LegacyCustomScript): Promise<ScriptDetails | null>;
|
|
10
|
-
executeScript(script: ScriptBase | LegacyCustomScript, context: ScriptContext): Promise<EffectScriptExecutionResult>;
|
|
11
|
-
private isLegacy;
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ScriptBase, LegacyCustomScript, InstalledPluginConfig, ScriptDetails } from "../../../types";
|
|
2
|
-
import { IPluginExecutor, PluginExecutionResult } from "./script-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: ScriptBase | LegacyCustomScript): Promise<boolean>;
|
|
9
|
-
executePlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<PluginExecutionResult>;
|
|
10
|
-
unloadPlugin(script: ScriptBase | LegacyCustomScript): Promise<void>;
|
|
11
|
-
updateParameters(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<void>;
|
|
12
|
-
getScriptDetails(script: ScriptBase | LegacyCustomScript): Promise<ScriptDetails>;
|
|
13
|
-
private buildParameters;
|
|
14
|
-
private isLegacyScript;
|
|
15
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ScriptBase, LegacyCustomScript, Plugin, InstalledPluginConfig, ScriptDetails } from "../../../types";
|
|
2
|
-
import { IPluginExecutor, PluginRegistrations, PluginExecutionResult } from "./script-executor.interface";
|
|
3
|
-
import { ScriptApiContext } from "../script-api";
|
|
4
|
-
/**
|
|
5
|
-
* Executor for new-spec Plugins (manifest.type === "plugin")
|
|
6
|
-
*/
|
|
7
|
-
export declare class PluginExecutor extends IPluginExecutor {
|
|
8
|
-
constructor();
|
|
9
|
-
canHandle(script: ScriptBase | LegacyCustomScript): script is Plugin<import("../../../types").FirebotParams>;
|
|
10
|
-
getScriptDetails(script: ScriptBase | LegacyCustomScript): ScriptDetails | null;
|
|
11
|
-
executePlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, isInstalling?: boolean, ctx?: ScriptApiContext): Promise<PluginExecutionResult>;
|
|
12
|
-
unloadPlugin(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig, registrations?: PluginRegistrations, isUninstalling?: boolean): Promise<void>;
|
|
13
|
-
updateParameters(script: ScriptBase | LegacyCustomScript, config: InstalledPluginConfig): Promise<void>;
|
|
14
|
-
private registerAll;
|
|
15
|
-
private runUnregistrations;
|
|
16
|
-
private buildParameters;
|
|
17
|
-
private isPlugin;
|
|
18
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FirebotScriptApi } from "../../../types/script-api";
|
|
2
|
-
import type { ScriptApiContext } from "./context";
|
|
3
|
-
/**
|
|
4
|
-
* Composition root for the Firebot Script API
|
|
5
|
-
*/
|
|
6
|
-
export declare function buildScriptApi(ctx: ScriptApiContext): FirebotScriptApi;
|
|
7
|
-
export type { ScriptApiContext, ScriptApiContextSource } from "./context";
|
|
8
|
-
export { createScriptApiContext } from "./context";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function resolveScriptDataDir(scriptId: string): string;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ScriptStorageApi } from "../../../../types/script-api";
|
|
2
|
-
/**
|
|
3
|
-
* Simple per-script storage. Lets a script easily save/load JSON values or
|
|
4
|
-
* arbitrary files inside its own data directory.
|
|
5
|
-
*/
|
|
6
|
-
export declare const createStorageApi: import("../internal/define-namespace").ScriptApiNamespaceFactory<ScriptStorageApi>;
|