@carddb/browser 0.4.6 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +197 -174
- 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 f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardDBError",this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this,oe);}},
|
|
1
|
+
var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardDBError",this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this,oe);}},H=class extends f{constructor(e="Invalid or missing API key",t){super(e,t),this.name="AuthenticationError";}},L=class extends f{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;}},Qt=class extends f{constructor(e="Resource not found",t){super(e,t),this.name="NotFoundError";}},R=class extends f{errors;constructor(e="Validation error",t={}){super(e,t.response),this.name="ValidationError",this.errors=t.errors??[];}},w=class extends f{constructor(e,t){super(e,t),this.name="RestrictedError";}},ue=class extends f{errors;constructor(e="GraphQL error",t={}){super(e,t.response),this.name="GraphQLError",this.errors=t.errors??[];}},T=class extends f{constructor(e="Connection error",t){super(e,t),this.name="ConnectionError";}},Y=class extends T{constructor(e="Request timed out",t){super(e,t),this.name="TimeoutError";}},z=class extends f{status;constructor(e="Server error",t={}){super(e,t.response),this.name="ServerError",this.status=t.status??null;}},Zt=class extends f{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 er(e){return {eq:e}}function tr(e){return {neq:e}}function rr(e){return {gt:e}}function sr(e){return {gte:e}}function ir(e){return {lt:e}}function ar(e){return {lte:e}}function nr(e){return {in:e}}function cr(e){return {nin:e}}function or(e){return {contains:e}}function ur(e){return {like:e}}function lr(e){return {ilike:e}}function dr(){return {is_null:true}}function hr(){return {is_null:false}}var qe=class le{conditions=[];orGroups=[];where(t,r){if(typeof t=="string")this.conditions.push({[t]:r});else for(let[s,i]of Object.entries(t))this.conditions.push({[s]:i});return this}any(t){let r=new le;t(r);let s=r.getConditions();return s.length>0&&this.orGroups.push({$or:s}),this}whereLink(t,r){let s={};for(let[i,n]of Object.entries(r))s[i]=n;return this.conditions.push({[`${t}._link`]:s}),this}whereAny(t,r){let s={};for(let[i,n]of Object.entries(r))s[i]=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 _(e){if(e!==void 0){if(typeof e=="function"){let t=new qe;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 Ce=new Set(["metadata","annotations"]);function b(e){return de(e,"input")}function de(e,t){if(!N(e))return e;let r={};for(let[s,i]of Object.entries(e)){let n=`${t}.${s}`;Ce.has(s)?r[s]=xe(i,n):s==="entries"&&Array.isArray(i)?r[s]=i.map((c,o)=>de(c,`${n}[${o}]`)):r[s]=i;}return r}function xe(e,t){if(e==null||N(e))return e;if(typeof e=="string")try{let r=JSON.parse(e);if(N(r))return r}catch{}throw new R(`${t} must be a JSON object`)}function N(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var x=`
|
|
2
2
|
id
|
|
3
3
|
createdAt
|
|
4
4
|
updatedAt
|
|
@@ -123,7 +123,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
123
123
|
nestedFields {
|
|
124
124
|
${he(e-1)}
|
|
125
125
|
}`:""}
|
|
126
|
-
`}var
|
|
126
|
+
`}var A=`
|
|
127
127
|
schema {
|
|
128
128
|
fields {
|
|
129
129
|
${he(Ue)}
|
|
@@ -142,6 +142,21 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
142
142
|
isArray
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
+
`,Ke=`
|
|
146
|
+
field
|
|
147
|
+
edges {
|
|
148
|
+
cursor
|
|
149
|
+
node {
|
|
150
|
+
value
|
|
151
|
+
count
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
pageInfo {
|
|
155
|
+
hasNextPage
|
|
156
|
+
hasPreviousPage
|
|
157
|
+
startCursor
|
|
158
|
+
endCursor
|
|
159
|
+
}
|
|
145
160
|
`,ye=`
|
|
146
161
|
id
|
|
147
162
|
objectTypeId
|
|
@@ -176,7 +191,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
176
191
|
parentFieldId
|
|
177
192
|
createdAt
|
|
178
193
|
updatedAt
|
|
179
|
-
`,
|
|
194
|
+
`,Te=`
|
|
180
195
|
pricing {
|
|
181
196
|
productId
|
|
182
197
|
prices {
|
|
@@ -188,11 +203,11 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
188
203
|
directLowPrice
|
|
189
204
|
}
|
|
190
205
|
}
|
|
191
|
-
`;function
|
|
206
|
+
`;function k(e={}){return `
|
|
192
207
|
id
|
|
193
208
|
datasetId
|
|
194
209
|
data
|
|
195
|
-
${e.includePricing?
|
|
210
|
+
${e.includePricing?Te:""}
|
|
196
211
|
createdAt
|
|
197
212
|
updatedAt
|
|
198
213
|
dataset {
|
|
@@ -202,7 +217,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
202
217
|
gameId
|
|
203
218
|
publisherId
|
|
204
219
|
}
|
|
205
|
-
`}var
|
|
220
|
+
`}var U=k(),E=`
|
|
206
221
|
key
|
|
207
222
|
label
|
|
208
223
|
description
|
|
@@ -225,7 +240,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
225
240
|
annotations
|
|
226
241
|
display
|
|
227
242
|
record {
|
|
228
|
-
${
|
|
243
|
+
${U}
|
|
229
244
|
}
|
|
230
245
|
`,fe=`
|
|
231
246
|
rulesetId
|
|
@@ -235,7 +250,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
235
250
|
cardDatasetVersionId
|
|
236
251
|
validatedAt
|
|
237
252
|
validationResultSummary
|
|
238
|
-
`,
|
|
253
|
+
`,K=`
|
|
239
254
|
code
|
|
240
255
|
severity
|
|
241
256
|
message
|
|
@@ -244,14 +259,14 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
244
259
|
datasetId
|
|
245
260
|
identifier
|
|
246
261
|
metadata
|
|
247
|
-
`,
|
|
262
|
+
`,W=`
|
|
248
263
|
deckId
|
|
249
264
|
valid
|
|
250
265
|
blockers {
|
|
251
|
-
${
|
|
266
|
+
${K}
|
|
252
267
|
}
|
|
253
268
|
warnings {
|
|
254
|
-
${
|
|
269
|
+
${K}
|
|
255
270
|
}
|
|
256
271
|
affectedEntries {
|
|
257
272
|
entryId
|
|
@@ -272,7 +287,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
272
287
|
status
|
|
273
288
|
rules
|
|
274
289
|
sectionDefinitions {
|
|
275
|
-
${
|
|
290
|
+
${E}
|
|
276
291
|
}
|
|
277
292
|
cardDatasetId
|
|
278
293
|
cardDatasetVersionId
|
|
@@ -289,7 +304,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
289
304
|
supersededAt
|
|
290
305
|
createdAt
|
|
291
306
|
updatedAt
|
|
292
|
-
`,
|
|
307
|
+
`,q=`
|
|
293
308
|
id
|
|
294
309
|
gameId
|
|
295
310
|
game {
|
|
@@ -310,16 +325,16 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
310
325
|
isArchived
|
|
311
326
|
createdAt
|
|
312
327
|
updatedAt
|
|
313
|
-
`,
|
|
328
|
+
`,Fe=`
|
|
314
329
|
rulesetId
|
|
315
330
|
rulesetVersionId
|
|
316
331
|
rulesetKey
|
|
317
332
|
rulesetVersionLabel
|
|
318
333
|
rules
|
|
319
334
|
sections {
|
|
320
|
-
${
|
|
335
|
+
${E}
|
|
321
336
|
}
|
|
322
|
-
`,
|
|
337
|
+
`,Ve=`
|
|
323
338
|
deckId
|
|
324
339
|
title
|
|
325
340
|
slug
|
|
@@ -330,9 +345,9 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
330
345
|
warningCount
|
|
331
346
|
affectedEntryCount
|
|
332
347
|
issues {
|
|
333
|
-
${
|
|
348
|
+
${K}
|
|
334
349
|
}
|
|
335
|
-
`,
|
|
350
|
+
`,Pe=`
|
|
336
351
|
rulesetId
|
|
337
352
|
rulesetVersionId
|
|
338
353
|
checkedAt
|
|
@@ -341,16 +356,16 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
341
356
|
blockerCount
|
|
342
357
|
warningCount
|
|
343
358
|
results {
|
|
344
|
-
${
|
|
359
|
+
${Ve}
|
|
345
360
|
}
|
|
346
|
-
`,
|
|
361
|
+
`,Le=`
|
|
347
362
|
sourceDatasetId
|
|
348
363
|
sourceDatasetVersionId
|
|
349
364
|
sourceDatasetRecordId
|
|
350
365
|
sourceRecordIdentifier
|
|
351
366
|
rules
|
|
352
367
|
sectionDefinitions {
|
|
353
|
-
${
|
|
368
|
+
${E}
|
|
354
369
|
}
|
|
355
370
|
rulesFingerprint
|
|
356
371
|
summary
|
|
@@ -363,7 +378,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
363
378
|
toDraftRevision
|
|
364
379
|
hasChanges
|
|
365
380
|
diff
|
|
366
|
-
`,
|
|
381
|
+
`,P=`
|
|
367
382
|
id
|
|
368
383
|
deckId
|
|
369
384
|
versionNumber
|
|
@@ -388,7 +403,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
388
403
|
${fe}
|
|
389
404
|
}
|
|
390
405
|
sectionDefinitions {
|
|
391
|
-
${
|
|
406
|
+
${E}
|
|
392
407
|
}
|
|
393
408
|
publishedByAccountId
|
|
394
409
|
publishedByApiApplicationId
|
|
@@ -418,7 +433,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
418
433
|
revokedAt
|
|
419
434
|
createdAt
|
|
420
435
|
updatedAt
|
|
421
|
-
`,
|
|
436
|
+
`,_e=`
|
|
422
437
|
id
|
|
423
438
|
apiApplicationId
|
|
424
439
|
issuerId
|
|
@@ -432,7 +447,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
432
447
|
lastUsedAt
|
|
433
448
|
createdAt
|
|
434
449
|
updatedAt
|
|
435
|
-
`,
|
|
450
|
+
`,X=`
|
|
436
451
|
lineNumber
|
|
437
452
|
raw
|
|
438
453
|
datasetKey
|
|
@@ -444,14 +459,14 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
444
459
|
sortOrder
|
|
445
460
|
display
|
|
446
461
|
record {
|
|
447
|
-
${
|
|
462
|
+
${U}
|
|
448
463
|
}
|
|
449
464
|
`,pe=`
|
|
450
465
|
lineNumber
|
|
451
466
|
raw
|
|
452
467
|
code
|
|
453
468
|
message
|
|
454
|
-
`,
|
|
469
|
+
`,Q=`
|
|
455
470
|
lineNumber
|
|
456
471
|
raw
|
|
457
472
|
datasetKey
|
|
@@ -460,7 +475,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
460
475
|
section
|
|
461
476
|
code
|
|
462
477
|
message
|
|
463
|
-
`,
|
|
478
|
+
`,Z=`
|
|
464
479
|
lineNumber
|
|
465
480
|
raw
|
|
466
481
|
datasetKey
|
|
@@ -472,7 +487,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
472
487
|
identifier
|
|
473
488
|
display
|
|
474
489
|
}
|
|
475
|
-
`,
|
|
490
|
+
`,v=`
|
|
476
491
|
id
|
|
477
492
|
gameId
|
|
478
493
|
key
|
|
@@ -492,33 +507,33 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
492
507
|
name
|
|
493
508
|
confidence
|
|
494
509
|
reason
|
|
495
|
-
`,
|
|
510
|
+
`,Be=`
|
|
496
511
|
detection {
|
|
497
512
|
${me}
|
|
498
513
|
}
|
|
499
514
|
entries {
|
|
500
|
-
${
|
|
515
|
+
${X}
|
|
501
516
|
}
|
|
502
517
|
parseErrors {
|
|
503
518
|
${pe}
|
|
504
519
|
}
|
|
505
520
|
unmatched {
|
|
506
|
-
${
|
|
521
|
+
${Q}
|
|
507
522
|
}
|
|
508
523
|
ambiguous {
|
|
509
|
-
${
|
|
524
|
+
${Z}
|
|
510
525
|
}
|
|
511
|
-
`,
|
|
526
|
+
`,Me=`
|
|
512
527
|
entries {
|
|
513
|
-
${
|
|
528
|
+
${X}
|
|
514
529
|
}
|
|
515
530
|
unmatched {
|
|
516
|
-
${
|
|
531
|
+
${Q}
|
|
517
532
|
}
|
|
518
533
|
ambiguous {
|
|
519
|
-
${
|
|
534
|
+
${Z}
|
|
520
535
|
}
|
|
521
|
-
`,
|
|
536
|
+
`,Je=`
|
|
522
537
|
deckId
|
|
523
538
|
format
|
|
524
539
|
text
|
|
@@ -553,10 +568,10 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
553
568
|
sourceUrl
|
|
554
569
|
metadata
|
|
555
570
|
sectionDefinitions {
|
|
556
|
-
${
|
|
571
|
+
${E}
|
|
557
572
|
}
|
|
558
573
|
latestPublishedVersion {
|
|
559
|
-
${
|
|
574
|
+
${P}
|
|
560
575
|
}
|
|
561
576
|
publishedAt
|
|
562
577
|
draftRevision
|
|
@@ -577,18 +592,18 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
577
592
|
${u}
|
|
578
593
|
}
|
|
579
594
|
retainedAppAccess
|
|
580
|
-
`,
|
|
595
|
+
`,Oe=`
|
|
581
596
|
deck {
|
|
582
597
|
${u}
|
|
583
598
|
}
|
|
584
599
|
copiedFromDeckId
|
|
585
600
|
retainedAppAccess
|
|
586
|
-
`,
|
|
601
|
+
`,Ge=`
|
|
587
602
|
id
|
|
588
603
|
name
|
|
589
604
|
description
|
|
590
605
|
revokedAt
|
|
591
|
-
`,
|
|
606
|
+
`,J=`
|
|
592
607
|
id
|
|
593
608
|
deckId
|
|
594
609
|
deck {
|
|
@@ -596,7 +611,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
596
611
|
}
|
|
597
612
|
apiApplicationId
|
|
598
613
|
apiApplication {
|
|
599
|
-
${
|
|
614
|
+
${Ge}
|
|
600
615
|
}
|
|
601
616
|
role
|
|
602
617
|
grantSource
|
|
@@ -606,23 +621,23 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
606
621
|
revokedAt
|
|
607
622
|
createdAt
|
|
608
623
|
updatedAt
|
|
609
|
-
`,
|
|
624
|
+
`,Ne=`
|
|
610
625
|
deck {
|
|
611
626
|
${u}
|
|
612
627
|
}
|
|
613
628
|
version {
|
|
614
|
-
${
|
|
629
|
+
${P}
|
|
615
630
|
}
|
|
616
631
|
validation {
|
|
617
|
-
${
|
|
632
|
+
${W}
|
|
618
633
|
}
|
|
619
634
|
blockers {
|
|
620
|
-
${
|
|
635
|
+
${K}
|
|
621
636
|
}
|
|
622
637
|
warnings {
|
|
623
|
-
${
|
|
638
|
+
${K}
|
|
624
639
|
}
|
|
625
|
-
`,
|
|
640
|
+
`,O=`
|
|
626
641
|
deck {
|
|
627
642
|
${u}
|
|
628
643
|
}
|
|
@@ -636,7 +651,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
636
651
|
entries {
|
|
637
652
|
${B}
|
|
638
653
|
}
|
|
639
|
-
`,
|
|
654
|
+
`,je=ge,He=`
|
|
640
655
|
deck {
|
|
641
656
|
${u}
|
|
642
657
|
}
|
|
@@ -645,25 +660,25 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
645
660
|
replace
|
|
646
661
|
format
|
|
647
662
|
importFormat {
|
|
648
|
-
${
|
|
663
|
+
${v}
|
|
649
664
|
}
|
|
650
665
|
detection {
|
|
651
666
|
${me}
|
|
652
667
|
}
|
|
653
668
|
entries {
|
|
654
|
-
${
|
|
669
|
+
${X}
|
|
655
670
|
}
|
|
656
671
|
parseErrors {
|
|
657
672
|
${pe}
|
|
658
673
|
}
|
|
659
674
|
unmatched {
|
|
660
|
-
${
|
|
675
|
+
${Q}
|
|
661
676
|
}
|
|
662
677
|
ambiguous {
|
|
663
|
-
${
|
|
678
|
+
${Z}
|
|
664
679
|
}
|
|
665
680
|
validation {
|
|
666
|
-
${
|
|
681
|
+
${W}
|
|
667
682
|
}
|
|
668
683
|
`,ne=`
|
|
669
684
|
resolvedLinks {
|
|
@@ -684,7 +699,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
684
699
|
message
|
|
685
700
|
details
|
|
686
701
|
}
|
|
687
|
-
`,
|
|
702
|
+
`,Ye=`
|
|
688
703
|
total
|
|
689
704
|
inserted
|
|
690
705
|
updated
|
|
@@ -692,10 +707,10 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
692
707
|
failed
|
|
693
708
|
`,$e=`
|
|
694
709
|
inserted {
|
|
695
|
-
${
|
|
710
|
+
${U}
|
|
696
711
|
}
|
|
697
712
|
updated {
|
|
698
|
-
${
|
|
713
|
+
${U}
|
|
699
714
|
}
|
|
700
715
|
skipped
|
|
701
716
|
errors {
|
|
@@ -705,7 +720,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
705
720
|
${ye}
|
|
706
721
|
}
|
|
707
722
|
stats {
|
|
708
|
-
${
|
|
723
|
+
${Ye}
|
|
709
724
|
}
|
|
710
725
|
`,be=`
|
|
711
726
|
fileId
|
|
@@ -713,7 +728,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
713
728
|
file {
|
|
714
729
|
${x}
|
|
715
730
|
}
|
|
716
|
-
`,
|
|
731
|
+
`,D=`
|
|
717
732
|
id
|
|
718
733
|
publisherId
|
|
719
734
|
publisher {
|
|
@@ -722,7 +737,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
722
737
|
datasetId
|
|
723
738
|
dataset {
|
|
724
739
|
${m}
|
|
725
|
-
${
|
|
740
|
+
${A}
|
|
726
741
|
}
|
|
727
742
|
accountId
|
|
728
743
|
status
|
|
@@ -756,7 +771,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
756
771
|
imagesPending
|
|
757
772
|
imagesCompleted
|
|
758
773
|
imagesFailed
|
|
759
|
-
`,
|
|
774
|
+
`,ze=`
|
|
760
775
|
id
|
|
761
776
|
importJobId
|
|
762
777
|
level
|
|
@@ -766,20 +781,20 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
766
781
|
fieldKey
|
|
767
782
|
details
|
|
768
783
|
createdAt
|
|
769
|
-
`,
|
|
784
|
+
`,We=`
|
|
770
785
|
job {
|
|
771
|
-
${
|
|
786
|
+
${D}
|
|
772
787
|
}
|
|
773
788
|
dryRunResult {
|
|
774
789
|
${$e}
|
|
775
790
|
}
|
|
776
|
-
`,
|
|
791
|
+
`,Xe=`
|
|
777
792
|
target
|
|
778
793
|
recordId
|
|
779
794
|
identifier
|
|
780
795
|
status
|
|
781
796
|
message
|
|
782
|
-
`,
|
|
797
|
+
`,G=`
|
|
783
798
|
id
|
|
784
799
|
publisherId
|
|
785
800
|
publisher {
|
|
@@ -803,7 +818,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
803
818
|
blockedCount
|
|
804
819
|
failedCount
|
|
805
820
|
results {
|
|
806
|
-
${
|
|
821
|
+
${Xe}
|
|
807
822
|
}
|
|
808
823
|
errorMessage
|
|
809
824
|
startedAt
|
|
@@ -836,12 +851,12 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
836
851
|
targetFieldType
|
|
837
852
|
sampleValues
|
|
838
853
|
status
|
|
839
|
-
`,
|
|
854
|
+
`,j=`
|
|
840
855
|
datasetKey
|
|
841
856
|
field
|
|
842
857
|
message
|
|
843
858
|
severity
|
|
844
|
-
`,
|
|
859
|
+
`,Qe=`
|
|
845
860
|
datasetKey
|
|
846
861
|
datasetName
|
|
847
862
|
datasetId
|
|
@@ -851,15 +866,15 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
851
866
|
${ke}
|
|
852
867
|
}
|
|
853
868
|
warnings {
|
|
854
|
-
${
|
|
869
|
+
${j}
|
|
855
870
|
}
|
|
856
871
|
canProceed
|
|
857
872
|
sampleRecords
|
|
858
873
|
availableDatasets {
|
|
859
874
|
${m}
|
|
860
|
-
${
|
|
875
|
+
${A}
|
|
861
876
|
}
|
|
862
|
-
`,
|
|
877
|
+
`,Ze=`
|
|
863
878
|
datasets {
|
|
864
879
|
datasetKey
|
|
865
880
|
datasetName
|
|
@@ -870,16 +885,16 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
870
885
|
${ke}
|
|
871
886
|
}
|
|
872
887
|
warnings {
|
|
873
|
-
${
|
|
888
|
+
${j}
|
|
874
889
|
}
|
|
875
890
|
sampleRecords
|
|
876
891
|
}
|
|
877
892
|
importOrder
|
|
878
893
|
warnings {
|
|
879
|
-
${
|
|
894
|
+
${j}
|
|
880
895
|
}
|
|
881
896
|
canProceed
|
|
882
|
-
`,
|
|
897
|
+
`,et=`
|
|
883
898
|
datasetKey
|
|
884
899
|
datasetId
|
|
885
900
|
datasetName
|
|
@@ -890,7 +905,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
890
905
|
skippedCount
|
|
891
906
|
failedCount
|
|
892
907
|
errorMessage
|
|
893
|
-
`,
|
|
908
|
+
`,S=`
|
|
894
909
|
id
|
|
895
910
|
publisherId
|
|
896
911
|
publisher {
|
|
@@ -913,7 +928,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
913
928
|
progress
|
|
914
929
|
importOrder
|
|
915
930
|
datasetStatuses {
|
|
916
|
-
${
|
|
931
|
+
${et}
|
|
917
932
|
}
|
|
918
933
|
errorMessage
|
|
919
934
|
startedAt
|
|
@@ -933,7 +948,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
933
948
|
linkBuildingCompletedDatasets
|
|
934
949
|
linkBuildingProcessedRecords
|
|
935
950
|
linkBuildingTotalRecords
|
|
936
|
-
`,
|
|
951
|
+
`,C=`
|
|
937
952
|
id
|
|
938
953
|
publisherId
|
|
939
954
|
publisher {
|
|
@@ -959,13 +974,13 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
959
974
|
createdAt
|
|
960
975
|
updatedAt
|
|
961
976
|
lastCheckpointIndex
|
|
962
|
-
`,
|
|
977
|
+
`,tt=`
|
|
963
978
|
recordId
|
|
964
979
|
rank
|
|
965
980
|
score
|
|
966
981
|
confidence
|
|
967
982
|
reasons
|
|
968
|
-
`,
|
|
983
|
+
`,rt=`
|
|
969
984
|
configured
|
|
970
985
|
url
|
|
971
986
|
latestDeliveryId
|
|
@@ -976,7 +991,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
976
991
|
deliveredAt
|
|
977
992
|
lastStatusCode
|
|
978
993
|
lastError
|
|
979
|
-
`,
|
|
994
|
+
`,st=`
|
|
980
995
|
featureVersion
|
|
981
996
|
candidateCount
|
|
982
997
|
confidenceScore
|
|
@@ -1005,14 +1020,14 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1005
1020
|
confidence
|
|
1006
1021
|
}
|
|
1007
1022
|
candidates {
|
|
1008
|
-
${
|
|
1023
|
+
${tt}
|
|
1009
1024
|
}
|
|
1010
1025
|
extracted
|
|
1011
1026
|
metrics {
|
|
1012
|
-
${
|
|
1027
|
+
${st}
|
|
1013
1028
|
}
|
|
1014
1029
|
webhook {
|
|
1015
|
-
${
|
|
1030
|
+
${rt}
|
|
1016
1031
|
}
|
|
1017
1032
|
error {
|
|
1018
1033
|
code
|
|
@@ -1022,7 +1037,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1022
1037
|
updatedAt
|
|
1023
1038
|
startedAt
|
|
1024
1039
|
completedAt
|
|
1025
|
-
`,
|
|
1040
|
+
`,it=`
|
|
1026
1041
|
publisherSlug
|
|
1027
1042
|
gameKey
|
|
1028
1043
|
datasetKey
|
|
@@ -1067,11 +1082,11 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1067
1082
|
correctedFeedback
|
|
1068
1083
|
feedbackAccuracy
|
|
1069
1084
|
}
|
|
1070
|
-
`,
|
|
1085
|
+
`,F=`
|
|
1071
1086
|
code
|
|
1072
1087
|
region
|
|
1073
1088
|
message
|
|
1074
|
-
`,
|
|
1089
|
+
`,at=`
|
|
1075
1090
|
id
|
|
1076
1091
|
key
|
|
1077
1092
|
label
|
|
@@ -1084,7 +1099,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1084
1099
|
isRequired
|
|
1085
1100
|
weight
|
|
1086
1101
|
config
|
|
1087
|
-
`,
|
|
1102
|
+
`,V=`
|
|
1088
1103
|
id
|
|
1089
1104
|
key
|
|
1090
1105
|
name
|
|
@@ -1100,11 +1115,11 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1100
1115
|
notes
|
|
1101
1116
|
config
|
|
1102
1117
|
regions {
|
|
1103
|
-
${
|
|
1118
|
+
${at}
|
|
1104
1119
|
}
|
|
1105
1120
|
createdAt
|
|
1106
1121
|
updatedAt
|
|
1107
|
-
`,
|
|
1122
|
+
`,nt=`
|
|
1108
1123
|
key
|
|
1109
1124
|
label
|
|
1110
1125
|
semanticType
|
|
@@ -1115,7 +1130,7 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1115
1130
|
source
|
|
1116
1131
|
status
|
|
1117
1132
|
confidence
|
|
1118
|
-
`,
|
|
1133
|
+
`,ct=`
|
|
1119
1134
|
id
|
|
1120
1135
|
key
|
|
1121
1136
|
name
|
|
@@ -1221,14 +1236,14 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1221
1236
|
query FetchDataset($id: UUID!) {
|
|
1222
1237
|
fetchDataset(id: $id) {
|
|
1223
1238
|
${m}
|
|
1224
|
-
${
|
|
1239
|
+
${A}
|
|
1225
1240
|
}
|
|
1226
1241
|
}
|
|
1227
1242
|
`}},fetchDatasetByKeys(){return {query:`
|
|
1228
1243
|
query FetchDataset($publisherSlug: String!, $gameKey: String!, $datasetKey: String!) {
|
|
1229
1244
|
fetchDataset(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey) {
|
|
1230
1245
|
${m}
|
|
1231
|
-
${
|
|
1246
|
+
${A}
|
|
1232
1247
|
}
|
|
1233
1248
|
}
|
|
1234
1249
|
`}},fetchDatasets(){return {query:`
|
|
@@ -1237,21 +1252,29 @@ var f=class oe extends Error{response;constructor(t,r){super(t),this.name="CardD
|
|
|
1237
1252
|
${m}
|
|
1238
1253
|
}
|
|
1239
1254
|
}
|
|
1240
|
-
`}},
|
|
1255
|
+
`}},fetchDatasetFilterValues(e){if(e.fields.length===0)throw new R("fields must contain at least one field key");let t=e.id!==void 0,r=e.publisherSlug!==void 0&&e.gameKey!==void 0&&e.datasetKey!==void 0;if(!t&&!r)throw new R("provide either id or publisherSlug, gameKey, and datasetKey");let s=["$fields: [String!]!"],i=["fields: $fields"],n={fields:e.fields};e.search!==void 0&&(s.push("$search: String"),i.push("search: $search"),n.search=e.search),e.includeCounts!==void 0&&(s.push("$includeCounts: Boolean"),i.push("includeCounts: $includeCounts"),n.includeCounts=e.includeCounts),e.first!==void 0&&(s.push("$first: Int"),i.push("first: $first"),n.first=e.first),e.after!==void 0&&(s.push("$after: String"),i.push("after: $after"),n.after=e.after);let c=[];return t?(s.push("$id: UUID!"),c.push("id: $id"),n.id=e.id):(s.push("$publisherSlug: String!","$gameKey: String!","$datasetKey: String!"),c.push("publisherSlug: $publisherSlug","gameKey: $gameKey","datasetKey: $datasetKey"),n.publisherSlug=e.publisherSlug,n.gameKey=e.gameKey,n.datasetKey=e.datasetKey),{query:`
|
|
1256
|
+
query FetchDatasetFilterValues(${s.join(", ")}) {
|
|
1257
|
+
fetchDataset(${c.join(", ")}) {
|
|
1258
|
+
filterValues(${i.join(", ")}) {
|
|
1259
|
+
${Ke}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
`,variables:n}},listDatasets(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.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),e.purpose!==void 0&&(s.push("$purpose: DatasetPurpose"),r.push("purpose: $purpose"),t.purpose=e.purpose),{query:`
|
|
1241
1264
|
query Datasets(${s.join(", ")}) {
|
|
1242
1265
|
datasets(${r.join(", ")}) {
|
|
1243
1266
|
${d(`${m}
|
|
1244
|
-
${
|
|
1267
|
+
${A}`)}
|
|
1245
1268
|
}
|
|
1246
1269
|
}
|
|
1247
1270
|
`,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:`
|
|
1248
1271
|
query Dataset(${s.join(", ")}) {
|
|
1249
1272
|
dataset(${r.join(", ")}) {
|
|
1250
1273
|
${m}
|
|
1251
|
-
${
|
|
1274
|
+
${A}
|
|
1252
1275
|
}
|
|
1253
1276
|
}
|
|
1254
|
-
`,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 i=e.resolveLinks&&e.resolveLinks.length>0,n=
|
|
1277
|
+
`,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 i=e.resolveLinks&&e.resolveLinks.length>0,n=k({includePricing:e.includePricing}),c=i?`${n}
|
|
1255
1278
|
${ne}`:n;return {query:`
|
|
1256
1279
|
query SearchRecords(${s.join(", ")}) {
|
|
1257
1280
|
searchRecords(${r.join(", ")}) {
|
|
@@ -1261,34 +1284,34 @@ ${ne}`:n;return {query:`
|
|
|
1261
1284
|
`,variables:t}},fetchRecordById(e={}){return {query:`
|
|
1262
1285
|
query FetchRecord($id: UUID!) {
|
|
1263
1286
|
fetchRecord(id: $id) {
|
|
1264
|
-
${
|
|
1287
|
+
${k(e)}
|
|
1265
1288
|
}
|
|
1266
1289
|
}
|
|
1267
1290
|
`}},fetchRecordByIdentifier(e={}){return {query:`
|
|
1268
1291
|
query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) {
|
|
1269
1292
|
fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) {
|
|
1270
|
-
${
|
|
1293
|
+
${k(e)}
|
|
1271
1294
|
}
|
|
1272
1295
|
}
|
|
1273
1296
|
`}},fetchRecordsByIdentifier(e={}){return {query:`
|
|
1274
1297
|
query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) {
|
|
1275
1298
|
fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) {
|
|
1276
|
-
${
|
|
1299
|
+
${k(e)}
|
|
1277
1300
|
}
|
|
1278
1301
|
}
|
|
1279
1302
|
`}},fetchRecords(e={}){return {query:`
|
|
1280
1303
|
query FetchRecords($ids: [UUID!]!) {
|
|
1281
1304
|
fetchRecords(ids: $ids) {
|
|
1282
|
-
${
|
|
1305
|
+
${k(e)}
|
|
1283
1306
|
}
|
|
1284
1307
|
}
|
|
1285
1308
|
`}},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:`
|
|
1286
1309
|
query DatasetRecords(${s.join(", ")}) {
|
|
1287
1310
|
datasetRecords(${r.join(", ")}) {
|
|
1288
|
-
${d(
|
|
1311
|
+
${d(U)}
|
|
1289
1312
|
}
|
|
1290
1313
|
}
|
|
1291
|
-
`,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 i=e.resolveLinks&&e.resolveLinks.length>0,n=
|
|
1314
|
+
`,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 i=e.resolveLinks&&e.resolveLinks.length>0,n=k({includePricing:e.includePricing}),c=i?`${n}
|
|
1292
1315
|
${ne}`:n;return {query:`
|
|
1293
1316
|
query DatasetRecord(${s.join(", ")}) {
|
|
1294
1317
|
datasetRecord(${r.join(", ")}) {
|
|
@@ -1298,31 +1321,31 @@ ${ne}`:n;return {query:`
|
|
|
1298
1321
|
`,variables:t}},upsertDatasetRecords(){return {query:`
|
|
1299
1322
|
mutation DatasetRecordsUpsert($input: DatasetRecordsUpsertInput!) {
|
|
1300
1323
|
datasetRecordsUpsert(input: $input) {
|
|
1301
|
-
${
|
|
1324
|
+
${We}
|
|
1302
1325
|
}
|
|
1303
1326
|
}
|
|
1304
1327
|
`}},deleteDatasetRecords(){return {query:`
|
|
1305
1328
|
mutation DatasetRecordsDelete($input: DatasetRecordsDeleteInput!) {
|
|
1306
1329
|
datasetRecordsDelete(input: $input) {
|
|
1307
|
-
${
|
|
1330
|
+
${G}
|
|
1308
1331
|
}
|
|
1309
1332
|
}
|
|
1310
1333
|
`}},datasetRecordDeleteJob(){return {query:`
|
|
1311
1334
|
query DatasetRecordDeleteJob($id: UUID!) {
|
|
1312
1335
|
datasetRecordDeleteJob(id: $id) {
|
|
1313
|
-
${
|
|
1336
|
+
${G}
|
|
1314
1337
|
}
|
|
1315
1338
|
}
|
|
1316
1339
|
`}},datasetRecordDeleteJobs(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: DatasetRecordDeleteJobStatus"),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:`
|
|
1317
1340
|
query DatasetRecordDeleteJobs(${s.join(", ")}) {
|
|
1318
1341
|
datasetRecordDeleteJobs(${r.join(", ")}) {
|
|
1319
|
-
${d(
|
|
1342
|
+
${d(G)}
|
|
1320
1343
|
}
|
|
1321
1344
|
}
|
|
1322
1345
|
`,variables:t}},datasetImportPreview(){return {query:`
|
|
1323
1346
|
query DatasetImportPreview($input: DatasetImportPreviewInput!) {
|
|
1324
1347
|
datasetImportPreview(input: $input) {
|
|
1325
|
-
${
|
|
1348
|
+
${Qe}
|
|
1326
1349
|
}
|
|
1327
1350
|
}
|
|
1328
1351
|
`}},datasetImportValidate(){return {query:`
|
|
@@ -1334,87 +1357,87 @@ ${ne}`:n;return {query:`
|
|
|
1334
1357
|
`}},datasetImportFromFile(){return {query:`
|
|
1335
1358
|
mutation DatasetImportFromFile($input: DatasetImportFromFileInput!) {
|
|
1336
1359
|
datasetImportFromFile(input: $input) {
|
|
1337
|
-
${
|
|
1360
|
+
${D}
|
|
1338
1361
|
}
|
|
1339
1362
|
}
|
|
1340
1363
|
`}},datasetImportFromPayload(){return {query:`
|
|
1341
1364
|
mutation DatasetImportFromPayload($input: DatasetImportFromPayloadInput!) {
|
|
1342
1365
|
datasetImportFromPayload(input: $input) {
|
|
1343
|
-
${
|
|
1366
|
+
${D}
|
|
1344
1367
|
}
|
|
1345
1368
|
}
|
|
1346
1369
|
`}},datasetImportFromUrl(){return {query:`
|
|
1347
1370
|
mutation DatasetImportFromUrl($input: DatasetImportFromUrlInput!) {
|
|
1348
1371
|
datasetImportFromUrl(input: $input) {
|
|
1349
|
-
${
|
|
1372
|
+
${D}
|
|
1350
1373
|
}
|
|
1351
1374
|
}
|
|
1352
1375
|
`}},importJob(){return {query:`
|
|
1353
1376
|
query ImportJob($id: UUID!) {
|
|
1354
1377
|
importJob(id: $id) {
|
|
1355
|
-
${
|
|
1378
|
+
${D}
|
|
1356
1379
|
}
|
|
1357
1380
|
}
|
|
1358
1381
|
`}},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:`
|
|
1359
1382
|
query ImportJobs(${s.join(", ")}) {
|
|
1360
1383
|
importJobs(${r.join(", ")}) {
|
|
1361
|
-
${d(
|
|
1384
|
+
${d(D)}
|
|
1362
1385
|
}
|
|
1363
1386
|
}
|
|
1364
1387
|
`,variables:t}},importJobCancel(){return {query:`
|
|
1365
1388
|
mutation ImportJobCancel($id: UUID!) {
|
|
1366
1389
|
importJobCancel(id: $id) {
|
|
1367
|
-
${
|
|
1390
|
+
${D}
|
|
1368
1391
|
}
|
|
1369
1392
|
}
|
|
1370
1393
|
`}},importJobLogs(e){let t={importJobId:e.importJobId},r=["id: $importJobId"],s=[],i=["$importJobId: UUID!"];e.level!==void 0&&(i.push("$level: ImportLogLevel"),s.push("level: $level"),t.level=e.level),e.datasetKey!==void 0&&(i.push("$datasetKey: String"),s.push("datasetKey: $datasetKey"),t.datasetKey=e.datasetKey),e.first!==void 0&&(i.push("$first: Int"),s.push("first: $first"),t.first=e.first),e.after!==void 0&&(i.push("$after: String"),s.push("after: $after"),t.after=e.after);let n=s.length>0?`(${s.join(", ")})`:"";return {query:`
|
|
1371
1394
|
query ImportJobLogs(${i.join(", ")}) {
|
|
1372
1395
|
importJob(${r.join(", ")}) {
|
|
1373
1396
|
logs${n} {
|
|
1374
|
-
${d(
|
|
1397
|
+
${d(ze)}
|
|
1375
1398
|
}
|
|
1376
1399
|
}
|
|
1377
1400
|
}
|
|
1378
1401
|
`,variables:t}},gameImportPreview(){return {query:`
|
|
1379
1402
|
query GameImportPreview($input: GameImportPreviewInput!) {
|
|
1380
1403
|
gameImportPreview(input: $input) {
|
|
1381
|
-
${
|
|
1404
|
+
${Ze}
|
|
1382
1405
|
}
|
|
1383
1406
|
}
|
|
1384
1407
|
`}},gameImportFromFile(){return {query:`
|
|
1385
1408
|
mutation GameImportFromFile($input: GameImportFromFileInput!) {
|
|
1386
1409
|
gameImportFromFile(input: $input) {
|
|
1387
|
-
${
|
|
1410
|
+
${S}
|
|
1388
1411
|
}
|
|
1389
1412
|
}
|
|
1390
1413
|
`}},gameImportFromPayload(){return {query:`
|
|
1391
1414
|
mutation GameImportFromPayload($input: GameImportFromPayloadInput!) {
|
|
1392
1415
|
gameImportFromPayload(input: $input) {
|
|
1393
|
-
${
|
|
1416
|
+
${S}
|
|
1394
1417
|
}
|
|
1395
1418
|
}
|
|
1396
1419
|
`}},gameImportFromUrl(){return {query:`
|
|
1397
1420
|
mutation GameImportFromUrl($input: GameImportFromUrlInput!) {
|
|
1398
1421
|
gameImportFromUrl(input: $input) {
|
|
1399
|
-
${
|
|
1422
|
+
${S}
|
|
1400
1423
|
}
|
|
1401
1424
|
}
|
|
1402
1425
|
`}},gameImportJob(){return {query:`
|
|
1403
1426
|
query GameImportJob($id: UUID!) {
|
|
1404
1427
|
gameImportJob(id: $id) {
|
|
1405
|
-
${
|
|
1428
|
+
${S}
|
|
1406
1429
|
}
|
|
1407
1430
|
}
|
|
1408
1431
|
`}},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:`
|
|
1409
1432
|
query GameImportJobs(${s.join(", ")}) {
|
|
1410
1433
|
gameImportJobs(${r.join(", ")}) {
|
|
1411
|
-
${d(
|
|
1434
|
+
${d(S)}
|
|
1412
1435
|
}
|
|
1413
1436
|
}
|
|
1414
1437
|
`,variables:t}},gameImportJobCancel(){return {query:`
|
|
1415
1438
|
mutation GameImportJobCancel($id: UUID!) {
|
|
1416
1439
|
gameImportJobCancel(id: $id) {
|
|
1417
|
-
${
|
|
1440
|
+
${S}
|
|
1418
1441
|
}
|
|
1419
1442
|
}
|
|
1420
1443
|
`}},file(){return {query:`
|
|
@@ -1483,17 +1506,17 @@ ${ne}`:n;return {query:`
|
|
|
1483
1506
|
`}},scanMetrics(){return {query:`
|
|
1484
1507
|
query ScanMetrics($input: ScanMetricsInput!) {
|
|
1485
1508
|
scanMetrics(input: $input) {
|
|
1486
|
-
${
|
|
1509
|
+
${it}
|
|
1487
1510
|
}
|
|
1488
1511
|
}
|
|
1489
1512
|
`}},resolveScanTemplate(){return {query:`
|
|
1490
1513
|
query ResolveScanTemplate($input: ResolveScanTemplateInput!) {
|
|
1491
1514
|
resolveScanTemplate(input: $input) {
|
|
1492
1515
|
template {
|
|
1493
|
-
${
|
|
1516
|
+
${V}
|
|
1494
1517
|
}
|
|
1495
1518
|
warnings {
|
|
1496
|
-
${
|
|
1519
|
+
${F}
|
|
1497
1520
|
}
|
|
1498
1521
|
}
|
|
1499
1522
|
}
|
|
@@ -1501,7 +1524,7 @@ ${ne}`:n;return {query:`
|
|
|
1501
1524
|
query ScanTemplates($input: ScanTemplatesInput!) {
|
|
1502
1525
|
scanTemplates(input: $input) {
|
|
1503
1526
|
templates {
|
|
1504
|
-
${
|
|
1527
|
+
${V}
|
|
1505
1528
|
}
|
|
1506
1529
|
}
|
|
1507
1530
|
}
|
|
@@ -1509,10 +1532,10 @@ ${ne}`:n;return {query:`
|
|
|
1509
1532
|
mutation CreateScanTemplate($input: SaveScanTemplateInput!) {
|
|
1510
1533
|
createScanTemplate(input: $input) {
|
|
1511
1534
|
template {
|
|
1512
|
-
${
|
|
1535
|
+
${V}
|
|
1513
1536
|
}
|
|
1514
1537
|
warnings {
|
|
1515
|
-
${
|
|
1538
|
+
${F}
|
|
1516
1539
|
}
|
|
1517
1540
|
}
|
|
1518
1541
|
}
|
|
@@ -1520,10 +1543,10 @@ ${ne}`:n;return {query:`
|
|
|
1520
1543
|
mutation UpdateScanTemplate($id: UUID!, $input: SaveScanTemplateInput!) {
|
|
1521
1544
|
updateScanTemplate(id: $id, input: $input) {
|
|
1522
1545
|
template {
|
|
1523
|
-
${
|
|
1546
|
+
${V}
|
|
1524
1547
|
}
|
|
1525
1548
|
warnings {
|
|
1526
|
-
${
|
|
1549
|
+
${F}
|
|
1527
1550
|
}
|
|
1528
1551
|
}
|
|
1529
1552
|
}
|
|
@@ -1531,10 +1554,10 @@ ${ne}`:n;return {query:`
|
|
|
1531
1554
|
mutation PreviewScanTemplate($input: PreviewScanTemplateInput!) {
|
|
1532
1555
|
previewScanTemplate(input: $input) {
|
|
1533
1556
|
warnings {
|
|
1534
|
-
${
|
|
1557
|
+
${F}
|
|
1535
1558
|
}
|
|
1536
1559
|
regions {
|
|
1537
|
-
${
|
|
1560
|
+
${nt}
|
|
1538
1561
|
}
|
|
1539
1562
|
message
|
|
1540
1563
|
}
|
|
@@ -1542,55 +1565,55 @@ ${ne}`:n;return {query:`
|
|
|
1542
1565
|
`}},gameScanRegions(){return {query:`
|
|
1543
1566
|
query GameScanRegions($publisherSlug: String!, $gameKey: String!, $includeInactive: Boolean) {
|
|
1544
1567
|
gameScanRegions(publisherSlug: $publisherSlug, gameKey: $gameKey, includeInactive: $includeInactive) {
|
|
1545
|
-
${
|
|
1568
|
+
${ct}
|
|
1546
1569
|
}
|
|
1547
1570
|
}
|
|
1548
1571
|
`}},exportJob(){return {query:`
|
|
1549
1572
|
query ExportJob($id: UUID!) {
|
|
1550
1573
|
exportJob(id: $id) {
|
|
1551
|
-
${
|
|
1574
|
+
${C}
|
|
1552
1575
|
}
|
|
1553
1576
|
}
|
|
1554
1577
|
`}},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:`
|
|
1555
1578
|
query ExportJobs(${s.join(", ")}) {
|
|
1556
1579
|
exportJobs(${r.join(", ")}) {
|
|
1557
|
-
${d(
|
|
1580
|
+
${d(C)}
|
|
1558
1581
|
}
|
|
1559
1582
|
}
|
|
1560
1583
|
`,variables:t}},datasetExport(){return {query:`
|
|
1561
1584
|
mutation DatasetExport($input: DatasetExportInput!) {
|
|
1562
1585
|
datasetExport(input: $input) {
|
|
1563
|
-
${
|
|
1586
|
+
${C}
|
|
1564
1587
|
}
|
|
1565
1588
|
}
|
|
1566
1589
|
`}},exportJobCancel(){return {query:`
|
|
1567
1590
|
mutation ExportJobCancel($id: UUID!) {
|
|
1568
1591
|
exportJobCancel(id: $id) {
|
|
1569
|
-
${
|
|
1592
|
+
${C}
|
|
1570
1593
|
}
|
|
1571
1594
|
}
|
|
1572
1595
|
`}},exportJobRefreshUrl(){return {query:`
|
|
1573
1596
|
mutation ExportJobRefreshUrl($id: UUID!) {
|
|
1574
1597
|
exportJobRefreshUrl(id: $id) {
|
|
1575
|
-
${
|
|
1598
|
+
${C}
|
|
1576
1599
|
}
|
|
1577
1600
|
}
|
|
1578
1601
|
`}},rulesets(e){let t={gameId:e.gameId},r=["gameId: $gameId"],s=["$gameId: UUID!"];return 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),{query:`
|
|
1579
1602
|
query Rulesets(${s.join(", ")}) {
|
|
1580
1603
|
rulesets(${r.join(", ")}) {
|
|
1581
|
-
${d(
|
|
1604
|
+
${d(q)}
|
|
1582
1605
|
}
|
|
1583
1606
|
}
|
|
1584
1607
|
`,variables:t}},publicRulesets(e){let t={gameId:e.gameId},r=["gameId: $gameId"],s=["$gameId: 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:`
|
|
1585
1608
|
query PublicRulesets(${s.join(", ")}) {
|
|
1586
1609
|
publicRulesets(${r.join(", ")}) {
|
|
1587
|
-
${d(
|
|
1610
|
+
${d(q)}
|
|
1588
1611
|
}
|
|
1589
1612
|
}
|
|
1590
1613
|
`,variables:t}},ruleset(e){let t={},r=[],s=[];return e.id!==void 0&&(s.push("$id: UUID"),r.push("id: $id"),t.id=e.id),e.gameId!==void 0&&(s.push("$gameId: UUID"),r.push("gameId: $gameId"),t.gameId=e.gameId),e.key!==void 0&&(s.push("$key: String"),r.push("key: $key"),t.key=e.key),{query:`
|
|
1591
1614
|
query Ruleset(${s.join(", ")}) {
|
|
1592
1615
|
ruleset(${r.join(", ")}) {
|
|
1593
|
-
${
|
|
1616
|
+
${q}
|
|
1594
1617
|
}
|
|
1595
1618
|
}
|
|
1596
1619
|
`,variables:t}},rulesetVersions(e){let t={rulesetId:e.rulesetId},r=["rulesetId: $rulesetId"],s=["$rulesetId: UUID!"];return e.status!==void 0&&(s.push("$status: RulesetVersionStatus"),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:`
|
|
@@ -1612,31 +1635,31 @@ ${ne}`:n;return {query:`
|
|
|
1612
1635
|
`}},deckValidationRules(){return {query:`
|
|
1613
1636
|
query DeckValidationRules($gameId: UUID!, $rulesetKey: String!, $rulesetVersionId: UUID) {
|
|
1614
1637
|
deckValidationRules(gameId: $gameId, rulesetKey: $rulesetKey, rulesetVersionId: $rulesetVersionId) {
|
|
1615
|
-
${
|
|
1638
|
+
${Fe}
|
|
1616
1639
|
}
|
|
1617
1640
|
}
|
|
1618
1641
|
`}},rulesetVersionDraftImportPreview(){return {query:`
|
|
1619
1642
|
query RulesetVersionDraftImportPreview($rulesetId: UUID!, $input: RulesetVersionDraftImportFromDatasetRecordInput!) {
|
|
1620
1643
|
rulesetVersionDraftImportPreview(rulesetId: $rulesetId, input: $input) {
|
|
1621
|
-
${
|
|
1644
|
+
${Le}
|
|
1622
1645
|
}
|
|
1623
1646
|
}
|
|
1624
1647
|
`}},rulesetValidationImpact(e){let t={rulesetVersionId:e.rulesetVersionId},r=["rulesetVersionId: $rulesetVersionId"],s=["$rulesetVersionId: UUID!"];return e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),{query:`
|
|
1625
1648
|
query RulesetValidationImpact(${s.join(", ")}) {
|
|
1626
1649
|
rulesetValidationImpact(${r.join(", ")}) {
|
|
1627
|
-
${
|
|
1650
|
+
${Pe}
|
|
1628
1651
|
}
|
|
1629
1652
|
}
|
|
1630
1653
|
`,variables:t}},createRuleset(){return {query:`
|
|
1631
1654
|
mutation RulesetCreate($input: RulesetCreateInput!) {
|
|
1632
1655
|
rulesetCreate(input: $input) {
|
|
1633
|
-
${
|
|
1656
|
+
${q}
|
|
1634
1657
|
}
|
|
1635
1658
|
}
|
|
1636
1659
|
`}},updateRuleset(){return {query:`
|
|
1637
1660
|
mutation RulesetUpdate($id: UUID!, $input: RulesetUpdateInput!) {
|
|
1638
1661
|
rulesetUpdate(id: $id, input: $input) {
|
|
1639
|
-
${
|
|
1662
|
+
${q}
|
|
1640
1663
|
}
|
|
1641
1664
|
}
|
|
1642
1665
|
`}},createRulesetVersionDraft(){return {query:`
|
|
@@ -1738,13 +1761,13 @@ ${ne}`:n;return {query:`
|
|
|
1738
1761
|
`}},deckVersion(){return {query:`
|
|
1739
1762
|
query DeckVersion($id: UUID!) {
|
|
1740
1763
|
deckVersion(id: $id) {
|
|
1741
|
-
${
|
|
1764
|
+
${P}
|
|
1742
1765
|
}
|
|
1743
1766
|
}
|
|
1744
1767
|
`}},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:`
|
|
1745
1768
|
query DeckVersions(${s.join(", ")}) {
|
|
1746
1769
|
deckVersions(${r.join(", ")}) {
|
|
1747
|
-
${d(
|
|
1770
|
+
${d(P)}
|
|
1748
1771
|
}
|
|
1749
1772
|
}
|
|
1750
1773
|
`,variables:t}},deckDraftDiff(){return {query:`
|
|
@@ -1762,25 +1785,25 @@ ${ne}`:n;return {query:`
|
|
|
1762
1785
|
`}},deckHydrateEntries(){return {query:`
|
|
1763
1786
|
query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
|
|
1764
1787
|
deckHydrateEntries(input: $input) {
|
|
1765
|
-
${
|
|
1788
|
+
${Me}
|
|
1766
1789
|
}
|
|
1767
1790
|
}
|
|
1768
1791
|
`}},deckExport(){return {query:`
|
|
1769
1792
|
query DeckExport($id: UUID!, $format: DeckExportFormat!) {
|
|
1770
1793
|
deckExport(id: $id, format: $format) {
|
|
1771
|
-
${
|
|
1794
|
+
${Je}
|
|
1772
1795
|
}
|
|
1773
1796
|
}
|
|
1774
1797
|
`}},deckValidate(){return {query:`
|
|
1775
1798
|
query DeckValidate($id: UUID!, $input: DeckValidateInput) {
|
|
1776
1799
|
deckValidate(id: $id, input: $input) {
|
|
1777
|
-
${
|
|
1800
|
+
${W}
|
|
1778
1801
|
}
|
|
1779
1802
|
}
|
|
1780
1803
|
`}},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 i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1781
1804
|
query DeckSectionDefinitions${i} {
|
|
1782
1805
|
deckSectionDefinitions${n} {
|
|
1783
|
-
${
|
|
1806
|
+
${E}
|
|
1784
1807
|
}
|
|
1785
1808
|
}
|
|
1786
1809
|
`,variables:t}},deckCollaborators(){return {query:`
|
|
@@ -1792,31 +1815,31 @@ ${ne}`:n;return {query:`
|
|
|
1792
1815
|
`}},deckApiApplicationAccesses(){return {query:`
|
|
1793
1816
|
query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) {
|
|
1794
1817
|
deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) {
|
|
1795
|
-
${
|
|
1818
|
+
${J}
|
|
1796
1819
|
}
|
|
1797
1820
|
}
|
|
1798
1821
|
`}},myDeckApiApplicationAccesses(){return {query:`
|
|
1799
1822
|
query MyDeckApiApplicationAccesses($applicationId: UUID) {
|
|
1800
1823
|
myDeckApiApplicationAccesses(applicationId: $applicationId) {
|
|
1801
|
-
${
|
|
1824
|
+
${J}
|
|
1802
1825
|
}
|
|
1803
1826
|
}
|
|
1804
1827
|
`}},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 i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1805
1828
|
query DeckImportFormats${i} {
|
|
1806
1829
|
deckImportFormats${n} {
|
|
1807
|
-
${d(
|
|
1830
|
+
${d(v)}
|
|
1808
1831
|
}
|
|
1809
1832
|
}
|
|
1810
1833
|
`,variables:t}},deckImportFormat(){return {query:`
|
|
1811
1834
|
query DeckImportFormat($id: UUID, $gameId: UUID, $key: String) {
|
|
1812
1835
|
deckImportFormat(id: $id, gameId: $gameId, key: $key) {
|
|
1813
|
-
${
|
|
1836
|
+
${v}
|
|
1814
1837
|
}
|
|
1815
1838
|
}
|
|
1816
1839
|
`}},deckImportFormatTest(){return {query:`
|
|
1817
1840
|
query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
|
|
1818
1841
|
deckImportFormatTest(input: $input) {
|
|
1819
|
-
${
|
|
1842
|
+
${Be}
|
|
1820
1843
|
}
|
|
1821
1844
|
}
|
|
1822
1845
|
`}},createDeck(){return {query:`
|
|
@@ -1856,19 +1879,19 @@ ${ne}`:n;return {query:`
|
|
|
1856
1879
|
`}},addDeckEntry(){return {query:`
|
|
1857
1880
|
mutation DeckEntryAdd($input: DeckEntryAddInput!) {
|
|
1858
1881
|
deckEntryAdd(input: $input) {
|
|
1859
|
-
${
|
|
1882
|
+
${O}
|
|
1860
1883
|
}
|
|
1861
1884
|
}
|
|
1862
1885
|
`}},updateDeckEntry(){return {query:`
|
|
1863
1886
|
mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) {
|
|
1864
1887
|
deckEntryUpdate(id: $id, input: $input) {
|
|
1865
|
-
${
|
|
1888
|
+
${O}
|
|
1866
1889
|
}
|
|
1867
1890
|
}
|
|
1868
1891
|
`}},removeDeckEntry(){return {query:`
|
|
1869
1892
|
mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) {
|
|
1870
1893
|
deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) {
|
|
1871
|
-
${
|
|
1894
|
+
${O}
|
|
1872
1895
|
}
|
|
1873
1896
|
}
|
|
1874
1897
|
`}},reorderDeckEntries(){return {query:`
|
|
@@ -1880,37 +1903,37 @@ ${ne}`:n;return {query:`
|
|
|
1880
1903
|
`}},replaceDeckEntries(){return {query:`
|
|
1881
1904
|
mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
|
|
1882
1905
|
deckEntriesReplace(deckId: $deckId, input: $input) {
|
|
1883
|
-
${
|
|
1906
|
+
${je}
|
|
1884
1907
|
}
|
|
1885
1908
|
}
|
|
1886
1909
|
`}},importDeck(){return {query:`
|
|
1887
1910
|
mutation DeckImport($input: DeckImportInput!) {
|
|
1888
1911
|
deckImport(input: $input) {
|
|
1889
|
-
${
|
|
1912
|
+
${He}
|
|
1890
1913
|
}
|
|
1891
1914
|
}
|
|
1892
1915
|
`}},createDeckImportFormat(){return {query:`
|
|
1893
1916
|
mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
|
|
1894
1917
|
deckImportFormatCreate(input: $input) {
|
|
1895
|
-
${
|
|
1918
|
+
${v}
|
|
1896
1919
|
}
|
|
1897
1920
|
}
|
|
1898
1921
|
`}},updateDeckImportFormat(){return {query:`
|
|
1899
1922
|
mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
|
|
1900
1923
|
deckImportFormatUpdate(id: $id, input: $input) {
|
|
1901
|
-
${
|
|
1924
|
+
${v}
|
|
1902
1925
|
}
|
|
1903
1926
|
}
|
|
1904
1927
|
`}},archiveDeckImportFormat(){return {query:`
|
|
1905
1928
|
mutation DeckImportFormatArchive($id: UUID!) {
|
|
1906
1929
|
deckImportFormatArchive(id: $id) {
|
|
1907
|
-
${
|
|
1930
|
+
${v}
|
|
1908
1931
|
}
|
|
1909
1932
|
}
|
|
1910
1933
|
`}},unarchiveDeckImportFormat(){return {query:`
|
|
1911
1934
|
mutation DeckImportFormatUnarchive($id: UUID!) {
|
|
1912
1935
|
deckImportFormatUnarchive(id: $id) {
|
|
1913
|
-
${
|
|
1936
|
+
${v}
|
|
1914
1937
|
}
|
|
1915
1938
|
}
|
|
1916
1939
|
`}},upsertDeckByExternalRef(){return {query:`
|
|
@@ -1938,13 +1961,13 @@ ${ne}`:n;return {query:`
|
|
|
1938
1961
|
`}},copyDeck(){return {query:`
|
|
1939
1962
|
mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
|
|
1940
1963
|
deckCopy(id: $id, input: $input) {
|
|
1941
|
-
${
|
|
1964
|
+
${Oe}
|
|
1942
1965
|
}
|
|
1943
1966
|
}
|
|
1944
1967
|
`}},publishDeck(){return {query:`
|
|
1945
1968
|
mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
|
|
1946
1969
|
deckPublish(id: $id, input: $input) {
|
|
1947
|
-
${
|
|
1970
|
+
${Ne}
|
|
1948
1971
|
}
|
|
1949
1972
|
}
|
|
1950
1973
|
`}},removeInvalidDeckEntries(){return {query:`
|
|
@@ -1984,7 +2007,7 @@ ${ne}`:n;return {query:`
|
|
|
1984
2007
|
deckTokenExchange(input: $input) {
|
|
1985
2008
|
token
|
|
1986
2009
|
deckToken {
|
|
1987
|
-
${
|
|
2010
|
+
${_e}
|
|
1988
2011
|
}
|
|
1989
2012
|
}
|
|
1990
2013
|
}
|
|
@@ -1995,14 +2018,14 @@ ${ne}`:n;return {query:`
|
|
|
1995
2018
|
`}},grantDeckApiApplicationAccess(){return {query:`
|
|
1996
2019
|
mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
|
|
1997
2020
|
deckApiApplicationAccessGrant(input: $input) {
|
|
1998
|
-
${
|
|
2021
|
+
${J}
|
|
1999
2022
|
}
|
|
2000
2023
|
}
|
|
2001
2024
|
`}},revokeDeckApiApplicationAccess(){return {query:`
|
|
2002
2025
|
mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
|
|
2003
2026
|
deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
|
|
2004
2027
|
}
|
|
2005
|
-
`}},rulesetValidationRulesVariables(e,t,r){return r===void 0?{gameId:e,rulesetKey:t}:{gameId:e,rulesetKey:t,rulesetVersionId:r}},rulesetVersionDraftImportPreviewVariables(e,t){return {rulesetId:e,input:t}},rulesetCreateVariables(e){return {input:e}},rulesetUpdateVariables(e,t){return {id:e,input:t}},rulesetVersionDraftCreateVariables(e,t){return {rulesetId:e,input:t}},rulesetVersionDraftImportFromDatasetRecordVariables(e,t){return {rulesetId:e,input:t}},rulesetVersionDraftUpdateVariables(e,t){return {id:e,input:t}},rulesetVersionPublishVariables(e,t){return t===void 0?{id:e}:{id:e,input:t}},deckCreateVariables(e){return {input
|
|
2028
|
+
`}},rulesetValidationRulesVariables(e,t,r){return r===void 0?{gameId:e,rulesetKey:t}:{gameId:e,rulesetKey:t,rulesetVersionId:r}},rulesetVersionDraftImportPreviewVariables(e,t){return {rulesetId:e,input:t}},rulesetCreateVariables(e){return {input:e}},rulesetUpdateVariables(e,t){return {id:e,input:t}},rulesetVersionDraftCreateVariables(e,t){return {rulesetId:e,input:t}},rulesetVersionDraftImportFromDatasetRecordVariables(e,t){return {rulesetId:e,input:t}},rulesetVersionDraftUpdateVariables(e,t){return {id:e,input:t}},rulesetVersionPublishVariables(e,t){return t===void 0?{id:e}:{id:e,input:t}},deckCreateVariables(e){return {input:b(e)}},deckUpdateVariables(e,t){return {id:e,input:b(t)}},deckEntryAddVariables(e){return {input:b(e)}},deckEntryUpdateVariables(e,t){return {id:e,input:b(t)}},deckEntryRemoveVariables(e,t){return {id:e,expectedDraftRevision:t}},deckEntryReorderVariables(e,t){return {deckId:e,input:t}},deckEntriesReplaceVariables(e,t){return {deckId:e,input:b(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:b(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:b(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:`
|
|
2006
2029
|
query FetchMe {
|
|
2007
2030
|
fetchMe {
|
|
2008
2031
|
application {
|
|
@@ -2024,6 +2047,6 @@ ${ne}`:n;return {query:`
|
|
|
2024
2047
|
}
|
|
2025
2048
|
}
|
|
2026
2049
|
}
|
|
2027
|
-
`}}},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 ct="https://carddb.dev/query",ot=3e4,ut=1e4,lt=300,dt=3,ht=2,yt=1e3,ft=3e4,pt=class ve{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??ct,this.timeout=t.timeout??ot,this.openTimeout=t.openTimeout??ut,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??dt,this.retryOnNetworkError=t.retryOnNetworkError??true,this.maxNetworkRetries=t.maxNetworkRetries??ht,this.retryBaseDelay=t.retryBaseDelay??yt,this.retryMaxDelay=t.retryMaxDelay??ft,this.cache=t.cache,this.cacheTtl=t.cacheTtl??lt,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 D(`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 D(`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 D(`${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 ve({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})}},De="0.4.1";function mt(){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?gt(navigator.userAgent):{name:"unknown",version:"unknown"}}function gt(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 It(){let e=mt();return `CardDB-SDK/js/${De} (${e.name}/${e.version})`}function wr(){return De}var we=null;function $t(){return we}var bt=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 P&&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 Y&&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 K||e instanceof H}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":It(),...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 H("Request timed out")):(this.logError(`Connection failed: ${n.message}`),new K(`Connection failed: ${n.message}`)):new K("Connection failed")}finally{clearTimeout(s);}}async handleResponse(e){switch(this.extractRateLimitInfo(e),e.status){case 200:return this.handleSuccessResponse(e);case 401:throw new j("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 Y(`Server error (${e.status})`,{status:e.status,response:t})}throw new f(`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 j(s,t);case "RATE_LIMITED":throw new P(s,{response:t});case "NOT_FOUND":throw new f(s,t);case "VALIDATION_ERROR":case "BAD_USER_INPUT":throw new L(s,{errors:e,response:t});default:throw new ue(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 P("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 L(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;we={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 kt(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 vt(e,t){let r=e.get(t);return r}async function Dt(e,t,r,s){let i=e.set(t,r,s);i instanceof Promise&&await i;}var y=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 vt(n,e);if(c!==null)return c;let o=await s();if(o!=null){let h=this.config.cacheTtlFor(t);await Dt(n,e,o,h);}return o}cacheKey(e,t,r){return kt(e,t,r)}},wt=class extends y{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)}},St=class extends y{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??[]})}},At=class extends y{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??[]})}},Rt=class extends y{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=a.deckReadVariables(e,t.readState,t.version),s=this.cacheKey("decks","get",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckById();return (await this.connection.execute(i,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}=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=a.deckExternalRefReadVariables(e,t.readState,t.version),s=this.cacheKey("decks","getByExternalRef",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckByExternalRef();return (await this.connection.execute(i,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}=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 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 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 createTokenIssuer(e){this.config.requireSecretCredential("decks.createTokenIssuer");let{query:t}=a.createDeckTokenIssuer(),r=a.deckTokenIssuerCreateVariables(e);return (await this.connection.execute(t,r)).deckTokenIssuerCreate}async revokeTokenIssuer(e){this.config.requireSecretCredential("decks.revokeTokenIssuer");let{query:t}=a.revokeDeckTokenIssuer();return !!(await this.connection.execute(t,{id:e})).deckTokenIssuerRevoke}async revokeTokenIssuerSigningKey(e){this.config.requireSecretCredential("decks.revokeTokenIssuerSigningKey");let{query:t}=a.revokeDeckTokenIssuerSigningKey();return (await this.connection.execute(t,{id:e})).deckTokenIssuerSigningKeyRevoke}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 exchangeToken(e){this.config.requireSecretCredential("decks.exchangeToken");let{query:t}=a.exchangeDeckToken(),r=a.deckTokenExchangeVariables(e);return (await this.connection.execute(t,r)).deckTokenExchange}async revokeToken(e){this.config.requireSecretCredential("decks.revokeToken");let{query:t}=a.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),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=Et(n,s,e.identifierField);return e.entries.map(o=>({...o,record:c.get(o.identifier)??null}))}};function Et(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 qt=class extends y{constructor(e,t){super(e,t);}async list(e){let t=_(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=_(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??[]})}},xt=class extends y{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=_(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),R=await this.withCache(h,"records",t,async()=>(await this.connection.execute(c,o)).searchRecords);return new l(R,{nextPageLoader:async ee=>this.searchRuleRecords(e,{...t,after:ee})})}},Ct=class extends y{constructor(e,t){super(e,t);}async list(e,t={}){let{query:r,variables:s}=a.rulesets({gameId:e,includeArchived:t.includeArchived,first:t.first,after:t.after}),i=this.cacheKey("rulesets","list",s),n=await this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).rulesets);return new l(n,{nextPageLoader:async c=>this.list(e,{...t,after:c})})}async listPublic(e,t={}){let{query:r,variables:s}=a.publicRulesets({gameId:e,first:t.first,after:t.after}),i=this.cacheKey("rulesets","listPublic",s),n=await this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).publicRulesets);return new l(n,{nextPageLoader:async c=>this.listPublic(e,{...t,after:c})})}async get(e,t={}){let r={id:e},s=this.cacheKey("rulesets","get",r);return this.withCache(s,"rulesets",t,async()=>{let{query:i,variables:n}=a.ruleset({id:e});return (await this.connection.execute(i,n)).ruleset??null})}async getByKey(e){let t={gameId:e.gameId,key:e.key},r=this.cacheKey("rulesets","getByKey",t);return this.withCache(r,"rulesets",e,async()=>{let{query:s,variables:i}=a.ruleset({gameId:e.gameId,key:e.key});return (await this.connection.execute(s,i)).ruleset??null})}async versions(e,t={}){let{query:r,variables:s}=a.rulesetVersions({rulesetId:e,status:t.status,first:t.first,after:t.after}),i=this.cacheKey("rulesets","versions",s),n=await this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).rulesetVersions);return new l(n,{nextPageLoader:async c=>this.versions(e,{...t,after:c})})}async getVersion(e,t={}){let r=this.cacheKey("rulesets","getVersion",{id:e});return this.withCache(r,"rulesets",t,async()=>{let{query:s}=a.rulesetVersion();return (await this.connection.execute(s,{id:e})).rulesetVersion??null})}async validationRules(e,t,r={}){let s=a.rulesetValidationRulesVariables(e,t,r.rulesetVersionId),i=this.cacheKey("rulesets","validationRules",s);return this.withCache(i,"rulesets",r,async()=>{let{query:n}=a.rulesetValidationRules();return (await this.connection.execute(n,s)).rulesetValidationRules??null})}async deckValidationRules(e,t,r={}){let s=a.rulesetValidationRulesVariables(e,t,r.rulesetVersionId),i=this.cacheKey("rulesets","deckValidationRules",s);return this.withCache(i,"rulesets",r,async()=>{let{query:n}=a.deckValidationRules();return (await this.connection.execute(n,s)).deckValidationRules??null})}async previewImport(e,t){let{query:r}=a.rulesetVersionDraftImportPreview(),s=a.rulesetVersionDraftImportPreviewVariables(e,t);return (await this.connection.execute(r,s)).rulesetVersionDraftImportPreview}async validationImpact(e,t={}){let{query:r,variables:s}=a.rulesetValidationImpact({rulesetVersionId:e,first:t.first}),i=this.cacheKey("rulesets","validationImpact",s);return this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).rulesetValidationImpact)}async create(e){this.config.requireSecretCredential("rulesets.create");let{query:t}=a.createRuleset();return (await this.connection.execute(t,a.rulesetCreateVariables(e))).rulesetCreate}async update(e,t){this.config.requireSecretCredential("rulesets.update");let{query:r}=a.updateRuleset();return (await this.connection.execute(r,a.rulesetUpdateVariables(e,t))).rulesetUpdate}async createDraft(e,t){this.config.requireSecretCredential("rulesets.createDraft");let{query:r}=a.createRulesetVersionDraft();return (await this.connection.execute(r,a.rulesetVersionDraftCreateVariables(e,t))).rulesetVersionDraftCreate}async importDraftFromDatasetRecord(e,t){this.config.requireSecretCredential("rulesets.importDraftFromDatasetRecord");let{query:r}=a.importRulesetVersionDraftFromDatasetRecord();return (await this.connection.execute(r,a.rulesetVersionDraftImportFromDatasetRecordVariables(e,t))).rulesetVersionDraftImportFromDatasetRecord}async updateDraft(e,t){this.config.requireSecretCredential("rulesets.updateDraft");let{query:r}=a.updateRulesetVersionDraft();return (await this.connection.execute(r,a.rulesetVersionDraftUpdateVariables(e,t))).rulesetVersionDraftUpdate}async publishVersion(e,t){this.config.requireSecretCredential("rulesets.publishVersion");let{query:r}=a.publishRulesetVersion();return (await this.connection.execute(r,a.rulesetVersionPublishVariables(e,t))).rulesetVersionPublish}async activateVersion(e){this.config.requireSecretCredential("rulesets.activateVersion");let{query:t}=a.activateRulesetVersion();return (await this.connection.execute(t,{id:e})).rulesetVersionActivate}},Ut=class extends y{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}},Kt=class extends y{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??Tt());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 Tt(){return {totalCount:0,pageInfo:{hasNextPage:false,hasPreviousPage:false,startCursor:null,endCursor:null},edges:[]}}var Ft=class extends y{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));}}},Vt=class extends y{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??Lt(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??_t(e.purpose),entityId:e.entityId,publisherId:e.publisherId,datasetId:e.datasetId});return await Pt(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 Pt(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 Lt(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 _t(e){if(!(!e||e==="scan_image"))return e==="import"?"import":e==="scan_template_example"?"scan_template_example":e}var Bt=class extends y{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(;;){Ot(t.signal);let o=await this.getJob(e,{cache:false});if(!o)throw new Error(`Scan job '${e}' was not found`);if(Mt(o.status))return o;let h=Date.now()-n,R=r-h;if(R<=0)throw new Error(`Timed out waiting for scan job '${e}'`);await Jt(Math.min(c,R)),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=Gt(),r=await t.importKey("raw",Se(e.secret),{name:"HMAC",hash:"SHA-256"},false,["sign"]),s=await t.sign("HMAC",r,Nt(e.body)),i=`sha256=${jt(new Uint8Array(s))}`;return Ht(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 Mt(e){let t=e.toLowerCase();return t==="completed"||t==="failed"||t==="cancelled"}async function Jt(e){return new Promise(t=>setTimeout(t,e))}function Ot(e){if(e&&(e.throwIfAborted&&e.throwIfAborted(),e.aborted))throw new Error("Scan job polling aborted")}function Gt(){let t=globalThis.crypto?.subtle;if(!t)throw new Error("Web Crypto HMAC support is not available in this runtime");return t}function Nt(e){return typeof e=="string"?Se(e):e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Se(e){return new TextEncoder().encode(e)}function jt(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function Ht(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 Yt=class extends y{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:zt(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 zt(e){let t={...e};return delete t.id,t}var Ae=class Re{config;connection;publishers;games;datasets;records;decks;rules;rulesets;importFormats;imports;exports;files;scans;scanTemplates;constructor(t={}){this.config=new pt(t),this.connection=new bt(this.config),this.publishers=new wt(this.connection,this.config),this.games=new St(this.connection,this.config),this.datasets=new At(this.connection,this.config),this.records=new qt(this.connection,this.config),this.decks=new Rt(this.connection,this.config),this.rules=new xt(this.connection,this.config),this.rulesets=new Ct(this.connection,this.config),this.importFormats=new Ut(this.connection,this.config),this.imports=new Kt(this.connection,this.config),this.exports=new Ft(this.connection,this.config),this.files=new Vt(this.connection,this.config),this.scans=new Bt(this.connection,this.config),this.scanTemplates=new Yt(this.connection,this.config);}async me(){let{query:t}=a.fetchMe();return (await this.connection.execute(t)).fetchMe??null}getRateLimitInfo(){return $t()}withConfig(t){let r=this.config.merge(t);return new Re({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 Z=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 Ee=class extends Ae{constructor(t={}){if("apiKey"in t&&t.apiKey!==void 0)throw new D("apiKey is not accepted in browsers; use publishableKey or accessToken");if("secretKey"in t&&t.secretKey!==void 0)throw new D("secretKey is server-only; use publishableKey or accessToken in browsers");super(t);}};
|
|
2028
|
-
export{
|
|
2050
|
+
`}}},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 ot="https://carddb.dev/query",ut=3e4,lt=1e4,dt=300,ht=3,yt=2,ft=1e3,pt=3e4,mt=class ve{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??ot,this.timeout=t.timeout??ut,this.openTimeout=t.openTimeout??lt,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??ht,this.retryOnNetworkError=t.retryOnNetworkError??true,this.maxNetworkRetries=t.maxNetworkRetries??yt,this.retryBaseDelay=t.retryBaseDelay??ft,this.retryMaxDelay=t.retryMaxDelay??pt,this.cache=t.cache,this.cacheTtl=t.cacheTtl??dt,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 w(`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 w(`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 w(`${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 ve({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})}},De="0.4.1";function gt(){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?It(navigator.userAgent):{name:"unknown",version:"unknown"}}function It(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 $t(){let e=gt();return `CardDB-SDK/js/${De} (${e.name}/${e.version})`}function Ar(){return De}var we=null;function bt(){return we}var kt=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 L&&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 z&&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 T||e instanceof Y}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":$t(),...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 Y("Request timed out")):(this.logError(`Connection failed: ${n.message}`),new T(`Connection failed: ${n.message}`)):new T("Connection failed")}finally{clearTimeout(s);}}async handleResponse(e){switch(this.extractRateLimitInfo(e),e.status){case 200:return this.handleSuccessResponse(e);case 401:throw new H("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 z(`Server error (${e.status})`,{status:e.status,response:t})}throw new f(`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 H(s,t);case "RATE_LIMITED":throw new L(s,{response:t});case "NOT_FOUND":throw new f(s,t);case "VALIDATION_ERROR":case "BAD_USER_INPUT":throw new R(s,{errors:e,response:t});default:throw new ue(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 L("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 R(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;we={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 vt(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 Dt(e,t){let r=e.get(t);return r}async function wt(e,t,r,s){let i=e.set(t,r,s);i instanceof Promise&&await i;}var y=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 Dt(n,e);if(c!==null)return c;let o=await s();if(o!=null){let h=this.config.cacheTtlFor(t);await wt(n,e,o,h);}return o}cacheKey(e,t,r){return vt(e,t,r)}},St=class extends y{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)}},At=class extends y{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??[]})}},Rt=class extends y{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??[]})}async filterValues(e,t,r,s,i){let n,c;Array.isArray(t)?(n={id:e,fields:t},c=r??{}):(n={publisherSlug:e,gameKey:t,datasetKey:r,fields:s},c=i??{},this.validateAccess(n.publisherSlug,n.gameKey));let{query:o,variables:h}=a.fetchDatasetFilterValues({...n,search:c.search,includeCounts:c.includeCounts,first:c.first,after:c.after}),$=this.cacheKey("datasets","filterValues",h);return this.withCache($,"datasets",c,async()=>(await this.connection.execute(o,h)).fetchDataset?.filterValues??[])}},Et=class extends y{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=a.deckReadVariables(e,t.readState,t.version),s=this.cacheKey("decks","get",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckById();return (await this.connection.execute(i,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}=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=a.deckExternalRefReadVariables(e,t.readState,t.version),s=this.cacheKey("decks","getByExternalRef",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckByExternalRef();return (await this.connection.execute(i,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}=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 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 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 createTokenIssuer(e){this.config.requireSecretCredential("decks.createTokenIssuer");let{query:t}=a.createDeckTokenIssuer(),r=a.deckTokenIssuerCreateVariables(e);return (await this.connection.execute(t,r)).deckTokenIssuerCreate}async revokeTokenIssuer(e){this.config.requireSecretCredential("decks.revokeTokenIssuer");let{query:t}=a.revokeDeckTokenIssuer();return !!(await this.connection.execute(t,{id:e})).deckTokenIssuerRevoke}async revokeTokenIssuerSigningKey(e){this.config.requireSecretCredential("decks.revokeTokenIssuerSigningKey");let{query:t}=a.revokeDeckTokenIssuerSigningKey();return (await this.connection.execute(t,{id:e})).deckTokenIssuerSigningKeyRevoke}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 exchangeToken(e){this.config.requireSecretCredential("decks.exchangeToken");let{query:t}=a.exchangeDeckToken(),r=a.deckTokenExchangeVariables(e);return (await this.connection.execute(t,r)).deckTokenExchange}async revokeToken(e){this.config.requireSecretCredential("decks.revokeToken");let{query:t}=a.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),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=qt(n,s,e.identifierField);return e.entries.map(o=>({...o,record:c.get(o.identifier)??null}))}};function qt(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 Ct=class extends y{constructor(e,t){super(e,t);}async list(e){let t=_(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=_(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??[]})}},xt=class extends y{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=_(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),$=await this.withCache(h,"records",t,async()=>(await this.connection.execute(c,o)).searchRecords);return new l($,{nextPageLoader:async M=>this.searchRuleRecords(e,{...t,after:M})})}},Ut=class extends y{constructor(e,t){super(e,t);}async list(e,t={}){let{query:r,variables:s}=a.rulesets({gameId:e,includeArchived:t.includeArchived,first:t.first,after:t.after}),i=this.cacheKey("rulesets","list",s),n=await this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).rulesets);return new l(n,{nextPageLoader:async c=>this.list(e,{...t,after:c})})}async listPublic(e,t={}){let{query:r,variables:s}=a.publicRulesets({gameId:e,first:t.first,after:t.after}),i=this.cacheKey("rulesets","listPublic",s),n=await this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).publicRulesets);return new l(n,{nextPageLoader:async c=>this.listPublic(e,{...t,after:c})})}async get(e,t={}){let r={id:e},s=this.cacheKey("rulesets","get",r);return this.withCache(s,"rulesets",t,async()=>{let{query:i,variables:n}=a.ruleset({id:e});return (await this.connection.execute(i,n)).ruleset??null})}async getByKey(e){let t={gameId:e.gameId,key:e.key},r=this.cacheKey("rulesets","getByKey",t);return this.withCache(r,"rulesets",e,async()=>{let{query:s,variables:i}=a.ruleset({gameId:e.gameId,key:e.key});return (await this.connection.execute(s,i)).ruleset??null})}async versions(e,t={}){let{query:r,variables:s}=a.rulesetVersions({rulesetId:e,status:t.status,first:t.first,after:t.after}),i=this.cacheKey("rulesets","versions",s),n=await this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).rulesetVersions);return new l(n,{nextPageLoader:async c=>this.versions(e,{...t,after:c})})}async getVersion(e,t={}){let r=this.cacheKey("rulesets","getVersion",{id:e});return this.withCache(r,"rulesets",t,async()=>{let{query:s}=a.rulesetVersion();return (await this.connection.execute(s,{id:e})).rulesetVersion??null})}async validationRules(e,t,r={}){let s=a.rulesetValidationRulesVariables(e,t,r.rulesetVersionId),i=this.cacheKey("rulesets","validationRules",s);return this.withCache(i,"rulesets",r,async()=>{let{query:n}=a.rulesetValidationRules();return (await this.connection.execute(n,s)).rulesetValidationRules??null})}async deckValidationRules(e,t,r={}){let s=a.rulesetValidationRulesVariables(e,t,r.rulesetVersionId),i=this.cacheKey("rulesets","deckValidationRules",s);return this.withCache(i,"rulesets",r,async()=>{let{query:n}=a.deckValidationRules();return (await this.connection.execute(n,s)).deckValidationRules??null})}async previewImport(e,t){let{query:r}=a.rulesetVersionDraftImportPreview(),s=a.rulesetVersionDraftImportPreviewVariables(e,t);return (await this.connection.execute(r,s)).rulesetVersionDraftImportPreview}async validationImpact(e,t={}){let{query:r,variables:s}=a.rulesetValidationImpact({rulesetVersionId:e,first:t.first}),i=this.cacheKey("rulesets","validationImpact",s);return this.withCache(i,"rulesets",t,async()=>(await this.connection.execute(r,s)).rulesetValidationImpact)}async create(e){this.config.requireSecretCredential("rulesets.create");let{query:t}=a.createRuleset();return (await this.connection.execute(t,a.rulesetCreateVariables(e))).rulesetCreate}async update(e,t){this.config.requireSecretCredential("rulesets.update");let{query:r}=a.updateRuleset();return (await this.connection.execute(r,a.rulesetUpdateVariables(e,t))).rulesetUpdate}async createDraft(e,t){this.config.requireSecretCredential("rulesets.createDraft");let{query:r}=a.createRulesetVersionDraft();return (await this.connection.execute(r,a.rulesetVersionDraftCreateVariables(e,t))).rulesetVersionDraftCreate}async importDraftFromDatasetRecord(e,t){this.config.requireSecretCredential("rulesets.importDraftFromDatasetRecord");let{query:r}=a.importRulesetVersionDraftFromDatasetRecord();return (await this.connection.execute(r,a.rulesetVersionDraftImportFromDatasetRecordVariables(e,t))).rulesetVersionDraftImportFromDatasetRecord}async updateDraft(e,t){this.config.requireSecretCredential("rulesets.updateDraft");let{query:r}=a.updateRulesetVersionDraft();return (await this.connection.execute(r,a.rulesetVersionDraftUpdateVariables(e,t))).rulesetVersionDraftUpdate}async publishVersion(e,t){this.config.requireSecretCredential("rulesets.publishVersion");let{query:r}=a.publishRulesetVersion();return (await this.connection.execute(r,a.rulesetVersionPublishVariables(e,t))).rulesetVersionPublish}async activateVersion(e){this.config.requireSecretCredential("rulesets.activateVersion");let{query:t}=a.activateRulesetVersion();return (await this.connection.execute(t,{id:e})).rulesetVersionActivate}},Kt=class extends y{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}},Tt=class extends y{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??Ft());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 Ft(){return {totalCount:0,pageInfo:{hasNextPage:false,hasPreviousPage:false,startCursor:null,endCursor:null},edges:[]}}var Vt=class extends y{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));}}},Pt=class extends y{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??_t(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??Bt(e.purpose),entityId:e.entityId,publisherId:e.publisherId,datasetId:e.datasetId});return await Lt(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 Lt(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 _t(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 Bt(e){if(!(!e||e==="scan_image"))return e==="import"?"import":e==="scan_template_example"?"scan_template_example":e}var Mt=class extends y{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(;;){Gt(t.signal);let o=await this.getJob(e,{cache:false});if(!o)throw new Error(`Scan job '${e}' was not found`);if(Jt(o.status))return o;let h=Date.now()-n,$=r-h;if($<=0)throw new Error(`Timed out waiting for scan job '${e}'`);await Ot(Math.min(c,$)),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=Nt(),r=await t.importKey("raw",Se(e.secret),{name:"HMAC",hash:"SHA-256"},false,["sign"]),s=await t.sign("HMAC",r,jt(e.body)),i=`sha256=${Ht(new Uint8Array(s))}`;return Yt(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 Jt(e){let t=e.toLowerCase();return t==="completed"||t==="failed"||t==="cancelled"}async function Ot(e){return new Promise(t=>setTimeout(t,e))}function Gt(e){if(e&&(e.throwIfAborted&&e.throwIfAborted(),e.aborted))throw new Error("Scan job polling aborted")}function Nt(){let t=globalThis.crypto?.subtle;if(!t)throw new Error("Web Crypto HMAC support is not available in this runtime");return t}function jt(e){return typeof e=="string"?Se(e):e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Se(e){return new TextEncoder().encode(e)}function Ht(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function Yt(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 zt=class extends y{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:Wt(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 Wt(e){let t={...e};return delete t.id,t}var Ae=class Re{config;connection;publishers;games;datasets;records;decks;rules;rulesets;importFormats;imports;exports;files;scans;scanTemplates;constructor(t={}){this.config=new mt(t),this.connection=new kt(this.config),this.publishers=new St(this.connection,this.config),this.games=new At(this.connection,this.config),this.datasets=new Rt(this.connection,this.config),this.records=new Ct(this.connection,this.config),this.decks=new Et(this.connection,this.config),this.rules=new xt(this.connection,this.config),this.rulesets=new Ut(this.connection,this.config),this.importFormats=new Kt(this.connection,this.config),this.imports=new Tt(this.connection,this.config),this.exports=new Vt(this.connection,this.config),this.files=new Pt(this.connection,this.config),this.scans=new Mt(this.connection,this.config),this.scanTemplates=new zt(this.connection,this.config);}async me(){let{query:t}=a.fetchMe();return (await this.connection.execute(t)).fetchMe??null}getRateLimitInfo(){return bt()}withConfig(t){let r=this.config.merge(t);return new Re({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 ee=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 Ee=class extends Ae{constructor(t={}){if("apiKey"in t&&t.apiKey!==void 0)throw new w("apiKey is not accepted in browsers; use publishableKey or accessToken");if("secretKey"in t&&t.secretKey!==void 0)throw new w("secretKey is server-only; use publishableKey or accessToken in browsers");super(t);}};
|
|
2051
|
+
export{H as AuthenticationError,y as BaseResource,ee as BrowserCache,Ee as CardDBClient,f as CardDBError,l as Collection,mt as Configuration,kt as Connection,T as ConnectionError,dt as DEFAULT_CACHE_TTL,ot as DEFAULT_ENDPOINT,yt as DEFAULT_MAX_NETWORK_RETRIES,ht as DEFAULT_MAX_RETRIES,lt as DEFAULT_OPEN_TIMEOUT,ft as DEFAULT_RETRY_BASE_DELAY,pt as DEFAULT_RETRY_MAX_DELAY,ut as DEFAULT_TIMEOUT,Rt as DatasetsResource,Et as DecksResource,Vt as ExportsResource,Pt as FilesResource,qe as FilterBuilder,At as GamesResource,ue as GraphQLError,Kt as ImportFormatsResource,Tt as ImportsResource,Zt as LinkResolutionError,Qt as NotFoundError,St as PublishersResource,a as QueryBuilder,L as RateLimitError,Ct as RecordsResource,w as RestrictedError,xt as RulesResource,Ut as RulesetsResource,zt as ScanTemplatesResource,Mt as ScansResource,z as ServerError,Y as TimeoutError,R as ValidationError,vt as cacheKey,or as contains,er as eq,bt as getRateLimitInfo,Ar as getSDKVersion,$t as getUserAgent,rr as gt,sr as gte,lr as ilike,hr as isNotNull,dr as isNull,ur as like,ir as lt,ar as lte,tr as neq,cr as notWithin,Dt as readCache,_ as resolveFilter,nr as within,wt as writeCache};//# sourceMappingURL=index.js.map
|
|
2029
2052
|
//# sourceMappingURL=index.js.map
|