@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.cjs CHANGED
@@ -354,6 +354,7 @@ var DATASET_FIELDS = `
354
354
  name
355
355
  description
356
356
  purpose
357
+ tcgplayerProductIdFieldKey
357
358
  visibility
358
359
  isArchived
359
360
  createdAt
@@ -407,19 +408,112 @@ var SCHEMA_FIELDS = `
407
408
  }
408
409
  }
409
410
  `;
410
- var RECORD_FIELDS = `
411
+ var TCGPLAYER_PRICING_FIELDS = `
412
+ pricing {
413
+ productId
414
+ prices {
415
+ subTypeName
416
+ lowPrice
417
+ midPrice
418
+ highPrice
419
+ marketPrice
420
+ directLowPrice
421
+ }
422
+ }
423
+ `;
424
+ function recordFields(options = {}) {
425
+ return `
426
+ id
427
+ datasetId
428
+ data
429
+ ${options.includePricing ? TCGPLAYER_PRICING_FIELDS : ""}
430
+ createdAt
431
+ updatedAt
432
+ dataset {
433
+ id
434
+ key
435
+ name
436
+ gameId
437
+ publisherId
438
+ }
439
+ `;
440
+ }
441
+ var RECORD_FIELDS = recordFields();
442
+ var DECK_SECTION_DEFINITION_FIELDS = `
443
+ key
444
+ label
445
+ description
446
+ order
447
+ default
448
+ aliases
449
+ minCards
450
+ maxCards
451
+ excludedFromDeckSize
452
+ legalCardTypes
453
+ metadata
454
+ `;
455
+ var DECK_ENTRY_FIELDS = `
411
456
  id
412
457
  datasetId
413
- data
414
- createdAt
415
- updatedAt
416
- dataset {
417
- id
418
- key
419
- name
420
- gameId
421
- publisherId
458
+ recordId
459
+ identifier
460
+ quantity
461
+ section
462
+ sortOrder
463
+ annotations
464
+ display
465
+ record {
466
+ ${RECORD_FIELDS}
467
+ }
468
+ `;
469
+ var DECK_VALIDATED_AGAINST_FIELDS = `
470
+ rulesetId
471
+ rulesetVersionId
472
+ rulesetVersionLabel
473
+ cardDatasetId
474
+ cardDatasetVersionId
475
+ validatedAt
476
+ validationResultSummary
477
+ `;
478
+ var DECK_VALIDATION_ISSUE_FIELDS = `
479
+ code
480
+ severity
481
+ message
482
+ entryIds
483
+ section
484
+ datasetId
485
+ identifier
486
+ metadata
487
+ `;
488
+ var DECK_VALIDATION_FIELDS = `
489
+ deckId
490
+ valid
491
+ blockers {
492
+ ${DECK_VALIDATION_ISSUE_FIELDS}
493
+ }
494
+ warnings {
495
+ ${DECK_VALIDATION_ISSUE_FIELDS}
496
+ }
497
+ affectedEntries {
498
+ entryId
499
+ datasetId
500
+ recordId
501
+ identifier
502
+ section
503
+ quantity
504
+ }
505
+ validatedAgainst {
506
+ ${DECK_VALIDATED_AGAINST_FIELDS}
422
507
  }
508
+ checkedAt
509
+ `;
510
+ var DECK_DIFF_FIELDS = `
511
+ deckId
512
+ fromVersionId
513
+ toVersionId
514
+ toDraftRevision
515
+ hasChanges
516
+ diff
423
517
  `;
424
518
  var DECK_VERSION_FIELDS = `
425
519
  id
@@ -436,21 +530,23 @@ var DECK_VERSION_FIELDS = `
436
530
  metadata
437
531
  publishNote
438
532
  computedDiff
533
+ rulesetId
534
+ rulesetVersionId
535
+ cardDatasetId
536
+ cardDatasetVersionId
537
+ validatedAt
538
+ validationSummary
539
+ validatedAgainst {
540
+ ${DECK_VALIDATED_AGAINST_FIELDS}
541
+ }
542
+ sectionDefinitions {
543
+ ${DECK_SECTION_DEFINITION_FIELDS}
544
+ }
439
545
  publishedByAccountId
440
546
  publishedByApiApplicationId
441
547
  createdAt
442
548
  entries {
443
- id
444
- datasetId
445
- recordId
446
- identifier
447
- quantity
448
- section
449
- sortOrder
450
- annotations
451
- record {
452
- ${RECORD_FIELDS}
453
- }
549
+ ${DECK_ENTRY_FIELDS}
454
550
  }
455
551
  `;
456
552
  var DECK_COLLABORATOR_FIELDS = `
@@ -472,8 +568,156 @@ var DECK_PREVIEW_TOKEN_FIELDS = `
472
568
  createdAt
473
569
  updatedAt
474
570
  `;
