@domino-sdk/relay 1.66.1 → 1.68.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/CHANGELOG.md +68 -0
- package/dist/{accounts-_lNsiR2k.d.ts → accounts-DnpKoJCo.d.ts} +210 -3
- package/dist/{attempt-captures-BqPggxTU.d.ts → attempt-captures-DMNFMYFb.d.ts} +9 -1
- package/dist/authoring.d.ts +352 -40
- package/dist/authoring.js +131 -22
- package/dist/{automatic-outcomes-BzAvfcpd.d.ts → automatic-outcomes-CQ3vpiQl.d.ts} +2 -2
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +10 -9
- package/dist/browser.js +12 -12
- package/dist/{catalog-ByZMRS7I.d.ts → catalog-BLGie8Lh.d.ts} +60 -2
- package/dist/chunk-4JSPMFO2.js +427 -0
- package/dist/{chunk-5LD5DKOM.js → chunk-55WJVFWC.js} +2 -2
- package/dist/{chunk-CJDB6W6I.js → chunk-5AKD4ZF3.js} +75 -36
- package/dist/{chunk-7MQCQYEE.js → chunk-6UBFSMCM.js} +1 -1
- package/dist/{chunk-XCEGNKGH.js → chunk-6YTSRWRB.js} +1254 -700
- package/dist/{chunk-OWDIR7ZU.js → chunk-75KF633N.js} +9 -1
- package/dist/{chunk-4TC4HK5Y.js → chunk-7YSVZA7A.js} +1 -1
- package/dist/{chunk-7HTRIEM7.js → chunk-CZ7NQ7W7.js} +11 -68
- package/dist/{chunk-ANVAUOJP.js → chunk-DDJN2T5A.js} +1 -1
- package/dist/{chunk-M66Y5OMJ.js → chunk-DNPDR4Z7.js} +16 -9
- package/dist/{chunk-FU3W4IQN.js → chunk-EXZVWQOQ.js} +2 -2
- package/dist/{chunk-5DYS2OIP.js → chunk-HXTKI34N.js} +14 -2
- package/dist/{chunk-FGXLXENM.js → chunk-IW46TW3A.js} +21 -1
- package/dist/{chunk-2Y4EZKET.js → chunk-KKHENO57.js} +2 -2
- package/dist/{chunk-U66GUVSG.js → chunk-LZXDYSUH.js} +2 -0
- package/dist/{chunk-QYHEHMCG.js → chunk-MEUAJIVO.js} +2 -2
- package/dist/{chunk-BQXRCJ3N.js → chunk-P4TPW4SY.js} +1 -1
- package/dist/{chunk-CGUL4MRE.js → chunk-R3MNZKNJ.js} +1 -1
- package/dist/{chunk-R2LHIWAM.js → chunk-SD74HD75.js} +45 -9
- package/dist/{chunk-FUFMYKSQ.js → chunk-TYZFVL73.js} +136 -5
- package/dist/chunk-VAGGGB6B.js +87 -0
- package/dist/{chunk-2HHZV7U3.js → chunk-VRZZB7CQ.js} +1 -1
- package/dist/{client-Cze4lfwA.d.ts → client-BMif22WQ.d.ts} +136 -7
- package/dist/{dashboards-pVfclkyh.d.ts → dashboards-DMk-vL1q.d.ts} +4 -4
- package/dist/{deployments-Cr1tfqrr.d.ts → deployments-BCr418BX.d.ts} +582 -173
- package/dist/{identity-integration-Ci2vGKtX.d.ts → identity-integration-r76xaAax.d.ts} +10 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/internal.d.ts +155 -14
- package/dist/internal.js +255 -25
- package/dist/{limits-pE04y9O2.d.ts → limits-ByVRQePO.d.ts} +6 -1
- package/dist/{offers-Hw2P6tcK.d.ts → offers-xcPbYaEv.d.ts} +2 -2
- package/dist/portal-proxy.d.ts +5 -5
- package/dist/portal-proxy.js +13 -15
- package/dist/react/index.d.ts +38 -15
- package/dist/react/index.js +12 -12
- package/dist/{reward-deliveries-BCV8hznc.d.ts → reward-deliveries-0VvT6LMj.d.ts} +1 -1
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/2UDZ6TPL.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/schema.d.ts +401 -104
- package/dist/schema.js +66 -8
- package/dist/server/index.d.ts +12 -12
- package/dist/server/index.js +2288 -873
- package/dist/{sign-in-providers-BAkGjSXo.d.ts → sign-in-providers-C5_753DZ.d.ts} +2 -2
- package/dist/solana.d.ts +171 -0
- package/dist/solana.js +364 -0
- package/dist/{submission-input-ChL1aYNH.d.ts → submission-input-CaL8drIh.d.ts} +2 -2
- package/dist/{telegram-browser-BFs4u7lC.d.ts → telegram-browser-DLtHPRBI.d.ts} +6 -108
- package/dist/telegram.d.ts +8 -8
- package/dist/telegram.js +2 -2
- package/dist/testing.d.ts +87 -14
- package/dist/testing.js +108 -11
- package/dist/{tracker-data-Bl-qPIvZ.d.ts → tracker-data-CAK942sx.d.ts} +300 -3
- package/dist/{transport-WE49Ta3A.d.ts → transport-CkidqTOk.d.ts} +5866 -1244
- package/dist/{wallet-B7e06v4m.d.ts → wallet-DQtJelQQ.d.ts} +418 -33
- package/dist/wallet-browser-dpmr22Xv.d.ts +106 -0
- package/package.json +18 -1
- package/dist/chunk-UYVJZR33.js +0 -34
- package/dist/chunk-UZ765UGH.js +0 -18
- package/dist/runtime/chunks/C5V267I7.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RelayErrorCode,
|
|
3
3
|
clientError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IW46TW3A.js";
|
|
5
5
|
|
|
6
6
|
// src/identifier.ts
|
|
7
7
|
import * as z from "zod";
|
|
@@ -352,6 +352,9 @@ var telegramMessagesNamespace = "telegram-messages";
|
|
|
352
352
|
var youtubeShortsNamespace = "youtube-shorts";
|
|
353
353
|
var tiktokVideosNamespace = "tiktok-videos";
|
|
354
354
|
var walletBalancesNamespace = "wallet-balances";
|
|
355
|
+
var walletProgramActivityNamespace = "wallet-program-activity";
|
|
356
|
+
var walletNftsNamespace = "wallet-nfts";
|
|
357
|
+
var walletStakeNamespace = "wallet-stake";
|
|
355
358
|
|
|
356
359
|
// src/telegram.ts
|
|
357
360
|
import * as z6 from "zod";
|
|
@@ -502,9 +505,65 @@ var limits = /* @__PURE__ */ (() => Object.freeze({
|
|
|
502
505
|
trackerPreview: Object.freeze({ pages: 3, posts: 100, days: 30 }),
|
|
503
506
|
walletsPerChain: 5,
|
|
504
507
|
walletEventLogs: 1e3,
|
|
505
|
-
walletTransactions: 1e3
|
|
508
|
+
walletTransactions: 1e3,
|
|
509
|
+
transactionFixtureSignatures: 20
|
|
506
510
|
}))();
|
|
507
511
|
|
|
512
|
+
// src/base58.ts
|
|
513
|
+
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
514
|
+
function base58(bytes) {
|
|
515
|
+
let zeros = 0;
|
|
516
|
+
while (zeros < bytes.length && bytes[zeros] === 0) {
|
|
517
|
+
zeros++;
|
|
518
|
+
}
|
|
519
|
+
const digits = [];
|
|
520
|
+
for (let index = zeros; index < bytes.length; index++) {
|
|
521
|
+
let carry = bytes[index];
|
|
522
|
+
for (let digit = 0; digit < digits.length; digit++) {
|
|
523
|
+
carry += digits[digit] * 256;
|
|
524
|
+
digits[digit] = carry % 58;
|
|
525
|
+
carry = Math.floor(carry / 58);
|
|
526
|
+
}
|
|
527
|
+
while (carry > 0) {
|
|
528
|
+
digits.push(carry % 58);
|
|
529
|
+
carry = Math.floor(carry / 58);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
let result = "1".repeat(zeros);
|
|
533
|
+
for (let digit = digits.length - 1; digit >= 0; digit--) {
|
|
534
|
+
result += alphabet[digits[digit]];
|
|
535
|
+
}
|
|
536
|
+
return result;
|
|
537
|
+
}
|
|
538
|
+
function base58Bytes(value, length) {
|
|
539
|
+
if (value.length > Math.ceil(length * Math.log(256) / Math.log(58))) {
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
542
|
+
let zeros = 0;
|
|
543
|
+
while (zeros < value.length && value[zeros] === "1") {
|
|
544
|
+
zeros++;
|
|
545
|
+
}
|
|
546
|
+
const bytes = [];
|
|
547
|
+
for (let index = zeros; index < value.length; index++) {
|
|
548
|
+
let carry = alphabet.indexOf(value[index]);
|
|
549
|
+
if (carry < 0) {
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
for (let byte = 0; byte < bytes.length; byte++) {
|
|
553
|
+
carry += bytes[byte] * 58;
|
|
554
|
+
bytes[byte] = carry & 255;
|
|
555
|
+
carry >>= 8;
|
|
556
|
+
}
|
|
557
|
+
while (carry > 0) {
|
|
558
|
+
bytes.push(carry & 255);
|
|
559
|
+
carry >>= 8;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const decoded = new Uint8Array(zeros + bytes.length);
|
|
563
|
+
decoded.set(bytes.reverse(), zeros);
|
|
564
|
+
return decoded.length === length && base58(decoded) === value ? decoded : null;
|
|
565
|
+
}
|
|
566
|
+
|
|
508
567
|
// src/wallet.ts
|
|
509
568
|
import * as z7 from "zod";
|
|
510
569
|
var solanaAddressSchema = /* @__PURE__ */ (() => z7.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/))();
|
|
@@ -540,6 +599,10 @@ function cosmosChain(chain) {
|
|
|
540
599
|
return { ...value, network };
|
|
541
600
|
}
|
|
542
601
|
var solanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
602
|
+
var solanaDevnet = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
603
|
+
function isSolanaNetwork(value) {
|
|
604
|
+
return value === solanaMainnet || value === solanaDevnet;
|
|
605
|
+
}
|
|
543
606
|
var evmAddressSchema = /* @__PURE__ */ (() => z7.string().regex(/^0x[0-9a-fA-F]{40}$/))();
|
|
544
607
|
var cosmosAddressSchema = /* @__PURE__ */ (() => z7.string().min(8).max(90).regex(
|
|
545
608
|
/^(?:[a-z][a-z0-9]{0,82}1[02-9ac-hj-np-z]{38,}|[A-Z][A-Z0-9]{0,82}1[02-9AC-HJ-NP-Z]{38,})$/
|
|
@@ -549,7 +612,10 @@ var walletAddressInputSchema = /* @__PURE__ */ (() => z7.discriminatedUnion("cha
|
|
|
549
612
|
z7.object({
|
|
550
613
|
chain: z7.literal("eip155"),
|
|
551
614
|
address: evmAddressSchema,
|
|
552
|
-
/**
|
|
615
|
+
/**
|
|
616
|
+
* The wallet's current chain, in the message's Chain ID line. Defaults to 1. An EOA's link is
|
|
617
|
+
* chain-agnostic; a smart-contract wallet's signature is checked on this chain.
|
|
618
|
+
*/
|
|
553
619
|
chainId: z7.number().int().positive().safe().optional()
|
|
554
620
|
}).strict(),
|
|
555
621
|
z7.object({
|
|
@@ -570,15 +636,67 @@ var walletMessageChallengeSchema = /* @__PURE__ */ (() => z7.object({
|
|
|
570
636
|
}))();
|
|
571
637
|
var walletSignatureSchema = /* @__PURE__ */ (() => z7.object({
|
|
572
638
|
challenge: z7.string().min(1).max(200),
|
|
573
|
-
/**
|
|
574
|
-
|
|
639
|
+
/**
|
|
640
|
+
* solana: base58, 64 bytes · eip155: 0x and hex, 65 bytes from an EOA, longer from a smart-contract
|
|
641
|
+
* wallet (ERC-1271, or ERC-6492-wrapped before it is deployed) · cosmos: base64, 64 bytes (r‖s).
|
|
642
|
+
* The limit fits an ERC-6492-wrapped passkey signature, a few kilobytes, with room to spare.
|
|
643
|
+
*/
|
|
644
|
+
signature: z7.string().min(1).max(16384),
|
|
575
645
|
/** cosmos only: the base64 33-byte compressed secp256k1 key from signArbitrary's pub_key.value */
|
|
576
646
|
publicKey: z7.string().max(128).optional()
|
|
577
647
|
}).strict())();
|
|
648
|
+
function isEvmChainId(value) {
|
|
649
|
+
return /^eip155:[1-9][0-9]{0,15}$/.test(value);
|
|
650
|
+
}
|
|
651
|
+
var evmChainIdSchema = /* @__PURE__ */ (() => z7.custom(
|
|
652
|
+
(value) => typeof value === "string" && isEvmChainId(value),
|
|
653
|
+
'Use an EVM chain ID such as "eip155:8453"'
|
|
654
|
+
))();
|
|
655
|
+
var solanaMemoProgram = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
|
|
656
|
+
var solanaSignatureSchema = /* @__PURE__ */ (() => z7.string().min(64).max(88).refine((value) => base58Bytes(value, 64) !== null, {
|
|
657
|
+
message: "Use a Solana transaction signature: base58, 64 bytes"
|
|
658
|
+
}))();
|
|
659
|
+
var walletTransactionChallengeSchema = /* @__PURE__ */ (() => z7.object({
|
|
660
|
+
id: z7.string().min(1).max(200),
|
|
661
|
+
chain: walletChainSchema,
|
|
662
|
+
/** Canonical base58. The memo instruction lists this account, and it signs it. */
|
|
663
|
+
address: z7.string(),
|
|
664
|
+
/** The exact memo text, which names the project, the environment and a nonce. */
|
|
665
|
+
memo: z7.string().max(566),
|
|
666
|
+
/** The program the memo instruction calls: SPL Memo v2 (`solanaMemoProgram`). */
|
|
667
|
+
memoProgram: z7.string(),
|
|
668
|
+
/** Submit the transaction's signature before this time (epoch milliseconds). */
|
|
669
|
+
expiresAt: z7.number().int()
|
|
670
|
+
}))();
|
|
671
|
+
var walletTransactionProofSchema = /* @__PURE__ */ (() => z7.object({
|
|
672
|
+
chain: z7.literal("solana"),
|
|
673
|
+
address: solanaAddressSchema,
|
|
674
|
+
/** The transaction's signature (its first one, as explorers show it). */
|
|
675
|
+
signature: solanaSignatureSchema
|
|
676
|
+
}).strict())();
|
|
578
677
|
var linkedWalletSchema = /* @__PURE__ */ (() => z7.object({
|
|
579
678
|
chain: walletChainSchema,
|
|
580
679
|
network: cosmosNetworkSchema.nullable(),
|
|
581
680
|
address: z7.string(),
|
|
681
|
+
/**
|
|
682
|
+
* EVM only, for a smart-contract wallet: the CAIP-2 network (`eip155:<chain ID>`) whose contract
|
|
683
|
+
* checked the wallet's latest proof. The wallet is the account at this address on that chain.
|
|
684
|
+
* Absent for a key's own signature.
|
|
685
|
+
*/
|
|
686
|
+
provedOn: evmChainIdSchema.optional(),
|
|
687
|
+
/**
|
|
688
|
+
* `"transaction"` when the wallet's latest proof was a transaction it executed (a Solana smart
|
|
689
|
+
* account, such as a Squads vault) rather than a signed message. Absent for a signed message.
|
|
690
|
+
*
|
|
691
|
+
* @experimental A minor release can change linking by transaction.
|
|
692
|
+
*/
|
|
693
|
+
provedBy: z7.string().optional(),
|
|
694
|
+
/**
|
|
695
|
+
* With `provedBy: "transaction"`: the signature of the Solana mainnet transaction that proved it.
|
|
696
|
+
*
|
|
697
|
+
* @experimental A minor release can change linking by transaction.
|
|
698
|
+
*/
|
|
699
|
+
proofTransaction: z7.string().optional(),
|
|
582
700
|
verifiedAt: z7.number().int().nonnegative(),
|
|
583
701
|
revision: z7.number().int().positive(),
|
|
584
702
|
/** True when this wallet can sign in: it was first used through wallet sign-in. Linking never enables sign-in. */
|
|
@@ -617,7 +735,18 @@ var walletSignInNetworksSchema = /* @__PURE__ */ (() => z7.array(walletSignInNet
|
|
|
617
735
|
function walletSignInNetwork(wallet) {
|
|
618
736
|
return wallet.chain;
|
|
619
737
|
}
|
|
738
|
+
function evmWalletOn(wallet, chain) {
|
|
739
|
+
return wallet.chain === "eip155" && chain.startsWith("eip155:") && (wallet.provedOn == null || wallet.provedOn === chain);
|
|
740
|
+
}
|
|
620
741
|
function caip10(wallet, network) {
|
|
742
|
+
if (wallet.chain === "eip155" && wallet.provedOn) {
|
|
743
|
+
if (network && network !== wallet.provedOn) {
|
|
744
|
+
throw new Error(
|
|
745
|
+
`A smart-contract wallet is an account on ${wallet.provedOn} only`
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
return `${wallet.provedOn}:${wallet.address}`;
|
|
749
|
+
}
|
|
621
750
|
if (wallet.chain === "cosmos") {
|
|
622
751
|
if (!wallet.network || network && network !== wallet.network) {
|
|
623
752
|
throw new Error("A Cosmos wallet belongs to its own network");
|
|
@@ -631,13 +760,6 @@ function caip10(wallet, network) {
|
|
|
631
760
|
}
|
|
632
761
|
return `${selected}:${wallet.address}`;
|
|
633
762
|
}
|
|
634
|
-
function isEvmChainId(value) {
|
|
635
|
-
return /^eip155:[1-9][0-9]{0,15}$/.test(value);
|
|
636
|
-
}
|
|
637
|
-
var evmChainIdSchema = /* @__PURE__ */ (() => z7.custom(
|
|
638
|
-
(value) => typeof value === "string" && isEvmChainId(value),
|
|
639
|
-
'Use an EVM chain ID such as "eip155:8453"'
|
|
640
|
-
))();
|
|
641
763
|
var units = /* @__PURE__ */ (() => z7.string().regex(/^(0|[1-9][0-9]*)$/))();
|
|
642
764
|
var walletBalanceSchema = /* @__PURE__ */ (() => responseShape(
|
|
643
765
|
z7.object({
|
|
@@ -669,13 +791,38 @@ var walletBalanceSampleSchema = /* @__PURE__ */ (() => z7.object({
|
|
|
669
791
|
*/
|
|
670
792
|
block: z7.string()
|
|
671
793
|
}))();
|
|
794
|
+
var walletProgramActivitySchema = /* @__PURE__ */ (() => z7.object({
|
|
795
|
+
signature: z7.string(),
|
|
796
|
+
/** The transaction's slot, as a decimal integer string. */
|
|
797
|
+
slot: z7.string(),
|
|
798
|
+
/** The block time, in epoch milliseconds. */
|
|
799
|
+
timestamp: z7.number().int().nonnegative(),
|
|
800
|
+
/**
|
|
801
|
+
* Whether the wallet signed the transaction. Always true unless the tracker counts any signer
|
|
802
|
+
* (`signer: "any"`).
|
|
803
|
+
*/
|
|
804
|
+
signer: z7.boolean(),
|
|
805
|
+
/** The tracker's instruction, as the program's IDL spells it; null when the tracker names none. */
|
|
806
|
+
instruction: z7.string().nullable(),
|
|
807
|
+
/**
|
|
808
|
+
* How much of the tracker's mint the wallet moved, in or out, in base units as a decimal integer
|
|
809
|
+
* string; null when the tracker names no mint.
|
|
810
|
+
*/
|
|
811
|
+
amount: z7.string().nullable(),
|
|
812
|
+
/**
|
|
813
|
+
* The wallet's change of the tracker's mint in base units, negative when it spent: a decimal
|
|
814
|
+
* integer string; null when the tracker names no mint.
|
|
815
|
+
*/
|
|
816
|
+
delta: z7.string().nullable()
|
|
817
|
+
}))();
|
|
672
818
|
var nftCollectionPattern = /^(eip155:[1-9][0-9]{0,15})\/(erc721|erc1155):(0x[0-9a-fA-F]{40})(?:\/(0|[1-9][0-9]{0,77}))?$/;
|
|
673
|
-
var
|
|
819
|
+
var solanaNftCollectionPattern = /^(solana:[1-9A-HJ-NP-Za-km-z]{32})\/nft:(.*)$/;
|
|
674
820
|
var maxTokenId = 2n ** 256n - 1n;
|
|
675
821
|
function parseNftCollection(value) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
822
|
+
const solana = solanaNftCollectionPattern.exec(value);
|
|
823
|
+
if (solana) {
|
|
824
|
+
const [, chain2, mint] = solana;
|
|
825
|
+
return isSolanaNetwork(chain2) && solanaAddressSchema.safeParse(mint).success ? { chain: chain2, standard: "metaplex", mint } : null;
|
|
679
826
|
}
|
|
680
827
|
const match = nftCollectionPattern.exec(value);
|
|
681
828
|
if (!match) {
|
|
@@ -712,6 +859,16 @@ var walletNftsSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
712
859
|
observedAt: z7.number().int().nonnegative()
|
|
713
860
|
}).strict()
|
|
714
861
|
))();
|
|
862
|
+
var walletNftSampleSchema = /* @__PURE__ */ (() => z7.object({
|
|
863
|
+
/** How many of the collection's NFTs the wallet held, as a decimal integer string. */
|
|
864
|
+
count: z7.string(),
|
|
865
|
+
/**
|
|
866
|
+
* Where the run read: the EVM block number every wallet of the run was read at, or on Solana the
|
|
867
|
+
* slot this wallet's answer reflects (at or after the run's pinned slot), as a decimal integer
|
|
868
|
+
* string.
|
|
869
|
+
*/
|
|
870
|
+
block: z7.string()
|
|
871
|
+
}))();
|
|
715
872
|
var integerType = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
716
873
|
var bytesType = /^bytes([1-9]|[12][0-9]|3[0-2])?$/;
|
|
717
874
|
function elementaryType(type) {
|
|
@@ -918,7 +1075,7 @@ var maxWalletTransactionLookback = 30 * 24 * 60 * 60 * 1e3;
|
|
|
918
1075
|
var walletTransactionsSchema = /* @__PURE__ */ (() => responseShape(
|
|
919
1076
|
z7.object({
|
|
920
1077
|
program: z7.string(),
|
|
921
|
-
/**
|
|
1078
|
+
/** The CAIP-2 ID of the cluster read: Solana mainnet or devnet. */
|
|
922
1079
|
chain: z7.string(),
|
|
923
1080
|
/** The mint whose associated token accounts were read, or null for the wallets themselves. */
|
|
924
1081
|
mint: z7.string().nullable(),
|
|
@@ -961,7 +1118,7 @@ var walletTransactionsSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
961
1118
|
),
|
|
962
1119
|
/**
|
|
963
1120
|
* The program's instructions in the transaction, top-level and inner, in call order,
|
|
964
|
-
* decoded with the program's
|
|
1121
|
+
* decoded with the program's IDL. Instructions the IDL does not describe are left
|
|
965
1122
|
* out. Absent when the program's setting has no IDL.
|
|
966
1123
|
*/
|
|
967
1124
|
instructions: z7.array(
|
|
@@ -983,6 +1140,125 @@ var walletTransactionsSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
983
1140
|
observedAt: z7.number().int().nonnegative()
|
|
984
1141
|
}).strict()
|
|
985
1142
|
))();
|
|
1143
|
+
var solanaTransactionFixtureInputSchema = /* @__PURE__ */ (() => z7.object({
|
|
1144
|
+
/** The cluster the transactions ran on; mainnet by default. */
|
|
1145
|
+
chain: z7.enum([solanaMainnet, solanaDevnet]).default(solanaMainnet),
|
|
1146
|
+
/** The program the quest reads, as its `settings.solanaProgram()` setting holds it. */
|
|
1147
|
+
program: solanaAddressSchema,
|
|
1148
|
+
/** Each signature once, at most {@link limits.transactionFixtureSignatures}. */
|
|
1149
|
+
signatures: z7.array(solanaSignatureSchema).min(1).max(limits.transactionFixtureSignatures).refine((list) => new Set(list).size === list.length, {
|
|
1150
|
+
message: "List each signature once"
|
|
1151
|
+
}),
|
|
1152
|
+
/** The wallet whose view the answer gives; the transactions' fee payer by default. */
|
|
1153
|
+
wallet: solanaAddressSchema.optional(),
|
|
1154
|
+
/**
|
|
1155
|
+
* The program's IDL, as a pasted one would be stored; without it, the IDL the program
|
|
1156
|
+
* publishes on chain, as saving its setting stores it.
|
|
1157
|
+
*/
|
|
1158
|
+
idl: anchorIdlSchema.optional()
|
|
1159
|
+
}).strict())();
|
|
1160
|
+
var seedInteger = /* @__PURE__ */ (() => z7.union([z7.number().finite(), z7.string().max(64)]))();
|
|
1161
|
+
var solanaSeedSchema = /* @__PURE__ */ (() => z7.union([
|
|
1162
|
+
z7.strictObject({ wallet: z7.literal(true) }),
|
|
1163
|
+
z7.string().max(200),
|
|
1164
|
+
z7.strictObject({ pubkey: z7.string().max(64) }),
|
|
1165
|
+
z7.strictObject({ u8: seedInteger }),
|
|
1166
|
+
z7.strictObject({ u16: seedInteger }),
|
|
1167
|
+
z7.strictObject({ u32: seedInteger }),
|
|
1168
|
+
z7.strictObject({ u64: seedInteger }),
|
|
1169
|
+
z7.strictObject({ u128: seedInteger }),
|
|
1170
|
+
z7.strictObject({ i8: seedInteger }),
|
|
1171
|
+
z7.strictObject({ i16: seedInteger }),
|
|
1172
|
+
z7.strictObject({ i32: seedInteger }),
|
|
1173
|
+
z7.strictObject({ i64: seedInteger }),
|
|
1174
|
+
z7.strictObject({ i128: seedInteger })
|
|
1175
|
+
]))();
|
|
1176
|
+
var maxSolanaSeeds = 15;
|
|
1177
|
+
var walletProgramAccountSchema = /* @__PURE__ */ (() => responseShape(
|
|
1178
|
+
z7.object({
|
|
1179
|
+
program: z7.string(),
|
|
1180
|
+
/** The CAIP-2 ID of the cluster read: Solana mainnet or devnet. */
|
|
1181
|
+
chain: z7.string(),
|
|
1182
|
+
/** The account type read, as the IDL names it. */
|
|
1183
|
+
account: z7.string(),
|
|
1184
|
+
wallets: z7.array(
|
|
1185
|
+
z7.object({
|
|
1186
|
+
/** The member's linked wallet. */
|
|
1187
|
+
address: z7.string(),
|
|
1188
|
+
/** The program-derived address its seeds give: the account read. */
|
|
1189
|
+
pda: z7.string(),
|
|
1190
|
+
/**
|
|
1191
|
+
* The account's fields by name, decoded with the IDL: integers up to 32 bits and floats as
|
|
1192
|
+
* numbers, wider integers as decimal strings, public keys in base58, `bytes` and arrays as
|
|
1193
|
+
* arrays, an absent option as null, and an enum as `{ Variant: fields }`. Null when no
|
|
1194
|
+
* account exists at `pda`.
|
|
1195
|
+
*/
|
|
1196
|
+
fields: z7.record(z7.string(), z7.json()).nullable()
|
|
1197
|
+
})
|
|
1198
|
+
),
|
|
1199
|
+
/** The slot every account was read at. */
|
|
1200
|
+
at: z7.object({
|
|
1201
|
+
kind: z7.string(),
|
|
1202
|
+
number: units
|
|
1203
|
+
}),
|
|
1204
|
+
observedAt: z7.number().int().nonnegative()
|
|
1205
|
+
})
|
|
1206
|
+
))();
|
|
1207
|
+
var stakeAmounts = {
|
|
1208
|
+
/** Delegated stake that is active: activated before the current epoch and not deactivating. */
|
|
1209
|
+
amount: units,
|
|
1210
|
+
/** Delegated stake that activates at the next epoch boundary. */
|
|
1211
|
+
activating: units,
|
|
1212
|
+
/** Stake deactivated this epoch, which stops earning at the next epoch boundary. */
|
|
1213
|
+
deactivating: units
|
|
1214
|
+
};
|
|
1215
|
+
var walletStakeSchema = /* @__PURE__ */ (() => responseShape(
|
|
1216
|
+
z7.object({
|
|
1217
|
+
/** The CAIP-2 ID of the cluster read: Solana mainnet or devnet. */
|
|
1218
|
+
chain: z7.string(),
|
|
1219
|
+
/** The vote account the read counted, or null for every validator. */
|
|
1220
|
+
voteAccount: z7.string().nullable(),
|
|
1221
|
+
/** The epoch the stake states are for. */
|
|
1222
|
+
epoch: z7.number().int().nonnegative(),
|
|
1223
|
+
/** Active stake, summed over `wallets`. */
|
|
1224
|
+
total: units,
|
|
1225
|
+
/** Activating stake, summed over `wallets`. */
|
|
1226
|
+
activating: units,
|
|
1227
|
+
/** Deactivating stake, summed over `wallets`. */
|
|
1228
|
+
deactivating: units,
|
|
1229
|
+
/**
|
|
1230
|
+
* Each wallet read, with the stake of the accounts it controls. An account two linked wallets
|
|
1231
|
+
* control counts once, for its withdrawer.
|
|
1232
|
+
*/
|
|
1233
|
+
wallets: z7.array(z7.object({ address: z7.string(), ...stakeAmounts })),
|
|
1234
|
+
/** The stake per vote account, summed over the wallets; none without stake in any state. */
|
|
1235
|
+
voteAccounts: z7.array(
|
|
1236
|
+
z7.object({ voteAccount: z7.string(), ...stakeAmounts })
|
|
1237
|
+
),
|
|
1238
|
+
/** The earliest slot the epoch and the stake accounts were read at. */
|
|
1239
|
+
at: z7.object({
|
|
1240
|
+
kind: z7.string(),
|
|
1241
|
+
number: units
|
|
1242
|
+
}),
|
|
1243
|
+
observedAt: z7.number().int().nonnegative()
|
|
1244
|
+
})
|
|
1245
|
+
))();
|
|
1246
|
+
var walletStakeSampleSchema = /* @__PURE__ */ (() => z7.object({
|
|
1247
|
+
/**
|
|
1248
|
+
* Active stake: delegated, activated before the sampled epoch and not deactivating, as a
|
|
1249
|
+
* decimal integer string.
|
|
1250
|
+
*/
|
|
1251
|
+
amount: z7.string(),
|
|
1252
|
+
/** Stake that activates at the next epoch boundary, as a decimal integer string. */
|
|
1253
|
+
activating: z7.string(),
|
|
1254
|
+
/** Stake deactivated this epoch, as a decimal integer string. */
|
|
1255
|
+
deactivating: z7.string(),
|
|
1256
|
+
/**
|
|
1257
|
+
* The slot this wallet's answer reflects, at or after the run's pinned slot, as a decimal
|
|
1258
|
+
* integer string.
|
|
1259
|
+
*/
|
|
1260
|
+
block: z7.string()
|
|
1261
|
+
}))();
|
|
986
1262
|
|
|
987
1263
|
// src/discord.ts
|
|
988
1264
|
import * as z8 from "zod";
|
|
@@ -1466,26 +1742,26 @@ function matches(schema, value, at, budget) {
|
|
|
1466
1742
|
}
|
|
1467
1743
|
}
|
|
1468
1744
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
1469
|
-
const
|
|
1745
|
+
const object26 = value;
|
|
1470
1746
|
const properties = schema.properties ?? {};
|
|
1471
1747
|
const required = schema.required ?? [];
|
|
1472
1748
|
charge(budget, required.length);
|
|
1473
1749
|
for (const key of required) {
|
|
1474
|
-
if (!Object.hasOwn(
|
|
1750
|
+
if (!Object.hasOwn(object26, key)) {
|
|
1475
1751
|
return issue(() => `missing required key "${clip(key, maxKeyText)}"`);
|
|
1476
1752
|
}
|
|
1477
1753
|
}
|
|
1478
1754
|
const literals = literalsOf(schema);
|
|
1479
1755
|
charge(budget, literals.length);
|
|
1480
1756
|
for (const [key, property] of literals) {
|
|
1481
|
-
if (Object.hasOwn(
|
|
1757
|
+
if (Object.hasOwn(object26, key) && object26[key] !== property.const) {
|
|
1482
1758
|
return {
|
|
1483
1759
|
at: { parent: at, key },
|
|
1484
1760
|
reason: () => `expected ${JSON.stringify(property.const)}`
|
|
1485
1761
|
};
|
|
1486
1762
|
}
|
|
1487
1763
|
}
|
|
1488
|
-
const keys = Object.keys(
|
|
1764
|
+
const keys = Object.keys(object26);
|
|
1489
1765
|
charge(budget, keys.length);
|
|
1490
1766
|
const names = schema.propertyNames?.enum;
|
|
1491
1767
|
const allowed = names && setOf(schema.propertyNames, names);
|
|
@@ -1506,7 +1782,7 @@ function matches(schema, value, at, budget) {
|
|
|
1506
1782
|
if (property && property !== true) {
|
|
1507
1783
|
const found = matches(
|
|
1508
1784
|
property,
|
|
1509
|
-
|
|
1785
|
+
object26[key],
|
|
1510
1786
|
{ parent: at, key },
|
|
1511
1787
|
budget
|
|
1512
1788
|
);
|
|
@@ -1812,11 +2088,42 @@ var customContentSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
|
1812
2088
|
}))();
|
|
1813
2089
|
var walletBalanceSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
1814
2090
|
chain: z12.string().regex(
|
|
1815
|
-
/^(?:solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp|eip155:[1-9][0-9]{0,15}|cosmos:[-_a-zA-Z0-9]{1,32})$/,
|
|
1816
|
-
'Use "solana", an EVM chain such as "eip155:8453" or a Cosmos network such as "cosmos:cosmoshub-4"'
|
|
2091
|
+
/^(?:solana:(?:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp|EtWTRABZaYq6iMfeYKouRu166VU2xqa1)|eip155:[1-9][0-9]{0,15}|cosmos:[-_a-zA-Z0-9]{1,32})$/,
|
|
2092
|
+
'Use "solana", Solana devnet ("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"), an EVM chain such as "eip155:8453" or a Cosmos network such as "cosmos:cosmoshub-4"'
|
|
1817
2093
|
),
|
|
1818
2094
|
token: z12.string().min(1).max(128).nullable()
|
|
1819
2095
|
}))();
|
|
2096
|
+
var solanaClusterSchema = /* @__PURE__ */ (() => z12.string().regex(
|
|
2097
|
+
/^solana:(?:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp|EtWTRABZaYq6iMfeYKouRu166VU2xqa1)$/,
|
|
2098
|
+
'Use "solana" or Solana devnet ("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1")'
|
|
2099
|
+
))();
|
|
2100
|
+
var walletProgramActivitySourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2101
|
+
chain: solanaClusterSchema,
|
|
2102
|
+
program: z12.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "Use a base58 program address"),
|
|
2103
|
+
instruction: z12.string().regex(
|
|
2104
|
+
/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,
|
|
2105
|
+
"Use the instruction's name as the program's IDL spells it"
|
|
2106
|
+
).nullable(),
|
|
2107
|
+
mint: z12.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "Use a base58 SPL mint address").nullable(),
|
|
2108
|
+
minAmount: z12.string().regex(/^[1-9][0-9]{0,77}$/, "Use a positive whole number of base units").nullable(),
|
|
2109
|
+
anySigner: z12.boolean()
|
|
2110
|
+
}).refine(
|
|
2111
|
+
(activity) => activity.minAmount === null || activity.mint !== null,
|
|
2112
|
+
"minAmount needs a mint"
|
|
2113
|
+
))();
|
|
2114
|
+
var walletNftSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2115
|
+
collection: z12.string().max(200).refine(
|
|
2116
|
+
(value) => isNftCollection(value),
|
|
2117
|
+
"Use an NFT collection"
|
|
2118
|
+
)
|
|
2119
|
+
}))();
|
|
2120
|
+
var walletStakeSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2121
|
+
chain: solanaClusterSchema,
|
|
2122
|
+
voteAccount: z12.string().refine(
|
|
2123
|
+
(value) => base58Bytes(value, 32) !== null,
|
|
2124
|
+
"Use a base58 vote account address"
|
|
2125
|
+
).nullable()
|
|
2126
|
+
}))();
|
|
1820
2127
|
var xSearchSourceSchema = /* @__PURE__ */ (() => z12.object({
|
|
1821
2128
|
kind: z12.literal("x-search"),
|
|
1822
2129
|
query: z12.string().trim().min(1).max(2e3)
|
|
@@ -1851,10 +2158,34 @@ var customSourceSchema = /* @__PURE__ */ (() => z12.object({
|
|
|
1851
2158
|
* The chain and token Relay samples, on `wallet.balances()`'s reserved namespace only.
|
|
1852
2159
|
* `wallet.balances()` sets it.
|
|
1853
2160
|
*/
|
|
1854
|
-
balance: walletBalanceSourceSchema.optional()
|
|
2161
|
+
balance: walletBalanceSourceSchema.optional(),
|
|
2162
|
+
/**
|
|
2163
|
+
* The program activity Relay records, on `wallet.programActivity()`'s reserved namespace only.
|
|
2164
|
+
* `wallet.programActivity()` sets it.
|
|
2165
|
+
*/
|
|
2166
|
+
activity: walletProgramActivitySourceSchema.optional(),
|
|
2167
|
+
/**
|
|
2168
|
+
* The NFT collection Relay samples, on `wallet.nfts()`'s reserved namespace only.
|
|
2169
|
+
* `wallet.nfts()` sets it.
|
|
2170
|
+
*/
|
|
2171
|
+
nfts: walletNftSourceSchema.optional(),
|
|
2172
|
+
/**
|
|
2173
|
+
* The cluster and vote account Relay samples stake for, on `wallet.stake()`'s reserved
|
|
2174
|
+
* namespace only. `wallet.stake()` sets it.
|
|
2175
|
+
*/
|
|
2176
|
+
stake: walletStakeSourceSchema.optional()
|
|
1855
2177
|
}).strict().refine(
|
|
1856
2178
|
(source) => source.balance === void 0 || source.namespace === walletBalancesNamespace,
|
|
1857
2179
|
"Only wallet.balances() samples a balance"
|
|
2180
|
+
).refine(
|
|
2181
|
+
(source) => source.activity === void 0 || source.namespace === walletProgramActivityNamespace,
|
|
2182
|
+
"Only wallet.programActivity() records program activity"
|
|
2183
|
+
).refine(
|
|
2184
|
+
(source) => source.nfts === void 0 || source.namespace === walletNftsNamespace,
|
|
2185
|
+
"Only wallet.nfts() samples NFTs"
|
|
2186
|
+
).refine(
|
|
2187
|
+
(source) => source.stake === void 0 || source.namespace === walletStakeNamespace,
|
|
2188
|
+
"Only wallet.stake() samples stake"
|
|
1858
2189
|
).refine(
|
|
1859
2190
|
(source) => !source.content || source.data?.properties?.body?.type === "object" && (source.data.required ?? []).includes("body"),
|
|
1860
2191
|
"A content source's data schema has a required object body"
|
|
@@ -1919,7 +2250,13 @@ var knownTrackerSourceResponseSchema = /* @__PURE__ */ (() => z12.discriminatedU
|
|
|
1919
2250
|
z12.object(xSearchSourceSchema.shape),
|
|
1920
2251
|
z12.object({
|
|
1921
2252
|
...customSourceSchema.shape,
|
|
1922
|
-
identities: z12.array(openIdentityKindSchema).optional()
|
|
2253
|
+
identities: z12.array(openIdentityKindSchema).optional(),
|
|
2254
|
+
// A later Relay may add settings to program activity, NFT or stake samples.
|
|
2255
|
+
activity: z12.object(walletProgramActivitySourceSchema.shape).optional(),
|
|
2256
|
+
// Read as stored: a later Relay may sample collections this SDK does not parse.
|
|
2257
|
+
nfts: z12.object({ collection: z12.string() }).optional(),
|
|
2258
|
+
// Read as stored: a later Relay may sample clusters this SDK does not name.
|
|
2259
|
+
stake: z12.object({ chain: z12.string(), voteAccount: z12.string().nullable() }).optional()
|
|
1923
2260
|
}),
|
|
1924
2261
|
z12.object(discordMessagesSourceSchema.shape),
|
|
1925
2262
|
z12.object(discordReactionsSourceSchema.shape)
|
|
@@ -2053,6 +2390,24 @@ var managedTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.exte
|
|
|
2053
2390
|
(input) => input.query === void 0 !== (input.source === void 0),
|
|
2054
2391
|
"Name the source with source, or an X search with query, not both"
|
|
2055
2392
|
))();
|
|
2393
|
+
var walletProgramActivityTrackerSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2394
|
+
kind: z12.literal("wallet-program-activity"),
|
|
2395
|
+
...walletProgramActivitySourceSchema.shape
|
|
2396
|
+
}).refine(
|
|
2397
|
+
(activity) => activity.minAmount === null || activity.mint !== null,
|
|
2398
|
+
"minAmount needs a mint"
|
|
2399
|
+
))();
|
|
2400
|
+
var programActivityTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.omit({ query: true }).extend({ source: walletProgramActivityTrackerSourceSchema }))();
|
|
2401
|
+
var walletNftsTrackerSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2402
|
+
kind: z12.literal("wallet-nfts"),
|
|
2403
|
+
...walletNftSourceSchema.shape
|
|
2404
|
+
}))();
|
|
2405
|
+
var nftTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.omit({ query: true }).extend({ source: walletNftsTrackerSourceSchema }))();
|
|
2406
|
+
var walletStakeTrackerSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2407
|
+
kind: z12.literal("wallet-stake"),
|
|
2408
|
+
...walletStakeSourceSchema.shape
|
|
2409
|
+
}))();
|
|
2410
|
+
var stakeTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.omit({ query: true }).extend({ source: walletStakeTrackerSourceSchema }))();
|
|
2056
2411
|
var trackerUpdateSchema = /* @__PURE__ */ (() => trackerPropertiesSchema.partial().extend({
|
|
2057
2412
|
source: managedTrackerSourceSchema.optional(),
|
|
2058
2413
|
actionId: identifier
|
|
@@ -2615,7 +2970,7 @@ var trackerTriggerModeSchema = /* @__PURE__ */ (() => z17.enum([
|
|
|
2615
2970
|
"data-changed"
|
|
2616
2971
|
]))();
|
|
2617
2972
|
function defaultTriggerMode(source, namespace) {
|
|
2618
|
-
return source === "custom" && namespace !== telegramMessagesNamespace && namespace !== telegramReactionsNamespace ? "new-observation" : "new-record";
|
|
2973
|
+
return source === "custom" && namespace !== telegramMessagesNamespace && namespace !== telegramReactionsNamespace && namespace !== walletProgramActivityNamespace ? "new-observation" : "new-record";
|
|
2619
2974
|
}
|
|
2620
2975
|
var trackerBoundSchema = /* @__PURE__ */ (() => z17.union([
|
|
2621
2976
|
z17.number().finite(),
|
|
@@ -3140,137 +3495,211 @@ var quizContentSchema = /* @__PURE__ */ (() => z24.array(
|
|
|
3140
3495
|
"Question IDs must be unique"
|
|
3141
3496
|
))();
|
|
3142
3497
|
|
|
3143
|
-
// src/
|
|
3498
|
+
// src/windows.ts
|
|
3144
3499
|
import * as z25 from "zod";
|
|
3145
|
-
var
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3500
|
+
var timestamp4 = /* @__PURE__ */ (() => z25.number().int().safe().nonnegative())();
|
|
3501
|
+
var endsAfterStart = (window) => window.from === void 0 || window.until === void 0 || window.until > window.from;
|
|
3502
|
+
var inWindow = (window, time) => (window.from === void 0 || time >= window.from) && (window.until === void 0 || time < window.until);
|
|
3503
|
+
|
|
3504
|
+
// src/solana-actions.ts
|
|
3505
|
+
import * as z26 from "zod";
|
|
3506
|
+
var maxSolanaActionReference = 64;
|
|
3507
|
+
var prefix = "domino:quest:";
|
|
3508
|
+
var referenceSchema = /* @__PURE__ */ (() => z26.string().min(1).max(maxSolanaActionReference).regex(/^[a-zA-Z0-9_-]+$/, "use letters, digits, _ or -"))();
|
|
3509
|
+
function solanaActionMemo(input) {
|
|
3510
|
+
const quest = identifier.parse(input.quest);
|
|
3511
|
+
return input.reference === void 0 ? prefix + quest : `${prefix}${quest}:${referenceSchema.parse(input.reference)}`;
|
|
3512
|
+
}
|
|
3513
|
+
function parseSolanaActionMemo(text) {
|
|
3514
|
+
if (!text.startsWith(prefix)) {
|
|
3515
|
+
return null;
|
|
3516
|
+
}
|
|
3517
|
+
const [quest, reference, ...rest] = text.slice(prefix.length).split(":");
|
|
3518
|
+
if (rest.length || !identifier.safeParse(quest).success || reference !== void 0 && !referenceSchema.safeParse(reference).success) {
|
|
3519
|
+
return null;
|
|
3520
|
+
}
|
|
3521
|
+
return { quest, reference: reference ?? null };
|
|
3522
|
+
}
|
|
3523
|
+
function takesSolanaTransaction(trigger) {
|
|
3524
|
+
return trigger.kind === "manual" && trigger.actor !== "staff" && trigger.input === "none";
|
|
3525
|
+
}
|
|
3526
|
+
var questStationSchema = /* @__PURE__ */ (() => z26.object({
|
|
3527
|
+
key: referenceSchema,
|
|
3528
|
+
label: z26.string().trim().min(1).max(120),
|
|
3529
|
+
opensAt: timestamp4.optional(),
|
|
3530
|
+
closesAt: timestamp4.optional()
|
|
3531
|
+
}).strict().refine(
|
|
3532
|
+
(station) => endsAfterStart({ from: station.opensAt, until: station.closesAt }),
|
|
3533
|
+
{ message: "A station must close after it opens", path: ["closesAt"] }
|
|
3534
|
+
))();
|
|
3535
|
+
var questStationsSchema = /* @__PURE__ */ (() => z26.array(questStationSchema).min(1).max(200).refine(
|
|
3536
|
+
(stations) => new Set(stations.map((station) => station.key)).size === stations.length,
|
|
3537
|
+
"Give each station its own key"
|
|
3538
|
+
))();
|
|
3539
|
+
function stationRefusal(stations, reference, blockTime) {
|
|
3540
|
+
const station = stations.find((station2) => station2.key === reference);
|
|
3541
|
+
if (!station) {
|
|
3542
|
+
return {
|
|
3543
|
+
code: "station-unknown",
|
|
3544
|
+
message: reference === null ? "This quest completes only from a transaction whose memo names one of its stations" : `The memo names station "${reference}", which this quest does not have`
|
|
3545
|
+
};
|
|
3546
|
+
}
|
|
3547
|
+
if (!inWindow({ from: station.opensAt, until: station.closesAt }, blockTime)) {
|
|
3548
|
+
return {
|
|
3549
|
+
code: "station-closed",
|
|
3550
|
+
message: `Station "${station.key}" was closed when the transaction landed`
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
return null;
|
|
3554
|
+
}
|
|
3555
|
+
var solanaSignatureSchema2 = /* @__PURE__ */ (() => z26.string().min(64).max(88).regex(/^[1-9A-HJ-NP-Za-km-z]+$/, "use a base58 transaction signature"))();
|
|
3556
|
+
var solanaTransactionSubmissionSchema = /* @__PURE__ */ (() => z26.object({
|
|
3557
|
+
quest: identifier,
|
|
3558
|
+
signature: solanaSignatureSchema2,
|
|
3559
|
+
chain: z26.enum(["solana", solanaMainnet, solanaDevnet]).default(solanaMainnet).transform(
|
|
3560
|
+
(chain) => chain === "solana" ? solanaMainnet : chain
|
|
3561
|
+
)
|
|
3562
|
+
}).strict())();
|
|
3563
|
+
var attemptActionSchema = /* @__PURE__ */ (() => z26.object({
|
|
3564
|
+
kind: z26.string(),
|
|
3565
|
+
chain: z26.string(),
|
|
3566
|
+
signature: z26.string(),
|
|
3567
|
+
wallet: z26.string(),
|
|
3568
|
+
reference: z26.string().nullable()
|
|
3569
|
+
}))();
|
|
3570
|
+
|
|
3571
|
+
// src/resources.ts
|
|
3572
|
+
import * as z27 from "zod";
|
|
3573
|
+
var resourceSourceSchema = /* @__PURE__ */ (() => z27.union([
|
|
3574
|
+
z27.strictObject({
|
|
3575
|
+
provider: z27.literal("domino"),
|
|
3576
|
+
resource: z27.literal("point-ledger")
|
|
3149
3577
|
}),
|
|
3150
3578
|
discordResourceSourceSchema
|
|
3151
3579
|
]))();
|
|
3152
|
-
var resourceRequestSchema = /* @__PURE__ */ (() =>
|
|
3580
|
+
var resourceRequestSchema = /* @__PURE__ */ (() => z27.object({
|
|
3153
3581
|
source: resourceSourceSchema,
|
|
3154
|
-
query:
|
|
3155
|
-
cursor:
|
|
3156
|
-
ids:
|
|
3582
|
+
query: z27.string().max(100).optional(),
|
|
3583
|
+
cursor: z27.string().regex(/^\d{1,6}$/).optional(),
|
|
3584
|
+
ids: z27.array(z27.string().min(1).max(100)).max(50).optional()
|
|
3157
3585
|
}).strict())();
|
|
3158
|
-
var resourceOptionsSchema = /* @__PURE__ */ (() =>
|
|
3159
|
-
revision:
|
|
3160
|
-
options:
|
|
3161
|
-
|
|
3162
|
-
id:
|
|
3163
|
-
label:
|
|
3164
|
-
description:
|
|
3165
|
-
group:
|
|
3166
|
-
disabledReason:
|
|
3586
|
+
var resourceOptionsSchema = /* @__PURE__ */ (() => z27.object({
|
|
3587
|
+
revision: z27.number().int(),
|
|
3588
|
+
options: z27.array(
|
|
3589
|
+
z27.object({
|
|
3590
|
+
id: z27.string(),
|
|
3591
|
+
label: z27.string(),
|
|
3592
|
+
description: z27.string().optional(),
|
|
3593
|
+
group: z27.string().optional(),
|
|
3594
|
+
disabledReason: z27.string().optional()
|
|
3167
3595
|
})
|
|
3168
3596
|
),
|
|
3169
3597
|
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
3170
|
-
nextCursor:
|
|
3598
|
+
nextCursor: z27.string().nullable().default(null),
|
|
3171
3599
|
/** @deprecated Use `nextCursor`. Removed in 2.0.0. */
|
|
3172
|
-
cursor:
|
|
3600
|
+
cursor: z27.string().nullable()
|
|
3173
3601
|
}))();
|
|
3174
3602
|
|
|
3175
3603
|
// src/settings.ts
|
|
3176
|
-
import * as
|
|
3604
|
+
import * as z29 from "zod";
|
|
3177
3605
|
|
|
3178
3606
|
// src/setting-values.ts
|
|
3179
|
-
import * as
|
|
3607
|
+
import * as z28 from "zod";
|
|
3180
3608
|
var settingInstant = /* @__PURE__ */ (() => offsetDateTimeSchema().transform(
|
|
3181
3609
|
(value) => new Date(value).toISOString()
|
|
3182
3610
|
))();
|
|
3183
|
-
var settingResourceId = /* @__PURE__ */ (() =>
|
|
3184
|
-
|
|
3185
|
-
|
|
3611
|
+
var settingResourceId = /* @__PURE__ */ (() => z28.union([
|
|
3612
|
+
z28.literal(""),
|
|
3613
|
+
z28.string().regex(/^\S{1,200}$/)
|
|
3186
3614
|
]))();
|
|
3187
3615
|
|
|
3188
3616
|
// src/settings.ts
|
|
3189
|
-
var base = /* @__PURE__ */ (() => ({ label:
|
|
3190
|
-
var settingFieldSchema = /* @__PURE__ */ (() =>
|
|
3191
|
-
|
|
3617
|
+
var base = /* @__PURE__ */ (() => ({ label: z29.string().min(1), description: z29.string().optional() }))();
|
|
3618
|
+
var settingFieldSchema = /* @__PURE__ */ (() => z29.discriminatedUnion("kind", [
|
|
3619
|
+
z29.object({
|
|
3192
3620
|
...base,
|
|
3193
|
-
kind:
|
|
3194
|
-
default: identifier.or(
|
|
3621
|
+
kind: z29.literal("point-ledger"),
|
|
3622
|
+
default: identifier.or(z29.literal(""))
|
|
3195
3623
|
}).strict(),
|
|
3196
|
-
|
|
3197
|
-
|
|
3624
|
+
z29.object({ ...base, kind: z29.literal("datetime"), default: settingInstant }).strict(),
|
|
3625
|
+
z29.object({
|
|
3198
3626
|
...base,
|
|
3199
|
-
kind:
|
|
3627
|
+
kind: z29.literal("resource"),
|
|
3200
3628
|
default: settingResourceId,
|
|
3201
3629
|
source: resourceSourceSchema
|
|
3202
3630
|
}).strict(),
|
|
3203
|
-
|
|
3204
|
-
|
|
3631
|
+
z29.object({ ...base, kind: z29.literal("quiz"), default: quizContentSchema }).strict(),
|
|
3632
|
+
z29.object({
|
|
3205
3633
|
...base,
|
|
3206
|
-
kind:
|
|
3207
|
-
default:
|
|
3208
|
-
minLength:
|
|
3209
|
-
maxLength:
|
|
3210
|
-
multiline:
|
|
3634
|
+
kind: z29.literal("text"),
|
|
3635
|
+
default: z29.string(),
|
|
3636
|
+
minLength: z29.number().int().nonnegative(),
|
|
3637
|
+
maxLength: z29.number().int().positive(),
|
|
3638
|
+
multiline: z29.boolean(),
|
|
3211
3639
|
/**
|
|
3212
3640
|
* A list Console offers the value from, beside free text: `telegram-chat` lists the
|
|
3213
3641
|
* project's connected Telegram chats. Unknown pickers read as free text. Six pickers also
|
|
3214
3642
|
* constrain the value, at publication and when an operator edits it: `amount`, a
|
|
3215
3643
|
* non-negative integer in a token's base units (`settings.amount()`), `chain`, a chain
|
|
3216
3644
|
* `ctx.wallet.balance()` reads (`settings.chain()`), `nft`, an NFT collection
|
|
3217
|
-
* `ctx.wallet.nfts()` reads (`settings.nft()`), whose contract or Solana collection
|
|
3645
|
+
* `ctx.wallet.nfts()` reads (`settings.nft()`), whose contract or Solana collection
|
|
3218
3646
|
* Relay also checks on its chain, `contract-call`, a contract function `ctx.wallet.call()`
|
|
3219
3647
|
* reads (`settings.contractCall()`), whose chain Relay also checks, and `contract-event`, a
|
|
3220
3648
|
* contract event `ctx.wallet.events()` reads (`settings.contractEvent()`), whose chain and
|
|
3221
3649
|
* contract Relay also checks, and `solana-program`, a Solana program
|
|
3222
|
-
* `ctx.wallet.transactions()`
|
|
3650
|
+
* `ctx.wallet.transactions()` or `ctx.wallet.programAccount()` reads
|
|
3651
|
+
* (`settings.solanaProgram()`), which Relay also checks is
|
|
3223
3652
|
* an executable program.
|
|
3224
3653
|
*/
|
|
3225
|
-
picker:
|
|
3654
|
+
picker: z29.string().optional(),
|
|
3226
3655
|
/**
|
|
3227
3656
|
* On an `amount` setting, the token's decimals: Console shows and edits the value in whole
|
|
3228
3657
|
* tokens.
|
|
3229
3658
|
*/
|
|
3230
|
-
decimals:
|
|
3659
|
+
decimals: z29.number().int().min(0).max(255).optional(),
|
|
3231
3660
|
/**
|
|
3232
3661
|
* A value operators set in Console that never leaves Relay: management responses, the CLI
|
|
3233
3662
|
* and Console withhold it, and the quest's code reads it as usual. Its `default` is `""`.
|
|
3234
3663
|
*/
|
|
3235
|
-
secret:
|
|
3664
|
+
secret: z29.literal(true).optional()
|
|
3236
3665
|
}).strict(),
|
|
3237
|
-
|
|
3666
|
+
z29.object({
|
|
3238
3667
|
...base,
|
|
3239
|
-
kind:
|
|
3240
|
-
default:
|
|
3241
|
-
min:
|
|
3242
|
-
max:
|
|
3668
|
+
kind: z29.literal("integer"),
|
|
3669
|
+
default: z29.number().int(),
|
|
3670
|
+
min: z29.number().int(),
|
|
3671
|
+
max: z29.number().int()
|
|
3243
3672
|
}).strict(),
|
|
3244
|
-
|
|
3245
|
-
|
|
3673
|
+
z29.object({ ...base, kind: z29.literal("boolean"), default: z29.boolean() }).strict(),
|
|
3674
|
+
z29.object({
|
|
3246
3675
|
...base,
|
|
3247
|
-
kind:
|
|
3248
|
-
default:
|
|
3249
|
-
options:
|
|
3676
|
+
kind: z29.literal("choice"),
|
|
3677
|
+
default: z29.string(),
|
|
3678
|
+
options: z29.array(z29.string().min(1)).min(1)
|
|
3250
3679
|
}).strict()
|
|
3251
3680
|
]))();
|
|
3252
|
-
var settingsFieldsSchema = /* @__PURE__ */ (() =>
|
|
3253
|
-
|
|
3681
|
+
var settingsFieldsSchema = /* @__PURE__ */ (() => z29.record(
|
|
3682
|
+
z29.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
3254
3683
|
settingFieldSchema
|
|
3255
3684
|
))();
|
|
3256
|
-
var settingsValuesSchema = /* @__PURE__ */ (() =>
|
|
3257
|
-
|
|
3258
|
-
|
|
3685
|
+
var settingsValuesSchema = /* @__PURE__ */ (() => z29.record(
|
|
3686
|
+
z29.string(),
|
|
3687
|
+
z29.union([z29.string(), z29.number().finite(), z29.boolean(), quizContentSchema])
|
|
3259
3688
|
))();
|
|
3260
3689
|
function isAmount(value) {
|
|
3261
3690
|
return value.length <= 100 && /^(0|[1-9][0-9]*)$/.test(value);
|
|
3262
3691
|
}
|
|
3263
3692
|
function isBalanceChain(value) {
|
|
3264
|
-
return value === "solana" || value
|
|
3693
|
+
return value === "solana" || isSolanaNetwork(value) || isEvmChainId(value);
|
|
3265
3694
|
}
|
|
3266
3695
|
function isBoundSetting(field) {
|
|
3267
3696
|
return field?.kind === "integer" || field?.kind === "text" && field.picker === "amount";
|
|
3268
3697
|
}
|
|
3269
3698
|
function textSettingSchema(field) {
|
|
3270
|
-
const text = field.secret ?
|
|
3699
|
+
const text = field.secret ? z29.string().max(field.maxLength).refine(
|
|
3271
3700
|
(value) => value === "" || value.length >= field.minLength,
|
|
3272
3701
|
`Use at least ${field.minLength} characters`
|
|
3273
|
-
) :
|
|
3702
|
+
) : z29.string().min(field.minLength).max(field.maxLength);
|
|
3274
3703
|
switch (field.picker) {
|
|
3275
3704
|
case "amount":
|
|
3276
3705
|
return text.refine(
|
|
@@ -3280,12 +3709,12 @@ function textSettingSchema(field) {
|
|
|
3280
3709
|
case "chain":
|
|
3281
3710
|
return text.refine(
|
|
3282
3711
|
isBalanceChain,
|
|
3283
|
-
'Use "solana" or an EVM chain ID such as "eip155:8453"'
|
|
3712
|
+
'Use "solana", a Solana cluster ID such as "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1" (devnet), or an EVM chain ID such as "eip155:8453"'
|
|
3284
3713
|
);
|
|
3285
3714
|
case "nft":
|
|
3286
3715
|
return text.refine(
|
|
3287
3716
|
isNftCollection,
|
|
3288
|
-
'Use an NFT collection such as "eip155:1/erc721:0x\u2026", "eip155:8453/erc1155:0x\u2026/1" for one ERC-1155 token ID, or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/nft:<collection
|
|
3717
|
+
'Use an NFT collection such as "eip155:1/erc721:0x\u2026", "eip155:8453/erc1155:0x\u2026/1" for one ERC-1155 token ID, or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/nft:<collection>" (mainnet; devnet is "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/nft:<collection>")'
|
|
3289
3718
|
);
|
|
3290
3719
|
case "contract-call":
|
|
3291
3720
|
return text.refine(
|
|
@@ -3326,17 +3755,17 @@ function parseSettings(fields2, input) {
|
|
|
3326
3755
|
shape[key] = textSettingSchema(field).default(field.default);
|
|
3327
3756
|
break;
|
|
3328
3757
|
case "integer":
|
|
3329
|
-
shape[key] =
|
|
3758
|
+
shape[key] = z29.number().int().min(field.min).max(field.max).default(field.default);
|
|
3330
3759
|
break;
|
|
3331
3760
|
case "boolean":
|
|
3332
|
-
shape[key] =
|
|
3761
|
+
shape[key] = z29.boolean().default(field.default);
|
|
3333
3762
|
break;
|
|
3334
3763
|
case "choice":
|
|
3335
|
-
shape[key] =
|
|
3764
|
+
shape[key] = z29.enum(field.options).default(field.default);
|
|
3336
3765
|
break;
|
|
3337
3766
|
}
|
|
3338
3767
|
}
|
|
3339
|
-
return settingsValuesSchema.parse(
|
|
3768
|
+
return settingsValuesSchema.parse(z29.object(shape).strict().parse(input));
|
|
3340
3769
|
}
|
|
3341
3770
|
function missingResourceSettings(fields2, values2) {
|
|
3342
3771
|
return Object.entries(fields2).filter(
|
|
@@ -3357,21 +3786,20 @@ function authoringKey(input) {
|
|
|
3357
3786
|
}
|
|
3358
3787
|
|
|
3359
3788
|
// src/campaigns.ts
|
|
3360
|
-
import * as
|
|
3361
|
-
var
|
|
3362
|
-
var availabilityWindowSchema = /* @__PURE__ */ (() => z28.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
|
|
3789
|
+
import * as z30 from "zod";
|
|
3790
|
+
var availabilityWindowSchema = /* @__PURE__ */ (() => z30.object({ from: timestamp4, until: timestamp4 }).strict().refine(endsAfterStart, {
|
|
3363
3791
|
message: "Window end must follow its start",
|
|
3364
3792
|
path: ["until"]
|
|
3365
3793
|
}))();
|
|
3366
|
-
var campaignDefinitionSchema = /* @__PURE__ */ (() =>
|
|
3794
|
+
var campaignDefinitionSchema = /* @__PURE__ */ (() => z30.object({
|
|
3367
3795
|
key: identifier,
|
|
3368
|
-
title:
|
|
3796
|
+
title: z30.string().trim().min(1).max(120),
|
|
3369
3797
|
window: availabilityWindowSchema.optional(),
|
|
3370
|
-
enrollment:
|
|
3798
|
+
enrollment: z30.enum(["none", "required"]).default("none")
|
|
3371
3799
|
}).strict())();
|
|
3372
3800
|
var campaignAuthoringSchema = /* @__PURE__ */ (() => campaignDefinitionSchema.omit({ key: true, title: true }).extend({
|
|
3373
3801
|
...authoringIdentityShape,
|
|
3374
|
-
title:
|
|
3802
|
+
title: z30.string().trim().min(1).max(120).optional()
|
|
3375
3803
|
}).strict().transform((value) => {
|
|
3376
3804
|
const normalized = value;
|
|
3377
3805
|
return campaignDefinitionSchema.parse({
|
|
@@ -3385,42 +3813,42 @@ function defineCampaign(input) {
|
|
|
3385
3813
|
var campaignViewSchema = /* @__PURE__ */ (() => campaignDefinitionSchema.extend({
|
|
3386
3814
|
enrolledAt: timestamp4.nullable(),
|
|
3387
3815
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
3388
|
-
withdrawalReason:
|
|
3816
|
+
withdrawalReason: z30.string().nullable().default(null)
|
|
3389
3817
|
}))();
|
|
3390
|
-
var campaignEnrollmentInputSchema = /* @__PURE__ */ (() =>
|
|
3818
|
+
var campaignEnrollmentInputSchema = /* @__PURE__ */ (() => z30.object({ actionId: identifier, campaign: identifier }).strict())();
|
|
3391
3819
|
var memberCampaignEnrollmentInputSchema = /* @__PURE__ */ (() => campaignEnrollmentInputSchema.extend({ member: identifier }))();
|
|
3392
3820
|
var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
|
|
3393
3821
|
var memberCampaignWithdrawalInputSchema = /* @__PURE__ */ (() => campaignWithdrawalInputSchema.extend({
|
|
3394
3822
|
member: identifier,
|
|
3395
|
-
reason:
|
|
3823
|
+
reason: z30.string().trim().min(1).max(500)
|
|
3396
3824
|
}))();
|
|
3397
|
-
var campaignEnrollmentSchema = /* @__PURE__ */ (() =>
|
|
3825
|
+
var campaignEnrollmentSchema = /* @__PURE__ */ (() => z30.object({
|
|
3398
3826
|
campaign: identifier,
|
|
3399
3827
|
member: identifier,
|
|
3400
3828
|
enrolledAt: timestamp4,
|
|
3401
3829
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
3402
|
-
withdrawalReason:
|
|
3830
|
+
withdrawalReason: z30.string().nullable().default(null)
|
|
3403
3831
|
}))();
|
|
3404
3832
|
|
|
3405
3833
|
// src/resource-handle.ts
|
|
3406
|
-
import * as
|
|
3834
|
+
import * as z31 from "zod";
|
|
3407
3835
|
function resourceHandle(_kind, definition) {
|
|
3408
3836
|
return definition;
|
|
3409
3837
|
}
|
|
3410
|
-
var ledgerSettingSchema = /* @__PURE__ */ (() => identifier.or(
|
|
3838
|
+
var ledgerSettingSchema = /* @__PURE__ */ (() => identifier.or(z31.literal("")).brand())();
|
|
3411
3839
|
function ledgerKey(ledger) {
|
|
3412
3840
|
return typeof ledger === "string" ? ledger : ledger.key;
|
|
3413
3841
|
}
|
|
3414
3842
|
|
|
3415
3843
|
// src/groups.ts
|
|
3416
|
-
import * as
|
|
3417
|
-
var projectGroupSchema = /* @__PURE__ */ (() =>
|
|
3844
|
+
import * as z32 from "zod";
|
|
3845
|
+
var projectGroupSchema = /* @__PURE__ */ (() => z32.object({
|
|
3418
3846
|
key: identifier,
|
|
3419
|
-
title:
|
|
3847
|
+
title: z32.string().trim().min(1).max(120)
|
|
3420
3848
|
}).strict())();
|
|
3421
3849
|
var projectGroupAuthoringSchema = /* @__PURE__ */ (() => projectGroupSchema.omit({ key: true, title: true }).extend({
|
|
3422
3850
|
...authoringIdentityShape,
|
|
3423
|
-
title:
|
|
3851
|
+
title: z32.string().trim().min(1).max(120).optional()
|
|
3424
3852
|
}).strict().transform((value) => {
|
|
3425
3853
|
return projectGroupSchema.parse({
|
|
3426
3854
|
...value,
|
|
@@ -3433,93 +3861,93 @@ function defineGroup(input) {
|
|
|
3433
3861
|
function projectGroupKey(group) {
|
|
3434
3862
|
return identifier.parse(group.key);
|
|
3435
3863
|
}
|
|
3436
|
-
var groupTitle = /* @__PURE__ */ (() =>
|
|
3437
|
-
var reason = /* @__PURE__ */ (() =>
|
|
3438
|
-
var timestamp5 = /* @__PURE__ */ (() =>
|
|
3439
|
-
var createGroupSchema = /* @__PURE__ */ (() =>
|
|
3440
|
-
var updateGroupSchema = /* @__PURE__ */ (() =>
|
|
3441
|
-
var addGroupMemberSchema = /* @__PURE__ */ (() =>
|
|
3442
|
-
var removeGroupMemberSchema = /* @__PURE__ */ (() =>
|
|
3443
|
-
var groupArchiveInputSchema = /* @__PURE__ */ (() =>
|
|
3444
|
-
var groupPageQuerySchema = /* @__PURE__ */ (() =>
|
|
3864
|
+
var groupTitle = /* @__PURE__ */ (() => z32.string().trim().min(1).max(120))();
|
|
3865
|
+
var reason = /* @__PURE__ */ (() => z32.string().trim().min(1).max(1e3))();
|
|
3866
|
+
var timestamp5 = /* @__PURE__ */ (() => z32.number().int().nonnegative().max(864e13))();
|
|
3867
|
+
var createGroupSchema = /* @__PURE__ */ (() => z32.object({ actionId: identifier, key: identifier, title: groupTitle }).strict())();
|
|
3868
|
+
var updateGroupSchema = /* @__PURE__ */ (() => z32.object({ title: groupTitle }).strict())();
|
|
3869
|
+
var addGroupMemberSchema = /* @__PURE__ */ (() => z32.object({ actionId: identifier, member: identifier, reason }).strict())();
|
|
3870
|
+
var removeGroupMemberSchema = /* @__PURE__ */ (() => z32.object({ actionId: identifier, reason }).strict())();
|
|
3871
|
+
var groupArchiveInputSchema = /* @__PURE__ */ (() => z32.object({ reason: lifecycleReasonSchema.optional() }).strict())();
|
|
3872
|
+
var groupPageQuerySchema = /* @__PURE__ */ (() => z32.strictObject({
|
|
3445
3873
|
cursor: pageCursorSchema.optional(),
|
|
3446
3874
|
/** Items per page, 1–100; the default is 50. */
|
|
3447
|
-
limit:
|
|
3875
|
+
limit: z32.number().int().min(1).max(100).optional()
|
|
3448
3876
|
}))();
|
|
3449
|
-
var managedGroupSchema = /* @__PURE__ */ (() =>
|
|
3877
|
+
var managedGroupSchema = /* @__PURE__ */ (() => z32.object({
|
|
3450
3878
|
key: identifier,
|
|
3451
|
-
title:
|
|
3452
|
-
members:
|
|
3879
|
+
title: z32.string(),
|
|
3880
|
+
members: z32.number().int().nonnegative(),
|
|
3453
3881
|
createdAt: timestamp5,
|
|
3454
3882
|
archivedAt: timestamp5.nullable()
|
|
3455
3883
|
}))();
|
|
3456
|
-
var groupPageSchema = /* @__PURE__ */ (() =>
|
|
3457
|
-
items:
|
|
3884
|
+
var groupPageSchema = /* @__PURE__ */ (() => z32.object({
|
|
3885
|
+
items: z32.array(managedGroupSchema),
|
|
3458
3886
|
nextCursor: pageCursorSchema.nullable()
|
|
3459
3887
|
}))();
|
|
3460
|
-
var groupMemberSchema = /* @__PURE__ */ (() =>
|
|
3888
|
+
var groupMemberSchema = /* @__PURE__ */ (() => z32.object({
|
|
3461
3889
|
member: identifier,
|
|
3462
3890
|
addedAt: timestamp5.nullable()
|
|
3463
3891
|
}))();
|
|
3464
|
-
var groupMemberPageSchema = /* @__PURE__ */ (() =>
|
|
3465
|
-
items:
|
|
3892
|
+
var groupMemberPageSchema = /* @__PURE__ */ (() => z32.object({
|
|
3893
|
+
items: z32.array(groupMemberSchema),
|
|
3466
3894
|
nextCursor: pageCursorSchema.nullable()
|
|
3467
3895
|
}))();
|
|
3468
3896
|
|
|
3469
3897
|
// src/prerequisites.ts
|
|
3470
|
-
import * as
|
|
3471
|
-
var amount = /* @__PURE__ */ (() =>
|
|
3898
|
+
import * as z33 from "zod";
|
|
3899
|
+
var amount = /* @__PURE__ */ (() => z33.number().int().safe().nonnegative())();
|
|
3472
3900
|
var threshold = /* @__PURE__ */ (() => amount.positive())();
|
|
3473
|
-
var completionPrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3474
|
-
|
|
3475
|
-
kind:
|
|
3901
|
+
var completionPrerequisiteSchema = /* @__PURE__ */ (() => z33.discriminatedUnion("scope", [
|
|
3902
|
+
z33.object({
|
|
3903
|
+
kind: z33.literal("completion"),
|
|
3476
3904
|
quest: identifier,
|
|
3477
|
-
scope:
|
|
3905
|
+
scope: z33.literal("ever")
|
|
3478
3906
|
}).strict(),
|
|
3479
|
-
|
|
3480
|
-
kind:
|
|
3907
|
+
z33.object({
|
|
3908
|
+
kind: z33.literal("completion"),
|
|
3481
3909
|
quest: identifier,
|
|
3482
|
-
scope:
|
|
3910
|
+
scope: z33.literal("period"),
|
|
3483
3911
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
3484
3912
|
}).strict()
|
|
3485
3913
|
]))();
|
|
3486
|
-
var balancePrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3487
|
-
kind:
|
|
3914
|
+
var balancePrerequisiteSchema = /* @__PURE__ */ (() => z33.object({
|
|
3915
|
+
kind: z33.literal("balance"),
|
|
3488
3916
|
balance: identifier,
|
|
3489
3917
|
minimum: threshold
|
|
3490
3918
|
}).strict())();
|
|
3491
|
-
var groupPrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3492
|
-
var prerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3919
|
+
var groupPrerequisiteSchema = /* @__PURE__ */ (() => z33.object({ kind: z33.literal("group"), group: identifier, title: z33.string() }).strict())();
|
|
3920
|
+
var prerequisiteSchema = /* @__PURE__ */ (() => z33.discriminatedUnion("kind", [
|
|
3493
3921
|
completionPrerequisiteSchema,
|
|
3494
3922
|
balancePrerequisiteSchema,
|
|
3495
3923
|
groupPrerequisiteSchema
|
|
3496
3924
|
]))();
|
|
3497
|
-
var missingPrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3498
|
-
|
|
3499
|
-
kind:
|
|
3925
|
+
var missingPrerequisiteSchema = /* @__PURE__ */ (() => z33.union([
|
|
3926
|
+
z33.object({
|
|
3927
|
+
kind: z33.literal("completion"),
|
|
3500
3928
|
quest: identifier,
|
|
3501
|
-
title:
|
|
3502
|
-
scope:
|
|
3929
|
+
title: z33.string(),
|
|
3930
|
+
scope: z33.literal("ever")
|
|
3503
3931
|
}),
|
|
3504
|
-
|
|
3505
|
-
kind:
|
|
3932
|
+
z33.object({
|
|
3933
|
+
kind: z33.literal("completion"),
|
|
3506
3934
|
quest: identifier,
|
|
3507
|
-
title:
|
|
3508
|
-
scope:
|
|
3935
|
+
title: z33.string(),
|
|
3936
|
+
scope: z33.literal("period"),
|
|
3509
3937
|
period: calendarPeriodSchema.exclude(["lifetime"]),
|
|
3510
|
-
resetsAt:
|
|
3938
|
+
resetsAt: z33.number().int().safe()
|
|
3511
3939
|
}),
|
|
3512
|
-
|
|
3513
|
-
kind:
|
|
3940
|
+
z33.object({
|
|
3941
|
+
kind: z33.literal("balance"),
|
|
3514
3942
|
balance: identifier,
|
|
3515
|
-
title:
|
|
3943
|
+
title: z33.string(),
|
|
3516
3944
|
minimum: threshold,
|
|
3517
3945
|
current: amount
|
|
3518
3946
|
}),
|
|
3519
|
-
|
|
3520
|
-
kind:
|
|
3947
|
+
z33.object({
|
|
3948
|
+
kind: z33.literal("group"),
|
|
3521
3949
|
group: identifier,
|
|
3522
|
-
title:
|
|
3950
|
+
title: z33.string()
|
|
3523
3951
|
})
|
|
3524
3952
|
]))();
|
|
3525
3953
|
function completed(quest, options = {}) {
|
|
@@ -3550,29 +3978,29 @@ function inGroup(group) {
|
|
|
3550
3978
|
var maxPointsAmount = 2147483647;
|
|
3551
3979
|
|
|
3552
3980
|
// src/schema.ts
|
|
3553
|
-
import * as
|
|
3554
|
-
var pointsRewardSchema = /* @__PURE__ */ (() =>
|
|
3555
|
-
kind:
|
|
3981
|
+
import * as z34 from "zod";
|
|
3982
|
+
var pointsRewardSchema = /* @__PURE__ */ (() => z34.object({
|
|
3983
|
+
kind: z34.literal("points").default("points"),
|
|
3556
3984
|
balance: identifier,
|
|
3557
|
-
amount:
|
|
3985
|
+
amount: z34.number().int().min(0).max(maxPointsAmount)
|
|
3558
3986
|
}).strict())();
|
|
3559
|
-
var tieredRewardDefinitionSchema = /* @__PURE__ */ (() =>
|
|
3987
|
+
var tieredRewardDefinitionSchema = /* @__PURE__ */ (() => z34.object({
|
|
3560
3988
|
/** An automatic achievement backed by the project badge catalog. */
|
|
3561
3989
|
badge: identifier.optional(),
|
|
3562
3990
|
/** Membership in the project group with this key, added when the reward is delivered. */
|
|
3563
3991
|
group: identifier.optional(),
|
|
3564
3992
|
id: identifier,
|
|
3565
|
-
title:
|
|
3566
|
-
tiers:
|
|
3567
|
-
|
|
3993
|
+
title: z34.string().min(1).max(120),
|
|
3994
|
+
tiers: z34.array(
|
|
3995
|
+
z34.object({ id: identifier, title: z34.string().min(1).max(120) }).strict()
|
|
3568
3996
|
).min(1).max(20).refine(
|
|
3569
3997
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
3570
3998
|
"Tier IDs must be unique"
|
|
3571
3999
|
),
|
|
3572
|
-
inventory:
|
|
3573
|
-
fulfillment:
|
|
3574
|
-
|
|
3575
|
-
|
|
4000
|
+
inventory: z34.object({ kind: z34.literal("untracked") }).strict(),
|
|
4001
|
+
fulfillment: z34.discriminatedUnion("kind", [
|
|
4002
|
+
z34.object({ kind: z34.literal("staff-handover") }).strict(),
|
|
4003
|
+
z34.object({ kind: z34.literal("automatic") }).strict()
|
|
3576
4004
|
])
|
|
3577
4005
|
}).strict().refine(
|
|
3578
4006
|
(value) => value.badge === void 0 && value.group === void 0 || value.fulfillment.kind === "automatic" && value.tiers.length === 1 && value.tiers[0].id === "awarded",
|
|
@@ -3581,12 +4009,12 @@ var tieredRewardDefinitionSchema = /* @__PURE__ */ (() => z32.object({
|
|
|
3581
4009
|
(value) => value.badge === void 0 || value.group === void 0,
|
|
3582
4010
|
"A reward is either a badge or a group membership"
|
|
3583
4011
|
))();
|
|
3584
|
-
var tieredRewardReferenceSchema = /* @__PURE__ */ (() =>
|
|
4012
|
+
var tieredRewardReferenceSchema = /* @__PURE__ */ (() => z34.object({
|
|
3585
4013
|
id: identifier,
|
|
3586
4014
|
key: identifier.nullable()
|
|
3587
4015
|
}))();
|
|
3588
|
-
var tierRewardSchema = /* @__PURE__ */ (() =>
|
|
3589
|
-
kind:
|
|
4016
|
+
var tierRewardSchema = /* @__PURE__ */ (() => z34.object({
|
|
4017
|
+
kind: z34.literal("tier"),
|
|
3590
4018
|
reward: tieredRewardDefinitionSchema,
|
|
3591
4019
|
tier: identifier
|
|
3592
4020
|
}).strict().refine(
|
|
@@ -3598,7 +4026,7 @@ var badgeRewardSchema = /* @__PURE__ */ (() => tierRewardSchema.transform(
|
|
|
3598
4026
|
const badge = value.reward.badge;
|
|
3599
4027
|
if (!badge || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
3600
4028
|
context.addIssue({ code: "custom", message: "Invalid badge reward" });
|
|
3601
|
-
return
|
|
4029
|
+
return z34.NEVER;
|
|
3602
4030
|
}
|
|
3603
4031
|
return { ...value, reward: { ...value.reward, badge } };
|
|
3604
4032
|
}
|
|
@@ -3622,7 +4050,7 @@ var groupRewardSchema = /* @__PURE__ */ (() => tierRewardSchema.transform(
|
|
|
3622
4050
|
const group = value.reward.group;
|
|
3623
4051
|
if (!group || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
3624
4052
|
context.addIssue({ code: "custom", message: "Invalid group reward" });
|
|
3625
|
-
return
|
|
4053
|
+
return z34.NEVER;
|
|
3626
4054
|
}
|
|
3627
4055
|
return { ...value, reward: { ...value.reward, group } };
|
|
3628
4056
|
}
|
|
@@ -3642,15 +4070,15 @@ function groupReward(key, title) {
|
|
|
3642
4070
|
});
|
|
3643
4071
|
}
|
|
3644
4072
|
var integrationRewardSchema = discordRewardSchema;
|
|
3645
|
-
var rewardSchema = /* @__PURE__ */ (() =>
|
|
4073
|
+
var rewardSchema = /* @__PURE__ */ (() => z34.union([
|
|
3646
4074
|
pointsRewardSchema,
|
|
3647
4075
|
tierRewardSchema,
|
|
3648
4076
|
integrationRewardSchema
|
|
3649
4077
|
]))();
|
|
3650
|
-
var rewardTypeSchema = /* @__PURE__ */ (() =>
|
|
3651
|
-
var rewardEntrySchema = /* @__PURE__ */ (() =>
|
|
4078
|
+
var rewardTypeSchema = /* @__PURE__ */ (() => z34.string())();
|
|
4079
|
+
var rewardEntrySchema = /* @__PURE__ */ (() => z34.object({
|
|
3652
4080
|
type: rewardTypeSchema,
|
|
3653
|
-
data:
|
|
4081
|
+
data: z34.record(z34.string(), z34.json())
|
|
3654
4082
|
}))();
|
|
3655
4083
|
function rewardKey(reward) {
|
|
3656
4084
|
if (reward.kind === "tier" && reward.reward.badge) {
|
|
@@ -3664,39 +4092,39 @@ function rewardKey(reward) {
|
|
|
3664
4092
|
}
|
|
3665
4093
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
3666
4094
|
}
|
|
3667
|
-
var triggerSchema = /* @__PURE__ */ (() =>
|
|
3668
|
-
|
|
3669
|
-
kind:
|
|
3670
|
-
input:
|
|
4095
|
+
var triggerSchema = /* @__PURE__ */ (() => z34.union([
|
|
4096
|
+
z34.object({
|
|
4097
|
+
kind: z34.literal("manual"),
|
|
4098
|
+
input: z34.literal("text"),
|
|
3671
4099
|
constraints: textOptionsSchema,
|
|
3672
|
-
actor:
|
|
4100
|
+
actor: z34.enum(["member", "staff"]).optional()
|
|
3673
4101
|
}).strict(),
|
|
3674
|
-
|
|
3675
|
-
kind:
|
|
3676
|
-
input:
|
|
4102
|
+
z34.object({
|
|
4103
|
+
kind: z34.literal("manual"),
|
|
4104
|
+
input: z34.literal("url"),
|
|
3677
4105
|
constraints: urlOptionsSchema,
|
|
3678
|
-
actor:
|
|
4106
|
+
actor: z34.enum(["member", "staff"]).optional()
|
|
3679
4107
|
}).strict(),
|
|
3680
|
-
|
|
3681
|
-
kind:
|
|
3682
|
-
input:
|
|
3683
|
-
actor:
|
|
4108
|
+
z34.object({
|
|
4109
|
+
kind: z34.literal("manual"),
|
|
4110
|
+
input: z34.enum(["photo", "quiz", "none"]),
|
|
4111
|
+
actor: z34.enum(["member", "staff"]).optional()
|
|
3684
4112
|
}).strict(),
|
|
3685
|
-
|
|
3686
|
-
kind:
|
|
4113
|
+
z34.object({
|
|
4114
|
+
kind: z34.literal("automatic"),
|
|
3687
4115
|
tracker: trackerTriggerPolicySchema.optional()
|
|
3688
4116
|
}).strict()
|
|
3689
4117
|
]))();
|
|
3690
|
-
var triggerResponseSchema = /* @__PURE__ */ (() =>
|
|
4118
|
+
var triggerResponseSchema = /* @__PURE__ */ (() => z34.union(
|
|
3691
4119
|
triggerSchema.options.map((option) => option.strip())
|
|
3692
4120
|
))();
|
|
3693
|
-
var photoResultSchema = /* @__PURE__ */ (() =>
|
|
3694
|
-
kind:
|
|
3695
|
-
reason:
|
|
4121
|
+
var photoResultSchema = /* @__PURE__ */ (() => z34.object({
|
|
4122
|
+
kind: z34.enum(["pass", "fail", "unclear"]),
|
|
4123
|
+
reason: z34.string().min(1).max(2e3)
|
|
3696
4124
|
}).strict())();
|
|
3697
|
-
var textReviewInputSchema = /* @__PURE__ */ (() =>
|
|
3698
|
-
text:
|
|
3699
|
-
criteria:
|
|
4125
|
+
var textReviewInputSchema = /* @__PURE__ */ (() => z34.object({
|
|
4126
|
+
text: z34.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
4127
|
+
criteria: z34.string().trim().min(1).max(2e3)
|
|
3700
4128
|
}).strict())();
|
|
3701
4129
|
var textResultSchema = photoResultSchema;
|
|
3702
4130
|
var deferPolicy = {
|
|
@@ -3710,31 +4138,31 @@ var retryCooldownPolicy = {
|
|
|
3710
4138
|
minMs: 1e3,
|
|
3711
4139
|
maxMs: 6048e5
|
|
3712
4140
|
};
|
|
3713
|
-
var retryCooldownMsSchema = /* @__PURE__ */ (() =>
|
|
3714
|
-
var evaluatorProgressSchema = /* @__PURE__ */ (() =>
|
|
3715
|
-
current:
|
|
3716
|
-
target:
|
|
3717
|
-
reason:
|
|
4141
|
+
var retryCooldownMsSchema = /* @__PURE__ */ (() => z34.number().int().min(limits.retryCooldown.minMs).max(limits.retryCooldown.maxMs))();
|
|
4142
|
+
var evaluatorProgressSchema = /* @__PURE__ */ (() => z34.object({
|
|
4143
|
+
current: z34.number().finite().nonnegative(),
|
|
4144
|
+
target: z34.number().finite().positive(),
|
|
4145
|
+
reason: z34.string().min(1).max(2e3)
|
|
3718
4146
|
}).refine((value) => value.current <= value.target, {
|
|
3719
4147
|
message: "Progress current must not exceed target"
|
|
3720
4148
|
}))();
|
|
3721
|
-
var decisionSchema = /* @__PURE__ */ (() =>
|
|
3722
|
-
|
|
3723
|
-
kind:
|
|
3724
|
-
reason:
|
|
3725
|
-
retryAfterMs:
|
|
4149
|
+
var decisionSchema = /* @__PURE__ */ (() => z34.discriminatedUnion("kind", [
|
|
4150
|
+
z34.strictObject({
|
|
4151
|
+
kind: z34.literal("defer"),
|
|
4152
|
+
reason: z34.string().min(1).max(2e3),
|
|
4153
|
+
retryAfterMs: z34.number().int().min(limits.defer.minRetryAfterMs).max(limits.defer.maxRetryAfterMs).optional(),
|
|
3726
4154
|
/** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
|
|
3727
|
-
until:
|
|
4155
|
+
until: z34.number().int().safe().nonnegative().optional()
|
|
3728
4156
|
}),
|
|
3729
|
-
evaluatorProgressSchema.safeExtend({ kind:
|
|
3730
|
-
|
|
3731
|
-
kind:
|
|
3732
|
-
rewards:
|
|
4157
|
+
evaluatorProgressSchema.safeExtend({ kind: z34.literal("progress") }).strict(),
|
|
4158
|
+
z34.object({
|
|
4159
|
+
kind: z34.literal("accept"),
|
|
4160
|
+
rewards: z34.array(rewardSchema).max(10),
|
|
3733
4161
|
completionKey: completionKeySchema.optional()
|
|
3734
4162
|
}).strict(),
|
|
3735
|
-
|
|
3736
|
-
kind:
|
|
3737
|
-
reason:
|
|
4163
|
+
z34.object({
|
|
4164
|
+
kind: z34.literal("reject"),
|
|
4165
|
+
reason: z34.string().min(1).max(2e3),
|
|
3738
4166
|
/**
|
|
3739
4167
|
* A stable key for the rejection's cause, such as `wrong-answers`, stored as the attempt's
|
|
3740
4168
|
* `code`: lowercase letters, digits and hyphens, at most 64 characters, and none of the
|
|
@@ -3742,28 +4170,28 @@ var decisionSchema = /* @__PURE__ */ (() => z32.discriminatedUnion("kind", [
|
|
|
3742
4170
|
*/
|
|
3743
4171
|
code: rejectCodeSchema.optional(),
|
|
3744
4172
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
3745
|
-
requestedReview:
|
|
4173
|
+
requestedReview: z34.literal(true).optional()
|
|
3746
4174
|
}).strict(),
|
|
3747
|
-
|
|
3748
|
-
kind:
|
|
3749
|
-
reason:
|
|
3750
|
-
rewards:
|
|
4175
|
+
z34.object({
|
|
4176
|
+
kind: z34.literal("review"),
|
|
4177
|
+
reason: z34.string().min(1).max(2e3),
|
|
4178
|
+
rewards: z34.array(rewardSchema).max(10).optional(),
|
|
3751
4179
|
completionKey: completionKeySchema.optional()
|
|
3752
4180
|
}).strict()
|
|
3753
4181
|
]))();
|
|
3754
|
-
var reviewModeSchema = /* @__PURE__ */ (() =>
|
|
3755
|
-
var storedReviewModeSchema = /* @__PURE__ */ (() =>
|
|
4182
|
+
var reviewModeSchema = /* @__PURE__ */ (() => z34.enum(["workers-ai"]))();
|
|
4183
|
+
var storedReviewModeSchema = /* @__PURE__ */ (() => z34.enum([
|
|
3756
4184
|
"fixture-pass",
|
|
3757
4185
|
"fixture-fail",
|
|
3758
4186
|
"fixture-unclear",
|
|
3759
4187
|
"fixture-error",
|
|
3760
4188
|
"workers-ai"
|
|
3761
4189
|
]))();
|
|
3762
|
-
var rewardBundleSchema = /* @__PURE__ */ (() =>
|
|
4190
|
+
var rewardBundleSchema = /* @__PURE__ */ (() => z34.array(rewardSchema).max(10).refine(
|
|
3763
4191
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
3764
4192
|
"Use one entry per balance or shared reward"
|
|
3765
4193
|
))();
|
|
3766
|
-
var mediaUrlSchema = /* @__PURE__ */ (() =>
|
|
4194
|
+
var mediaUrlSchema = /* @__PURE__ */ (() => z34.string().max(2e3).refine((value) => {
|
|
3767
4195
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
3768
4196
|
return true;
|
|
3769
4197
|
}
|
|
@@ -3773,78 +4201,78 @@ var mediaUrlSchema = /* @__PURE__ */ (() => z32.string().max(2e3).refine((value)
|
|
|
3773
4201
|
return false;
|
|
3774
4202
|
}
|
|
3775
4203
|
}, "Use an HTTPS URL or a same-site path beginning with /"))();
|
|
3776
|
-
var questStepActionSchema = /* @__PURE__ */ (() =>
|
|
3777
|
-
|
|
3778
|
-
kind:
|
|
4204
|
+
var questStepActionSchema = /* @__PURE__ */ (() => z34.discriminatedUnion("kind", [
|
|
4205
|
+
z34.object({
|
|
4206
|
+
kind: z34.literal("link"),
|
|
3779
4207
|
url: mediaUrlSchema.refine(
|
|
3780
4208
|
(value) => value.startsWith("https://"),
|
|
3781
4209
|
"Use an HTTPS URL"
|
|
3782
4210
|
),
|
|
3783
|
-
label:
|
|
4211
|
+
label: z34.string().trim().min(1).max(120)
|
|
3784
4212
|
}).strict()
|
|
3785
4213
|
]))();
|
|
3786
|
-
var questStepSchema = /* @__PURE__ */ (() =>
|
|
3787
|
-
title:
|
|
3788
|
-
description:
|
|
4214
|
+
var questStepSchema = /* @__PURE__ */ (() => z34.object({
|
|
4215
|
+
title: z34.string().trim().min(1).max(120),
|
|
4216
|
+
description: z34.string().max(4e3).optional(),
|
|
3789
4217
|
action: questStepActionSchema.optional()
|
|
3790
4218
|
}).strict())();
|
|
3791
|
-
var questPresentationRequirementSchema = /* @__PURE__ */ (() =>
|
|
3792
|
-
|
|
3793
|
-
|
|
4219
|
+
var questPresentationRequirementSchema = /* @__PURE__ */ (() => z34.discriminatedUnion("kind", [
|
|
4220
|
+
z34.object({ kind: z34.literal("account"), provider: authProviderSchema }).strict(),
|
|
4221
|
+
z34.object({ kind: z34.literal("wallet"), chain: walletChainSchema.optional() }).strict()
|
|
3794
4222
|
]))();
|
|
3795
|
-
var questPresentationContentSchema = /* @__PURE__ */ (() =>
|
|
3796
|
-
steps:
|
|
4223
|
+
var questPresentationContentSchema = /* @__PURE__ */ (() => z34.object({
|
|
4224
|
+
steps: z34.array(questStepSchema).max(30).optional(),
|
|
3797
4225
|
image: mediaUrlSchema.optional(),
|
|
3798
|
-
imageAlt:
|
|
3799
|
-
requirements:
|
|
4226
|
+
imageAlt: z34.string().max(500).optional(),
|
|
4227
|
+
requirements: z34.array(questPresentationRequirementSchema).max(10).optional()
|
|
3800
4228
|
}).strict())();
|
|
3801
4229
|
var questPresentationSchema = /* @__PURE__ */ (() => questPresentationContentSchema.extend({
|
|
3802
4230
|
quiz: quizQuestionsSchema.optional(),
|
|
3803
|
-
instructions:
|
|
3804
|
-
video:
|
|
4231
|
+
instructions: z34.string().max(4e3).optional(),
|
|
4232
|
+
video: z34.object({
|
|
3805
4233
|
url: mediaUrlSchema,
|
|
3806
4234
|
poster: mediaUrlSchema.optional(),
|
|
3807
|
-
captions:
|
|
4235
|
+
captions: z34.object({
|
|
3808
4236
|
url: mediaUrlSchema,
|
|
3809
|
-
language:
|
|
3810
|
-
label:
|
|
4237
|
+
language: z34.string().min(2).max(20),
|
|
4238
|
+
label: z34.string().min(1).max(80)
|
|
3811
4239
|
}).strict().optional()
|
|
3812
4240
|
}).strict().optional()
|
|
3813
4241
|
}).strict())();
|
|
3814
|
-
var questProfileSchema = /* @__PURE__ */ (() =>
|
|
4242
|
+
var questProfileSchema = /* @__PURE__ */ (() => z34.object({ visible: z34.boolean() }).strict())();
|
|
3815
4243
|
var evaluatorProtocol = 2;
|
|
3816
|
-
var evaluatorProtocolSchema = /* @__PURE__ */ (() =>
|
|
3817
|
-
var questDescriptionSchema = /* @__PURE__ */ (() =>
|
|
4244
|
+
var evaluatorProtocolSchema = /* @__PURE__ */ (() => z34.literal(evaluatorProtocol))();
|
|
4245
|
+
var questDescriptionSchema = /* @__PURE__ */ (() => z34.object({
|
|
3818
4246
|
quest: identifier,
|
|
3819
4247
|
evaluatorProtocol: evaluatorProtocolSchema,
|
|
3820
|
-
title:
|
|
4248
|
+
title: z34.string().min(1).max(120),
|
|
3821
4249
|
presentation: questPresentationSchema.default({}),
|
|
3822
4250
|
/** The declared modules this SDK knows. `integrationModules` lists every declared module. */
|
|
3823
|
-
integrations:
|
|
4251
|
+
integrations: z34.array(evaluatorIntegrationProviderSchema).max(10).default([]),
|
|
3824
4252
|
/**
|
|
3825
4253
|
* Every integration module the quest declares, including providers this SDK does not know: the
|
|
3826
4254
|
* open sibling of `integrations`. A description omits it when every module is in
|
|
3827
4255
|
* `integrations`, as descriptions from older SDKs do; Relay's reads always include it.
|
|
3828
4256
|
*/
|
|
3829
|
-
integrationModules:
|
|
4257
|
+
integrationModules: z34.array(integrationModuleProviderSchema).max(10).optional(),
|
|
3830
4258
|
fields: settingsFieldsSchema,
|
|
3831
4259
|
values: settingsValuesSchema,
|
|
3832
4260
|
rewards: rewardBundleSchema,
|
|
3833
4261
|
/** Messages Relay posts in connected chats and channels when a completion pays. */
|
|
3834
|
-
announcements:
|
|
3835
|
-
humanReview:
|
|
4262
|
+
announcements: z34.array(announcementSchema).max(3).optional(),
|
|
4263
|
+
humanReview: z34.boolean(),
|
|
3836
4264
|
trigger: triggerSchema,
|
|
3837
4265
|
performance: contentPerformancePolicySchema.optional(),
|
|
3838
|
-
requires:
|
|
4266
|
+
requires: z34.array(prerequisiteSchema).max(30).default([]),
|
|
3839
4267
|
campaign: campaignDefinitionSchema.optional(),
|
|
3840
4268
|
availability: availabilityWindowSchema.optional(),
|
|
3841
|
-
completion:
|
|
3842
|
-
visibility:
|
|
4269
|
+
completion: z34.preprocess(refuseStreakTimeZone, completionPolicySchema),
|
|
4270
|
+
visibility: z34.enum(["visible", "hidden"]).default("visible"),
|
|
3843
4271
|
/** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
|
|
3844
4272
|
profile: questProfileSchema.default({ visible: false }),
|
|
3845
|
-
budgets:
|
|
4273
|
+
budgets: z34.array(budgetSchema).max(20).default([]),
|
|
3846
4274
|
/** Budgets counted per tracker record author; only on quests with a tracker trigger. */
|
|
3847
|
-
authorBudgets:
|
|
4275
|
+
authorBudgets: z34.array(authorBudgetSchema).max(20).optional(),
|
|
3848
4276
|
/**
|
|
3849
4277
|
* Milliseconds a member waits after an attempt is rejected (by the evaluator or a reviewer)
|
|
3850
4278
|
* before submitting this quest again. Only for quests members submit. Omitted: no cooldown.
|
|
@@ -3855,33 +4283,39 @@ var questDescriptionSchema = /* @__PURE__ */ (() => z32.object({
|
|
|
3855
4283
|
* submitting it again. Only for repeatable quests members submit; same bounds as
|
|
3856
4284
|
* `retryCooldownMs`. Omitted: no cooldown.
|
|
3857
4285
|
*/
|
|
3858
|
-
completionCooldownMs: retryCooldownMsSchema.optional()
|
|
4286
|
+
completionCooldownMs: retryCooldownMsSchema.optional(),
|
|
4287
|
+
/**
|
|
4288
|
+
* Check-in stations: a transaction completes the quest only when its memo's `reference` names
|
|
4289
|
+
* one, inside the station's window. Only on quests a signed Solana transaction completes.
|
|
4290
|
+
* Experimental.
|
|
4291
|
+
*/
|
|
4292
|
+
stations: questStationsSchema.optional()
|
|
3859
4293
|
}).strict())();
|
|
3860
|
-
var artifactSchema = /* @__PURE__ */ (() =>
|
|
4294
|
+
var artifactSchema = /* @__PURE__ */ (() => z34.object({ code: z34.string().min(1).max(1e6) }).strict())();
|
|
3861
4295
|
var releaseSchema = /* @__PURE__ */ (() => artifactSchema.extend({
|
|
3862
4296
|
/** The SDK runtime the code imports. Absent, the code bundles its own SDK. */
|
|
3863
4297
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
3864
4298
|
settings: settingsValuesSchema,
|
|
3865
4299
|
provider: reviewModeSchema,
|
|
3866
4300
|
expectedRelease: identifier.nullable().optional(),
|
|
3867
|
-
settingRenames:
|
|
4301
|
+
settingRenames: z34.record(z34.string(), z34.string()).optional()
|
|
3868
4302
|
}).strict())();
|
|
3869
|
-
var batchReleaseSchema = /* @__PURE__ */ (() =>
|
|
3870
|
-
releases:
|
|
4303
|
+
var batchReleaseSchema = /* @__PURE__ */ (() => z34.object({
|
|
4304
|
+
releases: z34.array(releaseSchema).min(1).max(limits.quests)
|
|
3871
4305
|
}).strict())();
|
|
3872
|
-
var questSettingsInputSchema = /* @__PURE__ */ (() =>
|
|
4306
|
+
var questSettingsInputSchema = /* @__PURE__ */ (() => z34.object({
|
|
3873
4307
|
quest: identifier,
|
|
3874
4308
|
expectedRelease: identifier,
|
|
3875
4309
|
set: settingsValuesSchema,
|
|
3876
|
-
reset:
|
|
4310
|
+
reset: z34.array(z34.string()),
|
|
3877
4311
|
/** Replace the editable presentation fields; null restores the code defaults. */
|
|
3878
4312
|
presentation: questPresentationContentSchema.nullable().optional(),
|
|
3879
4313
|
/**
|
|
3880
|
-
* Anchor
|
|
3881
|
-
* none on chain; null removes a pasted one.
|
|
3882
|
-
*
|
|
4314
|
+
* IDLs (Anchor, Codama or Shank) to paste, by `settings.solanaProgram()` setting key, for programs that publish
|
|
4315
|
+
* none on chain or to use another; null removes a pasted one. A pasted IDL takes precedence
|
|
4316
|
+
* over one the program publishes on chain.
|
|
3883
4317
|
*/
|
|
3884
|
-
solanaIdls:
|
|
4318
|
+
solanaIdls: z34.record(z34.string(), anchorIdlSchema.nullable()).optional()
|
|
3885
4319
|
}).strict())();
|
|
3886
4320
|
var storedQuestDescriptionSchema = /* @__PURE__ */ (() => questDescriptionSchema.extend({
|
|
3887
4321
|
completion: completionPolicySchema
|
|
@@ -3892,42 +4326,42 @@ var publishedReleaseSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
3892
4326
|
* Every reward of the quest, kinds this SDK does not know included: the open sibling of
|
|
3893
4327
|
* `rewards`, which keeps SDK 1.x's closed `Reward`. Absent from older Relay versions.
|
|
3894
4328
|
*/
|
|
3895
|
-
rewardEntries:
|
|
4329
|
+
rewardEntries: z34.array(rewardEntrySchema).optional(),
|
|
3896
4330
|
key: identifier.optional(),
|
|
3897
|
-
code:
|
|
4331
|
+
code: z34.string(),
|
|
3898
4332
|
/** The SDK runtime `code` imports. Absent, the code bundles its own SDK. */
|
|
3899
4333
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
3900
4334
|
provider: storedReviewModeSchema,
|
|
3901
4335
|
id: identifier,
|
|
3902
|
-
createdAt:
|
|
3903
|
-
origin:
|
|
3904
|
-
lifecycle:
|
|
3905
|
-
configuration:
|
|
4336
|
+
createdAt: z34.number(),
|
|
4337
|
+
origin: z34.object({ typeVersion: identifier }).strict().optional(),
|
|
4338
|
+
lifecycle: z34.enum(["active", "paused", "archived"]).default("active"),
|
|
4339
|
+
configuration: z34.object({
|
|
3906
4340
|
defaults: settingsValuesSchema,
|
|
3907
4341
|
overrides: settingsValuesSchema,
|
|
3908
|
-
preserved:
|
|
4342
|
+
preserved: z34.array(z34.string()),
|
|
3909
4343
|
presentation: questPresentationContentSchema.optional(),
|
|
3910
4344
|
presentationDefaults: questPresentationContentSchema.optional()
|
|
3911
4345
|
}).strict().optional(),
|
|
3912
4346
|
/**
|
|
3913
|
-
* The
|
|
4347
|
+
* The IDLs `ctx.wallet.transactions()` decodes instructions with, by
|
|
3914
4348
|
* `settings.solanaProgram()` setting key. Stored when the setting is saved; a setting without
|
|
3915
4349
|
* an IDL has no entry.
|
|
3916
4350
|
*/
|
|
3917
|
-
solanaIdls:
|
|
4351
|
+
solanaIdls: z34.record(z34.string(), solanaProgramIdlSchema).optional(),
|
|
3918
4352
|
/**
|
|
3919
4353
|
* The secret settings (`settings.text({ secret: true })`) that hold a value. Responses leave
|
|
3920
4354
|
* every secret setting out of `values` and `configuration`; one not listed here is empty.
|
|
3921
4355
|
* Absent when the release has no secret setting.
|
|
3922
4356
|
*/
|
|
3923
|
-
withheldSettings:
|
|
4357
|
+
withheldSettings: z34.array(z34.string()).optional()
|
|
3924
4358
|
})
|
|
3925
4359
|
))();
|
|
3926
|
-
var templateSchema = /* @__PURE__ */ (() =>
|
|
3927
|
-
code:
|
|
4360
|
+
var templateSchema = /* @__PURE__ */ (() => z34.object({
|
|
4361
|
+
code: z34.string(),
|
|
3928
4362
|
definition: questDescriptionSchema
|
|
3929
4363
|
}))();
|
|
3930
|
-
var quizAnswersSchema = /* @__PURE__ */ (() =>
|
|
4364
|
+
var quizAnswersSchema = /* @__PURE__ */ (() => z34.record(identifier, identifier).refine(
|
|
3931
4365
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
3932
4366
|
"Provide between 1 and 50 answers"
|
|
3933
4367
|
).transform(
|
|
@@ -3935,17 +4369,17 @@ var quizAnswersSchema = /* @__PURE__ */ (() => z32.record(identifier, identifier
|
|
|
3935
4369
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
3936
4370
|
)
|
|
3937
4371
|
))();
|
|
3938
|
-
var quizEvidenceSchema = /* @__PURE__ */ (() =>
|
|
3939
|
-
kind:
|
|
4372
|
+
var quizEvidenceSchema = /* @__PURE__ */ (() => z34.object({
|
|
4373
|
+
kind: z34.literal("quiz"),
|
|
3940
4374
|
release: identifier.optional(),
|
|
3941
4375
|
answers: quizAnswersSchema
|
|
3942
4376
|
}).strict())();
|
|
3943
|
-
var submissionEvidenceSchema = /* @__PURE__ */ (() =>
|
|
4377
|
+
var submissionEvidenceSchema = /* @__PURE__ */ (() => z34.union([
|
|
3944
4378
|
quizEvidenceSchema,
|
|
3945
4379
|
textEvidenceSchema,
|
|
3946
4380
|
urlEvidenceSchema
|
|
3947
4381
|
]))();
|
|
3948
|
-
var submitSchema = /* @__PURE__ */ (() =>
|
|
4382
|
+
var submitSchema = /* @__PURE__ */ (() => z34.object({
|
|
3949
4383
|
actionId: identifier,
|
|
3950
4384
|
quest: identifier,
|
|
3951
4385
|
member: identifier,
|
|
@@ -3953,7 +4387,7 @@ var submitSchema = /* @__PURE__ */ (() => z32.object({
|
|
|
3953
4387
|
input: submissionEvidenceSchema.optional(),
|
|
3954
4388
|
release: identifier.optional(),
|
|
3955
4389
|
/** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
|
|
3956
|
-
faultAfterReview:
|
|
4390
|
+
faultAfterReview: z34.boolean().optional()
|
|
3957
4391
|
}).strict())();
|
|
3958
4392
|
var AttemptStatus = {
|
|
3959
4393
|
Queued: "queued",
|
|
@@ -3965,13 +4399,13 @@ var AttemptStatus = {
|
|
|
3965
4399
|
NeedsReview: "needs-review",
|
|
3966
4400
|
Failed: "failed"
|
|
3967
4401
|
};
|
|
3968
|
-
var attemptStatusSchema = /* @__PURE__ */ (() =>
|
|
4402
|
+
var attemptStatusSchema = /* @__PURE__ */ (() => z34.string())();
|
|
3969
4403
|
var AttemptCodeSource = {
|
|
3970
4404
|
Relay: "relay",
|
|
3971
4405
|
Evaluator: "evaluator"
|
|
3972
4406
|
};
|
|
3973
|
-
var attemptCodeSourceSchema = /* @__PURE__ */ (() =>
|
|
3974
|
-
var attemptSchema = /* @__PURE__ */ (() =>
|
|
4407
|
+
var attemptCodeSourceSchema = /* @__PURE__ */ (() => z34.string())();
|
|
4408
|
+
var attemptSchema = /* @__PURE__ */ (() => z34.object({
|
|
3975
4409
|
id: identifier,
|
|
3976
4410
|
release: identifier,
|
|
3977
4411
|
quest: identifier,
|
|
@@ -3979,22 +4413,22 @@ var attemptSchema = /* @__PURE__ */ (() => z32.object({
|
|
|
3979
4413
|
evidence: identifier.nullable(),
|
|
3980
4414
|
input: submissionEvidenceSchema.optional(),
|
|
3981
4415
|
status: attemptStatusSchema,
|
|
3982
|
-
reason:
|
|
3983
|
-
retries:
|
|
3984
|
-
generation:
|
|
3985
|
-
completion:
|
|
4416
|
+
reason: z34.string().nullable(),
|
|
4417
|
+
retries: z34.number(),
|
|
4418
|
+
generation: z34.number(),
|
|
4419
|
+
completion: z34.string().nullable(),
|
|
3986
4420
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
3987
4421
|
/** Scheduled reruns advance this number; failure retries preserve it. */
|
|
3988
|
-
evaluationRun:
|
|
3989
|
-
deferCount:
|
|
3990
|
-
deferUntil:
|
|
3991
|
-
nextEvaluationAt:
|
|
4422
|
+
evaluationRun: z34.number().int().nonnegative().default(0),
|
|
4423
|
+
deferCount: z34.number().int().nonnegative().default(0),
|
|
4424
|
+
deferUntil: z34.number().int().safe().nullable().default(null),
|
|
4425
|
+
nextEvaluationAt: z34.number().int().safe().nullable().default(null),
|
|
3992
4426
|
/**
|
|
3993
4427
|
* Open code: consumers must tolerate new values. Relay writes its own codes, such as
|
|
3994
4428
|
* `budget-exhausted`; an attempt the evaluator rejected with `decision.reject({ reason, code })`
|
|
3995
4429
|
* carries the evaluator's code in management reads, and null in responses to members.
|
|
3996
4430
|
*/
|
|
3997
|
-
code:
|
|
4431
|
+
code: z34.string().nullable().default(null),
|
|
3998
4432
|
/**
|
|
3999
4433
|
* Who wrote `code`: `relay` or `evaluator` (an `AttemptCodeSource`), null when `code` is null.
|
|
4000
4434
|
* Open: consumers must tolerate new values. An evaluator can reject with a code Relay also writes,
|
|
@@ -4007,8 +4441,15 @@ var attemptSchema = /* @__PURE__ */ (() => z32.object({
|
|
|
4007
4441
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
4008
4442
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
4009
4443
|
*/
|
|
4010
|
-
requestedReview:
|
|
4011
|
-
createdAt:
|
|
4444
|
+
requestedReview: z34.boolean().default(false),
|
|
4445
|
+
createdAt: z34.number(),
|
|
4446
|
+
/**
|
|
4447
|
+
* The action that started the attempt: the signed Solana transaction an app's server submitted
|
|
4448
|
+
* with `management.attempts.submitSolanaTransaction()`. Absent for any other attempt.
|
|
4449
|
+
*
|
|
4450
|
+
* @experimental A minor release can change quest actions.
|
|
4451
|
+
*/
|
|
4452
|
+
action: attemptActionSchema.nullable().optional()
|
|
4012
4453
|
}))();
|
|
4013
4454
|
var QuestSubmissionStatus = {
|
|
4014
4455
|
Open: "open",
|
|
@@ -4016,9 +4457,9 @@ var QuestSubmissionStatus = {
|
|
|
4016
4457
|
Discarded: "discarded",
|
|
4017
4458
|
Expired: "expired"
|
|
4018
4459
|
};
|
|
4019
|
-
var questSubmissionStatusSchema = /* @__PURE__ */ (() =>
|
|
4460
|
+
var questSubmissionStatusSchema = /* @__PURE__ */ (() => z34.string())();
|
|
4020
4461
|
var questSubmissionSchema = /* @__PURE__ */ (() => responseShape(
|
|
4021
|
-
|
|
4462
|
+
z34.object({
|
|
4022
4463
|
id: identifier,
|
|
4023
4464
|
quest: identifier,
|
|
4024
4465
|
member: identifier,
|
|
@@ -4028,85 +4469,85 @@ var questSubmissionSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
4028
4469
|
/** An uploaded photo's evidence ID. */
|
|
4029
4470
|
evidence: identifier.nullable(),
|
|
4030
4471
|
/** Submitting was refused because the quest changed: review the draft before submitting again. */
|
|
4031
|
-
reviewRequired:
|
|
4472
|
+
reviewRequired: z34.boolean(),
|
|
4032
4473
|
status: questSubmissionStatusSchema,
|
|
4033
4474
|
/** The attempt a `submitted` submission admitted. */
|
|
4034
4475
|
attempt: identifier.nullable(),
|
|
4035
|
-
createdAt:
|
|
4036
|
-
updatedAt:
|
|
4476
|
+
createdAt: z34.number(),
|
|
4477
|
+
updatedAt: z34.number(),
|
|
4037
4478
|
/** When an open submission expires unless it changes again. */
|
|
4038
|
-
expiresAt:
|
|
4479
|
+
expiresAt: z34.number()
|
|
4039
4480
|
})
|
|
4040
4481
|
))();
|
|
4041
|
-
var questSubmissionUpdateSchema = /* @__PURE__ */ (() =>
|
|
4482
|
+
var questSubmissionUpdateSchema = /* @__PURE__ */ (() => z34.object({
|
|
4042
4483
|
release: identifier.nullable().optional(),
|
|
4043
4484
|
input: submissionEvidenceSchema.nullable().optional(),
|
|
4044
4485
|
evidence: identifier.nullable().optional()
|
|
4045
4486
|
}).strict())();
|
|
4046
4487
|
var questSubmissionResultSchema = /* @__PURE__ */ (() => responseShape(
|
|
4047
|
-
|
|
4488
|
+
z34.object({
|
|
4048
4489
|
submission: questSubmissionSchema,
|
|
4049
4490
|
attempt: attemptSchema,
|
|
4050
|
-
replayed:
|
|
4491
|
+
replayed: z34.boolean()
|
|
4051
4492
|
})
|
|
4052
4493
|
))();
|
|
4053
|
-
var eventSchema = /* @__PURE__ */ (() =>
|
|
4054
|
-
id:
|
|
4055
|
-
attempt:
|
|
4056
|
-
kind:
|
|
4057
|
-
detail:
|
|
4058
|
-
actor:
|
|
4059
|
-
at:
|
|
4060
|
-
}))();
|
|
4061
|
-
var pickupSelectionSchema = /* @__PURE__ */ (() =>
|
|
4494
|
+
var eventSchema = /* @__PURE__ */ (() => z34.object({
|
|
4495
|
+
id: z34.number(),
|
|
4496
|
+
attempt: z34.string().nullable(),
|
|
4497
|
+
kind: z34.string(),
|
|
4498
|
+
detail: z34.string(),
|
|
4499
|
+
actor: z34.string().nullable().default(null),
|
|
4500
|
+
at: z34.number()
|
|
4501
|
+
}))();
|
|
4502
|
+
var pickupSelectionSchema = /* @__PURE__ */ (() => z34.object({
|
|
4062
4503
|
item: identifier,
|
|
4063
|
-
revision:
|
|
4504
|
+
revision: z34.number().int().nonnegative()
|
|
4064
4505
|
}).strict())();
|
|
4065
|
-
var pickupAllocationSchema = /* @__PURE__ */ (() =>
|
|
4506
|
+
var pickupAllocationSchema = /* @__PURE__ */ (() => z34.object({
|
|
4066
4507
|
item: identifier,
|
|
4067
|
-
label:
|
|
4508
|
+
label: z34.string().min(1).max(80)
|
|
4068
4509
|
}).strict())();
|
|
4069
|
-
var pickupPolicySchema = /* @__PURE__ */ (() =>
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
kind:
|
|
4073
|
-
tiers:
|
|
4074
|
-
|
|
4510
|
+
var pickupPolicySchema = /* @__PURE__ */ (() => z34.discriminatedUnion("kind", [
|
|
4511
|
+
z34.object({ kind: z34.literal("untracked") }).strict(),
|
|
4512
|
+
z34.object({
|
|
4513
|
+
kind: z34.literal("at-pickup"),
|
|
4514
|
+
tiers: z34.array(
|
|
4515
|
+
z34.object({
|
|
4075
4516
|
tier: identifier,
|
|
4076
|
-
variants:
|
|
4517
|
+
variants: z34.array(pickupAllocationSchema).min(1).max(100)
|
|
4077
4518
|
}).strict()
|
|
4078
4519
|
).min(1).max(100)
|
|
4079
4520
|
}).strict()
|
|
4080
4521
|
]))();
|
|
4081
|
-
var pickupCatalogSchema = /* @__PURE__ */ (() =>
|
|
4522
|
+
var pickupCatalogSchema = /* @__PURE__ */ (() => z34.object({
|
|
4082
4523
|
reward: tieredRewardDefinitionSchema,
|
|
4083
|
-
revision:
|
|
4524
|
+
revision: z34.number().int().nonnegative(),
|
|
4084
4525
|
policy: pickupPolicySchema
|
|
4085
4526
|
}))();
|
|
4086
|
-
var pickupAvailabilitySchema = /* @__PURE__ */ (() =>
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
kind:
|
|
4090
|
-
revision:
|
|
4091
|
-
variants:
|
|
4527
|
+
var pickupAvailabilitySchema = /* @__PURE__ */ (() => z34.discriminatedUnion("kind", [
|
|
4528
|
+
z34.object({ kind: z34.literal("untracked") }).strict(),
|
|
4529
|
+
z34.object({
|
|
4530
|
+
kind: z34.literal("at-pickup"),
|
|
4531
|
+
revision: z34.number().int().nonnegative(),
|
|
4532
|
+
variants: z34.array(
|
|
4092
4533
|
pickupAllocationSchema.extend({
|
|
4093
|
-
available:
|
|
4534
|
+
available: z34.number().int().nonnegative()
|
|
4094
4535
|
})
|
|
4095
4536
|
)
|
|
4096
4537
|
}).strict()
|
|
4097
4538
|
]))();
|
|
4098
|
-
var configurePickupSchema = /* @__PURE__ */ (() =>
|
|
4539
|
+
var configurePickupSchema = /* @__PURE__ */ (() => z34.object({
|
|
4099
4540
|
reward: identifier,
|
|
4100
|
-
revision:
|
|
4541
|
+
revision: z34.number().int().nonnegative(),
|
|
4101
4542
|
actionId: identifier,
|
|
4102
|
-
policy:
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
kind:
|
|
4106
|
-
tiers:
|
|
4107
|
-
|
|
4543
|
+
policy: z34.discriminatedUnion("kind", [
|
|
4544
|
+
z34.object({ kind: z34.literal("untracked") }).strict(),
|
|
4545
|
+
z34.object({
|
|
4546
|
+
kind: z34.literal("at-pickup"),
|
|
4547
|
+
tiers: z34.array(
|
|
4548
|
+
z34.object({
|
|
4108
4549
|
tier: identifier,
|
|
4109
|
-
variants:
|
|
4550
|
+
variants: z34.array(
|
|
4110
4551
|
pickupAllocationSchema.extend({
|
|
4111
4552
|
item: identifier.optional()
|
|
4112
4553
|
})
|
|
@@ -4116,10 +4557,10 @@ var configurePickupSchema = /* @__PURE__ */ (() => z32.object({
|
|
|
4116
4557
|
}).strict()
|
|
4117
4558
|
])
|
|
4118
4559
|
}).strict())();
|
|
4119
|
-
var entitlementRecoverySchema = /* @__PURE__ */ (() =>
|
|
4560
|
+
var entitlementRecoverySchema = /* @__PURE__ */ (() => z34.object({
|
|
4120
4561
|
completion: identifier,
|
|
4121
|
-
reason:
|
|
4122
|
-
flaggedAt:
|
|
4562
|
+
reason: z34.string(),
|
|
4563
|
+
flaggedAt: z34.number(),
|
|
4123
4564
|
/** Null means no accepted completion currently earns this reward. */
|
|
4124
4565
|
remainingTier: identifier.nullable()
|
|
4125
4566
|
}))();
|
|
@@ -4129,40 +4570,40 @@ var entitlementBase = /* @__PURE__ */ (() => ({
|
|
|
4129
4570
|
reward: tieredRewardDefinitionSchema,
|
|
4130
4571
|
earnedTier: identifier,
|
|
4131
4572
|
tier: identifier,
|
|
4132
|
-
revision:
|
|
4573
|
+
revision: z34.number().int().positive()
|
|
4133
4574
|
}))();
|
|
4134
|
-
var entitlementStateSchema = /* @__PURE__ */ (() =>
|
|
4135
|
-
|
|
4136
|
-
|
|
4575
|
+
var entitlementStateSchema = /* @__PURE__ */ (() => z34.discriminatedUnion("status", [
|
|
4576
|
+
z34.object({ ...entitlementBase, status: z34.literal("available") }).strict(),
|
|
4577
|
+
z34.object({
|
|
4137
4578
|
...entitlementBase,
|
|
4138
|
-
status:
|
|
4579
|
+
status: z34.literal("handing-over"),
|
|
4139
4580
|
handover: identifier,
|
|
4140
|
-
startedAt:
|
|
4581
|
+
startedAt: z34.number(),
|
|
4141
4582
|
allocation: pickupAllocationSchema.optional()
|
|
4142
4583
|
}).strict(),
|
|
4143
|
-
|
|
4584
|
+
z34.object({
|
|
4144
4585
|
...entitlementBase,
|
|
4145
|
-
status:
|
|
4586
|
+
status: z34.literal("collected"),
|
|
4146
4587
|
handover: identifier,
|
|
4147
|
-
startedAt:
|
|
4588
|
+
startedAt: z34.number(),
|
|
4148
4589
|
allocation: pickupAllocationSchema.optional(),
|
|
4149
|
-
collectedAt:
|
|
4590
|
+
collectedAt: z34.number(),
|
|
4150
4591
|
recovery: entitlementRecoverySchema.optional()
|
|
4151
4592
|
}).strict(),
|
|
4152
4593
|
// An operator voided it: it can no longer be handed over. A quest grant of the same reward to
|
|
4153
4594
|
// the member (the same grant key) makes it available again; a voided referral reward stays void.
|
|
4154
|
-
|
|
4595
|
+
z34.object({
|
|
4155
4596
|
...entitlementBase,
|
|
4156
|
-
status:
|
|
4157
|
-
voidedAt:
|
|
4597
|
+
status: z34.literal("void"),
|
|
4598
|
+
voidedAt: z34.number()
|
|
4158
4599
|
}).strict()
|
|
4159
4600
|
]))();
|
|
4160
|
-
var tieredRewardReadSchema = /* @__PURE__ */ (() =>
|
|
4601
|
+
var tieredRewardReadSchema = /* @__PURE__ */ (() => z34.object({
|
|
4161
4602
|
id: identifier,
|
|
4162
|
-
title:
|
|
4163
|
-
tiers:
|
|
4164
|
-
inventory:
|
|
4165
|
-
fulfillment:
|
|
4603
|
+
title: z34.string(),
|
|
4604
|
+
tiers: z34.array(z34.object({ id: identifier, title: z34.string() }).loose()),
|
|
4605
|
+
inventory: z34.object({ kind: z34.string() }).loose(),
|
|
4606
|
+
fulfillment: z34.object({ kind: z34.string() }).loose()
|
|
4166
4607
|
}).loose())();
|
|
4167
4608
|
var entitlementReadBase = /* @__PURE__ */ (() => ({
|
|
4168
4609
|
id: identifier,
|
|
@@ -4170,63 +4611,63 @@ var entitlementReadBase = /* @__PURE__ */ (() => ({
|
|
|
4170
4611
|
reward: tieredRewardReadSchema,
|
|
4171
4612
|
earnedTier: identifier,
|
|
4172
4613
|
tier: identifier,
|
|
4173
|
-
revision:
|
|
4614
|
+
revision: z34.number().int()
|
|
4174
4615
|
}))();
|
|
4175
|
-
var allocationReadSchema = /* @__PURE__ */ (() =>
|
|
4176
|
-
var entitlementSchema = /* @__PURE__ */ (() =>
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4616
|
+
var allocationReadSchema = /* @__PURE__ */ (() => z34.object({ item: identifier, label: z34.string() }).loose())();
|
|
4617
|
+
var entitlementSchema = /* @__PURE__ */ (() => z34.union([
|
|
4618
|
+
z34.discriminatedUnion("status", [
|
|
4619
|
+
z34.object({ ...entitlementReadBase, status: z34.literal("available") }).loose(),
|
|
4620
|
+
z34.object({
|
|
4180
4621
|
...entitlementReadBase,
|
|
4181
|
-
status:
|
|
4622
|
+
status: z34.literal("handing-over"),
|
|
4182
4623
|
handover: identifier,
|
|
4183
|
-
startedAt:
|
|
4624
|
+
startedAt: z34.number(),
|
|
4184
4625
|
allocation: allocationReadSchema.optional()
|
|
4185
4626
|
}).loose(),
|
|
4186
|
-
|
|
4627
|
+
z34.object({
|
|
4187
4628
|
...entitlementReadBase,
|
|
4188
|
-
status:
|
|
4629
|
+
status: z34.literal("collected"),
|
|
4189
4630
|
handover: identifier,
|
|
4190
|
-
startedAt:
|
|
4631
|
+
startedAt: z34.number(),
|
|
4191
4632
|
allocation: allocationReadSchema.optional(),
|
|
4192
|
-
collectedAt:
|
|
4633
|
+
collectedAt: z34.number(),
|
|
4193
4634
|
recovery: entitlementRecoverySchema.optional()
|
|
4194
4635
|
}).loose(),
|
|
4195
|
-
|
|
4636
|
+
z34.object({
|
|
4196
4637
|
...entitlementReadBase,
|
|
4197
|
-
status:
|
|
4198
|
-
voidedAt:
|
|
4638
|
+
status: z34.literal("void"),
|
|
4639
|
+
voidedAt: z34.number()
|
|
4199
4640
|
}).loose()
|
|
4200
4641
|
]),
|
|
4201
|
-
|
|
4642
|
+
z34.object({ ...entitlementReadBase, status: z34.string() }).loose().transform(({ status, ...entitlement }) => ({
|
|
4202
4643
|
...entitlement,
|
|
4203
4644
|
status: "unsupported",
|
|
4204
4645
|
reportedStatus: status
|
|
4205
4646
|
}))
|
|
4206
4647
|
]))();
|
|
4207
|
-
var beginHandoverSchema = /* @__PURE__ */ (() =>
|
|
4648
|
+
var beginHandoverSchema = /* @__PURE__ */ (() => z34.object({
|
|
4208
4649
|
actionId: identifier,
|
|
4209
|
-
revision:
|
|
4650
|
+
revision: z34.number().int().positive(),
|
|
4210
4651
|
selection: pickupSelectionSchema.optional()
|
|
4211
4652
|
}).strict())();
|
|
4212
|
-
var confirmHandoverSchema = /* @__PURE__ */ (() =>
|
|
4213
|
-
var entitlementCorrectionSchema = /* @__PURE__ */ (() =>
|
|
4653
|
+
var confirmHandoverSchema = /* @__PURE__ */ (() => z34.object({ actionId: identifier, handover: identifier }).strict())();
|
|
4654
|
+
var entitlementCorrectionSchema = /* @__PURE__ */ (() => z34.object({
|
|
4214
4655
|
actionId: identifier,
|
|
4215
|
-
revision:
|
|
4216
|
-
reason:
|
|
4656
|
+
revision: z34.number().int().positive(),
|
|
4657
|
+
reason: z34.string().trim().min(1).max(500)
|
|
4217
4658
|
}).strict())();
|
|
4218
4659
|
var CompletionSourceKind = {
|
|
4219
4660
|
Quest: "quest",
|
|
4220
4661
|
Leaderboard: "leaderboard"
|
|
4221
4662
|
};
|
|
4222
|
-
var completionSourceKindSchema = /* @__PURE__ */ (() =>
|
|
4223
|
-
var completionSourceSchema = /* @__PURE__ */ (() =>
|
|
4663
|
+
var completionSourceKindSchema = /* @__PURE__ */ (() => z34.string().min(1).max(64))();
|
|
4664
|
+
var completionSourceSchema = /* @__PURE__ */ (() => z34.object({
|
|
4224
4665
|
kind: completionSourceKindSchema,
|
|
4225
4666
|
id: identifier
|
|
4226
4667
|
}))();
|
|
4227
|
-
var completionRecordSchema = /* @__PURE__ */ (() =>
|
|
4668
|
+
var completionRecordSchema = /* @__PURE__ */ (() => z34.object({
|
|
4228
4669
|
/** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
|
|
4229
|
-
key:
|
|
4670
|
+
key: z34.string().default("once"),
|
|
4230
4671
|
id: identifier,
|
|
4231
4672
|
/** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
|
|
4232
4673
|
quest: identifier,
|
|
@@ -4234,19 +4675,19 @@ var completionRecordSchema = /* @__PURE__ */ (() => z32.object({
|
|
|
4234
4675
|
/** What paid the completion. `source.id` repeats `quest`. */
|
|
4235
4676
|
source: completionSourceSchema.optional()
|
|
4236
4677
|
}))();
|
|
4237
|
-
var questAvailabilitySchema = /* @__PURE__ */ (() =>
|
|
4238
|
-
|
|
4239
|
-
kind:
|
|
4240
|
-
input:
|
|
4678
|
+
var questAvailabilitySchema = /* @__PURE__ */ (() => z34.discriminatedUnion("kind", [
|
|
4679
|
+
z34.object({
|
|
4680
|
+
kind: z34.literal("available"),
|
|
4681
|
+
input: z34.enum(["photo", "quiz", "none", "text", "url"])
|
|
4241
4682
|
}).strict(),
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
kind:
|
|
4245
|
-
missing:
|
|
4683
|
+
z34.object({ kind: z34.literal("completed") }).strict(),
|
|
4684
|
+
z34.object({
|
|
4685
|
+
kind: z34.literal("locked"),
|
|
4686
|
+
missing: z34.array(missingPrerequisiteSchema).min(1)
|
|
4246
4687
|
}).strict(),
|
|
4247
|
-
|
|
4248
|
-
kind:
|
|
4249
|
-
reason:
|
|
4688
|
+
z34.object({
|
|
4689
|
+
kind: z34.literal("blocked"),
|
|
4690
|
+
reason: z34.enum([
|
|
4250
4691
|
"budget-exhausted",
|
|
4251
4692
|
"connection-required",
|
|
4252
4693
|
"wallet-required",
|
|
@@ -4255,56 +4696,56 @@ var questAvailabilitySchema = /* @__PURE__ */ (() => z32.discriminatedUnion("kin
|
|
|
4255
4696
|
"enrollment-required"
|
|
4256
4697
|
]),
|
|
4257
4698
|
/** Which window refused admission when `reason` is `outside-window`. */
|
|
4258
|
-
window:
|
|
4259
|
-
resetsAt:
|
|
4699
|
+
window: z34.enum(["tracker", "quest"]).optional(),
|
|
4700
|
+
resetsAt: z34.number().int().safe().optional()
|
|
4260
4701
|
}).strict(),
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4702
|
+
z34.object({ kind: z34.literal("staff-required") }).strict(),
|
|
4703
|
+
z34.object({ kind: z34.literal("automatic") }).strict(),
|
|
4704
|
+
z34.object({ kind: z34.literal("checking"), attempt: identifier }).strict(),
|
|
4705
|
+
z34.object({ kind: z34.literal("needs-review"), attempt: identifier }).strict(),
|
|
4706
|
+
z34.object({ kind: z34.literal("retryable"), attempt: identifier }).strict()
|
|
4266
4707
|
]))();
|
|
4267
|
-
var questAvailabilityResponseSchema = /* @__PURE__ */ (() =>
|
|
4708
|
+
var questAvailabilityResponseSchema = /* @__PURE__ */ (() => z34.union(
|
|
4268
4709
|
questAvailabilitySchema.options.map((option) => option.strip())
|
|
4269
4710
|
))();
|
|
4270
|
-
var questBudgetViewSchema = /* @__PURE__ */ (() =>
|
|
4711
|
+
var questBudgetViewSchema = /* @__PURE__ */ (() => z34.object({
|
|
4271
4712
|
id: identifier,
|
|
4272
|
-
scope:
|
|
4273
|
-
period:
|
|
4274
|
-
remaining:
|
|
4275
|
-
resetsAt:
|
|
4713
|
+
scope: z34.enum(["member", "project"]),
|
|
4714
|
+
period: z34.enum(["day", "week", "month", "lifetime"]),
|
|
4715
|
+
remaining: z34.number().int().safe().nonnegative(),
|
|
4716
|
+
resetsAt: z34.number().int().safe().nullable()
|
|
4276
4717
|
}))();
|
|
4277
4718
|
var memberProgressSchema = /* @__PURE__ */ (() => responseShape(
|
|
4278
|
-
|
|
4719
|
+
z34.object({
|
|
4279
4720
|
member: identifier,
|
|
4280
|
-
quests:
|
|
4281
|
-
|
|
4721
|
+
quests: z34.array(
|
|
4722
|
+
z34.object({
|
|
4282
4723
|
quest: identifier,
|
|
4283
4724
|
key: identifier.optional(),
|
|
4284
4725
|
release: identifier.optional(),
|
|
4285
|
-
title:
|
|
4726
|
+
title: z34.string(),
|
|
4286
4727
|
presentation: questPresentationSchema.default({}),
|
|
4287
|
-
connections:
|
|
4728
|
+
connections: z34.array(authProviderSchema).default([]),
|
|
4288
4729
|
trigger: triggerResponseSchema,
|
|
4289
4730
|
availability: questAvailabilityResponseSchema,
|
|
4290
|
-
completed:
|
|
4731
|
+
completed: z34.boolean(),
|
|
4291
4732
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
4292
4733
|
streak: streakProgressSchema.nullable().optional(),
|
|
4293
4734
|
counter: counterProgressSchema.nullable().optional(),
|
|
4294
4735
|
/** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
|
|
4295
4736
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
4296
|
-
completionCount:
|
|
4297
|
-
visibility:
|
|
4298
|
-
missing:
|
|
4737
|
+
completionCount: z34.number().int().nonnegative().default(0),
|
|
4738
|
+
visibility: z34.enum(["visible", "hidden"]).default("visible"),
|
|
4739
|
+
missing: z34.array(missingPrerequisiteSchema),
|
|
4299
4740
|
campaign: campaignViewSchema.nullable().default(null),
|
|
4300
4741
|
window: availabilityWindowSchema.nullable().default(null),
|
|
4301
|
-
budgets:
|
|
4742
|
+
budgets: z34.array(questBudgetViewSchema).default([]),
|
|
4302
4743
|
/**
|
|
4303
4744
|
* Unix milliseconds when the member may submit again, while the quest's retry cooldown
|
|
4304
4745
|
* after their rejected attempt runs. Until then a new attempt is refused with
|
|
4305
4746
|
* `retry-cooldown`. Absent when no cooldown is running.
|
|
4306
4747
|
*/
|
|
4307
|
-
retryAt:
|
|
4748
|
+
retryAt: z34.number().int().safe().optional(),
|
|
4308
4749
|
/**
|
|
4309
4750
|
* Unix milliseconds when the member may next submit the quest, while it waits on something
|
|
4310
4751
|
* that ends by itself: the retry cooldown after a rejection, the completion cooldown after
|
|
@@ -4313,128 +4754,128 @@ var memberProgressSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
4313
4754
|
* several apply; use it for countdowns. Absent when the member can submit now, or when
|
|
4314
4755
|
* nothing will reopen the quest (a used-up lifetime budget, a closed window).
|
|
4315
4756
|
*/
|
|
4316
|
-
nextAvailableAt:
|
|
4757
|
+
nextAvailableAt: z34.number().int().safe().optional(),
|
|
4317
4758
|
attempt: attemptSchema.nullable()
|
|
4318
4759
|
})
|
|
4319
4760
|
),
|
|
4320
|
-
entitlements:
|
|
4761
|
+
entitlements: z34.array(entitlementSchema)
|
|
4321
4762
|
})
|
|
4322
4763
|
))();
|
|
4323
4764
|
var snapshotSchema = /* @__PURE__ */ (() => responseShape(
|
|
4324
|
-
|
|
4325
|
-
releases:
|
|
4326
|
-
completions:
|
|
4327
|
-
entitlements:
|
|
4328
|
-
attempts:
|
|
4329
|
-
balances:
|
|
4330
|
-
|
|
4331
|
-
member:
|
|
4332
|
-
balance:
|
|
4333
|
-
earned:
|
|
4334
|
-
held:
|
|
4335
|
-
available:
|
|
4765
|
+
z34.object({
|
|
4766
|
+
releases: z34.array(publishedReleaseSchema),
|
|
4767
|
+
completions: z34.array(completionRecordSchema),
|
|
4768
|
+
entitlements: z34.array(entitlementSchema),
|
|
4769
|
+
attempts: z34.array(attemptSchema),
|
|
4770
|
+
balances: z34.array(
|
|
4771
|
+
z34.object({
|
|
4772
|
+
member: z34.string(),
|
|
4773
|
+
balance: z34.string(),
|
|
4774
|
+
earned: z34.number(),
|
|
4775
|
+
held: z34.number(),
|
|
4776
|
+
available: z34.number()
|
|
4336
4777
|
})
|
|
4337
4778
|
),
|
|
4338
|
-
events:
|
|
4779
|
+
events: z34.array(eventSchema)
|
|
4339
4780
|
})
|
|
4340
4781
|
))();
|
|
4341
|
-
var evidenceSchema = /* @__PURE__ */ (() =>
|
|
4782
|
+
var evidenceSchema = /* @__PURE__ */ (() => z34.object({
|
|
4342
4783
|
id: identifier,
|
|
4343
4784
|
member: identifier,
|
|
4344
|
-
type:
|
|
4345
|
-
size:
|
|
4785
|
+
type: z34.enum(["image/jpeg", "image/png"]),
|
|
4786
|
+
size: z34.number()
|
|
4346
4787
|
}))();
|
|
4347
|
-
var errorSchema = /* @__PURE__ */ (() =>
|
|
4348
|
-
error:
|
|
4349
|
-
code:
|
|
4788
|
+
var errorSchema = /* @__PURE__ */ (() => z34.object({
|
|
4789
|
+
error: z34.string(),
|
|
4790
|
+
code: z34.string().optional(),
|
|
4350
4791
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
4351
|
-
window:
|
|
4352
|
-
missing:
|
|
4792
|
+
window: z34.enum(["tracker", "quest"]).optional(),
|
|
4793
|
+
missing: z34.array(missingPrerequisiteSchema).optional(),
|
|
4353
4794
|
/**
|
|
4354
4795
|
* Unix milliseconds when the member may submit again, when `code` is `retry-cooldown` or
|
|
4355
4796
|
* `completion-cooldown`.
|
|
4356
4797
|
*/
|
|
4357
|
-
retryAt:
|
|
4798
|
+
retryAt: z34.number().int().safe().optional()
|
|
4358
4799
|
}))();
|
|
4359
|
-
var staffDecisionSchema = /* @__PURE__ */ (() =>
|
|
4800
|
+
var staffDecisionSchema = /* @__PURE__ */ (() => z34.object({
|
|
4360
4801
|
actionId: identifier,
|
|
4361
|
-
generation:
|
|
4362
|
-
decision:
|
|
4363
|
-
reason:
|
|
4802
|
+
generation: z34.number().int().nonnegative(),
|
|
4803
|
+
decision: z34.enum(["accept", "reject"]),
|
|
4804
|
+
reason: z34.string().trim().min(1).max(2e3)
|
|
4364
4805
|
}).strict())();
|
|
4365
|
-
var acceptAnywaySchema = /* @__PURE__ */ (() =>
|
|
4806
|
+
var acceptAnywaySchema = /* @__PURE__ */ (() => z34.object({
|
|
4366
4807
|
actionId: identifier,
|
|
4367
|
-
reason:
|
|
4808
|
+
reason: z34.string().trim().min(1).max(2e3)
|
|
4368
4809
|
}).strict())();
|
|
4369
|
-
var evidenceRedactionInputSchema = /* @__PURE__ */ (() =>
|
|
4810
|
+
var evidenceRedactionInputSchema = /* @__PURE__ */ (() => z34.object({
|
|
4370
4811
|
actionId: identifier,
|
|
4371
|
-
reason:
|
|
4812
|
+
reason: z34.string().trim().min(1).max(2e3)
|
|
4372
4813
|
}).strict())();
|
|
4373
|
-
var evidenceRetentionInputSchema = /* @__PURE__ */ (() =>
|
|
4814
|
+
var evidenceRetentionInputSchema = /* @__PURE__ */ (() => z34.object({
|
|
4374
4815
|
actionId: identifier,
|
|
4375
4816
|
quest: identifier,
|
|
4376
|
-
decidedBefore:
|
|
4377
|
-
reason:
|
|
4817
|
+
decidedBefore: z34.number().int().nonnegative(),
|
|
4818
|
+
reason: z34.string().trim().min(1).max(2e3)
|
|
4378
4819
|
}).strict())();
|
|
4379
|
-
var evidenceRetentionPeriodSchema = /* @__PURE__ */ (() =>
|
|
4380
|
-
|
|
4381
|
-
|
|
4820
|
+
var evidenceRetentionPeriodSchema = /* @__PURE__ */ (() => z34.union([
|
|
4821
|
+
z34.object({ days: z34.number().int().min(1).max(3650) }).strict(),
|
|
4822
|
+
z34.literal("keep")
|
|
4382
4823
|
]))();
|
|
4383
|
-
var evidenceRetentionSettingInputSchema = /* @__PURE__ */ (() =>
|
|
4824
|
+
var evidenceRetentionSettingInputSchema = /* @__PURE__ */ (() => z34.object({
|
|
4384
4825
|
actionId: identifier,
|
|
4385
4826
|
evidenceRetention: evidenceRetentionPeriodSchema
|
|
4386
4827
|
}).strict())();
|
|
4387
|
-
var stockSchema = /* @__PURE__ */ (() =>
|
|
4388
|
-
var reservationSchema = /* @__PURE__ */ (() =>
|
|
4828
|
+
var stockSchema = /* @__PURE__ */ (() => z34.object({ item: identifier, quantity: z34.number().int().min(0).max(1e4) }).strict())();
|
|
4829
|
+
var reservationSchema = /* @__PURE__ */ (() => z34.object({
|
|
4389
4830
|
actionId: identifier,
|
|
4390
4831
|
member: identifier,
|
|
4391
4832
|
item: identifier,
|
|
4392
4833
|
balance: identifier,
|
|
4393
|
-
price:
|
|
4834
|
+
price: z34.number().int().positive().max(1e4)
|
|
4394
4835
|
}).strict())();
|
|
4395
4836
|
var pageOptions = /* @__PURE__ */ (() => ({
|
|
4396
|
-
limit:
|
|
4397
|
-
cursor:
|
|
4837
|
+
limit: z34.number().int().min(1).max(100).default(25),
|
|
4838
|
+
cursor: z34.string().min(1).max(4096).optional()
|
|
4398
4839
|
}))();
|
|
4399
|
-
var reviewListSchema = /* @__PURE__ */ (() =>
|
|
4840
|
+
var reviewListSchema = /* @__PURE__ */ (() => z34.object({
|
|
4400
4841
|
...pageOptions,
|
|
4401
4842
|
member: identifier.optional(),
|
|
4402
4843
|
quest: identifier.optional()
|
|
4403
4844
|
}).strict())();
|
|
4404
|
-
var memberListSchema = /* @__PURE__ */ (() =>
|
|
4845
|
+
var memberListSchema = /* @__PURE__ */ (() => z34.object({
|
|
4405
4846
|
...pageOptions,
|
|
4406
4847
|
prefix: identifier.optional()
|
|
4407
4848
|
}).strict())();
|
|
4408
|
-
var reviewItemSchema = /* @__PURE__ */ (() =>
|
|
4849
|
+
var reviewItemSchema = /* @__PURE__ */ (() => z34.object({
|
|
4409
4850
|
attempt: attemptSchema,
|
|
4410
|
-
title:
|
|
4411
|
-
checks:
|
|
4412
|
-
|
|
4851
|
+
title: z34.string(),
|
|
4852
|
+
checks: z34.array(
|
|
4853
|
+
z34.object({ criteria: z34.string(), result: photoResultSchema })
|
|
4413
4854
|
)
|
|
4414
4855
|
}))();
|
|
4415
|
-
var reviewPageSchema = /* @__PURE__ */ (() =>
|
|
4416
|
-
items:
|
|
4417
|
-
nextCursor:
|
|
4856
|
+
var reviewPageSchema = /* @__PURE__ */ (() => z34.object({
|
|
4857
|
+
items: z34.array(reviewItemSchema).max(100),
|
|
4858
|
+
nextCursor: z34.string().nullable()
|
|
4418
4859
|
}))();
|
|
4419
|
-
var memberPageSchema = /* @__PURE__ */ (() =>
|
|
4420
|
-
items:
|
|
4421
|
-
nextCursor:
|
|
4860
|
+
var memberPageSchema = /* @__PURE__ */ (() => z34.object({
|
|
4861
|
+
items: z34.array(z34.object({ member: identifier })).max(100),
|
|
4862
|
+
nextCursor: z34.string().nullable()
|
|
4422
4863
|
}))();
|
|
4423
|
-
var createStockItemSchema = /* @__PURE__ */ (() =>
|
|
4424
|
-
var stockItemSchema = /* @__PURE__ */ (() =>
|
|
4425
|
-
var contentPerformanceSnapshotSchema = /* @__PURE__ */ (() =>
|
|
4864
|
+
var createStockItemSchema = /* @__PURE__ */ (() => z34.object({ actionId: identifier, name: z34.string().trim().min(1).max(80) }).strict())();
|
|
4865
|
+
var stockItemSchema = /* @__PURE__ */ (() => z34.object({ id: identifier, name: z34.string() }))();
|
|
4866
|
+
var contentPerformanceSnapshotSchema = /* @__PURE__ */ (() => z34.strictObject({
|
|
4426
4867
|
contentAttempt: identifier,
|
|
4427
4868
|
observation: identifier,
|
|
4428
|
-
observedAt:
|
|
4869
|
+
observedAt: z34.number().int().safe().nonnegative(),
|
|
4429
4870
|
metrics: contentMetricsSchema,
|
|
4430
4871
|
rewards: rewardBundleSchema
|
|
4431
4872
|
}))();
|
|
4432
4873
|
var contentPerformanceQuerySchema = /* @__PURE__ */ (() => contentQualificationQuerySchema.extend({
|
|
4433
|
-
content:
|
|
4874
|
+
content: z34.string().min(1).max(256)
|
|
4434
4875
|
}))();
|
|
4435
|
-
var contentPerformancePageSchema = /* @__PURE__ */ (() =>
|
|
4436
|
-
current:
|
|
4437
|
-
state:
|
|
4876
|
+
var contentPerformancePageSchema = /* @__PURE__ */ (() => z34.strictObject({
|
|
4877
|
+
current: z34.strictObject({
|
|
4878
|
+
state: z34.enum([
|
|
4438
4879
|
"content-pending",
|
|
4439
4880
|
"content-unqualified",
|
|
4440
4881
|
"waiting",
|
|
@@ -4445,19 +4886,19 @@ var contentPerformancePageSchema = /* @__PURE__ */ (() => z32.strictObject({
|
|
|
4445
4886
|
"failed",
|
|
4446
4887
|
"superseded"
|
|
4447
4888
|
]),
|
|
4448
|
-
reason:
|
|
4889
|
+
reason: z34.string().nullable(),
|
|
4449
4890
|
contentAttempt: identifier,
|
|
4450
4891
|
attempt: identifier.nullable(),
|
|
4451
4892
|
reward: contentQualificationSchema.shape.reward
|
|
4452
4893
|
}),
|
|
4453
|
-
items:
|
|
4454
|
-
|
|
4894
|
+
items: z34.array(
|
|
4895
|
+
z34.strictObject({
|
|
4455
4896
|
attempt: identifier,
|
|
4456
4897
|
contentAttempt: identifier,
|
|
4457
4898
|
observation: identifier,
|
|
4458
|
-
observedAt:
|
|
4899
|
+
observedAt: z34.number(),
|
|
4459
4900
|
metrics: contentMetricsSchema,
|
|
4460
|
-
state:
|
|
4901
|
+
state: z34.enum([
|
|
4461
4902
|
"pending",
|
|
4462
4903
|
"qualified",
|
|
4463
4904
|
"unqualified",
|
|
@@ -4465,43 +4906,43 @@ var contentPerformancePageSchema = /* @__PURE__ */ (() => z32.strictObject({
|
|
|
4465
4906
|
"failed",
|
|
4466
4907
|
"superseded"
|
|
4467
4908
|
]),
|
|
4468
|
-
reason:
|
|
4909
|
+
reason: z34.string().nullable()
|
|
4469
4910
|
})
|
|
4470
4911
|
),
|
|
4471
4912
|
nextCursor: pageCursorSchema.nullable()
|
|
4472
4913
|
}))();
|
|
4473
4914
|
|
|
4474
4915
|
// src/point-ledgers.ts
|
|
4475
|
-
import * as
|
|
4476
|
-
var pointLedgerPropertiesSchema = /* @__PURE__ */ (() =>
|
|
4477
|
-
name:
|
|
4478
|
-
description:
|
|
4916
|
+
import * as z35 from "zod";
|
|
4917
|
+
var pointLedgerPropertiesSchema = /* @__PURE__ */ (() => z35.object({
|
|
4918
|
+
name: z35.string().trim().min(1).max(120),
|
|
4919
|
+
description: z35.string().trim().max(1e3).default("")
|
|
4479
4920
|
}).strict())();
|
|
4480
4921
|
var createPointLedgerSchema = /* @__PURE__ */ (() => pointLedgerPropertiesSchema.extend({ actionId: identifier, key: identifier.optional() }).strict())();
|
|
4481
4922
|
var pointLedgerSchema = /* @__PURE__ */ (() => pointLedgerPropertiesSchema.extend({
|
|
4482
4923
|
id: identifier
|
|
4483
4924
|
}))();
|
|
4484
4925
|
var managedPointLedgerSchema = /* @__PURE__ */ (() => pointLedgerSchema.extend({
|
|
4485
|
-
archivedAt:
|
|
4926
|
+
archivedAt: z35.number().int().nonnegative().nullable()
|
|
4486
4927
|
}))();
|
|
4487
4928
|
var pointLedgerDeclarationSchema = /* @__PURE__ */ (() => pointLedgerPropertiesSchema.extend({ key: identifier }).strict())();
|
|
4488
|
-
var pointLedgerArtifactSchema = /* @__PURE__ */ (() =>
|
|
4929
|
+
var pointLedgerArtifactSchema = /* @__PURE__ */ (() => z35.union([
|
|
4489
4930
|
pointLedgerDeclarationSchema,
|
|
4490
|
-
|
|
4931
|
+
z35.object({ code: z35.string().min(1).max(2e6) }).strict()
|
|
4491
4932
|
]))();
|
|
4492
|
-
var pointLedgerReferenceSchema = /* @__PURE__ */ (() =>
|
|
4933
|
+
var pointLedgerReferenceSchema = /* @__PURE__ */ (() => z35.object({
|
|
4493
4934
|
id: identifier,
|
|
4494
4935
|
key: identifier.nullable(),
|
|
4495
|
-
name:
|
|
4936
|
+
name: z35.string()
|
|
4496
4937
|
}))();
|
|
4497
|
-
var points = /* @__PURE__ */ (() =>
|
|
4498
|
-
var pointBalanceSchema = /* @__PURE__ */ (() =>
|
|
4938
|
+
var points = /* @__PURE__ */ (() => z35.number().int().safe())();
|
|
4939
|
+
var pointBalanceSchema = /* @__PURE__ */ (() => z35.object({
|
|
4499
4940
|
ledger: pointLedgerReferenceSchema,
|
|
4500
4941
|
balance: points,
|
|
4501
4942
|
available: points
|
|
4502
4943
|
}))();
|
|
4503
|
-
var pointBalancesSchema = /* @__PURE__ */ (() =>
|
|
4504
|
-
items:
|
|
4944
|
+
var pointBalancesSchema = /* @__PURE__ */ (() => z35.object({
|
|
4945
|
+
items: z35.array(pointBalanceSchema)
|
|
4505
4946
|
}))();
|
|
4506
4947
|
var PointEntryKind = {
|
|
4507
4948
|
/** Points a quest completion, an engagement settlement or an operator awarded. */
|
|
@@ -4513,8 +4954,8 @@ var PointEntryKind = {
|
|
|
4513
4954
|
/** Undoes part or all of an award or a positive adjustment (`reverses`). */
|
|
4514
4955
|
Reverse: "reverse"
|
|
4515
4956
|
};
|
|
4516
|
-
var pointEntryKindSchema = /* @__PURE__ */ (() =>
|
|
4517
|
-
var pointEntrySchema = /* @__PURE__ */ (() =>
|
|
4957
|
+
var pointEntryKindSchema = /* @__PURE__ */ (() => z35.string().min(1).max(64))();
|
|
4958
|
+
var pointEntrySchema = /* @__PURE__ */ (() => z35.object({
|
|
4518
4959
|
id: identifier,
|
|
4519
4960
|
amount: points,
|
|
4520
4961
|
kind: pointEntryKindSchema,
|
|
@@ -4526,204 +4967,261 @@ var pointEntrySchema = /* @__PURE__ */ (() => z33.object({
|
|
|
4526
4967
|
* True for an opening balance a member import recorded (an `adjust`). Absent from Relay
|
|
4527
4968
|
* versions without imports.
|
|
4528
4969
|
*/
|
|
4529
|
-
imported:
|
|
4970
|
+
imported: z35.boolean().optional()
|
|
4530
4971
|
}))();
|
|
4531
|
-
var pointHistoryQuerySchema = /* @__PURE__ */ (() =>
|
|
4972
|
+
var pointHistoryQuerySchema = /* @__PURE__ */ (() => z35.strictObject({
|
|
4532
4973
|
ledger: identifier,
|
|
4533
4974
|
cursor: pageCursorSchema.optional()
|
|
4534
4975
|
}))();
|
|
4535
|
-
var pointHistoryPageSchema = /* @__PURE__ */ (() =>
|
|
4536
|
-
items:
|
|
4976
|
+
var pointHistoryPageSchema = /* @__PURE__ */ (() => z35.object({
|
|
4977
|
+
items: z35.array(pointEntrySchema),
|
|
4537
4978
|
nextCursor: pageCursorSchema.nullable()
|
|
4538
4979
|
}))();
|
|
4539
4980
|
|
|
4540
4981
|
// src/profiles.ts
|
|
4541
|
-
import * as
|
|
4542
|
-
var count3 = /* @__PURE__ */ (() =>
|
|
4543
|
-
var profileVisibilitySchema = /* @__PURE__ */ (() =>
|
|
4982
|
+
import * as z36 from "zod";
|
|
4983
|
+
var count3 = /* @__PURE__ */ (() => z36.number().int().nonnegative().safe())();
|
|
4984
|
+
var profileVisibilitySchema = /* @__PURE__ */ (() => z36.enum([
|
|
4544
4985
|
"private",
|
|
4545
4986
|
"participants",
|
|
4546
4987
|
"public"
|
|
4547
4988
|
]))();
|
|
4548
|
-
var avatarProviderSchema = /* @__PURE__ */ (() =>
|
|
4549
|
-
var profileDefaultProviderSchema = /* @__PURE__ */ (() =>
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4989
|
+
var avatarProviderSchema = /* @__PURE__ */ (() => z36.enum(["x", "discord", "google"]))();
|
|
4990
|
+
var profileDefaultProviderSchema = /* @__PURE__ */ (() => z36.enum(["x", "discord"]))();
|
|
4991
|
+
function orderedSources(sources) {
|
|
4992
|
+
return z36.array(sources).max(sources.options.length).refine(
|
|
4993
|
+
(values2) => new Set(values2).size === values2.length,
|
|
4994
|
+
"List each provider once"
|
|
4995
|
+
);
|
|
4996
|
+
}
|
|
4997
|
+
var profileDefaultsSchema = /* @__PURE__ */ (() => orderedSources(
|
|
4998
|
+
profileDefaultProviderSchema
|
|
4553
4999
|
))();
|
|
4554
|
-
var
|
|
4555
|
-
var
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
5000
|
+
var knownProfileDefaultSources = ["x", "discord", "sol"];
|
|
5001
|
+
var profileDefaultSourcesSchema = /* @__PURE__ */ (() => orderedSources(
|
|
5002
|
+
z36.enum(knownProfileDefaultSources)
|
|
5003
|
+
))();
|
|
5004
|
+
var profileNameSourceSchema = /* @__PURE__ */ (() => z36.enum(["sol"]))();
|
|
5005
|
+
var openValue = /* @__PURE__ */ (() => z36.string().min(1).max(64))();
|
|
5006
|
+
var avatarSeedSchema = /* @__PURE__ */ (() => z36.string().min(1).max(100))();
|
|
5007
|
+
var profileAvatarSchema = /* @__PURE__ */ (() => z36.discriminatedUnion("source", [
|
|
5008
|
+
z36.object({
|
|
5009
|
+
source: z36.literal("upload"),
|
|
5010
|
+
url: z36.string().url(),
|
|
4559
5011
|
seed: avatarSeedSchema
|
|
4560
5012
|
}),
|
|
4561
|
-
|
|
4562
|
-
source:
|
|
5013
|
+
z36.object({
|
|
5014
|
+
source: z36.literal("account"),
|
|
4563
5015
|
provider: avatarProviderSchema,
|
|
4564
|
-
url:
|
|
5016
|
+
url: z36.string().url(),
|
|
4565
5017
|
seed: avatarSeedSchema
|
|
4566
5018
|
}),
|
|
4567
|
-
|
|
5019
|
+
z36.object({ source: z36.literal("generated"), seed: avatarSeedSchema })
|
|
4568
5020
|
]))();
|
|
4569
|
-
var profileSummarySchema = /* @__PURE__ */ (() =>
|
|
5021
|
+
var profileSummarySchema = /* @__PURE__ */ (() => z36.object({
|
|
4570
5022
|
id: identifier,
|
|
4571
|
-
name:
|
|
5023
|
+
name: z36.string(),
|
|
4572
5024
|
avatar: profileAvatarSchema
|
|
4573
5025
|
}))();
|
|
4574
5026
|
var invisible = /[\p{Cc}----]/u;
|
|
4575
|
-
var displayNameSchema = /* @__PURE__ */ (() =>
|
|
4576
|
-
|
|
5027
|
+
var displayNameSchema = /* @__PURE__ */ (() => z36.string().max(200).transform((value) => value.normalize("NFC").replace(/\s+/g, " ").trim()).pipe(
|
|
5028
|
+
z36.string().min(1, "Enter a name").max(40, "Use at most 40 characters").refine((value) => !invisible.test(value), "Use visible characters only")
|
|
4577
5029
|
))();
|
|
4578
|
-
var profileUpdateSchema = /* @__PURE__ */ (() =>
|
|
5030
|
+
var profileUpdateSchema = /* @__PURE__ */ (() => z36.object({
|
|
4579
5031
|
displayName: displayNameSchema.nullable().optional(),
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
5032
|
+
/** @experimental A minor release can change `.sol` names. */
|
|
5033
|
+
nameSource: profileNameSourceSchema.nullable().optional(),
|
|
5034
|
+
avatar: z36.discriminatedUnion("source", [
|
|
5035
|
+
z36.object({
|
|
5036
|
+
source: z36.literal("account"),
|
|
4583
5037
|
provider: avatarProviderSchema
|
|
4584
5038
|
}).strict(),
|
|
4585
|
-
|
|
5039
|
+
z36.object({ source: z36.literal("generated") }).strict()
|
|
4586
5040
|
]).nullable().optional(),
|
|
4587
|
-
hidden:
|
|
5041
|
+
hidden: z36.boolean().optional()
|
|
4588
5042
|
}).strict().refine(
|
|
4589
5043
|
(value) => Object.values(value).some((field) => field !== void 0),
|
|
4590
5044
|
"Change at least one field"
|
|
4591
|
-
))()
|
|
5045
|
+
).refine((value) => !(value.displayName !== void 0 && value.nameSource), {
|
|
5046
|
+
message: "Choose a name or a name source, not both",
|
|
5047
|
+
path: ["nameSource"]
|
|
5048
|
+
}))();
|
|
4592
5049
|
var ownProfileSchema = /* @__PURE__ */ (() => profileSummarySchema.extend({
|
|
4593
5050
|
/** The name the member chose, or null for the default. */
|
|
4594
|
-
displayName:
|
|
5051
|
+
displayName: z36.string().nullable(),
|
|
4595
5052
|
/** The avatar the member chose: `default` follows the project's defaults. */
|
|
4596
|
-
avatarChoice:
|
|
5053
|
+
avatarChoice: z36.enum(["default", "upload", "account", "generated"]),
|
|
4597
5054
|
/** The account of an `account` choice. */
|
|
4598
5055
|
avatarProvider: avatarProviderSchema.nullable(),
|
|
4599
|
-
hidden:
|
|
5056
|
+
hidden: z36.boolean(),
|
|
4600
5057
|
/** An operator locked the name and avatar; the member can still hide the profile. */
|
|
4601
|
-
locked:
|
|
5058
|
+
locked: z36.boolean(),
|
|
4602
5059
|
/** Who can see profiles in this project, so the app can explain it. */
|
|
4603
5060
|
visibility: profileVisibilitySchema,
|
|
4604
5061
|
/** The member's connected accounts a picture or name can come from. */
|
|
4605
|
-
options:
|
|
4606
|
-
|
|
5062
|
+
options: z36.array(
|
|
5063
|
+
z36.object({
|
|
4607
5064
|
provider: avatarProviderSchema,
|
|
4608
|
-
name:
|
|
5065
|
+
name: z36.string().nullable(),
|
|
4609
5066
|
/**
|
|
4610
5067
|
* The account's first name, where the provider sends one (Google does; X and Discord don't).
|
|
4611
5068
|
* Only the member's own profile carries it.
|
|
4612
5069
|
*/
|
|
4613
|
-
givenName:
|
|
4614
|
-
imageUrl:
|
|
5070
|
+
givenName: z36.string().nullable().default(null),
|
|
5071
|
+
imageUrl: z36.string().url().nullable()
|
|
4615
5072
|
})
|
|
4616
|
-
)
|
|
5073
|
+
),
|
|
5074
|
+
/**
|
|
5075
|
+
* What the member's name follows instead of a name they typed (`profileNameSourceSchema`), or
|
|
5076
|
+
* null. Absent from Relay versions without name sources.
|
|
5077
|
+
*
|
|
5078
|
+
* @experimental A minor release can change `.sol` names.
|
|
5079
|
+
*/
|
|
5080
|
+
nameSource: openValue.nullable().optional(),
|
|
5081
|
+
/**
|
|
5082
|
+
* The names the member can choose to follow with `nameSource`: `sol`, the primary `.sol` name of
|
|
5083
|
+
* a Solana wallet they linked, when it has one. Absent from Relay versions without name sources.
|
|
5084
|
+
*
|
|
5085
|
+
* @experimental A minor release can change `.sol` names.
|
|
5086
|
+
*/
|
|
5087
|
+
nameOptions: z36.array(z36.object({ source: openValue, name: z36.string() })).optional()
|
|
4617
5088
|
}))();
|
|
4618
|
-
var cursor = /* @__PURE__ */ (() =>
|
|
4619
|
-
var profileCompletionQuerySchema = /* @__PURE__ */ (() =>
|
|
4620
|
-
limit:
|
|
5089
|
+
var cursor = /* @__PURE__ */ (() => z36.string().min(1).max(512))();
|
|
5090
|
+
var profileCompletionQuerySchema = /* @__PURE__ */ (() => z36.object({
|
|
5091
|
+
limit: z36.coerce.number().int().min(1).max(100).default(20),
|
|
4621
5092
|
cursor: cursor.optional()
|
|
4622
5093
|
}).strict())();
|
|
4623
|
-
var profileCompletionSchema = /* @__PURE__ */ (() =>
|
|
5094
|
+
var profileCompletionSchema = /* @__PURE__ */ (() => z36.object({
|
|
4624
5095
|
quest: identifier,
|
|
4625
5096
|
key: identifier.optional(),
|
|
4626
|
-
title:
|
|
5097
|
+
title: z36.string(),
|
|
4627
5098
|
completions: count3.positive(),
|
|
4628
5099
|
/** Null for completions recorded before completion times were. */
|
|
4629
5100
|
lastCompletedAt: count3.nullable()
|
|
4630
5101
|
}))();
|
|
4631
|
-
var profileCompletionPageSchema = /* @__PURE__ */ (() =>
|
|
4632
|
-
items:
|
|
5102
|
+
var profileCompletionPageSchema = /* @__PURE__ */ (() => z36.object({
|
|
5103
|
+
items: z36.array(profileCompletionSchema),
|
|
4633
5104
|
nextCursor: cursor.nullable()
|
|
4634
5105
|
}))();
|
|
4635
|
-
var profileReferralSchema = /* @__PURE__ */ (() =>
|
|
5106
|
+
var profileReferralSchema = /* @__PURE__ */ (() => z36.object({
|
|
4636
5107
|
program: identifier,
|
|
4637
5108
|
key: identifier.optional(),
|
|
4638
|
-
title:
|
|
5109
|
+
title: z36.string(),
|
|
4639
5110
|
/** Members this member invited. Invitations are shared by every program. */
|
|
4640
5111
|
invited: count3,
|
|
4641
5112
|
/** Invited members who qualified in this program. */
|
|
4642
5113
|
qualified: count3,
|
|
4643
|
-
milestones:
|
|
4644
|
-
|
|
5114
|
+
milestones: z36.array(
|
|
5115
|
+
z36.object({ id: identifier, count: count3, reached: z36.boolean() })
|
|
4645
5116
|
)
|
|
4646
5117
|
}))();
|
|
4647
|
-
var profileSettingsSchema = /* @__PURE__ */ (() =>
|
|
5118
|
+
var profileSettingsSchema = /* @__PURE__ */ (() => z36.object({
|
|
4648
5119
|
visibility: profileVisibilitySchema,
|
|
5120
|
+
/** The `defaultSources` that are accounts, in order: `.sol` names are left out. */
|
|
4649
5121
|
defaults: profileDefaultsSchema,
|
|
5122
|
+
/**
|
|
5123
|
+
* Every source of default names and pictures, in order (`knownProfileDefaultSources`). Absent
|
|
5124
|
+
* from Relay versions without `.sol` names, where it is `defaults`.
|
|
5125
|
+
*
|
|
5126
|
+
* @experimental A minor release can change `.sol` names.
|
|
5127
|
+
*/
|
|
5128
|
+
defaultSources: z36.array(openValue).optional(),
|
|
4650
5129
|
revision: count3,
|
|
4651
|
-
actor:
|
|
5130
|
+
actor: z36.string().nullable(),
|
|
4652
5131
|
updatedAt: count3.nullable()
|
|
4653
5132
|
}))();
|
|
4654
|
-
var profileSettingsInputSchema = /* @__PURE__ */ (() => profileSettingsSchema.omit({
|
|
5133
|
+
var profileSettingsInputSchema = /* @__PURE__ */ (() => profileSettingsSchema.omit({
|
|
5134
|
+
revision: true,
|
|
5135
|
+
actor: true,
|
|
5136
|
+
updatedAt: true,
|
|
5137
|
+
defaultSources: true
|
|
5138
|
+
}).extend({
|
|
5139
|
+
/**
|
|
5140
|
+
* Every source of default names and pictures in order, `.sol` names included. `defaults` must
|
|
5141
|
+
* list its accounts in the same order. Without it, the project's `.sol` names keep their place
|
|
5142
|
+
* around the accounts while `defaults` keeps the accounts' order.
|
|
5143
|
+
*
|
|
5144
|
+
* @experimental A minor release can change `.sol` names.
|
|
5145
|
+
*/
|
|
5146
|
+
defaultSources: profileDefaultSourcesSchema.optional(),
|
|
4655
5147
|
actionId: identifier,
|
|
4656
5148
|
/** The revision the change was made against; a newer one is a 409. */
|
|
4657
5149
|
expectedRevision: count3,
|
|
4658
|
-
reason:
|
|
4659
|
-
}).strict()
|
|
4660
|
-
|
|
5150
|
+
reason: z36.string().trim().min(1).max(500)
|
|
5151
|
+
}).strict().refine(
|
|
5152
|
+
(value) => !value.defaultSources || value.defaultSources.filter((source) => source !== "sol").join() === value.defaults.join(),
|
|
5153
|
+
{
|
|
5154
|
+
message: "List defaultSources' accounts in defaults, in the same order",
|
|
5155
|
+
path: ["defaults"]
|
|
5156
|
+
}
|
|
5157
|
+
))();
|
|
5158
|
+
var profileModerationSchema = /* @__PURE__ */ (() => z36.object({
|
|
4661
5159
|
actionId: identifier,
|
|
4662
|
-
resetName:
|
|
4663
|
-
removeAvatar:
|
|
5160
|
+
resetName: z36.boolean().default(false),
|
|
5161
|
+
removeAvatar: z36.boolean().default(false),
|
|
4664
5162
|
/** True locks the name and avatar, false unlocks them. */
|
|
4665
|
-
lock:
|
|
4666
|
-
reason:
|
|
5163
|
+
lock: z36.boolean().optional(),
|
|
5164
|
+
reason: z36.string().trim().min(1).max(1e3)
|
|
4667
5165
|
}).strict().refine(
|
|
4668
5166
|
(value) => value.resetName || value.removeAvatar || value.lock !== void 0,
|
|
4669
5167
|
"Choose an action"
|
|
4670
5168
|
))();
|
|
4671
|
-
var managedProfileSchema = /* @__PURE__ */ (() => ownProfileSchema.omit({ options: true }).extend({
|
|
5169
|
+
var managedProfileSchema = /* @__PURE__ */ (() => ownProfileSchema.omit({ options: true, nameOptions: true }).extend({
|
|
4672
5170
|
member: identifier,
|
|
4673
5171
|
lockedAt: count3.nullable(),
|
|
4674
|
-
lockedBy:
|
|
4675
|
-
lockedReason:
|
|
5172
|
+
lockedBy: z36.string().nullable(),
|
|
5173
|
+
lockedReason: z36.string().nullable(),
|
|
4676
5174
|
updatedAt: count3
|
|
4677
5175
|
}))();
|
|
4678
5176
|
var AVATAR_UPLOAD_LIMIT = 5 * 1024 * 1024;
|
|
4679
5177
|
var avatarUploadTypes = ["image/jpeg", "image/png", "image/webp"];
|
|
4680
5178
|
|
|
4681
5179
|
// src/leaderboards.ts
|
|
4682
|
-
import * as
|
|
4683
|
-
var integer = /* @__PURE__ */ (() =>
|
|
5180
|
+
import * as z37 from "zod";
|
|
5181
|
+
var integer = /* @__PURE__ */ (() => z37.number().int().safe())();
|
|
4684
5182
|
var timestamp6 = /* @__PURE__ */ (() => integer.nonnegative().max(864e13))();
|
|
4685
|
-
var leaderboardWindowSchema = /* @__PURE__ */ (() =>
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
5183
|
+
var leaderboardWindowSchema = /* @__PURE__ */ (() => z37.discriminatedUnion("kind", [
|
|
5184
|
+
z37.object({ kind: z37.literal("all-time") }).strict(),
|
|
5185
|
+
z37.object({ kind: z37.literal("fixed"), start: timestamp6, end: timestamp6 }).strict().refine((w) => w.end > w.start, "Window end must follow its start"),
|
|
5186
|
+
z37.object({ kind: z37.literal("rolling"), days: integer.min(1).max(3660) }).strict(),
|
|
4689
5187
|
// Not strict: boards published while a calendar window named its own `timeZone` keep reading,
|
|
4690
5188
|
// and the field drops on parse. The authoring schema refuses it.
|
|
4691
|
-
|
|
4692
|
-
kind:
|
|
5189
|
+
z37.object({
|
|
5190
|
+
kind: z37.literal("calendar"),
|
|
4693
5191
|
/** The current day, week (ISO, starting on Monday) or month of the project calendar. */
|
|
4694
5192
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
4695
5193
|
})
|
|
4696
5194
|
]))();
|
|
4697
5195
|
var periodScore = /* @__PURE__ */ (() => ({
|
|
4698
5196
|
window: leaderboardWindowSchema.default({ kind: "all-time" }),
|
|
4699
|
-
quests:
|
|
5197
|
+
quests: z37.array(identifier).min(1).max(100).optional()
|
|
4700
5198
|
}))();
|
|
4701
|
-
var scoreSchema = /* @__PURE__ */ (() =>
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
kind:
|
|
5199
|
+
var scoreSchema = /* @__PURE__ */ (() => z37.discriminatedUnion("kind", [
|
|
5200
|
+
z37.object({ kind: z37.literal("balance") }).strict(),
|
|
5201
|
+
z37.object({ kind: z37.literal("earned"), ...periodScore }).strict(),
|
|
5202
|
+
z37.object({
|
|
5203
|
+
kind: z37.literal("net"),
|
|
4706
5204
|
window: leaderboardWindowSchema.default({ kind: "all-time" })
|
|
4707
5205
|
}).strict()
|
|
4708
5206
|
]).default({ kind: "balance" }))();
|
|
4709
|
-
var leaderboardPrizeRewardSchema = /* @__PURE__ */ (() =>
|
|
5207
|
+
var leaderboardPrizeRewardSchema = /* @__PURE__ */ (() => z37.union([
|
|
4710
5208
|
pointsRewardSchema,
|
|
4711
5209
|
tierRewardSchema
|
|
4712
5210
|
]))();
|
|
4713
|
-
var leaderboardPrizeSchema = /* @__PURE__ */ (() =>
|
|
4714
|
-
ranks:
|
|
5211
|
+
var leaderboardPrizeSchema = /* @__PURE__ */ (() => z37.object({
|
|
5212
|
+
ranks: z37.tuple([integer.positive(), integer.positive()]).refine(([first, last]) => last >= first, {
|
|
4715
5213
|
message: "Prize rank range must end at or after it starts"
|
|
4716
5214
|
}),
|
|
4717
|
-
rewards:
|
|
5215
|
+
rewards: z37.array(leaderboardPrizeRewardSchema).min(1).max(20)
|
|
4718
5216
|
}).strict())();
|
|
4719
|
-
var baseUnitsSchema = /* @__PURE__ */ (() =>
|
|
5217
|
+
var baseUnitsSchema = /* @__PURE__ */ (() => z37.string().regex(
|
|
4720
5218
|
/^(0|[1-9]\d{0,77})$/,
|
|
4721
5219
|
'Use a whole number of base units, such as "1000000"'
|
|
4722
5220
|
))();
|
|
4723
|
-
var leaderboardPoolUnitSchema = /* @__PURE__ */ (() =>
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
code:
|
|
5221
|
+
var leaderboardPoolUnitSchema = /* @__PURE__ */ (() => z37.union([
|
|
5222
|
+
z37.literal("points"),
|
|
5223
|
+
z37.object({
|
|
5224
|
+
code: z37.string().trim().min(1).max(32),
|
|
4727
5225
|
decimals: integer.min(0).max(36)
|
|
4728
5226
|
}).strict()
|
|
4729
5227
|
]))();
|
|
@@ -4765,12 +5263,12 @@ var refinePool = (pool, context) => {
|
|
|
4765
5263
|
});
|
|
4766
5264
|
}
|
|
4767
5265
|
};
|
|
4768
|
-
var leaderboardPoolSchema = /* @__PURE__ */ (() =>
|
|
4769
|
-
var leaderboardSettlementPolicySchema = /* @__PURE__ */ (() =>
|
|
4770
|
-
at:
|
|
4771
|
-
ties:
|
|
5266
|
+
var leaderboardPoolSchema = /* @__PURE__ */ (() => z37.object(poolShape).strict().superRefine(refinePool))();
|
|
5267
|
+
var leaderboardSettlementPolicySchema = /* @__PURE__ */ (() => z37.object({
|
|
5268
|
+
at: z37.literal("window-end"),
|
|
5269
|
+
ties: z37.enum(["shared", "earliest"]),
|
|
4772
5270
|
/** Rank prizes. A board with a pool may list none. */
|
|
4773
|
-
prizes:
|
|
5271
|
+
prizes: z37.array(leaderboardPrizeSchema).max(50),
|
|
4774
5272
|
pool: leaderboardPoolSchema.optional()
|
|
4775
5273
|
}).strict().superRefine((policy, context) => {
|
|
4776
5274
|
if (!policy.prizes.length && !policy.pool) {
|
|
@@ -4802,10 +5300,10 @@ var leaderboardSettlementPolicySchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4802
5300
|
}
|
|
4803
5301
|
}
|
|
4804
5302
|
}))();
|
|
4805
|
-
var leaderboardDefinitionObject = /* @__PURE__ */ (() =>
|
|
5303
|
+
var leaderboardDefinitionObject = /* @__PURE__ */ (() => z37.object({
|
|
4806
5304
|
id: identifier,
|
|
4807
5305
|
key: identifier.optional(),
|
|
4808
|
-
title:
|
|
5306
|
+
title: z37.string().trim().min(1).max(120),
|
|
4809
5307
|
/**
|
|
4810
5308
|
* The point ledger the leaderboard ranks members by. Named `balance` from before ledger fields
|
|
4811
5309
|
* were named `ledger` (docs/management-api.md#field-names); a points pool's `ledger` is the
|
|
@@ -4813,20 +5311,20 @@ var leaderboardDefinitionObject = /* @__PURE__ */ (() => z35.object({
|
|
|
4813
5311
|
*/
|
|
4814
5312
|
balance: identifier,
|
|
4815
5313
|
score: scoreSchema,
|
|
4816
|
-
access:
|
|
5314
|
+
access: z37.enum(["participants", "public"]).default("participants"),
|
|
4817
5315
|
group: identifier.optional(),
|
|
4818
5316
|
/**
|
|
4819
5317
|
* List the project's eligible members who have no qualifying points, with a score of 0, ranked
|
|
4820
5318
|
* after every member who scored and ordered by member ID. Omitted or false lists only members
|
|
4821
5319
|
* with a qualifying entry. Settlements never include them.
|
|
4822
5320
|
*/
|
|
4823
|
-
includeUnscored:
|
|
5321
|
+
includeUnscored: z37.boolean().optional(),
|
|
4824
5322
|
/**
|
|
4825
5323
|
* How the live standings order equal scores. Omitted or `"shared"`: they share a rank. With
|
|
4826
5324
|
* `"earliest"`, the member whose last counted entry is earlier ranks first (then member ID), and
|
|
4827
5325
|
* every scored member gets its own rank: the order `settle.ties: "earliest"` uses.
|
|
4828
5326
|
*/
|
|
4829
|
-
ties:
|
|
5327
|
+
ties: z37.enum(["shared", "earliest"]).optional(),
|
|
4830
5328
|
settle: leaderboardSettlementPolicySchema.optional()
|
|
4831
5329
|
}).strict())();
|
|
4832
5330
|
var validateSettlementWindow = (definition, context) => {
|
|
@@ -4844,70 +5342,70 @@ var leaderboardDefinitionResponseSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
4844
5342
|
))();
|
|
4845
5343
|
var leaderboardAuthoringSchema = /* @__PURE__ */ (() => leaderboardDefinitionObject.omit({ id: true }).extend({
|
|
4846
5344
|
...authoringIdentityShape,
|
|
4847
|
-
score:
|
|
5345
|
+
score: z37.preprocess(refuseWindowTimeZone, scoreSchema),
|
|
4848
5346
|
group: identifier.optional()
|
|
4849
5347
|
}).strict().superRefine(validateSettlementWindow))();
|
|
4850
|
-
var leaderboardArtifactSchema = /* @__PURE__ */ (() =>
|
|
5348
|
+
var leaderboardArtifactSchema = /* @__PURE__ */ (() => z37.union([
|
|
4851
5349
|
leaderboardAuthoringSchema,
|
|
4852
|
-
|
|
5350
|
+
z37.object({ code: z37.string().min(1).max(2e6) }).strict()
|
|
4853
5351
|
]))();
|
|
4854
|
-
var publishedLeaderboardSchema = /* @__PURE__ */ (() =>
|
|
4855
|
-
archivedAt:
|
|
5352
|
+
var publishedLeaderboardSchema = /* @__PURE__ */ (() => z37.object({
|
|
5353
|
+
archivedAt: z37.number().int().nonnegative().nullable().optional(),
|
|
4856
5354
|
version: identifier,
|
|
4857
5355
|
definition: leaderboardDefinitionResponseSchema,
|
|
4858
5356
|
publishedAt: timestamp6,
|
|
4859
|
-
actor:
|
|
5357
|
+
actor: z37.string().nullable()
|
|
4860
5358
|
}))();
|
|
4861
|
-
var leaderboardQuerySchema = /* @__PURE__ */ (() =>
|
|
4862
|
-
limit:
|
|
4863
|
-
cursor:
|
|
5359
|
+
var leaderboardQuerySchema = /* @__PURE__ */ (() => z37.object({
|
|
5360
|
+
limit: z37.coerce.number().int().min(1).max(100).default(25),
|
|
5361
|
+
cursor: z37.string().max(4096).optional()
|
|
4864
5362
|
}).strict())();
|
|
4865
|
-
var leaderboardRowSchema = /* @__PURE__ */ (() =>
|
|
5363
|
+
var leaderboardRowSchema = /* @__PURE__ */ (() => z37.object({
|
|
4866
5364
|
/** The row's stable key: a pseudonym per board and member. */
|
|
4867
5365
|
participant: identifier,
|
|
4868
5366
|
member: identifier.optional(),
|
|
4869
5367
|
/** The profile's name where the viewer can see it, otherwise the pseudonym's. */
|
|
4870
|
-
name:
|
|
5368
|
+
name: z37.string(),
|
|
4871
5369
|
score: integer,
|
|
4872
5370
|
rank: integer.positive(),
|
|
4873
5371
|
/** The member's profile, where visible to this viewer and not hidden by the member. */
|
|
4874
5372
|
profile: profileSummarySchema.nullable()
|
|
4875
5373
|
}))();
|
|
4876
|
-
var leaderboardPageSchema = /* @__PURE__ */ (() =>
|
|
5374
|
+
var leaderboardPageSchema = /* @__PURE__ */ (() => z37.object({
|
|
4877
5375
|
leaderboard: identifier,
|
|
4878
|
-
title:
|
|
5376
|
+
title: z37.string(),
|
|
4879
5377
|
version: identifier,
|
|
4880
|
-
calculation:
|
|
4881
|
-
period:
|
|
5378
|
+
calculation: z37.enum(["balance", "earned", "net"]),
|
|
5379
|
+
period: z37.object({ start: timestamp6.nullable(), end: timestamp6.nullable() }),
|
|
4882
5380
|
calculatedAt: timestamp6,
|
|
4883
5381
|
lastEntryAt: timestamp6.nullable(),
|
|
4884
5382
|
total: integer.nonnegative(),
|
|
4885
|
-
items:
|
|
5383
|
+
items: z37.array(leaderboardRowSchema),
|
|
4886
5384
|
me: leaderboardRowSchema.nullable(),
|
|
4887
|
-
nearby:
|
|
4888
|
-
nextCursor:
|
|
5385
|
+
nearby: z37.array(leaderboardRowSchema),
|
|
5386
|
+
nextCursor: z37.string().nullable()
|
|
4889
5387
|
}))();
|
|
4890
|
-
var leaderboardPlacementSchema = /* @__PURE__ */ (() =>
|
|
5388
|
+
var leaderboardPlacementSchema = /* @__PURE__ */ (() => z37.object({
|
|
4891
5389
|
leaderboard: identifier,
|
|
4892
5390
|
key: identifier.optional(),
|
|
4893
|
-
title:
|
|
5391
|
+
title: z37.string(),
|
|
4894
5392
|
profile: identifier,
|
|
4895
5393
|
rank: integer.positive().nullable(),
|
|
4896
5394
|
score: integer.nullable(),
|
|
4897
5395
|
/** Ranked participants on the board. */
|
|
4898
5396
|
total: integer.nonnegative()
|
|
4899
5397
|
}))();
|
|
4900
|
-
var leaderboardHistoryQuerySchema = /* @__PURE__ */ (() =>
|
|
5398
|
+
var leaderboardHistoryQuerySchema = /* @__PURE__ */ (() => z37.strictObject({
|
|
4901
5399
|
board: identifier,
|
|
4902
5400
|
cursor: pageCursorSchema.optional()
|
|
4903
5401
|
}))();
|
|
4904
|
-
var leaderboardHistoryPageSchema = /* @__PURE__ */ (() =>
|
|
5402
|
+
var leaderboardHistoryPageSchema = /* @__PURE__ */ (() => z37.object({
|
|
4905
5403
|
leaderboard: identifier,
|
|
4906
|
-
period:
|
|
4907
|
-
items:
|
|
5404
|
+
period: z37.object({ start: timestamp6.nullable(), end: timestamp6.nullable() }),
|
|
5405
|
+
items: z37.array(pointEntrySchema),
|
|
4908
5406
|
nextCursor: pageCursorSchema.nullable()
|
|
4909
5407
|
}))();
|
|
4910
|
-
var leaderboardPreviewSchema = /* @__PURE__ */ (() =>
|
|
5408
|
+
var leaderboardPreviewSchema = /* @__PURE__ */ (() => z37.object({
|
|
4911
5409
|
published: publishedLeaderboardSchema,
|
|
4912
5410
|
before: leaderboardPageSchema.nullable(),
|
|
4913
5411
|
after: leaderboardPageSchema
|
|
@@ -4916,53 +5414,53 @@ var mutationBase = /* @__PURE__ */ (() => ({
|
|
|
4916
5414
|
actionId: identifier,
|
|
4917
5415
|
member: identifier,
|
|
4918
5416
|
balance: identifier,
|
|
4919
|
-
reason:
|
|
5417
|
+
reason: z37.string().trim().min(1).max(1e3)
|
|
4920
5418
|
}))();
|
|
4921
5419
|
var datedMutation = /* @__PURE__ */ (() => ({ ...mutationBase, effectiveAt: timestamp6.optional() }))();
|
|
4922
|
-
var pointsMutationSchema = /* @__PURE__ */ (() =>
|
|
4923
|
-
|
|
5420
|
+
var pointsMutationSchema = /* @__PURE__ */ (() => z37.discriminatedUnion("kind", [
|
|
5421
|
+
z37.object({
|
|
4924
5422
|
...datedMutation,
|
|
4925
|
-
kind:
|
|
4926
|
-
referralEligible:
|
|
5423
|
+
kind: z37.literal("award"),
|
|
5424
|
+
referralEligible: z37.boolean().optional(),
|
|
4927
5425
|
amount: integer.positive()
|
|
4928
5426
|
}).strict(),
|
|
4929
|
-
|
|
5427
|
+
z37.object({
|
|
4930
5428
|
...datedMutation,
|
|
4931
|
-
kind:
|
|
5429
|
+
kind: z37.literal("spend"),
|
|
4932
5430
|
amount: integer.positive()
|
|
4933
5431
|
}).strict(),
|
|
4934
|
-
|
|
5432
|
+
z37.object({
|
|
4935
5433
|
...datedMutation,
|
|
4936
|
-
kind:
|
|
5434
|
+
kind: z37.literal("adjust"),
|
|
4937
5435
|
amount: integer.refine((n) => n !== 0)
|
|
4938
5436
|
}).strict(),
|
|
4939
|
-
|
|
5437
|
+
z37.object({
|
|
4940
5438
|
...datedMutation,
|
|
4941
|
-
kind:
|
|
5439
|
+
kind: z37.literal("set"),
|
|
4942
5440
|
total: integer.nonnegative(),
|
|
4943
5441
|
expectedTotal: integer.nonnegative(),
|
|
4944
|
-
classification:
|
|
5442
|
+
classification: z37.enum(["earned", "spend"])
|
|
4945
5443
|
}).strict(),
|
|
4946
|
-
|
|
5444
|
+
z37.object({
|
|
4947
5445
|
...mutationBase,
|
|
4948
|
-
kind:
|
|
5446
|
+
kind: z37.literal("reverse"),
|
|
4949
5447
|
entry: identifier,
|
|
4950
5448
|
amount: integer.positive()
|
|
4951
5449
|
}).strict()
|
|
4952
5450
|
]))();
|
|
4953
|
-
var pointsEntrySchema = /* @__PURE__ */ (() =>
|
|
5451
|
+
var pointsEntrySchema = /* @__PURE__ */ (() => z37.object({
|
|
4954
5452
|
id: identifier,
|
|
4955
|
-
completion:
|
|
5453
|
+
completion: z37.string().nullable(),
|
|
4956
5454
|
member: identifier,
|
|
4957
5455
|
balance: identifier,
|
|
4958
5456
|
amount: integer,
|
|
4959
|
-
kind:
|
|
5457
|
+
kind: z37.enum(["award", "spend", "adjust", "reverse"]),
|
|
4960
5458
|
effectiveAt: timestamp6,
|
|
4961
5459
|
receivedAt: timestamp6,
|
|
4962
5460
|
quest: identifier.nullable(),
|
|
4963
5461
|
original: identifier.nullable(),
|
|
4964
|
-
reason:
|
|
4965
|
-
actor:
|
|
5462
|
+
reason: z37.string(),
|
|
5463
|
+
actor: z37.string().nullable(),
|
|
4966
5464
|
/**
|
|
4967
5465
|
* The member import whose opening balance this `adjust` is, or null. Imported entries emit no
|
|
4968
5466
|
* `points.awarded` and count on balance leaderboards only. Absent from Relay versions without
|
|
@@ -4970,103 +5468,116 @@ var pointsEntrySchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4970
5468
|
*/
|
|
4971
5469
|
import: identifier.nullable().optional()
|
|
4972
5470
|
}))();
|
|
4973
|
-
var managedPointHistoryPageSchema = /* @__PURE__ */ (() =>
|
|
4974
|
-
items:
|
|
5471
|
+
var managedPointHistoryPageSchema = /* @__PURE__ */ (() => z37.object({
|
|
5472
|
+
items: z37.array(pointsEntrySchema),
|
|
4975
5473
|
nextCursor: pageCursorSchema.nullable(),
|
|
4976
5474
|
/** @deprecated Use `nextCursor`, passed back as `cursor`. Removed in 2.0.0. */
|
|
4977
|
-
next:
|
|
5475
|
+
next: z37.number().nullable()
|
|
4978
5476
|
}))();
|
|
4979
|
-
var pointsResultSchema = /* @__PURE__ */ (() =>
|
|
5477
|
+
var pointsResultSchema = /* @__PURE__ */ (() => z37.object({
|
|
4980
5478
|
entry: pointsEntrySchema,
|
|
4981
5479
|
total: integer.nonnegative()
|
|
4982
5480
|
}))();
|
|
4983
|
-
var pointsAccountSchema = /* @__PURE__ */ (() =>
|
|
5481
|
+
var pointsAccountSchema = /* @__PURE__ */ (() => z37.object({
|
|
4984
5482
|
member: identifier,
|
|
4985
5483
|
balance: identifier,
|
|
4986
5484
|
total: integer.nonnegative(),
|
|
4987
5485
|
held: integer.nonnegative()
|
|
4988
5486
|
}))();
|
|
4989
|
-
var leaderboardExclusionSchema = /* @__PURE__ */ (() =>
|
|
5487
|
+
var leaderboardExclusionSchema = /* @__PURE__ */ (() => z37.object({
|
|
4990
5488
|
actionId: identifier,
|
|
4991
5489
|
member: identifier,
|
|
4992
|
-
excluded:
|
|
4993
|
-
reason:
|
|
5490
|
+
excluded: z37.boolean(),
|
|
5491
|
+
reason: z37.string().trim().min(1).max(1e3)
|
|
4994
5492
|
}).strict())();
|
|
4995
|
-
var leaderboardExclusionGroupSchema = /* @__PURE__ */ (() =>
|
|
5493
|
+
var leaderboardExclusionGroupSchema = /* @__PURE__ */ (() => z37.object({
|
|
4996
5494
|
leaderboard: identifier,
|
|
4997
5495
|
group: identifier,
|
|
4998
|
-
generated:
|
|
5496
|
+
generated: z37.boolean(),
|
|
4999
5497
|
boundAt: timestamp6.nullable()
|
|
5000
5498
|
}))();
|
|
5001
|
-
var leaderboardExclusionGroupBindingSchema = /* @__PURE__ */ (() =>
|
|
5499
|
+
var leaderboardExclusionGroupBindingSchema = /* @__PURE__ */ (() => z37.object({
|
|
5002
5500
|
actionId: identifier,
|
|
5003
5501
|
group: identifier,
|
|
5004
|
-
reason:
|
|
5502
|
+
reason: z37.string().trim().min(1).max(1e3)
|
|
5005
5503
|
}).strict())();
|
|
5006
|
-
var leaderboardGroupSchema = /* @__PURE__ */ (() =>
|
|
5504
|
+
var leaderboardGroupSchema = /* @__PURE__ */ (() => z37.object({
|
|
5007
5505
|
actionId: identifier,
|
|
5008
5506
|
member: identifier,
|
|
5009
|
-
included:
|
|
5010
|
-
reason:
|
|
5507
|
+
included: z37.boolean(),
|
|
5508
|
+
reason: z37.string().trim().min(1).max(1e3)
|
|
5011
5509
|
}).strict())();
|
|
5012
|
-
var leaderboardSettlementStatusSchema = /* @__PURE__ */ (() =>
|
|
5013
|
-
var leaderboardSettlementSummarySchema = /* @__PURE__ */ (() =>
|
|
5510
|
+
var leaderboardSettlementStatusSchema = /* @__PURE__ */ (() => z37.enum(["pending", "approved"]))();
|
|
5511
|
+
var leaderboardSettlementSummarySchema = /* @__PURE__ */ (() => z37.object({
|
|
5014
5512
|
id: identifier,
|
|
5015
5513
|
leaderboard: identifier,
|
|
5016
5514
|
version: identifier,
|
|
5017
|
-
title:
|
|
5018
|
-
period:
|
|
5019
|
-
ties:
|
|
5515
|
+
title: z37.string(),
|
|
5516
|
+
period: z37.object({ start: timestamp6, end: timestamp6 }),
|
|
5517
|
+
ties: z37.enum(["shared", "earliest"]),
|
|
5020
5518
|
status: leaderboardSettlementStatusSchema,
|
|
5021
5519
|
total: integer.nonnegative(),
|
|
5022
5520
|
winners: integer.nonnegative(),
|
|
5023
5521
|
createdAt: timestamp6,
|
|
5024
5522
|
approvedAt: timestamp6.nullable(),
|
|
5025
|
-
approvedBy:
|
|
5026
|
-
approvalReason:
|
|
5027
|
-
}))();
|
|
5028
|
-
var
|
|
5523
|
+
approvedBy: z37.string().nullable(),
|
|
5524
|
+
approvalReason: z37.string().nullable()
|
|
5525
|
+
}))();
|
|
5526
|
+
var settlementPaymentSchema = /* @__PURE__ */ (() => z37.object({
|
|
5527
|
+
status: z37.string(),
|
|
5528
|
+
/** The CAIP-2 cluster of the batch that pays or paid the share; null when unpaid. */
|
|
5529
|
+
network: z37.string().nullable(),
|
|
5530
|
+
/** The transaction that paid the share; null until paid. */
|
|
5531
|
+
signature: z37.string().nullable(),
|
|
5532
|
+
paidAt: timestamp6.nullable()
|
|
5533
|
+
}))();
|
|
5534
|
+
var leaderboardSettlementRowSchema = /* @__PURE__ */ (() => z37.object({
|
|
5029
5535
|
member: identifier,
|
|
5030
5536
|
score: integer,
|
|
5031
5537
|
rank: integer.positive(),
|
|
5032
5538
|
position: integer.positive(),
|
|
5033
5539
|
scoredAt: timestamp6,
|
|
5034
|
-
prizes:
|
|
5540
|
+
prizes: z37.array(integer.nonnegative()),
|
|
5035
5541
|
completion: identifier.nullable(),
|
|
5036
5542
|
revokedAt: timestamp6.nullable(),
|
|
5037
5543
|
/**
|
|
5038
5544
|
* The member's pool share in the pool's base units, frozen with the row: `"0"` for a member the
|
|
5039
5545
|
* pool leaves out. Absent when the settlement has no pool.
|
|
5040
5546
|
*/
|
|
5041
|
-
share: baseUnitsSchema.optional()
|
|
5547
|
+
share: baseUnitsSchema.optional(),
|
|
5548
|
+
/**
|
|
5549
|
+
* How the row's pool share was paid on chain, for a non-zero share in a pool whose unit is not
|
|
5550
|
+
* points. Absent otherwise, and from Relay versions without Solana payouts.
|
|
5551
|
+
*/
|
|
5552
|
+
payment: settlementPaymentSchema.optional()
|
|
5042
5553
|
}))();
|
|
5043
|
-
var leaderboardSettlementPoolSchema = /* @__PURE__ */ (() =>
|
|
5554
|
+
var leaderboardSettlementPoolSchema = /* @__PURE__ */ (() => z37.object({
|
|
5044
5555
|
...poolShape,
|
|
5045
5556
|
allocated: baseUnitsSchema,
|
|
5046
5557
|
unallocated: baseUnitsSchema
|
|
5047
5558
|
}))();
|
|
5048
|
-
var leaderboardSettlementUnmeasuredSchema = /* @__PURE__ */ (() =>
|
|
5049
|
-
content:
|
|
5559
|
+
var leaderboardSettlementUnmeasuredSchema = /* @__PURE__ */ (() => z37.object({
|
|
5560
|
+
content: z37.string(),
|
|
5050
5561
|
member: identifier,
|
|
5051
5562
|
/** When the last good measurement was observed, if Relay has one. */
|
|
5052
5563
|
observedAt: timestamp6.nullable()
|
|
5053
5564
|
}))();
|
|
5054
5565
|
var leaderboardSettlementSchema = /* @__PURE__ */ (() => leaderboardSettlementSummarySchema.extend({
|
|
5055
|
-
prizes:
|
|
5056
|
-
excluded:
|
|
5566
|
+
prizes: z37.array(leaderboardPrizeSchema),
|
|
5567
|
+
excluded: z37.array(identifier),
|
|
5057
5568
|
/**
|
|
5058
5569
|
* Content frozen at its last good measurement because its closing measurement never came; a
|
|
5059
5570
|
* reviewer can retry measurement. Relay sends it for every settlement, empty when nothing is
|
|
5060
5571
|
* missing.
|
|
5061
5572
|
*/
|
|
5062
|
-
unmeasured:
|
|
5573
|
+
unmeasured: z37.array(leaderboardSettlementUnmeasuredSchema).optional(),
|
|
5063
5574
|
/** The settlement's pool prize, or null without one. Absent from Relay versions without pools. */
|
|
5064
5575
|
pool: leaderboardSettlementPoolSchema.nullable().optional(),
|
|
5065
|
-
rows:
|
|
5576
|
+
rows: z37.array(leaderboardSettlementRowSchema)
|
|
5066
5577
|
}))();
|
|
5067
|
-
var leaderboardSettlementApprovalSchema = /* @__PURE__ */ (() =>
|
|
5578
|
+
var leaderboardSettlementApprovalSchema = /* @__PURE__ */ (() => z37.object({
|
|
5068
5579
|
actionId: identifier,
|
|
5069
|
-
reason:
|
|
5580
|
+
reason: z37.string().trim().min(1).max(500)
|
|
5070
5581
|
}).strict())();
|
|
5071
5582
|
|
|
5072
5583
|
export {
|
|
@@ -5109,6 +5620,9 @@ export {
|
|
|
5109
5620
|
youtubeShortsNamespace,
|
|
5110
5621
|
tiktokVideosNamespace,
|
|
5111
5622
|
walletBalancesNamespace,
|
|
5623
|
+
walletProgramActivityNamespace,
|
|
5624
|
+
walletNftsNamespace,
|
|
5625
|
+
walletStakeNamespace,
|
|
5112
5626
|
telegramSignInMethodsSchema,
|
|
5113
5627
|
telegramAccountConnectionSchema,
|
|
5114
5628
|
telegramInitDataSchema,
|
|
@@ -5124,17 +5638,27 @@ export {
|
|
|
5124
5638
|
telegramReactionDataSchema,
|
|
5125
5639
|
telegramMessageDataSchema,
|
|
5126
5640
|
limits,
|
|
5641
|
+
base58,
|
|
5642
|
+
base58Bytes,
|
|
5127
5643
|
solanaAddressSchema,
|
|
5128
5644
|
walletChainSchema,
|
|
5129
5645
|
cosmosNetworkSchema,
|
|
5130
5646
|
cosmosDenomSchema,
|
|
5131
5647
|
cosmosChain,
|
|
5132
5648
|
solanaMainnet,
|
|
5649
|
+
solanaDevnet,
|
|
5650
|
+
isSolanaNetwork,
|
|
5133
5651
|
evmAddressSchema,
|
|
5134
5652
|
cosmosAddressSchema,
|
|
5135
5653
|
walletAddressInputSchema,
|
|
5136
5654
|
walletMessageChallengeSchema,
|
|
5137
5655
|
walletSignatureSchema,
|
|
5656
|
+
isEvmChainId,
|
|
5657
|
+
evmChainIdSchema,
|
|
5658
|
+
solanaMemoProgram,
|
|
5659
|
+
solanaSignatureSchema,
|
|
5660
|
+
walletTransactionChallengeSchema,
|
|
5661
|
+
walletTransactionProofSchema,
|
|
5138
5662
|
linkedWalletSchema,
|
|
5139
5663
|
walletUnlinkInputSchema,
|
|
5140
5664
|
walletAddressInput,
|
|
@@ -5143,14 +5667,15 @@ export {
|
|
|
5143
5667
|
walletSignInNetworkSchema,
|
|
5144
5668
|
walletSignInNetworksSchema,
|
|
5145
5669
|
walletSignInNetwork,
|
|
5670
|
+
evmWalletOn,
|
|
5146
5671
|
caip10,
|
|
5147
|
-
isEvmChainId,
|
|
5148
|
-
evmChainIdSchema,
|
|
5149
5672
|
walletBalanceSchema,
|
|
5150
5673
|
walletBalanceSampleSchema,
|
|
5674
|
+
walletProgramActivitySchema,
|
|
5151
5675
|
parseNftCollection,
|
|
5152
5676
|
isNftCollection,
|
|
5153
5677
|
walletNftsSchema,
|
|
5678
|
+
walletNftSampleSchema,
|
|
5154
5679
|
parseContractFunction,
|
|
5155
5680
|
parseContractCall,
|
|
5156
5681
|
isContractCall,
|
|
@@ -5167,6 +5692,12 @@ export {
|
|
|
5167
5692
|
maxWalletTransactions,
|
|
5168
5693
|
maxWalletTransactionLookback,
|
|
5169
5694
|
walletTransactionsSchema,
|
|
5695
|
+
solanaTransactionFixtureInputSchema,
|
|
5696
|
+
solanaSeedSchema,
|
|
5697
|
+
maxSolanaSeeds,
|
|
5698
|
+
walletProgramAccountSchema,
|
|
5699
|
+
walletStakeSchema,
|
|
5700
|
+
walletStakeSampleSchema,
|
|
5170
5701
|
lifecycleReasonSchema,
|
|
5171
5702
|
offsetDateTimeSchema,
|
|
5172
5703
|
discordMessageSchema,
|
|
@@ -5206,6 +5737,9 @@ export {
|
|
|
5206
5737
|
xContentMetrics,
|
|
5207
5738
|
customContentSchema,
|
|
5208
5739
|
walletBalanceSourceSchema,
|
|
5740
|
+
walletProgramActivitySourceSchema,
|
|
5741
|
+
walletNftSourceSchema,
|
|
5742
|
+
walletStakeSourceSchema,
|
|
5209
5743
|
xSearchSourceSchema,
|
|
5210
5744
|
customSourceSchema,
|
|
5211
5745
|
trackerSourceSchema,
|
|
@@ -5225,6 +5759,12 @@ export {
|
|
|
5225
5759
|
trackerPropertiesSchema,
|
|
5226
5760
|
trackerCreateSchema,
|
|
5227
5761
|
managedTrackerCreateSchema,
|
|
5762
|
+
walletProgramActivityTrackerSourceSchema,
|
|
5763
|
+
programActivityTrackerCreateSchema,
|
|
5764
|
+
walletNftsTrackerSourceSchema,
|
|
5765
|
+
nftTrackerCreateSchema,
|
|
5766
|
+
walletStakeTrackerSourceSchema,
|
|
5767
|
+
stakeTrackerCreateSchema,
|
|
5228
5768
|
trackerUpdateSchema,
|
|
5229
5769
|
trackerControlSchema,
|
|
5230
5770
|
trackerAccountSchema,
|
|
@@ -5332,6 +5872,16 @@ export {
|
|
|
5332
5872
|
quizQuestionSchema,
|
|
5333
5873
|
quizQuestionsSchema,
|
|
5334
5874
|
quizContentSchema,
|
|
5875
|
+
inWindow,
|
|
5876
|
+
maxSolanaActionReference,
|
|
5877
|
+
solanaActionMemo,
|
|
5878
|
+
parseSolanaActionMemo,
|
|
5879
|
+
takesSolanaTransaction,
|
|
5880
|
+
questStationsSchema,
|
|
5881
|
+
stationRefusal,
|
|
5882
|
+
solanaSignatureSchema2,
|
|
5883
|
+
solanaTransactionSubmissionSchema,
|
|
5884
|
+
attemptActionSchema,
|
|
5335
5885
|
resourceSourceSchema,
|
|
5336
5886
|
resourceRequestSchema,
|
|
5337
5887
|
resourceOptionsSchema,
|
|
@@ -5491,6 +6041,9 @@ export {
|
|
|
5491
6041
|
avatarProviderSchema,
|
|
5492
6042
|
profileDefaultProviderSchema,
|
|
5493
6043
|
profileDefaultsSchema,
|
|
6044
|
+
knownProfileDefaultSources,
|
|
6045
|
+
profileDefaultSourcesSchema,
|
|
6046
|
+
profileNameSourceSchema,
|
|
5494
6047
|
avatarSeedSchema,
|
|
5495
6048
|
profileAvatarSchema,
|
|
5496
6049
|
profileSummarySchema,
|
|
@@ -5537,6 +6090,7 @@ export {
|
|
|
5537
6090
|
leaderboardGroupSchema,
|
|
5538
6091
|
leaderboardSettlementStatusSchema,
|
|
5539
6092
|
leaderboardSettlementSummarySchema,
|
|
6093
|
+
settlementPaymentSchema,
|
|
5540
6094
|
leaderboardSettlementRowSchema,
|
|
5541
6095
|
leaderboardSettlementPoolSchema,
|
|
5542
6096
|
leaderboardSettlementUnmeasuredSchema,
|