@dreamboard-games/api-client 0.1.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.
Files changed (87) hide show
  1. package/LICENSE +89 -0
  2. package/NOTICE +1 -0
  3. package/dist/@tanstack/react-query.gen.d.ts +1037 -0
  4. package/dist/@tanstack/react-query.gen.d.ts.map +1 -0
  5. package/dist/@tanstack/react-query.gen.js +1016 -0
  6. package/dist/client/client.gen.d.ts +3 -0
  7. package/dist/client/client.gen.d.ts.map +1 -0
  8. package/dist/client/client.gen.js +235 -0
  9. package/dist/client/index.d.ts +9 -0
  10. package/dist/client/index.d.ts.map +1 -0
  11. package/dist/client/index.js +6 -0
  12. package/dist/client/types.gen.d.ts +118 -0
  13. package/dist/client/types.gen.d.ts.map +1 -0
  14. package/dist/client/types.gen.js +2 -0
  15. package/dist/client/utils.gen.d.ts +34 -0
  16. package/dist/client/utils.gen.d.ts.map +1 -0
  17. package/dist/client/utils.gen.js +233 -0
  18. package/dist/client.gen.d.ts +13 -0
  19. package/dist/client.gen.d.ts.map +1 -0
  20. package/dist/client.gen.js +3 -0
  21. package/dist/core/auth.gen.d.ts +19 -0
  22. package/dist/core/auth.gen.d.ts.map +1 -0
  23. package/dist/core/auth.gen.js +14 -0
  24. package/dist/core/bodySerializer.gen.d.ts +26 -0
  25. package/dist/core/bodySerializer.gen.d.ts.map +1 -0
  26. package/dist/core/bodySerializer.gen.js +57 -0
  27. package/dist/core/params.gen.d.ts +44 -0
  28. package/dist/core/params.gen.d.ts.map +1 -0
  29. package/dist/core/params.gen.js +100 -0
  30. package/dist/core/pathSerializer.gen.d.ts +34 -0
  31. package/dist/core/pathSerializer.gen.d.ts.map +1 -0
  32. package/dist/core/pathSerializer.gen.js +114 -0
  33. package/dist/core/queryKeySerializer.gen.d.ts +19 -0
  34. package/dist/core/queryKeySerializer.gen.d.ts.map +1 -0
  35. package/dist/core/queryKeySerializer.gen.js +99 -0
  36. package/dist/core/serverSentEvents.gen.d.ts +72 -0
  37. package/dist/core/serverSentEvents.gen.d.ts.map +1 -0
  38. package/dist/core/serverSentEvents.gen.js +136 -0
  39. package/dist/core/types.gen.d.ts +79 -0
  40. package/dist/core/types.gen.d.ts.map +1 -0
  41. package/dist/core/types.gen.js +2 -0
  42. package/dist/core/utils.gen.d.ts +20 -0
  43. package/dist/core/utils.gen.d.ts.map +1 -0
  44. package/dist/core/utils.gen.js +87 -0
  45. package/dist/generated/problem-types.gen.d.ts +26 -0
  46. package/dist/generated/problem-types.gen.d.ts.map +1 -0
  47. package/dist/generated/problem-types.gen.js +23 -0
  48. package/dist/index.d.ts +5 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +4 -0
  51. package/dist/sdk.gen.d.ts +364 -0
  52. package/dist/sdk.gen.d.ts.map +1 -0
  53. package/dist/sdk.gen.js +634 -0
  54. package/dist/source-revisions.d.ts +27 -0
  55. package/dist/source-revisions.d.ts.map +1 -0
  56. package/dist/source-revisions.js +174 -0
  57. package/dist/storage-paths.d.ts +17 -0
  58. package/dist/storage-paths.d.ts.map +1 -0
  59. package/dist/storage-paths.js +16 -0
  60. package/dist/types.gen.d.ts +5007 -0
  61. package/dist/types.gen.d.ts.map +1 -0
  62. package/dist/types.gen.js +2 -0
  63. package/dist/zod.gen.d.ts +37398 -0
  64. package/dist/zod.gen.d.ts.map +1 -0
  65. package/dist/zod.gen.js +2396 -0
  66. package/package.json +105 -0
  67. package/src/@tanstack/react-query.gen.ts +1114 -0
  68. package/src/client/client.gen.ts +311 -0
  69. package/src/client/index.ts +25 -0
  70. package/src/client/types.gen.ts +241 -0
  71. package/src/client/utils.gen.ts +332 -0
  72. package/src/client.gen.ts +16 -0
  73. package/src/core/auth.gen.ts +42 -0
  74. package/src/core/bodySerializer.gen.ts +100 -0
  75. package/src/core/params.gen.ts +176 -0
  76. package/src/core/pathSerializer.gen.ts +181 -0
  77. package/src/core/queryKeySerializer.gen.ts +136 -0
  78. package/src/core/serverSentEvents.gen.ts +265 -0
  79. package/src/core/types.gen.ts +118 -0
  80. package/src/core/utils.gen.ts +143 -0
  81. package/src/generated/problem-types.gen.ts +35 -0
  82. package/src/index.ts +7 -0
  83. package/src/sdk.gen.ts +709 -0
  84. package/src/source-revisions.ts +283 -0
  85. package/src/storage-paths.ts +19 -0
  86. package/src/types.gen.ts +5486 -0
  87. package/src/zod.gen.ts +2705 -0
