@carddb/core 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -301,6 +301,7 @@ var DATASET_FIELDS = `
301
301
  name
302
302
  description
303
303
  purpose
304
+ tcgplayerProductIdFieldKey
304
305
  visibility
305
306
  isArchived
306
307
  createdAt
@@ -354,19 +355,112 @@ var SCHEMA_FIELDS = `
354
355
  }
355
356
  }
356
357
  `;
357
- var RECORD_FIELDS = `
358
+ var TCGPLAYER_PRICING_FIELDS = `
359
+ pricing {
360
+ productId
361
+ prices {
362
+ subTypeName
363
+ lowPrice
364
+ midPrice
365
+ highPrice
366
+ marketPrice
367
+ directLowPrice
368
+ }
369
+ }
370
+ `;
371
+ function recordFields(options = {}) {
372
+ return `
373
+ id
374
+ datasetId
375
+ data
376
+ ${options.includePricing ? TCGPLAYER_PRICING_FIELDS : ""}
377
+ createdAt
378
+ updatedAt
379
+ dataset {
380
+ id
381
+ key
382
+ name
383
+ gameId
384
+ publisherId
385
+ }
386
+ `;
387
+ }
388
+ var RECORD_FIELDS = recordFields();
389
+ var DECK_SECTION_DEFINITION_FIELDS = `
390
+ key
391
+ label
392
+ description
393
+ order
394
+ default
395
+ aliases
396
+ minCards
397
+ maxCards
398
+ excludedFromDeckSize
399
+ legalCardTypes
400
+ metadata
401
+ `;
402
+ var DECK_ENTRY_FIELDS = `
358
403
  id
359
404
  datasetId
360
- data
361
- createdAt
362
- updatedAt
363
- dataset {
364
- id
365
- key
366
- name
367
- gameId
368
- publisherId
405
+ recordId
406
+ identifier
407
+ quantity
408
+ section
409
+ sortOrder
410
+ annotations
411
+ display
412
+ record {
413
+ ${RECORD_FIELDS}
414
+ }
415
+ `;
416
+ var DECK_VALIDATED_AGAINST_FIELDS = `
417
+ rulesetId
418
+ rulesetVersionId
419
+ rulesetVersionLabel
420
+ cardDatasetId
421
+ cardDatasetVersionId
422
+ validatedAt
423
+ validationResultSummary
424
+ `;
425
+ var DECK_VALIDATION_ISSUE_FIELDS = `
426
+ code
427
+ severity
428
+ message
429
+ entryIds
430
+ section
431
+ datasetId
432
+ identifier
433
+ metadata
434
+ `;
435
+ var DECK_VALIDATION_FIELDS = `
436
+ deckId
437
+ valid
438
+ blockers {
439
+ ${DECK_VALIDATION_ISSUE_FIELDS}
440
+ }
441
+ warnings {
442
+ ${DECK_VALIDATION_ISSUE_FIELDS}
443
+ }
444
+ affectedEntries {
445
+ entryId
446
+ datasetId
447
+ recordId
448
+ identifier
449
+ section
450
+ quantity
451
+ }
452
+ validatedAgainst {
453
+ ${DECK_VALIDATED_AGAINST_FIELDS}
369
454
  }
455
+ checkedAt
456
+ `;
457
+ var DECK_DIFF_FIELDS = `
458
+ deckId
459
+ fromVersionId
460
+ toVersionId
461
+ toDraftRevision
462
+ hasChanges
463
+ diff
370
464
  `;
371
465
  var DECK_VERSION_FIELDS = `
372
466
  id
@@ -383,21 +477,23 @@ var DECK_VERSION_FIELDS = `
383
477
  metadata
384
478
  publishNote
385
479
  computedDiff
480
+ rulesetId
481
+ rulesetVersionId
482
+ cardDatasetId
483
+ cardDatasetVersionId
484
+ validatedAt
485
+ validationSummary
486
+ validatedAgainst {
487
+ ${DECK_VALIDATED_AGAINST_FIELDS}
488
+ }
489
+ sectionDefinitions {
490
+ ${DECK_SECTION_DEFINITION_FIELDS}
491
+ }
386
492
  publishedByAccountId
387
493
  publishedByApiApplicationId
388
494
  createdAt
389
495
  entries {
390
- id
391
- datasetId
392
- recordId
393
- identifier
394
- quantity
395
- section
396
- sortOrder
397
- annotations
398
- record {
399
- ${RECORD_FIELDS}
400
- }
496
+ ${DECK_ENTRY_FIELDS}
401
497
  }
402
498
  `;
403
499
  var DECK_COLLABORATOR_FIELDS = `
@@ -419,8 +515,156 @@ var DECK_PREVIEW_TOKEN_FIELDS = `
419
515
  createdAt
420
516
  updatedAt
421
517
  `;
