@carddb/client 0.1.5 → 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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _carddb_core from '@carddb/core';
2
- import { Logger, LogLevel, Cache, ResourceType, CardDBConfig, RateLimitInfo, GraphQLErrorInfo, Collection, Publisher, Game, Dataset, Deck, DeckVersion, DeckCollaborator, DeckPreviewToken, DeckCreateInput, DeckUpdateInput, DeckPublishInput, DeckCollaboratorRole, DeckPreviewTokenCreateInput, DeckPreviewTokenCreatePayload, HydrateDeckEntryInput, HydratedDeckEntry, FilterInput, DatasetRecord, APIKeyInfo } from '@carddb/core';
2
+ import { Logger, LogLevel, Cache, ResourceType, CardDBConfig, RateLimitInfo, GraphQLErrorInfo, Collection, Publisher, Game, Dataset, Deck, ViewerDecksFilterInput, AppDecksFilterInput, PublicDecksFilterInput, DeckVersion, DeckDiff, DeckValidateInput, DeckValidation, DeckHydrateEntriesInput, DeckHydrateEntriesPayload, DeckExportFormat, DeckExportPayload, DeckSectionDefinition, DeckCollaborator, DeckPreviewToken, DeckEmbedToken, DeckAccessTokenIssuer, DeckAPIApplicationAccess, DeckCreateInput, DeckUpdateInput, DeckUpsertByExternalRefInput, DeckUpsertByExternalRefPayload, DeckClaimInput, DeckOwnershipTransferPayload, DeckTransferOwnershipInput, DeckCopyInput, DeckCopyPayload, DeckEntryAddInput, DeckEntryMutationPayload, DeckEntryUpdateInput, DeckEntryReorderInput, DeckEntryReorderPayload, DeckEntriesReplaceInput, DeckEntriesReplacePayload, DeckImportInput, DeckImportPayload, DeckImportFormatDefinition, DeckImportFormatTestInput, DeckImportFormatTestPayload, DeckImportFormatCreateInput, DeckImportFormatUpdateInput, DeckPublishInput, DeckPublishPayload, DeckRemoveInvalidEntriesInput, DeckCollaboratorRole, DeckPreviewTokenCreateInput, DeckPreviewTokenCreatePayload, DeckEmbedTokenCreateInput, DeckEmbedTokenCreatePayload, DeckAccessTokenIssuerCreateInput, DeckAPIApplicationAccessGrantInput, DeckAccessTokenExchangeInput, DeckAccessTokenExchangePayload, HydrateDeckEntryInput, HydratedDeckEntry, FilterInput, DatasetRecord, APIKeyInfo } from '@carddb/core';
3
3
  export * from '@carddb/core';
4
4
 
5
5
  /**
@@ -16,6 +16,11 @@ declare const DEFAULT_RETRY_BASE_DELAY = 1000;
16
16
  declare const DEFAULT_RETRY_MAX_DELAY = 30000;
17
17
  declare class Configuration {
18
18
  apiKey?: string;
19
+ publishableKey?: string;
20
+ secretKey?: string;
21
+ accessToken?: string;
22
+ private legacyApiKey?;
23
+ environment?: 'TEST' | 'LIVE';
19
24
  endpoint: string;
20
25
  timeout: number;
21
26
  openTimeout: number;
@@ -65,6 +70,18 @@ declare class Configuration {
65
70
  * Validate both publisher and game access
66
71
  */
67
72
  validateAccess(publisherSlug?: string, gameKey?: string): void;
73
+ /**
74
+ * Secret-key-only helpers are for server runtimes and trusted backend workflows.
75
+ */
76
+ requireSecretCredential(operation: string): void;
77
+ /**
78
+ * API key sent on requests when no OAuth bearer token is configured.
79
+ */
80
+ requestApiKey(): string | undefined;
81
+ /**
82
+ * Explicit legacy apiKey supplied by the caller, excluding publishable/secret aliases.
83
+ */
84
+ configApiKey(): string | undefined;
68
85
  /**
69
86
  * Check if a log level should be logged
70
87
  */
@@ -323,9 +340,20 @@ interface ListDecksOptions {
323
340
  first?: number;
324
341
  /** Cursor for pagination */
325
342
  after?: string;
343
+ /** Include archived decks in owner lists */
344
+ includeArchived?: boolean;
326
345
  /** Whether to use cache (defaults to client config) */
327
346
  cache?: boolean;
328
347
  }