571
+ var DECK_EMBED_TOKEN_FIELDS = `
572
+ id
573
+ deckId
574
+ apiApplicationId
575
+ label
576
+ readMode
577
+ allowedOrigins
578
+ externalSubject
579
+ expiresAt
580
+ revokedAt
581
+ lastUsedAt
582
+ createdAt
583
+ updatedAt
584
+ `;
585
+ var DECK_ACCESS_TOKEN_ISSUER_FIELDS = `
586
+ id
587
+ deckId
588
+ apiApplicationId
589
+ label
590
+ readModes
591
+ maxTokenLifetimeSeconds
592
+ directSigningAlg
593
+ directSigningKeyId
594
+ directSigningPublicKey
595
+ directSigningKeyRevokedAt
596
+ revokedAt
597
+ createdAt
598
+ updatedAt
599
+ `;
600
+ var DECK_ACCESS_TOKEN_FIELDS = `
601
+ id
602
+ deckId
603
+ apiApplicationId
604
+ issuerId
605
+ readMode
606
+ externalSubject
607
+ expiresAt
608
+ revokedAt
609
+ lastUsedAt
610
+ createdAt
611
+ updatedAt
612
+ `;
613
+ var DECK_IMPORT_ENTRY_FIELDS = `
614
+ lineNumber
615
+ raw
616
+ datasetKey
617
+ datasetId
618
+ recordId
619
+ identifier
620
+ quantity
621
+ section
622
+ sortOrder
623
+ display
624
+ record {
625
+ ${RECORD_FIELDS}
626
+ }
627
+ `;
628
+ var DECK_IMPORT_ISSUE_FIELDS = `
629
+ lineNumber
630
+ raw
631
+ code
632
+ message
633
+ `;
634
+ var DECK_IMPORT_UNMATCHED_FIELDS = `
635
+ lineNumber
636
+ raw
637
+ datasetKey
638
+ identifier
639
+ quantity
640
+ section
641
+ code
642
+ message
643
+ `;
644
+ var DECK_IMPORT_AMBIGUOUS_FIELDS = `
645
+ lineNumber
646
+ raw
647
+ datasetKey
648
+ identifier
649
+ quantity
650
+ section
651
+ candidates {
652
+ recordId
653
+ identifier
654
+ display
655
+ }
656
+ `;
657
+ var DECK_IMPORT_FORMAT_DEFINITION_FIELDS = `
658
+ id
659
+ gameId
660
+ key
661
+ name
662
+ description
663
+ enabled
664
+ priority
665
+ datasetKey
666
+ config
667
+ archivedAt
668
+ isArchived
669
+ createdAt
670
+ updatedAt
671
+ `;
672
+ var DECK_IMPORT_FORMAT_DETECTION_FIELDS = `
673
+ formatId
674
+ key
675
+ name
676
+ confidence
677
+ reason
678
+ `;
679
+ var DECK_IMPORT_FORMAT_TEST_PAYLOAD_FIELDS = `
680
+ detection {
681
+ ${DECK_IMPORT_FORMAT_DETECTION_FIELDS}
682
+ }
683
+ entries {
684
+ ${DECK_IMPORT_ENTRY_FIELDS}
685
+ }
686
+ parseErrors {
687
+ ${DECK_IMPORT_ISSUE_FIELDS}
688
+ }
689
+ unmatched {
690
+ ${DECK_IMPORT_UNMATCHED_FIELDS}
691
+ }
692
+ ambiguous {
693
+ ${DECK_IMPORT_AMBIGUOUS_FIELDS}
694
+ }
695
+ `;
696
+ var DECK_HYDRATE_ENTRIES_PAYLOAD_FIELDS = `
697
+ entries {
698
+ ${DECK_IMPORT_ENTRY_FIELDS}
699
+ }
700
+ unmatched {
701
+ ${DECK_IMPORT_UNMATCHED_FIELDS}
702
+ }
703
+ ambiguous {
704
+ ${DECK_IMPORT_AMBIGUOUS_FIELDS}
705
+ }
706
+ `;
707
+ var DECK_EXPORT_PAYLOAD_FIELDS = `
708
+ deckId
709
+ format
710
+ text
711
+ entryCount
712
+ `;
475
713
  var DECK_FIELDS = `
476
714
  id
715
+ ownerType
716
+ ownerAccountId
717
+ ownerApiApplicationId
718
+ environment
719
+ createdByAccountId
720
+ createdByApiApplicationId
477
721
  accountId
478
722
  apiApplicationId
479
723
  gameId
@@ -483,13 +727,29 @@ var DECK_FIELDS = `
483
727
  description
484
728
  formatKey
485
729
  visibility
730
+ accessMode
731
+ discoverability
732
+ state
733
+ archivedAt
734
+ deletedAt
735
+ unpublishedAt
736
+ externalRefApiApplicationId
486
737
  externalRef
738
+ externalSubjectRef
739
+ rulesetId
487
740
  sourceUrl
488
741
  metadata
742
+ sectionDefinitions {
743
+ ${DECK_SECTION_DEFINITION_FIELDS}
744
+ }
489
745
  latestPublishedVersion {
490
746
  ${DECK_VERSION_FIELDS}
491
747
  }
492
748
  publishedAt
749
+ draftRevision
750
+ draftUpdatedAt
751
+ draftUpdatedByAccountId
752
+ draftUpdatedByApiApplicationId
493
753
  hasUnpublishedChanges
494
754
  createdAt
495
755
  updatedAt
