@domino-sdk/relay 1.11.1 → 1.15.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 -0
- package/build.mjs +15 -0
- package/dist/accounts-5ciAkCMP.d.ts +147 -0
- package/dist/{request-error-D_dUPLwo.d.ts → action-DBzILFx9.d.ts} +31 -1
- package/dist/attempt-captures-DHwIVoRP.d.ts +285 -0
- package/dist/authoring.d.ts +12 -10
- package/dist/authoring.js +6 -4
- package/dist/{automatic-outcomes-kPIDv6X_.d.ts → automatic-outcomes-BcEn_L46.d.ts} +1 -1
- package/dist/browser.d.ts +9 -9
- package/dist/browser.js +7 -6
- package/dist/capability-error-oTd3eYFH.d.ts +151 -0
- package/dist/chunk-2UAVZCMH.js +314 -0
- package/dist/{chunk-AGFUDCNM.js → chunk-3PPEXDWR.js} +1 -1
- package/dist/chunk-CHD6HHWG.js +485 -0
- package/dist/{chunk-T657WO56.js → chunk-LLMJ2SUT.js} +6 -2
- package/dist/chunk-NIYCAW2I.js +79 -0
- package/dist/{chunk-XK5E4HAS.js → chunk-PJXBW754.js} +80 -28
- package/dist/{chunk-PUDL4JBY.js → chunk-PUY35TH3.js} +2 -2
- package/dist/chunk-UJACD6K2.js +987 -0
- package/dist/chunk-W335CWYJ.js +53 -0
- package/dist/{chunk-X7ECZ3AK.js → chunk-XMBM2XD5.js} +1 -1
- package/dist/{chunk-2K2QBPAD.js → chunk-ZLYBUM7K.js} +6 -4
- package/dist/{client-fUSERMAC.d.ts → client-DFSCmf3H.d.ts} +27 -8
- package/dist/{activity-CNiPDPK6.d.ts → deployments-Ci6GyANg.d.ts} +15 -15
- package/dist/{groups-BK8ts2yK.d.ts → groups-Bi7lc54m.d.ts} +1 -1
- package/dist/{images-aw6W7vFZ.d.ts → images-Cb8QHGjn.d.ts} +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +8 -6
- package/dist/{capability-error-ty3SqD_b.d.ts → integrations-Cr9EhGI_.d.ts} +1 -149
- package/dist/internal.d.ts +11 -4
- package/dist/internal.js +8 -3
- package/dist/{offers-C2FANzrG.d.ts → offers-Catj06u7.d.ts} +2 -2
- package/dist/{pages-Chb6OZSB.d.ts → pages-CpYt56Km.d.ts} +1 -1
- package/dist/{participant-activity-DkL3nY5a.d.ts → participant-activity-DYdUUhw2.d.ts} +1 -0
- package/dist/portal-proxy.js +1 -1
- package/dist/react/index.d.ts +247 -179
- package/dist/react/index.js +954 -383
- package/dist/{schema-DEM8y8Fm.d.ts → schema-BaVl2VBS.d.ts} +1 -1
- package/dist/schema.d.ts +15 -13
- package/dist/schema.js +16 -14
- package/dist/server/index.d.ts +12 -70916
- package/dist/server/index.js +594 -841
- package/dist/{sign-in-options-iWOp9puZ.d.ts → sign-in-options-CU1ND6-y.d.ts} +2 -2
- package/dist/submission-input-Bi4HipqI.d.ts +146 -0
- package/dist/testing.d.ts +641 -0
- package/dist/testing.js +1282 -0
- package/dist/transport-0ttRwUat.d.ts +73361 -0
- package/package.json +6 -2
- package/dist/action-9Xl0StBg.d.ts +0 -33
- package/dist/chunk-OCXGG75K.js +0 -171
- package/dist/chunk-ZFABFKIY.js +0 -1295
- package/dist/referral-reward-kinds-M3f0PdiR.d.ts +0 -171
- package/dist/submission-input-BbBJTVlT.d.ts +0 -290
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayAction,
|
|
3
3
|
withActionId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XMBM2XD5.js";
|
|
5
5
|
import {
|
|
6
6
|
collectionPassSchema,
|
|
7
7
|
participantActivityQuerySchema,
|
|
@@ -16,25 +16,19 @@ import {
|
|
|
16
16
|
questOutcomeQuerySchema,
|
|
17
17
|
questOutcomeSchema,
|
|
18
18
|
rewardDeliveriesSchema
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LLMJ2SUT.js";
|
|
20
20
|
import {
|
|
21
21
|
AVATAR_UPLOAD_LIMIT,
|
|
22
|
-
RelayError,
|
|
23
|
-
RelayErrorCode,
|
|
24
22
|
avatarUploadTypes,
|
|
25
|
-
clientError,
|
|
26
23
|
engagementBoundaryPageSchema,
|
|
27
24
|
engagementPageQuerySchema,
|
|
28
25
|
engagementPageSchema,
|
|
29
|
-
isRelayError,
|
|
30
26
|
leaderboardDefinitionResponseSchema,
|
|
31
27
|
leaderboardPageSchema,
|
|
32
28
|
leaderboardPlacementSchema,
|
|
33
29
|
leaderboardQuerySchema,
|
|
34
|
-
linkedWalletSchema,
|
|
35
30
|
offerSchema,
|
|
36
31
|
ownProfileSchema,
|
|
37
|
-
parseInput,
|
|
38
32
|
pointBalancesSchema,
|
|
39
33
|
pointHistoryPageSchema,
|
|
40
34
|
pointHistoryQuerySchema,
|
|
@@ -48,14 +42,22 @@ import {
|
|
|
48
42
|
referralAcceptSchema,
|
|
49
43
|
referralDefinitionSchema,
|
|
50
44
|
referralHistorySchema,
|
|
51
|
-
referralSummarySchema
|
|
45
|
+
referralSummarySchema
|
|
46
|
+
} from "./chunk-UJACD6K2.js";
|
|
47
|
+
import {
|
|
48
|
+
RelayError,
|
|
49
|
+
RelayErrorCode,
|
|
50
|
+
clientError,
|
|
51
|
+
isRelayError,
|
|
52
|
+
linkedWalletSchema,
|
|
53
|
+
parseInput,
|
|
52
54
|
walletAddressInput,
|
|
53
55
|
walletAddressInputSchema,
|
|
54
56
|
walletMessageChallengeSchema,
|
|
55
57
|
walletSignInNetworksSchema,
|
|
56
58
|
walletSignatureSchema,
|
|
57
59
|
walletUnlinkInputSchema
|
|
58
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-2UAVZCMH.js";
|
|
59
61
|
import {
|
|
60
62
|
PARTICIPANT_TIMEOUT,
|
|
61
63
|
lifetime,
|
|
@@ -63,9 +65,12 @@ import {
|
|
|
63
65
|
retrying,
|
|
64
66
|
validTimeout
|
|
65
67
|
} from "./chunk-6QJ3LADK.js";
|
|
68
|
+
import {
|
|
69
|
+
isRequestError
|
|
70
|
+
} from "./chunk-NPGENI7K.js";
|
|
66
71
|
import {
|
|
67
72
|
clientIdentity
|
|
68
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-3PPEXDWR.js";
|
|
69
74
|
import {
|
|
70
75
|
exchangeResultSchema,
|
|
71
76
|
exchangeSchema,
|
|
@@ -488,13 +493,18 @@ var QuestUpdatedError = class extends RelayError {
|
|
|
488
493
|
import { z as z2 } from "zod";
|
|
489
494
|
|
|
490
495
|
// src/progress.ts
|
|
496
|
+
function sessionEnded(error) {
|
|
497
|
+
return isRequestError(error) && (error.code === RelayErrorCode.StaleSession || error.code === RelayErrorCode.NotSignedIn);
|
|
498
|
+
}
|
|
491
499
|
function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
492
500
|
}) {
|
|
493
501
|
const interval = options.intervalMs ?? 1500;
|
|
494
502
|
const maximum = options.maxBackoffMs ?? 3e4;
|
|
495
|
-
|
|
503
|
+
const bound = options.bound ?? false;
|
|
504
|
+
const retry = options.retryMs ?? interval * 2;
|
|
505
|
+
if (!Number.isFinite(interval) || interval <= 0 || !Number.isFinite(maximum) || !Number.isFinite(retry) || retry <= 0 || maximum < interval) {
|
|
496
506
|
throw clientError(
|
|
497
|
-
"Progress polling requires a positive interval and a maximum at least as large",
|
|
507
|
+
"Progress polling requires a positive interval and retry wait, and a maximum at least as large as the interval",
|
|
498
508
|
RelayErrorCode.InvalidInput
|
|
499
509
|
);
|
|
500
510
|
}
|
|
@@ -502,16 +512,23 @@ function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
|
502
512
|
let controller;
|
|
503
513
|
let timer;
|
|
504
514
|
let sessionId;
|
|
515
|
+
let reusable;
|
|
516
|
+
let reread = false;
|
|
505
517
|
let failures = 0;
|
|
518
|
+
let settledAt = 0;
|
|
519
|
+
let delay = interval;
|
|
506
520
|
const visible = () => typeof document === "undefined" || document.visibilityState !== "hidden";
|
|
507
521
|
const visibility = () => {
|
|
522
|
+
if (timer !== void 0) {
|
|
523
|
+
clearTimeout(timer);
|
|
524
|
+
}
|
|
508
525
|
if (visible()) {
|
|
509
|
-
|
|
526
|
+
timer = setTimeout(
|
|
527
|
+
() => void refresh(),
|
|
528
|
+
Math.max(0, settledAt + delay - Date.now())
|
|
529
|
+
);
|
|
510
530
|
} else {
|
|
511
531
|
controller?.abort();
|
|
512
|
-
if (timer !== void 0) {
|
|
513
|
-
clearTimeout(timer);
|
|
514
|
-
}
|
|
515
532
|
}
|
|
516
533
|
};
|
|
517
534
|
if (typeof document !== "undefined") {
|
|
@@ -523,6 +540,8 @@ function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
|
523
540
|
clearTimeout(timer);
|
|
524
541
|
}
|
|
525
542
|
sessionId = void 0;
|
|
543
|
+
reusable = void 0;
|
|
544
|
+
settledAt = 0;
|
|
526
545
|
if (!disposed) {
|
|
527
546
|
listener({ kind: "loading" });
|
|
528
547
|
}
|
|
@@ -538,8 +557,9 @@ function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
|
538
557
|
const request = new AbortController();
|
|
539
558
|
controller = request;
|
|
540
559
|
const current = () => !disposed && !request.signal.aborted;
|
|
560
|
+
let readSessionNow = false;
|
|
541
561
|
try {
|
|
542
|
-
const session = await transport.session(request.signal);
|
|
562
|
+
const session = (bound ? reusable : void 0) ?? await transport.session(request.signal);
|
|
543
563
|
if (!current()) {
|
|
544
564
|
return;
|
|
545
565
|
}
|
|
@@ -549,44 +569,69 @@ function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
|
549
569
|
}
|
|
550
570
|
const member = sessionMember(session);
|
|
551
571
|
if (session && member) {
|
|
552
|
-
|
|
572
|
+
let progress;
|
|
573
|
+
try {
|
|
574
|
+
progress = await transport.progress(session.id, request.signal);
|
|
575
|
+
} catch (error) {
|
|
576
|
+
if (bound && !reread && sessionEnded(error) && current()) {
|
|
577
|
+
sessionId = void 0;
|
|
578
|
+
reusable = void 0;
|
|
579
|
+
reread = true;
|
|
580
|
+
readSessionNow = true;
|
|
581
|
+
listener({ kind: "loading" });
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
throw error;
|
|
585
|
+
}
|
|
553
586
|
if (!current()) {
|
|
554
587
|
return;
|
|
555
588
|
}
|
|
556
|
-
const confirmed = await transport.session(request.signal);
|
|
589
|
+
const confirmed = bound ? session : await transport.session(request.signal);
|
|
557
590
|
if (!current()) {
|
|
558
591
|
return;
|
|
559
592
|
}
|
|
560
593
|
if (confirmed?.id !== session.id || progress.member !== member) {
|
|
561
594
|
sessionId = void 0;
|
|
595
|
+
reusable = void 0;
|
|
562
596
|
listener({ kind: "loading" });
|
|
563
597
|
return;
|
|
564
598
|
}
|
|
599
|
+
reusable = bound ? confirmed : void 0;
|
|
565
600
|
listener({ kind: "ready", session: confirmed, progress });
|
|
601
|
+
} else {
|
|
602
|
+
reusable = void 0;
|
|
566
603
|
}
|
|
567
604
|
failures = 0;
|
|
605
|
+
reread = false;
|
|
568
606
|
} catch (error) {
|
|
569
607
|
if (!current()) {
|
|
570
608
|
return;
|
|
571
609
|
}
|
|
572
610
|
failures = Math.min(failures + 1, 20);
|
|
573
611
|
sessionId = void 0;
|
|
612
|
+
reusable = void 0;
|
|
613
|
+
reread = false;
|
|
574
614
|
listener({
|
|
575
615
|
kind: "error",
|
|
576
616
|
error: error instanceof Error ? error : new Error("Could not refresh progress")
|
|
577
617
|
});
|
|
578
618
|
} finally {
|
|
579
619
|
if (current()) {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
);
|
|
620
|
+
settledAt = Date.now();
|
|
621
|
+
delay = readSessionNow ? 0 : failures === 0 ? interval : Math.min(maximum, retry * 2 ** (failures - 1));
|
|
622
|
+
timer = setTimeout(() => void refresh(), delay);
|
|
584
623
|
}
|
|
585
624
|
}
|
|
586
625
|
}
|
|
587
626
|
const observer = {
|
|
588
627
|
refresh,
|
|
589
628
|
clear,
|
|
629
|
+
/** A bound observer's next poll uses `session`, already read, instead of reading it. */
|
|
630
|
+
reuse(session) {
|
|
631
|
+
if (bound && sessionMember(session)) {
|
|
632
|
+
reusable = session;
|
|
633
|
+
}
|
|
634
|
+
},
|
|
590
635
|
dispose() {
|
|
591
636
|
if (disposed) {
|
|
592
637
|
return;
|
|
@@ -1366,7 +1411,7 @@ function relayClient(options) {
|
|
|
1366
1411
|
})
|
|
1367
1412
|
},
|
|
1368
1413
|
listener,
|
|
1369
|
-
observeOptions,
|
|
1414
|
+
{ ...observeOptions, bound: true },
|
|
1370
1415
|
() => observers.delete(observer)
|
|
1371
1416
|
);
|
|
1372
1417
|
observers.add(observer);
|
|
@@ -1584,7 +1629,10 @@ function relayClient(options) {
|
|
|
1584
1629
|
{
|
|
1585
1630
|
session: (signal) => readSession({ signal }),
|
|
1586
1631
|
progress: (session, signal) => request(
|
|
1587
|
-
withQuery(
|
|
1632
|
+
withQuery(
|
|
1633
|
+
"/v1/me/activity",
|
|
1634
|
+
cursor === void 0 && options2.start ? { start: options2.start } : { cursor }
|
|
1635
|
+
),
|
|
1588
1636
|
participantActivitySchema,
|
|
1589
1637
|
{ options: { session, signal } }
|
|
1590
1638
|
)
|
|
@@ -1609,12 +1657,16 @@ function relayClient(options) {
|
|
|
1609
1657
|
},
|
|
1610
1658
|
{
|
|
1611
1659
|
intervalMs: options2.intervalMs ?? 5e3,
|
|
1612
|
-
maxBackoffMs: options2.maxBackoffMs
|
|
1660
|
+
maxBackoffMs: options2.maxBackoffMs,
|
|
1661
|
+
bound: true
|
|
1613
1662
|
},
|
|
1614
1663
|
() => observers.delete(observer)
|
|
1615
1664
|
);
|
|
1616
1665
|
observers.add(observer);
|
|
1617
1666
|
observer.clear();
|
|
1667
|
+
if (options2.session) {
|
|
1668
|
+
observer.reuse(options2.session);
|
|
1669
|
+
}
|
|
1618
1670
|
void observer.refresh();
|
|
1619
1671
|
return { refresh: observer.refresh, dispose: observer.dispose };
|
|
1620
1672
|
}
|
|
@@ -1630,7 +1682,7 @@ function relayClient(options) {
|
|
|
1630
1682
|
})
|
|
1631
1683
|
},
|
|
1632
1684
|
listener,
|
|
1633
|
-
observeOptions,
|
|
1685
|
+
{ ...observeOptions, bound: true },
|
|
1634
1686
|
() => observers.delete(observer)
|
|
1635
1687
|
);
|
|
1636
1688
|
observers.add(observer);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PJXBW754.js";
|
|
4
4
|
import {
|
|
5
5
|
RelayErrorCode,
|
|
6
6
|
asRelayError,
|
|
7
7
|
clientError,
|
|
8
8
|
cosmosChain
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2UAVZCMH.js";
|
|
10
10
|
|
|
11
11
|
// src/base58.ts
|
|
12
12
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|