518
+ var DECK_EMBED_TOKEN_FIELDS = `
519
+ id
520
+ deckId
521
+ apiApplicationId
522
+ label
523
+ readMode
524
+ allowedOrigins
525
+ externalSubject
526
+ expiresAt
527
+ revokedAt
528
+ lastUsedAt
529
+ createdAt
530
+ updatedAt
531
+ `;
532
+ var DECK_ACCESS_TOKEN_ISSUER_FIELDS = `
533
+ id
534
+ deckId
535
+ apiApplicationId
536
+ label
537
+ readModes
538
+ maxTokenLifetimeSeconds
539
+ directSigningAlg
540
+ directSigningKeyId
541
+ directSigningPublicKey
542
+ directSigningKeyRevokedAt
543
+ revokedAt
544
+ createdAt
545
+ updatedAt
546
+ `;
547
+ var DECK_ACCESS_TOKEN_FIELDS = `
548
+ id
549
+ deckId
550
+ apiApplicationId
551
+ issuerId
552
+ readMode
553
+ externalSubject
554
+ expiresAt
555
+ revokedAt
556
+ lastUsedAt
557
+ createdAt
558
+ updatedAt
559
+ `;
560
+ var DECK_IMPORT_ENTRY_FIELDS = `
561
+ lineNumber
562
+ raw
563
+ datasetKey
564
+ datasetId
565
+ recordId
566
+ identifier
567
+ quantity
568
+ section
569
+ sortOrder
570
+ display
571
+ record {
572
+ ${RECORD_FIELDS}
573
+ }
574
+ `;
575
+ var DECK_IMPORT_ISSUE_FIELDS = `
576
+ lineNumber
577
+ raw
578
+ code
579
+ message
580
+ `;
581
+ var DECK_IMPORT_UNMATCHED_FIELDS = `
582
+ lineNumber
583
+ raw
584
+ datasetKey
585
+ identifier
586
+ quantity
587
+ section
588
+ code
589
+ message
590
+ `;
591
+ var DECK_IMPORT_AMBIGUOUS_FIELDS = `
592
+ lineNumber
593
+ raw
594
+ datasetKey
595
+ identifier
596
+ quantity
597
+ section
598
+ candidates {
599
+ recordId
600
+ identifier
601
+ display
602
+ }
603
+ `;
604
+ var DECK_IMPORT_FORMAT_DEFINITION_FIELDS = `
605
+ id
606
+ gameId
607
+ key
608
+ name
609
+ description
610
+ enabled
611
+ priority
612
+ datasetKey
613
+ config
614
+ archivedAt
615
+ isArchived
616
+ createdAt
617
+ updatedAt
618
+ `;
619
+ var DECK_IMPORT_FORMAT_DETECTION_FIELDS = `
620
+ formatId
621
+ key
622
+ name
623
+ confidence
624
+ reason
625
+ `;
626
+ var DECK_IMPORT_FORMAT_TEST_PAYLOAD_FIELDS = `
627
+ detection {
628
+ ${DECK_IMPORT_FORMAT_DETECTION_FIELDS}
629
+ }
630
+ entries {
631
+ ${DECK_IMPORT_ENTRY_FIELDS}
632
+ }
633
+ parseErrors {
634
+ ${DECK_IMPORT_ISSUE_FIELDS}
635
+ }
636
+ unmatched {
637
+ ${DECK_IMPORT_UNMATCHED_FIELDS}
638
+ }
639
+ ambiguous {
640
+ ${DECK_IMPORT_AMBIGUOUS_FIELDS}
641
+ }
642
+ `;
643
+ var DECK_HYDRATE_ENTRIES_PAYLOAD_FIELDS = `
644
+ entries {
645
+ ${DECK_IMPORT_ENTRY_FIELDS}
646
+ }
647
+ unmatched {
648
+ ${DECK_IMPORT_UNMATCHED_FIELDS}
649
+ }
650
+ ambiguous {
651
+ ${DECK_IMPORT_AMBIGUOUS_FIELDS}
652
+ }
653
+ `;
654
+ var DECK_EXPORT_PAYLOAD_FIELDS = `
655
+ deckId
656
+ format
657
+ text
658
+ entryCount
659
+ `;
422
660
  var DECK_FIELDS = `
423
661
  id
662
+ ownerType
663
+ ownerAccountId
664
+ ownerApiApplicationId
665
+ environment
666
+ createdByAccountId
667
+ createdByApiApplicationId
424
668
  accountId
425
669
  apiApplicationId
426
670
  gameId
@@ -430,13 +674,29 @@ var DECK_FIELDS = `
430
674
  description
431
675
  formatKey
432
676
  visibility
677
+ accessMode
678
+ discoverability
679
+ state
680
+ archivedAt
681
+ deletedAt
682
+ unpublishedAt
683
+ externalRefApiApplicationId
433
684
  externalRef
685
+ externalSubjectRef
686
+ rulesetId
434
687
  sourceUrl
435
688
  metadata
689
+ sectionDefinitions {
690
+ ${DECK_SECTION_DEFINITION_FIELDS}
691
+ }
436
692
  latestPublishedVersion {
437
693
  ${DECK_VERSION_FIELDS}
438
694
  }
439
695
  publishedAt
696
+ draftRevision
697
+ draftUpdatedAt
698
+ draftUpdatedByAccountId
699
+ draftUpdatedByApiApplicationId
440
700
  hasUnpublishedChanges
441
701
  createdAt
442
702
  updatedAt
