@carddb/client 0.3.15 → 0.4.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/README.md +1 -1
- package/dist/index.cjs +336 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +171 -2
- package/dist/index.d.ts +171 -2
- package/dist/index.js +335 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
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, GameCreateInput, GameUpdateInput, Dataset, DatasetSchema, 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, DeckSessionTokenExchangeInput, DeckSessionTokenExchangePayload, HydrateDeckEntryInput, HydratedDeckEntry, FilterInput, DatasetRecord, DatasetRecordsUpsertInput, DatasetRecordsUpsertPayload, DatasetRecordsDeleteInput, DatasetRecordDeleteJob, DatasetRecordDeleteJobStatus, DatasetImportPreviewInput, DatasetImportPreviewResult, DatasetImportValidateInput, BulkImportResult, DatasetImportRunInput, ImportJob, ImportJobStatus, ImportLogLevel, ImportJobLog, GameImportPreviewInput, GameImportPreview, GameImportRunInput, GameImportJob, DatasetExportInput, ExportJob, ExportJobStatus, File, FileUploadInput, PresignedUpload, APIKeyInfo } from '@carddb/core';
|
|
2
|
+
import { Logger, LogLevel, Cache, ResourceType, CardDBConfig, RateLimitInfo, GraphQLErrorInfo, Collection, Publisher, Game, GameCreateInput, GameUpdateInput, GameScanRegion, Dataset, DatasetSchema, 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, DeckSessionTokenExchangeInput, DeckSessionTokenExchangePayload, HydrateDeckEntryInput, HydratedDeckEntry, FilterInput, DatasetRecord, DatasetRecordsUpsertInput, DatasetRecordsUpsertPayload, DatasetRecordsDeleteInput, DatasetRecordDeleteJob, DatasetRecordDeleteJobStatus, DatasetImportPreviewInput, DatasetImportPreviewResult, DatasetImportValidateInput, BulkImportResult, DatasetImportRunInput, ImportJob, ImportJobStatus, ImportLogLevel, ImportJobLog, GameImportPreviewInput, GameImportPreview, GameImportRunInput, GameImportJob, DatasetExportInput, ExportJob, ExportJobStatus, File, FileUploadInput, PresignedUpload, UploadPurpose, CreateScanJobInput, ScanJobPayload, ScanJob, SubmitScanFeedbackInput, ScanFeedbackPayload, ScanMetricsInput, ScanMetrics, ResolveScanTemplateInput, ScanTemplateResolution, ScanTemplatesInput, ScanTemplate, SaveScanTemplateInput, ScanTemplatePayload, PreviewScanTemplateInput, ScanTemplatePreview, APIKeyInfo } from '@carddb/core';
|
|
3
3
|
export * from '@carddb/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -256,6 +256,14 @@ interface GetGameBySlugOptions extends GetGameOptions {
|
|
|
256
256
|
/** Stable game slug, currently backed by metafyGameSlug */
|
|
257
257
|
gameSlug: string;
|
|
258
258
|
}
|
|
259
|
+
interface GetGameRegionsOptions extends GetGameOptions {
|
|
260
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
261
|
+
publisherSlug?: string;
|
|
262
|
+
/** Stable game key, defaults to client defaultGame */
|
|
263
|
+
gameKey?: string;
|
|
264
|
+
/** Include inactive publisher-managed scan regions */
|
|
265
|
+
includeInactive?: boolean;
|
|
266
|
+
}
|
|
259
267
|
declare class GamesResource extends BaseResource {
|
|
260
268
|
constructor(connection: Connection, config: Configuration);
|
|
261
269
|
/**
|
|
@@ -278,6 +286,10 @@ declare class GamesResource extends BaseResource {
|
|
|
278
286
|
* Update a publisher-managed game. Requires a server-side secret credential.
|
|
279
287
|
*/
|
|
280
288
|
update(id: string, input: GameUpdateInput): Promise<Game>;
|
|
289
|
+
/**
|
|
290
|
+
* Get publisher-defined game region metadata for scan-capable clients.
|
|
291
|
+
*/
|
|
292
|
+
getRegions(options?: GetGameRegionsOptions): Promise<GameScanRegion[]>;
|
|
281
293
|
/**
|
|
282
294
|
* Search for games
|
|
283
295
|
*
|
|
@@ -1324,6 +1336,22 @@ interface GetFileOptions {
|
|
|
1324
1336
|
/** Whether to use cache (defaults to client config) */
|
|
1325
1337
|
cache?: boolean;
|
|
1326
1338
|
}
|
|
1339
|
+
interface UploadFileInput {
|
|
1340
|
+
filename: string;
|
|
1341
|
+
contentType: string;
|
|
1342
|
+
body: unknown;
|
|
1343
|
+
/** File size in bytes. Inferred for strings, ArrayBuffers, typed arrays, Blob/File-like values. */
|
|
1344
|
+
size?: number;
|
|
1345
|
+
/** Defaults to false. */
|
|
1346
|
+
isPublic?: boolean;
|
|
1347
|
+
/** Convenience purpose mapped onto existing file metadata. */
|
|
1348
|
+
purpose?: UploadPurpose;
|
|
1349
|
+
/** Override the entity type sent to the API. */
|
|
1350
|
+
entityType?: string;
|
|
1351
|
+
entityId?: string;
|
|
1352
|
+
publisherId?: string;
|
|
1353
|
+
datasetId?: string;
|
|
1354
|
+
}
|
|
1327
1355
|
declare class FilesResource extends BaseResource {
|
|
1328
1356
|
constructor(connection: Connection, config: Configuration);
|
|
1329
1357
|
/**
|
|
@@ -1338,12 +1366,149 @@ declare class FilesResource extends BaseResource {
|
|
|
1338
1366
|
* Confirm that a presigned upload completed.
|
|
1339
1367
|
*/
|
|
1340
1368
|
confirmUpload(id: string): Promise<File>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Request a presigned upload URL, PUT bytes directly to storage, then confirm the file.
|
|
1371
|
+
*/
|
|
1372
|
+
upload(input: UploadFileInput): Promise<File>;
|
|
1341
1373
|
/**
|
|
1342
1374
|
* Delete a file. Requires a server-side secret credential.
|
|
1343
1375
|
*/
|
|
1344
1376
|
delete(id: string): Promise<boolean>;
|
|
1345
1377
|
}
|
|
1346
1378
|
|
|
1379
|
+
/**
|
|
1380
|
+
* Scan job resource for CardDB API
|
|
1381
|
+
*/
|
|
1382
|
+
|
|
1383
|
+
type CreateScanJobOptions = Omit<CreateScanJobInput, 'publisherSlug' | 'gameKey'> & {
|
|
1384
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1385
|
+
publisherSlug?: string;
|
|
1386
|
+
/** Game key, defaults to client defaultGame */
|
|
1387
|
+
gameKey?: string;
|
|
1388
|
+
};
|
|
1389
|
+
type ScanMetricsOptions = Omit<ScanMetricsInput, 'publisherSlug' | 'gameKey'> & {
|
|
1390
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1391
|
+
publisherSlug?: string;
|
|
1392
|
+
/** Game key, defaults to client defaultGame */
|
|
1393
|
+
gameKey?: string;
|
|
1394
|
+
};
|
|
1395
|
+
interface GetScanJobOptions {
|
|
1396
|
+
/** Whether to use cache (defaults to client config) */
|
|
1397
|
+
cache?: boolean;
|
|
1398
|
+
}
|
|
1399
|
+
interface PollScanJobOptions {
|
|
1400
|
+
/** First delay between polling attempts in milliseconds */
|
|
1401
|
+
intervalMs?: number;
|
|
1402
|
+
/** Maximum total polling time in milliseconds */
|
|
1403
|
+
timeoutMs?: number;
|
|
1404
|
+
/** Multiplier applied to the delay after each non-terminal response */
|
|
1405
|
+
backoffFactor?: number;
|
|
1406
|
+
/** Maximum delay between polling attempts in milliseconds */
|
|
1407
|
+
maxIntervalMs?: number;
|
|
1408
|
+
/** Abort-like signal. The SDK checks `aborted` before each request and sleep. */
|
|
1409
|
+
signal?: PollSignal;
|
|
1410
|
+
}
|
|
1411
|
+
interface PollSignal {
|
|
1412
|
+
aborted: boolean;
|
|
1413
|
+
reason?: unknown;
|
|
1414
|
+
throwIfAborted?: () => void;
|
|
1415
|
+
}
|
|
1416
|
+
interface VerifyWebhookSignatureInput {
|
|
1417
|
+
body: string | ArrayBuffer | ArrayBufferView;
|
|
1418
|
+
signature: string;
|
|
1419
|
+
secret: string;
|
|
1420
|
+
}
|
|
1421
|
+
declare class ScansResource extends BaseResource {
|
|
1422
|
+
constructor(connection: Connection, config: Configuration);
|
|
1423
|
+
/**
|
|
1424
|
+
* Create a scan job for an already uploaded image file.
|
|
1425
|
+
*/
|
|
1426
|
+
createJob(input: CreateScanJobOptions): Promise<ScanJobPayload>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Get a scan job and its latest processing result.
|
|
1429
|
+
*/
|
|
1430
|
+
getJob(id: string, options?: GetScanJobOptions): Promise<ScanJob | null>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Poll a scan job until it reaches a terminal status.
|
|
1433
|
+
*/
|
|
1434
|
+
pollJob(id: string, options?: PollScanJobOptions): Promise<ScanJob>;
|
|
1435
|
+
/**
|
|
1436
|
+
* Submit correctness feedback for a completed scan job.
|
|
1437
|
+
*/
|
|
1438
|
+
submitFeedback(input: SubmitScanFeedbackInput): Promise<ScanFeedbackPayload>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Aggregate scan metrics for a publisher/game/dataset scope.
|
|
1441
|
+
*/
|
|
1442
|
+
metrics(input: ScanMetricsOptions): Promise<ScanMetrics>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Verify an `X-CardDB-Signature` value for a webhook body.
|
|
1445
|
+
*/
|
|
1446
|
+
verifyWebhookSignature(input: VerifyWebhookSignatureInput): Promise<boolean>;
|
|
1447
|
+
private resolveCreateJobInput;
|
|
1448
|
+
private resolveMetricsInput;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Scan template resource for CardDB API
|
|
1453
|
+
*/
|
|
1454
|
+
|
|
1455
|
+
type ResolveScanTemplateOptions = Omit<ResolveScanTemplateInput, 'publisherSlug' | 'gameKey'> & {
|
|
1456
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1457
|
+
publisherSlug?: string;
|
|
1458
|
+
/** Game key, defaults to client defaultGame */
|
|
1459
|
+
gameKey?: string;
|
|
1460
|
+
/** Whether to use cache (defaults to client config) */
|
|
1461
|
+
cache?: boolean;
|
|
1462
|
+
};
|
|
1463
|
+
type ListScanTemplatesOptions = Omit<ScanTemplatesInput, 'publisherSlug' | 'gameKey'> & {
|
|
1464
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1465
|
+
publisherSlug?: string;
|
|
1466
|
+
/** Game key, defaults to client defaultGame */
|
|
1467
|
+
gameKey?: string;
|
|
1468
|
+
/** Whether to use cache (defaults to client config) */
|
|
1469
|
+
cache?: boolean;
|
|
1470
|
+
};
|
|
1471
|
+
type SaveScanTemplateOptions = Omit<SaveScanTemplateInput, 'publisherSlug' | 'gameKey'> & {
|
|
1472
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1473
|
+
publisherSlug?: string;
|
|
1474
|
+
/** Game key, defaults to client defaultGame */
|
|
1475
|
+
gameKey?: string;
|
|
1476
|
+
};
|
|
1477
|
+
type PreviewScanTemplateOptions = Omit<PreviewScanTemplateInput, 'publisherSlug' | 'gameKey'> & {
|
|
1478
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1479
|
+
publisherSlug?: string;
|
|
1480
|
+
/** Game key, defaults to client defaultGame */
|
|
1481
|
+
gameKey?: string;
|
|
1482
|
+
};
|
|
1483
|
+
type UpdateScanTemplateOptions = SaveScanTemplateOptions & {
|
|
1484
|
+
id: string;
|
|
1485
|
+
};
|
|
1486
|
+
declare class ScanTemplatesResource extends BaseResource {
|
|
1487
|
+
constructor(connection: Connection, config: Configuration);
|
|
1488
|
+
/**
|
|
1489
|
+
* Resolve the active scan template for a game or dataset scope.
|
|
1490
|
+
*/
|
|
1491
|
+
resolve(input: ResolveScanTemplateOptions): Promise<ScanTemplateResolution>;
|
|
1492
|
+
/**
|
|
1493
|
+
* List publisher-managed scan templates for a game or dataset scope.
|
|
1494
|
+
*/
|
|
1495
|
+
list(input: ListScanTemplatesOptions): Promise<ScanTemplate[]>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Create a publisher-managed scan template. Requires a server-side secret credential.
|
|
1498
|
+
*/
|
|
1499
|
+
create(input: SaveScanTemplateOptions): Promise<ScanTemplatePayload>;
|
|
1500
|
+
update(input: UpdateScanTemplateOptions): Promise<ScanTemplatePayload>;
|
|
1501
|
+
update(id: string, input: SaveScanTemplateOptions): Promise<ScanTemplatePayload>;
|
|
1502
|
+
/**
|
|
1503
|
+
* Validate a draft scan template and normalize provided region OCR hints.
|
|
1504
|
+
*/
|
|
1505
|
+
preview(input: PreviewScanTemplateOptions): Promise<ScanTemplatePreview>;
|
|
1506
|
+
private resolveTemplateScope;
|
|
1507
|
+
private resolveListScope;
|
|
1508
|
+
private resolveSaveInput;
|
|
1509
|
+
private resolvePreviewInput;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1347
1512
|
/**
|
|
1348
1513
|
* CardDB API Client
|
|
1349
1514
|
*
|
|
@@ -1415,6 +1580,10 @@ declare class CardDBClient {
|
|
|
1415
1580
|
readonly exports: ExportsResource;
|
|
1416
1581
|
/** File upload helper resource */
|
|
1417
1582
|
readonly files: FilesResource;
|
|
1583
|
+
/** Scan job helper resource */
|
|
1584
|
+
readonly scans: ScansResource;
|
|
1585
|
+
/** Scan template helper resource */
|
|
1586
|
+
readonly scanTemplates: ScanTemplatesResource;
|
|
1418
1587
|
/**
|
|
1419
1588
|
* Create a new CardDB client
|
|
1420
1589
|
*
|
|
@@ -1496,4 +1665,4 @@ declare function readCache<T>(cache: Cache, key: string): Promise<T | null>;
|
|
|
1496
1665
|
*/
|
|
1497
1666
|
declare function writeCache<T>(cache: Cache, key: string, value: T, ttl: number): Promise<void>;
|
|
1498
1667
|
|
|
1499
|
-
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, ExportsResource, type FetchDeckByExternalRefOptions, type FetchDeckBySlugOptions, type FetchDeckOptions, FilesResource, GamesResource, type GetDatasetByKeyOptions, type GetDatasetOptions, type GetFileOptions, type GetGameByKeyOptions, type GetGameBySlugOptions, type GetGameOptions, type GetImportFormatByKeyOptions, type GetImportFormatOptions, type GetPublisherOptions, type GetRecordByDatasetIdentifierOptions, type GetRecordByIdentifierOptions, type GetRecordOptions, type GetRecordsByIdentifierOptions, type GraphQLResponse, type HydrateDeckEntriesOptions, ImportFormatsResource, ImportsResource, type ListAppDecksOptions, type ListDatasetsOptions, type ListDeckAccessTokenIssuersOptions, type ListDeckApiApplicationAccessesOptions, type ListDeckCollaboratorsOptions, type ListDeckEmbedTokensOptions, type ListDeckImportFormatsOptions, type ListDeckPreviewTokensOptions, type ListDeckVersionsOptions, type ListDecksOptions, type ListExportJobsOptions, type ListFormatsOptions, type ListGameImportJobsOptions, type ListGamesOptions, type ListImportFormatsOptions, type ListImportJobLogsOptions, type ListImportJobsOptions, type ListMyDeckApiApplicationAccessesOptions, type ListPublicDecksOptions, type ListRecordDeleteJobsOptions, type ListRecordsOptions, type ListRuleDatasetsOptions, type ListRulesOptions, type ListViewerDecksOptions, PublishersResource, RecordsResource, RulesResource, type SearchDatasetsOptions, type SearchGamesOptions, type SearchPublishersOptions, type SearchRecordsOptions, type WaitForExportJobOptions, type WaitForImportJobOptions, type WaitForRecordDeleteJobOptions, cacheKey, getRateLimitInfo, getSDKVersion, getUserAgent, readCache, writeCache };
|
|
1668
|
+
export { BaseResource, CardDBClient, Configuration, Connection, type CreateScanJobOptions, 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, ExportsResource, type FetchDeckByExternalRefOptions, type FetchDeckBySlugOptions, type FetchDeckOptions, FilesResource, GamesResource, type GetDatasetByKeyOptions, type GetDatasetOptions, type GetFileOptions, type GetGameByKeyOptions, type GetGameBySlugOptions, type GetGameOptions, type GetGameRegionsOptions, type GetImportFormatByKeyOptions, type GetImportFormatOptions, type GetPublisherOptions, type GetRecordByDatasetIdentifierOptions, type GetRecordByIdentifierOptions, type GetRecordOptions, type GetRecordsByIdentifierOptions, type GetScanJobOptions, type GraphQLResponse, type HydrateDeckEntriesOptions, ImportFormatsResource, ImportsResource, type ListAppDecksOptions, type ListDatasetsOptions, type ListDeckAccessTokenIssuersOptions, type ListDeckApiApplicationAccessesOptions, type ListDeckCollaboratorsOptions, type ListDeckEmbedTokensOptions, type ListDeckImportFormatsOptions, type ListDeckPreviewTokensOptions, type ListDeckVersionsOptions, type ListDecksOptions, type ListExportJobsOptions, type ListFormatsOptions, type ListGameImportJobsOptions, type ListGamesOptions, type ListImportFormatsOptions, type ListImportJobLogsOptions, type ListImportJobsOptions, type ListMyDeckApiApplicationAccessesOptions, type ListPublicDecksOptions, type ListRecordDeleteJobsOptions, type ListRecordsOptions, type ListRuleDatasetsOptions, type ListRulesOptions, type ListScanTemplatesOptions, type ListViewerDecksOptions, type PollScanJobOptions, type PollSignal, type PreviewScanTemplateOptions, PublishersResource, RecordsResource, type ResolveScanTemplateOptions, RulesResource, type SaveScanTemplateOptions, type ScanMetricsOptions, ScanTemplatesResource, ScansResource, type SearchDatasetsOptions, type SearchGamesOptions, type SearchPublishersOptions, type SearchRecordsOptions, type UpdateScanTemplateOptions, type UploadFileInput, type VerifyWebhookSignatureInput, type WaitForExportJobOptions, type WaitForImportJobOptions, type WaitForRecordDeleteJobOptions, cacheKey, getRateLimitInfo, getSDKVersion, getUserAgent, readCache, writeCache };
|
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, GameCreateInput, GameUpdateInput, Dataset, DatasetSchema, 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, DeckSessionTokenExchangeInput, DeckSessionTokenExchangePayload, HydrateDeckEntryInput, HydratedDeckEntry, FilterInput, DatasetRecord, DatasetRecordsUpsertInput, DatasetRecordsUpsertPayload, DatasetRecordsDeleteInput, DatasetRecordDeleteJob, DatasetRecordDeleteJobStatus, DatasetImportPreviewInput, DatasetImportPreviewResult, DatasetImportValidateInput, BulkImportResult, DatasetImportRunInput, ImportJob, ImportJobStatus, ImportLogLevel, ImportJobLog, GameImportPreviewInput, GameImportPreview, GameImportRunInput, GameImportJob, DatasetExportInput, ExportJob, ExportJobStatus, File, FileUploadInput, PresignedUpload, APIKeyInfo } from '@carddb/core';
|
|
2
|
+
import { Logger, LogLevel, Cache, ResourceType, CardDBConfig, RateLimitInfo, GraphQLErrorInfo, Collection, Publisher, Game, GameCreateInput, GameUpdateInput, GameScanRegion, Dataset, DatasetSchema, 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, DeckSessionTokenExchangeInput, DeckSessionTokenExchangePayload, HydrateDeckEntryInput, HydratedDeckEntry, FilterInput, DatasetRecord, DatasetRecordsUpsertInput, DatasetRecordsUpsertPayload, DatasetRecordsDeleteInput, DatasetRecordDeleteJob, DatasetRecordDeleteJobStatus, DatasetImportPreviewInput, DatasetImportPreviewResult, DatasetImportValidateInput, BulkImportResult, DatasetImportRunInput, ImportJob, ImportJobStatus, ImportLogLevel, ImportJobLog, GameImportPreviewInput, GameImportPreview, GameImportRunInput, GameImportJob, DatasetExportInput, ExportJob, ExportJobStatus, File, FileUploadInput, PresignedUpload, UploadPurpose, CreateScanJobInput, ScanJobPayload, ScanJob, SubmitScanFeedbackInput, ScanFeedbackPayload, ScanMetricsInput, ScanMetrics, ResolveScanTemplateInput, ScanTemplateResolution, ScanTemplatesInput, ScanTemplate, SaveScanTemplateInput, ScanTemplatePayload, PreviewScanTemplateInput, ScanTemplatePreview, APIKeyInfo } from '@carddb/core';
|
|
3
3
|
export * from '@carddb/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -256,6 +256,14 @@ interface GetGameBySlugOptions extends GetGameOptions {
|
|
|
256
256
|
/** Stable game slug, currently backed by metafyGameSlug */
|
|
257
257
|
gameSlug: string;
|
|
258
258
|
}
|
|
259
|
+
interface GetGameRegionsOptions extends GetGameOptions {
|
|
260
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
261
|
+
publisherSlug?: string;
|
|
262
|
+
/** Stable game key, defaults to client defaultGame */
|
|
263
|
+
gameKey?: string;
|
|
264
|
+
/** Include inactive publisher-managed scan regions */
|
|
265
|
+
includeInactive?: boolean;
|
|
266
|
+
}
|
|
259
267
|
declare class GamesResource extends BaseResource {
|
|
260
268
|
constructor(connection: Connection, config: Configuration);
|
|
261
269
|
/**
|
|
@@ -278,6 +286,10 @@ declare class GamesResource extends BaseResource {
|
|
|
278
286
|
* Update a publisher-managed game. Requires a server-side secret credential.
|
|
279
287
|
*/
|
|
280
288
|
update(id: string, input: GameUpdateInput): Promise<Game>;
|
|
289
|
+
/**
|
|
290
|
+
* Get publisher-defined game region metadata for scan-capable clients.
|
|
291
|
+
*/
|
|
292
|
+
getRegions(options?: GetGameRegionsOptions): Promise<GameScanRegion[]>;
|
|
281
293
|
/**
|
|
282
294
|
* Search for games
|
|
283
295
|
*
|
|
@@ -1324,6 +1336,22 @@ interface GetFileOptions {
|
|
|
1324
1336
|
/** Whether to use cache (defaults to client config) */
|
|
1325
1337
|
cache?: boolean;
|
|
1326
1338
|
}
|
|
1339
|
+
interface UploadFileInput {
|
|
1340
|
+
filename: string;
|
|
1341
|
+
contentType: string;
|
|
1342
|
+
body: unknown;
|
|
1343
|
+
/** File size in bytes. Inferred for strings, ArrayBuffers, typed arrays, Blob/File-like values. */
|
|
1344
|
+
size?: number;
|
|
1345
|
+
/** Defaults to false. */
|
|
1346
|
+
isPublic?: boolean;
|
|
1347
|
+
/** Convenience purpose mapped onto existing file metadata. */
|
|
1348
|
+
purpose?: UploadPurpose;
|
|
1349
|
+
/** Override the entity type sent to the API. */
|
|
1350
|
+
entityType?: string;
|
|
1351
|
+
entityId?: string;
|
|
1352
|
+
publisherId?: string;
|
|
1353
|
+
datasetId?: string;
|
|
1354
|
+
}
|
|
1327
1355
|
declare class FilesResource extends BaseResource {
|
|
1328
1356
|
constructor(connection: Connection, config: Configuration);
|
|
1329
1357
|
/**
|
|
@@ -1338,12 +1366,149 @@ declare class FilesResource extends BaseResource {
|
|
|
1338
1366
|
* Confirm that a presigned upload completed.
|
|
1339
1367
|
*/
|
|
1340
1368
|
confirmUpload(id: string): Promise<File>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Request a presigned upload URL, PUT bytes directly to storage, then confirm the file.
|
|
1371
|
+
*/
|
|
1372
|
+
upload(input: UploadFileInput): Promise<File>;
|
|
1341
1373
|
/**
|
|
1342
1374
|
* Delete a file. Requires a server-side secret credential.
|
|
1343
1375
|
*/
|
|
1344
1376
|
delete(id: string): Promise<boolean>;
|
|
1345
1377
|
}
|
|
1346
1378
|
|
|
1379
|
+
/**
|
|
1380
|
+
* Scan job resource for CardDB API
|
|
1381
|
+
*/
|
|
1382
|
+
|
|
1383
|
+
type CreateScanJobOptions = Omit<CreateScanJobInput, 'publisherSlug' | 'gameKey'> & {
|
|
1384
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1385
|
+
publisherSlug?: string;
|
|
1386
|
+
/** Game key, defaults to client defaultGame */
|
|
1387
|
+
gameKey?: string;
|
|
1388
|
+
};
|
|
1389
|
+
type ScanMetricsOptions = Omit<ScanMetricsInput, 'publisherSlug' | 'gameKey'> & {
|
|
1390
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1391
|
+
publisherSlug?: string;
|
|
1392
|
+
/** Game key, defaults to client defaultGame */
|
|
1393
|
+
gameKey?: string;
|
|
1394
|
+
};
|
|
1395
|
+
interface GetScanJobOptions {
|
|
1396
|
+
/** Whether to use cache (defaults to client config) */
|
|
1397
|
+
cache?: boolean;
|
|
1398
|
+
}
|
|
1399
|
+
interface PollScanJobOptions {
|
|
1400
|
+
/** First delay between polling attempts in milliseconds */
|
|
1401
|
+
intervalMs?: number;
|
|
1402
|
+
/** Maximum total polling time in milliseconds */
|
|
1403
|
+
timeoutMs?: number;
|
|
1404
|
+
/** Multiplier applied to the delay after each non-terminal response */
|
|
1405
|
+
backoffFactor?: number;
|
|
1406
|
+
/** Maximum delay between polling attempts in milliseconds */
|
|
1407
|
+
maxIntervalMs?: number;
|
|
1408
|
+
/** Abort-like signal. The SDK checks `aborted` before each request and sleep. */
|
|
1409
|
+
signal?: PollSignal;
|
|
1410
|
+
}
|
|
1411
|
+
interface PollSignal {
|
|
1412
|
+
aborted: boolean;
|
|
1413
|
+
reason?: unknown;
|
|
1414
|
+
throwIfAborted?: () => void;
|
|
1415
|
+
}
|
|
1416
|
+
interface VerifyWebhookSignatureInput {
|
|
1417
|
+
body: string | ArrayBuffer | ArrayBufferView;
|
|
1418
|
+
signature: string;
|
|
1419
|
+
secret: string;
|
|
1420
|
+
}
|
|
1421
|
+
declare class ScansResource extends BaseResource {
|
|
1422
|
+
constructor(connection: Connection, config: Configuration);
|
|
1423
|
+
/**
|
|
1424
|
+
* Create a scan job for an already uploaded image file.
|
|
1425
|
+
*/
|
|
1426
|
+
createJob(input: CreateScanJobOptions): Promise<ScanJobPayload>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Get a scan job and its latest processing result.
|
|
1429
|
+
*/
|
|
1430
|
+
getJob(id: string, options?: GetScanJobOptions): Promise<ScanJob | null>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Poll a scan job until it reaches a terminal status.
|
|
1433
|
+
*/
|
|
1434
|
+
pollJob(id: string, options?: PollScanJobOptions): Promise<ScanJob>;
|
|
1435
|
+
/**
|
|
1436
|
+
* Submit correctness feedback for a completed scan job.
|
|
1437
|
+
*/
|
|
1438
|
+
submitFeedback(input: SubmitScanFeedbackInput): Promise<ScanFeedbackPayload>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Aggregate scan metrics for a publisher/game/dataset scope.
|
|
1441
|
+
*/
|
|
1442
|
+
metrics(input: ScanMetricsOptions): Promise<ScanMetrics>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Verify an `X-CardDB-Signature` value for a webhook body.
|
|
1445
|
+
*/
|
|
1446
|
+
verifyWebhookSignature(input: VerifyWebhookSignatureInput): Promise<boolean>;
|
|
1447
|
+
private resolveCreateJobInput;
|
|
1448
|
+
private resolveMetricsInput;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Scan template resource for CardDB API
|
|
1453
|
+
*/
|
|
1454
|
+
|
|
1455
|
+
type ResolveScanTemplateOptions = Omit<ResolveScanTemplateInput, 'publisherSlug' | 'gameKey'> & {
|
|
1456
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1457
|
+
publisherSlug?: string;
|
|
1458
|
+
/** Game key, defaults to client defaultGame */
|
|
1459
|
+
gameKey?: string;
|
|
1460
|
+
/** Whether to use cache (defaults to client config) */
|
|
1461
|
+
cache?: boolean;
|
|
1462
|
+
};
|
|
1463
|
+
type ListScanTemplatesOptions = Omit<ScanTemplatesInput, 'publisherSlug' | 'gameKey'> & {
|
|
1464
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1465
|
+
publisherSlug?: string;
|
|
1466
|
+
/** Game key, defaults to client defaultGame */
|
|
1467
|
+
gameKey?: string;
|
|
1468
|
+
/** Whether to use cache (defaults to client config) */
|
|
1469
|
+
cache?: boolean;
|
|
1470
|
+
};
|
|
1471
|
+
type SaveScanTemplateOptions = Omit<SaveScanTemplateInput, 'publisherSlug' | 'gameKey'> & {
|
|
1472
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1473
|
+
publisherSlug?: string;
|
|
1474
|
+
/** Game key, defaults to client defaultGame */
|
|
1475
|
+
gameKey?: string;
|
|
1476
|
+
};
|
|
1477
|
+
type PreviewScanTemplateOptions = Omit<PreviewScanTemplateInput, 'publisherSlug' | 'gameKey'> & {
|
|
1478
|
+
/** Publisher slug, defaults to client defaultPublisher */
|
|
1479
|
+
publisherSlug?: string;
|
|
1480
|
+
/** Game key, defaults to client defaultGame */
|
|
1481
|
+
gameKey?: string;
|
|
1482
|
+
};
|
|
1483
|
+
type UpdateScanTemplateOptions = SaveScanTemplateOptions & {
|
|
1484
|
+
id: string;
|
|
1485
|
+
};
|
|
1486
|
+
declare class ScanTemplatesResource extends BaseResource {
|
|
1487
|
+
constructor(connection: Connection, config: Configuration);
|
|
1488
|
+
/**
|
|
1489
|
+
* Resolve the active scan template for a game or dataset scope.
|
|
1490
|
+
*/
|
|
1491
|
+
resolve(input: ResolveScanTemplateOptions): Promise<ScanTemplateResolution>;
|
|
1492
|
+
/**
|
|
1493
|
+
* List publisher-managed scan templates for a game or dataset scope.
|
|
1494
|
+
*/
|
|
1495
|
+
list(input: ListScanTemplatesOptions): Promise<ScanTemplate[]>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Create a publisher-managed scan template. Requires a server-side secret credential.
|
|
1498
|
+
*/
|
|
1499
|
+
create(input: SaveScanTemplateOptions): Promise<ScanTemplatePayload>;
|
|
1500
|
+
update(input: UpdateScanTemplateOptions): Promise<ScanTemplatePayload>;
|
|
1501
|
+
update(id: string, input: SaveScanTemplateOptions): Promise<ScanTemplatePayload>;
|
|
1502
|
+
/**
|
|
1503
|
+
* Validate a draft scan template and normalize provided region OCR hints.
|
|
1504
|
+
*/
|
|
1505
|
+
preview(input: PreviewScanTemplateOptions): Promise<ScanTemplatePreview>;
|
|
1506
|
+
private resolveTemplateScope;
|
|
1507
|
+
private resolveListScope;
|
|
1508
|
+
private resolveSaveInput;
|
|
1509
|
+
private resolvePreviewInput;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1347
1512
|
/**
|
|
1348
1513
|
* CardDB API Client
|
|
1349
1514
|
*
|
|
@@ -1415,6 +1580,10 @@ declare class CardDBClient {
|
|
|
1415
1580
|
readonly exports: ExportsResource;
|
|
1416
1581
|
/** File upload helper resource */
|
|
1417
1582
|
readonly files: FilesResource;
|
|
1583
|
+
/** Scan job helper resource */
|
|
1584
|
+
readonly scans: ScansResource;
|
|
1585
|
+
/** Scan template helper resource */
|
|
1586
|
+
readonly scanTemplates: ScanTemplatesResource;
|
|
1418
1587
|
/**
|
|
1419
1588
|
* Create a new CardDB client
|
|
1420
1589
|
*
|
|
@@ -1496,4 +1665,4 @@ declare function readCache<T>(cache: Cache, key: string): Promise<T | null>;
|
|
|
1496
1665
|
*/
|
|
1497
1666
|
declare function writeCache<T>(cache: Cache, key: string, value: T, ttl: number): Promise<void>;
|
|
1498
1667
|
|
|
1499
|
-
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, ExportsResource, type FetchDeckByExternalRefOptions, type FetchDeckBySlugOptions, type FetchDeckOptions, FilesResource, GamesResource, type GetDatasetByKeyOptions, type GetDatasetOptions, type GetFileOptions, type GetGameByKeyOptions, type GetGameBySlugOptions, type GetGameOptions, type GetImportFormatByKeyOptions, type GetImportFormatOptions, type GetPublisherOptions, type GetRecordByDatasetIdentifierOptions, type GetRecordByIdentifierOptions, type GetRecordOptions, type GetRecordsByIdentifierOptions, type GraphQLResponse, type HydrateDeckEntriesOptions, ImportFormatsResource, ImportsResource, type ListAppDecksOptions, type ListDatasetsOptions, type ListDeckAccessTokenIssuersOptions, type ListDeckApiApplicationAccessesOptions, type ListDeckCollaboratorsOptions, type ListDeckEmbedTokensOptions, type ListDeckImportFormatsOptions, type ListDeckPreviewTokensOptions, type ListDeckVersionsOptions, type ListDecksOptions, type ListExportJobsOptions, type ListFormatsOptions, type ListGameImportJobsOptions, type ListGamesOptions, type ListImportFormatsOptions, type ListImportJobLogsOptions, type ListImportJobsOptions, type ListMyDeckApiApplicationAccessesOptions, type ListPublicDecksOptions, type ListRecordDeleteJobsOptions, type ListRecordsOptions, type ListRuleDatasetsOptions, type ListRulesOptions, type ListViewerDecksOptions, PublishersResource, RecordsResource, RulesResource, type SearchDatasetsOptions, type SearchGamesOptions, type SearchPublishersOptions, type SearchRecordsOptions, type WaitForExportJobOptions, type WaitForImportJobOptions, type WaitForRecordDeleteJobOptions, cacheKey, getRateLimitInfo, getSDKVersion, getUserAgent, readCache, writeCache };
|
|
1668
|
+
export { BaseResource, CardDBClient, Configuration, Connection, type CreateScanJobOptions, 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, ExportsResource, type FetchDeckByExternalRefOptions, type FetchDeckBySlugOptions, type FetchDeckOptions, FilesResource, GamesResource, type GetDatasetByKeyOptions, type GetDatasetOptions, type GetFileOptions, type GetGameByKeyOptions, type GetGameBySlugOptions, type GetGameOptions, type GetGameRegionsOptions, type GetImportFormatByKeyOptions, type GetImportFormatOptions, type GetPublisherOptions, type GetRecordByDatasetIdentifierOptions, type GetRecordByIdentifierOptions, type GetRecordOptions, type GetRecordsByIdentifierOptions, type GetScanJobOptions, type GraphQLResponse, type HydrateDeckEntriesOptions, ImportFormatsResource, ImportsResource, type ListAppDecksOptions, type ListDatasetsOptions, type ListDeckAccessTokenIssuersOptions, type ListDeckApiApplicationAccessesOptions, type ListDeckCollaboratorsOptions, type ListDeckEmbedTokensOptions, type ListDeckImportFormatsOptions, type ListDeckPreviewTokensOptions, type ListDeckVersionsOptions, type ListDecksOptions, type ListExportJobsOptions, type ListFormatsOptions, type ListGameImportJobsOptions, type ListGamesOptions, type ListImportFormatsOptions, type ListImportJobLogsOptions, type ListImportJobsOptions, type ListMyDeckApiApplicationAccessesOptions, type ListPublicDecksOptions, type ListRecordDeleteJobsOptions, type ListRecordsOptions, type ListRuleDatasetsOptions, type ListRulesOptions, type ListScanTemplatesOptions, type ListViewerDecksOptions, type PollScanJobOptions, type PollSignal, type PreviewScanTemplateOptions, PublishersResource, RecordsResource, type ResolveScanTemplateOptions, RulesResource, type SaveScanTemplateOptions, type ScanMetricsOptions, ScanTemplatesResource, ScansResource, type SearchDatasetsOptions, type SearchGamesOptions, type SearchPublishersOptions, type SearchRecordsOptions, type UpdateScanTemplateOptions, type UploadFileInput, type VerifyWebhookSignatureInput, type WaitForExportJobOptions, type WaitForImportJobOptions, type WaitForRecordDeleteJobOptions, cacheKey, getRateLimitInfo, getSDKVersion, getUserAgent, readCache, writeCache };
|