@carddb/core 0.4.1 → 0.4.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 +102 -210
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -138
- package/dist/index.d.ts +61 -138
- package/dist/index.js +102 -210
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -250,6 +250,47 @@ function resolveFilter(input) {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
// src/query-builder.ts
|
|
253
|
+
var DECK_JSON_OBJECT_KEYS = /* @__PURE__ */ new Set(["metadata", "annotations"]);
|
|
254
|
+
function normalizeDeckJsonInput(input) {
|
|
255
|
+
return normalizeDeckJsonValue(input, "input");
|
|
256
|
+
}
|
|
257
|
+
function normalizeDeckJsonValue(value, path) {
|
|
258
|
+
if (!isRecord(value)) {
|
|
259
|
+
return value;
|
|
260
|
+
}
|
|
261
|
+
const normalized = {};
|
|
262
|
+
for (const [key, child] of Object.entries(value)) {
|
|
263
|
+
const childPath = `${path}.${key}`;
|
|
264
|
+
if (DECK_JSON_OBJECT_KEYS.has(key)) {
|
|
265
|
+
normalized[key] = normalizeJsonObject(child, childPath);
|
|
266
|
+
} else if (key === "entries" && Array.isArray(child)) {
|
|
267
|
+
normalized[key] = child.map(
|
|
268
|
+
(entry, index) => normalizeDeckJsonValue(entry, `${childPath}[${index}]`)
|
|
269
|
+
);
|
|
270
|
+
} else {
|
|
271
|
+
normalized[key] = child;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return normalized;
|
|
275
|
+
}
|
|
276
|
+
function normalizeJsonObject(value, path) {
|
|
277
|
+
if (value == null || isRecord(value)) {
|
|
278
|
+
return value;
|
|
279
|
+
}
|
|
280
|
+
if (typeof value === "string") {
|
|
281
|
+
try {
|
|
282
|
+
const parsed = JSON.parse(value);
|
|
283
|
+
if (isRecord(parsed)) {
|
|
284
|
+
return parsed;
|
|
285
|
+
}
|
|
286
|
+
} catch {
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
throw new ValidationError(`${path} must be a JSON object`);
|
|
290
|
+
}
|
|
291
|
+
function isRecord(value) {
|
|
292
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
293
|
+
}
|
|
253
294
|
var FILE_FIELDS = `
|
|
254
295
|
id
|
|
255
296
|
createdAt
|
|
@@ -590,36 +631,12 @@ var DECK_COLLABORATOR_FIELDS = `
|
|
|
590
631
|
createdAt
|
|
591
632
|
updatedAt
|
|
592
633
|
`;
|
|
593
|
-
var
|
|
634
|
+
var DECK_TOKEN_ISSUER_FIELDS = `
|
|
594
635
|
id
|
|
595
|
-
deckId
|
|
596
|
-
label
|
|
597
|
-
expiresAt
|
|
598
|
-
revokedAt
|
|
599
|
-
lastUsedAt
|
|
600
|
-
createdAt
|
|
601
|
-
updatedAt
|
|
602
|
-
`;
|
|
603
|
-
var DECK_EMBED_TOKEN_FIELDS = `
|
|
604
|
-
id
|
|
605
|
-
deckId
|
|
606
|
-
apiApplicationId
|
|
607
|
-
label
|
|
608
|
-
readMode
|
|
609
|
-
allowedOrigins
|
|
610
|
-
externalSubject
|
|
611
|
-
expiresAt
|
|
612
|
-
revokedAt
|
|
613
|
-
lastUsedAt
|
|
614
|
-
createdAt
|
|
615
|
-
updatedAt
|
|
616
|
-
`;
|
|
617
|
-
var DECK_ACCESS_TOKEN_ISSUER_FIELDS = `
|
|
618
|
-
id
|
|
619
|
-
deckId
|
|
620
636
|
apiApplicationId
|
|
621
637
|
label
|
|
622
|
-
|
|
638
|
+
allowedScopes
|
|
639
|
+
allowedRepresentations
|
|
623
640
|
maxTokenLifetimeSeconds
|
|
624
641
|
directSigningAlg
|
|
625
642
|
directSigningKeyId
|
|
@@ -629,13 +646,15 @@ var DECK_ACCESS_TOKEN_ISSUER_FIELDS = `
|
|
|
629
646
|
createdAt
|
|
630
647
|
updatedAt
|
|
631
648
|
`;
|
|
632
|
-
var
|
|
649
|
+
var DECK_TOKEN_FIELDS = `
|
|
633
650
|
id
|
|
634
|
-
deckId
|
|
635
651
|
apiApplicationId
|
|
636
652
|
issuerId
|
|
637
|
-
|
|
653
|
+
deckId
|
|
654
|
+
gameId
|
|
638
655
|
externalSubject
|
|
656
|
+
scopes
|
|
657
|
+
representation
|
|
639
658
|
expiresAt
|
|
640
659
|
revokedAt
|
|
641
660
|
lastUsedAt
|
|
@@ -1283,7 +1302,14 @@ var SCAN_METRICS_FIELDS = `
|
|
|
1283
1302
|
completedJobs
|
|
1284
1303
|
failedJobs
|
|
1285
1304
|
failureRate
|
|
1305
|
+
noMatchCount
|
|
1306
|
+
noMatchRate
|
|
1286
1307
|
averageShortlistSize
|
|
1308
|
+
vectorQueryCount
|
|
1309
|
+
vectorFallbackCount
|
|
1310
|
+
averageVectorCandidates
|
|
1311
|
+
averageVectorQueryMs
|
|
1312
|
+
averageEmbeddingMs
|
|
1287
1313
|
confidenceDistribution
|
|
1288
1314
|
feedback {
|
|
1289
1315
|
total
|
|
@@ -1297,8 +1323,14 @@ var SCAN_METRICS_FIELDS = `
|
|
|
1297
1323
|
jobCount
|
|
1298
1324
|
completedJobs
|
|
1299
1325
|
failedJobs
|
|
1326
|
+
noMatchCount
|
|
1300
1327
|
averageConfidence
|
|
1301
1328
|
averageShortlistSize
|
|
1329
|
+
vectorQueryCount
|
|
1330
|
+
vectorFallbackCount
|
|
1331
|
+
averageVectorCandidates
|
|
1332
|
+
averageVectorQueryMs
|
|
1333
|
+
averageEmbeddingMs
|
|
1302
1334
|
feedbackCount
|
|
1303
1335
|
correctFeedback
|
|
1304
1336
|
correctedFeedback
|
|
@@ -2746,8 +2778,8 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
2746
2778
|
deckById() {
|
|
2747
2779
|
return {
|
|
2748
2780
|
query: `
|
|
2749
|
-
query Deck($id: UUID
|
|
2750
|
-
deck(id: $id) {
|
|
2781
|
+
query Deck($id: UUID!, $readState: DeckReadState!, $version: DeckPublishedVersionSelector) {
|
|
2782
|
+
deck(id: $id, readState: $readState, version: $version) {
|
|
2751
2783
|
${DECK_FIELDS}
|
|
2752
2784
|
}
|
|
2753
2785
|
}
|
|
@@ -2801,8 +2833,8 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
2801
2833
|
deckByExternalRef() {
|
|
2802
2834
|
return {
|
|
2803
2835
|
query: `
|
|
2804
|
-
query DeckByExternalRef($externalRef: String
|
|
2805
|
-
deckByExternalRef(externalRef: $externalRef) {
|
|
2836
|
+
query DeckByExternalRef($externalRef: String!, $readState: DeckReadState!, $version: DeckPublishedVersionSelector) {
|
|
2837
|
+
deckByExternalRef(externalRef: $externalRef, readState: $readState, version: $version) {
|
|
2806
2838
|
${DECK_FIELDS}
|
|
2807
2839
|
}
|
|
2808
2840
|
}
|
|
@@ -2845,39 +2877,6 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
2845
2877
|
variables
|
|
2846
2878
|
};
|
|
2847
2879
|
},
|
|
2848
|
-
deckPreview() {
|
|
2849
|
-
return {
|
|
2850
|
-
query: `
|
|
2851
|
-
query DeckPreview($token: String!) {
|
|
2852
|
-
deckPreview(token: $token) {
|
|
2853
|
-
${DECK_FIELDS}
|
|
2854
|
-
}
|
|
2855
|
-
}
|
|
2856
|
-
`
|
|
2857
|
-
};
|
|
2858
|
-
},
|
|
2859
|
-
deckEmbed() {
|
|
2860
|
-
return {
|
|
2861
|
-
query: `
|
|
2862
|
-
query DeckEmbed($token: String!) {
|
|
2863
|
-
deckEmbed(token: $token) {
|
|
2864
|
-
${DECK_FIELDS}
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
`
|
|
2868
|
-
};
|
|
2869
|
-
},
|
|
2870
|
-
deckAccess() {
|
|
2871
|
-
return {
|
|
2872
|
-
query: `
|
|
2873
|
-
query DeckAccess($token: String!) {
|
|
2874
|
-
deckAccess(token: $token) {
|
|
2875
|
-
${DECK_FIELDS}
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
|
-
`
|
|
2879
|
-
};
|
|
2880
|
-
},
|
|
2881
2880
|
deckDraftDiff() {
|
|
2882
2881
|
return {
|
|
2883
2882
|
query: `
|
|
@@ -2986,28 +2985,6 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
2986
2985
|
`
|
|
2987
2986
|
};
|
|
2988
2987
|
},
|
|
2989
|
-
deckEmbedTokens() {
|
|
2990
|
-
return {
|
|
2991
|
-
query: `
|
|
2992
|
-
query DeckEmbedTokens($deckId: UUID!) {
|
|
2993
|
-
deckEmbedTokens(deckId: $deckId) {
|
|
2994
|
-
${DECK_EMBED_TOKEN_FIELDS}
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
`
|
|
2998
|
-
};
|
|
2999
|
-
},
|
|
3000
|
-
deckAccessTokenIssuers() {
|
|
3001
|
-
return {
|
|
3002
|
-
query: `
|
|
3003
|
-
query DeckAccessTokenIssuers($deckId: UUID!) {
|
|
3004
|
-
deckAccessTokenIssuers(deckId: $deckId) {
|
|
3005
|
-
${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
|
|
3006
|
-
}
|
|
3007
|
-
}
|
|
3008
|
-
`
|
|
3009
|
-
};
|
|
3010
|
-
},
|
|
3011
2988
|
deckApiApplicationAccesses() {
|
|
3012
2989
|
return {
|
|
3013
2990
|
query: `
|
|
@@ -3094,17 +3071,6 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
3094
3071
|
`
|
|
3095
3072
|
};
|
|
3096
3073
|
},
|
|
3097
|
-
deckPreviewTokens() {
|
|
3098
|
-
return {
|
|
3099
|
-
query: `
|
|
3100
|
-
query DeckPreviewTokens($deckId: UUID!) {
|
|
3101
|
-
deckPreviewTokens(deckId: $deckId) {
|
|
3102
|
-
${DECK_PREVIEW_TOKEN_FIELDS}
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3105
|
-
`
|
|
3106
|
-
};
|
|
3107
|
-
},
|
|
3108
3074
|
createDeck() {
|
|
3109
3075
|
return {
|
|
3110
3076
|
query: `
|
|
@@ -3369,120 +3335,58 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
3369
3335
|
`
|
|
3370
3336
|
};
|
|
3371
3337
|
},
|
|
3372
|
-
|
|
3373
|
-
return {
|
|
3374
|
-
query: `
|
|
3375
|
-
mutation DeckPreviewTokenCreate($input: DeckPreviewTokenCreateInput!) {
|
|
3376
|
-
deckPreviewTokenCreate(input: $input) {
|
|
3377
|
-
token
|
|
3378
|
-
previewToken {
|
|
3379
|
-
${DECK_PREVIEW_TOKEN_FIELDS}
|
|
3380
|
-
}
|
|
3381
|
-
}
|
|
3382
|
-
}
|
|
3383
|
-
`
|
|
3384
|
-
};
|
|
3385
|
-
},
|
|
3386
|
-
revokeDeckPreviewToken() {
|
|
3387
|
-
return {
|
|
3388
|
-
query: `
|
|
3389
|
-
mutation DeckPreviewTokenRevoke($id: UUID!) {
|
|
3390
|
-
deckPreviewTokenRevoke(id: $id)
|
|
3391
|
-
}
|
|
3392
|
-
`
|
|
3393
|
-
};
|
|
3394
|
-
},
|
|
3395
|
-
createDeckEmbedToken() {
|
|
3396
|
-
return {
|
|
3397
|
-
query: `
|
|
3398
|
-
mutation DeckEmbedTokenCreate($input: DeckEmbedTokenCreateInput!) {
|
|
3399
|
-
deckEmbedTokenCreate(input: $input) {
|
|
3400
|
-
token
|
|
3401
|
-
embedToken {
|
|
3402
|
-
${DECK_EMBED_TOKEN_FIELDS}
|
|
3403
|
-
}
|
|
3404
|
-
}
|
|
3405
|
-
}
|
|
3406
|
-
`
|
|
3407
|
-
};
|
|
3408
|
-
},
|
|
3409
|
-
revokeDeckEmbedToken() {
|
|
3338
|
+
createDeckTokenIssuer() {
|
|
3410
3339
|
return {
|
|
3411
3340
|
query: `
|
|
3412
|
-
mutation
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
`
|
|
3416
|
-
};
|
|
3417
|
-
},
|
|
3418
|
-
createDeckAccessTokenIssuer() {
|
|
3419
|
-
return {
|
|
3420
|
-
query: `
|
|
3421
|
-
mutation DeckAccessTokenIssuerCreate($input: DeckAccessTokenIssuerCreateInput!) {
|
|
3422
|
-
deckAccessTokenIssuerCreate(input: $input) {
|
|
3423
|
-
${DECK_ACCESS_TOKEN_ISSUER_FIELDS}
|
|
3341
|
+
mutation DeckTokenIssuerCreate($input: DeckTokenIssuerCreateInput!) {
|
|
3342
|
+
deckTokenIssuerCreate(input: $input) {
|
|
3343
|
+
${DECK_TOKEN_ISSUER_FIELDS}
|
|
3424
3344
|
}
|
|
3425
3345
|
}
|
|
3426
3346
|
`
|
|
3427
3347
|
};
|
|
3428
3348
|
},
|
|
3429
|
-
|
|
3349
|
+
revokeDeckTokenIssuer() {
|
|
3430
3350
|
return {
|
|
3431
3351
|
query: `
|
|
3432
|
-
mutation
|
|
3433
|
-
|
|
3352
|
+
mutation DeckTokenIssuerRevoke($id: UUID!) {
|
|
3353
|
+
deckTokenIssuerRevoke(id: $id)
|
|
3434
3354
|
}
|
|
3435
3355
|
`
|
|
3436
3356
|
};
|
|
3437
3357
|
},
|
|
3438
|
-
|
|
3358
|
+
revokeDeckTokenIssuerSigningKey() {
|
|
3439
3359
|
return {
|
|
3440
3360
|
query: `
|
|
3441
|
-
mutation
|
|
3442
|
-
|
|
3443
|
-
${
|
|
3361
|
+
mutation DeckTokenIssuerSigningKeyRevoke($id: UUID!) {
|
|
3362
|
+
deckTokenIssuerSigningKeyRevoke(id: $id) {
|
|
3363
|
+
${DECK_TOKEN_ISSUER_FIELDS}
|
|
3444
3364
|
}
|
|
3445
3365
|
}
|
|
3446
3366
|
`
|
|
3447
3367
|
};
|
|
3448
3368
|
},
|
|
3449
|
-
|
|
3369
|
+
exchangeDeckToken() {
|
|
3450
3370
|
return {
|
|
3451
3371
|
query: `
|
|
3452
|
-
mutation
|
|
3453
|
-
|
|
3372
|
+
mutation DeckTokenExchange($input: DeckTokenExchangeInput!) {
|
|
3373
|
+
deckTokenExchange(input: $input) {
|
|
3454
3374
|
token
|
|
3455
|
-
|
|
3456
|
-
${
|
|
3375
|
+
deckToken {
|
|
3376
|
+
${DECK_TOKEN_FIELDS}
|
|
3457
3377
|
}
|
|
3458
3378
|
}
|
|
3459
3379
|
}
|
|
3460
3380
|
`
|
|
3461
3381
|
};
|
|
3462
3382
|
},
|
|
3463
|
-
|
|
3383
|
+
revokeDeckToken() {
|
|
3464
3384
|
return {
|
|
3465
3385
|
query: `
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
id
|
|
3471
|
-
accountId
|
|
3472
|
-
apiApplicationId
|
|
3473
|
-
gameId
|
|
3474
|
-
environment
|
|
3475
|
-
externalSubject
|
|
3476
|
-
scopes
|
|
3477
|
-
expiresAt
|
|
3478
|
-
revokedAt
|
|
3479
|
-
lastUsedAt
|
|
3480
|
-
createdAt
|
|
3481
|
-
updatedAt
|
|
3482
|
-
}
|
|
3483
|
-
}
|
|
3484
|
-
}
|
|
3485
|
-
`
|
|
3386
|
+
mutation DeckTokenRevoke($id: UUID!) {
|
|
3387
|
+
deckTokenRevoke(id: $id)
|
|
3388
|
+
}
|
|
3389
|
+
`
|
|
3486
3390
|
};
|
|
3487
3391
|
},
|
|
3488
3392
|
grantDeckApiApplicationAccess() {
|
|
@@ -3505,26 +3409,17 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
3505
3409
|
`
|
|
3506
3410
|
};
|
|
3507
3411
|
},
|
|
3508
|
-
revokeDeckAccessToken() {
|
|
3509
|
-
return {
|
|
3510
|
-
query: `
|
|
3511
|
-
mutation DeckAccessTokenRevoke($id: UUID!) {
|
|
3512
|
-
deckAccessTokenRevoke(id: $id)
|
|
3513
|
-
}
|
|
3514
|
-
`
|
|
3515
|
-
};
|
|
3516
|
-
},
|
|
3517
3412
|
deckCreateVariables(input) {
|
|
3518
|
-
return { input };
|
|
3413
|
+
return { input: normalizeDeckJsonInput(input) };
|
|
3519
3414
|
},
|
|
3520
3415
|
deckUpdateVariables(id, input) {
|
|
3521
|
-
return { id, input };
|
|
3416
|
+
return { id, input: normalizeDeckJsonInput(input) };
|
|
3522
3417
|
},
|
|
3523
3418
|
deckEntryAddVariables(input) {
|
|
3524
|
-
return { input };
|
|
3419
|
+
return { input: normalizeDeckJsonInput(input) };
|
|
3525
3420
|
},
|
|
3526
3421
|
deckEntryUpdateVariables(id, input) {
|
|
3527
|
-
return { id, input };
|
|
3422
|
+
return { id, input: normalizeDeckJsonInput(input) };
|
|
3528
3423
|
},
|
|
3529
3424
|
deckEntryRemoveVariables(id, expectedDraftRevision) {
|
|
3530
3425
|
return { id, expectedDraftRevision };
|
|
@@ -3533,7 +3428,7 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
3533
3428
|
return { deckId, input };
|
|
3534
3429
|
},
|
|
3535
3430
|
deckEntriesReplaceVariables(deckId, input) {
|
|
3536
|
-
return { deckId, input };
|
|
3431
|
+
return { deckId, input: normalizeDeckJsonInput(input) };
|
|
3537
3432
|
},
|
|
3538
3433
|
deckImportVariables(input) {
|
|
3539
3434
|
return { input };
|
|
@@ -3548,7 +3443,13 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
3548
3443
|
return { input };
|
|
3549
3444
|
},
|
|
3550
3445
|
deckUpsertByExternalRefVariables(input) {
|
|
3551
|
-
return { input };
|
|
3446
|
+
return { input: normalizeDeckJsonInput(input) };
|
|
3447
|
+
},
|
|
3448
|
+
deckReadVariables(id, readState, version) {
|
|
3449
|
+
return { id, readState, version };
|
|
3450
|
+
},
|
|
3451
|
+
deckExternalRefReadVariables(externalRef, readState, version) {
|
|
3452
|
+
return { externalRef, readState, version };
|
|
3552
3453
|
},
|
|
3553
3454
|
deckClaimVariables(id, input) {
|
|
3554
3455
|
return { id, input };
|
|
@@ -3569,7 +3470,7 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
3569
3470
|
return { id, input };
|
|
3570
3471
|
},
|
|
3571
3472
|
deckHydrateEntriesVariables(input) {
|
|
3572
|
-
return { input };
|
|
3473
|
+
return { input: normalizeDeckJsonInput(input) };
|
|
3573
3474
|
},
|
|
3574
3475
|
deckExportVariables(id, format) {
|
|
3575
3476
|
return { id, format };
|
|
@@ -3580,19 +3481,10 @@ ${RESOLVED_LINKS_FIELDS}` : selectedRecordFields;
|
|
|
3580
3481
|
deckCollaboratorVariables(deckId, accountId, role) {
|
|
3581
3482
|
return role === void 0 ? { deckId, accountId } : { deckId, accountId, role };
|
|
3582
3483
|
},
|
|
3583
|
-
|
|
3584
|
-
return { input };
|
|
3585
|
-
},
|
|
3586
|
-
deckEmbedTokenCreateVariables(input) {
|
|
3587
|
-
return { input };
|
|
3588
|
-
},
|
|
3589
|
-
deckAccessTokenIssuerCreateVariables(input) {
|
|
3590
|
-
return { input };
|
|
3591
|
-
},
|
|
3592
|
-
deckAccessTokenExchangeVariables(input) {
|
|
3484
|
+
deckTokenIssuerCreateVariables(input) {
|
|
3593
3485
|
return { input };
|
|
3594
3486
|
},
|
|
3595
|
-
|
|
3487
|
+
deckTokenExchangeVariables(input) {
|
|
3596
3488
|
return { input };
|
|
3597
3489
|
},
|
|
3598
3490
|
deckApiApplicationAccessesVariables(deckId, includeRevoked) {
|