@rocketman-streamkit/types 1.0.0 → 1.0.3
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 +42 -0
- package/addon.d.ts +24 -2
- package/package.json +2 -1
- package/tsconfig.json +10 -0
package/README.md
CHANGED
|
@@ -8,6 +8,18 @@ Use this package when developing worker addons outside the StreamKit+ repository
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
API reference, manifest format, permissions, and addon categories are published in a separate repository — one branch per StreamKit+ version:
|
|
14
|
+
|
|
15
|
+
**[github.com/RocketMan-StreamKit/types](https://github.com/RocketMan-StreamKit/types)**
|
|
16
|
+
|
|
17
|
+
Open the branch that matches your target app version (for example `1.0.0`) and start from [`index.md`](https://github.com/RocketMan-StreamKit/types/blob/1.0.0/index.md).
|
|
18
|
+
|
|
19
|
+
This npm package provides **TypeScript typings only**; the docs repo is the full written guide.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
11
23
|
## Installation
|
|
12
24
|
|
|
13
25
|
```bash
|
|
@@ -59,6 +71,17 @@ Alternatively, reference the package types field directly:
|
|
|
59
71
|
|
|
60
72
|
Do **not** add `@types/node` — addon workers are not Node.js processes.
|
|
61
73
|
|
|
74
|
+
Do **not** include `"DOM"` in `compilerOptions.lib` — sandbox globals such as `URL`, `console`, and `status` intentionally replace browser typings.
|
|
75
|
+
|
|
76
|
+
The npm package ships `tsconfig.json`; you can extend it in your addon project:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"extends": "./node_modules/@rocketman-streamkit/types/tsconfig.json",
|
|
81
|
+
"include": ["./**/*.ts"]
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
62
85
|
---
|
|
63
86
|
|
|
64
87
|
## Examples
|
|
@@ -102,6 +125,25 @@ await GenerateConfig([
|
|
|
102
125
|
const params = await api.config.getParams<{ channel_id: string; enabled: boolean }>();
|
|
103
126
|
```
|
|
104
127
|
|
|
128
|
+
### App UI locale (`LANG`)
|
|
129
|
+
|
|
130
|
+
Read-only bridge to the user's language setting in StreamKit+ (`en`, `ru`, `uk`). No permission required:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
const labels = {
|
|
134
|
+
en: 'Connected',
|
|
135
|
+
ru: 'Подключено',
|
|
136
|
+
uk: 'Підключено',
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
status.Update({ current: 'online', message: { [LANG.current]: labels[LANG.current] } });
|
|
140
|
+
|
|
141
|
+
const sub = LANG.onChangeLanguage((lang) => {
|
|
142
|
+
console.log('UI locale changed:', lang);
|
|
143
|
+
});
|
|
144
|
+
// later: sub.Destroy();
|
|
145
|
+
```
|
|
146
|
+
|
|
105
147
|
### Outbound HTTP request
|
|
106
148
|
|
|
107
149
|
Requires `NETWORK_REQUEST` permission in `manifest.json`:
|
package/addon.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// AUTO-GENERATED — do not edit manually
|
|
2
2
|
// Source: backend/addons/list/integrations/index.ts -> GenerateContext()
|
|
3
|
+
// Typecheck with lib: ["ES2020"] only (no DOM) — see tsconfig.json in this folder.
|
|
3
4
|
|
|
4
5
|
declare global {
|
|
5
6
|
type URLSearchParamsInit = | string
|
|
@@ -8,7 +9,7 @@ declare global {
|
|
|
8
9
|
| ReadonlyArray<[string, string]>
|
|
9
10
|
| URLSearchParams;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
class URLSearchParams {
|
|
12
13
|
constructor(init?: URLSearchParamsInit);
|
|
13
14
|
static from(native: URLSearchParams): URLSearchParams;
|
|
14
15
|
append(name: string, value: string): void;
|
|
@@ -27,7 +28,7 @@ declare global {
|
|
|
27
28
|
size: number;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
class UrlCustom {
|
|
31
32
|
constructor(url: string | UrlCustom, base?: string | UrlCustom);
|
|
32
33
|
static canParse(url: string, base?: string | UrlCustom): boolean;
|
|
33
34
|
static parse(url: string, base?: string | UrlCustom): UrlCustom | null;
|
|
@@ -185,6 +186,27 @@ declare global {
|
|
|
185
186
|
|
|
186
187
|
type AddonConfigSchema = AddonConfigSchemaEntry[];
|
|
187
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Read-only bridge to the app UI locale (`en`, `ru`, or `uk`).
|
|
191
|
+
Use to pick strings from per-locale objects; does not expose app translation keys.
|
|
192
|
+
* @example const label = { en: 'Connected', ru: 'Подключено', uk: 'Підключено' };
|
|
193
|
+
status.Update({ current: 'online', message: { [LANG.current]: label[LANG.current] } });
|
|
194
|
+
* @example const sub = LANG.onChangeLanguage((lang) => {
|
|
195
|
+
console.log('UI locale changed to', lang);
|
|
196
|
+
});
|
|
197
|
+
// later: sub.Destroy();
|
|
198
|
+
*/
|
|
199
|
+
var LANG: {
|
|
200
|
+
/**
|
|
201
|
+
* Current app UI locale key. Updated when the user changes language in settings.
|
|
202
|
+
*/
|
|
203
|
+
current: "en" | "ru" | "uk";
|
|
204
|
+
/**
|
|
205
|
+
* Subscribe to app UI locale changes. Returns `{ Destroy }` to unsubscribe.
|
|
206
|
+
* @param cb - Called with the new locale key (`en`, `ru`, or `uk`).
|
|
207
|
+
*/
|
|
208
|
+
onChangeLanguage: (cb: (lang: "en" | "ru" | "uk") => void) => { Destroy: () => void; };
|
|
209
|
+
};
|
|
188
210
|
/**
|
|
189
211
|
* The port of the local web server.
|
|
190
212
|
* @example const port = WEB_SERVER_PORT;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocketman-streamkit/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "TypeScript declarations for the StreamKit+ integration addon sandbox API",
|
|
5
5
|
"types": "addon.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"addon.d.ts",
|
|
8
|
+
"tsconfig.json",
|
|
8
9
|
"README.md"
|
|
9
10
|
],
|
|
10
11
|
"keywords": [
|