@carddb/browser 0.1.5 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/browser/index.js +1269 -82
- package/dist/browser/index.js.map +1 -1
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -2
- package/dist/index.d.ts +45 -2
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
var
|
|
1
|
+
var y=class re extends Error{response;constructor(t,r){super(t),this.name="CardDBError",this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this,re);}},B=class extends y{constructor(e="Invalid or missing API key",t){super(e,t),this.name="AuthenticationError";}},q=class extends y{retryAfter;limit;remaining;resetAt;constructor(e="Rate limit exceeded",t={}){super(e,t.response),this.name="RateLimitError",this.retryAfter=t.retryAfter??null,this.limit=t.limit??null,this.remaining=t.remaining??null,this.resetAt=t.resetAt??null;}},mt=class extends y{constructor(e="Resource not found",t){super(e,t),this.name="NotFoundError";}},_=class extends y{errors;constructor(e="Validation error",t={}){super(e,t.response),this.name="ValidationError",this.errors=t.errors??[];}},b=class extends y{constructor(e,t){super(e,t),this.name="RestrictedError";}},se=class extends y{errors;constructor(e="GraphQL error",t={}){super(e,t.response),this.name="GraphQLError",this.errors=t.errors??[];}},E=class extends y{constructor(e="Connection error",t){super(e,t),this.name="ConnectionError";}},V=class extends E{constructor(e="Request timed out",t){super(e,t),this.name="TimeoutError";}},J=class extends y{status;constructor(e="Server error",t={}){super(e,t.response),this.name="ServerError",this.status=t.status??null;}},gt=class extends y{failures;partialResults;constructor(e="Some links could not be resolved",t={}){super(e,t.response),this.name="LinkResolutionError",this.failures=t.failures??[],this.partialResults=t.partialResults;}getFailuresForField(e){return this.failures.filter(t=>t.field===e)}hasFailuresForField(e){return this.failures.some(t=>t.field===e)}};function kt(e){return {eq:e}}function It(e){return {neq:e}}function $t(e){return {gt:e}}function bt(e){return {gte:e}}function vt(e){return {lt:e}}function Dt(e){return {lte:e}}function wt(e){return {in:e}}function At(e){return {nin:e}}function Et(e){return {contains:e}}function St(e){return {like:e}}function xt(e){return {ilike:e}}function Rt(){return {is_null:true}}function qt(){return {is_null:false}}var be=class ie{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 ie;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 C(e){if(e!==void 0){if(typeof e=="function"){let t=new be;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 S=`
|
|
2
|
+
id
|
|
3
|
+
createdAt
|
|
4
|
+
updatedAt
|
|
5
|
+
key
|
|
6
|
+
filename
|
|
7
|
+
contentType
|
|
8
|
+
size
|
|
9
|
+
status
|
|
10
|
+
isPublic
|
|
11
|
+
entityType
|
|
12
|
+
entityId
|
|
13
|
+
url
|
|
14
|
+
`,ve=`
|
|
15
|
+
file {
|
|
16
|
+
${S}
|
|
17
|
+
}
|
|
18
|
+
uploadUrl
|
|
19
|
+
expiresAt
|
|
20
|
+
`,g=`
|
|
2
21
|
id
|
|
3
22
|
name
|
|
4
23
|
slug
|
|
@@ -15,12 +34,14 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
15
34
|
id
|
|
16
35
|
url
|
|
17
36
|
}
|
|
18
|
-
`,
|
|
37
|
+
`,f=`
|
|
19
38
|
id
|
|
20
39
|
publisherId
|
|
21
40
|
key
|
|
22
41
|
name
|
|
23
42
|
description
|
|
43
|
+
metafyGameUuid
|
|
44
|
+
metafyGameSlug
|
|
24
45
|
website
|
|
25
46
|
visibility
|
|
26
47
|
isArchived
|
|
@@ -39,7 +60,7 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
39
60
|
id
|
|
40
61
|
url
|
|
41
62
|
}
|
|
42
|
-
`,
|
|
63
|
+
`,p=`
|
|
43
64
|
id
|
|
44
65
|
publisherId
|
|
45
66
|
gameId
|
|
@@ -47,8 +68,13 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
47
68
|
name
|
|
48
69
|
description
|
|
49
70
|
purpose
|
|
71
|
+
activeVersionId
|
|
50
72
|
tcgplayerProductIdFieldKey
|
|
51
73
|
visibility
|
|
74
|
+
posX
|
|
75
|
+
posY
|
|
76
|
+
sortOrder
|
|
77
|
+
archivedAt
|
|
52
78
|
isArchived
|
|
53
79
|
createdAt
|
|
54
80
|
updatedAt
|
|
@@ -62,7 +88,7 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
62
88
|
key
|
|
63
89
|
name
|
|
64
90
|
}
|
|
65
|
-
`,
|
|
91
|
+
`,De=4;function ae(e){return `
|
|
66
92
|
key
|
|
67
93
|
label
|
|
68
94
|
description
|
|
@@ -71,18 +97,36 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
71
97
|
filterable
|
|
72
98
|
searchable
|
|
73
99
|
isIdentifier
|
|
100
|
+
sortOrder
|
|
74
101
|
itemType
|
|
102
|
+
linkDatasetId
|
|
103
|
+
linkDatasetKey
|
|
104
|
+
linkDatasetName
|
|
105
|
+
linkFieldKey
|
|
106
|
+
linkAlias
|
|
107
|
+
linkDirection
|
|
75
108
|
displayFormat
|
|
76
109
|
semanticType
|
|
110
|
+
placeholder
|
|
111
|
+
isHidden
|
|
112
|
+
isComputed
|
|
113
|
+
isSystemField
|
|
114
|
+
defaultValue
|
|
77
115
|
allowedValues
|
|
116
|
+
minLength
|
|
117
|
+
maxLength
|
|
118
|
+
minValue
|
|
119
|
+
maxValue
|
|
120
|
+
pattern
|
|
121
|
+
isUnique
|
|
78
122
|
${e>0?`
|
|
79
123
|
nestedFields {
|
|
80
|
-
${
|
|
124
|
+
${ae(e-1)}
|
|
81
125
|
}`:""}
|
|
82
|
-
`}var
|
|
126
|
+
`}var D=`
|
|
83
127
|
schema {
|
|
84
128
|
fields {
|
|
85
|
-
${
|
|
129
|
+
${ae(De)}
|
|
86
130
|
}
|
|
87
131
|
filterableFields
|
|
88
132
|
searchableFields
|
|
@@ -92,9 +136,47 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
92
136
|
targetDatasetKey
|
|
93
137
|
targetDatasetName
|
|
94
138
|
targetDatasetId
|
|
139
|
+
targetFieldKey
|
|
140
|
+
linkAlias
|
|
141
|
+
linkDirection
|
|
142
|
+
isArray
|
|
95
143
|
}
|
|
96
144
|
}
|
|
97
|
-
`,
|
|
145
|
+
`,ne=`
|
|
146
|
+
id
|
|
147
|
+
objectTypeId
|
|
148
|
+
key
|
|
149
|
+
label
|
|
150
|
+
dataType
|
|
151
|
+
isRequired
|
|
152
|
+
isFilterable
|
|
153
|
+
isSearchable
|
|
154
|
+
isIdentifier
|
|
155
|
+
sortOrder
|
|
156
|
+
description
|
|
157
|
+
placeholder
|
|
158
|
+
displayFormat
|
|
159
|
+
semanticType
|
|
160
|
+
isHidden
|
|
161
|
+
isComputed
|
|
162
|
+
isSystemField
|
|
163
|
+
defaultValue
|
|
164
|
+
allowedValues
|
|
165
|
+
minLength
|
|
166
|
+
maxLength
|
|
167
|
+
minValue
|
|
168
|
+
maxValue
|
|
169
|
+
pattern
|
|
170
|
+
isUnique
|
|
171
|
+
itemType
|
|
172
|
+
linkDatasetId
|
|
173
|
+
linkFieldKey
|
|
174
|
+
linkAlias
|
|
175
|
+
linkDirection
|
|
176
|
+
parentFieldId
|
|
177
|
+
createdAt
|
|
178
|
+
updatedAt
|
|
179
|
+
`,we=`
|
|
98
180
|
pricing {
|
|
99
181
|
productId
|
|
100
182
|
prices {
|
|
@@ -106,11 +188,11 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
106
188
|
directLowPrice
|
|
107
189
|
}
|
|
108
190
|
}
|
|
109
|
-
`;function
|
|
191
|
+
`;function k(e={}){return `
|
|
110
192
|
id
|
|
111
193
|
datasetId
|
|
112
194
|
data
|
|
113
|
-
${e.includePricing?
|
|
195
|
+
${e.includePricing?we:""}
|
|
114
196
|
createdAt
|
|
115
197
|
updatedAt
|
|
116
198
|
dataset {
|
|
@@ -120,7 +202,77 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
120
202
|
gameId
|
|
121
203
|
publisherId
|
|
122
204
|
}
|
|
123
|
-
`}var
|
|
205
|
+
`}var A=k(),O=`
|
|
206
|
+
key
|
|
207
|
+
label
|
|
208
|
+
description
|
|
209
|
+
order
|
|
210
|
+
default
|
|
211
|
+
aliases
|
|
212
|
+
minCards
|
|
213
|
+
maxCards
|
|
214
|
+
excludedFromDeckSize
|
|
215
|
+
legalCardTypes
|
|
216
|
+
metadata
|
|
217
|
+
`,K=`
|
|
218
|
+
id
|
|
219
|
+
datasetId
|
|
220
|
+
recordId
|
|
221
|
+
identifier
|
|
222
|
+
quantity
|
|
223
|
+
section
|
|
224
|
+
sortOrder
|
|
225
|
+
annotations
|
|
226
|
+
display
|
|
227
|
+
record {
|
|
228
|
+
${A}
|
|
229
|
+
}
|
|
230
|
+
`,ce=`
|
|
231
|
+
rulesetId
|
|
232
|
+
rulesetVersionId
|
|
233
|
+
rulesetVersionLabel
|
|
234
|
+
cardDatasetId
|
|
235
|
+
cardDatasetVersionId
|
|
236
|
+
validatedAt
|
|
237
|
+
validationResultSummary
|
|
238
|
+
`,x=`
|
|
239
|
+
code
|
|
240
|
+
severity
|
|
241
|
+
message
|
|
242
|
+
entryIds
|
|
243
|
+
section
|
|
244
|
+
datasetId
|
|
245
|
+
identifier
|
|
246
|
+
metadata
|
|
247
|
+
`,G=`
|
|
248
|
+
deckId
|
|
249
|
+
valid
|
|
250
|
+
blockers {
|
|
251
|
+
${x}
|
|
252
|
+
}
|
|
253
|
+
warnings {
|
|
254
|
+
${x}
|
|
255
|
+
}
|
|
256
|
+
affectedEntries {
|
|
257
|
+
entryId
|
|
258
|
+
datasetId
|
|
259
|
+
recordId
|
|
260
|
+
identifier
|
|
261
|
+
section
|
|
262
|
+
quantity
|
|
263
|
+
}
|
|
264
|
+
validatedAgainst {
|
|
265
|
+
${ce}
|
|
266
|
+
}
|
|
267
|
+
checkedAt
|
|
268
|
+
`,W=`
|
|
269
|
+
deckId
|
|
270
|
+
fromVersionId
|
|
271
|
+
toVersionId
|
|
272
|
+
toDraftRevision
|
|
273
|
+
hasChanges
|
|
274
|
+
diff
|
|
275
|
+
`,R=`
|
|
124
276
|
id
|
|
125
277
|
deckId
|
|
126
278
|
versionNumber
|
|
@@ -135,23 +287,25 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
135
287
|
metadata
|
|
136
288
|
publishNote
|
|
137
289
|
computedDiff
|
|
290
|
+
rulesetId
|
|
291
|
+
rulesetVersionId
|
|
292
|
+
cardDatasetId
|
|
293
|
+
cardDatasetVersionId
|
|
294
|
+
validatedAt
|
|
295
|
+
validationSummary
|
|
296
|
+
validatedAgainst {
|
|
297
|
+
${ce}
|
|
298
|
+
}
|
|
299
|
+
sectionDefinitions {
|
|
300
|
+
${O}
|
|
301
|
+
}
|
|
138
302
|
publishedByAccountId
|
|
139
303
|
publishedByApiApplicationId
|
|
140
304
|
createdAt
|
|
141
305
|
entries {
|
|
142
|
-
|
|
143
|
-
datasetId
|
|
144
|
-
recordId
|
|
145
|
-
identifier
|
|
146
|
-
quantity
|
|
147
|
-
section
|
|
148
|
-
sortOrder
|
|
149
|
-
annotations
|
|
150
|
-
record {
|
|
151
|
-
${F}
|
|
152
|
-
}
|
|
306
|
+
${K}
|
|
153
307
|
}
|
|
154
|
-
`,
|
|
308
|
+
`,Q=`
|
|
155
309
|
id
|
|
156
310
|
deckId
|
|
157
311
|
accountId
|
|
@@ -159,7 +313,7 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
159
313
|
createdByAccountId
|
|
160
314
|
createdAt
|
|
161
315
|
updatedAt
|
|
162
|
-
`,
|
|
316
|
+
`,z=`
|
|
163
317
|
id
|
|
164
318
|
deckId
|
|
165
319
|
label
|
|
@@ -168,8 +322,144 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
168
322
|
lastUsedAt
|
|
169
323
|
createdAt
|
|
170
324
|
updatedAt
|
|
171
|
-
`,
|
|
325
|
+
`,Z=`
|
|
172
326
|
id
|
|
327
|
+
deckId
|
|
328
|
+
apiApplicationId
|
|
329
|
+
label
|
|
330
|
+
readMode
|
|
331
|
+
allowedOrigins
|
|
332
|
+
externalSubject
|
|
333
|
+
expiresAt
|
|
334
|
+
revokedAt
|
|
335
|
+
lastUsedAt
|
|
336
|
+
createdAt
|
|
337
|
+
updatedAt
|
|
338
|
+
`,T=`
|
|
339
|
+
id
|
|
340
|
+
deckId
|
|
341
|
+
apiApplicationId
|
|
342
|
+
label
|
|
343
|
+
readModes
|
|
344
|
+
maxTokenLifetimeSeconds
|
|
345
|
+
directSigningAlg
|
|
346
|
+
directSigningKeyId
|
|
347
|
+
directSigningPublicKey
|
|
348
|
+
directSigningKeyRevokedAt
|
|
349
|
+
revokedAt
|
|
350
|
+
createdAt
|
|
351
|
+
updatedAt
|
|
352
|
+
`,Ae=`
|
|
353
|
+
id
|
|
354
|
+
deckId
|
|
355
|
+
apiApplicationId
|
|
356
|
+
issuerId
|
|
357
|
+
readMode
|
|
358
|
+
externalSubject
|
|
359
|
+
expiresAt
|
|
360
|
+
revokedAt
|
|
361
|
+
lastUsedAt
|
|
362
|
+
createdAt
|
|
363
|
+
updatedAt
|
|
364
|
+
`,M=`
|
|
365
|
+
lineNumber
|
|
366
|
+
raw
|
|
367
|
+
datasetKey
|
|
368
|
+
datasetId
|
|
369
|
+
recordId
|
|
370
|
+
identifier
|
|
371
|
+
quantity
|
|
372
|
+
section
|
|
373
|
+
sortOrder
|
|
374
|
+
display
|
|
375
|
+
record {
|
|
376
|
+
${A}
|
|
377
|
+
}
|
|
378
|
+
`,oe=`
|
|
379
|
+
lineNumber
|
|
380
|
+
raw
|
|
381
|
+
code
|
|
382
|
+
message
|
|
383
|
+
`,N=`
|
|
384
|
+
lineNumber
|
|
385
|
+
raw
|
|
386
|
+
datasetKey
|
|
387
|
+
identifier
|
|
388
|
+
quantity
|
|
389
|
+
section
|
|
390
|
+
code
|
|
391
|
+
message
|
|
392
|
+
`,j=`
|
|
393
|
+
lineNumber
|
|
394
|
+
raw
|
|
395
|
+
datasetKey
|
|
396
|
+
identifier
|
|
397
|
+
quantity
|
|
398
|
+
section
|
|
399
|
+
candidates {
|
|
400
|
+
recordId
|
|
401
|
+
identifier
|
|
402
|
+
display
|
|
403
|
+
}
|
|
404
|
+
`,I=`
|
|
405
|
+
id
|
|
406
|
+
gameId
|
|
407
|
+
key
|
|
408
|
+
name
|
|
409
|
+
description
|
|
410
|
+
enabled
|
|
411
|
+
priority
|
|
412
|
+
datasetKey
|
|
413
|
+
config
|
|
414
|
+
archivedAt
|
|
415
|
+
isArchived
|
|
416
|
+
createdAt
|
|
417
|
+
updatedAt
|
|
418
|
+
`,ue=`
|
|
419
|
+
formatId
|
|
420
|
+
key
|
|
421
|
+
name
|
|
422
|
+
confidence
|
|
423
|
+
reason
|
|
424
|
+
`,Ee=`
|
|
425
|
+
detection {
|
|
426
|
+
${ue}
|
|
427
|
+
}
|
|
428
|
+
entries {
|
|
429
|
+
${M}
|
|
430
|
+
}
|
|
431
|
+
parseErrors {
|
|
432
|
+
${oe}
|
|
433
|
+
}
|
|
434
|
+
unmatched {
|
|
435
|
+
${N}
|
|
436
|
+
}
|
|
437
|
+
ambiguous {
|
|
438
|
+
${j}
|
|
439
|
+
}
|
|
440
|
+
`,Se=`
|
|
441
|
+
entries {
|
|
442
|
+
${M}
|
|
443
|
+
}
|
|
444
|
+
unmatched {
|
|
445
|
+
${N}
|
|
446
|
+
}
|
|
447
|
+
ambiguous {
|
|
448
|
+
${j}
|
|
449
|
+
}
|
|
450
|
+
`,xe=`
|
|
451
|
+
deckId
|
|
452
|
+
format
|
|
453
|
+
text
|
|
454
|
+
entryCount
|
|
455
|
+
`,u=`
|
|
456
|
+
id
|
|
457
|
+
ownerType
|
|
458
|
+
ownerAccountId
|
|
459
|
+
ownerApiApplicationId
|
|
460
|
+
environment
|
|
461
|
+
createdByAccountId
|
|
462
|
+
createdByApiApplicationId
|
|
173
463
|
accountId
|
|
174
464
|
apiApplicationId
|
|
175
465
|
gameId
|
|
@@ -179,33 +469,132 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
179
469
|
description
|
|
180
470
|
formatKey
|
|
181
471
|
visibility
|
|
472
|
+
accessMode
|
|
473
|
+
discoverability
|
|
474
|
+
state
|
|
475
|
+
archivedAt
|
|
476
|
+
deletedAt
|
|
477
|
+
unpublishedAt
|
|
478
|
+
externalRefApiApplicationId
|
|
182
479
|
externalRef
|
|
480
|
+
externalSubjectRef
|
|
481
|
+
rulesetId
|
|
183
482
|
sourceUrl
|
|
184
483
|
metadata
|
|
484
|
+
sectionDefinitions {
|
|
485
|
+
${O}
|
|
486
|
+
}
|
|
185
487
|
latestPublishedVersion {
|
|
186
|
-
${
|
|
488
|
+
${R}
|
|
187
489
|
}
|
|
188
490
|
publishedAt
|
|
491
|
+
draftRevision
|
|
492
|
+
draftUpdatedAt
|
|
493
|
+
draftUpdatedByAccountId
|
|
494
|
+
draftUpdatedByApiApplicationId
|
|
189
495
|
hasUnpublishedChanges
|
|
190
496
|
createdAt
|
|
191
497
|
updatedAt
|
|
192
498
|
game {
|
|
193
|
-
${
|
|
499
|
+
${f}
|
|
194
500
|
}
|
|
195
501
|
entries {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
502
|
+
${K}
|
|
503
|
+
}
|
|
504
|
+
`,ee=`
|
|
505
|
+
deck {
|
|
506
|
+
${u}
|
|
507
|
+
}
|
|
508
|
+
retainedAppAccess
|
|
509
|
+
`,Re=`
|
|
510
|
+
deck {
|
|
511
|
+
${u}
|
|
512
|
+
}
|
|
513
|
+
copiedFromDeckId
|
|
514
|
+
retainedAppAccess
|
|
515
|
+
`,qe=`
|
|
516
|
+
id
|
|
517
|
+
name
|
|
518
|
+
description
|
|
519
|
+
revokedAt
|
|
520
|
+
`,U=`
|
|
521
|
+
id
|
|
522
|
+
deckId
|
|
523
|
+
deck {
|
|
524
|
+
${u}
|
|
525
|
+
}
|
|
526
|
+
apiApplicationId
|
|
527
|
+
apiApplication {
|
|
528
|
+
${qe}
|
|
529
|
+
}
|
|
530
|
+
role
|
|
531
|
+
grantSource
|
|
532
|
+
externalRef
|
|
533
|
+
createdByAccountId
|
|
534
|
+
createdByApiApplicationId
|
|
535
|
+
revokedAt
|
|
536
|
+
createdAt
|
|
537
|
+
updatedAt
|
|
538
|
+
`,Ce=`
|
|
539
|
+
deck {
|
|
540
|
+
${u}
|
|
541
|
+
}
|
|
542
|
+
version {
|
|
543
|
+
${R}
|
|
544
|
+
}
|
|
545
|
+
validation {
|
|
546
|
+
${G}
|
|
547
|
+
}
|
|
548
|
+
blockers {
|
|
549
|
+
${x}
|
|
207
550
|
}
|
|
208
|
-
|
|
551
|
+
warnings {
|
|
552
|
+
${x}
|
|
553
|
+
}
|
|
554
|
+
`,F=`
|
|
555
|
+
deck {
|
|
556
|
+
${u}
|
|
557
|
+
}
|
|
558
|
+
entry {
|
|
559
|
+
${K}
|
|
560
|
+
}
|
|
561
|
+
`,de=`
|
|
562
|
+
deck {
|
|
563
|
+
${u}
|
|
564
|
+
}
|
|
565
|
+
entries {
|
|
566
|
+
${K}
|
|
567
|
+
}
|
|
568
|
+
`,Ke=de,Te=`
|
|
569
|
+
deck {
|
|
570
|
+
${u}
|
|
571
|
+
}
|
|
572
|
+
applied
|
|
573
|
+
dryRun
|
|
574
|
+
replace
|
|
575
|
+
format
|
|
576
|
+
importFormat {
|
|
577
|
+
${I}
|
|
578
|
+
}
|
|
579
|
+
detection {
|
|
580
|
+
${ue}
|
|
581
|
+
}
|
|
582
|
+
entries {
|
|
583
|
+
${M}
|
|
584
|
+
}
|
|
585
|
+
parseErrors {
|
|
586
|
+
${oe}
|
|
587
|
+
}
|
|
588
|
+
unmatched {
|
|
589
|
+
${N}
|
|
590
|
+
}
|
|
591
|
+
ambiguous {
|
|
592
|
+
${j}
|
|
593
|
+
}
|
|
594
|
+
validation {
|
|
595
|
+
${G}
|
|
596
|
+
}
|
|
597
|
+
`,te=`
|
|
209
598
|
resolvedLinks {
|
|
210
599
|
field
|
|
211
600
|
linkFieldKey
|
|
@@ -216,7 +605,290 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
216
605
|
data
|
|
217
606
|
}
|
|
218
607
|
}
|
|
219
|
-
|
|
608
|
+
`,le=`
|
|
609
|
+
datasetKey
|
|
610
|
+
index
|
|
611
|
+
errors {
|
|
612
|
+
field
|
|
613
|
+
message
|
|
614
|
+
details
|
|
615
|
+
}
|
|
616
|
+
`,Ue=`
|
|
617
|
+
total
|
|
618
|
+
inserted
|
|
619
|
+
updated
|
|
620
|
+
skipped
|
|
621
|
+
failed
|
|
622
|
+
`,he=`
|
|
623
|
+
inserted {
|
|
624
|
+
${A}
|
|
625
|
+
}
|
|
626
|
+
updated {
|
|
627
|
+
${A}
|
|
628
|
+
}
|
|
629
|
+
skipped
|
|
630
|
+
errors {
|
|
631
|
+
${le}
|
|
632
|
+
}
|
|
633
|
+
createdFields {
|
|
634
|
+
${ne}
|
|
635
|
+
}
|
|
636
|
+
stats {
|
|
637
|
+
${Ue}
|
|
638
|
+
}
|
|
639
|
+
`,ye=`
|
|
640
|
+
fileId
|
|
641
|
+
filename
|
|
642
|
+
file {
|
|
643
|
+
${S}
|
|
644
|
+
}
|
|
645
|
+
`,$=`
|
|
646
|
+
id
|
|
647
|
+
publisherId
|
|
648
|
+
publisher {
|
|
649
|
+
${g}
|
|
650
|
+
}
|
|
651
|
+
datasetId
|
|
652
|
+
dataset {
|
|
653
|
+
${p}
|
|
654
|
+
${D}
|
|
655
|
+
}
|
|
656
|
+
accountId
|
|
657
|
+
status
|
|
658
|
+
mode
|
|
659
|
+
onConflict
|
|
660
|
+
format
|
|
661
|
+
fileId
|
|
662
|
+
progress
|
|
663
|
+
totalRecords
|
|
664
|
+
processedRecords
|
|
665
|
+
insertedCount
|
|
666
|
+
updatedCount
|
|
667
|
+
skippedCount
|
|
668
|
+
failedCount
|
|
669
|
+
createdFields {
|
|
670
|
+
${ne}
|
|
671
|
+
}
|
|
672
|
+
errors {
|
|
673
|
+
${le}
|
|
674
|
+
}
|
|
675
|
+
errorMessage
|
|
676
|
+
assets {
|
|
677
|
+
${ye}
|
|
678
|
+
}
|
|
679
|
+
startedAt
|
|
680
|
+
completedAt
|
|
681
|
+
createdAt
|
|
682
|
+
updatedAt
|
|
683
|
+
lastCheckpointIndex
|
|
684
|
+
isResumed
|
|
685
|
+
imagesPending
|
|
686
|
+
imagesCompleted
|
|
687
|
+
imagesFailed
|
|
688
|
+
`,Fe=`
|
|
689
|
+
id
|
|
690
|
+
importJobId
|
|
691
|
+
level
|
|
692
|
+
message
|
|
693
|
+
datasetKey
|
|
694
|
+
recordIndex
|
|
695
|
+
fieldKey
|
|
696
|
+
details
|
|
697
|
+
createdAt
|
|
698
|
+
`,Pe=`
|
|
699
|
+
job {
|
|
700
|
+
${$}
|
|
701
|
+
}
|
|
702
|
+
dryRunResult {
|
|
703
|
+
${he}
|
|
704
|
+
}
|
|
705
|
+
`,Le=`
|
|
706
|
+
target
|
|
707
|
+
recordId
|
|
708
|
+
identifier
|
|
709
|
+
status
|
|
710
|
+
message
|
|
711
|
+
`,P=`
|
|
712
|
+
id
|
|
713
|
+
publisherId
|
|
714
|
+
publisher {
|
|
715
|
+
${g}
|
|
716
|
+
}
|
|
717
|
+
datasetId
|
|
718
|
+
dataset {
|
|
719
|
+
${p}
|
|
720
|
+
}
|
|
721
|
+
accountId
|
|
722
|
+
status
|
|
723
|
+
targetType
|
|
724
|
+
dryRun
|
|
725
|
+
targets
|
|
726
|
+
progress
|
|
727
|
+
totalTargets
|
|
728
|
+
processedTargets
|
|
729
|
+
matchedCount
|
|
730
|
+
deletedCount
|
|
731
|
+
missingCount
|
|
732
|
+
blockedCount
|
|
733
|
+
failedCount
|
|
734
|
+
results {
|
|
735
|
+
${Le}
|
|
736
|
+
}
|
|
737
|
+
errorMessage
|
|
738
|
+
startedAt
|
|
739
|
+
completedAt
|
|
740
|
+
createdAt
|
|
741
|
+
updatedAt
|
|
742
|
+
`,fe=`
|
|
743
|
+
sourceField
|
|
744
|
+
targetField
|
|
745
|
+
targetFieldLabel
|
|
746
|
+
inferredType
|
|
747
|
+
inferredItemType
|
|
748
|
+
inferredChildren {
|
|
749
|
+
key
|
|
750
|
+
label
|
|
751
|
+
type
|
|
752
|
+
required
|
|
753
|
+
itemType
|
|
754
|
+
children {
|
|
755
|
+
key
|
|
756
|
+
label
|
|
757
|
+
type
|
|
758
|
+
required
|
|
759
|
+
itemType
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
inferredLinkDataset
|
|
763
|
+
inferredLinkFieldKey
|
|
764
|
+
inferredLinkDirection
|
|
765
|
+
targetFieldType
|
|
766
|
+
sampleValues
|
|
767
|
+
status
|
|
768
|
+
`,L=`
|
|
769
|
+
datasetKey
|
|
770
|
+
field
|
|
771
|
+
message
|
|
772
|
+
severity
|
|
773
|
+
`,Be=`
|
|
774
|
+
datasetKey
|
|
775
|
+
datasetName
|
|
776
|
+
datasetId
|
|
777
|
+
exists
|
|
778
|
+
recordCount
|
|
779
|
+
fieldMappings {
|
|
780
|
+
${fe}
|
|
781
|
+
}
|
|
782
|
+
warnings {
|
|
783
|
+
${L}
|
|
784
|
+
}
|
|
785
|
+
canProceed
|
|
786
|
+
sampleRecords
|
|
787
|
+
availableDatasets {
|
|
788
|
+
${p}
|
|
789
|
+
${D}
|
|
790
|
+
}
|
|
791
|
+
`,_e=`
|
|
792
|
+
datasets {
|
|
793
|
+
datasetKey
|
|
794
|
+
datasetName
|
|
795
|
+
datasetId
|
|
796
|
+
exists
|
|
797
|
+
recordCount
|
|
798
|
+
fieldMappings {
|
|
799
|
+
${fe}
|
|
800
|
+
}
|
|
801
|
+
warnings {
|
|
802
|
+
${L}
|
|
803
|
+
}
|
|
804
|
+
sampleRecords
|
|
805
|
+
}
|
|
806
|
+
importOrder
|
|
807
|
+
warnings {
|
|
808
|
+
${L}
|
|
809
|
+
}
|
|
810
|
+
canProceed
|
|
811
|
+
`,Ve=`
|
|
812
|
+
datasetKey
|
|
813
|
+
datasetId
|
|
814
|
+
datasetName
|
|
815
|
+
status
|
|
816
|
+
recordCount
|
|
817
|
+
insertedCount
|
|
818
|
+
updatedCount
|
|
819
|
+
skippedCount
|
|
820
|
+
failedCount
|
|
821
|
+
errorMessage
|
|
822
|
+
`,v=`
|
|
823
|
+
id
|
|
824
|
+
publisherId
|
|
825
|
+
publisher {
|
|
826
|
+
${g}
|
|
827
|
+
}
|
|
828
|
+
gameId
|
|
829
|
+
game {
|
|
830
|
+
${f}
|
|
831
|
+
}
|
|
832
|
+
accountId
|
|
833
|
+
status
|
|
834
|
+
mode
|
|
835
|
+
onConflict
|
|
836
|
+
fileId
|
|
837
|
+
assets {
|
|
838
|
+
${ye}
|
|
839
|
+
}
|
|
840
|
+
totalDatasets
|
|
841
|
+
completedDatasets
|
|
842
|
+
progress
|
|
843
|
+
importOrder
|
|
844
|
+
datasetStatuses {
|
|
845
|
+
${Ve}
|
|
846
|
+
}
|
|
847
|
+
errorMessage
|
|
848
|
+
startedAt
|
|
849
|
+
completedAt
|
|
850
|
+
createdAt
|
|
851
|
+
updatedAt
|
|
852
|
+
completedDatasetKeys
|
|
853
|
+
currentDatasetKey
|
|
854
|
+
lastCheckpointIndex
|
|
855
|
+
isResumed
|
|
856
|
+
imagesPending
|
|
857
|
+
imagesCompleted
|
|
858
|
+
imagesFailed
|
|
859
|
+
phase
|
|
860
|
+
linkBuildingDataset
|
|
861
|
+
linkBuildingTotalDatasets
|
|
862
|
+
linkBuildingCompletedDatasets
|
|
863
|
+
linkBuildingProcessedRecords
|
|
864
|
+
linkBuildingTotalRecords
|
|
865
|
+
`,w=`
|
|
866
|
+
id
|
|
867
|
+
publisherId
|
|
868
|
+
publisher {
|
|
869
|
+
${g}
|
|
870
|
+
}
|
|
871
|
+
datasetId
|
|
872
|
+
dataset {
|
|
873
|
+
${p}
|
|
874
|
+
}
|
|
875
|
+
accountId
|
|
876
|
+
status
|
|
877
|
+
format
|
|
878
|
+
filter
|
|
879
|
+
totalRecords
|
|
880
|
+
processedRecords
|
|
881
|
+
progress
|
|
882
|
+
fileId
|
|
883
|
+
downloadUrl
|
|
884
|
+
downloadExpiresAt
|
|
885
|
+
errorMessage
|
|
886
|
+
startedAt
|
|
887
|
+
completedAt
|
|
888
|
+
createdAt
|
|
889
|
+
updatedAt
|
|
890
|
+
lastCheckpointIndex
|
|
891
|
+
`;function l(e){return `
|
|
220
892
|
totalCount
|
|
221
893
|
pageInfo {
|
|
222
894
|
hasNextPage
|
|
@@ -230,197 +902,660 @@ var $=class{storage;prefix;constructor(t={}){let r=t.storage??"localStorage";thi
|
|
|
230
902
|
${e}
|
|
231
903
|
}
|
|
232
904
|
}
|
|
233
|
-
`}var
|
|
905
|
+
`}var a={searchPublishers(e={}){let t={},r=[],s=[];e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
234
906
|
query SearchPublishers${i} {
|
|
235
907
|
searchPublishers${n} {
|
|
236
|
-
${
|
|
908
|
+
${l(g)}
|
|
237
909
|
}
|
|
238
910
|
}
|
|
239
911
|
`,variables:t}},fetchPublisherById(){return {query:`
|
|
240
912
|
query FetchPublisher($id: UUID!) {
|
|
241
913
|
fetchPublisher(id: $id) {
|
|
242
|
-
${
|
|
914
|
+
${g}
|
|
243
915
|
}
|
|
244
916
|
}
|
|
245
917
|
`}},fetchPublisherBySlug(){return {query:`
|
|
246
918
|
query FetchPublisher($slug: String!) {
|
|
247
919
|
fetchPublisher(slug: $slug) {
|
|
248
|
-
${
|
|
920
|
+
${g}
|
|
249
921
|
}
|
|
250
922
|
}
|
|
251
923
|
`}},fetchPublishers(){return {query:`
|
|
252
924
|
query FetchPublishers($slugs: [String!]!) {
|
|
253
925
|
fetchPublishers(slugs: $slugs) {
|
|
254
|
-
${
|
|
926
|
+
${g}
|
|
255
927
|
}
|
|
256
928
|
}
|
|
257
929
|
`}},searchGames(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
258
930
|
query SearchGames${i} {
|
|
259
931
|
searchGames${n} {
|
|
260
|
-
${f
|
|
932
|
+
${l(f)}
|
|
261
933
|
}
|
|
262
934
|
}
|
|
263
935
|
`,variables:t}},fetchGameById(){return {query:`
|
|
264
936
|
query FetchGame($id: UUID!) {
|
|
265
937
|
fetchGame(id: $id) {
|
|
266
|
-
${
|
|
938
|
+
${f}
|
|
267
939
|
}
|
|
268
940
|
}
|
|
269
941
|
`}},fetchGameByKeys(){return {query:`
|
|
270
942
|
query FetchGame($publisherSlug: String!, $gameKey: String!) {
|
|
271
943
|
fetchGame(publisherSlug: $publisherSlug, gameKey: $gameKey) {
|
|
272
|
-
${
|
|
944
|
+
${f}
|
|
273
945
|
}
|
|
274
946
|
}
|
|
275
947
|
`}},fetchGames(){return {query:`
|
|
276
948
|
query FetchGames($ids: [UUID!]!) {
|
|
277
949
|
fetchGames(ids: $ids) {
|
|
278
|
-
${
|
|
950
|
+
${f}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
`}},listGames(e){let t={publisherId:e.publisherId},r=["publisherId: $publisherId"],s=["$publisherId: 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),e.includeArchived!==void 0&&(s.push("$includeArchived: Boolean"),r.push("includeArchived: $includeArchived"),t.includeArchived=e.includeArchived),{query:`
|
|
954
|
+
query Games(${s.join(", ")}) {
|
|
955
|
+
games(${r.join(", ")}) {
|
|
956
|
+
${l(f)}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
`,variables:t}},game(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.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.gameSlug!==void 0&&(s.push("$gameSlug: String"),r.push("gameSlug: $gameSlug"),t.gameSlug=e.gameSlug),{query:`
|
|
960
|
+
query Game(${s.join(", ")}) {
|
|
961
|
+
game(${r.join(", ")}) {
|
|
962
|
+
${f}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
`,variables:t}},createGame(){return {query:`
|
|
966
|
+
mutation GameCreate($input: GameCreateInput!) {
|
|
967
|
+
gameCreate(input: $input) {
|
|
968
|
+
${f}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
`}},updateGame(){return {query:`
|
|
972
|
+
mutation GameUpdate($id: UUID!, $input: GameUpdateInput!) {
|
|
973
|
+
gameUpdate(id: $id, input: $input) {
|
|
974
|
+
${f}
|
|
279
975
|
}
|
|
280
976
|
}
|
|
281
977
|
`}},searchDatasets(e={}){let t={},r=[],s=[];e.publisherSlug!==void 0&&(s.push("$publisherSlug: String"),r.push("publisherSlug: $publisherSlug"),t.publisherSlug=e.publisherSlug),e.gameKey!==void 0&&(s.push("$gameKey: String"),r.push("gameKey: $gameKey"),t.gameKey=e.gameKey),e.search!==void 0&&(s.push("$search: String"),r.push("search: $search"),t.search=e.search),e.purpose!==void 0&&(s.push("$purpose: DatasetPurpose"),r.push("purpose: $purpose"),t.purpose=e.purpose),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
282
978
|
query SearchDatasets${i} {
|
|
283
979
|
searchDatasets${n} {
|
|
284
|
-
${
|
|
980
|
+
${l(p)}
|
|
285
981
|
}
|
|
286
982
|
}
|
|
287
983
|
`,variables:t}},fetchDatasetById(){return {query:`
|
|
288
984
|
query FetchDataset($id: UUID!) {
|
|
289
985
|
fetchDataset(id: $id) {
|
|
290
|
-
${
|
|
291
|
-
${
|
|
986
|
+
${p}
|
|
987
|
+
${D}
|
|
292
988
|
}
|
|
293
989
|
}
|
|
294
990
|
`}},fetchDatasetByKeys(){return {query:`
|
|
295
991
|
query FetchDataset($publisherSlug: String!, $gameKey: String!, $datasetKey: String!) {
|
|
296
992
|
fetchDataset(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey) {
|
|
297
|
-
${
|
|
298
|
-
${
|
|
993
|
+
${p}
|
|
994
|
+
${D}
|
|
299
995
|
}
|
|
300
996
|
}
|
|
301
997
|
`}},fetchDatasets(){return {query:`
|
|
302
998
|
query FetchDatasets($ids: [UUID!]!) {
|
|
303
999
|
fetchDatasets(ids: $ids) {
|
|
304
|
-
${
|
|
1000
|
+
${p}
|
|
305
1001
|
}
|
|
306
1002
|
}
|
|
307
|
-
`}},
|
|
308
|
-
${
|
|
1003
|
+
`}},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:`
|
|
1004
|
+
query Datasets(${s.join(", ")}) {
|
|
1005
|
+
datasets(${r.join(", ")}) {
|
|
1006
|
+
${l(`${p}
|
|
1007
|
+
${D}`)}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
`,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:`
|
|
1011
|
+
query Dataset(${s.join(", ")}) {
|
|
1012
|
+
dataset(${r.join(", ")}) {
|
|
1013
|
+
${p}
|
|
1014
|
+
${D}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
`,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}
|
|
1018
|
+
${te}`:n;return {query:`
|
|
309
1019
|
query SearchRecords(${s.join(", ")}) {
|
|
310
1020
|
searchRecords(${r.join(", ")}) {
|
|
311
|
-
${
|
|
1021
|
+
${l(c)}
|
|
312
1022
|
}
|
|
313
1023
|
}
|
|
314
1024
|
`,variables:t}},fetchRecordById(e={}){return {query:`
|
|
315
1025
|
query FetchRecord($id: UUID!) {
|
|
316
1026
|
fetchRecord(id: $id) {
|
|
317
|
-
${
|
|
1027
|
+
${k(e)}
|
|
318
1028
|
}
|
|
319
1029
|
}
|
|
320
1030
|
`}},fetchRecordByIdentifier(e={}){return {query:`
|
|
321
1031
|
query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) {
|
|
322
1032
|
fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) {
|
|
323
|
-
${
|
|
1033
|
+
${k(e)}
|
|
324
1034
|
}
|
|
325
1035
|
}
|
|
326
1036
|
`}},fetchRecordsByIdentifier(e={}){return {query:`
|
|
327
1037
|
query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) {
|
|
328
1038
|
fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) {
|
|
329
|
-
${
|
|
1039
|
+
${k(e)}
|
|
330
1040
|
}
|
|
331
1041
|
}
|
|
332
1042
|
`}},fetchRecords(e={}){return {query:`
|
|
333
1043
|
query FetchRecords($ids: [UUID!]!) {
|
|
334
1044
|
fetchRecords(ids: $ids) {
|
|
335
|
-
${
|
|
1045
|
+
${k(e)}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
`}},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:`
|
|
1049
|
+
query DatasetRecords(${s.join(", ")}) {
|
|
1050
|
+
datasetRecords(${r.join(", ")}) {
|
|
1051
|
+
${l(A)}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
`,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}
|
|
1055
|
+
${te}`:n;return {query:`
|
|
1056
|
+
query DatasetRecord(${s.join(", ")}) {
|
|
1057
|
+
datasetRecord(${r.join(", ")}) {
|
|
1058
|
+
${c}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
`,variables:t}},upsertDatasetRecords(){return {query:`
|
|
1062
|
+
mutation DatasetRecordsUpsert($input: DatasetRecordsUpsertInput!) {
|
|
1063
|
+
datasetRecordsUpsert(input: $input) {
|
|
1064
|
+
${Pe}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
`}},deleteDatasetRecords(){return {query:`
|
|
1068
|
+
mutation DatasetRecordsDelete($input: DatasetRecordsDeleteInput!) {
|
|
1069
|
+
datasetRecordsDelete(input: $input) {
|
|
1070
|
+
${P}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
`}},datasetRecordDeleteJob(){return {query:`
|
|
1074
|
+
query DatasetRecordDeleteJob($id: UUID!) {
|
|
1075
|
+
datasetRecordDeleteJob(id: $id) {
|
|
1076
|
+
${P}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
`}},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:`
|
|
1080
|
+
query DatasetRecordDeleteJobs(${s.join(", ")}) {
|
|
1081
|
+
datasetRecordDeleteJobs(${r.join(", ")}) {
|
|
1082
|
+
${l(P)}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
`,variables:t}},datasetImportPreview(){return {query:`
|
|
1086
|
+
query DatasetImportPreview($input: DatasetImportPreviewInput!) {
|
|
1087
|
+
datasetImportPreview(input: $input) {
|
|
1088
|
+
${Be}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
`}},datasetImportValidate(){return {query:`
|
|
1092
|
+
query DatasetImportValidate($input: DatasetImportValidateInput!) {
|
|
1093
|
+
datasetImportValidate(input: $input) {
|
|
1094
|
+
${he}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
`}},datasetImportFromFile(){return {query:`
|
|
1098
|
+
mutation DatasetImportFromFile($input: DatasetImportFromFileInput!) {
|
|
1099
|
+
datasetImportFromFile(input: $input) {
|
|
1100
|
+
${$}
|
|
336
1101
|
}
|
|
337
1102
|
}
|
|
338
|
-
`}},
|
|
1103
|
+
`}},datasetImportFromPayload(){return {query:`
|
|
1104
|
+
mutation DatasetImportFromPayload($input: DatasetImportFromPayloadInput!) {
|
|
1105
|
+
datasetImportFromPayload(input: $input) {
|
|
1106
|
+
${$}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
`}},datasetImportFromUrl(){return {query:`
|
|
1110
|
+
mutation DatasetImportFromUrl($input: DatasetImportFromUrlInput!) {
|
|
1111
|
+
datasetImportFromUrl(input: $input) {
|
|
1112
|
+
${$}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
`}},importJob(){return {query:`
|
|
1116
|
+
query ImportJob($id: UUID!) {
|
|
1117
|
+
importJob(id: $id) {
|
|
1118
|
+
${$}
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
`}},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:`
|
|
1122
|
+
query ImportJobs(${s.join(", ")}) {
|
|
1123
|
+
importJobs(${r.join(", ")}) {
|
|
1124
|
+
${l($)}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
`,variables:t}},importJobCancel(){return {query:`
|
|
1128
|
+
mutation ImportJobCancel($id: UUID!) {
|
|
1129
|
+
importJobCancel(id: $id) {
|
|
1130
|
+
${$}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
`}},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:`
|
|
1134
|
+
query ImportJobLogs(${i.join(", ")}) {
|
|
1135
|
+
importJob(${r.join(", ")}) {
|
|
1136
|
+
logs${n} {
|
|
1137
|
+
${l(Fe)}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
`,variables:t}},gameImportPreview(){return {query:`
|
|
1142
|
+
query GameImportPreview($input: GameImportPreviewInput!) {
|
|
1143
|
+
gameImportPreview(input: $input) {
|
|
1144
|
+
${_e}
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
`}},gameImportFromFile(){return {query:`
|
|
1148
|
+
mutation GameImportFromFile($input: GameImportFromFileInput!) {
|
|
1149
|
+
gameImportFromFile(input: $input) {
|
|
1150
|
+
${v}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
`}},gameImportFromPayload(){return {query:`
|
|
1154
|
+
mutation GameImportFromPayload($input: GameImportFromPayloadInput!) {
|
|
1155
|
+
gameImportFromPayload(input: $input) {
|
|
1156
|
+
${v}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
`}},gameImportFromUrl(){return {query:`
|
|
1160
|
+
mutation GameImportFromUrl($input: GameImportFromUrlInput!) {
|
|
1161
|
+
gameImportFromUrl(input: $input) {
|
|
1162
|
+
${v}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
`}},gameImportJob(){return {query:`
|
|
1166
|
+
query GameImportJob($id: UUID!) {
|
|
1167
|
+
gameImportJob(id: $id) {
|
|
1168
|
+
${v}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
`}},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:`
|
|
1172
|
+
query GameImportJobs(${s.join(", ")}) {
|
|
1173
|
+
gameImportJobs(${r.join(", ")}) {
|
|
1174
|
+
${l(v)}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
`,variables:t}},gameImportJobCancel(){return {query:`
|
|
1178
|
+
mutation GameImportJobCancel($id: UUID!) {
|
|
1179
|
+
gameImportJobCancel(id: $id) {
|
|
1180
|
+
${v}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
`}},file(){return {query:`
|
|
1184
|
+
query File($id: UUID!) {
|
|
1185
|
+
file(id: $id) {
|
|
1186
|
+
${S}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
`}},fileUploadRequest(){return {query:`
|
|
1190
|
+
mutation FileUploadRequest($input: FileUploadInput!) {
|
|
1191
|
+
fileUploadRequest(input: $input) {
|
|
1192
|
+
${ve}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
`}},fileUploadConfirm(){return {query:`
|
|
1196
|
+
mutation FileUploadConfirm($id: UUID!) {
|
|
1197
|
+
fileUploadConfirm(id: $id) {
|
|
1198
|
+
${S}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
`}},fileDelete(){return {query:`
|
|
1202
|
+
mutation FileDelete($id: UUID!) {
|
|
1203
|
+
fileDelete(id: $id)
|
|
1204
|
+
}
|
|
1205
|
+
`}},exportJob(){return {query:`
|
|
1206
|
+
query ExportJob($id: UUID!) {
|
|
1207
|
+
exportJob(id: $id) {
|
|
1208
|
+
${w}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
`}},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:`
|
|
1212
|
+
query ExportJobs(${s.join(", ")}) {
|
|
1213
|
+
exportJobs(${r.join(", ")}) {
|
|
1214
|
+
${l(w)}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
`,variables:t}},datasetExport(){return {query:`
|
|
1218
|
+
mutation DatasetExport($input: DatasetExportInput!) {
|
|
1219
|
+
datasetExport(input: $input) {
|
|
1220
|
+
${w}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
`}},exportJobCancel(){return {query:`
|
|
1224
|
+
mutation ExportJobCancel($id: UUID!) {
|
|
1225
|
+
exportJobCancel(id: $id) {
|
|
1226
|
+
${w}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
`}},exportJobRefreshUrl(){return {query:`
|
|
1230
|
+
mutation ExportJobRefreshUrl($id: UUID!) {
|
|
1231
|
+
exportJobRefreshUrl(id: $id) {
|
|
1232
|
+
${w}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
`}},listMyDecks(e={}){let t={},r=[],s=[];e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after),e.includeArchived!==void 0&&(s.push("$includeArchived: Boolean"),r.push("includeArchived: $includeArchived"),t.includeArchived=e.includeArchived);let i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
339
1236
|
query MyDecks${i} {
|
|
340
1237
|
myDecks${n} {
|
|
341
|
-
${
|
|
1238
|
+
${l(u)}
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
`,variables:t}},viewerDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: ViewerDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1242
|
+
query ViewerDecks${i} {
|
|
1243
|
+
viewerDecks${n} {
|
|
1244
|
+
${l(u)}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
`,variables:t}},appDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: AppDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1248
|
+
query AppDecks${i} {
|
|
1249
|
+
appDecks${n} {
|
|
1250
|
+
${l(u)}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
`,variables:t}},publicDecks(e={}){let t={},r=[],s=[];e.filter!==void 0&&(s.push("$filter: PublicDecksFilterInput"),r.push("filter: $filter"),t.filter=e.filter),e.first!==void 0&&(s.push("$first: Int"),r.push("first: $first"),t.first=e.first),e.after!==void 0&&(s.push("$after: String"),r.push("after: $after"),t.after=e.after);let i=s.length>0?`(${s.join(", ")})`:"",n=r.length>0?`(${r.join(", ")})`:"";return {query:`
|
|
1254
|
+
query PublicDecks${i} {
|
|
1255
|
+
publicDecks${n} {
|
|
1256
|
+
${l(u)}
|
|
342
1257
|
}
|
|
343
1258
|
}
|
|
344
1259
|
`,variables:t}},fetchDeckById(){return {query:`
|
|
345
1260
|
query FetchDeck($id: UUID!) {
|
|
346
1261
|
fetchDeck(id: $id) {
|
|
347
|
-
${
|
|
1262
|
+
${u}
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
`}},deckById(){return {query:`
|
|
1266
|
+
query Deck($id: UUID!) {
|
|
1267
|
+
deck(id: $id) {
|
|
1268
|
+
${u}
|
|
348
1269
|
}
|
|
349
1270
|
}
|
|
350
1271
|
`}},myDeck(){return {query:`
|
|
351
1272
|
query MyDeck($id: UUID!) {
|
|
352
1273
|
myDeck(id: $id) {
|
|
353
|
-
${
|
|
1274
|
+
${u}
|
|
354
1275
|
}
|
|
355
1276
|
}
|
|
356
1277
|
`}},fetchDeckBySlug(){return {query:`
|
|
357
1278
|
query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
|
|
358
1279
|
fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
|
|
359
|
-
${
|
|
1280
|
+
${u}
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
`}},deckBySlug(){return {query:`
|
|
1284
|
+
query DeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
|
|
1285
|
+
deckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
|
|
1286
|
+
${u}
|
|
360
1287
|
}
|
|
361
1288
|
}
|
|
362
1289
|
`}},fetchDeckByExternalRef(){return {query:`
|
|
363
1290
|
query FetchDeckByExternalRef($externalRef: String!) {
|
|
364
1291
|
fetchDeckByExternalRef(externalRef: $externalRef) {
|
|
365
|
-
${
|
|
1292
|
+
${u}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
`}},deckByExternalRef(){return {query:`
|
|
1296
|
+
query DeckByExternalRef($externalRef: String!) {
|
|
1297
|
+
deckByExternalRef(externalRef: $externalRef) {
|
|
1298
|
+
${u}
|
|
366
1299
|
}
|
|
367
1300
|
}
|
|
368
1301
|
`}},deckVersion(){return {query:`
|
|
369
1302
|
query DeckVersion($id: UUID!) {
|
|
370
1303
|
deckVersion(id: $id) {
|
|
371
|
-
${
|
|
1304
|
+
${R}
|
|
372
1305
|
}
|
|
373
1306
|
}
|
|
374
1307
|
`}},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:`
|
|
375
1308
|
query DeckVersions(${s.join(", ")}) {
|
|
376
1309
|
deckVersions(${r.join(", ")}) {
|
|
377
|
-
${
|
|
1310
|
+
${l(R)}
|
|
378
1311
|
}
|
|
379
1312
|
}
|
|
380
1313
|
`,variables:t}},deckPreview(){return {query:`
|
|
381
1314
|
query DeckPreview($token: String!) {
|
|
382
1315
|
deckPreview(token: $token) {
|
|
383
|
-
${
|
|
1316
|
+
${u}
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
`}},deckEmbed(){return {query:`
|
|
1320
|
+
query DeckEmbed($token: String!) {
|
|
1321
|
+
deckEmbed(token: $token) {
|
|
1322
|
+
${u}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
`}},deckAccess(){return {query:`
|
|
1326
|
+
query DeckAccess($token: String!) {
|
|
1327
|
+
deckAccess(token: $token) {
|
|
1328
|
+
${u}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
`}},deckDraftDiff(){return {query:`
|
|
1332
|
+
query DeckDraftDiff($id: UUID!) {
|
|
1333
|
+
deckDraftDiff(id: $id) {
|
|
1334
|
+
${W}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
`}},deckVersionDiff(){return {query:`
|
|
1338
|
+
query DeckVersionDiff($fromVersionId: UUID!, $toVersionId: UUID!) {
|
|
1339
|
+
deckVersionDiff(fromVersionId: $fromVersionId, toVersionId: $toVersionId) {
|
|
1340
|
+
${W}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
`}},deckHydrateEntries(){return {query:`
|
|
1344
|
+
query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
|
|
1345
|
+
deckHydrateEntries(input: $input) {
|
|
1346
|
+
${Se}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
`}},deckExport(){return {query:`
|
|
1350
|
+
query DeckExport($id: UUID!, $format: DeckExportFormat!) {
|
|
1351
|
+
deckExport(id: $id, format: $format) {
|
|
1352
|
+
${xe}
|
|
384
1353
|
}
|
|
385
1354
|
}
|
|
386
|
-
`}},
|
|
1355
|
+
`}},deckValidate(){return {query:`
|
|
1356
|
+
query DeckValidate($id: UUID!, $input: DeckValidateInput) {
|
|
1357
|
+
deckValidate(id: $id, input: $input) {
|
|
1358
|
+
${G}
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
`}},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:`
|
|
1362
|
+
query DeckSectionDefinitions${i} {
|
|
1363
|
+
deckSectionDefinitions${n} {
|
|
1364
|
+
${O}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
`,variables:t}},deckCollaborators(){return {query:`
|
|
387
1368
|
query DeckCollaborators($deckId: UUID!) {
|
|
388
1369
|
deckCollaborators(deckId: $deckId) {
|
|
389
|
-
${
|
|
1370
|
+
${Q}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
`}},deckEmbedTokens(){return {query:`
|
|
1374
|
+
query DeckEmbedTokens($deckId: UUID!) {
|
|
1375
|
+
deckEmbedTokens(deckId: $deckId) {
|
|
1376
|
+
${Z}
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
`}},deckAccessTokenIssuers(){return {query:`
|
|
1380
|
+
query DeckAccessTokenIssuers($deckId: UUID!) {
|
|
1381
|
+
deckAccessTokenIssuers(deckId: $deckId) {
|
|
1382
|
+
${T}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
`}},deckApiApplicationAccesses(){return {query:`
|
|
1386
|
+
query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) {
|
|
1387
|
+
deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) {
|
|
1388
|
+
${U}
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
`}},myDeckApiApplicationAccesses(){return {query:`
|
|
1392
|
+
query MyDeckApiApplicationAccesses($applicationId: UUID) {
|
|
1393
|
+
myDeckApiApplicationAccesses(applicationId: $applicationId) {
|
|
1394
|
+
${U}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
`}},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:`
|
|
1398
|
+
query DeckImportFormats${i} {
|
|
1399
|
+
deckImportFormats${n} {
|
|
1400
|
+
${l(I)}
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
`,variables:t}},deckImportFormat(){return {query:`
|
|
1404
|
+
query DeckImportFormat($id: UUID, $gameId: UUID, $key: String) {
|
|
1405
|
+
deckImportFormat(id: $id, gameId: $gameId, key: $key) {
|
|
1406
|
+
${I}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
`}},deckImportFormatTest(){return {query:`
|
|
1410
|
+
query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
|
|
1411
|
+
deckImportFormatTest(input: $input) {
|
|
1412
|
+
${Ee}
|
|
390
1413
|
}
|
|
391
1414
|
}
|
|
392
1415
|
`}},deckPreviewTokens(){return {query:`
|
|
393
1416
|
query DeckPreviewTokens($deckId: UUID!) {
|
|
394
1417
|
deckPreviewTokens(deckId: $deckId) {
|
|
395
|
-
${
|
|
1418
|
+
${z}
|
|
396
1419
|
}
|
|
397
1420
|
}
|
|
398
1421
|
`}},createDeck(){return {query:`
|
|
399
1422
|
mutation DeckCreate($input: DeckCreateInput!) {
|
|
400
1423
|
deckCreate(input: $input) {
|
|
401
|
-
${
|
|
1424
|
+
${u}
|
|
402
1425
|
}
|
|
403
1426
|
}
|
|
404
1427
|
`}},updateDeck(){return {query:`
|
|
405
1428
|
mutation DeckUpdate($id: UUID!, $input: DeckUpdateInput!) {
|
|
406
1429
|
deckUpdate(id: $id, input: $input) {
|
|
407
|
-
${
|
|
1430
|
+
${u}
|
|
408
1431
|
}
|
|
409
1432
|
}
|
|
410
1433
|
`}},deleteDeck(){return {query:`
|
|
411
1434
|
mutation DeckDelete($id: UUID!) {
|
|
412
1435
|
deckDelete(id: $id)
|
|
413
1436
|
}
|
|
1437
|
+
`}},archiveDeck(){return {query:`
|
|
1438
|
+
mutation DeckArchive($id: UUID!) {
|
|
1439
|
+
deckArchive(id: $id) {
|
|
1440
|
+
${u}
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
`}},restoreDeck(){return {query:`
|
|
1444
|
+
mutation DeckRestore($id: UUID!) {
|
|
1445
|
+
deckRestore(id: $id) {
|
|
1446
|
+
${u}
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
`}},unpublishDeck(){return {query:`
|
|
1450
|
+
mutation DeckUnpublish($id: UUID!) {
|
|
1451
|
+
deckUnpublish(id: $id) {
|
|
1452
|
+
${u}
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
`}},addDeckEntry(){return {query:`
|
|
1456
|
+
mutation DeckEntryAdd($input: DeckEntryAddInput!) {
|
|
1457
|
+
deckEntryAdd(input: $input) {
|
|
1458
|
+
${F}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
`}},updateDeckEntry(){return {query:`
|
|
1462
|
+
mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) {
|
|
1463
|
+
deckEntryUpdate(id: $id, input: $input) {
|
|
1464
|
+
${F}
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
`}},removeDeckEntry(){return {query:`
|
|
1468
|
+
mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) {
|
|
1469
|
+
deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) {
|
|
1470
|
+
${F}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
`}},reorderDeckEntries(){return {query:`
|
|
1474
|
+
mutation DeckEntryReorder($deckId: UUID!, $input: DeckEntryReorderInput!) {
|
|
1475
|
+
deckEntryReorder(deckId: $deckId, input: $input) {
|
|
1476
|
+
${de}
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
`}},replaceDeckEntries(){return {query:`
|
|
1480
|
+
mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
|
|
1481
|
+
deckEntriesReplace(deckId: $deckId, input: $input) {
|
|
1482
|
+
${Ke}
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
`}},importDeck(){return {query:`
|
|
1486
|
+
mutation DeckImport($input: DeckImportInput!) {
|
|
1487
|
+
deckImport(input: $input) {
|
|
1488
|
+
${Te}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
`}},createDeckImportFormat(){return {query:`
|
|
1492
|
+
mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
|
|
1493
|
+
deckImportFormatCreate(input: $input) {
|
|
1494
|
+
${I}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
`}},updateDeckImportFormat(){return {query:`
|
|
1498
|
+
mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
|
|
1499
|
+
deckImportFormatUpdate(id: $id, input: $input) {
|
|
1500
|
+
${I}
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
`}},archiveDeckImportFormat(){return {query:`
|
|
1504
|
+
mutation DeckImportFormatArchive($id: UUID!) {
|
|
1505
|
+
deckImportFormatArchive(id: $id) {
|
|
1506
|
+
${I}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
`}},unarchiveDeckImportFormat(){return {query:`
|
|
1510
|
+
mutation DeckImportFormatUnarchive($id: UUID!) {
|
|
1511
|
+
deckImportFormatUnarchive(id: $id) {
|
|
1512
|
+
${I}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
`}},upsertDeckByExternalRef(){return {query:`
|
|
1516
|
+
mutation DeckUpsertByExternalRef($input: DeckUpsertByExternalRefInput!) {
|
|
1517
|
+
deckUpsertByExternalRef(input: $input) {
|
|
1518
|
+
deck {
|
|
1519
|
+
${u}
|
|
1520
|
+
}
|
|
1521
|
+
created
|
|
1522
|
+
idempotentReplay
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
`}},claimDeck(){return {query:`
|
|
1526
|
+
mutation DeckClaim($id: UUID!, $input: DeckClaimInput!) {
|
|
1527
|
+
deckClaim(id: $id, input: $input) {
|
|
1528
|
+
${ee}
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
`}},transferDeckOwnership(){return {query:`
|
|
1532
|
+
mutation DeckTransferOwnership($id: UUID!, $input: DeckTransferOwnershipInput!) {
|
|
1533
|
+
deckTransferOwnership(id: $id, input: $input) {
|
|
1534
|
+
${ee}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
`}},copyDeck(){return {query:`
|
|
1538
|
+
mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
|
|
1539
|
+
deckCopy(id: $id, input: $input) {
|
|
1540
|
+
${Re}
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
414
1543
|
`}},publishDeck(){return {query:`
|
|
415
1544
|
mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
|
|
416
1545
|
deckPublish(id: $id, input: $input) {
|
|
417
|
-
${
|
|
1546
|
+
${Ce}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
`}},removeInvalidDeckEntries(){return {query:`
|
|
1550
|
+
mutation DeckRemoveInvalidEntries($id: UUID!, $input: DeckRemoveInvalidEntriesInput!) {
|
|
1551
|
+
deckRemoveInvalidEntries(id: $id, input: $input) {
|
|
1552
|
+
${u}
|
|
418
1553
|
}
|
|
419
1554
|
}
|
|
420
1555
|
`}},upsertDeckCollaborator(){return {query:`
|
|
421
1556
|
mutation DeckCollaboratorUpsert($deckId: UUID!, $accountId: UUID!, $role: DeckCollaboratorRole!) {
|
|
422
1557
|
deckCollaboratorUpsert(deckId: $deckId, accountId: $accountId, role: $role) {
|
|
423
|
-
${
|
|
1558
|
+
${Q}
|
|
424
1559
|
}
|
|
425
1560
|
}
|
|
426
1561
|
`}},removeDeckCollaborator(){return {query:`
|
|
@@ -432,7 +1567,7 @@ ${X}`:n;return {query:`
|
|
|
432
1567
|
deckPreviewTokenCreate(input: $input) {
|
|
433
1568
|
token
|
|
434
1569
|
previewToken {
|
|
435
|
-
${
|
|
1570
|
+
${z}
|
|
436
1571
|
}
|
|
437
1572
|
}
|
|
438
1573
|
}
|
|
@@ -440,7 +1575,59 @@ ${X}`:n;return {query:`
|
|
|
440
1575
|
mutation DeckPreviewTokenRevoke($id: UUID!) {
|
|
441
1576
|
deckPreviewTokenRevoke(id: $id)
|
|
442
1577
|
}
|
|
443
|
-
`}},
|
|
1578
|
+
`}},createDeckEmbedToken(){return {query:`
|
|
1579
|
+
mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) {
|
|
1580
|
+
deckEmbedTokenCreate(input: $input) {
|
|
1581
|
+
token
|
|
1582
|
+
embedToken {
|
|
1583
|
+
${Z}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
`}},revokeDeckEmbedToken(){return {query:`
|
|
1588
|
+
mutation DeckEmbedTokenRevoke($id: UUID!) {
|
|
1589
|
+
deckEmbedTokenRevoke(id: $id)
|
|
1590
|
+
}
|
|
1591
|
+
`}},createDeckAccessTokenIssuer(){return {query:`
|
|
1592
|
+
mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) {
|
|
1593
|
+
deckAccessTokenIssuerCreate(input: $input) {
|
|
1594
|
+
${T}
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
`}},revokeDeckAccessTokenIssuer(){return {query:`
|
|
1598
|
+
mutation DeckAccessTokenIssuerRevoke($id: UUID!) {
|
|
1599
|
+
deckAccessTokenIssuerRevoke(id: $id)
|
|
1600
|
+
}
|
|
1601
|
+
`}},revokeDeckAccessTokenIssuerSigningKey(){return {query:`
|
|
1602
|
+
mutation DeckAccessTokenIssuerSigningKeyRevoke($id: UUID!) {
|
|
1603
|
+
deckAccessTokenIssuerSigningKeyRevoke(id: $id) {
|
|
1604
|
+
${T}
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
`}},exchangeDeckAccessToken(){return {query:`
|
|
1608
|
+
mutation DeckAccessTokenExchange($input: DeckAccessTokenExchangeInput!) {
|
|
1609
|
+
deckAccessTokenExchange(input: $input) {
|
|
1610
|
+
token
|
|
1611
|
+
accessToken {
|
|
1612
|
+
${Ae}
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
`}},grantDeckApiApplicationAccess(){return {query:`
|
|
1617
|
+
mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
|
|
1618
|
+
deckApiApplicationAccessGrant(input: $input) {
|
|
1619
|
+
${U}
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
`}},revokeDeckApiApplicationAccess(){return {query:`
|
|
1623
|
+
mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
|
|
1624
|
+
deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
|
|
1625
|
+
}
|
|
1626
|
+
`}},revokeDeckAccessToken(){return {query:`
|
|
1627
|
+
mutation DeckAccessTokenRevoke($id: UUID!) {
|
|
1628
|
+
deckAccessTokenRevoke(id: $id)
|
|
1629
|
+
}
|
|
1630
|
+
`}},deckCreateVariables(e){return {input:e}},deckUpdateVariables(e,t){return {id:e,input:t}},deckEntryAddVariables(e){return {input:e}},deckEntryUpdateVariables(e,t){return {id:e,input:t}},deckEntryRemoveVariables(e,t){return {id:e,expectedDraftRevision:t}},deckEntryReorderVariables(e,t){return {deckId:e,input:t}},deckEntriesReplaceVariables(e,t){return {deckId:e,input:t}},deckImportVariables(e){return {input:e}},deckImportFormatCreateVariables(e){return {input:e}},deckImportFormatUpdateVariables(e,t){return {id:e,input:t}},deckImportFormatTestVariables(e){return {input:e}},deckUpsertByExternalRefVariables(e){return {input:e}},deckClaimVariables(e,t){return {id:e,input:t}},deckTransferOwnershipVariables(e,t){return {id:e,input:t}},deckCopyVariables(e,t){return {id:e,input:t}},deckPublishVariables(e,t){return {id:e,input:t}},deckValidateVariables(e,t){return t===void 0?{id:e}:{id:e,input:t}},deckRemoveInvalidEntriesVariables(e,t){return {id:e,input:t}},deckHydrateEntriesVariables(e){return {input:e}},deckExportVariables(e,t){return {id:e,format:t}},deckVersionDiffVariables(e,t){return {fromVersionId:e,toVersionId:t}},deckCollaboratorVariables(e,t,r){return r===void 0?{deckId:e,accountId:t}:{deckId:e,accountId:t,role:r}},deckPreviewTokenCreateVariables(e){return {input:e}},deckEmbedTokenCreateVariables(e){return {input:e}},deckAccessTokenIssuerCreateVariables(e){return {input:e}},deckAccessTokenExchangeVariables(e){return {input:e}},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}},datasetExportVariables(e){return {input:e}},fetchMe(){return {query:`
|
|
444
1631
|
query FetchMe {
|
|
445
1632
|
fetchMe {
|
|
446
1633
|
application {
|
|
@@ -462,6 +1649,6 @@ ${X}`:n;return {query:`
|
|
|
462
1649
|
}
|
|
463
1650
|
}
|
|
464
1651
|
}
|
|
465
|
-
`}}},h=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 Q="https://carddb.xtda.org/query",H=3e4,J=1e4,W=300,Y=3,z=2,Z=1e3,ee=3e4,te=class N{apiKey;endpoint;timeout;openTimeout;defaultPublisher;defaultGame;allowedPublishers;allowedGames;logger;logLevel;retryOnRateLimit;maxRetries;retryOnNetworkError;maxNetworkRetries;retryBaseDelay;retryMaxDelay;cache;cacheTtl;cacheTtls;constructor(t={}){this.apiKey=t.apiKey,this.endpoint=t.endpoint??Q,this.timeout=t.timeout??H,this.openTimeout=t.openTimeout??J,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??Y,this.retryOnNetworkError=t.retryOnNetworkError??true,this.maxNetworkRetries=t.maxNetworkRetries??z,this.retryBaseDelay=t.retryBaseDelay??Z,this.retryMaxDelay=t.retryMaxDelay??ee,this.cache=t.cache,this.cacheTtl=t.cacheTtl??W,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 S(`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 S(`Game '${r}' is not allowed for publisher '${t}'`)}validateAccess(t,r){t&&(this.validatePublisher(t),r&&this.validateGame(t,r));}shouldLog(t){let r={debug:0,info:1,warn:2,error:3};return r[t]>=r[this.logLevel]}merge(t){return new N({apiKey:t.apiKey??this.apiKey,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})}},G="0.1.0";function re(){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?se(navigator.userAgent):{name:"unknown",version:"unknown"}}function se(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 ie(){let e=re();return `CardDB-SDK/js/${G} (${e.name}/${e.version})`}function Xe(){return G}var M=null;function ne(){return M}var ae=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 a=await this.fetch(e,t),o=Date.now()-n,u=await this.handleResponse(a);return this.logResponse(r,o),u}catch(n){if(n instanceof p&&this.config.retryOnRateLimit&&s<this.config.maxRetries){s++;let a=n.retryAfter??60;this.logRateLimitRetry(r,s,a),await this.sleep(a*1e3);continue}if(this.isRetryableNetworkError(n)&&this.config.retryOnNetworkError&&i<this.config.maxNetworkRetries){let a=this.config.calculateRetryDelay(i);this.logNetworkRetry(r,i+1,a,n),i++,await this.sleep(a);continue}if(n instanceof I&&this.config.retryOnNetworkError&&i<this.config.maxNetworkRetries){let a=this.config.calculateRetryDelay(i);this.logNetworkRetry(r,i+1,a,n),i++,await this.sleep(a);continue}throw n}}isRetryableNetworkError(e){return e instanceof k||e instanceof x}async fetch(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(),this.config.timeout);try{return await fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":ie(),...this.config.apiKey?{"X-API-Key":this.config.apiKey}:{}},body:JSON.stringify({query:e,variables:t}),signal:r.signal})}catch(i){throw i instanceof Error?i.name==="AbortError"?(this.logError("Request timed out"),new x("Request timed out")):(this.logError(`Connection failed: ${i.message}`),new k(`Connection failed: ${i.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 D("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 I(`Server error (${e.status})`,{status:e.status,response:t})}throw new l(`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 D(s,t);case "RATE_LIMITED":throw new p(s,{response:t});case "NOT_FOUND":throw new l(s,t);case "VALIDATION_ERROR":case "BAD_USER_INPUT":throw new R(s,{errors:e,response:t});default:throw new B(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,a=await this.parseBody(e);throw new p("Rate limit exceeded",{retryAfter:t,limit:r,remaining:s,resetAt:n,response:a})}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;M={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 ce(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 oe(e,t){let r=e.get(t);return r}async function ue(e,t,r,s){let i=e.set(t,r,s);i instanceof Promise&&await i;}var g=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 a=await oe(n,e);if(a!==null)return a;let o=await s();if(o!=null){let u=this.config.cacheTtlFor(t);await ue(n,e,o,u);}return o}cacheKey(e,t,r){return ce(e,t,r)}},le=class extends g{constructor(e,t){super(e,t);}async search(e={}){let{query:t,variables:r}=c.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 h(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}=c.fetchPublisherById();return (await this.connection.execute(i,{id:e})).fetchPublisher??null}else {let{query:i}=c.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}=c.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)}},he=class extends g{constructor(e,t){super(e,t);}async search(e={}){let t=this.config.resolvePublisher(e.publisherSlug);t&&this.validateAccess(t);let{query:r,variables:s}=c.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 h(n,{nextPageLoader:async a=>this.search({...e,after:a})})}async get(e,t,r){if(typeof t=="string"){let s=e,i=t,n=r??{};this.validateAccess(s,i);let a=this.cacheKey("games","getByKeys",{publisherSlug:s,gameKey:i});return this.withCache(a,"games",n,async()=>{let{query:o}=c.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:a}=c.fetchGameById();return (await this.connection.execute(a,{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}=c.fetchGames();return (await this.connection.execute(s,{ids:e})).fetchGames??[]})}},de=class extends g{constructor(e,t){super(e,t);}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}=c.searchDatasets({publisherSlug:t,gameKey:r,search:e.search,purpose:e.purpose,first:e.first,after:e.after}),n=this.cacheKey("datasets","search",i),a=await this.withCache(n,"datasets",e,async()=>(await this.connection.execute(s,i)).searchDatasets);return new h(a,{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,a=s??{};this.validateAccess(i,n);let o=this.cacheKey("datasets","getByKeys",{publisherSlug:i,gameKey:n,datasetKey:r});return this.withCache(o,"datasets",a,async()=>{let{query:u}=c.fetchDatasetByKeys();return (await this.connection.execute(u,{publisherSlug:i,gameKey:n,datasetKey:r})).fetchDataset??null})}else {let i=e,n=t??{},a=this.cacheKey("datasets","get",{id:i});return this.withCache(a,"datasets",n,async()=>{let{query:o}=c.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}=c.fetchDatasets();return (await this.connection.execute(s,{ids:e})).fetchDatasets??[]})}},fe=class extends g{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}=c.fetchDeckById();return (await this.connection.execute(s,{id:e})).fetchDeck??null})}async fetchMine(e,t={}){let r=this.cacheKey("decks","fetchMine",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=c.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}=c.fetchDeckBySlug();return (await this.connection.execute(n,{publisherSlug:e,gameKey:t,slug:r})).fetchDeckBySlug??null})}async fetchByExternalRef(e,t={}){let r=this.cacheKey("decks","fetchByExternalRef",{externalRef:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=c.fetchDeckByExternalRef();return (await this.connection.execute(s,{externalRef:e})).fetchDeckByExternalRef??null})}async listMine(e={}){let{query:t,variables:r}=c.listMyDecks({first:e.first,after:e.after}),s=this.cacheKey("decks","listMine",r),i=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).myDecks);return new h(i,{nextPageLoader:async n=>this.listMine({...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}=c.deckVersion();return (await this.connection.execute(s,{id:e})).deckVersion??null})}async listVersions(e,t={}){let{query:r,variables:s}=c.deckVersions({first:t.first,after:t.after}),i={deckId:e,...s},n=this.cacheKey("decks","listVersions",i),a=await this.withCache(n,"decks",t,async()=>(await this.connection.execute(r,i)).deckVersions);return new h(a,{nextPageLoader:async o=>this.listVersions(e,{...t,after:o})})}async preview(e,t={}){let r=this.cacheKey("decks","preview",{token:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=c.deckPreview();return (await this.connection.execute(s,{token:e})).deckPreview??null})}async listCollaborators(e,t={}){let r=this.cacheKey("decks","listCollaborators",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=c.deckCollaborators();return (await this.connection.execute(s,{deckId:e})).deckCollaborators})}async listPreviewTokens(e,t={}){let r=this.cacheKey("decks","listPreviewTokens",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=c.deckPreviewTokens();return (await this.connection.execute(s,{deckId:e})).deckPreviewTokens})}async create(e){let{query:t}=c.createDeck(),r=c.deckCreateVariables(e);return (await this.connection.execute(t,r)).deckCreate}async update(e,t){let{query:r}=c.updateDeck(),s=c.deckUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckUpdate}async delete(e){let{query:t}=c.deleteDeck();return !!(await this.connection.execute(t,{id:e})).deckDelete}async publish(e,t={}){let{query:r}=c.publishDeck(),s=c.deckPublishVariables(e,t);return (await this.connection.execute(r,s)).deckPublish}async upsertCollaborator(e,t,r){let{query:s}=c.upsertDeckCollaborator(),i=c.deckCollaboratorVariables(e,t,r);return (await this.connection.execute(s,i)).deckCollaboratorUpsert}async removeCollaborator(e,t){let{query:r}=c.removeDeckCollaborator(),s=c.deckCollaboratorVariables(e,t);return !!(await this.connection.execute(r,s)).deckCollaboratorRemove}async createPreviewToken(e){let{query:t}=c.createDeckPreviewToken(),r=c.deckPreviewTokenCreateVariables(e);return (await this.connection.execute(t,r)).deckPreviewTokenCreate}async revokePreviewToken(e){let{query:t}=c.revokeDeckPreviewToken();return !!(await this.connection.execute(t,{id:e})).deckPreviewTokenRevoke}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}=c.fetchRecordsByIdentifier();return (await this.connection.execute(o,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:s})).fetchRecordsByIdentifier}),a=ye(n,s,e.identifierField);return e.entries.map(o=>({...o,record:a.get(o.identifier)??null}))}};function ye(e,t,r){let s=new Set(t),i=new Map;for(let n of e){let a=r?n.data[r]:Object.values(n.data).find(u=>s.has(String(u)));if(a==null)continue;let o=String(a);s.has(o)&&(i.set(o,n),s.delete(o));}return i}var ge=class extends g{constructor(e,t){super(e,t);}async search(e){let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=P(e.filter),{query:i,variables:n}=c.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}),a=this.cacheKey("records","search",{...n,includePricing:e.includePricing??false}),o=await this.withCache(a,"records",e,async()=>(await this.connection.execute(i,n)).searchRecords);return new h(o,{nextPageLoader:async u=>this.search({...e,after:u})})}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}=c.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}=c.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}=c.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}=c.fetchRecords({includePricing:t.includePricing});return (await this.connection.execute(s,{ids:e})).fetchRecords??[]})}},me=class extends g{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}=c.searchDatasets({publisherSlug:t,gameKey:r,search:e.search,purpose:"RULES",first:e.first,after:e.after}),n=this.cacheKey("rules","datasets",i),a=await this.withCache(n,"datasets",e,async()=>(await this.connection.execute(s,i)).searchDatasets);return new h(a,{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=P(t.filter),{query:a,variables:o}=c.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}),u=this.cacheKey("rules","records",o),E=await this.withCache(u,"records",t,async()=>(await this.connection.execute(a,o)).searchRecords);return new h(E,{nextPageLoader:async C=>this.searchRuleRecords(e,{...t,after:C})})}},Qe=class _{config;connection;publishers;games;datasets;records;decks;rules;constructor(t={}){this.config=new te(t),this.connection=new ae(this.config),this.publishers=new le(this.connection,this.config),this.games=new he(this.connection,this.config),this.datasets=new de(this.connection,this.config),this.records=new ge(this.connection,this.config),this.decks=new fe(this.connection,this.config),this.rules=new me(this.connection,this.config);}async me(){let{query:t}=c.fetchMe();return (await this.connection.execute(t)).fetchMe??null}getRateLimitInfo(){return ne()}withConfig(t){let r=this.config.merge(t);return new _({apiKey:r.apiKey,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})}};
|
|
466
|
-
export{
|
|
1652
|
+
`}}},d=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 Je="https://carddb.xtda.org/query",Oe=3e4,Ge=1e4,Me=300,Ne=3,je=2,Ye=1e3,He=3e4,Xe=class pe{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??Je,this.timeout=t.timeout??Oe,this.openTimeout=t.openTimeout??Ge,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??Ne,this.retryOnNetworkError=t.retryOnNetworkError??true,this.maxNetworkRetries=t.maxNetworkRetries??je,this.retryBaseDelay=t.retryBaseDelay??Ye,this.retryMaxDelay=t.retryMaxDelay??He,this.cache=t.cache,this.cacheTtl=t.cacheTtl??Me,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 b(`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 b(`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 b(`${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 pe({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})}},me="0.1.0";function We(){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?Qe(navigator.userAgent):{name:"unknown",version:"unknown"}}function Qe(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 ze(){let e=We();return `CardDB-SDK/js/${me} (${e.name}/${e.version})`}function Mt(){return me}var ge=null;function Ze(){return ge}var et=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 q&&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 J&&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 E||e instanceof V}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":ze(),...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 V("Request timed out")):(this.logError(`Connection failed: ${n.message}`),new E(`Connection failed: ${n.message}`)):new E("Connection failed")}finally{clearTimeout(s);}}async handleResponse(e){switch(this.extractRateLimitInfo(e),e.status){case 200:return this.handleSuccessResponse(e);case 401:throw new B("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 J(`Server error (${e.status})`,{status:e.status,response:t})}throw new y(`Unexpected response status: ${e.status}`)}}async handleSuccessResponse(e){let t=await this.parseBody(e);return t.errors&&t.errors.length>0&&this.handleGraphQLErrors(t.errors,t),t.data??{}}handleGraphQLErrors(e,t){let r=e[0],s=r.message||"GraphQL error";switch(r.extensions?.code){case "UNAUTHENTICATED":throw new B(s,t);case "RATE_LIMITED":throw new q(s,{response:t});case "NOT_FOUND":throw new y(s,t);case "VALIDATION_ERROR":case "BAD_USER_INPUT":throw new _(s,{errors:e,response:t});default:throw new se(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 q("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,{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;ge={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 tt(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 rt(e,t){let r=e.get(t);return r}async function st(e,t,r,s){let i=e.set(t,r,s);i instanceof Promise&&await i;}var m=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 rt(n,e);if(c!==null)return c;let o=await s();if(o!=null){let h=this.config.cacheTtlFor(t);await st(n,e,o,h);}return o}cacheKey(e,t,r){return tt(e,t,r)}},it=class extends m{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 d(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 m{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 d(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 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 d(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??[]})}},nt=class extends m{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 d(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 d(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??[]})}},ct=class extends m{constructor(e,t){super(e,t);}async fetch(e,t={}){let r=this.cacheKey("decks","fetch",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.fetchDeckById();return (await this.connection.execute(s,{id:e})).fetchDeck??null})}async get(e,t={}){let r=this.cacheKey("decks","get",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckById();return (await this.connection.execute(s,{id:e})).deck??null})}async fetchMine(e,t={}){let r=this.cacheKey("decks","fetchMine",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.myDeck();return (await this.connection.execute(s,{id:e})).myDeck??null})}async fetchBySlug(e,t,r,s={}){let i=this.cacheKey("decks","fetchBySlug",{publisherSlug:e,gameKey:t,slug:r});return this.withCache(i,"decks",s,async()=>{let{query:n}=a.fetchDeckBySlug();return (await this.connection.execute(n,{publisherSlug:e,gameKey:t,slug:r})).fetchDeckBySlug??null})}async getBySlug(e,t,r,s={}){let i=this.cacheKey("decks","getBySlug",{publisherSlug:e,gameKey:t,slug:r});return this.withCache(i,"decks",s,async()=>{let{query:n}=a.deckBySlug();return (await this.connection.execute(n,{publisherSlug:e,gameKey:t,slug:r})).deckBySlug??null})}async fetchByExternalRef(e,t={}){let r=this.cacheKey("decks","fetchByExternalRef",{externalRef:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.fetchDeckByExternalRef();return (await this.connection.execute(s,{externalRef:e})).fetchDeckByExternalRef??null})}async getByExternalRef(e,t={}){let r=this.cacheKey("decks","getByExternalRef",{externalRef:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckByExternalRef();return (await this.connection.execute(s,{externalRef:e})).deckByExternalRef??null})}async listMine(e={}){let{query:t,variables:r}=a.listMyDecks({first:e.first,after:e.after,includeArchived:e.includeArchived}),s=this.cacheKey("decks","listMine",r),i=await this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).myDecks);return new d(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 d(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 d(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 d(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 d(c,{nextPageLoader:async o=>this.listVersions(e,{...t,after:o})})}async preview(e,t={}){let r=this.cacheKey("decks","preview",{token:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckPreview();return (await this.connection.execute(s,{token:e})).deckPreview??null})}async embed(e,t={}){let r=this.cacheKey("decks","embed",{token:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckEmbed();return (await this.connection.execute(s,{token:e})).deckEmbed??null})}async access(e,t={}){let r=this.cacheKey("decks","access",{token:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckAccess();return (await this.connection.execute(s,{token:e})).deckAccess??null})}async draftDiff(e,t={}){let r=this.cacheKey("decks","draftDiff",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckDraftDiff();return (await this.connection.execute(s,{id:e})).deckDraftDiff})}async versionDiff(e,t,r={}){let s=a.deckVersionDiffVariables(e,t),i=this.cacheKey("decks","versionDiff",s);return this.withCache(i,"decks",r,async()=>{let{query:n}=a.deckVersionDiff();return (await this.connection.execute(n,s)).deckVersionDiff})}async validate(e,t,r={}){let s=a.deckValidateVariables(e,t),i=this.cacheKey("decks","validate",s);return this.withCache(i,"decks",r,async()=>{let{query:n}=a.deckValidate();return (await this.connection.execute(n,s)).deckValidate})}async hydrateDeckEntries(e,t={}){let r=a.deckHydrateEntriesVariables(e),s=this.cacheKey("decks","hydrateDeckEntries",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckHydrateEntries();return (await this.connection.execute(i,r)).deckHydrateEntries})}async exportDeck(e,t="SIMPLE_TEXT",r={}){let s=a.deckExportVariables(e,t),i=this.cacheKey("decks","exportDeck",s);return this.withCache(i,"decks",r,async()=>{let{query:n}=a.deckExport();return (await this.connection.execute(n,s)).deckExport})}async sectionDefinitions(e={}){let{query:t,variables:r}=a.deckSectionDefinitions({publisherSlug:e.publisherSlug,gameKey:e.gameKey,gameId:e.gameId,rulesetKey:e.rulesetKey,rulesetVersionId:e.rulesetVersionId}),s=this.cacheKey("decks","sectionDefinitions",r);return this.withCache(s,"decks",e,async()=>(await this.connection.execute(t,r)).deckSectionDefinitions)}async listCollaborators(e,t={}){let r=this.cacheKey("decks","listCollaborators",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckCollaborators();return (await this.connection.execute(s,{deckId:e})).deckCollaborators})}async listPreviewTokens(e,t={}){let r=this.cacheKey("decks","listPreviewTokens",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckPreviewTokens();return (await this.connection.execute(s,{deckId:e})).deckPreviewTokens})}async listEmbedTokens(e,t={}){let r=this.cacheKey("decks","listEmbedTokens",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckEmbedTokens();return (await this.connection.execute(s,{deckId:e})).deckEmbedTokens})}async listAccessTokenIssuers(e,t={}){let r=this.cacheKey("decks","listAccessTokenIssuers",{deckId:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckAccessTokenIssuers();return (await this.connection.execute(s,{deckId:e})).deckAccessTokenIssuers})}async listApiApplicationAccesses(e,t={}){let r=a.deckApiApplicationAccessesVariables(e,t.includeRevoked),s=this.cacheKey("decks","listApiApplicationAccesses",r);return this.withCache(s,"decks",t,async()=>{let{query:i}=a.deckApiApplicationAccesses();return (await this.connection.execute(i,r)).deckApiApplicationAccesses})}async listMyApiApplicationAccesses(e={}){let t=a.myDeckApiApplicationAccessesVariables(e.applicationId),r=this.cacheKey("decks","listMyApiApplicationAccesses",t);return this.withCache(r,"decks",e,async()=>{let{query:s}=a.myDeckApiApplicationAccesses();return (await this.connection.execute(s,t)).myDeckApiApplicationAccesses})}async create(e){let{query:t}=a.createDeck(),r=a.deckCreateVariables(e);return (await this.connection.execute(t,r)).deckCreate}async update(e,t){let{query:r}=a.updateDeck(),s=a.deckUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckUpdate}async updateMetadata(e,t){return this.update(e,t)}async upsertByExternalRef(e){this.config.requireSecretCredential("decks.upsertByExternalRef");let{query:t}=a.upsertDeckByExternalRef(),r=a.deckUpsertByExternalRefVariables(e);return (await this.connection.execute(t,r)).deckUpsertByExternalRef}async claim(e,t){let{query:r}=a.claimDeck(),s=a.deckClaimVariables(e,t);return (await this.connection.execute(r,s)).deckClaim}async transferOwnership(e,t){let{query:r}=a.transferDeckOwnership(),s=a.deckTransferOwnershipVariables(e,t);return (await this.connection.execute(r,s)).deckTransferOwnership}async copy(e,t){let{query:r}=a.copyDeck(),s=a.deckCopyVariables(e,t);return (await this.connection.execute(r,s)).deckCopy}async addEntry(e){let{query:t}=a.addDeckEntry(),r=a.deckEntryAddVariables(e);return (await this.connection.execute(t,r)).deckEntryAdd}async updateEntry(e,t){let{query:r}=a.updateDeckEntry(),s=a.deckEntryUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckEntryUpdate}async removeEntry(e,t){let{query:r}=a.removeDeckEntry(),s=a.deckEntryRemoveVariables(e,t);return (await this.connection.execute(r,s)).deckEntryRemove}async reorderEntries(e,t){let{query:r}=a.reorderDeckEntries(),s=a.deckEntryReorderVariables(e,t);return (await this.connection.execute(r,s)).deckEntryReorder}async replaceEntries(e,t){let{query:r}=a.replaceDeckEntries(),s=a.deckEntriesReplaceVariables(e,t);return (await this.connection.execute(r,s)).deckEntriesReplace}async importDeck(e){let{query:t}=a.importDeck(),r=a.deckImportVariables(e);return (await this.connection.execute(t,r)).deckImport}async listImportFormats(e,t={}){let{query:r,variables:s}=a.deckImportFormats({gameId:e,includeArchived:t.includeArchived,first:t.first,after:t.after}),i=this.cacheKey("decks","listImportFormats",s),n=await this.withCache(i,"decks",t,async()=>(await this.connection.execute(r,s)).deckImportFormats);return new d(n,{nextPageLoader:async c=>this.listImportFormats(e,{...t,after:c})})}async fetchImportFormat(e,t={}){let r=this.cacheKey("decks","fetchImportFormat",{id:e});return this.withCache(r,"decks",t,async()=>{let{query:s}=a.deckImportFormat();return (await this.connection.execute(s,{id:e})).deckImportFormat??null})}async testImportFormat(e){let{query:t}=a.deckImportFormatTest(),r=a.deckImportFormatTestVariables(e);return (await this.connection.execute(t,r)).deckImportFormatTest}async createImportFormat(e){let{query:t}=a.createDeckImportFormat(),r=a.deckImportFormatCreateVariables(e);return (await this.connection.execute(t,r)).deckImportFormatCreate}async updateImportFormat(e,t){let{query:r}=a.updateDeckImportFormat(),s=a.deckImportFormatUpdateVariables(e,t);return (await this.connection.execute(r,s)).deckImportFormatUpdate}async archiveImportFormat(e){let{query:t}=a.archiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatArchive}async unarchiveImportFormat(e){let{query:t}=a.unarchiveDeckImportFormat();return (await this.connection.execute(t,{id:e})).deckImportFormatUnarchive}async delete(e){let{query:t}=a.deleteDeck();return !!(await this.connection.execute(t,{id:e})).deckDelete}async archive(e){let{query:t}=a.archiveDeck();return (await this.connection.execute(t,{id:e})).deckArchive}async restore(e){let{query:t}=a.restoreDeck();return (await this.connection.execute(t,{id:e})).deckRestore}async unpublish(e){let{query:t}=a.unpublishDeck();return (await this.connection.execute(t,{id:e})).deckUnpublish}async publish(e,t){let{query:r}=a.publishDeck(),s=a.deckPublishVariables(e,t);return (await this.connection.execute(r,s)).deckPublish}async removeInvalidEntries(e,t){let{query:r}=a.removeInvalidDeckEntries(),s=a.deckRemoveInvalidEntriesVariables(e,t);return (await this.connection.execute(r,s)).deckRemoveInvalidEntries}async upsertCollaborator(e,t,r){let{query:s}=a.upsertDeckCollaborator(),i=a.deckCollaboratorVariables(e,t,r);return (await this.connection.execute(s,i)).deckCollaboratorUpsert}async removeCollaborator(e,t){let{query:r}=a.removeDeckCollaborator(),s=a.deckCollaboratorVariables(e,t);return !!(await this.connection.execute(r,s)).deckCollaboratorRemove}async createPreviewToken(e){let{query:t}=a.createDeckPreviewToken(),r=a.deckPreviewTokenCreateVariables(e);return (await this.connection.execute(t,r)).deckPreviewTokenCreate}async revokePreviewToken(e){let{query:t}=a.revokeDeckPreviewToken();return !!(await this.connection.execute(t,{id:e})).deckPreviewTokenRevoke}async createEmbedToken(e){let{query:t}=a.createDeckEmbedToken(),r=a.deckEmbedTokenCreateVariables(e);return (await this.connection.execute(t,r)).deckEmbedTokenCreate}async revokeEmbedToken(e){let{query:t}=a.revokeDeckEmbedToken();return !!(await this.connection.execute(t,{id:e})).deckEmbedTokenRevoke}async createAccessTokenIssuer(e){let{query:t}=a.createDeckAccessTokenIssuer(),r=a.deckAccessTokenIssuerCreateVariables(e);return (await this.connection.execute(t,r)).deckAccessTokenIssuerCreate}async revokeAccessTokenIssuer(e){let{query:t}=a.revokeDeckAccessTokenIssuer();return !!(await this.connection.execute(t,{id:e})).deckAccessTokenIssuerRevoke}async revokeAccessTokenIssuerSigningKey(e){let{query:t}=a.revokeDeckAccessTokenIssuerSigningKey();return (await this.connection.execute(t,{id:e})).deckAccessTokenIssuerSigningKeyRevoke}async grantApiApplicationAccess(e){let{query:t}=a.grantDeckApiApplicationAccess(),r=a.deckApiApplicationAccessGrantVariables(e);return (await this.connection.execute(t,r)).deckApiApplicationAccessGrant}async revokeApiApplicationAccess(e,t){let{query:r}=a.revokeDeckApiApplicationAccess(),s=a.deckApiApplicationAccessRevokeVariables(e,t);return !!(await this.connection.execute(r,s)).deckApiApplicationAccessRevoke}async exchangeAccessToken(e){this.config.requireSecretCredential("decks.exchangeAccessToken");let{query:t}=a.exchangeDeckAccessToken(),r=a.deckAccessTokenExchangeVariables(e);return (await this.connection.execute(t,r)).deckAccessTokenExchange}async revokeAccessToken(e){this.config.requireSecretCredential("decks.revokeAccessToken");let{query:t}=a.revokeDeckAccessToken();return !!(await this.connection.execute(t,{id:e})).deckAccessTokenRevoke}async hydrateEntries(e){if(e.entries.length===0)return [];let t=this.resolvePublisher(e.publisherSlug),r=this.resolveGame(e.gameKey);this.validateAccess(t,r);let s=e.entries.map(o=>o.identifier),i=this.cacheKey("decks","hydrateEntries",{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:s}),n=await this.withCache(i,"decks",e,async()=>{let{query:o}=a.fetchRecordsByIdentifier();return (await this.connection.execute(o,{publisherSlug:t,gameKey:r,datasetKey:e.datasetKey,identifiers:s})).fetchRecordsByIdentifier}),c=ot(n,s,e.identifierField);return e.entries.map(o=>({...o,record:c.get(o.identifier)??null}))}};function ot(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 ut=class extends m{constructor(e,t){super(e,t);}async list(e){let t=C(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 d(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 d(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=C(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 d(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??[]})}},dt=class extends m{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 d(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=C(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),H=await this.withCache(h,"records",t,async()=>(await this.connection.execute(c,o)).searchRecords);return new d(H,{nextPageLoader:async X=>this.searchRuleRecords(e,{...t,after:X})})}},lt=class extends m{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 d(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}},ht=class extends m{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 d(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??yt());return new d(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 d(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 yt(){return {totalCount:0,pageInfo:{hasNextPage:false,hasPreviousPage:false,startCursor:null,endCursor:null},edges:[]}}var ft=class extends m{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 d(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 m{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 delete(e){this.config.requireSecretCredential("files.delete");let{query:t}=a.fileDelete();return !!(await this.connection.execute(t,{id:e})).fileDelete}},ke=class Ie{config;connection;publishers;games;datasets;records;decks;rules;importFormats;imports;exports;files;constructor(t={}){this.config=new Xe(t),this.connection=new et(this.config),this.publishers=new it(this.connection,this.config),this.games=new at(this.connection,this.config),this.datasets=new nt(this.connection,this.config),this.records=new ut(this.connection,this.config),this.decks=new ct(this.connection,this.config),this.rules=new dt(this.connection,this.config),this.importFormats=new lt(this.connection,this.config),this.imports=new ht(this.connection,this.config),this.exports=new ft(this.connection,this.config),this.files=new pt(this.connection,this.config);}async me(){let{query:t}=a.fetchMe();return (await this.connection.execute(t)).fetchMe??null}getRateLimitInfo(){return Ze()}withConfig(t){let r=this.config.merge(t);return new Ie({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 Y=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 $e=class extends ke{constructor(t={}){if("apiKey"in t&&t.apiKey!==void 0)throw new b("apiKey is not accepted in browsers; use publishableKey or accessToken");if("secretKey"in t&&t.secretKey!==void 0)throw new b("secretKey is server-only; use publishableKey or accessToken in browsers");super(t);}};
|
|
1653
|
+
export{B as AuthenticationError,m as BaseResource,Y as BrowserCache,$e as CardDBClient,y as CardDBError,d as Collection,Xe as Configuration,et as Connection,E as ConnectionError,Me as DEFAULT_CACHE_TTL,Je as DEFAULT_ENDPOINT,je as DEFAULT_MAX_NETWORK_RETRIES,Ne as DEFAULT_MAX_RETRIES,Ge as DEFAULT_OPEN_TIMEOUT,Ye as DEFAULT_RETRY_BASE_DELAY,He as DEFAULT_RETRY_MAX_DELAY,Oe as DEFAULT_TIMEOUT,nt as DatasetsResource,ct as DecksResource,ft as ExportsResource,pt as FilesResource,be as FilterBuilder,at as GamesResource,se as GraphQLError,lt as ImportFormatsResource,ht as ImportsResource,gt as LinkResolutionError,mt as NotFoundError,it as PublishersResource,a as QueryBuilder,q as RateLimitError,ut as RecordsResource,b as RestrictedError,dt as RulesResource,J as ServerError,V as TimeoutError,_ as ValidationError,tt as cacheKey,Et as contains,kt as eq,Ze as getRateLimitInfo,Mt as getSDKVersion,ze as getUserAgent,$t as gt,bt as gte,xt as ilike,qt as isNotNull,Rt as isNull,St as like,vt as lt,Dt as lte,It as neq,At as notWithin,rt as readCache,C as resolveFilter,wt as within,st as writeCache};//# sourceMappingURL=index.js.map
|
|
467
1654
|
//# sourceMappingURL=index.js.map
|