@domino-sdk/relay 1.72.0 → 1.74.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 +25 -0
- package/dist/{accounts-COLmXRbW.d.ts → accounts-C9as33l1.d.ts} +2 -2
- package/dist/{attempt-captures-CVl161qB.d.ts → attempt-captures-DU4vi20Y.d.ts} +2 -2
- package/dist/authoring.d.ts +103 -106
- package/dist/authoring.js +187 -286
- package/dist/{automatic-outcomes-5l68PGr1.d.ts → automatic-outcomes-D0yMHSHL.d.ts} +2 -2
- package/dist/browser.d.ts +9 -9
- package/dist/browser.js +11 -11
- package/dist/{dashboards-DXpjHnq-.d.ts → capability-error-Bn6cCqof.d.ts} +298 -5
- package/dist/{catalog-BR3g-1H9.d.ts → catalog-9I6t18qP.d.ts} +2 -2
- package/dist/{chunk-W6DBNBMT.js → chunk-2LURSPDM.js} +232 -232
- package/dist/{chunk-VNEJH4NT.js → chunk-2M5FM7FW.js} +21 -0
- package/dist/{chunk-74SMLZZ5.js → chunk-6TDHRGBM.js} +1522 -1278
- package/dist/{chunk-QG6XVOOO.js → chunk-724CKAC7.js} +4 -4
- package/dist/{chunk-I7XIBXT2.js → chunk-7I7P5UVC.js} +3 -3
- package/dist/{chunk-LDO5GP7G.js → chunk-AL5XMXPO.js} +1 -1
- package/dist/{chunk-TW4RABVS.js → chunk-CW7FJ5PX.js} +1 -1
- package/dist/{chunk-BXUF3CRL.js → chunk-DNOLNMCW.js} +9 -9
- package/dist/{chunk-5RLIPTL7.js → chunk-E73HZCG2.js} +1 -1
- package/dist/{chunk-UEVZ3TST.js → chunk-ELHMJODS.js} +1 -1
- package/dist/{chunk-ASBDB436.js → chunk-F66GGNKD.js} +1 -1
- package/dist/{chunk-ETGKC2SB.js → chunk-HCOLMJFX.js} +2 -2
- package/dist/chunk-JZT2NLSG.js +7201 -0
- package/dist/{chunk-FGZGL5PG.js → chunk-KGZ7SRKJ.js} +2 -2
- package/dist/{chunk-3KKRXN5E.js → chunk-KP55TMCC.js} +1 -1
- package/dist/chunk-NI6XRGEL.js +374 -0
- package/dist/{chunk-VFHLMNYV.js → chunk-RALBAKKX.js} +1 -1
- package/dist/chunk-SVZ3QWHT.js +142 -0
- package/dist/{chunk-CVJTIVAP.js → chunk-T4PTFCSB.js} +2 -2
- package/dist/{chunk-KIRXE37T.js → chunk-TGQNNMCY.js} +6 -6
- package/dist/{client-B__hMWtK.d.ts → client-B2aVGf38.d.ts} +7 -7
- package/dist/{deployments-CT2kQloT.d.ts → deployments-CGV1rIZm.d.ts} +107 -107
- package/dist/{identity-integration-ClX4oUAu.d.ts → identity-integration-C03rUYc0.d.ts} +3 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/internal.d.ts +36197 -18
- package/dist/internal.js +518 -15
- package/dist/{limits-B7wbnWhd.d.ts → limits-p-Mg0oSi.d.ts} +1 -1
- package/dist/{offers-D4pyeY9b.d.ts → offers-CnMyMeQo.d.ts} +2 -2
- package/dist/portal-proxy.d.ts +2 -2
- package/dist/portal-proxy.js +10 -10
- package/dist/react/index.d.ts +11 -11
- package/dist/react/index.js +11 -11
- package/dist/{reward-deliveries-HGpj1VFz.d.ts → reward-deliveries-zWfsgc6m.d.ts} +1 -1
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/NYEWMPJH.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/schema.d.ts +35 -60
- package/dist/schema.js +10 -8
- package/dist/server/index.d.ts +13 -13
- package/dist/server/index.js +2972 -4528
- package/dist/{sign-in-providers-lbOXCF8N.d.ts → sign-in-providers-BG22ZZkl.d.ts} +2 -2
- package/dist/solana.d.ts +13 -13
- package/dist/solana.js +9 -9
- package/dist/stake-BSVjB3BJ.d.ts +254 -0
- package/dist/{station-check-in-qBiaftfE.d.ts → station-check-in-a1deSjbm.d.ts} +5 -5
- package/dist/{submission-input-U4aIkJuT.d.ts → submission-input-DBDLkTF8.d.ts} +2 -2
- package/dist/telegram.d.ts +7 -7
- package/dist/telegram.js +2 -2
- package/dist/testing.d.ts +159 -160
- package/dist/testing.js +47 -344
- package/dist/{tracker-data-2BYXZjsN.d.ts → tracker-data-Dwq9dWEm.d.ts} +474 -221
- package/dist/{transport-DcRXDZ1j.d.ts → transport-D77Rbf4D.d.ts} +77050 -74062
- package/dist/{wallet-BqswMAqZ.d.ts → wallet-CeqgtXNm.d.ts} +2 -7
- package/dist/{wallet-browser-B5r7u3xB.d.ts → wallet-browser-Cucpqn3F.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/capability-error-db7kO8-P.d.ts +0 -297
- package/dist/chunk-2UELTHW6.js +0 -467
- package/dist/chunk-GHBYWDEZ.js +0 -94
- package/dist/chunk-HN7DE2UN.js +0 -53
- package/dist/runtime/chunks/A7G5P76B.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RelayErrorCode,
|
|
3
3
|
clientError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2M5FM7FW.js";
|
|
5
5
|
|
|
6
6
|
// src/identifier.ts
|
|
7
7
|
import * as z from "zod";
|
|
@@ -355,11 +355,6 @@ var telegramReactionsNamespace = "telegram-reactions";
|
|
|
355
355
|
var telegramMessagesNamespace = "telegram-messages";
|
|
356
356
|
var youtubeShortsNamespace = "youtube-shorts";
|
|
357
357
|
var tiktokVideosNamespace = "tiktok-videos";
|
|
358
|
-
var walletBalancesNamespace = "wallet-balances";
|
|
359
|
-
var walletProgramActivityNamespace = "wallet-program-activity";
|
|
360
|
-
var walletNftsNamespace = "wallet-nfts";
|
|
361
|
-
var walletStakeNamespace = "wallet-stake";
|
|
362
|
-
var walletProgramAccountsNamespace = "wallet-program-accounts";
|
|
363
358
|
|
|
364
359
|
// src/telegram.ts
|
|
365
360
|
import * as z6 from "zod";
|
|
@@ -1597,9 +1592,9 @@ function subset(schema, path) {
|
|
|
1597
1592
|
return kept;
|
|
1598
1593
|
}
|
|
1599
1594
|
function trackerDataSchema(schema) {
|
|
1600
|
-
let
|
|
1595
|
+
let json7;
|
|
1601
1596
|
try {
|
|
1602
|
-
|
|
1597
|
+
json7 = z9.toJSONSchema(schema, {
|
|
1603
1598
|
target: "draft-2020-12",
|
|
1604
1599
|
io: "input",
|
|
1605
1600
|
unrepresentable: "throw",
|
|
@@ -1627,7 +1622,7 @@ function trackerDataSchema(schema) {
|
|
|
1627
1622
|
);
|
|
1628
1623
|
}
|
|
1629
1624
|
const parsed = trackerDataSchemaSchema.safeParse(
|
|
1630
|
-
subset(singleTypes(
|
|
1625
|
+
subset(singleTypes(json7), "data")
|
|
1631
1626
|
);
|
|
1632
1627
|
if (!parsed.success) {
|
|
1633
1628
|
throw new Error(
|
|
@@ -1775,26 +1770,26 @@ function matches(schema, value, at, budget) {
|
|
|
1775
1770
|
}
|
|
1776
1771
|
}
|
|
1777
1772
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
1778
|
-
const
|
|
1773
|
+
const object31 = value;
|
|
1779
1774
|
const properties = schema.properties ?? {};
|
|
1780
1775
|
const required = schema.required ?? [];
|
|
1781
1776
|
charge(budget, required.length);
|
|
1782
1777
|
for (const key of required) {
|
|
1783
|
-
if (!Object.hasOwn(
|
|
1778
|
+
if (!Object.hasOwn(object31, key)) {
|
|
1784
1779
|
return issue(() => `missing required key "${clip(key, maxKeyText)}"`);
|
|
1785
1780
|
}
|
|
1786
1781
|
}
|
|
1787
1782
|
const literals = literalsOf(schema);
|
|
1788
1783
|
charge(budget, literals.length);
|
|
1789
1784
|
for (const [key, property] of literals) {
|
|
1790
|
-
if (Object.hasOwn(
|
|
1785
|
+
if (Object.hasOwn(object31, key) && object31[key] !== property.const) {
|
|
1791
1786
|
return {
|
|
1792
1787
|
at: { parent: at, key },
|
|
1793
1788
|
reason: () => `expected ${JSON.stringify(property.const)}`
|
|
1794
1789
|
};
|
|
1795
1790
|
}
|
|
1796
1791
|
}
|
|
1797
|
-
const keys = Object.keys(
|
|
1792
|
+
const keys = Object.keys(object31);
|
|
1798
1793
|
charge(budget, keys.length);
|
|
1799
1794
|
const names = schema.propertyNames?.enum;
|
|
1800
1795
|
const allowed = names && setOf(schema.propertyNames, names);
|
|
@@ -1815,7 +1810,7 @@ function matches(schema, value, at, budget) {
|
|
|
1815
1810
|
if (property && property !== true) {
|
|
1816
1811
|
const found = matches(
|
|
1817
1812
|
property,
|
|
1818
|
-
|
|
1813
|
+
object31[key],
|
|
1819
1814
|
{ parent: at, key },
|
|
1820
1815
|
budget
|
|
1821
1816
|
);
|
|
@@ -1968,35 +1963,368 @@ function whereSchemaIssue(schema, where) {
|
|
|
1968
1963
|
return null;
|
|
1969
1964
|
}
|
|
1970
1965
|
|
|
1971
|
-
// src/
|
|
1966
|
+
// src/wallet-read-kinds/balances.ts
|
|
1967
|
+
import * as z11 from "zod";
|
|
1968
|
+
|
|
1969
|
+
// src/wallet-read-kinds/kind.ts
|
|
1970
|
+
import * as z10 from "zod";
|
|
1971
|
+
function walletReadKind(field, rest) {
|
|
1972
|
+
return { ...field, ...rest };
|
|
1973
|
+
}
|
|
1974
|
+
var solanaClusterSchema = /* @__PURE__ */ (() => z10.string().regex(
|
|
1975
|
+
/^solana:(?:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp|EtWTRABZaYq6iMfeYKouRu166VU2xqa1)$/,
|
|
1976
|
+
'Use "solana" or Solana devnet ("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1")'
|
|
1977
|
+
))();
|
|
1978
|
+
|
|
1979
|
+
// src/wallet-read-kinds/balances.ts
|
|
1980
|
+
var walletBalancesNamespace = "wallet-balances";
|
|
1981
|
+
var walletBalanceSourceSchema = /* @__PURE__ */ (() => z11.strictObject({
|
|
1982
|
+
chain: z11.string().regex(
|
|
1983
|
+
balanceChainPattern,
|
|
1984
|
+
'Use "solana", Solana devnet ("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"), an EVM chain such as "eip155:8453" or a Cosmos network such as "cosmos:cosmoshub-4"'
|
|
1985
|
+
),
|
|
1986
|
+
token: z11.string().min(1).max(128).nullable()
|
|
1987
|
+
}))();
|
|
1988
|
+
var walletBalancesManagedSourceSchema = /* @__PURE__ */ (() => z11.strictObject({
|
|
1989
|
+
kind: z11.literal("wallet-balances"),
|
|
1990
|
+
...walletBalanceSourceSchema.shape
|
|
1991
|
+
}))();
|
|
1992
|
+
function walletBalanceSource(query) {
|
|
1993
|
+
const { chain, token } = query;
|
|
1994
|
+
const given = token === void 0 ? null : token;
|
|
1995
|
+
if (given !== null && typeof given !== "string") {
|
|
1996
|
+
throw new Error("wallet.balances() takes the token as a string");
|
|
1997
|
+
}
|
|
1998
|
+
if (chain === "solana" || typeof chain === "string" && isSolanaNetwork(chain)) {
|
|
1999
|
+
if (given !== null && !solanaAddressSchema.safeParse(given).success) {
|
|
2000
|
+
throw new Error(
|
|
2001
|
+
"wallet.balances() on Solana takes an SPL or Token-2022 mint address (base58)"
|
|
2002
|
+
);
|
|
2003
|
+
}
|
|
2004
|
+
return { chain: chain === "solana" ? solanaMainnet : chain, token: given };
|
|
2005
|
+
}
|
|
2006
|
+
if (typeof chain === "string" && isEvmChainId(chain)) {
|
|
2007
|
+
if (given !== null && !isEvmAddress(given)) {
|
|
2008
|
+
throw new Error(
|
|
2009
|
+
"wallet.balances() on an EVM chain takes an ERC-20 contract address: 0x and 40 hex digits"
|
|
2010
|
+
);
|
|
2011
|
+
}
|
|
2012
|
+
return { chain, token: given };
|
|
2013
|
+
}
|
|
2014
|
+
if (typeof chain === "string" && /^cosmos:[-_a-zA-Z0-9]{1,32}$/.test(chain)) {
|
|
2015
|
+
if (given === null || !cosmosDenomSchema.safeParse(given).success) {
|
|
2016
|
+
throw new Error(
|
|
2017
|
+
"wallet.balances() on a Cosmos chain takes a bank denomination such as uatom"
|
|
2018
|
+
);
|
|
2019
|
+
}
|
|
2020
|
+
return { chain, token: given };
|
|
2021
|
+
}
|
|
2022
|
+
throw new Error(
|
|
2023
|
+
'wallet.balances() reads "solana", an EVM chain such as "eip155:8453" or a Cosmos network such as "cosmos:cosmoshub-4"'
|
|
2024
|
+
);
|
|
2025
|
+
}
|
|
2026
|
+
var walletBalancesField = {
|
|
2027
|
+
namespace: walletBalancesNamespace,
|
|
2028
|
+
field: "balance",
|
|
2029
|
+
source: walletBalanceSourceSchema,
|
|
2030
|
+
misplaced: "Only wallet.balances() samples a balance",
|
|
2031
|
+
stored: walletBalanceSourceSchema
|
|
2032
|
+
};
|
|
2033
|
+
var walletBalances = /* @__PURE__ */ (() => walletReadKind(walletBalancesField, {
|
|
2034
|
+
builder: "balances",
|
|
2035
|
+
sample: walletBalanceSampleSchema,
|
|
2036
|
+
management: walletBalancesManagedSourceSchema,
|
|
2037
|
+
create: "managed",
|
|
2038
|
+
limit: 5,
|
|
2039
|
+
settings: walletBalanceSource
|
|
2040
|
+
}))();
|
|
2041
|
+
|
|
2042
|
+
// src/wallet-read-kinds/program-activity.ts
|
|
1972
2043
|
import * as z12 from "zod";
|
|
2044
|
+
var walletProgramActivityNamespace = "wallet-program-activity";
|
|
2045
|
+
var minAmountNeedsMint = (activity) => activity.minAmount === null || activity.mint !== null;
|
|
2046
|
+
var walletProgramActivitySourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2047
|
+
chain: solanaClusterSchema,
|
|
2048
|
+
program: z12.string().regex(solanaAddressPattern, "Use a base58 program address"),
|
|
2049
|
+
instruction: z12.string().regex(
|
|
2050
|
+
/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,
|
|
2051
|
+
"Use the instruction's name as the program's IDL spells it"
|
|
2052
|
+
).nullable(),
|
|
2053
|
+
mint: z12.string().regex(solanaAddressPattern, "Use a base58 SPL mint address").nullable(),
|
|
2054
|
+
minAmount: z12.string().regex(/^[1-9][0-9]{0,77}$/, "Use a positive whole number of base units").nullable(),
|
|
2055
|
+
anySigner: z12.boolean()
|
|
2056
|
+
}).refine(minAmountNeedsMint, "minAmount needs a mint"))();
|
|
2057
|
+
var walletProgramActivityTrackerSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2058
|
+
kind: z12.literal("wallet-program-activity"),
|
|
2059
|
+
...walletProgramActivitySourceSchema.shape
|
|
2060
|
+
}).refine(minAmountNeedsMint, "minAmount needs a mint"))();
|
|
2061
|
+
function walletProgramActivitySource(query) {
|
|
2062
|
+
const {
|
|
2063
|
+
chain = "solana",
|
|
2064
|
+
program,
|
|
2065
|
+
instruction,
|
|
2066
|
+
mint,
|
|
2067
|
+
minAmount,
|
|
2068
|
+
signer = "wallet"
|
|
2069
|
+
} = query;
|
|
2070
|
+
if (chain !== "solana" && !(typeof chain === "string" && isSolanaNetwork(chain))) {
|
|
2071
|
+
throw new Error(
|
|
2072
|
+
'wallet.programActivity() reads "solana" (mainnet) or Solana devnet, solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1'
|
|
2073
|
+
);
|
|
2074
|
+
}
|
|
2075
|
+
if (signer !== "wallet" && signer !== "any") {
|
|
2076
|
+
throw new Error('wallet.programActivity() takes signer "wallet" or "any"');
|
|
2077
|
+
}
|
|
2078
|
+
const parsed = walletProgramActivitySourceSchema.safeParse({
|
|
2079
|
+
chain: chain === "solana" ? solanaMainnet : chain,
|
|
2080
|
+
program,
|
|
2081
|
+
instruction: instruction ?? null,
|
|
2082
|
+
mint: mint ?? null,
|
|
2083
|
+
minAmount: minAmount ?? null,
|
|
2084
|
+
anySigner: signer === "any"
|
|
2085
|
+
});
|
|
2086
|
+
if (!parsed.success) {
|
|
2087
|
+
const issue = parsed.error.issues[0];
|
|
2088
|
+
throw new Error(
|
|
2089
|
+
`wallet.programActivity()${issue.path.length ? ` ${issue.path.join(".")}` : ""}: ${issue.message}`
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
return parsed.data;
|
|
2093
|
+
}
|
|
2094
|
+
var walletProgramActivityField = /* @__PURE__ */ (() => ({
|
|
2095
|
+
namespace: walletProgramActivityNamespace,
|
|
2096
|
+
field: "activity",
|
|
2097
|
+
source: walletProgramActivitySourceSchema,
|
|
2098
|
+
misplaced: "Only wallet.programActivity() records program activity",
|
|
2099
|
+
// A later Relay may add settings to program activity.
|
|
2100
|
+
stored: z12.object(walletProgramActivitySourceSchema.shape)
|
|
2101
|
+
}))();
|
|
2102
|
+
var walletProgramActivity = /* @__PURE__ */ (() => walletReadKind(
|
|
2103
|
+
walletProgramActivityField,
|
|
2104
|
+
{
|
|
2105
|
+
builder: "programActivity",
|
|
2106
|
+
sample: walletProgramActivitySchema,
|
|
2107
|
+
management: walletProgramActivityTrackerSourceSchema,
|
|
2108
|
+
create: "own",
|
|
2109
|
+
limit: 20,
|
|
2110
|
+
settings: walletProgramActivitySource
|
|
2111
|
+
}
|
|
2112
|
+
))();
|
|
2113
|
+
|
|
2114
|
+
// src/wallet-read-kinds/nfts.ts
|
|
2115
|
+
import * as z13 from "zod";
|
|
2116
|
+
var walletNftsNamespace = "wallet-nfts";
|
|
2117
|
+
var walletNftSourceSchema = /* @__PURE__ */ (() => z13.strictObject({
|
|
2118
|
+
collection: z13.string().max(200).refine(
|
|
2119
|
+
(value) => isNftCollection(value),
|
|
2120
|
+
"Use an NFT collection"
|
|
2121
|
+
)
|
|
2122
|
+
}))();
|
|
2123
|
+
var walletNftsTrackerSourceSchema = /* @__PURE__ */ (() => z13.strictObject({
|
|
2124
|
+
kind: z13.literal("wallet-nfts"),
|
|
2125
|
+
...walletNftSourceSchema.shape
|
|
2126
|
+
}))();
|
|
2127
|
+
function walletNftSource(query) {
|
|
2128
|
+
const { collection } = query;
|
|
2129
|
+
if (typeof collection !== "string" || !isNftCollection(collection)) {
|
|
2130
|
+
throw new Error(
|
|
2131
|
+
'wallet.nfts() takes an NFT collection such as "eip155:1/erc721:0x\u2026", "eip155:8453/erc1155:0x\u2026/1" or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/nft:<collection mint>"'
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2134
|
+
return { collection };
|
|
2135
|
+
}
|
|
2136
|
+
var walletNftsField = /* @__PURE__ */ (() => ({
|
|
2137
|
+
namespace: walletNftsNamespace,
|
|
2138
|
+
field: "nfts",
|
|
2139
|
+
source: walletNftSourceSchema,
|
|
2140
|
+
misplaced: "Only wallet.nfts() samples NFTs",
|
|
2141
|
+
// Read as stored: a later Relay may sample collections this SDK does not parse.
|
|
2142
|
+
stored: z13.object({ collection: z13.string() })
|
|
2143
|
+
}))();
|
|
2144
|
+
var walletNfts = /* @__PURE__ */ (() => walletReadKind(walletNftsField, {
|
|
2145
|
+
builder: "nfts",
|
|
2146
|
+
sample: walletNftSampleSchema,
|
|
2147
|
+
management: walletNftsTrackerSourceSchema,
|
|
2148
|
+
create: "own",
|
|
2149
|
+
limit: 5,
|
|
2150
|
+
settings: walletNftSource
|
|
2151
|
+
}))();
|
|
2152
|
+
|
|
2153
|
+
// src/wallet-read-kinds/stake.ts
|
|
2154
|
+
import * as z14 from "zod";
|
|
2155
|
+
var walletStakeNamespace = "wallet-stake";
|
|
2156
|
+
var walletStakeSourceSchema = /* @__PURE__ */ (() => z14.strictObject({
|
|
2157
|
+
chain: solanaClusterSchema,
|
|
2158
|
+
voteAccount: z14.string().refine(
|
|
2159
|
+
(value) => base58Bytes(value, 32) !== null,
|
|
2160
|
+
"Use a base58 vote account address"
|
|
2161
|
+
).nullable()
|
|
2162
|
+
}))();
|
|
2163
|
+
var walletStakeTrackerSourceSchema = /* @__PURE__ */ (() => z14.strictObject({
|
|
2164
|
+
kind: z14.literal("wallet-stake"),
|
|
2165
|
+
...walletStakeSourceSchema.shape
|
|
2166
|
+
}))();
|
|
2167
|
+
function walletStakeSource(query = {}) {
|
|
2168
|
+
const { chain = "solana", voteAccount } = query;
|
|
2169
|
+
const stake = walletStakeSourceSchema.safeParse({
|
|
2170
|
+
chain: chain === "solana" ? solanaMainnet : chain,
|
|
2171
|
+
voteAccount: voteAccount ?? null
|
|
2172
|
+
});
|
|
2173
|
+
if (!stake.success) {
|
|
2174
|
+
throw new Error(
|
|
2175
|
+
`wallet.stake() ${stake.error.issues[0].path.join(".")}: ${stake.error.issues[0].message}`
|
|
2176
|
+
);
|
|
2177
|
+
}
|
|
2178
|
+
return stake.data;
|
|
2179
|
+
}
|
|
2180
|
+
var walletStakeField = /* @__PURE__ */ (() => ({
|
|
2181
|
+
namespace: walletStakeNamespace,
|
|
2182
|
+
field: "stake",
|
|
2183
|
+
source: walletStakeSourceSchema,
|
|
2184
|
+
misplaced: "Only wallet.stake() samples stake",
|
|
2185
|
+
// Read as stored: a later Relay may sample clusters this SDK does not name.
|
|
2186
|
+
stored: z14.object({ chain: z14.string(), voteAccount: z14.string().nullable() })
|
|
2187
|
+
}))();
|
|
2188
|
+
var walletStake = /* @__PURE__ */ (() => walletReadKind(walletStakeField, {
|
|
2189
|
+
builder: "stake",
|
|
2190
|
+
sample: walletStakeSampleSchema,
|
|
2191
|
+
management: walletStakeTrackerSourceSchema,
|
|
2192
|
+
create: "own",
|
|
2193
|
+
limit: 5,
|
|
2194
|
+
settings: walletStakeSource
|
|
2195
|
+
}))();
|
|
2196
|
+
|
|
2197
|
+
// src/wallet-read-kinds/program-accounts.ts
|
|
2198
|
+
import * as z15 from "zod";
|
|
2199
|
+
var walletProgramAccountsNamespace = "wallet-program-accounts";
|
|
2200
|
+
var walletProgramAccountSourceSchema = /* @__PURE__ */ (() => z15.strictObject({
|
|
2201
|
+
chain: solanaClusterSchema,
|
|
2202
|
+
program: z15.string().regex(solanaAddressPattern, "Use a base58 program address"),
|
|
2203
|
+
account: z15.string().min(1).max(128),
|
|
2204
|
+
seeds: z15.array(solanaSeedSchema).min(1).max(maxSolanaSeeds).refine(
|
|
2205
|
+
(seeds) => seeds.some((seed) => typeof seed === "object" && "wallet" in seed),
|
|
2206
|
+
"Place the member's wallet in the seeds with { wallet: true }"
|
|
2207
|
+
),
|
|
2208
|
+
field: z15.string().min(1).max(128),
|
|
2209
|
+
idl: solanaProgramIdlSchema.optional()
|
|
2210
|
+
}))();
|
|
2211
|
+
var walletProgramAccountsTrackerSourceSchema = /* @__PURE__ */ (() => z15.strictObject({
|
|
2212
|
+
kind: z15.literal("wallet-program-accounts"),
|
|
2213
|
+
...walletProgramAccountSourceSchema.shape,
|
|
2214
|
+
idl: anchorIdlSchema.optional()
|
|
2215
|
+
}))();
|
|
2216
|
+
function walletProgramAccountSource(query) {
|
|
2217
|
+
const {
|
|
2218
|
+
chain = "solana",
|
|
2219
|
+
idl,
|
|
2220
|
+
...rest
|
|
2221
|
+
} = query;
|
|
2222
|
+
const programAccount = walletProgramAccountSourceSchema.safeParse({
|
|
2223
|
+
...rest,
|
|
2224
|
+
chain: chain === "solana" ? solanaMainnet : chain,
|
|
2225
|
+
...idl === void 0 ? {} : { idl: { program: rest.program, source: "pasted", idl } }
|
|
2226
|
+
});
|
|
2227
|
+
if (!programAccount.success) {
|
|
2228
|
+
throw new Error(
|
|
2229
|
+
`wallet.programAccounts() ${programAccount.error.issues[0].path.join(".")}: ${programAccount.error.issues[0].message}`
|
|
2230
|
+
);
|
|
2231
|
+
}
|
|
2232
|
+
return programAccount.data;
|
|
2233
|
+
}
|
|
2234
|
+
var walletProgramAccountsField = /* @__PURE__ */ (() => ({
|
|
2235
|
+
namespace: walletProgramAccountsNamespace,
|
|
2236
|
+
field: "programAccount",
|
|
2237
|
+
source: walletProgramAccountSourceSchema,
|
|
2238
|
+
misplaced: "Only wallet.programAccounts() samples program accounts",
|
|
2239
|
+
// Read as stored: a later Relay may sample clusters, seeds or IDLs this SDK does not parse.
|
|
2240
|
+
stored: z15.object({
|
|
2241
|
+
chain: z15.string(),
|
|
2242
|
+
program: z15.string(),
|
|
2243
|
+
account: z15.string(),
|
|
2244
|
+
seeds: z15.array(z15.json()),
|
|
2245
|
+
field: z15.string(),
|
|
2246
|
+
idl: z15.object({ program: z15.string(), source: z15.string(), idl: z15.json() }).optional()
|
|
2247
|
+
})
|
|
2248
|
+
}))();
|
|
2249
|
+
var walletProgramAccounts = /* @__PURE__ */ (() => walletReadKind(
|
|
2250
|
+
walletProgramAccountsField,
|
|
2251
|
+
{
|
|
2252
|
+
builder: "programAccounts",
|
|
2253
|
+
sample: walletProgramAccountSampleSchema,
|
|
2254
|
+
management: walletProgramAccountsTrackerSourceSchema,
|
|
2255
|
+
create: "own",
|
|
2256
|
+
// The management API takes a pasted IDL; one fetched from chain is fetched again on publication.
|
|
2257
|
+
managementSettings: ({
|
|
2258
|
+
idl,
|
|
2259
|
+
...programAccount
|
|
2260
|
+
}) => ({
|
|
2261
|
+
...programAccount,
|
|
2262
|
+
...idl?.source === "pasted" ? { idl: idl.idl } : {}
|
|
2263
|
+
}),
|
|
2264
|
+
limit: 10,
|
|
2265
|
+
settings: walletProgramAccountSource
|
|
2266
|
+
}
|
|
2267
|
+
))();
|
|
2268
|
+
|
|
2269
|
+
// src/trackers.ts
|
|
2270
|
+
import * as z18 from "zod";
|
|
1973
2271
|
|
|
1974
2272
|
// src/lifecycle-reason.ts
|
|
1975
|
-
import * as
|
|
1976
|
-
var lifecycleReasonSchema = /* @__PURE__ */ (() =>
|
|
2273
|
+
import * as z16 from "zod";
|
|
2274
|
+
var lifecycleReasonSchema = /* @__PURE__ */ (() => z16.string().trim().min(1).max(500))();
|
|
1977
2275
|
|
|
1978
2276
|
// src/offset-date-time.ts
|
|
1979
|
-
import * as
|
|
2277
|
+
import * as z17 from "zod";
|
|
1980
2278
|
var offsetDateTime = /^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/;
|
|
1981
2279
|
function offsetDateTimeSchema() {
|
|
1982
|
-
return
|
|
2280
|
+
return z17.iso.datetime({ offset: true, pattern: offsetDateTime });
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
// src/wallet-read-kinds/index.ts
|
|
2284
|
+
var walletReadKinds = [
|
|
2285
|
+
walletBalances,
|
|
2286
|
+
walletProgramActivity,
|
|
2287
|
+
walletNfts,
|
|
2288
|
+
walletStake,
|
|
2289
|
+
walletProgramAccounts
|
|
2290
|
+
];
|
|
2291
|
+
var walletReadFieldList = [
|
|
2292
|
+
walletBalancesField,
|
|
2293
|
+
walletProgramActivityField,
|
|
2294
|
+
walletNftsField,
|
|
2295
|
+
walletStakeField,
|
|
2296
|
+
walletProgramAccountsField
|
|
2297
|
+
];
|
|
2298
|
+
function walletReadFields(part) {
|
|
2299
|
+
return Object.fromEntries(
|
|
2300
|
+
walletReadFieldList.map((kind) => [kind.field, kind[part].optional()])
|
|
2301
|
+
);
|
|
2302
|
+
}
|
|
2303
|
+
function refuseMisplacedWalletReads(schema) {
|
|
2304
|
+
return walletReadFieldList.reduce(
|
|
2305
|
+
(refined, kind) => refined.refine(
|
|
2306
|
+
(source) => source[kind.field] === void 0 || source.namespace === kind.namespace,
|
|
2307
|
+
kind.misplaced
|
|
2308
|
+
),
|
|
2309
|
+
schema
|
|
2310
|
+
);
|
|
1983
2311
|
}
|
|
1984
2312
|
|
|
1985
2313
|
// src/trackers.ts
|
|
1986
|
-
var timestamp = /* @__PURE__ */ (() =>
|
|
1987
|
-
var count = /* @__PURE__ */ (() =>
|
|
1988
|
-
var externalId = /* @__PURE__ */ (() =>
|
|
2314
|
+
var timestamp = /* @__PURE__ */ (() => z18.number().int().safe().nonnegative().max(864e13))();
|
|
2315
|
+
var count = /* @__PURE__ */ (() => z18.number().int().safe().nonnegative())();
|
|
2316
|
+
var externalId = /* @__PURE__ */ (() => z18.string().min(1).max(256))();
|
|
1989
2317
|
var metric = /* @__PURE__ */ (() => count.nullable().default(null))();
|
|
1990
|
-
var xTweetSchema = /* @__PURE__ */ (() =>
|
|
2318
|
+
var xTweetSchema = /* @__PURE__ */ (() => z18.looseObject({
|
|
1991
2319
|
id: externalId,
|
|
1992
2320
|
userId: externalId,
|
|
1993
|
-
content:
|
|
2321
|
+
content: z18.string(),
|
|
1994
2322
|
createdAt: offsetDateTimeSchema(),
|
|
1995
|
-
author:
|
|
2323
|
+
author: z18.looseObject({
|
|
1996
2324
|
id: externalId,
|
|
1997
|
-
username:
|
|
1998
|
-
name:
|
|
1999
|
-
verified:
|
|
2325
|
+
username: z18.string(),
|
|
2326
|
+
name: z18.string(),
|
|
2327
|
+
verified: z18.boolean().nullable().default(null)
|
|
2000
2328
|
}),
|
|
2001
2329
|
likeCount: metric,
|
|
2002
2330
|
replyCount: metric,
|
|
@@ -2004,84 +2332,84 @@ var xTweetSchema = /* @__PURE__ */ (() => z12.looseObject({
|
|
|
2004
2332
|
quoteCount: metric,
|
|
2005
2333
|
viewCount: metric,
|
|
2006
2334
|
bookmarkCount: metric,
|
|
2007
|
-
isReply:
|
|
2008
|
-
isRetweet:
|
|
2009
|
-
isQuoteTweet:
|
|
2010
|
-
}))();
|
|
2011
|
-
var xContentBodySchema = /* @__PURE__ */ (() =>
|
|
2012
|
-
version:
|
|
2013
|
-
id:
|
|
2014
|
-
authorId:
|
|
2335
|
+
isReply: z18.boolean(),
|
|
2336
|
+
isRetweet: z18.boolean(),
|
|
2337
|
+
isQuoteTweet: z18.boolean()
|
|
2338
|
+
}))();
|
|
2339
|
+
var xContentBodySchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2340
|
+
version: z18.literal(1),
|
|
2341
|
+
id: z18.string().min(1),
|
|
2342
|
+
authorId: z18.string().min(1),
|
|
2015
2343
|
publishedAt: timestamp,
|
|
2016
|
-
text:
|
|
2017
|
-
isReply:
|
|
2018
|
-
isRetweet:
|
|
2019
|
-
isQuoteTweet:
|
|
2020
|
-
media:
|
|
2021
|
-
mentionedAuthorIds:
|
|
2022
|
-
videoLengthSeconds:
|
|
2023
|
-
references:
|
|
2024
|
-
replyId:
|
|
2025
|
-
replyAuthorId:
|
|
2026
|
-
quoteId:
|
|
2027
|
-
quoteAuthorId:
|
|
2028
|
-
repostId:
|
|
2029
|
-
repostAuthorId:
|
|
2344
|
+
text: z18.string(),
|
|
2345
|
+
isReply: z18.boolean(),
|
|
2346
|
+
isRetweet: z18.boolean(),
|
|
2347
|
+
isQuoteTweet: z18.boolean(),
|
|
2348
|
+
media: z18.array(z18.strictObject({ type: z18.string(), url: z18.string() })).nullable(),
|
|
2349
|
+
mentionedAuthorIds: z18.array(z18.string().min(1)).nullable(),
|
|
2350
|
+
videoLengthSeconds: z18.number().nonnegative().nullable(),
|
|
2351
|
+
references: z18.strictObject({
|
|
2352
|
+
replyId: z18.string().nullable(),
|
|
2353
|
+
replyAuthorId: z18.string().nullable(),
|
|
2354
|
+
quoteId: z18.string().nullable(),
|
|
2355
|
+
quoteAuthorId: z18.string().nullable(),
|
|
2356
|
+
repostId: z18.string().nullable(),
|
|
2357
|
+
repostAuthorId: z18.string().nullable()
|
|
2030
2358
|
})
|
|
2031
2359
|
}))();
|
|
2032
|
-
var trackerContentQuerySchema = /* @__PURE__ */ (() =>
|
|
2360
|
+
var trackerContentQuerySchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2033
2361
|
id: externalId,
|
|
2034
|
-
observation:
|
|
2362
|
+
observation: z18.string().regex(/^observation_[a-f0-9]{64}$/)
|
|
2035
2363
|
}))();
|
|
2036
2364
|
var trackerContentReadSchema = /* @__PURE__ */ (() => trackerContentQuerySchema.extend({
|
|
2037
2365
|
member: identifier
|
|
2038
2366
|
}))();
|
|
2039
2367
|
var attributionContext = { member: identifier, capturedAt: timestamp };
|
|
2040
|
-
var trackerEvidenceSchema = /* @__PURE__ */ (() =>
|
|
2368
|
+
var trackerEvidenceSchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2041
2369
|
contentRevision: identifier,
|
|
2042
2370
|
observation: identifier
|
|
2043
2371
|
}))();
|
|
2044
|
-
var trackerContentSchema = /* @__PURE__ */ (() =>
|
|
2372
|
+
var trackerContentSchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2045
2373
|
tracker: identifier,
|
|
2046
|
-
source:
|
|
2374
|
+
source: z18.literal("x"),
|
|
2047
2375
|
evidence: trackerEvidenceSchema,
|
|
2048
2376
|
content: xContentBodySchema,
|
|
2049
2377
|
observedAt: timestamp,
|
|
2050
|
-
removed:
|
|
2051
|
-
attribution:
|
|
2052
|
-
|
|
2378
|
+
removed: z18.boolean(),
|
|
2379
|
+
attribution: z18.discriminatedUnion("kind", [
|
|
2380
|
+
z18.strictObject({
|
|
2053
2381
|
...attributionContext,
|
|
2054
|
-
kind:
|
|
2055
|
-
account:
|
|
2056
|
-
provider:
|
|
2057
|
-
issuer:
|
|
2382
|
+
kind: z18.literal("linked"),
|
|
2383
|
+
account: z18.strictObject({
|
|
2384
|
+
provider: z18.literal("x"),
|
|
2385
|
+
issuer: z18.string().min(1),
|
|
2058
2386
|
subject: externalId,
|
|
2059
2387
|
revision: count,
|
|
2060
2388
|
linkedAt: timestamp.nullable()
|
|
2061
2389
|
})
|
|
2062
2390
|
}),
|
|
2063
|
-
|
|
2064
|
-
|
|
2391
|
+
z18.strictObject({ ...attributionContext, kind: z18.literal("unlinked") }),
|
|
2392
|
+
z18.strictObject({
|
|
2065
2393
|
...attributionContext,
|
|
2066
|
-
kind:
|
|
2394
|
+
kind: z18.literal("different-author")
|
|
2067
2395
|
})
|
|
2068
2396
|
])
|
|
2069
2397
|
}))();
|
|
2070
2398
|
var knownIdentityKinds = ["wallet", "x", "discord", "member"];
|
|
2071
|
-
var appIdentityKindSchema = /* @__PURE__ */ (() =>
|
|
2399
|
+
var appIdentityKindSchema = /* @__PURE__ */ (() => z18.templateLiteral([
|
|
2072
2400
|
"app:",
|
|
2073
|
-
|
|
2401
|
+
z18.string().regex(
|
|
2074
2402
|
/^[a-z0-9][a-z0-9_-]{0,39}$/,
|
|
2075
2403
|
"Name an app identity kind like app:game: lowercase letters, digits, _ or -, at most 40"
|
|
2076
2404
|
)
|
|
2077
2405
|
]))();
|
|
2078
|
-
var identityKindSchema = /* @__PURE__ */ (() =>
|
|
2079
|
-
|
|
2406
|
+
var identityKindSchema = /* @__PURE__ */ (() => z18.union([
|
|
2407
|
+
z18.enum(knownIdentityKinds),
|
|
2080
2408
|
appIdentityKindSchema
|
|
2081
2409
|
]))();
|
|
2082
2410
|
var isAppIdentityKind = (kind) => kind.startsWith("app:");
|
|
2083
|
-
var openIdentityKindSchema = /* @__PURE__ */ (() =>
|
|
2084
|
-
var memberIdentitySchema = /* @__PURE__ */ (() =>
|
|
2411
|
+
var openIdentityKindSchema = /* @__PURE__ */ (() => z18.string().min(1).max(64))();
|
|
2412
|
+
var memberIdentitySchema = /* @__PURE__ */ (() => z18.object({
|
|
2085
2413
|
kind: openIdentityKindSchema,
|
|
2086
2414
|
/** The stable user ID for `x` and `discord`; the subject your app signed the member in with for `app:<name>`. */
|
|
2087
2415
|
subject: externalId,
|
|
@@ -2093,7 +2421,7 @@ var memberIdentitySchema = /* @__PURE__ */ (() => z12.object({
|
|
|
2093
2421
|
/** The latest link time, refreshed on app identity relink; null when the link time is unknown. */
|
|
2094
2422
|
linkedAt: timestamp.nullable()
|
|
2095
2423
|
}))();
|
|
2096
|
-
var accountRoleSchema = /* @__PURE__ */ (() =>
|
|
2424
|
+
var accountRoleSchema = /* @__PURE__ */ (() => z18.string().regex(
|
|
2097
2425
|
/^[a-zA-Z][a-zA-Z0-9_]{0,39}$/,
|
|
2098
2426
|
"Name roles like author or recipient: a letter, then letters, digits or underscores"
|
|
2099
2427
|
))();
|
|
@@ -2104,7 +2432,7 @@ var xAccountRoles = [
|
|
|
2104
2432
|
"reposted"
|
|
2105
2433
|
];
|
|
2106
2434
|
var distinct = (values2) => new Set(values2).size === values2.length;
|
|
2107
|
-
var contentMetricNameSchema = /* @__PURE__ */ (() =>
|
|
2435
|
+
var contentMetricNameSchema = /* @__PURE__ */ (() => z18.string().regex(
|
|
2108
2436
|
/^[a-z][a-zA-Z0-9]{0,39}$/,
|
|
2109
2437
|
"Name metrics like likes or watchTime: a lowercase letter, then letters or digits"
|
|
2110
2438
|
))();
|
|
@@ -2116,128 +2444,46 @@ var xContentMetrics = [
|
|
|
2116
2444
|
"views",
|
|
2117
2445
|
"bookmarks"
|
|
2118
2446
|
];
|
|
2119
|
-
var customContentSchema = /* @__PURE__ */ (() =>
|
|
2120
|
-
metrics:
|
|
2121
|
-
}))();
|
|
2122
|
-
var walletBalanceSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2123
|
-
chain: z12.string().regex(
|
|
2124
|
-
balanceChainPattern,
|
|
2125
|
-
'Use "solana", Solana devnet ("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"), an EVM chain such as "eip155:8453" or a Cosmos network such as "cosmos:cosmoshub-4"'
|
|
2126
|
-
),
|
|
2127
|
-
token: z12.string().min(1).max(128).nullable()
|
|
2447
|
+
var customContentSchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2448
|
+
metrics: z18.array(contentMetricNameSchema).max(10).refine(distinct, "List each metric once")
|
|
2128
2449
|
}))();
|
|
2129
|
-
var
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
))();
|
|
2133
|
-
var walletProgramActivitySourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2134
|
-
chain: solanaClusterSchema,
|
|
2135
|
-
program: z12.string().regex(solanaAddressPattern, "Use a base58 program address"),
|
|
2136
|
-
instruction: z12.string().regex(
|
|
2137
|
-
/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,
|
|
2138
|
-
"Use the instruction's name as the program's IDL spells it"
|
|
2139
|
-
).nullable(),
|
|
2140
|
-
mint: z12.string().regex(solanaAddressPattern, "Use a base58 SPL mint address").nullable(),
|
|
2141
|
-
minAmount: z12.string().regex(/^[1-9][0-9]{0,77}$/, "Use a positive whole number of base units").nullable(),
|
|
2142
|
-
anySigner: z12.boolean()
|
|
2143
|
-
}).refine(
|
|
2144
|
-
(activity) => activity.minAmount === null || activity.mint !== null,
|
|
2145
|
-
"minAmount needs a mint"
|
|
2146
|
-
))();
|
|
2147
|
-
var walletNftSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2148
|
-
collection: z12.string().max(200).refine(
|
|
2149
|
-
(value) => isNftCollection(value),
|
|
2150
|
-
"Use an NFT collection"
|
|
2151
|
-
)
|
|
2152
|
-
}))();
|
|
2153
|
-
var walletStakeSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2154
|
-
chain: solanaClusterSchema,
|
|
2155
|
-
voteAccount: z12.string().refine(
|
|
2156
|
-
(value) => base58Bytes(value, 32) !== null,
|
|
2157
|
-
"Use a base58 vote account address"
|
|
2158
|
-
).nullable()
|
|
2159
|
-
}))();
|
|
2160
|
-
var walletProgramAccountSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2161
|
-
chain: solanaClusterSchema,
|
|
2162
|
-
program: z12.string().regex(solanaAddressPattern, "Use a base58 program address"),
|
|
2163
|
-
account: z12.string().min(1).max(128),
|
|
2164
|
-
seeds: z12.array(solanaSeedSchema).min(1).max(maxSolanaSeeds).refine(
|
|
2165
|
-
(seeds) => seeds.some((seed) => typeof seed === "object" && "wallet" in seed),
|
|
2166
|
-
"Place the member's wallet in the seeds with { wallet: true }"
|
|
2167
|
-
),
|
|
2168
|
-
field: z12.string().min(1).max(128),
|
|
2169
|
-
idl: solanaProgramIdlSchema.optional()
|
|
2170
|
-
}))();
|
|
2171
|
-
var xSearchSourceSchema = /* @__PURE__ */ (() => z12.object({
|
|
2172
|
-
kind: z12.literal("x-search"),
|
|
2173
|
-
query: z12.string().trim().min(1).max(2e3)
|
|
2450
|
+
var xSearchSourceSchema = /* @__PURE__ */ (() => z18.object({
|
|
2451
|
+
kind: z18.literal("x-search"),
|
|
2452
|
+
query: z18.string().trim().min(1).max(2e3)
|
|
2174
2453
|
}).strict())();
|
|
2175
|
-
var customSourceSchema = /* @__PURE__ */ (() =>
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
(
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
* `wallet.programActivity()` sets it.
|
|
2209
|
-
*/
|
|
2210
|
-
activity: walletProgramActivitySourceSchema.optional(),
|
|
2211
|
-
/**
|
|
2212
|
-
* The NFT collection Relay samples, on `wallet.nfts()`'s reserved namespace only.
|
|
2213
|
-
* `wallet.nfts()` sets it.
|
|
2214
|
-
*/
|
|
2215
|
-
nfts: walletNftSourceSchema.optional(),
|
|
2216
|
-
/**
|
|
2217
|
-
* The cluster and vote account Relay samples stake for, on `wallet.stake()`'s reserved
|
|
2218
|
-
* namespace only. `wallet.stake()` sets it.
|
|
2219
|
-
*/
|
|
2220
|
-
stake: walletStakeSourceSchema.optional(),
|
|
2221
|
-
/**
|
|
2222
|
-
* The program account field Relay samples, on `wallet.programAccounts()`'s reserved namespace
|
|
2223
|
-
* only. `wallet.programAccounts()` sets it.
|
|
2224
|
-
*/
|
|
2225
|
-
programAccount: walletProgramAccountSourceSchema.optional()
|
|
2226
|
-
}).strict().refine(
|
|
2227
|
-
(source) => source.balance === void 0 || source.namespace === walletBalancesNamespace,
|
|
2228
|
-
"Only wallet.balances() samples a balance"
|
|
2229
|
-
).refine(
|
|
2230
|
-
(source) => source.activity === void 0 || source.namespace === walletProgramActivityNamespace,
|
|
2231
|
-
"Only wallet.programActivity() records program activity"
|
|
2232
|
-
).refine(
|
|
2233
|
-
(source) => source.nfts === void 0 || source.namespace === walletNftsNamespace,
|
|
2234
|
-
"Only wallet.nfts() samples NFTs"
|
|
2235
|
-
).refine(
|
|
2236
|
-
(source) => source.stake === void 0 || source.namespace === walletStakeNamespace,
|
|
2237
|
-
"Only wallet.stake() samples stake"
|
|
2238
|
-
).refine(
|
|
2239
|
-
(source) => source.programAccount === void 0 || source.namespace === walletProgramAccountsNamespace,
|
|
2240
|
-
"Only wallet.programAccounts() samples program accounts"
|
|
2454
|
+
var customSourceSchema = /* @__PURE__ */ (() => refuseMisplacedWalletReads(
|
|
2455
|
+
z18.object({
|
|
2456
|
+
kind: z18.literal("custom"),
|
|
2457
|
+
namespace: identifier,
|
|
2458
|
+
/**
|
|
2459
|
+
* The identity kinds a record's author and named accounts can be, attributed to members
|
|
2460
|
+
* through verified links: `wallet`, `x`, `discord`, `member`, or your app's own `app:<name>`.
|
|
2461
|
+
* Omitted when authors are opaque IDs, which no quest can pay.
|
|
2462
|
+
*/
|
|
2463
|
+
identities: z18.array(identityKindSchema).min(1).max(8).refine(distinct, "List each identity kind once").optional(),
|
|
2464
|
+
/** Roles of the named accounts records can carry besides their author, such as `recipient`. */
|
|
2465
|
+
accounts: z18.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
|
|
2466
|
+
(roles) => !roles.includes("author"),
|
|
2467
|
+
"author is every record's own role; name other accounts"
|
|
2468
|
+
).optional(),
|
|
2469
|
+
/**
|
|
2470
|
+
* The schema every record's `data` matches, which ingestion enforces. `customSource()`
|
|
2471
|
+
* requires it. Trackers published before typed data have none, and take no records until
|
|
2472
|
+
* they are published with one.
|
|
2473
|
+
*/
|
|
2474
|
+
data: trackerDataSchemaSchema.optional(),
|
|
2475
|
+
/**
|
|
2476
|
+
* The content its records carry: each record's `data` is `{ body, metrics? }`, and quests can
|
|
2477
|
+
* use the tracker with `content()`. `customSource(namespace, { content })` sets it with the
|
|
2478
|
+
* matching `data` schema.
|
|
2479
|
+
*/
|
|
2480
|
+
content: customContentSchema.optional(),
|
|
2481
|
+
/**
|
|
2482
|
+
* Each wallet read kind's settings, such as `nfts` for `wallet.nfts()`, on that kind's reserved
|
|
2483
|
+
* namespace only. Its builder sets it.
|
|
2484
|
+
*/
|
|
2485
|
+
...walletReadFields("source")
|
|
2486
|
+
}).strict()
|
|
2241
2487
|
).refine(
|
|
2242
2488
|
(source) => !source.content || source.data?.properties?.body?.type === "object" && (source.data.required ?? []).includes("body"),
|
|
2243
2489
|
"A content source's data schema has a required object body"
|
|
@@ -2245,7 +2491,7 @@ var customSourceSchema = /* @__PURE__ */ (() => z12.object({
|
|
|
2245
2491
|
(source) => !source.accounts || source.identities,
|
|
2246
2492
|
"Named accounts need identities"
|
|
2247
2493
|
))();
|
|
2248
|
-
var trackerSourceSchema = /* @__PURE__ */ (() =>
|
|
2494
|
+
var trackerSourceSchema = /* @__PURE__ */ (() => z18.discriminatedUnion("kind", [
|
|
2249
2495
|
xSearchSourceSchema,
|
|
2250
2496
|
customSourceSchema,
|
|
2251
2497
|
discordMessagesSourceSchema,
|
|
@@ -2282,74 +2528,61 @@ function sourceContent(source) {
|
|
|
2282
2528
|
return void 0;
|
|
2283
2529
|
}
|
|
2284
2530
|
}
|
|
2285
|
-
var windowSchema = /* @__PURE__ */ (() =>
|
|
2531
|
+
var windowSchema = /* @__PURE__ */ (() => z18.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
|
|
2286
2532
|
(w) => w.end === void 0 || w.end > w.start,
|
|
2287
2533
|
"End must follow start"
|
|
2288
2534
|
))();
|
|
2289
|
-
var trackerDefinitionSchema = /* @__PURE__ */ (() =>
|
|
2535
|
+
var trackerDefinitionSchema = /* @__PURE__ */ (() => z18.object({
|
|
2290
2536
|
key: identifier,
|
|
2291
|
-
title:
|
|
2537
|
+
title: z18.string().trim().min(1).max(120),
|
|
2292
2538
|
source: trackerSourceSchema,
|
|
2293
2539
|
window: windowSchema,
|
|
2294
|
-
refreshSeconds:
|
|
2295
|
-
maxPages:
|
|
2540
|
+
refreshSeconds: z18.number().int().min(300).max(86400).default(21600),
|
|
2541
|
+
maxPages: z18.number().int().min(1).max(1e3).default(60)
|
|
2296
2542
|
}).strict())();
|
|
2297
|
-
var trackerArtifactSchema = /* @__PURE__ */ (() =>
|
|
2543
|
+
var trackerArtifactSchema = /* @__PURE__ */ (() => z18.union([
|
|
2298
2544
|
trackerDefinitionSchema,
|
|
2299
|
-
|
|
2545
|
+
z18.object({ code: z18.string().min(1).max(2e6) }).strict()
|
|
2300
2546
|
]))();
|
|
2301
|
-
var knownTrackerSourceResponseSchema = /* @__PURE__ */ (() =>
|
|
2302
|
-
|
|
2303
|
-
|
|
2547
|
+
var knownTrackerSourceResponseSchema = /* @__PURE__ */ (() => z18.discriminatedUnion("kind", [
|
|
2548
|
+
z18.object(xSearchSourceSchema.shape),
|
|
2549
|
+
z18.object({
|
|
2304
2550
|
...customSourceSchema.shape,
|
|
2305
|
-
identities:
|
|
2306
|
-
//
|
|
2307
|
-
|
|
2308
|
-
// Read as stored: a later Relay may sample collections this SDK does not parse.
|
|
2309
|
-
nfts: z12.object({ collection: z12.string() }).optional(),
|
|
2310
|
-
// Read as stored: a later Relay may sample clusters this SDK does not name.
|
|
2311
|
-
stake: z12.object({ chain: z12.string(), voteAccount: z12.string().nullable() }).optional(),
|
|
2312
|
-
// Read as stored: a later Relay may sample clusters, seeds or IDLs this SDK does not parse.
|
|
2313
|
-
programAccount: z12.object({
|
|
2314
|
-
chain: z12.string(),
|
|
2315
|
-
program: z12.string(),
|
|
2316
|
-
account: z12.string(),
|
|
2317
|
-
seeds: z12.array(z12.json()),
|
|
2318
|
-
field: z12.string(),
|
|
2319
|
-
idl: z12.object({ program: z12.string(), source: z12.string(), idl: z12.json() }).optional()
|
|
2320
|
-
}).optional()
|
|
2551
|
+
identities: z18.array(openIdentityKindSchema).optional(),
|
|
2552
|
+
// Each wallet read kind's settings as stored, which a later Relay may widen.
|
|
2553
|
+
...walletReadFields("stored")
|
|
2321
2554
|
}),
|
|
2322
|
-
|
|
2323
|
-
|
|
2555
|
+
z18.object(discordMessagesSourceSchema.shape),
|
|
2556
|
+
z18.object(discordReactionsSourceSchema.shape)
|
|
2324
2557
|
]))();
|
|
2325
|
-
var trackerSourceResponseSchema = /* @__PURE__ */ (() =>
|
|
2558
|
+
var trackerSourceResponseSchema = /* @__PURE__ */ (() => z18.union([
|
|
2326
2559
|
knownTrackerSourceResponseSchema,
|
|
2327
|
-
|
|
2328
|
-
kind:
|
|
2560
|
+
z18.object({
|
|
2561
|
+
kind: z18.string().min(1).refine(
|
|
2329
2562
|
(kind) => !trackerSourceKinds.some((known) => known === kind),
|
|
2330
2563
|
"Known source kinds must match their schema"
|
|
2331
2564
|
)
|
|
2332
|
-
}).catchall(
|
|
2565
|
+
}).catchall(z18.json())
|
|
2333
2566
|
]))();
|
|
2334
2567
|
function isKnownTrackerSource(source) {
|
|
2335
2568
|
return knownTrackerSourceResponseSchema.safeParse(source).success;
|
|
2336
2569
|
}
|
|
2337
|
-
var trackerDefinitionResponseSchema = /* @__PURE__ */ (() =>
|
|
2570
|
+
var trackerDefinitionResponseSchema = /* @__PURE__ */ (() => z18.object({
|
|
2338
2571
|
...trackerDefinitionSchema.shape,
|
|
2339
2572
|
source: trackerSourceResponseSchema,
|
|
2340
|
-
window:
|
|
2573
|
+
window: z18.object(windowSchema.shape)
|
|
2341
2574
|
}))();
|
|
2342
|
-
var publishedTrackerSchema = /* @__PURE__ */ (() =>
|
|
2575
|
+
var publishedTrackerSchema = /* @__PURE__ */ (() => z18.object({
|
|
2343
2576
|
id: identifier,
|
|
2344
2577
|
version: identifier,
|
|
2345
2578
|
definition: trackerDefinitionResponseSchema,
|
|
2346
2579
|
publishedAt: timestamp,
|
|
2347
|
-
actor:
|
|
2580
|
+
actor: z18.string().nullable()
|
|
2348
2581
|
}))();
|
|
2349
|
-
var trackerStatusSchema = /* @__PURE__ */ (() =>
|
|
2350
|
-
archivedAt:
|
|
2582
|
+
var trackerStatusSchema = /* @__PURE__ */ (() => z18.object({
|
|
2583
|
+
archivedAt: z18.number().int().nonnegative().nullable().optional(),
|
|
2351
2584
|
published: publishedTrackerSchema,
|
|
2352
|
-
paused:
|
|
2585
|
+
paused: z18.boolean(),
|
|
2353
2586
|
/**
|
|
2354
2587
|
* Why a paused tracker is paused, null when it isn't: `operator` (paused by hand),
|
|
2355
2588
|
* `x-budget-exhausted` (the project's monthly X budget, or in test the organization's, is spent;
|
|
@@ -2357,41 +2590,37 @@ var trackerStatusSchema = /* @__PURE__ */ (() => z12.object({
|
|
|
2357
2590
|
* `test-window-ended` (a test X tracker collects for 14 days; resume it for another 14). Treat an
|
|
2358
2591
|
* unknown reason, which a newer Relay can add, as paused. Older servers leave it out.
|
|
2359
2592
|
*/
|
|
2360
|
-
pauseReason:
|
|
2593
|
+
pauseReason: z18.string().nullable().optional(),
|
|
2361
2594
|
/** When a tracker paused on its X budget resumes on its own: the start of the next UTC month. */
|
|
2362
2595
|
resumesAt: timestamp.nullable().optional(),
|
|
2363
2596
|
/**
|
|
2364
2597
|
* The interval a scheduled tracker actually runs at: `refreshSeconds`, but no shorter than the
|
|
2365
2598
|
* project's plan allows (6 hours, shorter on Enterprise). Older servers leave it out.
|
|
2366
2599
|
*/
|
|
2367
|
-
effectiveRefreshSeconds:
|
|
2368
|
-
state:
|
|
2600
|
+
effectiveRefreshSeconds: z18.number().int().positive().optional(),
|
|
2601
|
+
state: z18.enum(["idle", "syncing", "error", "complete"]),
|
|
2369
2602
|
lastStartedAt: timestamp.nullable(),
|
|
2370
2603
|
lastCompletedAt: timestamp.nullable(),
|
|
2371
2604
|
nextSyncAt: timestamp.nullable(),
|
|
2372
|
-
coverage:
|
|
2373
|
-
error:
|
|
2605
|
+
coverage: z18.enum(["unknown", "partial", "complete"]),
|
|
2606
|
+
error: z18.string().nullable(),
|
|
2374
2607
|
records: count,
|
|
2375
2608
|
/**
|
|
2376
2609
|
* Who owns the definition: `code` for a tracker a deployment publishes from `defineTracker`,
|
|
2377
2610
|
* `data` for a tracker created with `management.trackers.create` or in Console, which only
|
|
2378
2611
|
* `management.trackers.update` changes. Older servers leave it out.
|
|
2379
2612
|
*/
|
|
2380
|
-
origin:
|
|
2613
|
+
origin: z18.enum(["code", "data"]).optional()
|
|
2381
2614
|
}))();
|
|
2382
|
-
var managedTrackerSourceSchema = /* @__PURE__ */ (() =>
|
|
2615
|
+
var managedTrackerSourceSchema = /* @__PURE__ */ (() => z18.discriminatedUnion("kind", [
|
|
2383
2616
|
xSearchSourceSchema,
|
|
2384
2617
|
discordMessagesSourceSchema,
|
|
2385
2618
|
discordReactionsSourceSchema,
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
z12.strictObject({
|
|
2392
|
-
kind: z12.literal("wallet-balances"),
|
|
2393
|
-
...walletBalanceSourceSchema.shape
|
|
2394
|
-
})
|
|
2619
|
+
z18.strictObject({ kind: z18.literal("telegram-messages") }),
|
|
2620
|
+
z18.strictObject({ kind: z18.literal("telegram-reactions") }),
|
|
2621
|
+
z18.strictObject({ kind: z18.literal("youtube-shorts") }),
|
|
2622
|
+
z18.strictObject({ kind: z18.literal("tiktok-videos") }),
|
|
2623
|
+
walletBalancesManagedSourceSchema
|
|
2395
2624
|
]))();
|
|
2396
2625
|
var managedTrackerSourceKinds = [
|
|
2397
2626
|
"x-search",
|
|
@@ -2429,7 +2658,26 @@ function managedTrackerSource(source) {
|
|
|
2429
2658
|
} : void 0;
|
|
2430
2659
|
}
|
|
2431
2660
|
}
|
|
2432
|
-
|
|
2661
|
+
function dataTrackerSource(source) {
|
|
2662
|
+
const kind = isKnownTrackerSource(source) && source.kind === "custom" ? walletReadKinds.find(
|
|
2663
|
+
// `managedTrackerSource()` reads the kinds among the managed sources.
|
|
2664
|
+
({ namespace, create }) => create === "own" && namespace === source.namespace
|
|
2665
|
+
) : void 0;
|
|
2666
|
+
if (!kind) {
|
|
2667
|
+
return managedTrackerSource(source);
|
|
2668
|
+
}
|
|
2669
|
+
const stored = source[kind.field];
|
|
2670
|
+
if (stored === void 0) {
|
|
2671
|
+
return void 0;
|
|
2672
|
+
}
|
|
2673
|
+
const settings = "managementSettings" in kind ? kind.managementSettings(stored) : stored;
|
|
2674
|
+
const named = kind.management.safeParse({
|
|
2675
|
+
...settings,
|
|
2676
|
+
kind: kind.management.shape.kind.value
|
|
2677
|
+
});
|
|
2678
|
+
return named.success ? named.data : void 0;
|
|
2679
|
+
}
|
|
2680
|
+
var trackerPropertiesSchema = /* @__PURE__ */ (() => z18.object({
|
|
2433
2681
|
title: trackerDefinitionSchema.shape.title,
|
|
2434
2682
|
/** The X search query. A new query collects from now on; it never searches the past. */
|
|
2435
2683
|
query: xSearchSourceSchema.shape.query,
|
|
@@ -2451,30 +2699,22 @@ var managedTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.exte
|
|
|
2451
2699
|
(input) => input.query === void 0 !== (input.source === void 0),
|
|
2452
2700
|
"Name the source with source, or an X search with query, not both"
|
|
2453
2701
|
))();
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
(
|
|
2459
|
-
|
|
2702
|
+
function sampledTrackerCreateSchema(kind) {
|
|
2703
|
+
return trackerCreateSchema.omit({ query: true }).extend({ source: kind.management });
|
|
2704
|
+
}
|
|
2705
|
+
var sampledTrackerCreateSchemas = /* @__PURE__ */ (() => Object.fromEntries(
|
|
2706
|
+
walletReadKinds.flatMap(
|
|
2707
|
+
(kind) => kind.create === "own" ? [[kind.management.shape.kind.value, sampledTrackerCreateSchema(kind)]] : []
|
|
2708
|
+
)
|
|
2709
|
+
))();
|
|
2710
|
+
var programActivityTrackerCreateSchema = /* @__PURE__ */ (() => sampledTrackerCreateSchema(
|
|
2711
|
+
walletProgramActivity
|
|
2712
|
+
))();
|
|
2713
|
+
var nftTrackerCreateSchema = /* @__PURE__ */ (() => sampledTrackerCreateSchema(walletNfts))();
|
|
2714
|
+
var stakeTrackerCreateSchema = /* @__PURE__ */ (() => sampledTrackerCreateSchema(walletStake))();
|
|
2715
|
+
var programAccountTrackerCreateSchema = /* @__PURE__ */ (() => sampledTrackerCreateSchema(
|
|
2716
|
+
walletProgramAccounts
|
|
2460
2717
|
))();
|
|
2461
|
-
var programActivityTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.omit({ query: true }).extend({ source: walletProgramActivityTrackerSourceSchema }))();
|
|
2462
|
-
var walletNftsTrackerSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2463
|
-
kind: z12.literal("wallet-nfts"),
|
|
2464
|
-
...walletNftSourceSchema.shape
|
|
2465
|
-
}))();
|
|
2466
|
-
var nftTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.omit({ query: true }).extend({ source: walletNftsTrackerSourceSchema }))();
|
|
2467
|
-
var walletStakeTrackerSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2468
|
-
kind: z12.literal("wallet-stake"),
|
|
2469
|
-
...walletStakeSourceSchema.shape
|
|
2470
|
-
}))();
|
|
2471
|
-
var stakeTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.omit({ query: true }).extend({ source: walletStakeTrackerSourceSchema }))();
|
|
2472
|
-
var walletProgramAccountsTrackerSourceSchema = /* @__PURE__ */ (() => z12.strictObject({
|
|
2473
|
-
kind: z12.literal("wallet-program-accounts"),
|
|
2474
|
-
...walletProgramAccountSourceSchema.shape,
|
|
2475
|
-
idl: anchorIdlSchema.optional()
|
|
2476
|
-
}))();
|
|
2477
|
-
var programAccountTrackerCreateSchema = /* @__PURE__ */ (() => trackerCreateSchema.omit({ query: true }).extend({ source: walletProgramAccountsTrackerSourceSchema }))();
|
|
2478
2718
|
var trackerUpdateSchema = /* @__PURE__ */ (() => trackerPropertiesSchema.partial().extend({
|
|
2479
2719
|
source: managedTrackerSourceSchema.optional(),
|
|
2480
2720
|
actionId: identifier
|
|
@@ -2485,70 +2725,70 @@ var trackerUpdateSchema = /* @__PURE__ */ (() => trackerPropertiesSchema.partial
|
|
|
2485
2725
|
(input) => input.query === void 0 || input.source === void 0,
|
|
2486
2726
|
"Change the query with source or query, not both"
|
|
2487
2727
|
))();
|
|
2488
|
-
var trackerControlSchema = /* @__PURE__ */ (() =>
|
|
2728
|
+
var trackerControlSchema = /* @__PURE__ */ (() => z18.object({
|
|
2489
2729
|
actionId: identifier,
|
|
2490
|
-
action:
|
|
2730
|
+
action: z18.enum(["pause", "resume", "refresh"]),
|
|
2491
2731
|
reason: lifecycleReasonSchema.optional()
|
|
2492
2732
|
}).strict())();
|
|
2493
|
-
var trackerAccountSchema = /* @__PURE__ */ (() =>
|
|
2733
|
+
var trackerAccountSchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2494
2734
|
kind: identityKindSchema.optional(),
|
|
2495
2735
|
id: externalId
|
|
2496
2736
|
}))();
|
|
2497
|
-
var trackerRecordInputSchema = /* @__PURE__ */ (() =>
|
|
2737
|
+
var trackerRecordInputSchema = /* @__PURE__ */ (() => z18.object({
|
|
2498
2738
|
id: externalId,
|
|
2499
2739
|
occurredAt: timestamp,
|
|
2500
2740
|
observedAt: timestamp,
|
|
2501
|
-
author:
|
|
2741
|
+
author: z18.object({
|
|
2502
2742
|
id: externalId,
|
|
2503
|
-
verified:
|
|
2743
|
+
verified: z18.boolean().nullable().default(null),
|
|
2504
2744
|
/** The author's identity kind; needed when the source names more than one. */
|
|
2505
2745
|
kind: identityKindSchema.optional()
|
|
2506
2746
|
}).strict().nullable().default(null),
|
|
2507
2747
|
/** Named accounts besides the author, by the roles the custom source declares. */
|
|
2508
|
-
accounts:
|
|
2748
|
+
accounts: z18.record(accountRoleSchema, trackerAccountSchema).refine(
|
|
2509
2749
|
(accounts) => Object.keys(accounts).length <= 10,
|
|
2510
2750
|
"At most 10 accounts"
|
|
2511
2751
|
).optional(),
|
|
2512
|
-
data:
|
|
2513
|
-
removed:
|
|
2752
|
+
data: z18.record(z18.string(), z18.json()),
|
|
2753
|
+
removed: z18.boolean().default(false)
|
|
2514
2754
|
}).strict().refine(
|
|
2515
2755
|
(v) => new TextEncoder().encode(JSON.stringify(v.data)).byteLength <= 131072,
|
|
2516
2756
|
"Record exceeds 128 KB"
|
|
2517
2757
|
))();
|
|
2518
|
-
var trackerRecordAccountSchema = /* @__PURE__ */ (() =>
|
|
2758
|
+
var trackerRecordAccountSchema = /* @__PURE__ */ (() => z18.object({
|
|
2519
2759
|
kind: openIdentityKindSchema.optional(),
|
|
2520
|
-
id:
|
|
2760
|
+
id: z18.string()
|
|
2521
2761
|
}))();
|
|
2522
|
-
var trackerRecordSchema = /* @__PURE__ */ (() =>
|
|
2523
|
-
id:
|
|
2762
|
+
var trackerRecordSchema = /* @__PURE__ */ (() => z18.object({
|
|
2763
|
+
id: z18.string(),
|
|
2524
2764
|
occurredAt: timestamp,
|
|
2525
2765
|
observedAt: timestamp,
|
|
2526
|
-
author:
|
|
2527
|
-
id:
|
|
2528
|
-
verified:
|
|
2766
|
+
author: z18.object({
|
|
2767
|
+
id: z18.string(),
|
|
2768
|
+
verified: z18.boolean().nullable().default(null),
|
|
2529
2769
|
kind: openIdentityKindSchema.optional()
|
|
2530
2770
|
}).nullable().default(null),
|
|
2531
|
-
accounts:
|
|
2532
|
-
data:
|
|
2533
|
-
removed:
|
|
2534
|
-
source:
|
|
2771
|
+
accounts: z18.record(z18.string(), trackerRecordAccountSchema).optional(),
|
|
2772
|
+
data: z18.record(z18.string(), z18.json()),
|
|
2773
|
+
removed: z18.boolean().default(false),
|
|
2774
|
+
source: z18.string(),
|
|
2535
2775
|
firstSeenAt: timestamp,
|
|
2536
2776
|
/**
|
|
2537
2777
|
* True on a record an operator sent for a test member (`management.testMembers.record`), in
|
|
2538
2778
|
* test only. Absent on every other record.
|
|
2539
2779
|
*/
|
|
2540
|
-
synthetic:
|
|
2780
|
+
synthetic: z18.literal(true).optional(),
|
|
2541
2781
|
/** Present only when includeEvidence is true; custom sources have no X evidence. */
|
|
2542
2782
|
evidence: trackerEvidenceSchema.nullable().optional()
|
|
2543
2783
|
}))();
|
|
2544
|
-
var trackerIngestSchema = /* @__PURE__ */ (() =>
|
|
2784
|
+
var trackerIngestSchema = /* @__PURE__ */ (() => z18.object({
|
|
2545
2785
|
actionId: identifier,
|
|
2546
|
-
records:
|
|
2786
|
+
records: z18.array(trackerRecordInputSchema).min(1).max(100)
|
|
2547
2787
|
}).strict())();
|
|
2548
|
-
var trackerIngestResultSchema = /* @__PURE__ */ (() =>
|
|
2788
|
+
var trackerIngestResultSchema = /* @__PURE__ */ (() => z18.object({
|
|
2549
2789
|
stored: count,
|
|
2550
2790
|
/** Tracker-trigger decisions this ingest caused. Absent from servers without tracker triggers. */
|
|
2551
|
-
admissions:
|
|
2791
|
+
admissions: z18.object({
|
|
2552
2792
|
admitted: count,
|
|
2553
2793
|
skipped: count,
|
|
2554
2794
|
/**
|
|
@@ -2569,11 +2809,11 @@ var trackerOutcomeFields = /* @__PURE__ */ (() => ({
|
|
|
2569
2809
|
/** The release admitted, or the one active when the observation was skipped. */
|
|
2570
2810
|
release: identifier,
|
|
2571
2811
|
/** The account attribution resolved or failed to resolve, such as a CAIP-10 wallet ID. */
|
|
2572
|
-
account:
|
|
2812
|
+
account: z18.string().nullable(),
|
|
2573
2813
|
createdAt: timestamp,
|
|
2574
2814
|
updatedAt: timestamp,
|
|
2575
2815
|
/** Null for automatic decisions; the staff actor after a retry. */
|
|
2576
|
-
actor:
|
|
2816
|
+
actor: z18.string().nullable()
|
|
2577
2817
|
}))();
|
|
2578
2818
|
var trackerSkipCodes = [
|
|
2579
2819
|
/** The quest is paused or no longer active. Catch-up after a pause is an operator decision. */
|
|
@@ -2633,27 +2873,27 @@ var trackerSkipCodes = [
|
|
|
2633
2873
|
/** A prerequisite quest was not complete when the record occurred. */
|
|
2634
2874
|
"prerequisites-incomplete"
|
|
2635
2875
|
];
|
|
2636
|
-
var skipEnrollmentSchema = /* @__PURE__ */ (() =>
|
|
2637
|
-
var trackerOutcomeSchema = /* @__PURE__ */ (() =>
|
|
2638
|
-
|
|
2876
|
+
var skipEnrollmentSchema = /* @__PURE__ */ (() => z18.string().optional())();
|
|
2877
|
+
var trackerOutcomeSchema = /* @__PURE__ */ (() => z18.discriminatedUnion("state", [
|
|
2878
|
+
z18.object({
|
|
2639
2879
|
...trackerOutcomeFields,
|
|
2640
|
-
state:
|
|
2641
|
-
code:
|
|
2642
|
-
reason:
|
|
2880
|
+
state: z18.literal("admitted"),
|
|
2881
|
+
code: z18.null(),
|
|
2882
|
+
reason: z18.null(),
|
|
2643
2883
|
/** The attributed member. */
|
|
2644
2884
|
member: identifier,
|
|
2645
2885
|
/** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
|
|
2646
2886
|
attempt: identifier
|
|
2647
2887
|
}),
|
|
2648
|
-
|
|
2888
|
+
z18.object({
|
|
2649
2889
|
...trackerOutcomeFields,
|
|
2650
|
-
state:
|
|
2890
|
+
state: z18.literal("skipped"),
|
|
2651
2891
|
/** Why the observation was skipped, as one of `trackerSkipCodes`. */
|
|
2652
|
-
code:
|
|
2892
|
+
code: z18.string().min(1),
|
|
2653
2893
|
/** Why the observation was skipped, for people. */
|
|
2654
|
-
reason:
|
|
2894
|
+
reason: z18.string(),
|
|
2655
2895
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
2656
|
-
window:
|
|
2896
|
+
window: z18.enum(["tracker", "quest"]).optional(),
|
|
2657
2897
|
/** Which enrollment the member lacks when `code` is `not-enrolled`. */
|
|
2658
2898
|
enrollment: skipEnrollmentSchema,
|
|
2659
2899
|
/** The attributed member, when attribution got that far. */
|
|
@@ -2666,63 +2906,63 @@ var trackerOutcomeFilters = /* @__PURE__ */ (() => ({
|
|
|
2666
2906
|
quest: identifier.optional(),
|
|
2667
2907
|
record: externalId.optional(),
|
|
2668
2908
|
member: identifier.optional(),
|
|
2669
|
-
state:
|
|
2909
|
+
state: z18.enum(["admitted", "skipped"]).optional(),
|
|
2670
2910
|
/** Only skips with this code, such as `unlinked-account`. */
|
|
2671
|
-
code:
|
|
2672
|
-
limit:
|
|
2911
|
+
code: z18.string().min(1).max(100).optional(),
|
|
2912
|
+
limit: z18.coerce.number().int().min(1).max(100).default(25)
|
|
2673
2913
|
}))();
|
|
2674
|
-
var trackerTriggerOutcomeQuerySchema = /* @__PURE__ */ (() =>
|
|
2914
|
+
var trackerTriggerOutcomeQuerySchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2675
2915
|
...trackerOutcomeFilters,
|
|
2676
2916
|
cursor: pageCursorSchema.optional()
|
|
2677
2917
|
}))();
|
|
2678
|
-
var trackerTriggerOutcomePageSchema = /* @__PURE__ */ (() =>
|
|
2679
|
-
items:
|
|
2918
|
+
var trackerTriggerOutcomePageSchema = /* @__PURE__ */ (() => z18.object({
|
|
2919
|
+
items: z18.array(trackerOutcomeSchema).max(100),
|
|
2680
2920
|
nextCursor: pageCursorSchema.nullable()
|
|
2681
2921
|
}))();
|
|
2682
|
-
var trackerOutcomeQuerySchema = /* @__PURE__ */ (() =>
|
|
2922
|
+
var trackerOutcomeQuerySchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2683
2923
|
...trackerOutcomeFilters,
|
|
2684
2924
|
/** Opaque cursor from `next`: older outcomes. */
|
|
2685
|
-
before:
|
|
2925
|
+
before: z18.string().max(512).optional()
|
|
2686
2926
|
}))();
|
|
2687
|
-
var trackerOutcomePageSchema = /* @__PURE__ */ (() =>
|
|
2927
|
+
var trackerOutcomePageSchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2688
2928
|
/** Newest first. */
|
|
2689
|
-
items:
|
|
2690
|
-
next:
|
|
2929
|
+
items: z18.array(trackerOutcomeSchema).max(100),
|
|
2930
|
+
next: z18.string().nullable()
|
|
2691
2931
|
}))();
|
|
2692
|
-
var trackerOutcomeRetrySchema = /* @__PURE__ */ (() =>
|
|
2932
|
+
var trackerOutcomeRetrySchema = /* @__PURE__ */ (() => z18.strictObject({
|
|
2693
2933
|
actionId: identifier,
|
|
2694
2934
|
/** Quest key or ID. */
|
|
2695
2935
|
quest: identifier,
|
|
2696
2936
|
record: externalId,
|
|
2697
2937
|
observedAt: timestamp
|
|
2698
2938
|
}))();
|
|
2699
|
-
var trackerQuerySchema = /* @__PURE__ */ (() =>
|
|
2939
|
+
var trackerQuerySchema = /* @__PURE__ */ (() => z18.object({
|
|
2700
2940
|
author: externalId.optional(),
|
|
2701
2941
|
member: identifier.optional(),
|
|
2702
2942
|
verified: booleanQuery.optional(),
|
|
2703
|
-
since:
|
|
2704
|
-
until:
|
|
2943
|
+
since: z18.coerce.number().int().safe().nonnegative().optional(),
|
|
2944
|
+
until: z18.coerce.number().int().safe().nonnegative().optional(),
|
|
2705
2945
|
removed: booleanQuery.default(false),
|
|
2706
|
-
minLikes:
|
|
2707
|
-
minViews:
|
|
2708
|
-
limit:
|
|
2709
|
-
cursor:
|
|
2946
|
+
minLikes: z18.coerce.number().int().safe().nonnegative().optional(),
|
|
2947
|
+
minViews: z18.coerce.number().int().safe().nonnegative().optional(),
|
|
2948
|
+
limit: z18.coerce.number().int().min(1).max(100).default(25),
|
|
2949
|
+
cursor: z18.string().max(2048).optional(),
|
|
2710
2950
|
includeEvidence: booleanQuery.optional()
|
|
2711
2951
|
}).strict().refine(
|
|
2712
2952
|
(q) => q.since === void 0 || q.until === void 0 || q.until > q.since,
|
|
2713
2953
|
"Until must follow since"
|
|
2714
2954
|
))();
|
|
2715
|
-
var trackerPageSchema = /* @__PURE__ */ (() =>
|
|
2955
|
+
var trackerPageSchema = /* @__PURE__ */ (() => z18.object({
|
|
2716
2956
|
tracker: identifier,
|
|
2717
|
-
items:
|
|
2718
|
-
nextCursor:
|
|
2957
|
+
items: z18.array(trackerRecordSchema),
|
|
2958
|
+
nextCursor: z18.string().nullable(),
|
|
2719
2959
|
total: count,
|
|
2720
2960
|
status: trackerStatusSchema
|
|
2721
2961
|
}))();
|
|
2722
|
-
var trackerSummarySchema = /* @__PURE__ */ (() =>
|
|
2962
|
+
var trackerSummarySchema = /* @__PURE__ */ (() => z18.object({
|
|
2723
2963
|
records: count,
|
|
2724
2964
|
authors: count,
|
|
2725
|
-
metrics:
|
|
2965
|
+
metrics: z18.object({
|
|
2726
2966
|
likes: count,
|
|
2727
2967
|
replies: count,
|
|
2728
2968
|
reposts: count,
|
|
@@ -2738,26 +2978,26 @@ var trackerPreviewLimits = {
|
|
|
2738
2978
|
posts: 100,
|
|
2739
2979
|
days: 30
|
|
2740
2980
|
};
|
|
2741
|
-
var trackerPreviewInputSchema = /* @__PURE__ */ (() =>
|
|
2981
|
+
var trackerPreviewInputSchema = /* @__PURE__ */ (() => z18.object({
|
|
2742
2982
|
query: xSearchSourceSchema.shape.query,
|
|
2743
2983
|
/** Start of the searched window. The window ends when the sample is fetched. */
|
|
2744
2984
|
since: timestamp
|
|
2745
2985
|
}).strict())();
|
|
2746
|
-
var trackerPreviewSchema = /* @__PURE__ */ (() =>
|
|
2747
|
-
query:
|
|
2986
|
+
var trackerPreviewSchema = /* @__PURE__ */ (() => z18.object({
|
|
2987
|
+
query: z18.string(),
|
|
2748
2988
|
since: timestamp,
|
|
2749
2989
|
fetchedAt: timestamp,
|
|
2750
2990
|
pages: count,
|
|
2751
2991
|
/** Every match in the sample, newest first, verified or not. */
|
|
2752
|
-
posts:
|
|
2992
|
+
posts: z18.array(xTweetSchema).max(limits.trackerPreview.posts),
|
|
2753
2993
|
/** X had more matches than the sample holds. */
|
|
2754
|
-
more:
|
|
2994
|
+
more: z18.boolean()
|
|
2755
2995
|
}))();
|
|
2756
2996
|
|
|
2757
2997
|
// src/content.ts
|
|
2758
|
-
import * as
|
|
2759
|
-
var contentQualificationDecisionSchema = /* @__PURE__ */ (() =>
|
|
2760
|
-
kind:
|
|
2998
|
+
import * as z19 from "zod";
|
|
2999
|
+
var contentQualificationDecisionSchema = /* @__PURE__ */ (() => z19.strictObject({
|
|
3000
|
+
kind: z19.enum([
|
|
2761
3001
|
"accept",
|
|
2762
3002
|
"reject",
|
|
2763
3003
|
"review",
|
|
@@ -2765,26 +3005,26 @@ var contentQualificationDecisionSchema = /* @__PURE__ */ (() => z13.strictObject
|
|
|
2765
3005
|
"progress",
|
|
2766
3006
|
"superseded"
|
|
2767
3007
|
]),
|
|
2768
|
-
reason:
|
|
3008
|
+
reason: z19.string().nullable()
|
|
2769
3009
|
}))();
|
|
2770
|
-
var contentQualificationQuerySchema = /* @__PURE__ */ (() =>
|
|
3010
|
+
var contentQualificationQuerySchema = /* @__PURE__ */ (() => z19.strictObject({
|
|
2771
3011
|
quest: identifier,
|
|
2772
3012
|
member: identifier.optional(),
|
|
2773
3013
|
/** A content item's record ID in the quest's tracker. */
|
|
2774
|
-
content:
|
|
3014
|
+
content: z19.string().min(1).max(256).optional(),
|
|
2775
3015
|
cursor: pageCursorSchema.optional()
|
|
2776
3016
|
}))();
|
|
2777
|
-
var contentQualificationSchema = /* @__PURE__ */ (() =>
|
|
3017
|
+
var contentQualificationSchema = /* @__PURE__ */ (() => z19.strictObject({
|
|
2778
3018
|
quest: identifier,
|
|
2779
3019
|
/** The content item's record ID in the quest's tracker. */
|
|
2780
|
-
content:
|
|
3020
|
+
content: z19.string(),
|
|
2781
3021
|
member: identifier,
|
|
2782
3022
|
release: identifier,
|
|
2783
3023
|
attempt: identifier,
|
|
2784
3024
|
revision: identifier,
|
|
2785
3025
|
observation: identifier,
|
|
2786
|
-
current:
|
|
2787
|
-
state:
|
|
3026
|
+
current: z19.boolean(),
|
|
3027
|
+
state: z19.enum([
|
|
2788
3028
|
"pending",
|
|
2789
3029
|
"qualified",
|
|
2790
3030
|
"unqualified",
|
|
@@ -2795,117 +3035,117 @@ var contentQualificationSchema = /* @__PURE__ */ (() => z13.strictObject({
|
|
|
2795
3035
|
"blocked",
|
|
2796
3036
|
"unavailable"
|
|
2797
3037
|
]),
|
|
2798
|
-
reason:
|
|
2799
|
-
reward:
|
|
3038
|
+
reason: z19.string().nullable(),
|
|
3039
|
+
reward: z19.strictObject({
|
|
2800
3040
|
attempt: identifier.nullable(),
|
|
2801
3041
|
completion: identifier.nullable(),
|
|
2802
|
-
state:
|
|
3042
|
+
state: z19.enum(["unresolved", "awarded", "excluded"])
|
|
2803
3043
|
})
|
|
2804
3044
|
}))();
|
|
2805
|
-
var contentQualificationPageSchema = /* @__PURE__ */ (() =>
|
|
2806
|
-
items:
|
|
3045
|
+
var contentQualificationPageSchema = /* @__PURE__ */ (() => z19.strictObject({
|
|
3046
|
+
items: z19.array(contentQualificationSchema),
|
|
2807
3047
|
nextCursor: pageCursorSchema.nullable()
|
|
2808
3048
|
}))();
|
|
2809
3049
|
var contentMetricSchema = contentMetricNameSchema;
|
|
2810
|
-
var contentMetricsSchema = /* @__PURE__ */ (() =>
|
|
3050
|
+
var contentMetricsSchema = /* @__PURE__ */ (() => z19.record(
|
|
2811
3051
|
contentMetricSchema,
|
|
2812
|
-
|
|
3052
|
+
z19.number().int().safe().nonnegative()
|
|
2813
3053
|
))();
|
|
2814
|
-
var contentPerformancePolicySchema = /* @__PURE__ */ (() =>
|
|
2815
|
-
metrics:
|
|
3054
|
+
var contentPerformancePolicySchema = /* @__PURE__ */ (() => z19.strictObject({
|
|
3055
|
+
metrics: z19.array(contentMetricSchema).min(1).max(10).refine(
|
|
2816
3056
|
(values2) => new Set(values2).size === values2.length,
|
|
2817
3057
|
"Metrics must be unique"
|
|
2818
3058
|
),
|
|
2819
|
-
maxAgeMs:
|
|
3059
|
+
maxAgeMs: z19.number().int().positive().max(864e5).default(36e5)
|
|
2820
3060
|
}))();
|
|
2821
3061
|
|
|
2822
3062
|
// src/counters.ts
|
|
2823
|
-
import * as
|
|
3063
|
+
import * as z20 from "zod";
|
|
2824
3064
|
var day = 864e5;
|
|
2825
|
-
var counterGoalSchema = /* @__PURE__ */ (() =>
|
|
2826
|
-
kind:
|
|
2827
|
-
count:
|
|
3065
|
+
var counterGoalSchema = /* @__PURE__ */ (() => z20.object({
|
|
3066
|
+
kind: z20.literal("count"),
|
|
3067
|
+
count: z20.number().int().min(1).max(1e4)
|
|
2828
3068
|
}).strict())();
|
|
2829
|
-
var counterWindowSchema = /* @__PURE__ */ (() =>
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
kind:
|
|
2833
|
-
period:
|
|
2834
|
-
latenessMs:
|
|
3069
|
+
var counterWindowSchema = /* @__PURE__ */ (() => z20.discriminatedUnion("kind", [
|
|
3070
|
+
z20.object({ kind: z20.literal("lifetime") }).strict(),
|
|
3071
|
+
z20.object({
|
|
3072
|
+
kind: z20.literal("calendar"),
|
|
3073
|
+
period: z20.enum(["day", "week", "month"]),
|
|
3074
|
+
latenessMs: z20.number().int().min(0).max(90 * day).default(7 * day)
|
|
2835
3075
|
}).strict(),
|
|
2836
|
-
|
|
2837
|
-
kind:
|
|
2838
|
-
durationMs:
|
|
3076
|
+
z20.object({
|
|
3077
|
+
kind: z20.literal("rolling"),
|
|
3078
|
+
durationMs: z20.number().int().min(1).max(365 * day)
|
|
2839
3079
|
}).strict()
|
|
2840
3080
|
]))();
|
|
2841
|
-
var counterPolicySchema = /* @__PURE__ */ (() =>
|
|
2842
|
-
kind:
|
|
3081
|
+
var counterPolicySchema = /* @__PURE__ */ (() => z20.object({
|
|
3082
|
+
kind: z20.literal("progress"),
|
|
2843
3083
|
goal: counterGoalSchema,
|
|
2844
3084
|
window: counterWindowSchema,
|
|
2845
|
-
repeat:
|
|
3085
|
+
repeat: z20.enum(["once", "repeat"]).default("once")
|
|
2846
3086
|
}).strict())();
|
|
2847
|
-
var achievementBase = /* @__PURE__ */ (() =>
|
|
3087
|
+
var achievementBase = /* @__PURE__ */ (() => z20.object({
|
|
2848
3088
|
id: identifier,
|
|
2849
|
-
ordinal:
|
|
2850
|
-
achievedAt:
|
|
2851
|
-
window:
|
|
3089
|
+
ordinal: z20.number().int().positive(),
|
|
3090
|
+
achievedAt: z20.number().int(),
|
|
3091
|
+
window: z20.string()
|
|
2852
3092
|
}))();
|
|
2853
|
-
var counterAchievementSchema = /* @__PURE__ */ (() =>
|
|
3093
|
+
var counterAchievementSchema = /* @__PURE__ */ (() => z20.discriminatedUnion("status", [
|
|
2854
3094
|
achievementBase.extend({
|
|
2855
|
-
status:
|
|
3095
|
+
status: z20.literal("revoked"),
|
|
2856
3096
|
completion: identifier,
|
|
2857
|
-
revokedAt:
|
|
3097
|
+
revokedAt: z20.number().int()
|
|
2858
3098
|
}),
|
|
2859
3099
|
achievementBase.extend({
|
|
2860
|
-
status:
|
|
3100
|
+
status: z20.literal("awarded"),
|
|
2861
3101
|
completion: identifier
|
|
2862
3102
|
}),
|
|
2863
3103
|
achievementBase.extend({
|
|
2864
|
-
status:
|
|
3104
|
+
status: z20.literal("budget-exhausted"),
|
|
2865
3105
|
budget: identifier
|
|
2866
3106
|
})
|
|
2867
3107
|
]))();
|
|
2868
|
-
var counterProgressSchema = /* @__PURE__ */ (() =>
|
|
2869
|
-
goal:
|
|
2870
|
-
current:
|
|
2871
|
-
window:
|
|
2872
|
-
key:
|
|
2873
|
-
start:
|
|
2874
|
-
end:
|
|
3108
|
+
var counterProgressSchema = /* @__PURE__ */ (() => z20.object({
|
|
3109
|
+
goal: z20.number().int().positive(),
|
|
3110
|
+
current: z20.number().int().nonnegative(),
|
|
3111
|
+
window: z20.object({
|
|
3112
|
+
key: z20.string(),
|
|
3113
|
+
start: z20.number().int().nullable(),
|
|
3114
|
+
end: z20.number().int().nullable()
|
|
2875
3115
|
}),
|
|
2876
|
-
repeat:
|
|
2877
|
-
settled:
|
|
3116
|
+
repeat: z20.enum(["once", "repeat"]),
|
|
3117
|
+
settled: z20.number().int().nonnegative(),
|
|
2878
3118
|
latest: counterAchievementSchema.nullable()
|
|
2879
3119
|
}))();
|
|
2880
|
-
var counterContributionSchema = /* @__PURE__ */ (() =>
|
|
3120
|
+
var counterContributionSchema = /* @__PURE__ */ (() => z20.object({
|
|
2881
3121
|
id: identifier,
|
|
2882
|
-
distinct:
|
|
3122
|
+
distinct: z20.string(),
|
|
2883
3123
|
attempt: identifier,
|
|
2884
|
-
occurredAt:
|
|
2885
|
-
recordedAt:
|
|
2886
|
-
window:
|
|
2887
|
-
status:
|
|
3124
|
+
occurredAt: z20.number().int(),
|
|
3125
|
+
recordedAt: z20.number().int(),
|
|
3126
|
+
window: z20.string(),
|
|
3127
|
+
status: z20.enum(["counted", "late", "future", "excluded"]),
|
|
2888
3128
|
achievement: counterAchievementSchema.nullable(),
|
|
2889
|
-
reason:
|
|
3129
|
+
reason: z20.string().nullable()
|
|
2890
3130
|
}))();
|
|
2891
|
-
var counterHistorySchema = /* @__PURE__ */ (() =>
|
|
2892
|
-
items:
|
|
2893
|
-
nextCursor:
|
|
3131
|
+
var counterHistorySchema = /* @__PURE__ */ (() => z20.object({
|
|
3132
|
+
items: z20.array(counterContributionSchema),
|
|
3133
|
+
nextCursor: z20.string().nullable()
|
|
2894
3134
|
}))();
|
|
2895
|
-
var counterModerationSchema = /* @__PURE__ */ (() =>
|
|
2896
|
-
actionId:
|
|
2897
|
-
excluded:
|
|
2898
|
-
reason:
|
|
3135
|
+
var counterModerationSchema = /* @__PURE__ */ (() => z20.object({
|
|
3136
|
+
actionId: z20.uuid(),
|
|
3137
|
+
excluded: z20.boolean(),
|
|
3138
|
+
reason: z20.string().trim().min(1).max(2e3)
|
|
2899
3139
|
}).strict())();
|
|
2900
|
-
var counterHistoryQuerySchema = /* @__PURE__ */ (() =>
|
|
2901
|
-
cursor:
|
|
2902
|
-
limit:
|
|
3140
|
+
var counterHistoryQuerySchema = /* @__PURE__ */ (() => z20.object({
|
|
3141
|
+
cursor: z20.string().max(2e3).optional(),
|
|
3142
|
+
limit: z20.coerce.number().int().min(1).max(100).optional()
|
|
2903
3143
|
}).strict())();
|
|
2904
|
-
var counterModerationResultSchema = /* @__PURE__ */ (() =>
|
|
3144
|
+
var counterModerationResultSchema = /* @__PURE__ */ (() => z20.object({ excluded: z20.boolean() }))();
|
|
2905
3145
|
|
|
2906
3146
|
// src/calendar.ts
|
|
2907
|
-
import * as
|
|
2908
|
-
var timestamp2 = /* @__PURE__ */ (() =>
|
|
3147
|
+
import * as z21 from "zod";
|
|
3148
|
+
var timestamp2 = /* @__PURE__ */ (() => z21.number().int().safe())();
|
|
2909
3149
|
var fixedOffset = /^(?:[+-]|(?:Etc\/)?GMT[+-]\d|(?:EST|MST|HST)$)/i;
|
|
2910
3150
|
function canonicalTimeZone(zone) {
|
|
2911
3151
|
let resolved;
|
|
@@ -2921,18 +3161,18 @@ function canonicalTimeZone(zone) {
|
|
|
2921
3161
|
}
|
|
2922
3162
|
return fixedOffset.test(zone) || fixedOffset.test(resolved) ? null : resolved;
|
|
2923
3163
|
}
|
|
2924
|
-
var timeZoneSchema = /* @__PURE__ */ (() =>
|
|
3164
|
+
var timeZoneSchema = /* @__PURE__ */ (() => z21.string().min(1).max(100).transform((zone, ctx) => {
|
|
2925
3165
|
const canonical = canonicalTimeZone(zone);
|
|
2926
3166
|
if (canonical === null) {
|
|
2927
3167
|
ctx.addIssue({
|
|
2928
3168
|
code: "custom",
|
|
2929
3169
|
message: fixedOffset.test(zone) ? "Use a named IANA timezone, such as Europe/Budapest or UTC. Fixed offsets have no daylight-saving rules." : "Use an IANA timezone name, such as Europe/Budapest or UTC"
|
|
2930
3170
|
});
|
|
2931
|
-
return
|
|
3171
|
+
return z21.NEVER;
|
|
2932
3172
|
}
|
|
2933
3173
|
return canonical;
|
|
2934
3174
|
}))();
|
|
2935
|
-
var timeZoneNameSchema = /* @__PURE__ */ (() =>
|
|
3175
|
+
var timeZoneNameSchema = /* @__PURE__ */ (() => z21.string().min(1).max(100))();
|
|
2936
3176
|
var movedTimeZone = (what) => `${what} no longer take a timeZone: they follow the project calendar. Set calendar.timeZone in relay.json or in Console settings.`;
|
|
2937
3177
|
var record6 = (value) => typeof value === "object" && value !== null;
|
|
2938
3178
|
function refuseStreakTimeZone(value, ctx) {
|
|
@@ -2956,78 +3196,78 @@ function refuseWindowTimeZone(value, ctx) {
|
|
|
2956
3196
|
}
|
|
2957
3197
|
return value;
|
|
2958
3198
|
}
|
|
2959
|
-
var calendarPeriodSchema = /* @__PURE__ */ (() =>
|
|
2960
|
-
var projectCalendarSchema = /* @__PURE__ */ (() =>
|
|
3199
|
+
var calendarPeriodSchema = /* @__PURE__ */ (() => z21.enum(["lifetime", "day", "week", "month"]))();
|
|
3200
|
+
var projectCalendarSchema = /* @__PURE__ */ (() => z21.object({
|
|
2961
3201
|
/** The timezone of the current calendar day. */
|
|
2962
3202
|
timeZone: timeZoneNameSchema,
|
|
2963
3203
|
/** The current calendar date, such as `2026-10-01`. */
|
|
2964
|
-
today:
|
|
3204
|
+
today: z21.string(),
|
|
2965
3205
|
/** When the current calendar day ends, in epoch milliseconds. */
|
|
2966
3206
|
nextBoundary: timestamp2,
|
|
2967
3207
|
/** A change that takes effect at the next day boundary, or null. */
|
|
2968
|
-
pending:
|
|
3208
|
+
pending: z21.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp2 }).nullable(),
|
|
2969
3209
|
/** The `calendar.timeZone` the last deployment that declared one set, or null. */
|
|
2970
3210
|
declared: timeZoneNameSchema.nullable(),
|
|
2971
3211
|
/**
|
|
2972
3212
|
* A stored timezone the calendar no longer accepts, such as a fixed offset a streak named before
|
|
2973
3213
|
* v1. The calendar reads it as UTC until an operator chooses a timezone. Null otherwise.
|
|
2974
3214
|
*/
|
|
2975
|
-
unsupported:
|
|
3215
|
+
unsupported: z21.string().nullable().default(null)
|
|
2976
3216
|
}))();
|
|
2977
|
-
var projectCalendarInputSchema = /* @__PURE__ */ (() =>
|
|
3217
|
+
var projectCalendarInputSchema = /* @__PURE__ */ (() => z21.object({
|
|
2978
3218
|
actionId: identifier,
|
|
2979
3219
|
timeZone: timeZoneSchema,
|
|
2980
|
-
reason:
|
|
3220
|
+
reason: z21.string().trim().min(1).max(500)
|
|
2981
3221
|
}).strict())();
|
|
2982
|
-
var projectCalendarDeclarationSchema = /* @__PURE__ */ (() =>
|
|
3222
|
+
var projectCalendarDeclarationSchema = /* @__PURE__ */ (() => z21.object({ timeZone: timeZoneSchema }).strict())();
|
|
2983
3223
|
|
|
2984
3224
|
// src/streaks.ts
|
|
2985
|
-
import * as
|
|
2986
|
-
var streakPolicySchema = /* @__PURE__ */ (() =>
|
|
2987
|
-
kind:
|
|
2988
|
-
days:
|
|
2989
|
-
}))();
|
|
2990
|
-
var streakProgressSchema = /* @__PURE__ */ (() =>
|
|
2991
|
-
goal:
|
|
2992
|
-
current:
|
|
2993
|
-
best:
|
|
2994
|
-
today:
|
|
2995
|
-
todayQualified:
|
|
3225
|
+
import * as z22 from "zod";
|
|
3226
|
+
var streakPolicySchema = /* @__PURE__ */ (() => z22.object({
|
|
3227
|
+
kind: z22.literal("streak"),
|
|
3228
|
+
days: z22.number().int().min(1).max(3650)
|
|
3229
|
+
}))();
|
|
3230
|
+
var streakProgressSchema = /* @__PURE__ */ (() => z22.object({
|
|
3231
|
+
goal: z22.number().int().positive(),
|
|
3232
|
+
current: z22.number().int().nonnegative(),
|
|
3233
|
+
best: z22.number().int().nonnegative(),
|
|
3234
|
+
today: z22.string(),
|
|
3235
|
+
todayQualified: z22.boolean(),
|
|
2996
3236
|
timeZone: timeZoneNameSchema,
|
|
2997
|
-
nextBoundary:
|
|
2998
|
-
pendingTimeZone:
|
|
3237
|
+
nextBoundary: z22.number().int(),
|
|
3238
|
+
pendingTimeZone: z22.object({
|
|
2999
3239
|
timeZone: timeZoneNameSchema,
|
|
3000
|
-
effectiveAt:
|
|
3240
|
+
effectiveAt: z22.number().int()
|
|
3001
3241
|
}).nullable(),
|
|
3002
|
-
days:
|
|
3003
|
-
|
|
3004
|
-
day:
|
|
3005
|
-
date:
|
|
3242
|
+
days: z22.array(
|
|
3243
|
+
z22.object({
|
|
3244
|
+
day: z22.number().int(),
|
|
3245
|
+
date: z22.string(),
|
|
3006
3246
|
// The zone the day was recorded in, as stored: days from before v1 can name a fixed offset.
|
|
3007
|
-
timeZone:
|
|
3008
|
-
occurredAt:
|
|
3247
|
+
timeZone: z22.string(),
|
|
3248
|
+
occurredAt: z22.number().int()
|
|
3009
3249
|
})
|
|
3010
3250
|
),
|
|
3011
|
-
milestone:
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
status:
|
|
3015
|
-
completion:
|
|
3016
|
-
achievedAt:
|
|
3251
|
+
milestone: z22.discriminatedUnion("status", [
|
|
3252
|
+
z22.object({ status: z22.literal("pending") }),
|
|
3253
|
+
z22.object({
|
|
3254
|
+
status: z22.literal("awarded"),
|
|
3255
|
+
completion: z22.string(),
|
|
3256
|
+
achievedAt: z22.number().int()
|
|
3017
3257
|
}),
|
|
3018
|
-
|
|
3019
|
-
status:
|
|
3020
|
-
budget:
|
|
3021
|
-
achievedAt:
|
|
3258
|
+
z22.object({
|
|
3259
|
+
status: z22.literal("budget-exhausted"),
|
|
3260
|
+
budget: z22.string(),
|
|
3261
|
+
achievedAt: z22.number().int()
|
|
3022
3262
|
})
|
|
3023
3263
|
])
|
|
3024
3264
|
}))();
|
|
3025
3265
|
|
|
3026
3266
|
// src/tracker-triggers.ts
|
|
3027
|
-
import * as
|
|
3028
|
-
var timestamp3 = /* @__PURE__ */ (() =>
|
|
3029
|
-
var count2 = /* @__PURE__ */ (() =>
|
|
3030
|
-
var trackerTriggerModeSchema = /* @__PURE__ */ (() =>
|
|
3267
|
+
import * as z23 from "zod";
|
|
3268
|
+
var timestamp3 = /* @__PURE__ */ (() => z23.number().int().safe().nonnegative().max(864e13))();
|
|
3269
|
+
var count2 = /* @__PURE__ */ (() => z23.number().int().safe().nonnegative())();
|
|
3270
|
+
var trackerTriggerModeSchema = /* @__PURE__ */ (() => z23.enum([
|
|
3031
3271
|
"new-record",
|
|
3032
3272
|
"new-observation",
|
|
3033
3273
|
"data-changed"
|
|
@@ -3035,20 +3275,20 @@ var trackerTriggerModeSchema = /* @__PURE__ */ (() => z17.enum([
|
|
|
3035
3275
|
function defaultTriggerMode(source, namespace) {
|
|
3036
3276
|
return source === "custom" && namespace !== telegramMessagesNamespace && namespace !== telegramReactionsNamespace && namespace !== walletProgramActivityNamespace ? "new-observation" : "new-record";
|
|
3037
3277
|
}
|
|
3038
|
-
var trackerBoundSchema = /* @__PURE__ */ (() =>
|
|
3039
|
-
|
|
3040
|
-
|
|
3278
|
+
var trackerBoundSchema = /* @__PURE__ */ (() => z23.union([
|
|
3279
|
+
z23.number().finite(),
|
|
3280
|
+
z23.strictObject({ setting: z23.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
|
|
3041
3281
|
]))();
|
|
3042
|
-
var dataPath = /* @__PURE__ */ (() =>
|
|
3282
|
+
var dataPath = /* @__PURE__ */ (() => z23.string().max(200).regex(
|
|
3043
3283
|
/^[^.\s]+(\.[^.\s]+)*$/,
|
|
3044
3284
|
"Use dot-separated keys, such as metrics.likes"
|
|
3045
3285
|
))();
|
|
3046
|
-
var trackerConditionSchema = /* @__PURE__ */ (() =>
|
|
3047
|
-
|
|
3286
|
+
var trackerConditionSchema = /* @__PURE__ */ (() => z23.union([
|
|
3287
|
+
z23.strictObject({
|
|
3048
3288
|
path: dataPath,
|
|
3049
|
-
equals:
|
|
3289
|
+
equals: z23.union([z23.string().max(1e3), z23.number().finite(), z23.boolean()])
|
|
3050
3290
|
}),
|
|
3051
|
-
|
|
3291
|
+
z23.strictObject({
|
|
3052
3292
|
path: dataPath,
|
|
3053
3293
|
gt: trackerBoundSchema.optional(),
|
|
3054
3294
|
gte: trackerBoundSchema.optional(),
|
|
@@ -3061,9 +3301,9 @@ var trackerConditionSchema = /* @__PURE__ */ (() => z17.union([
|
|
|
3061
3301
|
"Compare with equals, gt, gte, lt or lte"
|
|
3062
3302
|
)
|
|
3063
3303
|
]))();
|
|
3064
|
-
var trackerWhereSchema = /* @__PURE__ */ (() =>
|
|
3304
|
+
var trackerWhereSchema = /* @__PURE__ */ (() => z23.union([
|
|
3065
3305
|
trackerConditionSchema,
|
|
3066
|
-
|
|
3306
|
+
z23.array(trackerConditionSchema).min(1).max(10)
|
|
3067
3307
|
]))();
|
|
3068
3308
|
function whereConditions(where) {
|
|
3069
3309
|
return where === void 0 ? [] : Array.isArray(where) ? where : [where];
|
|
@@ -3075,17 +3315,17 @@ function whereSettings(where) {
|
|
|
3075
3315
|
)
|
|
3076
3316
|
);
|
|
3077
3317
|
}
|
|
3078
|
-
var triggerEnrollmentSchema = /* @__PURE__ */ (() =>
|
|
3079
|
-
var triggerSinceSchema = /* @__PURE__ */ (() =>
|
|
3080
|
-
var triggerHistoricalSchema = /* @__PURE__ */ (() =>
|
|
3081
|
-
var trackerTriggerPolicySchema = /* @__PURE__ */ (() =>
|
|
3318
|
+
var triggerEnrollmentSchema = /* @__PURE__ */ (() => z23.enum(["none", "required"]))();
|
|
3319
|
+
var triggerSinceSchema = /* @__PURE__ */ (() => z23.enum(["activation", "window", "enrollment"]))();
|
|
3320
|
+
var triggerHistoricalSchema = /* @__PURE__ */ (() => z23.enum(["staff", "claim", "automatic"]))();
|
|
3321
|
+
var trackerTriggerPolicySchema = /* @__PURE__ */ (() => z23.strictObject({
|
|
3082
3322
|
/** The tracker's authoring key; publication binds it to the tracker's stable ID. */
|
|
3083
3323
|
tracker: identifier,
|
|
3084
3324
|
/**
|
|
3085
3325
|
* The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
|
|
3086
3326
|
* releases keep parsing them when a later Relay adds a managed source.
|
|
3087
3327
|
*/
|
|
3088
|
-
source:
|
|
3328
|
+
source: z23.string().min(1).max(100),
|
|
3089
3329
|
/** Which observations fire. */
|
|
3090
3330
|
on: trackerTriggerModeSchema,
|
|
3091
3331
|
where: trackerWhereSchema.optional(),
|
|
@@ -3106,7 +3346,7 @@ var trackerTriggerPolicySchema = /* @__PURE__ */ (() => z17.strictObject({
|
|
|
3106
3346
|
* that re-evaluates edits and runs `performance`, firing on each new record and paying its
|
|
3107
3347
|
* author.
|
|
3108
3348
|
*/
|
|
3109
|
-
content:
|
|
3349
|
+
content: z23.literal(true).optional()
|
|
3110
3350
|
}).refine(
|
|
3111
3351
|
(policy) => policy.since !== "enrollment" || policy.enrollment === "required",
|
|
3112
3352
|
'since: "enrollment" needs enrollment: "required"'
|
|
@@ -3125,72 +3365,72 @@ function beneficiaryRole(policy) {
|
|
|
3125
3365
|
return policy.beneficiary;
|
|
3126
3366
|
}
|
|
3127
3367
|
var xLink = /* @__PURE__ */ (() => ({
|
|
3128
|
-
issuer:
|
|
3368
|
+
issuer: z23.string().min(1),
|
|
3129
3369
|
/** The account's stable user ID. */
|
|
3130
|
-
subject:
|
|
3370
|
+
subject: z23.string().min(1).max(256),
|
|
3131
3371
|
/** The member's account selection revision. */
|
|
3132
3372
|
revision: count2,
|
|
3133
3373
|
/** When the member linked the account; null when unknown. */
|
|
3134
3374
|
linkedAt: timestamp3.nullable()
|
|
3135
3375
|
}))();
|
|
3136
|
-
var trackerAttributionSchema = /* @__PURE__ */ (() =>
|
|
3376
|
+
var trackerAttributionSchema = /* @__PURE__ */ (() => z23.object({
|
|
3137
3377
|
member: identifier,
|
|
3138
3378
|
capturedAt: timestamp3,
|
|
3139
|
-
account:
|
|
3140
|
-
|
|
3141
|
-
provider:
|
|
3379
|
+
account: z23.union([
|
|
3380
|
+
z23.object({
|
|
3381
|
+
provider: z23.literal("wallet"),
|
|
3142
3382
|
/** Canonical CAIP-10 account ID, as the record names it. */
|
|
3143
|
-
id:
|
|
3383
|
+
id: z23.string().min(5).max(256),
|
|
3144
3384
|
/** The wallet link's revision. */
|
|
3145
3385
|
revision: count2,
|
|
3146
3386
|
/** When the member verified the wallet. */
|
|
3147
3387
|
linkedAt: timestamp3.nullable()
|
|
3148
3388
|
}),
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
provider:
|
|
3389
|
+
z23.object({ provider: z23.literal("x"), ...xLink }),
|
|
3390
|
+
z23.object({ provider: z23.literal("discord"), ...xLink }),
|
|
3391
|
+
z23.object({
|
|
3392
|
+
provider: z23.literal("member"),
|
|
3153
3393
|
/** The member ID the record names. */
|
|
3154
3394
|
id: identifier
|
|
3155
3395
|
}),
|
|
3156
|
-
|
|
3396
|
+
z23.object({
|
|
3157
3397
|
/** Your app's identity kind, such as `app:game`. */
|
|
3158
3398
|
provider: appIdentityKindSchema,
|
|
3159
3399
|
/** The subject your app signed the member in with, as the record names it. */
|
|
3160
|
-
subject:
|
|
3400
|
+
subject: z23.string().min(1).max(256),
|
|
3161
3401
|
/** The identity's revision in the project. */
|
|
3162
3402
|
revision: count2,
|
|
3163
3403
|
/** When the identity was linked to the member. */
|
|
3164
3404
|
linkedAt: timestamp3.nullable()
|
|
3165
3405
|
}),
|
|
3166
3406
|
/** A kind a later Relay adds. */
|
|
3167
|
-
|
|
3407
|
+
z23.object({ provider: z23.string().min(1) })
|
|
3168
3408
|
])
|
|
3169
3409
|
}))();
|
|
3170
|
-
var trackerTriggerRecordSchema = /* @__PURE__ */ (() =>
|
|
3171
|
-
id:
|
|
3172
|
-
source:
|
|
3410
|
+
var trackerTriggerRecordSchema = /* @__PURE__ */ (() => z23.object({
|
|
3411
|
+
id: z23.string().min(1).max(256),
|
|
3412
|
+
source: z23.string(),
|
|
3173
3413
|
occurredAt: timestamp3,
|
|
3174
3414
|
observedAt: timestamp3,
|
|
3175
3415
|
firstSeenAt: timestamp3,
|
|
3176
|
-
author:
|
|
3177
|
-
id:
|
|
3178
|
-
verified:
|
|
3416
|
+
author: z23.object({
|
|
3417
|
+
id: z23.string().min(1).max(256),
|
|
3418
|
+
verified: z23.boolean().nullable(),
|
|
3179
3419
|
kind: openIdentityKindSchema.optional()
|
|
3180
3420
|
}).nullable(),
|
|
3181
|
-
accounts:
|
|
3182
|
-
data:
|
|
3183
|
-
removed:
|
|
3421
|
+
accounts: z23.record(accountRoleSchema, trackerRecordAccountSchema).optional(),
|
|
3422
|
+
data: z23.record(z23.string(), z23.json()),
|
|
3423
|
+
removed: z23.boolean()
|
|
3184
3424
|
}))();
|
|
3185
|
-
var trackerContentStageSchema = /* @__PURE__ */ (() =>
|
|
3425
|
+
var trackerContentStageSchema = /* @__PURE__ */ (() => z23.object({
|
|
3186
3426
|
/** The body's revision: the hash of its canonical JSON. Edits make a new one. */
|
|
3187
3427
|
revision: identifier,
|
|
3188
3428
|
/** The captured observation that carried this body. */
|
|
3189
3429
|
observation: identifier,
|
|
3190
3430
|
/** The body: an X post's normalized body, or a custom record's `data.body`. */
|
|
3191
|
-
body:
|
|
3431
|
+
body: z23.record(z23.string(), z23.json())
|
|
3192
3432
|
}))();
|
|
3193
|
-
var trackerTriggerContextSchema = /* @__PURE__ */ (() =>
|
|
3433
|
+
var trackerTriggerContextSchema = /* @__PURE__ */ (() => z23.object({
|
|
3194
3434
|
/** The tracker's stable ID. */
|
|
3195
3435
|
tracker: identifier,
|
|
3196
3436
|
/** The tracker's authoring key. */
|
|
@@ -3212,7 +3452,7 @@ var trackerTriggerContextSchema = /* @__PURE__ */ (() => z17.object({
|
|
|
3212
3452
|
}))();
|
|
3213
3453
|
|
|
3214
3454
|
// src/reject-codes.ts
|
|
3215
|
-
import * as
|
|
3455
|
+
import * as z24 from "zod";
|
|
3216
3456
|
var reservedAttemptCodes = /* @__PURE__ */ (() => Object.freeze([
|
|
3217
3457
|
"budget-exhausted",
|
|
3218
3458
|
"defer-expired",
|
|
@@ -3238,7 +3478,7 @@ function rejectCodeIssue(code) {
|
|
|
3238
3478
|
}
|
|
3239
3479
|
return null;
|
|
3240
3480
|
}
|
|
3241
|
-
var rejectCodeSchema = /* @__PURE__ */ (() =>
|
|
3481
|
+
var rejectCodeSchema = /* @__PURE__ */ (() => z24.string().superRefine((code, context) => {
|
|
3242
3482
|
const issue = rejectCodeIssue(code);
|
|
3243
3483
|
if (issue) {
|
|
3244
3484
|
context.addIssue({ code: "custom", message: issue });
|
|
@@ -3246,7 +3486,7 @@ var rejectCodeSchema = /* @__PURE__ */ (() => z18.string().superRefine((code, co
|
|
|
3246
3486
|
}))();
|
|
3247
3487
|
|
|
3248
3488
|
// src/sdk-runtime.ts
|
|
3249
|
-
import * as
|
|
3489
|
+
import * as z25 from "zod";
|
|
3250
3490
|
var questScaleLimits = {
|
|
3251
3491
|
quests: 1e3,
|
|
3252
3492
|
questTypes: 200,
|
|
@@ -3257,22 +3497,22 @@ var sdkRuntimeLimits = {
|
|
|
3257
3497
|
/** Characters of module source, summed over all modules. */
|
|
3258
3498
|
size: 2e6
|
|
3259
3499
|
};
|
|
3260
|
-
var sha256 = /* @__PURE__ */ (() =>
|
|
3261
|
-
var sdkRuntimeModulePathSchema = /* @__PURE__ */ (() =>
|
|
3500
|
+
var sha256 = /* @__PURE__ */ (() => z25.string().regex(/^[0-9a-f]{64}$/))();
|
|
3501
|
+
var sdkRuntimeModulePathSchema = /* @__PURE__ */ (() => z25.string().max(200).regex(/^[a-z0-9_][a-z0-9_.-]*(\/[a-z0-9_][a-z0-9_.-]*)*\.js$/i).refine(
|
|
3262
3502
|
(path) => !path.split("/").some((part) => part === "." || part === ".."),
|
|
3263
3503
|
"Runtime module paths cannot contain . or .. segments"
|
|
3264
3504
|
))();
|
|
3265
|
-
var sdkRuntimeReferenceSchema = /* @__PURE__ */ (() =>
|
|
3505
|
+
var sdkRuntimeReferenceSchema = /* @__PURE__ */ (() => z25.object({
|
|
3266
3506
|
digest: sha256,
|
|
3267
3507
|
/** The SDK version that built the runtime, for display. The digest is what pins it. */
|
|
3268
|
-
sdkVersion:
|
|
3508
|
+
sdkVersion: z25.string().min(1).max(64)
|
|
3269
3509
|
}).strict())();
|
|
3270
|
-
var sdkRuntimeModulesSchema = /* @__PURE__ */ (() =>
|
|
3510
|
+
var sdkRuntimeModulesSchema = /* @__PURE__ */ (() => z25.record(sdkRuntimeModulePathSchema, z25.string().min(1)).refine((modules) => {
|
|
3271
3511
|
const entries = Object.values(modules);
|
|
3272
3512
|
return entries.length > 0 && entries.length <= limits.sdkRuntime.modules && entries.reduce((sum, source) => sum + source.length, 0) <= limits.sdkRuntime.size;
|
|
3273
3513
|
}, `A runtime has 1 to ${limits.sdkRuntime.modules} modules and at most ${limits.sdkRuntime.size} characters of source`))();
|
|
3274
3514
|
var sdkRuntimeSchema = /* @__PURE__ */ (() => sdkRuntimeReferenceSchema.extend({
|
|
3275
|
-
zodVersion:
|
|
3515
|
+
zodVersion: z25.string().min(1).max(64),
|
|
3276
3516
|
modules: sdkRuntimeModulesSchema
|
|
3277
3517
|
}).strict())();
|
|
3278
3518
|
async function sdkRuntimeDigest(modules) {
|
|
@@ -3287,69 +3527,69 @@ async function sdkRuntimeDigest(modules) {
|
|
|
3287
3527
|
}
|
|
3288
3528
|
|
|
3289
3529
|
// src/completion.ts
|
|
3290
|
-
import * as
|
|
3291
|
-
var name = /* @__PURE__ */ (() =>
|
|
3292
|
-
var completionPolicySchema = /* @__PURE__ */ (() =>
|
|
3530
|
+
import * as z26 from "zod";
|
|
3531
|
+
var name = /* @__PURE__ */ (() => z26.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/))();
|
|
3532
|
+
var completionPolicySchema = /* @__PURE__ */ (() => z26.discriminatedUnion("kind", [
|
|
3293
3533
|
streakPolicySchema,
|
|
3294
3534
|
counterPolicySchema,
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
kind:
|
|
3535
|
+
z26.object({ kind: z26.literal("once") }).strict(),
|
|
3536
|
+
z26.object({
|
|
3537
|
+
kind: z26.literal("keyed"),
|
|
3298
3538
|
/**
|
|
3299
3539
|
* `"members"`: a key completes the quest once for the whole project and environment, not once
|
|
3300
3540
|
* per member. Another member's attempt with a key already used is rejected with `key-used`.
|
|
3301
3541
|
*/
|
|
3302
|
-
across:
|
|
3542
|
+
across: z26.literal("members").optional()
|
|
3303
3543
|
}).strict()
|
|
3304
3544
|
]))();
|
|
3305
|
-
var completionKeySchema = /* @__PURE__ */ (() =>
|
|
3306
|
-
var budgetSchema = /* @__PURE__ */ (() =>
|
|
3545
|
+
var completionKeySchema = /* @__PURE__ */ (() => z26.string().min(1).max(500))();
|
|
3546
|
+
var budgetSchema = /* @__PURE__ */ (() => z26.object({
|
|
3307
3547
|
id: name,
|
|
3308
|
-
scope:
|
|
3548
|
+
scope: z26.enum(["member", "project"]),
|
|
3309
3549
|
/**
|
|
3310
3550
|
* The project calendar period of the attempt's eligibility time that one bucket covers:
|
|
3311
3551
|
* `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
|
|
3312
3552
|
* `"lifetime"` never resets.
|
|
3313
3553
|
*/
|
|
3314
3554
|
period: calendarPeriodSchema,
|
|
3315
|
-
limit:
|
|
3316
|
-
cost:
|
|
3317
|
-
|
|
3318
|
-
|
|
3555
|
+
limit: z26.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
3556
|
+
cost: z26.union([
|
|
3557
|
+
z26.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
3558
|
+
z26.object({ balance: name }).strict()
|
|
3319
3559
|
])
|
|
3320
3560
|
}).strict())();
|
|
3321
|
-
var authorBudgetSchema = /* @__PURE__ */ (() => budgetSchema.extend({ scope:
|
|
3322
|
-
var memberCompletionSchema = /* @__PURE__ */ (() =>
|
|
3323
|
-
quest:
|
|
3561
|
+
var authorBudgetSchema = /* @__PURE__ */ (() => budgetSchema.extend({ scope: z26.literal("author") }).strict())();
|
|
3562
|
+
var memberCompletionSchema = /* @__PURE__ */ (() => z26.object({
|
|
3563
|
+
quest: z26.string().min(1).max(200),
|
|
3324
3564
|
key: completionKeySchema,
|
|
3325
|
-
completedAt:
|
|
3565
|
+
completedAt: z26.number().int().nonnegative().safe().nullable()
|
|
3326
3566
|
}))();
|
|
3327
3567
|
var maxMemberCompletions = 100;
|
|
3328
3568
|
|
|
3329
3569
|
// src/integrations.ts
|
|
3330
|
-
import * as
|
|
3331
|
-
var evaluatorIntegrationProviderSchema = /* @__PURE__ */ (() =>
|
|
3332
|
-
var integrationModuleProviderSchema = /* @__PURE__ */ (() =>
|
|
3570
|
+
import * as z27 from "zod";
|
|
3571
|
+
var evaluatorIntegrationProviderSchema = /* @__PURE__ */ (() => z27.enum(["discord", "x"]))();
|
|
3572
|
+
var integrationModuleProviderSchema = /* @__PURE__ */ (() => z27.string().regex(
|
|
3333
3573
|
/^[a-z][a-z0-9-]{0,63}$/,
|
|
3334
3574
|
"Name an integration module provider, such as discord"
|
|
3335
3575
|
))();
|
|
3336
|
-
var integrationProviderSchema = /* @__PURE__ */ (() =>
|
|
3337
|
-
var discordServerSchema = /* @__PURE__ */ (() =>
|
|
3338
|
-
id:
|
|
3339
|
-
name:
|
|
3340
|
-
icon:
|
|
3576
|
+
var integrationProviderSchema = /* @__PURE__ */ (() => z27.enum(["discord"]))();
|
|
3577
|
+
var discordServerSchema = /* @__PURE__ */ (() => z27.object({
|
|
3578
|
+
id: z27.string().regex(/^[0-9]{1,20}$/),
|
|
3579
|
+
name: z27.string().min(1),
|
|
3580
|
+
icon: z27.string().nullable()
|
|
3341
3581
|
}))();
|
|
3342
|
-
var projectIntegrationSchema = /* @__PURE__ */ (() =>
|
|
3582
|
+
var projectIntegrationSchema = /* @__PURE__ */ (() => z27.object({
|
|
3343
3583
|
provider: integrationProviderSchema,
|
|
3344
|
-
configured:
|
|
3345
|
-
status:
|
|
3346
|
-
revision:
|
|
3584
|
+
configured: z27.boolean(),
|
|
3585
|
+
status: z27.enum(["disconnected", "ready", "attention"]),
|
|
3586
|
+
revision: z27.number().int().nonnegative(),
|
|
3347
3587
|
server: discordServerSchema.nullable(),
|
|
3348
|
-
issue:
|
|
3349
|
-
connectedAt:
|
|
3588
|
+
issue: z27.string().nullable(),
|
|
3589
|
+
connectedAt: z27.number().default(0)
|
|
3350
3590
|
}))();
|
|
3351
|
-
var organizationDiscordServersSchema = /* @__PURE__ */ (() =>
|
|
3352
|
-
servers:
|
|
3591
|
+
var organizationDiscordServersSchema = /* @__PURE__ */ (() => z27.object({
|
|
3592
|
+
servers: z27.array(discordServerSchema)
|
|
3353
3593
|
}))();
|
|
3354
3594
|
|
|
3355
3595
|
// src/announcement-template.ts
|
|
@@ -3363,17 +3603,17 @@ var announcementPlaceholders = [
|
|
|
3363
3603
|
var placeholderNames = /* @__PURE__ */ (() => new Set(announcementPlaceholders))();
|
|
3364
3604
|
function parseAnnouncementTemplate(text) {
|
|
3365
3605
|
const segments = [];
|
|
3366
|
-
let
|
|
3606
|
+
let literal25 = "";
|
|
3367
3607
|
let index = 0;
|
|
3368
3608
|
while (index < text.length) {
|
|
3369
3609
|
const char = text[index];
|
|
3370
3610
|
if (char === "{" && text[index + 1] === "{") {
|
|
3371
|
-
|
|
3611
|
+
literal25 += "{";
|
|
3372
3612
|
index += 2;
|
|
3373
3613
|
continue;
|
|
3374
3614
|
}
|
|
3375
3615
|
if (char === "}" && text[index + 1] === "}") {
|
|
3376
|
-
|
|
3616
|
+
literal25 += "}";
|
|
3377
3617
|
index += 2;
|
|
3378
3618
|
continue;
|
|
3379
3619
|
}
|
|
@@ -3381,7 +3621,7 @@ function parseAnnouncementTemplate(text) {
|
|
|
3381
3621
|
return { error: "Write }} for a literal } in an announcement" };
|
|
3382
3622
|
}
|
|
3383
3623
|
if (char !== "{") {
|
|
3384
|
-
|
|
3624
|
+
literal25 += char;
|
|
3385
3625
|
index += 1;
|
|
3386
3626
|
continue;
|
|
3387
3627
|
}
|
|
@@ -3392,9 +3632,9 @@ function parseAnnouncementTemplate(text) {
|
|
|
3392
3632
|
error: `Unknown announcement placeholder {${name2}}: use ${announcementPlaceholders.map((known) => `{${known}}`).join(", ")}, or {{ for a literal {`
|
|
3393
3633
|
};
|
|
3394
3634
|
}
|
|
3395
|
-
if (
|
|
3396
|
-
segments.push({ kind: "text", text:
|
|
3397
|
-
|
|
3635
|
+
if (literal25) {
|
|
3636
|
+
segments.push({ kind: "text", text: literal25 });
|
|
3637
|
+
literal25 = "";
|
|
3398
3638
|
}
|
|
3399
3639
|
segments.push({
|
|
3400
3640
|
kind: "placeholder",
|
|
@@ -3402,58 +3642,58 @@ function parseAnnouncementTemplate(text) {
|
|
|
3402
3642
|
});
|
|
3403
3643
|
index = end + 1;
|
|
3404
3644
|
}
|
|
3405
|
-
if (
|
|
3406
|
-
segments.push({ kind: "text", text:
|
|
3645
|
+
if (literal25) {
|
|
3646
|
+
segments.push({ kind: "text", text: literal25 });
|
|
3407
3647
|
}
|
|
3408
3648
|
return { segments };
|
|
3409
3649
|
}
|
|
3410
3650
|
|
|
3411
3651
|
// src/announcements.ts
|
|
3412
|
-
import * as
|
|
3413
|
-
var announcementTextSchema = /* @__PURE__ */ (() =>
|
|
3652
|
+
import * as z28 from "zod";
|
|
3653
|
+
var announcementTextSchema = /* @__PURE__ */ (() => z28.string().trim().min(1).max(1e3).superRefine((text, context) => {
|
|
3414
3654
|
const parsed = parseAnnouncementTemplate(text);
|
|
3415
3655
|
if ("error" in parsed) {
|
|
3416
3656
|
context.addIssue({ code: "custom", message: parsed.error });
|
|
3417
3657
|
}
|
|
3418
3658
|
}))();
|
|
3419
3659
|
var announcementFields = /* @__PURE__ */ (() => ({
|
|
3420
|
-
action:
|
|
3660
|
+
action: z28.literal("post-message"),
|
|
3421
3661
|
text: announcementTextSchema,
|
|
3422
3662
|
/**
|
|
3423
3663
|
* Post as a reply to the message that triggered the completion: the message itself, or the
|
|
3424
3664
|
* message a reaction was added to. Only when that message is in the same chat or channel; the
|
|
3425
3665
|
* post is a plain message otherwise.
|
|
3426
3666
|
*/
|
|
3427
|
-
replyToTriggeringMessage:
|
|
3667
|
+
replyToTriggeringMessage: z28.boolean().optional()
|
|
3428
3668
|
}))();
|
|
3429
|
-
var telegramAnnouncementSchema = /* @__PURE__ */ (() =>
|
|
3430
|
-
provider:
|
|
3669
|
+
var telegramAnnouncementSchema = /* @__PURE__ */ (() => z28.strictObject({
|
|
3670
|
+
provider: z28.literal("telegram"),
|
|
3431
3671
|
/** The chat's numeric ID, as `settings.telegramChat()` holds it. */
|
|
3432
3672
|
chat: telegramChatIdSchema,
|
|
3433
3673
|
...announcementFields
|
|
3434
3674
|
}))();
|
|
3435
|
-
var discordAnnouncementSchema = /* @__PURE__ */ (() =>
|
|
3436
|
-
provider:
|
|
3675
|
+
var discordAnnouncementSchema = /* @__PURE__ */ (() => z28.strictObject({
|
|
3676
|
+
provider: z28.literal("discord"),
|
|
3437
3677
|
/** The channel's ID, as a `discord.channels()` resource setting holds it. */
|
|
3438
|
-
channel:
|
|
3678
|
+
channel: z28.string().regex(/^[0-9]{1,20}$/),
|
|
3439
3679
|
...announcementFields
|
|
3440
3680
|
}))();
|
|
3441
|
-
var announcementSchema = /* @__PURE__ */ (() =>
|
|
3681
|
+
var announcementSchema = /* @__PURE__ */ (() => z28.discriminatedUnion("provider", [
|
|
3442
3682
|
telegramAnnouncementSchema,
|
|
3443
3683
|
discordAnnouncementSchema
|
|
3444
3684
|
]))();
|
|
3445
3685
|
|
|
3446
3686
|
// src/submission-input.ts
|
|
3447
|
-
import * as
|
|
3448
|
-
var textOptionsSchema = /* @__PURE__ */ (() =>
|
|
3449
|
-
required:
|
|
3450
|
-
minLength:
|
|
3451
|
-
maxLength:
|
|
3687
|
+
import * as z29 from "zod";
|
|
3688
|
+
var textOptionsSchema = /* @__PURE__ */ (() => z29.object({
|
|
3689
|
+
required: z29.boolean().default(true),
|
|
3690
|
+
minLength: z29.number().int().min(0).max(1e4).default(1),
|
|
3691
|
+
maxLength: z29.number().int().min(1).max(1e4).default(1e4)
|
|
3452
3692
|
}).strict().refine(
|
|
3453
3693
|
(v) => v.minLength <= v.maxLength,
|
|
3454
3694
|
"minLength must not exceed maxLength"
|
|
3455
3695
|
))();
|
|
3456
|
-
var hostSchema = /* @__PURE__ */ (() =>
|
|
3696
|
+
var hostSchema = /* @__PURE__ */ (() => z29.string().min(1).max(253).refine((host) => {
|
|
3457
3697
|
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
3458
3698
|
return false;
|
|
3459
3699
|
}
|
|
@@ -3464,13 +3704,13 @@ var hostSchema = /* @__PURE__ */ (() => z23.string().min(1).max(253).refine((hos
|
|
|
3464
3704
|
return false;
|
|
3465
3705
|
}
|
|
3466
3706
|
}, "Use a hostname without a scheme, path, port, or wildcard"))();
|
|
3467
|
-
var urlOptionsSchema = /* @__PURE__ */ (() =>
|
|
3468
|
-
required:
|
|
3469
|
-
allowedHosts:
|
|
3707
|
+
var urlOptionsSchema = /* @__PURE__ */ (() => z29.object({
|
|
3708
|
+
required: z29.boolean().default(true),
|
|
3709
|
+
allowedHosts: z29.array(hostSchema).min(1).max(100).optional()
|
|
3470
3710
|
}).strict())();
|
|
3471
|
-
var textEvidenceSchema = /* @__PURE__ */ (() =>
|
|
3472
|
-
var urlEvidenceSchema = /* @__PURE__ */ (() =>
|
|
3473
|
-
var valueEvidenceSchema = /* @__PURE__ */ (() =>
|
|
3711
|
+
var textEvidenceSchema = /* @__PURE__ */ (() => z29.object({ kind: z29.literal("text"), value: z29.string().max(1e4) }).strict())();
|
|
3712
|
+
var urlEvidenceSchema = /* @__PURE__ */ (() => z29.object({ kind: z29.literal("url"), value: z29.string().max(2048) }).strict())();
|
|
3713
|
+
var valueEvidenceSchema = /* @__PURE__ */ (() => z29.discriminatedUnion("kind", [
|
|
3474
3714
|
textEvidenceSchema,
|
|
3475
3715
|
urlEvidenceSchema
|
|
3476
3716
|
]))();
|
|
@@ -3533,22 +3773,22 @@ function xPostId(value) {
|
|
|
3533
3773
|
}
|
|
3534
3774
|
|
|
3535
3775
|
// src/quiz.ts
|
|
3536
|
-
import * as
|
|
3537
|
-
var quizId = /* @__PURE__ */ (() =>
|
|
3538
|
-
var quizChoiceSchema = /* @__PURE__ */ (() =>
|
|
3539
|
-
var quizQuestionSchema = /* @__PURE__ */ (() =>
|
|
3776
|
+
import * as z30 from "zod";
|
|
3777
|
+
var quizId = /* @__PURE__ */ (() => z30.string().regex(/^[a-zA-Z0-9_-]+$/).max(100))();
|
|
3778
|
+
var quizChoiceSchema = /* @__PURE__ */ (() => z30.object({ id: quizId, label: z30.string().trim().min(1).max(500) }).strict())();
|
|
3779
|
+
var quizQuestionSchema = /* @__PURE__ */ (() => z30.object({
|
|
3540
3780
|
id: quizId,
|
|
3541
|
-
prompt:
|
|
3542
|
-
choices:
|
|
3781
|
+
prompt: z30.string().trim().min(1).max(1e3),
|
|
3782
|
+
choices: z30.array(quizChoiceSchema).min(2).max(8).refine(
|
|
3543
3783
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
3544
3784
|
"Choice IDs must be unique"
|
|
3545
3785
|
)
|
|
3546
3786
|
}).strict())();
|
|
3547
|
-
var quizQuestionsSchema = /* @__PURE__ */ (() =>
|
|
3787
|
+
var quizQuestionsSchema = /* @__PURE__ */ (() => z30.array(quizQuestionSchema).min(1).max(20).refine(
|
|
3548
3788
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
3549
3789
|
"Question IDs must be unique"
|
|
3550
3790
|
))();
|
|
3551
|
-
var quizContentSchema = /* @__PURE__ */ (() =>
|
|
3791
|
+
var quizContentSchema = /* @__PURE__ */ (() => z30.array(
|
|
3552
3792
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
3553
3793
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
3554
3794
|
"Choose a correct answer from the available choices"
|
|
@@ -3559,16 +3799,16 @@ var quizContentSchema = /* @__PURE__ */ (() => z24.array(
|
|
|
3559
3799
|
))();
|
|
3560
3800
|
|
|
3561
3801
|
// src/windows.ts
|
|
3562
|
-
import * as
|
|
3563
|
-
var timestamp4 = /* @__PURE__ */ (() =>
|
|
3802
|
+
import * as z31 from "zod";
|
|
3803
|
+
var timestamp4 = /* @__PURE__ */ (() => z31.number().int().safe().nonnegative())();
|
|
3564
3804
|
var endsAfterStart = (window) => window.from === void 0 || window.until === void 0 || window.until > window.from;
|
|
3565
3805
|
var inWindow = (window, time) => (window.from === void 0 || time >= window.from) && (window.until === void 0 || time < window.until);
|
|
3566
3806
|
|
|
3567
3807
|
// src/solana-actions.ts
|
|
3568
|
-
import * as
|
|
3808
|
+
import * as z32 from "zod";
|
|
3569
3809
|
var maxSolanaActionReference = 64;
|
|
3570
3810
|
var prefix = "domino:quest:";
|
|
3571
|
-
var referenceSchema = /* @__PURE__ */ (() =>
|
|
3811
|
+
var referenceSchema = /* @__PURE__ */ (() => z32.string().min(1).max(maxSolanaActionReference).regex(/^[a-zA-Z0-9_-]+$/, "use letters, digits, _ or -"))();
|
|
3572
3812
|
function solanaActionMemo(input) {
|
|
3573
3813
|
const quest = identifier.parse(input.quest);
|
|
3574
3814
|
return input.reference === void 0 ? prefix + quest : `${prefix}${quest}:${referenceSchema.parse(input.reference)}`;
|
|
@@ -3586,17 +3826,17 @@ function parseSolanaActionMemo(text) {
|
|
|
3586
3826
|
function takesSolanaTransaction(trigger) {
|
|
3587
3827
|
return trigger.kind === "manual" && trigger.actor !== "staff" && trigger.input === "none";
|
|
3588
3828
|
}
|
|
3589
|
-
var questStationSchema = /* @__PURE__ */ (() =>
|
|
3829
|
+
var questStationSchema = /* @__PURE__ */ (() => z32.object({
|
|
3590
3830
|
key: referenceSchema,
|
|
3591
|
-
label:
|
|
3831
|
+
label: z32.string().trim().min(1).max(120),
|
|
3592
3832
|
opensAt: timestamp4.optional(),
|
|
3593
3833
|
closesAt: timestamp4.optional(),
|
|
3594
|
-
proof:
|
|
3834
|
+
proof: z32.enum(["transaction", "code"]).optional()
|
|
3595
3835
|
}).strict().refine(
|
|
3596
3836
|
(station) => endsAfterStart({ from: station.opensAt, until: station.closesAt }),
|
|
3597
3837
|
{ message: "A station must close after it opens", path: ["closesAt"] }
|
|
3598
3838
|
))();
|
|
3599
|
-
var questStationsSchema = /* @__PURE__ */ (() =>
|
|
3839
|
+
var questStationsSchema = /* @__PURE__ */ (() => z32.array(questStationSchema).min(1).max(200).refine(
|
|
3600
3840
|
(stations) => new Set(stations.map((station) => station.key)).size === stations.length,
|
|
3601
3841
|
"Give each station its own key"
|
|
3602
3842
|
))();
|
|
@@ -3622,97 +3862,97 @@ function stationRefusal(stations, reference, time, proof = "transaction") {
|
|
|
3622
3862
|
}
|
|
3623
3863
|
return null;
|
|
3624
3864
|
}
|
|
3625
|
-
var submittedStationCode = /* @__PURE__ */ (() =>
|
|
3626
|
-
var stationCheckInSchema = /* @__PURE__ */ (() =>
|
|
3865
|
+
var submittedStationCode = /* @__PURE__ */ (() => z32.string().min(1).max(256))();
|
|
3866
|
+
var stationCheckInSchema = /* @__PURE__ */ (() => z32.object({ code: submittedStationCode, actionId: identifier }).strict())();
|
|
3627
3867
|
var stationCodeSubmissionSchema = /* @__PURE__ */ (() => stationCheckInSchema.extend({ quest: identifier, station: identifier, member: identifier }).strict())();
|
|
3628
|
-
var solanaTransactionSubmissionSchema = /* @__PURE__ */ (() =>
|
|
3868
|
+
var solanaTransactionSubmissionSchema = /* @__PURE__ */ (() => z32.object({
|
|
3629
3869
|
quest: identifier,
|
|
3630
3870
|
signature: solanaSignatureSchema,
|
|
3631
|
-
chain:
|
|
3871
|
+
chain: z32.enum(["solana", solanaMainnet, solanaDevnet]).default(solanaMainnet).transform(
|
|
3632
3872
|
(chain) => chain === "solana" ? solanaMainnet : chain
|
|
3633
3873
|
)
|
|
3634
3874
|
}).strict())();
|
|
3635
|
-
var attemptActionSchema = /* @__PURE__ */ (() =>
|
|
3636
|
-
kind:
|
|
3637
|
-
chain:
|
|
3638
|
-
signature:
|
|
3639
|
-
wallet:
|
|
3640
|
-
reference:
|
|
3875
|
+
var attemptActionSchema = /* @__PURE__ */ (() => z32.object({
|
|
3876
|
+
kind: z32.string(),
|
|
3877
|
+
chain: z32.string(),
|
|
3878
|
+
signature: z32.string(),
|
|
3879
|
+
wallet: z32.string(),
|
|
3880
|
+
reference: z32.string().nullable()
|
|
3641
3881
|
}))();
|
|
3642
3882
|
|
|
3643
3883
|
// src/galleries.ts
|
|
3644
|
-
import * as
|
|
3884
|
+
import * as z33 from "zod";
|
|
3645
3885
|
var galleryKinds = ["wall", "contest"];
|
|
3646
|
-
var questGallerySchema = /* @__PURE__ */ (() =>
|
|
3886
|
+
var questGallerySchema = /* @__PURE__ */ (() => z33.object({ kind: z33.string().min(1).max(40) }).strict())();
|
|
3647
3887
|
|
|
3648
3888
|
// src/resources.ts
|
|
3649
|
-
import * as
|
|
3650
|
-
var resourceSourceSchema = /* @__PURE__ */ (() =>
|
|
3651
|
-
|
|
3652
|
-
provider:
|
|
3653
|
-
resource:
|
|
3889
|
+
import * as z34 from "zod";
|
|
3890
|
+
var resourceSourceSchema = /* @__PURE__ */ (() => z34.union([
|
|
3891
|
+
z34.strictObject({
|
|
3892
|
+
provider: z34.literal("domino"),
|
|
3893
|
+
resource: z34.literal("point-ledger")
|
|
3654
3894
|
}),
|
|
3655
3895
|
discordResourceSourceSchema
|
|
3656
3896
|
]))();
|
|
3657
|
-
var resourceRequestSchema = /* @__PURE__ */ (() =>
|
|
3897
|
+
var resourceRequestSchema = /* @__PURE__ */ (() => z34.object({
|
|
3658
3898
|
source: resourceSourceSchema,
|
|
3659
|
-
query:
|
|
3660
|
-
cursor:
|
|
3661
|
-
ids:
|
|
3899
|
+
query: z34.string().max(100).optional(),
|
|
3900
|
+
cursor: z34.string().regex(/^\d{1,6}$/).optional(),
|
|
3901
|
+
ids: z34.array(z34.string().min(1).max(100)).max(50).optional()
|
|
3662
3902
|
}).strict())();
|
|
3663
|
-
var resourceOptionsSchema = /* @__PURE__ */ (() =>
|
|
3664
|
-
revision:
|
|
3665
|
-
options:
|
|
3666
|
-
|
|
3667
|
-
id:
|
|
3668
|
-
label:
|
|
3669
|
-
description:
|
|
3670
|
-
group:
|
|
3671
|
-
disabledReason:
|
|
3903
|
+
var resourceOptionsSchema = /* @__PURE__ */ (() => z34.object({
|
|
3904
|
+
revision: z34.number().int(),
|
|
3905
|
+
options: z34.array(
|
|
3906
|
+
z34.object({
|
|
3907
|
+
id: z34.string(),
|
|
3908
|
+
label: z34.string(),
|
|
3909
|
+
description: z34.string().optional(),
|
|
3910
|
+
group: z34.string().optional(),
|
|
3911
|
+
disabledReason: z34.string().optional()
|
|
3672
3912
|
})
|
|
3673
3913
|
),
|
|
3674
3914
|
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
3675
|
-
nextCursor:
|
|
3915
|
+
nextCursor: z34.string().nullable().default(null),
|
|
3676
3916
|
/** @deprecated Use `nextCursor`. Removed in 2.0.0. */
|
|
3677
|
-
cursor:
|
|
3917
|
+
cursor: z34.string().nullable()
|
|
3678
3918
|
}))();
|
|
3679
3919
|
|
|
3680
3920
|
// src/settings.ts
|
|
3681
|
-
import * as
|
|
3921
|
+
import * as z36 from "zod";
|
|
3682
3922
|
|
|
3683
3923
|
// src/setting-values.ts
|
|
3684
|
-
import * as
|
|
3924
|
+
import * as z35 from "zod";
|
|
3685
3925
|
var settingInstant = /* @__PURE__ */ (() => offsetDateTimeSchema().transform(
|
|
3686
3926
|
(value) => new Date(value).toISOString()
|
|
3687
3927
|
))();
|
|
3688
|
-
var settingResourceId = /* @__PURE__ */ (() =>
|
|
3689
|
-
|
|
3690
|
-
|
|
3928
|
+
var settingResourceId = /* @__PURE__ */ (() => z35.union([
|
|
3929
|
+
z35.literal(""),
|
|
3930
|
+
z35.string().regex(/^\S{1,200}$/)
|
|
3691
3931
|
]))();
|
|
3692
3932
|
|
|
3693
3933
|
// src/settings.ts
|
|
3694
|
-
var base = /* @__PURE__ */ (() => ({ label:
|
|
3695
|
-
var settingFieldSchema = /* @__PURE__ */ (() =>
|
|
3696
|
-
|
|
3934
|
+
var base = /* @__PURE__ */ (() => ({ label: z36.string().min(1), description: z36.string().optional() }))();
|
|
3935
|
+
var settingFieldSchema = /* @__PURE__ */ (() => z36.discriminatedUnion("kind", [
|
|
3936
|
+
z36.object({
|
|
3697
3937
|
...base,
|
|
3698
|
-
kind:
|
|
3699
|
-
default: identifier.or(
|
|
3938
|
+
kind: z36.literal("point-ledger"),
|
|
3939
|
+
default: identifier.or(z36.literal(""))
|
|
3700
3940
|
}).strict(),
|
|
3701
|
-
|
|
3702
|
-
|
|
3941
|
+
z36.object({ ...base, kind: z36.literal("datetime"), default: settingInstant }).strict(),
|
|
3942
|
+
z36.object({
|
|
3703
3943
|
...base,
|
|
3704
|
-
kind:
|
|
3944
|
+
kind: z36.literal("resource"),
|
|
3705
3945
|
default: settingResourceId,
|
|
3706
3946
|
source: resourceSourceSchema
|
|
3707
3947
|
}).strict(),
|
|
3708
|
-
|
|
3709
|
-
|
|
3948
|
+
z36.object({ ...base, kind: z36.literal("quiz"), default: quizContentSchema }).strict(),
|
|
3949
|
+
z36.object({
|
|
3710
3950
|
...base,
|
|
3711
|
-
kind:
|
|
3712
|
-
default:
|
|
3713
|
-
minLength:
|
|
3714
|
-
maxLength:
|
|
3715
|
-
multiline:
|
|
3951
|
+
kind: z36.literal("text"),
|
|
3952
|
+
default: z36.string(),
|
|
3953
|
+
minLength: z36.number().int().nonnegative(),
|
|
3954
|
+
maxLength: z36.number().int().positive(),
|
|
3955
|
+
multiline: z36.boolean(),
|
|
3716
3956
|
/**
|
|
3717
3957
|
* A list Console offers the value from, beside free text: `telegram-chat` lists the
|
|
3718
3958
|
* project's connected Telegram chats. Unknown pickers read as free text. Six pickers also
|
|
@@ -3728,40 +3968,40 @@ var settingFieldSchema = /* @__PURE__ */ (() => z30.discriminatedUnion("kind", [
|
|
|
3728
3968
|
* (`settings.solanaProgram()`), which Relay also checks is
|
|
3729
3969
|
* an executable program.
|
|
3730
3970
|
*/
|
|
3731
|
-
picker:
|
|
3971
|
+
picker: z36.string().optional(),
|
|
3732
3972
|
/**
|
|
3733
3973
|
* On an `amount` setting, the token's decimals: Console shows and edits the value in whole
|
|
3734
3974
|
* tokens.
|
|
3735
3975
|
*/
|
|
3736
|
-
decimals:
|
|
3976
|
+
decimals: z36.number().int().min(0).max(255).optional(),
|
|
3737
3977
|
/**
|
|
3738
3978
|
* A value operators set in Console that never leaves Relay: management responses, the CLI
|
|
3739
3979
|
* and Console withhold it, and the quest's code reads it as usual. Its `default` is `""`.
|
|
3740
3980
|
*/
|
|
3741
|
-
secret:
|
|
3981
|
+
secret: z36.literal(true).optional()
|
|
3742
3982
|
}).strict(),
|
|
3743
|
-
|
|
3983
|
+
z36.object({
|
|
3744
3984
|
...base,
|
|
3745
|
-
kind:
|
|
3746
|
-
default:
|
|
3747
|
-
min:
|
|
3748
|
-
max:
|
|
3985
|
+
kind: z36.literal("integer"),
|
|
3986
|
+
default: z36.number().int(),
|
|
3987
|
+
min: z36.number().int(),
|
|
3988
|
+
max: z36.number().int()
|
|
3749
3989
|
}).strict(),
|
|
3750
|
-
|
|
3751
|
-
|
|
3990
|
+
z36.object({ ...base, kind: z36.literal("boolean"), default: z36.boolean() }).strict(),
|
|
3991
|
+
z36.object({
|
|
3752
3992
|
...base,
|
|
3753
|
-
kind:
|
|
3754
|
-
default:
|
|
3755
|
-
options:
|
|
3993
|
+
kind: z36.literal("choice"),
|
|
3994
|
+
default: z36.string(),
|
|
3995
|
+
options: z36.array(z36.string().min(1)).min(1)
|
|
3756
3996
|
}).strict()
|
|
3757
3997
|
]))();
|
|
3758
|
-
var settingsFieldsSchema = /* @__PURE__ */ (() =>
|
|
3759
|
-
|
|
3998
|
+
var settingsFieldsSchema = /* @__PURE__ */ (() => z36.record(
|
|
3999
|
+
z36.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
3760
4000
|
settingFieldSchema
|
|
3761
4001
|
))();
|
|
3762
|
-
var settingsValuesSchema = /* @__PURE__ */ (() =>
|
|
3763
|
-
|
|
3764
|
-
|
|
4002
|
+
var settingsValuesSchema = /* @__PURE__ */ (() => z36.record(
|
|
4003
|
+
z36.string(),
|
|
4004
|
+
z36.union([z36.string(), z36.number().finite(), z36.boolean(), quizContentSchema])
|
|
3765
4005
|
))();
|
|
3766
4006
|
function isAmount(value) {
|
|
3767
4007
|
return value.length <= 100 && /^(0|[1-9][0-9]*)$/.test(value);
|
|
@@ -3773,10 +4013,10 @@ function isBoundSetting(field) {
|
|
|
3773
4013
|
return field?.kind === "integer" || field?.kind === "text" && field.picker === "amount";
|
|
3774
4014
|
}
|
|
3775
4015
|
function textSettingSchema(field) {
|
|
3776
|
-
const text = field.secret ?
|
|
4016
|
+
const text = field.secret ? z36.string().max(field.maxLength).refine(
|
|
3777
4017
|
(value) => value === "" || value.length >= field.minLength,
|
|
3778
4018
|
`Use at least ${field.minLength} characters`
|
|
3779
|
-
) :
|
|
4019
|
+
) : z36.string().min(field.minLength).max(field.maxLength);
|
|
3780
4020
|
switch (field.picker) {
|
|
3781
4021
|
case "amount":
|
|
3782
4022
|
return text.refine(
|
|
@@ -3832,17 +4072,17 @@ function parseSettings(fields2, input) {
|
|
|
3832
4072
|
shape[key] = textSettingSchema(field).default(field.default);
|
|
3833
4073
|
break;
|
|
3834
4074
|
case "integer":
|
|
3835
|
-
shape[key] =
|
|
4075
|
+
shape[key] = z36.number().int().min(field.min).max(field.max).default(field.default);
|
|
3836
4076
|
break;
|
|
3837
4077
|
case "boolean":
|
|
3838
|
-
shape[key] =
|
|
4078
|
+
shape[key] = z36.boolean().default(field.default);
|
|
3839
4079
|
break;
|
|
3840
4080
|
case "choice":
|
|
3841
|
-
shape[key] =
|
|
4081
|
+
shape[key] = z36.enum(field.options).default(field.default);
|
|
3842
4082
|
break;
|
|
3843
4083
|
}
|
|
3844
4084
|
}
|
|
3845
|
-
return settingsValuesSchema.parse(
|
|
4085
|
+
return settingsValuesSchema.parse(z36.object(shape).strict().parse(input));
|
|
3846
4086
|
}
|
|
3847
4087
|
function missingResourceSettings(fields2, values2) {
|
|
3848
4088
|
return Object.entries(fields2).filter(
|
|
@@ -3863,20 +4103,20 @@ function authoringKey(input) {
|
|
|
3863
4103
|
}
|
|
3864
4104
|
|
|
3865
4105
|
// src/campaigns.ts
|
|
3866
|
-
import * as
|
|
3867
|
-
var availabilityWindowSchema = /* @__PURE__ */ (() =>
|
|
4106
|
+
import * as z37 from "zod";
|
|
4107
|
+
var availabilityWindowSchema = /* @__PURE__ */ (() => z37.object({ from: timestamp4, until: timestamp4 }).strict().refine(endsAfterStart, {
|
|
3868
4108
|
message: "Window end must follow its start",
|
|
3869
4109
|
path: ["until"]
|
|
3870
4110
|
}))();
|
|
3871
|
-
var campaignDefinitionSchema = /* @__PURE__ */ (() =>
|
|
4111
|
+
var campaignDefinitionSchema = /* @__PURE__ */ (() => z37.object({
|
|
3872
4112
|
key: identifier,
|
|
3873
|
-
title:
|
|
4113
|
+
title: z37.string().trim().min(1).max(120),
|
|
3874
4114
|
window: availabilityWindowSchema.optional(),
|
|
3875
|
-
enrollment:
|
|
4115
|
+
enrollment: z37.enum(["none", "required"]).default("none")
|
|
3876
4116
|
}).strict())();
|
|
3877
4117
|
var campaignAuthoringSchema = /* @__PURE__ */ (() => campaignDefinitionSchema.omit({ key: true, title: true }).extend({
|
|
3878
4118
|
...authoringIdentityShape,
|
|
3879
|
-
title:
|
|
4119
|
+
title: z37.string().trim().min(1).max(120).optional()
|
|
3880
4120
|
}).strict().transform((value) => {
|
|
3881
4121
|
const normalized = value;
|
|
3882
4122
|
return campaignDefinitionSchema.parse({
|
|
@@ -3890,42 +4130,42 @@ function defineCampaign(input) {
|
|
|
3890
4130
|
var campaignViewSchema = /* @__PURE__ */ (() => campaignDefinitionSchema.extend({
|
|
3891
4131
|
enrolledAt: timestamp4.nullable(),
|
|
3892
4132
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
3893
|
-
withdrawalReason:
|
|
4133
|
+
withdrawalReason: z37.string().nullable().default(null)
|
|
3894
4134
|
}))();
|
|
3895
|
-
var campaignEnrollmentInputSchema = /* @__PURE__ */ (() =>
|
|
4135
|
+
var campaignEnrollmentInputSchema = /* @__PURE__ */ (() => z37.object({ actionId: identifier, campaign: identifier }).strict())();
|
|
3896
4136
|
var memberCampaignEnrollmentInputSchema = /* @__PURE__ */ (() => campaignEnrollmentInputSchema.extend({ member: identifier }))();
|
|
3897
4137
|
var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
|
|
3898
4138
|
var memberCampaignWithdrawalInputSchema = /* @__PURE__ */ (() => campaignWithdrawalInputSchema.extend({
|
|
3899
4139
|
member: identifier,
|
|
3900
|
-
reason:
|
|
4140
|
+
reason: z37.string().trim().min(1).max(500)
|
|
3901
4141
|
}))();
|
|
3902
|
-
var campaignEnrollmentSchema = /* @__PURE__ */ (() =>
|
|
4142
|
+
var campaignEnrollmentSchema = /* @__PURE__ */ (() => z37.object({
|
|
3903
4143
|
campaign: identifier,
|
|
3904
4144
|
member: identifier,
|
|
3905
4145
|
enrolledAt: timestamp4,
|
|
3906
4146
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
3907
|
-
withdrawalReason:
|
|
4147
|
+
withdrawalReason: z37.string().nullable().default(null)
|
|
3908
4148
|
}))();
|
|
3909
4149
|
|
|
3910
4150
|
// src/resource-handle.ts
|
|
3911
|
-
import * as
|
|
4151
|
+
import * as z38 from "zod";
|
|
3912
4152
|
function resourceHandle(_kind, definition) {
|
|
3913
4153
|
return definition;
|
|
3914
4154
|
}
|
|
3915
|
-
var ledgerSettingSchema = /* @__PURE__ */ (() => identifier.or(
|
|
4155
|
+
var ledgerSettingSchema = /* @__PURE__ */ (() => identifier.or(z38.literal("")).brand())();
|
|
3916
4156
|
function ledgerKey(ledger) {
|
|
3917
4157
|
return typeof ledger === "string" ? ledger : ledger.key;
|
|
3918
4158
|
}
|
|
3919
4159
|
|
|
3920
4160
|
// src/groups.ts
|
|
3921
|
-
import * as
|
|
3922
|
-
var projectGroupSchema = /* @__PURE__ */ (() =>
|
|
4161
|
+
import * as z39 from "zod";
|
|
4162
|
+
var projectGroupSchema = /* @__PURE__ */ (() => z39.object({
|
|
3923
4163
|
key: identifier,
|
|
3924
|
-
title:
|
|
4164
|
+
title: z39.string().trim().min(1).max(120)
|
|
3925
4165
|
}).strict())();
|
|
3926
4166
|
var projectGroupAuthoringSchema = /* @__PURE__ */ (() => projectGroupSchema.omit({ key: true, title: true }).extend({
|
|
3927
4167
|
...authoringIdentityShape,
|
|
3928
|
-
title:
|
|
4168
|
+
title: z39.string().trim().min(1).max(120).optional()
|
|
3929
4169
|
}).strict().transform((value) => {
|
|
3930
4170
|
return projectGroupSchema.parse({
|
|
3931
4171
|
...value,
|
|
@@ -3938,93 +4178,93 @@ function defineGroup(input) {
|
|
|
3938
4178
|
function projectGroupKey(group) {
|
|
3939
4179
|
return identifier.parse(group.key);
|
|
3940
4180
|
}
|
|
3941
|
-
var groupTitle = /* @__PURE__ */ (() =>
|
|
3942
|
-
var reason = /* @__PURE__ */ (() =>
|
|
3943
|
-
var timestamp5 = /* @__PURE__ */ (() =>
|
|
3944
|
-
var createGroupSchema = /* @__PURE__ */ (() =>
|
|
3945
|
-
var updateGroupSchema = /* @__PURE__ */ (() =>
|
|
3946
|
-
var addGroupMemberSchema = /* @__PURE__ */ (() =>
|
|
3947
|
-
var removeGroupMemberSchema = /* @__PURE__ */ (() =>
|
|
3948
|
-
var groupArchiveInputSchema = /* @__PURE__ */ (() =>
|
|
3949
|
-
var groupPageQuerySchema = /* @__PURE__ */ (() =>
|
|
4181
|
+
var groupTitle = /* @__PURE__ */ (() => z39.string().trim().min(1).max(120))();
|
|
4182
|
+
var reason = /* @__PURE__ */ (() => z39.string().trim().min(1).max(1e3))();
|
|
4183
|
+
var timestamp5 = /* @__PURE__ */ (() => z39.number().int().nonnegative().max(864e13))();
|
|
4184
|
+
var createGroupSchema = /* @__PURE__ */ (() => z39.object({ actionId: identifier, key: identifier, title: groupTitle }).strict())();
|
|
4185
|
+
var updateGroupSchema = /* @__PURE__ */ (() => z39.object({ title: groupTitle }).strict())();
|
|
4186
|
+
var addGroupMemberSchema = /* @__PURE__ */ (() => z39.object({ actionId: identifier, member: identifier, reason }).strict())();
|
|
4187
|
+
var removeGroupMemberSchema = /* @__PURE__ */ (() => z39.object({ actionId: identifier, reason }).strict())();
|
|
4188
|
+
var groupArchiveInputSchema = /* @__PURE__ */ (() => z39.object({ reason: lifecycleReasonSchema.optional() }).strict())();
|
|
4189
|
+
var groupPageQuerySchema = /* @__PURE__ */ (() => z39.strictObject({
|
|
3950
4190
|
cursor: pageCursorSchema.optional(),
|
|
3951
4191
|
/** Items per page, 1–100; the default is 50. */
|
|
3952
|
-
limit:
|
|
4192
|
+
limit: z39.number().int().min(1).max(100).optional()
|
|
3953
4193
|
}))();
|
|
3954
|
-
var managedGroupSchema = /* @__PURE__ */ (() =>
|
|
4194
|
+
var managedGroupSchema = /* @__PURE__ */ (() => z39.object({
|
|
3955
4195
|
key: identifier,
|
|
3956
|
-
title:
|
|
3957
|
-
members:
|
|
4196
|
+
title: z39.string(),
|
|
4197
|
+
members: z39.number().int().nonnegative(),
|
|
3958
4198
|
createdAt: timestamp5,
|
|
3959
4199
|
archivedAt: timestamp5.nullable()
|
|
3960
4200
|
}))();
|
|
3961
|
-
var groupPageSchema = /* @__PURE__ */ (() =>
|
|
3962
|
-
items:
|
|
4201
|
+
var groupPageSchema = /* @__PURE__ */ (() => z39.object({
|
|
4202
|
+
items: z39.array(managedGroupSchema),
|
|
3963
4203
|
nextCursor: pageCursorSchema.nullable()
|
|
3964
4204
|
}))();
|
|
3965
|
-
var groupMemberSchema = /* @__PURE__ */ (() =>
|
|
4205
|
+
var groupMemberSchema = /* @__PURE__ */ (() => z39.object({
|
|
3966
4206
|
member: identifier,
|
|
3967
4207
|
addedAt: timestamp5.nullable()
|
|
3968
4208
|
}))();
|
|
3969
|
-
var groupMemberPageSchema = /* @__PURE__ */ (() =>
|
|
3970
|
-
items:
|
|
4209
|
+
var groupMemberPageSchema = /* @__PURE__ */ (() => z39.object({
|
|
4210
|
+
items: z39.array(groupMemberSchema),
|
|
3971
4211
|
nextCursor: pageCursorSchema.nullable()
|
|
3972
4212
|
}))();
|
|
3973
4213
|
|
|
3974
4214
|
// src/prerequisites.ts
|
|
3975
|
-
import * as
|
|
3976
|
-
var amount = /* @__PURE__ */ (() =>
|
|
4215
|
+
import * as z40 from "zod";
|
|
4216
|
+
var amount = /* @__PURE__ */ (() => z40.number().int().safe().nonnegative())();
|
|
3977
4217
|
var threshold = /* @__PURE__ */ (() => amount.positive())();
|
|
3978
|
-
var completionPrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3979
|
-
|
|
3980
|
-
kind:
|
|
4218
|
+
var completionPrerequisiteSchema = /* @__PURE__ */ (() => z40.discriminatedUnion("scope", [
|
|
4219
|
+
z40.object({
|
|
4220
|
+
kind: z40.literal("completion"),
|
|
3981
4221
|
quest: identifier,
|
|
3982
|
-
scope:
|
|
4222
|
+
scope: z40.literal("ever")
|
|
3983
4223
|
}).strict(),
|
|
3984
|
-
|
|
3985
|
-
kind:
|
|
4224
|
+
z40.object({
|
|
4225
|
+
kind: z40.literal("completion"),
|
|
3986
4226
|
quest: identifier,
|
|
3987
|
-
scope:
|
|
4227
|
+
scope: z40.literal("period"),
|
|
3988
4228
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
3989
4229
|
}).strict()
|
|
3990
4230
|
]))();
|
|
3991
|
-
var balancePrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3992
|
-
kind:
|
|
4231
|
+
var balancePrerequisiteSchema = /* @__PURE__ */ (() => z40.object({
|
|
4232
|
+
kind: z40.literal("balance"),
|
|
3993
4233
|
balance: identifier,
|
|
3994
4234
|
minimum: threshold
|
|
3995
4235
|
}).strict())();
|
|
3996
|
-
var groupPrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
3997
|
-
var prerequisiteSchema = /* @__PURE__ */ (() =>
|
|
4236
|
+
var groupPrerequisiteSchema = /* @__PURE__ */ (() => z40.object({ kind: z40.literal("group"), group: identifier, title: z40.string() }).strict())();
|
|
4237
|
+
var prerequisiteSchema = /* @__PURE__ */ (() => z40.discriminatedUnion("kind", [
|
|
3998
4238
|
completionPrerequisiteSchema,
|
|
3999
4239
|
balancePrerequisiteSchema,
|
|
4000
4240
|
groupPrerequisiteSchema
|
|
4001
4241
|
]))();
|
|
4002
|
-
var missingPrerequisiteSchema = /* @__PURE__ */ (() =>
|
|
4003
|
-
|
|
4004
|
-
kind:
|
|
4242
|
+
var missingPrerequisiteSchema = /* @__PURE__ */ (() => z40.union([
|
|
4243
|
+
z40.object({
|
|
4244
|
+
kind: z40.literal("completion"),
|
|
4005
4245
|
quest: identifier,
|
|
4006
|
-
title:
|
|
4007
|
-
scope:
|
|
4246
|
+
title: z40.string(),
|
|
4247
|
+
scope: z40.literal("ever")
|
|
4008
4248
|
}),
|
|
4009
|
-
|
|
4010
|
-
kind:
|
|
4249
|
+
z40.object({
|
|
4250
|
+
kind: z40.literal("completion"),
|
|
4011
4251
|
quest: identifier,
|
|
4012
|
-
title:
|
|
4013
|
-
scope:
|
|
4252
|
+
title: z40.string(),
|
|
4253
|
+
scope: z40.literal("period"),
|
|
4014
4254
|
period: calendarPeriodSchema.exclude(["lifetime"]),
|
|
4015
|
-
resetsAt:
|
|
4255
|
+
resetsAt: z40.number().int().safe()
|
|
4016
4256
|
}),
|
|
4017
|
-
|
|
4018
|
-
kind:
|
|
4257
|
+
z40.object({
|
|
4258
|
+
kind: z40.literal("balance"),
|
|
4019
4259
|
balance: identifier,
|
|
4020
|
-
title:
|
|
4260
|
+
title: z40.string(),
|
|
4021
4261
|
minimum: threshold,
|
|
4022
4262
|
current: amount
|
|
4023
4263
|
}),
|
|
4024
|
-
|
|
4025
|
-
kind:
|
|
4264
|
+
z40.object({
|
|
4265
|
+
kind: z40.literal("group"),
|
|
4026
4266
|
group: identifier,
|
|
4027
|
-
title:
|
|
4267
|
+
title: z40.string()
|
|
4028
4268
|
})
|
|
4029
4269
|
]))();
|
|
4030
4270
|
function completed(quest, options = {}) {
|
|
@@ -4055,29 +4295,29 @@ function inGroup(group) {
|
|
|
4055
4295
|
var maxPointsAmount = 2147483647;
|
|
4056
4296
|
|
|
4057
4297
|
// src/schema.ts
|
|
4058
|
-
import * as
|
|
4059
|
-
var pointsRewardSchema = /* @__PURE__ */ (() =>
|
|
4060
|
-
kind:
|
|
4298
|
+
import * as z41 from "zod";
|
|
4299
|
+
var pointsRewardSchema = /* @__PURE__ */ (() => z41.object({
|
|
4300
|
+
kind: z41.literal("points").default("points"),
|
|
4061
4301
|
balance: identifier,
|
|
4062
|
-
amount:
|
|
4302
|
+
amount: z41.number().int().min(0).max(maxPointsAmount)
|
|
4063
4303
|
}).strict())();
|
|
4064
|
-
var tieredRewardDefinitionSchema = /* @__PURE__ */ (() =>
|
|
4304
|
+
var tieredRewardDefinitionSchema = /* @__PURE__ */ (() => z41.object({
|
|
4065
4305
|
/** An automatic achievement backed by the project badge catalog. */
|
|
4066
4306
|
badge: identifier.optional(),
|
|
4067
4307
|
/** Membership in the project group with this key, added when the reward is delivered. */
|
|
4068
4308
|
group: identifier.optional(),
|
|
4069
4309
|
id: identifier,
|
|
4070
|
-
title:
|
|
4071
|
-
tiers:
|
|
4072
|
-
|
|
4310
|
+
title: z41.string().min(1).max(120),
|
|
4311
|
+
tiers: z41.array(
|
|
4312
|
+
z41.object({ id: identifier, title: z41.string().min(1).max(120) }).strict()
|
|
4073
4313
|
).min(1).max(20).refine(
|
|
4074
4314
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
4075
4315
|
"Tier IDs must be unique"
|
|
4076
4316
|
),
|
|
4077
|
-
inventory:
|
|
4078
|
-
fulfillment:
|
|
4079
|
-
|
|
4080
|
-
|
|
4317
|
+
inventory: z41.object({ kind: z41.literal("untracked") }).strict(),
|
|
4318
|
+
fulfillment: z41.discriminatedUnion("kind", [
|
|
4319
|
+
z41.object({ kind: z41.literal("staff-handover") }).strict(),
|
|
4320
|
+
z41.object({ kind: z41.literal("automatic") }).strict()
|
|
4081
4321
|
])
|
|
4082
4322
|
}).strict().refine(
|
|
4083
4323
|
(value) => value.badge === void 0 && value.group === void 0 || value.fulfillment.kind === "automatic" && value.tiers.length === 1 && value.tiers[0].id === "awarded",
|
|
@@ -4086,12 +4326,12 @@ var tieredRewardDefinitionSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4086
4326
|
(value) => value.badge === void 0 || value.group === void 0,
|
|
4087
4327
|
"A reward is either a badge or a group membership"
|
|
4088
4328
|
))();
|
|
4089
|
-
var tieredRewardReferenceSchema = /* @__PURE__ */ (() =>
|
|
4329
|
+
var tieredRewardReferenceSchema = /* @__PURE__ */ (() => z41.object({
|
|
4090
4330
|
id: identifier,
|
|
4091
4331
|
key: identifier.nullable()
|
|
4092
4332
|
}))();
|
|
4093
|
-
var tierRewardSchema = /* @__PURE__ */ (() =>
|
|
4094
|
-
kind:
|
|
4333
|
+
var tierRewardSchema = /* @__PURE__ */ (() => z41.object({
|
|
4334
|
+
kind: z41.literal("tier"),
|
|
4095
4335
|
reward: tieredRewardDefinitionSchema,
|
|
4096
4336
|
tier: identifier
|
|
4097
4337
|
}).strict().refine(
|
|
@@ -4103,7 +4343,7 @@ var badgeRewardSchema = /* @__PURE__ */ (() => tierRewardSchema.transform(
|
|
|
4103
4343
|
const badge = value.reward.badge;
|
|
4104
4344
|
if (!badge || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
4105
4345
|
context.addIssue({ code: "custom", message: "Invalid badge reward" });
|
|
4106
|
-
return
|
|
4346
|
+
return z41.NEVER;
|
|
4107
4347
|
}
|
|
4108
4348
|
return { ...value, reward: { ...value.reward, badge } };
|
|
4109
4349
|
}
|
|
@@ -4127,7 +4367,7 @@ var groupRewardSchema = /* @__PURE__ */ (() => tierRewardSchema.transform(
|
|
|
4127
4367
|
const group = value.reward.group;
|
|
4128
4368
|
if (!group || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
4129
4369
|
context.addIssue({ code: "custom", message: "Invalid group reward" });
|
|
4130
|
-
return
|
|
4370
|
+
return z41.NEVER;
|
|
4131
4371
|
}
|
|
4132
4372
|
return { ...value, reward: { ...value.reward, group } };
|
|
4133
4373
|
}
|
|
@@ -4147,15 +4387,15 @@ function groupReward(key, title) {
|
|
|
4147
4387
|
});
|
|
4148
4388
|
}
|
|
4149
4389
|
var integrationRewardSchema = discordRewardSchema;
|
|
4150
|
-
var rewardSchema = /* @__PURE__ */ (() =>
|
|
4390
|
+
var rewardSchema = /* @__PURE__ */ (() => z41.union([
|
|
4151
4391
|
pointsRewardSchema,
|
|
4152
4392
|
tierRewardSchema,
|
|
4153
4393
|
integrationRewardSchema
|
|
4154
4394
|
]))();
|
|
4155
|
-
var rewardTypeSchema = /* @__PURE__ */ (() =>
|
|
4156
|
-
var rewardEntrySchema = /* @__PURE__ */ (() =>
|
|
4395
|
+
var rewardTypeSchema = /* @__PURE__ */ (() => z41.string())();
|
|
4396
|
+
var rewardEntrySchema = /* @__PURE__ */ (() => z41.object({
|
|
4157
4397
|
type: rewardTypeSchema,
|
|
4158
|
-
data:
|
|
4398
|
+
data: z41.record(z41.string(), z41.json())
|
|
4159
4399
|
}))();
|
|
4160
4400
|
function rewardKey(reward) {
|
|
4161
4401
|
if (reward.kind === "tier" && reward.reward.badge) {
|
|
@@ -4169,39 +4409,39 @@ function rewardKey(reward) {
|
|
|
4169
4409
|
}
|
|
4170
4410
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
4171
4411
|
}
|
|
4172
|
-
var triggerSchema = /* @__PURE__ */ (() =>
|
|
4173
|
-
|
|
4174
|
-
kind:
|
|
4175
|
-
input:
|
|
4412
|
+
var triggerSchema = /* @__PURE__ */ (() => z41.union([
|
|
4413
|
+
z41.object({
|
|
4414
|
+
kind: z41.literal("manual"),
|
|
4415
|
+
input: z41.literal("text"),
|
|
4176
4416
|
constraints: textOptionsSchema,
|
|
4177
|
-
actor:
|
|
4417
|
+
actor: z41.enum(["member", "staff"]).optional()
|
|
4178
4418
|
}).strict(),
|
|
4179
|
-
|
|
4180
|
-
kind:
|
|
4181
|
-
input:
|
|
4419
|
+
z41.object({
|
|
4420
|
+
kind: z41.literal("manual"),
|
|
4421
|
+
input: z41.literal("url"),
|
|
4182
4422
|
constraints: urlOptionsSchema,
|
|
4183
|
-
actor:
|
|
4423
|
+
actor: z41.enum(["member", "staff"]).optional()
|
|
4184
4424
|
}).strict(),
|
|
4185
|
-
|
|
4186
|
-
kind:
|
|
4187
|
-
input:
|
|
4188
|
-
actor:
|
|
4425
|
+
z41.object({
|
|
4426
|
+
kind: z41.literal("manual"),
|
|
4427
|
+
input: z41.enum(["photo", "quiz", "none"]),
|
|
4428
|
+
actor: z41.enum(["member", "staff"]).optional()
|
|
4189
4429
|
}).strict(),
|
|
4190
|
-
|
|
4191
|
-
kind:
|
|
4430
|
+
z41.object({
|
|
4431
|
+
kind: z41.literal("automatic"),
|
|
4192
4432
|
tracker: trackerTriggerPolicySchema.optional()
|
|
4193
4433
|
}).strict()
|
|
4194
4434
|
]))();
|
|
4195
|
-
var triggerResponseSchema = /* @__PURE__ */ (() =>
|
|
4435
|
+
var triggerResponseSchema = /* @__PURE__ */ (() => z41.union(
|
|
4196
4436
|
triggerSchema.options.map((option) => option.strip())
|
|
4197
4437
|
))();
|
|
4198
|
-
var photoResultSchema = /* @__PURE__ */ (() =>
|
|
4199
|
-
kind:
|
|
4200
|
-
reason:
|
|
4438
|
+
var photoResultSchema = /* @__PURE__ */ (() => z41.object({
|
|
4439
|
+
kind: z41.enum(["pass", "fail", "unclear"]),
|
|
4440
|
+
reason: z41.string().min(1).max(2e3)
|
|
4201
4441
|
}).strict())();
|
|
4202
|
-
var textReviewInputSchema = /* @__PURE__ */ (() =>
|
|
4203
|
-
text:
|
|
4204
|
-
criteria:
|
|
4442
|
+
var textReviewInputSchema = /* @__PURE__ */ (() => z41.object({
|
|
4443
|
+
text: z41.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
4444
|
+
criteria: z41.string().trim().min(1).max(2e3)
|
|
4205
4445
|
}).strict())();
|
|
4206
4446
|
var textResultSchema = photoResultSchema;
|
|
4207
4447
|
var deferPolicy = {
|
|
@@ -4215,31 +4455,31 @@ var retryCooldownPolicy = {
|
|
|
4215
4455
|
minMs: 1e3,
|
|
4216
4456
|
maxMs: 6048e5
|
|
4217
4457
|
};
|
|
4218
|
-
var retryCooldownMsSchema = /* @__PURE__ */ (() =>
|
|
4219
|
-
var evaluatorProgressSchema = /* @__PURE__ */ (() =>
|
|
4220
|
-
current:
|
|
4221
|
-
target:
|
|
4222
|
-
reason:
|
|
4458
|
+
var retryCooldownMsSchema = /* @__PURE__ */ (() => z41.number().int().min(limits.retryCooldown.minMs).max(limits.retryCooldown.maxMs))();
|
|
4459
|
+
var evaluatorProgressSchema = /* @__PURE__ */ (() => z41.object({
|
|
4460
|
+
current: z41.number().finite().nonnegative(),
|
|
4461
|
+
target: z41.number().finite().positive(),
|
|
4462
|
+
reason: z41.string().min(1).max(2e3)
|
|
4223
4463
|
}).refine((value) => value.current <= value.target, {
|
|
4224
4464
|
message: "Progress current must not exceed target"
|
|
4225
4465
|
}))();
|
|
4226
|
-
var decisionSchema = /* @__PURE__ */ (() =>
|
|
4227
|
-
|
|
4228
|
-
kind:
|
|
4229
|
-
reason:
|
|
4230
|
-
retryAfterMs:
|
|
4466
|
+
var decisionSchema = /* @__PURE__ */ (() => z41.discriminatedUnion("kind", [
|
|
4467
|
+
z41.strictObject({
|
|
4468
|
+
kind: z41.literal("defer"),
|
|
4469
|
+
reason: z41.string().min(1).max(2e3),
|
|
4470
|
+
retryAfterMs: z41.number().int().min(limits.defer.minRetryAfterMs).max(limits.defer.maxRetryAfterMs).optional(),
|
|
4231
4471
|
/** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
|
|
4232
|
-
until:
|
|
4472
|
+
until: z41.number().int().safe().nonnegative().optional()
|
|
4233
4473
|
}),
|
|
4234
|
-
evaluatorProgressSchema.safeExtend({ kind:
|
|
4235
|
-
|
|
4236
|
-
kind:
|
|
4237
|
-
rewards:
|
|
4474
|
+
evaluatorProgressSchema.safeExtend({ kind: z41.literal("progress") }).strict(),
|
|
4475
|
+
z41.object({
|
|
4476
|
+
kind: z41.literal("accept"),
|
|
4477
|
+
rewards: z41.array(rewardSchema).max(10),
|
|
4238
4478
|
completionKey: completionKeySchema.optional()
|
|
4239
4479
|
}).strict(),
|
|
4240
|
-
|
|
4241
|
-
kind:
|
|
4242
|
-
reason:
|
|
4480
|
+
z41.object({
|
|
4481
|
+
kind: z41.literal("reject"),
|
|
4482
|
+
reason: z41.string().min(1).max(2e3),
|
|
4243
4483
|
/**
|
|
4244
4484
|
* A stable key for the rejection's cause, such as `wrong-answers`, stored as the attempt's
|
|
4245
4485
|
* `code`: lowercase letters, digits and hyphens, at most 64 characters, and none of the
|
|
@@ -4247,28 +4487,28 @@ var decisionSchema = /* @__PURE__ */ (() => z35.discriminatedUnion("kind", [
|
|
|
4247
4487
|
*/
|
|
4248
4488
|
code: rejectCodeSchema.optional(),
|
|
4249
4489
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
4250
|
-
requestedReview:
|
|
4490
|
+
requestedReview: z41.literal(true).optional()
|
|
4251
4491
|
}).strict(),
|
|
4252
|
-
|
|
4253
|
-
kind:
|
|
4254
|
-
reason:
|
|
4255
|
-
rewards:
|
|
4492
|
+
z41.object({
|
|
4493
|
+
kind: z41.literal("review"),
|
|
4494
|
+
reason: z41.string().min(1).max(2e3),
|
|
4495
|
+
rewards: z41.array(rewardSchema).max(10).optional(),
|
|
4256
4496
|
completionKey: completionKeySchema.optional()
|
|
4257
4497
|
}).strict()
|
|
4258
4498
|
]))();
|
|
4259
|
-
var reviewModeSchema = /* @__PURE__ */ (() =>
|
|
4260
|
-
var storedReviewModeSchema = /* @__PURE__ */ (() =>
|
|
4499
|
+
var reviewModeSchema = /* @__PURE__ */ (() => z41.enum(["workers-ai"]))();
|
|
4500
|
+
var storedReviewModeSchema = /* @__PURE__ */ (() => z41.enum([
|
|
4261
4501
|
"fixture-pass",
|
|
4262
4502
|
"fixture-fail",
|
|
4263
4503
|
"fixture-unclear",
|
|
4264
4504
|
"fixture-error",
|
|
4265
4505
|
"workers-ai"
|
|
4266
4506
|
]))();
|
|
4267
|
-
var rewardBundleSchema = /* @__PURE__ */ (() =>
|
|
4507
|
+
var rewardBundleSchema = /* @__PURE__ */ (() => z41.array(rewardSchema).max(10).refine(
|
|
4268
4508
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
4269
4509
|
"Use one entry per balance or shared reward"
|
|
4270
4510
|
))();
|
|
4271
|
-
var mediaUrlSchema = /* @__PURE__ */ (() =>
|
|
4511
|
+
var mediaUrlSchema = /* @__PURE__ */ (() => z41.string().max(2e3).refine((value) => {
|
|
4272
4512
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
4273
4513
|
return true;
|
|
4274
4514
|
}
|
|
@@ -4278,78 +4518,78 @@ var mediaUrlSchema = /* @__PURE__ */ (() => z35.string().max(2e3).refine((value)
|
|
|
4278
4518
|
return false;
|
|
4279
4519
|
}
|
|
4280
4520
|
}, "Use an HTTPS URL or a same-site path beginning with /"))();
|
|
4281
|
-
var questStepActionSchema = /* @__PURE__ */ (() =>
|
|
4282
|
-
|
|
4283
|
-
kind:
|
|
4521
|
+
var questStepActionSchema = /* @__PURE__ */ (() => z41.discriminatedUnion("kind", [
|
|
4522
|
+
z41.object({
|
|
4523
|
+
kind: z41.literal("link"),
|
|
4284
4524
|
url: mediaUrlSchema.refine(
|
|
4285
4525
|
(value) => value.startsWith("https://"),
|
|
4286
4526
|
"Use an HTTPS URL"
|
|
4287
4527
|
),
|
|
4288
|
-
label:
|
|
4528
|
+
label: z41.string().trim().min(1).max(120)
|
|
4289
4529
|
}).strict()
|
|
4290
4530
|
]))();
|
|
4291
|
-
var questStepSchema = /* @__PURE__ */ (() =>
|
|
4292
|
-
title:
|
|
4293
|
-
description:
|
|
4531
|
+
var questStepSchema = /* @__PURE__ */ (() => z41.object({
|
|
4532
|
+
title: z41.string().trim().min(1).max(120),
|
|
4533
|
+
description: z41.string().max(4e3).optional(),
|
|
4294
4534
|
action: questStepActionSchema.optional()
|
|
4295
4535
|
}).strict())();
|
|
4296
|
-
var questPresentationRequirementSchema = /* @__PURE__ */ (() =>
|
|
4297
|
-
|
|
4298
|
-
|
|
4536
|
+
var questPresentationRequirementSchema = /* @__PURE__ */ (() => z41.discriminatedUnion("kind", [
|
|
4537
|
+
z41.object({ kind: z41.literal("account"), provider: authProviderSchema }).strict(),
|
|
4538
|
+
z41.object({ kind: z41.literal("wallet"), chain: walletChainSchema.optional() }).strict()
|
|
4299
4539
|
]))();
|
|
4300
|
-
var questPresentationContentSchema = /* @__PURE__ */ (() =>
|
|
4301
|
-
steps:
|
|
4540
|
+
var questPresentationContentSchema = /* @__PURE__ */ (() => z41.object({
|
|
4541
|
+
steps: z41.array(questStepSchema).max(30).optional(),
|
|
4302
4542
|
image: mediaUrlSchema.optional(),
|
|
4303
|
-
imageAlt:
|
|
4304
|
-
requirements:
|
|
4543
|
+
imageAlt: z41.string().max(500).optional(),
|
|
4544
|
+
requirements: z41.array(questPresentationRequirementSchema).max(10).optional()
|
|
4305
4545
|
}).strict())();
|
|
4306
4546
|
var questPresentationSchema = /* @__PURE__ */ (() => questPresentationContentSchema.extend({
|
|
4307
4547
|
quiz: quizQuestionsSchema.optional(),
|
|
4308
|
-
instructions:
|
|
4309
|
-
video:
|
|
4548
|
+
instructions: z41.string().max(4e3).optional(),
|
|
4549
|
+
video: z41.object({
|
|
4310
4550
|
url: mediaUrlSchema,
|
|
4311
4551
|
poster: mediaUrlSchema.optional(),
|
|
4312
|
-
captions:
|
|
4552
|
+
captions: z41.object({
|
|
4313
4553
|
url: mediaUrlSchema,
|
|
4314
|
-
language:
|
|
4315
|
-
label:
|
|
4554
|
+
language: z41.string().min(2).max(20),
|
|
4555
|
+
label: z41.string().min(1).max(80)
|
|
4316
4556
|
}).strict().optional()
|
|
4317
4557
|
}).strict().optional()
|
|
4318
4558
|
}).strict())();
|
|
4319
|
-
var questProfileSchema = /* @__PURE__ */ (() =>
|
|
4559
|
+
var questProfileSchema = /* @__PURE__ */ (() => z41.object({ visible: z41.boolean() }).strict())();
|
|
4320
4560
|
var evaluatorProtocol = 2;
|
|
4321
|
-
var evaluatorProtocolSchema = /* @__PURE__ */ (() =>
|
|
4322
|
-
var questDescriptionSchema = /* @__PURE__ */ (() =>
|
|
4561
|
+
var evaluatorProtocolSchema = /* @__PURE__ */ (() => z41.literal(evaluatorProtocol))();
|
|
4562
|
+
var questDescriptionSchema = /* @__PURE__ */ (() => z41.object({
|
|
4323
4563
|
quest: identifier,
|
|
4324
4564
|
evaluatorProtocol: evaluatorProtocolSchema,
|
|
4325
|
-
title:
|
|
4565
|
+
title: z41.string().min(1).max(120),
|
|
4326
4566
|
presentation: questPresentationSchema.default({}),
|
|
4327
4567
|
/** The declared modules this SDK knows. `integrationModules` lists every declared module. */
|
|
4328
|
-
integrations:
|
|
4568
|
+
integrations: z41.array(evaluatorIntegrationProviderSchema).max(10).default([]),
|
|
4329
4569
|
/**
|
|
4330
4570
|
* Every integration module the quest declares, including providers this SDK does not know: the
|
|
4331
4571
|
* open sibling of `integrations`. A description omits it when every module is in
|
|
4332
4572
|
* `integrations`, as descriptions from older SDKs do; Relay's reads always include it.
|
|
4333
4573
|
*/
|
|
4334
|
-
integrationModules:
|
|
4574
|
+
integrationModules: z41.array(integrationModuleProviderSchema).max(10).optional(),
|
|
4335
4575
|
fields: settingsFieldsSchema,
|
|
4336
4576
|
values: settingsValuesSchema,
|
|
4337
4577
|
rewards: rewardBundleSchema,
|
|
4338
4578
|
/** Messages Relay posts in connected chats and channels when a completion pays. */
|
|
4339
|
-
announcements:
|
|
4340
|
-
humanReview:
|
|
4579
|
+
announcements: z41.array(announcementSchema).max(3).optional(),
|
|
4580
|
+
humanReview: z41.boolean(),
|
|
4341
4581
|
trigger: triggerSchema,
|
|
4342
4582
|
performance: contentPerformancePolicySchema.optional(),
|
|
4343
|
-
requires:
|
|
4583
|
+
requires: z41.array(prerequisiteSchema).max(30).default([]),
|
|
4344
4584
|
campaign: campaignDefinitionSchema.optional(),
|
|
4345
4585
|
availability: availabilityWindowSchema.optional(),
|
|
4346
|
-
completion:
|
|
4347
|
-
visibility:
|
|
4586
|
+
completion: z41.preprocess(refuseStreakTimeZone, completionPolicySchema),
|
|
4587
|
+
visibility: z41.enum(["visible", "hidden"]).default("visible"),
|
|
4348
4588
|
/** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
|
|
4349
4589
|
profile: questProfileSchema.default({ visible: false }),
|
|
4350
|
-
budgets:
|
|
4590
|
+
budgets: z41.array(budgetSchema).max(20).default([]),
|
|
4351
4591
|
/** Budgets counted per tracker record author; only on quests with a tracker trigger. */
|
|
4352
|
-
authorBudgets:
|
|
4592
|
+
authorBudgets: z41.array(authorBudgetSchema).max(20).optional(),
|
|
4353
4593
|
/**
|
|
4354
4594
|
* Milliseconds a member waits after an attempt is rejected (by the evaluator or a reviewer)
|
|
4355
4595
|
* before submitting this quest again. Only for quests members submit. Omitted: no cooldown.
|
|
@@ -4373,23 +4613,23 @@ var questDescriptionSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4373
4613
|
*/
|
|
4374
4614
|
gallery: questGallerySchema.optional()
|
|
4375
4615
|
}).strict())();
|
|
4376
|
-
var artifactSchema = /* @__PURE__ */ (() =>
|
|
4616
|
+
var artifactSchema = /* @__PURE__ */ (() => z41.object({ code: z41.string().min(1).max(1e6) }).strict())();
|
|
4377
4617
|
var releaseSchema = /* @__PURE__ */ (() => artifactSchema.extend({
|
|
4378
4618
|
/** The SDK runtime the code imports. Absent, the code bundles its own SDK. */
|
|
4379
4619
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
4380
4620
|
settings: settingsValuesSchema,
|
|
4381
4621
|
provider: reviewModeSchema,
|
|
4382
4622
|
expectedRelease: identifier.nullable().optional(),
|
|
4383
|
-
settingRenames:
|
|
4623
|
+
settingRenames: z41.record(z41.string(), z41.string()).optional()
|
|
4384
4624
|
}).strict())();
|
|
4385
|
-
var batchReleaseSchema = /* @__PURE__ */ (() =>
|
|
4386
|
-
releases:
|
|
4625
|
+
var batchReleaseSchema = /* @__PURE__ */ (() => z41.object({
|
|
4626
|
+
releases: z41.array(releaseSchema).min(1).max(limits.quests)
|
|
4387
4627
|
}).strict())();
|
|
4388
|
-
var questSettingsInputSchema = /* @__PURE__ */ (() =>
|
|
4628
|
+
var questSettingsInputSchema = /* @__PURE__ */ (() => z41.object({
|
|
4389
4629
|
quest: identifier,
|
|
4390
4630
|
expectedRelease: identifier,
|
|
4391
4631
|
set: settingsValuesSchema,
|
|
4392
|
-
reset:
|
|
4632
|
+
reset: z41.array(z41.string()),
|
|
4393
4633
|
/** Replace the editable presentation fields; null restores the code defaults. */
|
|
4394
4634
|
presentation: questPresentationContentSchema.nullable().optional(),
|
|
4395
4635
|
/**
|
|
@@ -4397,7 +4637,7 @@ var questSettingsInputSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4397
4637
|
* none on chain or to use another; null removes a pasted one. A pasted IDL takes precedence
|
|
4398
4638
|
* over one the program publishes on chain.
|
|
4399
4639
|
*/
|
|
4400
|
-
solanaIdls:
|
|
4640
|
+
solanaIdls: z41.record(z41.string(), anchorIdlSchema.nullable()).optional()
|
|
4401
4641
|
}).strict())();
|
|
4402
4642
|
var storedQuestDescriptionSchema = /* @__PURE__ */ (() => questDescriptionSchema.extend({
|
|
4403
4643
|
completion: completionPolicySchema
|
|
@@ -4408,20 +4648,20 @@ var publishedReleaseSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
4408
4648
|
* Every reward of the quest, kinds this SDK does not know included: the open sibling of
|
|
4409
4649
|
* `rewards`, which keeps SDK 1.x's closed `Reward`. Absent from older Relay versions.
|
|
4410
4650
|
*/
|
|
4411
|
-
rewardEntries:
|
|
4651
|
+
rewardEntries: z41.array(rewardEntrySchema).optional(),
|
|
4412
4652
|
key: identifier.optional(),
|
|
4413
|
-
code:
|
|
4653
|
+
code: z41.string(),
|
|
4414
4654
|
/** The SDK runtime `code` imports. Absent, the code bundles its own SDK. */
|
|
4415
4655
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
4416
4656
|
provider: storedReviewModeSchema,
|
|
4417
4657
|
id: identifier,
|
|
4418
|
-
createdAt:
|
|
4419
|
-
origin:
|
|
4420
|
-
lifecycle:
|
|
4421
|
-
configuration:
|
|
4658
|
+
createdAt: z41.number(),
|
|
4659
|
+
origin: z41.object({ typeVersion: identifier }).strict().optional(),
|
|
4660
|
+
lifecycle: z41.enum(["active", "paused", "archived"]).default("active"),
|
|
4661
|
+
configuration: z41.object({
|
|
4422
4662
|
defaults: settingsValuesSchema,
|
|
4423
4663
|
overrides: settingsValuesSchema,
|
|
4424
|
-
preserved:
|
|
4664
|
+
preserved: z41.array(z41.string()),
|
|
4425
4665
|
presentation: questPresentationContentSchema.optional(),
|
|
4426
4666
|
presentationDefaults: questPresentationContentSchema.optional()
|
|
4427
4667
|
}).strict().optional(),
|
|
@@ -4430,20 +4670,20 @@ var publishedReleaseSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
4430
4670
|
* `settings.solanaProgram()` setting key. Stored when the setting is saved; a setting without
|
|
4431
4671
|
* an IDL has no entry.
|
|
4432
4672
|
*/
|
|
4433
|
-
solanaIdls:
|
|
4673
|
+
solanaIdls: z41.record(z41.string(), solanaProgramIdlSchema).optional(),
|
|
4434
4674
|
/**
|
|
4435
4675
|
* The secret settings (`settings.text({ secret: true })`) that hold a value. Responses leave
|
|
4436
4676
|
* every secret setting out of `values` and `configuration`; one not listed here is empty.
|
|
4437
4677
|
* Absent when the release has no secret setting.
|
|
4438
4678
|
*/
|
|
4439
|
-
withheldSettings:
|
|
4679
|
+
withheldSettings: z41.array(z41.string()).optional()
|
|
4440
4680
|
})
|
|
4441
4681
|
))();
|
|
4442
|
-
var templateSchema = /* @__PURE__ */ (() =>
|
|
4443
|
-
code:
|
|
4682
|
+
var templateSchema = /* @__PURE__ */ (() => z41.object({
|
|
4683
|
+
code: z41.string(),
|
|
4444
4684
|
definition: questDescriptionSchema
|
|
4445
4685
|
}))();
|
|
4446
|
-
var quizAnswersSchema = /* @__PURE__ */ (() =>
|
|
4686
|
+
var quizAnswersSchema = /* @__PURE__ */ (() => z41.record(identifier, identifier).refine(
|
|
4447
4687
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
4448
4688
|
"Provide between 1 and 50 answers"
|
|
4449
4689
|
).transform(
|
|
@@ -4451,17 +4691,17 @@ var quizAnswersSchema = /* @__PURE__ */ (() => z35.record(identifier, identifier
|
|
|
4451
4691
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
4452
4692
|
)
|
|
4453
4693
|
))();
|
|
4454
|
-
var quizEvidenceSchema = /* @__PURE__ */ (() =>
|
|
4455
|
-
kind:
|
|
4694
|
+
var quizEvidenceSchema = /* @__PURE__ */ (() => z41.object({
|
|
4695
|
+
kind: z41.literal("quiz"),
|
|
4456
4696
|
release: identifier.optional(),
|
|
4457
4697
|
answers: quizAnswersSchema
|
|
4458
4698
|
}).strict())();
|
|
4459
|
-
var submissionEvidenceSchema = /* @__PURE__ */ (() =>
|
|
4699
|
+
var submissionEvidenceSchema = /* @__PURE__ */ (() => z41.union([
|
|
4460
4700
|
quizEvidenceSchema,
|
|
4461
4701
|
textEvidenceSchema,
|
|
4462
4702
|
urlEvidenceSchema
|
|
4463
4703
|
]))();
|
|
4464
|
-
var submitSchema = /* @__PURE__ */ (() =>
|
|
4704
|
+
var submitSchema = /* @__PURE__ */ (() => z41.object({
|
|
4465
4705
|
actionId: identifier,
|
|
4466
4706
|
quest: identifier,
|
|
4467
4707
|
member: identifier,
|
|
@@ -4469,7 +4709,7 @@ var submitSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4469
4709
|
input: submissionEvidenceSchema.optional(),
|
|
4470
4710
|
release: identifier.optional(),
|
|
4471
4711
|
/** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
|
|
4472
|
-
faultAfterReview:
|
|
4712
|
+
faultAfterReview: z41.boolean().optional()
|
|
4473
4713
|
}).strict())();
|
|
4474
4714
|
var AttemptStatus = {
|
|
4475
4715
|
Queued: "queued",
|
|
@@ -4481,13 +4721,13 @@ var AttemptStatus = {
|
|
|
4481
4721
|
NeedsReview: "needs-review",
|
|
4482
4722
|
Failed: "failed"
|
|
4483
4723
|
};
|
|
4484
|
-
var attemptStatusSchema = /* @__PURE__ */ (() =>
|
|
4724
|
+
var attemptStatusSchema = /* @__PURE__ */ (() => z41.string())();
|
|
4485
4725
|
var AttemptCodeSource = {
|
|
4486
4726
|
Relay: "relay",
|
|
4487
4727
|
Evaluator: "evaluator"
|
|
4488
4728
|
};
|
|
4489
|
-
var attemptCodeSourceSchema = /* @__PURE__ */ (() =>
|
|
4490
|
-
var attemptSchema = /* @__PURE__ */ (() =>
|
|
4729
|
+
var attemptCodeSourceSchema = /* @__PURE__ */ (() => z41.string())();
|
|
4730
|
+
var attemptSchema = /* @__PURE__ */ (() => z41.object({
|
|
4491
4731
|
id: identifier,
|
|
4492
4732
|
release: identifier,
|
|
4493
4733
|
quest: identifier,
|
|
@@ -4495,22 +4735,22 @@ var attemptSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4495
4735
|
evidence: identifier.nullable(),
|
|
4496
4736
|
input: submissionEvidenceSchema.optional(),
|
|
4497
4737
|
status: attemptStatusSchema,
|
|
4498
|
-
reason:
|
|
4499
|
-
retries:
|
|
4500
|
-
generation:
|
|
4501
|
-
completion:
|
|
4738
|
+
reason: z41.string().nullable(),
|
|
4739
|
+
retries: z41.number(),
|
|
4740
|
+
generation: z41.number(),
|
|
4741
|
+
completion: z41.string().nullable(),
|
|
4502
4742
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
4503
4743
|
/** Scheduled reruns advance this number; failure retries preserve it. */
|
|
4504
|
-
evaluationRun:
|
|
4505
|
-
deferCount:
|
|
4506
|
-
deferUntil:
|
|
4507
|
-
nextEvaluationAt:
|
|
4744
|
+
evaluationRun: z41.number().int().nonnegative().default(0),
|
|
4745
|
+
deferCount: z41.number().int().nonnegative().default(0),
|
|
4746
|
+
deferUntil: z41.number().int().safe().nullable().default(null),
|
|
4747
|
+
nextEvaluationAt: z41.number().int().safe().nullable().default(null),
|
|
4508
4748
|
/**
|
|
4509
4749
|
* Open code: consumers must tolerate new values. Relay writes its own codes, such as
|
|
4510
4750
|
* `budget-exhausted`; an attempt the evaluator rejected with `decision.reject({ reason, code })`
|
|
4511
4751
|
* carries the evaluator's code in management reads, and null in responses to members.
|
|
4512
4752
|
*/
|
|
4513
|
-
code:
|
|
4753
|
+
code: z41.string().nullable().default(null),
|
|
4514
4754
|
/**
|
|
4515
4755
|
* Who wrote `code`: `relay` or `evaluator` (an `AttemptCodeSource`), null when `code` is null.
|
|
4516
4756
|
* Open: consumers must tolerate new values. An evaluator can reject with a code Relay also writes,
|
|
@@ -4523,8 +4763,8 @@ var attemptSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4523
4763
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
4524
4764
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
4525
4765
|
*/
|
|
4526
|
-
requestedReview:
|
|
4527
|
-
createdAt:
|
|
4766
|
+
requestedReview: z41.boolean().default(false),
|
|
4767
|
+
createdAt: z41.number(),
|
|
4528
4768
|
/**
|
|
4529
4769
|
* The action that started the attempt: the signed Solana transaction an app's server submitted
|
|
4530
4770
|
* with `management.attempts.submitSolanaTransaction()`. Absent for any other attempt.
|
|
@@ -4540,7 +4780,7 @@ var attemptSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4540
4780
|
*
|
|
4541
4781
|
* @experimental A minor release can change check-in stations.
|
|
4542
4782
|
*/
|
|
4543
|
-
station:
|
|
4783
|
+
station: z41.string().optional()
|
|
4544
4784
|
}))();
|
|
4545
4785
|
var QuestSubmissionStatus = {
|
|
4546
4786
|
Open: "open",
|
|
@@ -4548,9 +4788,9 @@ var QuestSubmissionStatus = {
|
|
|
4548
4788
|
Discarded: "discarded",
|
|
4549
4789
|
Expired: "expired"
|
|
4550
4790
|
};
|
|
4551
|
-
var questSubmissionStatusSchema = /* @__PURE__ */ (() =>
|
|
4791
|
+
var questSubmissionStatusSchema = /* @__PURE__ */ (() => z41.string())();
|
|
4552
4792
|
var questSubmissionSchema = /* @__PURE__ */ (() => responseShape(
|
|
4553
|
-
|
|
4793
|
+
z41.object({
|
|
4554
4794
|
id: identifier,
|
|
4555
4795
|
quest: identifier,
|
|
4556
4796
|
member: identifier,
|
|
@@ -4560,85 +4800,85 @@ var questSubmissionSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
4560
4800
|
/** An uploaded photo's evidence ID. */
|
|
4561
4801
|
evidence: identifier.nullable(),
|
|
4562
4802
|
/** Submitting was refused because the quest changed: review the draft before submitting again. */
|
|
4563
|
-
reviewRequired:
|
|
4803
|
+
reviewRequired: z41.boolean(),
|
|
4564
4804
|
status: questSubmissionStatusSchema,
|
|
4565
4805
|
/** The attempt a `submitted` submission admitted. */
|
|
4566
4806
|
attempt: identifier.nullable(),
|
|
4567
|
-
createdAt:
|
|
4568
|
-
updatedAt:
|
|
4807
|
+
createdAt: z41.number(),
|
|
4808
|
+
updatedAt: z41.number(),
|
|
4569
4809
|
/** When an open submission expires unless it changes again. */
|
|
4570
|
-
expiresAt:
|
|
4810
|
+
expiresAt: z41.number()
|
|
4571
4811
|
})
|
|
4572
4812
|
))();
|
|
4573
|
-
var questSubmissionUpdateSchema = /* @__PURE__ */ (() =>
|
|
4813
|
+
var questSubmissionUpdateSchema = /* @__PURE__ */ (() => z41.object({
|
|
4574
4814
|
release: identifier.nullable().optional(),
|
|
4575
4815
|
input: submissionEvidenceSchema.nullable().optional(),
|
|
4576
4816
|
evidence: identifier.nullable().optional()
|
|
4577
4817
|
}).strict())();
|
|
4578
4818
|
var questSubmissionResultSchema = /* @__PURE__ */ (() => responseShape(
|
|
4579
|
-
|
|
4819
|
+
z41.object({
|
|
4580
4820
|
submission: questSubmissionSchema,
|
|
4581
4821
|
attempt: attemptSchema,
|
|
4582
|
-
replayed:
|
|
4822
|
+
replayed: z41.boolean()
|
|
4583
4823
|
})
|
|
4584
4824
|
))();
|
|
4585
|
-
var eventSchema = /* @__PURE__ */ (() =>
|
|
4586
|
-
id:
|
|
4587
|
-
attempt:
|
|
4588
|
-
kind:
|
|
4589
|
-
detail:
|
|
4590
|
-
actor:
|
|
4591
|
-
at:
|
|
4592
|
-
}))();
|
|
4593
|
-
var pickupSelectionSchema = /* @__PURE__ */ (() =>
|
|
4825
|
+
var eventSchema = /* @__PURE__ */ (() => z41.object({
|
|
4826
|
+
id: z41.number(),
|
|
4827
|
+
attempt: z41.string().nullable(),
|
|
4828
|
+
kind: z41.string(),
|
|
4829
|
+
detail: z41.string(),
|
|
4830
|
+
actor: z41.string().nullable().default(null),
|
|
4831
|
+
at: z41.number()
|
|
4832
|
+
}))();
|
|
4833
|
+
var pickupSelectionSchema = /* @__PURE__ */ (() => z41.object({
|
|
4594
4834
|
item: identifier,
|
|
4595
|
-
revision:
|
|
4835
|
+
revision: z41.number().int().nonnegative()
|
|
4596
4836
|
}).strict())();
|
|
4597
|
-
var pickupAllocationSchema = /* @__PURE__ */ (() =>
|
|
4837
|
+
var pickupAllocationSchema = /* @__PURE__ */ (() => z41.object({
|
|
4598
4838
|
item: identifier,
|
|
4599
|
-
label:
|
|
4839
|
+
label: z41.string().min(1).max(80)
|
|
4600
4840
|
}).strict())();
|
|
4601
|
-
var pickupPolicySchema = /* @__PURE__ */ (() =>
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
kind:
|
|
4605
|
-
tiers:
|
|
4606
|
-
|
|
4841
|
+
var pickupPolicySchema = /* @__PURE__ */ (() => z41.discriminatedUnion("kind", [
|
|
4842
|
+
z41.object({ kind: z41.literal("untracked") }).strict(),
|
|
4843
|
+
z41.object({
|
|
4844
|
+
kind: z41.literal("at-pickup"),
|
|
4845
|
+
tiers: z41.array(
|
|
4846
|
+
z41.object({
|
|
4607
4847
|
tier: identifier,
|
|
4608
|
-
variants:
|
|
4848
|
+
variants: z41.array(pickupAllocationSchema).min(1).max(100)
|
|
4609
4849
|
}).strict()
|
|
4610
4850
|
).min(1).max(100)
|
|
4611
4851
|
}).strict()
|
|
4612
4852
|
]))();
|
|
4613
|
-
var pickupCatalogSchema = /* @__PURE__ */ (() =>
|
|
4853
|
+
var pickupCatalogSchema = /* @__PURE__ */ (() => z41.object({
|
|
4614
4854
|
reward: tieredRewardDefinitionSchema,
|
|
4615
|
-
revision:
|
|
4855
|
+
revision: z41.number().int().nonnegative(),
|
|
4616
4856
|
policy: pickupPolicySchema
|
|
4617
4857
|
}))();
|
|
4618
|
-
var pickupAvailabilitySchema = /* @__PURE__ */ (() =>
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
kind:
|
|
4622
|
-
revision:
|
|
4623
|
-
variants:
|
|
4858
|
+
var pickupAvailabilitySchema = /* @__PURE__ */ (() => z41.discriminatedUnion("kind", [
|
|
4859
|
+
z41.object({ kind: z41.literal("untracked") }).strict(),
|
|
4860
|
+
z41.object({
|
|
4861
|
+
kind: z41.literal("at-pickup"),
|
|
4862
|
+
revision: z41.number().int().nonnegative(),
|
|
4863
|
+
variants: z41.array(
|
|
4624
4864
|
pickupAllocationSchema.extend({
|
|
4625
|
-
available:
|
|
4865
|
+
available: z41.number().int().nonnegative()
|
|
4626
4866
|
})
|
|
4627
4867
|
)
|
|
4628
4868
|
}).strict()
|
|
4629
4869
|
]))();
|
|
4630
|
-
var configurePickupSchema = /* @__PURE__ */ (() =>
|
|
4870
|
+
var configurePickupSchema = /* @__PURE__ */ (() => z41.object({
|
|
4631
4871
|
reward: identifier,
|
|
4632
|
-
revision:
|
|
4872
|
+
revision: z41.number().int().nonnegative(),
|
|
4633
4873
|
actionId: identifier,
|
|
4634
|
-
policy:
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
kind:
|
|
4638
|
-
tiers:
|
|
4639
|
-
|
|
4874
|
+
policy: z41.discriminatedUnion("kind", [
|
|
4875
|
+
z41.object({ kind: z41.literal("untracked") }).strict(),
|
|
4876
|
+
z41.object({
|
|
4877
|
+
kind: z41.literal("at-pickup"),
|
|
4878
|
+
tiers: z41.array(
|
|
4879
|
+
z41.object({
|
|
4640
4880
|
tier: identifier,
|
|
4641
|
-
variants:
|
|
4881
|
+
variants: z41.array(
|
|
4642
4882
|
pickupAllocationSchema.extend({
|
|
4643
4883
|
item: identifier.optional()
|
|
4644
4884
|
})
|
|
@@ -4648,10 +4888,10 @@ var configurePickupSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4648
4888
|
}).strict()
|
|
4649
4889
|
])
|
|
4650
4890
|
}).strict())();
|
|
4651
|
-
var entitlementRecoverySchema = /* @__PURE__ */ (() =>
|
|
4891
|
+
var entitlementRecoverySchema = /* @__PURE__ */ (() => z41.object({
|
|
4652
4892
|
completion: identifier,
|
|
4653
|
-
reason:
|
|
4654
|
-
flaggedAt:
|
|
4893
|
+
reason: z41.string(),
|
|
4894
|
+
flaggedAt: z41.number(),
|
|
4655
4895
|
/** Null means no accepted completion currently earns this reward. */
|
|
4656
4896
|
remainingTier: identifier.nullable()
|
|
4657
4897
|
}))();
|
|
@@ -4661,40 +4901,40 @@ var entitlementBase = /* @__PURE__ */ (() => ({
|
|
|
4661
4901
|
reward: tieredRewardDefinitionSchema,
|
|
4662
4902
|
earnedTier: identifier,
|
|
4663
4903
|
tier: identifier,
|
|
4664
|
-
revision:
|
|
4904
|
+
revision: z41.number().int().positive()
|
|
4665
4905
|
}))();
|
|
4666
|
-
var entitlementStateSchema = /* @__PURE__ */ (() =>
|
|
4667
|
-
|
|
4668
|
-
|
|
4906
|
+
var entitlementStateSchema = /* @__PURE__ */ (() => z41.discriminatedUnion("status", [
|
|
4907
|
+
z41.object({ ...entitlementBase, status: z41.literal("available") }).strict(),
|
|
4908
|
+
z41.object({
|
|
4669
4909
|
...entitlementBase,
|
|
4670
|
-
status:
|
|
4910
|
+
status: z41.literal("handing-over"),
|
|
4671
4911
|
handover: identifier,
|
|
4672
|
-
startedAt:
|
|
4912
|
+
startedAt: z41.number(),
|
|
4673
4913
|
allocation: pickupAllocationSchema.optional()
|
|
4674
4914
|
}).strict(),
|
|
4675
|
-
|
|
4915
|
+
z41.object({
|
|
4676
4916
|
...entitlementBase,
|
|
4677
|
-
status:
|
|
4917
|
+
status: z41.literal("collected"),
|
|
4678
4918
|
handover: identifier,
|
|
4679
|
-
startedAt:
|
|
4919
|
+
startedAt: z41.number(),
|
|
4680
4920
|
allocation: pickupAllocationSchema.optional(),
|
|
4681
|
-
collectedAt:
|
|
4921
|
+
collectedAt: z41.number(),
|
|
4682
4922
|
recovery: entitlementRecoverySchema.optional()
|
|
4683
4923
|
}).strict(),
|
|
4684
4924
|
// An operator voided it: it can no longer be handed over. A quest grant of the same reward to
|
|
4685
4925
|
// the member (the same grant key) makes it available again; a voided referral reward stays void.
|
|
4686
|
-
|
|
4926
|
+
z41.object({
|
|
4687
4927
|
...entitlementBase,
|
|
4688
|
-
status:
|
|
4689
|
-
voidedAt:
|
|
4928
|
+
status: z41.literal("void"),
|
|
4929
|
+
voidedAt: z41.number()
|
|
4690
4930
|
}).strict()
|
|
4691
4931
|
]))();
|
|
4692
|
-
var tieredRewardReadSchema = /* @__PURE__ */ (() =>
|
|
4932
|
+
var tieredRewardReadSchema = /* @__PURE__ */ (() => z41.object({
|
|
4693
4933
|
id: identifier,
|
|
4694
|
-
title:
|
|
4695
|
-
tiers:
|
|
4696
|
-
inventory:
|
|
4697
|
-
fulfillment:
|
|
4934
|
+
title: z41.string(),
|
|
4935
|
+
tiers: z41.array(z41.object({ id: identifier, title: z41.string() }).loose()),
|
|
4936
|
+
inventory: z41.object({ kind: z41.string() }).loose(),
|
|
4937
|
+
fulfillment: z41.object({ kind: z41.string() }).loose(),
|
|
4698
4938
|
/**
|
|
4699
4939
|
* The key given to defineTieredReward, or null for a reward created without one. Management
|
|
4700
4940
|
* reads carry it; participant reads and Relay versions before it leave it out.
|
|
@@ -4707,63 +4947,63 @@ var entitlementReadBase = /* @__PURE__ */ (() => ({
|
|
|
4707
4947
|
reward: tieredRewardReadSchema,
|
|
4708
4948
|
earnedTier: identifier,
|
|
4709
4949
|
tier: identifier,
|
|
4710
|
-
revision:
|
|
4950
|
+
revision: z41.number().int()
|
|
4711
4951
|
}))();
|
|
4712
|
-
var allocationReadSchema = /* @__PURE__ */ (() =>
|
|
4713
|
-
var entitlementSchema = /* @__PURE__ */ (() =>
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4952
|
+
var allocationReadSchema = /* @__PURE__ */ (() => z41.object({ item: identifier, label: z41.string() }).loose())();
|
|
4953
|
+
var entitlementSchema = /* @__PURE__ */ (() => z41.union([
|
|
4954
|
+
z41.discriminatedUnion("status", [
|
|
4955
|
+
z41.object({ ...entitlementReadBase, status: z41.literal("available") }).loose(),
|
|
4956
|
+
z41.object({
|
|
4717
4957
|
...entitlementReadBase,
|
|
4718
|
-
status:
|
|
4958
|
+
status: z41.literal("handing-over"),
|
|
4719
4959
|
handover: identifier,
|
|
4720
|
-
startedAt:
|
|
4960
|
+
startedAt: z41.number(),
|
|
4721
4961
|
allocation: allocationReadSchema.optional()
|
|
4722
4962
|
}).loose(),
|
|
4723
|
-
|
|
4963
|
+
z41.object({
|
|
4724
4964
|
...entitlementReadBase,
|
|
4725
|
-
status:
|
|
4965
|
+
status: z41.literal("collected"),
|
|
4726
4966
|
handover: identifier,
|
|
4727
|
-
startedAt:
|
|
4967
|
+
startedAt: z41.number(),
|
|
4728
4968
|
allocation: allocationReadSchema.optional(),
|
|
4729
|
-
collectedAt:
|
|
4969
|
+
collectedAt: z41.number(),
|
|
4730
4970
|
recovery: entitlementRecoverySchema.optional()
|
|
4731
4971
|
}).loose(),
|
|
4732
|
-
|
|
4972
|
+
z41.object({
|
|
4733
4973
|
...entitlementReadBase,
|
|
4734
|
-
status:
|
|
4735
|
-
voidedAt:
|
|
4974
|
+
status: z41.literal("void"),
|
|
4975
|
+
voidedAt: z41.number()
|
|
4736
4976
|
}).loose()
|
|
4737
4977
|
]),
|
|
4738
|
-
|
|
4978
|
+
z41.object({ ...entitlementReadBase, status: z41.string() }).loose().transform(({ status, ...entitlement }) => ({
|
|
4739
4979
|
...entitlement,
|
|
4740
4980
|
status: "unsupported",
|
|
4741
4981
|
reportedStatus: status
|
|
4742
4982
|
}))
|
|
4743
4983
|
]))();
|
|
4744
|
-
var beginHandoverSchema = /* @__PURE__ */ (() =>
|
|
4984
|
+
var beginHandoverSchema = /* @__PURE__ */ (() => z41.object({
|
|
4745
4985
|
actionId: identifier,
|
|
4746
|
-
revision:
|
|
4986
|
+
revision: z41.number().int().positive(),
|
|
4747
4987
|
selection: pickupSelectionSchema.optional()
|
|
4748
4988
|
}).strict())();
|
|
4749
|
-
var confirmHandoverSchema = /* @__PURE__ */ (() =>
|
|
4750
|
-
var entitlementCorrectionSchema = /* @__PURE__ */ (() =>
|
|
4989
|
+
var confirmHandoverSchema = /* @__PURE__ */ (() => z41.object({ actionId: identifier, handover: identifier }).strict())();
|
|
4990
|
+
var entitlementCorrectionSchema = /* @__PURE__ */ (() => z41.object({
|
|
4751
4991
|
actionId: identifier,
|
|
4752
|
-
revision:
|
|
4753
|
-
reason:
|
|
4992
|
+
revision: z41.number().int().positive(),
|
|
4993
|
+
reason: z41.string().trim().min(1).max(500)
|
|
4754
4994
|
}).strict())();
|
|
4755
4995
|
var CompletionSourceKind = {
|
|
4756
4996
|
Quest: "quest",
|
|
4757
4997
|
Leaderboard: "leaderboard"
|
|
4758
4998
|
};
|
|
4759
|
-
var completionSourceKindSchema = /* @__PURE__ */ (() =>
|
|
4760
|
-
var completionSourceSchema = /* @__PURE__ */ (() =>
|
|
4999
|
+
var completionSourceKindSchema = /* @__PURE__ */ (() => z41.string().min(1).max(64))();
|
|
5000
|
+
var completionSourceSchema = /* @__PURE__ */ (() => z41.object({
|
|
4761
5001
|
kind: completionSourceKindSchema,
|
|
4762
5002
|
id: identifier
|
|
4763
5003
|
}))();
|
|
4764
|
-
var completionRecordSchema = /* @__PURE__ */ (() =>
|
|
5004
|
+
var completionRecordSchema = /* @__PURE__ */ (() => z41.object({
|
|
4765
5005
|
/** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
|
|
4766
|
-
key:
|
|
5006
|
+
key: z41.string().default("once"),
|
|
4767
5007
|
id: identifier,
|
|
4768
5008
|
/** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
|
|
4769
5009
|
quest: identifier,
|
|
@@ -4771,19 +5011,19 @@ var completionRecordSchema = /* @__PURE__ */ (() => z35.object({
|
|
|
4771
5011
|
/** What paid the completion. `source.id` repeats `quest`. */
|
|
4772
5012
|
source: completionSourceSchema.optional()
|
|
4773
5013
|
}))();
|
|
4774
|
-
var questAvailabilitySchema = /* @__PURE__ */ (() =>
|
|
4775
|
-
|
|
4776
|
-
kind:
|
|
4777
|
-
input:
|
|
5014
|
+
var questAvailabilitySchema = /* @__PURE__ */ (() => z41.discriminatedUnion("kind", [
|
|
5015
|
+
z41.object({
|
|
5016
|
+
kind: z41.literal("available"),
|
|
5017
|
+
input: z41.enum(["photo", "quiz", "none", "text", "url"])
|
|
4778
5018
|
}).strict(),
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
kind:
|
|
4782
|
-
missing:
|
|
5019
|
+
z41.object({ kind: z41.literal("completed") }).strict(),
|
|
5020
|
+
z41.object({
|
|
5021
|
+
kind: z41.literal("locked"),
|
|
5022
|
+
missing: z41.array(missingPrerequisiteSchema).min(1)
|
|
4783
5023
|
}).strict(),
|
|
4784
|
-
|
|
4785
|
-
kind:
|
|
4786
|
-
reason:
|
|
5024
|
+
z41.object({
|
|
5025
|
+
kind: z41.literal("blocked"),
|
|
5026
|
+
reason: z41.enum([
|
|
4787
5027
|
"budget-exhausted",
|
|
4788
5028
|
"connection-required",
|
|
4789
5029
|
"wallet-required",
|
|
@@ -4792,56 +5032,56 @@ var questAvailabilitySchema = /* @__PURE__ */ (() => z35.discriminatedUnion("kin
|
|
|
4792
5032
|
"enrollment-required"
|
|
4793
5033
|
]),
|
|
4794
5034
|
/** Which window refused admission when `reason` is `outside-window`. */
|
|
4795
|
-
window:
|
|
4796
|
-
resetsAt:
|
|
5035
|
+
window: z41.enum(["tracker", "quest"]).optional(),
|
|
5036
|
+
resetsAt: z41.number().int().safe().optional()
|
|
4797
5037
|
}).strict(),
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
5038
|
+
z41.object({ kind: z41.literal("staff-required") }).strict(),
|
|
5039
|
+
z41.object({ kind: z41.literal("automatic") }).strict(),
|
|
5040
|
+
z41.object({ kind: z41.literal("checking"), attempt: identifier }).strict(),
|
|
5041
|
+
z41.object({ kind: z41.literal("needs-review"), attempt: identifier }).strict(),
|
|
5042
|
+
z41.object({ kind: z41.literal("retryable"), attempt: identifier }).strict()
|
|
4803
5043
|
]))();
|
|
4804
|
-
var questAvailabilityResponseSchema = /* @__PURE__ */ (() =>
|
|
5044
|
+
var questAvailabilityResponseSchema = /* @__PURE__ */ (() => z41.union(
|
|
4805
5045
|
questAvailabilitySchema.options.map((option) => option.strip())
|
|
4806
5046
|
))();
|
|
4807
|
-
var questBudgetViewSchema = /* @__PURE__ */ (() =>
|
|
5047
|
+
var questBudgetViewSchema = /* @__PURE__ */ (() => z41.object({
|
|
4808
5048
|
id: identifier,
|
|
4809
|
-
scope:
|
|
4810
|
-
period:
|
|
4811
|
-
remaining:
|
|
4812
|
-
resetsAt:
|
|
5049
|
+
scope: z41.enum(["member", "project"]),
|
|
5050
|
+
period: z41.enum(["day", "week", "month", "lifetime"]),
|
|
5051
|
+
remaining: z41.number().int().safe().nonnegative(),
|
|
5052
|
+
resetsAt: z41.number().int().safe().nullable()
|
|
4813
5053
|
}))();
|
|
4814
5054
|
var memberProgressSchema = /* @__PURE__ */ (() => responseShape(
|
|
4815
|
-
|
|
5055
|
+
z41.object({
|
|
4816
5056
|
member: identifier,
|
|
4817
|
-
quests:
|
|
4818
|
-
|
|
5057
|
+
quests: z41.array(
|
|
5058
|
+
z41.object({
|
|
4819
5059
|
quest: identifier,
|
|
4820
5060
|
key: identifier.optional(),
|
|
4821
5061
|
release: identifier.optional(),
|
|
4822
|
-
title:
|
|
5062
|
+
title: z41.string(),
|
|
4823
5063
|
presentation: questPresentationSchema.default({}),
|
|
4824
|
-
connections:
|
|
5064
|
+
connections: z41.array(authProviderSchema).default([]),
|
|
4825
5065
|
trigger: triggerResponseSchema,
|
|
4826
5066
|
availability: questAvailabilityResponseSchema,
|
|
4827
|
-
completed:
|
|
5067
|
+
completed: z41.boolean(),
|
|
4828
5068
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
4829
5069
|
streak: streakProgressSchema.nullable().optional(),
|
|
4830
5070
|
counter: counterProgressSchema.nullable().optional(),
|
|
4831
5071
|
/** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
|
|
4832
5072
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
4833
|
-
completionCount:
|
|
4834
|
-
visibility:
|
|
4835
|
-
missing:
|
|
5073
|
+
completionCount: z41.number().int().nonnegative().default(0),
|
|
5074
|
+
visibility: z41.enum(["visible", "hidden"]).default("visible"),
|
|
5075
|
+
missing: z41.array(missingPrerequisiteSchema),
|
|
4836
5076
|
campaign: campaignViewSchema.nullable().default(null),
|
|
4837
5077
|
window: availabilityWindowSchema.nullable().default(null),
|
|
4838
|
-
budgets:
|
|
5078
|
+
budgets: z41.array(questBudgetViewSchema).default([]),
|
|
4839
5079
|
/**
|
|
4840
5080
|
* Unix milliseconds when the member may submit again, while the quest's retry cooldown
|
|
4841
5081
|
* after their rejected attempt runs. Until then a new attempt is refused with
|
|
4842
5082
|
* `retry-cooldown`. Absent when no cooldown is running.
|
|
4843
5083
|
*/
|
|
4844
|
-
retryAt:
|
|
5084
|
+
retryAt: z41.number().int().safe().optional(),
|
|
4845
5085
|
/**
|
|
4846
5086
|
* Unix milliseconds when the member may next submit the quest, while it waits on something
|
|
4847
5087
|
* that ends by itself: the retry cooldown after a rejection, the completion cooldown after
|
|
@@ -4850,126 +5090,126 @@ var memberProgressSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
4850
5090
|
* several apply; use it for countdowns. Absent when the member can submit now, or when
|
|
4851
5091
|
* nothing will reopen the quest (a used-up lifetime budget, a closed window).
|
|
4852
5092
|
*/
|
|
4853
|
-
nextAvailableAt:
|
|
5093
|
+
nextAvailableAt: z41.number().int().safe().optional(),
|
|
4854
5094
|
attempt: attemptSchema.nullable()
|
|
4855
5095
|
})
|
|
4856
5096
|
),
|
|
4857
|
-
entitlements:
|
|
5097
|
+
entitlements: z41.array(entitlementSchema)
|
|
4858
5098
|
})
|
|
4859
5099
|
))();
|
|
4860
5100
|
var snapshotSchema = /* @__PURE__ */ (() => responseShape(
|
|
4861
|
-
|
|
4862
|
-
releases:
|
|
4863
|
-
completions:
|
|
4864
|
-
entitlements:
|
|
4865
|
-
attempts:
|
|
4866
|
-
balances:
|
|
4867
|
-
|
|
4868
|
-
member:
|
|
4869
|
-
balance:
|
|
4870
|
-
earned:
|
|
4871
|
-
held:
|
|
4872
|
-
available:
|
|
5101
|
+
z41.object({
|
|
5102
|
+
releases: z41.array(publishedReleaseSchema),
|
|
5103
|
+
completions: z41.array(completionRecordSchema),
|
|
5104
|
+
entitlements: z41.array(entitlementSchema),
|
|
5105
|
+
attempts: z41.array(attemptSchema),
|
|
5106
|
+
balances: z41.array(
|
|
5107
|
+
z41.object({
|
|
5108
|
+
member: z41.string(),
|
|
5109
|
+
balance: z41.string(),
|
|
5110
|
+
earned: z41.number(),
|
|
5111
|
+
held: z41.number(),
|
|
5112
|
+
available: z41.number()
|
|
4873
5113
|
})
|
|
4874
5114
|
),
|
|
4875
|
-
events:
|
|
5115
|
+
events: z41.array(eventSchema)
|
|
4876
5116
|
})
|
|
4877
5117
|
))();
|
|
4878
|
-
var evidenceSchema = /* @__PURE__ */ (() =>
|
|
5118
|
+
var evidenceSchema = /* @__PURE__ */ (() => z41.object({
|
|
4879
5119
|
id: identifier,
|
|
4880
5120
|
member: identifier,
|
|
4881
|
-
type:
|
|
4882
|
-
size:
|
|
5121
|
+
type: z41.enum(["image/jpeg", "image/png"]),
|
|
5122
|
+
size: z41.number()
|
|
4883
5123
|
}))();
|
|
4884
|
-
var errorSchema = /* @__PURE__ */ (() =>
|
|
4885
|
-
error:
|
|
4886
|
-
code:
|
|
5124
|
+
var errorSchema = /* @__PURE__ */ (() => z41.object({
|
|
5125
|
+
error: z41.string(),
|
|
5126
|
+
code: z41.string().optional(),
|
|
4887
5127
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
4888
|
-
window:
|
|
4889
|
-
missing:
|
|
5128
|
+
window: z41.enum(["tracker", "quest"]).optional(),
|
|
5129
|
+
missing: z41.array(missingPrerequisiteSchema).optional(),
|
|
4890
5130
|
/**
|
|
4891
5131
|
* Unix milliseconds when the member may submit again, when `code` is `retry-cooldown` or
|
|
4892
5132
|
* `completion-cooldown`.
|
|
4893
5133
|
*/
|
|
4894
|
-
retryAt:
|
|
5134
|
+
retryAt: z41.number().int().safe().optional()
|
|
4895
5135
|
}))();
|
|
4896
|
-
var staffDecisionSchema = /* @__PURE__ */ (() =>
|
|
5136
|
+
var staffDecisionSchema = /* @__PURE__ */ (() => z41.object({
|
|
4897
5137
|
actionId: identifier,
|
|
4898
|
-
generation:
|
|
4899
|
-
decision:
|
|
4900
|
-
reason:
|
|
5138
|
+
generation: z41.number().int().nonnegative(),
|
|
5139
|
+
decision: z41.enum(["accept", "reject"]),
|
|
5140
|
+
reason: z41.string().trim().min(1).max(2e3)
|
|
4901
5141
|
}).strict())();
|
|
4902
|
-
var staffReasonInputSchema = /* @__PURE__ */ (() =>
|
|
5142
|
+
var staffReasonInputSchema = /* @__PURE__ */ (() => z41.object({
|
|
4903
5143
|
actionId: identifier,
|
|
4904
|
-
reason:
|
|
5144
|
+
reason: z41.string().trim().min(1).max(2e3)
|
|
4905
5145
|
}).strict())();
|
|
4906
5146
|
var acceptAnywaySchema = staffReasonInputSchema;
|
|
4907
5147
|
var evidenceRedactionInputSchema = staffReasonInputSchema;
|
|
4908
|
-
var evidenceRetentionInputSchema = /* @__PURE__ */ (() =>
|
|
5148
|
+
var evidenceRetentionInputSchema = /* @__PURE__ */ (() => z41.object({
|
|
4909
5149
|
actionId: identifier,
|
|
4910
5150
|
quest: identifier,
|
|
4911
|
-
decidedBefore:
|
|
4912
|
-
reason:
|
|
5151
|
+
decidedBefore: z41.number().int().nonnegative(),
|
|
5152
|
+
reason: z41.string().trim().min(1).max(2e3)
|
|
4913
5153
|
}).strict())();
|
|
4914
|
-
var evidenceRetentionPeriodSchema = /* @__PURE__ */ (() =>
|
|
4915
|
-
|
|
4916
|
-
|
|
5154
|
+
var evidenceRetentionPeriodSchema = /* @__PURE__ */ (() => z41.union([
|
|
5155
|
+
z41.object({ days: z41.number().int().min(1).max(3650) }).strict(),
|
|
5156
|
+
z41.literal("keep")
|
|
4917
5157
|
]))();
|
|
4918
|
-
var evidenceRetentionSettingInputSchema = /* @__PURE__ */ (() =>
|
|
5158
|
+
var evidenceRetentionSettingInputSchema = /* @__PURE__ */ (() => z41.object({
|
|
4919
5159
|
actionId: identifier,
|
|
4920
5160
|
evidenceRetention: evidenceRetentionPeriodSchema
|
|
4921
5161
|
}).strict())();
|
|
4922
|
-
var stockSchema = /* @__PURE__ */ (() =>
|
|
4923
|
-
var reservationSchema = /* @__PURE__ */ (() =>
|
|
5162
|
+
var stockSchema = /* @__PURE__ */ (() => z41.object({ item: identifier, quantity: z41.number().int().min(0).max(1e4) }).strict())();
|
|
5163
|
+
var reservationSchema = /* @__PURE__ */ (() => z41.object({
|
|
4924
5164
|
actionId: identifier,
|
|
4925
5165
|
member: identifier,
|
|
4926
5166
|
item: identifier,
|
|
4927
5167
|
balance: identifier,
|
|
4928
|
-
price:
|
|
5168
|
+
price: z41.number().int().positive().max(1e4)
|
|
4929
5169
|
}).strict())();
|
|
4930
5170
|
var pageOptions = /* @__PURE__ */ (() => ({
|
|
4931
|
-
limit:
|
|
4932
|
-
cursor:
|
|
5171
|
+
limit: z41.number().int().min(1).max(100).default(25),
|
|
5172
|
+
cursor: z41.string().min(1).max(4096).optional()
|
|
4933
5173
|
}))();
|
|
4934
|
-
var reviewListSchema = /* @__PURE__ */ (() =>
|
|
5174
|
+
var reviewListSchema = /* @__PURE__ */ (() => z41.object({
|
|
4935
5175
|
...pageOptions,
|
|
4936
5176
|
member: identifier.optional(),
|
|
4937
5177
|
quest: identifier.optional()
|
|
4938
5178
|
}).strict())();
|
|
4939
|
-
var memberListSchema = /* @__PURE__ */ (() =>
|
|
5179
|
+
var memberListSchema = /* @__PURE__ */ (() => z41.object({
|
|
4940
5180
|
...pageOptions,
|
|
4941
5181
|
prefix: identifier.optional()
|
|
4942
5182
|
}).strict())();
|
|
4943
|
-
var reviewItemSchema = /* @__PURE__ */ (() =>
|
|
5183
|
+
var reviewItemSchema = /* @__PURE__ */ (() => z41.object({
|
|
4944
5184
|
attempt: attemptSchema,
|
|
4945
|
-
title:
|
|
4946
|
-
checks:
|
|
4947
|
-
|
|
5185
|
+
title: z41.string(),
|
|
5186
|
+
checks: z41.array(
|
|
5187
|
+
z41.object({ criteria: z41.string(), result: photoResultSchema })
|
|
4948
5188
|
)
|
|
4949
5189
|
}))();
|
|
4950
|
-
var reviewPageSchema = /* @__PURE__ */ (() =>
|
|
4951
|
-
items:
|
|
4952
|
-
nextCursor:
|
|
5190
|
+
var reviewPageSchema = /* @__PURE__ */ (() => z41.object({
|
|
5191
|
+
items: z41.array(reviewItemSchema).max(100),
|
|
5192
|
+
nextCursor: z41.string().nullable()
|
|
4953
5193
|
}))();
|
|
4954
|
-
var memberPageSchema = /* @__PURE__ */ (() =>
|
|
4955
|
-
items:
|
|
4956
|
-
nextCursor:
|
|
5194
|
+
var memberPageSchema = /* @__PURE__ */ (() => z41.object({
|
|
5195
|
+
items: z41.array(z41.object({ member: identifier })).max(100),
|
|
5196
|
+
nextCursor: z41.string().nullable()
|
|
4957
5197
|
}))();
|
|
4958
|
-
var createStockItemSchema = /* @__PURE__ */ (() =>
|
|
4959
|
-
var stockItemSchema = /* @__PURE__ */ (() =>
|
|
4960
|
-
var contentPerformanceSnapshotSchema = /* @__PURE__ */ (() =>
|
|
5198
|
+
var createStockItemSchema = /* @__PURE__ */ (() => z41.object({ actionId: identifier, name: z41.string().trim().min(1).max(80) }).strict())();
|
|
5199
|
+
var stockItemSchema = /* @__PURE__ */ (() => z41.object({ id: identifier, name: z41.string() }))();
|
|
5200
|
+
var contentPerformanceSnapshotSchema = /* @__PURE__ */ (() => z41.strictObject({
|
|
4961
5201
|
contentAttempt: identifier,
|
|
4962
5202
|
observation: identifier,
|
|
4963
|
-
observedAt:
|
|
5203
|
+
observedAt: z41.number().int().safe().nonnegative(),
|
|
4964
5204
|
metrics: contentMetricsSchema,
|
|
4965
5205
|
rewards: rewardBundleSchema
|
|
4966
5206
|
}))();
|
|
4967
5207
|
var contentPerformanceQuerySchema = /* @__PURE__ */ (() => contentQualificationQuerySchema.extend({
|
|
4968
|
-
content:
|
|
5208
|
+
content: z41.string().min(1).max(256)
|
|
4969
5209
|
}))();
|
|
4970
|
-
var contentPerformancePageSchema = /* @__PURE__ */ (() =>
|
|
4971
|
-
current:
|
|
4972
|
-
state:
|
|
5210
|
+
var contentPerformancePageSchema = /* @__PURE__ */ (() => z41.strictObject({
|
|
5211
|
+
current: z41.strictObject({
|
|
5212
|
+
state: z41.enum([
|
|
4973
5213
|
"content-pending",
|
|
4974
5214
|
"content-unqualified",
|
|
4975
5215
|
"waiting",
|
|
@@ -4980,19 +5220,19 @@ var contentPerformancePageSchema = /* @__PURE__ */ (() => z35.strictObject({
|
|
|
4980
5220
|
"failed",
|
|
4981
5221
|
"superseded"
|
|
4982
5222
|
]),
|
|
4983
|
-
reason:
|
|
5223
|
+
reason: z41.string().nullable(),
|
|
4984
5224
|
contentAttempt: identifier,
|
|
4985
5225
|
attempt: identifier.nullable(),
|
|
4986
5226
|
reward: contentQualificationSchema.shape.reward
|
|
4987
5227
|
}),
|
|
4988
|
-
items:
|
|
4989
|
-
|
|
5228
|
+
items: z41.array(
|
|
5229
|
+
z41.strictObject({
|
|
4990
5230
|
attempt: identifier,
|
|
4991
5231
|
contentAttempt: identifier,
|
|
4992
5232
|
observation: identifier,
|
|
4993
|
-
observedAt:
|
|
5233
|
+
observedAt: z41.number(),
|
|
4994
5234
|
metrics: contentMetricsSchema,
|
|
4995
|
-
state:
|
|
5235
|
+
state: z41.enum([
|
|
4996
5236
|
"pending",
|
|
4997
5237
|
"qualified",
|
|
4998
5238
|
"unqualified",
|
|
@@ -5000,43 +5240,43 @@ var contentPerformancePageSchema = /* @__PURE__ */ (() => z35.strictObject({
|
|
|
5000
5240
|
"failed",
|
|
5001
5241
|
"superseded"
|
|
5002
5242
|
]),
|
|
5003
|
-
reason:
|
|
5243
|
+
reason: z41.string().nullable()
|
|
5004
5244
|
})
|
|
5005
5245
|
),
|
|
5006
5246
|
nextCursor: pageCursorSchema.nullable()
|
|
5007
5247
|
}))();
|
|
5008
5248
|
|
|
5009
5249
|
// src/point-ledgers.ts
|
|
5010
|
-
import * as
|
|
5011
|
-
var pointLedgerPropertiesSchema = /* @__PURE__ */ (() =>
|
|
5012
|
-
name:
|
|
5013
|
-
description:
|
|
5250
|
+
import * as z42 from "zod";
|
|
5251
|
+
var pointLedgerPropertiesSchema = /* @__PURE__ */ (() => z42.object({
|
|
5252
|
+
name: z42.string().trim().min(1).max(120),
|
|
5253
|
+
description: z42.string().trim().max(1e3).default("")
|
|
5014
5254
|
}).strict())();
|
|
5015
5255
|
var createPointLedgerSchema = /* @__PURE__ */ (() => pointLedgerPropertiesSchema.extend({ actionId: identifier, key: identifier.optional() }).strict())();
|
|
5016
5256
|
var pointLedgerSchema = /* @__PURE__ */ (() => pointLedgerPropertiesSchema.extend({
|
|
5017
5257
|
id: identifier
|
|
5018
5258
|
}))();
|
|
5019
5259
|
var managedPointLedgerSchema = /* @__PURE__ */ (() => pointLedgerSchema.extend({
|
|
5020
|
-
archivedAt:
|
|
5260
|
+
archivedAt: z42.number().int().nonnegative().nullable()
|
|
5021
5261
|
}))();
|
|
5022
5262
|
var pointLedgerDeclarationSchema = /* @__PURE__ */ (() => pointLedgerPropertiesSchema.extend({ key: identifier }).strict())();
|
|
5023
|
-
var pointLedgerArtifactSchema = /* @__PURE__ */ (() =>
|
|
5263
|
+
var pointLedgerArtifactSchema = /* @__PURE__ */ (() => z42.union([
|
|
5024
5264
|
pointLedgerDeclarationSchema,
|
|
5025
|
-
|
|
5265
|
+
z42.object({ code: z42.string().min(1).max(2e6) }).strict()
|
|
5026
5266
|
]))();
|
|
5027
|
-
var pointLedgerReferenceSchema = /* @__PURE__ */ (() =>
|
|
5267
|
+
var pointLedgerReferenceSchema = /* @__PURE__ */ (() => z42.object({
|
|
5028
5268
|
id: identifier,
|
|
5029
5269
|
key: identifier.nullable(),
|
|
5030
|
-
name:
|
|
5270
|
+
name: z42.string()
|
|
5031
5271
|
}))();
|
|
5032
|
-
var points = /* @__PURE__ */ (() =>
|
|
5033
|
-
var pointBalanceSchema = /* @__PURE__ */ (() =>
|
|
5272
|
+
var points = /* @__PURE__ */ (() => z42.number().int().safe())();
|
|
5273
|
+
var pointBalanceSchema = /* @__PURE__ */ (() => z42.object({
|
|
5034
5274
|
ledger: pointLedgerReferenceSchema,
|
|
5035
5275
|
balance: points,
|
|
5036
5276
|
available: points
|
|
5037
5277
|
}))();
|
|
5038
|
-
var pointBalancesSchema = /* @__PURE__ */ (() =>
|
|
5039
|
-
items:
|
|
5278
|
+
var pointBalancesSchema = /* @__PURE__ */ (() => z42.object({
|
|
5279
|
+
items: z42.array(pointBalanceSchema)
|
|
5040
5280
|
}))();
|
|
5041
5281
|
var PointEntryKind = {
|
|
5042
5282
|
/** Points a quest completion, an engagement settlement or an operator awarded. */
|
|
@@ -5048,8 +5288,8 @@ var PointEntryKind = {
|
|
|
5048
5288
|
/** Undoes part or all of an award or a positive adjustment (`reverses`). */
|
|
5049
5289
|
Reverse: "reverse"
|
|
5050
5290
|
};
|
|
5051
|
-
var pointEntryKindSchema = /* @__PURE__ */ (() =>
|
|
5052
|
-
var pointEntrySchema = /* @__PURE__ */ (() =>
|
|
5291
|
+
var pointEntryKindSchema = /* @__PURE__ */ (() => z42.string().min(1).max(64))();
|
|
5292
|
+
var pointEntrySchema = /* @__PURE__ */ (() => z42.object({
|
|
5053
5293
|
id: identifier,
|
|
5054
5294
|
amount: points,
|
|
5055
5295
|
kind: pointEntryKindSchema,
|
|
@@ -5061,29 +5301,29 @@ var pointEntrySchema = /* @__PURE__ */ (() => z36.object({
|
|
|
5061
5301
|
* True for an opening balance a member import recorded (an `adjust`). Absent from Relay
|
|
5062
5302
|
* versions without imports.
|
|
5063
5303
|
*/
|
|
5064
|
-
imported:
|
|
5304
|
+
imported: z42.boolean().optional()
|
|
5065
5305
|
}))();
|
|
5066
|
-
var pointHistoryQuerySchema = /* @__PURE__ */ (() =>
|
|
5306
|
+
var pointHistoryQuerySchema = /* @__PURE__ */ (() => z42.strictObject({
|
|
5067
5307
|
ledger: identifier,
|
|
5068
5308
|
cursor: pageCursorSchema.optional()
|
|
5069
5309
|
}))();
|
|
5070
|
-
var pointHistoryPageSchema = /* @__PURE__ */ (() =>
|
|
5071
|
-
items:
|
|
5310
|
+
var pointHistoryPageSchema = /* @__PURE__ */ (() => z42.object({
|
|
5311
|
+
items: z42.array(pointEntrySchema),
|
|
5072
5312
|
nextCursor: pageCursorSchema.nullable()
|
|
5073
5313
|
}))();
|
|
5074
5314
|
|
|
5075
5315
|
// src/profiles.ts
|
|
5076
|
-
import * as
|
|
5077
|
-
var count3 = /* @__PURE__ */ (() =>
|
|
5078
|
-
var profileVisibilitySchema = /* @__PURE__ */ (() =>
|
|
5316
|
+
import * as z43 from "zod";
|
|
5317
|
+
var count3 = /* @__PURE__ */ (() => z43.number().int().nonnegative().safe())();
|
|
5318
|
+
var profileVisibilitySchema = /* @__PURE__ */ (() => z43.enum([
|
|
5079
5319
|
"private",
|
|
5080
5320
|
"participants",
|
|
5081
5321
|
"public"
|
|
5082
5322
|
]))();
|
|
5083
|
-
var avatarProviderSchema = /* @__PURE__ */ (() =>
|
|
5084
|
-
var profileDefaultProviderSchema = /* @__PURE__ */ (() =>
|
|
5323
|
+
var avatarProviderSchema = /* @__PURE__ */ (() => z43.enum(["x", "discord", "google"]))();
|
|
5324
|
+
var profileDefaultProviderSchema = /* @__PURE__ */ (() => z43.enum(["x", "discord"]))();
|
|
5085
5325
|
function orderedSources(sources) {
|
|
5086
|
-
return
|
|
5326
|
+
return z43.array(sources).max(sources.options.length).refine(
|
|
5087
5327
|
(values2) => new Set(values2).size === values2.length,
|
|
5088
5328
|
"List each provider once"
|
|
5089
5329
|
);
|
|
@@ -5093,46 +5333,46 @@ var profileDefaultsSchema = /* @__PURE__ */ (() => orderedSources(
|
|
|
5093
5333
|
))();
|
|
5094
5334
|
var knownProfileDefaultSources = ["x", "discord", "sol"];
|
|
5095
5335
|
var profileDefaultSourcesSchema = /* @__PURE__ */ (() => orderedSources(
|
|
5096
|
-
|
|
5336
|
+
z43.enum(knownProfileDefaultSources)
|
|
5097
5337
|
))();
|
|
5098
|
-
var profileNameSourceSchema = /* @__PURE__ */ (() =>
|
|
5099
|
-
var openValue = /* @__PURE__ */ (() =>
|
|
5100
|
-
var avatarSeedSchema = /* @__PURE__ */ (() =>
|
|
5101
|
-
var profileAvatarSchema = /* @__PURE__ */ (() =>
|
|
5102
|
-
|
|
5103
|
-
source:
|
|
5104
|
-
url:
|
|
5338
|
+
var profileNameSourceSchema = /* @__PURE__ */ (() => z43.enum(["sol"]))();
|
|
5339
|
+
var openValue = /* @__PURE__ */ (() => z43.string().min(1).max(64))();
|
|
5340
|
+
var avatarSeedSchema = /* @__PURE__ */ (() => z43.string().min(1).max(100))();
|
|
5341
|
+
var profileAvatarSchema = /* @__PURE__ */ (() => z43.discriminatedUnion("source", [
|
|
5342
|
+
z43.object({
|
|
5343
|
+
source: z43.literal("upload"),
|
|
5344
|
+
url: z43.string().url(),
|
|
5105
5345
|
seed: avatarSeedSchema
|
|
5106
5346
|
}),
|
|
5107
|
-
|
|
5108
|
-
source:
|
|
5347
|
+
z43.object({
|
|
5348
|
+
source: z43.literal("account"),
|
|
5109
5349
|
provider: avatarProviderSchema,
|
|
5110
|
-
url:
|
|
5350
|
+
url: z43.string().url(),
|
|
5111
5351
|
seed: avatarSeedSchema
|
|
5112
5352
|
}),
|
|
5113
|
-
|
|
5353
|
+
z43.object({ source: z43.literal("generated"), seed: avatarSeedSchema })
|
|
5114
5354
|
]))();
|
|
5115
|
-
var profileSummarySchema = /* @__PURE__ */ (() =>
|
|
5355
|
+
var profileSummarySchema = /* @__PURE__ */ (() => z43.object({
|
|
5116
5356
|
id: identifier,
|
|
5117
|
-
name:
|
|
5357
|
+
name: z43.string(),
|
|
5118
5358
|
avatar: profileAvatarSchema
|
|
5119
5359
|
}))();
|
|
5120
5360
|
var invisible = /[\p{Cc}----]/u;
|
|
5121
|
-
var displayNameSchema = /* @__PURE__ */ (() =>
|
|
5122
|
-
|
|
5361
|
+
var displayNameSchema = /* @__PURE__ */ (() => z43.string().max(200).transform((value) => value.normalize("NFC").replace(/\s+/g, " ").trim()).pipe(
|
|
5362
|
+
z43.string().min(1, "Enter a name").max(40, "Use at most 40 characters").refine((value) => !invisible.test(value), "Use visible characters only")
|
|
5123
5363
|
))();
|
|
5124
|
-
var profileUpdateSchema = /* @__PURE__ */ (() =>
|
|
5364
|
+
var profileUpdateSchema = /* @__PURE__ */ (() => z43.object({
|
|
5125
5365
|
displayName: displayNameSchema.nullable().optional(),
|
|
5126
5366
|
/** @experimental A minor release can change `.sol` names. */
|
|
5127
5367
|
nameSource: profileNameSourceSchema.nullable().optional(),
|
|
5128
|
-
avatar:
|
|
5129
|
-
|
|
5130
|
-
source:
|
|
5368
|
+
avatar: z43.discriminatedUnion("source", [
|
|
5369
|
+
z43.object({
|
|
5370
|
+
source: z43.literal("account"),
|
|
5131
5371
|
provider: avatarProviderSchema
|
|
5132
5372
|
}).strict(),
|
|
5133
|
-
|
|
5373
|
+
z43.object({ source: z43.literal("generated") }).strict()
|
|
5134
5374
|
]).nullable().optional(),
|
|
5135
|
-
hidden:
|
|
5375
|
+
hidden: z43.boolean().optional()
|
|
5136
5376
|
}).strict().refine(
|
|
5137
5377
|
(value) => Object.values(value).some((field) => field !== void 0),
|
|
5138
5378
|
"Change at least one field"
|
|
@@ -5142,27 +5382,27 @@ var profileUpdateSchema = /* @__PURE__ */ (() => z37.object({
|
|
|
5142
5382
|
}))();
|
|
5143
5383
|
var ownProfileSchema = /* @__PURE__ */ (() => profileSummarySchema.extend({
|
|
5144
5384
|
/** The name the member chose, or null for the default. */
|
|
5145
|
-
displayName:
|
|
5385
|
+
displayName: z43.string().nullable(),
|
|
5146
5386
|
/** The avatar the member chose: `default` follows the project's defaults. */
|
|
5147
|
-
avatarChoice:
|
|
5387
|
+
avatarChoice: z43.enum(["default", "upload", "account", "generated"]),
|
|
5148
5388
|
/** The account of an `account` choice. */
|
|
5149
5389
|
avatarProvider: avatarProviderSchema.nullable(),
|
|
5150
|
-
hidden:
|
|
5390
|
+
hidden: z43.boolean(),
|
|
5151
5391
|
/** An operator locked the name and avatar; the member can still hide the profile. */
|
|
5152
|
-
locked:
|
|
5392
|
+
locked: z43.boolean(),
|
|
5153
5393
|
/** Who can see profiles in this project, so the app can explain it. */
|
|
5154
5394
|
visibility: profileVisibilitySchema,
|
|
5155
5395
|
/** The member's connected accounts a picture or name can come from. */
|
|
5156
|
-
options:
|
|
5157
|
-
|
|
5396
|
+
options: z43.array(
|
|
5397
|
+
z43.object({
|
|
5158
5398
|
provider: avatarProviderSchema,
|
|
5159
|
-
name:
|
|
5399
|
+
name: z43.string().nullable(),
|
|
5160
5400
|
/**
|
|
5161
5401
|
* The account's first name, where the provider sends one (Google does; X and Discord don't).
|
|
5162
5402
|
* Only the member's own profile carries it.
|
|
5163
5403
|
*/
|
|
5164
|
-
givenName:
|
|
5165
|
-
imageUrl:
|
|
5404
|
+
givenName: z43.string().nullable().default(null),
|
|
5405
|
+
imageUrl: z43.string().url().nullable()
|
|
5166
5406
|
})
|
|
5167
5407
|
),
|
|
5168
5408
|
/**
|
|
@@ -5178,38 +5418,38 @@ var ownProfileSchema = /* @__PURE__ */ (() => profileSummarySchema.extend({
|
|
|
5178
5418
|
*
|
|
5179
5419
|
* @experimental A minor release can change `.sol` names.
|
|
5180
5420
|
*/
|
|
5181
|
-
nameOptions:
|
|
5421
|
+
nameOptions: z43.array(z43.object({ source: openValue, name: z43.string() })).optional()
|
|
5182
5422
|
}))();
|
|
5183
|
-
var cursor = /* @__PURE__ */ (() =>
|
|
5184
|
-
var profileCompletionQuerySchema = /* @__PURE__ */ (() =>
|
|
5185
|
-
limit:
|
|
5423
|
+
var cursor = /* @__PURE__ */ (() => z43.string().min(1).max(512))();
|
|
5424
|
+
var profileCompletionQuerySchema = /* @__PURE__ */ (() => z43.object({
|
|
5425
|
+
limit: z43.coerce.number().int().min(1).max(100).default(20),
|
|
5186
5426
|
cursor: cursor.optional()
|
|
5187
5427
|
}).strict())();
|
|
5188
|
-
var profileCompletionSchema = /* @__PURE__ */ (() =>
|
|
5428
|
+
var profileCompletionSchema = /* @__PURE__ */ (() => z43.object({
|
|
5189
5429
|
quest: identifier,
|
|
5190
5430
|
key: identifier.optional(),
|
|
5191
|
-
title:
|
|
5431
|
+
title: z43.string(),
|
|
5192
5432
|
completions: count3.positive(),
|
|
5193
5433
|
/** Null for completions recorded before completion times were. */
|
|
5194
5434
|
lastCompletedAt: count3.nullable()
|
|
5195
5435
|
}))();
|
|
5196
|
-
var profileCompletionPageSchema = /* @__PURE__ */ (() =>
|
|
5197
|
-
items:
|
|
5436
|
+
var profileCompletionPageSchema = /* @__PURE__ */ (() => z43.object({
|
|
5437
|
+
items: z43.array(profileCompletionSchema),
|
|
5198
5438
|
nextCursor: cursor.nullable()
|
|
5199
5439
|
}))();
|
|
5200
|
-
var profileReferralSchema = /* @__PURE__ */ (() =>
|
|
5440
|
+
var profileReferralSchema = /* @__PURE__ */ (() => z43.object({
|
|
5201
5441
|
program: identifier,
|
|
5202
5442
|
key: identifier.optional(),
|
|
5203
|
-
title:
|
|
5443
|
+
title: z43.string(),
|
|
5204
5444
|
/** Members this member invited. Invitations are shared by every program. */
|
|
5205
5445
|
invited: count3,
|
|
5206
5446
|
/** Invited members who qualified in this program. */
|
|
5207
5447
|
qualified: count3,
|
|
5208
|
-
milestones:
|
|
5209
|
-
|
|
5448
|
+
milestones: z43.array(
|
|
5449
|
+
z43.object({ id: identifier, count: count3, reached: z43.boolean() })
|
|
5210
5450
|
)
|
|
5211
5451
|
}))();
|
|
5212
|
-
var profileSettingsSchema = /* @__PURE__ */ (() =>
|
|
5452
|
+
var profileSettingsSchema = /* @__PURE__ */ (() => z43.object({
|
|
5213
5453
|
visibility: profileVisibilitySchema,
|
|
5214
5454
|
/** The `defaultSources` that are accounts, in order: `.sol` names are left out. */
|
|
5215
5455
|
defaults: profileDefaultsSchema,
|
|
@@ -5219,9 +5459,9 @@ var profileSettingsSchema = /* @__PURE__ */ (() => z37.object({
|
|
|
5219
5459
|
*
|
|
5220
5460
|
* @experimental A minor release can change `.sol` names.
|
|
5221
5461
|
*/
|
|
5222
|
-
defaultSources:
|
|
5462
|
+
defaultSources: z43.array(openValue).optional(),
|
|
5223
5463
|
revision: count3,
|
|
5224
|
-
actor:
|
|
5464
|
+
actor: z43.string().nullable(),
|
|
5225
5465
|
updatedAt: count3.nullable()
|
|
5226
5466
|
}))();
|
|
5227
5467
|
var profileSettingsInputSchema = /* @__PURE__ */ (() => profileSettingsSchema.omit({
|
|
@@ -5241,7 +5481,7 @@ var profileSettingsInputSchema = /* @__PURE__ */ (() => profileSettingsSchema.om
|
|
|
5241
5481
|
actionId: identifier,
|
|
5242
5482
|
/** The revision the change was made against; a newer one is a 409. */
|
|
5243
5483
|
expectedRevision: count3,
|
|
5244
|
-
reason:
|
|
5484
|
+
reason: z43.string().trim().min(1).max(500)
|
|
5245
5485
|
}).strict().refine(
|
|
5246
5486
|
(value) => !value.defaultSources || value.defaultSources.filter((source) => source !== "sol").join() === value.defaults.join(),
|
|
5247
5487
|
{
|
|
@@ -5249,13 +5489,13 @@ var profileSettingsInputSchema = /* @__PURE__ */ (() => profileSettingsSchema.om
|
|
|
5249
5489
|
path: ["defaults"]
|
|
5250
5490
|
}
|
|
5251
5491
|
))();
|
|
5252
|
-
var profileModerationSchema = /* @__PURE__ */ (() =>
|
|
5492
|
+
var profileModerationSchema = /* @__PURE__ */ (() => z43.object({
|
|
5253
5493
|
actionId: identifier,
|
|
5254
|
-
resetName:
|
|
5255
|
-
removeAvatar:
|
|
5494
|
+
resetName: z43.boolean().default(false),
|
|
5495
|
+
removeAvatar: z43.boolean().default(false),
|
|
5256
5496
|
/** True locks the name and avatar, false unlocks them. */
|
|
5257
|
-
lock:
|
|
5258
|
-
reason:
|
|
5497
|
+
lock: z43.boolean().optional(),
|
|
5498
|
+
reason: z43.string().trim().min(1).max(1e3)
|
|
5259
5499
|
}).strict().refine(
|
|
5260
5500
|
(value) => value.resetName || value.removeAvatar || value.lock !== void 0,
|
|
5261
5501
|
"Choose an action"
|
|
@@ -5263,59 +5503,59 @@ var profileModerationSchema = /* @__PURE__ */ (() => z37.object({
|
|
|
5263
5503
|
var managedProfileSchema = /* @__PURE__ */ (() => ownProfileSchema.omit({ options: true, nameOptions: true }).extend({
|
|
5264
5504
|
member: identifier,
|
|
5265
5505
|
lockedAt: count3.nullable(),
|
|
5266
|
-
lockedBy:
|
|
5267
|
-
lockedReason:
|
|
5506
|
+
lockedBy: z43.string().nullable(),
|
|
5507
|
+
lockedReason: z43.string().nullable(),
|
|
5268
5508
|
updatedAt: count3
|
|
5269
5509
|
}))();
|
|
5270
5510
|
var AVATAR_UPLOAD_LIMIT = 5 * 1024 * 1024;
|
|
5271
5511
|
var avatarUploadTypes = ["image/jpeg", "image/png", "image/webp"];
|
|
5272
5512
|
|
|
5273
5513
|
// src/leaderboards.ts
|
|
5274
|
-
import * as
|
|
5275
|
-
var integer = /* @__PURE__ */ (() =>
|
|
5514
|
+
import * as z44 from "zod";
|
|
5515
|
+
var integer = /* @__PURE__ */ (() => z44.number().int().safe())();
|
|
5276
5516
|
var timestamp6 = /* @__PURE__ */ (() => integer.nonnegative().max(864e13))();
|
|
5277
|
-
var leaderboardWindowSchema = /* @__PURE__ */ (() =>
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5517
|
+
var leaderboardWindowSchema = /* @__PURE__ */ (() => z44.discriminatedUnion("kind", [
|
|
5518
|
+
z44.object({ kind: z44.literal("all-time") }).strict(),
|
|
5519
|
+
z44.object({ kind: z44.literal("fixed"), start: timestamp6, end: timestamp6 }).strict().refine((w) => w.end > w.start, "Window end must follow its start"),
|
|
5520
|
+
z44.object({ kind: z44.literal("rolling"), days: integer.min(1).max(3660) }).strict(),
|
|
5281
5521
|
// Not strict: boards published while a calendar window named its own `timeZone` keep reading,
|
|
5282
5522
|
// and the field drops on parse. The authoring schema refuses it.
|
|
5283
|
-
|
|
5284
|
-
kind:
|
|
5523
|
+
z44.object({
|
|
5524
|
+
kind: z44.literal("calendar"),
|
|
5285
5525
|
/** The current day, week (ISO, starting on Monday) or month of the project calendar. */
|
|
5286
5526
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
5287
5527
|
})
|
|
5288
5528
|
]))();
|
|
5289
5529
|
var periodScore = /* @__PURE__ */ (() => ({
|
|
5290
5530
|
window: leaderboardWindowSchema.default({ kind: "all-time" }),
|
|
5291
|
-
quests:
|
|
5531
|
+
quests: z44.array(identifier).min(1).max(100).optional()
|
|
5292
5532
|
}))();
|
|
5293
|
-
var scoreSchema = /* @__PURE__ */ (() =>
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
kind:
|
|
5533
|
+
var scoreSchema = /* @__PURE__ */ (() => z44.discriminatedUnion("kind", [
|
|
5534
|
+
z44.object({ kind: z44.literal("balance") }).strict(),
|
|
5535
|
+
z44.object({ kind: z44.literal("earned"), ...periodScore }).strict(),
|
|
5536
|
+
z44.object({
|
|
5537
|
+
kind: z44.literal("net"),
|
|
5298
5538
|
window: leaderboardWindowSchema.default({ kind: "all-time" })
|
|
5299
5539
|
}).strict()
|
|
5300
5540
|
]).default({ kind: "balance" }))();
|
|
5301
|
-
var leaderboardPrizeRewardSchema = /* @__PURE__ */ (() =>
|
|
5541
|
+
var leaderboardPrizeRewardSchema = /* @__PURE__ */ (() => z44.union([
|
|
5302
5542
|
pointsRewardSchema,
|
|
5303
5543
|
tierRewardSchema
|
|
5304
5544
|
]))();
|
|
5305
|
-
var leaderboardPrizeSchema = /* @__PURE__ */ (() =>
|
|
5306
|
-
ranks:
|
|
5545
|
+
var leaderboardPrizeSchema = /* @__PURE__ */ (() => z44.object({
|
|
5546
|
+
ranks: z44.tuple([integer.positive(), integer.positive()]).refine(([first, last]) => last >= first, {
|
|
5307
5547
|
message: "Prize rank range must end at or after it starts"
|
|
5308
5548
|
}),
|
|
5309
|
-
rewards:
|
|
5549
|
+
rewards: z44.array(leaderboardPrizeRewardSchema).min(1).max(20)
|
|
5310
5550
|
}).strict())();
|
|
5311
|
-
var baseUnitsSchema = /* @__PURE__ */ (() =>
|
|
5551
|
+
var baseUnitsSchema = /* @__PURE__ */ (() => z44.string().regex(
|
|
5312
5552
|
/^(0|[1-9]\d{0,77})$/,
|
|
5313
5553
|
'Use a whole number of base units, such as "1000000"'
|
|
5314
5554
|
))();
|
|
5315
|
-
var leaderboardPoolUnitSchema = /* @__PURE__ */ (() =>
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
code:
|
|
5555
|
+
var leaderboardPoolUnitSchema = /* @__PURE__ */ (() => z44.union([
|
|
5556
|
+
z44.literal("points"),
|
|
5557
|
+
z44.object({
|
|
5558
|
+
code: z44.string().trim().min(1).max(32),
|
|
5319
5559
|
decimals: integer.min(0).max(36)
|
|
5320
5560
|
}).strict()
|
|
5321
5561
|
]))();
|
|
@@ -5357,12 +5597,12 @@ var refinePool = (pool, context) => {
|
|
|
5357
5597
|
});
|
|
5358
5598
|
}
|
|
5359
5599
|
};
|
|
5360
|
-
var leaderboardPoolSchema = /* @__PURE__ */ (() =>
|
|
5361
|
-
var leaderboardSettlementPolicySchema = /* @__PURE__ */ (() =>
|
|
5362
|
-
at:
|
|
5363
|
-
ties:
|
|
5600
|
+
var leaderboardPoolSchema = /* @__PURE__ */ (() => z44.object(poolShape).strict().superRefine(refinePool))();
|
|
5601
|
+
var leaderboardSettlementPolicySchema = /* @__PURE__ */ (() => z44.object({
|
|
5602
|
+
at: z44.literal("window-end"),
|
|
5603
|
+
ties: z44.enum(["shared", "earliest"]),
|
|
5364
5604
|
/** Rank prizes. A board with a pool may list none. */
|
|
5365
|
-
prizes:
|
|
5605
|
+
prizes: z44.array(leaderboardPrizeSchema).max(50),
|
|
5366
5606
|
pool: leaderboardPoolSchema.optional()
|
|
5367
5607
|
}).strict().superRefine((policy, context) => {
|
|
5368
5608
|
if (!policy.prizes.length && !policy.pool) {
|
|
@@ -5394,10 +5634,10 @@ var leaderboardSettlementPolicySchema = /* @__PURE__ */ (() => z38.object({
|
|
|
5394
5634
|
}
|
|
5395
5635
|
}
|
|
5396
5636
|
}))();
|
|
5397
|
-
var leaderboardDefinitionObject = /* @__PURE__ */ (() =>
|
|
5637
|
+
var leaderboardDefinitionObject = /* @__PURE__ */ (() => z44.object({
|
|
5398
5638
|
id: identifier,
|
|
5399
5639
|
key: identifier.optional(),
|
|
5400
|
-
title:
|
|
5640
|
+
title: z44.string().trim().min(1).max(120),
|
|
5401
5641
|
/**
|
|
5402
5642
|
* The point ledger the leaderboard ranks members by. Named `balance` from before ledger fields
|
|
5403
5643
|
* were named `ledger` (docs/management-api.md#field-names); a points pool's `ledger` is the
|
|
@@ -5405,20 +5645,20 @@ var leaderboardDefinitionObject = /* @__PURE__ */ (() => z38.object({
|
|
|
5405
5645
|
*/
|
|
5406
5646
|
balance: identifier,
|
|
5407
5647
|
score: scoreSchema,
|
|
5408
|
-
access:
|
|
5648
|
+
access: z44.enum(["participants", "public"]).default("participants"),
|
|
5409
5649
|
group: identifier.optional(),
|
|
5410
5650
|
/**
|
|
5411
5651
|
* List the project's eligible members who have no qualifying points, with a score of 0, ranked
|
|
5412
5652
|
* after every member who scored and ordered by member ID. Omitted or false lists only members
|
|
5413
5653
|
* with a qualifying entry. Settlements never include them.
|
|
5414
5654
|
*/
|
|
5415
|
-
includeUnscored:
|
|
5655
|
+
includeUnscored: z44.boolean().optional(),
|
|
5416
5656
|
/**
|
|
5417
5657
|
* How the live standings order equal scores. Omitted or `"shared"`: they share a rank. With
|
|
5418
5658
|
* `"earliest"`, the member whose last counted entry is earlier ranks first (then member ID), and
|
|
5419
5659
|
* every scored member gets its own rank: the order `settle.ties: "earliest"` uses.
|
|
5420
5660
|
*/
|
|
5421
|
-
ties:
|
|
5661
|
+
ties: z44.enum(["shared", "earliest"]).optional(),
|
|
5422
5662
|
settle: leaderboardSettlementPolicySchema.optional()
|
|
5423
5663
|
}).strict())();
|
|
5424
5664
|
var validateSettlementWindow = (definition, context) => {
|
|
@@ -5436,70 +5676,70 @@ var leaderboardDefinitionResponseSchema = /* @__PURE__ */ (() => responseShape(
|
|
|
5436
5676
|
))();
|
|
5437
5677
|
var leaderboardAuthoringSchema = /* @__PURE__ */ (() => leaderboardDefinitionObject.omit({ id: true }).extend({
|
|
5438
5678
|
...authoringIdentityShape,
|
|
5439
|
-
score:
|
|
5679
|
+
score: z44.preprocess(refuseWindowTimeZone, scoreSchema),
|
|
5440
5680
|
group: identifier.optional()
|
|
5441
5681
|
}).strict().superRefine(validateSettlementWindow))();
|
|
5442
|
-
var leaderboardArtifactSchema = /* @__PURE__ */ (() =>
|
|
5682
|
+
var leaderboardArtifactSchema = /* @__PURE__ */ (() => z44.union([
|
|
5443
5683
|
leaderboardAuthoringSchema,
|
|
5444
|
-
|
|
5684
|
+
z44.object({ code: z44.string().min(1).max(2e6) }).strict()
|
|
5445
5685
|
]))();
|
|
5446
|
-
var publishedLeaderboardSchema = /* @__PURE__ */ (() =>
|
|
5447
|
-
archivedAt:
|
|
5686
|
+
var publishedLeaderboardSchema = /* @__PURE__ */ (() => z44.object({
|
|
5687
|
+
archivedAt: z44.number().int().nonnegative().nullable().optional(),
|
|
5448
5688
|
version: identifier,
|
|
5449
5689
|
definition: leaderboardDefinitionResponseSchema,
|
|
5450
5690
|
publishedAt: timestamp6,
|
|
5451
|
-
actor:
|
|
5691
|
+
actor: z44.string().nullable()
|
|
5452
5692
|
}))();
|
|
5453
|
-
var leaderboardQuerySchema = /* @__PURE__ */ (() =>
|
|
5454
|
-
limit:
|
|
5455
|
-
cursor:
|
|
5693
|
+
var leaderboardQuerySchema = /* @__PURE__ */ (() => z44.object({
|
|
5694
|
+
limit: z44.coerce.number().int().min(1).max(100).default(25),
|
|
5695
|
+
cursor: z44.string().max(4096).optional()
|
|
5456
5696
|
}).strict())();
|
|
5457
|
-
var leaderboardRowSchema = /* @__PURE__ */ (() =>
|
|
5697
|
+
var leaderboardRowSchema = /* @__PURE__ */ (() => z44.object({
|
|
5458
5698
|
/** The row's stable key: a pseudonym per board and member. */
|
|
5459
5699
|
participant: identifier,
|
|
5460
5700
|
member: identifier.optional(),
|
|
5461
5701
|
/** The profile's name where the viewer can see it, otherwise the pseudonym's. */
|
|
5462
|
-
name:
|
|
5702
|
+
name: z44.string(),
|
|
5463
5703
|
score: integer,
|
|
5464
5704
|
rank: integer.positive(),
|
|
5465
5705
|
/** The member's profile, where visible to this viewer and not hidden by the member. */
|
|
5466
5706
|
profile: profileSummarySchema.nullable()
|
|
5467
5707
|
}))();
|
|
5468
|
-
var leaderboardPageSchema = /* @__PURE__ */ (() =>
|
|
5708
|
+
var leaderboardPageSchema = /* @__PURE__ */ (() => z44.object({
|
|
5469
5709
|
leaderboard: identifier,
|
|
5470
|
-
title:
|
|
5710
|
+
title: z44.string(),
|
|
5471
5711
|
version: identifier,
|
|
5472
|
-
calculation:
|
|
5473
|
-
period:
|
|
5712
|
+
calculation: z44.enum(["balance", "earned", "net"]),
|
|
5713
|
+
period: z44.object({ start: timestamp6.nullable(), end: timestamp6.nullable() }),
|
|
5474
5714
|
calculatedAt: timestamp6,
|
|
5475
5715
|
lastEntryAt: timestamp6.nullable(),
|
|
5476
5716
|
total: integer.nonnegative(),
|
|
5477
|
-
items:
|
|
5717
|
+
items: z44.array(leaderboardRowSchema),
|
|
5478
5718
|
me: leaderboardRowSchema.nullable(),
|
|
5479
|
-
nearby:
|
|
5480
|
-
nextCursor:
|
|
5719
|
+
nearby: z44.array(leaderboardRowSchema),
|
|
5720
|
+
nextCursor: z44.string().nullable()
|
|
5481
5721
|
}))();
|
|
5482
|
-
var leaderboardPlacementSchema = /* @__PURE__ */ (() =>
|
|
5722
|
+
var leaderboardPlacementSchema = /* @__PURE__ */ (() => z44.object({
|
|
5483
5723
|
leaderboard: identifier,
|
|
5484
5724
|
key: identifier.optional(),
|
|
5485
|
-
title:
|
|
5725
|
+
title: z44.string(),
|
|
5486
5726
|
profile: identifier,
|
|
5487
5727
|
rank: integer.positive().nullable(),
|
|
5488
5728
|
score: integer.nullable(),
|
|
5489
5729
|
/** Ranked participants on the board. */
|
|
5490
5730
|
total: integer.nonnegative()
|
|
5491
5731
|
}))();
|
|
5492
|
-
var leaderboardHistoryQuerySchema = /* @__PURE__ */ (() =>
|
|
5732
|
+
var leaderboardHistoryQuerySchema = /* @__PURE__ */ (() => z44.strictObject({
|
|
5493
5733
|
board: identifier,
|
|
5494
5734
|
cursor: pageCursorSchema.optional()
|
|
5495
5735
|
}))();
|
|
5496
|
-
var leaderboardHistoryPageSchema = /* @__PURE__ */ (() =>
|
|
5736
|
+
var leaderboardHistoryPageSchema = /* @__PURE__ */ (() => z44.object({
|
|
5497
5737
|
leaderboard: identifier,
|
|
5498
|
-
period:
|
|
5499
|
-
items:
|
|
5738
|
+
period: z44.object({ start: timestamp6.nullable(), end: timestamp6.nullable() }),
|
|
5739
|
+
items: z44.array(pointEntrySchema),
|
|
5500
5740
|
nextCursor: pageCursorSchema.nullable()
|
|
5501
5741
|
}))();
|
|
5502
|
-
var leaderboardPreviewSchema = /* @__PURE__ */ (() =>
|
|
5742
|
+
var leaderboardPreviewSchema = /* @__PURE__ */ (() => z44.object({
|
|
5503
5743
|
published: publishedLeaderboardSchema,
|
|
5504
5744
|
before: leaderboardPageSchema.nullable(),
|
|
5505
5745
|
after: leaderboardPageSchema
|
|
@@ -5508,53 +5748,53 @@ var mutationBase = /* @__PURE__ */ (() => ({
|
|
|
5508
5748
|
actionId: identifier,
|
|
5509
5749
|
member: identifier,
|
|
5510
5750
|
balance: identifier,
|
|
5511
|
-
reason:
|
|
5751
|
+
reason: z44.string().trim().min(1).max(1e3)
|
|
5512
5752
|
}))();
|
|
5513
5753
|
var datedMutation = /* @__PURE__ */ (() => ({ ...mutationBase, effectiveAt: timestamp6.optional() }))();
|
|
5514
|
-
var pointsMutationSchema = /* @__PURE__ */ (() =>
|
|
5515
|
-
|
|
5754
|
+
var pointsMutationSchema = /* @__PURE__ */ (() => z44.discriminatedUnion("kind", [
|
|
5755
|
+
z44.object({
|
|
5516
5756
|
...datedMutation,
|
|
5517
|
-
kind:
|
|
5518
|
-
referralEligible:
|
|
5757
|
+
kind: z44.literal("award"),
|
|
5758
|
+
referralEligible: z44.boolean().optional(),
|
|
5519
5759
|
amount: integer.positive()
|
|
5520
5760
|
}).strict(),
|
|
5521
|
-
|
|
5761
|
+
z44.object({
|
|
5522
5762
|
...datedMutation,
|
|
5523
|
-
kind:
|
|
5763
|
+
kind: z44.literal("spend"),
|
|
5524
5764
|
amount: integer.positive()
|
|
5525
5765
|
}).strict(),
|
|
5526
|
-
|
|
5766
|
+
z44.object({
|
|
5527
5767
|
...datedMutation,
|
|
5528
|
-
kind:
|
|
5768
|
+
kind: z44.literal("adjust"),
|
|
5529
5769
|
amount: integer.refine((n) => n !== 0)
|
|
5530
5770
|
}).strict(),
|
|
5531
|
-
|
|
5771
|
+
z44.object({
|
|
5532
5772
|
...datedMutation,
|
|
5533
|
-
kind:
|
|
5773
|
+
kind: z44.literal("set"),
|
|
5534
5774
|
total: integer.nonnegative(),
|
|
5535
5775
|
expectedTotal: integer.nonnegative(),
|
|
5536
|
-
classification:
|
|
5776
|
+
classification: z44.enum(["earned", "spend"])
|
|
5537
5777
|
}).strict(),
|
|
5538
|
-
|
|
5778
|
+
z44.object({
|
|
5539
5779
|
...mutationBase,
|
|
5540
|
-
kind:
|
|
5780
|
+
kind: z44.literal("reverse"),
|
|
5541
5781
|
entry: identifier,
|
|
5542
5782
|
amount: integer.positive()
|
|
5543
5783
|
}).strict()
|
|
5544
5784
|
]))();
|
|
5545
|
-
var pointsEntrySchema = /* @__PURE__ */ (() =>
|
|
5785
|
+
var pointsEntrySchema = /* @__PURE__ */ (() => z44.object({
|
|
5546
5786
|
id: identifier,
|
|
5547
|
-
completion:
|
|
5787
|
+
completion: z44.string().nullable(),
|
|
5548
5788
|
member: identifier,
|
|
5549
5789
|
balance: identifier,
|
|
5550
5790
|
amount: integer,
|
|
5551
|
-
kind:
|
|
5791
|
+
kind: z44.enum(["award", "spend", "adjust", "reverse"]),
|
|
5552
5792
|
effectiveAt: timestamp6,
|
|
5553
5793
|
receivedAt: timestamp6,
|
|
5554
5794
|
quest: identifier.nullable(),
|
|
5555
5795
|
original: identifier.nullable(),
|
|
5556
|
-
reason:
|
|
5557
|
-
actor:
|
|
5796
|
+
reason: z44.string(),
|
|
5797
|
+
actor: z44.string().nullable(),
|
|
5558
5798
|
/**
|
|
5559
5799
|
* The member import whose opening balance this `adjust` is, or null. Imported entries emit no
|
|
5560
5800
|
* `points.awarded` and count on balance leaderboards only. Absent from Relay versions without
|
|
@@ -5562,76 +5802,76 @@ var pointsEntrySchema = /* @__PURE__ */ (() => z38.object({
|
|
|
5562
5802
|
*/
|
|
5563
5803
|
import: identifier.nullable().optional()
|
|
5564
5804
|
}))();
|
|
5565
|
-
var managedPointHistoryPageSchema = /* @__PURE__ */ (() =>
|
|
5566
|
-
items:
|
|
5805
|
+
var managedPointHistoryPageSchema = /* @__PURE__ */ (() => z44.object({
|
|
5806
|
+
items: z44.array(pointsEntrySchema),
|
|
5567
5807
|
nextCursor: pageCursorSchema.nullable(),
|
|
5568
5808
|
/** @deprecated Use `nextCursor`, passed back as `cursor`. Removed in 2.0.0. */
|
|
5569
|
-
next:
|
|
5809
|
+
next: z44.number().nullable()
|
|
5570
5810
|
}))();
|
|
5571
|
-
var pointsResultSchema = /* @__PURE__ */ (() =>
|
|
5811
|
+
var pointsResultSchema = /* @__PURE__ */ (() => z44.object({
|
|
5572
5812
|
entry: pointsEntrySchema,
|
|
5573
5813
|
total: integer.nonnegative()
|
|
5574
5814
|
}))();
|
|
5575
|
-
var pointsAccountSchema = /* @__PURE__ */ (() =>
|
|
5815
|
+
var pointsAccountSchema = /* @__PURE__ */ (() => z44.object({
|
|
5576
5816
|
member: identifier,
|
|
5577
5817
|
balance: identifier,
|
|
5578
5818
|
total: integer.nonnegative(),
|
|
5579
5819
|
held: integer.nonnegative()
|
|
5580
5820
|
}))();
|
|
5581
|
-
var leaderboardExclusionSchema = /* @__PURE__ */ (() =>
|
|
5821
|
+
var leaderboardExclusionSchema = /* @__PURE__ */ (() => z44.object({
|
|
5582
5822
|
actionId: identifier,
|
|
5583
5823
|
member: identifier,
|
|
5584
|
-
excluded:
|
|
5585
|
-
reason:
|
|
5824
|
+
excluded: z44.boolean(),
|
|
5825
|
+
reason: z44.string().trim().min(1).max(1e3)
|
|
5586
5826
|
}).strict())();
|
|
5587
|
-
var leaderboardExclusionGroupSchema = /* @__PURE__ */ (() =>
|
|
5827
|
+
var leaderboardExclusionGroupSchema = /* @__PURE__ */ (() => z44.object({
|
|
5588
5828
|
leaderboard: identifier,
|
|
5589
5829
|
group: identifier,
|
|
5590
|
-
generated:
|
|
5830
|
+
generated: z44.boolean(),
|
|
5591
5831
|
boundAt: timestamp6.nullable()
|
|
5592
5832
|
}))();
|
|
5593
|
-
var leaderboardExclusionGroupBindingSchema = /* @__PURE__ */ (() =>
|
|
5833
|
+
var leaderboardExclusionGroupBindingSchema = /* @__PURE__ */ (() => z44.object({
|
|
5594
5834
|
actionId: identifier,
|
|
5595
5835
|
group: identifier,
|
|
5596
|
-
reason:
|
|
5836
|
+
reason: z44.string().trim().min(1).max(1e3)
|
|
5597
5837
|
}).strict())();
|
|
5598
|
-
var leaderboardGroupSchema = /* @__PURE__ */ (() =>
|
|
5838
|
+
var leaderboardGroupSchema = /* @__PURE__ */ (() => z44.object({
|
|
5599
5839
|
actionId: identifier,
|
|
5600
5840
|
member: identifier,
|
|
5601
|
-
included:
|
|
5602
|
-
reason:
|
|
5841
|
+
included: z44.boolean(),
|
|
5842
|
+
reason: z44.string().trim().min(1).max(1e3)
|
|
5603
5843
|
}).strict())();
|
|
5604
|
-
var leaderboardSettlementStatusSchema = /* @__PURE__ */ (() =>
|
|
5605
|
-
var leaderboardSettlementSummarySchema = /* @__PURE__ */ (() =>
|
|
5844
|
+
var leaderboardSettlementStatusSchema = /* @__PURE__ */ (() => z44.enum(["pending", "approved"]))();
|
|
5845
|
+
var leaderboardSettlementSummarySchema = /* @__PURE__ */ (() => z44.object({
|
|
5606
5846
|
id: identifier,
|
|
5607
5847
|
leaderboard: identifier,
|
|
5608
5848
|
version: identifier,
|
|
5609
|
-
title:
|
|
5610
|
-
period:
|
|
5611
|
-
ties:
|
|
5849
|
+
title: z44.string(),
|
|
5850
|
+
period: z44.object({ start: timestamp6, end: timestamp6 }),
|
|
5851
|
+
ties: z44.enum(["shared", "earliest"]),
|
|
5612
5852
|
status: leaderboardSettlementStatusSchema,
|
|
5613
5853
|
total: integer.nonnegative(),
|
|
5614
5854
|
winners: integer.nonnegative(),
|
|
5615
5855
|
createdAt: timestamp6,
|
|
5616
5856
|
approvedAt: timestamp6.nullable(),
|
|
5617
|
-
approvedBy:
|
|
5618
|
-
approvalReason:
|
|
5857
|
+
approvedBy: z44.string().nullable(),
|
|
5858
|
+
approvalReason: z44.string().nullable()
|
|
5619
5859
|
}))();
|
|
5620
|
-
var settlementPaymentSchema = /* @__PURE__ */ (() =>
|
|
5621
|
-
status:
|
|
5860
|
+
var settlementPaymentSchema = /* @__PURE__ */ (() => z44.object({
|
|
5861
|
+
status: z44.string(),
|
|
5622
5862
|
/** The CAIP-2 cluster of the batch that pays or paid the share; null when unpaid. */
|
|
5623
|
-
network:
|
|
5863
|
+
network: z44.string().nullable(),
|
|
5624
5864
|
/** The transaction that paid the share; null until paid. */
|
|
5625
|
-
signature:
|
|
5865
|
+
signature: z44.string().nullable(),
|
|
5626
5866
|
paidAt: timestamp6.nullable()
|
|
5627
5867
|
}))();
|
|
5628
|
-
var leaderboardSettlementRowSchema = /* @__PURE__ */ (() =>
|
|
5868
|
+
var leaderboardSettlementRowSchema = /* @__PURE__ */ (() => z44.object({
|
|
5629
5869
|
member: identifier,
|
|
5630
5870
|
score: integer,
|
|
5631
5871
|
rank: integer.positive(),
|
|
5632
5872
|
position: integer.positive(),
|
|
5633
5873
|
scoredAt: timestamp6,
|
|
5634
|
-
prizes:
|
|
5874
|
+
prizes: z44.array(integer.nonnegative()),
|
|
5635
5875
|
completion: identifier.nullable(),
|
|
5636
5876
|
revokedAt: timestamp6.nullable(),
|
|
5637
5877
|
/**
|
|
@@ -5645,33 +5885,33 @@ var leaderboardSettlementRowSchema = /* @__PURE__ */ (() => z38.object({
|
|
|
5645
5885
|
*/
|
|
5646
5886
|
payment: settlementPaymentSchema.optional()
|
|
5647
5887
|
}))();
|
|
5648
|
-
var leaderboardSettlementPoolSchema = /* @__PURE__ */ (() =>
|
|
5888
|
+
var leaderboardSettlementPoolSchema = /* @__PURE__ */ (() => z44.object({
|
|
5649
5889
|
...poolShape,
|
|
5650
5890
|
allocated: baseUnitsSchema,
|
|
5651
5891
|
unallocated: baseUnitsSchema
|
|
5652
5892
|
}))();
|
|
5653
|
-
var leaderboardSettlementUnmeasuredSchema = /* @__PURE__ */ (() =>
|
|
5654
|
-
content:
|
|
5893
|
+
var leaderboardSettlementUnmeasuredSchema = /* @__PURE__ */ (() => z44.object({
|
|
5894
|
+
content: z44.string(),
|
|
5655
5895
|
member: identifier,
|
|
5656
5896
|
/** When the last good measurement was observed, if Relay has one. */
|
|
5657
5897
|
observedAt: timestamp6.nullable()
|
|
5658
5898
|
}))();
|
|
5659
5899
|
var leaderboardSettlementSchema = /* @__PURE__ */ (() => leaderboardSettlementSummarySchema.extend({
|
|
5660
|
-
prizes:
|
|
5661
|
-
excluded:
|
|
5900
|
+
prizes: z44.array(leaderboardPrizeSchema),
|
|
5901
|
+
excluded: z44.array(identifier),
|
|
5662
5902
|
/**
|
|
5663
5903
|
* Content frozen at its last good measurement because its closing measurement never came; a
|
|
5664
5904
|
* reviewer can retry measurement. Relay sends it for every settlement, empty when nothing is
|
|
5665
5905
|
* missing.
|
|
5666
5906
|
*/
|
|
5667
|
-
unmeasured:
|
|
5907
|
+
unmeasured: z44.array(leaderboardSettlementUnmeasuredSchema).optional(),
|
|
5668
5908
|
/** The settlement's pool prize, or null without one. Absent from Relay versions without pools. */
|
|
5669
5909
|
pool: leaderboardSettlementPoolSchema.nullable().optional(),
|
|
5670
|
-
rows:
|
|
5910
|
+
rows: z44.array(leaderboardSettlementRowSchema)
|
|
5671
5911
|
}))();
|
|
5672
|
-
var leaderboardSettlementApprovalSchema = /* @__PURE__ */ (() =>
|
|
5912
|
+
var leaderboardSettlementApprovalSchema = /* @__PURE__ */ (() => z44.object({
|
|
5673
5913
|
actionId: identifier,
|
|
5674
|
-
reason:
|
|
5914
|
+
reason: z44.string().trim().min(1).max(500)
|
|
5675
5915
|
}).strict())();
|
|
5676
5916
|
|
|
5677
5917
|
export {
|
|
@@ -5714,11 +5954,6 @@ export {
|
|
|
5714
5954
|
telegramMessagesNamespace,
|
|
5715
5955
|
youtubeShortsNamespace,
|
|
5716
5956
|
tiktokVideosNamespace,
|
|
5717
|
-
walletBalancesNamespace,
|
|
5718
|
-
walletProgramActivityNamespace,
|
|
5719
|
-
walletNftsNamespace,
|
|
5720
|
-
walletStakeNamespace,
|
|
5721
|
-
walletProgramAccountsNamespace,
|
|
5722
5957
|
telegramSignInMethodsSchema,
|
|
5723
5958
|
telegramAccountConnectionSchema,
|
|
5724
5959
|
telegramInitDataSchema,
|
|
@@ -5772,7 +6007,6 @@ export {
|
|
|
5772
6007
|
parseNftCollection,
|
|
5773
6008
|
isNftCollection,
|
|
5774
6009
|
walletNftsSchema,
|
|
5775
|
-
walletNftSampleSchema,
|
|
5776
6010
|
parseContractFunction,
|
|
5777
6011
|
parseContractCall,
|
|
5778
6012
|
isContractCall,
|
|
@@ -5794,8 +6028,6 @@ export {
|
|
|
5794
6028
|
maxSolanaSeeds,
|
|
5795
6029
|
walletProgramAccountSchema,
|
|
5796
6030
|
walletStakeSchema,
|
|
5797
|
-
walletStakeSampleSchema,
|
|
5798
|
-
walletProgramAccountSampleSchema,
|
|
5799
6031
|
lifecycleReasonSchema,
|
|
5800
6032
|
offsetDateTimeSchema,
|
|
5801
6033
|
discordMessageSchema,
|
|
@@ -5817,6 +6049,25 @@ export {
|
|
|
5817
6049
|
trackerDataPathTypes,
|
|
5818
6050
|
schemaCheckedReader,
|
|
5819
6051
|
whereSchemaIssue,
|
|
6052
|
+
walletBalancesNamespace,
|
|
6053
|
+
walletBalanceSourceSchema,
|
|
6054
|
+
walletBalances,
|
|
6055
|
+
walletProgramActivityNamespace,
|
|
6056
|
+
walletProgramActivitySourceSchema,
|
|
6057
|
+
walletProgramActivityTrackerSourceSchema,
|
|
6058
|
+
walletProgramActivity,
|
|
6059
|
+
walletNftsNamespace,
|
|
6060
|
+
walletNftSourceSchema,
|
|
6061
|
+
walletNftsTrackerSourceSchema,
|
|
6062
|
+
walletNfts,
|
|
6063
|
+
walletStakeNamespace,
|
|
6064
|
+
walletStakeSourceSchema,
|
|
6065
|
+
walletStakeTrackerSourceSchema,
|
|
6066
|
+
walletStake,
|
|
6067
|
+
walletProgramAccountsNamespace,
|
|
6068
|
+
walletProgramAccountSourceSchema,
|
|
6069
|
+
walletProgramAccountsTrackerSourceSchema,
|
|
6070
|
+
walletProgramAccounts,
|
|
5820
6071
|
xTweetSchema,
|
|
5821
6072
|
xContentBodySchema,
|
|
5822
6073
|
trackerContentQuerySchema,
|
|
@@ -5834,11 +6085,6 @@ export {
|
|
|
5834
6085
|
contentMetricNameSchema,
|
|
5835
6086
|
xContentMetrics,
|
|
5836
6087
|
customContentSchema,
|
|
5837
|
-
walletBalanceSourceSchema,
|
|
5838
|
-
walletProgramActivitySourceSchema,
|
|
5839
|
-
walletNftSourceSchema,
|
|
5840
|
-
walletStakeSourceSchema,
|
|
5841
|
-
walletProgramAccountSourceSchema,
|
|
5842
6088
|
xSearchSourceSchema,
|
|
5843
6089
|
customSourceSchema,
|
|
5844
6090
|
trackerSourceSchema,
|
|
@@ -5855,16 +6101,14 @@ export {
|
|
|
5855
6101
|
managedTrackerSourceSchema,
|
|
5856
6102
|
managedTrackerSourceKinds,
|
|
5857
6103
|
managedTrackerSource,
|
|
6104
|
+
dataTrackerSource,
|
|
5858
6105
|
trackerPropertiesSchema,
|
|
5859
6106
|
trackerCreateSchema,
|
|
5860
6107
|
managedTrackerCreateSchema,
|
|
5861
|
-
|
|
6108
|
+
sampledTrackerCreateSchemas,
|
|
5862
6109
|
programActivityTrackerCreateSchema,
|
|
5863
|
-
walletNftsTrackerSourceSchema,
|
|
5864
6110
|
nftTrackerCreateSchema,
|
|
5865
|
-
walletStakeTrackerSourceSchema,
|
|
5866
6111
|
stakeTrackerCreateSchema,
|
|
5867
|
-
walletProgramAccountsTrackerSourceSchema,
|
|
5868
6112
|
programAccountTrackerCreateSchema,
|
|
5869
6113
|
trackerUpdateSchema,
|
|
5870
6114
|
trackerControlSchema,
|