@@ -444,17 +704,109 @@ var DECK_FIELDS = `
444
704
  ${GAME_FIELDS}
445
705
  }
446
706
  entries {
447
- id
448
- datasetId
449
- recordId
450
- identifier
451
- quantity
452
- section
453
- sortOrder
454
- annotations
455
- record {
456
- ${RECORD_FIELDS}
457
- }
707
+ ${DECK_ENTRY_FIELDS}
708
+ }
709
+ `;
710
+ var DECK_OWNERSHIP_TRANSFER_PAYLOAD_FIELDS = `
711
+ deck {
712
+ ${DECK_FIELDS}
713
+ }
714
+ retainedAppAccess
715
+ `;
716
+ var DECK_COPY_PAYLOAD_FIELDS = `
717
+ deck {
718
+ ${DECK_FIELDS}
719
+ }
720
+ copiedFromDeckId
721
+ retainedAppAccess
722
+ `;
723
+ var DECK_ACCESS_APPLICATION_FIELDS = `
724
+ id
725
+ name
726
+ description
727
+ revokedAt
728
+ `;
729
+ var DECK_API_APPLICATION_ACCESS_FIELDS = `
730
+ id
731
+ deckId
732
+ deck {
733
+ ${DECK_FIELDS}
734
+ }
735
+ apiApplicationId
736
+ apiApplication {
737
+ ${DECK_ACCESS_APPLICATION_FIELDS}
738
+ }
739
+ role
740
+ grantSource
741
+ externalRef
742
+ createdByAccountId
743
+ createdByApiApplicationId
744
+ revokedAt
745
+ createdAt
746
+ updatedAt
747
+ `;
748
+ var DECK_PUBLISH_PAYLOAD_FIELDS = `
749
+ deck {
750
+ ${DECK_FIELDS}
751
+ }
752
+ version {
753
+ ${DECK_VERSION_FIELDS}
754
+ }
755
+ validation {
756
+ ${DECK_VALIDATION_FIELDS}
757
+ }
758
+ blockers {
759
+ ${DECK_VALIDATION_ISSUE_FIELDS}
760
+ }
761
+ warnings {
762
+ ${DECK_VALIDATION_ISSUE_FIELDS}
763
+ }
764
+ `;
765
+ var DECK_ENTRY_MUTATION_PAYLOAD_FIELDS = `
766
+ deck {
767
+ ${DECK_FIELDS}
768
+ }
769
+ entry {
770
+ ${DECK_ENTRY_FIELDS}
771
+ }
772
+ `;
773
+ var DECK_ENTRY_REORDER_PAYLOAD_FIELDS = `
774
+ deck {
775
+ ${DECK_FIELDS}
776
+ }
777
+ entries {
778
+ ${DECK_ENTRY_FIELDS}
779
+ }
780
+ `;
781
+ var DECK_ENTRIES_REPLACE_PAYLOAD_FIELDS = DECK_ENTRY_REORDER_PAYLOAD_FIELDS;
782
+ var DECK_IMPORT_PAYLOAD_FIELDS = `
783
+ deck {
784
+ ${DECK_FIELDS}
785
+ }
786
+ applied
787
+ dryRun
788
+ replace
789
+ format
790
+ importFormat {
791
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
792
+ }
793
+ detection {
794
+ ${DECK_IMPORT_FORMAT_DETECTION_FIELDS}
795
+ }
796
+ entries {
797
+ ${DECK_IMPORT_ENTRY_FIELDS}
798
+ }
799
+ parseErrors {
800
+ ${DECK_IMPORT_ISSUE_FIELDS}
801
+ }
802
+ unmatched {
803
+ ${DECK_IMPORT_UNMATCHED_FIELDS}
804
+ }
805
+ ambiguous {
806
+ ${DECK_IMPORT_AMBIGUOUS_FIELDS}
807
+ }
808
+ validation {
809
+ ${DECK_VALIDATION_FIELDS}
458
810
  }
459
811
  `;
460
812
  var RESOLVED_LINKS_FIELDS = `
@@ -756,8 +1108,9 @@ var QueryBuilder = {
756
1108
  variables["validateSchema"] = params.validateSchema;
757
1109
  }
758
1110
  const includeResolvedLinks = params.resolveLinks && params.resolveLinks.length > 0;
759
- const nodeFields = includeResolvedLinks ? `${RECORD_FIELDS}
760
- ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
1111
+ const selectedRecordFields = recordFields({ includePricing: params.includePricing });
1112
+ const nodeFields = includeResolvedLinks ? `${selectedRecordFields}
1113
+ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
761
1114
  return {
762
1115
  query: `
763
1116
  query SearchRecords(${defs.join(", ")}) {
@@ -769,45 +1122,45 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
769
1122
  variables
770
1123
  };
771
1124
  },