@@ -497,17 +757,109 @@ var DECK_FIELDS = `
497
757
  ${GAME_FIELDS}
498
758
  }
499
759
  entries {
500
- id
501
- datasetId
502
- recordId
503
- identifier
504
- quantity
505
- section
506
- sortOrder
507
- annotations
508
- record {
509
- ${RECORD_FIELDS}
510
- }
760
+ ${DECK_ENTRY_FIELDS}
761
+ }
762
+ `;
763
+ var DECK_OWNERSHIP_TRANSFER_PAYLOAD_FIELDS = `
764
+ deck {
765
+ ${DECK_FIELDS}
766
+ }
767
+ retainedAppAccess
768
+ `;
769
+ var DECK_COPY_PAYLOAD_FIELDS = `
770
+ deck {
771
+ ${DECK_FIELDS}
772
+ }
773
+ copiedFromDeckId
774
+ retainedAppAccess
775
+ `;
776
+ var DECK_ACCESS_APPLICATION_FIELDS = `
777
+ id
778
+ name
779
+ description
780
+ revokedAt
781
+ `;
782
+ var DECK_API_APPLICATION_ACCESS_FIELDS = `
783
+ id
784
+ deckId
785
+ deck {
786
+ ${DECK_FIELDS}
787
+ }
788
+ apiApplicationId
789
+ apiApplication {
790
+ ${DECK_ACCESS_APPLICATION_FIELDS}
791
+ }
792
+ role
793
+ grantSource
794
+ externalRef
795
+ createdByAccountId
796
+ createdByApiApplicationId
797
+ revokedAt
798
+ createdAt
799
+ updatedAt
800
+ `;
801
+ var DECK_PUBLISH_PAYLOAD_FIELDS = `
802
+ deck {
803
+ ${DECK_FIELDS}
804
+ }
805
+ version {
806
+ ${DECK_VERSION_FIELDS}
807
+ }
808
+ validation {
809
+ ${DECK_VALIDATION_FIELDS}
810
+ }
811
+ blockers {
812
+ ${DECK_VALIDATION_ISSUE_FIELDS}
813
+ }
814
+ warnings {
815
+ ${DECK_VALIDATION_ISSUE_FIELDS}
816
+ }
817
+ `;
818
+ var DECK_ENTRY_MUTATION_PAYLOAD_FIELDS = `
819
+ deck {
820
+ ${DECK_FIELDS}
821
+ }
822
+ entry {
823
+ ${DECK_ENTRY_FIELDS}
824
+ }
825
+ `;
826
+ var DECK_ENTRY_REORDER_PAYLOAD_FIELDS = `
827
+ deck {
828
+ ${DECK_FIELDS}
829
+ }
830
+ entries {
831
+ ${DECK_ENTRY_FIELDS}
832
+ }
833
+ `;
834
+ var DECK_ENTRIES_REPLACE_PAYLOAD_FIELDS = DECK_ENTRY_REORDER_PAYLOAD_FIELDS;
835
+ var DECK_IMPORT_PAYLOAD_FIELDS = `
836
+ deck {
837
+ ${DECK_FIELDS}
838
+ }
839
+ applied
840
+ dryRun
841
+ replace
842
+ format
843
+ importFormat {
844
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
845
+ }
846
+ detection {
847
+ ${DECK_IMPORT_FORMAT_DETECTION_FIELDS}
848
+ }
849
+ entries {
850
+ ${DECK_IMPORT_ENTRY_FIELDS}
851
+ }
852
+ parseErrors {
853
+ ${DECK_IMPORT_ISSUE_FIELDS}
854
+ }
855
+ unmatched {
856
+ ${DECK_IMPORT_UNMATCHED_FIELDS}
857
+ }
858
+ ambiguous {
859
+ ${DECK_IMPORT_AMBIGUOUS_FIELDS}
860
+ }
861
+ validation {
862
+ ${DECK_VALIDATION_FIELDS}
511
863
  }
512
864
  `;
513
865
  var RESOLVED_LINKS_FIELDS = `
@@ -809,8 +1161,9 @@ var QueryBuilder = {
809
1161
  variables["validateSchema"] = params.validateSchema;
810
1162
  }
811
1163
  const includeResolvedLinks = params.resolveLinks && params.resolveLinks.length > 0;
812
- const nodeFields = includeResolvedLinks ? `${RECORD_FIELDS}
813
- ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
1164
+ const selectedRecordFields = recordFields({ includePricing: params.includePricing });
1165
+ const nodeFields = includeResolvedLinks ? `${selectedRecordFields}
1166
+ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
814
1167
  return {
815
1168
  query: `
816
1169
  query SearchRecords(${defs.join(", ")}) {
@@ -822,45 +1175,45 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
822
1175
  variables
823
1176
  };
824
1177
  },
