@gameslate/sdk 0.0.0-stage → 0.3.1

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -2
  3. package/bin/gameslate-plugin.mjs +26 -0
  4. package/build/build-plugin.mjs +127 -0
  5. package/lib/assets.d.ts +1788 -0
  6. package/lib/assets.js +107 -0
  7. package/lib/bytes.d.ts +33 -0
  8. package/lib/bytes.js +89 -0
  9. package/lib/catalogue.d.ts +1228 -0
  10. package/lib/catalogue.js +305 -0
  11. package/lib/chips.d.ts +18 -0
  12. package/lib/chips.js +28 -0
  13. package/lib/condition.d.ts +58 -0
  14. package/lib/condition.js +125 -0
  15. package/lib/index.d.ts +16 -0
  16. package/lib/index.js +16 -0
  17. package/lib/logic.d.ts +68 -0
  18. package/lib/logic.js +194 -0
  19. package/lib/navigation.d.ts +139 -0
  20. package/lib/navigation.js +38 -0
  21. package/lib/pack.d.ts +933 -0
  22. package/lib/pack.js +29 -0
  23. package/lib/pins.d.ts +19 -0
  24. package/lib/pins.js +35 -0
  25. package/lib/plugin/contract.d.ts +111 -0
  26. package/lib/plugin/contract.js +1 -0
  27. package/lib/plugin/index.d.ts +3 -0
  28. package/lib/plugin/index.js +9 -0
  29. package/lib/plugin/sandbox-guest.d.ts +12 -0
  30. package/lib/plugin/sandbox-guest.js +128 -0
  31. package/lib/plugin/seqlock.d.ts +8 -0
  32. package/lib/plugin/seqlock.js +19 -0
  33. package/lib/plugin-manifest.d.ts +131 -0
  34. package/lib/plugin-manifest.js +54 -0
  35. package/lib/plugins-api.d.ts +445 -0
  36. package/lib/plugins-api.js +38 -0
  37. package/lib/registry.d.ts +2231 -0
  38. package/lib/registry.js +170 -0
  39. package/lib/sandbox-protocol.d.ts +1363 -0
  40. package/lib/sandbox-protocol.js +39 -0
  41. package/lib/status.d.ts +24 -0
  42. package/lib/status.js +75 -0
  43. package/lib/types.d.ts +2684 -0
  44. package/lib/types.js +282 -0
  45. package/lib/views.d.ts +204 -0
  46. package/lib/views.js +35 -0
  47. package/package.json +53 -3
