@domino-sdk/relay 1.66.1 → 1.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/{accounts-_lNsiR2k.d.ts → accounts-DnpKoJCo.d.ts} +210 -3
  3. package/dist/{attempt-captures-BqPggxTU.d.ts → attempt-captures-DMNFMYFb.d.ts} +9 -1
  4. package/dist/authoring.d.ts +352 -40
  5. package/dist/authoring.js +131 -22
  6. package/dist/{automatic-outcomes-BzAvfcpd.d.ts → automatic-outcomes-CQ3vpiQl.d.ts} +2 -2
  7. package/dist/avatar.d.ts +1 -1
  8. package/dist/browser.d.ts +10 -9
  9. package/dist/browser.js +12 -12
  10. package/dist/{catalog-ByZMRS7I.d.ts → catalog-BLGie8Lh.d.ts} +60 -2
  11. package/dist/chunk-4JSPMFO2.js +427 -0
  12. package/dist/{chunk-5LD5DKOM.js → chunk-55WJVFWC.js} +2 -2
  13. package/dist/{chunk-CJDB6W6I.js → chunk-5AKD4ZF3.js} +75 -36
  14. package/dist/{chunk-7MQCQYEE.js → chunk-6UBFSMCM.js} +1 -1
  15. package/dist/{chunk-XCEGNKGH.js → chunk-6YTSRWRB.js} +1254 -700
  16. package/dist/{chunk-OWDIR7ZU.js → chunk-75KF633N.js} +9 -1
  17. package/dist/{chunk-4TC4HK5Y.js → chunk-7YSVZA7A.js} +1 -1
  18. package/dist/{chunk-7HTRIEM7.js → chunk-CZ7NQ7W7.js} +11 -68
  19. package/dist/{chunk-ANVAUOJP.js → chunk-DDJN2T5A.js} +1 -1
  20. package/dist/{chunk-M66Y5OMJ.js → chunk-DNPDR4Z7.js} +16 -9
  21. package/dist/{chunk-FU3W4IQN.js → chunk-EXZVWQOQ.js} +2 -2
  22. package/dist/{chunk-5DYS2OIP.js → chunk-HXTKI34N.js} +14 -2
  23. package/dist/{chunk-FGXLXENM.js → chunk-IW46TW3A.js} +21 -1
  24. package/dist/{chunk-2Y4EZKET.js → chunk-KKHENO57.js} +2 -2
  25. package/dist/{chunk-U66GUVSG.js → chunk-LZXDYSUH.js} +2 -0
  26. package/dist/{chunk-QYHEHMCG.js → chunk-MEUAJIVO.js} +2 -2
  27. package/dist/{chunk-BQXRCJ3N.js → chunk-P4TPW4SY.js} +1 -1
  28. package/dist/{chunk-CGUL4MRE.js → chunk-R3MNZKNJ.js} +1 -1
  29. package/dist/{chunk-R2LHIWAM.js → chunk-SD74HD75.js} +45 -9
  30. package/dist/{chunk-FUFMYKSQ.js → chunk-TYZFVL73.js} +136 -5
  31. package/dist/chunk-VAGGGB6B.js +87 -0
  32. package/dist/{chunk-2HHZV7U3.js → chunk-VRZZB7CQ.js} +1 -1
  33. package/dist/{client-Cze4lfwA.d.ts → client-BMif22WQ.d.ts} +136 -7
  34. package/dist/{dashboards-pVfclkyh.d.ts → dashboards-DMk-vL1q.d.ts} +4 -4
  35. package/dist/{deployments-Cr1tfqrr.d.ts → deployments-BCr418BX.d.ts} +582 -173
  36. package/dist/{identity-integration-Ci2vGKtX.d.ts → identity-integration-r76xaAax.d.ts} +10 -2
  37. package/dist/index.d.ts +10 -10
  38. package/dist/index.js +10 -10
  39. package/dist/internal.d.ts +155 -14
  40. package/dist/internal.js +255 -25
  41. package/dist/{limits-pE04y9O2.d.ts → limits-ByVRQePO.d.ts} +6 -1
  42. package/dist/{offers-Hw2P6tcK.d.ts → offers-xcPbYaEv.d.ts} +2 -2
  43. package/dist/portal-proxy.d.ts +5 -5
  44. package/dist/portal-proxy.js +13 -15
  45. package/dist/react/index.d.ts +38 -15
  46. package/dist/react/index.js +12 -12
  47. package/dist/{reward-deliveries-BCV8hznc.d.ts → reward-deliveries-0VvT6LMj.d.ts} +1 -1
  48. package/dist/runtime/authoring.js +1 -1
  49. package/dist/runtime/chunks/2UDZ6TPL.js +1 -0
  50. package/dist/runtime/manifest.json +3 -3
  51. package/dist/runtime/schema.js +1 -1
  52. package/dist/schema.d.ts +401 -104
  53. package/dist/schema.js +66 -8
  54. package/dist/server/index.d.ts +12 -12
  55. package/dist/server/index.js +2288 -873
  56. package/dist/{sign-in-providers-BAkGjSXo.d.ts → sign-in-providers-C5_753DZ.d.ts} +2 -2
  57. package/dist/solana.d.ts +171 -0
  58. package/dist/solana.js +364 -0
  59. package/dist/{submission-input-ChL1aYNH.d.ts → submission-input-CaL8drIh.d.ts} +2 -2
  60. package/dist/{telegram-browser-BFs4u7lC.d.ts → telegram-browser-DLtHPRBI.d.ts} +6 -108
  61. package/dist/telegram.d.ts +8 -8
  62. package/dist/telegram.js +2 -2
  63. package/dist/testing.d.ts +87 -14
  64. package/dist/testing.js +108 -11
  65. package/dist/{tracker-data-Bl-qPIvZ.d.ts → tracker-data-CAK942sx.d.ts} +300 -3
  66. package/dist/{transport-WE49Ta3A.d.ts → transport-CkidqTOk.d.ts} +5866 -1244
  67. package/dist/{wallet-B7e06v4m.d.ts → wallet-DQtJelQQ.d.ts} +418 -33
  68. package/dist/wallet-browser-dpmr22Xv.d.ts +106 -0
  69. package/package.json +18 -1
  70. package/dist/chunk-UYVJZR33.js +0 -34
  71. package/dist/chunk-UZ765UGH.js +0 -18
  72. package/dist/runtime/chunks/C5V267I7.js +0 -1
@@ -1,7 +1,47 @@
1
1
  import {
2
2
  attemptCaptureSchema,
3
3
  capturedFactSchema
4
- } from "../chunk-OWDIR7ZU.js";
4
+ } from "../chunk-75KF633N.js";
5
+ import {
6
+ PayoutSourceKind,
7
+ RestoredDeliveryOutcome,
8
+ RestoredEntitlementOutcome,
9
+ RestoredReferralOutcome,
10
+ RevokedDeliveryOutcome,
11
+ RevokedEntitlementOutcome,
12
+ RevokedReferralOutcome,
13
+ WEBHOOK_MAX_BYTES,
14
+ completionReceiptInputSchema,
15
+ completionReceiptListSchema,
16
+ completionReceiptSchema,
17
+ completionRestorationSchema,
18
+ completionRestoreSchema,
19
+ completionRevocationSchema,
20
+ completionRevocationShortfallSchema,
21
+ completionRevokeSchema,
22
+ maxCompletionReceipts,
23
+ memberCompletionPageSchema,
24
+ memberCompletionQuerySchema,
25
+ memberCompletionSchema,
26
+ revokedCompletionSchema,
27
+ verifyWebhook,
28
+ walletLinkedEventDataSchema,
29
+ webhookControlInputSchema,
30
+ webhookCreateInputSchema,
31
+ webhookDeleteInputSchema,
32
+ webhookDeliveryPageSchema,
33
+ webhookDeliverySchema,
34
+ webhookEndpointSchema,
35
+ webhookEndpointStateSchema,
36
+ webhookEventSchema,
37
+ webhookInputSchema,
38
+ webhookQuerySchema,
39
+ webhookRotateInputSchema,
40
+ webhookSecretSchema,
41
+ webhookStatePageSchema,
42
+ webhookStateQuerySchema,
43
+ webhookUpdateSchema
44
+ } from "../chunk-4JSPMFO2.js";
5
45
  import {
6
46
  DEFAULT_MANAGEMENT_TIMEOUT,
7
47
  ManagementError,
@@ -9,22 +49,26 @@ import {
9
49
  ManagementUploadBody,
10
50
  REFERRAL_INTEGRATION_REWARD_ERROR,
11
51
  actionIdOf,
52
+ canonicalWalletAddress,
12
53
  containsReferralIntegrationReward,
54
+ hex,
13
55
  isManagementError,
14
56
  managementErrorSchema,
15
57
  managementTransport,
16
58
  questConfiguration,
17
- sequenceCursorSchema
18
- } from "../chunk-FUFMYKSQ.js";
59
+ sequenceCursorSchema,
60
+ solanaRpc,
61
+ walletSignatureValid
62
+ } from "../chunk-TYZFVL73.js";
19
63
  import {
20
64
  parseImageExtraction,
21
65
  parseImageResult
22
- } from "../chunk-FU3W4IQN.js";
66
+ } from "../chunk-EXZVWQOQ.js";
23
67
  import {
24
68
  sourceDataSchema,
25
69
  sourceRoles,
26
70
  validateQuestShape
27
- } from "../chunk-5DYS2OIP.js";
71
+ } from "../chunk-HXTKI34N.js";
28
72
  import {
29
73
  APP_KV_LIMIT,
30
74
  APP_MIGRATION_FILE_BYTES,
@@ -76,6 +120,7 @@ import {
76
120
  appStorageTablesSchema,
77
121
  appStorageValueSchema,
78
122
  assetPathSchema,
123
+ boundedBodyText,
79
124
  buildArtifactsSchema,
80
125
  buildIdentitySchema,
81
126
  buildPhaseSchema,
@@ -152,13 +197,13 @@ import {
152
197
  starterTemplates,
153
198
  starters,
154
199
  verifyScheduledRequest
155
- } from "../chunk-CJDB6W6I.js";
200
+ } from "../chunk-5AKD4ZF3.js";
156
201
  import {
157
202
  isIntegrationParticipantPath,
158
203
  isParticipantRoute,
159
204
  participantRoutePattern,
160
205
  participantRoutes
161
- } from "../chunk-U66GUVSG.js";
206
+ } from "../chunk-LZXDYSUH.js";
162
207
  import {
163
208
  activityTypeSchema,
164
209
  activityTypes,
@@ -184,12 +229,12 @@ import {
184
229
  publishDeploymentSchema,
185
230
  rejectDeploymentSchema,
186
231
  submitDeploymentSchema
187
- } from "../chunk-M66Y5OMJ.js";
232
+ } from "../chunk-DNPDR4Z7.js";
188
233
  import {
189
234
  xUserLookupInputSchema,
190
235
  xUserSchema,
191
236
  xUsernameSchema
192
- } from "../chunk-ANVAUOJP.js";
237
+ } from "../chunk-DDJN2T5A.js";
193
238
  import {
194
239
  analyticsBreakdowns,
195
240
  analyticsCatalog,
@@ -204,15 +249,15 @@ import {
204
249
  analyticsRanges,
205
250
  analyticsReadSchema,
206
251
  dashboardDefinitionSchema
207
- } from "../chunk-QYHEHMCG.js";
252
+ } from "../chunk-MEUAJIVO.js";
208
253
  import "../chunk-MWMCQLCG.js";
209
254
  import {
210
255
  withActionId
211
- } from "../chunk-BQXRCJ3N.js";
256
+ } from "../chunk-P4TPW4SY.js";
212
257
  import {
213
258
  withQuery
214
- } from "../chunk-4TC4HK5Y.js";
215
- import "../chunk-2Y4EZKET.js";
259
+ } from "../chunk-7YSVZA7A.js";
260
+ import "../chunk-KKHENO57.js";
216
261
  import {
217
262
  collectionBeginSchema,
218
263
  collectionPreviewSchema,
@@ -227,7 +272,7 @@ import {
227
272
  rewardDeliveriesSchema,
228
273
  rewardDeliveryQuerySchema,
229
274
  rewardDeliverySchema
230
- } from "../chunk-CGUL4MRE.js";
275
+ } from "../chunk-R3MNZKNJ.js";
231
276
  import {
232
277
  allocateQuestSchema,
233
278
  allocatedQuestSchema,
@@ -238,7 +283,7 @@ import {
238
283
  questDraftSchema,
239
284
  questPublicationPreviewSchema,
240
285
  saveQuestDraftSchema
241
- } from "../chunk-7MQCQYEE.js";
286
+ } from "../chunk-6UBFSMCM.js";
242
287
  import {
243
288
  engagementBoundaryPageSchema,
244
289
  engagementChangePreviewInputSchema,
@@ -264,7 +309,7 @@ import {
264
309
  referralQualificationSchema,
265
310
  referralRewardResolutionSchema,
266
311
  referralSuspensionSchema
267
- } from "../chunk-5LD5DKOM.js";
312
+ } from "../chunk-55WJVFWC.js";
268
313
  import {
269
314
  CompletionSourceKind,
270
315
  acceptAnywaySchema,
@@ -275,11 +320,13 @@ import {
275
320
  badgeMutationResultSchema,
276
321
  badgeMutationSchema,
277
322
  badgePropertiesSchema,
323
+ base58,
324
+ base58Bytes,
278
325
  baseUnitsSchema,
279
326
  beginHandoverSchema,
327
+ caip10,
280
328
  campaignEnrollmentSchema,
281
329
  completionKeySchema,
282
- completionSourceSchema,
283
330
  configurePickupSchema,
284
331
  confirmHandoverSchema,
285
332
  contentPerformancePageSchema,
@@ -312,6 +359,7 @@ import {
312
359
  groupPageQuerySchema,
313
360
  groupPageSchema,
314
361
  identifier,
362
+ isEvmChainId,
315
363
  leaderboardExclusionGroupBindingSchema,
316
364
  leaderboardExclusionGroupSchema,
317
365
  leaderboardExclusionSchema,
@@ -332,15 +380,18 @@ import {
332
380
  managedProfileSchema,
333
381
  managedTrackerCreateSchema,
334
382
  managementStateQuerySchema,
383
+ maxSolanaActionReference,
335
384
  memberBadgesSchema,
336
385
  memberCampaignEnrollmentInputSchema,
337
386
  memberCampaignWithdrawalInputSchema,
338
387
  memberIdentitySchema,
339
388
  memberProgressSchema,
389
+ nftTrackerCreateSchema,
340
390
  organizationDiscordServersSchema,
341
391
  pageCursorSchema,
342
392
  pageLimit,
343
393
  pageQuerySchema,
394
+ parseSolanaActionMemo,
344
395
  pickupAvailabilitySchema,
345
396
  pickupCatalogSchema,
346
397
  pointLedgerPropertiesSchema,
@@ -351,6 +402,7 @@ import {
351
402
  profileModerationSchema,
352
403
  profileSettingsInputSchema,
353
404
  profileSettingsSchema,
405
+ programActivityTrackerCreateSchema,
354
406
  projectCalendarInputSchema,
355
407
  projectCalendarSchema,
356
408
  projectGroupKey,
@@ -361,16 +413,26 @@ import {
361
413
  questSubmissionSchema,
362
414
  removeGroupMemberSchema,
363
415
  responseTables,
416
+ settlementPaymentSchema,
364
417
  signInProviderInputSchema,
365
418
  signInProviderOptionSchema,
366
419
  signInProviderSchema,
367
420
  snapshotSchema,
421
+ solanaActionMemo,
368
422
  solanaAddressSchema,
423
+ solanaDevnet,
369
424
  solanaMainnet,
425
+ solanaMemoProgram,
426
+ solanaSignatureSchema2 as solanaSignatureSchema,
427
+ solanaTransactionFixtureInputSchema,
428
+ solanaTransactionSubmissionSchema,
370
429
  staffDecisionSchema,
430
+ stakeTrackerCreateSchema,
431
+ stationRefusal,
371
432
  stockItemSchema,
372
433
  streakProgressSchema,
373
434
  submitSchema,
435
+ takesSolanaTransaction,
374
436
  telegramChatConnectionSchema,
375
437
  telegramChatIdSchema,
376
438
  telegramChatsSchema,
@@ -398,12 +460,13 @@ import {
398
460
  walletBalanceSchema,
399
461
  walletChainSchema,
400
462
  walletSignInNetworksSchema,
463
+ walletTransactionsSchema,
401
464
  walletUnlinkInputSchema,
402
465
  whereSchemaIssue
403
- } from "../chunk-XCEGNKGH.js";
466
+ } from "../chunk-6YTSRWRB.js";
404
467
  import {
405
468
  issueText
406
- } from "../chunk-FGXLXENM.js";
469
+ } from "../chunk-IW46TW3A.js";
407
470
 
408
471
  // src/server/identity-links.ts
409
472
  import * as z from "zod";
@@ -682,15 +745,19 @@ var leaderboardSettlementExportSchema = /* @__PURE__ */ (() => z6.object({
682
745
  share: baseUnitsSchema.nullable(),
683
746
  /** The pool share in whole units: `"600.5"` for 600500000 USDC base units. */
684
747
  amount: z6.string().nullable(),
685
- /** Linked wallets the member proved, on every chain, newest first per chain. */
748
+ /** Linked wallets the member proved, newest first per chain family; a smart wallet names its `provedOn` chain. */
686
749
  wallets: z6.array(
687
750
  z6.object({
688
751
  chain: walletChainSchema,
689
752
  /** The CAIP-2 network, for Cosmos wallets only. */
690
753
  network: z6.string().nullable(),
691
- address: z6.string()
754
+ address: z6.string(),
755
+ /** EVM smart-contract wallets only: the CAIP-2 network that proved it, the one chain to pay it on. */
756
+ provedOn: evmChainIdSchema.optional()
692
757
  })
693
- )
758
+ ),
759
+ /** How a non-zero share in a non-points pool was paid on chain; absent otherwise. */
760
+ payment: settlementPaymentSchema.optional()
694
761
  })
695
762
  )
696
763
  }))();
@@ -709,7 +776,9 @@ function settlementPayoutCsv(exported) {
709
776
  row.share,
710
777
  row.amount,
711
778
  row.share === null ? "" : unit,
712
- row.wallets.map((wallet) => `${wallet.network ?? wallet.chain}:${wallet.address}`).join(" ")
779
+ row.wallets.map(
780
+ (wallet) => `${wallet.provedOn ?? wallet.network ?? wallet.chain}:${wallet.address}`
781
+ ).join(" ")
713
782
  ])
714
783
  ].map((fields) => fields.map(csvField).join(",")).join("\n");
715
784
  }
