@domino-sdk/relay 1.59.0 → 1.60.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 +26 -0
- package/dist/{accounts-CVonEkdb.d.ts → accounts-DoabriBX.d.ts} +4 -1
- package/dist/{attempt-captures-DBj-rxak.d.ts → attempt-captures-W2dgzGqE.d.ts} +1 -1
- package/dist/authoring.d.ts +160 -28
- package/dist/authoring.js +83 -14
- package/dist/{automatic-outcomes-FS9okvBP.d.ts → automatic-outcomes-Cmou89IS.d.ts} +1 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +19 -10
- package/dist/browser.js +12 -10
- package/dist/{capability-error-DDJl0LY-.d.ts → capability-error-DufwG3G0.d.ts} +21 -1
- package/dist/{chunk-2LKGAL63.js → chunk-2FHNY52R.js} +8 -2
- package/dist/{chunk-EQF4ID47.js → chunk-422J3QRW.js} +12 -2
- package/dist/{chunk-KYUQEZZA.js → chunk-4OFH4BNX.js} +1 -1
- package/dist/{chunk-R4S6BFOH.js → chunk-6ZG7WNYX.js} +1 -1
- package/dist/{chunk-AWWCEP7F.js → chunk-GBSDAD3N.js} +811 -592
- package/dist/{chunk-YRSU2X2P.js → chunk-KUPVQXUJ.js} +2 -2
- package/dist/{chunk-LDLOB2UZ.js → chunk-KWFY7L7X.js} +4 -4
- package/dist/{chunk-UEMLYPKJ.js → chunk-MJEJQH5A.js} +13 -4
- package/dist/{chunk-W42KMMH5.js → chunk-N3LJ6GFK.js} +1 -1
- package/dist/{chunk-TZJT5CRF.js → chunk-N7YOS4ZU.js} +1 -1
- package/dist/{chunk-KBCTII6C.js → chunk-OTEUP2SG.js} +1 -1
- package/dist/{chunk-577DG2IT.js → chunk-VVRQQRMQ.js} +12 -12
- package/dist/{chunk-YMWRLAAP.js → chunk-VWMIA2TT.js} +8 -2
- package/dist/{chunk-6U5WWH3W.js → chunk-XQKUJL7H.js} +9 -4
- package/dist/{chunk-M2JQPDUX.js → chunk-Y2IGFLD2.js} +9 -9
- package/dist/chunk-YNW2ZUUP.js +247 -0
- package/dist/{chunk-IBROKMFV.js → chunk-YOAPPIWN.js} +1 -1
- package/dist/{client-3b9HjSzZ.d.ts → client-Cw1pB5sv.d.ts} +12 -7
- package/dist/{deployments-BydFVj4Q.d.ts → deployments-DI-W7fBq.d.ts} +786 -2
- package/dist/{groups-CFuTfFqG.d.ts → groups-9Jm3peq3.d.ts} +4 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +9 -9
- package/dist/{integrations-DrbKQSTD.d.ts → integrations-CmIkP1Gi.d.ts} +48 -3
- package/dist/internal.d.ts +10 -10
- package/dist/internal.js +8 -8
- package/dist/{offers-DAfe1O3_.d.ts → offers-CqXfMIxq.d.ts} +3 -2
- package/dist/{pages-ChDVLrgR.d.ts → pages-Bti7g5mX.d.ts} +147 -2
- package/dist/{participant-activity-iciCEs_8.d.ts → participant-activity-DHL8QYks.d.ts} +4 -0
- package/dist/portal-proxy.js +3 -3
- package/dist/react/index.d.ts +15 -14
- package/dist/react/index.js +10 -10
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/ADUMK6CR.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/{schema-BA0nRRlt.d.ts → schema-CwbRkmlr.d.ts} +142 -2
- package/dist/schema.d.ts +112 -17
- package/dist/schema.js +35 -21
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +292 -41
- package/dist/{submission-input-DxQ6RnKo.d.ts → submission-input-D9EGH_yb.d.ts} +2 -2
- package/dist/{telegram-browser-o3OIxGrJ.d.ts → telegram-browser-CTJh4Ro_.d.ts} +4 -4
- package/dist/testing.d.ts +7 -7
- package/dist/testing.js +8 -8
- package/dist/{transport-D_Eqf78J.d.ts → transport-B8Ss5lcz.d.ts} +5331 -118
- package/dist/{wallet-B06zvDXp.d.ts → wallet-DZWL7lJH.d.ts} +1 -1
- package/dist/{x-C28SNifw.d.ts → x-KFJD2x8y.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-XGXDINGM.js +0 -357
- package/dist/runtime/chunks/BG43KQ2T.js +0 -1
|
@@ -508,7 +508,9 @@ var discordResourceSourceSchema = z6.union([
|
|
|
508
508
|
z6.strictObject({
|
|
509
509
|
provider: z6.literal("discord"),
|
|
510
510
|
resource: z6.literal("channel"),
|
|
511
|
-
types: z6.array(z6.enum(["text", "announcement"])).min(1)
|
|
511
|
+
types: z6.array(z6.enum(["text", "announcement"])).min(1),
|
|
512
|
+
/** List channels Domino's bot cannot post in as unavailable, for an announcement's channel. */
|
|
513
|
+
postable: z6.literal(true).optional()
|
|
512
514
|
}),
|
|
513
515
|
z6.strictObject({
|
|
514
516
|
provider: z6.literal("discord"),
|
|
@@ -923,26 +925,26 @@ function matches(schema, value, at, budget) {
|
|
|
923
925
|
}
|
|
924
926
|
}
|
|
925
927
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
926
|
-
const
|
|
928
|
+
const object21 = value;
|
|
927
929
|
const properties = schema.properties ?? {};
|
|
928
930
|
const required = schema.required ?? [];
|
|
929
931
|
charge(budget, required.length);
|
|
930
932
|
for (const key of required) {
|
|
931
|
-
if (!Object.hasOwn(
|
|
933
|
+
if (!Object.hasOwn(object21, key)) {
|
|
932
934
|
return issue(() => `missing required key "${clip(key, maxKeyText)}"`);
|
|
933
935
|
}
|
|
934
936
|
}
|
|
935
937
|
const literals = literalsOf(schema);
|
|
936
938
|
charge(budget, literals.length);
|
|
937
939
|
for (const [key, property] of literals) {
|
|
938
|
-
if (Object.hasOwn(
|
|
940
|
+
if (Object.hasOwn(object21, key) && object21[key] !== property.const) {
|
|
939
941
|
return {
|
|
940
942
|
at: { parent: at, key },
|
|
941
943
|
reason: () => `expected ${JSON.stringify(property.const)}`
|
|
942
944
|
};
|
|
943
945
|
}
|
|
944
946
|
}
|
|
945
|
-
const keys = Object.keys(
|
|
947
|
+
const keys = Object.keys(object21);
|
|
946
948
|
charge(budget, keys.length);
|
|
947
949
|
const names = schema.propertyNames?.enum;
|
|
948
950
|
const allowed = names && setOf(schema.propertyNames, names);
|
|
@@ -963,7 +965,7 @@ function matches(schema, value, at, budget) {
|
|
|
963
965
|
if (property && property !== true) {
|
|
964
966
|
const found = matches(
|
|
965
967
|
property,
|
|
966
|
-
|
|
968
|
+
object21[key],
|
|
967
969
|
{ parent: at, key },
|
|
968
970
|
budget
|
|
969
971
|
);
|
|
@@ -2344,6 +2346,7 @@ var budgetSchema = z18.object({
|
|
|
2344
2346
|
z18.object({ balance: name }).strict()
|
|
2345
2347
|
])
|
|
2346
2348
|
}).strict();
|
|
2349
|
+
var authorBudgetSchema = budgetSchema.extend({ scope: z18.literal("author") }).strict();
|
|
2347
2350
|
var memberCompletionSchema = z18.object({
|
|
2348
2351
|
quest: z18.string().min(1).max(200),
|
|
2349
2352
|
key: completionKeySchema,
|
|
@@ -2370,16 +2373,209 @@ var projectIntegrationSchema = z19.object({
|
|
|
2370
2373
|
connectedAt: z19.number().default(0)
|
|
2371
2374
|
});
|
|
2372
2375
|
|
|
2373
|
-
// src/
|
|
2376
|
+
// src/announcement-template.ts
|
|
2377
|
+
var announcementPlaceholders = [
|
|
2378
|
+
"beneficiary",
|
|
2379
|
+
"author",
|
|
2380
|
+
"quest",
|
|
2381
|
+
"points",
|
|
2382
|
+
"rewards"
|
|
2383
|
+
];
|
|
2384
|
+
var placeholderNames = new Set(announcementPlaceholders);
|
|
2385
|
+
function parseAnnouncementTemplate(text) {
|
|
2386
|
+
const segments = [];
|
|
2387
|
+
let literal18 = "";
|
|
2388
|
+
let index = 0;
|
|
2389
|
+
while (index < text.length) {
|
|
2390
|
+
const char = text[index];
|
|
2391
|
+
if (char === "{" && text[index + 1] === "{") {
|
|
2392
|
+
literal18 += "{";
|
|
2393
|
+
index += 2;
|
|
2394
|
+
continue;
|
|
2395
|
+
}
|
|
2396
|
+
if (char === "}" && text[index + 1] === "}") {
|
|
2397
|
+
literal18 += "}";
|
|
2398
|
+
index += 2;
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
2401
|
+
if (char === "}") {
|
|
2402
|
+
return { error: "Write }} for a literal } in an announcement" };
|
|
2403
|
+
}
|
|
2404
|
+
if (char !== "{") {
|
|
2405
|
+
literal18 += char;
|
|
2406
|
+
index += 1;
|
|
2407
|
+
continue;
|
|
2408
|
+
}
|
|
2409
|
+
const end = text.indexOf("}", index);
|
|
2410
|
+
const name2 = end === -1 ? "" : text.slice(index + 1, end);
|
|
2411
|
+
if (!placeholderNames.has(name2)) {
|
|
2412
|
+
return {
|
|
2413
|
+
error: `Unknown announcement placeholder {${name2}}: use ${announcementPlaceholders.map((known) => `{${known}}`).join(", ")}, or {{ for a literal {`
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2416
|
+
if (literal18) {
|
|
2417
|
+
segments.push({ kind: "text", text: literal18 });
|
|
2418
|
+
literal18 = "";
|
|
2419
|
+
}
|
|
2420
|
+
segments.push({
|
|
2421
|
+
kind: "placeholder",
|
|
2422
|
+
name: name2
|
|
2423
|
+
});
|
|
2424
|
+
index = end + 1;
|
|
2425
|
+
}
|
|
2426
|
+
if (literal18) {
|
|
2427
|
+
segments.push({ kind: "text", text: literal18 });
|
|
2428
|
+
}
|
|
2429
|
+
return { segments };
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
// src/telegram.ts
|
|
2374
2433
|
import * as z20 from "zod";
|
|
2375
|
-
var
|
|
2376
|
-
|
|
2434
|
+
var telegramSignInMethodsSchema = z20.object({
|
|
2435
|
+
/** Telegram Login, the OpenID Connect sign-in Domino configures for the platform. */
|
|
2436
|
+
login: z20.boolean(),
|
|
2437
|
+
/** Mini App sign-in, which the project enables in Console with its bot's ID. */
|
|
2438
|
+
miniApp: z20.boolean()
|
|
2439
|
+
});
|
|
2440
|
+
var telegramAccountConnectionSchema = accountConnectionSchema.extend({
|
|
2441
|
+
provider: z20.literal("telegram")
|
|
2442
|
+
});
|
|
2443
|
+
var telegramInitDataSchema = z20.string().min(1, "Pass the Mini App's Telegram.WebApp.initData").max(8192);
|
|
2444
|
+
var telegramMiniAppSignInSchema = z20.object({
|
|
2445
|
+
initData: telegramInitDataSchema,
|
|
2446
|
+
mode: z20.enum(["sign-in", "connect"])
|
|
2447
|
+
}).strict();
|
|
2448
|
+
var telegramChatIdSchema = z20.string().regex(
|
|
2449
|
+
/^-?[1-9][0-9]{0,19}$/,
|
|
2450
|
+
"Use the chat's numeric ID, such as -1001234567890"
|
|
2451
|
+
);
|
|
2452
|
+
var telegramChatSchema = z20.object({
|
|
2453
|
+
/** The numeric chat ID, as a string. */
|
|
2454
|
+
id: telegramChatIdSchema,
|
|
2455
|
+
/** `group`, `supergroup` or `channel`; a later Telegram may add others. */
|
|
2456
|
+
type: z20.string(),
|
|
2457
|
+
title: z20.string(),
|
|
2458
|
+
/** The public @username, without the @, or null for a private chat. */
|
|
2459
|
+
username: z20.string().nullable(),
|
|
2460
|
+
status: z20.string(),
|
|
2461
|
+
issue: z20.string().nullable(),
|
|
2462
|
+
/**
|
|
2463
|
+
* Whether Domino's bot may post in the chat, as announcements do: as an administrator of a
|
|
2464
|
+
* group, or with the right to post in a channel. Absent from older Relay versions.
|
|
2465
|
+
*/
|
|
2466
|
+
canPost: z20.boolean().optional(),
|
|
2467
|
+
connectedAt: z20.number()
|
|
2468
|
+
});
|
|
2469
|
+
var telegramChatsSchema = z20.object({
|
|
2470
|
+
configured: z20.boolean(),
|
|
2471
|
+
/** Domino's bot, the one operators add to their chats. */
|
|
2472
|
+
bot: z20.object({ username: z20.string() }).nullable(),
|
|
2473
|
+
chats: z20.array(telegramChatSchema)
|
|
2474
|
+
});
|
|
2475
|
+
var telegramChatConnectionSchema = z20.object({
|
|
2476
|
+
url: z20.string(),
|
|
2477
|
+
expiresAt: z20.number()
|
|
2478
|
+
});
|
|
2479
|
+
var telegramMemberInputSchema = z20.object({
|
|
2480
|
+
chat: z20.string().regex(
|
|
2481
|
+
/^(-?[1-9][0-9]{0,19}|@[A-Za-z][A-Za-z0-9_]{3,31})$/,
|
|
2482
|
+
"Name a chat the project connected, by its numeric ID or @username"
|
|
2483
|
+
)
|
|
2484
|
+
}).strict();
|
|
2485
|
+
var telegramChatMemberSchema = z20.object({
|
|
2486
|
+
/** The numeric Telegram user ID. */
|
|
2487
|
+
userId: z20.string(),
|
|
2488
|
+
username: z20.string().nullable(),
|
|
2489
|
+
status: z20.custom(
|
|
2490
|
+
(value) => typeof value === "string"
|
|
2491
|
+
),
|
|
2492
|
+
/** Whether they are in the chat now: a creator, administrator, member, or restricted member. */
|
|
2493
|
+
isMember: z20.boolean(),
|
|
2494
|
+
/** Whether they are its creator or an administrator. */
|
|
2495
|
+
isAdmin: z20.boolean(),
|
|
2496
|
+
/** When a paid subscription or a restriction ends, epoch milliseconds; null when it does not. */
|
|
2497
|
+
untilDate: z20.number().nullable()
|
|
2498
|
+
});
|
|
2499
|
+
var telegramReactionDataSchema = z20.object({
|
|
2500
|
+
/** The chat's numeric ID, as a string. */
|
|
2501
|
+
chatId: z20.string(),
|
|
2502
|
+
/** `group` or `supergroup`: channel reactions are anonymous and never recorded. */
|
|
2503
|
+
chatType: z20.string(),
|
|
2504
|
+
messageId: z20.number(),
|
|
2505
|
+
/** `emoji`, `custom_emoji` or `paid`. */
|
|
2506
|
+
reactionType: z20.string(),
|
|
2507
|
+
/** The emoji, such as "❤", for an `emoji` reaction; null otherwise. */
|
|
2508
|
+
emoji: z20.string().nullable(),
|
|
2509
|
+
/** The custom emoji's ID for a `custom_emoji` reaction; null otherwise. */
|
|
2510
|
+
customEmojiId: z20.string().nullable(),
|
|
2511
|
+
/**
|
|
2512
|
+
* `creator` or `administrator` for one of the chat's administrators, read at most ten minutes
|
|
2513
|
+
* before Relay recorded the reaction; `member` for anyone else.
|
|
2514
|
+
*/
|
|
2515
|
+
reactorStatus: z20.string(),
|
|
2516
|
+
/** Whether the reactor was the chat's creator or an administrator then. */
|
|
2517
|
+
reactorIsAdmin: z20.boolean()
|
|
2518
|
+
});
|
|
2519
|
+
var telegramMessageDataSchema = z20.object({
|
|
2520
|
+
/** The chat's numeric ID, as a string. */
|
|
2521
|
+
chatId: z20.string(),
|
|
2522
|
+
/** `group` or `supergroup`: channel posts are authored by the channel and never recorded. */
|
|
2523
|
+
chatType: z20.string(),
|
|
2524
|
+
messageId: z20.number(),
|
|
2525
|
+
/** The ID of the message it replies to in the same chat; null when it is not a reply. */
|
|
2526
|
+
replyToMessageId: z20.number().nullable(),
|
|
2527
|
+
/**
|
|
2528
|
+
* The message thread it belongs to: the forum topic in a supergroup with topics, or the reply
|
|
2529
|
+
* thread otherwise. Null when Telegram names none.
|
|
2530
|
+
*/
|
|
2531
|
+
threadId: z20.number().nullable()
|
|
2532
|
+
});
|
|
2533
|
+
|
|
2534
|
+
// src/announcements.ts
|
|
2535
|
+
import * as z21 from "zod";
|
|
2536
|
+
var announcementTextSchema = z21.string().trim().min(1).max(1e3).superRefine((text, context) => {
|
|
2537
|
+
const parsed = parseAnnouncementTemplate(text);
|
|
2538
|
+
if ("error" in parsed) {
|
|
2539
|
+
context.addIssue({ code: "custom", message: parsed.error });
|
|
2540
|
+
}
|
|
2541
|
+
});
|
|
2542
|
+
var announcementFields = {
|
|
2543
|
+
action: z21.literal("post-message"),
|
|
2544
|
+
text: announcementTextSchema,
|
|
2545
|
+
/**
|
|
2546
|
+
* Post as a reply to the message that triggered the completion: the message itself, or the
|
|
2547
|
+
* message a reaction was added to. Only when that message is in the same chat or channel; the
|
|
2548
|
+
* post is a plain message otherwise.
|
|
2549
|
+
*/
|
|
2550
|
+
replyToTriggeringMessage: z21.boolean().optional()
|
|
2551
|
+
};
|
|
2552
|
+
var telegramAnnouncementSchema = z21.strictObject({
|
|
2553
|
+
provider: z21.literal("telegram"),
|
|
2554
|
+
/** The chat's numeric ID, as `settings.telegramChat()` holds it. */
|
|
2555
|
+
chat: telegramChatIdSchema,
|
|
2556
|
+
...announcementFields
|
|
2557
|
+
});
|
|
2558
|
+
var discordAnnouncementSchema = z21.strictObject({
|
|
2559
|
+
provider: z21.literal("discord"),
|
|
2560
|
+
/** The channel's ID, as a `discord.channels()` resource setting holds it. */
|
|
2561
|
+
channel: z21.string().regex(/^[0-9]{1,20}$/),
|
|
2562
|
+
...announcementFields
|
|
2563
|
+
});
|
|
2564
|
+
var announcementSchema = z21.discriminatedUnion("provider", [
|
|
2565
|
+
telegramAnnouncementSchema,
|
|
2566
|
+
discordAnnouncementSchema
|
|
2567
|
+
]);
|
|
2568
|
+
|
|
2569
|
+
// src/wallet.ts
|
|
2570
|
+
import * as z22 from "zod";
|
|
2571
|
+
var solanaAddressSchema = z22.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
|
|
2572
|
+
var walletChainSchema = z22.enum(["solana", "eip155", "cosmos"]);
|
|
2377
2573
|
var cosmosNetworkPattern = /^cosmos:[-_a-zA-Z0-9]{1,32}$/;
|
|
2378
|
-
var cosmosNetworkSchema =
|
|
2574
|
+
var cosmosNetworkSchema = z22.custom(
|
|
2379
2575
|
(value) => typeof value === "string" && cosmosNetworkPattern.test(value),
|
|
2380
2576
|
"Use a Cosmos network: cosmos:<chain ID>"
|
|
2381
2577
|
);
|
|
2382
|
-
var cosmosDenomSchema =
|
|
2578
|
+
var cosmosDenomSchema = z22.string().regex(
|
|
2383
2579
|
/^[a-zA-Z][a-zA-Z0-9/:._-]{2,127}$/,
|
|
2384
2580
|
"Use a Cosmos bank denomination such as uatom or uosmo"
|
|
2385
2581
|
);
|
|
@@ -2405,51 +2601,51 @@ function cosmosChain(chain) {
|
|
|
2405
2601
|
return { ...value, network };
|
|
2406
2602
|
}
|
|
2407
2603
|
var solanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
2408
|
-
var evmAddressSchema =
|
|
2409
|
-
var cosmosAddressSchema =
|
|
2604
|
+
var evmAddressSchema = z22.string().regex(/^0x[0-9a-fA-F]{40}$/);
|
|
2605
|
+
var cosmosAddressSchema = z22.string().min(8).max(90).regex(
|
|
2410
2606
|
/^(?:[a-z][a-z0-9]{0,82}1[02-9ac-hj-np-z]{38,}|[A-Z][A-Z0-9]{0,82}1[02-9AC-HJ-NP-Z]{38,})$/
|
|
2411
2607
|
);
|
|
2412
|
-
var walletAddressInputSchema =
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
chain:
|
|
2608
|
+
var walletAddressInputSchema = z22.discriminatedUnion("chain", [
|
|
2609
|
+
z22.object({ chain: z22.literal("solana"), address: solanaAddressSchema }).strict(),
|
|
2610
|
+
z22.object({
|
|
2611
|
+
chain: z22.literal("eip155"),
|
|
2416
2612
|
address: evmAddressSchema,
|
|
2417
2613
|
/** Shown in the sign-in message's Chain ID line only: links are chain-agnostic. Defaults to 1. */
|
|
2418
|
-
chainId:
|
|
2614
|
+
chainId: z22.number().int().positive().safe().optional()
|
|
2419
2615
|
}).strict(),
|
|
2420
|
-
|
|
2421
|
-
chain:
|
|
2616
|
+
z22.object({
|
|
2617
|
+
chain: z22.literal("cosmos"),
|
|
2422
2618
|
network: cosmosNetworkSchema,
|
|
2423
2619
|
address: cosmosAddressSchema
|
|
2424
2620
|
}).strict()
|
|
2425
2621
|
]);
|
|
2426
|
-
var walletMessageChallengeSchema =
|
|
2427
|
-
id:
|
|
2428
|
-
purpose:
|
|
2622
|
+
var walletMessageChallengeSchema = z22.object({
|
|
2623
|
+
id: z22.string().min(1).max(200),
|
|
2624
|
+
purpose: z22.enum(["link", "sign-in"]),
|
|
2429
2625
|
chain: walletChainSchema,
|
|
2430
2626
|
network: cosmosNetworkSchema.nullable(),
|
|
2431
2627
|
/** Canonical (base58, EIP-55 or lowercase bech32). The signer must sign with this address. */
|
|
2432
|
-
address:
|
|
2433
|
-
message:
|
|
2434
|
-
expiresAt:
|
|
2628
|
+
address: z22.string(),
|
|
2629
|
+
message: z22.string().max(4096),
|
|
2630
|
+
expiresAt: z22.number().int()
|
|
2435
2631
|
});
|
|
2436
|
-
var walletSignatureSchema =
|
|
2437
|
-
challenge:
|
|
2632
|
+
var walletSignatureSchema = z22.object({
|
|
2633
|
+
challenge: z22.string().min(1).max(200),
|
|
2438
2634
|
/** solana: base58, 64 bytes · eip155: 0x and 130 hex digits (65 bytes) · cosmos: base64, 64 bytes (r‖s) */
|
|
2439
|
-
signature:
|
|
2635
|
+
signature: z22.string().min(1).max(256),
|
|
2440
2636
|
/** cosmos only: the base64 33-byte compressed secp256k1 key from signArbitrary's pub_key.value */
|
|
2441
|
-
publicKey:
|
|
2637
|
+
publicKey: z22.string().max(128).optional()
|
|
2442
2638
|
}).strict();
|
|
2443
|
-
var linkedWalletSchema =
|
|
2639
|
+
var linkedWalletSchema = z22.object({
|
|
2444
2640
|
chain: walletChainSchema,
|
|
2445
2641
|
network: cosmosNetworkSchema.nullable(),
|
|
2446
|
-
address:
|
|
2447
|
-
verifiedAt:
|
|
2448
|
-
revision:
|
|
2642
|
+
address: z22.string(),
|
|
2643
|
+
verifiedAt: z22.number().int().nonnegative(),
|
|
2644
|
+
revision: z22.number().int().positive(),
|
|
2449
2645
|
/** True when this wallet can sign in: it was first used through wallet sign-in. Linking never enables sign-in. */
|
|
2450
|
-
signIn:
|
|
2646
|
+
signIn: z22.boolean()
|
|
2451
2647
|
});
|
|
2452
|
-
var walletUnlinkInputSchema =
|
|
2648
|
+
var walletUnlinkInputSchema = z22.object({ chain: walletChainSchema, address: z22.string().min(1).max(100) }).strict();
|
|
2453
2649
|
async function walletAddressInput(signer) {
|
|
2454
2650
|
const address = await signer.address();
|
|
2455
2651
|
switch (signer.chain) {
|
|
@@ -2473,8 +2669,8 @@ async function walletAddressInput(signer) {
|
|
|
2473
2669
|
}
|
|
2474
2670
|
var WALLETS_PER_CHAIN = 5;
|
|
2475
2671
|
var walletSignInFamilies = ["solana", "eip155", "cosmos"];
|
|
2476
|
-
var walletSignInNetworkSchema =
|
|
2477
|
-
var walletSignInNetworksSchema =
|
|
2672
|
+
var walletSignInNetworkSchema = z22.enum(walletSignInFamilies);
|
|
2673
|
+
var walletSignInNetworksSchema = z22.array(walletSignInNetworkSchema).max(walletSignInFamilies.length).refine((values2) => new Set(values2).size === values2.length, {
|
|
2478
2674
|
message: "Duplicate wallet family"
|
|
2479
2675
|
}).transform(
|
|
2480
2676
|
(values2) => walletSignInFamilies.filter((family) => values2.includes(family))
|
|
@@ -2499,40 +2695,40 @@ function caip10(wallet, network) {
|
|
|
2499
2695
|
function isEvmChainId(value) {
|
|
2500
2696
|
return /^eip155:[1-9][0-9]{0,15}$/.test(value);
|
|
2501
2697
|
}
|
|
2502
|
-
var evmChainIdSchema =
|
|
2698
|
+
var evmChainIdSchema = z22.custom(
|
|
2503
2699
|
(value) => typeof value === "string" && isEvmChainId(value),
|
|
2504
2700
|
'Use an EVM chain ID such as "eip155:8453"'
|
|
2505
2701
|
);
|
|
2506
|
-
var units =
|
|
2702
|
+
var units = z22.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
2507
2703
|
var walletBalanceSchema = responseShape(
|
|
2508
|
-
|
|
2704
|
+
z22.object({
|
|
2509
2705
|
/** Canonical CAIP-2 ID for Solana, EVM or a supported Cosmos SDK chain. */
|
|
2510
|
-
chain:
|
|
2706
|
+
chain: z22.string(),
|
|
2511
2707
|
/** The canonical mint, EIP-55 contract or Cosmos bank denom; null for a native coin. */
|
|
2512
|
-
token:
|
|
2708
|
+
token: z22.string().nullable(),
|
|
2513
2709
|
/** Null when token metadata does not report decimals. */
|
|
2514
|
-
decimals:
|
|
2710
|
+
decimals: z22.number().int().min(0).max(255).nullable(),
|
|
2515
2711
|
/** The sum over `wallets`. */
|
|
2516
2712
|
total: units,
|
|
2517
|
-
wallets:
|
|
2518
|
-
|
|
2713
|
+
wallets: z22.array(
|
|
2714
|
+
z22.object({ address: z22.string(), amount: units }).strict()
|
|
2519
2715
|
),
|
|
2520
2716
|
/** Solana: lowest slot. EVM: approximate latest block. Cosmos: the fixed queried block. */
|
|
2521
|
-
at:
|
|
2522
|
-
observedAt:
|
|
2717
|
+
at: z22.object({ kind: z22.enum(["slot", "block"]), number: units }).strict(),
|
|
2718
|
+
observedAt: z22.number().int().nonnegative()
|
|
2523
2719
|
}).strict()
|
|
2524
2720
|
);
|
|
2525
|
-
var walletBalanceSampleSchema =
|
|
2721
|
+
var walletBalanceSampleSchema = z22.object({
|
|
2526
2722
|
/** The balance in base units, as a decimal integer string. */
|
|
2527
|
-
amount:
|
|
2723
|
+
amount: z22.string(),
|
|
2528
2724
|
/** The token's decimals; null when token metadata does not report them. */
|
|
2529
|
-
decimals:
|
|
2725
|
+
decimals: z22.number().int().min(0).max(255).nullable(),
|
|
2530
2726
|
/**
|
|
2531
2727
|
* Where the run read: the EVM block number or Cosmos height every wallet of the run was read at,
|
|
2532
2728
|
* or on Solana the slot this wallet's answer reflects (at or after the run's pinned slot), as
|
|
2533
2729
|
* a decimal integer string.
|
|
2534
2730
|
*/
|
|
2535
|
-
block:
|
|
2731
|
+
block: z22.string()
|
|
2536
2732
|
});
|
|
2537
2733
|
var nftCollectionPattern = /^(eip155:[1-9][0-9]{0,15})\/(erc721|erc1155):(0x[0-9a-fA-F]{40})(?:\/(0|[1-9][0-9]{0,77}))?$/;
|
|
2538
2734
|
var solanaNftCollectionPrefix = `${solanaMainnet}/nft:`;
|
|
@@ -2561,20 +2757,20 @@ function isNftCollection(value) {
|
|
|
2561
2757
|
return parseNftCollection(value) !== null;
|
|
2562
2758
|
}
|
|
2563
2759
|
var walletNftsSchema = responseShape(
|
|
2564
|
-
|
|
2760
|
+
z22.object({
|
|
2565
2761
|
/** The collection read, in canonical form: an EVM contract EIP-55 checksummed. */
|
|
2566
|
-
collection:
|
|
2762
|
+
collection: z22.string(),
|
|
2567
2763
|
/** The collection's chain, canonical CAIP-2. */
|
|
2568
|
-
chain:
|
|
2569
|
-
standard:
|
|
2764
|
+
chain: z22.string(),
|
|
2765
|
+
standard: z22.enum(["erc721", "erc1155", "metaplex"]),
|
|
2570
2766
|
/** How many the wallets hold together: the sum over `wallets`. */
|
|
2571
2767
|
total: units,
|
|
2572
|
-
wallets:
|
|
2573
|
-
|
|
2768
|
+
wallets: z22.array(
|
|
2769
|
+
z22.object({ address: z22.string(), count: units }).strict()
|
|
2574
2770
|
),
|
|
2575
2771
|
/** Solana: the lowest slot of the reads. EVM: the approximate latest block. */
|
|
2576
|
-
at:
|
|
2577
|
-
observedAt:
|
|
2772
|
+
at: z22.object({ kind: z22.enum(["slot", "block"]), number: units }).strict(),
|
|
2773
|
+
observedAt: z22.number().int().nonnegative()
|
|
2578
2774
|
}).strict()
|
|
2579
2775
|
);
|
|
2580
2776
|
var integerType = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
@@ -2625,50 +2821,50 @@ function parseContractCall(value) {
|
|
|
2625
2821
|
function isContractCall(value) {
|
|
2626
2822
|
return parseContractCall(value) !== null;
|
|
2627
2823
|
}
|
|
2628
|
-
var signedUnits =
|
|
2824
|
+
var signedUnits = z22.string().regex(/^(0|-?[1-9][0-9]*)$/);
|
|
2629
2825
|
var walletCallSchema = responseShape(
|
|
2630
|
-
|
|
2826
|
+
z22.object({
|
|
2631
2827
|
/** The call read, canonical: the contract EIP-55 checksummed, the signature without names. */
|
|
2632
|
-
call:
|
|
2828
|
+
call: z22.string(),
|
|
2633
2829
|
/** The contract's chain, canonical CAIP-2. */
|
|
2634
|
-
chain:
|
|
2830
|
+
chain: z22.string(),
|
|
2635
2831
|
/** The contract, EIP-55 checksummed. */
|
|
2636
|
-
contract:
|
|
2832
|
+
contract: z22.string(),
|
|
2637
2833
|
/** The return value's ABI type, such as `"uint256"` or `"bool"`. */
|
|
2638
|
-
returns:
|
|
2834
|
+
returns: z22.string(),
|
|
2639
2835
|
/** The sum of the wallets' values when the function returns an integer; null otherwise. */
|
|
2640
2836
|
total: signedUnits.nullable(),
|
|
2641
|
-
wallets:
|
|
2642
|
-
|
|
2643
|
-
address:
|
|
2837
|
+
wallets: z22.array(
|
|
2838
|
+
z22.object({
|
|
2839
|
+
address: z22.string(),
|
|
2644
2840
|
/** An integer as a decimal string, a bool, or an EIP-55 address. */
|
|
2645
|
-
value:
|
|
2841
|
+
value: z22.union([z22.string(), z22.boolean()])
|
|
2646
2842
|
}).strict()
|
|
2647
2843
|
),
|
|
2648
2844
|
/** The block every call read. */
|
|
2649
|
-
at:
|
|
2650
|
-
observedAt:
|
|
2845
|
+
at: z22.object({ kind: z22.enum(["block"]), number: units }).strict(),
|
|
2846
|
+
observedAt: z22.number().int().nonnegative()
|
|
2651
2847
|
}).strict()
|
|
2652
2848
|
);
|
|
2653
2849
|
var walletDelegationsSchema = responseShape(
|
|
2654
|
-
|
|
2655
|
-
chain:
|
|
2850
|
+
z22.object({
|
|
2851
|
+
chain: z22.string(),
|
|
2656
2852
|
/** The chain's staking denomination, such as `uatom`: every amount is in its base units. */
|
|
2657
|
-
denom:
|
|
2853
|
+
denom: z22.string(),
|
|
2658
2854
|
/** The validator the read counted, or null for every validator. */
|
|
2659
|
-
validator:
|
|
2855
|
+
validator: z22.string().nullable(),
|
|
2660
2856
|
/** The sum over `wallets`. */
|
|
2661
2857
|
total: units,
|
|
2662
|
-
wallets:
|
|
2663
|
-
|
|
2858
|
+
wallets: z22.array(
|
|
2859
|
+
z22.object({ address: z22.string(), amount: units }).strict()
|
|
2664
2860
|
),
|
|
2665
2861
|
/** What the wallets delegate to each validator, summed over the wallets; none at zero. */
|
|
2666
|
-
validators:
|
|
2667
|
-
|
|
2862
|
+
validators: z22.array(
|
|
2863
|
+
z22.object({ validator: z22.string(), amount: units }).strict()
|
|
2668
2864
|
),
|
|
2669
2865
|
/** The block every request read. */
|
|
2670
|
-
at:
|
|
2671
|
-
observedAt:
|
|
2866
|
+
at: z22.object({ kind: z22.enum(["block"]), number: units }).strict(),
|
|
2867
|
+
observedAt: z22.number().int().nonnegative()
|
|
2672
2868
|
}).strict()
|
|
2673
2869
|
);
|
|
2674
2870
|
var contractEventPattern = /^(eip155:[1-9][0-9]{0,15}):(0x[0-9a-fA-F]{40})\s+(?:event\s+)?([A-Za-z_$][A-Za-z0-9_$]*)\s*\(([^()]*)\)\s*;?$/;
|
|
@@ -2725,135 +2921,135 @@ function isContractEvent(value) {
|
|
|
2725
2921
|
}
|
|
2726
2922
|
var maxWalletEventLogs = 1e3;
|
|
2727
2923
|
var maxWalletEventLookback = 30 * 24 * 60 * 60 * 1e3;
|
|
2728
|
-
var walletEventScalarSchema =
|
|
2729
|
-
var walletEventValueSchema =
|
|
2924
|
+
var walletEventScalarSchema = z22.union([z22.string(), z22.boolean()]);
|
|
2925
|
+
var walletEventValueSchema = z22.union([
|
|
2730
2926
|
walletEventScalarSchema,
|
|
2731
|
-
|
|
2927
|
+
z22.array(walletEventScalarSchema)
|
|
2732
2928
|
]);
|
|
2733
2929
|
var walletEventsSchema = responseShape(
|
|
2734
|
-
|
|
2930
|
+
z22.object({
|
|
2735
2931
|
/** The event read, in canonical form: the contract EIP-55 checksummed. */
|
|
2736
|
-
event:
|
|
2932
|
+
event: z22.string(),
|
|
2737
2933
|
/** The event's chain, canonical CAIP-2. */
|
|
2738
|
-
chain:
|
|
2739
|
-
contract:
|
|
2934
|
+
chain: z22.string(),
|
|
2935
|
+
contract: z22.string(),
|
|
2740
2936
|
/** The earliest block time read, in epoch milliseconds: `since`, or the activation. */
|
|
2741
|
-
since:
|
|
2937
|
+
since: z22.number().int().nonnegative(),
|
|
2742
2938
|
/**
|
|
2743
2939
|
* The newest block read: the chain's `finalized` block, or its `safe` block on a chain without
|
|
2744
2940
|
* finality. Events in later blocks are not read yet.
|
|
2745
2941
|
*/
|
|
2746
|
-
at:
|
|
2747
|
-
finality:
|
|
2942
|
+
at: z22.object({ kind: z22.enum(["block"]), number: units }).strict(),
|
|
2943
|
+
finality: z22.enum(["finalized", "safe"]),
|
|
2748
2944
|
/** The matching events, oldest first. */
|
|
2749
|
-
logs:
|
|
2750
|
-
|
|
2945
|
+
logs: z22.array(
|
|
2946
|
+
z22.object({
|
|
2751
2947
|
/** The member's linked wallet the `account` argument names. */
|
|
2752
|
-
wallet:
|
|
2948
|
+
wallet: z22.string(),
|
|
2753
2949
|
block: units,
|
|
2754
2950
|
/** The block's time, in epoch milliseconds. */
|
|
2755
|
-
timestamp:
|
|
2756
|
-
tx:
|
|
2757
|
-
logIndex:
|
|
2951
|
+
timestamp: z22.number().int().nonnegative(),
|
|
2952
|
+
tx: z22.string(),
|
|
2953
|
+
logIndex: z22.number().int().nonnegative(),
|
|
2758
2954
|
/** Every argument, by name. */
|
|
2759
|
-
args:
|
|
2955
|
+
args: z22.record(z22.string(), walletEventValueSchema)
|
|
2760
2956
|
}).strict()
|
|
2761
2957
|
).max(maxWalletEventLogs),
|
|
2762
|
-
observedAt:
|
|
2958
|
+
observedAt: z22.number().int().nonnegative()
|
|
2763
2959
|
}).strict()
|
|
2764
2960
|
);
|
|
2765
2961
|
function isSolanaProgram(value) {
|
|
2766
2962
|
return solanaAddressSchema.safeParse(value).success;
|
|
2767
2963
|
}
|
|
2768
|
-
var anchorIdlSchema =
|
|
2769
|
-
var solanaProgramIdlSchema =
|
|
2964
|
+
var anchorIdlSchema = z22.record(z22.string(), z22.json());
|
|
2965
|
+
var solanaProgramIdlSchema = z22.object({
|
|
2770
2966
|
/** The program the setting held when the IDL was stored. */
|
|
2771
|
-
program:
|
|
2772
|
-
source:
|
|
2967
|
+
program: z22.string(),
|
|
2968
|
+
source: z22.string(),
|
|
2773
2969
|
idl: anchorIdlSchema
|
|
2774
2970
|
}).strict();
|
|
2775
2971
|
var maxWalletTransactions = 1e3;
|
|
2776
2972
|
var maxWalletTransactionLookback = 30 * 24 * 60 * 60 * 1e3;
|
|
2777
2973
|
var walletTransactionsSchema = responseShape(
|
|
2778
|
-
|
|
2779
|
-
program:
|
|
2974
|
+
z22.object({
|
|
2975
|
+
program: z22.string(),
|
|
2780
2976
|
/** Solana mainnet's CAIP-2 ID. */
|
|
2781
|
-
chain:
|
|
2977
|
+
chain: z22.string(),
|
|
2782
2978
|
/** The mint whose associated token accounts were read, or null for the wallets themselves. */
|
|
2783
|
-
mint:
|
|
2979
|
+
mint: z22.string().nullable(),
|
|
2784
2980
|
/** The earliest block time read, in epoch milliseconds: `since`, or the activation. */
|
|
2785
|
-
since:
|
|
2981
|
+
since: z22.number().int().nonnegative(),
|
|
2786
2982
|
/** The newest finalized slot read. Transactions in later slots are not read yet. */
|
|
2787
|
-
at:
|
|
2983
|
+
at: z22.object({ kind: z22.enum(["slot"]), number: units }).strict(),
|
|
2788
2984
|
/**
|
|
2789
2985
|
* False when a wallet had more than {@link maxWalletTransactions} transactions to read since
|
|
2790
2986
|
* `since`: its newest ones are returned and older ones are not.
|
|
2791
2987
|
*/
|
|
2792
|
-
complete:
|
|
2988
|
+
complete: z22.boolean(),
|
|
2793
2989
|
/** The matching transactions, oldest first: one entry per linked wallet a transaction touched. */
|
|
2794
|
-
transactions:
|
|
2795
|
-
|
|
2990
|
+
transactions: z22.array(
|
|
2991
|
+
z22.object({
|
|
2796
2992
|
/** The member's linked wallet whose history holds the transaction. */
|
|
2797
|
-
wallet:
|
|
2798
|
-
signature:
|
|
2993
|
+
wallet: z22.string(),
|
|
2994
|
+
signature: z22.string(),
|
|
2799
2995
|
slot: units,
|
|
2800
2996
|
/** The block's time, in epoch milliseconds. */
|
|
2801
|
-
timestamp:
|
|
2997
|
+
timestamp: z22.number().int().nonnegative(),
|
|
2802
2998
|
/**
|
|
2803
2999
|
* Whether the wallet signed the transaction. False for one someone else signed that only
|
|
2804
3000
|
* touched the wallet, such as a transfer into it. Check it before rewarding an action.
|
|
2805
3001
|
* Results captured before Relay reported it read as false.
|
|
2806
3002
|
*/
|
|
2807
|
-
signer:
|
|
3003
|
+
signer: z22.boolean().default(false),
|
|
2808
3004
|
/**
|
|
2809
3005
|
* Every program the transaction invoked, in call order: each top-level instruction's
|
|
2810
3006
|
* program, then the programs it called.
|
|
2811
3007
|
*/
|
|
2812
|
-
programs:
|
|
3008
|
+
programs: z22.array(z22.string()),
|
|
2813
3009
|
/**
|
|
2814
3010
|
* The wallet's balance changes: `"SOL"` from its lamports (rent included, the fee left out
|
|
2815
3011
|
* when the wallet paid it), and
|
|
2816
3012
|
* each mint from the token accounts it owns. Mints whose balance did not change are left out.
|
|
2817
3013
|
*/
|
|
2818
|
-
balanceChanges:
|
|
2819
|
-
|
|
3014
|
+
balanceChanges: z22.array(
|
|
3015
|
+
z22.object({ mint: z22.string(), delta: signedUnits }).strict()
|
|
2820
3016
|
),
|
|
2821
3017
|
/**
|
|
2822
3018
|
* The program's instructions in the transaction, top-level and inner, in call order,
|
|
2823
3019
|
* decoded with the program's Anchor IDL. Instructions the IDL does not describe are left
|
|
2824
3020
|
* out. Absent when the program's setting has no IDL.
|
|
2825
3021
|
*/
|
|
2826
|
-
instructions:
|
|
2827
|
-
|
|
3022
|
+
instructions: z22.array(
|
|
3023
|
+
z22.object({
|
|
2828
3024
|
/** The instruction's name, as the IDL spells it. */
|
|
2829
|
-
name:
|
|
3025
|
+
name: z22.string(),
|
|
2830
3026
|
/**
|
|
2831
3027
|
* Its arguments by name: integers up to 32 bits and floats as numbers, wider
|
|
2832
3028
|
* integers as decimal strings, public keys in base58, `bytes` and arrays as arrays,
|
|
2833
3029
|
* an absent option as null, and an enum as `{ Variant: fields }`.
|
|
2834
3030
|
*/
|
|
2835
|
-
args:
|
|
3031
|
+
args: z22.record(z22.string(), z22.json()),
|
|
2836
3032
|
/** The accounts the IDL names, by name: each a base58 address. */
|
|
2837
|
-
accounts:
|
|
3033
|
+
accounts: z22.record(z22.string(), z22.string())
|
|
2838
3034
|
}).strict()
|
|
2839
3035
|
).optional()
|
|
2840
3036
|
}).strict()
|
|
2841
3037
|
),
|
|
2842
|
-
observedAt:
|
|
3038
|
+
observedAt: z22.number().int().nonnegative()
|
|
2843
3039
|
}).strict()
|
|
2844
3040
|
);
|
|
2845
3041
|
|
|
2846
3042
|
// src/submission-input.ts
|
|
2847
|
-
import * as
|
|
2848
|
-
var textOptionsSchema =
|
|
2849
|
-
required:
|
|
2850
|
-
minLength:
|
|
2851
|
-
maxLength:
|
|
3043
|
+
import * as z23 from "zod";
|
|
3044
|
+
var textOptionsSchema = z23.object({
|
|
3045
|
+
required: z23.boolean().default(true),
|
|
3046
|
+
minLength: z23.number().int().min(0).max(1e4).default(1),
|
|
3047
|
+
maxLength: z23.number().int().min(1).max(1e4).default(1e4)
|
|
2852
3048
|
}).strict().refine(
|
|
2853
3049
|
(v) => v.minLength <= v.maxLength,
|
|
2854
3050
|
"minLength must not exceed maxLength"
|
|
2855
3051
|
);
|
|
2856
|
-
var hostSchema =
|
|
3052
|
+
var hostSchema = z23.string().min(1).max(253).refine((host) => {
|
|
2857
3053
|
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
2858
3054
|
return false;
|
|
2859
3055
|
}
|
|
@@ -2864,13 +3060,13 @@ var hostSchema = z21.string().min(1).max(253).refine((host) => {
|
|
|
2864
3060
|
return false;
|
|
2865
3061
|
}
|
|
2866
3062
|
}, "Use a hostname without a scheme, path, port, or wildcard");
|
|
2867
|
-
var urlOptionsSchema =
|
|
2868
|
-
required:
|
|
2869
|
-
allowedHosts:
|
|
3063
|
+
var urlOptionsSchema = z23.object({
|
|
3064
|
+
required: z23.boolean().default(true),
|
|
3065
|
+
allowedHosts: z23.array(hostSchema).min(1).max(100).optional()
|
|
2870
3066
|
}).strict();
|
|
2871
|
-
var textEvidenceSchema =
|
|
2872
|
-
var urlEvidenceSchema =
|
|
2873
|
-
var valueEvidenceSchema =
|
|
3067
|
+
var textEvidenceSchema = z23.object({ kind: z23.literal("text"), value: z23.string().max(1e4) }).strict();
|
|
3068
|
+
var urlEvidenceSchema = z23.object({ kind: z23.literal("url"), value: z23.string().max(2048) }).strict();
|
|
3069
|
+
var valueEvidenceSchema = z23.discriminatedUnion("kind", [
|
|
2874
3070
|
textEvidenceSchema,
|
|
2875
3071
|
urlEvidenceSchema
|
|
2876
3072
|
]);
|
|
@@ -2933,22 +3129,22 @@ function xPostId(value) {
|
|
|
2933
3129
|
}
|
|
2934
3130
|
|
|
2935
3131
|
// src/quiz.ts
|
|
2936
|
-
import * as
|
|
2937
|
-
var quizId =
|
|
2938
|
-
var quizChoiceSchema =
|
|
2939
|
-
var quizQuestionSchema =
|
|
3132
|
+
import * as z24 from "zod";
|
|
3133
|
+
var quizId = z24.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
3134
|
+
var quizChoiceSchema = z24.object({ id: quizId, label: z24.string().trim().min(1).max(500) }).strict();
|
|
3135
|
+
var quizQuestionSchema = z24.object({
|
|
2940
3136
|
id: quizId,
|
|
2941
|
-
prompt:
|
|
2942
|
-
choices:
|
|
3137
|
+
prompt: z24.string().trim().min(1).max(1e3),
|
|
3138
|
+
choices: z24.array(quizChoiceSchema).min(2).max(8).refine(
|
|
2943
3139
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
2944
3140
|
"Choice IDs must be unique"
|
|
2945
3141
|
)
|
|
2946
3142
|
}).strict();
|
|
2947
|
-
var quizQuestionsSchema =
|
|
3143
|
+
var quizQuestionsSchema = z24.array(quizQuestionSchema).min(1).max(20).refine(
|
|
2948
3144
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
2949
3145
|
"Question IDs must be unique"
|
|
2950
3146
|
);
|
|
2951
|
-
var quizContentSchema =
|
|
3147
|
+
var quizContentSchema = z24.array(
|
|
2952
3148
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
2953
3149
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
2954
3150
|
"Choose a correct answer from the available choices"
|
|
@@ -2959,73 +3155,73 @@ var quizContentSchema = z22.array(
|
|
|
2959
3155
|
);
|
|
2960
3156
|
|
|
2961
3157
|
// src/resources.ts
|
|
2962
|
-
import * as
|
|
2963
|
-
var resourceSourceSchema =
|
|
2964
|
-
|
|
2965
|
-
provider:
|
|
2966
|
-
resource:
|
|
3158
|
+
import * as z25 from "zod";
|
|
3159
|
+
var resourceSourceSchema = z25.union([
|
|
3160
|
+
z25.strictObject({
|
|
3161
|
+
provider: z25.literal("domino"),
|
|
3162
|
+
resource: z25.literal("point-ledger")
|
|
2967
3163
|
}),
|
|
2968
3164
|
discordResourceSourceSchema
|
|
2969
3165
|
]);
|
|
2970
|
-
var resourceRequestSchema =
|
|
3166
|
+
var resourceRequestSchema = z25.object({
|
|
2971
3167
|
source: resourceSourceSchema,
|
|
2972
|
-
query:
|
|
2973
|
-
cursor:
|
|
2974
|
-
ids:
|
|
3168
|
+
query: z25.string().max(100).optional(),
|
|
3169
|
+
cursor: z25.string().regex(/^\d{1,6}$/).optional(),
|
|
3170
|
+
ids: z25.array(z25.string().min(1).max(100)).max(50).optional()
|
|
2975
3171
|
}).strict();
|
|
2976
|
-
var resourceOptionsSchema =
|
|
2977
|
-
revision:
|
|
2978
|
-
options:
|
|
2979
|
-
|
|
2980
|
-
id:
|
|
2981
|
-
label:
|
|
2982
|
-
description:
|
|
2983
|
-
group:
|
|
2984
|
-
disabledReason:
|
|
3172
|
+
var resourceOptionsSchema = z25.object({
|
|
3173
|
+
revision: z25.number().int(),
|
|
3174
|
+
options: z25.array(
|
|
3175
|
+
z25.object({
|
|
3176
|
+
id: z25.string(),
|
|
3177
|
+
label: z25.string(),
|
|
3178
|
+
description: z25.string().optional(),
|
|
3179
|
+
group: z25.string().optional(),
|
|
3180
|
+
disabledReason: z25.string().optional()
|
|
2985
3181
|
})
|
|
2986
3182
|
),
|
|
2987
3183
|
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
2988
|
-
nextCursor:
|
|
3184
|
+
nextCursor: z25.string().nullable().default(null),
|
|
2989
3185
|
/** @deprecated Use `nextCursor`. Removed in 2.0.0. */
|
|
2990
|
-
cursor:
|
|
3186
|
+
cursor: z25.string().nullable()
|
|
2991
3187
|
});
|
|
2992
3188
|
|
|
2993
3189
|
// src/settings.ts
|
|
2994
|
-
import * as
|
|
3190
|
+
import * as z27 from "zod";
|
|
2995
3191
|
|
|
2996
3192
|
// src/setting-values.ts
|
|
2997
|
-
import * as
|
|
3193
|
+
import * as z26 from "zod";
|
|
2998
3194
|
var settingInstant = offsetDateTimeSchema().transform(
|
|
2999
3195
|
(value) => new Date(value).toISOString()
|
|
3000
3196
|
);
|
|
3001
|
-
var settingResourceId =
|
|
3002
|
-
|
|
3003
|
-
|
|
3197
|
+
var settingResourceId = z26.union([
|
|
3198
|
+
z26.literal(""),
|
|
3199
|
+
z26.string().regex(/^\S{1,200}$/)
|
|
3004
3200
|
]);
|
|
3005
3201
|
|
|
3006
3202
|
// src/settings.ts
|
|
3007
|
-
var base = { label:
|
|
3008
|
-
var settingFieldSchema =
|
|
3009
|
-
|
|
3203
|
+
var base = { label: z27.string().min(1), description: z27.string().optional() };
|
|
3204
|
+
var settingFieldSchema = z27.discriminatedUnion("kind", [
|
|
3205
|
+
z27.object({
|
|
3010
3206
|
...base,
|
|
3011
|
-
kind:
|
|
3012
|
-
default: identifier.or(
|
|
3207
|
+
kind: z27.literal("point-ledger"),
|
|
3208
|
+
default: identifier.or(z27.literal(""))
|
|
3013
3209
|
}).strict(),
|
|
3014
|
-
|
|
3015
|
-
|
|
3210
|
+
z27.object({ ...base, kind: z27.literal("datetime"), default: settingInstant }).strict(),
|
|
3211
|
+
z27.object({
|
|
3016
3212
|
...base,
|
|
3017
|
-
kind:
|
|
3213
|
+
kind: z27.literal("resource"),
|
|
3018
3214
|
default: settingResourceId,
|
|
3019
3215
|
source: resourceSourceSchema
|
|
3020
3216
|
}).strict(),
|
|
3021
|
-
|
|
3022
|
-
|
|
3217
|
+
z27.object({ ...base, kind: z27.literal("quiz"), default: quizContentSchema }).strict(),
|
|
3218
|
+
z27.object({
|
|
3023
3219
|
...base,
|
|
3024
|
-
kind:
|
|
3025
|
-
default:
|
|
3026
|
-
minLength:
|
|
3027
|
-
maxLength:
|
|
3028
|
-
multiline:
|
|
3220
|
+
kind: z27.literal("text"),
|
|
3221
|
+
default: z27.string(),
|
|
3222
|
+
minLength: z27.number().int().nonnegative(),
|
|
3223
|
+
maxLength: z27.number().int().positive(),
|
|
3224
|
+
multiline: z27.boolean(),
|
|
3029
3225
|
/**
|
|
3030
3226
|
* A list Console offers the value from, beside free text: `telegram-chat` lists the
|
|
3031
3227
|
* project's connected Telegram chats. Unknown pickers read as free text. Six pickers also
|
|
@@ -3040,35 +3236,35 @@ var settingFieldSchema = z25.discriminatedUnion("kind", [
|
|
|
3040
3236
|
* `ctx.wallet.transactions()` reads (`settings.solanaProgram()`), which Relay also checks is
|
|
3041
3237
|
* an executable program.
|
|
3042
3238
|
*/
|
|
3043
|
-
picker:
|
|
3239
|
+
picker: z27.string().optional(),
|
|
3044
3240
|
/**
|
|
3045
3241
|
* On an `amount` setting, the token's decimals: Console shows and edits the value in whole
|
|
3046
3242
|
* tokens.
|
|
3047
3243
|
*/
|
|
3048
|
-
decimals:
|
|
3244
|
+
decimals: z27.number().int().min(0).max(255).optional()
|
|
3049
3245
|
}).strict(),
|
|
3050
|
-
|
|
3246
|
+
z27.object({
|
|
3051
3247
|
...base,
|
|
3052
|
-
kind:
|
|
3053
|
-
default:
|
|
3054
|
-
min:
|
|
3055
|
-
max:
|
|
3248
|
+
kind: z27.literal("integer"),
|
|
3249
|
+
default: z27.number().int(),
|
|
3250
|
+
min: z27.number().int(),
|
|
3251
|
+
max: z27.number().int()
|
|
3056
3252
|
}).strict(),
|
|
3057
|
-
|
|
3058
|
-
|
|
3253
|
+
z27.object({ ...base, kind: z27.literal("boolean"), default: z27.boolean() }).strict(),
|
|
3254
|
+
z27.object({
|
|
3059
3255
|
...base,
|
|
3060
|
-
kind:
|
|
3061
|
-
default:
|
|
3062
|
-
options:
|
|
3256
|
+
kind: z27.literal("choice"),
|
|
3257
|
+
default: z27.string(),
|
|
3258
|
+
options: z27.array(z27.string().min(1)).min(1)
|
|
3063
3259
|
}).strict()
|
|
3064
3260
|
]);
|
|
3065
|
-
var settingsFieldsSchema =
|
|
3066
|
-
|
|
3261
|
+
var settingsFieldsSchema = z27.record(
|
|
3262
|
+
z27.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
3067
3263
|
settingFieldSchema
|
|
3068
3264
|
);
|
|
3069
|
-
var settingsValuesSchema =
|
|
3070
|
-
|
|
3071
|
-
|
|
3265
|
+
var settingsValuesSchema = z27.record(
|
|
3266
|
+
z27.string(),
|
|
3267
|
+
z27.union([z27.string(), z27.number().finite(), z27.boolean(), quizContentSchema])
|
|
3072
3268
|
);
|
|
3073
3269
|
function isAmount(value) {
|
|
3074
3270
|
return value.length <= 100 && /^(0|[1-9][0-9]*)$/.test(value);
|
|
@@ -3080,7 +3276,7 @@ function isBoundSetting(field) {
|
|
|
3080
3276
|
return field?.kind === "integer" || field?.kind === "text" && field.picker === "amount";
|
|
3081
3277
|
}
|
|
3082
3278
|
function textSettingSchema(field) {
|
|
3083
|
-
const text =
|
|
3279
|
+
const text = z27.string().min(field.minLength).max(field.maxLength);
|
|
3084
3280
|
switch (field.picker) {
|
|
3085
3281
|
case "amount":
|
|
3086
3282
|
return text.refine(
|
|
@@ -3136,17 +3332,17 @@ function parseSettings(fields2, input) {
|
|
|
3136
3332
|
shape[key] = textSettingSchema(field).default(field.default);
|
|
3137
3333
|
break;
|
|
3138
3334
|
case "integer":
|
|
3139
|
-
shape[key] =
|
|
3335
|
+
shape[key] = z27.number().int().min(field.min).max(field.max).default(field.default);
|
|
3140
3336
|
break;
|
|
3141
3337
|
case "boolean":
|
|
3142
|
-
shape[key] =
|
|
3338
|
+
shape[key] = z27.boolean().default(field.default);
|
|
3143
3339
|
break;
|
|
3144
3340
|
case "choice":
|
|
3145
|
-
shape[key] =
|
|
3341
|
+
shape[key] = z27.enum(field.options).default(field.default);
|
|
3146
3342
|
break;
|
|
3147
3343
|
}
|
|
3148
3344
|
}
|
|
3149
|
-
return settingsValuesSchema.parse(
|
|
3345
|
+
return settingsValuesSchema.parse(z27.object(shape).strict().parse(input));
|
|
3150
3346
|
}
|
|
3151
3347
|
function missingResourceSettings(fields2, values2) {
|
|
3152
3348
|
return Object.entries(fields2).filter(
|
|
@@ -3167,21 +3363,21 @@ function authoringKey(input) {
|
|
|
3167
3363
|
}
|
|
3168
3364
|
|
|
3169
3365
|
// src/campaigns.ts
|
|
3170
|
-
import * as
|
|
3171
|
-
var timestamp4 =
|
|
3172
|
-
var availabilityWindowSchema =
|
|
3366
|
+
import * as z28 from "zod";
|
|
3367
|
+
var timestamp4 = z28.number().int().safe().nonnegative();
|
|
3368
|
+
var availabilityWindowSchema = z28.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
|
|
3173
3369
|
message: "Window end must follow its start",
|
|
3174
3370
|
path: ["until"]
|
|
3175
3371
|
});
|
|
3176
|
-
var campaignDefinitionSchema =
|
|
3372
|
+
var campaignDefinitionSchema = z28.object({
|
|
3177
3373
|
key: identifier,
|
|
3178
|
-
title:
|
|
3374
|
+
title: z28.string().trim().min(1).max(120),
|
|
3179
3375
|
window: availabilityWindowSchema.optional(),
|
|
3180
|
-
enrollment:
|
|
3376
|
+
enrollment: z28.enum(["none", "required"]).default("none")
|
|
3181
3377
|
}).strict();
|
|
3182
3378
|
var campaignAuthoringSchema = campaignDefinitionSchema.omit({ key: true, title: true }).extend({
|
|
3183
3379
|
...authoringIdentityShape,
|
|
3184
|
-
title:
|
|
3380
|
+
title: z28.string().trim().min(1).max(120).optional()
|
|
3185
3381
|
}).strict().transform((value) => {
|
|
3186
3382
|
const normalized = value;
|
|
3187
3383
|
return campaignDefinitionSchema.parse({
|
|
@@ -3195,42 +3391,42 @@ function defineCampaign(input) {
|
|
|
3195
3391
|
var campaignViewSchema = campaignDefinitionSchema.extend({
|
|
3196
3392
|
enrolledAt: timestamp4.nullable(),
|
|
3197
3393
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
3198
|
-
withdrawalReason:
|
|
3394
|
+
withdrawalReason: z28.string().nullable().default(null)
|
|
3199
3395
|
});
|
|
3200
|
-
var campaignEnrollmentInputSchema =
|
|
3396
|
+
var campaignEnrollmentInputSchema = z28.object({ actionId: identifier, campaign: identifier }).strict();
|
|
3201
3397
|
var memberCampaignEnrollmentInputSchema = campaignEnrollmentInputSchema.extend({ member: identifier });
|
|
3202
3398
|
var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
|
|
3203
3399
|
var memberCampaignWithdrawalInputSchema = campaignWithdrawalInputSchema.extend({
|
|
3204
3400
|
member: identifier,
|
|
3205
|
-
reason:
|
|
3401
|
+
reason: z28.string().trim().min(1).max(500)
|
|
3206
3402
|
});
|
|
3207
|
-
var campaignEnrollmentSchema =
|
|
3403
|
+
var campaignEnrollmentSchema = z28.object({
|
|
3208
3404
|
campaign: identifier,
|
|
3209
3405
|
member: identifier,
|
|
3210
3406
|
enrolledAt: timestamp4,
|
|
3211
3407
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
3212
|
-
withdrawalReason:
|
|
3408
|
+
withdrawalReason: z28.string().nullable().default(null)
|
|
3213
3409
|
});
|
|
3214
3410
|
|
|
3215
3411
|
// src/resource-handle.ts
|
|
3216
|
-
import * as
|
|
3412
|
+
import * as z29 from "zod";
|
|
3217
3413
|
function resourceHandle(_kind, definition) {
|
|
3218
3414
|
return definition;
|
|
3219
3415
|
}
|
|
3220
|
-
var ledgerSettingSchema = identifier.or(
|
|
3416
|
+
var ledgerSettingSchema = identifier.or(z29.literal("")).brand();
|
|
3221
3417
|
function ledgerKey(ledger) {
|
|
3222
3418
|
return typeof ledger === "string" ? ledger : ledger.key;
|
|
3223
3419
|
}
|
|
3224
3420
|
|
|
3225
3421
|
// src/groups.ts
|
|
3226
|
-
import * as
|
|
3227
|
-
var projectGroupSchema =
|
|
3422
|
+
import * as z30 from "zod";
|
|
3423
|
+
var projectGroupSchema = z30.object({
|
|
3228
3424
|
key: identifier,
|
|
3229
|
-
title:
|
|
3425
|
+
title: z30.string().trim().min(1).max(120)
|
|
3230
3426
|
}).strict();
|
|
3231
3427
|
var projectGroupAuthoringSchema = projectGroupSchema.omit({ key: true, title: true }).extend({
|
|
3232
3428
|
...authoringIdentityShape,
|
|
3233
|
-
title:
|
|
3429
|
+
title: z30.string().trim().min(1).max(120).optional()
|
|
3234
3430
|
}).strict().transform((value) => {
|
|
3235
3431
|
return projectGroupSchema.parse({
|
|
3236
3432
|
...value,
|
|
@@ -3243,93 +3439,93 @@ function defineGroup(input) {
|
|
|
3243
3439
|
function projectGroupKey(group) {
|
|
3244
3440
|
return identifier.parse(group.key);
|
|
3245
3441
|
}
|
|
3246
|
-
var groupTitle =
|
|
3247
|
-
var reason =
|
|
3248
|
-
var timestamp5 =
|
|
3249
|
-
var createGroupSchema =
|
|
3250
|
-
var updateGroupSchema =
|
|
3251
|
-
var addGroupMemberSchema =
|
|
3252
|
-
var removeGroupMemberSchema =
|
|
3253
|
-
var groupArchiveInputSchema =
|
|
3254
|
-
var groupPageQuerySchema =
|
|
3442
|
+
var groupTitle = z30.string().trim().min(1).max(120);
|
|
3443
|
+
var reason = z30.string().trim().min(1).max(1e3);
|
|
3444
|
+
var timestamp5 = z30.number().int().nonnegative().max(864e13);
|
|
3445
|
+
var createGroupSchema = z30.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
|
|
3446
|
+
var updateGroupSchema = z30.object({ title: groupTitle }).strict();
|
|
3447
|
+
var addGroupMemberSchema = z30.object({ actionId: identifier, member: identifier, reason }).strict();
|
|
3448
|
+
var removeGroupMemberSchema = z30.object({ actionId: identifier, reason }).strict();
|
|
3449
|
+
var groupArchiveInputSchema = z30.object({ reason: lifecycleReasonSchema.optional() }).strict();
|
|
3450
|
+
var groupPageQuerySchema = z30.strictObject({
|
|
3255
3451
|
cursor: pageCursorSchema.optional(),
|
|
3256
3452
|
/** Items per page, 1–100; the default is 50. */
|
|
3257
|
-
limit:
|
|
3453
|
+
limit: z30.number().int().min(1).max(100).optional()
|
|
3258
3454
|
});
|
|
3259
|
-
var managedGroupSchema =
|
|
3455
|
+
var managedGroupSchema = z30.object({
|
|
3260
3456
|
key: identifier,
|
|
3261
|
-
title:
|
|
3262
|
-
members:
|
|
3457
|
+
title: z30.string(),
|
|
3458
|
+
members: z30.number().int().nonnegative(),
|
|
3263
3459
|
createdAt: timestamp5,
|
|
3264
3460
|
archivedAt: timestamp5.nullable()
|
|
3265
3461
|
});
|
|
3266
|
-
var groupPageSchema =
|
|
3267
|
-
items:
|
|
3462
|
+
var groupPageSchema = z30.object({
|
|
3463
|
+
items: z30.array(managedGroupSchema),
|
|
3268
3464
|
nextCursor: pageCursorSchema.nullable()
|
|
3269
3465
|
});
|
|
3270
|
-
var groupMemberSchema =
|
|
3466
|
+
var groupMemberSchema = z30.object({
|
|
3271
3467
|
member: identifier,
|
|
3272
3468
|
addedAt: timestamp5.nullable()
|
|
3273
3469
|
});
|
|
3274
|
-
var groupMemberPageSchema =
|
|
3275
|
-
items:
|
|
3470
|
+
var groupMemberPageSchema = z30.object({
|
|
3471
|
+
items: z30.array(groupMemberSchema),
|
|
3276
3472
|
nextCursor: pageCursorSchema.nullable()
|
|
3277
3473
|
});
|
|
3278
3474
|
|
|
3279
3475
|
// src/prerequisites.ts
|
|
3280
|
-
import * as
|
|
3281
|
-
var amount =
|
|
3476
|
+
import * as z31 from "zod";
|
|
3477
|
+
var amount = z31.number().int().safe().nonnegative();
|
|
3282
3478
|
var threshold = amount.positive();
|
|
3283
|
-
var completionPrerequisiteSchema =
|
|
3284
|
-
|
|
3285
|
-
kind:
|
|
3479
|
+
var completionPrerequisiteSchema = z31.discriminatedUnion("scope", [
|
|
3480
|
+
z31.object({
|
|
3481
|
+
kind: z31.literal("completion"),
|
|
3286
3482
|
quest: identifier,
|
|
3287
|
-
scope:
|
|
3483
|
+
scope: z31.literal("ever")
|
|
3288
3484
|
}).strict(),
|
|
3289
|
-
|
|
3290
|
-
kind:
|
|
3485
|
+
z31.object({
|
|
3486
|
+
kind: z31.literal("completion"),
|
|
3291
3487
|
quest: identifier,
|
|
3292
|
-
scope:
|
|
3488
|
+
scope: z31.literal("period"),
|
|
3293
3489
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
3294
3490
|
}).strict()
|
|
3295
3491
|
]);
|
|
3296
|
-
var balancePrerequisiteSchema =
|
|
3297
|
-
kind:
|
|
3492
|
+
var balancePrerequisiteSchema = z31.object({
|
|
3493
|
+
kind: z31.literal("balance"),
|
|
3298
3494
|
balance: identifier,
|
|
3299
3495
|
minimum: threshold
|
|
3300
3496
|
}).strict();
|
|
3301
|
-
var groupPrerequisiteSchema =
|
|
3302
|
-
var prerequisiteSchema =
|
|
3497
|
+
var groupPrerequisiteSchema = z31.object({ kind: z31.literal("group"), group: identifier, title: z31.string() }).strict();
|
|
3498
|
+
var prerequisiteSchema = z31.discriminatedUnion("kind", [
|
|
3303
3499
|
completionPrerequisiteSchema,
|
|
3304
3500
|
balancePrerequisiteSchema,
|
|
3305
3501
|
groupPrerequisiteSchema
|
|
3306
3502
|
]);
|
|
3307
|
-
var missingPrerequisiteSchema =
|
|
3308
|
-
|
|
3309
|
-
kind:
|
|
3503
|
+
var missingPrerequisiteSchema = z31.union([
|
|
3504
|
+
z31.object({
|
|
3505
|
+
kind: z31.literal("completion"),
|
|
3310
3506
|
quest: identifier,
|
|
3311
|
-
title:
|
|
3312
|
-
scope:
|
|
3507
|
+
title: z31.string(),
|
|
3508
|
+
scope: z31.literal("ever")
|
|
3313
3509
|
}),
|
|
3314
|
-
|
|
3315
|
-
kind:
|
|
3510
|
+
z31.object({
|
|
3511
|
+
kind: z31.literal("completion"),
|
|
3316
3512
|
quest: identifier,
|
|
3317
|
-
title:
|
|
3318
|
-
scope:
|
|
3513
|
+
title: z31.string(),
|
|
3514
|
+
scope: z31.literal("period"),
|
|
3319
3515
|
period: calendarPeriodSchema.exclude(["lifetime"]),
|
|
3320
|
-
resetsAt:
|
|
3516
|
+
resetsAt: z31.number().int().safe()
|
|
3321
3517
|
}),
|
|
3322
|
-
|
|
3323
|
-
kind:
|
|
3518
|
+
z31.object({
|
|
3519
|
+
kind: z31.literal("balance"),
|
|
3324
3520
|
balance: identifier,
|
|
3325
|
-
title:
|
|
3521
|
+
title: z31.string(),
|
|
3326
3522
|
minimum: threshold,
|
|
3327
3523
|
current: amount
|
|
3328
3524
|
}),
|
|
3329
|
-
|
|
3330
|
-
kind:
|
|
3525
|
+
z31.object({
|
|
3526
|
+
kind: z31.literal("group"),
|
|
3331
3527
|
group: identifier,
|
|
3332
|
-
title:
|
|
3528
|
+
title: z31.string()
|
|
3333
3529
|
})
|
|
3334
3530
|
]);
|
|
3335
3531
|
function completed(quest, options = {}) {
|
|
@@ -3360,29 +3556,29 @@ function inGroup(group) {
|
|
|
3360
3556
|
var maxPointsAmount = 2147483647;
|
|
3361
3557
|
|
|
3362
3558
|
// src/schema.ts
|
|
3363
|
-
import * as
|
|
3364
|
-
var pointsRewardSchema =
|
|
3365
|
-
kind:
|
|
3559
|
+
import * as z32 from "zod";
|
|
3560
|
+
var pointsRewardSchema = z32.object({
|
|
3561
|
+
kind: z32.literal("points").default("points"),
|
|
3366
3562
|
balance: identifier,
|
|
3367
|
-
amount:
|
|
3563
|
+
amount: z32.number().int().min(0).max(maxPointsAmount)
|
|
3368
3564
|
}).strict();
|
|
3369
|
-
var tieredRewardDefinitionSchema =
|
|
3565
|
+
var tieredRewardDefinitionSchema = z32.object({
|
|
3370
3566
|
/** An automatic achievement backed by the project badge catalog. */
|
|
3371
3567
|
badge: identifier.optional(),
|
|
3372
3568
|
/** Membership in the project group with this key, added when the reward is delivered. */
|
|
3373
3569
|
group: identifier.optional(),
|
|
3374
3570
|
id: identifier,
|
|
3375
|
-
title:
|
|
3376
|
-
tiers:
|
|
3377
|
-
|
|
3571
|
+
title: z32.string().min(1).max(120),
|
|
3572
|
+
tiers: z32.array(
|
|
3573
|
+
z32.object({ id: identifier, title: z32.string().min(1).max(120) }).strict()
|
|
3378
3574
|
).min(1).max(20).refine(
|
|
3379
3575
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
3380
3576
|
"Tier IDs must be unique"
|
|
3381
3577
|
),
|
|
3382
|
-
inventory:
|
|
3383
|
-
fulfillment:
|
|
3384
|
-
|
|
3385
|
-
|
|
3578
|
+
inventory: z32.object({ kind: z32.literal("untracked") }).strict(),
|
|
3579
|
+
fulfillment: z32.discriminatedUnion("kind", [
|
|
3580
|
+
z32.object({ kind: z32.literal("staff-handover") }).strict(),
|
|
3581
|
+
z32.object({ kind: z32.literal("automatic") }).strict()
|
|
3386
3582
|
])
|
|
3387
3583
|
}).strict().refine(
|
|
3388
3584
|
(value) => value.badge === void 0 && value.group === void 0 || value.fulfillment.kind === "automatic" && value.tiers.length === 1 && value.tiers[0].id === "awarded",
|
|
@@ -3391,12 +3587,12 @@ var tieredRewardDefinitionSchema = z30.object({
|
|
|
3391
3587
|
(value) => value.badge === void 0 || value.group === void 0,
|
|
3392
3588
|
"A reward is either a badge or a group membership"
|
|
3393
3589
|
);
|
|
3394
|
-
var tieredRewardReferenceSchema =
|
|
3590
|
+
var tieredRewardReferenceSchema = z32.object({
|
|
3395
3591
|
id: identifier,
|
|
3396
3592
|
key: identifier.nullable()
|
|
3397
3593
|
});
|
|
3398
|
-
var tierRewardSchema =
|
|
3399
|
-
kind:
|
|
3594
|
+
var tierRewardSchema = z32.object({
|
|
3595
|
+
kind: z32.literal("tier"),
|
|
3400
3596
|
reward: tieredRewardDefinitionSchema,
|
|
3401
3597
|
tier: identifier
|
|
3402
3598
|
}).strict().refine(
|
|
@@ -3408,7 +3604,7 @@ var badgeRewardSchema = tierRewardSchema.transform(
|
|
|
3408
3604
|
const badge = value.reward.badge;
|
|
3409
3605
|
if (!badge || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
3410
3606
|
context.addIssue({ code: "custom", message: "Invalid badge reward" });
|
|
3411
|
-
return
|
|
3607
|
+
return z32.NEVER;
|
|
3412
3608
|
}
|
|
3413
3609
|
return { ...value, reward: { ...value.reward, badge } };
|
|
3414
3610
|
}
|
|
@@ -3432,7 +3628,7 @@ var groupRewardSchema = tierRewardSchema.transform(
|
|
|
3432
3628
|
const group = value.reward.group;
|
|
3433
3629
|
if (!group || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
3434
3630
|
context.addIssue({ code: "custom", message: "Invalid group reward" });
|
|
3435
|
-
return
|
|
3631
|
+
return z32.NEVER;
|
|
3436
3632
|
}
|
|
3437
3633
|
return { ...value, reward: { ...value.reward, group } };
|
|
3438
3634
|
}
|
|
@@ -3452,7 +3648,7 @@ function groupReward(key, title) {
|
|
|
3452
3648
|
});
|
|
3453
3649
|
}
|
|
3454
3650
|
var integrationRewardSchema = discordRewardSchema;
|
|
3455
|
-
var rewardSchema =
|
|
3651
|
+
var rewardSchema = z32.union([
|
|
3456
3652
|
pointsRewardSchema,
|
|
3457
3653
|
tierRewardSchema,
|
|
3458
3654
|
integrationRewardSchema
|
|
@@ -3469,39 +3665,39 @@ function rewardKey(reward) {
|
|
|
3469
3665
|
}
|
|
3470
3666
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
3471
3667
|
}
|
|
3472
|
-
var triggerSchema =
|
|
3473
|
-
|
|
3474
|
-
kind:
|
|
3475
|
-
input:
|
|
3668
|
+
var triggerSchema = z32.union([
|
|
3669
|
+
z32.object({
|
|
3670
|
+
kind: z32.literal("manual"),
|
|
3671
|
+
input: z32.literal("text"),
|
|
3476
3672
|
constraints: textOptionsSchema,
|
|
3477
|
-
actor:
|
|
3673
|
+
actor: z32.enum(["member", "staff"]).optional()
|
|
3478
3674
|
}).strict(),
|
|
3479
|
-
|
|
3480
|
-
kind:
|
|
3481
|
-
input:
|
|
3675
|
+
z32.object({
|
|
3676
|
+
kind: z32.literal("manual"),
|
|
3677
|
+
input: z32.literal("url"),
|
|
3482
3678
|
constraints: urlOptionsSchema,
|
|
3483
|
-
actor:
|
|
3679
|
+
actor: z32.enum(["member", "staff"]).optional()
|
|
3484
3680
|
}).strict(),
|
|
3485
|
-
|
|
3486
|
-
kind:
|
|
3487
|
-
input:
|
|
3488
|
-
actor:
|
|
3681
|
+
z32.object({
|
|
3682
|
+
kind: z32.literal("manual"),
|
|
3683
|
+
input: z32.enum(["photo", "quiz", "none"]),
|
|
3684
|
+
actor: z32.enum(["member", "staff"]).optional()
|
|
3489
3685
|
}).strict(),
|
|
3490
|
-
|
|
3491
|
-
kind:
|
|
3686
|
+
z32.object({
|
|
3687
|
+
kind: z32.literal("automatic"),
|
|
3492
3688
|
tracker: trackerTriggerPolicySchema.optional()
|
|
3493
3689
|
}).strict()
|
|
3494
3690
|
]);
|
|
3495
|
-
var triggerResponseSchema =
|
|
3691
|
+
var triggerResponseSchema = z32.union(
|
|
3496
3692
|
triggerSchema.options.map((option) => option.strip())
|
|
3497
3693
|
);
|
|
3498
|
-
var photoResultSchema =
|
|
3499
|
-
kind:
|
|
3500
|
-
reason:
|
|
3694
|
+
var photoResultSchema = z32.object({
|
|
3695
|
+
kind: z32.enum(["pass", "fail", "unclear"]),
|
|
3696
|
+
reason: z32.string().min(1).max(2e3)
|
|
3501
3697
|
}).strict();
|
|
3502
|
-
var textReviewInputSchema =
|
|
3503
|
-
text:
|
|
3504
|
-
criteria:
|
|
3698
|
+
var textReviewInputSchema = z32.object({
|
|
3699
|
+
text: z32.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
3700
|
+
criteria: z32.string().trim().min(1).max(2e3)
|
|
3505
3701
|
}).strict();
|
|
3506
3702
|
var textResultSchema = photoResultSchema;
|
|
3507
3703
|
var deferPolicy = {
|
|
@@ -3515,31 +3711,31 @@ var retryCooldownPolicy = {
|
|
|
3515
3711
|
minMs: 1e3,
|
|
3516
3712
|
maxMs: 6048e5
|
|
3517
3713
|
};
|
|
3518
|
-
var retryCooldownMsSchema =
|
|
3519
|
-
var evaluatorProgressSchema =
|
|
3520
|
-
current:
|
|
3521
|
-
target:
|
|
3522
|
-
reason:
|
|
3714
|
+
var retryCooldownMsSchema = z32.number().int().min(retryCooldownPolicy.minMs).max(retryCooldownPolicy.maxMs);
|
|
3715
|
+
var evaluatorProgressSchema = z32.object({
|
|
3716
|
+
current: z32.number().finite().nonnegative(),
|
|
3717
|
+
target: z32.number().finite().positive(),
|
|
3718
|
+
reason: z32.string().min(1).max(2e3)
|
|
3523
3719
|
}).refine((value) => value.current <= value.target, {
|
|
3524
3720
|
message: "Progress current must not exceed target"
|
|
3525
3721
|
});
|
|
3526
|
-
var decisionSchema =
|
|
3527
|
-
|
|
3528
|
-
kind:
|
|
3529
|
-
reason:
|
|
3530
|
-
retryAfterMs:
|
|
3722
|
+
var decisionSchema = z32.discriminatedUnion("kind", [
|
|
3723
|
+
z32.strictObject({
|
|
3724
|
+
kind: z32.literal("defer"),
|
|
3725
|
+
reason: z32.string().min(1).max(2e3),
|
|
3726
|
+
retryAfterMs: z32.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
|
|
3531
3727
|
/** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
|
|
3532
|
-
until:
|
|
3728
|
+
until: z32.number().int().safe().nonnegative().optional()
|
|
3533
3729
|
}),
|
|
3534
|
-
evaluatorProgressSchema.safeExtend({ kind:
|
|
3535
|
-
|
|
3536
|
-
kind:
|
|
3537
|
-
rewards:
|
|
3730
|
+
evaluatorProgressSchema.safeExtend({ kind: z32.literal("progress") }).strict(),
|
|
3731
|
+
z32.object({
|
|
3732
|
+
kind: z32.literal("accept"),
|
|
3733
|
+
rewards: z32.array(rewardSchema).max(10),
|
|
3538
3734
|
completionKey: completionKeySchema.optional()
|
|
3539
3735
|
}).strict(),
|
|
3540
|
-
|
|
3541
|
-
kind:
|
|
3542
|
-
reason:
|
|
3736
|
+
z32.object({
|
|
3737
|
+
kind: z32.literal("reject"),
|
|
3738
|
+
reason: z32.string().min(1).max(2e3),
|
|
3543
3739
|
/**
|
|
3544
3740
|
* A stable key for the rejection's cause, such as `wrong-answers`, stored as the attempt's
|
|
3545
3741
|
* `code`: lowercase letters, digits and hyphens, at most 64 characters, and none of the
|
|
@@ -3547,28 +3743,28 @@ var decisionSchema = z30.discriminatedUnion("kind", [
|
|
|
3547
3743
|
*/
|
|
3548
3744
|
code: rejectCodeSchema.optional(),
|
|
3549
3745
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
3550
|
-
requestedReview:
|
|
3746
|
+
requestedReview: z32.literal(true).optional()
|
|
3551
3747
|
}).strict(),
|
|
3552
|
-
|
|
3553
|
-
kind:
|
|
3554
|
-
reason:
|
|
3555
|
-
rewards:
|
|
3748
|
+
z32.object({
|
|
3749
|
+
kind: z32.literal("review"),
|
|
3750
|
+
reason: z32.string().min(1).max(2e3),
|
|
3751
|
+
rewards: z32.array(rewardSchema).max(10).optional(),
|
|
3556
3752
|
completionKey: completionKeySchema.optional()
|
|
3557
3753
|
}).strict()
|
|
3558
3754
|
]);
|
|
3559
|
-
var reviewModeSchema =
|
|
3560
|
-
var storedReviewModeSchema =
|
|
3755
|
+
var reviewModeSchema = z32.enum(["workers-ai"]);
|
|
3756
|
+
var storedReviewModeSchema = z32.enum([
|
|
3561
3757
|
"fixture-pass",
|
|
3562
3758
|
"fixture-fail",
|
|
3563
3759
|
"fixture-unclear",
|
|
3564
3760
|
"fixture-error",
|
|
3565
3761
|
"workers-ai"
|
|
3566
3762
|
]);
|
|
3567
|
-
var rewardBundleSchema =
|
|
3763
|
+
var rewardBundleSchema = z32.array(rewardSchema).max(10).refine(
|
|
3568
3764
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
3569
3765
|
"Use one entry per balance or shared reward"
|
|
3570
3766
|
);
|
|
3571
|
-
var mediaUrlSchema =
|
|
3767
|
+
var mediaUrlSchema = z32.string().max(2e3).refine((value) => {
|
|
3572
3768
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
3573
3769
|
return true;
|
|
3574
3770
|
}
|
|
@@ -3578,67 +3774,71 @@ var mediaUrlSchema = z30.string().max(2e3).refine((value) => {
|
|
|
3578
3774
|
return false;
|
|
3579
3775
|
}
|
|
3580
3776
|
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
3581
|
-
var questStepActionSchema =
|
|
3582
|
-
|
|
3583
|
-
kind:
|
|
3777
|
+
var questStepActionSchema = z32.discriminatedUnion("kind", [
|
|
3778
|
+
z32.object({
|
|
3779
|
+
kind: z32.literal("link"),
|
|
3584
3780
|
url: mediaUrlSchema.refine(
|
|
3585
3781
|
(value) => value.startsWith("https://"),
|
|
3586
3782
|
"Use an HTTPS URL"
|
|
3587
3783
|
),
|
|
3588
|
-
label:
|
|
3784
|
+
label: z32.string().trim().min(1).max(120)
|
|
3589
3785
|
}).strict()
|
|
3590
3786
|
]);
|
|
3591
|
-
var questStepSchema =
|
|
3592
|
-
title:
|
|
3593
|
-
description:
|
|
3787
|
+
var questStepSchema = z32.object({
|
|
3788
|
+
title: z32.string().trim().min(1).max(120),
|
|
3789
|
+
description: z32.string().max(4e3).optional(),
|
|
3594
3790
|
action: questStepActionSchema.optional()
|
|
3595
3791
|
}).strict();
|
|
3596
|
-
var questPresentationRequirementSchema =
|
|
3597
|
-
|
|
3598
|
-
|
|
3792
|
+
var questPresentationRequirementSchema = z32.discriminatedUnion("kind", [
|
|
3793
|
+
z32.object({ kind: z32.literal("account"), provider: authProviderSchema }).strict(),
|
|
3794
|
+
z32.object({ kind: z32.literal("wallet"), chain: walletChainSchema.optional() }).strict()
|
|
3599
3795
|
]);
|
|
3600
|
-
var questPresentationContentSchema =
|
|
3601
|
-
steps:
|
|
3796
|
+
var questPresentationContentSchema = z32.object({
|
|
3797
|
+
steps: z32.array(questStepSchema).max(30).optional(),
|
|
3602
3798
|
image: mediaUrlSchema.optional(),
|
|
3603
|
-
imageAlt:
|
|
3604
|
-
requirements:
|
|
3799
|
+
imageAlt: z32.string().max(500).optional(),
|
|
3800
|
+
requirements: z32.array(questPresentationRequirementSchema).max(10).optional()
|
|
3605
3801
|
}).strict();
|
|
3606
3802
|
var questPresentationSchema = questPresentationContentSchema.extend({
|
|
3607
3803
|
quiz: quizQuestionsSchema.optional(),
|
|
3608
|
-
instructions:
|
|
3609
|
-
video:
|
|
3804
|
+
instructions: z32.string().max(4e3).optional(),
|
|
3805
|
+
video: z32.object({
|
|
3610
3806
|
url: mediaUrlSchema,
|
|
3611
3807
|
poster: mediaUrlSchema.optional(),
|
|
3612
|
-
captions:
|
|
3808
|
+
captions: z32.object({
|
|
3613
3809
|
url: mediaUrlSchema,
|
|
3614
|
-
language:
|
|
3615
|
-
label:
|
|
3810
|
+
language: z32.string().min(2).max(20),
|
|
3811
|
+
label: z32.string().min(1).max(80)
|
|
3616
3812
|
}).strict().optional()
|
|
3617
3813
|
}).strict().optional()
|
|
3618
3814
|
}).strict();
|
|
3619
|
-
var questProfileSchema =
|
|
3815
|
+
var questProfileSchema = z32.object({ visible: z32.boolean() }).strict();
|
|
3620
3816
|
var evaluatorProtocol = 2;
|
|
3621
|
-
var evaluatorProtocolSchema =
|
|
3622
|
-
var questDescriptionSchema =
|
|
3817
|
+
var evaluatorProtocolSchema = z32.literal(evaluatorProtocol);
|
|
3818
|
+
var questDescriptionSchema = z32.object({
|
|
3623
3819
|
quest: identifier,
|
|
3624
3820
|
evaluatorProtocol: evaluatorProtocolSchema,
|
|
3625
|
-
title:
|
|
3821
|
+
title: z32.string().min(1).max(120),
|
|
3626
3822
|
presentation: questPresentationSchema.default({}),
|
|
3627
|
-
integrations:
|
|
3823
|
+
integrations: z32.array(evaluatorIntegrationProviderSchema).max(10).default([]),
|
|
3628
3824
|
fields: settingsFieldsSchema,
|
|
3629
3825
|
values: settingsValuesSchema,
|
|
3630
3826
|
rewards: rewardBundleSchema,
|
|
3631
|
-
|
|
3827
|
+
/** Messages Relay posts in connected chats and channels when a completion pays. */
|
|
3828
|
+
announcements: z32.array(announcementSchema).max(3).optional(),
|
|
3829
|
+
humanReview: z32.boolean(),
|
|
3632
3830
|
trigger: triggerSchema,
|
|
3633
3831
|
performance: contentPerformancePolicySchema.optional(),
|
|
3634
|
-
requires:
|
|
3832
|
+
requires: z32.array(prerequisiteSchema).max(30).default([]),
|
|
3635
3833
|
campaign: campaignDefinitionSchema.optional(),
|
|
3636
3834
|
availability: availabilityWindowSchema.optional(),
|
|
3637
|
-
completion:
|
|
3638
|
-
visibility:
|
|
3835
|
+
completion: z32.preprocess(refuseStreakTimeZone, completionPolicySchema),
|
|
3836
|
+
visibility: z32.enum(["visible", "hidden"]).default("visible"),
|
|
3639
3837
|
/** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
|
|
3640
3838
|
profile: questProfileSchema.default({ visible: false }),
|
|
3641
|
-
budgets:
|
|
3839
|
+
budgets: z32.array(budgetSchema).max(20).default([]),
|
|
3840
|
+
/** Budgets counted per tracker record author; only on quests with a tracker trigger. */
|
|
3841
|
+
authorBudgets: z32.array(authorBudgetSchema).max(20).optional(),
|
|
3642
3842
|
/**
|
|
3643
3843
|
* Milliseconds a member waits after an attempt is rejected (by the evaluator or a reviewer)
|
|
3644
3844
|
* before submitting this quest again. Only for quests members submit. Omitted: no cooldown.
|
|
@@ -3651,23 +3851,23 @@ var questDescriptionSchema = z30.object({
|
|
|
3651
3851
|
*/
|
|
3652
3852
|
completionCooldownMs: retryCooldownMsSchema.optional()
|
|
3653
3853
|
}).strict();
|
|
3654
|
-
var artifactSchema =
|
|
3854
|
+
var artifactSchema = z32.object({ code: z32.string().min(1).max(1e6) }).strict();
|
|
3655
3855
|
var releaseSchema = artifactSchema.extend({
|
|
3656
3856
|
/** The SDK runtime the code imports. Absent, the code bundles its own SDK. */
|
|
3657
3857
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
3658
3858
|
settings: settingsValuesSchema,
|
|
3659
3859
|
provider: reviewModeSchema,
|
|
3660
3860
|
expectedRelease: identifier.nullable().optional(),
|
|
3661
|
-
settingRenames:
|
|
3861
|
+
settingRenames: z32.record(z32.string(), z32.string()).optional()
|
|
3662
3862
|
}).strict();
|
|
3663
|
-
var batchReleaseSchema =
|
|
3664
|
-
releases:
|
|
3863
|
+
var batchReleaseSchema = z32.object({
|
|
3864
|
+
releases: z32.array(releaseSchema).min(1).max(questScaleLimits.quests)
|
|
3665
3865
|
}).strict();
|
|
3666
|
-
var questSettingsInputSchema =
|
|
3866
|
+
var questSettingsInputSchema = z32.object({
|
|
3667
3867
|
quest: identifier,
|
|
3668
3868
|
expectedRelease: identifier,
|
|
3669
3869
|
set: settingsValuesSchema,
|
|
3670
|
-
reset:
|
|
3870
|
+
reset: z32.array(z32.string()),
|
|
3671
3871
|
/** Replace the editable presentation fields; null restores the code defaults. */
|
|
3672
3872
|
presentation: questPresentationContentSchema.nullable().optional(),
|
|
3673
3873
|
/**
|
|
@@ -3675,7 +3875,7 @@ var questSettingsInputSchema = z30.object({
|
|
|
3675
3875
|
* none on chain; null removes a pasted one. An IDL the program publishes on chain takes
|
|
3676
3876
|
* precedence.
|
|
3677
3877
|
*/
|
|
3678
|
-
solanaIdls:
|
|
3878
|
+
solanaIdls: z32.record(z32.string(), anchorIdlSchema.nullable()).optional()
|
|
3679
3879
|
}).strict();
|
|
3680
3880
|
var storedQuestDescriptionSchema = questDescriptionSchema.extend({
|
|
3681
3881
|
completion: completionPolicySchema
|
|
@@ -3683,18 +3883,18 @@ var storedQuestDescriptionSchema = questDescriptionSchema.extend({
|
|
|
3683
3883
|
var publishedReleaseSchema = responseShape(
|
|
3684
3884
|
storedQuestDescriptionSchema.extend({
|
|
3685
3885
|
key: identifier.optional(),
|
|
3686
|
-
code:
|
|
3886
|
+
code: z32.string(),
|
|
3687
3887
|
/** The SDK runtime `code` imports. Absent, the code bundles its own SDK. */
|
|
3688
3888
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
3689
3889
|
provider: storedReviewModeSchema,
|
|
3690
3890
|
id: identifier,
|
|
3691
|
-
createdAt:
|
|
3692
|
-
origin:
|
|
3693
|
-
lifecycle:
|
|
3694
|
-
configuration:
|
|
3891
|
+
createdAt: z32.number(),
|
|
3892
|
+
origin: z32.object({ typeVersion: identifier }).strict().optional(),
|
|
3893
|
+
lifecycle: z32.enum(["active", "paused", "archived"]).default("active"),
|
|
3894
|
+
configuration: z32.object({
|
|
3695
3895
|
defaults: settingsValuesSchema,
|
|
3696
3896
|
overrides: settingsValuesSchema,
|
|
3697
|
-
preserved:
|
|
3897
|
+
preserved: z32.array(z32.string()),
|
|
3698
3898
|
presentation: questPresentationContentSchema.optional(),
|
|
3699
3899
|
presentationDefaults: questPresentationContentSchema.optional()
|
|
3700
3900
|
}).strict().optional(),
|
|
@@ -3703,14 +3903,14 @@ var publishedReleaseSchema = responseShape(
|
|
|
3703
3903
|
* `settings.solanaProgram()` setting key. Stored when the setting is saved; a setting without
|
|
3704
3904
|
* an IDL has no entry.
|
|
3705
3905
|
*/
|
|
3706
|
-
solanaIdls:
|
|
3906
|
+
solanaIdls: z32.record(z32.string(), solanaProgramIdlSchema).optional()
|
|
3707
3907
|
})
|
|
3708
3908
|
);
|
|
3709
|
-
var templateSchema =
|
|
3710
|
-
code:
|
|
3909
|
+
var templateSchema = z32.object({
|
|
3910
|
+
code: z32.string(),
|
|
3711
3911
|
definition: questDescriptionSchema
|
|
3712
3912
|
});
|
|
3713
|
-
var quizAnswersSchema =
|
|
3913
|
+
var quizAnswersSchema = z32.record(identifier, identifier).refine(
|
|
3714
3914
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
3715
3915
|
"Provide between 1 and 50 answers"
|
|
3716
3916
|
).transform(
|
|
@@ -3718,17 +3918,17 @@ var quizAnswersSchema = z30.record(identifier, identifier).refine(
|
|
|
3718
3918
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
3719
3919
|
)
|
|
3720
3920
|
);
|
|
3721
|
-
var quizEvidenceSchema =
|
|
3722
|
-
kind:
|
|
3921
|
+
var quizEvidenceSchema = z32.object({
|
|
3922
|
+
kind: z32.literal("quiz"),
|
|
3723
3923
|
release: identifier.optional(),
|
|
3724
3924
|
answers: quizAnswersSchema
|
|
3725
3925
|
}).strict();
|
|
3726
|
-
var submissionEvidenceSchema =
|
|
3926
|
+
var submissionEvidenceSchema = z32.union([
|
|
3727
3927
|
quizEvidenceSchema,
|
|
3728
3928
|
textEvidenceSchema,
|
|
3729
3929
|
urlEvidenceSchema
|
|
3730
3930
|
]);
|
|
3731
|
-
var submitSchema =
|
|
3931
|
+
var submitSchema = z32.object({
|
|
3732
3932
|
actionId: identifier,
|
|
3733
3933
|
quest: identifier,
|
|
3734
3934
|
member: identifier,
|
|
@@ -3736,7 +3936,7 @@ var submitSchema = z30.object({
|
|
|
3736
3936
|
input: submissionEvidenceSchema.optional(),
|
|
3737
3937
|
release: identifier.optional(),
|
|
3738
3938
|
/** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
|
|
3739
|
-
faultAfterReview:
|
|
3939
|
+
faultAfterReview: z32.boolean().optional()
|
|
3740
3940
|
}).strict();
|
|
3741
3941
|
var AttemptStatus = {
|
|
3742
3942
|
Queued: "queued",
|
|
@@ -3748,8 +3948,8 @@ var AttemptStatus = {
|
|
|
3748
3948
|
NeedsReview: "needs-review",
|
|
3749
3949
|
Failed: "failed"
|
|
3750
3950
|
};
|
|
3751
|
-
var attemptStatusSchema =
|
|
3752
|
-
var attemptSchema =
|
|
3951
|
+
var attemptStatusSchema = z32.string();
|
|
3952
|
+
var attemptSchema = z32.object({
|
|
3753
3953
|
id: identifier,
|
|
3754
3954
|
release: identifier,
|
|
3755
3955
|
quest: identifier,
|
|
@@ -3757,29 +3957,29 @@ var attemptSchema = z30.object({
|
|
|
3757
3957
|
evidence: identifier.nullable(),
|
|
3758
3958
|
input: submissionEvidenceSchema.optional(),
|
|
3759
3959
|
status: attemptStatusSchema,
|
|
3760
|
-
reason:
|
|
3761
|
-
retries:
|
|
3762
|
-
generation:
|
|
3763
|
-
completion:
|
|
3960
|
+
reason: z32.string().nullable(),
|
|
3961
|
+
retries: z32.number(),
|
|
3962
|
+
generation: z32.number(),
|
|
3963
|
+
completion: z32.string().nullable(),
|
|
3764
3964
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
3765
3965
|
/** Scheduled reruns advance this number; failure retries preserve it. */
|
|
3766
|
-
evaluationRun:
|
|
3767
|
-
deferCount:
|
|
3768
|
-
deferUntil:
|
|
3769
|
-
nextEvaluationAt:
|
|
3966
|
+
evaluationRun: z32.number().int().nonnegative().default(0),
|
|
3967
|
+
deferCount: z32.number().int().nonnegative().default(0),
|
|
3968
|
+
deferUntil: z32.number().int().safe().nullable().default(null),
|
|
3969
|
+
nextEvaluationAt: z32.number().int().safe().nullable().default(null),
|
|
3770
3970
|
/**
|
|
3771
3971
|
* Open code: consumers must tolerate new values. Relay writes its own codes, such as
|
|
3772
3972
|
* `budget-exhausted`; an attempt the evaluator rejected with `decision.reject({ reason, code })`
|
|
3773
3973
|
* carries the evaluator's code in management reads, and null in responses to members.
|
|
3774
3974
|
*/
|
|
3775
|
-
code:
|
|
3975
|
+
code: z32.string().nullable().default(null),
|
|
3776
3976
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
3777
3977
|
/**
|
|
3778
3978
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
3779
3979
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
3780
3980
|
*/
|
|
3781
|
-
requestedReview:
|
|
3782
|
-
createdAt:
|
|
3981
|
+
requestedReview: z32.boolean().default(false),
|
|
3982
|
+
createdAt: z32.number()
|
|
3783
3983
|
});
|
|
3784
3984
|
var QuestSubmissionStatus = {
|
|
3785
3985
|
Open: "open",
|
|
@@ -3787,9 +3987,9 @@ var QuestSubmissionStatus = {
|
|
|
3787
3987
|
Discarded: "discarded",
|
|
3788
3988
|
Expired: "expired"
|
|
3789
3989
|
};
|
|
3790
|
-
var questSubmissionStatusSchema =
|
|
3990
|
+
var questSubmissionStatusSchema = z32.string();
|
|
3791
3991
|
var questSubmissionSchema = responseShape(
|
|
3792
|
-
|
|
3992
|
+
z32.object({
|
|
3793
3993
|
id: identifier,
|
|
3794
3994
|
quest: identifier,
|
|
3795
3995
|
member: identifier,
|
|
@@ -3799,85 +3999,85 @@ var questSubmissionSchema = responseShape(
|
|
|
3799
3999
|
/** An uploaded photo's evidence ID. */
|
|
3800
4000
|
evidence: identifier.nullable(),
|
|
3801
4001
|
/** Submitting was refused because the quest changed: review the draft before submitting again. */
|
|
3802
|
-
reviewRequired:
|
|
4002
|
+
reviewRequired: z32.boolean(),
|
|
3803
4003
|
status: questSubmissionStatusSchema,
|
|
3804
4004
|
/** The attempt a `submitted` submission admitted. */
|
|
3805
4005
|
attempt: identifier.nullable(),
|
|
3806
|
-
createdAt:
|
|
3807
|
-
updatedAt:
|
|
4006
|
+
createdAt: z32.number(),
|
|
4007
|
+
updatedAt: z32.number(),
|
|
3808
4008
|
/** When an open submission expires unless it changes again. */
|
|
3809
|
-
expiresAt:
|
|
4009
|
+
expiresAt: z32.number()
|
|
3810
4010
|
})
|
|
3811
4011
|
);
|
|
3812
|
-
var questSubmissionUpdateSchema =
|
|
4012
|
+
var questSubmissionUpdateSchema = z32.object({
|
|
3813
4013
|
release: identifier.nullable().optional(),
|
|
3814
4014
|
input: submissionEvidenceSchema.nullable().optional(),
|
|
3815
4015
|
evidence: identifier.nullable().optional()
|
|
3816
4016
|
}).strict();
|
|
3817
4017
|
var questSubmissionResultSchema = responseShape(
|
|
3818
|
-
|
|
4018
|
+
z32.object({
|
|
3819
4019
|
submission: questSubmissionSchema,
|
|
3820
4020
|
attempt: attemptSchema,
|
|
3821
|
-
replayed:
|
|
4021
|
+
replayed: z32.boolean()
|
|
3822
4022
|
})
|
|
3823
4023
|
);
|
|
3824
|
-
var eventSchema =
|
|
3825
|
-
id:
|
|
3826
|
-
attempt:
|
|
3827
|
-
kind:
|
|
3828
|
-
detail:
|
|
3829
|
-
actor:
|
|
3830
|
-
at:
|
|
4024
|
+
var eventSchema = z32.object({
|
|
4025
|
+
id: z32.number(),
|
|
4026
|
+
attempt: z32.string().nullable(),
|
|
4027
|
+
kind: z32.string(),
|
|
4028
|
+
detail: z32.string(),
|
|
4029
|
+
actor: z32.string().nullable().default(null),
|
|
4030
|
+
at: z32.number()
|
|
3831
4031
|
});
|
|
3832
|
-
var pickupSelectionSchema =
|
|
4032
|
+
var pickupSelectionSchema = z32.object({
|
|
3833
4033
|
item: identifier,
|
|
3834
|
-
revision:
|
|
4034
|
+
revision: z32.number().int().nonnegative()
|
|
3835
4035
|
}).strict();
|
|
3836
|
-
var pickupAllocationSchema =
|
|
4036
|
+
var pickupAllocationSchema = z32.object({
|
|
3837
4037
|
item: identifier,
|
|
3838
|
-
label:
|
|
4038
|
+
label: z32.string().min(1).max(80)
|
|
3839
4039
|
}).strict();
|
|
3840
|
-
var pickupPolicySchema =
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
kind:
|
|
3844
|
-
tiers:
|
|
3845
|
-
|
|
4040
|
+
var pickupPolicySchema = z32.discriminatedUnion("kind", [
|
|
4041
|
+
z32.object({ kind: z32.literal("untracked") }).strict(),
|
|
4042
|
+
z32.object({
|
|
4043
|
+
kind: z32.literal("at-pickup"),
|
|
4044
|
+
tiers: z32.array(
|
|
4045
|
+
z32.object({
|
|
3846
4046
|
tier: identifier,
|
|
3847
|
-
variants:
|
|
4047
|
+
variants: z32.array(pickupAllocationSchema).min(1).max(100)
|
|
3848
4048
|
}).strict()
|
|
3849
4049
|
).min(1).max(100)
|
|
3850
4050
|
}).strict()
|
|
3851
4051
|
]);
|
|
3852
|
-
var pickupCatalogSchema =
|
|
4052
|
+
var pickupCatalogSchema = z32.object({
|
|
3853
4053
|
reward: tieredRewardDefinitionSchema,
|
|
3854
|
-
revision:
|
|
4054
|
+
revision: z32.number().int().nonnegative(),
|
|
3855
4055
|
policy: pickupPolicySchema
|
|
3856
4056
|
});
|
|
3857
|
-
var pickupAvailabilitySchema =
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
kind:
|
|
3861
|
-
revision:
|
|
3862
|
-
variants:
|
|
4057
|
+
var pickupAvailabilitySchema = z32.discriminatedUnion("kind", [
|
|
4058
|
+
z32.object({ kind: z32.literal("untracked") }).strict(),
|
|
4059
|
+
z32.object({
|
|
4060
|
+
kind: z32.literal("at-pickup"),
|
|
4061
|
+
revision: z32.number().int().nonnegative(),
|
|
4062
|
+
variants: z32.array(
|
|
3863
4063
|
pickupAllocationSchema.extend({
|
|
3864
|
-
available:
|
|
4064
|
+
available: z32.number().int().nonnegative()
|
|
3865
4065
|
})
|
|
3866
4066
|
)
|
|
3867
4067
|
}).strict()
|
|
3868
4068
|
]);
|
|
3869
|
-
var configurePickupSchema =
|
|
4069
|
+
var configurePickupSchema = z32.object({
|
|
3870
4070
|
reward: identifier,
|
|
3871
|
-
revision:
|
|
4071
|
+
revision: z32.number().int().nonnegative(),
|
|
3872
4072
|
actionId: identifier,
|
|
3873
|
-
policy:
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
kind:
|
|
3877
|
-
tiers:
|
|
3878
|
-
|
|
4073
|
+
policy: z32.discriminatedUnion("kind", [
|
|
4074
|
+
z32.object({ kind: z32.literal("untracked") }).strict(),
|
|
4075
|
+
z32.object({
|
|
4076
|
+
kind: z32.literal("at-pickup"),
|
|
4077
|
+
tiers: z32.array(
|
|
4078
|
+
z32.object({
|
|
3879
4079
|
tier: identifier,
|
|
3880
|
-
variants:
|
|
4080
|
+
variants: z32.array(
|
|
3881
4081
|
pickupAllocationSchema.extend({
|
|
3882
4082
|
item: identifier.optional()
|
|
3883
4083
|
})
|
|
@@ -3887,10 +4087,10 @@ var configurePickupSchema = z30.object({
|
|
|
3887
4087
|
}).strict()
|
|
3888
4088
|
])
|
|
3889
4089
|
}).strict();
|
|
3890
|
-
var entitlementRecoverySchema =
|
|
4090
|
+
var entitlementRecoverySchema = z32.object({
|
|
3891
4091
|
completion: identifier,
|
|
3892
|
-
reason:
|
|
3893
|
-
flaggedAt:
|
|
4092
|
+
reason: z32.string(),
|
|
4093
|
+
flaggedAt: z32.number(),
|
|
3894
4094
|
/** Null means no accepted completion currently earns this reward. */
|
|
3895
4095
|
remainingTier: identifier.nullable()
|
|
3896
4096
|
});
|
|
@@ -3900,40 +4100,40 @@ var entitlementBase = {
|
|
|
3900
4100
|
reward: tieredRewardDefinitionSchema,
|
|
3901
4101
|
earnedTier: identifier,
|
|
3902
4102
|
tier: identifier,
|
|
3903
|
-
revision:
|
|
4103
|
+
revision: z32.number().int().positive()
|
|
3904
4104
|
};
|
|
3905
|
-
var entitlementStateSchema =
|
|
3906
|
-
|
|
3907
|
-
|
|
4105
|
+
var entitlementStateSchema = z32.discriminatedUnion("status", [
|
|
4106
|
+
z32.object({ ...entitlementBase, status: z32.literal("available") }).strict(),
|
|
4107
|
+
z32.object({
|
|
3908
4108
|
...entitlementBase,
|
|
3909
|
-
status:
|
|
4109
|
+
status: z32.literal("handing-over"),
|
|
3910
4110
|
handover: identifier,
|
|
3911
|
-
startedAt:
|
|
4111
|
+
startedAt: z32.number(),
|
|
3912
4112
|
allocation: pickupAllocationSchema.optional()
|
|
3913
4113
|
}).strict(),
|
|
3914
|
-
|
|
4114
|
+
z32.object({
|
|
3915
4115
|
...entitlementBase,
|
|
3916
|
-
status:
|
|
4116
|
+
status: z32.literal("collected"),
|
|
3917
4117
|
handover: identifier,
|
|
3918
|
-
startedAt:
|
|
4118
|
+
startedAt: z32.number(),
|
|
3919
4119
|
allocation: pickupAllocationSchema.optional(),
|
|
3920
|
-
collectedAt:
|
|
4120
|
+
collectedAt: z32.number(),
|
|
3921
4121
|
recovery: entitlementRecoverySchema.optional()
|
|
3922
4122
|
}).strict(),
|
|
3923
4123
|
// An operator voided it: it can no longer be handed over. A quest grant of the same reward to
|
|
3924
4124
|
// the member (the same grant key) makes it available again; a voided referral reward stays void.
|
|
3925
|
-
|
|
4125
|
+
z32.object({
|
|
3926
4126
|
...entitlementBase,
|
|
3927
|
-
status:
|
|
3928
|
-
voidedAt:
|
|
4127
|
+
status: z32.literal("void"),
|
|
4128
|
+
voidedAt: z32.number()
|
|
3929
4129
|
}).strict()
|
|
3930
4130
|
]);
|
|
3931
|
-
var tieredRewardReadSchema =
|
|
4131
|
+
var tieredRewardReadSchema = z32.object({
|
|
3932
4132
|
id: identifier,
|
|
3933
|
-
title:
|
|
3934
|
-
tiers:
|
|
3935
|
-
inventory:
|
|
3936
|
-
fulfillment:
|
|
4133
|
+
title: z32.string(),
|
|
4134
|
+
tiers: z32.array(z32.object({ id: identifier, title: z32.string() }).loose()),
|
|
4135
|
+
inventory: z32.object({ kind: z32.string() }).loose(),
|
|
4136
|
+
fulfillment: z32.object({ kind: z32.string() }).loose()
|
|
3937
4137
|
}).loose();
|
|
3938
4138
|
var entitlementReadBase = {
|
|
3939
4139
|
id: identifier,
|
|
@@ -3941,63 +4141,63 @@ var entitlementReadBase = {
|
|
|
3941
4141
|
reward: tieredRewardReadSchema,
|
|
3942
4142
|
earnedTier: identifier,
|
|
3943
4143
|
tier: identifier,
|
|
3944
|
-
revision:
|
|
4144
|
+
revision: z32.number().int()
|
|
3945
4145
|
};
|
|
3946
|
-
var allocationReadSchema =
|
|
3947
|
-
var entitlementSchema =
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
4146
|
+
var allocationReadSchema = z32.object({ item: identifier, label: z32.string() }).loose();
|
|
4147
|
+
var entitlementSchema = z32.union([
|
|
4148
|
+
z32.discriminatedUnion("status", [
|
|
4149
|
+
z32.object({ ...entitlementReadBase, status: z32.literal("available") }).loose(),
|
|
4150
|
+
z32.object({
|
|
3951
4151
|
...entitlementReadBase,
|
|
3952
|
-
status:
|
|
4152
|
+
status: z32.literal("handing-over"),
|
|
3953
4153
|
handover: identifier,
|
|
3954
|
-
startedAt:
|
|
4154
|
+
startedAt: z32.number(),
|
|
3955
4155
|
allocation: allocationReadSchema.optional()
|
|
3956
4156
|
}).loose(),
|
|
3957
|
-
|
|
4157
|
+
z32.object({
|
|
3958
4158
|
...entitlementReadBase,
|
|
3959
|
-
status:
|
|
4159
|
+
status: z32.literal("collected"),
|
|
3960
4160
|
handover: identifier,
|
|
3961
|
-
startedAt:
|
|
4161
|
+
startedAt: z32.number(),
|
|
3962
4162
|
allocation: allocationReadSchema.optional(),
|
|
3963
|
-
collectedAt:
|
|
4163
|
+
collectedAt: z32.number(),
|
|
3964
4164
|
recovery: entitlementRecoverySchema.optional()
|
|
3965
4165
|
}).loose(),
|
|
3966
|
-
|
|
4166
|
+
z32.object({
|
|
3967
4167
|
...entitlementReadBase,
|
|
3968
|
-
status:
|
|
3969
|
-
voidedAt:
|
|
4168
|
+
status: z32.literal("void"),
|
|
4169
|
+
voidedAt: z32.number()
|
|
3970
4170
|
}).loose()
|
|
3971
4171
|
]),
|
|
3972
|
-
|
|
4172
|
+
z32.object({ ...entitlementReadBase, status: z32.string() }).loose().transform(({ status, ...entitlement }) => ({
|
|
3973
4173
|
...entitlement,
|
|
3974
4174
|
status: "unsupported",
|
|
3975
4175
|
reportedStatus: status
|
|
3976
4176
|
}))
|
|
3977
4177
|
]);
|
|
3978
|
-
var beginHandoverSchema =
|
|
4178
|
+
var beginHandoverSchema = z32.object({
|
|
3979
4179
|
actionId: identifier,
|
|
3980
|
-
revision:
|
|
4180
|
+
revision: z32.number().int().positive(),
|
|
3981
4181
|
selection: pickupSelectionSchema.optional()
|
|
3982
4182
|
}).strict();
|
|
3983
|
-
var confirmHandoverSchema =
|
|
3984
|
-
var entitlementCorrectionSchema =
|
|
4183
|
+
var confirmHandoverSchema = z32.object({ actionId: identifier, handover: identifier }).strict();
|
|
4184
|
+
var entitlementCorrectionSchema = z32.object({
|
|
3985
4185
|
actionId: identifier,
|
|
3986
|
-
revision:
|
|
3987
|
-
reason:
|
|
4186
|
+
revision: z32.number().int().positive(),
|
|
4187
|
+
reason: z32.string().trim().min(1).max(500)
|
|
3988
4188
|
}).strict();
|
|
3989
4189
|
var CompletionSourceKind = {
|
|
3990
4190
|
Quest: "quest",
|
|
3991
4191
|
Leaderboard: "leaderboard"
|
|
3992
4192
|
};
|
|
3993
|
-
var completionSourceKindSchema =
|
|
3994
|
-
var completionSourceSchema =
|
|
4193
|
+
var completionSourceKindSchema = z32.string().min(1).max(64);
|
|
4194
|
+
var completionSourceSchema = z32.object({
|
|
3995
4195
|
kind: completionSourceKindSchema,
|
|
3996
4196
|
id: identifier
|
|
3997
4197
|
});
|
|
3998
|
-
var completionRecordSchema =
|
|
4198
|
+
var completionRecordSchema = z32.object({
|
|
3999
4199
|
/** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
|
|
4000
|
-
key:
|
|
4200
|
+
key: z32.string().default("once"),
|
|
4001
4201
|
id: identifier,
|
|
4002
4202
|
/** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
|
|
4003
4203
|
quest: identifier,
|
|
@@ -4005,19 +4205,19 @@ var completionRecordSchema = z30.object({
|
|
|
4005
4205
|
/** What paid the completion. `source.id` repeats `quest`. */
|
|
4006
4206
|
source: completionSourceSchema.optional()
|
|
4007
4207
|
});
|
|
4008
|
-
var questAvailabilitySchema =
|
|
4009
|
-
|
|
4010
|
-
kind:
|
|
4011
|
-
input:
|
|
4208
|
+
var questAvailabilitySchema = z32.discriminatedUnion("kind", [
|
|
4209
|
+
z32.object({
|
|
4210
|
+
kind: z32.literal("available"),
|
|
4211
|
+
input: z32.enum(["photo", "quiz", "none", "text", "url"])
|
|
4012
4212
|
}).strict(),
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
kind:
|
|
4016
|
-
missing:
|
|
4213
|
+
z32.object({ kind: z32.literal("completed") }).strict(),
|
|
4214
|
+
z32.object({
|
|
4215
|
+
kind: z32.literal("locked"),
|
|
4216
|
+
missing: z32.array(missingPrerequisiteSchema).min(1)
|
|
4017
4217
|
}).strict(),
|
|
4018
|
-
|
|
4019
|
-
kind:
|
|
4020
|
-
reason:
|
|
4218
|
+
z32.object({
|
|
4219
|
+
kind: z32.literal("blocked"),
|
|
4220
|
+
reason: z32.enum([
|
|
4021
4221
|
"budget-exhausted",
|
|
4022
4222
|
"connection-required",
|
|
4023
4223
|
"wallet-required",
|
|
@@ -4026,56 +4226,56 @@ var questAvailabilitySchema = z30.discriminatedUnion("kind", [
|
|
|
4026
4226
|
"enrollment-required"
|
|
4027
4227
|
]),
|
|
4028
4228
|
/** Which window refused admission when `reason` is `outside-window`. */
|
|
4029
|
-
window:
|
|
4030
|
-
resetsAt:
|
|
4229
|
+
window: z32.enum(["tracker", "quest"]).optional(),
|
|
4230
|
+
resetsAt: z32.number().int().safe().optional()
|
|
4031
4231
|
}).strict(),
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4232
|
+
z32.object({ kind: z32.literal("staff-required") }).strict(),
|
|
4233
|
+
z32.object({ kind: z32.literal("automatic") }).strict(),
|
|
4234
|
+
z32.object({ kind: z32.literal("checking"), attempt: identifier }).strict(),
|
|
4235
|
+
z32.object({ kind: z32.literal("needs-review"), attempt: identifier }).strict(),
|
|
4236
|
+
z32.object({ kind: z32.literal("retryable"), attempt: identifier }).strict()
|
|
4037
4237
|
]);
|
|
4038
|
-
var questAvailabilityResponseSchema =
|
|
4238
|
+
var questAvailabilityResponseSchema = z32.union(
|
|
4039
4239
|
questAvailabilitySchema.options.map((option) => option.strip())
|
|
4040
4240
|
);
|
|
4041
|
-
var questBudgetViewSchema =
|
|
4241
|
+
var questBudgetViewSchema = z32.object({
|
|
4042
4242
|
id: identifier,
|
|
4043
|
-
scope:
|
|
4044
|
-
period:
|
|
4045
|
-
remaining:
|
|
4046
|
-
resetsAt:
|
|
4243
|
+
scope: z32.enum(["member", "project"]),
|
|
4244
|
+
period: z32.enum(["day", "week", "month", "lifetime"]),
|
|
4245
|
+
remaining: z32.number().int().safe().nonnegative(),
|
|
4246
|
+
resetsAt: z32.number().int().safe().nullable()
|
|
4047
4247
|
});
|
|
4048
4248
|
var memberProgressSchema = responseShape(
|
|
4049
|
-
|
|
4249
|
+
z32.object({
|
|
4050
4250
|
member: identifier,
|
|
4051
|
-
quests:
|
|
4052
|
-
|
|
4251
|
+
quests: z32.array(
|
|
4252
|
+
z32.object({
|
|
4053
4253
|
quest: identifier,
|
|
4054
4254
|
key: identifier.optional(),
|
|
4055
4255
|
release: identifier.optional(),
|
|
4056
|
-
title:
|
|
4256
|
+
title: z32.string(),
|
|
4057
4257
|
presentation: questPresentationSchema.default({}),
|
|
4058
|
-
connections:
|
|
4258
|
+
connections: z32.array(authProviderSchema).default([]),
|
|
4059
4259
|
trigger: triggerResponseSchema,
|
|
4060
4260
|
availability: questAvailabilityResponseSchema,
|
|
4061
|
-
completed:
|
|
4261
|
+
completed: z32.boolean(),
|
|
4062
4262
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
4063
4263
|
streak: streakProgressSchema.nullable().optional(),
|
|
4064
4264
|
counter: counterProgressSchema.nullable().optional(),
|
|
4065
4265
|
/** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
|
|
4066
4266
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
4067
|
-
completionCount:
|
|
4068
|
-
visibility:
|
|
4069
|
-
missing:
|
|
4267
|
+
completionCount: z32.number().int().nonnegative().default(0),
|
|
4268
|
+
visibility: z32.enum(["visible", "hidden"]).default("visible"),
|
|
4269
|
+
missing: z32.array(missingPrerequisiteSchema),
|
|
4070
4270
|
campaign: campaignViewSchema.nullable().default(null),
|
|
4071
4271
|
window: availabilityWindowSchema.nullable().default(null),
|
|
4072
|
-
budgets:
|
|
4272
|
+
budgets: z32.array(questBudgetViewSchema).default([]),
|
|
4073
4273
|
/**
|
|
4074
4274
|
* Unix milliseconds when the member may submit again, while the quest's retry cooldown
|
|
4075
4275
|
* after their rejected attempt runs. Until then a new attempt is refused with
|
|
4076
4276
|
* `retry-cooldown`. Absent when no cooldown is running.
|
|
4077
4277
|
*/
|
|
4078
|
-
retryAt:
|
|
4278
|
+
retryAt: z32.number().int().safe().optional(),
|
|
4079
4279
|
/**
|
|
4080
4280
|
* Unix milliseconds when the member may next submit the quest, while it waits on something
|
|
4081
4281
|
* that ends by itself: the retry cooldown after a rejection, the completion cooldown after
|
|
@@ -4084,110 +4284,110 @@ var memberProgressSchema = responseShape(
|
|
|
4084
4284
|
* several apply; use it for countdowns. Absent when the member can submit now, or when
|
|
4085
4285
|
* nothing will reopen the quest (a used-up lifetime budget, a closed window).
|
|
4086
4286
|
*/
|
|
4087
|
-
nextAvailableAt:
|
|
4287
|
+
nextAvailableAt: z32.number().int().safe().optional(),
|
|
4088
4288
|
attempt: attemptSchema.nullable()
|
|
4089
4289
|
})
|
|
4090
4290
|
),
|
|
4091
|
-
entitlements:
|
|
4291
|
+
entitlements: z32.array(entitlementSchema)
|
|
4092
4292
|
})
|
|
4093
4293
|
);
|
|
4094
4294
|
var snapshotSchema = responseShape(
|
|
4095
|
-
|
|
4096
|
-
releases:
|
|
4097
|
-
completions:
|
|
4098
|
-
entitlements:
|
|
4099
|
-
attempts:
|
|
4100
|
-
balances:
|
|
4101
|
-
|
|
4102
|
-
member:
|
|
4103
|
-
balance:
|
|
4104
|
-
earned:
|
|
4105
|
-
held:
|
|
4106
|
-
available:
|
|
4295
|
+
z32.object({
|
|
4296
|
+
releases: z32.array(publishedReleaseSchema),
|
|
4297
|
+
completions: z32.array(completionRecordSchema),
|
|
4298
|
+
entitlements: z32.array(entitlementSchema),
|
|
4299
|
+
attempts: z32.array(attemptSchema),
|
|
4300
|
+
balances: z32.array(
|
|
4301
|
+
z32.object({
|
|
4302
|
+
member: z32.string(),
|
|
4303
|
+
balance: z32.string(),
|
|
4304
|
+
earned: z32.number(),
|
|
4305
|
+
held: z32.number(),
|
|
4306
|
+
available: z32.number()
|
|
4107
4307
|
})
|
|
4108
4308
|
),
|
|
4109
|
-
events:
|
|
4309
|
+
events: z32.array(eventSchema)
|
|
4110
4310
|
})
|
|
4111
4311
|
);
|
|
4112
|
-
var evidenceSchema =
|
|
4312
|
+
var evidenceSchema = z32.object({
|
|
4113
4313
|
id: identifier,
|
|
4114
4314
|
member: identifier,
|
|
4115
|
-
type:
|
|
4116
|
-
size:
|
|
4315
|
+
type: z32.enum(["image/jpeg", "image/png"]),
|
|
4316
|
+
size: z32.number()
|
|
4117
4317
|
});
|
|
4118
|
-
var errorSchema =
|
|
4119
|
-
error:
|
|
4120
|
-
code:
|
|
4318
|
+
var errorSchema = z32.object({
|
|
4319
|
+
error: z32.string(),
|
|
4320
|
+
code: z32.string().optional(),
|
|
4121
4321
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
4122
|
-
window:
|
|
4123
|
-
missing:
|
|
4322
|
+
window: z32.enum(["tracker", "quest"]).optional(),
|
|
4323
|
+
missing: z32.array(missingPrerequisiteSchema).optional(),
|
|
4124
4324
|
/**
|
|
4125
4325
|
* Unix milliseconds when the member may submit again, when `code` is `retry-cooldown` or
|
|
4126
4326
|
* `completion-cooldown`.
|
|
4127
4327
|
*/
|
|
4128
|
-
retryAt:
|
|
4328
|
+
retryAt: z32.number().int().safe().optional()
|
|
4129
4329
|
});
|
|
4130
|
-
var staffDecisionSchema =
|
|
4330
|
+
var staffDecisionSchema = z32.object({
|
|
4131
4331
|
actionId: identifier,
|
|
4132
|
-
generation:
|
|
4133
|
-
decision:
|
|
4134
|
-
reason:
|
|
4332
|
+
generation: z32.number().int().nonnegative(),
|
|
4333
|
+
decision: z32.enum(["accept", "reject"]),
|
|
4334
|
+
reason: z32.string().trim().min(1).max(2e3)
|
|
4135
4335
|
}).strict();
|
|
4136
|
-
var acceptAnywaySchema =
|
|
4336
|
+
var acceptAnywaySchema = z32.object({
|
|
4137
4337
|
actionId: identifier,
|
|
4138
|
-
reason:
|
|
4338
|
+
reason: z32.string().trim().min(1).max(2e3)
|
|
4139
4339
|
}).strict();
|
|
4140
|
-
var stockSchema =
|
|
4141
|
-
var reservationSchema =
|
|
4340
|
+
var stockSchema = z32.object({ item: identifier, quantity: z32.number().int().min(0).max(1e4) }).strict();
|
|
4341
|
+
var reservationSchema = z32.object({
|
|
4142
4342
|
actionId: identifier,
|
|
4143
4343
|
member: identifier,
|
|
4144
4344
|
item: identifier,
|
|
4145
4345
|
balance: identifier,
|
|
4146
|
-
price:
|
|
4346
|
+
price: z32.number().int().positive().max(1e4)
|
|
4147
4347
|
}).strict();
|
|
4148
4348
|
var pageOptions = {
|
|
4149
|
-
limit:
|
|
4150
|
-
cursor:
|
|
4349
|
+
limit: z32.number().int().min(1).max(100).default(25),
|
|
4350
|
+
cursor: z32.string().min(1).max(4096).optional()
|
|
4151
4351
|
};
|
|
4152
|
-
var reviewListSchema =
|
|
4352
|
+
var reviewListSchema = z32.object({
|
|
4153
4353
|
...pageOptions,
|
|
4154
4354
|
member: identifier.optional(),
|
|
4155
4355
|
quest: identifier.optional()
|
|
4156
4356
|
}).strict();
|
|
4157
|
-
var memberListSchema =
|
|
4357
|
+
var memberListSchema = z32.object({
|
|
4158
4358
|
...pageOptions,
|
|
4159
4359
|
prefix: identifier.optional()
|
|
4160
4360
|
}).strict();
|
|
4161
|
-
var reviewItemSchema =
|
|
4361
|
+
var reviewItemSchema = z32.object({
|
|
4162
4362
|
attempt: attemptSchema,
|
|
4163
|
-
title:
|
|
4164
|
-
checks:
|
|
4165
|
-
|
|
4363
|
+
title: z32.string(),
|
|
4364
|
+
checks: z32.array(
|
|
4365
|
+
z32.object({ criteria: z32.string(), result: photoResultSchema })
|
|
4166
4366
|
)
|
|
4167
4367
|
});
|
|
4168
|
-
var reviewPageSchema =
|
|
4169
|
-
items:
|
|
4170
|
-
nextCursor:
|
|
4368
|
+
var reviewPageSchema = z32.object({
|
|
4369
|
+
items: z32.array(reviewItemSchema).max(100),
|
|
4370
|
+
nextCursor: z32.string().nullable()
|
|
4171
4371
|
});
|
|
4172
|
-
var memberPageSchema =
|
|
4173
|
-
items:
|
|
4174
|
-
nextCursor:
|
|
4372
|
+
var memberPageSchema = z32.object({
|
|
4373
|
+
items: z32.array(z32.object({ member: identifier })).max(100),
|
|
4374
|
+
nextCursor: z32.string().nullable()
|
|
4175
4375
|
});
|
|
4176
|
-
var createStockItemSchema =
|
|
4177
|
-
var stockItemSchema =
|
|
4178
|
-
var contentPerformanceSnapshotSchema =
|
|
4376
|
+
var createStockItemSchema = z32.object({ actionId: identifier, name: z32.string().trim().min(1).max(80) }).strict();
|
|
4377
|
+
var stockItemSchema = z32.object({ id: identifier, name: z32.string() });
|
|
4378
|
+
var contentPerformanceSnapshotSchema = z32.strictObject({
|
|
4179
4379
|
contentAttempt: identifier,
|
|
4180
4380
|
observation: identifier,
|
|
4181
|
-
observedAt:
|
|
4381
|
+
observedAt: z32.number().int().safe().nonnegative(),
|
|
4182
4382
|
metrics: contentMetricsSchema,
|
|
4183
4383
|
rewards: rewardBundleSchema
|
|
4184
4384
|
});
|
|
4185
4385
|
var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
|
|
4186
|
-
content:
|
|
4386
|
+
content: z32.string().min(1).max(256)
|
|
4187
4387
|
});
|
|
4188
|
-
var contentPerformancePageSchema =
|
|
4189
|
-
current:
|
|
4190
|
-
state:
|
|
4388
|
+
var contentPerformancePageSchema = z32.strictObject({
|
|
4389
|
+
current: z32.strictObject({
|
|
4390
|
+
state: z32.enum([
|
|
4191
4391
|
"content-pending",
|
|
4192
4392
|
"content-unqualified",
|
|
4193
4393
|
"waiting",
|
|
@@ -4198,19 +4398,19 @@ var contentPerformancePageSchema = z30.strictObject({
|
|
|
4198
4398
|
"failed",
|
|
4199
4399
|
"superseded"
|
|
4200
4400
|
]),
|
|
4201
|
-
reason:
|
|
4401
|
+
reason: z32.string().nullable(),
|
|
4202
4402
|
contentAttempt: identifier,
|
|
4203
4403
|
attempt: identifier.nullable(),
|
|
4204
4404
|
reward: contentQualificationSchema.shape.reward
|
|
4205
4405
|
}),
|
|
4206
|
-
items:
|
|
4207
|
-
|
|
4406
|
+
items: z32.array(
|
|
4407
|
+
z32.strictObject({
|
|
4208
4408
|
attempt: identifier,
|
|
4209
4409
|
contentAttempt: identifier,
|
|
4210
4410
|
observation: identifier,
|
|
4211
|
-
observedAt:
|
|
4411
|
+
observedAt: z32.number(),
|
|
4212
4412
|
metrics: contentMetricsSchema,
|
|
4213
|
-
state:
|
|
4413
|
+
state: z32.enum([
|
|
4214
4414
|
"pending",
|
|
4215
4415
|
"qualified",
|
|
4216
4416
|
"unqualified",
|
|
@@ -4218,7 +4418,7 @@ var contentPerformancePageSchema = z30.strictObject({
|
|
|
4218
4418
|
"failed",
|
|
4219
4419
|
"superseded"
|
|
4220
4420
|
]),
|
|
4221
|
-
reason:
|
|
4421
|
+
reason: z32.string().nullable()
|
|
4222
4422
|
})
|
|
4223
4423
|
),
|
|
4224
4424
|
nextCursor: pageCursorSchema.nullable()
|
|
@@ -4392,12 +4592,31 @@ export {
|
|
|
4392
4592
|
completionPolicySchema,
|
|
4393
4593
|
completionKeySchema,
|
|
4394
4594
|
budgetSchema,
|
|
4595
|
+
authorBudgetSchema,
|
|
4395
4596
|
memberCompletionSchema,
|
|
4396
4597
|
maxMemberCompletions,
|
|
4397
4598
|
evaluatorIntegrationProviderSchema,
|
|
4398
4599
|
integrationProviderSchema,
|
|
4399
4600
|
discordServerSchema,
|
|
4400
4601
|
projectIntegrationSchema,
|
|
4602
|
+
announcementPlaceholders,
|
|
4603
|
+
parseAnnouncementTemplate,
|
|
4604
|
+
telegramSignInMethodsSchema,
|
|
4605
|
+
telegramAccountConnectionSchema,
|
|
4606
|
+
telegramInitDataSchema,
|
|
4607
|
+
telegramMiniAppSignInSchema,
|
|
4608
|
+
telegramChatIdSchema,
|
|
4609
|
+
telegramChatSchema,
|
|
4610
|
+
telegramChatsSchema,
|
|
4611
|
+
telegramChatConnectionSchema,
|
|
4612
|
+
telegramMemberInputSchema,
|
|
4613
|
+
telegramChatMemberSchema,
|
|
4614
|
+
telegramReactionDataSchema,
|
|
4615
|
+
telegramMessageDataSchema,
|
|
4616
|
+
announcementTextSchema,
|
|
4617
|
+
telegramAnnouncementSchema,
|
|
4618
|
+
discordAnnouncementSchema,
|
|
4619
|
+
announcementSchema,
|
|
4401
4620
|
solanaAddressSchema,
|
|
4402
4621
|
walletChainSchema,
|
|
4403
4622
|
cosmosNetworkSchema,
|