@@ -0,0 +1,445 @@
1
+ import { z } from 'zod';
2
+ export declare const PluginViewSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ version: z.ZodString;
6
+ /** built and tested with another core version */
7
+ untested: z.ZodBoolean;
8
+ features: z.ZodObject<{
9
+ live: z.ZodObject<{
10
+ available: z.ZodBoolean;
11
+ on: z.ZodBoolean;
12
+ }, "strip", z.ZodTypeAny, {
13
+ available: boolean;
14
+ on: boolean;
15
+ }, {
16
+ available: boolean;
17
+ on: boolean;
18
+ }>;
19
+ assets: z.ZodObject<{
20
+ available: z.ZodBoolean;
21
+ on: z.ZodBoolean;
22
+ }, "strip", z.ZodTypeAny, {
23
+ available: boolean;
24
+ on: boolean;
25
+ }, {
26
+ available: boolean;
27
+ on: boolean;
28
+ }>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ assets: {
31
+ available: boolean;
32
+ on: boolean;
33
+ };
34
+ live: {
35
+ available: boolean;
36
+ on: boolean;
37
+ };
38
+ }, {
39
+ assets: {
40
+ available: boolean;
41
+ on: boolean;
42
+ };
43
+ live: {
44
+ available: boolean;
45
+ on: boolean;
46
+ };
47
+ }>;
48
+ games: z.ZodArray<z.ZodObject<{
49
+ id: z.ZodString;
50
+ title: z.ZodString;
51
+ /** folders the player can build this game's maps from (only those that exist) */
52
+ sources: z.ZodArray<z.ZodObject<{
53
+ label: z.ZodString;
54
+ folder: z.ZodString;
55
+ }, "strip", z.ZodTypeAny, {
56
+ label: string;
57
+ folder: string;
58
+ }, {
59
+ label: string;
60
+ folder: string;
61
+ }>, "many">;
62
+ }, "strip", z.ZodTypeAny, {
63
+ id: string;
64
+ title: string;
65
+ sources: {
66
+ label: string;
67
+ folder: string;
68
+ }[];
69
+ }, {
70
+ id: string;
71
+ title: string;
72
+ sources: {
73
+ label: string;
74
+ folder: string;
75
+ }[];
76
+ }>, "many">;
77
+ }, "strip", z.ZodTypeAny, {
78
+ id: string;
79
+ name: string;
80
+ games: {
81
+ id: string;
82
+ title: string;
83
+ sources: {
84
+ label: string;
85
+ folder: string;
86
+ }[];
87
+ }[];
88
+ version: string;
89
+ untested: boolean;
90
+ features: {
91
+ assets: {
92
+ available: boolean;
93
+ on: boolean;
94
+ };
95
+ live: {
96
+ available: boolean;
97
+ on: boolean;
98
+ };
99
+ };
100
+ }, {
101
+ id: string;
102
+ name: string;
103
+ games: {
104
+ id: string;
105
+ title: string;
106
+ sources: {
107
+ label: string;
108
+ folder: string;
109
+ }[];
110
+ }[];
111
+ version: string;
112
+ untested: boolean;
113
+ features: {
114
+ assets: {
115
+ available: boolean;
116
+ on: boolean;
117
+ };
118
+ live: {
119
+ available: boolean;
120
+ on: boolean;
121
+ };
122
+ };
123
+ }>;
124
+ export type PluginView = z.infer<typeof PluginViewSchema>;
125
+ export type PluginFeature = keyof PluginView['features'];
126
+ export declare const JobStatusSchema: z.ZodObject<{
127
+ id: z.ZodNumber;
128
+ gameId: z.ZodString;
129
+ folder: z.ZodString;
130
+ state: z.ZodEnum<["running", "done", "failed", "cancelled"]>;
131
+ total: z.ZodNumber;
132
+ done: z.ZodNumber;
133
+ built: z.ZodNumber;
134
+ failed: z.ZodNumber;
135
+ current: z.ZodOptional<z.ZodString>;
136
+ notes: z.ZodArray<z.ZodString, "many">;
137
+ failures: z.ZodArray<z.ZodObject<{
138
+ label: z.ZodString;
139
+ error: z.ZodString;
140
+ }, "strip", z.ZodTypeAny, {
141
+ label: string;
142
+ error: string;
143
+ }, {
144
+ label: string;
145
+ error: string;
146
+ }>, "many">;
147
+ error: z.ZodOptional<z.ZodString>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ id: number;
150
+ done: number;
151
+ failed: number;
152
+ gameId: string;
153
+ state: "done" | "failed" | "running" | "cancelled";
154
+ notes: string[];
155
+ folder: string;
156
+ total: number;
157
+ built: number;
158
+ failures: {
159
+ label: string;
160
+ error: string;
161
+ }[];
162
+ current?: string | undefined;
163
+ error?: string | undefined;
164
+ }, {
165
+ id: number;
166
+ done: number;
167
+ failed: number;
168
+ gameId: string;
169
+ state: "done" | "failed" | "running" | "cancelled";
170
+ notes: string[];
171
+ folder: string;
172
+ total: number;
173
+ built: number;
174
+ failures: {
175
+ label: string;
176
+ error: string;
177
+ }[];
178
+ current?: string | undefined;
179
+ error?: string | undefined;
180
+ }>;
181
+ export type JobStatus = z.infer<typeof JobStatusSchema>;
182
+ export declare const PluginsResponseSchema: z.ZodObject<{
183
+ plugins: z.ZodArray<z.ZodObject<{
184
+ id: z.ZodString;
185
+ name: z.ZodString;
186
+ version: z.ZodString;
187
+ /** built and tested with another core version */
188
+ untested: z.ZodBoolean;
189
+ features: z.ZodObject<{
190
+ live: z.ZodObject<{
191
+ available: z.ZodBoolean;
192
+ on: z.ZodBoolean;
193
+ }, "strip", z.ZodTypeAny, {
194
+ available: boolean;
195
+ on: boolean;
196
+ }, {
197
+ available: boolean;
198
+ on: boolean;
199
+ }>;
200
+ assets: z.ZodObject<{
201
+ available: z.ZodBoolean;
202
+ on: z.ZodBoolean;
203
+ }, "strip", z.ZodTypeAny, {
204
+ available: boolean;
205
+ on: boolean;
206
+ }, {
207
+ available: boolean;
208
+ on: boolean;
209
+ }>;
210
+ }, "strip", z.ZodTypeAny, {
211
+ assets: {
212
+ available: boolean;
213
+ on: boolean;
214
+ };
215
+ live: {
216
+ available: boolean;
217
+ on: boolean;
218
+ };
219
+ }, {
220
+ assets: {
221
+ available: boolean;
222
+ on: boolean;
223
+ };
224
+ live: {
225
+ available: boolean;
226
+ on: boolean;
227
+ };
228
+ }>;
229
+ games: z.ZodArray<z.ZodObject<{
230
+ id: z.ZodString;
231
+ title: z.ZodString;
232
+ /** folders the player can build this game's maps from (only those that exist) */
233
+ sources: z.ZodArray<z.ZodObject<{
234
+ label: z.ZodString;
235
+ folder: z.ZodString;
236
+ }, "strip", z.ZodTypeAny, {
237
+ label: string;
238
+ folder: string;
239
+ }, {
240
+ label: string;
241
+ folder: string;
242
+ }>, "many">;
243
+ }, "strip", z.ZodTypeAny, {
244
+ id: string;
245
+ title: string;
246
+ sources: {
247
+ label: string;
248
+ folder: string;
249
+ }[];
250
+ }, {
251
+ id: string;
252
+ title: string;
253
+ sources: {
254
+ label: string;
255
+ folder: string;
256
+ }[];
257
+ }>, "many">;
258
+ }, "strip", z.ZodTypeAny, {
259
+ id: string;
260
+ name: string;
261
+ games: {
262
+ id: string;
263
+ title: string;
264
+ sources: {
265
+ label: string;
266
+ folder: string;
267
+ }[];
268
+ }[];
269
+ version: string;
270
+ untested: boolean;
271
+ features: {
272
+ assets: {
273
+ available: boolean;
274
+ on: boolean;
275
+ };
276
+ live: {
277
+ available: boolean;
278
+ on: boolean;
279
+ };
280
+ };
281
+ }, {
282
+ id: string;
283
+ name: string;
284
+ games: {
285
+ id: string;
286
+ title: string;
287
+ sources: {
288
+ label: string;
289
+ folder: string;
290
+ }[];
291
+ }[];
292
+ version: string;
293
+ untested: boolean;
294
+ features: {
295
+ assets: {
296
+ available: boolean;
297
+ on: boolean;
298
+ };
299
+ live: {
300
+ available: boolean;
301
+ on: boolean;
302
+ };
303
+ };
304
+ }>, "many">;
305
+ job: z.ZodNullable<z.ZodObject<{
306
+ id: z.ZodNumber;
307
+ gameId: z.ZodString;
308
+ folder: z.ZodString;
309
+ state: z.ZodEnum<["running", "done", "failed", "cancelled"]>;
310
+ total: z.ZodNumber;
311
+ done: z.ZodNumber;
312
+ built: z.ZodNumber;
313
+ failed: z.ZodNumber;
314
+ current: z.ZodOptional<z.ZodString>;
315
+ notes: z.ZodArray<z.ZodString, "many">;
316
+ failures: z.ZodArray<z.ZodObject<{
317
+ label: z.ZodString;
318
+ error: z.ZodString;
319
+ }, "strip", z.ZodTypeAny, {
320
+ label: string;
321
+ error: string;
322
+ }, {
323
+ label: string;
324
+ error: string;
325
+ }>, "many">;
326
+ error: z.ZodOptional<z.ZodString>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ id: number;
329
+ done: number;
330
+ failed: number;
331
+ gameId: string;
332
+ state: "done" | "failed" | "running" | "cancelled";
333
+ notes: string[];
334
+ folder: string;
335
+ total: number;
336
+ built: number;
337
+ failures: {
338
+ label: string;
339
+ error: string;
340
+ }[];
341
+ current?: string | undefined;
342
+ error?: string | undefined;
343
+ }, {
344
+ id: number;
345
+ done: number;
346
+ failed: number;
347
+ gameId: string;
348
+ state: "done" | "failed" | "running" | "cancelled";
349
+ notes: string[];
350
+ folder: string;
351
+ total: number;
352
+ built: number;
353
+ failures: {
354
+ label: string;
355
+ error: string;
356
+ }[];
357
+ current?: string | undefined;
358
+ error?: string | undefined;
359
+ }>>;
360
+ }, "strip", z.ZodTypeAny, {
361
+ plugins: {
362
+ id: string;
363
+ name: string;
364
+ games: {
365
+ id: string;
366
+ title: string;
367
+ sources: {
368
+ label: string;
369
+ folder: string;
370
+ }[];
371
+ }[];
372
+ version: string;
373
+ untested: boolean;
374
+ features: {
375
+ assets: {
376
+ available: boolean;
377
+ on: boolean;
378
+ };
379
+ live: {
380
+ available: boolean;
381
+ on: boolean;
382
+ };
383
+ };
384
+ }[];
385
+ job: {
386
+ id: number;
387
+ done: number;
388
+ failed: number;
389
+ gameId: string;
390
+ state: "done" | "failed" | "running" | "cancelled";
391
+ notes: string[];
392
+ folder: string;
393
+ total: number;
394
+ built: number;
395
+ failures: {
396
+ label: string;
397
+ error: string;
398
+ }[];
399
+ current?: string | undefined;
400
+ error?: string | undefined;
401
+ } | null;
402
+ }, {
403
+ plugins: {
404
+ id: string;
405
+ name: string;
406
+ games: {
407
+ id: string;
408
+ title: string;
409
+ sources: {
410
+ label: string;
411
+ folder: string;
412
+ }[];
413
+ }[];
414
+ version: string;
415
+ untested: boolean;
416
+ features: {
417
+ assets: {
418
+ available: boolean;
419
+ on: boolean;
420
+ };
421
+ live: {
422
+ available: boolean;
423
+ on: boolean;
424
+ };
425
+ };
426
+ }[];
427
+ job: {
428
+ id: number;
429
+ done: number;
430
+ failed: number;
431
+ gameId: string;
432
+ state: "done" | "failed" | "running" | "cancelled";
433
+ notes: string[];
434
+ folder: string;
435
+ total: number;
436
+ built: number;
437
+ failures: {
438
+ label: string;
439
+ error: string;
440
+ }[];
441
+ current?: string | undefined;
442
+ error?: string | undefined;
443
+ } | null;
444
+ }>;
445
+ export type PluginsResponse = z.infer<typeof PluginsResponseSchema>;
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ /*
3
+ * The daemon's plugin API for the cog (GET /api/plugins and the switch and job endpoints): what's
4
+ * installed, each plugin's feature switches, and the extraction job, if any.
5
+ */
6
+ const Feature = z.object({ available: z.boolean(), on: z.boolean() });
7
+ export const PluginViewSchema = z.object({
8
+ id: z.string(),
9
+ name: z.string(),
10
+ version: z.string(),
11
+ /** built and tested with another core version */
12
+ untested: z.boolean(),
13
+ features: z.object({ live: Feature, assets: Feature }),
14
+ games: z.array(z.object({
15
+ id: z.string(),
16
+ title: z.string(),
17
+ /** folders the player can build this game's maps from (only those that exist) */
18
+ sources: z.array(z.object({ label: z.string(), folder: z.string() })),
19
+ })),
20
+ });
21
+ export const JobStatusSchema = z.object({
22
+ id: z.number().int(),
23
+ gameId: z.string(),
24
+ folder: z.string(),
25
+ state: z.enum(['running', 'done', 'failed', 'cancelled']),
26
+ total: z.number().int(),
27
+ done: z.number().int(),
28
+ built: z.number().int(),
29
+ failed: z.number().int(),
30
+ current: z.string().optional(),
31
+ notes: z.array(z.string()),
32
+ failures: z.array(z.object({ label: z.string(), error: z.string() })),
33
+ error: z.string().optional(),
34
+ });
35
+ export const PluginsResponseSchema = z.object({
36
+ plugins: z.array(PluginViewSchema),
37
+ job: JobStatusSchema.nullable(),
38
+ });