772
- fetchRecordById() {
1125
+ fetchRecordById(params = {}) {
773
1126
  return {
774
1127
  query: `
775
1128
  query FetchRecord($id: UUID!) {
776
1129
  fetchRecord(id: $id) {
777
- ${RECORD_FIELDS}
1130
+ ${recordFields(params)}
778
1131
  }
779
1132
  }
780
1133
  `
781
1134
  };
782
1135
  },
783
- fetchRecordByIdentifier() {
1136
+ fetchRecordByIdentifier(params = {}) {
784
1137
  return {
785
1138
  query: `
786
1139
  query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) {
787
1140
  fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) {
788
- ${RECORD_FIELDS}
1141
+ ${recordFields(params)}
789
1142
  }
790
1143
  }
791
1144
  `
792
1145
  };
793
1146
  },
794
- fetchRecordsByIdentifier() {
1147
+ fetchRecordsByIdentifier(params = {}) {
795
1148
  return {
796
1149
  query: `
797
1150
  query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) {
798
1151
  fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) {
799
- ${RECORD_FIELDS}
1152
+ ${recordFields(params)}
800
1153
  }
801
1154
  }
802
1155
  `
803
1156
  };
804
1157
  },
805
- fetchRecords() {
1158
+ fetchRecords(params = {}) {
806
1159
  return {
807
1160
  query: `
808
1161
  query FetchRecords($ids: [UUID!]!) {
809
1162
  fetchRecords(ids: $ids) {
810
- ${RECORD_FIELDS}
1163
+ ${recordFields(params)}
811
1164
  }
812
1165
  }
813
1166
  `
@@ -828,6 +1181,11 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
828
1181
  args.push("after: $after");
829
1182
  variables["after"] = params.after;
830
1183
  }
1184
+ if (params.includeArchived !== void 0) {
1185
+ defs.push("$includeArchived: Boolean");
1186
+ args.push("includeArchived: $includeArchived");
1187
+ variables["includeArchived"] = params.includeArchived;
1188
+ }
831
1189
  const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
832
1190
  const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
833
1191
  return {
@@ -841,44 +1199,173 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
841
1199
  variables
842
1200
  };
843
1201
  },
844
- fetchDeckById() {
1202
+ viewerDecks(params = {}) {
1203
+ const variables = {};
1204
+ const args = [];
1205
+ const defs = [];
1206
+ if (params.filter !== void 0) {
1207
+ defs.push("$filter: ViewerDecksFilterInput");
1208
+ args.push("filter: $filter");
1209
+ variables["filter"] = params.filter;
1210
+ }
1211
+ if (params.first !== void 0) {
1212
+ defs.push("$first: Int");
1213
+ args.push("first: $first");
1214
+ variables["first"] = params.first;
1215
+ }
1216
+ if (params.after !== void 0) {
1217
+ defs.push("$after: String");
1218
+ args.push("after: $after");
1219
+ variables["after"] = params.after;
1220
+ }
1221
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1222
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
845
1223
  return {
846
1224
  query: `
847
- query FetchDeck($id: UUID!) {
848
- fetchDeck(id: $id) {
849
- ${DECK_FIELDS}
1225
+ query ViewerDecks${defStr} {
1226
+ viewerDecks${argStr} {
1227
+ ${connectionFields(DECK_FIELDS)}
850
1228
  }
851
1229
  }
852
- `
1230
+ `,
1231
+ variables
853
1232
  };
854
1233
  },
855
- myDeck() {
1234
+ appDecks(params = {}) {
1235
+ const variables = {};
1236
+ const args = [];
1237
+ const defs = [];
1238
+ if (params.filter !== void 0) {
1239
+ defs.push("$filter: AppDecksFilterInput");
1240
+ args.push("filter: $filter");
1241
+ variables["filter"] = params.filter;
1242
+ }
1243
+ if (params.first !== void 0) {
1244
+ defs.push("$first: Int");
1245
+ args.push("first: $first");
1246
+ variables["first"] = params.first;
1247
+ }
1248
+ if (params.after !== void 0) {
1249
+ defs.push("$after: String");
1250
+ args.push("after: $after");
1251
+ variables["after"] = params.after;
1252
+ }
1253
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1254
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
856
1255
  return {
857
1256
  query: `
858
- query MyDeck($id: UUID!) {
859
- myDeck(id: $id) {
860
- ${DECK_FIELDS}
1257
+ query AppDecks${defStr} {
1258
+ appDecks${argStr} {
1259
+ ${connectionFields(DECK_FIELDS)}
861
1260
  }
862
1261
  }
863
- `
1262
+ `,
1263
+ variables
864
1264
  };
865
1265
  },
866
- fetchDeckBySlug() {
1266
+ publicDecks(params = {}) {
1267
+ const variables = {};
1268
+ const args = [];
1269
+ const defs = [];
1270
+ if (params.filter !== void 0) {
1271
+ defs.push("$filter: PublicDecksFilterInput");
1272
+ args.push("filter: $filter");
1273
+ variables["filter"] = params.filter;
1274
+ }
1275
+ if (params.first !== void 0) {
1276
+ defs.push("$first: Int");
1277
+ args.push("first: $first");
1278
+ variables["first"] = params.first;
1279
+ }
1280
+ if (params.after !== void 0) {
1281
+ defs.push("$after: String");
1282
+ args.push("after: $after");
1283
+ variables["after"] = params.after;
1284
+ }
1285
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1286
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
867
1287
  return {
868
1288
  query: `
869
- query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
870
- fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
871
- ${DECK_FIELDS}
1289
+ query PublicDecks${defStr} {
1290
+ publicDecks${argStr} {
1291
+ ${connectionFields(DECK_FIELDS)}
872
1292
  }
873
1293
  }
874
- `
1294
+ `,
1295
+ variables
875
1296
  };
876
1297
  },
877
- fetchDeckByExternalRef() {
1298
+ fetchDeckById() {
878
1299
  return {
879
1300
  query: `
880
- query FetchDeckByExternalRef($externalRef: String!) {
881
- fetchDeckByExternalRef(externalRef: $externalRef) {
1301
+ query FetchDeck($id: UUID!) {
1302
+ fetchDeck(id: $id) {
1303
+ ${DECK_FIELDS}
1304
+ }
1305
+ }
1306
+ `
1307
+ };
1308
+ },
1309
+ deckById() {
1310
+ return {
1311
+ query: `
1312
+ query Deck($id: UUID!) {
1313
+ deck(id: $id) {
1314
+ ${DECK_FIELDS}
1315
+ }
1316
+ }
1317
+ `
1318
+ };
1319
+ },
1320
+ myDeck() {
1321
+ return {
1322
+ query: `
1323
+ query MyDeck($id: UUID!) {
1324
+ myDeck(id: $id) {
1325
+ ${DECK_FIELDS}
1326
+ }
1327
+ }
1328
+ `
1329
+ };
1330
+ },
1331
+ fetchDeckBySlug() {
1332
+ return {
1333
+ query: `
1334
+ query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
1335
+ fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
1336
+ ${DECK_FIELDS}
1337
+ }
1338
+ }
1339
+ `
1340
+ };
1341
+ },
1342
+ deckBySlug() {
1343
+ return {
1344
+ query: `
1345
+ query DeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
1346
+ deckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
1347
+ ${DECK_FIELDS}
1348
+ }
1349
+ }
1350
+ `
1351
+ };
1352
+ },
1353
+ fetchDeckByExternalRef() {
1354
+ return {
1355
+ query: `
1356
+ query FetchDeckByExternalRef($externalRef: String!) {
1357
+ fetchDeckByExternalRef(externalRef: $externalRef) {
1358
+ ${DECK_FIELDS}
1359
+ }
1360
+ }
1361
+ `
1362
+ };
1363
+ },
1364
+ deckByExternalRef() {
1365
+ return {
1366
+ query: `
1367
+ query DeckByExternalRef($externalRef: String!) {
1368
+ deckByExternalRef(externalRef: $externalRef) {
882
1369
  ${DECK_FIELDS}
883
1370
  }
884
1371
  }
@@ -932,6 +1419,125 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
932
1419
  `
933
1420
  };
934
1421
  },
1422
+ deckEmbed() {
1423
+ return {
1424
+ query: `
1425
+ query DeckEmbed($token: String!) {
1426
+ deckEmbed(token: $token) {
1427
+ ${DECK_FIELDS}
1428
+ }
1429
+ }
1430
+ `
1431
+ };
1432
+ },
1433
+ deckAccess() {
1434
+ return {
1435
+ query: `
1436
+ query DeckAccess($token: String!) {
1437
+ deckAccess(token: $token) {
1438
+ ${DECK_FIELDS}
1439
+ }
1440
+ }
1441
+ `
1442
+ };
1443
+ },
1444
+ deckDraftDiff() {
1445
+ return {
1446
+ query: `
1447
+ query DeckDraftDiff($id: UUID!) {
1448
+ deckDraftDiff(id: $id) {
1449
+ ${DECK_DIFF_FIELDS}
1450
+ }
1451
+ }
1452
+ `
1453
+ };
1454
+ },
1455
+ deckVersionDiff() {
1456
+ return {
1457
+ query: `
1458
+ query DeckVersionDiff($fromVersionId: UUID!, $toVersionId: UUID!) {
1459
+ deckVersionDiff(fromVersionId: $fromVersionId, toVersionId: $toVersionId) {
1460
+ ${DECK_DIFF_FIELDS}
1461
+ }
1462
+ }
1463
+ `
1464
+ };
1465
+ },
1466
+ deckHydrateEntries() {
1467
+ return {
1468
+ query: `
1469
+ query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
1470
+ deckHydrateEntries(input: $input) {
1471
+ ${DECK_HYDRATE_ENTRIES_PAYLOAD_FIELDS}
1472
+ }
1473
+ }
1474
+ `
1475
+ };
1476
+ },
1477
+ deckExport() {
1478
+ return {
1479
+ query: `
1480
+ query DeckExport($id: UUID!, $format: DeckExportFormat!) {
1481
+ deckExport(id: $id, format: $format) {
1482
+ ${DECK_EXPORT_PAYLOAD_FIELDS}
1483
+ }
1484
+ }
1485
+ `
1486
+ };
1487
+ },
1488
+ deckValidate() {
1489
+ return {
1490
+ query: `
1491
+ query DeckValidate($id: UUID!, $input: DeckValidateInput) {
1492
+ deckValidate(id: $id, input: $input) {
1493
+ ${DECK_VALIDATION_FIELDS}
1494
+ }
1495
+ }
1496
+ `
1497
+ };
1498
+ },
1499
+ deckSectionDefinitions(params = {}) {
1500
+ const variables = {};
1501
+ const args = [];
1502
+ const defs = [];
1503
+ if (params.publisherSlug !== void 0) {
1504
+ defs.push("$publisherSlug: String");
1505
+ args.push("publisherSlug: $publisherSlug");
1506
+ variables["publisherSlug"] = params.publisherSlug;
1507
+ }
1508
+ if (params.gameKey !== void 0) {
1509
+ defs.push("$gameKey: String");
1510
+ args.push("gameKey: $gameKey");
1511
+ variables["gameKey"] = params.gameKey;
1512
+ }
1513
+ if (params.gameId !== void 0) {
1514
+ defs.push("$gameId: UUID");
1515
+ args.push("gameId: $gameId");
1516
+ variables["gameId"] = params.gameId;
1517
+ }
1518
+ if (params.rulesetKey !== void 0) {
1519
+ defs.push("$rulesetKey: String");
1520
+ args.push("rulesetKey: $rulesetKey");
1521
+ variables["rulesetKey"] = params.rulesetKey;
1522
+ }
1523
+ if (params.rulesetVersionId !== void 0) {
1524
+ defs.push("$rulesetVersionId: UUID");
1525
+ args.push("rulesetVersionId: $rulesetVersionId");
1526
+ variables["rulesetVersionId"] = params.rulesetVersionId;
1527
+ }
1528
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1529
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
1530
+ return {
1531
+ query: `
1532
+ query DeckSectionDefinitions${defStr} {
1533
+ deckSectionDefinitions${argStr} {
1534
+ ${DECK_SECTION_DEFINITION_FIELDS}
1535
+ }
1536
+ }
1537
+ `,
1538
+ variables
1539
+ };
1540
+ },
935
1541
  deckCollaborators() {
936
1542
  return {
937
1543
  query: `
@@ -943,6 +1549,102 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
943
1549
  `
944
1550
  };
945
1551
  },
1552
+ deckEmbedTokens() {
1553
+ return {
1554
+ query: `
1555
+ query DeckEmbedTokens($deckId: UUID!) {
1556
+ deckEmbedTokens(deckId: $deckId) {
1557
+ ${DECK_EMBED_TOKEN_FIELDS}
1558
+ }
1559
+ }
1560
+ `
1561
+ };
1562
+ },
1563
+ deckAccessTokenIssuers() {
1564
+ return {
1565
+ query: `
1566
+ query DeckAccessTokenIssuers($deckId: UUID!) {
1567
+ deckAccessTokenIssuers(deckId: $deckId) {
1568
+ ${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
1569
+ }
1570
+ }
1571
+ `
1572
+ };
1573
+ },
1574
+ deckApiApplicationAccesses() {
1575
+ return {
1576
+ query: `
1577
+ query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) {
1578
+ deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) {
1579
+ ${DECK_API_APPLICATION_ACCESS_FIELDS}
1580
+ }
1581
+ }
1582
+ `
1583
+ };
1584
+ },
1585
+ myDeckApiApplicationAccesses() {
1586
+ return {
1587
+ query: `
1588
+ query MyDeckApiApplicationAccesses($applicationId: UUID) {
1589
+ myDeckApiApplicationAccesses(applicationId: $applicationId) {
1590
+ ${DECK_API_APPLICATION_ACCESS_FIELDS}
1591
+ }
1592
+ }
1593
+ `
1594
+ };
1595
+ },
1596
+ deckImportFormats(params) {
1597
+ const variables = { gameId: params.gameId };
1598
+ const args = ["gameId: $gameId"];
1599
+ const defs = ["$gameId: UUID!"];
1600
+ if (params.includeArchived !== void 0) {
1601
+ defs.push("$includeArchived: Boolean");
1602
+ args.push("includeArchived: $includeArchived");
1603
+ variables["includeArchived"] = params.includeArchived;
1604
+ }
1605
+ if (params.first !== void 0) {
1606
+ defs.push("$first: Int");
1607
+ args.push("first: $first");
1608
+ variables["first"] = params.first;
1609
+ }
1610
+ if (params.after !== void 0) {
1611
+ defs.push("$after: String");
1612
+ args.push("after: $after");
1613
+ variables["after"] = params.after;
1614
+ }
1615
+ return {
1616
+ query: `
1617
+ query DeckImportFormats(${defs.join(", ")}) {
1618
+ deckImportFormats(${args.join(", ")}) {
1619
+ ${connectionFields(DECK_IMPORT_FORMAT_DEFINITION_FIELDS)}
1620
+ }
1621
+ }
1622
+ `,
1623
+ variables
1624
+ };
1625
+ },
1626
+ deckImportFormat() {
1627
+ return {
1628
+ query: `
1629
+ query DeckImportFormat($id: UUID!) {
1630
+ deckImportFormat(id: $id) {
1631
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1632
+ }
1633
+ }
1634
+ `
1635
+ };
1636
+ },
1637
+ deckImportFormatTest() {
1638
+ return {
1639
+ query: `
1640
+ query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
1641
+ deckImportFormatTest(input: $input) {
1642
+ ${DECK_IMPORT_FORMAT_TEST_PAYLOAD_FIELDS}
1643
+ }
1644
+ }
1645
+ `
1646
+ };
1647
+ },
946
1648
  deckPreviewTokens() {
947
1649
  return {
948
1650
  query: `
@@ -985,12 +1687,214 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
985
1687
  `
986
1688
  };
987
1689
  },
1690
+ archiveDeck() {
1691
+ return {
1692
+ query: `
1693
+ mutation DeckArchive($id: UUID!) {
1694
+ deckArchive(id: $id) {
1695
+ ${DECK_FIELDS}
1696
+ }
1697
+ }
1698
+ `
1699
+ };
1700
+ },
1701
+ restoreDeck() {
1702
+ return {
1703
+ query: `
1704
+ mutation DeckRestore($id: UUID!) {
1705
+ deckRestore(id: $id) {
1706
+ ${DECK_FIELDS}
1707
+ }
1708
+ }
1709
+ `
1710
+ };
1711
+ },
1712
+ unpublishDeck() {
1713
+ return {
1714
+ query: `
1715
+ mutation DeckUnpublish($id: UUID!) {
1716
+ deckUnpublish(id: $id) {
1717
+ ${DECK_FIELDS}
1718
+ }
1719
+ }
1720
+ `
1721
+ };
1722
+ },
1723
+ addDeckEntry() {
1724
+ return {
1725
+ query: `
1726
+ mutation DeckEntryAdd($input: DeckEntryAddInput!) {
1727
+ deckEntryAdd(input: $input) {
1728
+ ${DECK_ENTRY_MUTATION_PAYLOAD_FIELDS}
1729
+ }
1730
+ }
1731
+ `
1732
+ };
1733
+ },
1734
+ updateDeckEntry() {
1735
+ return {
1736
+ query: `
1737
+ mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) {
1738
+ deckEntryUpdate(id: $id, input: $input) {
1739
+ ${DECK_ENTRY_MUTATION_PAYLOAD_FIELDS}
1740
+ }
1741
+ }
1742
+ `
1743
+ };
1744
+ },
1745
+ removeDeckEntry() {
1746
+ return {
1747
+ query: `
1748
+ mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) {
1749
+ deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) {
1750
+ ${DECK_ENTRY_MUTATION_PAYLOAD_FIELDS}
1751
+ }
1752
+ }
1753
+ `
1754
+ };
1755
+ },
1756
+ reorderDeckEntries() {
1757
+ return {
1758
+ query: `
1759
+ mutation DeckEntryReorder($deckId: UUID!, $input: DeckEntryReorderInput!) {
1760
+ deckEntryReorder(deckId: $deckId, input: $input) {
1761
+ ${DECK_ENTRY_REORDER_PAYLOAD_FIELDS}
1762
+ }
1763
+ }
1764
+ `
1765
+ };
1766
+ },
1767
+ replaceDeckEntries() {
1768
+ return {
1769
+ query: `
1770
+ mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
1771
+ deckEntriesReplace(deckId: $deckId, input: $input) {
1772
+ ${DECK_ENTRIES_REPLACE_PAYLOAD_FIELDS}
1773
+ }
1774
+ }
1775
+ `
1776
+ };
1777
+ },
1778
+ importDeck() {
1779
+ return {
1780
+ query: `
1781
+ mutation DeckImport($input: DeckImportInput!) {
1782
+ deckImport(input: $input) {
1783
+ ${DECK_IMPORT_PAYLOAD_FIELDS}
1784
+ }
1785
+ }
1786
+ `
1787
+ };
1788
+ },
1789
+ createDeckImportFormat() {
1790
+ return {
1791
+ query: `
1792
+ mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
1793
+ deckImportFormatCreate(input: $input) {
1794
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1795
+ }
1796
+ }
1797
+ `
1798
+ };
1799
+ },
1800
+ updateDeckImportFormat() {
1801
+ return {
1802
+ query: `
1803
+ mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
1804
+ deckImportFormatUpdate(id: $id, input: $input) {
1805
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1806
+ }
1807
+ }
1808
+ `
1809
+ };
1810
+ },
1811
+ archiveDeckImportFormat() {
1812
+ return {
1813
+ query: `
1814
+ mutation DeckImportFormatArchive($id: UUID!) {
1815
+ deckImportFormatArchive(id: $id) {
1816
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1817
+ }
1818
+ }
1819
+ `
1820
+ };
1821
+ },
1822
+ unarchiveDeckImportFormat() {
1823
+ return {
1824
+ query: `
1825
+ mutation DeckImportFormatUnarchive($id: UUID!) {
1826
+ deckImportFormatUnarchive(id: $id) {
1827
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1828
+ }
1829
+ }
1830
+ `
1831
+ };
1832
+ },
1833
+ upsertDeckByExternalRef() {
1834
+ return {
1835
+ query: `
1836
+ mutation DeckUpsertByExternalRef($input: DeckUpsertByExternalRefInput!) {
1837
+ deckUpsertByExternalRef(input: $input) {
1838
+ deck {
1839
+ ${DECK_FIELDS}
1840
+ }
1841
+ created
1842
+ idempotentReplay
1843
+ }
1844
+ }
1845
+ `
1846
+ };
1847
+ },
1848
+ claimDeck() {
1849
+ return {
1850
+ query: `
1851
+ mutation DeckClaim($id: UUID!, $input: DeckClaimInput!) {
1852
+ deckClaim(id: $id, input: $input) {
1853
+ ${DECK_OWNERSHIP_TRANSFER_PAYLOAD_FIELDS}
1854
+ }
1855
+ }
1856
+ `
1857
+ };
1858
+ },
1859
+ transferDeckOwnership() {
1860
+ return {
1861
+ query: `
1862
+ mutation DeckTransferOwnership($id: UUID!, $input: DeckTransferOwnershipInput!) {
1863
+ deckTransferOwnership(id: $id, input: $input) {
1864
+ ${DECK_OWNERSHIP_TRANSFER_PAYLOAD_FIELDS}
1865
+ }
1866
+ }
1867
+ `
1868
+ };
1869
+ },
1870
+ copyDeck() {
1871
+ return {
1872
+ query: `
1873
+ mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
1874
+ deckCopy(id: $id, input: $input) {
1875
+ ${DECK_COPY_PAYLOAD_FIELDS}
1876
+ }
1877
+ }
1878
+ `
1879
+ };
1880
+ },
988
1881
  publishDeck() {
989
1882
  return {
990
1883
  query: `
