@carddb/client 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +26 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +26 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -474,10 +474,14 @@ interface SearchRecordsOptions {
|
|
|
474
474
|
after?: string;
|
|
475
475
|
/** Whether to validate filter against schema (default: true) */
|
|
476
476
|
validateSchema?: boolean;
|
|
477
|
+
/** Include live TCGPlayer pricing when configured for the dataset */
|
|
478
|
+
includePricing?: boolean;
|
|
477
479
|
/** Whether to use cache (defaults to client config) */
|
|
478
480
|
cache?: boolean;
|
|
479
481
|
}
|
|
480
482
|
interface GetRecordOptions {
|
|
483
|
+
/** Include live TCGPlayer pricing when configured for the dataset */
|
|
484
|
+
includePricing?: boolean;
|
|
481
485
|
/** Whether to use cache (defaults to client config) */
|
|
482
486
|
cache?: boolean;
|
|
483
487
|
}
|
|
@@ -490,6 +494,8 @@ interface GetRecordByIdentifierOptions {
|
|
|
490
494
|
datasetKey: string;
|
|
491
495
|
/** The identifier value to look up */
|
|
492
496
|
identifier: string;
|
|
497
|
+
/** Include live TCGPlayer pricing when configured for the dataset */
|
|
498
|
+
includePricing?: boolean;
|
|
493
499
|
/** Whether to use cache (defaults to client config) */
|
|
494
500
|
cache?: boolean;
|
|
495
501
|
}
|
|
@@ -502,6 +508,8 @@ interface GetRecordsByIdentifierOptions {
|
|
|
502
508
|
datasetKey: string;
|
|
503
509
|
/** Identifier values to look up */
|
|
504
510
|
identifiers: string[];
|
|
511
|
+
/** Include live TCGPlayer pricing when configured for the dataset */
|
|
512
|
+
includePricing?: boolean;
|
|
505
513
|
/** Whether to use cache (defaults to client config) */
|
|
506
514
|
cache?: boolean;
|
|
507
515
|
}
|
package/dist/index.js
CHANGED
|
@@ -1040,9 +1040,13 @@ var RecordsResource = class extends BaseResource {
|
|
|
1040
1040
|
resolveLinks: options.resolveLinks,
|
|
1041
1041
|
first: options.first,
|
|
1042
1042
|
after: options.after,
|
|
1043
|
-
validateSchema: options.validateSchema
|
|
1043
|
+
validateSchema: options.validateSchema,
|
|
1044
|
+
includePricing: options.includePricing
|
|
1045
|
+
});
|
|
1046
|
+
const key = this.cacheKey("records", "search", {
|
|
1047
|
+
...variables,
|
|
1048
|
+
includePricing: options.includePricing ?? false
|
|
1044
1049
|
});
|
|
1045
|
-
const key = this.cacheKey("records", "search", variables);
|
|
1046
1050
|
const data = await this.withCache(key, "records", options, async () => {
|
|
1047
1051
|
const result = await this.connection.execute(query, variables);
|
|
1048
1052
|
return result["searchRecords"];
|
|
@@ -1060,9 +1064,12 @@ var RecordsResource = class extends BaseResource {
|
|
|
1060
1064
|
* const record = await client.records.get('550e8400-e29b-41d4-a716-446655440000')
|
|
1061
1065
|
*/
|
|
1062
1066
|
async get(id, options = {}) {
|
|
1063
|
-
const key = this.cacheKey("records", "get", {
|
|
1067
|
+
const key = this.cacheKey("records", "get", {
|
|
1068
|
+
id,
|
|
1069
|
+
includePricing: options.includePricing ?? false
|
|
1070
|
+
});
|
|
1064
1071
|
return this.withCache(key, "records", options, async () => {
|
|
1065
|
-
const { query } = QueryBuilder.fetchRecordById();
|
|
1072
|
+
const { query } = QueryBuilder.fetchRecordById({ includePricing: options.includePricing });
|
|
1066
1073
|
const result = await this.connection.execute(query, { id });
|
|
1067
1074
|
return result["fetchRecord"] ?? null;
|
|
1068
1075
|
});
|
|
@@ -1094,10 +1101,13 @@ var RecordsResource = class extends BaseResource {
|
|
|
1094
1101
|
publisherSlug,
|
|
1095
1102
|
gameKey,
|
|
1096
1103
|
datasetKey: options.datasetKey,
|
|
1097
|
-
identifier: options.identifier
|
|
1104
|
+
identifier: options.identifier,
|
|
1105
|
+
includePricing: options.includePricing ?? false
|
|
1098
1106
|
});
|
|
1099
1107
|
return this.withCache(key, "records", options, async () => {
|
|
1100
|
-
const { query } = QueryBuilder.fetchRecordByIdentifier(
|
|
1108
|
+
const { query } = QueryBuilder.fetchRecordByIdentifier({
|
|
1109
|
+
includePricing: options.includePricing
|
|
1110
|
+
});
|
|
1101
1111
|
const result = await this.connection.execute(query, {
|
|
1102
1112
|
publisherSlug,
|
|
1103
1113
|
gameKey,
|
|
@@ -1135,10 +1145,13 @@ var RecordsResource = class extends BaseResource {
|
|
|
1135
1145
|
publisherSlug,
|
|
1136
1146
|
gameKey,
|
|
1137
1147
|
datasetKey: options.datasetKey,
|
|
1138
|
-
identifiers: options.identifiers
|
|
1148
|
+
identifiers: options.identifiers,
|
|
1149
|
+
includePricing: options.includePricing ?? false
|
|
1139
1150
|
});
|
|
1140
1151
|
return this.withCache(key, "records", options, async () => {
|
|
1141
|
-
const { query } = QueryBuilder.fetchRecordsByIdentifier(
|
|
1152
|
+
const { query } = QueryBuilder.fetchRecordsByIdentifier({
|
|
1153
|
+
includePricing: options.includePricing
|
|
1154
|
+
});
|
|
1142
1155
|
const result = await this.connection.execute(query, {
|
|
1143
1156
|
publisherSlug,
|
|
1144
1157
|
gameKey,
|
|
@@ -1156,9 +1169,12 @@ var RecordsResource = class extends BaseResource {
|
|
|
1156
1169
|
*/
|
|
1157
1170
|
async getMany(ids, options = {}) {
|
|
1158
1171
|
if (ids.length === 0) return [];
|
|
1159
|
-
const key = this.cacheKey("records", "getMany", {
|
|
1172
|
+
const key = this.cacheKey("records", "getMany", {
|
|
1173
|
+
ids,
|
|
1174
|
+
includePricing: options.includePricing ?? false
|
|
1175
|
+
});
|
|
1160
1176
|
return this.withCache(key, "records", options, async () => {
|
|
1161
|
-
const { query } = QueryBuilder.fetchRecords();
|
|
1177
|
+
const { query } = QueryBuilder.fetchRecords({ includePricing: options.includePricing });
|
|
1162
1178
|
const result = await this.connection.execute(query, { ids });
|
|
1163
1179
|
return result["fetchRecords"] ?? [];
|
|
1164
1180
|
});
|