@carddb/browser 0.4.2 → 0.4.5
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/browser/index.js +254 -356
- package/dist/browser/index.js.map +1 -1
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardDBError",this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this,ne);}},
|
|
1
|
+
var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardDBError",this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this,ne);}},G=class extends y{constructor(e="Invalid or missing API key",t){super(e,t),this.name="AuthenticationError";}},U=class extends y{retryAfter;limit;remaining;resetAt;constructor(e="Rate limit exceeded",t={}){super(e,t.response),this.name="RateLimitError",this.retryAfter=t.retryAfter??null,this.limit=t.limit??null,this.remaining=t.remaining??null,this.resetAt=t.resetAt??null;}},Gt=class extends y{constructor(e="Resource not found",t){super(e,t),this.name="NotFoundError";}},F=class extends y{errors;constructor(e="Validation error",t={}){super(e,t.response),this.name="ValidationError",this.errors=t.errors??[];}},v=class extends y{constructor(e,t){super(e,t),this.name="RestrictedError";}},ce=class extends y{errors;constructor(e="GraphQL error",t={}){super(e,t.response),this.name="GraphQLError",this.errors=t.errors??[];}},x=class extends y{constructor(e="Connection error",t){super(e,t),this.name="ConnectionError";}},O=class extends x{constructor(e="Request timed out",t){super(e,t),this.name="TimeoutError";}},N=class extends y{status;constructor(e="Server error",t={}){super(e,t.response),this.name="ServerError",this.status=t.status??null;}},Ot=class extends y{failures;partialResults;constructor(e="Some links could not be resolved",t={}){super(e,t.response),this.name="LinkResolutionError",this.failures=t.failures??[],this.partialResults=t.partialResults;}getFailuresForField(e){return this.failures.filter(t=>t.field===e)}hasFailuresForField(e){return this.failures.some(t=>t.field===e)}};function Nt(e){return {eq:e}}function jt(e){return {neq:e}}function Ht(e){return {gt:e}}function Yt(e){return {gte:e}}function zt(e){return {lt:e}}function Wt(e){return {lte:e}}function Xt(e){return {in:e}}function Qt(e){return {nin:e}}function Zt(e){return {contains:e}}function er(e){return {like:e}}function tr(e){return {ilike:e}}function rr(){return {is_null:true}}function sr(){return {is_null:false}}var Ee=class oe{conditions=[];orGroups=[];where(t,r){if(typeof t=="string")this.conditions.push({[t]:r});else for(let[s,a]of Object.entries(t))this.conditions.push({[s]:a});return this}any(t){let r=new oe;t(r);let s=r.getConditions();return s.length>0&&this.orGroups.push({$or:s}),this}whereLink(t,r){let s={};for(let[a,n]of Object.entries(r))s[a]=n;return this.conditions.push({[`${t}._link`]:s}),this}whereAny(t,r){let s={};for(let[a,n]of Object.entries(r))s[a]=n;return this.conditions.push({[`${t}._any`]:s}),this}getConditions(){return this.conditions}build(){let t=[...this.conditions,...this.orGroups];return t.length===0?{}:t.length===1?t[0]:{$and:t}}};function P(e){if(e!==void 0){if(typeof e=="function"){let t=new Ee;e(t);let r=t.build();return Object.keys(r).length>0?r:void 0}return Object.keys(e).length>0?e:void 0}}var Re=new Set(["metadata","annotations"]);function I(e){return ue(e,"input")}function ue(e,t){if(!M(e))return e;let r={};for(let[s,a]of Object.entries(e)){let n=`${t}.${s}`;Re.has(s)?r[s]=xe(a,n):s==="entries"&&Array.isArray(a)?r[s]=a.map((c,o)=>ue(c,`${n}[${o}]`)):r[s]=a;}return r}function xe(e,t){if(e==null||M(e))return e;if(typeof e=="string")try{let r=JSON.parse(e);if(M(r))return r}catch{}throw new F(`${t} must be a JSON object`)}function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var E=`
|
|
2
2
|
id
|
|
3
3
|
createdAt
|
|
4
4
|
updatedAt
|
|
@@ -11,9 +11,9 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
11
11
|
entityType
|
|
12
12
|
entityId
|
|
13
13
|
url
|
|
14
|
-
`,
|
|
14
|
+
`,Z=`
|
|
15
15
|
file {
|
|
16
|
-
${
|
|
16
|
+
${E}
|
|
17
17
|
}
|
|
18
18
|
uploadUrl
|
|
19
19
|
expiresAt
|
|
@@ -88,7 +88,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
88
88
|
key
|
|
89
89
|
name
|
|
90
90
|
}
|
|
91
|
-
`,
|
|
91
|
+
`,qe=4;function le(e){return `
|
|
92
92
|
key
|
|
93
93
|
label
|
|
94
94
|
description
|
|
@@ -121,12 +121,12 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
121
121
|
isUnique
|
|
122
122
|
${e>0?`
|
|
123
123
|
nestedFields {
|
|
124
|
-
${
|
|
124
|
+
${le(e-1)}
|
|
125
125
|
}`:""}
|
|
126
|
-
`}var
|
|
126
|
+
`}var w=`
|
|
127
127
|
schema {
|
|
128
128
|
fields {
|
|
129
|
-
${
|
|
129
|
+
${le(qe)}
|
|
130
130
|
}
|
|
131
131
|
filterableFields
|
|
132
132
|
searchableFields
|
|
@@ -142,7 +142,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
142
142
|
isArray
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
`,
|
|
145
|
+
`,de=`
|
|
146
146
|
id
|
|
147
147
|
objectTypeId
|
|
148
148
|
key
|
|
@@ -176,7 +176,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
176
176
|
parentFieldId
|
|
177
177
|
createdAt
|
|
178
178
|
updatedAt
|
|
179
|
-
`,
|
|
179
|
+
`,Ce=`
|
|
180
180
|
pricing {
|
|
181
181
|
productId
|
|
182
182
|
prices {
|
|
@@ -188,11 +188,11 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
188
188
|
directLowPrice
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
`;function
|
|
191
|
+
`;function b(e={}){return `
|
|
192
192
|
id
|
|
193
193
|
datasetId
|
|
194
194
|
data
|
|
195
|
-
${e.includePricing?
|
|
195
|
+
${e.includePricing?Ce:""}
|
|
196
196
|
createdAt
|
|
197
197
|
updatedAt
|
|
198
198
|
dataset {
|
|
@@ -202,7 +202,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
202
202
|
gameId
|
|
203
203
|
publisherId
|
|
204
204
|
}
|
|
205
|
-
`}var
|
|
205
|
+
`}var R=b(),j=`
|
|
206
206
|
key
|
|
207
207
|
label
|
|
208
208
|
description
|
|
@@ -214,7 +214,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
214
214
|
excludedFromDeckSize
|
|
215
215
|
legalCardTypes
|
|
216
216
|
metadata
|
|
217
|
-
`,
|
|
217
|
+
`,L=`
|
|
218
218
|
id
|
|
219
219
|
datasetId
|
|
220
220
|
recordId
|
|
@@ -225,9 +225,9 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
225
225
|
annotations
|
|
226
226
|
display
|
|
227
227
|
record {
|
|
228
|
-
${
|
|
228
|
+
${R}
|
|
229
229
|
}
|
|
230
|
-
`,
|
|
230
|
+
`,he=`
|
|
231
231
|
rulesetId
|
|
232
232
|
rulesetVersionId
|
|
233
233
|
rulesetVersionLabel
|
|
@@ -235,7 +235,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
235
235
|
cardDatasetVersionId
|
|
236
236
|
validatedAt
|
|
237
237
|
validationResultSummary
|
|
238
|
-
`,
|
|
238
|
+
`,T=`
|
|
239
239
|
code
|
|
240
240
|
severity
|
|
241
241
|
message
|
|
@@ -244,14 +244,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
244
244
|
datasetId
|
|
245
245
|
identifier
|
|
246
246
|
metadata
|
|
247
|
-
`,
|
|
247
|
+
`,H=`
|
|
248
248
|
deckId
|
|
249
249
|
valid
|
|
250
250
|
blockers {
|
|
251
|
-
${
|
|
251
|
+
${T}
|
|
252
252
|
}
|
|
253
253
|
warnings {
|
|
254
|
-
${
|
|
254
|
+
${T}
|
|
255
255
|
}
|
|
256
256
|
affectedEntries {
|
|
257
257
|
entryId
|
|
@@ -262,17 +262,17 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
262
262
|
quantity
|
|
263
263
|
}
|
|
264
264
|
validatedAgainst {
|
|
265
|
-
${
|
|
265
|
+
${he}
|
|
266
266
|
}
|
|
267
267
|
checkedAt
|
|
268
|
-
`,
|
|
268
|
+
`,ee=`
|
|
269
269
|
deckId
|
|
270
270
|
fromVersionId
|
|
271
271
|
toVersionId
|
|
272
272
|
toDraftRevision
|
|
273
273
|
hasChanges
|
|
274
274
|
diff
|
|
275
|
-
`,
|
|
275
|
+
`,K=`
|
|
276
276
|
id
|
|
277
277
|
deckId
|
|
278
278
|
versionNumber
|
|
@@ -294,18 +294,18 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
294
294
|
validatedAt
|
|
295
295
|
validationSummary
|
|
296
296
|
validatedAgainst {
|
|
297
|
-
${
|
|
297
|
+
${he}
|
|
298
298
|
}
|
|
299
299
|
sectionDefinitions {
|
|
300
|
-
${
|
|
300
|
+
${j}
|
|
301
301
|
}
|
|
302
302
|
publishedByAccountId
|
|
303
303
|
publishedByApiApplicationId
|
|
304
304
|
createdAt
|
|
305
305
|
entries {
|
|
306
|
-
${
|
|
306
|
+
${L}
|
|
307
307
|
}
|
|
308
|
-
`,
|
|
308
|
+
`,te=`
|
|
309
309
|
id
|
|
310
310
|
deckId
|
|
311
311
|
accountId
|
|
@@ -313,34 +313,12 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
313
313
|
createdByAccountId
|
|
314
314
|
createdAt
|
|
315
315
|
updatedAt
|
|
316
|
-
`,te=`
|
|
317
|
-
id
|
|
318
|
-
deckId
|
|
319
|
-
label
|
|
320
|
-
expiresAt
|
|
321
|
-
revokedAt
|
|
322
|
-
lastUsedAt
|
|
323
|
-
createdAt
|
|
324
|
-
updatedAt
|
|
325
316
|
`,re=`
|
|
326
317
|
id
|
|
327
|
-
deckId
|
|
328
318
|
apiApplicationId
|
|
329
319
|
label
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
externalSubject
|
|
333
|
-
expiresAt
|
|
334
|
-
revokedAt
|
|
335
|
-
lastUsedAt
|
|
336
|
-
createdAt
|
|
337
|
-
updatedAt
|
|
338
|
-
`,P=`
|
|
339
|
-
id
|
|
340
|
-
deckId
|
|
341
|
-
apiApplicationId
|
|
342
|
-
label
|
|
343
|
-
readModes
|
|
320
|
+
allowedScopes
|
|
321
|
+
allowedRepresentations
|
|
344
322
|
maxTokenLifetimeSeconds
|
|
345
323
|
directSigningAlg
|
|
346
324
|
directSigningKeyId
|
|
@@ -351,17 +329,19 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
351
329
|
updatedAt
|
|
352
330
|
`,Te=`
|
|
353
331
|
id
|
|
354
|
-
deckId
|
|
355
332
|
apiApplicationId
|
|
356
333
|
issuerId
|
|
357
|
-
|
|
334
|
+
deckId
|
|
335
|
+
gameId
|
|
358
336
|
externalSubject
|
|
337
|
+
scopes
|
|
338
|
+
representation
|
|
359
339
|
expiresAt
|
|
360
340
|
revokedAt
|
|
361
341
|
lastUsedAt
|
|
362
342
|
createdAt
|
|
363
343
|
updatedAt
|
|
364
|
-
`,
|
|
344
|
+
`,Y=`
|
|
365
345
|
lineNumber
|
|
366
346
|
raw
|
|
367
347
|
datasetKey
|
|
@@ -373,14 +353,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
373
353
|
sortOrder
|
|
374
354
|
display
|
|
375
355
|
record {
|
|
376
|
-
${
|
|
356
|
+
${R}
|
|
377
357
|
}
|
|
378
|
-
`,
|
|
358
|
+
`,ye=`
|
|
379
359
|
lineNumber
|
|
380
360
|
raw
|
|
381
361
|
code
|
|
382
362
|
message
|
|
383
|
-
`,
|
|
363
|
+
`,z=`
|
|
384
364
|
lineNumber
|
|
385
365
|
raw
|
|
386
366
|
datasetKey
|
|
@@ -389,7 +369,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
389
369
|
section
|
|
390
370
|
code
|
|
391
371
|
message
|
|
392
|
-
`,
|
|
372
|
+
`,W=`
|
|
393
373
|
lineNumber
|
|
394
374
|
raw
|
|
395
375
|
datasetKey
|
|
@@ -401,7 +381,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
401
381
|
identifier
|
|
402
382
|
display
|
|
403
383
|
}
|
|
404
|
-
`,
|
|
384
|
+
`,k=`
|
|
405
385
|
id
|
|
406
386
|
gameId
|
|
407
387
|
key
|
|
@@ -415,39 +395,39 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
415
395
|
isArchived
|
|
416
396
|
createdAt
|
|
417
397
|
updatedAt
|
|
418
|
-
`,
|
|
398
|
+
`,fe=`
|
|
419
399
|
formatId
|
|
420
400
|
key
|
|
421
401
|
name
|
|
422
402
|
confidence
|
|
423
403
|
reason
|
|
424
|
-
`,
|
|
404
|
+
`,Ke=`
|
|
425
405
|
detection {
|
|
426
|
-
${
|
|
406
|
+
${fe}
|
|
427
407
|
}
|
|
428
408
|
entries {
|
|
429
|
-
${
|
|
409
|
+
${Y}
|
|
430
410
|
}
|
|
431
411
|
parseErrors {
|
|
432
|
-
${
|
|
412
|
+
${ye}
|
|
433
413
|
}
|
|
434
414
|
unmatched {
|
|
435
|
-
${
|
|
415
|
+
${z}
|
|
436
416
|
}
|
|
437
417
|
ambiguous {
|
|
438
|
-
${
|
|
418
|
+
${W}
|
|
439
419
|
}
|
|
440
|
-
`,
|
|
420
|
+
`,Ue=`
|
|
441
421
|
entries {
|
|
442
|
-
${
|
|
422
|
+
${Y}
|
|
443
423
|
}
|
|
444
424
|
unmatched {
|
|
445
|
-
${
|
|
425
|
+
${z}
|
|
446
426
|
}
|
|
447
427
|
ambiguous {
|
|
448
|
-
${
|
|
428
|
+
${W}
|
|
449
429
|
}
|
|
450
|
-
`,
|
|
430
|
+
`,Fe=`
|
|
451
431
|
deckId
|
|
452
432
|
format
|
|
453
433
|
text
|
|
@@ -482,10 +462,10 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
482
462
|
sourceUrl
|
|
483
463
|
metadata
|
|
484
464
|
sectionDefinitions {
|
|
485
|
-
${
|
|
465
|
+
${j}
|
|
486
466
|
}
|
|
487
467
|
latestPublishedVersion {
|
|
488
|
-
${
|
|
468
|
+
${K}
|
|
489
469
|
}
|
|
490
470
|
publishedAt
|
|
491
471
|
draftRevision
|
|
@@ -499,25 +479,25 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
499
479
|
${p}
|
|
500
480
|
}
|
|
501
481
|
entries {
|
|
502
|
-
${
|
|
482
|
+
${L}
|
|
503
483
|
}
|
|
504
484
|
`,se=`
|
|
505
485
|
deck {
|
|
506
486
|
${u}
|
|
507
487
|
}
|
|
508
488
|
retainedAppAccess
|
|
509
|
-
`,
|
|
489
|
+
`,Pe=`
|
|
510
490
|
deck {
|
|
511
491
|
${u}
|
|
512
492
|
}
|
|
513
493
|
copiedFromDeckId
|
|
514
494
|
retainedAppAccess
|
|
515
|
-
`,
|
|
495
|
+
`,Le=`
|
|
516
496
|
id
|
|
517
497
|
name
|
|
518
498
|
description
|
|
519
499
|
revokedAt
|
|
520
|
-
`,
|
|
500
|
+
`,V=`
|
|
521
501
|
id
|
|
522
502
|
deckId
|
|
523
503
|
deck {
|
|
@@ -525,7 +505,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
525
505
|
}
|
|
526
506
|
apiApplicationId
|
|
527
507
|
apiApplication {
|
|
528
|
-
${
|
|
508
|
+
${Le}
|
|
529
509
|
}
|
|
530
510
|
role
|
|
531
511
|
grantSource
|
|
@@ -535,37 +515,37 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
535
515
|
revokedAt
|
|
536
516
|
createdAt
|
|
537
517
|
updatedAt
|
|
538
|
-
`,
|
|
518
|
+
`,Ve=`
|
|
539
519
|
deck {
|
|
540
520
|
${u}
|
|
541
521
|
}
|
|
542
522
|
version {
|
|
543
|
-
${
|
|
523
|
+
${K}
|
|
544
524
|
}
|
|
545
525
|
validation {
|
|
546
|
-
${
|
|
526
|
+
${H}
|
|
547
527
|
}
|
|
548
528
|
blockers {
|
|
549
|
-
${
|
|
529
|
+
${T}
|
|
550
530
|
}
|
|
551
531
|
warnings {
|
|
552
|
-
${
|
|
532
|
+
${T}
|
|
553
533
|
}
|
|
554
|
-
`,
|
|
534
|
+
`,B=`
|
|
555
535
|
deck {
|
|
556
536
|
${u}
|
|
557
537
|
}
|
|
558
538
|
entry {
|
|
559
|
-
${
|
|
539
|
+
${L}
|
|
560
540
|
}
|
|
561
|
-
`,
|
|
541
|
+
`,pe=`
|
|
562
542
|
deck {
|
|
563
543
|
${u}
|
|
564
544
|
}
|
|
565
545
|
entries {
|
|
566
|
-
${
|
|
546
|
+
${L}
|
|
567
547
|
}
|
|
568
|
-
`,
|
|
548
|
+
`,Be=pe,_e=`
|
|
569
549
|
deck {
|
|
570
550
|
${u}
|
|
571
551
|
}
|
|
@@ -574,27 +554,27 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
574
554
|
replace
|
|
575
555
|
format
|
|
576
556
|
importFormat {
|
|
577
|
-
${
|
|
557
|
+
${k}
|
|
578
558
|
}
|
|
579
559
|
detection {
|
|
580
|
-
${
|
|
560
|
+
${fe}
|
|
581
561
|
}
|
|
582
562
|
entries {
|
|
583
|
-
${
|
|
563
|
+
${Y}
|
|
584
564
|
}
|
|
585
565
|
parseErrors {
|
|
586
|
-
${
|
|
566
|
+
${ye}
|
|
587
567
|
}
|
|
588
568
|
unmatched {
|
|
589
|
-
${
|
|
569
|
+
${z}
|
|
590
570
|
}
|
|
591
571
|
ambiguous {
|
|
592
|
-
${
|
|
572
|
+
${W}
|
|
593
573
|
}
|
|
594
574
|
validation {
|
|
595
|
-
${
|
|
575
|
+
${H}
|
|
596
576
|
}
|
|
597
|
-
`,
|
|
577
|
+
`,ae=`
|
|
598
578
|
resolvedLinks {
|
|
599
579
|
field
|
|
600
580
|
linkFieldKey
|
|
@@ -605,7 +585,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
605
585
|
data
|
|
606
586
|
}
|
|
607
587
|
}
|
|
608
|
-
`,
|
|
588
|
+
`,me=`
|
|
609
589
|
datasetKey
|
|
610
590
|
index
|
|
611
591
|
errors {
|
|
@@ -613,36 +593,36 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
613
593
|
message
|
|
614
594
|
details
|
|
615
595
|
}
|
|
616
|
-
`,
|
|
596
|
+
`,Me=`
|
|
617
597
|
total
|
|
618
598
|
inserted
|
|
619
599
|
updated
|
|
620
600
|
skipped
|
|
621
601
|
failed
|
|
622
|
-
`,
|
|
602
|
+
`,ge=`
|
|
623
603
|
inserted {
|
|
624
|
-
${
|
|
604
|
+
${R}
|
|
625
605
|
}
|
|
626
606
|
updated {
|
|
627
|
-
${
|
|
607
|
+
${R}
|
|
628
608
|
}
|
|
629
609
|
skipped
|
|
630
610
|
errors {
|
|
631
|
-
${
|
|
611
|
+
${me}
|
|
632
612
|
}
|
|
633
613
|
createdFields {
|
|
634
|
-
${
|
|
614
|
+
${de}
|
|
635
615
|
}
|
|
636
616
|
stats {
|
|
637
|
-
${
|
|
617
|
+
${Me}
|
|
638
618
|
}
|
|
639
|
-
`,
|
|
619
|
+
`,Ie=`
|
|
640
620
|
fileId
|
|
641
621
|
filename
|
|
642
622
|
file {
|
|
643
|
-
${
|
|
623
|
+
${E}
|
|
644
624
|
}
|
|
645
|
-
|
|
625
|
+
`,$=`
|
|
646
626
|
id
|
|
647
627
|
publisherId
|
|
648
628
|
publisher {
|
|
@@ -651,7 +631,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
651
631
|
datasetId
|
|
652
632
|
dataset {
|
|
653
633
|
${m}
|
|
654
|
-
${
|
|
634
|
+
${w}
|
|
655
635
|
}
|
|
656
636
|
accountId
|
|
657
637
|
status
|
|
@@ -667,14 +647,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
667
647
|
skippedCount
|
|
668
648
|
failedCount
|
|
669
649
|
createdFields {
|
|
670
|
-
${
|
|
650
|
+
${de}
|
|
671
651
|
}
|
|
672
652
|
errors {
|
|
673
|
-
${
|
|
653
|
+
${me}
|
|
674
654
|
}
|
|
675
655
|
errorMessage
|
|
676
656
|
assets {
|
|
677
|
-
${
|
|
657
|
+
${Ie}
|
|
678
658
|
}
|
|
679
659
|
startedAt
|
|
680
660
|
completedAt
|
|
@@ -685,7 +665,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
685
665
|
imagesPending
|
|
686
666
|
imagesCompleted
|
|
687
667
|
imagesFailed
|
|
688
|
-
`,
|
|
668
|
+
`,Je=`
|
|
689
669
|
id
|
|
690
670
|
importJobId
|
|
691
671
|
level
|
|
@@ -695,14 +675,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
695
675
|
fieldKey
|
|
696
676
|
details
|
|
697
677
|
createdAt
|
|
698
|
-
`,
|
|
678
|
+
`,Ge=`
|
|
699
679
|
job {
|
|
700
|
-
${
|
|
680
|
+
${$}
|
|
701
681
|
}
|
|
702
682
|
dryRunResult {
|
|
703
|
-
${
|
|
683
|
+
${ge}
|
|
704
684
|
}
|
|
705
|
-
`,
|
|
685
|
+
`,Oe=`
|
|
706
686
|
target
|
|
707
687
|
recordId
|
|
708
688
|
identifier
|
|
@@ -732,14 +712,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
732
712
|
blockedCount
|
|
733
713
|
failedCount
|
|
734
714
|
results {
|
|
735
|
-
${
|
|
715
|
+
${Oe}
|
|
736
716
|
}
|
|
737
717
|
errorMessage
|
|
738
718
|
startedAt
|
|
739
719
|
completedAt
|
|
740
720
|
createdAt
|
|
741
721
|
updatedAt
|
|
742
|
-
`,
|
|
722
|
+
`,be=`
|
|
743
723
|
sourceField
|
|
744
724
|
targetField
|
|
745
725
|
targetFieldLabel
|
|
@@ -765,30 +745,30 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
765
745
|
targetFieldType
|
|
766
746
|
sampleValues
|
|
767
747
|
status
|
|
768
|
-
`,
|
|
748
|
+
`,J=`
|
|
769
749
|
datasetKey
|
|
770
750
|
field
|
|
771
751
|
message
|
|
772
752
|
severity
|
|
773
|
-
`,
|
|
753
|
+
`,Ne=`
|
|
774
754
|
datasetKey
|
|
775
755
|
datasetName
|
|
776
756
|
datasetId
|
|
777
757
|
exists
|
|
778
758
|
recordCount
|
|
779
759
|
fieldMappings {
|
|
780
|
-
${
|
|
760
|
+
${be}
|
|
781
761
|
}
|
|
782
762
|
warnings {
|
|
783
|
-
${
|
|
763
|
+
${J}
|
|
784
764
|
}
|
|
785
765
|
canProceed
|
|
786
766
|
sampleRecords
|
|
787
767
|
availableDatasets {
|
|
788
768
|
${m}
|
|
789
|
-
${
|
|
769
|
+
${w}
|
|
790
770
|
}
|
|
791
|
-
`,
|
|
771
|
+
`,je=`
|
|
792
772
|
datasets {
|
|
793
773
|
datasetKey
|
|
794
774
|
datasetName
|
|
@@ -796,19 +776,19 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
796
776
|
exists
|
|
797
777
|
recordCount
|
|
798
778
|
fieldMappings {
|
|
799
|
-
${
|
|
779
|
+
${be}
|
|
800
780
|
}
|
|
801
781
|
warnings {
|
|
802
|
-
${
|
|
782
|
+
${J}
|
|
803
783
|
}
|
|
804
784
|
sampleRecords
|
|
805
785
|
}
|
|
806
786
|
importOrder
|
|
807
787
|
warnings {
|
|
808
|
-
${
|
|
788
|
+
${J}
|
|
809
789
|
}
|
|
810
790
|
canProceed
|
|
811
|
-
`,
|
|
791
|
+
`,He=`
|
|
812
792
|
datasetKey
|
|
813
793
|
datasetId
|
|
814
794
|
datasetName
|
|
@@ -819,7 +799,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
819
799
|
skippedCount
|
|
820
800
|
failedCount
|
|
821
801
|
errorMessage
|
|
822
|
-
`,
|
|
802
|
+
`,D=`
|
|
823
803
|
id
|
|
824
804
|
publisherId
|
|
825
805
|
publisher {
|
|
@@ -835,14 +815,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
835
815
|
onConflict
|
|
836
816
|
fileId
|
|
837
817
|
assets {
|
|
838
|
-
${
|
|
818
|
+
${Ie}
|
|
839
819
|
}
|
|
840
820
|
totalDatasets
|
|
841
821
|
completedDatasets
|
|
842
822
|
progress
|
|
843
823
|
importOrder
|
|
844
824
|
datasetStatuses {
|
|
845
|
-
${
|
|
825
|
+
${He}
|
|
846
826
|
}
|
|
847
827
|
errorMessage
|
|
848
828
|
startedAt
|
|
@@ -862,7 +842,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
862
842
|
linkBuildingCompletedDatasets
|
|
863
843
|
linkBuildingProcessedRecords
|
|
864
844
|
linkBuildingTotalRecords
|
|
865
|
-
`,
|
|
845
|
+
`,A=`
|
|
866
846
|
id
|
|
867
847
|
publisherId
|
|
868
848
|
publisher {
|
|
@@ -888,13 +868,13 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
888
868
|
createdAt
|
|
889
869
|
updatedAt
|
|
890
870
|
lastCheckpointIndex
|
|
891
|
-
`,
|
|
871
|
+
`,Ye=`
|
|
892
872
|
recordId
|
|
893
873
|
rank
|
|
894
874
|
score
|
|
895
875
|
confidence
|
|
896
876
|
reasons
|
|
897
|
-
`,
|
|
877
|
+
`,ze=`
|
|
898
878
|
configured
|
|
899
879
|
url
|
|
900
880
|
latestDeliveryId
|
|
@@ -905,7 +885,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
905
885
|
deliveredAt
|
|
906
886
|
lastStatusCode
|
|
907
887
|
lastError
|
|
908
|
-
`,
|
|
888
|
+
`,We=`
|
|
909
889
|
featureVersion
|
|
910
890
|
candidateCount
|
|
911
891
|
confidenceScore
|
|
@@ -918,7 +898,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
918
898
|
details
|
|
919
899
|
}
|
|
920
900
|
timings
|
|
921
|
-
`,
|
|
901
|
+
`,ie=`
|
|
922
902
|
jobId
|
|
923
903
|
status
|
|
924
904
|
publisherSlug
|
|
@@ -934,14 +914,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
934
914
|
confidence
|
|
935
915
|
}
|
|
936
916
|
candidates {
|
|
937
|
-
${
|
|
917
|
+
${Ye}
|
|
938
918
|
}
|
|
939
919
|
extracted
|
|
940
920
|
metrics {
|
|
941
|
-
${
|
|
921
|
+
${We}
|
|
942
922
|
}
|
|
943
923
|
webhook {
|
|
944
|
-
${
|
|
924
|
+
${ze}
|
|
945
925
|
}
|
|
946
926
|
error {
|
|
947
927
|
code
|
|
@@ -951,7 +931,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
951
931
|
updatedAt
|
|
952
932
|
startedAt
|
|
953
933
|
completedAt
|
|
954
|
-
`,
|
|
934
|
+
`,Xe=`
|
|
955
935
|
publisherSlug
|
|
956
936
|
gameKey
|
|
957
937
|
datasetKey
|
|
@@ -996,11 +976,11 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
996
976
|
correctedFeedback
|
|
997
977
|
feedbackAccuracy
|
|
998
978
|
}
|
|
999
|
-
`,
|
|
979
|
+
`,q=`
|
|
1000
980
|
code
|
|
1001
981
|
region
|
|
1002
982
|
message
|
|
1003
|
-
`,
|
|
983
|
+
`,Qe=`
|
|
1004
984
|
id
|
|
1005
985
|
key
|
|
1006
986
|
label
|
|
@@ -1013,7 +993,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1013
993
|
isRequired
|
|
1014
994
|
weight
|
|
1015
995
|
config
|
|
1016
|
-
`,
|
|
996
|
+
`,C=`
|
|
1017
997
|
id
|
|
1018
998
|
key
|
|
1019
999
|
name
|
|
@@ -1029,11 +1009,11 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1029
1009
|
notes
|
|
1030
1010
|
config
|
|
1031
1011
|
regions {
|
|
1032
|
-
${
|
|
1012
|
+
${Qe}
|
|
1033
1013
|
}
|
|
1034
1014
|
createdAt
|
|
1035
1015
|
updatedAt
|
|
1036
|
-
`,
|
|
1016
|
+
`,Ze=`
|
|
1037
1017
|
key
|
|
1038
1018
|
label
|
|
1039
1019
|
semanticType
|
|
@@ -1044,7 +1024,7 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1044
1024
|
source
|
|
1045
1025
|
status
|
|
1046
1026
|
confidence
|
|
1047
|
-
`,
|
|
1027
|
+
`,et=`
|
|
1048
1028
|
id
|
|
1049
1029
|
key
|
|
1050
1030
|
name
|
|
@@ -1068,8 +1048,8 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1068
1048
|
${e}
|
|
1069
1049
|
}
|
|
1070
1050
|
}
|
|
1071
|
-
`}var
|
|
1072
|
-
query SearchPublishers${
|
|
1051
|
+
`}var i={searchPublishers(e={}){let t={},r=[],s=[];e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1052
|
+
query SearchPublishers${a} {
|
|
1073
1053
|
searchPublishers${n} {
|
|
1074
1054
|
${d(g)}
|
|
1075
1055
|
}
|
|
@@ -1092,8 +1072,8 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1092
1072
|
${g}
|
|
1093
1073
|
}
|
|
1094
1074
|
}
|
|
1095
|
-
`}},searchGames(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let
|
|
1096
|
-
query SearchGames${
|
|
1075
|
+
`}},searchGames(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1076
|
+
query SearchGames${a} {
|
|
1097
1077
|
searchGames${n} {
|
|
1098
1078
|
${d(p)}
|
|
1099
1079
|
}
|
|
@@ -1140,8 +1120,8 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1140
1120
|
${p}
|
|
1141
1121
|
}
|
|
1142
1122
|
}
|
|
1143
|
-
`}},searchDatasets(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.gameKey!==void 0&&(s.push("$gameKey: String"),r.push("gameKey: $gameKey"),t.gameKey=e.gameKey),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.purpose!==void 0&&(s.push("$purpose: DatasetPurpose"),r.push("purpose: $purpose"),t.purpose=e.purpose),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let
|
|
1144
|
-
query SearchDatasets${
|
|
1123
|
+
`}},searchDatasets(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.gameKey!==void 0&&(s.push("$gameKey: String"),r.push("gameKey: $gameKey"),t.gameKey=e.gameKey),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.purpose!==void 0&&(s.push("$purpose: DatasetPurpose"),r.push("purpose: $purpose"),t.purpose=e.purpose),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1124
|
+
query SearchDatasets${a} {
|
|
1145
1125
|
searchDatasets${n} {
|
|
1146
1126
|
${d(m)}
|
|
1147
1127
|
}
|
|
@@ -1150,14 +1130,14 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1150
1130
|
query FetchDataset($id: UUID!) {
|
|
1151
1131
|
fetchDataset(id: $id) {
|
|
1152
1132
|
${m}
|
|
1153
|
-
${
|
|
1133
|
+
${w}
|
|
1154
1134
|
}
|
|
1155
1135
|
}
|
|
1156
1136
|
`}},fetchDatasetByKeys(){return {query:`
|
|
1157
1137
|
query FetchDataset($publisherSlug: String!, $gameKey: String!, $datasetKey: String!) {
|
|
1158
1138
|
fetchDataset(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey) {
|
|
1159
1139
|
${m}
|
|
1160
|
-
${
|
|
1140
|
+
${w}
|
|
1161
1141
|
}
|
|
1162
1142
|
}
|
|
1163
1143
|
`}},fetchDatasets(){return {query:`
|
|
@@ -1170,18 +1150,18 @@ var y=class ne extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1170
1150
|
query Datasets(${s.join(", ")}) {
|
|
1171
1151
|
datasets(${r.join(", ")}) {
|
|
1172
1152
|
${d(`${m}
|
|
1173
|
-
${
|
|
1153
|
+
${w}`)}
|
|
1174
1154
|
}
|
|
1175
1155
|
}
|
|
1176
1156
|
`,variables:t}},dataset(e){let t={},r=[],s=[];return e.id!==void 0&&(s.push("$id: UUID"),r.push("id: $id"),t.id=e.id),e.publisherId!==void 0&&(s.push("$publisherId: UUID"),r.push("publisherId: $publisherId"),t.publisherId=e.publisherId),e.gameId!==void 0&&(s.push("$gameId: UUID"),r.push("gameId: $gameId"),t.gameId=e.gameId),e.datasetKey!==void 0&&(s.push("$datasetKey: String"),r.push("datasetKey: $datasetKey"),t.datasetKey=e.datasetKey),{query:`
|
|
1177
1157
|
query Dataset(${s.join(", ")}) {
|
|
1178
1158
|
dataset(${r.join(", ")}) {
|
|
1179
1159
|
${m}
|
|
1180
|
-
${
|
|
1160
|
+
${w}
|
|
1181
1161
|
}
|
|
1182
1162
|
}
|
|
1183
|
-
`,variables:t}},searchRecords(e){let t={publisherSlug:e.publisherSlug,gameKey:e.gameKey,datasetKey:e.datasetKey},r=["publisherSlug: $publisherSlug","gameKey: $gameKey","datasetKey: $datasetKey"],s=["$publisherSlug: String!","$gameKey: String!","$datasetKey: String!"];e.filter!==void 0&&(s.push("$filter: JSON"),r.push("filter: $filter"),t.filter=e.filter),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.orderBy!==void 0&&(s.push("$orderBy: String"),r.push("orderBy: $orderBy"),t.orderBy=e.orderBy),e.resolveLinks!==void 0&&(s.push("$resolveLinks: [String!]"),r.push("resolveLinks: $resolveLinks"),t.resolveLinks=e.resolveLinks),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),e.validateSchema!==void 0&&(s.push("$validateSchema: Boolean"),r.push("validateSchema: $validateSchema"),t.validateSchema=e.validateSchema);let
|
|
1184
|
-
${
|
|
1163
|
+
`,variables:t}},searchRecords(e){let t={publisherSlug:e.publisherSlug,gameKey:e.gameKey,datasetKey:e.datasetKey},r=["publisherSlug: $publisherSlug","gameKey: $gameKey","datasetKey: $datasetKey"],s=["$publisherSlug: String!","$gameKey: String!","$datasetKey: String!"];e.filter!==void 0&&(s.push("$filter: JSON"),r.push("filter: $filter"),t.filter=e.filter),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.orderBy!==void 0&&(s.push("$orderBy: String"),r.push("orderBy: $orderBy"),t.orderBy=e.orderBy),e.resolveLinks!==void 0&&(s.push("$resolveLinks: [String!]"),r.push("resolveLinks: $resolveLinks"),t.resolveLinks=e.resolveLinks),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),e.validateSchema!==void 0&&(s.push("$validateSchema: Boolean"),r.push("validateSchema: $validateSchema"),t.validateSchema=e.validateSchema);let a=e.resolveLinks&&e.resolveLinks.length>0,n=b({includePricing:e.includePricing}),c=a?`${n}
|
|
1164
|
+
${ae}`:n;return {query:`
|
|
1185
1165
|
query SearchRecords(${s.join(", ")}) {
|
|
1186
1166
|
searchRecords(${r.join(", ")}) {
|
|
1187
1167
|
${d(c)}
|
|
@@ -1190,35 +1170,35 @@ ${ie}`:n;return {query:`
|
|
|
1190
1170
|
`,variables:t}},fetchRecordById(e={}){return {query:`
|
|
1191
1171
|
query FetchRecord($id: UUID!) {
|
|
1192
1172
|
fetchRecord(id: $id) {
|
|
1193
|
-
${
|
|
1173
|
+
${b(e)}
|
|
1194
1174
|
}
|
|
1195
1175
|
}
|
|
1196
1176
|
`}},fetchRecordByIdentifier(e={}){return {query:`
|
|
1197
1177
|
query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) {
|
|
1198
1178
|
fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) {
|
|
1199
|
-
${
|
|
1179
|
+
${b(e)}
|
|
1200
1180
|
}
|
|
1201
1181
|
}
|
|
1202
1182
|
`}},fetchRecordsByIdentifier(e={}){return {query:`
|
|
1203
1183
|
query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) {
|
|
1204
1184
|
fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) {
|
|
1205
|
-
${
|
|
1185
|
+
${b(e)}
|
|
1206
1186
|
}
|
|
1207
1187
|
}
|
|
1208
1188
|
`}},fetchRecords(e={}){return {query:`
|
|
1209
1189
|
query FetchRecords($ids: [UUID!]!) {
|
|
1210
1190
|
fetchRecords(ids: $ids) {
|
|
1211
|
-
${
|
|
1191
|
+
${b(e)}
|
|
1212
1192
|
}
|
|
1213
1193
|
}
|
|
1214
1194
|
`}},listDatasetRecords(e){let t={datasetId:e.datasetId},r=["datasetId: $datasetId"],s=["$datasetId: UUID!"];return e.filter!==void 0&&(s.push("$filter: JSON"),r.push("filter: $filter"),t.filter=e.filter),e.orderBy!==void 0&&(s.push("$orderBy: DatasetRecordOrderByInput"),r.push("orderBy: $orderBy"),t.orderBy=e.orderBy),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),e.last!==void 0&&(s.push("$last: Int"),r.push("last: $last"),t.last=e.last),e.before!==void 0&&(s.push("$before: String"),r.push("before: $before"),t.before=e.before),e.validateSchema!==void 0&&(s.push("$validateSchema: Boolean"),r.push("validateSchema: $validateSchema"),t.validateSchema=e.validateSchema),{query:`
|
|
1215
1195
|
query DatasetRecords(${s.join(", ")}) {
|
|
1216
1196
|
datasetRecords(${r.join(", ")}) {
|
|
1217
|
-
${d(
|
|
1197
|
+
${d(R)}
|
|
1218
1198
|
}
|
|
1219
1199
|
}
|
|
1220
|
-
`,variables:t}},datasetRecord(e){let t={},r=[],s=[];e.id!==void 0&&(s.push("$id: UUID"),r.push("id: $id"),t.id=e.id),e.datasetId!==void 0&&(s.push("$datasetId: UUID"),r.push("datasetId: $datasetId"),t.datasetId=e.datasetId),e.identifier!==void 0&&(s.push("$identifier: String"),r.push("identifier: $identifier"),t.identifier=e.identifier),e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.gameKey!==void 0&&(s.push("$gameKey: String"),r.push("gameKey: $gameKey"),t.gameKey=e.gameKey),e.datasetKey!==void 0&&(s.push("$datasetKey: String"),r.push("datasetKey: $datasetKey"),t.datasetKey=e.datasetKey),e.recordId!==void 0&&(s.push("$recordId: UUID"),r.push("recordId: $recordId"),t.recordId=e.recordId),e.resolveLinks!==void 0&&(s.push("$resolveLinks: [String!]"),r.push("resolveLinks: $resolveLinks"),t.resolveLinks=e.resolveLinks),e.validateSchema!==void 0&&(s.push("$validateSchema: Boolean"),r.push("validateSchema: $validateSchema"),t.validateSchema=e.validateSchema);let
|
|
1221
|
-
${
|
|
1200
|
+
`,variables:t}},datasetRecord(e){let t={},r=[],s=[];e.id!==void 0&&(s.push("$id: UUID"),r.push("id: $id"),t.id=e.id),e.datasetId!==void 0&&(s.push("$datasetId: UUID"),r.push("datasetId: $datasetId"),t.datasetId=e.datasetId),e.identifier!==void 0&&(s.push("$identifier: String"),r.push("identifier: $identifier"),t.identifier=e.identifier),e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.gameKey!==void 0&&(s.push("$gameKey: String"),r.push("gameKey: $gameKey"),t.gameKey=e.gameKey),e.datasetKey!==void 0&&(s.push("$datasetKey: String"),r.push("datasetKey: $datasetKey"),t.datasetKey=e.datasetKey),e.recordId!==void 0&&(s.push("$recordId: UUID"),r.push("recordId: $recordId"),t.recordId=e.recordId),e.resolveLinks!==void 0&&(s.push("$resolveLinks: [String!]"),r.push("resolveLinks: $resolveLinks"),t.resolveLinks=e.resolveLinks),e.validateSchema!==void 0&&(s.push("$validateSchema: Boolean"),r.push("validateSchema: $validateSchema"),t.validateSchema=e.validateSchema);let a=e.resolveLinks&&e.resolveLinks.length>0,n=b({includePricing:e.includePricing}),c=a?`${n}
|
|
1201
|
+
${ae}`:n;return {query:`
|
|
1222
1202
|
query DatasetRecord(${s.join(", ")}) {
|
|
1223
1203
|
datasetRecord(${r.join(", ")}) {
|
|
1224
1204
|
${c}
|
|
@@ -1227,7 +1207,7 @@ ${ie}`:n;return {query:`
|
|
|
1227
1207
|
`,variables:t}},upsertDatasetRecords(){return {query:`
|
|
1228
1208
|
mutation DatasetRecordsUpsert($input: DatasetRecordsUpsertInput!) {
|
|
1229
1209
|
datasetRecordsUpsert(input: $input) {
|
|
1230
|
-
${
|
|
1210
|
+
${Ge}
|
|
1231
1211
|
}
|
|
1232
1212
|
}
|
|
1233
1213
|
`}},deleteDatasetRecords(){return {query:`
|
|
@@ -1251,117 +1231,117 @@ ${ie}`:n;return {query:`
|
|
|
1251
1231
|
`,variables:t}},datasetImportPreview(){return {query:`
|
|
1252
1232
|
query DatasetImportPreview($input: DatasetImportPreviewInput!) {
|
|
1253
1233
|
datasetImportPreview(input: $input) {
|
|
1254
|
-
${
|
|
1234
|
+
${Ne}
|
|
1255
1235
|
}
|
|
1256
1236
|
}
|
|
1257
1237
|
`}},datasetImportValidate(){return {query:`
|
|
1258
1238
|
query DatasetImportValidate($input: DatasetImportValidateInput!) {
|
|
1259
1239
|
datasetImportValidate(input: $input) {
|
|
1260
|
-
${
|
|
1240
|
+
${ge}
|
|
1261
1241
|
}
|
|
1262
1242
|
}
|
|
1263
1243
|
`}},datasetImportFromFile(){return {query:`
|
|
1264
1244
|
mutation DatasetImportFromFile($input: DatasetImportFromFileInput!) {
|
|
1265
1245
|
datasetImportFromFile(input: $input) {
|
|
1266
|
-
${
|
|
1246
|
+
${$}
|
|
1267
1247
|
}
|
|
1268
1248
|
}
|
|
1269
1249
|
`}},datasetImportFromPayload(){return {query:`
|
|
1270
1250
|
mutation DatasetImportFromPayload($input: DatasetImportFromPayloadInput!) {
|
|
1271
1251
|
datasetImportFromPayload(input: $input) {
|
|
1272
|
-
${
|
|
1252
|
+
${$}
|
|
1273
1253
|
}
|
|
1274
1254
|
}
|
|
1275
1255
|
`}},datasetImportFromUrl(){return {query:`
|
|
1276
1256
|
mutation DatasetImportFromUrl($input: DatasetImportFromUrlInput!) {
|
|
1277
1257
|
datasetImportFromUrl(input: $input) {
|
|
1278
|
-
${
|
|
1258
|
+
${$}
|
|
1279
1259
|
}
|
|
1280
1260
|
}
|
|
1281
1261
|
`}},importJob(){return {query:`
|
|
1282
1262
|
query ImportJob($id: UUID!) {
|
|
1283
1263
|
importJob(id: $id) {
|
|
1284
|
-
${
|
|
1264
|
+
${$}
|
|
1285
1265
|
}
|
|
1286
1266
|
}
|
|
1287
1267
|
`}},importJobs(e){let t={publisherId:e.publisherId},r=["publisherId: $publisherId"],s=["$publisherId: UUID!"];return e.datasetId!==void 0&&(s.push("$datasetId: UUID"),r.push("datasetId: $datasetId"),t.datasetId=e.datasetId),e.status!==void 0&&(s.push("$status: ImportJobStatus"),r.push("status: $status"),t.status=e.status),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),{query:`
|
|
1288
1268
|
query ImportJobs(${s.join(", ")}) {
|
|
1289
1269
|
importJobs(${r.join(", ")}) {
|
|
1290
|
-
${d(
|
|
1270
|
+
${d($)}
|
|
1291
1271
|
}
|
|
1292
1272
|
}
|
|
1293
1273
|
`,variables:t}},importJobCancel(){return {query:`
|
|
1294
1274
|
mutation ImportJobCancel($id: UUID!) {
|
|
1295
1275
|
importJobCancel(id: $id) {
|
|
1296
|
-
${
|
|
1276
|
+
${$}
|
|
1297
1277
|
}
|
|
1298
1278
|
}
|
|
1299
|
-
`}},importJobLogs(e){let t={importJobId:e.importJobId},r=["id: $importJobId"],s=[],
|
|
1300
|
-
query ImportJobLogs(${
|
|
1279
|
+
`}},importJobLogs(e){let t={importJobId:e.importJobId},r=["id: $importJobId"],s=[],a=["$importJobId: UUID!"];e.level!==void 0&&(a.push("$level: ImportLogLevel"),s.push("level: $level"),t.level=e.level),e.datasetKey!==void 0&&(a.push("$datasetKey: String"),s.push("datasetKey: $datasetKey"),t.datasetKey=e.datasetKey),e.first!==void 0&&(a.push("$first: Int"),s.push("first: $first"),t.first=e.first),e.after!==void 0&&(a.push("$after: String"),s.push("after: $after"),t.after=e.after);let n=s.length>0?`(${s.join(", ")})`:"";return {query:`
|
|
1280
|
+
query ImportJobLogs(${a.join(", ")}) {
|
|
1301
1281
|
importJob(${r.join(", ")}) {
|
|
1302
1282
|
logs${n} {
|
|
1303
|
-
${d(
|
|
1283
|
+
${d(Je)}
|
|
1304
1284
|
}
|
|
1305
1285
|
}
|
|
1306
1286
|
}
|
|
1307
1287
|
`,variables:t}},gameImportPreview(){return {query:`
|
|
1308
1288
|
query GameImportPreview($input: GameImportPreviewInput!) {
|
|
1309
1289
|
gameImportPreview(input: $input) {
|
|
1310
|
-
${
|
|
1290
|
+
${je}
|
|
1311
1291
|
}
|
|
1312
1292
|
}
|
|
1313
1293
|
`}},gameImportFromFile(){return {query:`
|
|
1314
1294
|
mutation GameImportFromFile($input: GameImportFromFileInput!) {
|
|
1315
1295
|
gameImportFromFile(input: $input) {
|
|
1316
|
-
${
|
|
1296
|
+
${D}
|
|
1317
1297
|
}
|
|
1318
1298
|
}
|
|
1319
1299
|
`}},gameImportFromPayload(){return {query:`
|
|
1320
1300
|
mutation GameImportFromPayload($input: GameImportFromPayloadInput!) {
|
|
1321
1301
|
gameImportFromPayload(input: $input) {
|
|
1322
|
-
${
|
|
1302
|
+
${D}
|
|
1323
1303
|
}
|
|
1324
1304
|
}
|
|
1325
1305
|
`}},gameImportFromUrl(){return {query:`
|
|
1326
1306
|
mutation GameImportFromUrl($input: GameImportFromUrlInput!) {
|
|
1327
1307
|
gameImportFromUrl(input: $input) {
|
|
1328
|
-
${
|
|
1308
|
+
${D}
|
|
1329
1309
|
}
|
|
1330
1310
|
}
|
|
1331
1311
|
`}},gameImportJob(){return {query:`
|
|
1332
1312
|
query GameImportJob($id: UUID!) {
|
|
1333
1313
|
gameImportJob(id: $id) {
|
|
1334
|
-
${
|
|
1314
|
+
${D}
|
|
1335
1315
|
}
|
|
1336
1316
|
}
|
|
1337
1317
|
`}},gameImportJobs(e){let t={gameId:e.gameId},r=["gameId: $gameId"],s=["$gameId: UUID!"];return e.status!==void 0&&(s.push("$status: ImportJobStatus"),r.push("status: $status"),t.status=e.status),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),{query:`
|
|
1338
1318
|
query GameImportJobs(${s.join(", ")}) {
|
|
1339
1319
|
gameImportJobs(${r.join(", ")}) {
|
|
1340
|
-
${d(
|
|
1320
|
+
${d(D)}
|
|
1341
1321
|
}
|
|
1342
1322
|
}
|
|
1343
1323
|
`,variables:t}},gameImportJobCancel(){return {query:`
|
|
1344
1324
|
mutation GameImportJobCancel($id: UUID!) {
|
|
1345
1325
|
gameImportJobCancel(id: $id) {
|
|
1346
|
-
${
|
|
1326
|
+
${D}
|
|
1347
1327
|
}
|
|
1348
1328
|
}
|
|
1349
1329
|
`}},file(){return {query:`
|
|
1350
1330
|
query File($id: UUID!) {
|
|
1351
1331
|
file(id: $id) {
|
|
1352
|
-
${
|
|
1332
|
+
${E}
|
|
1353
1333
|
}
|
|
1354
1334
|
}
|
|
1355
1335
|
`}},fileUploadRequest(){return {query:`
|
|
1356
1336
|
mutation FileUploadRequest($input: FileUploadInput!) {
|
|
1357
1337
|
fileUploadRequest(input: $input) {
|
|
1358
|
-
${
|
|
1338
|
+
${Z}
|
|
1359
1339
|
}
|
|
1360
1340
|
}
|
|
1361
1341
|
`}},fileUploadConfirm(){return {query:`
|
|
1362
1342
|
mutation FileUploadConfirm($id: UUID!) {
|
|
1363
1343
|
fileUploadConfirm(id: $id) {
|
|
1364
|
-
${
|
|
1344
|
+
${E}
|
|
1365
1345
|
}
|
|
1366
1346
|
}
|
|
1367
1347
|
`}},fileDelete(){return {query:`
|
|
@@ -1371,20 +1351,20 @@ ${ie}`:n;return {query:`
|
|
|
1371
1351
|
`}},createScanUploadSession(){return {query:`
|
|
1372
1352
|
mutation CreateScanUploadSession($input: CreateScanUploadSessionInput!) {
|
|
1373
1353
|
createScanUploadSession(input: $input) {
|
|
1374
|
-
${
|
|
1354
|
+
${Z}
|
|
1375
1355
|
}
|
|
1376
1356
|
}
|
|
1377
1357
|
`}},confirmScanUpload(){return {query:`
|
|
1378
1358
|
mutation ConfirmScanUpload($input: ConfirmScanUploadInput!) {
|
|
1379
1359
|
confirmScanUpload(input: $input) {
|
|
1380
|
-
${
|
|
1360
|
+
${E}
|
|
1381
1361
|
}
|
|
1382
1362
|
}
|
|
1383
1363
|
`}},createScanJob(){return {query:`
|
|
1384
1364
|
mutation CreateScanJob($input: CreateScanJobInput!) {
|
|
1385
1365
|
createScanJob(input: $input) {
|
|
1386
1366
|
job {
|
|
1387
|
-
${
|
|
1367
|
+
${ie}
|
|
1388
1368
|
}
|
|
1389
1369
|
created
|
|
1390
1370
|
}
|
|
@@ -1392,7 +1372,7 @@ ${ie}`:n;return {query:`
|
|
|
1392
1372
|
`}},scanJob(){return {query:`
|
|
1393
1373
|
query ScanJob($id: UUID!) {
|
|
1394
1374
|
scanJob(id: $id) {
|
|
1395
|
-
${
|
|
1375
|
+
${ie}
|
|
1396
1376
|
}
|
|
1397
1377
|
}
|
|
1398
1378
|
`}},submitScanFeedback(){return {query:`
|
|
@@ -1412,17 +1392,17 @@ ${ie}`:n;return {query:`
|
|
|
1412
1392
|
`}},scanMetrics(){return {query:`
|
|
1413
1393
|
query ScanMetrics($input: ScanMetricsInput!) {
|
|
1414
1394
|
scanMetrics(input: $input) {
|
|
1415
|
-
${
|
|
1395
|
+
${Xe}
|
|
1416
1396
|
}
|
|
1417
1397
|
}
|
|
1418
1398
|
`}},resolveScanTemplate(){return {query:`
|
|
1419
1399
|
query ResolveScanTemplate($input: ResolveScanTemplateInput!) {
|
|
1420
1400
|
resolveScanTemplate(input: $input) {
|
|
1421
1401
|
template {
|
|
1422
|
-
${
|
|
1402
|
+
${C}
|
|
1423
1403
|
}
|
|
1424
1404
|
warnings {
|
|
1425
|
-
${
|
|
1405
|
+
${q}
|
|
1426
1406
|
}
|
|
1427
1407
|
}
|
|
1428
1408
|
}
|
|
@@ -1430,7 +1410,7 @@ ${ie}`:n;return {query:`
|
|
|
1430
1410
|
query ScanTemplates($input: ScanTemplatesInput!) {
|
|
1431
1411
|
scanTemplates(input: $input) {
|
|
1432
1412
|
templates {
|
|
1433
|
-
${
|
|
1413
|
+
${C}
|
|
1434
1414
|
}
|
|
1435
1415
|
}
|
|
1436
1416
|
}
|
|
@@ -1438,10 +1418,10 @@ ${ie}`:n;return {query:`
|
|
|
1438
1418
|
mutation CreateScanTemplate($input: SaveScanTemplateInput!) {
|
|
1439
1419
|
createScanTemplate(input: $input) {
|
|
1440
1420
|
template {
|
|
1441
|
-
${
|
|
1421
|
+
${C}
|
|
1442
1422
|
}
|
|
1443
1423
|
warnings {
|
|
1444
|
-
${
|
|
1424
|
+
${q}
|
|
1445
1425
|
}
|
|
1446
1426
|
}
|
|
1447
1427
|
}
|
|
@@ -1449,10 +1429,10 @@ ${ie}`:n;return {query:`
|
|
|
1449
1429
|
mutation UpdateScanTemplate($id: UUID!, $input: SaveScanTemplateInput!) {
|
|
1450
1430
|
updateScanTemplate(id: $id, input: $input) {
|
|
1451
1431
|
template {
|
|
1452
|
-
${
|
|
1432
|
+
${C}
|
|
1453
1433
|
}
|
|
1454
1434
|
warnings {
|
|
1455
|
-
${
|
|
1435
|
+
${q}
|
|
1456
1436
|
}
|
|
1457
1437
|
}
|
|
1458
1438
|
}
|
|
@@ -1460,10 +1440,10 @@ ${ie}`:n;return {query:`
|
|
|
1460
1440
|
mutation PreviewScanTemplate($input: PreviewScanTemplateInput!) {
|
|
1461
1441
|
previewScanTemplate(input: $input) {
|
|
1462
1442
|
warnings {
|
|
1463
|
-
${
|
|
1443
|
+
${q}
|
|
1464
1444
|
}
|
|
1465
1445
|
regions {
|
|
1466
|
-
${
|
|
1446
|
+
${Ze}
|
|
1467
1447
|
}
|
|
1468
1448
|
message
|
|
1469
1449
|
}
|
|
@@ -1471,59 +1451,59 @@ ${ie}`:n;return {query:`
|
|
|
1471
1451
|
`}},gameScanRegions(){return {query:`
|
|
1472
1452
|
query GameScanRegions($publisherSlug: String!, $gameKey: String!, $includeInactive: Boolean) {
|
|
1473
1453
|
gameScanRegions(publisherSlug: $publisherSlug, gameKey: $gameKey, includeInactive: $includeInactive) {
|
|
1474
|
-
${
|
|
1454
|
+
${et}
|
|
1475
1455
|
}
|
|
1476
1456
|
}
|
|
1477
1457
|
`}},exportJob(){return {query:`
|
|
1478
1458
|
query ExportJob($id: UUID!) {
|
|
1479
1459
|
exportJob(id: $id) {
|
|
1480
|
-
${
|
|
1460
|
+
${A}
|
|
1481
1461
|
}
|
|
1482
1462
|
}
|
|
1483
1463
|
`}},exportJobs(e){let t={publisherId:e.publisherId},r=["publisherId: $publisherId"],s=["$publisherId: UUID!"];return e.gameId!==void 0&&(s.push("$gameId: UUID"),r.push("gameId: $gameId"),t.gameId=e.gameId),e.datasetId!==void 0&&(s.push("$datasetId: UUID"),r.push("datasetId: $datasetId"),t.datasetId=e.datasetId),e.status!==void 0&&(s.push("$status: ExportJobStatus"),r.push("status: $status"),t.status=e.status),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),{query:`
|
|
1484
1464
|
query ExportJobs(${s.join(", ")}) {
|
|
1485
1465
|
exportJobs(${r.join(", ")}) {
|
|
1486
|
-
${d(
|
|
1466
|
+
${d(A)}
|
|
1487
1467
|
}
|
|
1488
1468
|
}
|
|
1489
1469
|
`,variables:t}},datasetExport(){return {query:`
|
|
1490
1470
|
mutation DatasetExport($input: DatasetExportInput!) {
|
|
1491
1471
|
datasetExport(input: $input) {
|
|
1492
|
-
${
|
|
1472
|
+
${A}
|
|
1493
1473
|
}
|
|
1494
1474
|
}
|
|
1495
1475
|
`}},exportJobCancel(){return {query:`
|
|
1496
1476
|
mutation ExportJobCancel($id: UUID!) {
|
|
1497
1477
|
exportJobCancel(id: $id) {
|
|
1498
|
-
${
|
|
1478
|
+
${A}
|
|
1499
1479
|
}
|
|
1500
1480
|
}
|
|
1501
1481
|
`}},exportJobRefreshUrl(){return {query:`
|
|
1502
1482
|
mutation ExportJobRefreshUrl($id: UUID!) {
|
|
1503
1483
|
exportJobRefreshUrl(id: $id) {
|
|
1504
|
-
${
|
|
1484
|
+
${A}
|
|
1505
1485
|
}
|
|
1506
1486
|
}
|
|
1507
|
-
`}},listMyDecks(e={}){let t={},r=[],s=[];e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),e.includeArchived!==void 0&&(s.push("$includeArchived: Boolean"),r.push("includeArchived: $includeArchived"),t.includeArchived=e.includeArchived);let
|
|
1508
|
-
query MyDecks${
|
|
1487
|
+
`}},listMyDecks(e={}){let t={},r=[],s=[];e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),e.includeArchived!==void 0&&(s.push("$includeArchived: Boolean"),r.push("includeArchived: $includeArchived"),t.includeArchived=e.includeArchived);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1488
|
+
query MyDecks${a} {
|
|
1509
1489
|
myDecks${n} {
|
|
1510
1490
|
${d(u)}
|
|
1511
1491
|
}
|
|
1512
1492
|
}
|
|
1513
|
-
`,variables:t}},viewerDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: ViewerDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let
|
|
1514
|
-
query ViewerDecks${
|
|
1493
|
+
`,variables:t}},viewerDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: ViewerDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1494
|
+
query ViewerDecks${a} {
|
|
1515
1495
|
viewerDecks${n} {
|
|
1516
1496
|
${d(u)}
|
|
1517
1497
|
}
|
|
1518
1498
|
}
|
|
1519
|
-
`,variables:t}},appDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: AppDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let
|
|
1520
|
-
query AppDecks${
|
|
1499
|
+
`,variables:t}},appDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: AppDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1500
|
+
query AppDecks${a} {
|
|
1521
1501
|
appDecks${n} {
|
|
1522
1502
|
${d(u)}
|
|
1523
1503
|
}
|
|
1524
1504
|
}
|
|
1525
|
-
`,variables:t}},publicDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: PublicDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let
|
|
1526
|
-
query PublicDecks${
|
|
1505
|
+
`,variables:t}},publicDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: PublicDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1506
|
+
query PublicDecks${a} {
|
|
1527
1507
|
publicDecks${n} {
|
|
1528
1508
|
${d(u)}
|
|
1529
1509
|
}
|
|
@@ -1535,8 +1515,8 @@ ${ie}`:n;return {query:`
|
|
|
1535
1515
|
}
|
|
1536
1516
|
}
|
|
1537
1517
|
`}},deckById(){return {query:`
|
|
1538
|
-
query Deck($id: UUID
|
|
1539
|
-
deck(id: $id) {
|
|
1518
|
+
query Deck($id: UUID!, $readState: DeckReadState!, $version: DeckPublishedVersionSelector) {
|
|
1519
|
+
deck(id: $id, readState: $readState, version: $version) {
|
|
1540
1520
|
${u}
|
|
1541
1521
|
}
|
|
1542
1522
|
}
|
|
@@ -1565,129 +1545,93 @@ ${ie}`:n;return {query:`
|
|
|
1565
1545
|
}
|
|
1566
1546
|
}
|
|
1567
1547
|
`}},deckByExternalRef(){return {query:`
|
|
1568
|
-
query DeckByExternalRef($externalRef: String
|
|
1569
|
-
deckByExternalRef(externalRef: $externalRef) {
|
|
1548
|
+
query DeckByExternalRef($externalRef: String!, $readState: DeckReadState!, $version: DeckPublishedVersionSelector) {
|
|
1549
|
+
deckByExternalRef(externalRef: $externalRef, readState: $readState, version: $version) {
|
|
1570
1550
|
${u}
|
|
1571
1551
|
}
|
|
1572
1552
|
}
|
|
1573
1553
|
`}},deckVersion(){return {query:`
|
|
1574
1554
|
query DeckVersion($id: UUID!) {
|
|
1575
1555
|
deckVersion(id: $id) {
|
|
1576
|
-
${
|
|
1556
|
+
${K}
|
|
1577
1557
|
}
|
|
1578
1558
|
}
|
|
1579
1559
|
`}},deckVersions(e={}){let t={},r=["deckId: $deckId"],s=["$deckId: UUID!"];return e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),{query:`
|
|
1580
1560
|
query DeckVersions(${s.join(", ")}) {
|
|
1581
1561
|
deckVersions(${r.join(", ")}) {
|
|
1582
|
-
${d(
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
`,variables:t}},deckPreview(){return {query:`
|
|
1586
|
-
query DeckPreview($token: String!) {
|
|
1587
|
-
deckPreview(token: $token) {
|
|
1588
|
-
${u}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
`}},deckEmbed(){return {query:`
|
|
1592
|
-
query DeckEmbed($token: String!) {
|
|
1593
|
-
deckEmbed(token: $token) {
|
|
1594
|
-
${u}
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
`}},deckAccess(){return {query:`
|
|
1598
|
-
query DeckAccess($token: String!) {
|
|
1599
|
-
deckAccess(token: $token) {
|
|
1600
|
-
${u}
|
|
1562
|
+
${d(K)}
|
|
1601
1563
|
}
|
|
1602
1564
|
}
|
|
1603
|
-
|
|
1565
|
+
`,variables:t}},deckDraftDiff(){return {query:`
|
|
1604
1566
|
query DeckDraftDiff($id: UUID!) {
|
|
1605
1567
|
deckDraftDiff(id: $id) {
|
|
1606
|
-
${
|
|
1568
|
+
${ee}
|
|
1607
1569
|
}
|
|
1608
1570
|
}
|
|
1609
1571
|
`}},deckVersionDiff(){return {query:`
|
|
1610
1572
|
query DeckVersionDiff($fromVersionId: UUID!, $toVersionId: UUID!) {
|
|
1611
1573
|
deckVersionDiff(fromVersionId: $fromVersionId, toVersionId: $toVersionId) {
|
|
1612
|
-
${
|
|
1574
|
+
${ee}
|
|
1613
1575
|
}
|
|
1614
1576
|
}
|
|
1615
1577
|
`}},deckHydrateEntries(){return {query:`
|
|
1616
1578
|
query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
|
|
1617
1579
|
deckHydrateEntries(input: $input) {
|
|
1618
|
-
${
|
|
1580
|
+
${Ue}
|
|
1619
1581
|
}
|
|
1620
1582
|
}
|
|
1621
1583
|
`}},deckExport(){return {query:`
|
|
1622
1584
|
query DeckExport($id: UUID!, $format: DeckExportFormat!) {
|
|
1623
1585
|
deckExport(id: $id, format: $format) {
|
|
1624
|
-
${
|
|
1586
|
+
${Fe}
|
|
1625
1587
|
}
|
|
1626
1588
|
}
|
|
1627
1589
|
`}},deckValidate(){return {query:`
|
|
1628
1590
|
query DeckValidate($id: UUID!, $input: DeckValidateInput) {
|
|
1629
1591
|
deckValidate(id: $id, input: $input) {
|
|
1630
|
-
${
|
|
1592
|
+
${H}
|
|
1631
1593
|
}
|
|
1632
1594
|
}
|
|
1633
|
-
`}},deckSectionDefinitions(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.gameKey!==void 0&&(s.push("$gameKey: String"),r.push("gameKey: $gameKey"),t.gameKey=e.gameKey),e.gameId!==void 0&&(s.push("$gameId: UUID"),r.push("gameId: $gameId"),t.gameId=e.gameId),e.rulesetKey!==void 0&&(s.push("$rulesetKey: String"),r.push("rulesetKey: $rulesetKey"),t.rulesetKey=e.rulesetKey),e.rulesetVersionId!==void 0&&(s.push("$rulesetVersionId: UUID"),r.push("rulesetVersionId: $rulesetVersionId"),t.rulesetVersionId=e.rulesetVersionId);let
|
|
1634
|
-
query DeckSectionDefinitions${
|
|
1595
|
+
`}},deckSectionDefinitions(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.gameKey!==void 0&&(s.push("$gameKey: String"),r.push("gameKey: $gameKey"),t.gameKey=e.gameKey),e.gameId!==void 0&&(s.push("$gameId: UUID"),r.push("gameId: $gameId"),t.gameId=e.gameId),e.rulesetKey!==void 0&&(s.push("$rulesetKey: String"),r.push("rulesetKey: $rulesetKey"),t.rulesetKey=e.rulesetKey),e.rulesetVersionId!==void 0&&(s.push("$rulesetVersionId: UUID"),r.push("rulesetVersionId: $rulesetVersionId"),t.rulesetVersionId=e.rulesetVersionId);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1596
|
+
query DeckSectionDefinitions${a} {
|
|
1635
1597
|
deckSectionDefinitions${n} {
|
|
1636
|
-
${
|
|
1598
|
+
${j}
|
|
1637
1599
|
}
|
|
1638
1600
|
}
|
|
1639
1601
|
`,variables:t}},deckCollaborators(){return {query:`
|
|
1640
1602
|
query DeckCollaborators($deckId: UUID!) {
|
|
1641
1603
|
deckCollaborators(deckId: $deckId) {
|
|
1642
|
-
${
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
`}},deckEmbedTokens(){return {query:`
|
|
1646
|
-
query DeckEmbedTokens($deckId: UUID!) {
|
|
1647
|
-
deckEmbedTokens(deckId: $deckId) {
|
|
1648
|
-
${re}
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
`}},deckAccessTokenIssuers(){return {query:`
|
|
1652
|
-
query DeckAccessTokenIssuers($deckId: UUID!) {
|
|
1653
|
-
deckAccessTokenIssuers(deckId: $deckId) {
|
|
1654
|
-
${P}
|
|
1604
|
+
${te}
|
|
1655
1605
|
}
|
|
1656
1606
|
}
|
|
1657
1607
|
`}},deckApiApplicationAccesses(){return {query:`
|
|
1658
1608
|
query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) {
|
|
1659
1609
|
deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) {
|
|
1660
|
-
${
|
|
1610
|
+
${V}
|
|
1661
1611
|
}
|
|
1662
1612
|
}
|
|
1663
1613
|
`}},myDeckApiApplicationAccesses(){return {query:`
|
|
1664
1614
|
query MyDeckApiApplicationAccesses($applicationId: UUID) {
|
|
1665
1615
|
myDeckApiApplicationAccesses(applicationId: $applicationId) {
|
|
1666
|
-
${
|
|
1616
|
+
${V}
|
|
1667
1617
|
}
|
|
1668
1618
|
}
|
|
1669
|
-
`}},deckImportFormats(e){let t={},r=[],s=[];e.publisherId!==void 0&&(s.push("$publisherId: UUID"),r.push("publisherId: $publisherId"),t.publisherId=e.publisherId),e.gameId!==void 0&&(s.push("$gameId: UUID"),r.push("gameId: $gameId"),t.gameId=e.gameId),e.includeArchived!==void 0&&(s.push("$includeArchived: Boolean"),r.push("includeArchived: $includeArchived"),t.includeArchived=e.includeArchived),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let
|
|
1670
|
-
query DeckImportFormats${
|
|
1619
|
+
`}},deckImportFormats(e){let t={},r=[],s=[];e.publisherId!==void 0&&(s.push("$publisherId: UUID"),r.push("publisherId: $publisherId"),t.publisherId=e.publisherId),e.gameId!==void 0&&(s.push("$gameId: UUID"),r.push("gameId: $gameId"),t.gameId=e.gameId),e.includeArchived!==void 0&&(s.push("$includeArchived: Boolean"),r.push("includeArchived: $includeArchived"),t.includeArchived=e.includeArchived),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let a=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1620
|
+
query DeckImportFormats${a} {
|
|
1671
1621
|
deckImportFormats${n} {
|
|
1672
|
-
${d(
|
|
1622
|
+
${d(k)}
|
|
1673
1623
|
}
|
|
1674
1624
|
}
|
|
1675
1625
|
`,variables:t}},deckImportFormat(){return {query:`
|
|
1676
1626
|
query DeckImportFormat($id: UUID, $gameId: UUID, $key: String) {
|
|
1677
1627
|
deckImportFormat(id: $id, gameId: $gameId, key: $key) {
|
|
1678
|
-
${
|
|
1628
|
+
${k}
|
|
1679
1629
|
}
|
|
1680
1630
|
}
|
|
1681
1631
|
`}},deckImportFormatTest(){return {query:`
|
|
1682
1632
|
query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
|
|
1683
1633
|
deckImportFormatTest(input: $input) {
|
|
1684
|
-
${
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
`}},deckPreviewTokens(){return {query:`
|
|
1688
|
-
query DeckPreviewTokens($deckId: UUID!) {
|
|
1689
|
-
deckPreviewTokens(deckId: $deckId) {
|
|
1690
|
-
${te}
|
|
1634
|
+
${Ke}
|
|
1691
1635
|
}
|
|
1692
1636
|
}
|
|
1693
1637
|
`}},createDeck(){return {query:`
|
|
@@ -1727,61 +1671,61 @@ ${ie}`:n;return {query:`
|
|
|
1727
1671
|
`}},addDeckEntry(){return {query:`
|
|
1728
1672
|
mutation DeckEntryAdd($input: DeckEntryAddInput!) {
|
|
1729
1673
|
deckEntryAdd(input: $input) {
|
|
1730
|
-
${
|
|
1674
|
+
${B}
|
|
1731
1675
|
}
|
|
1732
1676
|
}
|
|
1733
1677
|
`}},updateDeckEntry(){return {query:`
|
|
1734
1678
|
mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) {
|
|
1735
1679
|
deckEntryUpdate(id: $id, input: $input) {
|
|
1736
|
-
${
|
|
1680
|
+
${B}
|
|
1737
1681
|
}
|
|
1738
1682
|
}
|
|
1739
1683
|
`}},removeDeckEntry(){return {query:`
|
|
1740
1684
|
mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) {
|
|
1741
1685
|
deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) {
|
|
1742
|
-
${
|
|
1686
|
+
${B}
|
|
1743
1687
|
}
|
|
1744
1688
|
}
|
|
1745
1689
|
`}},reorderDeckEntries(){return {query:`
|
|
1746
1690
|
mutation DeckEntryReorder($deckId: UUID!, $input: DeckEntryReorderInput!) {
|
|
1747
1691
|
deckEntryReorder(deckId: $deckId, input: $input) {
|
|
1748
|
-
${
|
|
1692
|
+
${pe}
|
|
1749
1693
|
}
|
|
1750
1694
|
}
|
|
1751
1695
|
`}},replaceDeckEntries(){return {query:`
|
|
1752
1696
|
mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
|
|
1753
1697
|
deckEntriesReplace(deckId: $deckId, input: $input) {
|
|
1754
|
-
${
|
|
1698
|
+
${Be}
|
|
1755
1699
|
}
|
|
1756
1700
|
}
|
|
1757
1701
|
`}},importDeck(){return {query:`
|
|
1758
1702
|
mutation DeckImport($input: DeckImportInput!) {
|
|
1759
1703
|
deckImport(input: $input) {
|
|
1760
|
-
${
|
|
1704
|
+
${_e}
|
|
1761
1705
|
}
|
|
1762
1706
|
}
|
|
1763
1707
|
`}},createDeckImportFormat(){return {query:`
|
|
1764
1708
|
mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
|
|
1765
1709
|
deckImportFormatCreate(input: $input) {
|
|
1766
|
-
${
|
|
1710
|
+
${k}
|
|
1767
1711
|
}
|
|
1768
1712
|
}
|
|
1769
1713
|
`}},updateDeckImportFormat(){return {query:`
|
|
1770
1714
|
mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
|
|
1771
1715
|
deckImportFormatUpdate(id: $id, input: $input) {
|
|
1772
|
-
${
|
|
1716
|
+
${k}
|
|
1773
1717
|
}
|
|
1774
1718
|
}
|
|
1775
1719
|
`}},archiveDeckImportFormat(){return {query:`
|
|
1776
1720
|
mutation DeckImportFormatArchive($id: UUID!) {
|
|
1777
1721
|
deckImportFormatArchive(id: $id) {
|
|
1778
|
-
${
|
|
1722
|
+
${k}
|
|
1779
1723
|
}
|
|
1780
1724
|
}
|
|
1781
1725
|
`}},unarchiveDeckImportFormat(){return {query:`
|
|
1782
1726
|
mutation DeckImportFormatUnarchive($id: UUID!) {
|
|
1783
1727
|
deckImportFormatUnarchive(id: $id) {
|
|
1784
|
-
${
|
|
1728
|
+
${k}
|
|
1785
1729
|
}
|
|
1786
1730
|
}
|
|
1787
1731
|
`}},upsertDeckByExternalRef(){return {query:`
|
|
@@ -1809,13 +1753,13 @@ ${ie}`:n;return {query:`
|
|
|
1809
1753
|
`}},copyDeck(){return {query:`
|
|
1810
1754
|
mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
|
|
1811
1755
|
deckCopy(id: $id, input: $input) {
|
|
1812
|
-
${
|
|
1756
|
+
${Pe}
|
|
1813
1757
|
}
|
|
1814
1758
|
}
|
|
1815
1759
|
`}},publishDeck(){return {query:`
|
|
1816
1760
|
mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
|
|
1817
1761
|
deckPublish(id: $id, input: $input) {
|
|
1818
|
-
${
|
|
1762
|
+
${Ve}
|
|
1819
1763
|
}
|
|
1820
1764
|
}
|
|
1821
1765
|
`}},removeInvalidDeckEntries(){return {query:`
|
|
@@ -1827,99 +1771,53 @@ ${ie}`:n;return {query:`
|
|
|
1827
1771
|
`}},upsertDeckCollaborator(){return {query:`
|
|
1828
1772
|
mutation DeckCollaboratorUpsert($deckId: UUID!, $accountId: UUID!, $role: DeckCollaboratorRole!) {
|
|
1829
1773
|
deckCollaboratorUpsert(deckId: $deckId, accountId: $accountId, role: $role) {
|
|
1830
|
-
${
|
|
1774
|
+
${te}
|
|
1831
1775
|
}
|
|
1832
1776
|
}
|
|
1833
1777
|
`}},removeDeckCollaborator(){return {query:`
|
|
1834
1778
|
mutation DeckCollaboratorRemove($deckId: UUID!, $accountId: UUID!) {
|
|
1835
1779
|
deckCollaboratorRemove(deckId: $deckId, accountId: $accountId)
|
|
1836
1780
|
}
|
|
1837
|
-
`}},
|
|
1838
|
-
mutation
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
previewToken {
|
|
1842
|
-
${te}
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
`}},revokeDeckPreviewToken(){return {query:`
|
|
1847
|
-
mutation DeckPreviewTokenRevoke($id: UUID!) {
|
|
1848
|
-
deckPreviewTokenRevoke(id: $id)
|
|
1849
|
-
}
|
|
1850
|
-
`}},createDeckEmbedToken(){return {query:`
|
|
1851
|
-
mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) {
|
|
1852
|
-
deckEmbedTokenCreate(input: $input) {
|
|
1853
|
-
token
|
|
1854
|
-
embedToken {
|
|
1855
|
-
${re}
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
`}},revokeDeckEmbedToken(){return {query:`
|
|
1860
|
-
mutation DeckEmbedTokenRevoke($id: UUID!) {
|
|
1861
|
-
deckEmbedTokenRevoke(id: $id)
|
|
1862
|
-
}
|
|
1863
|
-
`}},createDeckAccessTokenIssuer(){return {query:`
|
|
1864
|
-
mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) {
|
|
1865
|
-
deckAccessTokenIssuerCreate(input: $input) {
|
|
1866
|
-
${P}
|
|
1781
|
+
`}},createDeckTokenIssuer(){return {query:`
|
|
1782
|
+
mutation DeckTokenIssuerCreate($input: DeckTokenIssuerCreateInput!) {
|
|
1783
|
+
deckTokenIssuerCreate(input: $input) {
|
|
1784
|
+
${re}
|
|
1867
1785
|
}
|
|
1868
1786
|
}
|
|
1869
|
-
`}},
|
|
1870
|
-
mutation
|
|
1871
|
-
|
|
1787
|
+
`}},revokeDeckTokenIssuer(){return {query:`
|
|
1788
|
+
mutation DeckTokenIssuerRevoke($id: UUID!) {
|
|
1789
|
+
deckTokenIssuerRevoke(id: $id)
|
|
1872
1790
|
}
|
|
1873
|
-
`}},
|
|
1874
|
-
mutation
|
|
1875
|
-
|
|
1876
|
-
${
|
|
1791
|
+
`}},revokeDeckTokenIssuerSigningKey(){return {query:`
|
|
1792
|
+
mutation DeckTokenIssuerSigningKeyRevoke($id: UUID!) {
|
|
1793
|
+
deckTokenIssuerSigningKeyRevoke(id: $id) {
|
|
1794
|
+
${re}
|
|
1877
1795
|
}
|
|
1878
1796
|
}
|
|
1879
|
-
`}},
|
|
1880
|
-
mutation
|
|
1881
|
-
|
|
1797
|
+
`}},exchangeDeckToken(){return {query:`
|
|
1798
|
+
mutation DeckTokenExchange($input: DeckTokenExchangeInput!) {
|
|
1799
|
+
deckTokenExchange(input: $input) {
|
|
1882
1800
|
token
|
|
1883
|
-
|
|
1801
|
+
deckToken {
|
|
1884
1802
|
${Te}
|
|
1885
1803
|
}
|
|
1886
1804
|
}
|
|
1887
1805
|
}
|
|
1888
|
-
`}},
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
id
|
|
1894
|
-
accountId
|
|
1895
|
-
apiApplicationId
|
|
1896
|
-
gameId
|
|
1897
|
-
environment
|
|
1898
|
-
externalSubject
|
|
1899
|
-
scopes
|
|
1900
|
-
expiresAt
|
|
1901
|
-
revokedAt
|
|
1902
|
-
lastUsedAt
|
|
1903
|
-
createdAt
|
|
1904
|
-
updatedAt
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
`}},grantDeckApiApplicationAccess(){return {query:`
|
|
1806
|
+
`}},revokeDeckToken(){return {query:`
|
|
1807
|
+
mutation DeckTokenRevoke($id: UUID!) {
|
|
1808
|
+
deckTokenRevoke(id: $id)
|
|
1809
|
+
}
|
|
1810
|
+
`}},grantDeckApiApplicationAccess(){return {query:`
|
|
1909
1811
|
mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
|
|
1910
1812
|
deckApiApplicationAccessGrant(input: $input) {
|
|
1911
|
-
${
|
|
1813
|
+
${V}
|
|
1912
1814
|
}
|
|
1913
1815
|
}
|
|
1914
1816
|
`}},revokeDeckApiApplicationAccess(){return {query:`
|
|
1915
1817
|
mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
|
|
1916
1818
|
deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
|
|
1917
1819
|
}
|
|
1918
|
-
`}},
|
|
1919
|
-
mutation DeckAccessTokenRevoke($id: UUID!) {
|
|
1920
|
-
deckAccessTokenRevoke(id: $id)
|
|
1921
|
-
}
|
|
1922
|
-
`}},deckCreateVariables(e){return {input:e}},deckUpdateVariables(e,t){return {id:e,input:t}},deckEntryAddVariables(e){return {input:e}},deckEntryUpdateVariables(e,t){return {id:e,input:t}},deckEntryRemoveVariables(e,t){return {id:e,expectedDraftRevision:t}},deckEntryReorderVariables(e,t){return {deckId:e,input:t}},deckEntriesReplaceVariables(e,t){return {deckId:e,input:t}},deckImportVariables(e){return {input:e}},deckImportFormatCreateVariables(e){return {input:e}},deckImportFormatUpdateVariables(e,t){return {id:e,input:t}},deckImportFormatTestVariables(e){return {input:e}},deckUpsertByExternalRefVariables(e){return {input:e}},deckClaimVariables(e,t){return {id:e,input:t}},deckTransferOwnershipVariables(e,t){return {id:e,input:t}},deckCopyVariables(e,t){return {id:e,input:t}},deckPublishVariables(e,t){return {id:e,input:t}},deckValidateVariables(e,t){return t===void 0?{id:e}:{id:e,input:t}},deckRemoveInvalidEntriesVariables(e,t){return {id:e,input:t}},deckHydrateEntriesVariables(e){return {input:e}},deckExportVariables(e,t){return {id:e,format:t}},deckVersionDiffVariables(e,t){return {fromVersionId:e,toVersionId:t}},deckCollaboratorVariables(e,t,r){return r===void 0?{deckId:e,accountId:t}:{deckId:e,accountId:t,role:r}},deckPreviewTokenCreateVariables(e){return {input:e}},deckEmbedTokenCreateVariables(e){return {input:e}},deckAccessTokenIssuerCreateVariables(e){return {input:e}},deckAccessTokenExchangeVariables(e){return {input:e}},deckSessionTokenExchangeVariables(e){return {input:e}},deckApiApplicationAccessesVariables(e,t){return t===void 0?{deckId:e}:{deckId:e,includeRevoked:t}},myDeckApiApplicationAccessesVariables(e){return e===void 0?{}:{applicationId:e}},deckApiApplicationAccessGrantVariables(e){return {input:e}},deckApiApplicationAccessRevokeVariables(e,t){return {deckId:e,apiApplicationId:t}},gameCreateVariables(e){return {input:e}},gameUpdateVariables(e,t){return {id:e,input:t}},datasetImportPreviewVariables(e){return {input:e}},datasetImportValidateVariables(e){return {input:e}},datasetImportFromFileVariables(e){return {input:e}},datasetImportFromPayloadVariables(e){return {input:e}},datasetImportFromUrlVariables(e){return {input:e}},gameImportPreviewVariables(e){return {input:e}},gameImportFromFileVariables(e){return {input:e}},gameImportFromPayloadVariables(e){return {input:e}},gameImportFromUrlVariables(e){return {input:e}},datasetRecordsUpsertVariables(e){return {input:e}},datasetRecordsDeleteVariables(e){return {input:e}},fileUploadRequestVariables(e){return {input:e}},createScanUploadSessionVariables(e){return {input:e}},confirmScanUploadVariables(e){return {input:e}},createScanJobVariables(e){return {input:e}},submitScanFeedbackVariables(e){return {input:e}},scanMetricsVariables(e){return {input:e}},resolveScanTemplateVariables(e){return {input:e}},scanTemplatesVariables(e){return {input:e}},createScanTemplateVariables(e){return {input:e}},updateScanTemplateVariables(e,t){return {id:e,input:t}},previewScanTemplateVariables(e){return {input:e}},gameScanRegionsVariables(e,t,r){return r===void 0?{publisherSlug:e,gameKey:t}:{publisherSlug:e,gameKey:t,includeInactive:r}},datasetExportVariables(e){return {input:e}},fetchMe(){return {query:`
|
|
1820
|
+
`}},deckCreateVariables(e){return {input:I(e)}},deckUpdateVariables(e,t){return {id:e,input:I(t)}},deckEntryAddVariables(e){return {input:I(e)}},deckEntryUpdateVariables(e,t){return {id:e,input:I(t)}},deckEntryRemoveVariables(e,t){return {id:e,expectedDraftRevision:t}},deckEntryReorderVariables(e,t){return {deckId:e,input:t}},deckEntriesReplaceVariables(e,t){return {deckId:e,input:I(t)}},deckImportVariables(e){return {input:e}},deckImportFormatCreateVariables(e){return {input:e}},deckImportFormatUpdateVariables(e,t){return {id:e,input:t}},deckImportFormatTestVariables(e){return {input:e}},deckUpsertByExternalRefVariables(e){return {input:I(e)}},deckReadVariables(e,t,r){return {id:e,readState:t,version:r}},deckExternalRefReadVariables(e,t,r){return {externalRef:e,readState:t,version:r}},deckClaimVariables(e,t){return {id:e,input:t}},deckTransferOwnershipVariables(e,t){return {id:e,input:t}},deckCopyVariables(e,t){return {id:e,input:t}},deckPublishVariables(e,t){return {id:e,input:t}},deckValidateVariables(e,t){return t===void 0?{id:e}:{id:e,input:t}},deckRemoveInvalidEntriesVariables(e,t){return {id:e,input:t}},deckHydrateEntriesVariables(e){return {input:I(e)}},deckExportVariables(e,t){return {id:e,format:t}},deckVersionDiffVariables(e,t){return {fromVersionId:e,toVersionId:t}},deckCollaboratorVariables(e,t,r){return r===void 0?{deckId:e,accountId:t}:{deckId:e,accountId:t,role:r}},deckTokenIssuerCreateVariables(e){return {input:e}},deckTokenExchangeVariables(e){return {input:e}},deckApiApplicationAccessesVariables(e,t){return t===void 0?{deckId:e}:{deckId:e,includeRevoked:t}},myDeckApiApplicationAccessesVariables(e){return e===void 0?{}:{applicationId:e}},deckApiApplicationAccessGrantVariables(e){return {input:e}},deckApiApplicationAccessRevokeVariables(e,t){return {deckId:e,apiApplicationId:t}},gameCreateVariables(e){return {input:e}},gameUpdateVariables(e,t){return {id:e,input:t}},datasetImportPreviewVariables(e){return {input:e}},datasetImportValidateVariables(e){return {input:e}},datasetImportFromFileVariables(e){return {input:e}},datasetImportFromPayloadVariables(e){return {input:e}},datasetImportFromUrlVariables(e){return {input:e}},gameImportPreviewVariables(e){return {input:e}},gameImportFromFileVariables(e){return {input:e}},gameImportFromPayloadVariables(e){return {input:e}},gameImportFromUrlVariables(e){return {input:e}},datasetRecordsUpsertVariables(e){return {input:e}},datasetRecordsDeleteVariables(e){return {input:e}},fileUploadRequestVariables(e){return {input:e}},createScanUploadSessionVariables(e){return {input:e}},confirmScanUploadVariables(e){return {input:e}},createScanJobVariables(e){return {input:e}},submitScanFeedbackVariables(e){return {input:e}},scanMetricsVariables(e){return {input:e}},resolveScanTemplateVariables(e){return {input:e}},scanTemplatesVariables(e){return {input:e}},createScanTemplateVariables(e){return {input:e}},updateScanTemplateVariables(e,t){return {id:e,input:t}},previewScanTemplateVariables(e){return {input:e}},gameScanRegionsVariables(e,t,r){return r===void 0?{publisherSlug:e,gameKey:t}:{publisherSlug:e,gameKey:t,includeInactive:r}},datasetExportVariables(e){return {input:e}},fetchMe(){return {query:`
|
|
1923
1821
|
query FetchMe {
|
|
1924
1822
|
fetchMe {
|
|
1925
1823
|
application {
|
|
@@ -1941,6 +1839,6 @@ ${ie}`:n;return {query:`
|
|
|
1941
1839
|
}
|
|
1942
1840
|
}
|
|
1943
1841
|
}
|
|
1944
|
-
`}}},l=class{totalCount;pageInfo;items;nextPageLoader;constructor(e,t={}){this.totalCount=e.totalCount,this.pageInfo=e.pageInfo,this.items=e.edges.map(r=>t.itemTransformer?t.itemTransformer(r.node):r.node),this.nextPageLoader=t.nextPageLoader;}get hasNextPage(){return this.pageInfo.hasNextPage}get hasPreviousPage(){return this.pageInfo.hasPreviousPage}get endCursor(){return this.pageInfo.endCursor}get startCursor(){return this.pageInfo.startCursor}get length(){return this.items.length}get isEmpty(){return this.items.length===0}get first(){return this.items[0]}get last(){return this.items[this.items.length-1]}async nextPage(){if(!this.hasNextPage)return null;if(!this.nextPageLoader)throw new Error("No next page loader configured");return this.endCursor?this.nextPageLoader(this.endCursor):null}async*[Symbol.asyncIterator](){let e=this;for(;e;){for(let t of e.items)yield t;if(!e.hasNextPage)break;e=await e.nextPage();}}async forEach(e){let t=0;for await(let r of this)await e(r,t++);}async map(e){let t=[],r=0;for await(let s of this)t.push(await e(s,r++));return t}async filter(e){let t=[],r=0;for await(let s of this)await e(s,r++)&&t.push(s);return t}async find(e){let t=0;for await(let r of this)if(await e(r,t++))return r}async take(e){let t=[];for await(let r of this){if(t.length>=e)break;t.push(r);}return t}async toArray(){let e=[];for await(let t of this)e.push(t);return e}async*batches(){let e=this;for(;e&&(e.items.length>0&&(yield e.items),!!e.hasNextPage);)e=await e.nextPage();}each(){return this}};var Qe="https://carddb.dev/query",Ze=3e4,et=1e4,tt=300,rt=3,st=2,it=1e3,at=3e4,nt=class Ie{apiKey;publishableKey;secretKey;accessToken;legacyApiKey;environment;endpoint;timeout;openTimeout;defaultPublisher;defaultGame;allowedPublishers;allowedGames;logger;logLevel;retryOnRateLimit;maxRetries;retryOnNetworkError;maxNetworkRetries;retryBaseDelay;retryMaxDelay;cache;cacheTtl;cacheTtls;constructor(t={}){this.legacyApiKey=t.apiKey,this.publishableKey=t.publishableKey,this.secretKey=t.secretKey,this.accessToken=t.accessToken,this.apiKey=t.apiKey??t.publishableKey??t.secretKey,this.environment=t.environment,this.endpoint=t.endpoint??Qe,this.timeout=t.timeout??Ze,this.openTimeout=t.openTimeout??et,this.defaultPublisher=t.defaultPublisher,this.defaultGame=t.defaultGame,this.allowedPublishers=t.allowedPublishers,this.allowedGames=t.allowedGames,this.logger=t.logger,this.logLevel=t.logLevel??"info",this.retryOnRateLimit=t.retryOnRateLimit??false,this.maxRetries=t.maxRetries??rt,this.retryOnNetworkError=t.retryOnNetworkError??true,this.maxNetworkRetries=t.maxNetworkRetries??st,this.retryBaseDelay=t.retryBaseDelay??it,this.retryMaxDelay=t.retryMaxDelay??at,this.cache=t.cache,this.cacheTtl=t.cacheTtl??tt,this.cacheTtls=t.cacheTtls??{};}calculateRetryDelay(t){let r=this.retryBaseDelay*Math.pow(2,t),s=Math.min(r,this.retryMaxDelay),i=s*.25*(Math.random()*2-1);return Math.round(s+i)}cacheTtlFor(t){return this.cacheTtls[t]??this.cacheTtl}resolvePublisher(t){return t??this.defaultPublisher}resolveGame(t){return t??this.defaultGame}validatePublisher(t){if(this.allowedPublishers&&!this.allowedPublishers.includes(t))throw new $(`Publisher '${t}' is not in the allowed publishers list`)}validateGame(t,r){if(!this.allowedGames)return;let s=this.allowedGames[t];if(s&&!s.includes(r))throw new $(`Game '${r}' is not allowed for publisher '${t}'`)}validateAccess(t,r){t&&(this.validatePublisher(t),r&&this.validateGame(t,r));}requireSecretCredential(t){if(!(!this.accessToken&&(this.legacyApiKey||this.secretKey&&!this.publishableKey)))throw new $(`${t} requires a server-side secretKey or legacy apiKey credential`)}requestApiKey(){return this.legacyApiKey??this.publishableKey??this.secretKey}configApiKey(){return this.legacyApiKey}shouldLog(t){let r={debug:0,info:1,warn:2,error:3};return r[t]>=r[this.logLevel]}merge(t){return new Ie({apiKey:t.apiKey??this.legacyApiKey,publishableKey:t.publishableKey??this.publishableKey,secretKey:t.secretKey??this.secretKey,accessToken:t.accessToken??this.accessToken,environment:t.environment??this.environment,endpoint:t.endpoint??this.endpoint,timeout:t.timeout??this.timeout,openTimeout:t.openTimeout??this.openTimeout,defaultPublisher:t.defaultPublisher??this.defaultPublisher,defaultGame:t.defaultGame??this.defaultGame,allowedPublishers:t.allowedPublishers??this.allowedPublishers,allowedGames:t.allowedGames??this.allowedGames,logger:t.logger??this.logger,logLevel:t.logLevel??this.logLevel,retryOnRateLimit:t.retryOnRateLimit??this.retryOnRateLimit,maxRetries:t.maxRetries??this.maxRetries,retryOnNetworkError:t.retryOnNetworkError??this.retryOnNetworkError,maxNetworkRetries:t.maxNetworkRetries??this.maxNetworkRetries,retryBaseDelay:t.retryBaseDelay??this.retryBaseDelay,retryMaxDelay:t.retryMaxDelay??this.retryMaxDelay,cache:t.cache??this.cache,cacheTtl:t.cacheTtl??this.cacheTtl,cacheTtls:t.cacheTtls??this.cacheTtls})}},be="0.4.1";function ct(){if(typeof globalThis<"u"&&"Bun"in globalThis){let e=globalThis.Bun&&typeof globalThis.Bun=="object"&&globalThis.Bun.version;return {name:"bun",version:typeof e=="string"?e:"unknown"}}if(typeof globalThis<"u"&&"Deno"in globalThis){let e=globalThis.Deno&&typeof globalThis.Deno=="object"&&globalThis.Deno.version&&typeof globalThis.Deno.version=="object"&&globalThis.Deno.version.deno;return {name:"deno",version:typeof e=="string"?e:"unknown"}}return typeof process<"u"&&process.versions&&process.versions.node?{name:"node",version:process.versions.node}:typeof navigator<"u"&&navigator.userAgent?ot(navigator.userAgent):{name:"unknown",version:"unknown"}}function ot(e){let t=e.match(/Edg\/(\d+(?:\.\d+)*)/);if(t)return {name:"edge",version:t[1]};let r=e.match(/Chrome\/(\d+(?:\.\d+)*)/);if(r&&!e.includes("Edg/"))return {name:"chrome",version:r[1]};let s=e.match(/Firefox\/(\d+(?:\.\d+)*)/);if(s)return {name:"firefox",version:s[1]};let i=e.match(/Version\/(\d+(?:\.\d+)*).*Safari/);return i?{name:"safari",version:i[1]}:{name:"browser",version:"unknown"}}function ut(){let e=ct();return `CardDB-SDK/js/${be} (${e.name}/${e.version})`}function fr(){return be}var $e=null;function lt(){return $e}var dt=class{config;constructor(e){this.config=e;}async execute(e,t={}){let r=this.extractOperationName(e),s=0,i=0;for(;;)try{let n=Date.now();this.logRequest(r,t);let c=await this.fetch(e,t),o=Date.now()-n,h=await this.handleResponse(c);return this.logResponse(r,o),h}catch(n){if(n instanceof K&&this.config.retryOnRateLimit&&s<this.config.maxRetries){s++;let c=n.retryAfter??60;this.logRateLimitRetry(r,s,c),await this.sleep(c*1e3);continue}if(this.isRetryableNetworkError(n)&&this.config.retryOnNetworkError&&i<this.config.maxNetworkRetries){let c=this.config.calculateRetryDelay(i);this.logNetworkRetry(r,i+1,c,n),i++,await this.sleep(c);continue}if(n instanceof O&&this.config.retryOnNetworkError&&i<this.config.maxNetworkRetries){let c=this.config.calculateRetryDelay(i);this.logNetworkRetry(r,i+1,c,n),i++,await this.sleep(c);continue}throw n}}isRetryableNetworkError(e){return e instanceof x||e instanceof G}async fetch(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(),this.config.timeout),i=this.config.requestApiKey();try{return await fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":ut(),...this.config.accessToken?{Authorization:`Bearer ${this.config.accessToken}`}:{},...!this.config.accessToken&&i?{"X-API-Key":i}:{}},body:JSON.stringify({query:e,variables:t}),signal:r.signal})}catch(n){throw n instanceof Error?n.name==="AbortError"?(this.logError("Request timed out"),new G("Request timed out")):(this.logError(`Connection failed: ${n.message}`),new x(`Connection failed: ${n.message}`)):new x("Connection failed")}finally{clearTimeout(s);}}async handleResponse(e){switch(this.extractRateLimitInfo(e),e.status){case 200:return this.handleSuccessResponse(e);case 401:throw new M("Invalid or missing API key");case 429:return this.handleRateLimitResponse(e);default:if(e.status>=400&&e.status<500)return this.handleClientError(e);if(e.status>=500){let t=await this.parseBody(e);throw new O(`Server error (${e.status})`,{status:e.status,response:t})}throw new y(`Unexpected response status: ${e.status}`)}}async handleSuccessResponse(e){let t=await this.parseBody(e);return t.errors&&t.errors.length>0&&this.handleGraphQLErrors(t.errors,t),t.data??{}}handleGraphQLErrors(e,t){let r=e[0],s=r.message||"GraphQL error";switch(r.extensions?.code){case "UNAUTHENTICATED":throw new M(s,t);case "RATE_LIMITED":throw new K(s,{response:t});case "NOT_FOUND":throw new y(s,t);case "VALIDATION_ERROR":case "BAD_USER_INPUT":throw new J(s,{errors:e,response:t});default:throw new ce(s,{errors:e,response:t})}}async handleRateLimitResponse(e){let t=parseInt(e.headers.get("Retry-After")??"60",10),r=parseInt(e.headers.get("X-RateLimit-Limit")??"",10)||null,s=parseInt(e.headers.get("X-RateLimit-Remaining")??"",10)||null,i=parseInt(e.headers.get("X-RateLimit-Reset")??"",10)||null,n=i?new Date(i*1e3):null,c=await this.parseBody(e);throw new K("Rate limit exceeded",{retryAfter:t,limit:r,remaining:s,resetAt:n,response:c})}async handleClientError(e){let t=await this.parseBody(e),r=t.errors?.[0]?.message??`Client error (${e.status})`;throw new J(r,{response:t})}async parseBody(e){try{return await e.json()}catch{return {raw:await e.text()}}}extractRateLimitInfo(e){let t=parseInt(e.headers.get("X-RateLimit-Limit")??"",10)||null,r=parseInt(e.headers.get("X-RateLimit-Remaining")??"",10)||null,s=parseInt(e.headers.get("X-RateLimit-Reset")??"",10)||null;$e={limit:t,remaining:r,reset:s};}extractOperationName(e){let t=e.match(/(?:query|mutation)\s+(\w+)/);return t?t[1]:"Unknown"}sleep(e){return new Promise(t=>setTimeout(t,e))}logRequest(e,t){!this.config.logger||!this.config.shouldLog("debug")||this.config.logger.debug(`[CardDB] Executing ${e}`,{variables:t});}logResponse(e,t){!this.config.logger||!this.config.shouldLog("info")||this.config.logger.info(`[CardDB] ${e} completed in ${t}ms`);}logRateLimitRetry(e,t,r){!this.config.logger||!this.config.shouldLog("warn")||this.config.logger.warn(`[CardDB] Rate limited on ${e}, retry ${t}/${this.config.maxRetries} after ${r}s`);}logNetworkRetry(e,t,r,s){if(!this.config.logger||!this.config.shouldLog("warn"))return;let i=s instanceof Error?s.name:"Unknown";this.config.logger.warn(`[CardDB] ${i} on ${e}, retry ${t}/${this.config.maxNetworkRetries} after ${r}ms`);}logError(e){!this.config.logger||!this.config.shouldLog("error")||this.config.logger.error(`[CardDB] ${e}`);}};function ht(e,t,r){let s=Object.entries(r).filter(([,i])=>i!==void 0).sort(([i],[n])=>i.localeCompare(n)).map(([i,n])=>`${i}=${JSON.stringify(n)}`).join("&");return `carddb:${e}:${t}:${s}`}async function yt(e,t){let r=e.get(t);return r}async function ft(e,t,r,s){let i=e.set(t,r,s);i instanceof Promise&&await i;}var f=class{connection;config;constructor(e,t){this.connection=e,this.config=t;}resolvePublisher(e){let t=this.config.resolvePublisher(e);if(!t)throw new Error("publisher_slug is required (no default configured)");return t}resolveGame(e){let t=this.config.resolveGame(e);if(!t)throw new Error("game_key is required (no default configured)");return t}validateAccess(e,t){this.config.validateAccess(e,t);}async withCache(e,t,r,s){let i=r.cache??!!this.config.cache,n=this.config.cache;if(!i||!n)return s();let c=await yt(n,e);if(c!==null)return c;let o=await s();if(o!=null){let h=this.config.cacheTtlFor(t);await ft(n,e,o,h);}return o}cacheKey(e,t,r){return ht(e,t,r)}},pt=class extends f{constructor(e,t){super(e,t);}async search(e={}){let{query:t,variables:r}=a.searchPublishers({search:e.search,first:e.first,after:e.after}),s=this.cacheKey("publishers","search",r),i=await this.withCache(s,"publishers",e,async()=>(await this.connection.execute(t,r)).searchPublishers);return new l(i,{nextPageLoader:async n=>this.search({...e,after:n})})}async get(e,t={}){let r=this.isUUID(e),s=this.cacheKey("publishers","get",{[r?"id":"slug"]:e});return this.withCache(s,"publishers",t,async()=>{if(r){let{query:i}=a.fetchPublisherById();return (await this.connection.execute(i,{id:e})).fetchPublisher??null}else {let{query:i}=a.fetchPublisherBySlug();return (await this.connection.execute(i,{slug:e})).fetchPublisher??null}})}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("publishers","getMany",{slugs:e});return this.withCache(r,"publishers",t,async()=>{let{query:s}=a.fetchPublishers();return (await this.connection.execute(s,{slugs:e})).fetchPublishers??[]})}isUUID(e){return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}},mt=class extends f{constructor(e,t){super(e,t);}async list(e,t={}){let{query:r,variables:s}=a.listGames({publisherId:e,first:t.first,after:t.after,includeArchived:t.includeArchived}),i=this.cacheKey("games","list",s),n=await this.withCache(i,"games",t,async()=>(await this.connection.execute(r,s)).games);return new l(n,{nextPageLoader:async c=>this.list(e,{...t,after:c})})}async getByKey(e){let t=this.cacheKey("games","getByKey",{publisherId:e.publisherId,publisherSlug:e.publisherSlug,gameKey:e.gameKey});return this.withCache(t,"games",e,async()=>{let{query:r,variables:s}=a.game(e);return (await this.connection.execute(r,s)).game??null})}async getBySlug(e){let t=this.cacheKey("games","getBySlug",{publisherId:e.publisherId,publisherSlug:e.publisherSlug,gameSlug:e.gameSlug});return this.withCache(t,"games",e,async()=>{let{query:r,variables:s}=a.game(e);return (await this.connection.execute(r,s)).game??null})}async create(e){this.config.requireSecretCredential("games.create");let{query:t}=a.createGame();return (await this.connection.execute(t,a.gameCreateVariables(e))).gameCreate}async update(e,t){this.config.requireSecretCredential("games.update");let{query:r}=a.updateGame();return (await this.connection.execute(r,a.gameUpdateVariables(e,t))).gameUpdate}async getRegions(e={}){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=a.gameScanRegionsVariables(t,r,e.includeInactive),i=this.cacheKey("games","getRegions",s);return this.withCache(i,"games",e,async()=>{let{query:n}=a.gameScanRegions();return (await this.connection.execute(n,s)).gameScanRegions??[]})}async search(e={}){let t=this.config.resolvePublisher(e.publisherSlug);t&&this.validateAccess(t);let{query:r,variables:s}=a.searchGames({publisherSlug:t,search:e.search,first:e.first,after:e.after}),i=this.cacheKey("games","search",s),n=await this.withCache(i,"games",e,async()=>(await this.connection.execute(r,s)).searchGames);return new l(n,{nextPageLoader:async c=>this.search({...e,after:c})})}async get(e,t,r){if(typeof t=="string"){let s=e,i=t,n=r??{};this.validateAccess(s,i);let c=this.cacheKey("games","getByKeys",{publisherSlug:s,gameKey:i});return this.withCache(c,"games",n,async()=>{let{query:o}=a.fetchGameByKeys();return (await this.connection.execute(o,{publisherSlug:s,gameKey:i})).fetchGame??null})}else {let s=e,i=t??{},n=this.cacheKey("games","get",{id:s});return this.withCache(n,"games",i,async()=>{let{query:c}=a.fetchGameById();return (await this.connection.execute(c,{id:s})).fetchGame??null})}}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("games","getMany",{ids:e});return this.withCache(r,"games",t,async()=>{let{query:s}=a.fetchGames();return (await this.connection.execute(s,{ids:e})).fetchGames??[]})}},gt=class extends f{constructor(e,t){super(e,t);}async list(e,t={}){let{query:r,variables:s}=a.listDatasets({publisherId:e,gameId:t.gameId,includeArchived:t.includeArchived,purpose:t.purpose,first:t.first,after:t.after}),i=this.cacheKey("datasets","list",s),n=await this.withCache(i,"datasets",t,async()=>(await this.connection.execute(r,s)).datasets);return new l(n,{nextPageLoader:async c=>this.list(e,{...t,after:c})})}async getByKey(e){let t=this.cacheKey("datasets","getByKey",{publisherId:e.publisherId,gameId:e.gameId,datasetKey:e.datasetKey});return this.withCache(t,"datasets",e,async()=>{let{query:r,variables:s}=a.dataset(e);return (await this.connection.execute(r,s)).dataset??null})}async getSchema(e){return (typeof e=="string"?await this.withCache(this.cacheKey("datasets","getSchema",{id:e}),"datasets",{},async()=>{let{query:r,variables:s}=a.dataset({id:e});return (await this.connection.execute(r,s)).dataset??null}):await this.getByKey(e))?.schema??null}async search(e={}){let t=this.config.resolvePublisher(e.publisherSlug),r=this.config.resolveGame(e.gameKey);t&&this.validateAccess(t,r);let{query:s,variables:i}=a.searchDatasets({publisherSlug:t,gameKey:r,search:e.search,purpose:e.purpose,first:e.first,after:e.after}),n=this.cacheKey("datasets","search",i),c=await this.withCache(n,"datasets",e,async()=>(await this.connection.execute(s,i)).searchDatasets);return new l(c,{nextPageLoader:async o=>this.search({...e,after:o})})}async get(e,t,r,s){if(typeof t=="string"&&typeof r=="string"){let i=e,n=t,c=s??{};this.validateAccess(i,n);let o=this.cacheKey("datasets","getByKeys",{publisherSlug:i,gameKey:n,datasetKey:r});return this.withCache(o,"datasets",c,async()=>{let{query:h}=a.fetchDatasetByKeys();return (await this.connection.execute(h,{publisherSlug:i,gameKey:n,datasetKey:r})).fetchDataset??null})}else {let i=e,n=t??{},c=this.cacheKey("datasets","get",{id:i});return this.withCache(c,"datasets",n,async()=>{let{query:o}=a.fetchDatasetById();return (await this.connection.execute(o,{id:i})).fetchDataset??null})}}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("datasets","getMany",{ids:e});return this.withCache(r,"datasets",t,async()=>{let{query:s}=a.fetchDatasets();return (await this.connection.execute(s,{ids:e})).fetchDatasets??[]})}},kt=class extends f{constructor(e,t){super(e,t);}async fetch(e,t={}){let r=this.cacheKey("decks","fetch",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.fetchDeckById();return (await this.connection.execute(s,{id:e})).fetchDeck??null})}async get(e,t={}){let r=this.cacheKey("decks","get",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckById();return (await this.connection.execute(s,{id:e})).deck??null})}async fetchMine(e,t={}){let r=this.cacheKey("decks","fetchMine",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.myDeck();return (await this.connection.execute(s,{id:e})).myDeck??null})}async fetchBySlug(e,t,r,s={}){let i=this.cacheKey("decks","fetchBySlug",{publisherSlug:e,gameKey:t,slug:r});return this.withCache(i,"decks",s,async()=>{let{query:n}=a.fetchDeckBySlug();return (await this.connection.execute(n,{publisherSlug:e,gameKey:t,slug:r})).fetchDeckBySlug??null})}async getBySlug(e,t,r,s={}){let i=this.cacheKey("decks","getBySlug",{publisherSlug:e,gameKey:t,slug:r});return this.withCache(i,"decks",s,async()=>{let{query:n}=a.deckBySlug();return (await this.connection.execute(n,{publisherSlug:e,gameKey:t,slug:r})).deckBySlug??null})}async fetchByExternalRef(e,t={}){let r=this.cacheKey("decks","fetchByExternalRef",{externalRef:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.fetchDeckByExternalRef();return (await this.connection.execute(s,{externalRef:e})).fetchDeckByExternalRef??null})}async getByExternalRef(e,t={}){let r=this.cacheKey("decks","getByExternalRef",{externalRef:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckByExternalRef();return (await this.connection.execute(s,{externalRef:e})).deckByExternalRef??null})}async listMine(e={}){let{query:t,variables:r}=a.listMyDecks({first:e.first,after:e.after,includeArchived:e.includeArchived}),s=this.cacheKey("decks","listMine",r),i=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).myDecks);return new l(i,{nextPageLoader:async n=>this.listMine({...e,after:n})})}async listViewer(e={}){let{query:t,variables:r}=a.viewerDecks({filter:e.filter,first:e.first,after:e.after}),s=this.cacheKey("decks","listViewer",r),i=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).viewerDecks);return new l(i,{nextPageLoader:async n=>this.listViewer({...e,after:n})})}async listApp(e={}){this.config.requireSecretCredential("decks.listApp");let{query:t,variables:r}=a.appDecks({filter:e.filter,first:e.first,after:e.after}),s=this.cacheKey("decks","listApp",r),i=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).appDecks);return new l(i,{nextPageLoader:async n=>this.listApp({...e,after:n})})}async listPublic(e={}){let{query:t,variables:r}=a.publicDecks({filter:e.filter,first:e.first,after:e.after}),s=this.cacheKey("decks","listPublic",r),i=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).publicDecks);return new l(i,{nextPageLoader:async n=>this.listPublic({...e,after:n})})}async fetchVersion(e,t={}){let r=this.cacheKey("decks","fetchVersion",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckVersion();return (await this.connection.execute(s,{id:e})).deckVersion??null})}async listVersions(e,t={}){let{query:r,variables:s}=a.deckVersions({first:t.first,after:t.after}),i={deckId:e,...s},n=this.cacheKey("decks","listVersions",i),c=await this.withCache(n,"decks",t,async()=>(await this.connection.execute(r,i)).deckVersions);return new l(c,{nextPageLoader:async o=>this.listVersions(e,{...t,after:o})})}async preview(e,t={}){let r=this.cacheKey("decks","preview",{token:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckPreview();return (await this.connection.execute(s,{token:e})).deckPreview??null})}async embed(e,t={}){let r=this.cacheKey("decks","embed",{token:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckEmbed();return (await this.connection.execute(s,{token:e})).deckEmbed??null})}async access(e,t={}){let r=this.cacheKey("decks","access",{token:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckAccess();return (await this.connection.execute(s,{token:e})).deckAccess??null})}async draftDiff(e,t={}){let r=this.cacheKey("decks","draftDiff",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckDraftDiff();return (await this.connection.execute(s,{id:e})).deckDraftDiff})}async versionDiff(e,t,r={}){let s=a.deckVersionDiffVariables(e,t),i=this.cacheKey("decks","versionDiff",s);return this.withCache(i,"decks",r,async()=>{let{query:n}=a.deckVersionDiff();return (await this.connection.execute(n,s)).deckVersionDiff})}async validate(e,t,r={}){let s=a.deckValidateVariables(e,t),i=this.cacheKey("decks","validate",s);return this.withCache(i,"decks",r,async()=>{let{query:n}=a.deckValidate();return (await this.connection.execute(n,s)).deckValidate})}async hydrateDeckEntries(e,t={}){let r=a.deckHydrateEntriesVariables(e),s=this.cacheKey("decks","hydrateDeckEntries",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckHydrateEntries();return (await this.connection.execute(i,r)).deckHydrateEntries})}async exportDeck(e,t="SIMPLE_TEXT",r={}){let s=a.deckExportVariables(e,t),i=this.cacheKey("decks","exportDeck",s);return this.withCache(i,"decks",r,async()=>{let{query:n}=a.deckExport();return (await this.connection.execute(n,s)).deckExport})}async sectionDefinitions(e={}){let{query:t,variables:r}=a.deckSectionDefinitions({publisherSlug:e.publisherSlug,gameKey:e.gameKey,gameId:e.gameId,rulesetKey:e.rulesetKey,rulesetVersionId:e.rulesetVersionId}),s=this.cacheKey("decks","sectionDefinitions",r);return this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).deckSectionDefinitions)}async listCollaborators(e,t={}){let r=this.cacheKey("decks","listCollaborators",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckCollaborators();return (await this.connection.execute(s,{deckId:e})).deckCollaborators})}async listPreviewTokens(e,t={}){let r=this.cacheKey("decks","listPreviewTokens",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckPreviewTokens();return (await this.connection.execute(s,{deckId:e})).deckPreviewTokens})}async listEmbedTokens(e,t={}){let r=this.cacheKey("decks","listEmbedTokens",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckEmbedTokens();return (await this.connection.execute(s,{deckId:e})).deckEmbedTokens})}async listAccessTokenIssuers(e,t={}){let r=this.cacheKey("decks","listAccessTokenIssuers",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckAccessTokenIssuers();return (await this.connection.execute(s,{deckId:e})).deckAccessTokenIssuers})}async listApiApplicationAccesses(e,t={}){let r=a.deckApiApplicationAccessesVariables(e,t.includeRevoked),s=this.cacheKey("decks","listApiApplicationAccesses",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckApiApplicationAccesses();return (await this.connection.execute(i,r)).deckApiApplicationAccesses})}async listMyApiApplicationAccesses(e={}){let t=a.myDeckApiApplicationAccessesVariables(e.applicationId),r=this.cacheKey("decks","listMyApiApplicationAccesses",t);return this.withCache(r,"decks",e,async()=>{let{query:s}=a.myDeckApiApplicationAccesses();return (await this.connection.execute(s,t)).myDeckApiApplicationAccesses})}async create(e){let{query:t}=a.createDeck(),r=a.deckCreateVariables(e);return (await this.connection.execute(t,r)).deckCreate}async update(e,t){let{query:r}=a.updateDeck(),s=a.deckUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckUpdate}async updateMetadata(e,t){return this.update(e,t)}async upsertByExternalRef(e){this.config.requireSecretCredential("decks.upsertByExternalRef");let{query:t}=a.upsertDeckByExternalRef(),r=a.deckUpsertByExternalRefVariables(e);return (await this.connection.execute(t,r)).deckUpsertByExternalRef}async claim(e,t){let{query:r}=a.claimDeck(),s=a.deckClaimVariables(e,t);return (await this.connection.execute(r,s)).deckClaim}async transferOwnership(e,t){let{query:r}=a.transferDeckOwnership(),s=a.deckTransferOwnershipVariables(e,t);return (await this.connection.execute(r,s)).deckTransferOwnership}async copy(e,t){let{query:r}=a.copyDeck(),s=a.deckCopyVariables(e,t);return (await this.connection.execute(r,s)).deckCopy}async addEntry(e){let{query:t}=a.addDeckEntry(),r=a.deckEntryAddVariables(e);return (await this.connection.execute(t,r)).deckEntryAdd}async updateEntry(e,t){let{query:r}=a.updateDeckEntry(),s=a.deckEntryUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckEntryUpdate}async removeEntry(e,t){let{query:r}=a.removeDeckEntry(),s=a.deckEntryRemoveVariables(e,t);return (await this.connection.execute(r,s)).deckEntryRemove}async reorderEntries(e,t){let{query:r}=a.reorderDeckEntries(),s=a.deckEntryReorderVariables(e,t);return (await this.connection.execute(r,s)).deckEntryReorder}async replaceEntries(e,t){let{query:r}=a.replaceDeckEntries(),s=a.deckEntriesReplaceVariables(e,t);return (await this.connection.execute(r,s)).deckEntriesReplace}async importDeck(e){let{query:t}=a.importDeck(),r=a.deckImportVariables(e);return (await this.connection.execute(t,r)).deckImport}async listImportFormats(e,t={}){let{query:r,variables:s}=a.deckImportFormats({gameId:e,includeArchived:t.includeArchived,first:t.first,after:t.after}),i=this.cacheKey("decks","listImportFormats",s),n=await this.withCache(i,"decks",t,async()=>(await this.connection.execute(r,s)).deckImportFormats);return new l(n,{nextPageLoader:async c=>this.listImportFormats(e,{...t,after:c})})}async fetchImportFormat(e,t={}){let r=this.cacheKey("decks","fetchImportFormat",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckImportFormat();return (await this.connection.execute(s,{id:e})).deckImportFormat??null})}async testImportFormat(e){let{query:t}=a.deckImportFormatTest(),r=a.deckImportFormatTestVariables(e);return (await this.connection.execute(t,r)).deckImportFormatTest}async createImportFormat(e){let{query:t}=a.createDeckImportFormat(),r=a.deckImportFormatCreateVariables(e);return (await this.connection.execute(t,r)).deckImportFormatCreate}async updateImportFormat(e,t){let{query:r}=a.updateDeckImportFormat(),s=a.deckImportFormatUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckImportFormatUpdate}async archiveImportFormat(e){let{query:t}=a.archiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatArchive}async unarchiveImportFormat(e){let{query:t}=a.unarchiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatUnarchive}async delete(e){let{query:t}=a.deleteDeck();return !!(await this.connection.execute(t,{id:e})).deckDelete}async archive(e){let{query:t}=a.archiveDeck();return (await this.connection.execute(t,{id:e})).deckArchive}async restore(e){let{query:t}=a.restoreDeck();return (await this.connection.execute(t,{id:e})).deckRestore}async unpublish(e){let{query:t}=a.unpublishDeck();return (await this.connection.execute(t,{id:e})).deckUnpublish}async publish(e,t){let{query:r}=a.publishDeck(),s=a.deckPublishVariables(e,t);return (await this.connection.execute(r,s)).deckPublish}async removeInvalidEntries(e,t){let{query:r}=a.removeInvalidDeckEntries(),s=a.deckRemoveInvalidEntriesVariables(e,t);return (await this.connection.execute(r,s)).deckRemoveInvalidEntries}async upsertCollaborator(e,t,r){let{query:s}=a.upsertDeckCollaborator(),i=a.deckCollaboratorVariables(e,t,r);return (await this.connection.execute(s,i)).deckCollaboratorUpsert}async removeCollaborator(e,t){let{query:r}=a.removeDeckCollaborator(),s=a.deckCollaboratorVariables(e,t);return !!(await this.connection.execute(r,s)).deckCollaboratorRemove}async createPreviewToken(e){let{query:t}=a.createDeckPreviewToken(),r=a.deckPreviewTokenCreateVariables(e);return (await this.connection.execute(t,r)).deckPreviewTokenCreate}async revokePreviewToken(e){let{query:t}=a.revokeDeckPreviewToken();return !!(await this.connection.execute(t,{id:e})).deckPreviewTokenRevoke}async createEmbedToken(e){let{query:t}=a.createDeckEmbedToken(),r=a.deckEmbedTokenCreateVariables(e);return (await this.connection.execute(t,r)).deckEmbedTokenCreate}async revokeEmbedToken(e){let{query:t}=a.revokeDeckEmbedToken();return !!(await this.connection.execute(t,{id:e})).deckEmbedTokenRevoke}async createAccessTokenIssuer(e){let{query:t}=a.createDeckAccessTokenIssuer(),r=a.deckAccessTokenIssuerCreateVariables(e);return (await this.connection.execute(t,r)).deckAccessTokenIssuerCreate}async revokeAccessTokenIssuer(e){let{query:t}=a.revokeDeckAccessTokenIssuer();return !!(await this.connection.execute(t,{id:e})).deckAccessTokenIssuerRevoke}async revokeAccessTokenIssuerSigningKey(e){let{query:t}=a.revokeDeckAccessTokenIssuerSigningKey();return (await this.connection.execute(t,{id:e})).deckAccessTokenIssuerSigningKeyRevoke}async grantApiApplicationAccess(e){let{query:t}=a.grantDeckApiApplicationAccess(),r=a.deckApiApplicationAccessGrantVariables(e);return (await this.connection.execute(t,r)).deckApiApplicationAccessGrant}async revokeApiApplicationAccess(e,t){let{query:r}=a.revokeDeckApiApplicationAccess(),s=a.deckApiApplicationAccessRevokeVariables(e,t);return !!(await this.connection.execute(r,s)).deckApiApplicationAccessRevoke}async exchangeAccessToken(e){this.config.requireSecretCredential("decks.exchangeAccessToken");let{query:t}=a.exchangeDeckAccessToken(),r=a.deckAccessTokenExchangeVariables(e);return (await this.connection.execute(t,r)).deckAccessTokenExchange}async exchangeSessionToken(e){this.config.requireSecretCredential("decks.exchangeSessionToken");let{query:t}=a.exchangeDeckSessionToken(),r=a.deckSessionTokenExchangeVariables(e);return (await this.connection.execute(t,r)).deckSessionTokenExchange}async revokeAccessToken(e){this.config.requireSecretCredential("decks.revokeAccessToken");let{query:t}=a.revokeDeckAccessToken();return !!(await this.connection.execute(t,{id:e})).deckAccessTokenRevoke}async hydrateEntries(e){if(e.entries.length===0)return [];let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=e.entries.map(o=>o.identifier),i=this.cacheKey("decks","hydrateEntries",{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:s}),n=await this.withCache(i,"decks",e,async()=>{let{query:o}=a.fetchRecordsByIdentifier();return (await this.connection.execute(o,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:s})).fetchRecordsByIdentifier}),c=It(n,s,e.identifierField);return e.entries.map(o=>({...o,record:c.get(o.identifier)??null}))}};function It(e,t,r){let s=new Set(t),i=new Map;for(let n of e){let c=r?n.data[r]:Object.values(n.data).find(h=>s.has(String(h)));if(c==null)continue;let o=String(c);s.has(o)&&(i.set(o,n),s.delete(o));}return i}var bt=class extends f{constructor(e,t){super(e,t);}async list(e){let t=U(e.filter),{query:r,variables:s}=a.listDatasetRecords({datasetId:e.datasetId,filter:t,orderBy:e.orderBy,first:e.first,after:e.after,last:e.last,before:e.before,validateSchema:e.validateSchema}),i=this.cacheKey("records","list",s),n=await this.withCache(i,"records",e,async()=>(await this.connection.execute(r,s)).datasetRecords);return new l(n,{nextPageLoader:async c=>this.list({...e,after:c})})}async getByDatasetIdentifier(e){let t=this.cacheKey("records","getByDatasetIdentifier",{datasetId:e.datasetId,identifier:e.identifier,includePricing:e.includePricing??false});return this.withCache(t,"records",e,async()=>{let{query:r,variables:s}=a.datasetRecord({datasetId:e.datasetId,identifier:e.identifier,includePricing:e.includePricing});return (await this.connection.execute(r,s)).datasetRecord??null})}async upsertBatch(e){this.config.requireSecretCredential("records.upsertBatch");let{query:t}=a.upsertDatasetRecords();return (await this.connection.execute(t,a.datasetRecordsUpsertVariables(e))).datasetRecordsUpsert}async deleteBatch(e){this.config.requireSecretCredential("records.deleteBatch");let{query:t}=a.deleteDatasetRecords();return (await this.connection.execute(t,a.datasetRecordsDeleteVariables(e))).datasetRecordsDelete}async getDeleteJob(e,t={}){let r=this.cacheKey("records","getDeleteJob",{id:e});return this.withCache(r,"records",t,async()=>{let{query:s}=a.datasetRecordDeleteJob();return (await this.connection.execute(s,{id:e})).datasetRecordDeleteJob??null})}async listDeleteJobs(e,t={}){let{query:r,variables:s}=a.datasetRecordDeleteJobs({publisherId:e,datasetId:t.datasetId,status:t.status,first:t.first,after:t.after}),i=this.cacheKey("records","listDeleteJobs",s),n=await this.withCache(i,"records",t,async()=>(await this.connection.execute(r,s)).datasetRecordDeleteJobs);return new l(n,{nextPageLoader:async c=>this.listDeleteJobs(e,{...t,after:c})})}async waitForDeleteJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,i=Date.now();for(;;){let n=await this.getDeleteJob(e,{cache:false});if(!n)throw new Error(`Delete job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-i>=s)throw new Error(`Timed out waiting for delete job '${e}'`);await new Promise(c=>setTimeout(c,r));}}async search(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=U(e.filter),{query:i,variables:n}=a.searchRecords({publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,filter:s,search:e.search,orderBy:e.orderBy,resolveLinks:e.resolveLinks,first:e.first,after:e.after,validateSchema:e.validateSchema,includePricing:e.includePricing}),c=this.cacheKey("records","search",{...n,includePricing:e.includePricing??false}),o=await this.withCache(c,"records",e,async()=>(await this.connection.execute(i,n)).searchRecords);return new l(o,{nextPageLoader:async h=>this.search({...e,after:h})})}async get(e,t={}){let r=this.cacheKey("records","get",{id:e,includePricing:t.includePricing??false});return this.withCache(r,"records",t,async()=>{let{query:s}=a.fetchRecordById({includePricing:t.includePricing});return (await this.connection.execute(s,{id:e})).fetchRecord??null})}async getByIdentifier(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=this.cacheKey("records","getByIdentifier",{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifier:e.identifier,includePricing:e.includePricing??false});return this.withCache(s,"records",e,async()=>{let{query:i}=a.fetchRecordByIdentifier({includePricing:e.includePricing});return (await this.connection.execute(i,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifier:e.identifier})).fetchRecordByIdentifier??null})}async getManyByIdentifier(e){if(e.identifiers.length===0)return [];let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=this.cacheKey("records","getManyByIdentifier",{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:e.identifiers,includePricing:e.includePricing??false});return this.withCache(s,"records",e,async()=>{let{query:i}=a.fetchRecordsByIdentifier({includePricing:e.includePricing});return (await this.connection.execute(i,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:e.identifiers})).fetchRecordsByIdentifier??[]})}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("records","getMany",{ids:e,includePricing:t.includePricing??false});return this.withCache(r,"records",t,async()=>{let{query:s}=a.fetchRecords({includePricing:t.includePricing});return (await this.connection.execute(s,{ids:e})).fetchRecords??[]})}},$t=class extends f{constructor(e,t){super(e,t);}async datasets(e={}){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let{query:s,variables:i}=a.searchDatasets({publisherSlug:t,gameKey:r,search:e.search,purpose:"RULES",first:e.first,after:e.after}),n=this.cacheKey("rules","datasets",i),c=await this.withCache(n,"datasets",e,async()=>(await this.connection.execute(s,i)).searchDatasets);return new l(c,{nextPageLoader:async o=>this.datasets({...e,after:o})})}async list(e={}){return this.searchRuleRecords("rules",e)}async formats(e={}){return this.searchRuleRecords(e.datasetKey??"formats",e)}async searchRuleRecords(e,t){let r=this.resolvePublisher(t.publisherSlug),s=this.resolveGame(t.gameKey),i=t.datasetKey??e;this.validateAccess(r,s);let n=U(t.filter),{query:c,variables:o}=a.searchRecords({publisherSlug:r,gameKey:s,datasetKey:i,filter:n,search:t.search,orderBy:t.orderBy,resolveLinks:t.resolveLinks,first:t.first,after:t.after,validateSchema:t.validateSchema}),h=this.cacheKey("rules","records",o),w=await this.withCache(h,"records",t,async()=>(await this.connection.execute(c,o)).searchRecords);return new l(w,{nextPageLoader:async X=>this.searchRuleRecords(e,{...t,after:X})})}},vt=class extends f{constructor(e,t){super(e,t);}async list(e){let{query:t,variables:r}=a.deckImportFormats({publisherId:e.publisherId,gameId:e.gameId,includeArchived:e.includeArchived,first:e.first,after:e.after}),s=this.cacheKey("importFormats","list",r),i=await this.withCache(s,"importFormats",e,async()=>(await this.connection.execute(t,r)).deckImportFormats);return new l(i,{nextPageLoader:async n=>this.list({...e,after:n})})}async get(e,t={}){let r=this.cacheKey("importFormats","get",{id:e});return this.withCache(r,"importFormats",t,async()=>{let{query:s}=a.deckImportFormat();return (await this.connection.execute(s,{id:e})).deckImportFormat??null})}async getByKey(e){let t=this.cacheKey("importFormats","getByKey",{gameId:e.gameId,formatKey:e.key});return this.withCache(t,"importFormats",e,async()=>{let{query:r}=a.deckImportFormat();return (await this.connection.execute(r,{gameId:e.gameId,key:e.key})).deckImportFormat??null})}async test(e){let{query:t}=a.deckImportFormatTest();return (await this.connection.execute(t,a.deckImportFormatTestVariables(e))).deckImportFormatTest}async create(e){this.config.requireSecretCredential("importFormats.create");let{query:t}=a.createDeckImportFormat();return (await this.connection.execute(t,a.deckImportFormatCreateVariables(e))).deckImportFormatCreate}async update(e,t){this.config.requireSecretCredential("importFormats.update");let{query:r}=a.updateDeckImportFormat();return (await this.connection.execute(r,a.deckImportFormatUpdateVariables(e,t))).deckImportFormatUpdate}async archive(e){this.config.requireSecretCredential("importFormats.archive");let{query:t}=a.archiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatArchive}async unarchive(e){this.config.requireSecretCredential("importFormats.unarchive");let{query:t}=a.unarchiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatUnarchive}},Dt=class extends f{constructor(e,t){super(e,t);}async preview(e){let{query:t}=a.datasetImportPreview();return (await this.connection.execute(t,a.datasetImportPreviewVariables(e))).datasetImportPreview}async validate(e){let{query:t}=a.datasetImportValidate();return (await this.connection.execute(t,a.datasetImportValidateVariables(e))).datasetImportValidate}async run(e){if(this.config.requireSecretCredential("imports.run"),"fileId"in e&&e.fileId){let{query:s}=a.datasetImportFromFile();return (await this.connection.execute(s,a.datasetImportFromFileVariables(e))).datasetImportFromFile}if("sourceUrl"in e&&e.sourceUrl){let{query:s}=a.datasetImportFromUrl();return (await this.connection.execute(s,a.datasetImportFromUrlVariables(e))).datasetImportFromUrl}let{query:t}=a.datasetImportFromPayload();return (await this.connection.execute(t,a.datasetImportFromPayloadVariables(e))).datasetImportFromPayload}async getJob(e,t={}){let r=this.cacheKey("imports","getJob",{id:e});return this.withCache(r,"imports",t,async()=>{let{query:s}=a.importJob();return (await this.connection.execute(s,{id:e})).importJob??null})}async listJobs(e,t={}){let{query:r,variables:s}=a.importJobs({publisherId:e,datasetId:t.datasetId,status:t.status,first:t.first,after:t.after}),i=this.cacheKey("imports","listJobs",s),n=await this.withCache(i,"imports",t,async()=>(await this.connection.execute(r,s)).importJobs);return new l(n,{nextPageLoader:async c=>this.listJobs(e,{...t,after:c})})}async cancelJob(e){this.config.requireSecretCredential("imports.cancelJob");let{query:t}=a.importJobCancel();return (await this.connection.execute(t,{id:e})).importJobCancel}async listJobLogs(e,t={}){let{query:r,variables:s}=a.importJobLogs({importJobId:e,level:t.level,datasetKey:t.datasetKey,first:t.first,after:t.after}),i=this.cacheKey("imports","listJobLogs",s),n=await this.withCache(i,"imports",t,async()=>(await this.connection.execute(r,s)).importJob?.logs??wt());return new l(n,{nextPageLoader:async c=>this.listJobLogs(e,{...t,after:c})})}async waitForJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,i=Date.now();for(;;){let n=await this.getJob(e,{cache:false});if(!n)throw new Error(`Import job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-i>=s)throw new Error(`Timed out waiting for import job '${e}'`);await new Promise(c=>setTimeout(c,r));}}async previewGame(e){let{query:t}=a.gameImportPreview();return (await this.connection.execute(t,a.gameImportPreviewVariables(e))).gameImportPreview}async runGame(e){if(this.config.requireSecretCredential("imports.runGame"),"fileId"in e&&e.fileId){let{query:s}=a.gameImportFromFile();return (await this.connection.execute(s,a.gameImportFromFileVariables(e))).gameImportFromFile}if("sourceUrl"in e&&e.sourceUrl){let{query:s}=a.gameImportFromUrl();return (await this.connection.execute(s,a.gameImportFromUrlVariables(e))).gameImportFromUrl}let{query:t}=a.gameImportFromPayload();return (await this.connection.execute(t,a.gameImportFromPayloadVariables(e))).gameImportFromPayload}async getGameJob(e,t={}){let r=this.cacheKey("imports","getGameJob",{id:e});return this.withCache(r,"imports",t,async()=>{let{query:s}=a.gameImportJob();return (await this.connection.execute(s,{id:e})).gameImportJob??null})}async listGameJobs(e,t={}){let{query:r,variables:s}=a.gameImportJobs({gameId:e,status:t.status,first:t.first,after:t.after}),i=this.cacheKey("imports","listGameJobs",s),n=await this.withCache(i,"imports",t,async()=>(await this.connection.execute(r,s)).gameImportJobs);return new l(n,{nextPageLoader:async c=>this.listGameJobs(e,{...t,after:c})})}async cancelGameJob(e){this.config.requireSecretCredential("imports.cancelGameJob");let{query:t}=a.gameImportJobCancel();return (await this.connection.execute(t,{id:e})).gameImportJobCancel}async waitForGameJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,i=Date.now();for(;;){let n=await this.getGameJob(e,{cache:false});if(!n)throw new Error(`Game import job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-i>=s)throw new Error(`Timed out waiting for game import job '${e}'`);await new Promise(c=>setTimeout(c,r));}}};function wt(){return {totalCount:0,pageInfo:{hasNextPage:false,hasPreviousPage:false,startCursor:null,endCursor:null},edges:[]}}var St=class extends f{constructor(e,t){super(e,t);}async run(e){this.config.requireSecretCredential("exports.run");let{query:t}=a.datasetExport();return (await this.connection.execute(t,a.datasetExportVariables(e))).datasetExport}async create(e){return this.run(e)}async getJob(e,t={}){let r=this.cacheKey("exports","getJob",{id:e});return this.withCache(r,"exports",t,async()=>{let{query:s}=a.exportJob();return (await this.connection.execute(s,{id:e})).exportJob??null})}async listJobs(e,t={}){let{query:r,variables:s}=a.exportJobs({publisherId:e,gameId:t.gameId,datasetId:t.datasetId,status:t.status,first:t.first,after:t.after}),i=this.cacheKey("exports","listJobs",s),n=await this.withCache(i,"exports",t,async()=>(await this.connection.execute(r,s)).exportJobs);return new l(n,{nextPageLoader:async c=>this.listJobs(e,{...t,after:c})})}async refreshUrl(e){let{query:t}=a.exportJobRefreshUrl();return (await this.connection.execute(t,{id:e})).exportJobRefreshUrl}async cancel(e){this.config.requireSecretCredential("exports.cancel");let{query:t}=a.exportJobCancel();return (await this.connection.execute(t,{id:e})).exportJobCancel}async waitForJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,i=Date.now();for(;;){let n=await this.getJob(e,{cache:false});if(!n)throw new Error(`Export job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-i>=s)throw new Error(`Timed out waiting for export job '${e}'`);await new Promise(c=>setTimeout(c,r));}}},At=class extends f{constructor(e,t){super(e,t);}async get(e,t={}){let r=this.cacheKey("files","get",{id:e});return this.withCache(r,"files",t,async()=>{let{query:s}=a.file();return (await this.connection.execute(s,{id:e})).file??null})}async requestUpload(e){this.config.requireSecretCredential("files.requestUpload");let{query:t}=a.fileUploadRequest();return (await this.connection.execute(t,a.fileUploadRequestVariables(e))).fileUploadRequest}async confirmUpload(e){this.config.requireSecretCredential("files.confirmUpload");let{query:t}=a.fileUploadConfirm();return (await this.connection.execute(t,{id:e})).fileUploadConfirm}async upload(e){let t=e.size??xt(e.body);if(!t||t<=0)throw new Error("files.upload requires a positive size or a body with an inferable size");let r=await this.requestUpload({filename:e.filename,contentType:e.contentType,size:t,isPublic:e.isPublic??false,entityType:e.entityType??Tt(e.purpose),entityId:e.entityId,publisherId:e.publisherId,datasetId:e.datasetId});return await Et(r.uploadUrl,e.contentType,e.body),this.confirmUpload(r.file.id)}async delete(e){this.config.requireSecretCredential("files.delete");let{query:t}=a.fileDelete();return !!(await this.connection.execute(t,{id:e})).fileDelete}};async function Et(e,t,r){let s=globalThis.fetch;if(!s)throw new Error("files.upload requires a runtime with fetch support");let i=await s(e,{method:"PUT",headers:{"Content-Type":t},body:r});if(!i.ok){let n=await i.text().catch(()=>"");throw new Error(`File upload failed with ${i.status} ${i.statusText}${n?`: ${n}`:""}`)}}function xt(e){if(typeof e=="string")return new TextEncoder().encode(e).byteLength;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength;let t=e;if(typeof t?.size=="number")return t.size;if(typeof t?.byteLength=="number")return t.byteLength;if(typeof t?.length=="number")return t.length}function Tt(e){if(!(!e||e==="scan_image"))return e==="import"?"import":e==="scan_template_example"?"scan_template_example":e}var qt=class extends f{constructor(e,t){super(e,t);}async createUploadSession(e){let t=this.resolveCreateUploadSessionInput(e),{query:r}=a.createScanUploadSession();return (await this.connection.execute(r,a.createScanUploadSessionVariables(t))).createScanUploadSession}async confirmUpload(e){let t=this.resolveConfirmUploadInput(e),{query:r}=a.confirmScanUpload();return (await this.connection.execute(r,a.confirmScanUploadVariables(t))).confirmScanUpload}async createJob(e){let t=this.resolveCreateJobInput(e),{query:r}=a.createScanJob();return (await this.connection.execute(r,a.createScanJobVariables(t))).createScanJob}async getJob(e,t={}){let r=this.cacheKey("scans","getJob",{id:e});return this.withCache(r,"scans",t,async()=>{let{query:s}=a.scanJob();return (await this.connection.execute(s,{id:e})).scanJob??null})}async pollJob(e,t={}){let r=t.timeoutMs??3e5,s=Math.max(t.backoffFactor??1.5,1),i=t.maxIntervalMs??1e4,n=Date.now(),c=Math.max(t.intervalMs??1e3,1);for(;;){Kt(t.signal);let o=await this.getJob(e,{cache:false});if(!o)throw new Error(`Scan job '${e}' was not found`);if(Rt(o.status))return o;let h=Date.now()-n,w=r-h;if(w<=0)throw new Error(`Timed out waiting for scan job '${e}'`);await Ct(Math.min(c,w)),c=Math.min(Math.ceil(c*s),i);}}async submitFeedback(e){let{query:t}=a.submitScanFeedback();return (await this.connection.execute(t,a.submitScanFeedbackVariables(e))).submitScanFeedback}async metrics(e){let t=this.resolveMetricsInput(e),{query:r}=a.scanMetrics();return (await this.connection.execute(r,a.scanMetricsVariables(t))).scanMetrics}async verifyWebhookSignature(e){let t=Ut(),r=await t.importKey("raw",ve(e.secret),{name:"HMAC",hash:"SHA-256"},false,["sign"]),s=await t.sign("HMAC",r,Ft(e.body)),i=`sha256=${Pt(new Uint8Array(s))}`;return Lt(e.signature.trim().toLowerCase(),i)}resolveCreateJobInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolveCreateUploadSessionInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolveConfirmUploadInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolveMetricsInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}};function Rt(e){let t=e.toLowerCase();return t==="completed"||t==="failed"||t==="cancelled"}async function Ct(e){return new Promise(t=>setTimeout(t,e))}function Kt(e){if(e&&(e.throwIfAborted&&e.throwIfAborted(),e.aborted))throw new Error("Scan job polling aborted")}function Ut(){let t=globalThis.crypto?.subtle;if(!t)throw new Error("Web Crypto HMAC support is not available in this runtime");return t}function Ft(e){return typeof e=="string"?ve(e):e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function ve(e){return new TextEncoder().encode(e)}function Pt(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function Lt(e,t){let r=Math.max(e.length,t.length),s=e.length^t.length;for(let i=0;i<r;i++)s|=(e.charCodeAt(i)||0)^(t.charCodeAt(i)||0);return s===0}var Vt=class extends f{constructor(e,t){super(e,t);}async resolve(e){let t=this.resolveTemplateScope(e),r=this.cacheKey("scanTemplates","resolve",{...t});return this.withCache(r,"scanTemplates",e,async()=>{let{query:s}=a.resolveScanTemplate();return (await this.connection.execute(s,a.resolveScanTemplateVariables(t))).resolveScanTemplate})}async list(e){let t=this.resolveListScope(e),r=this.cacheKey("scanTemplates","list",{...t});return this.withCache(r,"scanTemplates",e,async()=>{let{query:s}=a.scanTemplates();return (await this.connection.execute(s,a.scanTemplatesVariables(t))).scanTemplates?.templates??[]})}async create(e){this.config.requireSecretCredential("scanTemplates.create");let t=this.resolveSaveInput(e),{query:r}=a.createScanTemplate();return (await this.connection.execute(r,a.createScanTemplateVariables(t))).createScanTemplate}async update(e,t){this.config.requireSecretCredential("scanTemplates.update");let r=typeof e=="string"?e:e.id,s=typeof e=="string"?t:_t(e);if(!s)throw new Error("scan template input is required");let i=this.resolveSaveInput(s),{query:n}=a.updateScanTemplate();return (await this.connection.execute(n,a.updateScanTemplateVariables(r,i))).updateScanTemplate}async preview(e){let t=this.resolvePreviewInput(e),{query:r}=a.previewScanTemplate();return (await this.connection.execute(r,a.previewScanTemplateVariables(t))).previewScanTemplate}resolveTemplateScope(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,templateId:e.templateId}}resolveListScope(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,includeArchived:e.includeArchived}}resolveSaveInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolvePreviewInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}};function _t(e){let t={...e};return delete t.id,t}var De=class we{config;connection;publishers;games;datasets;records;decks;rules;importFormats;imports;exports;files;scans;scanTemplates;constructor(t={}){this.config=new nt(t),this.connection=new dt(this.config),this.publishers=new pt(this.connection,this.config),this.games=new mt(this.connection,this.config),this.datasets=new gt(this.connection,this.config),this.records=new bt(this.connection,this.config),this.decks=new kt(this.connection,this.config),this.rules=new $t(this.connection,this.config),this.importFormats=new vt(this.connection,this.config),this.imports=new Dt(this.connection,this.config),this.exports=new St(this.connection,this.config),this.files=new At(this.connection,this.config),this.scans=new qt(this.connection,this.config),this.scanTemplates=new Vt(this.connection,this.config);}async me(){let{query:t}=a.fetchMe();return (await this.connection.execute(t)).fetchMe??null}getRateLimitInfo(){return lt()}withConfig(t){let r=this.config.merge(t);return new we({apiKey:r.configApiKey(),publishableKey:r.publishableKey,secretKey:r.secretKey,accessToken:r.accessToken,environment:r.environment,endpoint:r.endpoint,timeout:r.timeout,openTimeout:r.openTimeout,defaultPublisher:r.defaultPublisher,defaultGame:r.defaultGame,allowedPublishers:r.allowedPublishers,allowedGames:r.allowedGames,logger:r.logger,logLevel:r.logLevel,retryOnRateLimit:r.retryOnRateLimit,maxRetries:r.maxRetries,retryOnNetworkError:r.retryOnNetworkError,maxNetworkRetries:r.maxNetworkRetries,retryBaseDelay:r.retryBaseDelay,retryMaxDelay:r.retryMaxDelay,cache:r.cache,cacheTtl:r.cacheTtl,cacheTtls:r.cacheTtls})}};var W=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";this.storage=r==="sessionStorage"?globalThis.sessionStorage:globalThis.localStorage,this.prefix=t.prefix??"carddb:";}get(t){try{let r=this.storage.getItem(this.prefix+t);if(!r)return null;let s=JSON.parse(r);return s.expiresAt!==null&&Date.now()>s.expiresAt?(this.storage.removeItem(this.prefix+t),null):s.value}catch{return this.storage.removeItem(this.prefix+t),null}}set(t,r,s){try{let i={value:r,expiresAt:s!==void 0?Date.now()+s*1e3:null};this.storage.setItem(this.prefix+t,JSON.stringify(i));}catch(i){console.warn("[CardDB] Failed to write to cache:",i);}}delete(t){this.storage.removeItem(this.prefix+t);}clear(){let t=[];for(let r=0;r<this.storage.length;r++){let s=this.storage.key(r);s&&s.startsWith(this.prefix)&&t.push(s);}for(let r of t)this.storage.removeItem(r);}has(t){return this.get(t)!==null}get size(){let t=0;for(let r=0;r<this.storage.length;r++){let s=this.storage.key(r);s&&s.startsWith(this.prefix)&&t++;}return t}cleanup(){let t=Date.now(),r=[];for(let s=0;s<this.storage.length;s++){let i=this.storage.key(s);if(i&&i.startsWith(this.prefix))try{let n=this.storage.getItem(i);if(n){let c=JSON.parse(n);c.expiresAt!==null&&t>c.expiresAt&&r.push(i);}}catch{r.push(i);}}for(let s of r)this.storage.removeItem(s);}};var Se=class extends De{constructor(t={}){if("apiKey"in t&&t.apiKey!==void 0)throw new $("apiKey is not accepted in browsers; use publishableKey or accessToken");if("secretKey"in t&&t.secretKey!==void 0)throw new $("secretKey is server-only; use publishableKey or accessToken in browsers");super(t);}};
|
|
1945
|
-
export{
|
|
1842
|
+
`}}},l=class{totalCount;pageInfo;items;nextPageLoader;constructor(e,t={}){this.totalCount=e.totalCount,this.pageInfo=e.pageInfo,this.items=e.edges.map(r=>t.itemTransformer?t.itemTransformer(r.node):r.node),this.nextPageLoader=t.nextPageLoader;}get hasNextPage(){return this.pageInfo.hasNextPage}get hasPreviousPage(){return this.pageInfo.hasPreviousPage}get endCursor(){return this.pageInfo.endCursor}get startCursor(){return this.pageInfo.startCursor}get length(){return this.items.length}get isEmpty(){return this.items.length===0}get first(){return this.items[0]}get last(){return this.items[this.items.length-1]}async nextPage(){if(!this.hasNextPage)return null;if(!this.nextPageLoader)throw new Error("No next page loader configured");return this.endCursor?this.nextPageLoader(this.endCursor):null}async*[Symbol.asyncIterator](){let e=this;for(;e;){for(let t of e.items)yield t;if(!e.hasNextPage)break;e=await e.nextPage();}}async forEach(e){let t=0;for await(let r of this)await e(r,t++);}async map(e){let t=[],r=0;for await(let s of this)t.push(await e(s,r++));return t}async filter(e){let t=[],r=0;for await(let s of this)await e(s,r++)&&t.push(s);return t}async find(e){let t=0;for await(let r of this)if(await e(r,t++))return r}async take(e){let t=[];for await(let r of this){if(t.length>=e)break;t.push(r);}return t}async toArray(){let e=[];for await(let t of this)e.push(t);return e}async*batches(){let e=this;for(;e&&(e.items.length>0&&(yield e.items),!!e.hasNextPage);)e=await e.nextPage();}each(){return this}};var tt="https://carddb.dev/query",rt=3e4,st=1e4,at=300,it=3,nt=2,ct=1e3,ot=3e4,ut=class ke{apiKey;publishableKey;secretKey;accessToken;legacyApiKey;environment;endpoint;timeout;openTimeout;defaultPublisher;defaultGame;allowedPublishers;allowedGames;logger;logLevel;retryOnRateLimit;maxRetries;retryOnNetworkError;maxNetworkRetries;retryBaseDelay;retryMaxDelay;cache;cacheTtl;cacheTtls;constructor(t={}){this.legacyApiKey=t.apiKey,this.publishableKey=t.publishableKey,this.secretKey=t.secretKey,this.accessToken=t.accessToken,this.apiKey=t.apiKey??t.publishableKey??t.secretKey,this.environment=t.environment,this.endpoint=t.endpoint??tt,this.timeout=t.timeout??rt,this.openTimeout=t.openTimeout??st,this.defaultPublisher=t.defaultPublisher,this.defaultGame=t.defaultGame,this.allowedPublishers=t.allowedPublishers,this.allowedGames=t.allowedGames,this.logger=t.logger,this.logLevel=t.logLevel??"info",this.retryOnRateLimit=t.retryOnRateLimit??false,this.maxRetries=t.maxRetries??it,this.retryOnNetworkError=t.retryOnNetworkError??true,this.maxNetworkRetries=t.maxNetworkRetries??nt,this.retryBaseDelay=t.retryBaseDelay??ct,this.retryMaxDelay=t.retryMaxDelay??ot,this.cache=t.cache,this.cacheTtl=t.cacheTtl??at,this.cacheTtls=t.cacheTtls??{};}calculateRetryDelay(t){let r=this.retryBaseDelay*Math.pow(2,t),s=Math.min(r,this.retryMaxDelay),a=s*.25*(Math.random()*2-1);return Math.round(s+a)}cacheTtlFor(t){return this.cacheTtls[t]??this.cacheTtl}resolvePublisher(t){return t??this.defaultPublisher}resolveGame(t){return t??this.defaultGame}validatePublisher(t){if(this.allowedPublishers&&!this.allowedPublishers.includes(t))throw new v(`Publisher '${t}' is not in the allowed publishers list`)}validateGame(t,r){if(!this.allowedGames)return;let s=this.allowedGames[t];if(s&&!s.includes(r))throw new v(`Game '${r}' is not allowed for publisher '${t}'`)}validateAccess(t,r){t&&(this.validatePublisher(t),r&&this.validateGame(t,r));}requireSecretCredential(t){if(!(!this.accessToken&&(this.legacyApiKey||this.secretKey&&!this.publishableKey)))throw new v(`${t} requires a server-side secretKey or legacy apiKey credential`)}requestApiKey(){return this.legacyApiKey??this.publishableKey??this.secretKey}configApiKey(){return this.legacyApiKey}shouldLog(t){let r={debug:0,info:1,warn:2,error:3};return r[t]>=r[this.logLevel]}merge(t){return new ke({apiKey:t.apiKey??this.legacyApiKey,publishableKey:t.publishableKey??this.publishableKey,secretKey:t.secretKey??this.secretKey,accessToken:t.accessToken??this.accessToken,environment:t.environment??this.environment,endpoint:t.endpoint??this.endpoint,timeout:t.timeout??this.timeout,openTimeout:t.openTimeout??this.openTimeout,defaultPublisher:t.defaultPublisher??this.defaultPublisher,defaultGame:t.defaultGame??this.defaultGame,allowedPublishers:t.allowedPublishers??this.allowedPublishers,allowedGames:t.allowedGames??this.allowedGames,logger:t.logger??this.logger,logLevel:t.logLevel??this.logLevel,retryOnRateLimit:t.retryOnRateLimit??this.retryOnRateLimit,maxRetries:t.maxRetries??this.maxRetries,retryOnNetworkError:t.retryOnNetworkError??this.retryOnNetworkError,maxNetworkRetries:t.maxNetworkRetries??this.maxNetworkRetries,retryBaseDelay:t.retryBaseDelay??this.retryBaseDelay,retryMaxDelay:t.retryMaxDelay??this.retryMaxDelay,cache:t.cache??this.cache,cacheTtl:t.cacheTtl??this.cacheTtl,cacheTtls:t.cacheTtls??this.cacheTtls})}},$e="0.4.1";function lt(){if(typeof globalThis<"u"&&"Bun"in globalThis){let e=globalThis.Bun&&typeof globalThis.Bun=="object"&&globalThis.Bun.version;return {name:"bun",version:typeof e=="string"?e:"unknown"}}if(typeof globalThis<"u"&&"Deno"in globalThis){let e=globalThis.Deno&&typeof globalThis.Deno=="object"&&globalThis.Deno.version&&typeof globalThis.Deno.version=="object"&&globalThis.Deno.version.deno;return {name:"deno",version:typeof e=="string"?e:"unknown"}}return typeof process<"u"&&process.versions&&process.versions.node?{name:"node",version:process.versions.node}:typeof navigator<"u"&&navigator.userAgent?dt(navigator.userAgent):{name:"unknown",version:"unknown"}}function dt(e){let t=e.match(/Edg\/(\d+(?:\.\d+)*)/);if(t)return {name:"edge",version:t[1]};let r=e.match(/Chrome\/(\d+(?:\.\d+)*)/);if(r&&!e.includes("Edg/"))return {name:"chrome",version:r[1]};let s=e.match(/Firefox\/(\d+(?:\.\d+)*)/);if(s)return {name:"firefox",version:s[1]};let a=e.match(/Version\/(\d+(?:\.\d+)*).*Safari/);return a?{name:"safari",version:a[1]}:{name:"browser",version:"unknown"}}function ht(){let e=lt();return `CardDB-SDK/js/${$e} (${e.name}/${e.version})`}function gr(){return $e}var ve=null;function yt(){return ve}var ft=class{config;constructor(e){this.config=e;}async execute(e,t={}){let r=this.extractOperationName(e),s=0,a=0;for(;;)try{let n=Date.now();this.logRequest(r,t);let c=await this.fetch(e,t),o=Date.now()-n,h=await this.handleResponse(c);return this.logResponse(r,o),h}catch(n){if(n instanceof U&&this.config.retryOnRateLimit&&s<this.config.maxRetries){s++;let c=n.retryAfter??60;this.logRateLimitRetry(r,s,c),await this.sleep(c*1e3);continue}if(this.isRetryableNetworkError(n)&&this.config.retryOnNetworkError&&a<this.config.maxNetworkRetries){let c=this.config.calculateRetryDelay(a);this.logNetworkRetry(r,a+1,c,n),a++,await this.sleep(c);continue}if(n instanceof N&&this.config.retryOnNetworkError&&a<this.config.maxNetworkRetries){let c=this.config.calculateRetryDelay(a);this.logNetworkRetry(r,a+1,c,n),a++,await this.sleep(c);continue}throw n}}isRetryableNetworkError(e){return e instanceof x||e instanceof O}async fetch(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(),this.config.timeout),a=this.config.requestApiKey();try{return await fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":ht(),...this.config.accessToken?{Authorization:`Bearer ${this.config.accessToken}`}:{},...!this.config.accessToken&&a?{"X-API-Key":a}:{}},body:JSON.stringify({query:e,variables:t}),signal:r.signal})}catch(n){throw n instanceof Error?n.name==="AbortError"?(this.logError("Request timed out"),new O("Request timed out")):(this.logError(`Connection failed: ${n.message}`),new x(`Connection failed: ${n.message}`)):new x("Connection failed")}finally{clearTimeout(s);}}async handleResponse(e){switch(this.extractRateLimitInfo(e),e.status){case 200:return this.handleSuccessResponse(e);case 401:throw new G("Invalid or missing API key");case 429:return this.handleRateLimitResponse(e);default:if(e.status>=400&&e.status<500)return this.handleClientError(e);if(e.status>=500){let t=await this.parseBody(e);throw new N(`Server error (${e.status})`,{status:e.status,response:t})}throw new y(`Unexpected response status: ${e.status}`)}}async handleSuccessResponse(e){let t=await this.parseBody(e);return t.errors&&t.errors.length>0&&this.handleGraphQLErrors(t.errors,t),t.data??{}}handleGraphQLErrors(e,t){let r=e[0],s=r.message||"GraphQL error";switch(r.extensions?.code){case "UNAUTHENTICATED":throw new G(s,t);case "RATE_LIMITED":throw new U(s,{response:t});case "NOT_FOUND":throw new y(s,t);case "VALIDATION_ERROR":case "BAD_USER_INPUT":throw new F(s,{errors:e,response:t});default:throw new ce(s,{errors:e,response:t})}}async handleRateLimitResponse(e){let t=parseInt(e.headers.get("Retry-After")??"60",10),r=parseInt(e.headers.get("X-RateLimit-Limit")??"",10)||null,s=parseInt(e.headers.get("X-RateLimit-Remaining")??"",10)||null,a=parseInt(e.headers.get("X-RateLimit-Reset")??"",10)||null,n=a?new Date(a*1e3):null,c=await this.parseBody(e);throw new U("Rate limit exceeded",{retryAfter:t,limit:r,remaining:s,resetAt:n,response:c})}async handleClientError(e){let t=await this.parseBody(e),r=t.errors?.[0]?.message??`Client error (${e.status})`;throw new F(r,{response:t})}async parseBody(e){try{return await e.json()}catch{return {raw:await e.text()}}}extractRateLimitInfo(e){let t=parseInt(e.headers.get("X-RateLimit-Limit")??"",10)||null,r=parseInt(e.headers.get("X-RateLimit-Remaining")??"",10)||null,s=parseInt(e.headers.get("X-RateLimit-Reset")??"",10)||null;ve={limit:t,remaining:r,reset:s};}extractOperationName(e){let t=e.match(/(?:query|mutation)\s+(\w+)/);return t?t[1]:"Unknown"}sleep(e){return new Promise(t=>setTimeout(t,e))}logRequest(e,t){!this.config.logger||!this.config.shouldLog("debug")||this.config.logger.debug(`[CardDB] Executing ${e}`,{variables:t});}logResponse(e,t){!this.config.logger||!this.config.shouldLog("info")||this.config.logger.info(`[CardDB] ${e} completed in ${t}ms`);}logRateLimitRetry(e,t,r){!this.config.logger||!this.config.shouldLog("warn")||this.config.logger.warn(`[CardDB] Rate limited on ${e}, retry ${t}/${this.config.maxRetries} after ${r}s`);}logNetworkRetry(e,t,r,s){if(!this.config.logger||!this.config.shouldLog("warn"))return;let a=s instanceof Error?s.name:"Unknown";this.config.logger.warn(`[CardDB] ${a} on ${e}, retry ${t}/${this.config.maxNetworkRetries} after ${r}ms`);}logError(e){!this.config.logger||!this.config.shouldLog("error")||this.config.logger.error(`[CardDB] ${e}`);}};function pt(e,t,r){let s=Object.entries(r).filter(([,a])=>a!==void 0).sort(([a],[n])=>a.localeCompare(n)).map(([a,n])=>`${a}=${JSON.stringify(n)}`).join("&");return `carddb:${e}:${t}:${s}`}async function mt(e,t){let r=e.get(t);return r}async function gt(e,t,r,s){let a=e.set(t,r,s);a instanceof Promise&&await a;}var f=class{connection;config;constructor(e,t){this.connection=e,this.config=t;}resolvePublisher(e){let t=this.config.resolvePublisher(e);if(!t)throw new Error("publisher_slug is required (no default configured)");return t}resolveGame(e){let t=this.config.resolveGame(e);if(!t)throw new Error("game_key is required (no default configured)");return t}validateAccess(e,t){this.config.validateAccess(e,t);}async withCache(e,t,r,s){let a=r.cache??!!this.config.cache,n=this.config.cache;if(!a||!n)return s();let c=await mt(n,e);if(c!==null)return c;let o=await s();if(o!=null){let h=this.config.cacheTtlFor(t);await gt(n,e,o,h);}return o}cacheKey(e,t,r){return pt(e,t,r)}},It=class extends f{constructor(e,t){super(e,t);}async search(e={}){let{query:t,variables:r}=i.searchPublishers({search:e.search,first:e.first,after:e.after}),s=this.cacheKey("publishers","search",r),a=await this.withCache(s,"publishers",e,async()=>(await this.connection.execute(t,r)).searchPublishers);return new l(a,{nextPageLoader:async n=>this.search({...e,after:n})})}async get(e,t={}){let r=this.isUUID(e),s=this.cacheKey("publishers","get",{[r?"id":"slug"]:e});return this.withCache(s,"publishers",t,async()=>{if(r){let{query:a}=i.fetchPublisherById();return (await this.connection.execute(a,{id:e})).fetchPublisher??null}else {let{query:a}=i.fetchPublisherBySlug();return (await this.connection.execute(a,{slug:e})).fetchPublisher??null}})}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("publishers","getMany",{slugs:e});return this.withCache(r,"publishers",t,async()=>{let{query:s}=i.fetchPublishers();return (await this.connection.execute(s,{slugs:e})).fetchPublishers??[]})}isUUID(e){return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}},bt=class extends f{constructor(e,t){super(e,t);}async list(e,t={}){let{query:r,variables:s}=i.listGames({publisherId:e,first:t.first,after:t.after,includeArchived:t.includeArchived}),a=this.cacheKey("games","list",s),n=await this.withCache(a,"games",t,async()=>(await this.connection.execute(r,s)).games);return new l(n,{nextPageLoader:async c=>this.list(e,{...t,after:c})})}async getByKey(e){let t=this.cacheKey("games","getByKey",{publisherId:e.publisherId,publisherSlug:e.publisherSlug,gameKey:e.gameKey});return this.withCache(t,"games",e,async()=>{let{query:r,variables:s}=i.game(e);return (await this.connection.execute(r,s)).game??null})}async getBySlug(e){let t=this.cacheKey("games","getBySlug",{publisherId:e.publisherId,publisherSlug:e.publisherSlug,gameSlug:e.gameSlug});return this.withCache(t,"games",e,async()=>{let{query:r,variables:s}=i.game(e);return (await this.connection.execute(r,s)).game??null})}async create(e){this.config.requireSecretCredential("games.create");let{query:t}=i.createGame();return (await this.connection.execute(t,i.gameCreateVariables(e))).gameCreate}async update(e,t){this.config.requireSecretCredential("games.update");let{query:r}=i.updateGame();return (await this.connection.execute(r,i.gameUpdateVariables(e,t))).gameUpdate}async getRegions(e={}){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=i.gameScanRegionsVariables(t,r,e.includeInactive),a=this.cacheKey("games","getRegions",s);return this.withCache(a,"games",e,async()=>{let{query:n}=i.gameScanRegions();return (await this.connection.execute(n,s)).gameScanRegions??[]})}async search(e={}){let t=this.config.resolvePublisher(e.publisherSlug);t&&this.validateAccess(t);let{query:r,variables:s}=i.searchGames({publisherSlug:t,search:e.search,first:e.first,after:e.after}),a=this.cacheKey("games","search",s),n=await this.withCache(a,"games",e,async()=>(await this.connection.execute(r,s)).searchGames);return new l(n,{nextPageLoader:async c=>this.search({...e,after:c})})}async get(e,t,r){if(typeof t=="string"){let s=e,a=t,n=r??{};this.validateAccess(s,a);let c=this.cacheKey("games","getByKeys",{publisherSlug:s,gameKey:a});return this.withCache(c,"games",n,async()=>{let{query:o}=i.fetchGameByKeys();return (await this.connection.execute(o,{publisherSlug:s,gameKey:a})).fetchGame??null})}else {let s=e,a=t??{},n=this.cacheKey("games","get",{id:s});return this.withCache(n,"games",a,async()=>{let{query:c}=i.fetchGameById();return (await this.connection.execute(c,{id:s})).fetchGame??null})}}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("games","getMany",{ids:e});return this.withCache(r,"games",t,async()=>{let{query:s}=i.fetchGames();return (await this.connection.execute(s,{ids:e})).fetchGames??[]})}},kt=class extends f{constructor(e,t){super(e,t);}async list(e,t={}){let{query:r,variables:s}=i.listDatasets({publisherId:e,gameId:t.gameId,includeArchived:t.includeArchived,purpose:t.purpose,first:t.first,after:t.after}),a=this.cacheKey("datasets","list",s),n=await this.withCache(a,"datasets",t,async()=>(await this.connection.execute(r,s)).datasets);return new l(n,{nextPageLoader:async c=>this.list(e,{...t,after:c})})}async getByKey(e){let t=this.cacheKey("datasets","getByKey",{publisherId:e.publisherId,gameId:e.gameId,datasetKey:e.datasetKey});return this.withCache(t,"datasets",e,async()=>{let{query:r,variables:s}=i.dataset(e);return (await this.connection.execute(r,s)).dataset??null})}async getSchema(e){return (typeof e=="string"?await this.withCache(this.cacheKey("datasets","getSchema",{id:e}),"datasets",{},async()=>{let{query:r,variables:s}=i.dataset({id:e});return (await this.connection.execute(r,s)).dataset??null}):await this.getByKey(e))?.schema??null}async search(e={}){let t=this.config.resolvePublisher(e.publisherSlug),r=this.config.resolveGame(e.gameKey);t&&this.validateAccess(t,r);let{query:s,variables:a}=i.searchDatasets({publisherSlug:t,gameKey:r,search:e.search,purpose:e.purpose,first:e.first,after:e.after}),n=this.cacheKey("datasets","search",a),c=await this.withCache(n,"datasets",e,async()=>(await this.connection.execute(s,a)).searchDatasets);return new l(c,{nextPageLoader:async o=>this.search({...e,after:o})})}async get(e,t,r,s){if(typeof t=="string"&&typeof r=="string"){let a=e,n=t,c=s??{};this.validateAccess(a,n);let o=this.cacheKey("datasets","getByKeys",{publisherSlug:a,gameKey:n,datasetKey:r});return this.withCache(o,"datasets",c,async()=>{let{query:h}=i.fetchDatasetByKeys();return (await this.connection.execute(h,{publisherSlug:a,gameKey:n,datasetKey:r})).fetchDataset??null})}else {let a=e,n=t??{},c=this.cacheKey("datasets","get",{id:a});return this.withCache(c,"datasets",n,async()=>{let{query:o}=i.fetchDatasetById();return (await this.connection.execute(o,{id:a})).fetchDataset??null})}}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("datasets","getMany",{ids:e});return this.withCache(r,"datasets",t,async()=>{let{query:s}=i.fetchDatasets();return (await this.connection.execute(s,{ids:e})).fetchDatasets??[]})}},$t=class extends f{constructor(e,t){super(e,t);}async fetch(e,t={}){let r=this.cacheKey("decks","fetch",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=i.fetchDeckById();return (await this.connection.execute(s,{id:e})).fetchDeck??null})}async get(e,t){let r=i.deckReadVariables(e,t.readState,t.version),s=this.cacheKey("decks","get",r);return this.withCache(s,"decks",t,async()=>{let{query:a}=i.deckById();return (await this.connection.execute(a,r)).deck??null})}async getDraft(e,t={}){return this.get(e,{...t,readState:"DRAFT"})}async getPublished(e,t={}){return this.get(e,{...t,readState:"PUBLISHED",version:t.version})}async fetchMine(e,t={}){let r=this.cacheKey("decks","fetchMine",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=i.myDeck();return (await this.connection.execute(s,{id:e})).myDeck??null})}async fetchBySlug(e,t,r,s={}){let a=this.cacheKey("decks","fetchBySlug",{publisherSlug:e,gameKey:t,slug:r});return this.withCache(a,"decks",s,async()=>{let{query:n}=i.fetchDeckBySlug();return (await this.connection.execute(n,{publisherSlug:e,gameKey:t,slug:r})).fetchDeckBySlug??null})}async getBySlug(e,t,r,s={}){let a=this.cacheKey("decks","getBySlug",{publisherSlug:e,gameKey:t,slug:r});return this.withCache(a,"decks",s,async()=>{let{query:n}=i.deckBySlug();return (await this.connection.execute(n,{publisherSlug:e,gameKey:t,slug:r})).deckBySlug??null})}async fetchByExternalRef(e,t={}){let r=this.cacheKey("decks","fetchByExternalRef",{externalRef:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=i.fetchDeckByExternalRef();return (await this.connection.execute(s,{externalRef:e})).fetchDeckByExternalRef??null})}async getByExternalRef(e,t){let r=i.deckExternalRefReadVariables(e,t.readState,t.version),s=this.cacheKey("decks","getByExternalRef",r);return this.withCache(s,"decks",t,async()=>{let{query:a}=i.deckByExternalRef();return (await this.connection.execute(a,r)).deckByExternalRef??null})}async getDraftByExternalRef(e,t={}){return this.getByExternalRef(e,{...t,readState:"DRAFT"})}async getPublishedByExternalRef(e,t={}){return this.getByExternalRef(e,{...t,readState:"PUBLISHED",version:t.version})}async listMine(e={}){let{query:t,variables:r}=i.listMyDecks({first:e.first,after:e.after,includeArchived:e.includeArchived}),s=this.cacheKey("decks","listMine",r),a=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).myDecks);return new l(a,{nextPageLoader:async n=>this.listMine({...e,after:n})})}async listViewer(e={}){let{query:t,variables:r}=i.viewerDecks({filter:e.filter,first:e.first,after:e.after}),s=this.cacheKey("decks","listViewer",r),a=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).viewerDecks);return new l(a,{nextPageLoader:async n=>this.listViewer({...e,after:n})})}async listApp(e={}){this.config.requireSecretCredential("decks.listApp");let{query:t,variables:r}=i.appDecks({filter:e.filter,first:e.first,after:e.after}),s=this.cacheKey("decks","listApp",r),a=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).appDecks);return new l(a,{nextPageLoader:async n=>this.listApp({...e,after:n})})}async listPublic(e={}){let{query:t,variables:r}=i.publicDecks({filter:e.filter,first:e.first,after:e.after}),s=this.cacheKey("decks","listPublic",r),a=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).publicDecks);return new l(a,{nextPageLoader:async n=>this.listPublic({...e,after:n})})}async fetchVersion(e,t={}){let r=this.cacheKey("decks","fetchVersion",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=i.deckVersion();return (await this.connection.execute(s,{id:e})).deckVersion??null})}async listVersions(e,t={}){let{query:r,variables:s}=i.deckVersions({first:t.first,after:t.after}),a={deckId:e,...s},n=this.cacheKey("decks","listVersions",a),c=await this.withCache(n,"decks",t,async()=>(await this.connection.execute(r,a)).deckVersions);return new l(c,{nextPageLoader:async o=>this.listVersions(e,{...t,after:o})})}async draftDiff(e,t={}){let r=this.cacheKey("decks","draftDiff",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=i.deckDraftDiff();return (await this.connection.execute(s,{id:e})).deckDraftDiff})}async versionDiff(e,t,r={}){let s=i.deckVersionDiffVariables(e,t),a=this.cacheKey("decks","versionDiff",s);return this.withCache(a,"decks",r,async()=>{let{query:n}=i.deckVersionDiff();return (await this.connection.execute(n,s)).deckVersionDiff})}async validate(e,t,r={}){let s=i.deckValidateVariables(e,t),a=this.cacheKey("decks","validate",s);return this.withCache(a,"decks",r,async()=>{let{query:n}=i.deckValidate();return (await this.connection.execute(n,s)).deckValidate})}async hydrateDeckEntries(e,t={}){let r=i.deckHydrateEntriesVariables(e),s=this.cacheKey("decks","hydrateDeckEntries",r);return this.withCache(s,"decks",t,async()=>{let{query:a}=i.deckHydrateEntries();return (await this.connection.execute(a,r)).deckHydrateEntries})}async exportDeck(e,t="SIMPLE_TEXT",r={}){let s=i.deckExportVariables(e,t),a=this.cacheKey("decks","exportDeck",s);return this.withCache(a,"decks",r,async()=>{let{query:n}=i.deckExport();return (await this.connection.execute(n,s)).deckExport})}async sectionDefinitions(e={}){let{query:t,variables:r}=i.deckSectionDefinitions({publisherSlug:e.publisherSlug,gameKey:e.gameKey,gameId:e.gameId,rulesetKey:e.rulesetKey,rulesetVersionId:e.rulesetVersionId}),s=this.cacheKey("decks","sectionDefinitions",r);return this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).deckSectionDefinitions)}async listCollaborators(e,t={}){let r=this.cacheKey("decks","listCollaborators",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=i.deckCollaborators();return (await this.connection.execute(s,{deckId:e})).deckCollaborators})}async listApiApplicationAccesses(e,t={}){let r=i.deckApiApplicationAccessesVariables(e,t.includeRevoked),s=this.cacheKey("decks","listApiApplicationAccesses",r);return this.withCache(s,"decks",t,async()=>{let{query:a}=i.deckApiApplicationAccesses();return (await this.connection.execute(a,r)).deckApiApplicationAccesses})}async listMyApiApplicationAccesses(e={}){let t=i.myDeckApiApplicationAccessesVariables(e.applicationId),r=this.cacheKey("decks","listMyApiApplicationAccesses",t);return this.withCache(r,"decks",e,async()=>{let{query:s}=i.myDeckApiApplicationAccesses();return (await this.connection.execute(s,t)).myDeckApiApplicationAccesses})}async create(e){let{query:t}=i.createDeck(),r=i.deckCreateVariables(e);return (await this.connection.execute(t,r)).deckCreate}async update(e,t){let{query:r}=i.updateDeck(),s=i.deckUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckUpdate}async updateMetadata(e,t){return this.update(e,t)}async upsertByExternalRef(e){this.config.requireSecretCredential("decks.upsertByExternalRef");let{query:t}=i.upsertDeckByExternalRef(),r=i.deckUpsertByExternalRefVariables(e);return (await this.connection.execute(t,r)).deckUpsertByExternalRef}async claim(e,t){let{query:r}=i.claimDeck(),s=i.deckClaimVariables(e,t);return (await this.connection.execute(r,s)).deckClaim}async transferOwnership(e,t){let{query:r}=i.transferDeckOwnership(),s=i.deckTransferOwnershipVariables(e,t);return (await this.connection.execute(r,s)).deckTransferOwnership}async copy(e,t){let{query:r}=i.copyDeck(),s=i.deckCopyVariables(e,t);return (await this.connection.execute(r,s)).deckCopy}async addEntry(e){let{query:t}=i.addDeckEntry(),r=i.deckEntryAddVariables(e);return (await this.connection.execute(t,r)).deckEntryAdd}async updateEntry(e,t){let{query:r}=i.updateDeckEntry(),s=i.deckEntryUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckEntryUpdate}async removeEntry(e,t){let{query:r}=i.removeDeckEntry(),s=i.deckEntryRemoveVariables(e,t);return (await this.connection.execute(r,s)).deckEntryRemove}async reorderEntries(e,t){let{query:r}=i.reorderDeckEntries(),s=i.deckEntryReorderVariables(e,t);return (await this.connection.execute(r,s)).deckEntryReorder}async replaceEntries(e,t){let{query:r}=i.replaceDeckEntries(),s=i.deckEntriesReplaceVariables(e,t);return (await this.connection.execute(r,s)).deckEntriesReplace}async importDeck(e){let{query:t}=i.importDeck(),r=i.deckImportVariables(e);return (await this.connection.execute(t,r)).deckImport}async listImportFormats(e,t={}){let{query:r,variables:s}=i.deckImportFormats({gameId:e,includeArchived:t.includeArchived,first:t.first,after:t.after}),a=this.cacheKey("decks","listImportFormats",s),n=await this.withCache(a,"decks",t,async()=>(await this.connection.execute(r,s)).deckImportFormats);return new l(n,{nextPageLoader:async c=>this.listImportFormats(e,{...t,after:c})})}async fetchImportFormat(e,t={}){let r=this.cacheKey("decks","fetchImportFormat",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=i.deckImportFormat();return (await this.connection.execute(s,{id:e})).deckImportFormat??null})}async testImportFormat(e){let{query:t}=i.deckImportFormatTest(),r=i.deckImportFormatTestVariables(e);return (await this.connection.execute(t,r)).deckImportFormatTest}async createImportFormat(e){let{query:t}=i.createDeckImportFormat(),r=i.deckImportFormatCreateVariables(e);return (await this.connection.execute(t,r)).deckImportFormatCreate}async updateImportFormat(e,t){let{query:r}=i.updateDeckImportFormat(),s=i.deckImportFormatUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckImportFormatUpdate}async archiveImportFormat(e){let{query:t}=i.archiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatArchive}async unarchiveImportFormat(e){let{query:t}=i.unarchiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatUnarchive}async delete(e){let{query:t}=i.deleteDeck();return !!(await this.connection.execute(t,{id:e})).deckDelete}async archive(e){let{query:t}=i.archiveDeck();return (await this.connection.execute(t,{id:e})).deckArchive}async restore(e){let{query:t}=i.restoreDeck();return (await this.connection.execute(t,{id:e})).deckRestore}async unpublish(e){let{query:t}=i.unpublishDeck();return (await this.connection.execute(t,{id:e})).deckUnpublish}async publish(e,t){let{query:r}=i.publishDeck(),s=i.deckPublishVariables(e,t);return (await this.connection.execute(r,s)).deckPublish}async removeInvalidEntries(e,t){let{query:r}=i.removeInvalidDeckEntries(),s=i.deckRemoveInvalidEntriesVariables(e,t);return (await this.connection.execute(r,s)).deckRemoveInvalidEntries}async upsertCollaborator(e,t,r){let{query:s}=i.upsertDeckCollaborator(),a=i.deckCollaboratorVariables(e,t,r);return (await this.connection.execute(s,a)).deckCollaboratorUpsert}async removeCollaborator(e,t){let{query:r}=i.removeDeckCollaborator(),s=i.deckCollaboratorVariables(e,t);return !!(await this.connection.execute(r,s)).deckCollaboratorRemove}async createTokenIssuer(e){this.config.requireSecretCredential("decks.createTokenIssuer");let{query:t}=i.createDeckTokenIssuer(),r=i.deckTokenIssuerCreateVariables(e);return (await this.connection.execute(t,r)).deckTokenIssuerCreate}async revokeTokenIssuer(e){this.config.requireSecretCredential("decks.revokeTokenIssuer");let{query:t}=i.revokeDeckTokenIssuer();return !!(await this.connection.execute(t,{id:e})).deckTokenIssuerRevoke}async revokeTokenIssuerSigningKey(e){this.config.requireSecretCredential("decks.revokeTokenIssuerSigningKey");let{query:t}=i.revokeDeckTokenIssuerSigningKey();return (await this.connection.execute(t,{id:e})).deckTokenIssuerSigningKeyRevoke}async grantApiApplicationAccess(e){let{query:t}=i.grantDeckApiApplicationAccess(),r=i.deckApiApplicationAccessGrantVariables(e);return (await this.connection.execute(t,r)).deckApiApplicationAccessGrant}async revokeApiApplicationAccess(e,t){let{query:r}=i.revokeDeckApiApplicationAccess(),s=i.deckApiApplicationAccessRevokeVariables(e,t);return !!(await this.connection.execute(r,s)).deckApiApplicationAccessRevoke}async exchangeToken(e){this.config.requireSecretCredential("decks.exchangeToken");let{query:t}=i.exchangeDeckToken(),r=i.deckTokenExchangeVariables(e);return (await this.connection.execute(t,r)).deckTokenExchange}async revokeToken(e){this.config.requireSecretCredential("decks.revokeToken");let{query:t}=i.revokeDeckToken();return !!(await this.connection.execute(t,{id:e})).deckTokenRevoke}async hydrateEntries(e){if(e.entries.length===0)return [];let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=e.entries.map(o=>o.identifier),a=this.cacheKey("decks","hydrateEntries",{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:s}),n=await this.withCache(a,"decks",e,async()=>{let{query:o}=i.fetchRecordsByIdentifier();return (await this.connection.execute(o,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:s})).fetchRecordsByIdentifier}),c=vt(n,s,e.identifierField);return e.entries.map(o=>({...o,record:c.get(o.identifier)??null}))}};function vt(e,t,r){let s=new Set(t),a=new Map;for(let n of e){let c=r?n.data[r]:Object.values(n.data).find(h=>s.has(String(h)));if(c==null)continue;let o=String(c);s.has(o)&&(a.set(o,n),s.delete(o));}return a}var Dt=class extends f{constructor(e,t){super(e,t);}async list(e){let t=P(e.filter),{query:r,variables:s}=i.listDatasetRecords({datasetId:e.datasetId,filter:t,orderBy:e.orderBy,first:e.first,after:e.after,last:e.last,before:e.before,validateSchema:e.validateSchema}),a=this.cacheKey("records","list",s),n=await this.withCache(a,"records",e,async()=>(await this.connection.execute(r,s)).datasetRecords);return new l(n,{nextPageLoader:async c=>this.list({...e,after:c})})}async getByDatasetIdentifier(e){let t=this.cacheKey("records","getByDatasetIdentifier",{datasetId:e.datasetId,identifier:e.identifier,includePricing:e.includePricing??false});return this.withCache(t,"records",e,async()=>{let{query:r,variables:s}=i.datasetRecord({datasetId:e.datasetId,identifier:e.identifier,includePricing:e.includePricing});return (await this.connection.execute(r,s)).datasetRecord??null})}async upsertBatch(e){this.config.requireSecretCredential("records.upsertBatch");let{query:t}=i.upsertDatasetRecords();return (await this.connection.execute(t,i.datasetRecordsUpsertVariables(e))).datasetRecordsUpsert}async deleteBatch(e){this.config.requireSecretCredential("records.deleteBatch");let{query:t}=i.deleteDatasetRecords();return (await this.connection.execute(t,i.datasetRecordsDeleteVariables(e))).datasetRecordsDelete}async getDeleteJob(e,t={}){let r=this.cacheKey("records","getDeleteJob",{id:e});return this.withCache(r,"records",t,async()=>{let{query:s}=i.datasetRecordDeleteJob();return (await this.connection.execute(s,{id:e})).datasetRecordDeleteJob??null})}async listDeleteJobs(e,t={}){let{query:r,variables:s}=i.datasetRecordDeleteJobs({publisherId:e,datasetId:t.datasetId,status:t.status,first:t.first,after:t.after}),a=this.cacheKey("records","listDeleteJobs",s),n=await this.withCache(a,"records",t,async()=>(await this.connection.execute(r,s)).datasetRecordDeleteJobs);return new l(n,{nextPageLoader:async c=>this.listDeleteJobs(e,{...t,after:c})})}async waitForDeleteJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,a=Date.now();for(;;){let n=await this.getDeleteJob(e,{cache:false});if(!n)throw new Error(`Delete job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-a>=s)throw new Error(`Timed out waiting for delete job '${e}'`);await new Promise(c=>setTimeout(c,r));}}async search(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=P(e.filter),{query:a,variables:n}=i.searchRecords({publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,filter:s,search:e.search,orderBy:e.orderBy,resolveLinks:e.resolveLinks,first:e.first,after:e.after,validateSchema:e.validateSchema,includePricing:e.includePricing}),c=this.cacheKey("records","search",{...n,includePricing:e.includePricing??false}),o=await this.withCache(c,"records",e,async()=>(await this.connection.execute(a,n)).searchRecords);return new l(o,{nextPageLoader:async h=>this.search({...e,after:h})})}async get(e,t={}){let r=this.cacheKey("records","get",{id:e,includePricing:t.includePricing??false});return this.withCache(r,"records",t,async()=>{let{query:s}=i.fetchRecordById({includePricing:t.includePricing});return (await this.connection.execute(s,{id:e})).fetchRecord??null})}async getByIdentifier(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=this.cacheKey("records","getByIdentifier",{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifier:e.identifier,includePricing:e.includePricing??false});return this.withCache(s,"records",e,async()=>{let{query:a}=i.fetchRecordByIdentifier({includePricing:e.includePricing});return (await this.connection.execute(a,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifier:e.identifier})).fetchRecordByIdentifier??null})}async getManyByIdentifier(e){if(e.identifiers.length===0)return [];let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=this.cacheKey("records","getManyByIdentifier",{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:e.identifiers,includePricing:e.includePricing??false});return this.withCache(s,"records",e,async()=>{let{query:a}=i.fetchRecordsByIdentifier({includePricing:e.includePricing});return (await this.connection.execute(a,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:e.identifiers})).fetchRecordsByIdentifier??[]})}async getMany(e,t={}){if(e.length===0)return [];let r=this.cacheKey("records","getMany",{ids:e,includePricing:t.includePricing??false});return this.withCache(r,"records",t,async()=>{let{query:s}=i.fetchRecords({includePricing:t.includePricing});return (await this.connection.execute(s,{ids:e})).fetchRecords??[]})}},wt=class extends f{constructor(e,t){super(e,t);}async datasets(e={}){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let{query:s,variables:a}=i.searchDatasets({publisherSlug:t,gameKey:r,search:e.search,purpose:"RULES",first:e.first,after:e.after}),n=this.cacheKey("rules","datasets",a),c=await this.withCache(n,"datasets",e,async()=>(await this.connection.execute(s,a)).searchDatasets);return new l(c,{nextPageLoader:async o=>this.datasets({...e,after:o})})}async list(e={}){return this.searchRuleRecords("rules",e)}async formats(e={}){return this.searchRuleRecords(e.datasetKey??"formats",e)}async searchRuleRecords(e,t){let r=this.resolvePublisher(t.publisherSlug),s=this.resolveGame(t.gameKey),a=t.datasetKey??e;this.validateAccess(r,s);let n=P(t.filter),{query:c,variables:o}=i.searchRecords({publisherSlug:r,gameKey:s,datasetKey:a,filter:n,search:t.search,orderBy:t.orderBy,resolveLinks:t.resolveLinks,first:t.first,after:t.after,validateSchema:t.validateSchema}),h=this.cacheKey("rules","records",o),S=await this.withCache(h,"records",t,async()=>(await this.connection.execute(c,o)).searchRecords);return new l(S,{nextPageLoader:async Q=>this.searchRuleRecords(e,{...t,after:Q})})}},St=class extends f{constructor(e,t){super(e,t);}async list(e){let{query:t,variables:r}=i.deckImportFormats({publisherId:e.publisherId,gameId:e.gameId,includeArchived:e.includeArchived,first:e.first,after:e.after}),s=this.cacheKey("importFormats","list",r),a=await this.withCache(s,"importFormats",e,async()=>(await this.connection.execute(t,r)).deckImportFormats);return new l(a,{nextPageLoader:async n=>this.list({...e,after:n})})}async get(e,t={}){let r=this.cacheKey("importFormats","get",{id:e});return this.withCache(r,"importFormats",t,async()=>{let{query:s}=i.deckImportFormat();return (await this.connection.execute(s,{id:e})).deckImportFormat??null})}async getByKey(e){let t=this.cacheKey("importFormats","getByKey",{gameId:e.gameId,formatKey:e.key});return this.withCache(t,"importFormats",e,async()=>{let{query:r}=i.deckImportFormat();return (await this.connection.execute(r,{gameId:e.gameId,key:e.key})).deckImportFormat??null})}async test(e){let{query:t}=i.deckImportFormatTest();return (await this.connection.execute(t,i.deckImportFormatTestVariables(e))).deckImportFormatTest}async create(e){this.config.requireSecretCredential("importFormats.create");let{query:t}=i.createDeckImportFormat();return (await this.connection.execute(t,i.deckImportFormatCreateVariables(e))).deckImportFormatCreate}async update(e,t){this.config.requireSecretCredential("importFormats.update");let{query:r}=i.updateDeckImportFormat();return (await this.connection.execute(r,i.deckImportFormatUpdateVariables(e,t))).deckImportFormatUpdate}async archive(e){this.config.requireSecretCredential("importFormats.archive");let{query:t}=i.archiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatArchive}async unarchive(e){this.config.requireSecretCredential("importFormats.unarchive");let{query:t}=i.unarchiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatUnarchive}},At=class extends f{constructor(e,t){super(e,t);}async preview(e){let{query:t}=i.datasetImportPreview();return (await this.connection.execute(t,i.datasetImportPreviewVariables(e))).datasetImportPreview}async validate(e){let{query:t}=i.datasetImportValidate();return (await this.connection.execute(t,i.datasetImportValidateVariables(e))).datasetImportValidate}async run(e){if(this.config.requireSecretCredential("imports.run"),"fileId"in e&&e.fileId){let{query:s}=i.datasetImportFromFile();return (await this.connection.execute(s,i.datasetImportFromFileVariables(e))).datasetImportFromFile}if("sourceUrl"in e&&e.sourceUrl){let{query:s}=i.datasetImportFromUrl();return (await this.connection.execute(s,i.datasetImportFromUrlVariables(e))).datasetImportFromUrl}let{query:t}=i.datasetImportFromPayload();return (await this.connection.execute(t,i.datasetImportFromPayloadVariables(e))).datasetImportFromPayload}async getJob(e,t={}){let r=this.cacheKey("imports","getJob",{id:e});return this.withCache(r,"imports",t,async()=>{let{query:s}=i.importJob();return (await this.connection.execute(s,{id:e})).importJob??null})}async listJobs(e,t={}){let{query:r,variables:s}=i.importJobs({publisherId:e,datasetId:t.datasetId,status:t.status,first:t.first,after:t.after}),a=this.cacheKey("imports","listJobs",s),n=await this.withCache(a,"imports",t,async()=>(await this.connection.execute(r,s)).importJobs);return new l(n,{nextPageLoader:async c=>this.listJobs(e,{...t,after:c})})}async cancelJob(e){this.config.requireSecretCredential("imports.cancelJob");let{query:t}=i.importJobCancel();return (await this.connection.execute(t,{id:e})).importJobCancel}async listJobLogs(e,t={}){let{query:r,variables:s}=i.importJobLogs({importJobId:e,level:t.level,datasetKey:t.datasetKey,first:t.first,after:t.after}),a=this.cacheKey("imports","listJobLogs",s),n=await this.withCache(a,"imports",t,async()=>(await this.connection.execute(r,s)).importJob?.logs??Et());return new l(n,{nextPageLoader:async c=>this.listJobLogs(e,{...t,after:c})})}async waitForJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,a=Date.now();for(;;){let n=await this.getJob(e,{cache:false});if(!n)throw new Error(`Import job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-a>=s)throw new Error(`Timed out waiting for import job '${e}'`);await new Promise(c=>setTimeout(c,r));}}async previewGame(e){let{query:t}=i.gameImportPreview();return (await this.connection.execute(t,i.gameImportPreviewVariables(e))).gameImportPreview}async runGame(e){if(this.config.requireSecretCredential("imports.runGame"),"fileId"in e&&e.fileId){let{query:s}=i.gameImportFromFile();return (await this.connection.execute(s,i.gameImportFromFileVariables(e))).gameImportFromFile}if("sourceUrl"in e&&e.sourceUrl){let{query:s}=i.gameImportFromUrl();return (await this.connection.execute(s,i.gameImportFromUrlVariables(e))).gameImportFromUrl}let{query:t}=i.gameImportFromPayload();return (await this.connection.execute(t,i.gameImportFromPayloadVariables(e))).gameImportFromPayload}async getGameJob(e,t={}){let r=this.cacheKey("imports","getGameJob",{id:e});return this.withCache(r,"imports",t,async()=>{let{query:s}=i.gameImportJob();return (await this.connection.execute(s,{id:e})).gameImportJob??null})}async listGameJobs(e,t={}){let{query:r,variables:s}=i.gameImportJobs({gameId:e,status:t.status,first:t.first,after:t.after}),a=this.cacheKey("imports","listGameJobs",s),n=await this.withCache(a,"imports",t,async()=>(await this.connection.execute(r,s)).gameImportJobs);return new l(n,{nextPageLoader:async c=>this.listGameJobs(e,{...t,after:c})})}async cancelGameJob(e){this.config.requireSecretCredential("imports.cancelGameJob");let{query:t}=i.gameImportJobCancel();return (await this.connection.execute(t,{id:e})).gameImportJobCancel}async waitForGameJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,a=Date.now();for(;;){let n=await this.getGameJob(e,{cache:false});if(!n)throw new Error(`Game import job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-a>=s)throw new Error(`Timed out waiting for game import job '${e}'`);await new Promise(c=>setTimeout(c,r));}}};function Et(){return {totalCount:0,pageInfo:{hasNextPage:false,hasPreviousPage:false,startCursor:null,endCursor:null},edges:[]}}var Rt=class extends f{constructor(e,t){super(e,t);}async run(e){this.config.requireSecretCredential("exports.run");let{query:t}=i.datasetExport();return (await this.connection.execute(t,i.datasetExportVariables(e))).datasetExport}async create(e){return this.run(e)}async getJob(e,t={}){let r=this.cacheKey("exports","getJob",{id:e});return this.withCache(r,"exports",t,async()=>{let{query:s}=i.exportJob();return (await this.connection.execute(s,{id:e})).exportJob??null})}async listJobs(e,t={}){let{query:r,variables:s}=i.exportJobs({publisherId:e,gameId:t.gameId,datasetId:t.datasetId,status:t.status,first:t.first,after:t.after}),a=this.cacheKey("exports","listJobs",s),n=await this.withCache(a,"exports",t,async()=>(await this.connection.execute(r,s)).exportJobs);return new l(n,{nextPageLoader:async c=>this.listJobs(e,{...t,after:c})})}async refreshUrl(e){let{query:t}=i.exportJobRefreshUrl();return (await this.connection.execute(t,{id:e})).exportJobRefreshUrl}async cancel(e){this.config.requireSecretCredential("exports.cancel");let{query:t}=i.exportJobCancel();return (await this.connection.execute(t,{id:e})).exportJobCancel}async waitForJob(e,t={}){let r=t.intervalMs??1e3,s=t.timeoutMs??3e5,a=Date.now();for(;;){let n=await this.getJob(e,{cache:false});if(!n)throw new Error(`Export job '${e}' was not found`);if(n.status==="COMPLETED"||n.status==="FAILED")return n;if(Date.now()-a>=s)throw new Error(`Timed out waiting for export job '${e}'`);await new Promise(c=>setTimeout(c,r));}}},xt=class extends f{constructor(e,t){super(e,t);}async get(e,t={}){let r=this.cacheKey("files","get",{id:e});return this.withCache(r,"files",t,async()=>{let{query:s}=i.file();return (await this.connection.execute(s,{id:e})).file??null})}async requestUpload(e){this.config.requireSecretCredential("files.requestUpload");let{query:t}=i.fileUploadRequest();return (await this.connection.execute(t,i.fileUploadRequestVariables(e))).fileUploadRequest}async confirmUpload(e){this.config.requireSecretCredential("files.confirmUpload");let{query:t}=i.fileUploadConfirm();return (await this.connection.execute(t,{id:e})).fileUploadConfirm}async upload(e){let t=e.size??Ct(e.body);if(!t||t<=0)throw new Error("files.upload requires a positive size or a body with an inferable size");let r=await this.requestUpload({filename:e.filename,contentType:e.contentType,size:t,isPublic:e.isPublic??false,entityType:e.entityType??Tt(e.purpose),entityId:e.entityId,publisherId:e.publisherId,datasetId:e.datasetId});return await qt(r.uploadUrl,e.contentType,e.body),this.confirmUpload(r.file.id)}async delete(e){this.config.requireSecretCredential("files.delete");let{query:t}=i.fileDelete();return !!(await this.connection.execute(t,{id:e})).fileDelete}};async function qt(e,t,r){let s=globalThis.fetch;if(!s)throw new Error("files.upload requires a runtime with fetch support");let a=await s(e,{method:"PUT",headers:{"Content-Type":t},body:r});if(!a.ok){let n=await a.text().catch(()=>"");throw new Error(`File upload failed with ${a.status} ${a.statusText}${n?`: ${n}`:""}`)}}function Ct(e){if(typeof e=="string")return new TextEncoder().encode(e).byteLength;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength;let t=e;if(typeof t?.size=="number")return t.size;if(typeof t?.byteLength=="number")return t.byteLength;if(typeof t?.length=="number")return t.length}function Tt(e){if(!(!e||e==="scan_image"))return e==="import"?"import":e==="scan_template_example"?"scan_template_example":e}var Kt=class extends f{constructor(e,t){super(e,t);}async createUploadSession(e){let t=this.resolveCreateUploadSessionInput(e),{query:r}=i.createScanUploadSession();return (await this.connection.execute(r,i.createScanUploadSessionVariables(t))).createScanUploadSession}async confirmUpload(e){let t=this.resolveConfirmUploadInput(e),{query:r}=i.confirmScanUpload();return (await this.connection.execute(r,i.confirmScanUploadVariables(t))).confirmScanUpload}async createJob(e){let t=this.resolveCreateJobInput(e),{query:r}=i.createScanJob();return (await this.connection.execute(r,i.createScanJobVariables(t))).createScanJob}async getJob(e,t={}){let r=this.cacheKey("scans","getJob",{id:e});return this.withCache(r,"scans",t,async()=>{let{query:s}=i.scanJob();return (await this.connection.execute(s,{id:e})).scanJob??null})}async pollJob(e,t={}){let r=t.timeoutMs??3e5,s=Math.max(t.backoffFactor??1.5,1),a=t.maxIntervalMs??1e4,n=Date.now(),c=Math.max(t.intervalMs??1e3,1);for(;;){Pt(t.signal);let o=await this.getJob(e,{cache:false});if(!o)throw new Error(`Scan job '${e}' was not found`);if(Ut(o.status))return o;let h=Date.now()-n,S=r-h;if(S<=0)throw new Error(`Timed out waiting for scan job '${e}'`);await Ft(Math.min(c,S)),c=Math.min(Math.ceil(c*s),a);}}async submitFeedback(e){let{query:t}=i.submitScanFeedback();return (await this.connection.execute(t,i.submitScanFeedbackVariables(e))).submitScanFeedback}async metrics(e){let t=this.resolveMetricsInput(e),{query:r}=i.scanMetrics();return (await this.connection.execute(r,i.scanMetricsVariables(t))).scanMetrics}async verifyWebhookSignature(e){let t=Lt(),r=await t.importKey("raw",De(e.secret),{name:"HMAC",hash:"SHA-256"},false,["sign"]),s=await t.sign("HMAC",r,Vt(e.body)),a=`sha256=${Bt(new Uint8Array(s))}`;return _t(e.signature.trim().toLowerCase(),a)}resolveCreateJobInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolveCreateUploadSessionInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolveConfirmUploadInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolveMetricsInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}};function Ut(e){let t=e.toLowerCase();return t==="completed"||t==="failed"||t==="cancelled"}async function Ft(e){return new Promise(t=>setTimeout(t,e))}function Pt(e){if(e&&(e.throwIfAborted&&e.throwIfAborted(),e.aborted))throw new Error("Scan job polling aborted")}function Lt(){let t=globalThis.crypto?.subtle;if(!t)throw new Error("Web Crypto HMAC support is not available in this runtime");return t}function Vt(e){return typeof e=="string"?De(e):e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function De(e){return new TextEncoder().encode(e)}function Bt(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function _t(e,t){let r=Math.max(e.length,t.length),s=e.length^t.length;for(let a=0;a<r;a++)s|=(e.charCodeAt(a)||0)^(t.charCodeAt(a)||0);return s===0}var Mt=class extends f{constructor(e,t){super(e,t);}async resolve(e){let t=this.resolveTemplateScope(e),r=this.cacheKey("scanTemplates","resolve",{...t});return this.withCache(r,"scanTemplates",e,async()=>{let{query:s}=i.resolveScanTemplate();return (await this.connection.execute(s,i.resolveScanTemplateVariables(t))).resolveScanTemplate})}async list(e){let t=this.resolveListScope(e),r=this.cacheKey("scanTemplates","list",{...t});return this.withCache(r,"scanTemplates",e,async()=>{let{query:s}=i.scanTemplates();return (await this.connection.execute(s,i.scanTemplatesVariables(t))).scanTemplates?.templates??[]})}async create(e){this.config.requireSecretCredential("scanTemplates.create");let t=this.resolveSaveInput(e),{query:r}=i.createScanTemplate();return (await this.connection.execute(r,i.createScanTemplateVariables(t))).createScanTemplate}async update(e,t){this.config.requireSecretCredential("scanTemplates.update");let r=typeof e=="string"?e:e.id,s=typeof e=="string"?t:Jt(e);if(!s)throw new Error("scan template input is required");let a=this.resolveSaveInput(s),{query:n}=i.updateScanTemplate();return (await this.connection.execute(n,i.updateScanTemplateVariables(r,a))).updateScanTemplate}async preview(e){let t=this.resolvePreviewInput(e),{query:r}=i.previewScanTemplate();return (await this.connection.execute(r,i.previewScanTemplateVariables(t))).previewScanTemplate}resolveTemplateScope(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,templateId:e.templateId}}resolveListScope(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,includeArchived:e.includeArchived}}resolveSaveInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}resolvePreviewInput(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);return this.validateAccess(t,r),{...e,publisherSlug:t,gameKey:r}}};function Jt(e){let t={...e};return delete t.id,t}var we=class Se{config;connection;publishers;games;datasets;records;decks;rules;importFormats;imports;exports;files;scans;scanTemplates;constructor(t={}){this.config=new ut(t),this.connection=new ft(this.config),this.publishers=new It(this.connection,this.config),this.games=new bt(this.connection,this.config),this.datasets=new kt(this.connection,this.config),this.records=new Dt(this.connection,this.config),this.decks=new $t(this.connection,this.config),this.rules=new wt(this.connection,this.config),this.importFormats=new St(this.connection,this.config),this.imports=new At(this.connection,this.config),this.exports=new Rt(this.connection,this.config),this.files=new xt(this.connection,this.config),this.scans=new Kt(this.connection,this.config),this.scanTemplates=new Mt(this.connection,this.config);}async me(){let{query:t}=i.fetchMe();return (await this.connection.execute(t)).fetchMe??null}getRateLimitInfo(){return yt()}withConfig(t){let r=this.config.merge(t);return new Se({apiKey:r.configApiKey(),publishableKey:r.publishableKey,secretKey:r.secretKey,accessToken:r.accessToken,environment:r.environment,endpoint:r.endpoint,timeout:r.timeout,openTimeout:r.openTimeout,defaultPublisher:r.defaultPublisher,defaultGame:r.defaultGame,allowedPublishers:r.allowedPublishers,allowedGames:r.allowedGames,logger:r.logger,logLevel:r.logLevel,retryOnRateLimit:r.retryOnRateLimit,maxRetries:r.maxRetries,retryOnNetworkError:r.retryOnNetworkError,maxNetworkRetries:r.maxNetworkRetries,retryBaseDelay:r.retryBaseDelay,retryMaxDelay:r.retryMaxDelay,cache:r.cache,cacheTtl:r.cacheTtl,cacheTtls:r.cacheTtls})}};var X=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";this.storage=r==="sessionStorage"?globalThis.sessionStorage:globalThis.localStorage,this.prefix=t.prefix??"carddb:";}get(t){try{let r=this.storage.getItem(this.prefix+t);if(!r)return null;let s=JSON.parse(r);return s.expiresAt!==null&&Date.now()>s.expiresAt?(this.storage.removeItem(this.prefix+t),null):s.value}catch{return this.storage.removeItem(this.prefix+t),null}}set(t,r,s){try{let a={value:r,expiresAt:s!==void 0?Date.now()+s*1e3:null};this.storage.setItem(this.prefix+t,JSON.stringify(a));}catch(a){console.warn("[CardDB] Failed to write to cache:",a);}}delete(t){this.storage.removeItem(this.prefix+t);}clear(){let t=[];for(let r=0;r<this.storage.length;r++){let s=this.storage.key(r);s&&s.startsWith(this.prefix)&&t.push(s);}for(let r of t)this.storage.removeItem(r);}has(t){return this.get(t)!==null}get size(){let t=0;for(let r=0;r<this.storage.length;r++){let s=this.storage.key(r);s&&s.startsWith(this.prefix)&&t++;}return t}cleanup(){let t=Date.now(),r=[];for(let s=0;s<this.storage.length;s++){let a=this.storage.key(s);if(a&&a.startsWith(this.prefix))try{let n=this.storage.getItem(a);if(n){let c=JSON.parse(n);c.expiresAt!==null&&t>c.expiresAt&&r.push(a);}}catch{r.push(a);}}for(let s of r)this.storage.removeItem(s);}};var Ae=class extends we{constructor(t={}){if("apiKey"in t&&t.apiKey!==void 0)throw new v("apiKey is not accepted in browsers; use publishableKey or accessToken");if("secretKey"in t&&t.secretKey!==void 0)throw new v("secretKey is server-only; use publishableKey or accessToken in browsers");super(t);}};
|
|
1843
|
+
export{G as AuthenticationError,f as BaseResource,X as BrowserCache,Ae as CardDBClient,y as CardDBError,l as Collection,ut as Configuration,ft as Connection,x as ConnectionError,at as DEFAULT_CACHE_TTL,tt as DEFAULT_ENDPOINT,nt as DEFAULT_MAX_NETWORK_RETRIES,it as DEFAULT_MAX_RETRIES,st as DEFAULT_OPEN_TIMEOUT,ct as DEFAULT_RETRY_BASE_DELAY,ot as DEFAULT_RETRY_MAX_DELAY,rt as DEFAULT_TIMEOUT,kt as DatasetsResource,$t as DecksResource,Rt as ExportsResource,xt as FilesResource,Ee as FilterBuilder,bt as GamesResource,ce as GraphQLError,St as ImportFormatsResource,At as ImportsResource,Ot as LinkResolutionError,Gt as NotFoundError,It as PublishersResource,i as QueryBuilder,U as RateLimitError,Dt as RecordsResource,v as RestrictedError,wt as RulesResource,Mt as ScanTemplatesResource,Kt as ScansResource,N as ServerError,O as TimeoutError,F as ValidationError,pt as cacheKey,Zt as contains,Nt as eq,yt as getRateLimitInfo,gr as getSDKVersion,ht as getUserAgent,Ht as gt,Yt as gte,tr as ilike,sr as isNotNull,rr as isNull,er as like,zt as lt,Wt as lte,jt as neq,Qt as notWithin,mt as readCache,P as resolveFilter,Xt as within,gt as writeCache};//# sourceMappingURL=index.js.map
|
|
1946
1844
|
//# sourceMappingURL=index.js.map
|