991
1884
  mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
992
1885
  deckPublish(id: $id, input: $input) {
993
- ${DECK_VERSION_FIELDS}
1886
+ ${DECK_PUBLISH_PAYLOAD_FIELDS}
1887
+ }
1888
+ }
1889
+ `
1890
+ };
1891
+ },
1892
+ removeInvalidDeckEntries() {
1893
+ return {
1894
+ query: `
1895
+ mutation DeckRemoveInvalidEntries($id: UUID!, $input: DeckRemoveInvalidEntriesInput!) {
1896
+ deckRemoveInvalidEntries(id: $id, input: $input) {
1897
+ ${DECK_FIELDS}
994
1898
  }
995
1899
  }
996
1900
  `
@@ -1039,21 +1943,193 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
1039
1943
  `
1040
1944
  };
1041
1945
  },
1946
+ createDeckEmbedToken() {
1947
+ return {
1948
+ query: `
1949
+ mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) {
1950
+ deckEmbedTokenCreate(input: $input) {
1951
+ token
1952
+ embedToken {
1953
+ ${DECK_EMBED_TOKEN_FIELDS}
1954
+ }
1955
+ }
1956
+ }
1957
+ `
1958
+ };
1959
+ },
1960
+ revokeDeckEmbedToken() {
1961
+ return {
1962
+ query: `
1963
+ mutation DeckEmbedTokenRevoke($id: UUID!) {
1964
+ deckEmbedTokenRevoke(id: $id)
1965
+ }
1966
+ `
1967
+ };
1968
+ },
1969
+ createDeckAccessTokenIssuer() {
1970
+ return {
1971
+ query: `
1972
+ mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) {
1973
+ deckAccessTokenIssuerCreate(input: $input) {
1974
+ ${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
1975
+ }
1976
+ }
1977
+ `
1978
+ };
1979
+ },
1980
+ revokeDeckAccessTokenIssuer() {
1981
+ return {
1982
+ query: `
1983
+ mutation DeckAccessTokenIssuerRevoke($id: UUID!) {
1984
+ deckAccessTokenIssuerRevoke(id: $id)
1985
+ }
1986
+ `
1987
+ };
1988
+ },
1989
+ revokeDeckAccessTokenIssuerSigningKey() {
1990
+ return {
1991
+ query: `
1992
+ mutation DeckAccessTokenIssuerSigningKeyRevoke($id: UUID!) {
1993
+ deckAccessTokenIssuerSigningKeyRevoke(id: $id) {
1994
+ ${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
1995
+ }
1996
+ }
1997
+ `
1998
+ };
1999
+ },
2000
+ exchangeDeckAccessToken() {
2001
+ return {
2002
+ query: `
2003
+ mutation DeckAccessTokenExchange($input: DeckAccessTokenExchangeInput!) {
2004
+ deckAccessTokenExchange(input: $input) {
2005
+ token
2006
+ accessToken {
2007
+ ${DECK_ACCESS_TOKEN_FIELDS}
2008
+ }
2009
+ }
2010
+ }
2011
+ `
2012
+ };
2013
+ },
2014
+ grantDeckApiApplicationAccess() {
2015
+ return {
2016
+ query: `
2017
+ mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
2018
+ deckApiApplicationAccessGrant(input: $input) {
2019
+ ${DECK_API_APPLICATION_ACCESS_FIELDS}
2020
+ }
2021
+ }
2022
+ `
2023
+ };
2024
+ },
2025
+ revokeDeckApiApplicationAccess() {
2026
+ return {
2027
+ query: `
2028
+ mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
2029
+ deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
2030
+ }
2031
+ `
2032
+ };
2033
+ },
2034
+ revokeDeckAccessToken() {
2035
+ return {
2036
+ query: `
2037
+ mutation DeckAccessTokenRevoke($id: UUID!) {
2038
+ deckAccessTokenRevoke(id: $id)
2039
+ }
2040
+ `
2041
+ };
2042
+ },
1042
2043
  deckCreateVariables(input) {
1043
2044
  return { input };
1044
2045
  },
