@zaflun/lumio-protocol 0.1.1 → 0.2.4
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/CHANGELOG.md +45 -0
- package/README.md +3 -3
- package/dist/index.d.ts +67 -5
- package/dist/index.js +44 -5
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@zaflun/lumio-protocol` are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## 0.2.4
|
|
9
|
+
|
|
10
|
+
Wire-format types for the Lumio Extension Platform — the contract for
|
|
11
|
+
communication between extension iframes/workers and the Lumio host. Ships as an
|
|
12
|
+
ESM build with generated `.d.ts` declarations; `zod` is a runtime dependency for
|
|
13
|
+
the validated schemas.
|
|
14
|
+
|
|
15
|
+
### Exports
|
|
16
|
+
|
|
17
|
+
- **Events** (`src/events.ts`)
|
|
18
|
+
- `LUMIO_EVENT_TYPES` — 54 platform event types across Twitch, YouTube, Kick,
|
|
19
|
+
Trovo, Spotify, StreamElements, and per-platform + cross-platform chat, with
|
|
20
|
+
`LumioEventType` and the `lumioEventTypeSchema` Zod enum.
|
|
21
|
+
- `ACTION_TYPES` — 21 action types (Chat, OBS, Spotify, Events, Overlay), with
|
|
22
|
+
`LumioActionType` and `lumioActionTypeSchema`.
|
|
23
|
+
- Sound-system event payloads `SoundPlayEvent` / `SoundStopEvent`.
|
|
24
|
+
- `STORAGE_SCOPES` (`instance`, `overlay`, `account`, `global`) with
|
|
25
|
+
`StorageScope` and `storageScopeSchema`.
|
|
26
|
+
- **Messages** (`src/messages.ts`)
|
|
27
|
+
- Theme schemas (`themeSchema`, colors/fonts/border-radius) and
|
|
28
|
+
`extensionConfigSchema`.
|
|
29
|
+
- `MESSAGE_TYPES` — 10 host↔iframe message types, individual per-type Zod
|
|
30
|
+
schemas, and the `lumioMessageSchema` discriminated union with `LumioMessage`.
|
|
31
|
+
- **Components** (`src/components.ts`)
|
|
32
|
+
- `LUMIO_COMPONENT_TYPES` — 30 serialized-UI component types with
|
|
33
|
+
`LumioComponentType` and the `LumioComponentNode` tree interface.
|
|
34
|
+
- JSON-RPC 2.0 wire types (`JsonRpcRequest` / `JsonRpcResponse` /
|
|
35
|
+
`JsonRpcNotification`), worker↔host param interfaces, the `Sound` data type,
|
|
36
|
+
and the `WORKER_METHODS` / `HOST_METHODS` method-name constants (including
|
|
37
|
+
`sound.play` / `sound.stop` / `sound.list`).
|
|
38
|
+
|
|
39
|
+
### Notes
|
|
40
|
+
|
|
41
|
+
- Adds the sound-system surface (`SoundPlayEvent` / `SoundStopEvent`, `Sound`,
|
|
42
|
+
and the `SOUND_PLAY` / `SOUND_STOP` / `SOUND_LIST` worker methods) that mirrors
|
|
43
|
+
the host sound-management contract.
|
|
44
|
+
- First release published with a changelog. Prior public releases: `0.2.3`,
|
|
45
|
+
`0.1.1`, `0.1.0`.
|
package/README.md
CHANGED
|
@@ -10,10 +10,10 @@ npm install @zaflun/lumio-protocol
|
|
|
10
10
|
|
|
11
11
|
## What's included
|
|
12
12
|
|
|
13
|
-
- **
|
|
13
|
+
- **54 Event Types** — Twitch, YouTube, Kick, Trovo, Spotify, StreamElements, Chat
|
|
14
14
|
- **21 Action Types** — Chat, OBS, Spotify, Events, Overlay
|
|
15
15
|
- **Message Schemas** — JSON-RPC 2.0 wire format (Zod validated)
|
|
16
|
-
- **Component Types** — `LumioComponentNode` for serialized UI trees
|
|
16
|
+
- **30 Component Types** — `LumioComponentNode` for serialized UI trees
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
@@ -35,4 +35,4 @@ const eventType: LumioEventType = "twitch:cheer";
|
|
|
35
35
|
|
|
36
36
|
## License
|
|
37
37
|
|
|
38
|
-
MIT © [
|
|
38
|
+
MIT © [zaflun](https://withzaflun.com)
|
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ declare const extensionConfigSchema: z.ZodObject<{
|
|
|
58
58
|
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
59
59
|
}, z.core.$strip>;
|
|
60
60
|
type ExtensionConfig = z.infer<typeof extensionConfigSchema>;
|
|
61
|
-
declare const MESSAGE_TYPES: readonly ["INIT", "CONFIG_UPDATE", "EVENT", "ACTION", "STORAGE_UPDATE", "THEME_CHANGE", "READY", "ERROR"];
|
|
61
|
+
declare const MESSAGE_TYPES: readonly ["INIT", "CONFIG_UPDATE", "EVENT", "ACTION", "STORAGE_UPDATE", "THEME_CHANGE", "READY", "ERROR", "NODE_CONFIG_REQUEST", "NODE_CONFIG_UPDATE"];
|
|
62
62
|
type MessageType = (typeof MESSAGE_TYPES)[number];
|
|
63
63
|
declare const initMessageSchema: z.ZodObject<{
|
|
64
64
|
type: z.ZodLiteral<"INIT">;
|
|
@@ -169,6 +169,19 @@ declare const errorMessageSchema: z.ZodObject<{
|
|
|
169
169
|
message: z.ZodString;
|
|
170
170
|
}, z.core.$strip>;
|
|
171
171
|
type ErrorMessage = z.infer<typeof errorMessageSchema>;
|
|
172
|
+
declare const nodeConfigRequestMessageSchema: z.ZodObject<{
|
|
173
|
+
type: z.ZodLiteral<"NODE_CONFIG_REQUEST">;
|
|
174
|
+
node_id: z.ZodString;
|
|
175
|
+
install_id: z.ZodString;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
type NodeConfigRequestMessage = z.infer<typeof nodeConfigRequestMessageSchema>;
|
|
178
|
+
declare const nodeConfigUpdateMessageSchema: z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"NODE_CONFIG_UPDATE">;
|
|
180
|
+
node_id: z.ZodString;
|
|
181
|
+
install_id: z.ZodString;
|
|
182
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
type NodeConfigUpdateMessage = z.infer<typeof nodeConfigUpdateMessageSchema>;
|
|
172
185
|
declare const lumioMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
173
186
|
type: z.ZodLiteral<"INIT">;
|
|
174
187
|
config: z.ZodObject<{
|
|
@@ -262,6 +275,15 @@ declare const lumioMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
262
275
|
type: z.ZodLiteral<"ERROR">;
|
|
263
276
|
code: z.ZodString;
|
|
264
277
|
message: z.ZodString;
|
|
278
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
279
|
+
type: z.ZodLiteral<"NODE_CONFIG_REQUEST">;
|
|
280
|
+
node_id: z.ZodString;
|
|
281
|
+
install_id: z.ZodString;
|
|
282
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
283
|
+
type: z.ZodLiteral<"NODE_CONFIG_UPDATE">;
|
|
284
|
+
node_id: z.ZodString;
|
|
285
|
+
install_id: z.ZodString;
|
|
286
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
265
287
|
}, z.core.$strip>], "type">;
|
|
266
288
|
type LumioMessage = z.infer<typeof lumioMessageSchema>;
|
|
267
289
|
|
|
@@ -348,20 +370,37 @@ declare const lumioActionTypeSchema: z.ZodEnum<{
|
|
|
348
370
|
"events:emit": "events:emit";
|
|
349
371
|
"overlay:update_layer": "overlay:update_layer";
|
|
350
372
|
}>;
|
|
373
|
+
interface SoundPlayEvent {
|
|
374
|
+
sound_id: string;
|
|
375
|
+
stream_path: string;
|
|
376
|
+
name: string;
|
|
377
|
+
volume: number;
|
|
378
|
+
target?: {
|
|
379
|
+
type: "widget" | "overlay";
|
|
380
|
+
id: string;
|
|
381
|
+
} | null;
|
|
382
|
+
}
|
|
383
|
+
interface SoundStopEvent {
|
|
384
|
+
sound_id: string;
|
|
385
|
+
target?: {
|
|
386
|
+
type: "widget" | "overlay";
|
|
387
|
+
id: string;
|
|
388
|
+
} | null;
|
|
389
|
+
}
|
|
351
390
|
declare const STORAGE_SCOPES: readonly ["instance", "overlay", "account", "global"];
|
|
352
391
|
type StorageScope = (typeof STORAGE_SCOPES)[number];
|
|
353
392
|
declare const storageScopeSchema: z.ZodEnum<{
|
|
354
|
-
instance: "instance";
|
|
355
393
|
overlay: "overlay";
|
|
394
|
+
instance: "instance";
|
|
356
395
|
account: "account";
|
|
357
396
|
global: "global";
|
|
358
397
|
}>;
|
|
359
398
|
|
|
360
|
-
declare const LUMIO_COMPONENT_TYPES: readonly ["Box", "VStack", "HStack", "CompactView", "List", "Text", "Image", "Button", "Toggle", "TextField", "TextArea", "NumberField", "Dropdown", "Slider"];
|
|
399
|
+
declare const LUMIO_COMPONENT_TYPES: readonly ["Box", "VStack", "HStack", "CompactView", "List", "Text", "Image", "Button", "Toggle", "TextField", "TextArea", "NumberField", "Dropdown", "Slider", "IconPicker", "IconDisplay", "EditorInput", "EditorTextarea", "EditorSelect", "EditorCheckbox", "EditorSlider", "EditorColorPicker", "EditorGroup", "EditorLabel", "EditorDivider", "EditorInfo", "EditorFontRow", "EditorButton", "EditorFontPicker", "EditorChannelRow"];
|
|
361
400
|
type LumioComponentType = (typeof LUMIO_COMPONENT_TYPES)[number];
|
|
362
401
|
interface LumioComponentNode {
|
|
363
402
|
_id: string;
|
|
364
|
-
type: LumioComponentType;
|
|
403
|
+
type: LumioComponentType | (string & {});
|
|
365
404
|
props: Record<string, unknown>;
|
|
366
405
|
children: LumioComponentNode[];
|
|
367
406
|
}
|
|
@@ -410,6 +449,23 @@ interface ServerMutationParams {
|
|
|
410
449
|
fn: string;
|
|
411
450
|
params: Record<string, unknown>;
|
|
412
451
|
}
|
|
452
|
+
interface SoundPlayParams {
|
|
453
|
+
sound_id: string;
|
|
454
|
+
volume?: number;
|
|
455
|
+
}
|
|
456
|
+
interface SoundStopParams {
|
|
457
|
+
sound_id: string;
|
|
458
|
+
}
|
|
459
|
+
interface SoundGetListParams {
|
|
460
|
+
}
|
|
461
|
+
interface Sound {
|
|
462
|
+
id: string;
|
|
463
|
+
name: string;
|
|
464
|
+
file_size: number;
|
|
465
|
+
duration_ms: number | null;
|
|
466
|
+
created_at: string;
|
|
467
|
+
source_extension_name: string | null;
|
|
468
|
+
}
|
|
413
469
|
interface LifecycleInitParams {
|
|
414
470
|
extensionId: string;
|
|
415
471
|
installId: string;
|
|
@@ -443,6 +499,11 @@ declare const WORKER_METHODS: {
|
|
|
443
499
|
readonly STORAGE_GET: "storage.get";
|
|
444
500
|
readonly SERVER_QUERY: "server.query";
|
|
445
501
|
readonly SERVER_MUTATION: "server.mutation";
|
|
502
|
+
readonly CONFIG_UPDATE: "config.update";
|
|
503
|
+
readonly UI_ACTION: "ui.action";
|
|
504
|
+
readonly SOUND_PLAY: "sound.play";
|
|
505
|
+
readonly SOUND_STOP: "sound.stop";
|
|
506
|
+
readonly SOUND_LIST: "sound.list";
|
|
446
507
|
};
|
|
447
508
|
declare const HOST_METHODS: {
|
|
448
509
|
readonly LIFECYCLE_INIT: "lifecycle.init";
|
|
@@ -451,6 +512,7 @@ declare const HOST_METHODS: {
|
|
|
451
512
|
readonly EVENT_PLATFORM: "event.platform";
|
|
452
513
|
readonly STORAGE_UPDATE: "storage.update";
|
|
453
514
|
readonly THEME_CHANGE: "theme.change";
|
|
515
|
+
readonly CONFIG_UPDATE: "config.update";
|
|
454
516
|
};
|
|
455
517
|
|
|
456
|
-
export { ACTION_TYPES, type ActionMessage, type ConfigUpdateMessage, type ErrorMessage, type EventCallbackParams, type EventMessage, type EventPlatformParams, type ExtensionConfig, HOST_METHODS, type InitMessage, type JsonRpcMessage, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, LUMIO_COMPONENT_TYPES, LUMIO_EVENT_TYPES, type LifecycleDestroyParams, type LifecycleInitParams, type LumioActionType, type LumioComponentNode, type LumioComponentType, type LumioEventType, type LumioMessage, MESSAGE_TYPES, type MessageType, type ReadyMessage, STORAGE_SCOPES, type ServerMutationParams, type ServerQueryParams, type StorageGetParams, type StorageScope, type StorageSetParams, type StorageUpdateMessage, type StorageUpdateParams, type Theme, type ThemeBorderRadius, type ThemeChangeMessage, type ThemeChangeParams, type ThemeColors, type ThemeFonts, type UiKeyframesParams, type UiReadyParams, type UiRenderParams, WORKER_METHODS, actionMessageSchema, configUpdateMessageSchema, errorMessageSchema, eventMessageSchema, extensionConfigSchema, initMessageSchema, lumioActionTypeSchema, lumioEventTypeSchema, lumioMessageSchema, readyMessageSchema, storageScopeSchema, storageUpdateMessageSchema, themeBorderRadiusSchema, themeChangeMessageSchema, themeColorsSchema, themeFontsSchema, themeSchema };
|
|
518
|
+
export { ACTION_TYPES, type ActionMessage, type ConfigUpdateMessage, type ErrorMessage, type EventCallbackParams, type EventMessage, type EventPlatformParams, type ExtensionConfig, HOST_METHODS, type InitMessage, type JsonRpcMessage, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, LUMIO_COMPONENT_TYPES, LUMIO_EVENT_TYPES, type LifecycleDestroyParams, type LifecycleInitParams, type LumioActionType, type LumioComponentNode, type LumioComponentType, type LumioEventType, type LumioMessage, MESSAGE_TYPES, type MessageType, type NodeConfigRequestMessage, type NodeConfigUpdateMessage, type ReadyMessage, STORAGE_SCOPES, type ServerMutationParams, type ServerQueryParams, type Sound, type SoundGetListParams, type SoundPlayEvent, type SoundPlayParams, type SoundStopEvent, type SoundStopParams, type StorageGetParams, type StorageScope, type StorageSetParams, type StorageUpdateMessage, type StorageUpdateParams, type Theme, type ThemeBorderRadius, type ThemeChangeMessage, type ThemeChangeParams, type ThemeColors, type ThemeFonts, type UiKeyframesParams, type UiReadyParams, type UiRenderParams, WORKER_METHODS, actionMessageSchema, configUpdateMessageSchema, errorMessageSchema, eventMessageSchema, extensionConfigSchema, initMessageSchema, lumioActionTypeSchema, lumioEventTypeSchema, lumioMessageSchema, nodeConfigRequestMessageSchema, nodeConfigUpdateMessageSchema, readyMessageSchema, storageScopeSchema, storageUpdateMessageSchema, themeBorderRadiusSchema, themeChangeMessageSchema, themeColorsSchema, themeFontsSchema, themeSchema };
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,9 @@ var MESSAGE_TYPES = [
|
|
|
41
41
|
"STORAGE_UPDATE",
|
|
42
42
|
"THEME_CHANGE",
|
|
43
43
|
"READY",
|
|
44
|
-
"ERROR"
|
|
44
|
+
"ERROR",
|
|
45
|
+
"NODE_CONFIG_REQUEST",
|
|
46
|
+
"NODE_CONFIG_UPDATE"
|
|
45
47
|
];
|
|
46
48
|
var initMessageSchema = z.object({
|
|
47
49
|
type: z.literal("INIT"),
|
|
@@ -80,6 +82,17 @@ var errorMessageSchema = z.object({
|
|
|
80
82
|
code: z.string(),
|
|
81
83
|
message: z.string()
|
|
82
84
|
});
|
|
85
|
+
var nodeConfigRequestMessageSchema = z.object({
|
|
86
|
+
type: z.literal("NODE_CONFIG_REQUEST"),
|
|
87
|
+
node_id: z.string(),
|
|
88
|
+
install_id: z.string()
|
|
89
|
+
});
|
|
90
|
+
var nodeConfigUpdateMessageSchema = z.object({
|
|
91
|
+
type: z.literal("NODE_CONFIG_UPDATE"),
|
|
92
|
+
node_id: z.string(),
|
|
93
|
+
install_id: z.string(),
|
|
94
|
+
config: z.record(z.string(), z.unknown())
|
|
95
|
+
});
|
|
83
96
|
var lumioMessageSchema = z.discriminatedUnion("type", [
|
|
84
97
|
initMessageSchema,
|
|
85
98
|
configUpdateMessageSchema,
|
|
@@ -88,7 +101,9 @@ var lumioMessageSchema = z.discriminatedUnion("type", [
|
|
|
88
101
|
storageUpdateMessageSchema,
|
|
89
102
|
themeChangeMessageSchema,
|
|
90
103
|
readyMessageSchema,
|
|
91
|
-
errorMessageSchema
|
|
104
|
+
errorMessageSchema,
|
|
105
|
+
nodeConfigRequestMessageSchema,
|
|
106
|
+
nodeConfigUpdateMessageSchema
|
|
92
107
|
]);
|
|
93
108
|
|
|
94
109
|
// src/events.ts
|
|
@@ -210,7 +225,23 @@ var LUMIO_COMPONENT_TYPES = [
|
|
|
210
225
|
"TextArea",
|
|
211
226
|
"NumberField",
|
|
212
227
|
"Dropdown",
|
|
213
|
-
"Slider"
|
|
228
|
+
"Slider",
|
|
229
|
+
"IconPicker",
|
|
230
|
+
"IconDisplay",
|
|
231
|
+
"EditorInput",
|
|
232
|
+
"EditorTextarea",
|
|
233
|
+
"EditorSelect",
|
|
234
|
+
"EditorCheckbox",
|
|
235
|
+
"EditorSlider",
|
|
236
|
+
"EditorColorPicker",
|
|
237
|
+
"EditorGroup",
|
|
238
|
+
"EditorLabel",
|
|
239
|
+
"EditorDivider",
|
|
240
|
+
"EditorInfo",
|
|
241
|
+
"EditorFontRow",
|
|
242
|
+
"EditorButton",
|
|
243
|
+
"EditorFontPicker",
|
|
244
|
+
"EditorChannelRow"
|
|
214
245
|
];
|
|
215
246
|
var WORKER_METHODS = {
|
|
216
247
|
UI_RENDER: "ui.render",
|
|
@@ -219,7 +250,12 @@ var WORKER_METHODS = {
|
|
|
219
250
|
STORAGE_SET: "storage.set",
|
|
220
251
|
STORAGE_GET: "storage.get",
|
|
221
252
|
SERVER_QUERY: "server.query",
|
|
222
|
-
SERVER_MUTATION: "server.mutation"
|
|
253
|
+
SERVER_MUTATION: "server.mutation",
|
|
254
|
+
CONFIG_UPDATE: "config.update",
|
|
255
|
+
UI_ACTION: "ui.action",
|
|
256
|
+
SOUND_PLAY: "sound.play",
|
|
257
|
+
SOUND_STOP: "sound.stop",
|
|
258
|
+
SOUND_LIST: "sound.list"
|
|
223
259
|
};
|
|
224
260
|
var HOST_METHODS = {
|
|
225
261
|
LIFECYCLE_INIT: "lifecycle.init",
|
|
@@ -227,7 +263,8 @@ var HOST_METHODS = {
|
|
|
227
263
|
EVENT_CALLBACK: "event.callback",
|
|
228
264
|
EVENT_PLATFORM: "event.platform",
|
|
229
265
|
STORAGE_UPDATE: "storage.update",
|
|
230
|
-
THEME_CHANGE: "theme.change"
|
|
266
|
+
THEME_CHANGE: "theme.change",
|
|
267
|
+
CONFIG_UPDATE: "config.update"
|
|
231
268
|
};
|
|
232
269
|
export {
|
|
233
270
|
ACTION_TYPES,
|
|
@@ -246,6 +283,8 @@ export {
|
|
|
246
283
|
lumioActionTypeSchema,
|
|
247
284
|
lumioEventTypeSchema,
|
|
248
285
|
lumioMessageSchema,
|
|
286
|
+
nodeConfigRequestMessageSchema,
|
|
287
|
+
nodeConfigUpdateMessageSchema,
|
|
249
288
|
readyMessageSchema,
|
|
250
289
|
storageScopeSchema,
|
|
251
290
|
storageUpdateMessageSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zaflun/lumio-protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Wire-format types for Lumio extension iframe-to-host communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"CHANGELOG.md"
|
|
19
20
|
],
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"zod": "^4.3.6"
|