@domino-sdk/relay 1.0.0-next.8 → 1.0.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/activity-DeKJsRry.d.ts +9112 -0
- package/dist/authoring.d.ts +1135 -285
- package/dist/authoring.js +545 -269
- package/dist/automatic-outcomes-B1xrETxm.d.ts +758 -0
- package/dist/avatar.d.ts +2 -2
- package/dist/browser-DFe7sWSN.d.ts +4154 -0
- package/dist/browser.d.ts +11 -2528
- package/dist/browser.js +8 -6
- package/dist/capability-error-DNMwKmlL.d.ts +458 -0
- package/dist/{chunk-V7EZUZ3Z.js → chunk-36HTX2BM.js} +389 -169
- package/dist/chunk-6QJ3LADK.js +112 -0
- package/dist/{chunk-77H7APVD.js → chunk-BGGKNIRP.js} +1 -1
- package/dist/chunk-EYH5RDIE.js +496 -0
- package/dist/chunk-GQKYAQM6.js +84 -0
- package/dist/chunk-GUP7YRR4.js +42 -0
- package/dist/{chunk-V5R2DMGY.js → chunk-GZ6FJAXN.js} +380 -128
- package/dist/chunk-JON5SESL.js +2986 -0
- package/dist/chunk-MC6V6VMG.js +49 -0
- package/dist/chunk-NPGENI7K.js +37 -0
- package/dist/chunk-VFHHLN6A.js +284 -0
- package/dist/chunk-WJSSJ7AF.js +151 -0
- package/dist/{chunk-QBOHLT7M.js → chunk-XFMSUPNS.js} +1 -1
- package/dist/{chunk-6A6K5RUD.js → chunk-ZVIRG24J.js} +145 -42
- package/dist/{client-CK4nwt7V.d.ts → client-XiuFnug_.d.ts} +2193 -562
- package/dist/{submission-input-C9qm9ixd.d.ts → groups-Ck-OxzjD.d.ts} +919 -1142
- package/dist/identity-integration-GxAHdKR2.d.ts +58 -0
- package/dist/{images--vZ9U0kr.d.ts → images-Dv-P5VBw.d.ts} +2 -2
- package/dist/index.d.ts +13 -9
- package/dist/index.js +17 -6
- package/dist/internal.d.ts +82 -43
- package/dist/internal.js +58 -90
- package/dist/offers-Cy-e4o5x.d.ts +431 -0
- package/dist/{pages-BzqJuI69.d.ts → outcomes-kVB-Juzs.d.ts} +2386 -1490
- package/dist/pages-BBYD21IE.d.ts +359 -0
- package/dist/participant-rewards-3duLb8YJ.d.ts +668 -0
- package/dist/portal-proxy.js +22 -4
- package/dist/{profiles-DDMFBRKe.d.ts → profiles-D2aFcOxu.d.ts} +15 -15
- package/dist/react/index.d.ts +3122 -1011
- package/dist/react/index.js +1627 -779
- package/dist/request-error-DWduJCGV.d.ts +62 -0
- package/dist/schema-DfJzH2ci.d.ts +5644 -0
- package/dist/schema.d.ts +15 -4216
- package/dist/schema.js +322 -81
- package/dist/server/index.d.ts +81498 -0
- package/dist/server/index.js +2520 -0
- package/dist/{streaks-CwGReWGt.d.ts → streaks-CWyq8Px5.d.ts} +2 -4
- package/dist/submission-input-BZkm6ohU.d.ts +290 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -0
- package/dist/{wallet-BGOfFkG9.d.ts → wallet-YssWxGg8.d.ts} +35 -38
- package/package.json +8 -2
- package/dist/chunk-MRIURJE3.js +0 -257
- package/dist/chunk-VARGF4JS.js +0 -1733
- package/dist/chunk-ZWY3R6B3.js +0 -26
- package/dist/collection-BGneJ6Bk.d.ts +0 -114
- package/dist/integrations-C3Sp558f.d.ts +0 -1297
- package/dist/point-ledgers-iS00Z_v0.d.ts +0 -37
- package/dist/schema-pnuWqvGn.d.ts +0 -3396
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GZ6FJAXN.js";
|
|
4
4
|
import {
|
|
5
5
|
RelayErrorCode,
|
|
6
|
+
asRelayError,
|
|
6
7
|
clientError,
|
|
7
8
|
cosmosChain
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-36HTX2BM.js";
|
|
9
10
|
|
|
10
11
|
// src/base58.ts
|
|
11
12
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
@@ -448,7 +449,10 @@ async function readSignInMethods(relay) {
|
|
|
448
449
|
providers: [],
|
|
449
450
|
email: true,
|
|
450
451
|
wallets: [],
|
|
451
|
-
error:
|
|
452
|
+
error: asRelayError(
|
|
453
|
+
cause,
|
|
454
|
+
"Couldn't read the project's sign-in methods."
|
|
455
|
+
)
|
|
452
456
|
};
|
|
453
457
|
}
|
|
454
458
|
}
|
|
@@ -492,59 +496,158 @@ function createBrowserRelayClient(options) {
|
|
|
492
496
|
submissionStore: options.submissionStore ?? browserSubmissionStore()
|
|
493
497
|
});
|
|
494
498
|
}
|
|
499
|
+
var DATABASE = "domino-relay-submissions";
|
|
500
|
+
var STORE = "submissions";
|
|
501
|
+
var BLOCKED_GRACE_MS = 1e3;
|
|
502
|
+
function errorName(error) {
|
|
503
|
+
return typeof error === "object" && error !== null && "name" in error ? String(error.name) : void 0;
|
|
504
|
+
}
|
|
505
|
+
function storageError(error, action) {
|
|
506
|
+
const name = errorName(error);
|
|
507
|
+
if (name === "QuotaExceededError") {
|
|
508
|
+
return clientError(
|
|
509
|
+
"Browser storage is full, so submission progress could not be saved. Free some space, then resume the saved submission.",
|
|
510
|
+
RelayErrorCode.SubmissionStorageQuota,
|
|
511
|
+
{ cause: error }
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
if (name === "VersionError") {
|
|
515
|
+
return clientError(
|
|
516
|
+
"Another tab upgraded submission storage. Reload this page to continue.",
|
|
517
|
+
RelayErrorCode.SubmissionStorage,
|
|
518
|
+
{ cause: error }
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
return clientError(
|
|
522
|
+
action === "open" ? "Could not open submission storage. Try again, and check that this browser allows site storage (private browsing can turn it off)." : action === "read" ? "Could not read the saved submission. Do not start another claim; try again when browser storage is available." : "Could not save submission progress. Resume the saved submission when browser storage is available.",
|
|
523
|
+
RelayErrorCode.SubmissionStorage,
|
|
524
|
+
{ cause: error }
|
|
525
|
+
);
|
|
526
|
+
}
|
|
495
527
|
function browserSubmissionStore() {
|
|
496
|
-
let
|
|
497
|
-
function
|
|
528
|
+
let opening;
|
|
529
|
+
function release(db) {
|
|
530
|
+
db.close();
|
|
531
|
+
if (opening?.db === db) {
|
|
532
|
+
opening = void 0;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function start() {
|
|
536
|
+
let unblock;
|
|
537
|
+
const current = {
|
|
538
|
+
blocked: new Promise((resolve) => unblock = resolve),
|
|
539
|
+
done: new Promise((resolve, reject) => {
|
|
540
|
+
let request;
|
|
541
|
+
try {
|
|
542
|
+
request = indexedDB.open(DATABASE, 1);
|
|
543
|
+
} catch (error) {
|
|
544
|
+
reject(storageError(error, "open"));
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
request.onupgradeneeded = () => {
|
|
548
|
+
if (!request.result.objectStoreNames.contains(STORE)) {
|
|
549
|
+
request.result.createObjectStore(STORE);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
request.onblocked = unblock;
|
|
553
|
+
request.onerror = () => reject(storageError(request.error, "open"));
|
|
554
|
+
request.onsuccess = () => {
|
|
555
|
+
const db = request.result;
|
|
556
|
+
db.onversionchange = () => release(db);
|
|
557
|
+
db.onclose = () => release(db);
|
|
558
|
+
current.db = db;
|
|
559
|
+
resolve(db);
|
|
560
|
+
};
|
|
561
|
+
})
|
|
562
|
+
};
|
|
563
|
+
current.done.catch(() => {
|
|
564
|
+
if (opening === current) {
|
|
565
|
+
opening = void 0;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
return current;
|
|
569
|
+
}
|
|
570
|
+
async function connect() {
|
|
498
571
|
if (!globalThis.indexedDB || !globalThis.navigator?.locks) {
|
|
499
572
|
throw clientError(
|
|
500
573
|
"This browser cannot safely save submissions. Use a browser with IndexedDB and Web Locks enabled.",
|
|
501
574
|
RelayErrorCode.SubmissionStorage
|
|
502
575
|
);
|
|
503
576
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
577
|
+
if (opening?.db) {
|
|
578
|
+
return opening.db;
|
|
579
|
+
}
|
|
580
|
+
const attempt = opening ??= start();
|
|
581
|
+
let timer;
|
|
582
|
+
try {
|
|
583
|
+
return await Promise.race([
|
|
584
|
+
attempt.done,
|
|
585
|
+
attempt.blocked.then(
|
|
586
|
+
() => new Promise((_, reject) => {
|
|
587
|
+
timer = setTimeout(
|
|
588
|
+
() => reject(
|
|
589
|
+
clientError(
|
|
590
|
+
"Submission storage is blocked by another Relay tab. Close or reload other Relay tabs, then try again.",
|
|
591
|
+
RelayErrorCode.SubmissionStorage
|
|
592
|
+
)
|
|
593
|
+
),
|
|
594
|
+
BLOCKED_GRACE_MS
|
|
595
|
+
);
|
|
596
|
+
})
|
|
518
597
|
)
|
|
519
|
-
);
|
|
520
|
-
}
|
|
598
|
+
]);
|
|
599
|
+
} finally {
|
|
600
|
+
clearTimeout(timer);
|
|
601
|
+
}
|
|
521
602
|
}
|
|
522
|
-
async function transact(key, value) {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
)
|
|
538
|
-
|
|
539
|
-
|
|
603
|
+
async function transact(key, action, value) {
|
|
604
|
+
for (let retry = true; ; retry = false) {
|
|
605
|
+
const db = await connect();
|
|
606
|
+
let transaction;
|
|
607
|
+
try {
|
|
608
|
+
transaction = db.transaction(
|
|
609
|
+
STORE,
|
|
610
|
+
action === "read" ? "readonly" : "readwrite",
|
|
611
|
+
{ durability: "strict" }
|
|
612
|
+
);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
release(db);
|
|
615
|
+
if (retry && errorName(error) === "InvalidStateError") {
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
throw storageError(error, action);
|
|
619
|
+
}
|
|
620
|
+
return new Promise((resolve, reject) => {
|
|
621
|
+
let request;
|
|
622
|
+
function fail(error) {
|
|
623
|
+
if (errorName(error) !== "QuotaExceededError") {
|
|
624
|
+
release(db);
|
|
625
|
+
}
|
|
626
|
+
reject(storageError(error, action));
|
|
627
|
+
}
|
|
628
|
+
try {
|
|
629
|
+
const objects = transaction.objectStore(STORE);
|
|
630
|
+
request = action === "read" ? objects.get(key) : objects.put(value, key);
|
|
631
|
+
} catch (error) {
|
|
632
|
+
try {
|
|
633
|
+
transaction.abort();
|
|
634
|
+
} catch {
|
|
635
|
+
}
|
|
636
|
+
fail(error);
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
transaction.oncomplete = () => resolve(request.result);
|
|
640
|
+
transaction.onabort = () => fail(transaction.error ?? request.error);
|
|
641
|
+
});
|
|
642
|
+
}
|
|
540
643
|
}
|
|
541
644
|
return {
|
|
542
|
-
read: (key) => transact(key),
|
|
645
|
+
read: (key) => transact(key, "read"),
|
|
543
646
|
write: async (key, value) => {
|
|
544
|
-
await transact(key, value);
|
|
647
|
+
await transact(key, "write", value);
|
|
545
648
|
},
|
|
546
649
|
exclusive: async (key, task) => {
|
|
547
|
-
await
|
|
650
|
+
await connect();
|
|
548
651
|
return navigator.locks.request(key, task);
|
|
549
652
|
}
|
|
550
653
|
};
|