1045
2046
  deckUpdateVariables(id, input) {
1046
2047
  return { id, input };
1047
2048
  },
1048
- deckPublishVariables(id, input = {}) {
2049
+ deckEntryAddVariables(input) {
2050
+ return { input };
2051
+ },
2052
+ deckEntryUpdateVariables(id, input) {
1049
2053
  return { id, input };
1050
2054
  },
2055
+ deckEntryRemoveVariables(id, expectedDraftRevision) {
2056
+ return { id, expectedDraftRevision };
2057
+ },
2058
+ deckEntryReorderVariables(deckId, input) {
2059
+ return { deckId, input };
2060
+ },
2061
+ deckEntriesReplaceVariables(deckId, input) {
2062
+ return { deckId, input };
2063
+ },
2064
+ deckImportVariables(input) {
2065
+ return { input };
2066
+ },
2067
+ deckImportFormatCreateVariables(input) {
2068
+ return { input };
2069
+ },
2070
+ deckImportFormatUpdateVariables(id, input) {
2071
+ return { id, input };
2072
+ },
2073
+ deckImportFormatTestVariables(input) {
2074
+ return { input };
2075
+ },
2076
+ deckUpsertByExternalRefVariables(input) {
2077
+ return { input };
2078
+ },
2079
+ deckClaimVariables(id, input) {
2080
+ return { id, input };
2081
+ },
2082
+ deckTransferOwnershipVariables(id, input) {
2083
+ return { id, input };
2084
+ },
2085
+ deckCopyVariables(id, input) {
2086
+ return { id, input };
2087
+ },
2088
+ deckPublishVariables(id, input) {
2089
+ return { id, input };
2090
+ },
2091
+ deckValidateVariables(id, input) {
2092
+ return input === void 0 ? { id } : { id, input };
2093
+ },
2094
+ deckRemoveInvalidEntriesVariables(id, input) {
2095
+ return { id, input };
2096
+ },
2097
+ deckHydrateEntriesVariables(input) {
2098
+ return { input };
2099
+ },
2100
+ deckExportVariables(id, format) {
2101
+ return { id, format };
2102
+ },
2103
+ deckVersionDiffVariables(fromVersionId, toVersionId) {
2104
+ return { fromVersionId, toVersionId };
2105
+ },
1051
2106
  deckCollaboratorVariables(deckId, accountId, role) {
1052
2107
  return role === void 0 ? { deckId, accountId } : { deckId, accountId, role };
1053
2108
  },
1054
2109
  deckPreviewTokenCreateVariables(input) {
1055
2110
  return { input };
1056
2111
  },
2112
+ deckEmbedTokenCreateVariables(input) {
2113
+ return { input };
2114
+ },
2115
+ deckAccessTokenIssuerCreateVariables(input) {
2116
+ return { input };
2117
+ },
2118
+ deckAccessTokenExchangeVariables(input) {
2119
+ return { input };
2120
+ },
2121
+ deckApiApplicationAccessesVariables(deckId, includeRevoked) {
2122
+ return includeRevoked === void 0 ? { deckId } : { deckId, includeRevoked };
2123
+ },
2124
+ myDeckApiApplicationAccessesVariables(applicationId) {
2125
+ return applicationId === void 0 ? {} : { applicationId };
2126
+ },
2127
+ deckApiApplicationAccessGrantVariables(input) {
2128
+ return { input };
2129
+ },
2130
+ deckApiApplicationAccessRevokeVariables(deckId, apiApplicationId) {
2131
+ return { deckId, apiApplicationId };
2132
+ },
1057
2133
  // API Key Info
1058
2134
  fetchMe() {
1059
2135
  return {