825
- fetchRecordById() {
1178
+ fetchRecordById(params = {}) {
826
1179
  return {
827
1180
  query: `
828
1181
  query FetchRecord($id: UUID!) {
829
1182
  fetchRecord(id: $id) {
830
- ${RECORD_FIELDS}
1183
+ ${recordFields(params)}
831
1184
  }
832
1185
  }
833
1186
  `
834
1187
  };
835
1188
  },
836
- fetchRecordByIdentifier() {
1189
+ fetchRecordByIdentifier(params = {}) {
837
1190
  return {
838
1191
  query: `
839
1192
  query FetchRecordByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifier: String!) {
840
1193
  fetchRecordByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifier: $identifier) {
841
- ${RECORD_FIELDS}
1194
+ ${recordFields(params)}
842
1195
  }
843
1196
  }
844
1197
  `
845
1198
  };
846
1199
  },
847
- fetchRecordsByIdentifier() {
1200
+ fetchRecordsByIdentifier(params = {}) {
848
1201
  return {
849
1202
  query: `
850
1203
  query FetchRecordsByIdentifier($publisherSlug: String!, $gameKey: String!, $datasetKey: String!, $identifiers: [String!]!) {
851
1204
  fetchRecordsByIdentifier(publisherSlug: $publisherSlug, gameKey: $gameKey, datasetKey: $datasetKey, identifiers: $identifiers) {
852
- ${RECORD_FIELDS}
1205
+ ${recordFields(params)}
853
1206
  }
854
1207
  }
855
1208
  `
856
1209
  };
857
1210
  },
858
- fetchRecords() {
1211
+ fetchRecords(params = {}) {
859
1212
  return {
860
1213
  query: `
861
1214
  query FetchRecords($ids: [UUID!]!) {
862
1215
  fetchRecords(ids: $ids) {
863
- ${RECORD_FIELDS}
1216
+ ${recordFields(params)}
864
1217
  }
865
1218
  }
866
1219
  `
@@ -881,6 +1234,11 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
881
1234
  args.push("after: $after");
882
1235
  variables["after"] = params.after;
883
1236
  }
1237
+ if (params.includeArchived !== void 0) {
1238
+ defs.push("$includeArchived: Boolean");
1239
+ args.push("includeArchived: $includeArchived");
1240
+ variables["includeArchived"] = params.includeArchived;
1241
+ }
884
1242
  const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
885
1243
  const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
886
1244
  return {
@@ -894,44 +1252,173 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
894
1252
  variables
895
1253
  };
896
1254
  },
897
- fetchDeckById() {
1255
+ viewerDecks(params = {}) {
1256
+ const variables = {};
1257
+ const args = [];
1258
+ const defs = [];
1259
+ if (params.filter !== void 0) {
1260
+ defs.push("$filter: ViewerDecksFilterInput");
1261
+ args.push("filter: $filter");
1262
+ variables["filter"] = params.filter;
1263
+ }
1264
+ if (params.first !== void 0) {
1265
+ defs.push("$first: Int");
1266
+ args.push("first: $first");
1267
+ variables["first"] = params.first;
1268
+ }
1269
+ if (params.after !== void 0) {
1270
+ defs.push("$after: String");
1271
+ args.push("after: $after");
1272
+ variables["after"] = params.after;
1273
+ }
1274
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1275
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
898
1276
  return {
899
1277
  query: `
900
- query FetchDeck($id: UUID!) {
901
- fetchDeck(id: $id) {
902
- ${DECK_FIELDS}
1278
+ query ViewerDecks${defStr} {
1279
+ viewerDecks${argStr} {
1280
+ ${connectionFields(DECK_FIELDS)}
903
1281
  }
904
1282
  }
905
- `
1283
+ `,
1284
+ variables
906
1285
  };
907
1286
  },
908
- myDeck() {
1287
+ appDecks(params = {}) {
1288
+ const variables = {};
1289
+ const args = [];
1290
+ const defs = [];
1291
+ if (params.filter !== void 0) {
1292
+ defs.push("$filter: AppDecksFilterInput");
1293
+ args.push("filter: $filter");
1294
+ variables["filter"] = params.filter;
1295
+ }
1296
+ if (params.first !== void 0) {
1297
+ defs.push("$first: Int");
1298
+ args.push("first: $first");
1299
+ variables["first"] = params.first;
1300
+ }
1301
+ if (params.after !== void 0) {
1302
+ defs.push("$after: String");
1303
+ args.push("after: $after");
1304
+ variables["after"] = params.after;
1305
+ }
1306
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1307
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
909
1308
  return {
910
1309
  query: `
911
- query MyDeck($id: UUID!) {
912
- myDeck(id: $id) {
913
- ${DECK_FIELDS}
1310
+ query AppDecks${defStr} {
1311
+ appDecks${argStr} {
1312
+ ${connectionFields(DECK_FIELDS)}
914
1313
  }
915
1314
  }
916
- `
1315
+ `,
1316
+ variables
917
1317
  };
918
1318
  },
919
- fetchDeckBySlug() {
1319
+ publicDecks(params = {}) {
1320
+ const variables = {};
1321
+ const args = [];
1322
+ const defs = [];
1323
+ if (params.filter !== void 0) {
1324
+ defs.push("$filter: PublicDecksFilterInput");
1325
+ args.push("filter: $filter");
1326
+ variables["filter"] = params.filter;
1327
+ }
1328
+ if (params.first !== void 0) {
1329
+ defs.push("$first: Int");
1330
+ args.push("first: $first");
1331
+ variables["first"] = params.first;
1332
+ }
1333
+ if (params.after !== void 0) {
1334
+ defs.push("$after: String");
1335
+ args.push("after: $after");
1336
+ variables["after"] = params.after;
1337
+ }
1338
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1339
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
920
1340
  return {
921
1341
  query: `
922
- query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
923
- fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
924
- ${DECK_FIELDS}
1342
+ query PublicDecks${defStr} {
1343
+ publicDecks${argStr} {
1344
+ ${connectionFields(DECK_FIELDS)}
925
1345
  }
926
1346
  }
927
- `
1347
+ `,
1348
+ variables
928
1349
  };
929
1350
  },
930
- fetchDeckByExternalRef() {
1351
+ fetchDeckById() {
931
1352
  return {
932
1353
  query: `
933
- query FetchDeckByExternalRef($externalRef: String!) {
934
- fetchDeckByExternalRef(externalRef: $externalRef) {
1354
+ query FetchDeck($id: UUID!) {
1355
+ fetchDeck(id: $id) {
1356
+ ${DECK_FIELDS}
1357
+ }
1358
+ }
1359
+ `
1360
+ };
1361
+ },
1362
+ deckById() {
1363
+ return {
1364
+ query: `
1365
+ query Deck($id: UUID!) {
1366
+ deck(id: $id) {
1367
+ ${DECK_FIELDS}
1368
+ }
1369
+ }
1370
+ `
1371
+ };
1372
+ },
1373
+ myDeck() {
1374
+ return {
1375
+ query: `
1376
+ query MyDeck($id: UUID!) {
1377
+ myDeck(id: $id) {
1378
+ ${DECK_FIELDS}
1379
+ }
1380
+ }
1381
+ `
1382
+ };
1383
+ },
1384
+ fetchDeckBySlug() {
1385
+ return {
1386
+ query: `
1387
+ query FetchDeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
1388
+ fetchDeckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
1389
+ ${DECK_FIELDS}
1390
+ }
1391
+ }
1392
+ `
1393
+ };
1394
+ },
1395
+ deckBySlug() {
1396
+ return {
1397
+ query: `
1398
+ query DeckBySlug($publisherSlug: String!, $gameKey: String!, $slug: String!) {
1399
+ deckBySlug(publisherSlug: $publisherSlug, gameKey: $gameKey, slug: $slug) {
1400
+ ${DECK_FIELDS}
1401
+ }
1402
+ }
1403
+ `
1404
+ };
1405
+ },
1406
+ fetchDeckByExternalRef() {
1407
+ return {
1408
+ query: `
1409
+ query FetchDeckByExternalRef($externalRef: String!) {
1410
+ fetchDeckByExternalRef(externalRef: $externalRef) {
1411
+ ${DECK_FIELDS}
1412
+ }
1413
+ }
1414
+ `
1415
+ };
1416
+ },
1417
+ deckByExternalRef() {
1418
+ return {
1419
+ query: `
1420
+ query DeckByExternalRef($externalRef: String!) {
1421
+ deckByExternalRef(externalRef: $externalRef) {
935
1422
  ${DECK_FIELDS}
936
1423
  }
937
1424
  }
@@ -985,6 +1472,125 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
985
1472
  `
986
1473
  };
987
1474
  },
1475
+ deckEmbed() {
1476
+ return {
1477
+ query: `
1478
+ query DeckEmbed($token: String!) {
1479
+ deckEmbed(token: $token) {
1480
+ ${DECK_FIELDS}
1481
+ }
1482
+ }
1483
+ `
1484
+ };
1485
+ },
1486
+ deckAccess() {
1487
+ return {
1488
+ query: `
1489
+ query DeckAccess($token: String!) {
1490
+ deckAccess(token: $token) {
1491
+ ${DECK_FIELDS}
1492
+ }
1493
+ }
1494
+ `
1495
+ };
1496
+ },
1497
+ deckDraftDiff() {
1498
+ return {
1499
+ query: `
1500
+ query DeckDraftDiff($id: UUID!) {
1501
+ deckDraftDiff(id: $id) {
1502
+ ${DECK_DIFF_FIELDS}
1503
+ }
1504
+ }
1505
+ `
1506
+ };
1507
+ },
1508
+ deckVersionDiff() {
1509
+ return {
1510
+ query: `
1511
+ query DeckVersionDiff($fromVersionId: UUID!, $toVersionId: UUID!) {
1512
+ deckVersionDiff(fromVersionId: $fromVersionId, toVersionId: $toVersionId) {
1513
+ ${DECK_DIFF_FIELDS}
1514
+ }
1515
+ }
1516
+ `
1517
+ };
1518
+ },
1519
+ deckHydrateEntries() {
1520
+ return {
1521
+ query: `
1522
+ query DeckHydrateEntries($input: DeckHydrateEntriesInput!) {
1523
+ deckHydrateEntries(input: $input) {
1524
+ ${DECK_HYDRATE_ENTRIES_PAYLOAD_FIELDS}
1525
+ }
1526
+ }
1527
+ `
1528
+ };
1529
+ },
1530
+ deckExport() {
1531
+ return {
1532
+ query: `
1533
+ query DeckExport($id: UUID!, $format: DeckExportFormat!) {
1534
+ deckExport(id: $id, format: $format) {
1535
+ ${DECK_EXPORT_PAYLOAD_FIELDS}
1536
+ }
1537
+ }
1538
+ `
1539
+ };
1540
+ },
1541
+ deckValidate() {
1542
+ return {
1543
+ query: `
1544
+ query DeckValidate($id: UUID!, $input: DeckValidateInput) {
1545
+ deckValidate(id: $id, input: $input) {
1546
+ ${DECK_VALIDATION_FIELDS}
1547
+ }
1548
+ }
1549
+ `
1550
+ };
1551
+ },
1552
+ deckSectionDefinitions(params = {}) {
1553
+ const variables = {};
1554
+ const args = [];
1555
+ const defs = [];
1556
+ if (params.publisherSlug !== void 0) {
1557
+ defs.push("$publisherSlug: String");
1558
+ args.push("publisherSlug: $publisherSlug");
1559
+ variables["publisherSlug"] = params.publisherSlug;
1560
+ }
1561
+ if (params.gameKey !== void 0) {
1562
+ defs.push("$gameKey: String");
1563
+ args.push("gameKey: $gameKey");
1564
+ variables["gameKey"] = params.gameKey;
1565
+ }
1566
+ if (params.gameId !== void 0) {
1567
+ defs.push("$gameId: UUID");
1568
+ args.push("gameId: $gameId");
1569
+ variables["gameId"] = params.gameId;
1570
+ }
1571
+ if (params.rulesetKey !== void 0) {
1572
+ defs.push("$rulesetKey: String");
1573
+ args.push("rulesetKey: $rulesetKey");
1574
+ variables["rulesetKey"] = params.rulesetKey;
1575
+ }
1576
+ if (params.rulesetVersionId !== void 0) {
1577
+ defs.push("$rulesetVersionId: UUID");
1578
+ args.push("rulesetVersionId: $rulesetVersionId");
1579
+ variables["rulesetVersionId"] = params.rulesetVersionId;
1580
+ }
1581
+ const defStr = defs.length > 0 ? `(${defs.join(", ")})` : "";
1582
+ const argStr = args.length > 0 ? `(${args.join(", ")})` : "";
1583
+ return {
1584
+ query: `
1585
+ query DeckSectionDefinitions${defStr} {
1586
+ deckSectionDefinitions${argStr} {
1587
+ ${DECK_SECTION_DEFINITION_FIELDS}
1588
+ }
1589
+ }
1590
+ `,
1591
+ variables
1592
+ };
1593
+ },
988
1594
  deckCollaborators() {
989
1595
  return {
990
1596
  query: `
@@ -996,6 +1602,102 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
996
1602
  `
997
1603
  };
998
1604
  },
1605
+ deckEmbedTokens() {
1606
+ return {
1607
+ query: `
1608
+ query DeckEmbedTokens($deckId: UUID!) {
1609
+ deckEmbedTokens(deckId: $deckId) {
1610
+ ${DECK_EMBED_TOKEN_FIELDS}
1611
+ }
1612
+ }
1613
+ `
1614
+ };
1615
+ },
1616
+ deckAccessTokenIssuers() {
1617
+ return {
1618
+ query: `
1619
+ query DeckAccessTokenIssuers($deckId: UUID!) {
1620
+ deckAccessTokenIssuers(deckId: $deckId) {
1621
+ ${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
1622
+ }
1623
+ }
1624
+ `
1625
+ };
1626
+ },
1627
+ deckApiApplicationAccesses() {
1628
+ return {
1629
+ query: `
1630
+ query DeckApiApplicationAccesses($deckId: UUID!, $includeRevoked: Boolean) {
1631
+ deckApiApplicationAccesses(deckId: $deckId, includeRevoked: $includeRevoked) {
1632
+ ${DECK_API_APPLICATION_ACCESS_FIELDS}
1633
+ }
1634
+ }
1635
+ `
1636
+ };
1637
+ },
1638
+ myDeckApiApplicationAccesses() {
1639
+ return {
1640
+ query: `
1641
+ query MyDeckApiApplicationAccesses($applicationId: UUID) {
1642
+ myDeckApiApplicationAccesses(applicationId: $applicationId) {
1643
+ ${DECK_API_APPLICATION_ACCESS_FIELDS}
1644
+ }
1645
+ }
1646
+ `
1647
+ };
1648
+ },
1649
+ deckImportFormats(params) {
1650
+ const variables = { gameId: params.gameId };
1651
+ const args = ["gameId: $gameId"];
1652
+ const defs = ["$gameId: UUID!"];
1653
+ if (params.includeArchived !== void 0) {
1654
+ defs.push("$includeArchived: Boolean");
1655
+ args.push("includeArchived: $includeArchived");
1656
+ variables["includeArchived"] = params.includeArchived;
1657
+ }
1658
+ if (params.first !== void 0) {
1659
+ defs.push("$first: Int");
1660
+ args.push("first: $first");
1661
+ variables["first"] = params.first;
1662
+ }
1663
+ if (params.after !== void 0) {
1664
+ defs.push("$after: String");
1665
+ args.push("after: $after");
1666
+ variables["after"] = params.after;
1667
+ }
1668
+ return {
1669
+ query: `
1670
+ query DeckImportFormats(${defs.join(", ")}) {
1671
+ deckImportFormats(${args.join(", ")}) {
1672
+ ${connectionFields(DECK_IMPORT_FORMAT_DEFINITION_FIELDS)}
1673
+ }
1674
+ }
1675
+ `,
1676
+ variables
1677
+ };
1678
+ },
1679
+ deckImportFormat() {
1680
+ return {
1681
+ query: `
1682
+ query DeckImportFormat($id: UUID!) {
1683
+ deckImportFormat(id: $id) {
1684
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1685
+ }
1686
+ }
1687
+ `
1688
+ };
1689
+ },
1690
+ deckImportFormatTest() {
1691
+ return {
1692
+ query: `
1693
+ query DeckImportFormatTest($input: DeckImportFormatTestInput!) {
1694
+ deckImportFormatTest(input: $input) {
1695
+ ${DECK_IMPORT_FORMAT_TEST_PAYLOAD_FIELDS}
1696
+ }
1697
+ }
1698
+ `
1699
+ };
1700
+ },
999
1701
  deckPreviewTokens() {
1000
1702
  return {
1001
1703
  query: `
@@ -1038,12 +1740,214 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
1038
1740
  `
1039
1741
  };
1040
1742
  },
1743
+ archiveDeck() {
1744
+ return {
1745
+ query: `
1746
+ mutation DeckArchive($id: UUID!) {
1747
+ deckArchive(id: $id) {
1748
+ ${DECK_FIELDS}
1749
+ }
1750
+ }
1751
+ `
1752
+ };
1753
+ },
1754
+ restoreDeck() {
1755
+ return {
1756
+ query: `
1757
+ mutation DeckRestore($id: UUID!) {
1758
+ deckRestore(id: $id) {
1759
+ ${DECK_FIELDS}
1760
+ }
1761
+ }
1762
+ `
1763
+ };
1764
+ },
1765
+ unpublishDeck() {
1766
+ return {
1767
+ query: `
1768
+ mutation DeckUnpublish($id: UUID!) {
1769
+ deckUnpublish(id: $id) {
1770
+ ${DECK_FIELDS}
1771
+ }
1772
+ }
1773
+ `
1774
+ };
1775
+ },
1776
+ addDeckEntry() {
1777
+ return {
1778
+ query: `
1779
+ mutation DeckEntryAdd($input: DeckEntryAddInput!) {
1780
+ deckEntryAdd(input: $input) {
1781
+ ${DECK_ENTRY_MUTATION_PAYLOAD_FIELDS}
1782
+ }
1783
+ }
1784
+ `
1785
+ };
1786
+ },
1787
+ updateDeckEntry() {
1788
+ return {
1789
+ query: `
1790
+ mutation DeckEntryUpdate($id: UUID!, $input: DeckEntryUpdateInput!) {
1791
+ deckEntryUpdate(id: $id, input: $input) {
1792
+ ${DECK_ENTRY_MUTATION_PAYLOAD_FIELDS}
1793
+ }
1794
+ }
1795
+ `
1796
+ };
1797
+ },
1798
+ removeDeckEntry() {
1799
+ return {
1800
+ query: `
1801
+ mutation DeckEntryRemove($id: UUID!, $expectedDraftRevision: Int!) {
1802
+ deckEntryRemove(id: $id, expectedDraftRevision: $expectedDraftRevision) {
1803
+ ${DECK_ENTRY_MUTATION_PAYLOAD_FIELDS}
1804
+ }
1805
+ }
1806
+ `
1807
+ };
1808
+ },
1809
+ reorderDeckEntries() {
1810
+ return {
1811
+ query: `
1812
+ mutation DeckEntryReorder($deckId: UUID!, $input: DeckEntryReorderInput!) {
1813
+ deckEntryReorder(deckId: $deckId, input: $input) {
1814
+ ${DECK_ENTRY_REORDER_PAYLOAD_FIELDS}
1815
+ }
1816
+ }
1817
+ `
1818
+ };
1819
+ },
1820
+ replaceDeckEntries() {
1821
+ return {
1822
+ query: `
1823
+ mutation DeckEntriesReplace($deckId: UUID!, $input: DeckEntriesReplaceInput!) {
1824
+ deckEntriesReplace(deckId: $deckId, input: $input) {
1825
+ ${DECK_ENTRIES_REPLACE_PAYLOAD_FIELDS}
1826
+ }
1827
+ }
1828
+ `
1829
+ };
1830
+ },
1831
+ importDeck() {
1832
+ return {
1833
+ query: `
1834
+ mutation DeckImport($input: DeckImportInput!) {
1835
+ deckImport(input: $input) {
1836
+ ${DECK_IMPORT_PAYLOAD_FIELDS}
1837
+ }
1838
+ }
1839
+ `
1840
+ };
1841
+ },
1842
+ createDeckImportFormat() {
1843
+ return {
1844
+ query: `
1845
+ mutation DeckImportFormatCreate($input: DeckImportFormatCreateInput!) {
1846
+ deckImportFormatCreate(input: $input) {
1847
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1848
+ }
1849
+ }
1850
+ `
1851
+ };
1852
+ },
1853
+ updateDeckImportFormat() {
1854
+ return {
1855
+ query: `
1856
+ mutation DeckImportFormatUpdate($id: UUID!, $input: DeckImportFormatUpdateInput!) {
1857
+ deckImportFormatUpdate(id: $id, input: $input) {
1858
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1859
+ }
1860
+ }
1861
+ `
1862
+ };
1863
+ },
1864
+ archiveDeckImportFormat() {
1865
+ return {
1866
+ query: `
1867
+ mutation DeckImportFormatArchive($id: UUID!) {
1868
+ deckImportFormatArchive(id: $id) {
1869
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1870
+ }
1871
+ }
1872
+ `
1873
+ };
1874
+ },
1875
+ unarchiveDeckImportFormat() {
1876
+ return {
1877
+ query: `
1878
+ mutation DeckImportFormatUnarchive($id: UUID!) {
1879
+ deckImportFormatUnarchive(id: $id) {
1880
+ ${DECK_IMPORT_FORMAT_DEFINITION_FIELDS}
1881
+ }
1882
+ }
1883
+ `
1884
+ };
1885
+ },
1886
+ upsertDeckByExternalRef() {
1887
+ return {
1888
+ query: `
1889
+ mutation DeckUpsertByExternalRef($input: DeckUpsertByExternalRefInput!) {
1890
+ deckUpsertByExternalRef(input: $input) {
1891
+ deck {
1892
+ ${DECK_FIELDS}
1893
+ }
1894
+ created
1895
+ idempotentReplay
1896
+ }
1897
+ }
1898
+ `
1899
+ };
1900
+ },
1901
+ claimDeck() {
1902
+ return {
1903
+ query: `
1904
+ mutation DeckClaim($id: UUID!, $input: DeckClaimInput!) {
1905
+ deckClaim(id: $id, input: $input) {
1906
+ ${DECK_OWNERSHIP_TRANSFER_PAYLOAD_FIELDS}
1907
+ }
1908
+ }
1909
+ `
1910
+ };
1911
+ },
1912
+ transferDeckOwnership() {
1913
+ return {
1914
+ query: `
1915
+ mutation DeckTransferOwnership($id: UUID!, $input: DeckTransferOwnershipInput!) {
1916
+ deckTransferOwnership(id: $id, input: $input) {
1917
+ ${DECK_OWNERSHIP_TRANSFER_PAYLOAD_FIELDS}
1918
+ }
1919
+ }
1920
+ `
1921
+ };
1922
+ },
1923
+ copyDeck() {
1924
+ return {
1925
+ query: `
1926
+ mutation DeckCopy($id: UUID!, $input: DeckCopyInput!) {
1927
+ deckCopy(id: $id, input: $input) {
1928
+ ${DECK_COPY_PAYLOAD_FIELDS}
1929
+ }
1930
+ }
1931
+ `
1932
+ };
1933
+ },
1041
1934
  publishDeck() {
1042
1935
  return {
1043
1936
  query: `
1044
1937
  mutation DeckPublish($id: UUID!, $input: DeckPublishInput!) {
1045
1938
  deckPublish(id: $id, input: $input) {
1046
- ${DECK_VERSION_FIELDS}
1939
+ ${DECK_PUBLISH_PAYLOAD_FIELDS}
1940
+ }
1941
+ }
1942
+ `
1943
+ };
1944
+ },
1945
+ removeInvalidDeckEntries() {
1946
+ return {
1947
+ query: `
1948
+ mutation DeckRemoveInvalidEntries($id: UUID!, $input: DeckRemoveInvalidEntriesInput!) {
1949
+ deckRemoveInvalidEntries(id: $id, input: $input) {
1950
+ ${DECK_FIELDS}
1047
1951
  }
1048
1952
  }
1049
1953
  `
@@ -1092,21 +1996,193 @@ ${RESOLVED_LINKS_FIELDS}` : RECORD_FIELDS;
1092
1996
  `
1093
1997
  };
1094
1998
  },
1999
+ createDeckEmbedToken() {
2000
+ return {
2001
+ query: `
2002
+ mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) {
2003
+ deckEmbedTokenCreate(input: $input) {
2004
+ token
2005
+ embedToken {
2006
+ ${DECK_EMBED_TOKEN_FIELDS}
2007
+ }
2008
+ }
2009
+ }
2010
+ `
2011
+ };
2012
+ },
2013
+ revokeDeckEmbedToken() {
2014
+ return {
2015
+ query: `
2016
+ mutation DeckEmbedTokenRevoke($id: UUID!) {
2017
+ deckEmbedTokenRevoke(id: $id)
2018
+ }
2019
+ `
2020
+ };
2021
+ },
2022
+ createDeckAccessTokenIssuer() {
2023
+ return {
2024
+ query: `
2025
+ mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) {
2026
+ deckAccessTokenIssuerCreate(input: $input) {
2027
+ ${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
2028
+ }
2029
+ }
2030
+ `
2031
+ };
2032
+ },
2033
+ revokeDeckAccessTokenIssuer() {
2034
+ return {
2035
+ query: `
2036
+ mutation DeckAccessTokenIssuerRevoke($id: UUID!) {
2037
+ deckAccessTokenIssuerRevoke(id: $id)
2038
+ }
2039
+ `
2040
+ };
2041
+ },
2042
+ revokeDeckAccessTokenIssuerSigningKey() {
2043
+ return {
2044
+ query: `
2045
+ mutation DeckAccessTokenIssuerSigningKeyRevoke($id: UUID!) {
2046
+ deckAccessTokenIssuerSigningKeyRevoke(id: $id) {
2047
+ ${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
2048
+ }
2049
+ }
2050
+ `
2051
+ };
2052
+ },
2053
+ exchangeDeckAccessToken() {
2054
+ return {
2055
+ query: `
2056
+ mutation DeckAccessTokenExchange($input: DeckAccessTokenExchangeInput!) {
2057
+ deckAccessTokenExchange(input: $input) {
2058
+ token
2059
+ accessToken {
2060
+ ${DECK_ACCESS_TOKEN_FIELDS}
2061
+ }
2062
+ }
2063
+ }
2064
+ `
2065
+ };
2066
+ },
2067
+ grantDeckApiApplicationAccess() {
2068
+ return {
2069
+ query: `
2070
+ mutation DeckApiApplicationAccessGrant($input: DeckAPIApplicationAccessGrantInput!) {
2071
+ deckApiApplicationAccessGrant(input: $input) {
2072
+ ${DECK_API_APPLICATION_ACCESS_FIELDS}
2073
+ }
2074
+ }
2075
+ `
2076
+ };
2077
+ },
2078
+ revokeDeckApiApplicationAccess() {
2079
+ return {
2080
+ query: `
2081
+ mutation DeckApiApplicationAccessRevoke($deckId: UUID!, $apiApplicationId: UUID!) {
2082
+ deckApiApplicationAccessRevoke(deckId: $deckId, apiApplicationId: $apiApplicationId)
2083
+ }
2084
+ `
2085
+ };
2086
+ },
2087
+ revokeDeckAccessToken() {
2088
+ return {
2089
+ query: `
2090
+ mutation DeckAccessTokenRevoke($id: UUID!) {
2091
+ deckAccessTokenRevoke(id: $id)
2092
+ }
2093
+ `
2094
+ };
2095
+ },
1095
2096
  deckCreateVariables(input) {
1096
2097
  return { input };
1097
2098
  },
1098
2099
  deckUpdateVariables(id, input) {
1099
2100
  return { id, input };
1100
2101
  },
1101
- deckPublishVariables(id, input = {}) {
2102
+ deckEntryAddVariables(input) {
2103
+ return { input };
2104
+ },
2105
+ deckEntryUpdateVariables(id, input) {
1102
2106
  return { id, input };
1103
2107
  },
2108
+ deckEntryRemoveVariables(id, expectedDraftRevision) {
2109
+ return { id, expectedDraftRevision };
2110
+ },
2111
+ deckEntryReorderVariables(deckId, input) {
2112
+ return { deckId, input };
2113
+ },
2114
+ deckEntriesReplaceVariables(deckId, input) {
2115
+ return { deckId, input };
2116
+ },
2117
+ deckImportVariables(input) {
2118
+ return { input };
2119
+ },
2120
+ deckImportFormatCreateVariables(input) {
2121
+ return { input };
2122
+ },
2123
+ deckImportFormatUpdateVariables(id, input) {
2124
+ return { id, input };
2125
+ },
2126
+ deckImportFormatTestVariables(input) {
2127
+ return { input };
2128
+ },
2129
+ deckUpsertByExternalRefVariables(input) {
2130
+ return { input };
2131
+ },
2132
+ deckClaimVariables(id, input) {
2133
+ return { id, input };
2134
+ },
2135
+ deckTransferOwnershipVariables(id, input) {
2136
+ return { id, input };
2137
+ },
2138
+ deckCopyVariables(id, input) {
2139
+ return { id, input };
2140
+ },
2141
+ deckPublishVariables(id, input) {
2142
+ return { id, input };
2143
+ },
2144
+ deckValidateVariables(id, input) {
2145
+ return input === void 0 ? { id } : { id, input };
2146
+ },
2147
+ deckRemoveInvalidEntriesVariables(id, input) {
2148
+ return { id, input };
2149
+ },
2150
+ deckHydrateEntriesVariables(input) {
2151
+ return { input };
2152
+ },
2153
+ deckExportVariables(id, format) {
2154
+ return { id, format };
2155
+ },
2156
+ deckVersionDiffVariables(fromVersionId, toVersionId) {
2157
+ return { fromVersionId, toVersionId };
2158
+ },
1104
2159
  deckCollaboratorVariables(deckId, accountId, role) {
1105
2160
  return role === void 0 ? { deckId, accountId } : { deckId, accountId, role };
1106
2161
  },
1107
2162
  deckPreviewTokenCreateVariables(input) {
1108
2163
  return { input };
1109
2164
  },
2165
+ deckEmbedTokenCreateVariables(input) {
2166
+ return { input };
2167
+ },
2168
+ deckAccessTokenIssuerCreateVariables(input) {
2169
+ return { input };
2170
+ },
2171
+ deckAccessTokenExchangeVariables(input) {
2172
+ return { input };
2173
+ },
2174
+ deckApiApplicationAccessesVariables(deckId, includeRevoked) {
2175
+ return includeRevoked === void 0 ? { deckId } : { deckId, includeRevoked };
2176
+ },
2177
+ myDeckApiApplicationAccessesVariables(applicationId) {
2178
+ return applicationId === void 0 ? {} : { applicationId };
2179
+ },
2180
+ deckApiApplicationAccessGrantVariables(input) {
2181
+ return { input };
2182
+ },
2183
+ deckApiApplicationAccessRevokeVariables(deckId, apiApplicationId) {
2184
+ return { deckId, apiApplicationId };
2185
+ },
1110
2186
  // API Key Info
1111
2187
  fetchMe() {
1112
2188
  return {