@@ -922,8 +991,8 @@ var accountReference = /* @__PURE__ */ (() => z9.object({
922
991
  actionId: identifier,
923
992
  kind: z9.enum(["x", "discord"]),
924
993
  subject: z9.string().regex(/^[1-9][0-9]{0,19}$/, "Use the numeric user ID")
925
- }).strict().transform(({ actionId: actionId2, kind, subject }) => ({
926
- actionId: actionId2,
994
+ }).strict().transform(({ actionId: actionId3, kind, subject }) => ({
995
+ actionId: actionId3,
927
996
  provider: kind,
928
997
  id: subject
929
998
  })))();
@@ -1052,135 +1121,9 @@ var testMemberHistorySchema = /* @__PURE__ */ (() => z9.object({
1052
1121
  complete: z9.boolean()
1053
1122
  }))();
1054
1123
 
1055
- // src/server/webhooks.ts
1056
- import * as z10 from "zod";
1057
- var PayoutSourceKind = {
1058
- Quest: "quest",
1059
- Leaderboard: "leaderboard",
1060
- Engagement: "engagement",
1061
- Manual: "manual"
1062
- };
1063
- var webhookEventSchema = /* @__PURE__ */ (() => z10.object({
1064
- id: z10.string().uuid(),
1065
- version: z10.literal(1),
1066
- type: activityTypeSchema,
1067
- createdAt: z10.number().int().nonnegative(),
1068
- organization: z10.string(),
1069
- project: z10.string(),
1070
- environment: z10.enum(["test", "live"]),
1071
- data: z10.record(z10.string(), z10.json())
1072
- }))();
1073
- var webhookControlInputSchema = /* @__PURE__ */ (() => z10.object({ actionId: z10.string().uuid().optional() }).strict())();
1074
- var webhookInputSchema = /* @__PURE__ */ (() => z10.object({
1075
- url: z10.url().max(2048).refine((value) => {
1076
- const url2 = new URL(value);
1077
- return url2.protocol === "https:" && !url2.username && !url2.password && !url2.hash;
1078
- }, "Use an HTTPS URL without credentials or a fragment"),
1079
- types: z10.array(activityTypeSchema).min(1).max(100).refine((v) => new Set(v).size === v.length)
1080
- }).strict())();
1081
- var webhookCreateInputSchema = /* @__PURE__ */ (() => webhookInputSchema.extend({ actionId: z10.string().uuid().optional() }).strict())();
1082
- var webhookRotateInputSchema = /* @__PURE__ */ (() => z10.object({ actionId: z10.string().uuid().optional() }).strict())();
1083
- var webhookUpdateSchema = /* @__PURE__ */ (() => webhookInputSchema.partial().extend({ enabled: z10.boolean().optional() }).strict())();
1084
- var webhookEndpointSchema = /* @__PURE__ */ (() => z10.object({
1085
- ...webhookInputSchema.shape,
1086
- id: z10.string().uuid(),
1087
- enabled: z10.boolean(),
1088
- disabledReason: z10.string().nullable(),
1089
- consecutiveFailures: z10.number().int().nonnegative(),
1090
- createdAt: z10.number(),
1091
- updatedAt: z10.number()
1092
- }))();
1093
- var webhookEndpointStateSchema = /* @__PURE__ */ (() => webhookEndpointSchema.extend({
1094
- revision: z10.number().int().nonnegative(),
1095
- deletedAt: z10.number().int().safe().nonnegative().nullable()
1096
- }))();
1097
- var webhookDeleteInputSchema = /* @__PURE__ */ (() => z10.strictObject({
1098
- actionId: z10.string().uuid().default(() => crypto.randomUUID()),
1099
- expectedRevision: z10.number().int().nonnegative(),
1100
- reason: z10.string().trim().min(1).max(500)
1101
- }))();
1102
- var webhookStateQuerySchema = /* @__PURE__ */ (() => z10.strictObject({
1103
- cursor: pageCursorSchema.optional(),
1104
- limit: z10.coerce.number().int().min(1).max(100).default(50)
1105
- }))();
1106
- var webhookStatePageSchema = /* @__PURE__ */ (() => z10.object({
1107
- items: z10.array(webhookEndpointStateSchema),
1108
- nextCursor: pageCursorSchema.nullable()
1109
- }))();
1110
- var webhookSecretSchema = /* @__PURE__ */ (() => z10.object({
1111
- endpoint: webhookEndpointSchema,
1112
- secret: z10.string(),
1113
- previousValidUntil: z10.number().nullable()
1114
- }))();
1115
- var webhookDeliverySchema = /* @__PURE__ */ (() => z10.object({
1116
- id: z10.string().uuid(),
1117
- endpoint: z10.string().uuid(),
1118
- event: webhookEventSchema,
1119
- status: z10.enum(["pending", "delivered", "failed", "skipped"]),
1120
- attempts: z10.number().int().nonnegative(),
1121
- responseStatus: z10.number().nullable(),
1122
- lastError: z10.string().nullable(),
1123
- createdAt: z10.number(),
1124
- deliveredAt: z10.number().nullable(),
1125
- replayOf: z10.string().uuid().nullable()
1126
- }))();
1127
- var webhookQuerySchema = /* @__PURE__ */ (() => z10.object({
1128
- /** A page's `nextCursor`: the deliveries after it, newest first. */
1129
- cursor: pageCursorSchema.optional(),
1130
- /** @deprecated Use `cursor`. Removed in 2.0.0. */
1131
- before: z10.string().uuid().optional(),
1132
- limit: z10.coerce.number().int().min(1).max(100).default(50)
1133
- }).strict())();
1134
- var webhookDeliveryPageSchema = /* @__PURE__ */ (() => z10.object({
1135
- items: z10.array(webhookDeliverySchema),
1136
- nextCursor: pageCursorSchema.nullable().default(null),
1137
- /** @deprecated Use `nextCursor`, passed back as `cursor`. Removed in 2.0.0. */
1138
- next: z10.string().uuid().nullable()
1139
- }))();
1140
- var WEBHOOK_MAX_BYTES = 64 * 1024;
1141
- async function verifyWebhook(input) {
1142
- const bytes = new TextEncoder().encode(input.body);
1143
- const tolerance = input.toleranceSeconds ?? 300;
1144
- const now = input.now ?? Date.now();
1145
- if (bytes.length > WEBHOOK_MAX_BYTES || !Number.isFinite(now) || !Number.isFinite(tolerance) || tolerance < 0 || tolerance > 300) {
1146
- throw new Error("Invalid webhook verification input");
1147
- }
1148
- const parts = input.signature.split(",");
1149
- const timestamps = parts.filter((part) => part.startsWith("t="));
1150
- const timestamp2 = timestamps[0]?.slice(2) ?? "";
1151
- const signatures = parts.filter((part) => /^v1=[a-f0-9]{64}$/.test(part)).map((part) => part.slice(3));
1152
- if (timestamps.length !== 1 || !/^\d{1,12}$/.test(timestamp2) || Math.abs(now / 1e3 - Number(timestamp2)) > tolerance || signatures.length < 1 || signatures.length > 2) {
1153
- throw new Error("Invalid or expired webhook signature");
1154
- }
1155
- const secrets3 = typeof input.secret === "string" ? [input.secret] : input.secret;
1156
- const message = new TextEncoder().encode(`${timestamp2}.${input.body}`);
1157
- for (const secret of secrets3) {
1158
- if (!secret) {
1159
- continue;
1160
- }
1161
- const key = await crypto.subtle.importKey(
1162
- "raw",
1163
- new TextEncoder().encode(secret),
1164
- { name: "HMAC", hash: "SHA-256" },
1165
- false,
1166
- ["verify"]
1167
- );
1168
- for (const signature of signatures) {
1169
- const digest = Uint8Array.from(
1170
- signature.match(/../g) ?? [],
1171
- (byte) => Number.parseInt(byte, 16)
1172
- );
1173
- if (await crypto.subtle.verify("HMAC", key, digest, message)) {
1174
- return webhookEventSchema.parse(JSON.parse(input.body));
1175
- }
1176
- }
1177
- }
1178
- throw new Error("Invalid webhook signature");
1179
- }
1180
-
1181
1124
  // src/server/resource-lifecycle.ts
1182
- import * as z11 from "zod";
1183
- var resourceLifecycleKindSchema = /* @__PURE__ */ (() => z11.enum([
1125
+ import * as z10 from "zod";
1126
+ var resourceLifecycleKindSchema = /* @__PURE__ */ (() => z10.enum([
1184
1127
  "tracker",
1185
1128
  "referral",
1186
1129
  "leaderboard",
@@ -1190,51 +1133,51 @@ var resourceLifecycleKindSchema = /* @__PURE__ */ (() => z11.enum([
1190
1133
  "image",
1191
1134
  "point-ledger"
1192
1135
  ]))();
1193
- var managedResourceSchema = /* @__PURE__ */ (() => z11.object({
1136
+ var managedResourceSchema = /* @__PURE__ */ (() => z10.object({
1194
1137
  kind: resourceLifecycleKindSchema,
1195
1138
  id: identifier,
1196
1139
  key: identifier.nullable(),
1197
- title: z11.string(),
1198
- archivedAt: z11.number().int().nonnegative().nullable()
1140
+ title: z10.string(),
1141
+ archivedAt: z10.number().int().nonnegative().nullable()
1199
1142
  }))();
1200
- var resourceLifecycleInputSchema = /* @__PURE__ */ (() => z11.object({
1201
- actionId: z11.string().uuid(),
1143
+ var resourceLifecycleInputSchema = /* @__PURE__ */ (() => z10.object({
1144
+ actionId: z10.string().uuid(),
1202
1145
  kind: resourceLifecycleKindSchema,
1203
1146
  resource: identifier,
1204
- archived: z11.boolean(),
1147
+ archived: z10.boolean(),
1205
1148
  reason: lifecycleReasonSchema,
1206
- expectedArchivedAt: z11.number().int().nonnegative().nullable().optional()
1149
+ expectedArchivedAt: z10.number().int().nonnegative().nullable().optional()
1207
1150
  }).strict())();
1208
- var resourceLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1151
+ var resourceLifecycleResultSchema = /* @__PURE__ */ (() => z10.object({
1209
1152
  resource: managedResourceSchema,
1210
- changed: z11.boolean()
1153
+ changed: z10.boolean()
1211
1154
  }))();
1212
1155
  var managedOfferSchema = /* @__PURE__ */ (() => managedResourceSchema.extend({
1213
- kind: z11.literal("offer")
1156
+ kind: z10.literal("offer")
1214
1157
  }))();
1215
1158
  var managedTieredRewardSchema = /* @__PURE__ */ (() => managedResourceSchema.extend({
1216
- kind: z11.literal("tiered-reward")
1159
+ kind: z10.literal("tiered-reward")
1217
1160
  }))();
1218
- var managedResourceListSchema = /* @__PURE__ */ (() => z11.object({
1219
- resources: z11.array(managedResourceSchema),
1220
- offers: z11.array(managedOfferSchema).default([]),
1161
+ var managedResourceListSchema = /* @__PURE__ */ (() => z10.object({
1162
+ resources: z10.array(managedResourceSchema),
1163
+ offers: z10.array(managedOfferSchema).default([]),
1221
1164
  /** Absent from a Relay older than tiered reward archiving; treat it as none. */
1222
- tieredRewards: z11.array(managedTieredRewardSchema).optional()
1165
+ tieredRewards: z10.array(managedTieredRewardSchema).optional()
1223
1166
  }))();
1224
- var offerLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1167
+ var offerLifecycleResultSchema = /* @__PURE__ */ (() => z10.object({
1225
1168
  resource: managedOfferSchema,
1226
- changed: z11.boolean()
1169
+ changed: z10.boolean()
1227
1170
  }))();
1228
- var offerLifecycleInputSchema = /* @__PURE__ */ (() => z11.strictObject({
1229
- actionId: z11.string().uuid(),
1171
+ var offerLifecycleInputSchema = /* @__PURE__ */ (() => z10.strictObject({
1172
+ actionId: z10.string().uuid(),
1230
1173
  offer: identifier,
1231
- archived: z11.boolean(),
1232
- reason: z11.string().trim().min(1).max(500),
1233
- expectedArchivedAt: z11.number().int().nonnegative().nullable().optional()
1174
+ archived: z10.boolean(),
1175
+ reason: z10.string().trim().min(1).max(500),
1176
+ expectedArchivedAt: z10.number().int().nonnegative().nullable().optional()
1234
1177
  }))();
1235
- var tieredRewardLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1178
+ var tieredRewardLifecycleResultSchema = /* @__PURE__ */ (() => z10.object({
1236
1179
  resource: managedTieredRewardSchema,
1237
- changed: z11.boolean()
1180
+ changed: z10.boolean()
1238
1181
  }))();
1239
1182
  var tieredRewardLifecycleInputSchema = /* @__PURE__ */ (() => offerLifecycleInputSchema.omit({ offer: true }).extend({ reward: identifier }))();
1240
1183
  var resourceLifecyclePaths = {
@@ -1254,46 +1197,46 @@ var resourceArchiveInputSchema = /* @__PURE__ */ (() => resourceLifecycleInputSc
1254
1197
  }))();
1255
1198
 
1256
1199
  // src/server/dashboards.ts
1257
- import * as z12 from "zod";
1258
- var dashboardListQuerySchema = /* @__PURE__ */ (() => z12.strictObject({
1259
- includeArchived: z12.union([z12.boolean(), z12.enum(["true", "false"])]).transform((value) => value === true || value === "true").optional()
1200
+ import * as z11 from "zod";
1201
+ var dashboardListQuerySchema = /* @__PURE__ */ (() => z11.strictObject({
1202
+ includeArchived: z11.union([z11.boolean(), z11.enum(["true", "false"])]).transform((value) => value === true || value === "true").optional()
1260
1203
  }))();
1261
1204
  var summaryFields = /* @__PURE__ */ (() => ({
1262
1205
  key: identifier,
1263
- title: z12.string(),
1264
- description: z12.string().nullable(),
1206
+ title: z11.string(),
1207
+ description: z11.string().nullable(),
1265
1208
  /** Lists order by it, dashboards without one last, then by title. */
1266
- position: z12.number().int().nullable(),
1267
- archivedAt: z12.number().int().nonnegative().nullable(),
1209
+ position: z11.number().int().nullable(),
1210
+ archivedAt: z11.number().int().nonnegative().nullable(),
1268
1211
  /** When the current version was published. */
1269
- updatedAt: z12.number().int().nonnegative()
1212
+ updatedAt: z11.number().int().nonnegative()
1270
1213
  }))();
1271
- var dashboardSummarySchema = /* @__PURE__ */ (() => z12.object(summaryFields))();
1272
- var dashboardListSchema = /* @__PURE__ */ (() => z12.array(dashboardSummarySchema))();
1273
- var dashboardLifecycleInputSchema = /* @__PURE__ */ (() => z12.strictObject({
1274
- actionId: z12.string().uuid(),
1214
+ var dashboardSummarySchema = /* @__PURE__ */ (() => z11.object(summaryFields))();
1215
+ var dashboardListSchema = /* @__PURE__ */ (() => z11.array(dashboardSummarySchema))();
1216
+ var dashboardLifecycleInputSchema = /* @__PURE__ */ (() => z11.strictObject({
1217
+ actionId: z11.string().uuid(),
1275
1218
  dashboard: identifier,
1276
- archived: z12.boolean(),
1277
- reason: z12.string().trim().min(1).max(500),
1278
- expectedArchivedAt: z12.number().int().nonnegative().nullable().optional()
1219
+ archived: z11.boolean(),
1220
+ reason: z11.string().trim().min(1).max(500),
1221
+ expectedArchivedAt: z11.number().int().nonnegative().nullable().optional()
1279
1222
  }))();
1280
- var dashboardLifecycleResultSchema = /* @__PURE__ */ (() => z12.object({
1223
+ var dashboardLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1281
1224
  dashboard: dashboardSummarySchema,
1282
- changed: z12.boolean()
1225
+ changed: z11.boolean()
1283
1226
  }))();
1284
- var dashboardReadQuerySchema = /* @__PURE__ */ (() => z12.strictObject({
1227
+ var dashboardReadQuerySchema = /* @__PURE__ */ (() => z11.strictObject({
1285
1228
  key: identifier,
1286
- range: z12.enum(analyticsRanges).optional()
1229
+ range: z11.enum(analyticsRanges).optional()
1287
1230
  }))();
1288
- var dashboardReadSchema = /* @__PURE__ */ (() => z12.object({
1231
+ var dashboardReadSchema = /* @__PURE__ */ (() => z11.object({
1289
1232
  ...summaryFields,
1290
1233
  definition: dashboardDefinitionSchema,
1291
- range: z12.enum(analyticsRanges),
1292
- panels: z12.array(
1293
- z12.object({
1234
+ range: z11.enum(analyticsRanges),
1235
+ panels: z11.array(
1236
+ z11.object({
1294
1237
  key: identifier,
1295
1238
  result: analyticsMetricResultSchema.optional(),
1296
- error: z12.object({ code: z12.string(), message: z12.string() }).optional()
1239
+ error: z11.object({ code: z11.string(), message: z11.string() }).optional()
1297
1240
  })
1298
1241
  )
1299
1242
  }))();
@@ -1302,33 +1245,33 @@ var dashboardReadSchema = /* @__PURE__ */ (() => z12.object({
1302
1245
  import * as z62 from "zod";
1303
1246
 
1304
1247
  // src/server/client/http.ts
1305
- import * as z15 from "zod";
1248
+ import * as z14 from "zod";
1306
1249
 
1307
1250
  // src/server/operations.ts
1308
- import * as z13 from "zod";
1309
- var operationSchema = /* @__PURE__ */ (() => z13.object({
1310
- target: z13.string(),
1311
- paused: z13.boolean(),
1312
- revision: z13.number().int(),
1313
- reason: z13.string(),
1314
- actor: z13.string().nullable(),
1315
- changedAt: z13.number()
1316
- }))();
1317
- var operationInputSchema = /* @__PURE__ */ (() => z13.object({
1318
- target: z13.union([
1319
- z13.literal("redemptions"),
1320
- z13.string().regex(/^quest:[\w-]+$/)
1251
+ import * as z12 from "zod";
1252
+ var operationSchema = /* @__PURE__ */ (() => z12.object({
1253
+ target: z12.string(),
1254
+ paused: z12.boolean(),
1255
+ revision: z12.number().int(),
1256
+ reason: z12.string(),
1257
+ actor: z12.string().nullable(),
1258
+ changedAt: z12.number()
1259
+ }))();
1260
+ var operationInputSchema = /* @__PURE__ */ (() => z12.object({
1261
+ target: z12.union([
1262
+ z12.literal("redemptions"),
1263
+ z12.string().regex(/^quest:[\w-]+$/)
1321
1264
  ]),
1322
- paused: z13.boolean(),
1323
- revision: z13.number().int().nonnegative(),
1324
- reason: z13.string().trim().min(1).max(500),
1265
+ paused: z12.boolean(),
1266
+ revision: z12.number().int().nonnegative(),
1267
+ reason: z12.string().trim().min(1).max(500),
1325
1268
  actionId: identifier
1326
1269
  }).strict())();
1327
1270
 
1328
1271
  // src/server/revision-fence.ts
1329
- import * as z14 from "zod";
1272
+ import * as z13 from "zod";
1330
1273
  function expectedRevision(schema) {
1331
- return z14.preprocess((body, context) => {
1274
+ return z13.preprocess((body, context) => {
1332
1275
  if (body === null || typeof body !== "object" || Array.isArray(body) || !("expectedRevision" in body)) {
1333
1276
  return body;
1334
1277
  }
@@ -1339,7 +1282,7 @@ function expectedRevision(schema) {
1339
1282
  message: "expectedRevision and revision name different revisions",
1340
1283
  path: ["expectedRevision"]
1341
1284
  });
1342
- return z14.NEVER;
1285
+ return z13.NEVER;
1343
1286
  }
1344
1287
  return { ...rest, revision: expectedRevision2 };
1345
1288
  }, schema);
@@ -1371,7 +1314,7 @@ function managementHttp(options) {
1371
1314
  }
1372
1315
  return { request, get, post, create, raw, exchange };
1373
1316
  }
1374
- var ok = /* @__PURE__ */ (() => z15.object({ ok: z15.literal(true) }))();
1317
+ var ok = /* @__PURE__ */ (() => z14.object({ ok: z14.literal(true) }))();
1375
1318
  function createPointLedger({ create }) {
1376
1319
  function run(input, call) {
1377
1320
  return create(
@@ -1384,12 +1327,12 @@ function createPointLedger({ create }) {
1384
1327
  }
1385
1328
  return run;
1386
1329
  }
1387
- function pathFirst(key, send) {
1330
+ function pathFirst(key2, send) {
1388
1331
  function run(first, second, call) {
1389
1332
  if (typeof first === "string") {
1390
1333
  return send(first, second, call);
1391
1334
  }
1392
- const { [key]: id, ...input } = first;
1335
+ const { [key2]: id, ...input } = first;
1393
1336
  return send(
1394
1337
  id,
1395
1338
  input,
@@ -1446,10 +1389,10 @@ var operationVerb = ({ post }, target, paused, input, call) => {
1446
1389
  };
1447
1390
 
1448
1391
  // src/server/client/badges.ts
1449
- import * as z16 from "zod";
1392
+ import * as z15 from "zod";
1450
1393
  function badges({ create, get, post }) {
1451
1394
  return {
1452
- list: (call) => get("/badges", z16.array(managedBadgeSchema), call),
1395
+ list: (call) => get("/badges", z15.array(managedBadgeSchema), call),
1453
1396
  create: (input, call) => create("/badges", managedBadgeSchema, createBadgeSchema, input, call),
1454
1397
  update: (badge, input, call) => {
1455
1398
  const body = badgePropertiesSchema.extend(badgeMutationSchema.shape).parse(withActionId(input));
@@ -1511,7 +1454,7 @@ function content({ get }) {
1511
1454
  var contentApi = (http) => content(http);
1512
1455
 
1513
1456
  // src/server/client/deployments.ts
1514
- import * as z17 from "zod";
1457
+ import * as z16 from "zod";
1515
1458
  function deployments({ get, post }) {
1516
1459
  function publishDeployment(target, call) {
1517
1460
  const id = typeof target === "string" ? identifier.parse(target) : publishDeploymentSchema.parse(target).id;
@@ -1557,7 +1500,7 @@ function deployments({ get, post }) {
1557
1500
  *
1558
1501
  * @deprecated Use `history`, which pages by `cursor` and `nextCursor`. Removed in 2.0.0.
1559
1502
  */
1560
- list: (call) => get("/deployments", z17.array(deploymentRecordSchema), call),
1503
+ list: (call) => get("/deployments", z16.array(deploymentRecordSchema), call),
1561
1504
  /**
1562
1505
  * The project environment's deployments, newest first, one page at a time, with the two
1563
1506
  * newest published deployments beside every page. Pass a page's `nextCursor` back as
@@ -1596,7 +1539,7 @@ function deployments({ get, post }) {
1596
1539
  var deploymentsApi = (http) => deployments(http);
1597
1540
 
1598
1541
  // src/server/client/engagement.ts
1599
- import * as z18 from "zod";
1542
+ import * as z17 from "zod";
1600
1543
  function engagement(http) {
1601
1544
  const { get, post } = http;
1602
1545
  return {
@@ -1642,7 +1585,7 @@ function engagement(http) {
1642
1585
  engagementPublishSchema.parse(withActionId(input)),
1643
1586
  call
1644
1587
  ),
1645
- list: (call) => get("/engagement", z18.array(engagementRuleSchema), call),
1588
+ list: (call) => get("/engagement", z17.array(engagementRuleSchema), call),
1646
1589
  page: (input, call) => get(
1647
1590
  "/engagement/history" + queryString(engagementPageQuerySchema.parse(input)),
1648
1591
  engagementPageSchema,
@@ -1722,6 +1665,152 @@ var groupsApi = (http) => groups(http);
1722
1665
 
1723
1666
  // src/server/client/leaderboards.ts
1724
1667
  import * as z19 from "zod";
1668
+
1669
+ // src/server/settlement-payouts.ts
1670
+ import * as z18 from "zod";
1671
+ var timestamp2 = /* @__PURE__ */ (() => z18.number().int().safe().nonnegative())();
1672
+ var index = /* @__PURE__ */ (() => z18.number().int().safe().nonnegative())();
1673
+ var actionId = /* @__PURE__ */ (() => z18.string().uuid().default(() => crypto.randomUUID()))();
1674
+ var signatureSchema = /* @__PURE__ */ (() => z18.string().min(64).max(88).regex(/^[1-9A-HJ-NP-Za-km-z]+$/))();
1675
+ var solanaPayoutMintSchema = /* @__PURE__ */ (() => z18.union([
1676
+ z18.literal("SOL"),
1677
+ solanaAddressSchema
1678
+ ]))();
1679
+ var solanaPayoutSquadsSchema = /* @__PURE__ */ (() => z18.strictObject({
1680
+ /** The multisig account (not its vault). */
1681
+ multisig: solanaAddressSchema,
1682
+ /** The vault the payout pays from; Squads' default vault is 0. */
1683
+ vaultIndex: z18.number().int().min(0).max(255).default(0),
1684
+ /** The member that signs each batch's proposal transaction and pays its fees and rent. */
1685
+ proposer: solanaAddressSchema
1686
+ }))();
1687
+ var solanaPayoutInputSchema = /* @__PURE__ */ (() => z18.strictObject({
1688
+ actionId,
1689
+ /** The cluster, by CAIP-2 ID. */
1690
+ network: z18.enum([solanaMainnet, solanaDevnet]),
1691
+ mint: solanaPayoutMintSchema,
1692
+ /** The wallet that signs every batch, pays its fees and rent, and holds the tokens. */
1693
+ payer: solanaAddressSchema.optional(),
1694
+ /** The Squads multisig whose vault pays, instead of a wallet. */
1695
+ squads: solanaPayoutSquadsSchema.optional()
1696
+ }).refine((input) => input.payer === void 0 !== !input.squads, {
1697
+ message: "Pass payer to pay from a wallet, or squads to pay from a multisig",
1698
+ path: ["payer"]
1699
+ }))();
1700
+ var solanaPayoutConfirmationSchema = /* @__PURE__ */ (() => z18.strictObject({
1701
+ actionId,
1702
+ /** Signatures of transactions the team sent, which Relay reads first. */
1703
+ signatures: z18.array(signatureSchema).max(100).default([])
1704
+ }))();
1705
+ var batchSchema = /* @__PURE__ */ (() => z18.object({
1706
+ index,
1707
+ /** The SPL Memo text the batch carries, which Relay finds it by. */
1708
+ memo: z18.string(),
1709
+ /**
1710
+ * The unsigned v0 transaction, base64. Its fee payer and only signer signs it: the payer, or for
1711
+ * a Squads payout the proposer.
1712
+ */
1713
+ transaction: z18.string(),
1714
+ status: z18.string(),
1715
+ /** The transaction Relay found for the batch; null while pending or expired. */
1716
+ signature: z18.string().nullable(),
1717
+ /** Base units the batch pays. */
1718
+ amount: baseUnitsSchema,
1719
+ /** Lamports for the token accounts the batch creates. */
1720
+ rent: baseUnitsSchema,
1721
+ /** The Squads vault transaction's index in its multisig; null for a wallet payout. */
1722
+ transactionIndex: z18.string().nullable().default(null),
1723
+ /** The address of the batch's Squads proposal account; null for a wallet payout. */
1724
+ proposal: z18.string().nullable().default(null),
1725
+ payments: z18.array(
1726
+ z18.object({
1727
+ member: identifier,
1728
+ /** The member's proven Solana wallet the share goes to. */
1729
+ wallet: z18.string(),
1730
+ amount: baseUnitsSchema
1731
+ })
1732
+ )
1733
+ }))();
1734
+ var solanaPayoutSchema = /* @__PURE__ */ (() => z18.object({
1735
+ id: identifier,
1736
+ settlement: identifier,
1737
+ network: z18.string(),
1738
+ /** `"SOL"` or the mint address. */
1739
+ mint: z18.string(),
1740
+ /** The mint's token program; null for SOL. */
1741
+ tokenProgram: z18.string().nullable(),
1742
+ /** What pays: `wallet`, or `squads`, whose vault is `payer`. */
1743
+ source: z18.string().default("wallet"),
1744
+ /** The account that holds the tokens and pays: the wallet, or the multisig's vault. */
1745
+ payer: z18.string(),
1746
+ /** The Squads multisig, for a payout from its vault; null for a wallet payout. */
1747
+ squads: z18.object({
1748
+ multisig: z18.string(),
1749
+ vaultIndex: z18.number().int().min(0).max(255),
1750
+ proposer: z18.string(),
1751
+ /**
1752
+ * Lamports the proposer puts into each batch's vault transaction and proposal accounts,
1753
+ * together. Squads returns them to the multisig's rent collector when the accounts close.
1754
+ */
1755
+ accountRent: baseUnitsSchema
1756
+ }).nullable().default(null),
1757
+ decimals: index,
1758
+ /** Base units the batches pay together. */
1759
+ total: baseUnitsSchema,
1760
+ /** Lamports the payer spends on token accounts the batches create, at the build's rent. */
1761
+ rent: baseUnitsSchema,
1762
+ /**
1763
+ * Lamports spent on signature fees, one signature per batch: by the payer, or by the proposer of
1764
+ * a Squads payout.
1765
+ */
1766
+ fees: baseUnitsSchema,
1767
+ /**
1768
+ * The last block height at which the batches can land; after it, they expire. For a Squads
1769
+ * payout, the height by which the proposals must be created.
1770
+ */
1771
+ lastValidBlockHeight: z18.string(),
1772
+ createdAt: timestamp2,
1773
+ createdBy: z18.string(),
1774
+ batches: z18.array(batchSchema),
1775
+ /** Winners with a non-zero, unpaid share this payout leaves out. */
1776
+ skipped: z18.array(
1777
+ z18.object({
1778
+ member: identifier,
1779
+ share: baseUnitsSchema,
1780
+ reason: z18.string()
1781
+ })
1782
+ )
1783
+ }))();
1784
+ var solanaPayoutQuerySchema = /* @__PURE__ */ (() => z18.strictObject({
1785
+ cursor: pageCursorSchema.optional(),
1786
+ limit: z18.coerce.number().int().min(1).max(25).default(10)
1787
+ }))();
1788
+ var solanaPayoutPageSchema = /* @__PURE__ */ (() => z18.object({
1789
+ items: z18.array(solanaPayoutSchema),
1790
+ nextCursor: pageCursorSchema.nullable()
1791
+ }))();
1792
+ var solanaPayoutConfirmationResultSchema = /* @__PURE__ */ (() => z18.object({
1793
+ settlement: identifier,
1794
+ batches: z18.array(
1795
+ z18.object({
1796
+ payout: identifier,
1797
+ index,
1798
+ status: z18.string(),
1799
+ signature: z18.string().nullable()
1800
+ })
1801
+ ),
1802
+ paid: index,
1803
+ pending: index,
1804
+ unpaid: index
1805
+ }))();
1806
+ function squadsProposalUrl(payout, batch) {
1807
+ if (payout.source !== "squads" || !batch.proposal) {
1808
+ return null;
1809
+ }
1810
+ return payout.network === solanaDevnet ? `https://explorer.solana.com/address/${batch.proposal}?cluster=devnet` : `https://app.squads.so/squads/${payout.payer}/transactions`;
1811
+ }
1812
+
1813
+ // src/server/client/leaderboards.ts
1725
1814
  function leaderboards(http) {
1726
1815
  const { get, post } = http;
1727
1816
  return {
@@ -1812,6 +1901,41 @@ function leaderboards(http) {
1812
1901
  leaderboardSettlementExportSchema,
1813
1902
  call
1814
1903
  ),
1904
+ /**
1905
+ * Builds unsigned Solana transfer batches that pay an approved settlement's unpaid token pool
1906
+ * shares from `payer`, to each winner's most recently linked proven Solana wallet. The team
1907
+ * signs and sends them; then call `confirmSolanaPayout`. Requires review permission.
1908
+ *
1909
+ * @experimental A minor release can change this method and its result.
1910
+ */
1911
+ buildSolanaPayout: (settlement, input, call) => post(
1912
+ `/leaderboard-settlements/${identifier.parse(settlement)}/solana-payouts`,
1913
+ solanaPayoutSchema,
1914
+ solanaPayoutInputSchema.parse(withActionId(input)),
1915
+ call
1916
+ ),
1917
+ /**
1918
+ * Reads the outcome of a settlement's unsettled payout batches on chain and marks the shares
1919
+ * they paid. Safe to repeat. Requires review permission.
1920
+ *
1921
+ * @experimental A minor release can change this method and its result.
1922
+ */
1923
+ confirmSolanaPayout: (settlement, input = {}, call) => post(
1924
+ `/leaderboard-settlements/${identifier.parse(settlement)}/solana-payouts/confirm`,
1925
+ solanaPayoutConfirmationResultSchema,
1926
+ solanaPayoutConfirmationSchema.parse(withActionId(input)),
1927
+ call
1928
+ ),
1929
+ /**
1930
+ * A settlement's Solana payouts with their batches, newest first. Requires read permission.
1931
+ *
1932
+ * @experimental A minor release can change this method and its result.
1933
+ */
1934
+ solanaPayouts: (settlement, query = {}, call) => get(
1935
+ `/leaderboard-settlements/${identifier.parse(settlement)}/solana-payouts${queryString(solanaPayoutQuerySchema.parse(query))}`,
1936
+ solanaPayoutPageSchema,
1937
+ call
1938
+ ),
1815
1939
  rejectSettlement: (settlement, input, call) => post(
1816
1940
  `/leaderboard-settlements/${identifier.parse(settlement)}/reject`,
1817
1941
  leaderboardSettlementReviewSchema,
@@ -2005,12 +2129,12 @@ function referrals(http) {
2005
2129
  /** @deprecated Use `pause` or `resume`, `qualify` or `resolveReward`. Removed in 2.0.0. */
2006
2130
  control: (input, call) => {
2007
2131
  const parsed = referralControlSchema.parse(withActionId(input));
2008
- const { actionId: actionId2, reason } = parsed;
2132
+ const { actionId: actionId3, reason } = parsed;
2009
2133
  if (parsed.kind === "suspend") {
2010
2134
  return post(
2011
2135
  `/referral-relationships/${parsed.member}/suspend`,
2012
2136
  ok,
2013
- { actionId: actionId2, suspended: parsed.suspended, reason },
2137
+ { actionId: actionId3, suspended: parsed.suspended, reason },
2014
2138
  call
2015
2139
  );
2016
2140
  }
@@ -2018,14 +2142,14 @@ function referrals(http) {
2018
2142
  return post(
2019
2143
  `/referral-programs/${parsed.program}/members/${parsed.member}/qualify`,
2020
2144
  ok,
2021
- { actionId: actionId2, qualified: parsed.qualified, reason },
2145
+ { actionId: actionId3, qualified: parsed.qualified, reason },
2022
2146
  call
2023
2147
  );
2024
2148
  }
2025
2149
  return post(
2026
2150
  `/referral-rewards/${parsed.entitlement}/resolve`,
2027
2151
  ok,
2028
- { actionId: actionId2, reason },
2152
+ { actionId: actionId3, reason },
2029
2153
  call
2030
2154
  );
2031
2155
  }
@@ -2041,11 +2165,33 @@ function trackers(http) {
2041
2165
  /**
2042
2166
  * Creates a tracker as data in test, with the same validation as `defineTracker`; requires
2043
2167
  * `publish`. Name its source with `source`, such as `{ kind: "discord-messages", text: true }`,
2044
- * or an X search with `query` alone. An X tracker's first collection searches from
2045
- * `window.start`. Live refuses it with `promotion-required`: the tracker reaches live through
2046
- * a promotion. A key a deployment already publishes is refused with `tracker-owned-by-code`.
2047
- */
2048
- create: (input, call) => create(
2168
+ * or an X search with `query` alone, a `wallet.programActivity()` source with
2169
+ * `{ kind: "wallet-program-activity", chain, program, instruction, mint, minAmount, anySigner }`,
2170
+ * a `wallet.nfts()` source with `{ kind: "wallet-nfts", collection }`, or a `wallet.stake()`
2171
+ * source with `{ kind: "wallet-stake", chain, voteAccount }`.
2172
+ * An X tracker's first collection searches from `window.start`. Live refuses it with
2173
+ * `promotion-required`: the tracker reaches live through a promotion. A key a deployment
2174
+ * already publishes is refused with `tracker-owned-by-code`.
2175
+ */
2176
+ create: (input, call) => input.source?.kind === "wallet-stake" ? create(
2177
+ "/trackers",
2178
+ trackerStatusSchema,
2179
+ stakeTrackerCreateSchema,
2180
+ input,
2181
+ call
2182
+ ) : input.source?.kind === "wallet-nfts" ? create(
2183
+ "/trackers",
2184
+ trackerStatusSchema,
2185
+ nftTrackerCreateSchema,
2186
+ input,
2187
+ call
2188
+ ) : input.source?.kind === "wallet-program-activity" ? create(
2189
+ "/trackers",
2190
+ trackerStatusSchema,
2191
+ programActivityTrackerCreateSchema,
2192
+ input,
2193
+ call
2194
+ ) : create(
2049
2195
  "/trackers",
2050
2196
  trackerStatusSchema,
2051
2197
  managedTrackerCreateSchema,
@@ -2401,7 +2547,12 @@ function subscriptionSchema(plan) {
2401
2547
  since: z25.number().int(),
2402
2548
  promotionsRefusedAt: z25.number().int(),
2403
2549
  offlineAt: z25.number().int()
2404
- }).nullable().default(null)
2550
+ }).nullable().default(null),
2551
+ discount: z25.object({
2552
+ amount: z25.number().int(),
2553
+ listAmount: z25.number().int(),
2554
+ until: z25.number().int()
2555
+ }).nullable().optional()
2405
2556
  });
2406
2557
  }
2407
2558
  var billingSubscriptionSchema = /* @__PURE__ */ (() => subscriptionSchema(billingPlanSchema))();
@@ -2663,9 +2814,9 @@ function dashboards({ get, post }) {
2663
2814
  * other panels still have results. Requires `read` permission.
2664
2815
  */
2665
2816
  read: (query, call) => {
2666
- const { key, ...rest } = dashboardReadQuerySchema.parse(query);
2817
+ const { key: key2, ...rest } = dashboardReadQuerySchema.parse(query);
2667
2818
  return get(
2668
- `/dashboards/${key}${queryString(rest)}`,
2819
+ `/dashboards/${key2}${queryString(rest)}`,
2669
2820
  dashboardReadSchema,
2670
2821
  call
2671
2822
  );
@@ -2675,15 +2826,15 @@ function dashboards({ get, post }) {
2675
2826
  * `includeArchived`, stays readable, and stays archived when its code deploys again. Live
2676
2827
  * gets the change through a promotion. Requires `publish` permission.
2677
2828
  */
2678
- archive: (key, input, call) => post(
2679
- `/dashboards/${identifier.parse(key)}/archive`,
2829
+ archive: (key2, input, call) => post(
2830
+ `/dashboards/${identifier.parse(key2)}/archive`,
2680
2831
  dashboardLifecycleResultSchema,
2681
2832
  resourceArchiveInputSchema.parse(withActionId(input)),
2682
2833
  call
2683
2834
  ),
2684
2835
  /** Restore an archived dashboard in test. Requires `publish` permission. */
2685
- unarchive: (key, input, call) => post(
2686
- `/dashboards/${identifier.parse(key)}/unarchive`,
2836
+ unarchive: (key2, input, call) => post(
2837
+ `/dashboards/${identifier.parse(key2)}/unarchive`,
2687
2838
  dashboardLifecycleResultSchema,
2688
2839
  resourceArchiveInputSchema.parse(withActionId(input)),
2689
2840
  call
@@ -2880,6 +3031,35 @@ function attempts({ get, post }) {
2880
3031
  submitSchema.parse(withActionId(input)),
2881
3032
  call
2882
3033
  ),
3034
+ /**
3035
+ * Completes a quest from a Solana transaction a member signed: Relay reads the transaction at
3036
+ * `finalized` on `chain` (mainnet by default) and runs a normal attempt for the member whose
3037
+ * linked wallet signed it, which the quest's evaluator decides, with the transaction in
3038
+ * `ctx.action`. Requires `ingest` permission. The transaction must have succeeded and carry the
3039
+ * quest's memo (`solanaActionMemo({ quest, reference? })` in an SPL Memo instruction); only a
3040
+ * member-submitted `manual()` quest without input accepts one. Resolves with the queued attempt,
3041
+ * or with the first attempt when the signature was already submitted.
3042
+ *
3043
+ * Refusals: 409 `transaction-not-final` (with `Retry-After`) until the transaction is
3044
+ * finalized, about 13 seconds after it lands, so retry it; 422 `transaction-failed`; 422
3045
+ * `transaction-not-for-quest` when it carries no memo for this quest; 404 `wallet-not-linked`
3046
+ * when no signer is a member's linked wallet; 409 `account-ambiguous` when signers belong to
3047
+ * different members; 422 `quest-not-transaction-completable` for any other kind of quest; on a
3048
+ * quest with check-in stations, 422 `station-unknown` when the memo names none of them and 409
3049
+ * `station-closed` when the station was closed at the transaction's block time, or 409
3050
+ * `station-revoked` when an operator revoked it (`quests.stations.revoke`), whenever it was
3051
+ * signed; 502
3052
+ * `unavailable` when the Solana read failed, so retry it; 429 `rate-limited` past the project
3053
+ * environment's budget of 1,500 reads per 10 minutes.
3054
+ *
3055
+ * @experimental A minor release can change this method and its result.
3056
+ */
3057
+ submitSolanaTransaction: (input, call) => post(
3058
+ "/attempts/solana-transaction",
3059
+ attemptSchema,
3060
+ solanaTransactionSubmissionSchema.parse(input),
3061
+ call
3062
+ ),
2883
3063
  /**
2884
3064
  * Accepts or rejects an attempt waiting for review, at the `generation` the reviewer saw,
2885
3065
  * with a reason; requires `review` permission.
@@ -3007,181 +3187,22 @@ function passes({ post }) {
3007
3187
  }
3008
3188
  var passesApi = (http) => passes(http);
3009
3189
 
3010
- // src/server/completions.ts
3011
- import * as z31 from "zod";
3012
- var completionRevokeSchema = /* @__PURE__ */ (() => z31.object({
3013
- actionId: identifier,
3014
- reason: z31.string().trim().min(1).max(500),
3015
- freeOccurrence: z31.boolean().default(false)
3016
- }).strict())();
3017
- var RevokedEntitlementOutcome = {
3018
- /** No other completion grants the reward: it is void, after cancelling a handover in progress. */
3019
- Voided: "voided",
3020
- /** Lowered to the best tier another completion grants, after cancelling a handover in progress. */
3021
- Downgraded: "downgraded",
3022
- /** Another completion grants the same tier, or it was already void. */
3023
- Kept: "kept",
3024
- /** Already collected: its earned tier follows the other completions, and the item stays handed over. */
3025
- Flagged: "flagged"
3026
- };
3027
- var RevokedDeliveryOutcome = {
3028
- /** The role was delivered and stays: remove it in Discord if appropriate. */
3029
- Flagged: "flagged",
3030
- /** The grant was stopped before any call to Discord. */
3031
- Cancelled: "cancelled",
3032
- /** The grant was stopped, but a call to Discord may already have been sent and can still land. */
3033
- InFlight: "in-flight",
3034
- /** The grant had failed, so Discord never received the role. */
3035
- NotDelivered: "not-delivered"
3036
- };
3037
- var RevokedReferralOutcome = {
3038
- /** The inviter's rewards for this member are reversed. */
3039
- Unqualified: "unqualified",
3040
- /** Qualified on another accepted completion of the program's quest instead. */
3041
- Requalified: "requalified"
3042
- };
3043
- var entitlementOutcomeSchema = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3044
- var deliveryOutcomeSchema = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3045
- var referralOutcomeSchema = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3046
- var completionRevocationSchema = /* @__PURE__ */ (() => z31.object({
3047
- completion: identifier,
3048
- /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
3049
- quest: identifier,
3050
- member: identifier,
3051
- /** What paid the revoked completion. `source.id` repeats `quest`. */
3052
- source: completionSourceSchema.optional(),
3053
- revokedAt: z31.number(),
3054
- occurrenceFreed: z31.boolean(),
3055
- badges: z31.array(z31.object({ badge: identifier, stillAwarded: z31.boolean() })).optional(),
3056
- groups: z31.array(z31.object({ group: identifier, stillMember: z31.boolean() })).optional(),
3057
- points: z31.array(
3058
- z31.object({
3059
- entry: identifier,
3060
- balance: identifier,
3061
- reversal: identifier.nullable(),
3062
- reversed: z31.number().int(),
3063
- unreversed: z31.number().int()
3064
- })
3065
- ),
3066
- entitlements: z31.array(
3067
- z31.object({
3068
- entitlement: identifier,
3069
- reward: identifier,
3070
- outcome: entitlementOutcomeSchema,
3071
- status: z31.string()
3072
- })
3073
- ),
3074
- deliveries: z31.array(
3075
- z31.object({
3076
- delivery: z31.string(),
3077
- roleId: z31.string(),
3078
- outcome: deliveryOutcomeSchema,
3079
- /**
3080
- * By Relay's records, another accepted, unrevoked completion of the member also granted this
3081
- * role to the same Discord account and server. Relay does not read Discord's membership.
3082
- */
3083
- stillGranted: z31.boolean()
3084
- })
3085
- ),
3086
- referrals: z31.array(
3087
- z31.object({
3088
- program: identifier,
3089
- outcome: referralOutcomeSchema
3090
- })
3091
- ),
3092
- streakMilestone: z31.boolean(),
3093
- budgets: z31.array(
3094
- z31.object({ budget: identifier, released: z31.number().int().nonnegative() })
3095
- ).optional()
3096
- }))();
3097
- var completionRestoreSchema = /* @__PURE__ */ (() => z31.object({
3098
- actionId: identifier,
3099
- reason: z31.string().trim().min(1).max(500)
3100
- }).strict())();
3101
- var RestoredEntitlementOutcome = {
3102
- /** The revocation voided it, and it is available again. */
3103
- Restored: "restored",
3104
- /** The revocation lowered or flagged it: its earned tier is the completion's again. */
3105
- Raised: "raised",
3106
- /** It changed since the revocation (an operator restored, voided or corrected it), so it stays. */
3107
- Kept: "kept"
3108
- };
3109
- var RestoredDeliveryOutcome = {
3110
- /** The grant had not reached Discord, and it is queued again. */
3111
- Requeued: "requeued",
3112
- /** The grant counts again for reconciliation, and its delivery status stays. */
3113
- Kept: "kept"
3114
- };
3115
- var RestoredReferralOutcome = {
3116
- /** The member qualifies on this completion again. */
3117
- Qualified: "qualified",
3118
- /** The program is disabled or gone, or the referral is suspended, so nothing changed. */
3119
- Kept: "kept"
3120
- };
3121
- var openOutcome = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3122
- var completionRestorationSchema = /* @__PURE__ */ (() => z31.object({
3123
- completion: identifier,
3124
- /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
3125
- quest: identifier,
3126
- member: identifier,
3127
- source: completionSourceSchema.optional(),
3128
- restoredAt: z31.number(),
3129
- points: z31.array(
3130
- z31.object({
3131
- entry: identifier,
3132
- balance: identifier,
3133
- reversal: identifier,
3134
- amount: z31.number().int()
3135
- })
3136
- ),
3137
- badges: z31.array(z31.object({ badge: identifier })),
3138
- groups: z31.array(z31.object({ group: identifier, added: z31.boolean() })),
3139
- entitlements: z31.array(
3140
- z31.object({
3141
- entitlement: identifier,
3142
- reward: identifier,
3143
- outcome: openOutcome,
3144
- status: z31.string()
3145
- })
3146
- ),
3147
- deliveries: z31.array(
3148
- z31.object({
3149
- delivery: z31.string(),
3150
- roleId: z31.string(),
3151
- outcome: openOutcome
3152
- })
3153
- ),
3154
- referrals: z31.array(
3155
- z31.object({
3156
- program: identifier,
3157
- outcome: openOutcome
3158
- })
3159
- ),
3160
- streakMilestone: z31.boolean(),
3161
- budgets: z31.array(
3162
- z31.object({ budget: identifier, charged: z31.number().int().nonnegative() })
3163
- ).optional()
3164
- }))();
3165
- var completionRevocationShortfallSchema = /* @__PURE__ */ (() => z31.object({
3166
- completion: identifier,
3167
- quest: identifier,
3168
- revokedAt: z31.number().int().nonnegative().safe(),
3169
- unreversedPoints: z31.record(identifier, z31.number().int().positive().safe())
3170
- }))();
3171
- var revokedCompletionSchema = /* @__PURE__ */ (() => z31.object({
3172
- completion: identifier,
3173
- quest: identifier,
3174
- /** The completion key: its occurrence, such as `once` or a day. */
3175
- key: z31.string(),
3176
- revokedAt: z31.number().int().nonnegative().safe(),
3177
- /** Why it was revoked, and what the revoke did, which a restore re-applies. */
3178
- reason: z31.string().optional(),
3179
- revocation: completionRevocationSchema.optional()
3180
- }))();
3181
-
3182
3190
  // src/server/client/completions.ts
3183
- function completions({ post }) {
3191
+ function completions({ get, post }) {
3184
3192
  return {
3193
+ /**
3194
+ * One page of a member's completions that count (not revoked), of every quest and leaderboard
3195
+ * prize or of one `quest`, ordered by quest ID, then completion ID; requires `read`
3196
+ * permission. Pass a page's `nextCursor` back as `cursor` for the next page. Fails with 404
3197
+ * `not-found` for a member who has not joined the project.
3198
+ *
3199
+ * @experimental A minor release can change the completions list.
3200
+ */
3201
+ list: (query, call) => get(
3202
+ `/completions${queryString(memberCompletionQuerySchema.parse(query))}`,
3203
+ memberCompletionPageSchema,
3204
+ call
3205
+ ),
3185
3206
  /**
3186
3207
  * Revokes an accepted completion with a reason; requires `review` permission. In one
3187
3208
  * transaction it reverses the completion's points, voids its undelivered tiered rewards and
@@ -3221,6 +3242,35 @@ function completions({ post }) {
3221
3242
  completionRestoreSchema.parse(withActionId(body)),
3222
3243
  call
3223
3244
  )
3245
+ ),
3246
+ /**
3247
+ * Records what your server did off-platform for a completion, such as minting a badge or
3248
+ * sending a payout, by the transaction that did it; requires `points` permission. A completion
3249
+ * holds one receipt per `key`: the same key with the same values answers the stored receipt, so
3250
+ * a retry is safe, and other values fail with 409 `receipt-conflict`. A completion holds at most
3251
+ * 20 receipts (409 `receipt-limit`). Relay does not read the chain. Console shows the receipt
3252
+ * on the completion, with an explorer link on Solana mainnet and devnet, and the audit history
3253
+ * records it. A revoked completion keeps its receipts, and takes new ones. Erasing the member
3254
+ * deletes them.
3255
+ *
3256
+ * @experimental A minor release can change completion receipts.
3257
+ */
3258
+ recordReceipt: (completion, body, call) => post(
3259
+ `/completions/${identifier.parse(completion)}/receipts`,
3260
+ completionReceiptSchema,
3261
+ completionReceiptInputSchema.parse(withActionId(body)),
3262
+ call
3263
+ ),
3264
+ /**
3265
+ * The completion's receipts, oldest first; requires `read` permission. Fails with 404
3266
+ * `not-found` for a completion this project and environment don't have.
3267
+ *
3268
+ * @experimental A minor release can change completion receipts.
3269
+ */
3270
+ receipts: (completion, call) => get(
3271
+ `/completions/${identifier.parse(completion)}/receipts`,
3272
+ completionReceiptListSchema,
3273
+ call
3224
3274
  )
3225
3275
  };
3226
3276
  }
@@ -3260,20 +3310,20 @@ function handover({ post }) {
3260
3310
  var handoverApi = (http) => handover(http);
3261
3311
 
3262
3312
  // src/server/entitlements.ts
3263
- import * as z32 from "zod";
3264
- var managedEntitlementQuerySchema = /* @__PURE__ */ (() => z32.strictObject({
3265
- q: z32.string().max(200).optional(),
3266
- status: z32.string().min(1).max(50).optional(),
3313
+ import * as z31 from "zod";
3314
+ var managedEntitlementQuerySchema = /* @__PURE__ */ (() => z31.strictObject({
3315
+ q: z31.string().max(200).optional(),
3316
+ status: z31.string().min(1).max(50).optional(),
3267
3317
  limit: pageLimit,
3268
3318
  cursor: pageCursorSchema.optional()
3269
3319
  }))();
3270
- var managedEntitlementPageSchema = /* @__PURE__ */ (() => z32.object({
3271
- items: z32.array(entitlementSchema),
3272
- people: z32.array(personSchema),
3273
- total: z32.number().int().nonnegative(),
3274
- nextCursor: z32.string().nullable()
3320
+ var managedEntitlementPageSchema = /* @__PURE__ */ (() => z31.object({
3321
+ items: z31.array(entitlementSchema),
3322
+ people: z31.array(personSchema),
3323
+ total: z31.number().int().nonnegative(),
3324
+ nextCursor: z31.string().nullable()
3275
3325
  }))();
3276
- var managedEntitlementSchema = /* @__PURE__ */ (() => z32.object({
3326
+ var managedEntitlementSchema = /* @__PURE__ */ (() => z31.object({
3277
3327
  entitlement: entitlementSchema,
3278
3328
  person: personSchema
3279
3329
  }))();
@@ -3365,11 +3415,11 @@ function collection({ post }) {
3365
3415
  var collectionApi = (http) => collection(http);
3366
3416
 
3367
3417
  // src/server/client/operations.ts
3368
- import * as z33 from "zod";
3418
+ import * as z32 from "zod";
3369
3419
  function operations({ get, post }) {
3370
3420
  return {
3371
3421
  /** Every paused or resumed operation: redemptions and each quest's participation; requires `read`. */
3372
- list: (call) => get("/operations", z33.array(operationSchema), call),
3422
+ list: (call) => get("/operations", z32.array(operationSchema), call),
3373
3423
  /**
3374
3424
  * Pauses or resumes redemptions or one quest's participation, against the `revision` the
3375
3425
  * operator saw, with a reason; requires `publish` permission.
@@ -3405,7 +3455,7 @@ function redemptions(http) {
3405
3455
  var redemptionsApi = (http) => redemptions(http);
3406
3456
 
3407
3457
  // src/server/client/inventory.ts
3408
- import * as z34 from "zod";
3458
+ import * as z33 from "zod";
3409
3459
  function inventory({ create, get, post }) {
3410
3460
  return {
3411
3461
  /** Includes archived items and revision fences; requires read permission. */
@@ -3439,7 +3489,7 @@ function inventory({ create, get, post }) {
3439
3489
  call
3440
3490
  ),
3441
3491
  /** Every stock item with its counts and the offers that sell it; requires `read` permission. */
3442
- list: (call) => get("/stock-items", z34.array(managedStockItemSchema), call),
3492
+ list: (call) => get("/stock-items", z33.array(managedStockItemSchema), call),
3443
3493
  createItem: (input, call) => create(
3444
3494
  "/stock-items",
3445
3495
  stockItemSchema,
@@ -3454,7 +3504,7 @@ function inventory({ create, get, post }) {
3454
3504
  stockInputSchema.parse(withActionId(input)),
3455
3505
  call
3456
3506
  ),
3457
- catalog: (call) => get("/pickup-inventory", z34.array(pickupCatalogSchema), call),
3507
+ catalog: (call) => get("/pickup-inventory", z33.array(pickupCatalogSchema), call),
3458
3508
  configure: (input, call) => post(
3459
3509
  "/pickup-inventory",
3460
3510
  pickupCatalogSchema,
@@ -3471,7 +3521,7 @@ function inventory({ create, get, post }) {
3471
3521
  var inventoryApi = (http) => inventory(http);
3472
3522
 
3473
3523
  // src/server/client/offers.ts
3474
- import * as z35 from "zod";
3524
+ import * as z34 from "zod";
3475
3525
  function offers({ get, post }) {
3476
3526
  return {
3477
3527
  /**
@@ -3509,7 +3559,7 @@ function offers({ get, post }) {
3509
3559
  ),
3510
3560
  call
3511
3561
  ),
3512
- list: (call) => get("/offers", z35.array(offerSchema), call),
3562
+ list: (call) => get("/offers", z34.array(offerSchema), call),
3513
3563
  /**
3514
3564
  * Every redemption, or one member's, newest first, in one unbounded response.
3515
3565
  *
@@ -3517,7 +3567,7 @@ function offers({ get, post }) {
3517
3567
  */
3518
3568
  redemptions: (input = {}, call) => get(
3519
3569
  `/redemptions${queryString({ member: input.member })}`,
3520
- z35.array(redemptionSchema),
3570
+ z34.array(redemptionSchema),
3521
3571
  call
3522
3572
  ),
3523
3573
  /** Pauses or resumes an offer at the revision the operator saw. */
@@ -3542,16 +3592,16 @@ function offers({ get, post }) {
3542
3592
  var offersApi = (http) => offers(http);
3543
3593
 
3544
3594
  // src/server/client/tokens.ts
3545
- import * as z38 from "zod";
3595
+ import * as z37 from "zod";
3546
3596
 
3547
3597
  // src/server/api-keys.ts
3548
- import * as z37 from "zod";
3598
+ import * as z36 from "zod";
3549
3599
 
3550
3600
  // src/server/permissions.ts
3551
- import * as z36 from "zod";
3552
- var environmentSchema = /* @__PURE__ */ (() => z36.enum(["test", "live"]))();
3553
- var roleSchema = /* @__PURE__ */ (() => z36.enum(["editor", "reviewer", "staff"]))();
3554
- var permissionSchema = /* @__PURE__ */ (() => z36.enum([
3601
+ import * as z35 from "zod";
3602
+ var environmentSchema = /* @__PURE__ */ (() => z35.enum(["test", "live"]))();
3603
+ var roleSchema = /* @__PURE__ */ (() => z35.enum(["editor", "reviewer", "staff"]))();
3604
+ var permissionSchema = /* @__PURE__ */ (() => z35.enum([
3555
3605
  "read",
3556
3606
  "publish",
3557
3607
  "review",
@@ -3571,7 +3621,7 @@ var permissionSchema = /* @__PURE__ */ (() => z36.enum([
3571
3621
  */
3572
3622
  "enroll"
3573
3623
  ]))();
3574
- var permissionListSchema = /* @__PURE__ */ (() => z36.array(z36.string()).transform(
3624
+ var permissionListSchema = /* @__PURE__ */ (() => z35.array(z35.string()).transform(
3575
3625
  (values) => values.filter(
3576
3626
  (value) => permissionSchema.safeParse(value).success
3577
3627
  )
@@ -3581,8 +3631,8 @@ var rolePermissions = {
3581
3631
  reviewer: ["read", "review"],
3582
3632
  staff: ["read", "confirm", "handover"]
3583
3633
  };
3584
- var projectRoleSchema = /* @__PURE__ */ (() => z36.enum([...roleSchema.options, "viewer"]))();
3585
- var projectPermissionSchema = /* @__PURE__ */ (() => z36.enum([
3634
+ var projectRoleSchema = /* @__PURE__ */ (() => z35.enum([...roleSchema.options, "viewer"]))();
3635
+ var projectPermissionSchema = /* @__PURE__ */ (() => z35.enum([
3586
3636
  ...permissionSchema.options,
3587
3637
  "dashboards"
3588
3638
  ]))();
@@ -3594,55 +3644,55 @@ var projectRolePermissions = {
3594
3644
  };
3595
3645
 
3596
3646
  // src/server/api-keys.ts
3597
- var ingestTrackerScopeSchema = /* @__PURE__ */ (() => z37.array(identifier).min(1).max(100).nullable())();
3598
- var tokenScopeInputSchema = /* @__PURE__ */ (() => z37.object({ ingestTrackers: ingestTrackerScopeSchema }).strict())();
3599
- var tokenInputSchema = /* @__PURE__ */ (() => z37.object({
3600
- name: z37.string().trim().min(1).max(80),
3647
+ var ingestTrackerScopeSchema = /* @__PURE__ */ (() => z36.array(identifier).min(1).max(100).nullable())();
3648
+ var tokenScopeInputSchema = /* @__PURE__ */ (() => z36.object({ ingestTrackers: ingestTrackerScopeSchema }).strict())();
3649
+ var tokenInputSchema = /* @__PURE__ */ (() => z36.object({
3650
+ name: z36.string().trim().min(1).max(80),
3601
3651
  project: identifier,
3602
3652
  environment: environmentSchema,
3603
- permissions: z37.array(permissionSchema).min(1),
3653
+ permissions: z36.array(permissionSchema).min(1),
3604
3654
  ingestTrackers: ingestTrackerScopeSchema.optional(),
3605
- days: z37.number().int().min(1).max(90).default(30)
3655
+ days: z36.number().int().min(1).max(90).default(30)
3606
3656
  }).strict())();
3607
- var tokenSchema = /* @__PURE__ */ (() => z37.object({
3608
- id: z37.string(),
3609
- name: z37.string(),
3610
- project: z37.string(),
3657
+ var tokenSchema = /* @__PURE__ */ (() => z36.object({
3658
+ id: z36.string(),
3659
+ name: z36.string(),
3660
+ project: z36.string(),
3611
3661
  environment: environmentSchema,
3612
3662
  permissions: permissionListSchema,
3613
3663
  ingestTrackers: ingestTrackerScopeSchema.optional(),
3614
- expiresAt: z37.number()
3664
+ expiresAt: z36.number()
3615
3665
  }))();
3616
- var issuedTokenSchema = /* @__PURE__ */ (() => tokenSchema.extend({ token: z37.string() }))();
3617
- var serviceKeyInputSchema = /* @__PURE__ */ (() => z37.object({
3618
- name: z37.string().trim().min(1).max(80),
3619
- permissions: z37.array(permissionSchema).min(1).refine(
3666
+ var issuedTokenSchema = /* @__PURE__ */ (() => tokenSchema.extend({ token: z36.string() }))();
3667
+ var serviceKeyInputSchema = /* @__PURE__ */ (() => z36.object({
3668
+ name: z36.string().trim().min(1).max(80),
3669
+ permissions: z36.array(permissionSchema).min(1).refine(
3620
3670
  (permissions) => !permissions.includes("access"),
3621
3671
  "Service keys cannot hold the access permission"
3622
3672
  ),
3623
3673
  /** Days until the first secret expires. Omit it for a key that never expires. */
3624
- expiresInDays: z37.number().int().min(1).max(3650).optional()
3674
+ expiresInDays: z36.number().int().min(1).max(3650).optional()
3625
3675
  }).strict())();
3626
- var serviceKeySchema = /* @__PURE__ */ (() => z37.object({
3627
- id: z37.string().uuid(),
3628
- organization: z37.string(),
3629
- project: z37.string(),
3676
+ var serviceKeySchema = /* @__PURE__ */ (() => z36.object({
3677
+ id: z36.string().uuid(),
3678
+ organization: z36.string(),
3679
+ project: z36.string(),
3630
3680
  environment: environmentSchema,
3631
- name: z37.string(),
3681
+ name: z36.string(),
3632
3682
  permissions: permissionListSchema,
3633
3683
  /** The Clerk user ID of the administrator who created it. */
3634
- createdBy: z37.string(),
3635
- createdAt: z37.number(),
3684
+ createdBy: z36.string(),
3685
+ createdAt: z36.number(),
3636
3686
  /** The latest use of any of its secrets, revoked ones included; null when none was used. */
3637
- lastUsedAt: z37.number().nullable(),
3687
+ lastUsedAt: z36.number().nullable(),
3638
3688
  /** Its working secrets, oldest first. Any of them authenticates the key. */
3639
- secrets: z37.array(credentialSecretSchema)
3689
+ secrets: z36.array(credentialSecretSchema)
3640
3690
  }))();
3641
3691
  var issuedServiceKeySchema = /* @__PURE__ */ (() => serviceKeySchema.extend({
3642
- secret: z37.string().uuid(),
3643
- token: z37.string()
3692
+ secret: z36.string().uuid(),
3693
+ token: z36.string()
3644
3694
  }))();
3645
- var automationKeyPermissionSchema = /* @__PURE__ */ (() => z37.enum([
3695
+ var automationKeyPermissionSchema = /* @__PURE__ */ (() => z36.enum([
3646
3696
  "read",
3647
3697
  "publish",
3648
3698
  "inventory",
@@ -3650,41 +3700,47 @@ var automationKeyPermissionSchema = /* @__PURE__ */ (() => z37.enum([
3650
3700
  "ingest",
3651
3701
  "enroll"
3652
3702
  ]))();
3653
- var automationKeyInputSchema = /* @__PURE__ */ (() => z37.object({
3654
- name: z37.string().trim().min(1).max(80),
3655
- permissions: z37.array(automationKeyPermissionSchema).min(1),
3656
- /** The projects it reaches. Omit it for every project of the organization, current and future. */
3657
- projects: z37.array(identifier).min(1).max(100).optional(),
3703
+ var automationKeyInputSchema = /* @__PURE__ */ (() => z36.object({
3704
+ name: z36.string().trim().min(1).max(80),
3705
+ permissions: z36.array(automationKeyPermissionSchema).min(1),
3706
+ /**
3707
+ * The projects it reaches. Omit it for every project of the organization, current and future.
3708
+ * An empty list, allowed only with `createProjects`, reaches only the projects it creates.
3709
+ */
3710
+ projects: z36.array(identifier).max(100).optional(),
3658
3711
  /** Whether it may create projects. A project it creates joins its `projects` list. */
3659
- createProjects: z37.boolean().default(false),
3712
+ createProjects: z36.boolean().default(false),
3660
3713
  /** Days until the first secret expires. Omit it for a key that never expires. */
3661
- expiresInDays: z37.number().int().min(1).max(3650).optional()
3662
- }).strict())();
3663
- var automationKeySchema = /* @__PURE__ */ (() => z37.object({
3664
- id: z37.string().uuid(),
3665
- organization: z37.string(),
3666
- name: z37.string(),
3714
+ expiresInDays: z36.number().int().min(1).max(3650).optional()
3715
+ }).strict().refine((key2) => key2.projects?.length !== 0 || key2.createProjects, {
3716
+ message: "Choose a project, or let the key create projects",
3717
+ path: ["projects"]
3718
+ }))();
3719
+ var automationKeySchema = /* @__PURE__ */ (() => z36.object({
3720
+ id: z36.string().uuid(),
3721
+ organization: z36.string(),
3722
+ name: z36.string(),
3667
3723
  permissions: permissionListSchema,
3668
3724
  /** The projects it reaches; null for every project of the organization. */
3669
- projects: z37.array(z37.string()).nullable(),
3670
- createProjects: z37.boolean(),
3725
+ projects: z36.array(z36.string()).nullable(),
3726
+ createProjects: z36.boolean(),
3671
3727
  /** The Clerk user ID of the administrator who created it. */
3672
- createdBy: z37.string(),
3673
- createdAt: z37.number(),
3728
+ createdBy: z36.string(),
3729
+ createdAt: z36.number(),
3674
3730
  /** The latest use of any of its secrets, revoked ones included; null when none was used. */
3675
- lastUsedAt: z37.number().nullable(),
3731
+ lastUsedAt: z36.number().nullable(),
3676
3732
  /** Its working secrets, oldest first. Any of them authenticates the key. */
3677
- secrets: z37.array(credentialSecretSchema)
3733
+ secrets: z36.array(credentialSecretSchema)
3678
3734
  }))();
3679
3735
  var issuedAutomationKeySchema = /* @__PURE__ */ (() => automationKeySchema.extend({
3680
- secret: z37.string().uuid(),
3681
- token: z37.string()
3736
+ secret: z36.string().uuid(),
3737
+ token: z36.string()
3682
3738
  }))();
3683
3739
 
3684
3740
  // src/server/client/tokens.ts
3685
3741
  function tokens({ get, post, request }) {
3686
3742
  return {
3687
- list: (call) => get("/tokens", z38.array(tokenSchema), call),
3743
+ list: (call) => get("/tokens", z37.array(tokenSchema), call),
3688
3744
  /**
3689
3745
  * Issues a key for one project and environment, limited to permissions the caller holds
3690
3746
  * there. It expires after `days`, 1 to 90 (default 30). The secret `token` is in this
@@ -3693,14 +3749,14 @@ function tokens({ get, post, request }) {
3693
3749
  create: (input, call) => post("/tokens", issuedTokenSchema, tokenInputSchema.parse(input), call),
3694
3750
  /** Replace a personal key's ingestion restriction without changing its secret. */
3695
3751
  scope: (id, input, call) => request(
3696
- `/tokens/${encodeURIComponent(z38.string().min(1).parse(id))}/scope`,
3752
+ `/tokens/${encodeURIComponent(z37.string().min(1).parse(id))}/scope`,
3697
3753
  tokenSchema,
3698
3754
  tokenScopeInputSchema.parse(input),
3699
3755
  "PUT",
3700
3756
  call
3701
3757
  ),
3702
3758
  revoke: (id, call) => request(
3703
- `/tokens/${encodeURIComponent(z38.string().min(1).parse(id))}`,
3759
+ `/tokens/${encodeURIComponent(z37.string().min(1).parse(id))}`,
3704
3760
  ok,
3705
3761
  void 0,
3706
3762
  "DELETE",
@@ -3711,10 +3767,10 @@ function tokens({ get, post, request }) {
3711
3767
  var tokensApi = (http) => tokens(http);
3712
3768
 
3713
3769
  // src/server/client/service-keys.ts
3714
- import * as z39 from "zod";
3770
+ import * as z38 from "zod";
3715
3771
  function serviceKeys({ get, post, request }) {
3716
3772
  return {
3717
- list: (call) => get("/service-keys", z39.array(serviceKeySchema), call),
3773
+ list: (call) => get("/service-keys", z38.array(serviceKeySchema), call),
3718
3774
  /** The secret `token` is in this response only. */
3719
3775
  create: (input, call) => post(
3720
3776
  "/service-keys",
@@ -3727,14 +3783,14 @@ function serviceKeys({ get, post, request }) {
3727
3783
  * them with `revokeSecret`. The new `token` is in this response only.
3728
3784
  */
3729
3785
  addSecret: (id, input = {}, call) => post(
3730
- `/service-keys/${z39.string().uuid().parse(id)}/secrets`,
3786
+ `/service-keys/${z38.string().uuid().parse(id)}/secrets`,
3731
3787
  issuedServiceKeySchema,
3732
3788
  credentialSecretInputSchema.parse(input),
3733
3789
  call
3734
3790
  ),
3735
3791
  /** Stops one secret working. A key's last secret cannot be revoked; revoke the key instead. */
3736
3792
  revokeSecret: (id, secret, call) => request(
3737
- `/service-keys/${z39.string().uuid().parse(id)}/secrets/${z39.string().uuid().parse(secret)}`,
3793
+ `/service-keys/${z38.string().uuid().parse(id)}/secrets/${z38.string().uuid().parse(secret)}`,
3738
3794
  serviceKeySchema,
3739
3795
  void 0,
3740
3796
  "DELETE",
@@ -3742,8 +3798,8 @@ function serviceKeys({ get, post, request }) {
3742
3798
  ),
3743
3799
  /** Deletes the key; every secret stops working. */
3744
3800
  revoke: (id, call) => request(
3745
- `/service-keys/${z39.string().uuid().parse(id)}`,
3746
- z39.null(),
3801
+ `/service-keys/${z38.string().uuid().parse(id)}`,
3802
+ z38.null(),
3747
3803
  void 0,
3748
3804
  "DELETE",
3749
3805
  call
@@ -3753,10 +3809,10 @@ function serviceKeys({ get, post, request }) {
3753
3809
  var serviceKeysApi = (http) => serviceKeys(http);
3754
3810
 
3755
3811
  // src/server/client/automation-keys.ts
3756
- import * as z40 from "zod";
3812
+ import * as z39 from "zod";
3757
3813
  function automationKeys({ get, post, request }) {
3758
3814
  return {
3759
- list: (call) => get("/automation-keys", z40.array(automationKeySchema), call),
3815
+ list: (call) => get("/automation-keys", z39.array(automationKeySchema), call),
3760
3816
  /** The secret `token` is in this response only. */
3761
3817
  create: (input, call) => post(
3762
3818
  "/automation-keys",
@@ -3769,14 +3825,14 @@ function automationKeys({ get, post, request }) {
3769
3825
  * them with `revokeSecret`. The new `token` is in this response only.
3770
3826
  */
3771
3827
  addSecret: (id, input = {}, call) => post(
3772
- `/automation-keys/${z40.string().uuid().parse(id)}/secrets`,
3828
+ `/automation-keys/${z39.string().uuid().parse(id)}/secrets`,
3773
3829
  issuedAutomationKeySchema,
3774
3830
  credentialSecretInputSchema.parse(input),
3775
3831
  call
3776
3832
  ),
3777
3833
  /** Stops one secret working. A key's last secret cannot be revoked; revoke the key instead. */
3778
3834
  revokeSecret: (id, secret, call) => request(
3779
- `/automation-keys/${z40.string().uuid().parse(id)}/secrets/${z40.string().uuid().parse(secret)}`,
3835
+ `/automation-keys/${z39.string().uuid().parse(id)}/secrets/${z39.string().uuid().parse(secret)}`,
3780
3836
  automationKeySchema,
3781
3837
  void 0,
3782
3838
  "DELETE",
@@ -3784,8 +3840,8 @@ function automationKeys({ get, post, request }) {
3784
3840
  ),
3785
3841
  /** Deletes the key; every secret stops working. */
3786
3842
  revoke: (id, call) => request(
3787
- `/automation-keys/${z40.string().uuid().parse(id)}`,
3788
- z40.null(),
3843
+ `/automation-keys/${z39.string().uuid().parse(id)}`,
3844
+ z39.null(),
3789
3845
  void 0,
3790
3846
  "DELETE",
3791
3847
  call
@@ -3795,26 +3851,26 @@ function automationKeys({ get, post, request }) {
3795
3851
  var automationKeysApi = (http) => automationKeys(http);
3796
3852
 
3797
3853
  // src/server/client/grants.ts
3798
- import * as z42 from "zod";
3854
+ import * as z41 from "zod";
3799
3855
 
3800
3856
  // src/server/grants.ts
3801
- import * as z41 from "zod";
3802
- var grantSchema = /* @__PURE__ */ (() => z41.object({
3803
- subject: z41.string().min(1).max(200),
3804
- roles: z41.array(roleSchema),
3805
- environments: z41.array(environmentSchema)
3857
+ import * as z40 from "zod";
3858
+ var grantSchema = /* @__PURE__ */ (() => z40.object({
3859
+ subject: z40.string().min(1).max(200),
3860
+ roles: z40.array(roleSchema),
3861
+ environments: z40.array(environmentSchema)
3806
3862
  }).strict())();
3807
- var projectGrantSchema = /* @__PURE__ */ (() => z41.object({
3863
+ var projectGrantSchema = /* @__PURE__ */ (() => z40.object({
3808
3864
  subject: grantSchema.shape.subject,
3809
- roles: z41.array(projectRoleSchema),
3865
+ roles: z40.array(projectRoleSchema),
3810
3866
  environments: grantSchema.shape.environments,
3811
3867
  /**
3812
3868
  * When the grant stops giving access (epoch ms). Omit it, or send null, for a grant without
3813
3869
  * an end. An ended grant stays listed, so the project's access shows who had it and until when.
3814
3870
  */
3815
- expiresAt: z41.number().int().positive().nullable().optional()
3871
+ expiresAt: z40.number().int().positive().nullable().optional()
3816
3872
  }).strict())();
3817
- var grantRecordSchema = /* @__PURE__ */ (() => z41.object({
3873
+ var grantRecordSchema = /* @__PURE__ */ (() => z40.object({
3818
3874
  ...grantSchema.shape,
3819
3875
  /**
3820
3876
  * Every role the grant gives, `viewer` included, which `roles` leaves out. Absent from Relay
@@ -3822,23 +3878,23 @@ var grantRecordSchema = /* @__PURE__ */ (() => z41.object({
3822
3878
  *
3823
3879
  * @experimental
3824
3880
  */
3825
- projectRoles: z41.array(z41.string()).optional(),
3881
+ projectRoles: z40.array(z40.string()).optional(),
3826
3882
  /**
3827
3883
  * When the grant stops giving access (epoch ms), or null for no end. A grant past it is still
3828
3884
  * listed and gives no permission.
3829
3885
  *
3830
3886
  * @experimental
3831
3887
  */
3832
- expiresAt: z41.number().nullable().optional()
3888
+ expiresAt: z40.number().nullable().optional()
3833
3889
  }))();
3834
- var teamSchema = /* @__PURE__ */ (() => z41.array(
3835
- z41.object({ id: z41.string(), label: z41.string() })
3890
+ var teamSchema = /* @__PURE__ */ (() => z40.array(
3891
+ z40.object({ id: z40.string(), label: z40.string() })
3836
3892
  ))();
3837
3893
 
3838
3894
  // src/server/client/grants.ts
3839
3895
  function grants({ get, request }) {
3840
3896
  return {
3841
- list: (call) => get("/grants", z42.array(grantRecordSchema), call),
3897
+ list: (call) => get("/grants", z41.array(grantRecordSchema), call),
3842
3898
  /**
3843
3899
  * Replaces one person's roles, environments and end date on the project. The audit log
3844
3900
  * records it. `viewer` and `expiresAt` are experimental.
@@ -3863,14 +3919,14 @@ function team({ get }) {
3863
3919
  var teamApi = (http) => team(http);
3864
3920
 
3865
3921
  // src/server/client/webhooks.ts
3866
- import * as z43 from "zod";
3922
+ import * as z42 from "zod";
3867
3923
  function webhooks({ get, post, request }) {
3868
3924
  function rotateWebhookSecret(id, inputOrCall, call) {
3869
3925
  const isInput = call !== void 0 || inputOrCall !== void 0 && "actionId" in inputOrCall;
3870
3926
  const input = isInput ? inputOrCall ?? {} : {};
3871
3927
  const options = isInput ? call : inputOrCall;
3872
3928
  return post(
3873
- `/webhooks/${z43.string().uuid().parse(id)}/rotate-secret`,
3929
+ `/webhooks/${z42.string().uuid().parse(id)}/rotate-secret`,
3874
3930
  webhookSecretSchema,
3875
3931
  webhookRotateInputSchema.parse(withActionId(input)),
3876
3932
  options
@@ -3878,7 +3934,7 @@ function webhooks({ get, post, request }) {
3878
3934
  }
3879
3935
  return {
3880
3936
  state: (id, call) => get(
3881
- `/webhooks/${z43.string().uuid().parse(id)}/state`,
3937
+ `/webhooks/${z42.string().uuid().parse(id)}/state`,
3882
3938
  webhookEndpointStateSchema,
3883
3939
  call
3884
3940
  ),
@@ -3889,24 +3945,24 @@ function webhooks({ get, post, request }) {
3889
3945
  call
3890
3946
  ),
3891
3947
  delete: (id, input, call) => post(
3892
- `/webhooks/${z43.string().uuid().parse(id)}/delete`,
3948
+ `/webhooks/${z42.string().uuid().parse(id)}/delete`,
3893
3949
  webhookEndpointStateSchema,
3894
3950
  webhookDeleteInputSchema.parse(withActionId(input)),
3895
3951
  call
3896
3952
  ),
3897
3953
  pause: (id, input = {}, call) => post(
3898
- `/webhooks/${z43.string().uuid().parse(id)}/pause`,
3954
+ `/webhooks/${z42.string().uuid().parse(id)}/pause`,
3899
3955
  webhookEndpointSchema,
3900
3956
  webhookControlInputSchema.parse(withActionId(input)),
3901
3957
  call
3902
3958
  ),
3903
3959
  resume: (id, input = {}, call) => post(
3904
- `/webhooks/${z43.string().uuid().parse(id)}/resume`,
3960
+ `/webhooks/${z42.string().uuid().parse(id)}/resume`,
3905
3961
  webhookEndpointSchema,
3906
3962
  webhookControlInputSchema.parse(withActionId(input)),
3907
3963
  call
3908
3964
  ),
3909
- list: (call) => get("/webhooks", z43.array(webhookEndpointSchema), call),
3965
+ list: (call) => get("/webhooks", z42.array(webhookEndpointSchema), call),
3910
3966
  /** Pass an `actionId` to recover the endpoint and its secret after a lost answer. */
3911
3967
  create: (input, call) => post(
3912
3968
  "/webhooks",
@@ -3915,7 +3971,7 @@ function webhooks({ get, post, request }) {
3915
3971
  call
3916
3972
  ),
3917
3973
  update: (id, input, call) => request(
3918
- `/webhooks/${z43.string().uuid().parse(id)}`,
3974
+ `/webhooks/${z42.string().uuid().parse(id)}`,
3919
3975
  webhookEndpointSchema,
3920
3976
  webhookUpdateSchema.parse(input),
3921
3977
  "PUT",
@@ -3923,14 +3979,14 @@ function webhooks({ get, post, request }) {
3923
3979
  ),
3924
3980
  /** @deprecated Use pause. Removed in 2.0.0. */
3925
3981
  disable: (id, call) => post(
3926
- `/webhooks/${z43.string().uuid().parse(id)}/disable`,
3982
+ `/webhooks/${z42.string().uuid().parse(id)}/disable`,
3927
3983
  webhookEndpointSchema,
3928
3984
  {},
3929
3985
  call
3930
3986
  ),
3931
3987
  rotateSecret: rotateWebhookSecret,
3932
3988
  deliveries: (id, query = {}, call) => get(
3933
- `/webhooks/${z43.string().uuid().parse(id)}/deliveries${queryString(webhookQuerySchema.parse(query))}`,
3989
+ `/webhooks/${z42.string().uuid().parse(id)}/deliveries${queryString(webhookQuerySchema.parse(query))}`,
3934
3990
  webhookDeliveryPageSchema,
3935
3991
  call
3936
3992
  ),
@@ -3940,7 +3996,7 @@ function webhooks({ get, post, request }) {
3940
3996
  */
3941
3997
  replay: (id, delivery, ...rest) => actionCommand(
3942
3998
  (webhook, input, call) => post(
3943
- `/webhooks/${z43.string().uuid().parse(webhook)}/deliveries/${z43.string().uuid().parse(delivery)}/replay`,
3999
+ `/webhooks/${z42.string().uuid().parse(webhook)}/deliveries/${z42.string().uuid().parse(delivery)}/replay`,
3944
4000
  webhookDeliverySchema,
3945
4001
  webhookControlInputSchema.parse(input),
3946
4002
  call
@@ -3951,7 +4007,7 @@ function webhooks({ get, post, request }) {
3951
4007
  var webhooksApi = (http) => webhooks(http);
3952
4008
 
3953
4009
  // src/server/client/identity-integrations.ts
3954
- import * as z44 from "zod";
4010
+ import * as z43 from "zod";
3955
4011
  function identityIntegrations({
3956
4012
  exchange,
3957
4013
  get,
@@ -3959,7 +4015,7 @@ function identityIntegrations({
3959
4015
  request
3960
4016
  }) {
3961
4017
  return {
3962
- list: (call) => get("/identity-integrations", z44.array(identityIntegrationSchema), call),
4018
+ list: (call) => get("/identity-integrations", z43.array(identityIntegrationSchema), call),
3963
4019
  /** The secret `token` is in this response only. */
3964
4020
  create: (input, call) => post(
3965
4021
  "/identity-integrations",
@@ -3989,7 +4045,7 @@ function identityIntegrations({
3989
4045
  * @deprecated Use `addSecret`, then `revokeSecret` the old secret once your app uses the new one.
3990
4046
  */
3991
4047
  rotate: (id, call) => post(
3992
- `/identity-integrations/${z44.string().uuid().parse(id)}/rotate`,
4048
+ `/identity-integrations/${z43.string().uuid().parse(id)}/rotate`,
3993
4049
  identityIntegrationSecretSchema,
3994
4050
  {},
3995
4051
  call
@@ -3999,7 +4055,7 @@ function identityIntegrations({
3999
4055
  * revoke them with `revokeSecret`. The new `token` is in this response only.
4000
4056
  */
4001
4057
  addSecret: (id, input = {}, call) => post(
4002
- `/identity-integrations/${z44.string().uuid().parse(id)}/secrets`,
4058
+ `/identity-integrations/${z43.string().uuid().parse(id)}/secrets`,
4003
4059
  identityIntegrationSecretSchema,
4004
4060
  credentialSecretInputSchema.parse(input),
4005
4061
  call
@@ -4009,7 +4065,7 @@ function identityIntegrations({
4009
4065
  * environment instead of answering it, as `createIntoAppSecret` does.
4010
4066
  */
4011
4067
  addSecretIntoAppSecret: (id, appSecret, input = {}, call) => post(
4012
- `/identity-integrations/${z44.string().uuid().parse(id)}/secrets`,
4068
+ `/identity-integrations/${z43.string().uuid().parse(id)}/secrets`,
4013
4069
  identityIntegrationAppSecretSchema,
4014
4070
  {
4015
4071
  ...credentialSecretInputSchema.parse(input),
@@ -4022,7 +4078,7 @@ function identityIntegrations({
4022
4078
  * revoked; disconnect the integration with `revoke` instead.
4023
4079
  */
4024
4080
  revokeSecret: (id, secret, call) => request(
4025
- `/identity-integrations/${z44.string().uuid().parse(id)}/secrets/${z44.string().uuid().parse(secret)}`,
4081
+ `/identity-integrations/${z43.string().uuid().parse(id)}/secrets/${z43.string().uuid().parse(secret)}`,
4026
4082
  identityIntegrationSchema,
4027
4083
  void 0,
4028
4084
  "DELETE",
@@ -4030,7 +4086,7 @@ function identityIntegrations({
4030
4086
  ),
4031
4087
  /** Makes one secret never expire. */
4032
4088
  removeSecretExpiry: (id, secret, call) => request(
4033
- `/identity-integrations/${z44.string().uuid().parse(id)}/secrets/${z44.string().uuid().parse(secret)}/expiry`,
4089
+ `/identity-integrations/${z43.string().uuid().parse(id)}/secrets/${z43.string().uuid().parse(secret)}/expiry`,
4034
4090
  identityIntegrationSchema,
4035
4091
  void 0,
4036
4092
  "DELETE",
@@ -4043,7 +4099,7 @@ function identityIntegrations({
4043
4099
  */
4044
4100
  kinds: (call) => get(
4045
4101
  "/identity-integrations/kinds",
4046
- z44.array(identityKindClaimSchema),
4102
+ z43.array(identityKindClaimSchema),
4047
4103
  call
4048
4104
  ),
4049
4105
  /**
@@ -4055,7 +4111,7 @@ function identityIntegrations({
4055
4111
  setAccountVouching: (id, input, call) => (
4056
4112
  // The action ID's receipt makes a repeat apply once, so the client may resend it.
4057
4113
  exchange(
4058
- `/identity-integrations/${z44.string().uuid().parse(id)}/account-vouching`,
4114
+ `/identity-integrations/${z43.string().uuid().parse(id)}/account-vouching`,
4059
4115
  identityIntegrationSchema,
4060
4116
  identityIntegrationAccountVouchingInputSchema.parse(
4061
4117
  withActionId(input)
@@ -4070,8 +4126,8 @@ function identityIntegrations({
4070
4126
  * and keep attributing tracker records; unlink them on the member to stop that.
4071
4127
  */
4072
4128
  revoke: (id, call) => request(
4073
- `/identity-integrations/${z44.string().uuid().parse(id)}`,
4074
- z44.null(),
4129
+ `/identity-integrations/${z43.string().uuid().parse(id)}`,
4130
+ z43.null(),
4075
4131
  void 0,
4076
4132
  "DELETE",
4077
4133
  call
@@ -4081,35 +4137,35 @@ function identityIntegrations({
4081
4137
  var identityIntegrationsApi = (http) => identityIntegrations(http);
4082
4138
 
4083
4139
  // src/server/audit.ts
4084
- import * as z45 from "zod";
4085
- var auditRecordSchema = /* @__PURE__ */ (() => z45.object({
4086
- id: z45.string(),
4087
- action: z45.string(),
4088
- actor: z45.string().nullable(),
4140
+ import * as z44 from "zod";
4141
+ var auditRecordSchema = /* @__PURE__ */ (() => z44.object({
4142
+ id: z44.string(),
4143
+ action: z44.string(),
4144
+ actor: z44.string().nullable(),
4089
4145
  user: operatorUserSchema.nullable().optional(),
4090
- detail: z45.string(),
4091
- at: z45.number(),
4092
- attempt: z45.string().nullable()
4093
- }).refine((record5) => !record5.user || record5.user.id === record5.actor, {
4146
+ detail: z44.string(),
4147
+ at: z44.number(),
4148
+ attempt: z44.string().nullable()
4149
+ }).refine((record3) => !record3.user || record3.user.id === record3.actor, {
4094
4150
  message: "User profile must match the recorded actor",
4095
4151
  path: ["user"]
4096
4152
  }))();
4097
- var auditQuerySchema = /* @__PURE__ */ (() => z45.strictObject({
4098
- category: z45.enum(["reviews", "rewards", "configuration"]).optional(),
4099
- q: z45.string().max(200).optional(),
4153
+ var auditQuerySchema = /* @__PURE__ */ (() => z44.strictObject({
4154
+ category: z44.enum(["reviews", "rewards", "configuration"]).optional(),
4155
+ q: z44.string().max(200).optional(),
4100
4156
  limit: pageLimit,
4101
4157
  cursor: pageCursorSchema.optional()
4102
4158
  }))();
4103
4159
  var auditListQuerySchema = /* @__PURE__ */ (() => auditQuerySchema.extend({
4104
- category: z45.enum(["reviews", "rewards", "configuration", "test-members"]).optional()
4160
+ category: z44.enum(["reviews", "rewards", "configuration", "test-members"]).optional()
4105
4161
  }))();
4106
4162
  var accessHistoryQuerySchema = /* @__PURE__ */ (() => auditQuerySchema.omit({
4107
4163
  category: true
4108
4164
  }))();
4109
- var auditPageSchema = /* @__PURE__ */ (() => z45.object({
4110
- items: z45.array(auditRecordSchema),
4111
- total: z45.number().int().nonnegative(),
4112
- nextCursor: z45.string().nullable()
4165
+ var auditPageSchema = /* @__PURE__ */ (() => z44.object({
4166
+ items: z44.array(auditRecordSchema),
4167
+ total: z44.number().int().nonnegative(),
4168
+ nextCursor: z44.string().nullable()
4113
4169
  }))();
4114
4170
 
4115
4171
  // src/server/client/audit.ts
@@ -4206,7 +4262,7 @@ function discordRoles({ get, post }) {
4206
4262
  var discordRolesApi = (http) => discordRoles(http);
4207
4263
 
4208
4264
  // src/server/client/test-members.ts
4209
- import * as z46 from "zod";
4265
+ import * as z45 from "zod";
4210
4266
  function testMembers({ get, post }) {
4211
4267
  return {
4212
4268
  create: (input, call) => post(
@@ -4215,7 +4271,7 @@ function testMembers({ get, post }) {
4215
4271
  testMemberCreateSchema.parse(withActionId(input)),
4216
4272
  call
4217
4273
  ),
4218
- list: (call) => get("/test-members", z46.array(testMemberSchema), call),
4274
+ list: (call) => get("/test-members", z45.array(testMemberSchema), call),
4219
4275
  history: (member, query = {}, call) => get(
4220
4276
  `/test-members/${identifier.parse(member)}/history${queryString(testMemberHistoryQuerySchema.parse(query))}`,
4221
4277
  testMemberHistorySchema,
@@ -4233,16 +4289,16 @@ function testMembers({ get, post }) {
4233
4289
  * and file store one image, so pass `act`'s action ID to replay both. Reset deletes it.
4234
4290
  */
4235
4291
  uploadEvidence: (member, file, input = {}, call) => {
4236
- const { actionId: actionId2 } = withActionId(
4237
- z46.object({ actionId: identifier.optional() }).strict().parse(input)
4292
+ const { actionId: actionId3 } = withActionId(
4293
+ z45.object({ actionId: identifier.optional() }).strict().parse(input)
4238
4294
  );
4239
4295
  return post(
4240
4296
  `/test-members/${identifier.parse(member)}/evidence`,
4241
4297
  evidenceSchema,
4242
4298
  new ManagementUploadBody(
4243
4299
  file,
4244
- { "X-Relay-Upload-ID": actionId2 },
4245
- actionId2
4300
+ { "X-Relay-Upload-ID": actionId3 },
4301
+ actionId3
4246
4302
  ),
4247
4303
  call
4248
4304
  );
@@ -4493,79 +4549,79 @@ function memberImports({ get, post }) {
4493
4549
  var memberImportsApi = (http) => memberImports(http);
4494
4550
 
4495
4551
  // src/server/client/members.ts
4496
- import * as z51 from "zod";
4552
+ import * as z50 from "zod";
4497
4553
 
4498
4554
  // src/server/members.ts
4499
- import * as z49 from "zod";
4555
+ import * as z48 from "zod";
4500
4556
 
4501
4557
  // src/server/member-bans.ts
4502
- import * as z47 from "zod";
4503
- var memberBanRollbackSchema = /* @__PURE__ */ (() => z47.object({
4504
- completions: z47.boolean().default(false),
4505
- referralPayouts: z47.boolean().default(false),
4506
- pointAwards: z47.boolean().default(false)
4558
+ import * as z46 from "zod";
4559
+ var memberBanRollbackSchema = /* @__PURE__ */ (() => z46.object({
4560
+ completions: z46.boolean().default(false),
4561
+ referralPayouts: z46.boolean().default(false),
4562
+ pointAwards: z46.boolean().default(false)
4507
4563
  }).strict())();
4508
- var banReason = /* @__PURE__ */ (() => z47.string().trim().min(1).max(500))();
4509
- var memberBanInputSchema = /* @__PURE__ */ (() => z47.object({
4564
+ var banReason = /* @__PURE__ */ (() => z46.string().trim().min(1).max(500))();
4565
+ var memberBanInputSchema = /* @__PURE__ */ (() => z46.object({
4510
4566
  actionId: identifier,
4511
4567
  reason: banReason,
4512
4568
  rollback: memberBanRollbackSchema.optional()
4513
4569
  }).strict())();
4514
- var memberBanPreviewInputSchema = /* @__PURE__ */ (() => z47.object({ rollback: memberBanRollbackSchema.optional() }).strict())();
4515
- var memberUnbanInputSchema = /* @__PURE__ */ (() => z47.object({
4570
+ var memberBanPreviewInputSchema = /* @__PURE__ */ (() => z46.object({ rollback: memberBanRollbackSchema.optional() }).strict())();
4571
+ var memberUnbanInputSchema = /* @__PURE__ */ (() => z46.object({
4516
4572
  actionId: identifier,
4517
4573
  reason: banReason,
4518
- restoreCompletions: z47.boolean().default(false)
4574
+ restoreCompletions: z46.boolean().default(false)
4519
4575
  }).strict())();
4520
- var points2 = /* @__PURE__ */ (() => z47.number().int().nonnegative())();
4521
- var memberBanOutcomeSchema = /* @__PURE__ */ (() => z47.object({
4576
+ var points2 = /* @__PURE__ */ (() => z46.number().int().nonnegative())();
4577
+ var memberBanOutcomeSchema = /* @__PURE__ */ (() => z46.object({
4522
4578
  attemptsRejected: points2,
4523
4579
  completionsRevoked: points2,
4524
4580
  completionsRestored: points2,
4525
- completionsKept: z47.array(
4526
- z47.object({ completion: identifier, code: z47.string() })
4581
+ completionsKept: z46.array(
4582
+ z46.object({ completion: identifier, code: z46.string() })
4527
4583
  ),
4528
4584
  entriesReversed: points2,
4529
4585
  referralAccounts: points2,
4530
- points: z47.array(
4531
- z47.object({ ledger: identifier, reversed: points2, unreversed: points2 })
4586
+ points: z46.array(
4587
+ z46.object({ ledger: identifier, reversed: points2, unreversed: points2 })
4532
4588
  ),
4533
- referralDebt: z47.array(z47.object({ ledger: identifier, amount: points2 }))
4589
+ referralDebt: z46.array(z46.object({ ledger: identifier, amount: points2 }))
4534
4590
  }))();
4535
- var runStatusSchema = /* @__PURE__ */ (() => z47.string())();
4536
- var runSchema = /* @__PURE__ */ (() => z47.object({
4591
+ var runStatusSchema = /* @__PURE__ */ (() => z46.string())();
4592
+ var runSchema = /* @__PURE__ */ (() => z46.object({
4537
4593
  status: runStatusSchema,
4538
- finishedAt: z47.number().int().nullable(),
4594
+ finishedAt: z46.number().int().nullable(),
4539
4595
  outcome: memberBanOutcomeSchema.nullable()
4540
4596
  }))();
4541
- var memberBanSchema = /* @__PURE__ */ (() => z47.object({
4597
+ var memberBanSchema = /* @__PURE__ */ (() => z46.object({
4542
4598
  id: identifier,
4543
4599
  member: identifier,
4544
- reason: z47.string(),
4545
- bannedAt: z47.number().int(),
4546
- bannedBy: z47.string().nullable(),
4600
+ reason: z46.string(),
4601
+ bannedAt: z46.number().int(),
4602
+ bannedBy: z46.string().nullable(),
4547
4603
  rollback: runSchema.extend({
4548
- completions: z47.boolean(),
4549
- referralPayouts: z47.boolean(),
4550
- pointAwards: z47.boolean()
4604
+ completions: z46.boolean(),
4605
+ referralPayouts: z46.boolean(),
4606
+ pointAwards: z46.boolean()
4551
4607
  }),
4552
- unban: z47.object({
4553
- reason: z47.string(),
4554
- unbannedAt: z47.number().int(),
4555
- by: z47.string().nullable(),
4556
- restoreCompletions: z47.boolean(),
4608
+ unban: z46.object({
4609
+ reason: z46.string(),
4610
+ unbannedAt: z46.number().int(),
4611
+ by: z46.string().nullable(),
4612
+ restoreCompletions: z46.boolean(),
4557
4613
  restore: runSchema.nullable()
4558
4614
  }).nullable()
4559
4615
  }))();
4560
- var memberBanPreviewSchema = /* @__PURE__ */ (() => z47.object({
4616
+ var memberBanPreviewSchema = /* @__PURE__ */ (() => z46.object({
4561
4617
  member: identifier,
4562
- banned: z47.boolean(),
4618
+ banned: z46.boolean(),
4563
4619
  attempts: points2,
4564
4620
  completions: points2,
4565
4621
  entries: points2,
4566
4622
  referralAccounts: points2,
4567
- points: z47.array(
4568
- z47.object({
4623
+ points: z46.array(
4624
+ z46.object({
4569
4625
  ledger: identifier,
4570
4626
  completions: points2,
4571
4627
  pointAwards: points2,
@@ -4576,11 +4632,11 @@ var memberBanPreviewSchema = /* @__PURE__ */ (() => z47.object({
4576
4632
  referralDebt: points2
4577
4633
  })
4578
4634
  ),
4579
- inviters: z47.array(
4580
- z47.object({
4635
+ inviters: z46.array(
4636
+ z46.object({
4581
4637
  member: identifier,
4582
- ledgers: z47.array(
4583
- z47.object({
4638
+ ledgers: z46.array(
4639
+ z46.object({
4584
4640
  ledger: identifier,
4585
4641
  bonus: points2,
4586
4642
  reversed: points2,
@@ -4592,23 +4648,31 @@ var memberBanPreviewSchema = /* @__PURE__ */ (() => z47.object({
4592
4648
  }))();
4593
4649
 
4594
4650
  // src/server/wallets.ts
4595
- import * as z48 from "zod";
4651
+ import * as z47 from "zod";
4596
4652
  var managedWalletSchema = /* @__PURE__ */ (() => linkedWalletSchema.extend({
4597
4653
  /**
4598
4654
  * True when the organization vouched for the wallet (a member import, or an app login's server at
4599
4655
  * sign-in), and the member has not proved it since. Absent from Relay versions without imports.
4600
4656
  */
4601
- imported: z48.boolean().optional(),
4657
+ imported: z47.boolean().optional(),
4602
4658
  /**
4603
4659
  * The app login that vouched for the wallet at sign-in, while `imported` is true and no member
4604
4660
  * import attached it. Absent from Relay versions without it.
4605
4661
  */
4606
4662
  vouchedBy: accountVouchedBySchema.optional(),
4607
4663
  ...identitySourceFields,
4608
- status: z48.enum(["linked", "unlinked"]),
4609
- unlinkedAt: z48.number().int().nullable(),
4664
+ /**
4665
+ * A linked Solana wallet's primary `.sol` name (SNS), such as `"toly.sol"`, while the wallet owns the
4666
+ * domain, as Relay last read it from mainnet. For display only: `address` stays the wallet's
4667
+ * identity. Absent when it has none or Relay has not read it yet.
4668
+ *
4669
+ * @experimental A minor release can change `.sol` names.
4670
+ */
4671
+ name: z47.string().optional(),
4672
+ status: z47.enum(["linked", "unlinked"]),
4673
+ unlinkedAt: z47.number().int().nullable(),
4610
4674
  /** "member", or the operator or key that unlinked it. */
4611
- unlinkedBy: z48.string().nullable()
4675
+ unlinkedBy: z47.string().nullable()
4612
4676
  }))();
4613
4677
  var balanceCheckSchema = /* @__PURE__ */ (() => walletBalanceSchema.pick({
4614
4678
  chain: true,
@@ -4618,65 +4682,66 @@ var balanceCheckSchema = /* @__PURE__ */ (() => walletBalanceSchema.pick({
4618
4682
  wallets: true,
4619
4683
  observedAt: true
4620
4684
  }).extend({ attempt: identifier }))();
4621
- var walletBalanceChainsSchema = /* @__PURE__ */ (() => z48.object({
4622
- chains: z48.array(
4623
- z48.object({
4624
- chain: z48.union([
4625
- z48.literal(solanaMainnet),
4685
+ var walletBalanceChainsSchema = /* @__PURE__ */ (() => z47.object({
4686
+ chains: z47.array(
4687
+ z47.object({
4688
+ chain: z47.union([
4689
+ z47.literal(solanaMainnet),
4690
+ z47.literal(solanaDevnet),
4626
4691
  cosmosNetworkSchema,
4627
4692
  evmChainIdSchema
4628
4693
  ]),
4629
- name: z48.string(),
4630
- testnet: z48.boolean()
4694
+ name: z47.string(),
4695
+ testnet: z47.boolean()
4631
4696
  })
4632
4697
  )
4633
4698
  }))();
4634
- var memberWalletUnlinkInputSchema = /* @__PURE__ */ (() => walletUnlinkInputSchema.extend({ reason: z48.string().trim().min(1).max(500) }).strict())();
4699
+ var memberWalletUnlinkInputSchema = /* @__PURE__ */ (() => walletUnlinkInputSchema.extend({ reason: z47.string().trim().min(1).max(500) }).strict())();
4635
4700
  var memberWalletSignInInputSchema = /* @__PURE__ */ (() => walletUnlinkInputSchema.extend({
4636
- enabled: z48.boolean(),
4637
- reason: z48.string().trim().min(1).max(500)
4701
+ enabled: z47.boolean(),
4702
+ reason: z47.string().trim().min(1).max(500)
4638
4703
  }).strict())();
4639
4704
 
4640
4705
  // src/server/members.ts
4641
- var memberSchema = /* @__PURE__ */ (() => z49.object({
4642
- id: z49.string(),
4643
- test: z49.boolean().optional(),
4644
- name: z49.string().nullable().optional(),
4645
- accounts: z49.array(memberAccountSchema).default([]),
4706
+ var memberSchema = /* @__PURE__ */ (() => z48.object({
4707
+ id: z48.string(),
4708
+ test: z48.boolean().optional(),
4709
+ name: z48.string().nullable().optional(),
4710
+ accounts: z48.array(memberAccountSchema).default([]),
4646
4711
  /** The member's linked app identities, by kind. Absent from Relay versions without it. */
4647
- appIdentities: z49.array(memberAppIdentitySchema).optional(),
4648
- attempts: z49.number(),
4649
- completions: z49.number(),
4650
- rewards: z49.number(),
4651
- lastActivity: z49.number().nullable(),
4712
+ appIdentities: z48.array(memberAppIdentitySchema).optional(),
4713
+ attempts: z48.number(),
4714
+ completions: z48.number(),
4715
+ rewards: z48.number(),
4716
+ lastActivity: z48.number().nullable(),
4652
4717
  /**
4653
4718
  * When the customer erased the member (`members.erase`), in Unix milliseconds: it keeps its ID
4654
4719
  * and accounting, with no profile, accounts or identities. Absent on a member that was not erased.
4655
4720
  */
4656
- erasedAt: z49.number().optional(),
4721
+ erasedAt: z48.number().optional(),
4657
4722
  /**
4658
4723
  * When an operator banned the member (`members.ban`), in Unix milliseconds. Absent on a member
4659
4724
  * who is not banned now.
4660
4725
  *
4661
4726
  * @experimental A minor release can change member bans.
4662
4727
  */
4663
- bannedAt: z49.number().optional()
4728
+ bannedAt: z48.number().optional()
4664
4729
  }))();
4665
- var managedOAuthAccountBaseSchema = /* @__PURE__ */ (() => z49.object({
4666
- provider: z49.enum(["x", "discord"]),
4667
- revision: z49.number().int().nonnegative()
4730
+ var managedOAuthAccountBaseSchema = /* @__PURE__ */ (() => z48.object({
4731
+ provider: z48.enum(["x", "discord"]),
4732
+ revision: z48.number().int().nonnegative()
4668
4733
  }))();
4669
- var managedOAuthAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion("status", [
4734
+ var managedOAuthAccountSchema = /* @__PURE__ */ (() => z48.discriminatedUnion("status", [
4670
4735
  managedOAuthAccountBaseSchema.extend({
4671
- status: z49.literal("connected"),
4672
- subject: z49.string().min(1),
4673
- linkedAt: z49.number(),
4736
+ status: z48.literal("connected"),
4737
+ subject: z48.string().min(1),
4738
+ linkedAt: z48.number(),
4674
4739
  /**
4675
4740
  * True when the organization vouched for the account, not the member's proof: a member import
4676
4741
  * attached it, or an app login's server did at sign-in (`vouchedBy`). Absent from Relay
4677
4742
  * versions without imports.
4678
4743
  */
4679
- imported: z49.boolean().optional(),
4744
+ imported: z48.boolean().optional(),
4680
4745
  /**
4681
4746
  * The app login that vouched for the account at sign-in, for an account with `imported` set
4682
4747
  * that no member import attached. Absent from Relay versions without it.
@@ -4686,26 +4751,26 @@ var managedOAuthAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion("s
4686
4751
  * True for a real account an operator linked to a test member without OAuth
4687
4752
  * (`testMembers.linkAccount`). Absent from Relay versions without it.
4688
4753
  */
4689
- testLinked: z49.boolean().optional(),
4754
+ testLinked: z48.boolean().optional(),
4690
4755
  ...identitySourceFields
4691
4756
  }),
4692
- managedOAuthAccountBaseSchema.extend({ status: z49.literal("disconnected") })
4757
+ managedOAuthAccountBaseSchema.extend({ status: z48.literal("disconnected") })
4693
4758
  ]))();
4694
4759
  var managedTelegramAccountBaseSchema = /* @__PURE__ */ (() => managedOAuthAccountBaseSchema.extend({
4695
- provider: z49.literal("telegram")
4760
+ provider: z48.literal("telegram")
4696
4761
  }))();
4697
- var managedTelegramAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion("status", [
4762
+ var managedTelegramAccountSchema = /* @__PURE__ */ (() => z48.discriminatedUnion("status", [
4698
4763
  managedTelegramAccountBaseSchema.extend({
4699
- status: z49.literal("connected"),
4764
+ status: z48.literal("connected"),
4700
4765
  /** The numeric Telegram user ID. */
4701
- subject: z49.string().min(1),
4702
- linkedAt: z49.number(),
4766
+ subject: z48.string().min(1),
4767
+ linkedAt: z48.number(),
4703
4768
  /**
4704
4769
  * True when the organization vouched for the account, not the member's proof: a member import
4705
4770
  * attached it, or an app login's server did at sign-in (`vouchedBy`). Absent from Relay
4706
4771
  * versions without it.
4707
4772
  */
4708
- imported: z49.boolean().optional(),
4773
+ imported: z48.boolean().optional(),
4709
4774
  /**
4710
4775
  * The app login that vouched for the account at sign-in, for an account with `imported` set
4711
4776
  * that no member import attached. Absent from Relay versions without it.
@@ -4714,14 +4779,14 @@ var managedTelegramAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion
4714
4779
  ...identitySourceFields
4715
4780
  }),
4716
4781
  managedTelegramAccountBaseSchema.extend({
4717
- status: z49.literal("disconnected")
4782
+ status: z48.literal("disconnected")
4718
4783
  })
4719
4784
  ]))();
4720
- var memberOAuthUnlinkInputSchema = /* @__PURE__ */ (() => z49.object({
4721
- provider: z49.enum(["x", "discord"]),
4722
- subject: z49.string().min(1).max(4096),
4723
- revision: z49.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER - 1),
4724
- reason: z49.string().trim().min(1).max(500)
4785
+ var memberOAuthUnlinkInputSchema = /* @__PURE__ */ (() => z48.object({
4786
+ provider: z48.enum(["x", "discord"]),
4787
+ subject: z48.string().min(1).max(4096),
4788
+ revision: z48.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER - 1),
4789
+ reason: z48.string().trim().min(1).max(500)
4725
4790
  }).strict())();
4726
4791
  var memberTelegramUnlinkInputSchema = /* @__PURE__ */ (() => memberOAuthUnlinkInputSchema.omit({ provider: true }).strict())();
4727
4792
  var managedMemberIdentitySchema = /* @__PURE__ */ (() => memberIdentitySchema.extend({
@@ -4730,7 +4795,7 @@ var managedMemberIdentitySchema = /* @__PURE__ */ (() => memberIdentitySchema.ex
4730
4795
  * login's server at sign-in), until the member links that provider's account, or signs in with
4731
4796
  * the X account, through Domino. Absent from Relay versions without imports.
4732
4797
  */
4733
- imported: z49.boolean().optional(),
4798
+ imported: z48.boolean().optional(),
4734
4799
  /**
4735
4800
  * The app login that vouched for the account at sign-in, for an `imported` account no member
4736
4801
  * import attached. Absent from Relay versions without it.
@@ -4740,40 +4805,40 @@ var managedMemberIdentitySchema = /* @__PURE__ */ (() => memberIdentitySchema.ex
4740
4805
  * True for a real X or Discord account an operator linked to a test member without OAuth
4741
4806
  * (`testMembers.linkAccount`). Absent from Relay versions without it.
4742
4807
  */
4743
- testLinked: z49.boolean().optional(),
4808
+ testLinked: z48.boolean().optional(),
4744
4809
  ...identitySourceFields,
4745
- status: z49.enum(["linked", "unlinked"]),
4746
- unlinkedAt: z49.number().int().nullable(),
4810
+ status: z48.enum(["linked", "unlinked"]),
4811
+ unlinkedAt: z48.number().int().nullable(),
4747
4812
  /** The operator or key that unlinked it. */
4748
- unlinkedBy: z49.string().nullable()
4813
+ unlinkedBy: z48.string().nullable()
4749
4814
  }))();
4750
- var memberIdentityChangeInputSchema = /* @__PURE__ */ (() => z49.object({
4815
+ var memberIdentityChangeInputSchema = /* @__PURE__ */ (() => z48.object({
4751
4816
  kind: appIdentityKindSchema,
4752
- subject: z49.string().min(1).max(256),
4753
- reason: z49.string().trim().min(1).max(500)
4817
+ subject: z48.string().min(1).max(256),
4818
+ reason: z48.string().trim().min(1).max(500)
4754
4819
  }).strict())();
4755
- var memberDetailSchema = /* @__PURE__ */ (() => z49.object({
4820
+ var memberDetailSchema = /* @__PURE__ */ (() => z48.object({
4756
4821
  snapshot: snapshotSchema,
4757
4822
  member: memberSchema,
4758
4823
  progress: memberProgressSchema,
4759
4824
  /** Up to 25 revoked completions with an unreversed point remainder, newest first. */
4760
- revocationShortfalls: z49.array(completionRevocationShortfallSchema).default([]),
4825
+ revocationShortfalls: z48.array(completionRevocationShortfallSchema).default([]),
4761
4826
  /** Up to 25 revoked completions, newest first. Relay older than restore leaves it out. */
4762
- revokedCompletions: z49.array(revokedCompletionSchema).optional(),
4827
+ revokedCompletions: z48.array(revokedCompletionSchema).optional(),
4763
4828
  /** Current and historical campaign enrollment state, including inactive enrollments. */
4764
- campaignEnrollments: z49.array(campaignEnrollmentSchema).default([]),
4765
- passes: z49.array(
4766
- z49.object({
4767
- provider: z49.string(),
4768
- event: z49.string(),
4769
- subject: z49.string(),
4829
+ campaignEnrollments: z48.array(campaignEnrollmentSchema).default([]),
4830
+ passes: z48.array(
4831
+ z48.object({
4832
+ provider: z48.string(),
4833
+ event: z48.string(),
4834
+ subject: z48.string(),
4770
4835
  attempt: identifier.nullable()
4771
4836
  })
4772
4837
  ).default([]),
4773
4838
  /** Linked and unlinked wallets. */
4774
- wallets: z49.array(managedWalletSchema),
4839
+ wallets: z48.array(managedWalletSchema),
4775
4840
  /** The member's 10 most recent recorded balance reads, newest first. */
4776
- balanceChecks: z49.array(balanceCheckSchema),
4841
+ balanceChecks: z48.array(balanceCheckSchema),
4777
4842
  /** The member's participant profile in this project. */
4778
4843
  profile: managedProfileSchema.nullable(),
4779
4844
  /**
@@ -4781,20 +4846,20 @@ var memberDetailSchema = /* @__PURE__ */ (() => z49.object({
4781
4846
  * member ID: their selected X and Discord accounts and their `app:<name>` identities in this
4782
4847
  * project, including app identities an operator unlinked, by kind.
4783
4848
  */
4784
- identities: z49.array(managedMemberIdentitySchema),
4849
+ identities: z48.array(managedMemberIdentitySchema),
4785
4850
  /**
4786
4851
  * The creator accounts the member linked (a YouTube channel), whose content managed tracker
4787
4852
  * sources attribute to them. Absent from Relay versions without creator accounts.
4788
4853
  */
4789
- creatorAccounts: z49.array(managedCreatorAccountSchema).optional(),
4854
+ creatorAccounts: z48.array(managedCreatorAccountSchema).optional(),
4790
4855
  /**
4791
4856
  * Who invited the member, when they accepted, and the member import that recorded it, or null
4792
4857
  * when nobody invited them. Absent from Relay versions before imported referrals.
4793
4858
  */
4794
- referral: z49.object({
4859
+ referral: z48.object({
4795
4860
  inviter: identifier,
4796
- acceptedAt: z49.number().int().nonnegative(),
4797
- suspended: z49.boolean(),
4861
+ acceptedAt: z48.number().int().nonnegative(),
4862
+ suspended: z48.boolean(),
4798
4863
  import: identifier.nullable()
4799
4864
  }).nullable().optional(),
4800
4865
  /**
@@ -4805,9 +4870,9 @@ var memberDetailSchema = /* @__PURE__ */ (() => z49.object({
4805
4870
  */
4806
4871
  ban: memberBanSchema.nullable().optional()
4807
4872
  }))();
4808
- var managedMemberProgressSchema = /* @__PURE__ */ (() => z49.object({
4873
+ var managedMemberProgressSchema = /* @__PURE__ */ (() => z48.object({
4809
4874
  member: identifier,
4810
- quests: z49.array(
4875
+ quests: z48.array(
4811
4876
  memberProgressSchema.shape.quests.element.extend({
4812
4877
  /** The streak as `members.get` reports it, without the list of qualifying days. */
4813
4878
  streak: streakProgressSchema.omit({ days: true }).nullable().optional()
@@ -4818,10 +4883,10 @@ var managedMemberProgressSchema = /* @__PURE__ */ (() => z49.object({
4818
4883
  /** Each point balance the member has, by balance ID. */
4819
4884
  balances: snapshotSchema.shape.balances
4820
4885
  }))();
4821
- var memberLookupSchema = /* @__PURE__ */ (() => z49.union([
4822
- z49.object({
4823
- provider: z49.string().min(1).max(200),
4824
- subject: z49.string().min(1).max(2048)
4886
+ var memberLookupSchema = /* @__PURE__ */ (() => z48.union([
4887
+ z48.object({
4888
+ provider: z48.string().min(1).max(200),
4889
+ subject: z48.string().min(1).max(2048)
4825
4890
  }).strict(),
4826
4891
  identityReferenceSchema.transform(
4827
4892
  (reference) => reference.kind === "wallet" ? { provider: reference.chain, subject: reference.address } : { provider: reference.kind, subject: reference.subject }
@@ -4832,50 +4897,50 @@ var memberLookupSchema = /* @__PURE__ */ (() => z49.union([
4832
4897
  subject: address
4833
4898
  }))
4834
4899
  ]))();
4835
- var booleanQuery = /* @__PURE__ */ (() => z49.union([
4836
- z49.boolean(),
4837
- z49.enum(["true", "false"]).transform((v) => v === "true")
4900
+ var booleanQuery = /* @__PURE__ */ (() => z48.union([
4901
+ z48.boolean(),
4902
+ z48.enum(["true", "false"]).transform((v) => v === "true")
4838
4903
  ]))();
4839
- var managedMemberQuerySchema = /* @__PURE__ */ (() => z49.strictObject({
4840
- q: z49.string().max(200).optional(),
4904
+ var managedMemberQuerySchema = /* @__PURE__ */ (() => z48.strictObject({
4905
+ q: z48.string().max(200).optional(),
4841
4906
  needsReview: booleanQuery.optional(),
4842
- limit: z49.coerce.number().int().min(1).max(100).optional(),
4907
+ limit: z48.coerce.number().int().min(1).max(100).optional(),
4843
4908
  cursor: pageCursorSchema.optional()
4844
4909
  }))();
4845
- var managedMemberPageSchema = /* @__PURE__ */ (() => z49.object({
4846
- items: z49.array(memberSchema),
4847
- total: z49.number().int().nonnegative(),
4848
- nextCursor: z49.string().nullable()
4910
+ var managedMemberPageSchema = /* @__PURE__ */ (() => z48.object({
4911
+ items: z48.array(memberSchema),
4912
+ total: z48.number().int().nonnegative(),
4913
+ nextCursor: z48.string().nullable()
4849
4914
  }))();
4850
4915
 
4851
4916
  // src/server/member-erasure.ts
4852
- import * as z50 from "zod";
4917
+ import * as z49 from "zod";
4853
4918
  var memberErasureInputSchema = evidenceRedactionInputSchema;
4854
- var memberErasureDeletedSchema = /* @__PURE__ */ (() => z50.object({
4919
+ var memberErasureDeletedSchema = /* @__PURE__ */ (() => z49.object({
4855
4920
  /** The profile: display name and avatar. 0 or 1. */
4856
- profiles: z50.number().int().nonnegative(),
4921
+ profiles: z49.number().int().nonnegative(),
4857
4922
  /** Sign-in identities. */
4858
- identities: z50.number().int().nonnegative(),
4923
+ identities: z49.number().int().nonnegative(),
4859
4924
  /** Linked X, Discord, Telegram, Google, Apple and email accounts. */
4860
- accounts: z50.number().int().nonnegative(),
4925
+ accounts: z49.number().int().nonnegative(),
4861
4926
  /** `app:<name>` identities your app's integration or an import gave. */
4862
- appIdentities: z50.number().int().nonnegative(),
4927
+ appIdentities: z49.number().int().nonnegative(),
4863
4928
  /** Linked wallet addresses. */
4864
- wallets: z50.number().int().nonnegative(),
4929
+ wallets: z49.number().int().nonnegative(),
4865
4930
  /** Signed-in sessions, ended at once. */
4866
- sessions: z50.number().int().nonnegative(),
4931
+ sessions: z49.number().int().nonnegative(),
4867
4932
  /** Marketing consent records. */
4868
- consents: z50.number().int().nonnegative(),
4933
+ consents: z49.number().int().nonnegative(),
4869
4934
  /** Leaderboard aliases. */
4870
- aliases: z50.number().int().nonnegative(),
4935
+ aliases: z49.number().int().nonnegative(),
4871
4936
  /** Attempts whose submitted evidence (photo, text, URL or answers) was deleted. */
4872
- evidence: z50.number().int().nonnegative(),
4937
+ evidence: z49.number().int().nonnegative(),
4873
4938
  /** Tracker records the member's accounts authored, whose stored content was forgotten. */
4874
- records: z50.number().int().nonnegative()
4939
+ records: z49.number().int().nonnegative()
4875
4940
  }))();
4876
- var memberErasureResultSchema = /* @__PURE__ */ (() => z50.object({
4941
+ var memberErasureResultSchema = /* @__PURE__ */ (() => z49.object({
4877
4942
  member: identifier,
4878
- erasedAt: z50.number().int(),
4943
+ erasedAt: z49.number().int(),
4879
4944
  deleted: memberErasureDeletedSchema
4880
4945
  }))();
4881
4946
 
@@ -5098,7 +5163,7 @@ function members({ get, post }) {
5098
5163
  /** Who each member is: up to 100 distinct IDs; unknown IDs come back without accounts. */
5099
5164
  people: (members2, call) => get(
5100
5165
  `/people${queryString({ ids: members2.join(",") })}`,
5101
- z51.array(personSchema),
5166
+ z50.array(personSchema),
5102
5167
  call
5103
5168
  ),
5104
5169
  /**
@@ -5108,7 +5173,7 @@ function members({ get, post }) {
5108
5173
  */
5109
5174
  oauthAccounts: (member, call) => get(
5110
5175
  `/members/${encodeURIComponent(member)}/oauth-accounts`,
5111
- z51.array(managedOAuthAccountSchema),
5176
+ z50.array(managedOAuthAccountSchema),
5112
5177
  call
5113
5178
  ),
5114
5179
  /**
@@ -5120,7 +5185,7 @@ function members({ get, post }) {
5120
5185
  */
5121
5186
  unlinkOAuthAccount: (member, input, call) => post(
5122
5187
  `/members/${encodeURIComponent(member)}/oauth-accounts/unlink`,
5123
- z51.array(managedOAuthAccountSchema),
5188
+ z50.array(managedOAuthAccountSchema),
5124
5189
  expectedRevision(memberOAuthUnlinkInputSchema).parse(input),
5125
5190
  call
5126
5191
  ),
@@ -5203,7 +5268,7 @@ function members({ get, post }) {
5203
5268
  */
5204
5269
  unlinkWallet: (member, input, call) => post(
5205
5270
  `/members/${encodeURIComponent(member)}/wallets/unlink`,
5206
- z51.array(managedWalletSchema),
5271
+ z50.array(managedWalletSchema),
5207
5272
  memberWalletUnlinkInputSchema.parse(input),
5208
5273
  call
5209
5274
  ),
@@ -5216,7 +5281,7 @@ function members({ get, post }) {
5216
5281
  */
5217
5282
  unlinkIdentity: (member, input, call) => post(
5218
5283
  `/members/${encodeURIComponent(member)}/identities/unlink`,
5219
- z51.array(managedMemberIdentitySchema),
5284
+ z50.array(managedMemberIdentitySchema),
5220
5285
  memberIdentityChangeInputSchema.parse(input),
5221
5286
  call
5222
5287
  ),
@@ -5227,7 +5292,7 @@ function members({ get, post }) {
5227
5292
  */
5228
5293
  relinkIdentity: (member, input, call) => post(
5229
5294
  `/members/${encodeURIComponent(member)}/identities/relink`,
5230
- z51.array(managedMemberIdentitySchema),
5295
+ z50.array(managedMemberIdentitySchema),
5231
5296
  memberIdentityChangeInputSchema.parse(input),
5232
5297
  call
5233
5298
  ),
@@ -5239,7 +5304,7 @@ function members({ get, post }) {
5239
5304
  */
5240
5305
  setWalletSignIn: (member, input, call) => post(
5241
5306
  `/members/${encodeURIComponent(member)}/wallets/sign-in`,
5242
- z51.array(managedWalletSchema),
5307
+ z50.array(managedWalletSchema),
5243
5308
  memberWalletSignInInputSchema.parse(input),
5244
5309
  call
5245
5310
  )
@@ -5289,77 +5354,77 @@ function domains({ get, post, raw }) {
5289
5354
  var domainsApi = (http) => domains(http);
5290
5355
 
5291
5356
  // src/server/connections.ts
5292
- import { z as z52 } from "zod";
5293
- var connectionPluginSchema = /* @__PURE__ */ (() => z52.string().max(40).regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, "Use a kebab-case plugin ID"))();
5357
+ import { z as z51 } from "zod";
5358
+ var connectionPluginSchema = /* @__PURE__ */ (() => z51.string().max(40).regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, "Use a kebab-case plugin ID"))();
5294
5359
  var knownConnectionStatuses = [
5295
5360
  "disconnected",
5296
5361
  "ready",
5297
5362
  "attention"
5298
5363
  ];
5299
- var connectionStatusSchema = /* @__PURE__ */ (() => z52.string().min(1))();
5364
+ var connectionStatusSchema = /* @__PURE__ */ (() => z51.string().min(1))();
5300
5365
  var knownConnectionReconnectReasons = ["revoked", "expired"];
5301
- var reconnectReasonSchema = /* @__PURE__ */ (() => z52.string().min(1))();
5302
- var connectionSecretFieldSchema = /* @__PURE__ */ (() => z52.object({
5303
- name: z52.string(),
5304
- label: z52.string(),
5305
- help: z52.string().nullable(),
5306
- set: z52.boolean()
5307
- }))();
5308
- var connectionSchema = /* @__PURE__ */ (() => z52.object({
5309
- plugin: z52.string(),
5310
- name: z52.string(),
5311
- environment: z52.enum(["test", "live"]),
5366
+ var reconnectReasonSchema = /* @__PURE__ */ (() => z51.string().min(1))();
5367
+ var connectionSecretFieldSchema = /* @__PURE__ */ (() => z51.object({
5368
+ name: z51.string(),
5369
+ label: z51.string(),
5370
+ help: z51.string().nullable(),
5371
+ set: z51.boolean()
5372
+ }))();
5373
+ var connectionSchema = /* @__PURE__ */ (() => z51.object({
5374
+ plugin: z51.string(),
5375
+ name: z51.string(),
5376
+ environment: z51.enum(["test", "live"]),
5312
5377
  status: connectionStatusSchema,
5313
- issue: z52.string().nullable(),
5314
- config: z52.record(z52.string(), z52.unknown()).nullable(),
5315
- configSchema: z52.record(z52.string(), z52.unknown()),
5316
- secrets: z52.array(connectionSecretFieldSchema),
5317
- revision: z52.number().int().nonnegative(),
5318
- connectedAt: z52.number().nullable(),
5319
- connectedBy: z52.string().nullable(),
5320
- updatedAt: z52.number().nullable(),
5378
+ issue: z51.string().nullable(),
5379
+ config: z51.record(z51.string(), z51.unknown()).nullable(),
5380
+ configSchema: z51.record(z51.string(), z51.unknown()),
5381
+ secrets: z51.array(connectionSecretFieldSchema),
5382
+ revision: z51.number().int().nonnegative(),
5383
+ connectedAt: z51.number().nullable(),
5384
+ connectedBy: z51.string().nullable(),
5385
+ updatedAt: z51.number().nullable(),
5321
5386
  // A Relay from before OAuth connections answers none.
5322
5387
  reconnectReason: reconnectReasonSchema.nullable().default(null),
5323
5388
  // A Relay from before dry runs answers none.
5324
- dryRun: z52.boolean().default(false)
5389
+ dryRun: z51.boolean().default(false)
5325
5390
  }))();
5326
- var connectionPageSchema = /* @__PURE__ */ (() => z52.object({
5327
- items: z52.array(connectionSchema),
5328
- nextCursor: z52.string().nullable()
5391
+ var connectionPageSchema = /* @__PURE__ */ (() => z51.object({
5392
+ items: z51.array(connectionSchema),
5393
+ nextCursor: z51.string().nullable()
5329
5394
  }))();
5330
- var actionId = /* @__PURE__ */ (() => z52.string().uuid().default(() => crypto.randomUUID()))();
5331
- var config = /* @__PURE__ */ (() => z52.record(z52.string(), z52.unknown()))();
5332
- var secrets = /* @__PURE__ */ (() => z52.record(z52.string().max(64), z52.string().min(1).max(8192)))();
5333
- var connectionConnectInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5395
+ var actionId2 = /* @__PURE__ */ (() => z51.string().uuid().default(() => crypto.randomUUID()))();
5396
+ var config = /* @__PURE__ */ (() => z51.record(z51.string(), z51.unknown()))();
5397
+ var secrets = /* @__PURE__ */ (() => z51.record(z51.string().max(64), z51.string().min(1).max(8192)))();
5398
+ var connectionConnectInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5334
5399
  config,
5335
5400
  secrets: secrets.default({}),
5336
- dryRun: z52.boolean().optional(),
5337
- actionId
5401
+ dryRun: z51.boolean().optional(),
5402
+ actionId: actionId2
5338
5403
  }))();
5339
- var connectionAuthorizeInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5404
+ var connectionAuthorizeInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5340
5405
  config: config.default({}),
5341
- returnTo: z52.string().url().max(2048).optional(),
5342
- actionId
5406
+ returnTo: z51.string().url().max(2048).optional(),
5407
+ actionId: actionId2
5343
5408
  }))();
5344
- var connectionAuthorizationSchema = /* @__PURE__ */ (() => z52.object({
5345
- authorizationUrl: z52.string().url(),
5346
- expiresAt: z52.number()
5409
+ var connectionAuthorizationSchema = /* @__PURE__ */ (() => z51.object({
5410
+ authorizationUrl: z51.string().url(),
5411
+ expiresAt: z51.number()
5347
5412
  }))();
5348
- var connectionAuthorizationCompleteInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5349
- code: z52.string().min(1).max(200)
5413
+ var connectionAuthorizationCompleteInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5414
+ code: z51.string().min(1).max(200)
5350
5415
  }))();
5351
- var connectionUpdateInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5416
+ var connectionUpdateInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5352
5417
  config: config.optional(),
5353
5418
  secrets: secrets.optional(),
5354
- expectedRevision: z52.number().int().nonnegative().optional(),
5355
- actionId
5419
+ expectedRevision: z51.number().int().nonnegative().optional(),
5420
+ actionId: actionId2
5356
5421
  }).refine(
5357
5422
  (input) => input.config !== void 0 || Object.keys(input.secrets ?? {}).length,
5358
5423
  { message: "Change the config, a secret, or both" }
5359
5424
  ))();
5360
- var connectionDisconnectInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5361
- expectedRevision: z52.number().int().nonnegative().optional(),
5362
- actionId
5425
+ var connectionDisconnectInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5426
+ expectedRevision: z51.number().int().nonnegative().optional(),
5427
+ actionId: actionId2
5363
5428
  }))();
5364
5429
  var knownPluginSlots = [
5365
5430
  "connection",
@@ -5369,29 +5434,29 @@ var knownPluginSlots = [
5369
5434
  "evaluator-capability",
5370
5435
  "identity"
5371
5436
  ];
5372
- var pluginSlotSchema = /* @__PURE__ */ (() => z52.string().min(1))();
5373
- var pluginSchema = /* @__PURE__ */ (() => z52.object({
5374
- id: z52.string(),
5375
- name: z52.string(),
5376
- slots: z52.array(pluginSlotSchema),
5377
- configSchema: z52.record(z52.string(), z52.unknown()),
5378
- secrets: z52.array(
5379
- z52.object({
5380
- name: z52.string(),
5381
- label: z52.string(),
5382
- help: z52.string().nullable()
5437
+ var pluginSlotSchema = /* @__PURE__ */ (() => z51.string().min(1))();
5438
+ var pluginSchema = /* @__PURE__ */ (() => z51.object({
5439
+ id: z51.string(),
5440
+ name: z51.string(),
5441
+ slots: z51.array(pluginSlotSchema),
5442
+ configSchema: z51.record(z51.string(), z51.unknown()),
5443
+ secrets: z51.array(
5444
+ z51.object({
5445
+ name: z51.string(),
5446
+ label: z51.string(),
5447
+ help: z51.string().nullable()
5383
5448
  })
5384
5449
  ),
5385
- events: z52.array(z52.string()),
5450
+ events: z51.array(z51.string()),
5386
5451
  // A Relay from before OAuth connections answers none.
5387
- oauth: z52.object({ configured: z52.boolean(), scopes: z52.array(z52.string()) }).nullable().default(null),
5388
- console: z52.object({ component: z52.string() }).nullable().default(null),
5452
+ oauth: z51.object({ configured: z51.boolean(), scopes: z51.array(z51.string()) }).nullable().default(null),
5453
+ console: z51.object({ component: z51.string() }).nullable().default(null),
5389
5454
  // A Relay from before dry runs answers none.
5390
- dryRun: z52.boolean().default(false)
5455
+ dryRun: z51.boolean().default(false)
5391
5456
  }))();
5392
- var pluginPageSchema = /* @__PURE__ */ (() => z52.object({
5393
- items: z52.array(pluginSchema),
5394
- nextCursor: z52.string().nullable()
5457
+ var pluginPageSchema = /* @__PURE__ */ (() => z51.object({
5458
+ items: z51.array(pluginSchema),
5459
+ nextCursor: z51.string().nullable()
5395
5460
  }))();
5396
5461
  var knownConnectionSyncKinds = ["connect", "resync"];
5397
5462
  var knownConnectionSyncStatuses = [
@@ -5399,53 +5464,53 @@ var knownConnectionSyncStatuses = [
5399
5464
  "finished",
5400
5465
  "failed"
5401
5466
  ];
5402
- var connectionSyncSchema = /* @__PURE__ */ (() => z52.object({
5403
- kind: z52.string().min(1),
5404
- status: z52.string().min(1),
5405
- done: z52.number().int().nonnegative(),
5406
- total: z52.number().int().nonnegative().nullable(),
5407
- startedAt: z52.number(),
5408
- finishedAt: z52.number().nullable()
5409
- }))();
5410
- var connectionActivitySchema = /* @__PURE__ */ (() => z52.object({
5411
- plugin: z52.string(),
5412
- environment: z52.enum(["test", "live"]),
5467
+ var connectionSyncSchema = /* @__PURE__ */ (() => z51.object({
5468
+ kind: z51.string().min(1),
5469
+ status: z51.string().min(1),
5470
+ done: z51.number().int().nonnegative(),
5471
+ total: z51.number().int().nonnegative().nullable(),
5472
+ startedAt: z51.number(),
5473
+ finishedAt: z51.number().nullable()
5474
+ }))();
5475
+ var connectionActivitySchema = /* @__PURE__ */ (() => z51.object({
5476
+ plugin: z51.string(),
5477
+ environment: z51.enum(["test", "live"]),
5413
5478
  status: connectionStatusSchema,
5414
- dryRun: z52.boolean(),
5415
- lastSyncAt: z52.number().nullable(),
5416
- failingSince: z52.number().nullable(),
5417
- consecutiveFailures: z52.number().int().nonnegative(),
5418
- members: z52.object({
5419
- synced: z52.number().int().nonnegative(),
5420
- skipped: z52.array(
5421
- z52.object({
5422
- reason: z52.string(),
5423
- members: z52.number().int().nonnegative()
5479
+ dryRun: z51.boolean(),
5480
+ lastSyncAt: z51.number().nullable(),
5481
+ failingSince: z51.number().nullable(),
5482
+ consecutiveFailures: z51.number().int().nonnegative(),
5483
+ members: z51.object({
5484
+ synced: z51.number().int().nonnegative(),
5485
+ skipped: z51.array(
5486
+ z51.object({
5487
+ reason: z51.string(),
5488
+ members: z51.number().int().nonnegative()
5424
5489
  })
5425
5490
  )
5426
5491
  }),
5427
5492
  sync: connectionSyncSchema.nullable(),
5428
- errors: z52.array(
5429
- z52.object({ at: z52.number(), kind: z52.string(), message: z52.string() })
5493
+ errors: z51.array(
5494
+ z51.object({ at: z51.number(), kind: z51.string(), message: z51.string() })
5430
5495
  )
5431
5496
  }))();
5432
- var connectionDryRunRequestSchema = /* @__PURE__ */ (() => z52.object({
5433
- id: z52.string(),
5434
- at: z52.number(),
5435
- member: z52.string().nullable(),
5436
- method: z52.string(),
5437
- path: z52.string(),
5438
- body: z52.unknown()
5497
+ var connectionDryRunRequestSchema = /* @__PURE__ */ (() => z51.object({
5498
+ id: z51.string(),
5499
+ at: z51.number(),
5500
+ member: z51.string().nullable(),
5501
+ method: z51.string(),
5502
+ path: z51.string(),
5503
+ body: z51.unknown()
5439
5504
  }))();
5440
- var connectionDryRunPageSchema = /* @__PURE__ */ (() => z52.object({
5441
- items: z52.array(connectionDryRunRequestSchema),
5442
- nextCursor: z52.string().nullable()
5505
+ var connectionDryRunPageSchema = /* @__PURE__ */ (() => z51.object({
5506
+ items: z51.array(connectionDryRunRequestSchema),
5507
+ nextCursor: z51.string().nullable()
5443
5508
  }))();
5444
- var connectionDryRunQuerySchema = /* @__PURE__ */ (() => z52.strictObject({
5445
- cursor: z52.string().min(1).max(40).optional(),
5446
- limit: z52.number().int().min(1).max(100).optional()
5509
+ var connectionDryRunQuerySchema = /* @__PURE__ */ (() => z51.strictObject({
5510
+ cursor: z51.string().min(1).max(40).optional(),
5511
+ limit: z51.number().int().min(1).max(100).optional()
5447
5512
  }))();
5448
- var connectionResyncInputSchema = /* @__PURE__ */ (() => z52.strictObject({ actionId }))();
5513
+ var connectionResyncInputSchema = /* @__PURE__ */ (() => z51.strictObject({ actionId: actionId2 }))();
5449
5514
 
5450
5515
  // src/server/client/connections.ts
5451
5516
  function connectionPath(plugin) {
@@ -5627,7 +5692,7 @@ function schedules({ request, get, post }) {
5627
5692
  var schedulesApi = (http) => schedules(http);
5628
5693
 
5629
5694
  // src/server/client/storage.ts
5630
- import * as z53 from "zod";
5695
+ import * as z52 from "zod";
5631
5696
  function storage({ get, post, raw }) {
5632
5697
  function clear(kind, name, input, call) {
5633
5698
  const path = `/storage/${kind}/${appSecretNameSchema.parse(name)}/clear`;
@@ -5671,7 +5736,7 @@ function storage({ get, post, raw }) {
5671
5736
  `/storage/sql/${appSecretNameSchema.parse(name)}/cell?${new URLSearchParams(
5672
5737
  {
5673
5738
  table,
5674
- row: String(z53.number().int().min(0).parse(options.row)),
5739
+ row: String(z52.number().int().min(0).parse(options.row)),
5675
5740
  column: options.column,
5676
5741
  ...options.cursor === void 0 ? {} : { cursor: pageCursorSchema.parse(options.cursor) }
5677
5742
  }
@@ -5690,8 +5755,8 @@ function storage({ get, post, raw }) {
5690
5755
  call
5691
5756
  ),
5692
5757
  /** A KV value's size and, when it is UTF-8 text, a preview. */
5693
- value: (name, key, call) => get(
5694
- `/storage/kv/${appSecretNameSchema.parse(name)}/value?${new URLSearchParams({ key })}`,
5758
+ value: (name, key2, call) => get(
5759
+ `/storage/kv/${appSecretNameSchema.parse(name)}/value?${new URLSearchParams({ key: key2 })}`,
5695
5760
  appStorageValueSchema,
5696
5761
  call
5697
5762
  ),
@@ -5786,26 +5851,64 @@ var campaignsApi = (http) => campaigns(http);
5786
5851
  import * as z55 from "zod";
5787
5852
 
5788
5853
  // src/server/quests.ts
5789
- import * as z54 from "zod";
5790
- var questLifecycleInputSchema = /* @__PURE__ */ (() => z54.object({
5854
+ import * as z53 from "zod";
5855
+ var questLifecycleInputSchema = /* @__PURE__ */ (() => z53.object({
5791
5856
  quest: identifier,
5792
5857
  expectedRelease: identifier.optional(),
5793
- archived: z54.boolean(),
5794
- reason: z54.string().trim().min(1).max(500),
5858
+ archived: z53.boolean(),
5859
+ reason: z53.string().trim().min(1).max(500),
5795
5860
  actionId: identifier
5796
5861
  }).strict())();
5797
- var questLifecycleSchema = /* @__PURE__ */ (() => z54.object({
5862
+ var questLifecycleSchema = /* @__PURE__ */ (() => z53.object({
5798
5863
  quest: identifier,
5799
5864
  key: identifier.nullable(),
5800
- title: z54.string(),
5865
+ title: z53.string(),
5801
5866
  release: identifier,
5802
- lifecycle: z54.enum(["active", "paused", "archived"]),
5867
+ lifecycle: z53.enum(["active", "paused", "archived"]),
5868
+ changed: z53.boolean()
5869
+ }))();
5870
+
5871
+ // src/server/quest-stations.ts
5872
+ import * as z54 from "zod";
5873
+ var stationOperationTarget = (quest, station) => `station:${quest}:${station}`;
5874
+ var stationRevocationInputSchema = /* @__PURE__ */ (() => z54.object({
5875
+ reason: z54.string().trim().min(1).max(500),
5876
+ actionId: identifier
5877
+ }).strict())();
5878
+ var stationRevocationSchema = /* @__PURE__ */ (() => z54.object({
5879
+ quest: identifier,
5880
+ station: z54.string(),
5881
+ revoked: z54.boolean(),
5882
+ reason: z54.string().nullable(),
5883
+ actor: z54.string().nullable(),
5884
+ /** When it was last revoked or restored, epoch milliseconds. */
5885
+ changedAt: z54.number().nullable(),
5803
5886
  changed: z54.boolean()
5804
5887
  }))();
5888
+ var questStationStateSchema = /* @__PURE__ */ (() => z54.object({
5889
+ key: z54.string(),
5890
+ label: z54.string(),
5891
+ opensAt: z54.number().optional(),
5892
+ closesAt: z54.number().optional(),
5893
+ status: z54.string(),
5894
+ revocation: z54.object({
5895
+ revoked: z54.boolean(),
5896
+ reason: z54.string(),
5897
+ actor: z54.string().nullable(),
5898
+ changedAt: z54.number()
5899
+ }).nullable(),
5900
+ completions: z54.number().int().nonnegative()
5901
+ }))();
5805
5902
 
5806
5903
  // src/server/client/quests.ts
5807
5904
  function quests(http) {
5808
5905
  const { get, post } = http;
5906
+ const station = (verb) => (quest, key2, input, call) => post(
5907
+ `/quests/${identifier.parse(quest)}/stations/${encodeURIComponent(key2)}/${verb}`,
5908
+ stationRevocationSchema,
5909
+ stationRevocationInputSchema.parse(withActionId(input)),
5910
+ call
5911
+ );
5809
5912
  return {
5810
5913
  pause: (quest, input, call) => operationVerb(
5811
5914
  http,
@@ -5821,11 +5924,55 @@ function quests(http) {
5821
5924
  input,
5822
5925
  call
5823
5926
  ),
5927
+ /**
5928
+ * A quest's check-in stations.
5929
+ *
5930
+ * @experimental A minor release can change check-in stations.
5931
+ */
5932
+ stations: {
5933
+ /**
5934
+ * Each check-in station of the quest's current release, in its order, with its status now,
5935
+ * its last revoke or restore, and its completions; requires `read`.
5936
+ *
5937
+ * @experimental A minor release can change check-in stations.
5938
+ */
5939
+ list: (quest, call) => get(
5940
+ `/quests/${identifier.parse(quest)}/stations`,
5941
+ z55.array(questStationStateSchema),
5942
+ call
5943
+ ),
5944
+ /**
5945
+ * Revokes a check-in station, such as one whose code leaked, with a reason; requires
5946
+ * `publish`, as pausing a quest does. From then on a transaction naming the station is
5947
+ * refused with `station-revoked`, whenever it was signed. It is an operation: it applies in
5948
+ * this environment at once, and a promotion never changes it. Revoking a revoked station
5949
+ * changes nothing.
5950
+ *
5951
+ * @experimental A minor release can change check-in stations.
5952
+ */
5953
+ revoke: station("revoke"),
5954
+ /**
5955
+ * Restores a revoked check-in station, with a reason; requires `publish`. Restoring a
5956
+ * station that is not revoked changes nothing.
5957
+ *
5958
+ * @experimental A minor release can change check-in stations.
5959
+ */
5960
+ restore: station("restore")
5961
+ },
5824
5962
  /**
5825
5963
  * Each quest's current release, the most recently published first, archived quests
5826
5964
  * included; requires `read` permission.
5827
5965
  */
5828
5966
  list: (call) => get("/quests/list", z55.array(publishedReleaseSchema), call),
5967
+ /**
5968
+ * `list` without each release's evaluator `code`; requires `read` permission. Code is most of
5969
+ * a release's size, up to a megabyte each, so use this to show or match quests.
5970
+ */
5971
+ listWithoutCode: (call) => get(
5972
+ "/quests/list-without-code",
5973
+ z55.array(publishedReleaseSchema.omit({ code: true })),
5974
+ call
5975
+ ),
5829
5976
  /** Pending and exhausted asynchronous balance checks. Requires read. */
5830
5977
  automaticScheduling: (query = {}, call) => get(
5831
5978
  `/quests/automatic-scheduling${queryString(automaticSchedulingQuerySchema.parse(query))}`,
@@ -5954,6 +6101,31 @@ function x({ get }) {
5954
6101
  }
5955
6102
  var xApi = (http) => x(http);
5956
6103
 
6104
+ // src/server/client/solana.ts
6105
+ function solana({ post }) {
6106
+ return {
6107
+ /**
6108
+ * Finalized, successful transactions as `ctx.wallet.transactions()` returns them, for a
6109
+ * testing kit's `facts.wallet.transactions`: Relay reads them through its Solana RPC and
6110
+ * decodes the program's instructions with the IDL a `settings.solanaProgram()` setting would
6111
+ * store (or `idl`); requires `read` permission and stores nothing. Each transaction is seen
6112
+ * by `wallet` (the fee payer by default) and must call `program`. Fails with 404
6113
+ * `transaction-not-found` for a signature the cluster has no transaction for, 409
6114
+ * `transaction-not-final` for one not finalized yet, and 422 `transaction-failed` for a
6115
+ * failed one.
6116
+ *
6117
+ * @experimental A minor release can change this method and its result.
6118
+ */
6119
+ transactionFixture: (input, call) => post(
6120
+ "/solana/transaction-fixtures",
6121
+ walletTransactionsSchema,
6122
+ solanaTransactionFixtureInputSchema.parse(input),
6123
+ call
6124
+ )
6125
+ };
6126
+ }
6127
+ var solanaApi = (http) => solana(http);
6128
+
5957
6129
  // src/server/client/discord.ts
5958
6130
  import * as z56 from "zod";
5959
6131
  function discord({ get, post }) {
@@ -6195,40 +6367,554 @@ var participantSignInInputSchema = /* @__PURE__ */ (() => z59.object({
6195
6367
  telegram: z59.object({ miniAppBotId: telegramBotIdSchema.nullable() }).strict().optional()
6196
6368
  }).strict())();
6197
6369
 
6198
- // src/server/development.ts
6199
- import * as z60 from "zod";
6200
- var developmentPreflightSchema = /* @__PURE__ */ (() => z60.object({
6201
- organization: z60.string(),
6202
- project: z60.string(),
6203
- environment: z60.enum(["test", "live"]),
6204
- identity: z60.object({
6205
- exchange: z60.literal("supported"),
6206
- activeIntegrations: z60.number().int().nonnegative()
6207
- }).optional(),
6208
- staging: z60.enum(["configured", "blocked"]),
6209
- development: z60.object({
6210
- status: z60.enum(["configured", "blocked"]),
6211
- // How `domino dev` reaches the preview origin: a Cloudflare tunnel, or a direct route on a
6212
- // local development stack. APIs that predate the field use tunnels.
6213
- transport: z60.enum(["tunnel", "direct"]).default("tunnel"),
6214
- missing: z60.array(z60.string()),
6215
- authentication: z60.array(z60.string())
6216
- }),
6217
- checks: z60.array(
6218
- z60.object({
6219
- id: z60.string(),
6220
- status: z60.enum(["ok", "error"]),
6221
- message: z60.string(),
6222
- missing: z60.array(z60.string()).optional(),
6223
- issues: z60.array(z60.string()).optional()
6224
- })
6225
- )
6226
- }))();
6370
+ // src/server/wallet-sign-in.ts
6371
+ var walletSignInErrorBrand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay.WalletSignInError"))();
6372
+ var WalletSignInError = class extends Error {
6373
+ constructor(message, code) {
6374
+ super(message);
6375
+ this.code = code;
6376
+ }
6377
+ code;
6378
+ name = "WalletSignInError";
6379
+ [walletSignInErrorBrand] = true;
6380
+ };
6381
+ function isWalletSignInError(value) {
6382
+ return value instanceof Error && value[walletSignInErrorBrand] === true;
6383
+ }
6384
+ var solanaChains = {
6385
+ mainnet: solanaMainnet,
6386
+ devnet: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
6387
+ testnet: "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"
6388
+ };
6389
+ var fieldOrder = [
6390
+ "URI",
6391
+ "Version",
6392
+ "Chain ID",
6393
+ "Nonce",
6394
+ "Issued At",
6395
+ "Expiration Time",
6396
+ "Not Before",
6397
+ "Request ID",
6398
+ "Resources"
6399
+ ];
6400
+ var fieldLine = /* @__PURE__ */ (() => new RegExp(`^(${fieldOrder.join("|")}):(?: (.*))?$`))();
6401
+ var dateTime = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
6402
+ var refuse = (code, message) => new WalletSignInError(message, code);
6403
+ var invalid = (message) => refuse("invalid-message", message);
6404
+ function time(value, field) {
6405
+ if (value === void 0) {
6406
+ return null;
6407
+ }
6408
+ const parsed = Date.parse(value);
6409
+ if (!dateTime.test(value) || Number.isNaN(parsed)) {
6410
+ throw invalid(`${field} is not an RFC 3339 date-time`);
6411
+ }
6412
+ return parsed;
6413
+ }
6414
+ function parse(message) {
6415
+ const lines = message.split("\n");
6416
+ const header = /^(?:([a-z][a-z0-9+.-]*):\/\/)?(\S+) wants you to sign in with your (Ethereum|Solana) account:$/.exec(
6417
+ lines[0] ?? ""
6418
+ );
6419
+ if (!header) {
6420
+ throw invalid(
6421
+ "The message does not start with an EIP-4361 or SIWS sign-in line"
6422
+ );
6423
+ }
6424
+ const [, scheme, domain, family] = header;
6425
+ const address = lines[1] ?? "";
6426
+ let index2 = 2;
6427
+ let statement = null;
6428
+ if (index2 < lines.length) {
6429
+ if (lines[index2] !== "") {
6430
+ throw invalid("The address is not followed by an empty line");
6431
+ }
6432
+ index2++;
6433
+ if (lines[index2] === "") {
6434
+ index2++;
6435
+ } else if (index2 < lines.length && !fieldLine.test(lines[index2])) {
6436
+ statement = lines[index2];
6437
+ index2++;
6438
+ if (lines[index2] !== "") {
6439
+ throw invalid("The statement is not followed by an empty line");
6440
+ }
6441
+ index2++;
6442
+ }
6443
+ }
6444
+ const fields = {};
6445
+ const resources2 = [];
6446
+ let position = -1;
6447
+ for (; index2 < lines.length; index2++) {
6448
+ const line = lines[index2];
6449
+ const field = fieldLine.exec(line);
6450
+ const name = field?.[1];
6451
+ const at = name ? fieldOrder.indexOf(name) : -1;
6452
+ if (!field || at <= position) {
6453
+ throw invalid(`Unexpected line ${JSON.stringify(line)}`);
6454
+ }
6455
+ position = at;
6456
+ if (name === "Resources") {
6457
+ if (field[2] !== void 0) {
6458
+ throw invalid("Resources are listed one per line");
6459
+ }
6460
+ while (lines[index2 + 1]?.startsWith("- ")) {
6461
+ resources2.push(lines[++index2].slice(2));
6462
+ }
6463
+ } else if (field[2] === void 0 || field[2] === "") {
6464
+ throw invalid(`${name} has no value`);
6465
+ } else {
6466
+ fields[name] = field[2];
6467
+ }
6468
+ }
6469
+ return {
6470
+ scheme: scheme ?? null,
6471
+ domain,
6472
+ family,
6473
+ address,
6474
+ statement,
6475
+ fields,
6476
+ resources: resources2
6477
+ };
6478
+ }
6479
+ async function verifyWalletSignIn(input) {
6480
+ const origin = new URL(input.origin);
6481
+ if (origin.origin !== input.origin) {
6482
+ throw new TypeError(
6483
+ `Pass the app's exact origin, such as ${origin.origin}, as origin`
6484
+ );
6485
+ }
6486
+ const now = input.now ?? Date.now();
6487
+ const maxAge = input.maxAge ?? 6e5;
6488
+ const parsed = parse(input.message);
6489
+ const { fields } = parsed;
6490
+ const evm = parsed.family === "Ethereum";
6491
+ if (parsed.domain.toLowerCase() !== origin.host || parsed.scheme !== null && parsed.scheme + ":" !== origin.protocol) {
6492
+ throw refuse(
6493
+ "wrong-domain",
6494
+ `The message is for ${parsed.domain}, not ${origin.host}`
6495
+ );
6496
+ }
6497
+ if (fields.URI !== void 0) {
6498
+ let uri;
6499
+ try {
6500
+ uri = new URL(fields.URI);
6501
+ } catch {
6502
+ throw invalid("URI is not a URL");
6503
+ }
6504
+ if (uri.origin !== origin.origin) {
6505
+ throw refuse(
6506
+ "wrong-domain",
6507
+ `The message's URI ${fields.URI} is not on ${origin.origin}`
6508
+ );
6509
+ }
6510
+ } else if (evm) {
6511
+ throw invalid("An EIP-4361 message needs a URI");
6512
+ }
6513
+ if ((evm || fields.Version !== void 0) && fields.Version !== "1") {
6514
+ throw invalid("Version must be 1");
6515
+ }
6516
+ let chainId;
6517
+ if (evm) {
6518
+ chainId = "eip155:" + fields["Chain ID"];
6519
+ if (!isEvmChainId(chainId)) {
6520
+ throw invalid("An EIP-4361 message needs a numeric Chain ID");
6521
+ }
6522
+ } else {
6523
+ const cluster = (fields["Chain ID"] ?? "mainnet").replace(/^solana:/, "");
6524
+ const known = Object.hasOwn(solanaChains, cluster) ? solanaChains[cluster] : void 0;
6525
+ if (!known) {
6526
+ throw refuse(
6527
+ "unsupported-chain",
6528
+ `Unknown Solana Chain ID ${fields["Chain ID"]}`
6529
+ );
6530
+ }
6531
+ chainId = known;
6532
+ }
6533
+ const accepted = input.chains.map((chain2) => {
6534
+ const cluster = /^solana:(mainnet|devnet|testnet)$/.exec(chain2);
6535
+ return cluster ? solanaChains[cluster[1]] : chain2;
6536
+ });
6537
+ if (!accepted.includes(chainId)) {
6538
+ throw refuse(
6539
+ "unsupported-chain",
6540
+ `The message signs in on ${chainId}, which is not among ${input.chains.join(", ")}`
6541
+ );
6542
+ }
6543
+ if (fields.Nonce === void 0 || fields.Nonce !== input.nonce) {
6544
+ throw refuse(
6545
+ "wrong-nonce",
6546
+ "The message's nonce is not the one issued for this sign-in"
6547
+ );
6548
+ }
6549
+ const issuedAt = time(fields["Issued At"], "Issued At");
6550
+ const expiresAt = time(fields["Expiration Time"], "Expiration Time");
6551
+ const notBefore = time(fields["Not Before"], "Not Before");
6552
+ if (issuedAt === null) {
6553
+ throw invalid("The message needs an Issued At time");
6554
+ }
6555
+ if (issuedAt > now + 6e4 || notBefore !== null && notBefore > now) {
6556
+ throw refuse("not-yet-valid", "The message is not valid yet");
6557
+ }
6558
+ if (now - issuedAt > maxAge || expiresAt !== null && expiresAt <= now) {
6559
+ throw refuse("expired", "The message has expired");
6560
+ }
6561
+ const chain = evm ? "eip155" : "solana";
6562
+ const address = canonicalWalletAddress(chain, parsed.address);
6563
+ if (!address) {
6564
+ throw invalid(`The address is not ${evm ? "an EVM" : "a Solana"} address`);
6565
+ }
6566
+ const account2 = { kind: "wallet", chain, address };
6567
+ const signature = typeof input.signature === "string" ? input.signature : evm ? "0x" + hex(input.signature) : base58(input.signature);
6568
+ if (!await walletSignatureValid({
6569
+ chain: account2.chain,
6570
+ address: account2.address,
6571
+ message: input.message,
6572
+ signature
6573
+ })) {
6574
+ throw refuse(
6575
+ "invalid-signature",
6576
+ "The signature is not this wallet's signature over this message"
6577
+ );
6578
+ }
6579
+ return {
6580
+ account: account2,
6581
+ accountId: caip10({ ...account2, network: null }, chainId),
6582
+ chainId,
6583
+ issuedAt,
6584
+ expiresAt
6585
+ };
6586
+ }
6587
+
6588
+ // src/solana-transaction-messages.ts
6589
+ var maxSolanaTransactionBytes = 1232;
6590
+ var SolanaTransactionShapeError = class extends Error {
6591
+ name = "SolanaTransactionShapeError";
6592
+ };
6593
+ var refuse2 = (message) => {
6594
+ throw new SolanaTransactionShapeError(message);
6595
+ };
6596
+ function key(address, what) {
6597
+ return base58Bytes(address, 32) ?? refuse2(`${what} is not a Solana address`);
6598
+ }
6599
+ function shortVec(value) {
6600
+ const bytes = [];
6601
+ for (let rest = value; ; ) {
6602
+ const byte = rest & 127;
6603
+ rest >>= 7;
6604
+ if (rest === 0) {
6605
+ bytes.push(byte);
6606
+ return bytes;
6607
+ }
6608
+ bytes.push(byte | 128);
6609
+ }
6610
+ }
6611
+ function reader(bytes) {
6612
+ let offset = 0;
6613
+ const take = (length2) => {
6614
+ if (offset + length2 > bytes.length) {
6615
+ refuse2("The transaction ends early");
6616
+ }
6617
+ const slice = bytes.slice(offset, offset + length2);
6618
+ offset += length2;
6619
+ return slice;
6620
+ };
6621
+ const byte = () => take(1)[0];
6622
+ const length = () => {
6623
+ let value = 0;
6624
+ for (let shift = 0; shift < 21; shift += 7) {
6625
+ const next = byte();
6626
+ value |= (next & 127) << shift;
6627
+ if (!(next & 128)) {
6628
+ return value;
6629
+ }
6630
+ }
6631
+ return refuse2("The transaction has a malformed length");
6632
+ };
6633
+ const list = (item) => Array.from({ length: length() }, () => item());
6634
+ return {
6635
+ take,
6636
+ byte,
6637
+ length,
6638
+ list,
6639
+ rest: () => take(bytes.length - offset),
6640
+ done: () => offset === bytes.length
6641
+ };
6642
+ }
6643
+ function decodeMessage(bytes) {
6644
+ const read = reader(bytes);
6645
+ const first = bytes[0];
6646
+ let version = "legacy";
6647
+ if (first !== void 0 && first & 128) {
6648
+ if ((first & 127) !== 0) {
6649
+ refuse2(
6650
+ `Version ${first & 127} transactions are not supported: use a legacy or version 0 message`
6651
+ );
6652
+ }
6653
+ read.byte();
6654
+ version = 0;
6655
+ }
6656
+ const header = [
6657
+ read.byte(),
6658
+ read.byte(),
6659
+ read.byte()
6660
+ ];
6661
+ const accounts = read.list(() => read.take(32));
6662
+ const blockhash = read.take(32);
6663
+ const instructions = read.list(() => ({
6664
+ program: read.byte(),
6665
+ accounts: read.list(read.byte),
6666
+ data: read.take(read.length())
6667
+ }));
6668
+ const lookups = version === 0 ? read.list(() => ({
6669
+ table: read.take(32),
6670
+ writable: read.list(read.byte),
6671
+ readonly: read.list(read.byte)
6672
+ })) : [];
6673
+ if (!read.done()) {
6674
+ refuse2("The transaction has bytes after its message");
6675
+ }
6676
+ return { version, header, accounts, blockhash, instructions, lookups };
6677
+ }
6678
+ function encodeMessage(message) {
6679
+ const indexes = (values) => [...shortVec(values.length), ...values];
6680
+ const bytes = [
6681
+ ...message.version === 0 ? [128] : [],
6682
+ ...message.header,
6683
+ ...shortVec(message.accounts.length),
6684
+ ...message.accounts.flatMap((account2) => [...account2]),
6685
+ ...message.blockhash,
6686
+ ...shortVec(message.instructions.length),
6687
+ ...message.instructions.flatMap((instruction) => [
6688
+ instruction.program,
6689
+ ...indexes(instruction.accounts),
6690
+ ...shortVec(instruction.data.length),
6691
+ ...instruction.data
6692
+ ])
6693
+ ];
6694
+ if (message.version === 0) {
6695
+ bytes.push(...shortVec(message.lookups.length));
6696
+ for (const lookup of message.lookups) {
6697
+ bytes.push(
6698
+ ...lookup.table,
6699
+ ...indexes(lookup.writable),
6700
+ ...indexes(lookup.readonly)
6701
+ );
6702
+ }
6703
+ }
6704
+ return Uint8Array.from(bytes);
6705
+ }
6706
+ function compileKitMessage(message) {
6707
+ const version = message.version === "legacy" ? "legacy" : message.version === 0 ? 0 : refuse2(
6708
+ `Version ${String(message.version)} transactions are not supported: use a legacy or version 0 message`
6709
+ );
6710
+ const payer = message.feePayer?.address ?? refuse2("Set the transaction message's fee payer");
6711
+ const lifetime = message.lifetimeConstraint;
6712
+ const blockhash = lifetime && "blockhash" in lifetime ? lifetime.blockhash : lifetime && "nonce" in lifetime ? lifetime.nonce : refuse2("Set the transaction message's blockhash or nonce lifetime");
6713
+ const statics = /* @__PURE__ */ new Map([[payer, 3]]);
6714
+ const looked = /* @__PURE__ */ new Map();
6715
+ const add = (address, role) => statics.set(address, (statics.get(address) ?? 0) | role);
6716
+ for (const instruction of message.instructions) {
6717
+ add(instruction.programAddress, 0);
6718
+ for (const account2 of instruction.accounts ?? []) {
6719
+ if (account2.lookupTableAddress === void 0 || account2.role & 2) {
6720
+ add(account2.address, account2.role);
6721
+ continue;
6722
+ }
6723
+ if (version === "legacy") {
6724
+ refuse2("A legacy message can't load accounts from a lookup table");
6725
+ }
6726
+ const known = looked.get(account2.address);
6727
+ looked.set(account2.address, {
6728
+ table: account2.lookupTableAddress,
6729
+ index: account2.addressIndex ?? refuse2("A lookup table account needs its addressIndex"),
6730
+ writable: !!(account2.role & 1) || !!known?.writable
6731
+ });
6732
+ }
6733
+ }
6734
+ for (const [address, entry] of looked) {
6735
+ if (statics.has(address)) {
6736
+ add(address, entry.writable ? 1 : 0);
6737
+ looked.delete(address);
6738
+ }
6739
+ }
6740
+ const rank = (role) => 3 - role;
6741
+ const [first, ...rest] = [...statics];
6742
+ const ordered = [first, ...rest.sort(([, a], [, b]) => rank(a) - rank(b))];
6743
+ const count = (match) => ordered.filter(([, role]) => match(role)).length;
6744
+ const tables = /* @__PURE__ */ new Map();
6745
+ for (const [address, entry] of looked) {
6746
+ const table = tables.get(entry.table) ?? { writable: [], readonly: [] };
6747
+ table[entry.writable ? "writable" : "readonly"].push([address, entry.index]);
6748
+ tables.set(entry.table, table);
6749
+ }
6750
+ const position = new Map(ordered.map(([address], index2) => [address, index2]));
6751
+ let next = ordered.length;
6752
+ for (const kind of ["writable", "readonly"]) {
6753
+ for (const table of tables.values()) {
6754
+ for (const [address] of table[kind]) {
6755
+ position.set(address, next++);
6756
+ }
6757
+ }
6758
+ }
6759
+ if (next > 256) {
6760
+ refuse2("The transaction names more than 256 accounts");
6761
+ }
6762
+ const at = (address) => position.get(address);
6763
+ return {
6764
+ version,
6765
+ header: [
6766
+ count((role) => (role & 2) !== 0),
6767
+ count((role) => role === 2),
6768
+ count((role) => (role & 2) === 0 && (role & 1) === 0)
6769
+ ],
6770
+ accounts: ordered.map(([address]) => key(address, address)),
6771
+ blockhash: key(blockhash, "The transaction's blockhash"),
6772
+ instructions: message.instructions.map((instruction) => ({
6773
+ program: at(instruction.programAddress),
6774
+ accounts: (instruction.accounts ?? []).map(({ address }) => at(address)),
6775
+ data: Uint8Array.from(instruction.data ?? [])
6776
+ })),
6777
+ lookups: [...tables].map(([table, entries]) => ({
6778
+ table: key(table, "A lookup table address"),
6779
+ writable: entries.writable.map(([, index2]) => index2),
6780
+ readonly: entries.readonly.map(([, index2]) => index2)
6781
+ }))
6782
+ };
6783
+ }
6784
+ function withInstruction(message, program, data) {
6785
+ const programKey = key(program, "The program");
6786
+ const existing = message.accounts.findIndex(
6787
+ (account2) => account2.every((byte, index2) => byte === programKey[index2])
6788
+ );
6789
+ if (existing >= 0) {
6790
+ return {
6791
+ ...message,
6792
+ instructions: [
6793
+ ...message.instructions,
6794
+ { program: existing, accounts: [], data }
6795
+ ]
6796
+ };
6797
+ }
6798
+ const statics = message.accounts.length;
6799
+ const shift = (index2) => index2 >= statics ? index2 + 1 : index2;
6800
+ return {
6801
+ ...message,
6802
+ header: [message.header[0], message.header[1], message.header[2] + 1],
6803
+ accounts: [...message.accounts, programKey],
6804
+ instructions: [
6805
+ ...message.instructions.map((instruction) => ({
6806
+ program: shift(instruction.program),
6807
+ accounts: instruction.accounts.map(shift),
6808
+ data: instruction.data
6809
+ })),
6810
+ { program: statics, accounts: [], data }
6811
+ ]
6812
+ };
6813
+ }
6814
+ function base64(bytes) {
6815
+ let binary = "";
6816
+ for (const byte of bytes) {
6817
+ binary += String.fromCharCode(byte);
6818
+ }
6819
+ return btoa(binary);
6820
+ }
6821
+ function fromBase64(value) {
6822
+ let binary;
6823
+ try {
6824
+ binary = atob(value);
6825
+ } catch {
6826
+ return refuse2("The transaction is not base64");
6827
+ }
6828
+ return Uint8Array.from(binary, (character) => character.charCodeAt(0));
6829
+ }
6830
+ function splitWire(bytes) {
6831
+ const read = reader(bytes);
6832
+ const signatures = read.list(() => read.take(64));
6833
+ return { signatures, message: read.rest() };
6834
+ }
6835
+ var isBytes = (value) => value instanceof Uint8Array;
6836
+ function messageOf(transaction2) {
6837
+ if (typeof transaction2 === "string" || isBytes(transaction2)) {
6838
+ const wire = typeof transaction2 === "string" ? fromBase64(transaction2) : Uint8Array.from(transaction2);
6839
+ const { signatures, message } = splitWire(wire);
6840
+ const decoded = decodeMessage(message);
6841
+ if (signatures.length !== decoded.header[0]) {
6842
+ refuse2(
6843
+ `The transaction has ${signatures.length} signatures where its message needs ${decoded.header[0]}`
6844
+ );
6845
+ }
6846
+ return {
6847
+ message: decoded,
6848
+ signed: signatures.some((signature) => signature.some(Boolean))
6849
+ };
6850
+ }
6851
+ if ("messageBytes" in transaction2) {
6852
+ return {
6853
+ message: decodeMessage(Uint8Array.from(transaction2.messageBytes)),
6854
+ signed: Object.values(transaction2.signatures).some(
6855
+ (signature) => signature !== null && signature.some(Boolean)
6856
+ )
6857
+ };
6858
+ }
6859
+ if (Array.isArray(transaction2.instructions)) {
6860
+ return { message: compileKitMessage(transaction2), signed: false };
6861
+ }
6862
+ return refuse2(
6863
+ "Return a @solana/kit transaction message, a compiled transaction, or the transaction's bytes"
6864
+ );
6865
+ }
6866
+ function appendSolanaInstruction(transaction2, program, data) {
6867
+ const { message, signed } = messageOf(transaction2);
6868
+ if (signed) {
6869
+ refuse2(
6870
+ "The transaction is already signed, and Domino's memo would void the signature: return it unsigned"
6871
+ );
6872
+ }
6873
+ if (!message.instructions.length) {
6874
+ refuse2("The transaction has no instructions");
6875
+ }
6876
+ const bytes = encodeMessage(withInstruction(message, program, data));
6877
+ const signatures = message.header[0];
6878
+ const wire = Uint8Array.from([
6879
+ ...shortVec(signatures),
6880
+ ...new Uint8Array(signatures * 64),
6881
+ ...bytes
6882
+ ]);
6883
+ if (wire.length > maxSolanaTransactionBytes) {
6884
+ refuse2(
6885
+ `The transaction takes ${wire.length} bytes with Domino's memo, more than Solana's ${maxSolanaTransactionBytes}`
6886
+ );
6887
+ }
6888
+ return base64(wire);
6889
+ }
6890
+ function decodeSolanaTransaction(transaction2) {
6891
+ const { signatures, message } = splitWire(fromBase64(transaction2));
6892
+ const decoded = decodeMessage(message);
6893
+ const loaded = ["writable", "readonly"].flatMap(
6894
+ (kind) => decoded.lookups.flatMap(
6895
+ ({ table, ...indexes }) => indexes[kind].map((index2) => `${base58(table)}#${index2}`)
6896
+ )
6897
+ );
6898
+ const names = [...decoded.accounts.map(base58), ...loaded];
6899
+ return {
6900
+ version: decoded.version,
6901
+ signatures: signatures.length,
6902
+ feePayer: names[0],
6903
+ blockhash: base58(decoded.blockhash),
6904
+ instructions: decoded.instructions.map(
6905
+ (instruction) => ({
6906
+ program: names[instruction.program],
6907
+ accounts: instruction.accounts.map((index2) => names[index2]),
6908
+ data: instruction.data
6909
+ })
6910
+ )
6911
+ };
6912
+ }
6227
6913
 
6228
6914
  // src/server/hosted.ts
6229
- import * as z61 from "zod";
6915
+ import * as z60 from "zod";
6230
6916
  var hostedKeyPermissions = ["read", "points", "ingest"];
6231
- var hostedKeyPermissionList = /* @__PURE__ */ (() => z61.array(z61.string()).transform(
6917
+ var hostedKeyPermissionList = /* @__PURE__ */ (() => z60.array(z60.string()).transform(
6232
6918
  (values) => values.filter(
6233
6919
  (value) => hostedKeyPermissions.includes(value)
6234
6920
  )
@@ -6240,17 +6926,17 @@ var hostedManagementBindings = [
6240
6926
  "DOMINO_PROJECT",
6241
6927
  "DOMINO_ENVIRONMENT"
6242
6928
  ];
6243
- var hostedKeySecretSchema = /* @__PURE__ */ (() => z61.string().regex(/^dhk_[A-Za-z0-9_-]{43}$/, "Expected a hosted app key"))();
6244
- var hostedKeySchema = /* @__PURE__ */ (() => z61.object({
6245
- id: z61.string().uuid(),
6929
+ var hostedKeySecretSchema = /* @__PURE__ */ (() => z60.string().regex(/^dhk_[A-Za-z0-9_-]{43}$/, "Expected a hosted app key"))();
6930
+ var hostedKeySchema = /* @__PURE__ */ (() => z60.object({
6931
+ id: z60.string().uuid(),
6246
6932
  token: hostedKeySecretSchema,
6247
6933
  organization: identifier,
6248
6934
  project: identifier,
6249
- environment: z61.enum(["test", "live"]),
6935
+ environment: z60.enum(["test", "live"]),
6250
6936
  permissions: hostedKeyPermissionList,
6251
- expiresAt: z61.number().nullable()
6937
+ expiresAt: z60.number().nullable()
6252
6938
  }).strict())();
6253
- var hostedDeploymentKeySchema = /* @__PURE__ */ (() => hostedKeySchema.extend({ apiUrl: z61.string().url() }).strict())();
6939
+ var hostedDeploymentKeySchema = /* @__PURE__ */ (() => hostedKeySchema.extend({ apiUrl: z60.string().url() }).strict())();
6254
6940
  function hostedManagementClient(env) {
6255
6941
  const missing = hostedManagementBindings.filter((name) => !env[name]);
6256
6942
  if (missing.length) {
@@ -6258,7 +6944,7 @@ function hostedManagementClient(env) {
6258
6944
  `Missing ${missing.join(", ")}. Domino sets these for hosted apps and domino dev; update the project's vite.config.ts to forward them in development.`
6259
6945
  );
6260
6946
  }
6261
- const environment = z61.enum(["test", "live"]).parse(env.DOMINO_ENVIRONMENT);
6947
+ const environment = z60.enum(["test", "live"]).parse(env.DOMINO_ENVIRONMENT);
6262
6948
  const token = env.DOMINO_MANAGEMENT_KEY;
6263
6949
  return createManagementClient({
6264
6950
  baseUrl: env.DOMINO_API_URL.replace(/\/+$/, ""),
@@ -6269,6 +6955,690 @@ function hostedManagementClient(env) {
6269
6955
  });
6270
6956
  }
6271
6957
 
6958
+ // src/server/quest-actions.ts
6959
+ var solanaActionVersion = "2.4";
6960
+ var step = "domino-step";
6961
+ var maxBody = 16 * 1024;
6962
+ var metadataTtl = 6e4;
6963
+ var defaultConfirmTimeout = 45e3;
6964
+ var pollInterval = 1500;
6965
+ var refusalBrand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay.QuestActionRefusal"))();
6966
+ var QuestActionRefusal = class extends Error {
6967
+ constructor(message, status = 422) {
6968
+ super(message);
6969
+ this.status = status;
6970
+ }
6971
+ status;
6972
+ name = "QuestActionRefusal";
6973
+ [refusalBrand] = true;
6974
+ };
6975
+ function isRefusal(value) {
6976
+ return value instanceof Error && value[refusalBrand] === true;
6977
+ }
6978
+ function solanaActionHeaders(chain) {
6979
+ return new Headers({
6980
+ "Access-Control-Allow-Origin": "*",
6981
+ "Access-Control-Allow-Methods": "GET,POST,PUT,OPTIONS",
6982
+ "Access-Control-Allow-Headers": "Content-Type, Authorization, Content-Encoding, Accept-Encoding, X-Accept-Action-Version, X-Accept-Blockchain-Ids",
6983
+ "Access-Control-Expose-Headers": "X-Action-Version, X-Blockchain-Ids",
6984
+ "X-Action-Version": solanaActionVersion,
6985
+ "X-Blockchain-Ids": chain
6986
+ });
6987
+ }
6988
+ function json2(chain, body, status = 200) {
6989
+ const headers = solanaActionHeaders(chain);
6990
+ headers.set("Content-Type", "application/json");
6991
+ return new Response(JSON.stringify(body), { status, headers });
6992
+ }
6993
+ var failure = (chain, message, status) => json2(chain, { message }, status);
6994
+ async function readBody(request) {
6995
+ const text = request.body ? await boundedBodyText(request.body, maxBody) : "";
6996
+ if (text === null) {
6997
+ return null;
6998
+ }
6999
+ if (!text.trim()) {
7000
+ return {};
7001
+ }
7002
+ try {
7003
+ const value = JSON.parse(text);
7004
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
7005
+ } catch {
7006
+ return null;
7007
+ }
7008
+ }
7009
+ function stepHref(request, value, extra = {}) {
7010
+ const url = new URL(request.url);
7011
+ url.searchParams.set(step, value);
7012
+ for (const [name, item] of Object.entries(extra)) {
7013
+ url.searchParams.set(name, item);
7014
+ }
7015
+ return url.pathname + url.search;
7016
+ }
7017
+ var wait = (ms) => new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
7018
+ function defineQuestAction(options) {
7019
+ const chain = solanaTransactionSubmissionSchema.shape.chain.parse(options.chain);
7020
+ const confirmTimeout = options.confirmTimeout ?? defaultConfirmTimeout;
7021
+ const { clientFor, cardFor } = questActionContext(options);
7022
+ return async function questAction(request, env) {
7023
+ if (request.method === "OPTIONS") {
7024
+ return new Response(null, {
7025
+ status: 204,
7026
+ headers: solanaActionHeaders(chain)
7027
+ });
7028
+ }
7029
+ if (request.method !== "GET" && request.method !== "POST") {
7030
+ return failure(chain, `${request.method} is not an action method`, 405);
7031
+ }
7032
+ try {
7033
+ const client = clientFor(env);
7034
+ const card = await cardFor(client, request);
7035
+ if (request.method === "GET") {
7036
+ return json2(chain, actionCard(card, options.metadata, request));
7037
+ }
7038
+ const body = await readBody(request);
7039
+ if (!body) {
7040
+ return failure(chain, "Send a JSON body of at most 16 KB", 400);
7041
+ }
7042
+ const url = new URL(request.url);
7043
+ switch (url.searchParams.get(step)) {
7044
+ case null:
7045
+ return await transaction(chain, card, options, request, url, body);
7046
+ case "complete":
7047
+ return await complete(
7048
+ chain,
7049
+ client,
7050
+ card,
7051
+ options,
7052
+ request,
7053
+ confirmTimeout,
7054
+ body
7055
+ );
7056
+ case "link":
7057
+ return json2(chain, {
7058
+ type: "external-link",
7059
+ externalLink: new URL(options.linkUrl, request.url).href
7060
+ });
7061
+ case "recheck":
7062
+ return json2(chain, {
7063
+ type: "post",
7064
+ links: {
7065
+ next: {
7066
+ type: "post",
7067
+ href: stepHref(request, "complete")
7068
+ }
7069
+ }
7070
+ });
7071
+ default:
7072
+ return failure(chain, "Unknown action step", 400);
7073
+ }
7074
+ } catch (error) {
7075
+ return questActionError(chain, error);
7076
+ }
7077
+ };
7078
+ }
7079
+ function questActionContext(options) {
7080
+ let cached;
7081
+ let hosted;
7082
+ const clientFor = (env) => {
7083
+ if (options.management) {
7084
+ return options.management;
7085
+ }
7086
+ const source = options.env ?? (env && typeof env === "object" && hostedManagementBindings.some((name) => name in env) ? env : globalThis.process?.env ?? {});
7087
+ const bindings = JSON.stringify(
7088
+ hostedManagementBindings.map((name) => source[name] ?? null)
7089
+ );
7090
+ if (hosted?.bindings !== bindings) {
7091
+ hosted = { bindings, client: hostedManagementClient(source) };
7092
+ }
7093
+ return hosted.client;
7094
+ };
7095
+ const cardFor = (client, request) => {
7096
+ const now = Date.now();
7097
+ if (!cached || cached.client !== client || now - cached.at > metadataTtl) {
7098
+ const card = questCard(client, options.quest, request);
7099
+ cached = { at: now, client, card };
7100
+ card.catch(() => {
7101
+ if (cached?.card === card) {
7102
+ cached = void 0;
7103
+ }
7104
+ });
7105
+ }
7106
+ return cached.card;
7107
+ };
7108
+ return { clientFor, cardFor };
7109
+ }
7110
+ function questActionError(chain, error) {
7111
+ if (isRefusal(error)) {
7112
+ return failure(chain, error.message, error.status);
7113
+ }
7114
+ if (isManagementError(error)) {
7115
+ return failure(
7116
+ chain,
7117
+ error.status === void 0 || error.status >= 500 ? "Domino could not be reached. Try again in a minute." : `Domino refused the app's request: ${error.message}`,
7118
+ 502
7119
+ );
7120
+ }
7121
+ console.error(error);
7122
+ return failure(chain, "The action failed. Try again in a minute.", 500);
7123
+ }
7124
+ async function questCard(client, quest, request) {
7125
+ const [releases2, operations2] = await Promise.all([
7126
+ client.quests.listWithoutCode(),
7127
+ client.operations.list()
7128
+ ]);
7129
+ const release = releases2.find(
7130
+ (item) => item.quest === quest || item.key === quest
7131
+ );
7132
+ if (!release) {
7133
+ throw new QuestActionRefusal(
7134
+ `Quest ${quest} does not exist in this project`,
7135
+ 404
7136
+ );
7137
+ }
7138
+ return {
7139
+ id: release.quest,
7140
+ key: release.key ?? null,
7141
+ title: release.title,
7142
+ description: release.presentation.instructions ?? "",
7143
+ image: release.presentation.image ? new URL(release.presentation.image, request.url).href : null,
7144
+ closed: release.lifecycle === "archived" ? "This quest has ended." : release.lifecycle === "paused" || operations2.some(
7145
+ (item) => item.target === `quest:${release.quest}` && item.paused
7146
+ ) ? "This quest is paused." : takesSolanaTransaction(release.trigger) ? null : "This quest can't be completed from a wallet transaction.",
7147
+ stations: release.stations ?? null,
7148
+ revoked: new Set(
7149
+ (release.stations ?? []).flatMap(
7150
+ (station) => operations2.some(
7151
+ (item) => item.target === stationOperationTarget(release.quest, station.key) && item.paused
7152
+ ) ? [station.key] : []
7153
+ )
7154
+ )
7155
+ };
7156
+ }
7157
+ function questIcon(card, icon, request, option) {
7158
+ const url = icon ? new URL(icon, request.url).href : card.image;
7159
+ if (!url) {
7160
+ throw new QuestActionRefusal(
7161
+ `The quest has no image: give it one, or set ${option}`,
7162
+ 500
7163
+ );
7164
+ }
7165
+ return url;
7166
+ }
7167
+ function memberAccount(body) {
7168
+ const account2 = body.account;
7169
+ if (typeof account2 !== "string" || !base58Bytes(account2, 32)) {
7170
+ throw new QuestActionRefusal("Send the wallet's address as account", 400);
7171
+ }
7172
+ return account2;
7173
+ }
7174
+ function actionCard(card, metadata = {}, request) {
7175
+ return {
7176
+ type: "action",
7177
+ icon: questIcon(card, metadata.icon, request, "metadata.icon"),
7178
+ title: metadata.title ?? card.title,
7179
+ description: metadata.description ?? card.description,
7180
+ label: metadata.label ?? "Complete quest",
7181
+ ...card.closed ? { disabled: true, error: { message: card.closed } } : {},
7182
+ ...metadata.actions?.length ? {
7183
+ links: {
7184
+ actions: metadata.actions.map((action) => ({
7185
+ type: "transaction",
7186
+ ...action
7187
+ }))
7188
+ }
7189
+ } : {}
7190
+ };
7191
+ }
7192
+ function paramsOf(url, body) {
7193
+ const params = {};
7194
+ for (const [name, value] of url.searchParams) {
7195
+ if (name !== step) {
7196
+ params[name] = value;
7197
+ }
7198
+ }
7199
+ const data = body.data;
7200
+ if (data && typeof data === "object" && !Array.isArray(data)) {
7201
+ for (const [name, value] of Object.entries(data)) {
7202
+ if (typeof value === "string" || Array.isArray(value) && value.every((item) => typeof item === "string")) {
7203
+ params[name] = value;
7204
+ }
7205
+ }
7206
+ }
7207
+ return params;
7208
+ }
7209
+ function questMemo(card, reference) {
7210
+ try {
7211
+ return solanaActionMemo({ quest: card.key ?? card.id, reference });
7212
+ } catch {
7213
+ throw new QuestActionRefusal(
7214
+ `The reference must be 1 to ${maxSolanaActionReference} letters, digits, _ or -`,
7215
+ 400
7216
+ );
7217
+ }
7218
+ }
7219
+ function withQuestMemo(built, memo) {
7220
+ let serialized;
7221
+ try {
7222
+ serialized = appendSolanaInstruction(
7223
+ built,
7224
+ solanaMemoProgram,
7225
+ new TextEncoder().encode(memo)
7226
+ );
7227
+ } catch (error) {
7228
+ if (error instanceof SolanaTransactionShapeError) {
7229
+ throw new QuestActionRefusal(error.message, 500);
7230
+ }
7231
+ throw error;
7232
+ }
7233
+ const instructions = decodeSolanaTransaction(serialized).instructions;
7234
+ if (instructions.slice(0, -1).some(
7235
+ ({ program, data }) => program === solanaMemoProgram && parseSolanaActionMemo(new TextDecoder().decode(data)) !== null
7236
+ )) {
7237
+ throw new QuestActionRefusal(
7238
+ "The transaction already carries a Domino quest memo: return it without one, and the helper adds it",
7239
+ 500
7240
+ );
7241
+ }
7242
+ return serialized;
7243
+ }
7244
+ async function transaction(chain, card, options, request, url, body) {
7245
+ const account2 = memberAccount(body);
7246
+ if (card.closed) {
7247
+ return failure(chain, card.closed, 422);
7248
+ }
7249
+ const reference = await options.reference?.(request) ?? void 0;
7250
+ const memo = questMemo(card, reference);
7251
+ const built = await options.build({
7252
+ account: account2,
7253
+ params: paramsOf(url, body),
7254
+ quest: { id: card.id, key: card.key, title: card.title },
7255
+ request
7256
+ });
7257
+ const serialized = withQuestMemo(built, memo);
7258
+ return json2(chain, {
7259
+ type: "transaction",
7260
+ transaction: serialized,
7261
+ message: options.metadata?.message ?? `Completes "${card.title}"`,
7262
+ links: {
7263
+ next: { type: "post", href: stepHref(request, "complete") }
7264
+ }
7265
+ });
7266
+ }
7267
+ var passingRefusals = [
7268
+ "transaction-not-final",
7269
+ "attempt-pending",
7270
+ "conflict",
7271
+ "unavailable"
7272
+ ];
7273
+ async function submitQuestTransaction(client, input, deadline, retried = passingRefusals) {
7274
+ for (; ; ) {
7275
+ try {
7276
+ return {
7277
+ attempt: await client.attempts.submitSolanaTransaction(input, {
7278
+ timeout: Math.max(deadline - Date.now(), 5e3)
7279
+ })
7280
+ };
7281
+ } catch (error) {
7282
+ if (!isManagementError(error) || error.status === void 0 || !error.code || !retried.includes(error.code)) {
7283
+ throw error;
7284
+ }
7285
+ const pause = Math.min(Math.max(error.retryAfter ?? 2e3, 500), 5e3);
7286
+ if (deadline - Date.now() <= pause) {
7287
+ return { waiting: error };
7288
+ }
7289
+ await wait(pause);
7290
+ }
7291
+ }
7292
+ }
7293
+ async function complete(chain, client, card, options, request, confirmTimeout, body) {
7294
+ const signature = solanaSignatureSchema.safeParse(
7295
+ body.signature ?? new URL(request.url).searchParams.get("signature")
7296
+ );
7297
+ if (!signature.success) {
7298
+ return failure(chain, "Send the transaction's signature", 400);
7299
+ }
7300
+ const shown = actionCard(card, options.metadata, request);
7301
+ const done = (label, description) => ({
7302
+ type: "completed",
7303
+ icon: shown.icon,
7304
+ title: shown.title,
7305
+ label,
7306
+ description
7307
+ });
7308
+ const deadline = Date.now() + confirmTimeout;
7309
+ const left = () => deadline - Date.now();
7310
+ const later = done(
7311
+ "Confirming on Solana",
7312
+ "Confirming on Solana: check the quest in the app in a minute."
7313
+ );
7314
+ let attempt;
7315
+ try {
7316
+ const submitted = await submitQuestTransaction(
7317
+ client,
7318
+ { quest: card.id, signature: signature.data, chain },
7319
+ deadline
7320
+ );
7321
+ if ("waiting" in submitted) {
7322
+ return json2(
7323
+ chain,
7324
+ submitted.waiting.code === "transaction-not-final" ? later : submitted.waiting.code === "attempt-pending" ? done(
7325
+ "Still checking",
7326
+ "Your previous try on this quest is still being checked: check the quest in the app in a minute."
7327
+ ) : done("Try again", "Domino is busy. Try again in a minute.")
7328
+ );
7329
+ }
7330
+ attempt = submitted.attempt;
7331
+ } catch (error) {
7332
+ if (!isManagementError(error) || error.status === void 0) {
7333
+ throw error;
7334
+ }
7335
+ if (error.code === "wallet-not-linked") {
7336
+ return json2(chain, {
7337
+ ...shown,
7338
+ label: "Link your wallet",
7339
+ description: "This wallet is not linked to a member yet. Link it in the app, then check again.",
7340
+ disabled: false,
7341
+ error: { message: "Wallet not linked" },
7342
+ links: {
7343
+ actions: [
7344
+ {
7345
+ type: "external-link",
7346
+ href: stepHref(request, "link"),
7347
+ label: "Link your wallet"
7348
+ },
7349
+ {
7350
+ type: "post",
7351
+ href: stepHref(request, "recheck", {
7352
+ signature: signature.data
7353
+ }),
7354
+ label: "Check again"
7355
+ }
7356
+ ]
7357
+ }
7358
+ });
7359
+ }
7360
+ if (error.status >= 400 && error.status < 500) {
7361
+ return json2(chain, done("Not completed", error.message));
7362
+ }
7363
+ throw error;
7364
+ }
7365
+ for (; ; ) {
7366
+ switch (attempt.status) {
7367
+ case "accepted": {
7368
+ const managed = await client.attempts.get(attempt.id);
7369
+ const rewards = managed.attempt.reviewRewards ?? managed.release?.rewards ?? [];
7370
+ const points3 = rewards.reduce(
7371
+ (sum, reward) => sum + (reward.kind === "points" ? reward.amount : 0),
7372
+ 0
7373
+ );
7374
+ return json2(
7375
+ chain,
7376
+ done(
7377
+ points3 ? `+${points3} points` : "Quest complete",
7378
+ `You completed "${card.title}".`
7379
+ )
7380
+ );
7381
+ }
7382
+ case "rejected":
7383
+ return json2(
7384
+ chain,
7385
+ done(
7386
+ "Not completed",
7387
+ attempt.reason ?? "The quest's check did not pass."
7388
+ )
7389
+ );
7390
+ case "progressed":
7391
+ return json2(
7392
+ chain,
7393
+ done("Progress saved", attempt.reason ?? "Your progress is saved.")
7394
+ );
7395
+ case "needs-review":
7396
+ return json2(
7397
+ chain,
7398
+ done(
7399
+ "Submitted for review",
7400
+ "A reviewer checks it: see the quest in the app."
7401
+ )
7402
+ );
7403
+ case "failed":
7404
+ return json2(
7405
+ chain,
7406
+ done(
7407
+ "Couldn't check",
7408
+ attempt.reason ?? "Domino could not check the quest. Try it in the app."
7409
+ )
7410
+ );
7411
+ }
7412
+ if (left() <= pollInterval) {
7413
+ return json2(
7414
+ chain,
7415
+ done("Submitted", "Submitted: check the quest in the app in a minute.")
7416
+ );
7417
+ }
7418
+ await wait(pollInterval);
7419
+ attempt = (await client.attempts.get(attempt.id)).attempt;
7420
+ }
7421
+ }
7422
+ function actionsJson(rules = [
7423
+ { pathPattern: "/api/actions/**", apiPath: "/api/actions/**" }
7424
+ ], chain = "solana") {
7425
+ const network = solanaTransactionSubmissionSchema.shape.chain.parse(chain);
7426
+ return async (request) => request.method === "OPTIONS" ? new Response(null, {
7427
+ status: 204,
7428
+ headers: solanaActionHeaders(network)
7429
+ }) : request.method === "GET" || request.method === "HEAD" ? json2(network, { rules }) : failure(network, `${request.method} is not allowed`, 405);
7430
+ }
7431
+
7432
+ // src/server/station-actions.ts
7433
+ var systemProgram = "11111111111111111111111111111111";
7434
+ var zeroTransfer = /* @__PURE__ */ (() => Uint8Array.of(2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))();
7435
+ var defaultFindTimeout = 9e4;
7436
+ var findInterval = 2e3;
7437
+ var submitTimeout = 6e4;
7438
+ var workerBudget = 28e3;
7439
+ function defineStationAction(options) {
7440
+ const chain = solanaTransactionSubmissionSchema.shape.chain.parse(options.chain);
7441
+ const findTimeout = options.findTimeout ?? defaultFindTimeout;
7442
+ const { clientFor, cardFor } = questActionContext(options);
7443
+ return async function stationAction(request, env, context) {
7444
+ if (request.method === "OPTIONS") {
7445
+ return new Response(null, {
7446
+ status: 204,
7447
+ headers: solanaActionHeaders(chain)
7448
+ });
7449
+ }
7450
+ if (request.method !== "GET" && request.method !== "POST") {
7451
+ return failure(
7452
+ chain,
7453
+ `${request.method} is not a transaction request method`,
7454
+ 405
7455
+ );
7456
+ }
7457
+ try {
7458
+ const client = clientFor(env);
7459
+ const card = await cardFor(client, request);
7460
+ const station = openStation(card, request);
7461
+ if (request.method === "GET") {
7462
+ return json2(chain, {
7463
+ label: options.label ?? card.title,
7464
+ icon: questIcon(card, options.icon, request, "the icon option")
7465
+ });
7466
+ }
7467
+ const body = await readBody(request);
7468
+ if (!body) {
7469
+ return failure(chain, "Send a JSON body of at most 16 KB", 400);
7470
+ }
7471
+ const account2 = memberAccount(body);
7472
+ if (card.closed) {
7473
+ return failure(chain, card.closed, 422);
7474
+ }
7475
+ const memo = questMemo(card, station.key);
7476
+ const own = await options.instructions?.({
7477
+ account: account2,
7478
+ station,
7479
+ quest: { id: card.id, key: card.key, title: card.title },
7480
+ request
7481
+ }) ?? [];
7482
+ const { value } = await solanaRpc(
7483
+ options.rpcUrl,
7484
+ "getLatestBlockhash",
7485
+ [{ commitment: "confirmed" }]
7486
+ );
7487
+ const reference = base58(crypto.getRandomValues(new Uint8Array(32)));
7488
+ const message = {
7489
+ // Legacy, which every wallet that takes transaction requests reads.
7490
+ version: "legacy",
7491
+ feePayer: { address: account2 },
7492
+ lifetimeConstraint: { blockhash: value.blockhash },
7493
+ instructions: [...own, referenceTransfer(account2, reference)]
7494
+ };
7495
+ const transaction2 = withQuestMemo(message, memo);
7496
+ const worker = !options.waitUntil && context?.waitUntil !== void 0;
7497
+ const now = Date.now();
7498
+ const task = findAndSubmit(client, card, chain, {
7499
+ rpcUrl: options.rpcUrl,
7500
+ reference,
7501
+ deadline: now + findTimeout,
7502
+ stopAt: worker ? now + workerBudget : Infinity
7503
+ });
7504
+ const keep = options.waitUntil ?? context?.waitUntil?.bind(context);
7505
+ keep?.(task);
7506
+ return json2(chain, {
7507
+ transaction: transaction2,
7508
+ message: `Checks you in at ${station.label} for "${card.title}". Wallet not linked yet? Sign in at ${new URL(options.linkUrl, request.url).href} first.`
7509
+ });
7510
+ } catch (error) {
7511
+ return questActionError(chain, error);
7512
+ }
7513
+ };
7514
+ }
7515
+ function openStation(card, request) {
7516
+ const key2 = new URL(request.url).searchParams.get("station");
7517
+ if (!card.stations) {
7518
+ throw new QuestActionRefusal(
7519
+ `"${card.title}" has no check-in stations`,
7520
+ 422
7521
+ );
7522
+ }
7523
+ if (!key2) {
7524
+ throw new QuestActionRefusal(
7525
+ "Name the station in the URL, as ?station=<key>",
7526
+ 400
7527
+ );
7528
+ }
7529
+ const refusal = stationRefusal(card.stations, key2, Date.now());
7530
+ if (refusal?.code === "station-unknown") {
7531
+ throw new QuestActionRefusal(`"${card.title}" has no station "${key2}"`, 404);
7532
+ }
7533
+ const station = card.stations.find((item) => item.key === key2);
7534
+ if (refusal) {
7535
+ throw new QuestActionRefusal(`${station.label} is closed`, 409);
7536
+ }
7537
+ if (card.revoked.has(station.key)) {
7538
+ throw new QuestActionRefusal(
7539
+ `${station.label} no longer takes check-ins`,
7540
+ 409
7541
+ );
7542
+ }
7543
+ return station;
7544
+ }
7545
+ function referenceTransfer(account2, reference) {
7546
+ return {
7547
+ programAddress: systemProgram,
7548
+ accounts: [
7549
+ { address: account2, role: 3 },
7550
+ { address: account2, role: 1 },
7551
+ { address: reference, role: 0 }
7552
+ ],
7553
+ data: zeroTransfer
7554
+ };
7555
+ }
7556
+ async function findAndSubmit(client, card, chain, find) {
7557
+ const deadline = Math.min(find.deadline, find.stopAt);
7558
+ let found;
7559
+ let lastError;
7560
+ try {
7561
+ while (!found && Date.now() < deadline) {
7562
+ try {
7563
+ ;
7564
+ [found] = await solanaRpc(
7565
+ find.rpcUrl,
7566
+ "getSignaturesForAddress",
7567
+ [find.reference, { commitment: "confirmed", limit: 1 }]
7568
+ );
7569
+ } catch (error) {
7570
+ lastError = error;
7571
+ }
7572
+ if (!found) {
7573
+ await wait(Math.min(findInterval, deadline - Date.now()));
7574
+ }
7575
+ }
7576
+ if (!found) {
7577
+ if (lastError) {
7578
+ console.error(
7579
+ "Station check-in: the reference lookup failed",
7580
+ lastError
7581
+ );
7582
+ }
7583
+ return;
7584
+ }
7585
+ if (found.err) {
7586
+ console.error(
7587
+ `Station check-in: transaction ${found.signature} failed on chain`,
7588
+ found.err
7589
+ );
7590
+ return;
7591
+ }
7592
+ const submitted = await submitQuestTransaction(
7593
+ client,
7594
+ { quest: card.id, signature: found.signature, chain },
7595
+ Math.min(Date.now() + submitTimeout, find.stopAt),
7596
+ passingRefusals
7597
+ );
7598
+ if ("waiting" in submitted) {
7599
+ console.error(
7600
+ `Station check-in: Domino did not take transaction ${found.signature} in time`,
7601
+ submitted.waiting
7602
+ );
7603
+ }
7604
+ } catch (error) {
7605
+ console.error(
7606
+ `Station check-in: submitting ${found?.signature ?? "the transaction"} failed`,
7607
+ error
7608
+ );
7609
+ }
7610
+ }
7611
+
7612
+ // src/server/development.ts
7613
+ import * as z61 from "zod";
7614
+ var developmentPreflightSchema = /* @__PURE__ */ (() => z61.object({
7615
+ organization: z61.string(),
7616
+ project: z61.string(),
7617
+ environment: z61.enum(["test", "live"]),
7618
+ identity: z61.object({
7619
+ exchange: z61.literal("supported"),
7620
+ activeIntegrations: z61.number().int().nonnegative()
7621
+ }).optional(),
7622
+ staging: z61.enum(["configured", "blocked"]),
7623
+ development: z61.object({
7624
+ status: z61.enum(["configured", "blocked"]),
7625
+ // How `domino dev` reaches the preview origin: a Cloudflare tunnel, or a direct route on a
7626
+ // local development stack. APIs that predate the field use tunnels.
7627
+ transport: z61.enum(["tunnel", "direct"]).default("tunnel"),
7628
+ missing: z61.array(z61.string()),
7629
+ authentication: z61.array(z61.string())
7630
+ }),
7631
+ checks: z61.array(
7632
+ z61.object({
7633
+ id: z61.string(),
7634
+ status: z61.enum(["ok", "error"]),
7635
+ message: z61.string(),
7636
+ missing: z61.array(z61.string()).optional(),
7637
+ issues: z61.array(z61.string()).optional()
7638
+ })
7639
+ )
7640
+ }))();
7641
+
6272
7642
  // src/server/index.ts
6273
7643
  function clientFailure(error) {
6274
7644
  if (error instanceof ManagementError) {
@@ -6283,8 +7653,8 @@ function clientFailure(error) {
6283
7653
  }
6284
7654
  function guarded(api) {
6285
7655
  return Object.fromEntries(
6286
- Object.entries(api).map(([key, value]) => [
6287
- key,
7656
+ Object.entries(api).map(([key2, value]) => [
7657
+ key2,
6288
7658
  typeof value === "function" ? (...args) => {
6289
7659
  try {
6290
7660
  return Promise.resolve(value(...args)).catch((error) => {
@@ -6580,6 +7950,8 @@ function managementClient(options) {
6580
7950
  quests: questsApi(http),
6581
7951
  /** Public X data the project's configuration refers to by ID. */
6582
7952
  x: xApi(http),
7953
+ /** Solana reads for quest development. */
7954
+ solana: solanaApi(http),
6583
7955
  /**
6584
7956
  * This project and environment's Discord connection. An organization administrator installs
6585
7957
  * Domino's bot into a new server in Console; once one project of the organization connects a
@@ -6665,6 +8037,8 @@ var managementResponseTables = /* @__PURE__ */ (() => responseTables({
6665
8037
  collectionPreviewSchema: () => collectionPreviewSchema,
6666
8038
  completionRevocationSchema: () => completionRevocationSchema,
6667
8039
  completionRestorationSchema: () => completionRestorationSchema,
8040
+ completionReceiptSchema: () => completionReceiptSchema,
8041
+ completionReceiptListSchema: () => completionReceiptListSchema,
6668
8042
  connectionPageSchema: () => connectionPageSchema,
6669
8043
  connectionSchema: () => connectionSchema,
6670
8044
  connectionAuthorizationSchema: () => connectionAuthorizationSchema,
@@ -6715,6 +8089,7 @@ var managementResponseTables = /* @__PURE__ */ (() => responseTables({
6715
8089
  managedMemberIdentitySchema: () => managedMemberIdentitySchema,
6716
8090
  managedMemberPageSchema: () => managedMemberPageSchema,
6717
8091
  managedMemberProgressSchema: () => managedMemberProgressSchema,
8092
+ memberCompletionPageSchema: () => memberCompletionPageSchema,
6718
8093
  memberConsentHistorySchema: () => memberConsentHistorySchema,
6719
8094
  memberConsentListSchema: () => memberConsentListSchema,
6720
8095
  memberImportPageSchema: () => memberImportPageSchema,
@@ -6795,6 +8170,7 @@ var managementResponseTables = /* @__PURE__ */ (() => responseTables({
6795
8170
  trackerSummarySchema: () => trackerSummarySchema,
6796
8171
  trackerTriggerOutcomePageSchema: () => trackerTriggerOutcomePageSchema,
6797
8172
  walletBalanceChainsSchema: () => walletBalanceChainsSchema,
8173
+ walletTransactionsSchema: () => walletTransactionsSchema,
6798
8174
  webhookDeliveryPageSchema: () => webhookDeliveryPageSchema,
6799
8175
  webhookDeliverySchema: () => webhookDeliverySchema,
6800
8176
  webhookEndpointSchema: () => webhookEndpointSchema,
@@ -6825,6 +8201,7 @@ export {
6825
8201
  MemberImportRefusalCode,
6826
8202
  MemberImportState,
6827
8203
  PayoutSourceKind,
8204
+ QuestActionRefusal,
6828
8205
  REFERRAL_INTEGRATION_REWARD_ERROR2 as REFERRAL_INTEGRATION_REWARD_ERROR,
6829
8206
  RestoredDeliveryOutcome,
6830
8207
  RestoredEntitlementOutcome,
@@ -6834,10 +8211,12 @@ export {
6834
8211
  RevokedReferralOutcome,
6835
8212
  TestMemberDecisionKind,
6836
8213
  WEBHOOK_MAX_BYTES,
8214
+ WalletSignInError,
6837
8215
  accessHistoryQuerySchema,
6838
8216
  accessSchema,
6839
8217
  accountProfileSchema,
6840
8218
  accountVouchedBySchema,
8219
+ actionsJson,
6841
8220
  activeMemberMonthSchema,
6842
8221
  activeMemberUsageSchema,
6843
8222
  activityTypeSchema,
@@ -6916,6 +8295,9 @@ export {
6916
8295
  capturedFactSchema,
6917
8296
  commitSchema,
6918
8297
  compareAppMigrations,
8298
+ completionReceiptInputSchema,
8299
+ completionReceiptListSchema,
8300
+ completionReceiptSchema,
6919
8301
  completionRestorationSchema,
6920
8302
  completionRestoreSchema,
6921
8303
  completionRevocationSchema,
@@ -6955,6 +8337,9 @@ export {
6955
8337
  dashboardReadQuerySchema,
6956
8338
  dashboardReadSchema,
6957
8339
  dashboardSummarySchema,
8340
+ decodeSolanaTransaction,
8341
+ defineQuestAction,
8342
+ defineStationAction,
6958
8343
  deploymentActionSchema,
6959
8344
  deploymentRejectionSchema,
6960
8345
  developmentPreflightSchema,
@@ -7005,6 +8390,7 @@ export {
7005
8390
  isIntegrationParticipantPath,
7006
8391
  isManagementError,
7007
8392
  isParticipantRoute,
8393
+ isWalletSignInError,
7008
8394
  issuedAutomationKeySchema,
7009
8395
  issuedServiceKeySchema,
7010
8396
  issuedTokenSchema,
@@ -7054,6 +8440,9 @@ export {
7054
8440
  managementResponseSchemas,
7055
8441
  managementResponses,
7056
8442
  managementStateQuerySchema,
8443
+ maxCompletionReceipts,
8444
+ maxSolanaActionReference,
8445
+ maxSolanaTransactionBytes,
7057
8446
  memberAccountSchema,
7058
8447
  memberAccountUnlinkInputSchema,
7059
8448
  memberAppIdentitySchema,
@@ -7063,6 +8452,9 @@ export {
7063
8452
  memberBanPreviewSchema,
7064
8453
  memberBanRollbackSchema,
7065
8454
  memberBanSchema,
8455
+ memberCompletionPageSchema,
8456
+ memberCompletionQuerySchema,
8457
+ memberCompletionSchema,
7066
8458
  memberCreatorAccountUnlinkInputSchema,
7067
8459
  memberDetailSchema,
7068
8460
  memberErasureDeletedSchema,
@@ -7122,6 +8514,7 @@ export {
7122
8514
  pageSchema,
7123
8515
  parseImageExtraction,
7124
8516
  parseImageResult,
8517
+ parseSolanaActionMemo,
7125
8518
  participantExchangeAccountResultSchema,
7126
8519
  participantExchangeResultSchema,
7127
8520
  participantExchangeSchema,
@@ -7167,6 +8560,7 @@ export {
7167
8560
  questEnrollmentWithdrawalInputSchema,
7168
8561
  questLifecycleInputSchema,
7169
8562
  questLifecycleSchema,
8563
+ questStationStateSchema,
7170
8564
  readinessSchema,
7171
8565
  realPeopleInTestUsageSchema,
7172
8566
  referralManagementSchema,
@@ -7191,8 +8585,23 @@ export {
7191
8585
  serviceKeySchema,
7192
8586
  settlementPayoutCsv,
7193
8587
  shortensEvidenceRetention,
8588
+ solanaActionHeaders,
8589
+ solanaActionMemo,
8590
+ solanaActionVersion,
8591
+ solanaMemoProgram,
8592
+ solanaPayoutConfirmationResultSchema,
8593
+ solanaPayoutConfirmationSchema,
8594
+ solanaPayoutInputSchema,
8595
+ solanaPayoutMintSchema,
8596
+ solanaPayoutPageSchema,
8597
+ solanaPayoutQuerySchema,
8598
+ solanaPayoutSchema,
8599
+ solanaPayoutSquadsSchema,
8600
+ solanaSignatureSchema,
8601
+ solanaTransactionSubmissionSchema,
7194
8602
  sourceDataSchema2 as sourceDataSchema,
7195
8603
  sourceRoles,
8604
+ squadsProposalUrl,
7196
8605
  stageRequestSchema,
7197
8606
  stagedDeploymentContentSchema,
7198
8607
  stagedDeploymentKey,
@@ -7206,8 +8615,12 @@ export {
7206
8615
  starterIdSchema,
7207
8616
  starterTemplates,
7208
8617
  starters,
8618
+ stationOperationTarget,
8619
+ stationRevocationInputSchema,
8620
+ stationRevocationSchema,
7209
8621
  stockAdditionSchema,
7210
8622
  stockInputSchema,
8623
+ takesSolanaTransaction,
7211
8624
  teamSchema,
7212
8625
  telegramBotIdSchema,
7213
8626
  telegramIdentitySelectorSchema,
@@ -7250,9 +8663,11 @@ export {
7250
8663
  validateQuestShape2 as validateQuestShape,
7251
8664
  verifiedPassSchema,
7252
8665
  verifyScheduledRequest,
8666
+ verifyWalletSignIn,
7253
8667
  verifyWebhook,
7254
8668
  walletBalanceChainsSchema,
7255
8669
  walletIdentitySelectorSchema,
8670
+ walletLinkedEventDataSchema,
7256
8671
  webhookControlInputSchema,
7257
8672
  webhookCreateInputSchema,
7258
8673
  webhookDeleteInputSchema,