@taphubhq/sdk-core 0.15.2 → 0.15.3
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 +14 -4
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -431,6 +431,15 @@ function coerceStatus(raw) {
|
|
|
431
431
|
console.warn(`Unknown bid status "${raw}", defaulting to "pending"`);
|
|
432
432
|
return "pending";
|
|
433
433
|
}
|
|
434
|
+
var SDK_TO_WIRE_STATUS = {
|
|
435
|
+
pending: "pending",
|
|
436
|
+
win: "won",
|
|
437
|
+
lose: "lost",
|
|
438
|
+
cancelled: "cancelled"
|
|
439
|
+
};
|
|
440
|
+
function toWireStatus(status) {
|
|
441
|
+
return SDK_TO_WIRE_STATUS[status];
|
|
442
|
+
}
|
|
434
443
|
function normaliseBid(node) {
|
|
435
444
|
if (typeof node.id !== "string" || node.id === "" || typeof node.user_id !== "string" || node.user_id === "" || typeof node.game_id !== "string" || node.game_id === "" || typeof node.status !== "string" || node.status === "") {
|
|
436
445
|
throw new TaphubServerError("Invalid response from server", {
|
|
@@ -469,8 +478,8 @@ var PLACE_BID_MUTATION = `mutation PlaceBid($input: PlaceBidInput!) {
|
|
|
469
478
|
id user_id game_id currency amount coefficient time1 time2 price1 price2 status payout slippage created_at
|
|
470
479
|
}
|
|
471
480
|
}`;
|
|
472
|
-
var MY_BIDS_QUERY = `query MyBids($
|
|
473
|
-
myBids(
|
|
481
|
+
var MY_BIDS_QUERY = `query MyBids($statuses: [BidStatus!], $limit: Int, $offset: Int, $gameId: ID) {
|
|
482
|
+
myBids(statuses: $statuses, limit: $limit, offset: $offset, gameId: $gameId) {
|
|
474
483
|
id user_id game_id currency amount coefficient time1 time2 price1 price2 status payout slippage created_at
|
|
475
484
|
}
|
|
476
485
|
}`;
|
|
@@ -543,8 +552,9 @@ var BidModule = class {
|
|
|
543
552
|
}
|
|
544
553
|
async listBids(opts) {
|
|
545
554
|
const variables = {};
|
|
546
|
-
|
|
547
|
-
|
|
555
|
+
const statusList = opts?.statuses ?? (opts?.status !== void 0 ? [opts.status] : void 0);
|
|
556
|
+
if (statusList !== void 0 && statusList.length > 0) {
|
|
557
|
+
variables.statuses = statusList.map(toWireStatus);
|
|
548
558
|
}
|
|
549
559
|
if (opts?.limit !== void 0) {
|
|
550
560
|
variables.limit = opts.limit;
|
package/dist/index.d.mts
CHANGED
|
@@ -222,7 +222,10 @@ declare class BidModule {
|
|
|
222
222
|
signal?: AbortSignal;
|
|
223
223
|
}): Promise<CancelBidResult>;
|
|
224
224
|
listBids(opts?: {
|
|
225
|
+
/** @deprecated Use `statuses` instead. Folded into a one-element `statuses` list. */
|
|
225
226
|
status?: BidStatus;
|
|
227
|
+
/** Include-semantics: return only bids whose status is in this list. */
|
|
228
|
+
statuses?: BidStatus[];
|
|
226
229
|
limit?: number;
|
|
227
230
|
offset?: number;
|
|
228
231
|
gameId?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -222,7 +222,10 @@ declare class BidModule {
|
|
|
222
222
|
signal?: AbortSignal;
|
|
223
223
|
}): Promise<CancelBidResult>;
|
|
224
224
|
listBids(opts?: {
|
|
225
|
+
/** @deprecated Use `statuses` instead. Folded into a one-element `statuses` list. */
|
|
225
226
|
status?: BidStatus;
|
|
227
|
+
/** Include-semantics: return only bids whose status is in this list. */
|
|
228
|
+
statuses?: BidStatus[];
|
|
226
229
|
limit?: number;
|
|
227
230
|
offset?: number;
|
|
228
231
|
gameId?: string;
|
package/dist/index.js
CHANGED
|
@@ -366,6 +366,15 @@ function coerceStatus(raw) {
|
|
|
366
366
|
console.warn(`Unknown bid status "${raw}", defaulting to "pending"`);
|
|
367
367
|
return "pending";
|
|
368
368
|
}
|
|
369
|
+
var SDK_TO_WIRE_STATUS = {
|
|
370
|
+
pending: "pending",
|
|
371
|
+
win: "won",
|
|
372
|
+
lose: "lost",
|
|
373
|
+
cancelled: "cancelled"
|
|
374
|
+
};
|
|
375
|
+
function toWireStatus(status) {
|
|
376
|
+
return SDK_TO_WIRE_STATUS[status];
|
|
377
|
+
}
|
|
369
378
|
function normaliseBid(node) {
|
|
370
379
|
if (typeof node.id !== "string" || node.id === "" || typeof node.user_id !== "string" || node.user_id === "" || typeof node.game_id !== "string" || node.game_id === "" || typeof node.status !== "string" || node.status === "") {
|
|
371
380
|
throw new TaphubServerError("Invalid response from server", {
|
|
@@ -404,8 +413,8 @@ var PLACE_BID_MUTATION = `mutation PlaceBid($input: PlaceBidInput!) {
|
|
|
404
413
|
id user_id game_id currency amount coefficient time1 time2 price1 price2 status payout slippage created_at
|
|
405
414
|
}
|
|
406
415
|
}`;
|
|
407
|
-
var MY_BIDS_QUERY = `query MyBids($
|
|
408
|
-
myBids(
|
|
416
|
+
var MY_BIDS_QUERY = `query MyBids($statuses: [BidStatus!], $limit: Int, $offset: Int, $gameId: ID) {
|
|
417
|
+
myBids(statuses: $statuses, limit: $limit, offset: $offset, gameId: $gameId) {
|
|
409
418
|
id user_id game_id currency amount coefficient time1 time2 price1 price2 status payout slippage created_at
|
|
410
419
|
}
|
|
411
420
|
}`;
|
|
@@ -478,8 +487,9 @@ var BidModule = class {
|
|
|
478
487
|
}
|
|
479
488
|
async listBids(opts) {
|
|
480
489
|
const variables = {};
|
|
481
|
-
|
|
482
|
-
|
|
490
|
+
const statusList = opts?.statuses ?? (opts?.status !== void 0 ? [opts.status] : void 0);
|
|
491
|
+
if (statusList !== void 0 && statusList.length > 0) {
|
|
492
|
+
variables.statuses = statusList.map(toWireStatus);
|
|
483
493
|
}
|
|
484
494
|
if (opts?.limit !== void 0) {
|
|
485
495
|
variables.limit = opts.limit;
|