@zaflun/lumio-extension-types 0.1.0 → 0.3.0
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/dist/index.d.ts +174 -3
- package/dist/index.js +69 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -190,6 +190,145 @@ declare const configSchemaSchema: z.ZodArray<z.ZodObject<{
|
|
|
190
190
|
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
191
191
|
}, z.core.$strip>>;
|
|
192
192
|
type ConfigSchema = z.infer<typeof configSchemaSchema>;
|
|
193
|
+
declare const VALID_PLATFORMS: readonly ["twitch", "youtube", "kick", "trovo", "discord"];
|
|
194
|
+
declare const VALID_ROLES: readonly ["everyone", "follower", "subscriber", "vip", "moderator", "broadcaster"];
|
|
195
|
+
declare const triggerCommandSchema: z.ZodObject<{
|
|
196
|
+
name: z.ZodString;
|
|
197
|
+
description: z.ZodString;
|
|
198
|
+
cooldown_global: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
199
|
+
cooldown_user: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
200
|
+
min_role: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
201
|
+
everyone: "everyone";
|
|
202
|
+
follower: "follower";
|
|
203
|
+
subscriber: "subscriber";
|
|
204
|
+
vip: "vip";
|
|
205
|
+
moderator: "moderator";
|
|
206
|
+
broadcaster: "broadcaster";
|
|
207
|
+
}>>>;
|
|
208
|
+
discord_options: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
declare const triggerTimerSchema: z.ZodObject<{
|
|
211
|
+
name: z.ZodString;
|
|
212
|
+
interval: z.ZodNumber;
|
|
213
|
+
handler: z.ZodString;
|
|
214
|
+
}, z.core.$strip>;
|
|
215
|
+
declare const triggerConfigSchema: z.ZodObject<{
|
|
216
|
+
commands: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
description: z.ZodString;
|
|
219
|
+
cooldown_global: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
220
|
+
cooldown_user: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
221
|
+
min_role: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
222
|
+
everyone: "everyone";
|
|
223
|
+
follower: "follower";
|
|
224
|
+
subscriber: "subscriber";
|
|
225
|
+
vip: "vip";
|
|
226
|
+
moderator: "moderator";
|
|
227
|
+
broadcaster: "broadcaster";
|
|
228
|
+
}>>>;
|
|
229
|
+
discord_options: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
|
|
230
|
+
}, z.core.$strip>>>>;
|
|
231
|
+
keywords: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
232
|
+
patterns: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
233
|
+
events: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
234
|
+
timers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
235
|
+
name: z.ZodString;
|
|
236
|
+
interval: z.ZodNumber;
|
|
237
|
+
handler: z.ZodString;
|
|
238
|
+
}, z.core.$strip>>>>;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
type TriggerConfig = z.infer<typeof triggerConfigSchema>;
|
|
241
|
+
type TriggerCommand = z.infer<typeof triggerCommandSchema>;
|
|
242
|
+
declare const lumioExtensionConfigBaseSchema: z.ZodObject<{
|
|
243
|
+
extension_id: z.ZodString;
|
|
244
|
+
name: z.ZodString;
|
|
245
|
+
description: z.ZodOptional<z.ZodString>;
|
|
246
|
+
category: z.ZodEnum<{
|
|
247
|
+
widget: "widget";
|
|
248
|
+
extension: "extension";
|
|
249
|
+
overlay: "overlay";
|
|
250
|
+
bot_module: "bot_module";
|
|
251
|
+
integration: "integration";
|
|
252
|
+
theme: "theme";
|
|
253
|
+
}>;
|
|
254
|
+
version: z.ZodString;
|
|
255
|
+
targets: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
256
|
+
editor: "editor";
|
|
257
|
+
layer: "layer";
|
|
258
|
+
interactive: "interactive";
|
|
259
|
+
}>>>>;
|
|
260
|
+
server: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
261
|
+
permissions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
262
|
+
egress: z.ZodOptional<z.ZodObject<{
|
|
263
|
+
allow_hosts: z.ZodArray<z.ZodString>;
|
|
264
|
+
allow_ports: z.ZodArray<z.ZodNumber>;
|
|
265
|
+
}, z.core.$strip>>;
|
|
266
|
+
fonts: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
267
|
+
visibility: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
268
|
+
private: "private";
|
|
269
|
+
unlisted: "unlisted";
|
|
270
|
+
public: "public";
|
|
271
|
+
paid: "paid";
|
|
272
|
+
}>>>;
|
|
273
|
+
pricing: z.ZodDefault<z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
274
|
+
type: z.ZodLiteral<"free">;
|
|
275
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
276
|
+
type: z.ZodLiteral<"one_time">;
|
|
277
|
+
amount: z.ZodNumber;
|
|
278
|
+
currency: z.ZodString;
|
|
279
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
280
|
+
type: z.ZodLiteral<"subscription">;
|
|
281
|
+
amount: z.ZodNumber;
|
|
282
|
+
currency: z.ZodString;
|
|
283
|
+
interval: z.ZodString;
|
|
284
|
+
}, z.core.$strip>], "type">>>;
|
|
285
|
+
config_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
286
|
+
key: z.ZodString;
|
|
287
|
+
type: z.ZodEnum<{
|
|
288
|
+
string: "string";
|
|
289
|
+
number: "number";
|
|
290
|
+
boolean: "boolean";
|
|
291
|
+
color: "color";
|
|
292
|
+
select: "select";
|
|
293
|
+
}>;
|
|
294
|
+
label: z.ZodString;
|
|
295
|
+
default_value: z.ZodUnknown;
|
|
296
|
+
required: z.ZodBoolean;
|
|
297
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
298
|
+
}, z.core.$strip>>>;
|
|
299
|
+
platforms: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
300
|
+
twitch: "twitch";
|
|
301
|
+
youtube: "youtube";
|
|
302
|
+
kick: "kick";
|
|
303
|
+
trovo: "trovo";
|
|
304
|
+
discord: "discord";
|
|
305
|
+
}>>>;
|
|
306
|
+
triggers: z.ZodOptional<z.ZodObject<{
|
|
307
|
+
commands: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
308
|
+
name: z.ZodString;
|
|
309
|
+
description: z.ZodString;
|
|
310
|
+
cooldown_global: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
311
|
+
cooldown_user: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
312
|
+
min_role: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
313
|
+
everyone: "everyone";
|
|
314
|
+
follower: "follower";
|
|
315
|
+
subscriber: "subscriber";
|
|
316
|
+
vip: "vip";
|
|
317
|
+
moderator: "moderator";
|
|
318
|
+
broadcaster: "broadcaster";
|
|
319
|
+
}>>>;
|
|
320
|
+
discord_options: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
|
|
321
|
+
}, z.core.$strip>>>>;
|
|
322
|
+
keywords: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
323
|
+
patterns: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
324
|
+
events: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
325
|
+
timers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
326
|
+
name: z.ZodString;
|
|
327
|
+
interval: z.ZodNumber;
|
|
328
|
+
handler: z.ZodString;
|
|
329
|
+
}, z.core.$strip>>>>;
|
|
330
|
+
}, z.core.$strip>>;
|
|
331
|
+
}, z.core.$strip>;
|
|
193
332
|
declare const lumioExtensionConfigSchema: z.ZodObject<{
|
|
194
333
|
extension_id: z.ZodString;
|
|
195
334
|
name: z.ZodString;
|
|
@@ -203,11 +342,11 @@ declare const lumioExtensionConfigSchema: z.ZodObject<{
|
|
|
203
342
|
theme: "theme";
|
|
204
343
|
}>;
|
|
205
344
|
version: z.ZodString;
|
|
206
|
-
targets: z.ZodArray<z.ZodEnum<{
|
|
345
|
+
targets: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
207
346
|
editor: "editor";
|
|
208
347
|
layer: "layer";
|
|
209
348
|
interactive: "interactive";
|
|
210
|
-
}
|
|
349
|
+
}>>>>;
|
|
211
350
|
server: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
212
351
|
permissions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
213
352
|
egress: z.ZodOptional<z.ZodObject<{
|
|
@@ -247,6 +386,38 @@ declare const lumioExtensionConfigSchema: z.ZodObject<{
|
|
|
247
386
|
required: z.ZodBoolean;
|
|
248
387
|
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
249
388
|
}, z.core.$strip>>>;
|
|
389
|
+
platforms: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
390
|
+
twitch: "twitch";
|
|
391
|
+
youtube: "youtube";
|
|
392
|
+
kick: "kick";
|
|
393
|
+
trovo: "trovo";
|
|
394
|
+
discord: "discord";
|
|
395
|
+
}>>>;
|
|
396
|
+
triggers: z.ZodOptional<z.ZodObject<{
|
|
397
|
+
commands: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
398
|
+
name: z.ZodString;
|
|
399
|
+
description: z.ZodString;
|
|
400
|
+
cooldown_global: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
401
|
+
cooldown_user: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
402
|
+
min_role: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
403
|
+
everyone: "everyone";
|
|
404
|
+
follower: "follower";
|
|
405
|
+
subscriber: "subscriber";
|
|
406
|
+
vip: "vip";
|
|
407
|
+
moderator: "moderator";
|
|
408
|
+
broadcaster: "broadcaster";
|
|
409
|
+
}>>>;
|
|
410
|
+
discord_options: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
|
|
411
|
+
}, z.core.$strip>>>>;
|
|
412
|
+
keywords: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
413
|
+
patterns: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
414
|
+
events: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
415
|
+
timers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
416
|
+
name: z.ZodString;
|
|
417
|
+
interval: z.ZodNumber;
|
|
418
|
+
handler: z.ZodString;
|
|
419
|
+
}, z.core.$strip>>>>;
|
|
420
|
+
}, z.core.$strip>>;
|
|
250
421
|
}, z.core.$strip>;
|
|
251
422
|
type LumioExtensionConfig = z.infer<typeof lumioExtensionConfigSchema>;
|
|
252
423
|
|
|
@@ -299,4 +470,4 @@ declare const developerTeamRoleSchema: z.ZodEnum<{
|
|
|
299
470
|
}>;
|
|
300
471
|
type DeveloperTeamRole = z.infer<typeof developerTeamRoleSchema>;
|
|
301
472
|
|
|
302
|
-
export { CONFIG_FIELD_TYPES, type ConfigField, type ConfigSchema, DEVELOPER_TEAM_ROLES, DEVELOPER_TYPES, DEVELOPER_VERIFICATION_STATUSES, type DeveloperProfile, type DeveloperTeam, type DeveloperTeamRole, type DeveloperType, type DeveloperVerificationStatus, EXTENSION_CATEGORIES, EXTENSION_STATUSES, EXTENSION_VISIBILITIES, type Extension, type ExtensionCategory, type ExtensionInstall, type ExtensionPricing, type ExtensionReview, type ExtensionStatus, type ExtensionVersion, type ExtensionVisibility, type LumioExtensionConfig, PRICING_TYPES, type PricingType, VERSION_STATUSES, type VersionStatus, configFieldSchema, configSchemaSchema, developerProfileSchema, developerTeamRoleSchema, developerTeamSchema, developerTypeSchema, developerVerificationStatusSchema, extensionCategorySchema, extensionInstallSchema, extensionPricingSchema, extensionReviewSchema, extensionSchema, extensionStatusSchema, extensionVersionSchema, extensionVisibilitySchema, lumioExtensionConfigSchema, pricingTypeSchema, versionStatusSchema };
|
|
473
|
+
export { CONFIG_FIELD_TYPES, type ConfigField, type ConfigSchema, DEVELOPER_TEAM_ROLES, DEVELOPER_TYPES, DEVELOPER_VERIFICATION_STATUSES, type DeveloperProfile, type DeveloperTeam, type DeveloperTeamRole, type DeveloperType, type DeveloperVerificationStatus, EXTENSION_CATEGORIES, EXTENSION_STATUSES, EXTENSION_VISIBILITIES, type Extension, type ExtensionCategory, type ExtensionInstall, type ExtensionPricing, type ExtensionReview, type ExtensionStatus, type ExtensionVersion, type ExtensionVisibility, type LumioExtensionConfig, PRICING_TYPES, type PricingType, type TriggerCommand, type TriggerConfig, VALID_PLATFORMS, VALID_ROLES, VERSION_STATUSES, type VersionStatus, configFieldSchema, configSchemaSchema, developerProfileSchema, developerTeamRoleSchema, developerTeamSchema, developerTypeSchema, developerVerificationStatusSchema, extensionCategorySchema, extensionInstallSchema, extensionPricingSchema, extensionReviewSchema, extensionSchema, extensionStatusSchema, extensionVersionSchema, extensionVisibilitySchema, lumioExtensionConfigBaseSchema, lumioExtensionConfigSchema, pricingTypeSchema, triggerCommandSchema, triggerConfigSchema, triggerTimerSchema, versionStatusSchema };
|
package/dist/index.js
CHANGED
|
@@ -135,13 +135,48 @@ var configFieldSchema = z2.object({
|
|
|
135
135
|
options: z2.array(z2.string()).optional()
|
|
136
136
|
});
|
|
137
137
|
var configSchemaSchema = z2.array(configFieldSchema);
|
|
138
|
-
var
|
|
138
|
+
var VALID_PLATFORMS = [
|
|
139
|
+
"twitch",
|
|
140
|
+
"youtube",
|
|
141
|
+
"kick",
|
|
142
|
+
"trovo",
|
|
143
|
+
"discord"
|
|
144
|
+
];
|
|
145
|
+
var VALID_ROLES = [
|
|
146
|
+
"everyone",
|
|
147
|
+
"follower",
|
|
148
|
+
"subscriber",
|
|
149
|
+
"vip",
|
|
150
|
+
"moderator",
|
|
151
|
+
"broadcaster"
|
|
152
|
+
];
|
|
153
|
+
var triggerCommandSchema = z2.object({
|
|
154
|
+
name: z2.string().min(1).max(32).regex(/^[a-zA-Z0-9_]+$/),
|
|
155
|
+
description: z2.string(),
|
|
156
|
+
cooldown_global: z2.number().int().min(0).optional().default(0),
|
|
157
|
+
cooldown_user: z2.number().int().min(0).optional().default(0),
|
|
158
|
+
min_role: z2.enum(VALID_ROLES).optional().default("everyone"),
|
|
159
|
+
discord_options: z2.array(z2.unknown()).optional().default([])
|
|
160
|
+
});
|
|
161
|
+
var triggerTimerSchema = z2.object({
|
|
162
|
+
name: z2.string(),
|
|
163
|
+
interval: z2.number().int().min(60),
|
|
164
|
+
handler: z2.string()
|
|
165
|
+
});
|
|
166
|
+
var triggerConfigSchema = z2.object({
|
|
167
|
+
commands: z2.array(triggerCommandSchema).max(20).optional().default([]),
|
|
168
|
+
keywords: z2.array(z2.string().min(3)).max(50).optional().default([]),
|
|
169
|
+
patterns: z2.array(z2.string().max(200)).max(10).optional().default([]),
|
|
170
|
+
events: z2.array(z2.string()).optional().default([]),
|
|
171
|
+
timers: z2.array(triggerTimerSchema).optional().default([])
|
|
172
|
+
});
|
|
173
|
+
var lumioExtensionConfigBaseSchema = z2.object({
|
|
139
174
|
extension_id: z2.string(),
|
|
140
175
|
name: z2.string(),
|
|
141
176
|
description: z2.string().optional(),
|
|
142
177
|
category: extensionCategorySchema,
|
|
143
178
|
version: z2.string(),
|
|
144
|
-
targets: z2.array(z2.enum(["editor", "layer", "interactive"])).
|
|
179
|
+
targets: z2.array(z2.enum(["editor", "layer", "interactive"])).optional().default([]),
|
|
145
180
|
server: z2.boolean().optional().default(false),
|
|
146
181
|
permissions: z2.array(z2.string()).optional().default([]),
|
|
147
182
|
egress: z2.object({
|
|
@@ -151,7 +186,32 @@ var lumioExtensionConfigSchema = z2.object({
|
|
|
151
186
|
fonts: z2.array(z2.string()).optional().default([]),
|
|
152
187
|
visibility: extensionVisibilitySchema.optional().default("private"),
|
|
153
188
|
pricing: extensionPricingSchema.optional().default({ type: "free" }),
|
|
154
|
-
config_schema: configSchemaSchema.optional()
|
|
189
|
+
config_schema: configSchemaSchema.optional(),
|
|
190
|
+
platforms: z2.array(z2.enum(VALID_PLATFORMS)).optional(),
|
|
191
|
+
triggers: triggerConfigSchema.optional()
|
|
192
|
+
});
|
|
193
|
+
var lumioExtensionConfigSchema = lumioExtensionConfigBaseSchema.superRefine((data, ctx) => {
|
|
194
|
+
if (data.category !== "bot_module" && data.targets.length === 0) {
|
|
195
|
+
ctx.addIssue({
|
|
196
|
+
code: "custom",
|
|
197
|
+
message: "Non-bot_module extensions must have at least one target",
|
|
198
|
+
path: ["targets"]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (data.triggers && data.category !== "bot_module") {
|
|
202
|
+
ctx.addIssue({
|
|
203
|
+
code: "custom",
|
|
204
|
+
message: "Only bot_module extensions can have triggers",
|
|
205
|
+
path: ["triggers"]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (data.category === "bot_module" && (!data.platforms || data.platforms.length === 0)) {
|
|
209
|
+
ctx.addIssue({
|
|
210
|
+
code: "custom",
|
|
211
|
+
message: "bot_module extensions must specify platforms",
|
|
212
|
+
path: ["platforms"]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
155
215
|
});
|
|
156
216
|
|
|
157
217
|
// src/developer.ts
|
|
@@ -199,6 +259,8 @@ export {
|
|
|
199
259
|
EXTENSION_STATUSES,
|
|
200
260
|
EXTENSION_VISIBILITIES,
|
|
201
261
|
PRICING_TYPES,
|
|
262
|
+
VALID_PLATFORMS,
|
|
263
|
+
VALID_ROLES,
|
|
202
264
|
VERSION_STATUSES,
|
|
203
265
|
configFieldSchema,
|
|
204
266
|
configSchemaSchema,
|
|
@@ -215,7 +277,11 @@ export {
|
|
|
215
277
|
extensionStatusSchema,
|
|
216
278
|
extensionVersionSchema,
|
|
217
279
|
extensionVisibilitySchema,
|
|
280
|
+
lumioExtensionConfigBaseSchema,
|
|
218
281
|
lumioExtensionConfigSchema,
|
|
219
282
|
pricingTypeSchema,
|
|
283
|
+
triggerCommandSchema,
|
|
284
|
+
triggerConfigSchema,
|
|
285
|
+
triggerTimerSchema,
|
|
220
286
|
versionStatusSchema
|
|
221
287
|
};
|