@crowbartools/firebot-types 5.67.0-alpha1 → 5.67.0-alpha1.2

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/README.md CHANGED
@@ -14,13 +14,12 @@ A `@types/node` peer dependency is required (the script API uses `Buffer` / `Buf
14
14
 
15
15
  ## Usage
16
16
 
17
- The default export is the runtime API object provided by Firebot. Named types live under the `@crowbartools/firebot-types/types` subpath.
17
+ The default export is the runtime API object provided by Firebot. Named types are re-exported from the package root and can be imported alongside the default in a single statement.
18
18
 
19
19
  ```ts
20
- import firebot from "@crowbartools/firebot-types";
21
- import type { Plugin, EffectScript } from "@crowbartools/firebot-types/types";
20
+ import firebot, { Plugin, EffectScript, Manifest } from "@crowbartools/firebot-types";
22
21
 
23
- export const manifest: Plugin["manifest"] = {
22
+ export const manifest: Manifest = {
24
23
  name: "My Plugin",
25
24
  version: "1.0.0",
26
25
  author: "you",
@@ -33,10 +32,16 @@ export function onLoad() {
33
32
  }
34
33
  ```
35
34
 
36
- CommonJS style works too:
35
+ Deep imports for less common types are also supported:
36
+
37
+ ```ts
38
+ import type { EffectHelperService } from "@crowbartools/firebot-types/types/ui/effect-helper-service";
39
+ ```
40
+
41
+ CommonJS style works too (requires `esModuleInterop` in your tsconfig):
37
42
 
38
43
  ```js
39
- const firebot = require("@crowbartools/firebot-types");
44
+ const firebot = require("@crowbartools/firebot-types").default;
40
45
  firebot.logger.info(firebot.version);
41
46
  ```
42
47
 
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  // Auto-generated by grunt publish-types. Do not edit by hand.
2
2
  import { FirebotScriptApi } from "./types/script-api";
3
3
 
4
+ export * from "./types";
5
+
4
6
  declare const firebot: FirebotScriptApi;
5
- export = firebot;
7
+ export default firebot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowbartools/firebot-types",
3
- "version": "5.67.0-alpha1",
3
+ "version": "5.67.0-alpha1.2",
4
4
  "description": "Type definitions and script API for Firebot custom scripts and plugins.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -21,9 +21,9 @@ export type InstalledPluginConfig<Params extends GenericParameters = GenericPara
21
21
  parameters: Params;
22
22
  };
23
23
 
24
- export type ScriptContext = {
24
+ export type ScriptContext<Params extends FirebotParams = FirebotParams> = {
25
25
  trigger?: Trigger;
26
- parameters: Record<string, unknown>;
26
+ parameters: Params;
27
27
  };
28
28
 
29
29
  type DynamicArray<T> = Array<T | ((context: ScriptContext) => Awaitable<T>)>;
@@ -80,12 +80,12 @@ export interface ScriptBase<Params extends FirebotParams = FirebotParams> {
80
80
 
81
81
  // if uninstalled is true, the script is being removed by the user, thus the script should remove related data files/assets
82
82
  // otherwise the script should assume firebot is closing or the script is being reloaded
83
- onUnload?: (context: ScriptContext, isUninstalling?: boolean) => NoResult;
83
+ onUnload?: (context: ScriptContext<Params>, isUninstalling?: boolean) => NoResult;
84
84
  }
85
85
 
86
86
  // Supplants the "Run Script" effect script functionality
87
87
  export interface EffectScript<Params extends FirebotParams = FirebotParams> extends ScriptBase<Params> {
88
- run: (context: ScriptContext) => Awaitable<void | EffectScriptResult>;
88
+ run: (context: ScriptContext<Params>) => Awaitable<void | EffectScriptResult>;
89
89
  }
90
90
 
91
91
  // Supplants the "Start up" script functionality
@@ -111,13 +111,13 @@ export interface Plugin<Params extends FirebotParams = FirebotParams> extends Sc
111
111
  };
112
112
 
113
113
  // Called when the script is loaded
114
- onLoad?: (context: ScriptContext, isInstalling?: boolean) => NoResult;
114
+ onLoad?: (context: ScriptContext<Params>, isInstalling?: boolean) => NoResult;
115
115
 
116
116
  // Called when firebot is closing or plugin is disabled / removed
117
- onUnload?: (context: ScriptContext, isUninstalling?: boolean) => NoResult;
117
+ onUnload?: (context: ScriptContext<Params>, isUninstalling?: boolean) => NoResult;
118
118
 
119
119
  // called when the user updates plugin-specific parameters
120
- onParameterUpdate?: (context: ScriptContext) => NoResult;
120
+ onParameterUpdate?: (context: ScriptContext<Params>) => NoResult;
121
121
  }
122
122
 
123
123
  export type ScriptDetails = Pick<ScriptBase, "manifest" | "parametersSchema">;