@@ -0,0 +1,1016 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { queryOptions } from '@tanstack/react-query';
3
+ import { client } from '../client.gen.js';
4
+ import { addSeat, assignSeat, cancelGameRun, createAuthoringState, createDemoGameSession, createGame, createGameRule, createGameRun, createSession, createSessionFromReducerSnapshot, createSourceBlobUploadSession, createSourceRevision, deleteGame, describePlayerAction, disconnectSessionEvents, downloadGameSources, ensureDevCompile, extractGameSpec, fetchUiBundle, findManifests, getActiveJob, getApiVersion, getAuthoringHead, getCompiledResult, getDemoGame, getDemoGameThumbnail, getGame, getGameBySlug, getGameRule, getGameScripts, getGameSources, getJob, getLatestCompiledResult, getLatestGameRule, getManifest, getPlayerActionTargets, getSessionByShortCode, getSessionSnapshot, healthCheck, listCompiledResults, listDemoGames, listGameRules, listGames, listPlayerActions, queryWorkshopRulebook, queueCompiledResultJob, removeSeat, restoreHistory, saveManifest, startGame, submitPlayerAction, unassignSeat, updateGame, updateSeat, validatePlayerAction } from '../sdk.gen.js';
5
+ const createQueryKey = (id, options, infinite, tags) => {
6
+ const params = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl };
7
+ if (infinite) {
8
+ params._infinite = infinite;
9
+ }
10
+ if (tags) {
11
+ params.tags = tags;
12
+ }
13
+ if (options?.body) {
14
+ params.body = options.body;
15
+ }
16
+ if (options?.headers) {
17
+ params.headers = options.headers;
18
+ }
19
+ if (options?.path) {
20
+ params.path = options.path;
21
+ }
22
+ if (options?.query) {
23
+ params.query = options.query;
24
+ }
25
+ return [params];
26
+ };
27
+ export const healthCheckQueryKey = (options) => createQueryKey('healthCheck', options);
28
+ /**
29
+ * Health check endpoint
30
+ *
31
+ * Returns a simple health check message
32
+ */
33
+ export const healthCheckOptions = (options) => queryOptions({
34
+ queryFn: async ({ queryKey, signal }) => {
35
+ const { data } = await healthCheck({
36
+ ...options,
37
+ ...queryKey[0],
38
+ signal,
39
+ throwOnError: true
40
+ });
41
+ return data;
42
+ },
43
+ queryKey: healthCheckQueryKey(options)
44
+ });
45
+ export const getApiVersionQueryKey = (options) => createQueryKey('getApiVersion', options);
46
+ /**
47
+ * Get backend version metadata
48
+ *
49
+ * Returns backend revision metadata and the UI SDK version expected by the backend runtime.
50
+ */
51
+ export const getApiVersionOptions = (options) => queryOptions({
52
+ queryFn: async ({ queryKey, signal }) => {
53
+ const { data } = await getApiVersion({
54
+ ...options,
55
+ ...queryKey[0],
56
+ signal,
57
+ throwOnError: true
58
+ });
59
+ return data;
60
+ },
61
+ queryKey: getApiVersionQueryKey(options)
62
+ });
63
+ export const listGamesQueryKey = (options) => createQueryKey('listGames', options);
64
+ /**
65
+ * List user's games
66
+ *
67
+ * Retrieve a list of all games owned by the authenticated user
68
+ */
69
+ export const listGamesOptions = (options) => queryOptions({
70
+ queryFn: async ({ queryKey, signal }) => {
71
+ const { data } = await listGames({
72
+ ...options,
73
+ ...queryKey[0],
74
+ signal,
75
+ throwOnError: true
76
+ });
77
+ return data;
78
+ },
79
+ queryKey: listGamesQueryKey(options)
80
+ });
81
+ /**
82
+ * Create a new game
83
+ *
84
+ * Create a new game definition
85
+ */
86
+ export const createGameMutation = (options) => {
87
+ const mutationOptions = {
88
+ mutationFn: async (fnOptions) => {
89
+ const { data } = await createGame({
90
+ ...options,
91
+ ...fnOptions,
92
+ throwOnError: true
93
+ });
94
+ return data;
95
+ }
96
+ };
97
+ return mutationOptions;
98
+ };
99
+ /**
100
+ * Extract a structured game spec
101
+ *
102
+ * Extract a normalized structured game spec from pasted rule text.
103
+ */
104
+ export const extractGameSpecMutation = (options) => {
105
+ const mutationOptions = {
106
+ mutationFn: async (fnOptions) => {
107
+ const { data } = await extractGameSpec({
108
+ ...options,
109
+ ...fnOptions,
110
+ throwOnError: true
111
+ });
112
+ return data;
113
+ }
114
+ };
115
+ return mutationOptions;
116
+ };
117
+ /**
118
+ * Delete game
119
+ *
120
+ * Delete a game definition permanently
121
+ */
122
+ export const deleteGameMutation = (options) => {
123
+ const mutationOptions = {
124
+ mutationFn: async (fnOptions) => {
125
+ const { data } = await deleteGame({
126
+ ...options,
127
+ ...fnOptions,
128
+ throwOnError: true
129
+ });
130
+ return data;
131
+ }
132
+ };
133
+ return mutationOptions;
134
+ };
135
+ export const getGameQueryKey = (options) => createQueryKey('getGame', options);
136
+ /**
137
+ * Get game by ID
138
+ *
139
+ * Retrieve a specific game definition by its ID
140
+ */
141
+ export const getGameOptions = (options) => queryOptions({
142
+ queryFn: async ({ queryKey, signal }) => {
143
+ const { data } = await getGame({
144
+ ...options,
145
+ ...queryKey[0],
146
+ signal,
147
+ throwOnError: true
148
+ });
149
+ return data;
150
+ },
151
+ queryKey: getGameQueryKey(options)
152
+ });
153
+ /**
154
+ * Update game
155
+ *
156
+ * Update an existing game definition
157
+ */
158
+ export const updateGameMutation = (options) => {
159
+ const mutationOptions = {
160
+ mutationFn: async (fnOptions) => {
161
+ const { data } = await updateGame({
162
+ ...options,
163
+ ...fnOptions,
164
+ throwOnError: true
165
+ });
166
+ return data;
167
+ }
168
+ };
169
+ return mutationOptions;
170
+ };
171
+ export const getGameBySlugQueryKey = (options) => createQueryKey('getGameBySlug', options);
172
+ /**
173
+ * Get game by slug
174
+ *
175
+ * Retrieve a specific game definition by its slug
176
+ */
177
+ export const getGameBySlugOptions = (options) => queryOptions({
178
+ queryFn: async ({ queryKey, signal }) => {
179
+ const { data } = await getGameBySlug({
180
+ ...options,
181
+ ...queryKey[0],
182
+ signal,
183
+ throwOnError: true
184
+ });
185
+ return data;
186
+ },
187
+ queryKey: getGameBySlugQueryKey(options)
188
+ });
189
+ export const queryWorkshopRulebookQueryKey = (options) => createQueryKey('queryWorkshopRulebook', options);
190
+ /**
191
+ * Query rulebook text by title
192
+ *
193
+ * Search ranked rulebook candidates for the provided title, try up to the top 3 matches, and return extracted text from the first valid PDF found.
194
+ */
195
+ export const queryWorkshopRulebookOptions = (options) => queryOptions({
196
+ queryFn: async ({ queryKey, signal }) => {
197
+ const { data } = await queryWorkshopRulebook({
198
+ ...options,
199
+ ...queryKey[0],
200
+ signal,
201
+ throwOnError: true
202
+ });
203
+ return data;
204
+ },
205
+ queryKey: queryWorkshopRulebookQueryKey(options)
206
+ });
207
+ export const findManifestsQueryKey = (options) => createQueryKey('findManifests', options);
208
+ /**
209
+ * Find manifests for game
210
+ *
211
+ * Retrieve a list of manifest versions for a game, ordered by version descending (newest first)
212
+ */
213
+ export const findManifestsOptions = (options) => queryOptions({
214
+ queryFn: async ({ queryKey, signal }) => {
215
+ const { data } = await findManifests({
216
+ ...options,
217
+ ...queryKey[0],
218
+ signal,
219
+ throwOnError: true
220
+ });
221
+ return data;
222
+ },
223
+ queryKey: findManifestsQueryKey(options)
224
+ });
225
+ /**
226
+ * Save game manifest
227
+ *
228
+ * Create a new versioned manifest for a game. Each save creates a new version with automatic version numbering.
229
+ */
230
+ export const saveManifestMutation = (options) => {
231
+ const mutationOptions = {
232
+ mutationFn: async (fnOptions) => {
233
+ const { data } = await saveManifest({
234
+ ...options,
235
+ ...fnOptions,
236
+ throwOnError: true
237
+ });
238
+ return data;
239
+ }
240
+ };
241
+ return mutationOptions;
242
+ };
243
+ export const getManifestQueryKey = (options) => createQueryKey('getManifest', options);
244
+ /**
245
+ * Get manifest by ID
246
+ *
247
+ * Retrieve a specific manifest version by its ID with full board manifest details
248
+ */
249
+ export const getManifestOptions = (options) => queryOptions({
250
+ queryFn: async ({ queryKey, signal }) => {
251
+ const { data } = await getManifest({
252
+ ...options,
253
+ ...queryKey[0],
254
+ signal,
255
+ throwOnError: true
256
+ });
257
+ return data;
258
+ },
259
+ queryKey: getManifestQueryKey(options)
260
+ });
261
+ export const getLatestCompiledResultQueryKey = (options) => createQueryKey('getLatestCompiledResult', options);
262
+ /**
263
+ * Get latest compiled result for a game
264
+ *
265
+ * Return the most recent compiled result for the specified game.
266
+ */
267
+ export const getLatestCompiledResultOptions = (options) => queryOptions({
268
+ queryFn: async ({ queryKey, signal }) => {
269
+ const { data } = await getLatestCompiledResult({
270
+ ...options,
271
+ ...queryKey[0],
272
+ signal,
273
+ throwOnError: true
274
+ });
275
+ return data;
276
+ },
277
+ queryKey: getLatestCompiledResultQueryKey(options)
278
+ });
279
+ export const listCompiledResultsQueryKey = (options) => createQueryKey('listCompiledResults', options);
280
+ /**
281
+ * List compiled results for a game
282
+ *
283
+ * Retrieve a list of compiled results for a game, ordered by creation date descending (newest first). Includes both successful and failed compilations.
284
+ */
285
+ export const listCompiledResultsOptions = (options) => queryOptions({
286
+ queryFn: async ({ queryKey, signal }) => {
287
+ const { data } = await listCompiledResults({
288
+ ...options,
289
+ ...queryKey[0],
290
+ signal,
291
+ throwOnError: true
292
+ });
293
+ return data;
294
+ },
295
+ queryKey: listCompiledResultsQueryKey(options)
296
+ });
297
+ /**
298
+ * Queue a compile job for an authoring state
299
+ *
300
+ * Queue an asynchronous compile for a specific authoring state. Poll `/api/jobs/{jobId}` and fetch the final compiled result by ID when the job completes.
301
+ */
302
+ export const queueCompiledResultJobMutation = (options) => {
303
+ const mutationOptions = {
304
+ mutationFn: async (fnOptions) => {
305
+ const { data } = await queueCompiledResultJob({
306
+ ...options,
307
+ ...fnOptions,
308
+ throwOnError: true
309
+ });
310
+ return data;
311
+ }
312
+ };
313
+ return mutationOptions;
314
+ };
315
+ /**
316
+ * Ensure a private dev compile exists
317
+ *
318
+ * Reuse or create a session-scoped dev compilation for the provided workspace fingerprint without advancing the canonical authored head.
319
+ */
320
+ export const ensureDevCompileMutation = (options) => {
321
+ const mutationOptions = {
322
+ mutationFn: async (fnOptions) => {
323
+ const { data } = await ensureDevCompile({
324
+ ...options,
325
+ ...fnOptions,
326
+ throwOnError: true
327
+ });
328
+ return data;
329
+ }
330
+ };
331
+ return mutationOptions;
332
+ };
333
+ export const getCompiledResultQueryKey = (options) => createQueryKey('getCompiledResult', options);
334
+ /**
335
+ * Get compiled result by ID
336
+ *
337
+ * Fetch a specific compiled result for a game, including failed results and diagnostics.
338
+ */
339
+ export const getCompiledResultOptions = (options) => queryOptions({
340
+ queryFn: async ({ queryKey, signal }) => {
341
+ const { data } = await getCompiledResult({
342
+ ...options,
343
+ ...queryKey[0],
344
+ signal,
345
+ throwOnError: true
346
+ });
347
+ return data;
348
+ },
349
+ queryKey: getCompiledResultQueryKey(options)
350
+ });
351
+ export const downloadGameSourcesQueryKey = (options) => createQueryKey('downloadGameSources', options);
352
+ /**
353
+ * Download authored game source files
354
+ *
355
+ * Download the authored source files for the current authoring head as a ZIP archive.
356
+ */
357
+ export const downloadGameSourcesOptions = (options) => queryOptions({
358
+ queryFn: async ({ queryKey, signal }) => {
359
+ const { data } = await downloadGameSources({
360
+ ...options,
361
+ ...queryKey[0],
362
+ signal,
363
+ throwOnError: true
364
+ });
365
+ return data;
366
+ },
367
+ queryKey: downloadGameSourcesQueryKey(options)
368
+ });
369
+ export const getGameSourcesQueryKey = (options) => createQueryKey('getGameSources', options);
370
+ /**
371
+ * Get authored game source files
372
+ *
373
+ * Retrieve authored source files as JSON for the selected authoring state. If no authoring state is provided, the current authoring head is used.
374
+ */
375
+ export const getGameSourcesOptions = (options) => queryOptions({
376
+ queryFn: async ({ queryKey, signal }) => {
377
+ const { data } = await getGameSources({
378
+ ...options,
379
+ ...queryKey[0],
380
+ signal,
381
+ throwOnError: true
382
+ });
383
+ return data;
384
+ },
385
+ queryKey: getGameSourcesQueryKey(options)
386
+ });
387
+ /**
388
+ * Create a source revision for a game
389
+ *
390
+ * Create a new authored source revision from a hash-addressed change set. The request must be based on the current head revision for the game.
391
+ */
392
+ export const createSourceRevisionMutation = (options) => {
393
+ const mutationOptions = {
394
+ mutationFn: async (fnOptions) => {
395
+ const { data } = await createSourceRevision({
396
+ ...options,
397
+ ...fnOptions,
398
+ throwOnError: true
399
+ });
400
+ return data;
401
+ }
402
+ };
403
+ return mutationOptions;
404
+ };
405
+ /**
406
+ * Create direct-upload targets for source blobs
407
+ *
408
+ * Create a direct-upload session for one or more source blobs referenced by a forthcoming source revision.
409
+ */
410
+ export const createSourceBlobUploadSessionMutation = (options) => {
411
+ const mutationOptions = {
412
+ mutationFn: async (fnOptions) => {
413
+ const { data } = await createSourceBlobUploadSession({
414
+ ...options,
415
+ ...fnOptions,
416
+ throwOnError: true
417
+ });
418
+ return data;
419
+ }
420
+ };
421
+ return mutationOptions;
422
+ };
423
+ export const getAuthoringHeadQueryKey = (options) => createQueryKey('getAuthoringHead', options);
424
+ /**
425
+ * Get current authoring head for a game
426
+ *
427
+ * Retrieve the current remote authoring head for the specified game.
428
+ */
429
+ export const getAuthoringHeadOptions = (options) => queryOptions({
430
+ queryFn: async ({ queryKey, signal }) => {
431
+ const { data } = await getAuthoringHead({
432
+ ...options,
433
+ ...queryKey[0],
434
+ signal,
435
+ throwOnError: true
436
+ });
437
+ return data;
438
+ },
439
+ queryKey: getAuthoringHeadQueryKey(options)
440
+ });
441
+ /**
442
+ * Advance the authoring head for a game
443
+ *
444
+ * Create a new immutable authoring state and make it the current authoring head for the specified game.
445
+ */
446
+ export const createAuthoringStateMutation = (options) => {
447
+ const mutationOptions = {
448
+ mutationFn: async (fnOptions) => {
449
+ const { data } = await createAuthoringState({
450
+ ...options,
451
+ ...fnOptions,
452
+ throwOnError: true
453
+ });
454
+ return data;
455
+ }
456
+ };
457
+ return mutationOptions;
458
+ };
459
+ export const getGameScriptsQueryKey = (options) => createQueryKey('getGameScripts', options);
460
+ /**
461
+ * Get game scripts
462
+ *
463
+ * Retrieve all compiled app and UI scripts for a specific manifest
464
+ */
465
+ export const getGameScriptsOptions = (options) => queryOptions({
466
+ queryFn: async ({ queryKey, signal }) => {
467
+ const { data } = await getGameScripts({
468
+ ...options,
469
+ ...queryKey[0],
470
+ signal,
471
+ throwOnError: true
472
+ });
473
+ return data;
474
+ },
475
+ queryKey: getGameScriptsQueryKey(options)
476
+ });
477
+ export const getActiveJobQueryKey = (options) => createQueryKey('getActiveJob', options);
478
+ /**
479
+ * Get active job for a game
480
+ *
481
+ * Returns the currently active (PENDING or RUNNING) job for a game, if any. Jobs older than 15 minutes are considered stale and ignored.
482
+ */
483
+ export const getActiveJobOptions = (options) => queryOptions({
484
+ queryFn: async ({ queryKey, signal }) => {
485
+ const { data } = await getActiveJob({
486
+ ...options,
487
+ ...queryKey[0],
488
+ signal,
489
+ throwOnError: true
490
+ });
491
+ return data;
492
+ },
493
+ queryKey: getActiveJobQueryKey(options)
494
+ });
495
+ export const getJobQueryKey = (options) => createQueryKey('getJob', options);
496
+ /**
497
+ * Get job details
498
+ *
499
+ * Fetch details for a specific async job, including ordered user-facing tasks.
500
+ */
501
+ export const getJobOptions = (options) => queryOptions({
502
+ queryFn: async ({ queryKey, signal }) => {
503
+ const { data } = await getJob({
504
+ ...options,
505
+ ...queryKey[0],
506
+ signal,
507
+ throwOnError: true
508
+ });
509
+ return data;
510
+ },
511
+ queryKey: getJobQueryKey(options)
512
+ });
513
+ /**
514
+ * Create a game build run
515
+ *
516
+ * Create a new game draft build job from a structured game spec.
517
+ */
518
+ export const createGameRunMutation = (options) => {
519
+ const mutationOptions = {
520
+ mutationFn: async (fnOptions) => {
521
+ const { data } = await createGameRun({
522
+ ...options,
523
+ ...fnOptions,
524
+ throwOnError: true
525
+ });
526
+ return data;
527
+ }
528
+ };
529
+ return mutationOptions;
530
+ };
531
+ /**
532
+ * Cancel a game build run
533
+ *
534
+ * Request cancellation of an active game draft build job.
535
+ */
536
+ export const cancelGameRunMutation = (options) => {
537
+ const mutationOptions = {
538
+ mutationFn: async (fnOptions) => {
539
+ const { data } = await cancelGameRun({
540
+ ...options,
541
+ ...fnOptions,
542
+ throwOnError: true
543
+ });
544
+ return data;
545
+ }
546
+ };
547
+ return mutationOptions;
548
+ };
549
+ export const listGameRulesQueryKey = (options) => createQueryKey('listGameRules', options);
550
+ /**
551
+ * List game rules for a game
552
+ *
553
+ * Retrieve a list of rule versions for a game, ordered by version descending (newest first)
554
+ */
555
+ export const listGameRulesOptions = (options) => queryOptions({
556
+ queryFn: async ({ queryKey, signal }) => {
557
+ const { data } = await listGameRules({
558
+ ...options,
559
+ ...queryKey[0],
560
+ signal,
561
+ throwOnError: true
562
+ });
563
+ return data;
564
+ },
565
+ queryKey: listGameRulesQueryKey(options)
566
+ });
567
+ /**
568
+ * Create a new game rule
569
+ *
570
+ * Create a new versioned rule for a game. Each save creates a new version with automatic version numbering.
571
+ */
572
+ export const createGameRuleMutation = (options) => {
573
+ const mutationOptions = {
574
+ mutationFn: async (fnOptions) => {
575
+ const { data } = await createGameRule({
576
+ ...options,
577
+ ...fnOptions,
578
+ throwOnError: true
579
+ });
580
+ return data;
581
+ }
582
+ };
583
+ return mutationOptions;
584
+ };
585
+ export const getLatestGameRuleQueryKey = (options) => createQueryKey('getLatestGameRule', options);
586
+ /**
587
+ * Get the latest game rule
588
+ *
589
+ * Retrieve the most recent rule version for a game with full details including the complete rule text
590
+ */
591
+ export const getLatestGameRuleOptions = (options) => queryOptions({
592
+ queryFn: async ({ queryKey, signal }) => {
593
+ const { data } = await getLatestGameRule({
594
+ ...options,
595
+ ...queryKey[0],
596
+ signal,
597
+ throwOnError: true
598
+ });
599
+ return data;
600
+ },
601
+ queryKey: getLatestGameRuleQueryKey(options)
602
+ });
603
+ export const getGameRuleQueryKey = (options) => createQueryKey('getGameRule', options);
604
+ /**
605
+ * Get game rule by ID
606
+ *
607
+ * Retrieve a specific game rule version by its ID with full details
608
+ */
609
+ export const getGameRuleOptions = (options) => queryOptions({
610
+ queryFn: async ({ queryKey, signal }) => {
611
+ const { data } = await getGameRule({
612
+ ...options,
613
+ ...queryKey[0],
614
+ signal,
615
+ throwOnError: true
616
+ });
617
+ return data;
618
+ },
619
+ queryKey: getGameRuleQueryKey(options)
620
+ });
621
+ /**
622
+ * Create a new game session
623
+ *
624
+ * Create a new game session in lobby phase with initial seat configuration
625
+ */
626
+ export const createSessionMutation = (options) => {
627
+ const mutationOptions = {
628
+ mutationFn: async (fnOptions) => {
629
+ const { data } = await createSession({
630
+ ...options,
631
+ ...fnOptions,
632
+ throwOnError: true
633
+ });
634
+ return data;
635
+ }
636
+ };
637
+ return mutationOptions;
638
+ };
639
+ /**
640
+ * Create a session from a reducer snapshot
641
+ *
642
+ * Create an auto-assigned gameplay session from a reducer-native snapshot produced by the CLI scenario harness.
643
+ */
644
+ export const createSessionFromReducerSnapshotMutation = (options) => {
645
+ const mutationOptions = {
646
+ mutationFn: async (fnOptions) => {
647
+ const { data } = await createSessionFromReducerSnapshot({
648
+ ...options,
649
+ ...fnOptions,
650
+ throwOnError: true
651
+ });
652
+ return data;
653
+ }
654
+ };
655
+ return mutationOptions;
656
+ };
657
+ export const getSessionByShortCodeQueryKey = (options) => createQueryKey('getSessionByShortCode', options);
658
+ /**
659
+ * Get session by short code
660
+ *
661
+ * Look up and hydrate a session using its memorable short code.
662
+ */
663
+ export const getSessionByShortCodeOptions = (options) => queryOptions({
664
+ queryFn: async ({ queryKey, signal }) => {
665
+ const { data } = await getSessionByShortCode({
666
+ ...options,
667
+ ...queryKey[0],
668
+ signal,
669
+ throwOnError: true
670
+ });
671
+ return data;
672
+ },
673
+ queryKey: getSessionByShortCodeQueryKey(options)
674
+ });
675
+ export const getSessionSnapshotQueryKey = (options) => createQueryKey('getSessionSnapshot', options);
676
+ /**
677
+ * Get a session snapshot
678
+ *
679
+ * Return the canonical selected-perspective session snapshot for first render or explicit resync.
680
+ */
681
+ export const getSessionSnapshotOptions = (options) => queryOptions({
682
+ queryFn: async ({ queryKey, signal }) => {
683
+ const { data } = await getSessionSnapshot({
684
+ ...options,
685
+ ...queryKey[0],
686
+ signal,
687
+ throwOnError: true
688
+ });
689
+ return data;
690
+ },
691
+ queryKey: getSessionSnapshotQueryKey(options)
692
+ });
693
+ /**
694
+ * Release a session events stream slot
695
+ *
696
+ * Best-effort disconnect signal used by browser tabs during unload and reconnect transitions so stale event stream slots are released promptly.
697
+ */
698
+ export const disconnectSessionEventsMutation = (options) => {
699
+ const mutationOptions = {
700
+ mutationFn: async (fnOptions) => {
701
+ const { data } = await disconnectSessionEvents({
702
+ ...options,
703
+ ...fnOptions,
704
+ throwOnError: true
705
+ });
706
+ return data;
707
+ }
708
+ };
709
+ return mutationOptions;
710
+ };
711
+ /**
712
+ * Start the game
713
+ *
714
+ * Transition session from lobby to gameplay phase (host only)
715
+ */
716
+ export const startGameMutation = (options) => {
717
+ const mutationOptions = {
718
+ mutationFn: async (fnOptions) => {
719
+ const { data } = await startGame({
720
+ ...options,
721
+ ...fnOptions,
722
+ throwOnError: true
723
+ });
724
+ return data;
725
+ }
726
+ };
727
+ return mutationOptions;
728
+ };
729
+ export const listPlayerActionsQueryKey = (options) => createQueryKey('listPlayerActions', options);
730
+ /**
731
+ * List current actions for a selected player
732
+ *
733
+ * Returns the current server-authored descriptors and action-set revision for the selected player.
734
+ */
735
+ export const listPlayerActionsOptions = (options) => queryOptions({
736
+ queryFn: async ({ queryKey, signal }) => {
737
+ const { data } = await listPlayerActions({
738
+ ...options,
739
+ ...queryKey[0],
740
+ signal,
741
+ throwOnError: true
742
+ });
743
+ return data;
744
+ },
745
+ queryKey: listPlayerActionsQueryKey(options)
746
+ });
747
+ export const describePlayerActionQueryKey = (options) => createQueryKey('describePlayerAction', options);
748
+ /**
749
+ * Describe one current action
750
+ *
751
+ * Returns the full current descriptor and action-set revision for one selected-player interaction.
752
+ */
753
+ export const describePlayerActionOptions = (options) => queryOptions({
754
+ queryFn: async ({ queryKey, signal }) => {
755
+ const { data } = await describePlayerAction({
756
+ ...options,
757
+ ...queryKey[0],
758
+ signal,
759
+ throwOnError: true
760
+ });
761
+ return data;
762
+ },
763
+ queryKey: describePlayerActionQueryKey(options)
764
+ });
765
+ export const getPlayerActionTargetsQueryKey = (options) => createQueryKey('getPlayerActionTargets', options);
766
+ /**
767
+ * Describe the current valid target/domain values for one action input
768
+ *
769
+ * Returns the current server-authored input domain for a selected-player action input.
770
+ */
771
+ export const getPlayerActionTargetsOptions = (options) => queryOptions({
772
+ queryFn: async ({ queryKey, signal }) => {
773
+ const { data } = await getPlayerActionTargets({
774
+ ...options,
775
+ ...queryKey[0],
776
+ signal,
777
+ throwOnError: true
778
+ });
779
+ return data;
780
+ },
781
+ queryKey: getPlayerActionTargetsQueryKey(options)
782
+ });
783
+ /**
784
+ * Validate collector-shaped action inputs
785
+ *
786
+ * Validates one selected-player action using collector-shaped inputs. Path fields are authoritative; clients do not send a GameInput envelope.
787
+ */
788
+ export const validatePlayerActionMutation = (options) => {
789
+ const mutationOptions = {
790
+ mutationFn: async (fnOptions) => {
791
+ const { data } = await validatePlayerAction({
792
+ ...options,
793
+ ...fnOptions,
794
+ throwOnError: true
795
+ });
796
+ return data;
797
+ }
798
+ };
799
+ return mutationOptions;
800
+ };
801
+ /**
802
+ * Submit collector-shaped action inputs
803
+ *
804
+ * Submits one selected-player action using collector-shaped inputs. Path fields are authoritative; clients do not send a GameInput envelope.
805
+ */
806
+ export const submitPlayerActionMutation = (options) => {
807
+ const mutationOptions = {
808
+ mutationFn: async (fnOptions) => {
809
+ const { data } = await submitPlayerAction({
810
+ ...options,
811
+ ...fnOptions,
812
+ throwOnError: true
813
+ });
814
+ return data;
815
+ }
816
+ };
817
+ return mutationOptions;
818
+ };
819
+ /**
820
+ * Add a seat to the lobby
821
+ *
822
+ * Add a new seat to the lobby (host only, up to maxPlayers)
823
+ */
824
+ export const addSeatMutation = (options) => {
825
+ const mutationOptions = {
826
+ mutationFn: async (fnOptions) => {
827
+ const { data } = await addSeat({
828
+ ...options,
829
+ ...fnOptions,
830
+ throwOnError: true
831
+ });
832
+ return data;
833
+ }
834
+ };
835
+ return mutationOptions;
836
+ };
837
+ /**
838
+ * Remove a seat from the lobby
839
+ *
840
+ * Remove a seat from the lobby (host only, down to minPlayers)
841
+ */
842
+ export const removeSeatMutation = (options) => {
843
+ const mutationOptions = {
844
+ mutationFn: async (fnOptions) => {
845
+ const { data } = await removeSeat({
846
+ ...options,
847
+ ...fnOptions,
848
+ throwOnError: true
849
+ });
850
+ return data;
851
+ }
852
+ };
853
+ return mutationOptions;
854
+ };
855
+ /**
856
+ * Update seat settings
857
+ *
858
+ * Update seat display name and/or player color. User must be assigned to the seat.
859
+ */
860
+ export const updateSeatMutation = (options) => {
861
+ const mutationOptions = {
862
+ mutationFn: async (fnOptions) => {
863
+ const { data } = await updateSeat({
864
+ ...options,
865
+ ...fnOptions,
866
+ throwOnError: true
867
+ });
868
+ return data;
869
+ }
870
+ };
871
+ return mutationOptions;
872
+ };
873
+ /**
874
+ * Assign a seat to current user
875
+ *
876
+ * Assign the current authenticated user to a specific seat
877
+ */
878
+ export const assignSeatMutation = (options) => {
879
+ const mutationOptions = {
880
+ mutationFn: async (fnOptions) => {
881
+ const { data } = await assignSeat({
882
+ ...options,
883
+ ...fnOptions,
884
+ throwOnError: true
885
+ });
886
+ return data;
887
+ }
888
+ };
889
+ return mutationOptions;
890
+ };
891
+ /**
892
+ * Restore game state from history
893
+ *
894
+ * Restore the game to a previous state from history (host only)
895
+ */
896
+ export const restoreHistoryMutation = (options) => {
897
+ const mutationOptions = {
898
+ mutationFn: async (fnOptions) => {
899
+ const { data } = await restoreHistory({
900
+ ...options,
901
+ ...fnOptions,
902
+ throwOnError: true
903
+ });
904
+ return data;
905
+ }
906
+ };
907
+ return mutationOptions;
908
+ };
909
+ /**
910
+ * Unassign a seat
911
+ *
912
+ * Unassign the current user from a specific seat
913
+ */
914
+ export const unassignSeatMutation = (options) => {
915
+ const mutationOptions = {
916
+ mutationFn: async (fnOptions) => {
917
+ const { data } = await unassignSeat({
918
+ ...options,
919
+ ...fnOptions,
920
+ throwOnError: true
921
+ });
922
+ return data;
923
+ }
924
+ };
925
+ return mutationOptions;
926
+ };
927
+ export const fetchUiBundleQueryKey = (options) => createQueryKey('fetchUiBundle', options);
928
+ /**
929
+ * Fetch UI bundle
930
+ *
931
+ * Fetch and return the HTML content of a UI bundle from Supabase storage based on the last compiled UI result
932
+ */
933
+ export const fetchUiBundleOptions = (options) => queryOptions({
934
+ queryFn: async ({ queryKey, signal }) => {
935
+ const { data } = await fetchUiBundle({
936
+ ...options,
937
+ ...queryKey[0],
938
+ signal,
939
+ throwOnError: true
940
+ });
941
+ return data;
942
+ },
943
+ queryKey: fetchUiBundleQueryKey(options)
944
+ });
945
+ export const listDemoGamesQueryKey = (options) => createQueryKey('listDemoGames', options);
946
+ /**
947
+ * List demo games
948
+ *
949
+ * List bundled demo games that can be opened without a normal user account.
950
+ */
951
+ export const listDemoGamesOptions = (options) => queryOptions({
952
+ queryFn: async ({ queryKey, signal }) => {
953
+ const { data } = await listDemoGames({
954
+ ...options,
955
+ ...queryKey[0],
956
+ signal,
957
+ throwOnError: true
958
+ });
959
+ return data;
960
+ },
961
+ queryKey: listDemoGamesQueryKey(options)
962
+ });
963
+ export const getDemoGameQueryKey = (options) => createQueryKey('getDemoGame', options);
964
+ /**
965
+ * Get demo game
966
+ *
967
+ * Return registration and playability metadata for a bundled demo game.
968
+ */
969
+ export const getDemoGameOptions = (options) => queryOptions({
970
+ queryFn: async ({ queryKey, signal }) => {
971
+ const { data } = await getDemoGame({
972
+ ...options,
973
+ ...queryKey[0],
974
+ signal,
975
+ throwOnError: true
976
+ });
977
+ return data;
978
+ },
979
+ queryKey: getDemoGameQueryKey(options)
980
+ });
981
+ export const getDemoGameThumbnailQueryKey = (options) => createQueryKey('getDemoGameThumbnail', options);
982
+ /**
983
+ * Get demo game thumbnail
984
+ *
985
+ * Return the static thumbnail image for an active bundled demo game.
986
+ */
987
+ export const getDemoGameThumbnailOptions = (options) => queryOptions({
988
+ queryFn: async ({ queryKey, signal }) => {
989
+ const { data } = await getDemoGameThumbnail({
990
+ ...options,
991
+ ...queryKey[0],
992
+ signal,
993
+ throwOnError: true
994
+ });
995
+ return data;
996
+ },
997
+ queryKey: getDemoGameThumbnailQueryKey(options)
998
+ });
999
+ /**
1000
+ * Create demo session
1001
+ *
1002
+ * Create a fresh guest-play session for a bundled demo game.
1003
+ */
1004
+ export const createDemoGameSessionMutation = (options) => {
1005
+ const mutationOptions = {
1006
+ mutationFn: async (fnOptions) => {
1007
+ const { data } = await createDemoGameSession({
1008
+ ...options,
1009
+ ...fnOptions,
1010
+ throwOnError: true
1011
+ });
1012
+ return data;
1013
+ }
1014
+ };
1015
+ return mutationOptions;
1016
+ };