348
+ interface ListViewerDecksOptions extends ListDecksOptions {
349
+ filter?: ViewerDecksFilterInput;
350
+ }
351
+ interface ListAppDecksOptions extends ListDecksOptions {
352
+ filter?: AppDecksFilterInput;
353
+ }
354
+ interface ListPublicDecksOptions extends Omit<ListDecksOptions, 'includeArchived'> {
355
+ filter?: PublicDecksFilterInput;
356
+ }
329
357
  interface FetchDeckOptions {
330
358
  /** Whether to use cache (defaults to client config) */
331
359
  cache?: boolean;
@@ -335,6 +363,22 @@ type FetchDeckBySlugOptions = FetchDeckOptions;
335
363
  type ListDeckVersionsOptions = ListDecksOptions;
336
364
  type ListDeckCollaboratorsOptions = FetchDeckOptions;
337
365
  type ListDeckPreviewTokensOptions = FetchDeckOptions;
366
+ type ListDeckEmbedTokensOptions = FetchDeckOptions;
367
+ type ListDeckAccessTokenIssuersOptions = FetchDeckOptions;
368
+ interface ListDeckApiApplicationAccessesOptions extends FetchDeckOptions {
369
+ includeRevoked?: boolean;
370
+ }
371
+ interface ListMyDeckApiApplicationAccessesOptions extends FetchDeckOptions {
372
+ applicationId?: string;
373
+ }
374
+ type ListDeckImportFormatsOptions = ListDecksOptions;
375
+ interface DeckSectionDefinitionsOptions extends FetchDeckOptions {
376
+ publisherSlug?: string;
377
+ gameKey?: string;
378
+ gameId?: string;
379
+ rulesetKey?: string;
380
+ rulesetVersionId?: string;
381
+ }
338
382
  interface HydrateDeckEntriesOptions {
339
383
  /** Publisher slug (uses default if configured) */
340
384
  publisherSlug?: string;
@@ -355,6 +399,10 @@ declare class DecksResource extends BaseResource {
355
399
  * Fetch a hosted deck by CardDB UUID.
356
400
  */
357
401
  fetch(id: string, options?: FetchDeckOptions): Promise<Deck | null>;
402
+ /**
403
+ * Fetch a deck by UUID using the ownership-aware `deck` API.
404
+ */
405
+ get(id: string, options?: FetchDeckOptions): Promise<Deck | null>;
358
406
  /**
359
407
  * Fetch one deck owned by the current account or API application.
360
408
  */
@@ -363,14 +411,34 @@ declare class DecksResource extends BaseResource {
363
411
  * Fetch a hosted deck by canonical or historical slug.
364
412
  */
365
413
  fetchBySlug(publisherSlug: string, gameKey: string, slug: string, options?: FetchDeckBySlugOptions): Promise<Deck | null>;
414
+ /**
415
+ * Fetch by slug using the ownership-aware `deckBySlug` API.
416
+ */
417
+ getBySlug(publisherSlug: string, gameKey: string, slug: string, options?: FetchDeckBySlugOptions): Promise<Deck | null>;
366
418
  /**
367
419
  * Fetch a hosted deck by external reference for the current API application.
368
420
  */
369
421
  fetchByExternalRef(externalRef: string, options?: FetchDeckByExternalRefOptions): Promise<Deck | null>;
422
+ /**
423
+ * Fetch by external reference using the ownership-aware `deckByExternalRef` API.
424
+ */
425
+ getByExternalRef(externalRef: string, options?: FetchDeckByExternalRefOptions): Promise<Deck | null>;
370
426
  /**
371
427
  * List decks owned by the current account or API application.
372
428
  */
373
429
  listMine(options?: ListDecksOptions): Promise<Collection<Deck>>;
430
+ /**
431
+ * List decks owned by the current account or OAuth grant.
432
+ */
433
+ listViewer(options?: ListViewerDecksOptions): Promise<Collection<Deck>>;
434
+ /**
435
+ * List app-owned decks for the current secret-key API application.
436
+ */
437
+ listApp(options?: ListAppDecksOptions): Promise<Collection<Deck>>;
438
+ /**
439
+ * List published live decks eligible for public discovery.
440
+ */
441
+ listPublic(options?: ListPublicDecksOptions): Promise<Collection<Deck>>;
374
442
  /**
375
443
  * Fetch one immutable published deck version.
376
444
  */
@@ -383,6 +451,38 @@ declare class DecksResource extends BaseResource {
383
451
  * Fetch current draft data using a revocable preview token.
384
452
  */
385
453
  preview(token: string, options?: FetchDeckOptions): Promise<Deck | null>;
454
+ /**
455
+ * Fetch published embed data using a revocable embed token.
456
+ */
457
+ embed(token: string, options?: FetchDeckOptions): Promise<Deck | null>;
458
+ /**
459
+ * Fetch token-authorized published data using an exchanged access token.
460
+ */
461
+ access(token: string, options?: FetchDeckOptions): Promise<Deck | null>;
462
+ /**
463
+ * Compare the current draft against the latest published version.
464
+ */
465
+ draftDiff(id: string, options?: FetchDeckOptions): Promise<DeckDiff>;
466
+ /**
467
+ * Compare any two readable immutable deck versions from the same deck.
468
+ */
469
+ versionDiff(fromVersionId: string, toVersionId: string, options?: FetchDeckOptions): Promise<DeckDiff>;
470
+ /**
471
+ * Validate a draft against current or explicitly requested immutable rules/data.
472
+ */
473
+ validate(id: string, input?: DeckValidateInput, options?: FetchDeckOptions): Promise<DeckValidation>;
474
+ /**
475
+ * Hydrate unpersisted deck entries against a stored deck's game without mutating the deck.
476
+ */
477
+ hydrateDeckEntries(input: DeckHydrateEntriesInput, options?: FetchDeckOptions): Promise<DeckHydrateEntriesPayload>;
478
+ /**
479
+ * Export a readable deck representation in a deterministic text format.
480
+ */
481
+ exportDeck(id: string, format?: DeckExportFormat, options?: FetchDeckOptions): Promise<DeckExportPayload>;
482
+ /**
483
+ * Resolve current or historical ruleset section definitions.
484
+ */
485
+ sectionDefinitions(options?: DeckSectionDefinitionsOptions): Promise<DeckSectionDefinition[]>;
386
486
  /**
387
487
  * List collaborators for a deck.
388
488
  */
@@ -391,6 +491,22 @@ declare class DecksResource extends BaseResource {
391
491
  * List draft preview tokens for a deck.
392
492
  */
393
493
  listPreviewTokens(deckId: string, options?: ListDeckPreviewTokensOptions): Promise<DeckPreviewToken[]>;
494
+ /**
495
+ * List published embed tokens for a deck.
496
+ */
497
+ listEmbedTokens(deckId: string, options?: ListDeckEmbedTokensOptions): Promise<DeckEmbedToken[]>;
498
+ /**
499
+ * List trusted access token issuers for a deck.
500
+ */
501
+ listAccessTokenIssuers(deckId: string, options?: ListDeckAccessTokenIssuersOptions): Promise<DeckAccessTokenIssuer[]>;
502
+ /**
503
+ * List API applications with explicit access to one owned deck.
504
+ */
505
+ listApiApplicationAccesses(deckId: string, options?: ListDeckApiApplicationAccessesOptions): Promise<DeckAPIApplicationAccess[]>;
506
+ /**
507
+ * List selected-deck grants for the current account.
508
+ */
509
+ listMyApiApplicationAccesses(options?: ListMyDeckApiApplicationAccessesOptions): Promise<DeckAPIApplicationAccess[]>;
394
510
  /**
395
511
  * Create a hosted deck.
396
512
  */
@@ -399,14 +515,102 @@ declare class DecksResource extends BaseResource {
399
515
  * Update a hosted deck.
400
516
  */
401
517
  update(id: string, input: DeckUpdateInput): Promise<Deck>;
518
+ /**
519
+ * Update deck-level metadata without mutating entries.
520
+ */
521
+ updateMetadata(id: string, input: DeckUpdateInput): Promise<Deck>;
522
+ /**
523
+ * Create or replace a draft by API-application external reference.
524
+ */
525
+ upsertByExternalRef(input: DeckUpsertByExternalRefInput): Promise<DeckUpsertByExternalRefPayload>;
526
+ /**
527
+ * Claim an app-owned deck into the consenting OAuth user's account.
528
+ */
529
+ claim(id: string, input: DeckClaimInput): Promise<DeckOwnershipTransferPayload>;
530
+ /**
531
+ * Transfer a deck to another account.
532
+ */
533
+ transferOwnership(id: string, input: DeckTransferOwnershipInput): Promise<DeckOwnershipTransferPayload>;
534
+ /**
535
+ * Copy a deck into the current principal's ownership namespace.
536
+ */
537
+ copy(id: string, input: DeckCopyInput): Promise<DeckCopyPayload>;
538
+ /**
539
+ * Add one entry to a deck draft.
540
+ */
541
+ addEntry(input: DeckEntryAddInput): Promise<DeckEntryMutationPayload>;
542
+ /**
543
+ * Update one stable deck entry.
544
+ */
545
+ updateEntry(id: string, input: DeckEntryUpdateInput): Promise<DeckEntryMutationPayload>;
546
+ /**
547
+ * Remove one stable deck entry.
548
+ */
549
+ removeEntry(id: string, expectedDraftRevision: number): Promise<DeckEntryMutationPayload>;
550
+ /**
551
+ * Reorder deck entries within or across sections.
552
+ */
553
+ reorderEntries(deckId: string, input: DeckEntryReorderInput): Promise<DeckEntryReorderPayload>;
554
+ /**
555
+ * Explicitly replace all deck entries for import or repair flows.
556
+ */
557
+ replaceEntries(deckId: string, input: DeckEntriesReplaceInput): Promise<DeckEntriesReplacePayload>;
558
+ /**
559
+ * Import a decklist into an existing deck or dry-run resolution.
560
+ */
561
+ importDeck(input: DeckImportInput): Promise<DeckImportPayload>;
562
+ /**
563
+ * List publisher-managed configured import formats for a game.
564
+ */
565
+ listImportFormats(gameId: string, options?: ListDeckImportFormatsOptions): Promise<Collection<DeckImportFormatDefinition>>;
566
+ /**
567
+ * Fetch one configured import format by UUID.
568
+ */
569
+ fetchImportFormat(id: string, options?: FetchDeckOptions): Promise<DeckImportFormatDefinition | null>;
570
+ /**
571
+ * Preview configured import-format parsing and record resolution.
572
+ */
573
+ testImportFormat(input: DeckImportFormatTestInput): Promise<DeckImportFormatTestPayload>;
574
+ /**
575
+ * Create a publisher-managed configured import format.
576
+ */
577
+ createImportFormat(input: DeckImportFormatCreateInput): Promise<DeckImportFormatDefinition>;
578
+ /**
579
+ * Update a publisher-managed configured import format.
580
+ */
581
+ updateImportFormat(id: string, input: DeckImportFormatUpdateInput): Promise<DeckImportFormatDefinition>;
582
+ /**
583
+ * Archive a configured import format.
584
+ */
585
+ archiveImportFormat(id: string): Promise<DeckImportFormatDefinition>;
586
+ /**
587
+ * Restore an archived configured import format.
588
+ */
589
+ unarchiveImportFormat(id: string): Promise<DeckImportFormatDefinition>;
402
590
  /**
403
591
  * Delete a hosted deck.
404
592
  */
405
593
  delete(id: string): Promise<boolean>;
594
+ /**
595
+ * Recoverably hide a deck from normal owner and public lists.
596
+ */
597
+ archive(id: string): Promise<Deck>;
598
+ /**
599
+ * Restore an archived deck to draft or published state.
600
+ */
601
+ restore(id: string): Promise<Deck>;
602
+ /**
603
+ * Remove the current public published pointer while keeping version history.
604
+ */
605
+ unpublish(id: string): Promise<Deck>;
406
606
  /**
407
607
  * Publish the current draft as an immutable deck version.
408
608
  */
409
- publish(id: string, input?: DeckPublishInput): Promise<DeckVersion>;
609
+ publish(id: string, input: DeckPublishInput): Promise<DeckPublishPayload>;
610
+ /**
611
+ * Remove draft entries that fail card-reference validation.
612
+ */
613
+ removeInvalidEntries(id: string, input: DeckRemoveInvalidEntriesInput): Promise<Deck>;
410
614
  /**
411
615
  * Create or update a deck collaborator.
412
616
  */
@@ -423,6 +627,42 @@ declare class DecksResource extends BaseResource {
423
627
  * Revoke a draft preview token.
424
628
  */
425
629
  revokePreviewToken(id: string): Promise<boolean>;
630
+ /**
631
+ * Create a revocable published embed token.
632
+ */
633
+ createEmbedToken(input: DeckEmbedTokenCreateInput): Promise<DeckEmbedTokenCreatePayload>;
634
+ /**
635
+ * Revoke a published embed token.
636
+ */
637
+ revokeEmbedToken(id: string): Promise<boolean>;
638
+ /**
639
+ * Trust the current API application to exchange short-lived deck access tokens.
640
+ */
641
+ createAccessTokenIssuer(input: DeckAccessTokenIssuerCreateInput): Promise<DeckAccessTokenIssuer>;
642
+ /**
643
+ * Revoke a trusted deck access token issuer.
644
+ */
645
+ revokeAccessTokenIssuer(id: string): Promise<boolean>;
646
+ /**
647
+ * Revoke only the direct signing key for a trusted deck access token issuer.
648
+ */
649
+ revokeAccessTokenIssuerSigningKey(id: string): Promise<DeckAccessTokenIssuer>;
650
+ /**
651
+ * Grant or update one OAuth app's selected-deck access.
652
+ */
653
+ grantApiApplicationAccess(input: DeckAPIApplicationAccessGrantInput): Promise<DeckAPIApplicationAccess>;
654
+ /**
655
+ * Revoke one OAuth app's selected-deck access.
656
+ */
657
+ revokeApiApplicationAccess(deckId: string, apiApplicationId: string): Promise<boolean>;
658
+ /**
659
+ * Exchange the current trusted API application credential for a deck access token.
660
+ */
661
+ exchangeAccessToken(input: DeckAccessTokenExchangeInput): Promise<DeckAccessTokenExchangePayload>;
662
+ /**
663
+ * Revoke an exchanged deck access token.
664
+ */
665
+ revokeAccessToken(id: string): Promise<boolean>;
426
666
  /**
427
667
  * Hydrate third-party-owned deck entries without storing them in CardDB.
428
668
  */
@@ -837,4 +1077,4 @@ declare function readCache<T>(cache: Cache, key: string): Promise<T | null>;
837
1077
  */
838
1078
  declare function writeCache<T>(cache: Cache, key: string, value: T, ttl: number): Promise<void>;
839
1079
 
840
- export { BaseResource, CardDBClient, Configuration, Connection, DEFAULT_CACHE_TTL, DEFAULT_ENDPOINT, DEFAULT_MAX_NETWORK_RETRIES, DEFAULT_MAX_RETRIES, DEFAULT_OPEN_TIMEOUT, DEFAULT_RETRY_BASE_DELAY, DEFAULT_RETRY_MAX_DELAY, DEFAULT_TIMEOUT, DatasetsResource, DecksResource, type FetchDeckByExternalRefOptions, type FetchDeckBySlugOptions, type FetchDeckOptions, GamesResource, type GetDatasetOptions, type GetGameOptions, type GetPublisherOptions, type GetRecordByIdentifierOptions, type GetRecordOptions, type GetRecordsByIdentifierOptions, type GraphQLResponse, type HydrateDeckEntriesOptions, type ListDeckCollaboratorsOptions, type ListDeckPreviewTokensOptions, type ListDeckVersionsOptions, type ListDecksOptions, type ListFormatsOptions, type ListRuleDatasetsOptions, type ListRulesOptions, PublishersResource, RecordsResource, RulesResource, type SearchDatasetsOptions, type SearchGamesOptions, type SearchPublishersOptions, type SearchRecordsOptions, cacheKey, getRateLimitInfo, getSDKVersion, getUserAgent, readCache, writeCache };
1080
+ export { BaseResource, CardDBClient, Configuration, Connection, DEFAULT_CACHE_TTL, DEFAULT_ENDPOINT, DEFAULT_MAX_NETWORK_RETRIES, DEFAULT_MAX_RETRIES, DEFAULT_OPEN_TIMEOUT, DEFAULT_RETRY_BASE_DELAY, DEFAULT_RETRY_MAX_DELAY, DEFAULT_TIMEOUT, DatasetsResource, type DeckSectionDefinitionsOptions, DecksResource, type FetchDeckByExternalRefOptions, type FetchDeckBySlugOptions, type FetchDeckOptions, GamesResource, type GetDatasetOptions, type GetGameOptions, type GetPublisherOptions, type GetRecordByIdentifierOptions, type GetRecordOptions, type GetRecordsByIdentifierOptions, type GraphQLResponse, type HydrateDeckEntriesOptions, type ListAppDecksOptions, type ListDeckAccessTokenIssuersOptions, type ListDeckApiApplicationAccessesOptions, type ListDeckCollaboratorsOptions, type ListDeckEmbedTokensOptions, type ListDeckImportFormatsOptions, type ListDeckPreviewTokensOptions, type ListDeckVersionsOptions, type ListDecksOptions, type ListFormatsOptions, type ListMyDeckApiApplicationAccessesOptions, type ListPublicDecksOptions, type ListRuleDatasetsOptions, type ListRulesOptions, type ListViewerDecksOptions, PublishersResource, RecordsResource, RulesResource, type SearchDatasetsOptions, type SearchGamesOptions, type SearchPublishersOptions, type SearchRecordsOptions, cacheKey, getRateLimitInfo, getSDKVersion, getUserAgent, readCache, writeCache };