@domino-sdk/relay 1.67.0 → 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 +43 -0
  2. package/dist/{accounts-C2O8mpB8.d.ts → accounts-DnpKoJCo.d.ts} +210 -3
  3. package/dist/{attempt-captures-ClHAoo_n.d.ts → attempt-captures-DMNFMYFb.d.ts} +9 -1
  4. package/dist/authoring.d.ts +349 -38
  5. package/dist/authoring.js +125 -18
  6. package/dist/{automatic-outcomes-BEnPn4Uh.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 -13
  10. package/dist/{catalog-CbiftcxQ.d.ts → catalog-BLGie8Lh.d.ts} +60 -2
  11. package/dist/chunk-4JSPMFO2.js +427 -0
  12. package/dist/{chunk-5DZNMLDM.js → chunk-55WJVFWC.js} +2 -2
  13. package/dist/{chunk-Q5QVAF7R.js → chunk-5AKD4ZF3.js} +37 -25
  14. package/dist/{chunk-DSJ46QLB.js → chunk-6UBFSMCM.js} +1 -1
  15. package/dist/{chunk-P33ZAJMS.js → chunk-6YTSRWRB.js} +1199 -677
  16. package/dist/{chunk-RDUSFUXX.js → chunk-75KF633N.js} +9 -1
  17. package/dist/{chunk-Q6KTTVOI.js → chunk-7YSVZA7A.js} +1 -1
  18. package/dist/{chunk-BMJHFWVT.js → chunk-CZ7NQ7W7.js} +10 -43
  19. package/dist/{chunk-X3FMVRMM.js → chunk-DDJN2T5A.js} +1 -1
  20. package/dist/{chunk-KUNPCDN6.js → chunk-DNPDR4Z7.js} +16 -9
  21. package/dist/{chunk-RWR2LOPA.js → chunk-EXZVWQOQ.js} +2 -2
  22. package/dist/{chunk-MVQQDPQX.js → chunk-HXTKI34N.js} +14 -2
  23. package/dist/{chunk-FGXLXENM.js → chunk-IW46TW3A.js} +21 -1
  24. package/dist/{chunk-5SBA6X5X.js → chunk-KKHENO57.js} +2 -2
  25. package/dist/{chunk-U66GUVSG.js → chunk-LZXDYSUH.js} +2 -0
  26. package/dist/{chunk-QYC3CZVD.js → chunk-MEUAJIVO.js} +2 -2
  27. package/dist/{chunk-BQXRCJ3N.js → chunk-P4TPW4SY.js} +1 -1
  28. package/dist/{chunk-NRMQVK2W.js → chunk-R3MNZKNJ.js} +1 -1
  29. package/dist/{chunk-Z2Z5DBNW.js → chunk-SD74HD75.js} +45 -9
  30. package/dist/{chunk-JK3XV2CR.js → chunk-TYZFVL73.js} +50 -8
  31. package/dist/chunk-VAGGGB6B.js +87 -0
  32. package/dist/{chunk-2HHZV7U3.js → chunk-VRZZB7CQ.js} +1 -1
  33. package/dist/{client-CZPewB9h.d.ts → client-BMif22WQ.d.ts} +133 -7
  34. package/dist/{dashboards-jGPM3AxF.d.ts → dashboards-DMk-vL1q.d.ts} +4 -4
  35. package/dist/{deployments-BVFd7ddA.d.ts → deployments-BCr418BX.d.ts} +582 -173
  36. package/dist/{identity-integration-W1Vo3Ql9.d.ts → identity-integration-r76xaAax.d.ts} +1 -1
  37. package/dist/index.d.ts +10 -10
  38. package/dist/index.js +10 -10
  39. package/dist/internal.d.ts +137 -14
  40. package/dist/internal.js +240 -19
  41. package/dist/{limits-C4RzrOV4.d.ts → limits-ByVRQePO.d.ts} +6 -1
  42. package/dist/{offers-BpYenB9i.d.ts → offers-xcPbYaEv.d.ts} +2 -2
  43. package/dist/portal-proxy.d.ts +2 -2
  44. package/dist/portal-proxy.js +11 -11
  45. package/dist/react/index.d.ts +37 -15
  46. package/dist/react/index.js +12 -13
  47. package/dist/{reward-deliveries-BOWpMytr.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 +398 -104
  53. package/dist/schema.js +62 -8
  54. package/dist/server/index.d.ts +12 -12
  55. package/dist/server/index.js +2046 -886
  56. package/dist/{sign-in-providers-BRYVOSlG.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-C152xIdn.d.ts → submission-input-CaL8drIh.d.ts} +2 -2
  60. package/dist/{telegram-browser-657QqiQl.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 +85 -13
  64. package/dist/testing.js +101 -11
  65. package/dist/{tracker-data-BqY-9Vu-.d.ts → tracker-data-CAK942sx.d.ts} +298 -1
  66. package/dist/{transport-CthYgZXK.d.ts → transport-CkidqTOk.d.ts} +5250 -1226
  67. package/dist/{wallet-Btng186v.d.ts → wallet-DQtJelQQ.d.ts} +367 -13
  68. package/dist/wallet-browser-dpmr22Xv.d.ts +106 -0
  69. package/package.json +16 -1
  70. package/dist/chunk-UWUS4OOV.js +0 -59
  71. package/dist/chunk-UYVJZR33.js +0 -34
  72. package/dist/runtime/chunks/C2MGLQXC.js +0 -1
@@ -1,7 +1,47 @@
1
1
  import {
2
2
  attemptCaptureSchema,
3
3
  capturedFactSchema
4
- } from "../chunk-RDUSFUXX.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,
@@ -17,17 +57,18 @@ import {
17
57
  managementTransport,
18
58
  questConfiguration,
19
59
  sequenceCursorSchema,
60
+ solanaRpc,
20
61
  walletSignatureValid
21
- } from "../chunk-JK3XV2CR.js";
62
+ } from "../chunk-TYZFVL73.js";
22
63
  import {
23
64
  parseImageExtraction,
24
65
  parseImageResult
25
- } from "../chunk-RWR2LOPA.js";
66
+ } from "../chunk-EXZVWQOQ.js";
26
67
  import {
27
68
  sourceDataSchema,
28
69
  sourceRoles,
29
70
  validateQuestShape
30
- } from "../chunk-MVQQDPQX.js";
71
+ } from "../chunk-HXTKI34N.js";
31
72
  import {
32
73
  APP_KV_LIMIT,
33
74
  APP_MIGRATION_FILE_BYTES,
@@ -79,6 +120,7 @@ import {
79
120
  appStorageTablesSchema,
80
121
  appStorageValueSchema,
81
122
  assetPathSchema,
123
+ boundedBodyText,
82
124
  buildArtifactsSchema,
83
125
  buildIdentitySchema,
84
126
  buildPhaseSchema,
@@ -155,13 +197,13 @@ import {
155
197
  starterTemplates,
156
198
  starters,
157
199
  verifyScheduledRequest
158
- } from "../chunk-Q5QVAF7R.js";
200
+ } from "../chunk-5AKD4ZF3.js";
159
201
  import {
160
202
  isIntegrationParticipantPath,
161
203
  isParticipantRoute,
162
204
  participantRoutePattern,
163
205
  participantRoutes
164
- } from "../chunk-U66GUVSG.js";
206
+ } from "../chunk-LZXDYSUH.js";
165
207
  import {
166
208
  activityTypeSchema,
167
209
  activityTypes,
@@ -187,12 +229,12 @@ import {
187
229
  publishDeploymentSchema,
188
230
  rejectDeploymentSchema,
189
231
  submitDeploymentSchema
190
- } from "../chunk-KUNPCDN6.js";
232
+ } from "../chunk-DNPDR4Z7.js";
191
233
  import {
192
234
  xUserLookupInputSchema,
193
235
  xUserSchema,
194
236
  xUsernameSchema
195
- } from "../chunk-X3FMVRMM.js";
237
+ } from "../chunk-DDJN2T5A.js";
196
238
  import {
197
239
  analyticsBreakdowns,
198
240
  analyticsCatalog,
@@ -207,18 +249,15 @@ import {
207
249
  analyticsRanges,
208
250
  analyticsReadSchema,
209
251
  dashboardDefinitionSchema
210
- } from "../chunk-QYC3CZVD.js";
252
+ } from "../chunk-MEUAJIVO.js";
211
253
  import "../chunk-MWMCQLCG.js";
212
254
  import {
213
255
  withActionId
214
- } from "../chunk-BQXRCJ3N.js";
215
- import {
216
- base58
217
- } from "../chunk-UWUS4OOV.js";
256
+ } from "../chunk-P4TPW4SY.js";
218
257
  import {
219
258
  withQuery
220
- } from "../chunk-Q6KTTVOI.js";
221
- import "../chunk-5SBA6X5X.js";
259
+ } from "../chunk-7YSVZA7A.js";
260
+ import "../chunk-KKHENO57.js";
222
261
  import {
223
262
  collectionBeginSchema,
224
263
  collectionPreviewSchema,
@@ -233,7 +272,7 @@ import {
233
272
  rewardDeliveriesSchema,
234
273
  rewardDeliveryQuerySchema,
235
274
  rewardDeliverySchema
236
- } from "../chunk-NRMQVK2W.js";
275
+ } from "../chunk-R3MNZKNJ.js";
237
276
  import {
238
277
  allocateQuestSchema,
239
278
  allocatedQuestSchema,
@@ -244,7 +283,7 @@ import {
244
283
  questDraftSchema,
245
284
  questPublicationPreviewSchema,
246
285
  saveQuestDraftSchema
247
- } from "../chunk-DSJ46QLB.js";
286
+ } from "../chunk-6UBFSMCM.js";
248
287
  import {
249
288
  engagementBoundaryPageSchema,
250
289
  engagementChangePreviewInputSchema,
@@ -270,7 +309,7 @@ import {
270
309
  referralQualificationSchema,
271
310
  referralRewardResolutionSchema,
272
311
  referralSuspensionSchema
273
- } from "../chunk-5DZNMLDM.js";
312
+ } from "../chunk-55WJVFWC.js";
274
313
  import {
275
314
  CompletionSourceKind,
276
315
  acceptAnywaySchema,
@@ -281,12 +320,13 @@ import {
281
320
  badgeMutationResultSchema,
282
321
  badgeMutationSchema,
283
322
  badgePropertiesSchema,
323
+ base58,
324
+ base58Bytes,
284
325
  baseUnitsSchema,
285
326
  beginHandoverSchema,
286
327
  caip10,
287
328
  campaignEnrollmentSchema,
288
329
  completionKeySchema,
289
- completionSourceSchema,
290
330
  configurePickupSchema,
291
331
  confirmHandoverSchema,
292
332
  contentPerformancePageSchema,
@@ -340,15 +380,18 @@ import {
340
380
  managedProfileSchema,
341
381
  managedTrackerCreateSchema,
342
382
  managementStateQuerySchema,
383
+ maxSolanaActionReference,
343
384
  memberBadgesSchema,
344
385
  memberCampaignEnrollmentInputSchema,
345
386
  memberCampaignWithdrawalInputSchema,
346
387
  memberIdentitySchema,
347
388
  memberProgressSchema,
389
+ nftTrackerCreateSchema,
348
390
  organizationDiscordServersSchema,
349
391
  pageCursorSchema,
350
392
  pageLimit,
351
393
  pageQuerySchema,
394
+ parseSolanaActionMemo,
352
395
  pickupAvailabilitySchema,
353
396
  pickupCatalogSchema,
354
397
  pointLedgerPropertiesSchema,
@@ -359,6 +402,7 @@ import {
359
402
  profileModerationSchema,
360
403
  profileSettingsInputSchema,
361
404
  profileSettingsSchema,
405
+ programActivityTrackerCreateSchema,
362
406
  projectCalendarInputSchema,
363
407
  projectCalendarSchema,
364
408
  projectGroupKey,
@@ -369,17 +413,26 @@ import {
369
413
  questSubmissionSchema,
370
414
  removeGroupMemberSchema,
371
415
  responseTables,
416
+ settlementPaymentSchema,
372
417
  signInProviderInputSchema,
373
418
  signInProviderOptionSchema,
374
419
  signInProviderSchema,
375
420
  snapshotSchema,
421
+ solanaActionMemo,
376
422
  solanaAddressSchema,
377
423
  solanaDevnet,
378
424
  solanaMainnet,
425
+ solanaMemoProgram,
426
+ solanaSignatureSchema2 as solanaSignatureSchema,
427
+ solanaTransactionFixtureInputSchema,
428
+ solanaTransactionSubmissionSchema,
379
429
  staffDecisionSchema,
430
+ stakeTrackerCreateSchema,
431
+ stationRefusal,
380
432
  stockItemSchema,
381
433
  streakProgressSchema,
382
434
  submitSchema,
435
+ takesSolanaTransaction,
383
436
  telegramChatConnectionSchema,
384
437
  telegramChatIdSchema,
385
438
  telegramChatsSchema,
@@ -407,12 +460,13 @@ import {
407
460
  walletBalanceSchema,
408
461
  walletChainSchema,
409
462
  walletSignInNetworksSchema,
463
+ walletTransactionsSchema,
410
464
  walletUnlinkInputSchema,
411
465
  whereSchemaIssue
412
- } from "../chunk-P33ZAJMS.js";
466
+ } from "../chunk-6YTSRWRB.js";
413
467
  import {
414
468
  issueText
415
- } from "../chunk-FGXLXENM.js";
469
+ } from "../chunk-IW46TW3A.js";
416
470
 
417
471
  // src/server/identity-links.ts
418
472
  import * as z from "zod";
@@ -701,7 +755,9 @@ var leaderboardSettlementExportSchema = /* @__PURE__ */ (() => z6.object({
701
755
  /** EVM smart-contract wallets only: the CAIP-2 network that proved it, the one chain to pay it on. */
702
756
  provedOn: evmChainIdSchema.optional()
703
757
  })
704
- )
758
+ ),
759
+ /** How a non-zero share in a non-points pool was paid on chain; absent otherwise. */
760
+ payment: settlementPaymentSchema.optional()
705
761
  })
706
762
  )
707
763
  }))();
@@ -935,8 +991,8 @@ var accountReference = /* @__PURE__ */ (() => z9.object({
935
991
  actionId: identifier,
936
992
  kind: z9.enum(["x", "discord"]),
937
993
  subject: z9.string().regex(/^[1-9][0-9]{0,19}$/, "Use the numeric user ID")
938
- }).strict().transform(({ actionId: actionId2, kind, subject }) => ({
939
- actionId: actionId2,
994
+ }).strict().transform(({ actionId: actionId3, kind, subject }) => ({
995
+ actionId: actionId3,
940
996
  provider: kind,
941
997
  id: subject
942
998
  })))();
@@ -1065,135 +1121,9 @@ var testMemberHistorySchema = /* @__PURE__ */ (() => z9.object({
1065
1121
  complete: z9.boolean()
1066
1122
  }))();
1067
1123
 
1068
- // src/server/webhooks.ts
1069
- import * as z10 from "zod";
1070
- var PayoutSourceKind = {
1071
- Quest: "quest",
1072
- Leaderboard: "leaderboard",
1073
- Engagement: "engagement",
1074
- Manual: "manual"
1075
- };
1076
- var webhookEventSchema = /* @__PURE__ */ (() => z10.object({
1077
- id: z10.string().uuid(),
1078
- version: z10.literal(1),
1079
- type: activityTypeSchema,
1080
- createdAt: z10.number().int().nonnegative(),
1081
- organization: z10.string(),
1082
- project: z10.string(),
1083
- environment: z10.enum(["test", "live"]),
1084
- data: z10.record(z10.string(), z10.json())
1085
- }))();
1086
- var webhookControlInputSchema = /* @__PURE__ */ (() => z10.object({ actionId: z10.string().uuid().optional() }).strict())();
1087
- var webhookInputSchema = /* @__PURE__ */ (() => z10.object({
1088
- url: z10.url().max(2048).refine((value) => {
1089
- const url2 = new URL(value);
1090
- return url2.protocol === "https:" && !url2.username && !url2.password && !url2.hash;
1091
- }, "Use an HTTPS URL without credentials or a fragment"),
1092
- types: z10.array(activityTypeSchema).min(1).max(100).refine((v) => new Set(v).size === v.length)
1093
- }).strict())();
1094
- var webhookCreateInputSchema = /* @__PURE__ */ (() => webhookInputSchema.extend({ actionId: z10.string().uuid().optional() }).strict())();
1095
- var webhookRotateInputSchema = /* @__PURE__ */ (() => z10.object({ actionId: z10.string().uuid().optional() }).strict())();
1096
- var webhookUpdateSchema = /* @__PURE__ */ (() => webhookInputSchema.partial().extend({ enabled: z10.boolean().optional() }).strict())();
1097
- var webhookEndpointSchema = /* @__PURE__ */ (() => z10.object({
1098
- ...webhookInputSchema.shape,
1099
- id: z10.string().uuid(),
1100
- enabled: z10.boolean(),
1101
- disabledReason: z10.string().nullable(),
1102
- consecutiveFailures: z10.number().int().nonnegative(),
1103
- createdAt: z10.number(),
1104
- updatedAt: z10.number()
1105
- }))();
1106
- var webhookEndpointStateSchema = /* @__PURE__ */ (() => webhookEndpointSchema.extend({
1107
- revision: z10.number().int().nonnegative(),
1108
- deletedAt: z10.number().int().safe().nonnegative().nullable()
1109
- }))();
1110
- var webhookDeleteInputSchema = /* @__PURE__ */ (() => z10.strictObject({
1111
- actionId: z10.string().uuid().default(() => crypto.randomUUID()),
1112
- expectedRevision: z10.number().int().nonnegative(),
1113
- reason: z10.string().trim().min(1).max(500)
1114
- }))();
1115
- var webhookStateQuerySchema = /* @__PURE__ */ (() => z10.strictObject({
1116
- cursor: pageCursorSchema.optional(),
1117
- limit: z10.coerce.number().int().min(1).max(100).default(50)
1118
- }))();
1119
- var webhookStatePageSchema = /* @__PURE__ */ (() => z10.object({
1120
- items: z10.array(webhookEndpointStateSchema),
1121
- nextCursor: pageCursorSchema.nullable()
1122
- }))();
1123
- var webhookSecretSchema = /* @__PURE__ */ (() => z10.object({
1124
- endpoint: webhookEndpointSchema,
1125
- secret: z10.string(),
1126
- previousValidUntil: z10.number().nullable()
1127
- }))();
1128
- var webhookDeliverySchema = /* @__PURE__ */ (() => z10.object({
1129
- id: z10.string().uuid(),
1130
- endpoint: z10.string().uuid(),
1131
- event: webhookEventSchema,
1132
- status: z10.enum(["pending", "delivered", "failed", "skipped"]),
1133
- attempts: z10.number().int().nonnegative(),
1134
- responseStatus: z10.number().nullable(),
1135
- lastError: z10.string().nullable(),
1136
- createdAt: z10.number(),
1137
- deliveredAt: z10.number().nullable(),
1138
- replayOf: z10.string().uuid().nullable()
1139
- }))();
1140
- var webhookQuerySchema = /* @__PURE__ */ (() => z10.object({
1141
- /** A page's `nextCursor`: the deliveries after it, newest first. */
1142
- cursor: pageCursorSchema.optional(),
1143
- /** @deprecated Use `cursor`. Removed in 2.0.0. */
1144
- before: z10.string().uuid().optional(),
1145
- limit: z10.coerce.number().int().min(1).max(100).default(50)
1146
- }).strict())();
1147
- var webhookDeliveryPageSchema = /* @__PURE__ */ (() => z10.object({
1148
- items: z10.array(webhookDeliverySchema),
1149
- nextCursor: pageCursorSchema.nullable().default(null),
1150
- /** @deprecated Use `nextCursor`, passed back as `cursor`. Removed in 2.0.0. */
1151
- next: z10.string().uuid().nullable()
1152
- }))();
1153
- var WEBHOOK_MAX_BYTES = 64 * 1024;
1154
- async function verifyWebhook(input) {
1155
- const bytes = new TextEncoder().encode(input.body);
1156
- const tolerance = input.toleranceSeconds ?? 300;
1157
- const now = input.now ?? Date.now();
1158
- if (bytes.length > WEBHOOK_MAX_BYTES || !Number.isFinite(now) || !Number.isFinite(tolerance) || tolerance < 0 || tolerance > 300) {
1159
- throw new Error("Invalid webhook verification input");
1160
- }
1161
- const parts = input.signature.split(",");
1162
- const timestamps = parts.filter((part) => part.startsWith("t="));
1163
- const timestamp2 = timestamps[0]?.slice(2) ?? "";
1164
- const signatures = parts.filter((part) => /^v1=[a-f0-9]{64}$/.test(part)).map((part) => part.slice(3));
1165
- if (timestamps.length !== 1 || !/^\d{1,12}$/.test(timestamp2) || Math.abs(now / 1e3 - Number(timestamp2)) > tolerance || signatures.length < 1 || signatures.length > 2) {
1166
- throw new Error("Invalid or expired webhook signature");
1167
- }
1168
- const secrets3 = typeof input.secret === "string" ? [input.secret] : input.secret;
1169
- const message = new TextEncoder().encode(`${timestamp2}.${input.body}`);
1170
- for (const secret of secrets3) {
1171
- if (!secret) {
1172
- continue;
1173
- }
1174
- const key = await crypto.subtle.importKey(
1175
- "raw",
1176
- new TextEncoder().encode(secret),
1177
- { name: "HMAC", hash: "SHA-256" },
1178
- false,
1179
- ["verify"]
1180
- );
1181
- for (const signature of signatures) {
1182
- const digest = Uint8Array.from(
1183
- signature.match(/../g) ?? [],
1184
- (byte) => Number.parseInt(byte, 16)
1185
- );
1186
- if (await crypto.subtle.verify("HMAC", key, digest, message)) {
1187
- return webhookEventSchema.parse(JSON.parse(input.body));
1188
- }
1189
- }
1190
- }
1191
- throw new Error("Invalid webhook signature");
1192
- }
1193
-
1194
1124
  // src/server/resource-lifecycle.ts
1195
- import * as z11 from "zod";
1196
- var resourceLifecycleKindSchema = /* @__PURE__ */ (() => z11.enum([
1125
+ import * as z10 from "zod";
1126
+ var resourceLifecycleKindSchema = /* @__PURE__ */ (() => z10.enum([
1197
1127
  "tracker",
1198
1128
  "referral",
1199
1129
  "leaderboard",
@@ -1203,51 +1133,51 @@ var resourceLifecycleKindSchema = /* @__PURE__ */ (() => z11.enum([
1203
1133
  "image",
1204
1134
  "point-ledger"
1205
1135
  ]))();
1206
- var managedResourceSchema = /* @__PURE__ */ (() => z11.object({
1136
+ var managedResourceSchema = /* @__PURE__ */ (() => z10.object({
1207
1137
  kind: resourceLifecycleKindSchema,
1208
1138
  id: identifier,
1209
1139
  key: identifier.nullable(),
1210
- title: z11.string(),
1211
- archivedAt: z11.number().int().nonnegative().nullable()
1140
+ title: z10.string(),
1141
+ archivedAt: z10.number().int().nonnegative().nullable()
1212
1142
  }))();
1213
- var resourceLifecycleInputSchema = /* @__PURE__ */ (() => z11.object({
1214
- actionId: z11.string().uuid(),
1143
+ var resourceLifecycleInputSchema = /* @__PURE__ */ (() => z10.object({
1144
+ actionId: z10.string().uuid(),
1215
1145
  kind: resourceLifecycleKindSchema,
1216
1146
  resource: identifier,
1217
- archived: z11.boolean(),
1147
+ archived: z10.boolean(),
1218
1148
  reason: lifecycleReasonSchema,
1219
- expectedArchivedAt: z11.number().int().nonnegative().nullable().optional()
1149
+ expectedArchivedAt: z10.number().int().nonnegative().nullable().optional()
1220
1150
  }).strict())();
1221
- var resourceLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1151
+ var resourceLifecycleResultSchema = /* @__PURE__ */ (() => z10.object({
1222
1152
  resource: managedResourceSchema,
1223
- changed: z11.boolean()
1153
+ changed: z10.boolean()
1224
1154
  }))();
1225
1155
  var managedOfferSchema = /* @__PURE__ */ (() => managedResourceSchema.extend({
1226
- kind: z11.literal("offer")
1156
+ kind: z10.literal("offer")
1227
1157
  }))();
1228
1158
  var managedTieredRewardSchema = /* @__PURE__ */ (() => managedResourceSchema.extend({
1229
- kind: z11.literal("tiered-reward")
1159
+ kind: z10.literal("tiered-reward")
1230
1160
  }))();
1231
- var managedResourceListSchema = /* @__PURE__ */ (() => z11.object({
1232
- resources: z11.array(managedResourceSchema),
1233
- offers: z11.array(managedOfferSchema).default([]),
1161
+ var managedResourceListSchema = /* @__PURE__ */ (() => z10.object({
1162
+ resources: z10.array(managedResourceSchema),
1163
+ offers: z10.array(managedOfferSchema).default([]),
1234
1164
  /** Absent from a Relay older than tiered reward archiving; treat it as none. */
1235
- tieredRewards: z11.array(managedTieredRewardSchema).optional()
1165
+ tieredRewards: z10.array(managedTieredRewardSchema).optional()
1236
1166
  }))();
1237
- var offerLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1167
+ var offerLifecycleResultSchema = /* @__PURE__ */ (() => z10.object({
1238
1168
  resource: managedOfferSchema,
1239
- changed: z11.boolean()
1169
+ changed: z10.boolean()
1240
1170
  }))();
1241
- var offerLifecycleInputSchema = /* @__PURE__ */ (() => z11.strictObject({
1242
- actionId: z11.string().uuid(),
1171
+ var offerLifecycleInputSchema = /* @__PURE__ */ (() => z10.strictObject({
1172
+ actionId: z10.string().uuid(),
1243
1173
  offer: identifier,
1244
- archived: z11.boolean(),
1245
- reason: z11.string().trim().min(1).max(500),
1246
- 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()
1247
1177
  }))();
1248
- var tieredRewardLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1178
+ var tieredRewardLifecycleResultSchema = /* @__PURE__ */ (() => z10.object({
1249
1179
  resource: managedTieredRewardSchema,
1250
- changed: z11.boolean()
1180
+ changed: z10.boolean()
1251
1181
  }))();
1252
1182
  var tieredRewardLifecycleInputSchema = /* @__PURE__ */ (() => offerLifecycleInputSchema.omit({ offer: true }).extend({ reward: identifier }))();
1253
1183
  var resourceLifecyclePaths = {
@@ -1267,46 +1197,46 @@ var resourceArchiveInputSchema = /* @__PURE__ */ (() => resourceLifecycleInputSc
1267
1197
  }))();
1268
1198
 
1269
1199
  // src/server/dashboards.ts
1270
- import * as z12 from "zod";
1271
- var dashboardListQuerySchema = /* @__PURE__ */ (() => z12.strictObject({
1272
- 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()
1273
1203
  }))();
1274
1204
  var summaryFields = /* @__PURE__ */ (() => ({
1275
1205
  key: identifier,
1276
- title: z12.string(),
1277
- description: z12.string().nullable(),
1206
+ title: z11.string(),
1207
+ description: z11.string().nullable(),
1278
1208
  /** Lists order by it, dashboards without one last, then by title. */
1279
- position: z12.number().int().nullable(),
1280
- archivedAt: z12.number().int().nonnegative().nullable(),
1209
+ position: z11.number().int().nullable(),
1210
+ archivedAt: z11.number().int().nonnegative().nullable(),
1281
1211
  /** When the current version was published. */
1282
- updatedAt: z12.number().int().nonnegative()
1212
+ updatedAt: z11.number().int().nonnegative()
1283
1213
  }))();
1284
- var dashboardSummarySchema = /* @__PURE__ */ (() => z12.object(summaryFields))();
1285
- var dashboardListSchema = /* @__PURE__ */ (() => z12.array(dashboardSummarySchema))();
1286
- var dashboardLifecycleInputSchema = /* @__PURE__ */ (() => z12.strictObject({
1287
- 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(),
1288
1218
  dashboard: identifier,
1289
- archived: z12.boolean(),
1290
- reason: z12.string().trim().min(1).max(500),
1291
- 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()
1292
1222
  }))();
1293
- var dashboardLifecycleResultSchema = /* @__PURE__ */ (() => z12.object({
1223
+ var dashboardLifecycleResultSchema = /* @__PURE__ */ (() => z11.object({
1294
1224
  dashboard: dashboardSummarySchema,
1295
- changed: z12.boolean()
1225
+ changed: z11.boolean()
1296
1226
  }))();
1297
- var dashboardReadQuerySchema = /* @__PURE__ */ (() => z12.strictObject({
1227
+ var dashboardReadQuerySchema = /* @__PURE__ */ (() => z11.strictObject({
1298
1228
  key: identifier,
1299
- range: z12.enum(analyticsRanges).optional()
1229
+ range: z11.enum(analyticsRanges).optional()
1300
1230
  }))();
1301
- var dashboardReadSchema = /* @__PURE__ */ (() => z12.object({
1231
+ var dashboardReadSchema = /* @__PURE__ */ (() => z11.object({
1302
1232
  ...summaryFields,
1303
1233
  definition: dashboardDefinitionSchema,
1304
- range: z12.enum(analyticsRanges),
1305
- panels: z12.array(
1306
- z12.object({
1234
+ range: z11.enum(analyticsRanges),
1235
+ panels: z11.array(
1236
+ z11.object({
1307
1237
  key: identifier,
1308
1238
  result: analyticsMetricResultSchema.optional(),
1309
- error: z12.object({ code: z12.string(), message: z12.string() }).optional()
1239
+ error: z11.object({ code: z11.string(), message: z11.string() }).optional()
1310
1240
  })
1311
1241
  )
1312
1242
  }))();
@@ -1315,33 +1245,33 @@ var dashboardReadSchema = /* @__PURE__ */ (() => z12.object({
1315
1245
  import * as z62 from "zod";
1316
1246
 
1317
1247
  // src/server/client/http.ts
1318
- import * as z15 from "zod";
1248
+ import * as z14 from "zod";
1319
1249
 
1320
1250
  // src/server/operations.ts
1321
- import * as z13 from "zod";
1322
- var operationSchema = /* @__PURE__ */ (() => z13.object({
1323
- target: z13.string(),
1324
- paused: z13.boolean(),
1325
- revision: z13.number().int(),
1326
- reason: z13.string(),
1327
- actor: z13.string().nullable(),
1328
- changedAt: z13.number()
1329
- }))();
1330
- var operationInputSchema = /* @__PURE__ */ (() => z13.object({
1331
- target: z13.union([
1332
- z13.literal("redemptions"),
1333
- 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-]+$/)
1334
1264
  ]),
1335
- paused: z13.boolean(),
1336
- revision: z13.number().int().nonnegative(),
1337
- 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),
1338
1268
  actionId: identifier
1339
1269
  }).strict())();
1340
1270
 
1341
1271
  // src/server/revision-fence.ts
1342
- import * as z14 from "zod";
1272
+ import * as z13 from "zod";
1343
1273
  function expectedRevision(schema) {
1344
- return z14.preprocess((body, context) => {
1274
+ return z13.preprocess((body, context) => {
1345
1275
  if (body === null || typeof body !== "object" || Array.isArray(body) || !("expectedRevision" in body)) {
1346
1276
  return body;
1347
1277
  }
@@ -1352,7 +1282,7 @@ function expectedRevision(schema) {
1352
1282
  message: "expectedRevision and revision name different revisions",
1353
1283
  path: ["expectedRevision"]
1354
1284
  });
1355
- return z14.NEVER;
1285
+ return z13.NEVER;
1356
1286
  }
1357
1287
  return { ...rest, revision: expectedRevision2 };
1358
1288
  }, schema);
@@ -1384,7 +1314,7 @@ function managementHttp(options) {
1384
1314
  }
1385
1315
  return { request, get, post, create, raw, exchange };
1386
1316
  }
1387
- var ok = /* @__PURE__ */ (() => z15.object({ ok: z15.literal(true) }))();
1317
+ var ok = /* @__PURE__ */ (() => z14.object({ ok: z14.literal(true) }))();
1388
1318
  function createPointLedger({ create }) {
1389
1319
  function run(input, call) {
1390
1320
  return create(
@@ -1397,12 +1327,12 @@ function createPointLedger({ create }) {
1397
1327
  }
1398
1328
  return run;
1399
1329
  }
1400
- function pathFirst(key, send) {
1330
+ function pathFirst(key2, send) {
1401
1331
  function run(first, second, call) {
1402
1332
  if (typeof first === "string") {
1403
1333
  return send(first, second, call);
1404
1334
  }
1405
- const { [key]: id, ...input } = first;
1335
+ const { [key2]: id, ...input } = first;
1406
1336
  return send(
1407
1337
  id,
1408
1338
  input,
@@ -1459,10 +1389,10 @@ var operationVerb = ({ post }, target, paused, input, call) => {
1459
1389
  };
1460
1390
 
1461
1391
  // src/server/client/badges.ts
1462
- import * as z16 from "zod";
1392
+ import * as z15 from "zod";
1463
1393
  function badges({ create, get, post }) {
1464
1394
  return {
1465
- list: (call) => get("/badges", z16.array(managedBadgeSchema), call),
1395
+ list: (call) => get("/badges", z15.array(managedBadgeSchema), call),
1466
1396
  create: (input, call) => create("/badges", managedBadgeSchema, createBadgeSchema, input, call),
1467
1397
  update: (badge, input, call) => {
1468
1398
  const body = badgePropertiesSchema.extend(badgeMutationSchema.shape).parse(withActionId(input));
@@ -1524,7 +1454,7 @@ function content({ get }) {
1524
1454
  var contentApi = (http) => content(http);
1525
1455
 
1526
1456
  // src/server/client/deployments.ts
1527
- import * as z17 from "zod";
1457
+ import * as z16 from "zod";
1528
1458
  function deployments({ get, post }) {
1529
1459
  function publishDeployment(target, call) {
1530
1460
  const id = typeof target === "string" ? identifier.parse(target) : publishDeploymentSchema.parse(target).id;
@@ -1570,7 +1500,7 @@ function deployments({ get, post }) {
1570
1500
  *
1571
1501
  * @deprecated Use `history`, which pages by `cursor` and `nextCursor`. Removed in 2.0.0.
1572
1502
  */
1573
- list: (call) => get("/deployments", z17.array(deploymentRecordSchema), call),
1503
+ list: (call) => get("/deployments", z16.array(deploymentRecordSchema), call),
1574
1504
  /**
1575
1505
  * The project environment's deployments, newest first, one page at a time, with the two
1576
1506
  * newest published deployments beside every page. Pass a page's `nextCursor` back as
@@ -1609,7 +1539,7 @@ function deployments({ get, post }) {
1609
1539
  var deploymentsApi = (http) => deployments(http);
1610
1540
 
1611
1541
  // src/server/client/engagement.ts
1612
- import * as z18 from "zod";
1542
+ import * as z17 from "zod";
1613
1543
  function engagement(http) {
1614
1544
  const { get, post } = http;
1615
1545
  return {
@@ -1655,7 +1585,7 @@ function engagement(http) {
1655
1585
  engagementPublishSchema.parse(withActionId(input)),
1656
1586
  call
1657
1587
  ),
1658
- list: (call) => get("/engagement", z18.array(engagementRuleSchema), call),
1588
+ list: (call) => get("/engagement", z17.array(engagementRuleSchema), call),
1659
1589
  page: (input, call) => get(
1660
1590
  "/engagement/history" + queryString(engagementPageQuerySchema.parse(input)),
1661
1591
  engagementPageSchema,
@@ -1735,6 +1665,152 @@ var groupsApi = (http) => groups(http);
1735
1665
 
1736
1666
  // src/server/client/leaderboards.ts
1737
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
1738
1814
  function leaderboards(http) {
1739
1815
  const { get, post } = http;
1740
1816
  return {
@@ -1825,6 +1901,41 @@ function leaderboards(http) {
1825
1901
  leaderboardSettlementExportSchema,
1826
1902
  call
1827
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
+ ),
1828
1939
  rejectSettlement: (settlement, input, call) => post(
1829
1940
  `/leaderboard-settlements/${identifier.parse(settlement)}/reject`,
1830
1941
  leaderboardSettlementReviewSchema,
@@ -2018,12 +2129,12 @@ function referrals(http) {
2018
2129
  /** @deprecated Use `pause` or `resume`, `qualify` or `resolveReward`. Removed in 2.0.0. */
2019
2130
  control: (input, call) => {
2020
2131
  const parsed = referralControlSchema.parse(withActionId(input));
2021
- const { actionId: actionId2, reason } = parsed;
2132
+ const { actionId: actionId3, reason } = parsed;
2022
2133
  if (parsed.kind === "suspend") {
2023
2134
  return post(
2024
2135
  `/referral-relationships/${parsed.member}/suspend`,
2025
2136
  ok,
2026
- { actionId: actionId2, suspended: parsed.suspended, reason },
2137
+ { actionId: actionId3, suspended: parsed.suspended, reason },
2027
2138
  call
2028
2139
  );
2029
2140
  }
@@ -2031,14 +2142,14 @@ function referrals(http) {
2031
2142
  return post(
2032
2143
  `/referral-programs/${parsed.program}/members/${parsed.member}/qualify`,
2033
2144
  ok,
2034
- { actionId: actionId2, qualified: parsed.qualified, reason },
2145
+ { actionId: actionId3, qualified: parsed.qualified, reason },
2035
2146
  call
2036
2147
  );
2037
2148
  }
2038
2149
  return post(
2039
2150
  `/referral-rewards/${parsed.entitlement}/resolve`,
2040
2151
  ok,
2041
- { actionId: actionId2, reason },
2152
+ { actionId: actionId3, reason },
2042
2153
  call
2043
2154
  );
2044
2155
  }
@@ -2054,11 +2165,33 @@ function trackers(http) {
2054
2165
  /**
2055
2166
  * Creates a tracker as data in test, with the same validation as `defineTracker`; requires
2056
2167
  * `publish`. Name its source with `source`, such as `{ kind: "discord-messages", text: true }`,
2057
- * or an X search with `query` alone. An X tracker's first collection searches from
2058
- * `window.start`. Live refuses it with `promotion-required`: the tracker reaches live through
2059
- * a promotion. A key a deployment already publishes is refused with `tracker-owned-by-code`.
2060
- */
2061
- 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(
2062
2195
  "/trackers",
2063
2196
  trackerStatusSchema,
2064
2197
  managedTrackerCreateSchema,
@@ -2681,9 +2814,9 @@ function dashboards({ get, post }) {
2681
2814
  * other panels still have results. Requires `read` permission.
2682
2815
  */
2683
2816
  read: (query, call) => {
2684
- const { key, ...rest } = dashboardReadQuerySchema.parse(query);
2817
+ const { key: key2, ...rest } = dashboardReadQuerySchema.parse(query);
2685
2818
  return get(
2686
- `/dashboards/${key}${queryString(rest)}`,
2819
+ `/dashboards/${key2}${queryString(rest)}`,
2687
2820
  dashboardReadSchema,
2688
2821
  call
2689
2822
  );
@@ -2693,15 +2826,15 @@ function dashboards({ get, post }) {
2693
2826
  * `includeArchived`, stays readable, and stays archived when its code deploys again. Live
2694
2827
  * gets the change through a promotion. Requires `publish` permission.
2695
2828
  */
2696
- archive: (key, input, call) => post(
2697
- `/dashboards/${identifier.parse(key)}/archive`,
2829
+ archive: (key2, input, call) => post(
2830
+ `/dashboards/${identifier.parse(key2)}/archive`,
2698
2831
  dashboardLifecycleResultSchema,
2699
2832
  resourceArchiveInputSchema.parse(withActionId(input)),
2700
2833
  call
2701
2834
  ),
2702
2835
  /** Restore an archived dashboard in test. Requires `publish` permission. */
2703
- unarchive: (key, input, call) => post(
2704
- `/dashboards/${identifier.parse(key)}/unarchive`,
2836
+ unarchive: (key2, input, call) => post(
2837
+ `/dashboards/${identifier.parse(key2)}/unarchive`,
2705
2838
  dashboardLifecycleResultSchema,
2706
2839
  resourceArchiveInputSchema.parse(withActionId(input)),
2707
2840
  call
@@ -2898,6 +3031,35 @@ function attempts({ get, post }) {
2898
3031
  submitSchema.parse(withActionId(input)),
2899
3032
  call
2900
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
+ ),
2901
3063
  /**
2902
3064
  * Accepts or rejects an attempt waiting for review, at the `generation` the reviewer saw,
2903
3065
  * with a reason; requires `review` permission.
@@ -3025,181 +3187,22 @@ function passes({ post }) {
3025
3187
  }
3026
3188
  var passesApi = (http) => passes(http);
3027
3189
 
3028
- // src/server/completions.ts
3029
- import * as z31 from "zod";
3030
- var completionRevokeSchema = /* @__PURE__ */ (() => z31.object({
3031
- actionId: identifier,
3032
- reason: z31.string().trim().min(1).max(500),
3033
- freeOccurrence: z31.boolean().default(false)
3034
- }).strict())();
3035
- var RevokedEntitlementOutcome = {
3036
- /** No other completion grants the reward: it is void, after cancelling a handover in progress. */
3037
- Voided: "voided",
3038
- /** Lowered to the best tier another completion grants, after cancelling a handover in progress. */
3039
- Downgraded: "downgraded",
3040
- /** Another completion grants the same tier, or it was already void. */
3041
- Kept: "kept",
3042
- /** Already collected: its earned tier follows the other completions, and the item stays handed over. */
3043
- Flagged: "flagged"
3044
- };
3045
- var RevokedDeliveryOutcome = {
3046
- /** The role was delivered and stays: remove it in Discord if appropriate. */
3047
- Flagged: "flagged",
3048
- /** The grant was stopped before any call to Discord. */
3049
- Cancelled: "cancelled",
3050
- /** The grant was stopped, but a call to Discord may already have been sent and can still land. */
3051
- InFlight: "in-flight",
3052
- /** The grant had failed, so Discord never received the role. */
3053
- NotDelivered: "not-delivered"
3054
- };
3055
- var RevokedReferralOutcome = {
3056
- /** The inviter's rewards for this member are reversed. */
3057
- Unqualified: "unqualified",
3058
- /** Qualified on another accepted completion of the program's quest instead. */
3059
- Requalified: "requalified"
3060
- };
3061
- var entitlementOutcomeSchema = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3062
- var deliveryOutcomeSchema = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3063
- var referralOutcomeSchema = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3064
- var completionRevocationSchema = /* @__PURE__ */ (() => z31.object({
3065
- completion: identifier,
3066
- /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
3067
- quest: identifier,
3068
- member: identifier,
3069
- /** What paid the revoked completion. `source.id` repeats `quest`. */
3070
- source: completionSourceSchema.optional(),
3071
- revokedAt: z31.number(),
3072
- occurrenceFreed: z31.boolean(),
3073
- badges: z31.array(z31.object({ badge: identifier, stillAwarded: z31.boolean() })).optional(),
3074
- groups: z31.array(z31.object({ group: identifier, stillMember: z31.boolean() })).optional(),
3075
- points: z31.array(
3076
- z31.object({
3077
- entry: identifier,
3078
- balance: identifier,
3079
- reversal: identifier.nullable(),
3080
- reversed: z31.number().int(),
3081
- unreversed: z31.number().int()
3082
- })
3083
- ),
3084
- entitlements: z31.array(
3085
- z31.object({
3086
- entitlement: identifier,
3087
- reward: identifier,
3088
- outcome: entitlementOutcomeSchema,
3089
- status: z31.string()
3090
- })
3091
- ),
3092
- deliveries: z31.array(
3093
- z31.object({
3094
- delivery: z31.string(),
3095
- roleId: z31.string(),
3096
- outcome: deliveryOutcomeSchema,
3097
- /**
3098
- * By Relay's records, another accepted, unrevoked completion of the member also granted this
3099
- * role to the same Discord account and server. Relay does not read Discord's membership.
3100
- */
3101
- stillGranted: z31.boolean()
3102
- })
3103
- ),
3104
- referrals: z31.array(
3105
- z31.object({
3106
- program: identifier,
3107
- outcome: referralOutcomeSchema
3108
- })
3109
- ),
3110
- streakMilestone: z31.boolean(),
3111
- budgets: z31.array(
3112
- z31.object({ budget: identifier, released: z31.number().int().nonnegative() })
3113
- ).optional()
3114
- }))();
3115
- var completionRestoreSchema = /* @__PURE__ */ (() => z31.object({
3116
- actionId: identifier,
3117
- reason: z31.string().trim().min(1).max(500)
3118
- }).strict())();
3119
- var RestoredEntitlementOutcome = {
3120
- /** The revocation voided it, and it is available again. */
3121
- Restored: "restored",
3122
- /** The revocation lowered or flagged it: its earned tier is the completion's again. */
3123
- Raised: "raised",
3124
- /** It changed since the revocation (an operator restored, voided or corrected it), so it stays. */
3125
- Kept: "kept"
3126
- };
3127
- var RestoredDeliveryOutcome = {
3128
- /** The grant had not reached Discord, and it is queued again. */
3129
- Requeued: "requeued",
3130
- /** The grant counts again for reconciliation, and its delivery status stays. */
3131
- Kept: "kept"
3132
- };
3133
- var RestoredReferralOutcome = {
3134
- /** The member qualifies on this completion again. */
3135
- Qualified: "qualified",
3136
- /** The program is disabled or gone, or the referral is suspended, so nothing changed. */
3137
- Kept: "kept"
3138
- };
3139
- var openOutcome = /* @__PURE__ */ (() => z31.string().min(1).max(64))();
3140
- var completionRestorationSchema = /* @__PURE__ */ (() => z31.object({
3141
- completion: identifier,
3142
- /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
3143
- quest: identifier,
3144
- member: identifier,
3145
- source: completionSourceSchema.optional(),
3146
- restoredAt: z31.number(),
3147
- points: z31.array(
3148
- z31.object({
3149
- entry: identifier,
3150
- balance: identifier,
3151
- reversal: identifier,
3152
- amount: z31.number().int()
3153
- })
3154
- ),
3155
- badges: z31.array(z31.object({ badge: identifier })),
3156
- groups: z31.array(z31.object({ group: identifier, added: z31.boolean() })),
3157
- entitlements: z31.array(
3158
- z31.object({
3159
- entitlement: identifier,
3160
- reward: identifier,
3161
- outcome: openOutcome,
3162
- status: z31.string()
3163
- })
3164
- ),
3165
- deliveries: z31.array(
3166
- z31.object({
3167
- delivery: z31.string(),
3168
- roleId: z31.string(),
3169
- outcome: openOutcome
3170
- })
3171
- ),
3172
- referrals: z31.array(
3173
- z31.object({
3174
- program: identifier,
3175
- outcome: openOutcome
3176
- })
3177
- ),
3178
- streakMilestone: z31.boolean(),
3179
- budgets: z31.array(
3180
- z31.object({ budget: identifier, charged: z31.number().int().nonnegative() })
3181
- ).optional()
3182
- }))();
3183
- var completionRevocationShortfallSchema = /* @__PURE__ */ (() => z31.object({
3184
- completion: identifier,
3185
- quest: identifier,
3186
- revokedAt: z31.number().int().nonnegative().safe(),
3187
- unreversedPoints: z31.record(identifier, z31.number().int().positive().safe())
3188
- }))();
3189
- var revokedCompletionSchema = /* @__PURE__ */ (() => z31.object({
3190
- completion: identifier,
3191
- quest: identifier,
3192
- /** The completion key: its occurrence, such as `once` or a day. */
3193
- key: z31.string(),
3194
- revokedAt: z31.number().int().nonnegative().safe(),
3195
- /** Why it was revoked, and what the revoke did, which a restore re-applies. */
3196
- reason: z31.string().optional(),
3197
- revocation: completionRevocationSchema.optional()
3198
- }))();
3199
-
3200
3190
  // src/server/client/completions.ts
3201
- function completions({ post }) {
3191
+ function completions({ get, post }) {
3202
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
+ ),
3203
3206
  /**
3204
3207
  * Revokes an accepted completion with a reason; requires `review` permission. In one
3205
3208
  * transaction it reverses the completion's points, voids its undelivered tiered rewards and
@@ -3239,6 +3242,35 @@ function completions({ post }) {
3239
3242
  completionRestoreSchema.parse(withActionId(body)),
3240
3243
  call
3241
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
3242
3274
  )
3243
3275
  };
3244
3276
  }
@@ -3278,20 +3310,20 @@ function handover({ post }) {
3278
3310
  var handoverApi = (http) => handover(http);
3279
3311
 
3280
3312
  // src/server/entitlements.ts
3281
- import * as z32 from "zod";
3282
- var managedEntitlementQuerySchema = /* @__PURE__ */ (() => z32.strictObject({
3283
- q: z32.string().max(200).optional(),
3284
- 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(),
3285
3317
  limit: pageLimit,
3286
3318
  cursor: pageCursorSchema.optional()
3287
3319
  }))();
3288
- var managedEntitlementPageSchema = /* @__PURE__ */ (() => z32.object({
3289
- items: z32.array(entitlementSchema),
3290
- people: z32.array(personSchema),
3291
- total: z32.number().int().nonnegative(),
3292
- 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()
3293
3325
  }))();
3294
- var managedEntitlementSchema = /* @__PURE__ */ (() => z32.object({
3326
+ var managedEntitlementSchema = /* @__PURE__ */ (() => z31.object({
3295
3327
  entitlement: entitlementSchema,
3296
3328
  person: personSchema
3297
3329
  }))();
@@ -3383,11 +3415,11 @@ function collection({ post }) {
3383
3415
  var collectionApi = (http) => collection(http);
3384
3416
 
3385
3417
  // src/server/client/operations.ts
3386
- import * as z33 from "zod";
3418
+ import * as z32 from "zod";
3387
3419
  function operations({ get, post }) {
3388
3420
  return {
3389
3421
  /** Every paused or resumed operation: redemptions and each quest's participation; requires `read`. */
3390
- list: (call) => get("/operations", z33.array(operationSchema), call),
3422
+ list: (call) => get("/operations", z32.array(operationSchema), call),
3391
3423
  /**
3392
3424
  * Pauses or resumes redemptions or one quest's participation, against the `revision` the
3393
3425
  * operator saw, with a reason; requires `publish` permission.
@@ -3423,7 +3455,7 @@ function redemptions(http) {
3423
3455
  var redemptionsApi = (http) => redemptions(http);
3424
3456
 
3425
3457
  // src/server/client/inventory.ts
3426
- import * as z34 from "zod";
3458
+ import * as z33 from "zod";
3427
3459
  function inventory({ create, get, post }) {
3428
3460
  return {
3429
3461
  /** Includes archived items and revision fences; requires read permission. */
@@ -3457,7 +3489,7 @@ function inventory({ create, get, post }) {
3457
3489
  call
3458
3490
  ),
3459
3491
  /** Every stock item with its counts and the offers that sell it; requires `read` permission. */
3460
- list: (call) => get("/stock-items", z34.array(managedStockItemSchema), call),
3492
+ list: (call) => get("/stock-items", z33.array(managedStockItemSchema), call),
3461
3493
  createItem: (input, call) => create(
3462
3494
  "/stock-items",
3463
3495
  stockItemSchema,
@@ -3472,7 +3504,7 @@ function inventory({ create, get, post }) {
3472
3504
  stockInputSchema.parse(withActionId(input)),
3473
3505
  call
3474
3506
  ),
3475
- catalog: (call) => get("/pickup-inventory", z34.array(pickupCatalogSchema), call),
3507
+ catalog: (call) => get("/pickup-inventory", z33.array(pickupCatalogSchema), call),
3476
3508
  configure: (input, call) => post(
3477
3509
  "/pickup-inventory",
3478
3510
  pickupCatalogSchema,
@@ -3489,7 +3521,7 @@ function inventory({ create, get, post }) {
3489
3521
  var inventoryApi = (http) => inventory(http);
3490
3522
 
3491
3523
  // src/server/client/offers.ts
3492
- import * as z35 from "zod";
3524
+ import * as z34 from "zod";
3493
3525
  function offers({ get, post }) {
3494
3526
  return {
3495
3527
  /**
@@ -3527,7 +3559,7 @@ function offers({ get, post }) {
3527
3559
  ),
3528
3560
  call
3529
3561
  ),
3530
- list: (call) => get("/offers", z35.array(offerSchema), call),
3562
+ list: (call) => get("/offers", z34.array(offerSchema), call),
3531
3563
  /**
3532
3564
  * Every redemption, or one member's, newest first, in one unbounded response.
3533
3565
  *
@@ -3535,7 +3567,7 @@ function offers({ get, post }) {
3535
3567
  */
3536
3568
  redemptions: (input = {}, call) => get(
3537
3569
  `/redemptions${queryString({ member: input.member })}`,
3538
- z35.array(redemptionSchema),
3570
+ z34.array(redemptionSchema),
3539
3571
  call
3540
3572
  ),
3541
3573
  /** Pauses or resumes an offer at the revision the operator saw. */
@@ -3560,16 +3592,16 @@ function offers({ get, post }) {
3560
3592
  var offersApi = (http) => offers(http);
3561
3593
 
3562
3594
  // src/server/client/tokens.ts
3563
- import * as z38 from "zod";
3595
+ import * as z37 from "zod";
3564
3596
 
3565
3597
  // src/server/api-keys.ts
3566
- import * as z37 from "zod";
3598
+ import * as z36 from "zod";
3567
3599
 
3568
3600
  // src/server/permissions.ts
3569
- import * as z36 from "zod";
3570
- var environmentSchema = /* @__PURE__ */ (() => z36.enum(["test", "live"]))();
3571
- var roleSchema = /* @__PURE__ */ (() => z36.enum(["editor", "reviewer", "staff"]))();
3572
- 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([
3573
3605
  "read",
3574
3606
  "publish",
3575
3607
  "review",
@@ -3589,7 +3621,7 @@ var permissionSchema = /* @__PURE__ */ (() => z36.enum([
3589
3621
  */
3590
3622
  "enroll"
3591
3623
  ]))();
3592
- var permissionListSchema = /* @__PURE__ */ (() => z36.array(z36.string()).transform(
3624
+ var permissionListSchema = /* @__PURE__ */ (() => z35.array(z35.string()).transform(
3593
3625
  (values) => values.filter(
3594
3626
  (value) => permissionSchema.safeParse(value).success
3595
3627
  )
@@ -3599,8 +3631,8 @@ var rolePermissions = {
3599
3631
  reviewer: ["read", "review"],
3600
3632
  staff: ["read", "confirm", "handover"]
3601
3633
  };
3602
- var projectRoleSchema = /* @__PURE__ */ (() => z36.enum([...roleSchema.options, "viewer"]))();
3603
- var projectPermissionSchema = /* @__PURE__ */ (() => z36.enum([
3634
+ var projectRoleSchema = /* @__PURE__ */ (() => z35.enum([...roleSchema.options, "viewer"]))();
3635
+ var projectPermissionSchema = /* @__PURE__ */ (() => z35.enum([
3604
3636
  ...permissionSchema.options,
3605
3637
  "dashboards"
3606
3638
  ]))();
@@ -3612,55 +3644,55 @@ var projectRolePermissions = {
3612
3644
  };
3613
3645
 
3614
3646
  // src/server/api-keys.ts
3615
- var ingestTrackerScopeSchema = /* @__PURE__ */ (() => z37.array(identifier).min(1).max(100).nullable())();
3616
- var tokenScopeInputSchema = /* @__PURE__ */ (() => z37.object({ ingestTrackers: ingestTrackerScopeSchema }).strict())();
3617
- var tokenInputSchema = /* @__PURE__ */ (() => z37.object({
3618
- 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),
3619
3651
  project: identifier,
3620
3652
  environment: environmentSchema,
3621
- permissions: z37.array(permissionSchema).min(1),
3653
+ permissions: z36.array(permissionSchema).min(1),
3622
3654
  ingestTrackers: ingestTrackerScopeSchema.optional(),
3623
- days: z37.number().int().min(1).max(90).default(30)
3655
+ days: z36.number().int().min(1).max(90).default(30)
3624
3656
  }).strict())();
3625
- var tokenSchema = /* @__PURE__ */ (() => z37.object({
3626
- id: z37.string(),
3627
- name: z37.string(),
3628
- project: z37.string(),
3657
+ var tokenSchema = /* @__PURE__ */ (() => z36.object({
3658
+ id: z36.string(),
3659
+ name: z36.string(),
3660
+ project: z36.string(),
3629
3661
  environment: environmentSchema,
3630
3662
  permissions: permissionListSchema,
3631
3663
  ingestTrackers: ingestTrackerScopeSchema.optional(),
3632
- expiresAt: z37.number()
3664
+ expiresAt: z36.number()
3633
3665
  }))();
3634
- var issuedTokenSchema = /* @__PURE__ */ (() => tokenSchema.extend({ token: z37.string() }))();
3635
- var serviceKeyInputSchema = /* @__PURE__ */ (() => z37.object({
3636
- name: z37.string().trim().min(1).max(80),
3637
- 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(
3638
3670
  (permissions) => !permissions.includes("access"),
3639
3671
  "Service keys cannot hold the access permission"
3640
3672
  ),
3641
3673
  /** Days until the first secret expires. Omit it for a key that never expires. */
3642
- expiresInDays: z37.number().int().min(1).max(3650).optional()
3674
+ expiresInDays: z36.number().int().min(1).max(3650).optional()
3643
3675
  }).strict())();
3644
- var serviceKeySchema = /* @__PURE__ */ (() => z37.object({
3645
- id: z37.string().uuid(),
3646
- organization: z37.string(),
3647
- project: z37.string(),
3676
+ var serviceKeySchema = /* @__PURE__ */ (() => z36.object({
3677
+ id: z36.string().uuid(),
3678
+ organization: z36.string(),
3679
+ project: z36.string(),
3648
3680
  environment: environmentSchema,
3649
- name: z37.string(),
3681
+ name: z36.string(),
3650
3682
  permissions: permissionListSchema,
3651
3683
  /** The Clerk user ID of the administrator who created it. */
3652
- createdBy: z37.string(),
3653
- createdAt: z37.number(),
3684
+ createdBy: z36.string(),
3685
+ createdAt: z36.number(),
3654
3686
  /** The latest use of any of its secrets, revoked ones included; null when none was used. */
3655
- lastUsedAt: z37.number().nullable(),
3687
+ lastUsedAt: z36.number().nullable(),
3656
3688
  /** Its working secrets, oldest first. Any of them authenticates the key. */
3657
- secrets: z37.array(credentialSecretSchema)
3689
+ secrets: z36.array(credentialSecretSchema)
3658
3690
  }))();
3659
3691
  var issuedServiceKeySchema = /* @__PURE__ */ (() => serviceKeySchema.extend({
3660
- secret: z37.string().uuid(),
3661
- token: z37.string()
3692
+ secret: z36.string().uuid(),
3693
+ token: z36.string()
3662
3694
  }))();
3663
- var automationKeyPermissionSchema = /* @__PURE__ */ (() => z37.enum([
3695
+ var automationKeyPermissionSchema = /* @__PURE__ */ (() => z36.enum([
3664
3696
  "read",
3665
3697
  "publish",
3666
3698
  "inventory",
@@ -3668,47 +3700,47 @@ var automationKeyPermissionSchema = /* @__PURE__ */ (() => z37.enum([
3668
3700
  "ingest",
3669
3701
  "enroll"
3670
3702
  ]))();
3671
- var automationKeyInputSchema = /* @__PURE__ */ (() => z37.object({
3672
- name: z37.string().trim().min(1).max(80),
3673
- permissions: z37.array(automationKeyPermissionSchema).min(1),
3703
+ var automationKeyInputSchema = /* @__PURE__ */ (() => z36.object({
3704
+ name: z36.string().trim().min(1).max(80),
3705
+ permissions: z36.array(automationKeyPermissionSchema).min(1),
3674
3706
  /**
3675
3707
  * The projects it reaches. Omit it for every project of the organization, current and future.
3676
3708
  * An empty list, allowed only with `createProjects`, reaches only the projects it creates.
3677
3709
  */
3678
- projects: z37.array(identifier).max(100).optional(),
3710
+ projects: z36.array(identifier).max(100).optional(),
3679
3711
  /** Whether it may create projects. A project it creates joins its `projects` list. */
3680
- createProjects: z37.boolean().default(false),
3712
+ createProjects: z36.boolean().default(false),
3681
3713
  /** Days until the first secret expires. Omit it for a key that never expires. */
3682
- expiresInDays: z37.number().int().min(1).max(3650).optional()
3683
- }).strict().refine((key) => key.projects?.length !== 0 || key.createProjects, {
3714
+ expiresInDays: z36.number().int().min(1).max(3650).optional()
3715
+ }).strict().refine((key2) => key2.projects?.length !== 0 || key2.createProjects, {
3684
3716
  message: "Choose a project, or let the key create projects",
3685
3717
  path: ["projects"]
3686
3718
  }))();
3687
- var automationKeySchema = /* @__PURE__ */ (() => z37.object({
3688
- id: z37.string().uuid(),
3689
- organization: z37.string(),
3690
- name: z37.string(),
3719
+ var automationKeySchema = /* @__PURE__ */ (() => z36.object({
3720
+ id: z36.string().uuid(),
3721
+ organization: z36.string(),
3722
+ name: z36.string(),
3691
3723
  permissions: permissionListSchema,
3692
3724
  /** The projects it reaches; null for every project of the organization. */
3693
- projects: z37.array(z37.string()).nullable(),
3694
- createProjects: z37.boolean(),
3725
+ projects: z36.array(z36.string()).nullable(),
3726
+ createProjects: z36.boolean(),
3695
3727
  /** The Clerk user ID of the administrator who created it. */
3696
- createdBy: z37.string(),
3697
- createdAt: z37.number(),
3728
+ createdBy: z36.string(),
3729
+ createdAt: z36.number(),
3698
3730
  /** The latest use of any of its secrets, revoked ones included; null when none was used. */
3699
- lastUsedAt: z37.number().nullable(),
3731
+ lastUsedAt: z36.number().nullable(),
3700
3732
  /** Its working secrets, oldest first. Any of them authenticates the key. */
3701
- secrets: z37.array(credentialSecretSchema)
3733
+ secrets: z36.array(credentialSecretSchema)
3702
3734
  }))();
3703
3735
  var issuedAutomationKeySchema = /* @__PURE__ */ (() => automationKeySchema.extend({
3704
- secret: z37.string().uuid(),
3705
- token: z37.string()
3736
+ secret: z36.string().uuid(),
3737
+ token: z36.string()
3706
3738
  }))();
3707
3739
 
3708
3740
  // src/server/client/tokens.ts
3709
3741
  function tokens({ get, post, request }) {
3710
3742
  return {
3711
- list: (call) => get("/tokens", z38.array(tokenSchema), call),
3743
+ list: (call) => get("/tokens", z37.array(tokenSchema), call),
3712
3744
  /**
3713
3745
  * Issues a key for one project and environment, limited to permissions the caller holds
3714
3746
  * there. It expires after `days`, 1 to 90 (default 30). The secret `token` is in this
@@ -3717,14 +3749,14 @@ function tokens({ get, post, request }) {
3717
3749
  create: (input, call) => post("/tokens", issuedTokenSchema, tokenInputSchema.parse(input), call),
3718
3750
  /** Replace a personal key's ingestion restriction without changing its secret. */
3719
3751
  scope: (id, input, call) => request(
3720
- `/tokens/${encodeURIComponent(z38.string().min(1).parse(id))}/scope`,
3752
+ `/tokens/${encodeURIComponent(z37.string().min(1).parse(id))}/scope`,
3721
3753
  tokenSchema,
3722
3754
  tokenScopeInputSchema.parse(input),
3723
3755
  "PUT",
3724
3756
  call
3725
3757
  ),
3726
3758
  revoke: (id, call) => request(
3727
- `/tokens/${encodeURIComponent(z38.string().min(1).parse(id))}`,
3759
+ `/tokens/${encodeURIComponent(z37.string().min(1).parse(id))}`,
3728
3760
  ok,
3729
3761
  void 0,
3730
3762
  "DELETE",
@@ -3735,10 +3767,10 @@ function tokens({ get, post, request }) {
3735
3767
  var tokensApi = (http) => tokens(http);
3736
3768
 
3737
3769
  // src/server/client/service-keys.ts
3738
- import * as z39 from "zod";
3770
+ import * as z38 from "zod";
3739
3771
  function serviceKeys({ get, post, request }) {
3740
3772
  return {
3741
- list: (call) => get("/service-keys", z39.array(serviceKeySchema), call),
3773
+ list: (call) => get("/service-keys", z38.array(serviceKeySchema), call),
3742
3774
  /** The secret `token` is in this response only. */
3743
3775
  create: (input, call) => post(
3744
3776
  "/service-keys",
@@ -3751,14 +3783,14 @@ function serviceKeys({ get, post, request }) {
3751
3783
  * them with `revokeSecret`. The new `token` is in this response only.
3752
3784
  */
3753
3785
  addSecret: (id, input = {}, call) => post(
3754
- `/service-keys/${z39.string().uuid().parse(id)}/secrets`,
3786
+ `/service-keys/${z38.string().uuid().parse(id)}/secrets`,
3755
3787
  issuedServiceKeySchema,
3756
3788
  credentialSecretInputSchema.parse(input),
3757
3789
  call
3758
3790
  ),
3759
3791
  /** Stops one secret working. A key's last secret cannot be revoked; revoke the key instead. */
3760
3792
  revokeSecret: (id, secret, call) => request(
3761
- `/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)}`,
3762
3794
  serviceKeySchema,
3763
3795
  void 0,
3764
3796
  "DELETE",
@@ -3766,8 +3798,8 @@ function serviceKeys({ get, post, request }) {
3766
3798
  ),
3767
3799
  /** Deletes the key; every secret stops working. */
3768
3800
  revoke: (id, call) => request(
3769
- `/service-keys/${z39.string().uuid().parse(id)}`,
3770
- z39.null(),
3801
+ `/service-keys/${z38.string().uuid().parse(id)}`,
3802
+ z38.null(),
3771
3803
  void 0,
3772
3804
  "DELETE",
3773
3805
  call
@@ -3777,10 +3809,10 @@ function serviceKeys({ get, post, request }) {
3777
3809
  var serviceKeysApi = (http) => serviceKeys(http);
3778
3810
 
3779
3811
  // src/server/client/automation-keys.ts
3780
- import * as z40 from "zod";
3812
+ import * as z39 from "zod";
3781
3813
  function automationKeys({ get, post, request }) {
3782
3814
  return {
3783
- list: (call) => get("/automation-keys", z40.array(automationKeySchema), call),
3815
+ list: (call) => get("/automation-keys", z39.array(automationKeySchema), call),
3784
3816
  /** The secret `token` is in this response only. */
3785
3817
  create: (input, call) => post(
3786
3818
  "/automation-keys",
@@ -3793,14 +3825,14 @@ function automationKeys({ get, post, request }) {
3793
3825
  * them with `revokeSecret`. The new `token` is in this response only.
3794
3826
  */
3795
3827
  addSecret: (id, input = {}, call) => post(
3796
- `/automation-keys/${z40.string().uuid().parse(id)}/secrets`,
3828
+ `/automation-keys/${z39.string().uuid().parse(id)}/secrets`,
3797
3829
  issuedAutomationKeySchema,
3798
3830
  credentialSecretInputSchema.parse(input),
3799
3831
  call
3800
3832
  ),
3801
3833
  /** Stops one secret working. A key's last secret cannot be revoked; revoke the key instead. */
3802
3834
  revokeSecret: (id, secret, call) => request(
3803
- `/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)}`,
3804
3836
  automationKeySchema,
3805
3837
  void 0,
3806
3838
  "DELETE",
@@ -3808,8 +3840,8 @@ function automationKeys({ get, post, request }) {
3808
3840
  ),
3809
3841
  /** Deletes the key; every secret stops working. */
3810
3842
  revoke: (id, call) => request(
3811
- `/automation-keys/${z40.string().uuid().parse(id)}`,
3812
- z40.null(),
3843
+ `/automation-keys/${z39.string().uuid().parse(id)}`,
3844
+ z39.null(),
3813
3845
  void 0,
3814
3846
  "DELETE",
3815
3847
  call
@@ -3819,26 +3851,26 @@ function automationKeys({ get, post, request }) {
3819
3851
  var automationKeysApi = (http) => automationKeys(http);
3820
3852
 
3821
3853
  // src/server/client/grants.ts
3822
- import * as z42 from "zod";
3854
+ import * as z41 from "zod";
3823
3855
 
3824
3856
  // src/server/grants.ts
3825
- import * as z41 from "zod";
3826
- var grantSchema = /* @__PURE__ */ (() => z41.object({
3827
- subject: z41.string().min(1).max(200),
3828
- roles: z41.array(roleSchema),
3829
- 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)
3830
3862
  }).strict())();
3831
- var projectGrantSchema = /* @__PURE__ */ (() => z41.object({
3863
+ var projectGrantSchema = /* @__PURE__ */ (() => z40.object({
3832
3864
  subject: grantSchema.shape.subject,
3833
- roles: z41.array(projectRoleSchema),
3865
+ roles: z40.array(projectRoleSchema),
3834
3866
  environments: grantSchema.shape.environments,
3835
3867
  /**
3836
3868
  * When the grant stops giving access (epoch ms). Omit it, or send null, for a grant without
3837
3869
  * an end. An ended grant stays listed, so the project's access shows who had it and until when.
3838
3870
  */
3839
- expiresAt: z41.number().int().positive().nullable().optional()
3871
+ expiresAt: z40.number().int().positive().nullable().optional()
3840
3872
  }).strict())();
3841
- var grantRecordSchema = /* @__PURE__ */ (() => z41.object({
3873
+ var grantRecordSchema = /* @__PURE__ */ (() => z40.object({
3842
3874
  ...grantSchema.shape,
3843
3875
  /**
3844
3876
  * Every role the grant gives, `viewer` included, which `roles` leaves out. Absent from Relay
@@ -3846,23 +3878,23 @@ var grantRecordSchema = /* @__PURE__ */ (() => z41.object({
3846
3878
  *
3847
3879
  * @experimental
3848
3880
  */
3849
- projectRoles: z41.array(z41.string()).optional(),
3881
+ projectRoles: z40.array(z40.string()).optional(),
3850
3882
  /**
3851
3883
  * When the grant stops giving access (epoch ms), or null for no end. A grant past it is still
3852
3884
  * listed and gives no permission.
3853
3885
  *
3854
3886
  * @experimental
3855
3887
  */
3856
- expiresAt: z41.number().nullable().optional()
3888
+ expiresAt: z40.number().nullable().optional()
3857
3889
  }))();
3858
- var teamSchema = /* @__PURE__ */ (() => z41.array(
3859
- z41.object({ id: z41.string(), label: z41.string() })
3890
+ var teamSchema = /* @__PURE__ */ (() => z40.array(
3891
+ z40.object({ id: z40.string(), label: z40.string() })
3860
3892
  ))();
3861
3893
 
3862
3894
  // src/server/client/grants.ts
3863
3895
  function grants({ get, request }) {
3864
3896
  return {
3865
- list: (call) => get("/grants", z42.array(grantRecordSchema), call),
3897
+ list: (call) => get("/grants", z41.array(grantRecordSchema), call),
3866
3898
  /**
3867
3899
  * Replaces one person's roles, environments and end date on the project. The audit log
3868
3900
  * records it. `viewer` and `expiresAt` are experimental.
@@ -3887,14 +3919,14 @@ function team({ get }) {
3887
3919
  var teamApi = (http) => team(http);
3888
3920
 
3889
3921
  // src/server/client/webhooks.ts
3890
- import * as z43 from "zod";
3922
+ import * as z42 from "zod";
3891
3923
  function webhooks({ get, post, request }) {
3892
3924
  function rotateWebhookSecret(id, inputOrCall, call) {
3893
3925
  const isInput = call !== void 0 || inputOrCall !== void 0 && "actionId" in inputOrCall;
3894
3926
  const input = isInput ? inputOrCall ?? {} : {};
3895
3927
  const options = isInput ? call : inputOrCall;
3896
3928
  return post(
3897
- `/webhooks/${z43.string().uuid().parse(id)}/rotate-secret`,
3929
+ `/webhooks/${z42.string().uuid().parse(id)}/rotate-secret`,
3898
3930
  webhookSecretSchema,
3899
3931
  webhookRotateInputSchema.parse(withActionId(input)),
3900
3932
  options
@@ -3902,7 +3934,7 @@ function webhooks({ get, post, request }) {
3902
3934
  }
3903
3935
  return {
3904
3936
  state: (id, call) => get(
3905
- `/webhooks/${z43.string().uuid().parse(id)}/state`,
3937
+ `/webhooks/${z42.string().uuid().parse(id)}/state`,
3906
3938
  webhookEndpointStateSchema,
3907
3939
  call
3908
3940
  ),
@@ -3913,24 +3945,24 @@ function webhooks({ get, post, request }) {
3913
3945
  call
3914
3946
  ),
3915
3947
  delete: (id, input, call) => post(
3916
- `/webhooks/${z43.string().uuid().parse(id)}/delete`,
3948
+ `/webhooks/${z42.string().uuid().parse(id)}/delete`,
3917
3949
  webhookEndpointStateSchema,
3918
3950
  webhookDeleteInputSchema.parse(withActionId(input)),
3919
3951
  call
3920
3952
  ),
3921
3953
  pause: (id, input = {}, call) => post(
3922
- `/webhooks/${z43.string().uuid().parse(id)}/pause`,
3954
+ `/webhooks/${z42.string().uuid().parse(id)}/pause`,
3923
3955
  webhookEndpointSchema,
3924
3956
  webhookControlInputSchema.parse(withActionId(input)),
3925
3957
  call
3926
3958
  ),
3927
3959
  resume: (id, input = {}, call) => post(
3928
- `/webhooks/${z43.string().uuid().parse(id)}/resume`,
3960
+ `/webhooks/${z42.string().uuid().parse(id)}/resume`,
3929
3961
  webhookEndpointSchema,
3930
3962
  webhookControlInputSchema.parse(withActionId(input)),
3931
3963
  call
3932
3964
  ),
3933
- list: (call) => get("/webhooks", z43.array(webhookEndpointSchema), call),
3965
+ list: (call) => get("/webhooks", z42.array(webhookEndpointSchema), call),
3934
3966
  /** Pass an `actionId` to recover the endpoint and its secret after a lost answer. */
3935
3967
  create: (input, call) => post(
3936
3968
  "/webhooks",
@@ -3939,7 +3971,7 @@ function webhooks({ get, post, request }) {
3939
3971
  call
3940
3972
  ),
3941
3973
  update: (id, input, call) => request(
3942
- `/webhooks/${z43.string().uuid().parse(id)}`,
3974
+ `/webhooks/${z42.string().uuid().parse(id)}`,
3943
3975
  webhookEndpointSchema,
3944
3976
  webhookUpdateSchema.parse(input),
3945
3977
  "PUT",
@@ -3947,14 +3979,14 @@ function webhooks({ get, post, request }) {
3947
3979
  ),
3948
3980
  /** @deprecated Use pause. Removed in 2.0.0. */
3949
3981
  disable: (id, call) => post(
3950
- `/webhooks/${z43.string().uuid().parse(id)}/disable`,
3982
+ `/webhooks/${z42.string().uuid().parse(id)}/disable`,
3951
3983
  webhookEndpointSchema,
3952
3984
  {},
3953
3985
  call
3954
3986
  ),
3955
3987
  rotateSecret: rotateWebhookSecret,
3956
3988
  deliveries: (id, query = {}, call) => get(
3957
- `/webhooks/${z43.string().uuid().parse(id)}/deliveries${queryString(webhookQuerySchema.parse(query))}`,
3989
+ `/webhooks/${z42.string().uuid().parse(id)}/deliveries${queryString(webhookQuerySchema.parse(query))}`,
3958
3990
  webhookDeliveryPageSchema,
3959
3991
  call
3960
3992
  ),
@@ -3964,7 +3996,7 @@ function webhooks({ get, post, request }) {
3964
3996
  */
3965
3997
  replay: (id, delivery, ...rest) => actionCommand(
3966
3998
  (webhook, input, call) => post(
3967
- `/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`,
3968
4000
  webhookDeliverySchema,
3969
4001
  webhookControlInputSchema.parse(input),
3970
4002
  call
@@ -3975,7 +4007,7 @@ function webhooks({ get, post, request }) {
3975
4007
  var webhooksApi = (http) => webhooks(http);
3976
4008
 
3977
4009
  // src/server/client/identity-integrations.ts
3978
- import * as z44 from "zod";
4010
+ import * as z43 from "zod";
3979
4011
  function identityIntegrations({
3980
4012
  exchange,
3981
4013
  get,
@@ -3983,7 +4015,7 @@ function identityIntegrations({
3983
4015
  request
3984
4016
  }) {
3985
4017
  return {
3986
- list: (call) => get("/identity-integrations", z44.array(identityIntegrationSchema), call),
4018
+ list: (call) => get("/identity-integrations", z43.array(identityIntegrationSchema), call),
3987
4019
  /** The secret `token` is in this response only. */
3988
4020
  create: (input, call) => post(
3989
4021
  "/identity-integrations",
@@ -4013,7 +4045,7 @@ function identityIntegrations({
4013
4045
  * @deprecated Use `addSecret`, then `revokeSecret` the old secret once your app uses the new one.
4014
4046
  */
4015
4047
  rotate: (id, call) => post(
4016
- `/identity-integrations/${z44.string().uuid().parse(id)}/rotate`,
4048
+ `/identity-integrations/${z43.string().uuid().parse(id)}/rotate`,
4017
4049
  identityIntegrationSecretSchema,
4018
4050
  {},
4019
4051
  call
@@ -4023,7 +4055,7 @@ function identityIntegrations({
4023
4055
  * revoke them with `revokeSecret`. The new `token` is in this response only.
4024
4056
  */
4025
4057
  addSecret: (id, input = {}, call) => post(
4026
- `/identity-integrations/${z44.string().uuid().parse(id)}/secrets`,
4058
+ `/identity-integrations/${z43.string().uuid().parse(id)}/secrets`,
4027
4059
  identityIntegrationSecretSchema,
4028
4060
  credentialSecretInputSchema.parse(input),
4029
4061
  call
@@ -4033,7 +4065,7 @@ function identityIntegrations({
4033
4065
  * environment instead of answering it, as `createIntoAppSecret` does.
4034
4066
  */
4035
4067
  addSecretIntoAppSecret: (id, appSecret, input = {}, call) => post(
4036
- `/identity-integrations/${z44.string().uuid().parse(id)}/secrets`,
4068
+ `/identity-integrations/${z43.string().uuid().parse(id)}/secrets`,
4037
4069
  identityIntegrationAppSecretSchema,
4038
4070
  {
4039
4071
  ...credentialSecretInputSchema.parse(input),
@@ -4046,7 +4078,7 @@ function identityIntegrations({
4046
4078
  * revoked; disconnect the integration with `revoke` instead.
4047
4079
  */
4048
4080
  revokeSecret: (id, secret, call) => request(
4049
- `/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)}`,
4050
4082
  identityIntegrationSchema,
4051
4083
  void 0,
4052
4084
  "DELETE",
@@ -4054,7 +4086,7 @@ function identityIntegrations({
4054
4086
  ),
4055
4087
  /** Makes one secret never expire. */
4056
4088
  removeSecretExpiry: (id, secret, call) => request(
4057
- `/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`,
4058
4090
  identityIntegrationSchema,
4059
4091
  void 0,
4060
4092
  "DELETE",
@@ -4067,7 +4099,7 @@ function identityIntegrations({
4067
4099
  */
4068
4100
  kinds: (call) => get(
4069
4101
  "/identity-integrations/kinds",
4070
- z44.array(identityKindClaimSchema),
4102
+ z43.array(identityKindClaimSchema),
4071
4103
  call
4072
4104
  ),
4073
4105
  /**
@@ -4079,7 +4111,7 @@ function identityIntegrations({
4079
4111
  setAccountVouching: (id, input, call) => (
4080
4112
  // The action ID's receipt makes a repeat apply once, so the client may resend it.
4081
4113
  exchange(
4082
- `/identity-integrations/${z44.string().uuid().parse(id)}/account-vouching`,
4114
+ `/identity-integrations/${z43.string().uuid().parse(id)}/account-vouching`,
4083
4115
  identityIntegrationSchema,
4084
4116
  identityIntegrationAccountVouchingInputSchema.parse(
4085
4117
  withActionId(input)
@@ -4094,8 +4126,8 @@ function identityIntegrations({
4094
4126
  * and keep attributing tracker records; unlink them on the member to stop that.
4095
4127
  */
4096
4128
  revoke: (id, call) => request(
4097
- `/identity-integrations/${z44.string().uuid().parse(id)}`,
4098
- z44.null(),
4129
+ `/identity-integrations/${z43.string().uuid().parse(id)}`,
4130
+ z43.null(),
4099
4131
  void 0,
4100
4132
  "DELETE",
4101
4133
  call
@@ -4105,35 +4137,35 @@ function identityIntegrations({
4105
4137
  var identityIntegrationsApi = (http) => identityIntegrations(http);
4106
4138
 
4107
4139
  // src/server/audit.ts
4108
- import * as z45 from "zod";
4109
- var auditRecordSchema = /* @__PURE__ */ (() => z45.object({
4110
- id: z45.string(),
4111
- action: z45.string(),
4112
- 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(),
4113
4145
  user: operatorUserSchema.nullable().optional(),
4114
- detail: z45.string(),
4115
- at: z45.number(),
4116
- attempt: z45.string().nullable()
4117
- }).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, {
4118
4150
  message: "User profile must match the recorded actor",
4119
4151
  path: ["user"]
4120
4152
  }))();
4121
- var auditQuerySchema = /* @__PURE__ */ (() => z45.strictObject({
4122
- category: z45.enum(["reviews", "rewards", "configuration"]).optional(),
4123
- 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(),
4124
4156
  limit: pageLimit,
4125
4157
  cursor: pageCursorSchema.optional()
4126
4158
  }))();
4127
4159
  var auditListQuerySchema = /* @__PURE__ */ (() => auditQuerySchema.extend({
4128
- category: z45.enum(["reviews", "rewards", "configuration", "test-members"]).optional()
4160
+ category: z44.enum(["reviews", "rewards", "configuration", "test-members"]).optional()
4129
4161
  }))();
4130
4162
  var accessHistoryQuerySchema = /* @__PURE__ */ (() => auditQuerySchema.omit({
4131
4163
  category: true
4132
4164
  }))();
4133
- var auditPageSchema = /* @__PURE__ */ (() => z45.object({
4134
- items: z45.array(auditRecordSchema),
4135
- total: z45.number().int().nonnegative(),
4136
- 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()
4137
4169
  }))();
4138
4170
 
4139
4171
  // src/server/client/audit.ts
@@ -4230,7 +4262,7 @@ function discordRoles({ get, post }) {
4230
4262
  var discordRolesApi = (http) => discordRoles(http);
4231
4263
 
4232
4264
  // src/server/client/test-members.ts
4233
- import * as z46 from "zod";
4265
+ import * as z45 from "zod";
4234
4266
  function testMembers({ get, post }) {
4235
4267
  return {
4236
4268
  create: (input, call) => post(
@@ -4239,7 +4271,7 @@ function testMembers({ get, post }) {
4239
4271
  testMemberCreateSchema.parse(withActionId(input)),
4240
4272
  call
4241
4273
  ),
4242
- list: (call) => get("/test-members", z46.array(testMemberSchema), call),
4274
+ list: (call) => get("/test-members", z45.array(testMemberSchema), call),
4243
4275
  history: (member, query = {}, call) => get(
4244
4276
  `/test-members/${identifier.parse(member)}/history${queryString(testMemberHistoryQuerySchema.parse(query))}`,
4245
4277
  testMemberHistorySchema,
@@ -4257,16 +4289,16 @@ function testMembers({ get, post }) {
4257
4289
  * and file store one image, so pass `act`'s action ID to replay both. Reset deletes it.
4258
4290
  */
4259
4291
  uploadEvidence: (member, file, input = {}, call) => {
4260
- const { actionId: actionId2 } = withActionId(
4261
- z46.object({ actionId: identifier.optional() }).strict().parse(input)
4292
+ const { actionId: actionId3 } = withActionId(
4293
+ z45.object({ actionId: identifier.optional() }).strict().parse(input)
4262
4294
  );
4263
4295
  return post(
4264
4296
  `/test-members/${identifier.parse(member)}/evidence`,
4265
4297
  evidenceSchema,
4266
4298
  new ManagementUploadBody(
4267
4299
  file,
4268
- { "X-Relay-Upload-ID": actionId2 },
4269
- actionId2
4300
+ { "X-Relay-Upload-ID": actionId3 },
4301
+ actionId3
4270
4302
  ),
4271
4303
  call
4272
4304
  );
@@ -4517,79 +4549,79 @@ function memberImports({ get, post }) {
4517
4549
  var memberImportsApi = (http) => memberImports(http);
4518
4550
 
4519
4551
  // src/server/client/members.ts
4520
- import * as z51 from "zod";
4552
+ import * as z50 from "zod";
4521
4553
 
4522
4554
  // src/server/members.ts
4523
- import * as z49 from "zod";
4555
+ import * as z48 from "zod";
4524
4556
 
4525
4557
  // src/server/member-bans.ts
4526
- import * as z47 from "zod";
4527
- var memberBanRollbackSchema = /* @__PURE__ */ (() => z47.object({
4528
- completions: z47.boolean().default(false),
4529
- referralPayouts: z47.boolean().default(false),
4530
- 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)
4531
4563
  }).strict())();
4532
- var banReason = /* @__PURE__ */ (() => z47.string().trim().min(1).max(500))();
4533
- var memberBanInputSchema = /* @__PURE__ */ (() => z47.object({
4564
+ var banReason = /* @__PURE__ */ (() => z46.string().trim().min(1).max(500))();
4565
+ var memberBanInputSchema = /* @__PURE__ */ (() => z46.object({
4534
4566
  actionId: identifier,
4535
4567
  reason: banReason,
4536
4568
  rollback: memberBanRollbackSchema.optional()
4537
4569
  }).strict())();
4538
- var memberBanPreviewInputSchema = /* @__PURE__ */ (() => z47.object({ rollback: memberBanRollbackSchema.optional() }).strict())();
4539
- var memberUnbanInputSchema = /* @__PURE__ */ (() => z47.object({
4570
+ var memberBanPreviewInputSchema = /* @__PURE__ */ (() => z46.object({ rollback: memberBanRollbackSchema.optional() }).strict())();
4571
+ var memberUnbanInputSchema = /* @__PURE__ */ (() => z46.object({
4540
4572
  actionId: identifier,
4541
4573
  reason: banReason,
4542
- restoreCompletions: z47.boolean().default(false)
4574
+ restoreCompletions: z46.boolean().default(false)
4543
4575
  }).strict())();
4544
- var points2 = /* @__PURE__ */ (() => z47.number().int().nonnegative())();
4545
- var memberBanOutcomeSchema = /* @__PURE__ */ (() => z47.object({
4576
+ var points2 = /* @__PURE__ */ (() => z46.number().int().nonnegative())();
4577
+ var memberBanOutcomeSchema = /* @__PURE__ */ (() => z46.object({
4546
4578
  attemptsRejected: points2,
4547
4579
  completionsRevoked: points2,
4548
4580
  completionsRestored: points2,
4549
- completionsKept: z47.array(
4550
- z47.object({ completion: identifier, code: z47.string() })
4581
+ completionsKept: z46.array(
4582
+ z46.object({ completion: identifier, code: z46.string() })
4551
4583
  ),
4552
4584
  entriesReversed: points2,
4553
4585
  referralAccounts: points2,
4554
- points: z47.array(
4555
- z47.object({ ledger: identifier, reversed: points2, unreversed: points2 })
4586
+ points: z46.array(
4587
+ z46.object({ ledger: identifier, reversed: points2, unreversed: points2 })
4556
4588
  ),
4557
- referralDebt: z47.array(z47.object({ ledger: identifier, amount: points2 }))
4589
+ referralDebt: z46.array(z46.object({ ledger: identifier, amount: points2 }))
4558
4590
  }))();
4559
- var runStatusSchema = /* @__PURE__ */ (() => z47.string())();
4560
- var runSchema = /* @__PURE__ */ (() => z47.object({
4591
+ var runStatusSchema = /* @__PURE__ */ (() => z46.string())();
4592
+ var runSchema = /* @__PURE__ */ (() => z46.object({
4561
4593
  status: runStatusSchema,
4562
- finishedAt: z47.number().int().nullable(),
4594
+ finishedAt: z46.number().int().nullable(),
4563
4595
  outcome: memberBanOutcomeSchema.nullable()
4564
4596
  }))();
4565
- var memberBanSchema = /* @__PURE__ */ (() => z47.object({
4597
+ var memberBanSchema = /* @__PURE__ */ (() => z46.object({
4566
4598
  id: identifier,
4567
4599
  member: identifier,
4568
- reason: z47.string(),
4569
- bannedAt: z47.number().int(),
4570
- bannedBy: z47.string().nullable(),
4600
+ reason: z46.string(),
4601
+ bannedAt: z46.number().int(),
4602
+ bannedBy: z46.string().nullable(),
4571
4603
  rollback: runSchema.extend({
4572
- completions: z47.boolean(),
4573
- referralPayouts: z47.boolean(),
4574
- pointAwards: z47.boolean()
4604
+ completions: z46.boolean(),
4605
+ referralPayouts: z46.boolean(),
4606
+ pointAwards: z46.boolean()
4575
4607
  }),
4576
- unban: z47.object({
4577
- reason: z47.string(),
4578
- unbannedAt: z47.number().int(),
4579
- by: z47.string().nullable(),
4580
- 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(),
4581
4613
  restore: runSchema.nullable()
4582
4614
  }).nullable()
4583
4615
  }))();
4584
- var memberBanPreviewSchema = /* @__PURE__ */ (() => z47.object({
4616
+ var memberBanPreviewSchema = /* @__PURE__ */ (() => z46.object({
4585
4617
  member: identifier,
4586
- banned: z47.boolean(),
4618
+ banned: z46.boolean(),
4587
4619
  attempts: points2,
4588
4620
  completions: points2,
4589
4621
  entries: points2,
4590
4622
  referralAccounts: points2,
4591
- points: z47.array(
4592
- z47.object({
4623
+ points: z46.array(
4624
+ z46.object({
4593
4625
  ledger: identifier,
4594
4626
  completions: points2,
4595
4627
  pointAwards: points2,
@@ -4600,11 +4632,11 @@ var memberBanPreviewSchema = /* @__PURE__ */ (() => z47.object({
4600
4632
  referralDebt: points2
4601
4633
  })
4602
4634
  ),
4603
- inviters: z47.array(
4604
- z47.object({
4635
+ inviters: z46.array(
4636
+ z46.object({
4605
4637
  member: identifier,
4606
- ledgers: z47.array(
4607
- z47.object({
4638
+ ledgers: z46.array(
4639
+ z46.object({
4608
4640
  ledger: identifier,
4609
4641
  bonus: points2,
4610
4642
  reversed: points2,
@@ -4616,23 +4648,31 @@ var memberBanPreviewSchema = /* @__PURE__ */ (() => z47.object({
4616
4648
  }))();
4617
4649
 
4618
4650
  // src/server/wallets.ts
4619
- import * as z48 from "zod";
4651
+ import * as z47 from "zod";
4620
4652
  var managedWalletSchema = /* @__PURE__ */ (() => linkedWalletSchema.extend({
4621
4653
  /**
4622
4654
  * True when the organization vouched for the wallet (a member import, or an app login's server at
4623
4655
  * sign-in), and the member has not proved it since. Absent from Relay versions without imports.
4624
4656
  */
4625
- imported: z48.boolean().optional(),
4657
+ imported: z47.boolean().optional(),
4626
4658
  /**
4627
4659
  * The app login that vouched for the wallet at sign-in, while `imported` is true and no member
4628
4660
  * import attached it. Absent from Relay versions without it.
4629
4661
  */
4630
4662
  vouchedBy: accountVouchedBySchema.optional(),
4631
4663
  ...identitySourceFields,
4632
- status: z48.enum(["linked", "unlinked"]),
4633
- 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(),
4634
4674
  /** "member", or the operator or key that unlinked it. */
4635
- unlinkedBy: z48.string().nullable()
4675
+ unlinkedBy: z47.string().nullable()
4636
4676
  }))();
4637
4677
  var balanceCheckSchema = /* @__PURE__ */ (() => walletBalanceSchema.pick({
4638
4678
  chain: true,
@@ -4642,66 +4682,66 @@ var balanceCheckSchema = /* @__PURE__ */ (() => walletBalanceSchema.pick({
4642
4682
  wallets: true,
4643
4683
  observedAt: true
4644
4684
  }).extend({ attempt: identifier }))();
4645
- var walletBalanceChainsSchema = /* @__PURE__ */ (() => z48.object({
4646
- chains: z48.array(
4647
- z48.object({
4648
- chain: z48.union([
4649
- z48.literal(solanaMainnet),
4650
- z48.literal(solanaDevnet),
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),
4651
4691
  cosmosNetworkSchema,
4652
4692
  evmChainIdSchema
4653
4693
  ]),
4654
- name: z48.string(),
4655
- testnet: z48.boolean()
4694
+ name: z47.string(),
4695
+ testnet: z47.boolean()
4656
4696
  })
4657
4697
  )
4658
4698
  }))();
4659
- 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())();
4660
4700
  var memberWalletSignInInputSchema = /* @__PURE__ */ (() => walletUnlinkInputSchema.extend({
4661
- enabled: z48.boolean(),
4662
- reason: z48.string().trim().min(1).max(500)
4701
+ enabled: z47.boolean(),
4702
+ reason: z47.string().trim().min(1).max(500)
4663
4703
  }).strict())();
4664
4704
 
4665
4705
  // src/server/members.ts
4666
- var memberSchema = /* @__PURE__ */ (() => z49.object({
4667
- id: z49.string(),
4668
- test: z49.boolean().optional(),
4669
- name: z49.string().nullable().optional(),
4670
- 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([]),
4671
4711
  /** The member's linked app identities, by kind. Absent from Relay versions without it. */
4672
- appIdentities: z49.array(memberAppIdentitySchema).optional(),
4673
- attempts: z49.number(),
4674
- completions: z49.number(),
4675
- rewards: z49.number(),
4676
- 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(),
4677
4717
  /**
4678
4718
  * When the customer erased the member (`members.erase`), in Unix milliseconds: it keeps its ID
4679
4719
  * and accounting, with no profile, accounts or identities. Absent on a member that was not erased.
4680
4720
  */
4681
- erasedAt: z49.number().optional(),
4721
+ erasedAt: z48.number().optional(),
4682
4722
  /**
4683
4723
  * When an operator banned the member (`members.ban`), in Unix milliseconds. Absent on a member
4684
4724
  * who is not banned now.
4685
4725
  *
4686
4726
  * @experimental A minor release can change member bans.
4687
4727
  */
4688
- bannedAt: z49.number().optional()
4728
+ bannedAt: z48.number().optional()
4689
4729
  }))();
4690
- var managedOAuthAccountBaseSchema = /* @__PURE__ */ (() => z49.object({
4691
- provider: z49.enum(["x", "discord"]),
4692
- revision: z49.number().int().nonnegative()
4730
+ var managedOAuthAccountBaseSchema = /* @__PURE__ */ (() => z48.object({
4731
+ provider: z48.enum(["x", "discord"]),
4732
+ revision: z48.number().int().nonnegative()
4693
4733
  }))();
4694
- var managedOAuthAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion("status", [
4734
+ var managedOAuthAccountSchema = /* @__PURE__ */ (() => z48.discriminatedUnion("status", [
4695
4735
  managedOAuthAccountBaseSchema.extend({
4696
- status: z49.literal("connected"),
4697
- subject: z49.string().min(1),
4698
- linkedAt: z49.number(),
4736
+ status: z48.literal("connected"),
4737
+ subject: z48.string().min(1),
4738
+ linkedAt: z48.number(),
4699
4739
  /**
4700
4740
  * True when the organization vouched for the account, not the member's proof: a member import
4701
4741
  * attached it, or an app login's server did at sign-in (`vouchedBy`). Absent from Relay
4702
4742
  * versions without imports.
4703
4743
  */
4704
- imported: z49.boolean().optional(),
4744
+ imported: z48.boolean().optional(),
4705
4745
  /**
4706
4746
  * The app login that vouched for the account at sign-in, for an account with `imported` set
4707
4747
  * that no member import attached. Absent from Relay versions without it.
@@ -4711,26 +4751,26 @@ var managedOAuthAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion("s
4711
4751
  * True for a real account an operator linked to a test member without OAuth
4712
4752
  * (`testMembers.linkAccount`). Absent from Relay versions without it.
4713
4753
  */
4714
- testLinked: z49.boolean().optional(),
4754
+ testLinked: z48.boolean().optional(),
4715
4755
  ...identitySourceFields
4716
4756
  }),
4717
- managedOAuthAccountBaseSchema.extend({ status: z49.literal("disconnected") })
4757
+ managedOAuthAccountBaseSchema.extend({ status: z48.literal("disconnected") })
4718
4758
  ]))();
4719
4759
  var managedTelegramAccountBaseSchema = /* @__PURE__ */ (() => managedOAuthAccountBaseSchema.extend({
4720
- provider: z49.literal("telegram")
4760
+ provider: z48.literal("telegram")
4721
4761
  }))();
4722
- var managedTelegramAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion("status", [
4762
+ var managedTelegramAccountSchema = /* @__PURE__ */ (() => z48.discriminatedUnion("status", [
4723
4763
  managedTelegramAccountBaseSchema.extend({
4724
- status: z49.literal("connected"),
4764
+ status: z48.literal("connected"),
4725
4765
  /** The numeric Telegram user ID. */
4726
- subject: z49.string().min(1),
4727
- linkedAt: z49.number(),
4766
+ subject: z48.string().min(1),
4767
+ linkedAt: z48.number(),
4728
4768
  /**
4729
4769
  * True when the organization vouched for the account, not the member's proof: a member import
4730
4770
  * attached it, or an app login's server did at sign-in (`vouchedBy`). Absent from Relay
4731
4771
  * versions without it.
4732
4772
  */
4733
- imported: z49.boolean().optional(),
4773
+ imported: z48.boolean().optional(),
4734
4774
  /**
4735
4775
  * The app login that vouched for the account at sign-in, for an account with `imported` set
4736
4776
  * that no member import attached. Absent from Relay versions without it.
@@ -4739,14 +4779,14 @@ var managedTelegramAccountSchema = /* @__PURE__ */ (() => z49.discriminatedUnion
4739
4779
  ...identitySourceFields
4740
4780
  }),
4741
4781
  managedTelegramAccountBaseSchema.extend({
4742
- status: z49.literal("disconnected")
4782
+ status: z48.literal("disconnected")
4743
4783
  })
4744
4784
  ]))();
4745
- var memberOAuthUnlinkInputSchema = /* @__PURE__ */ (() => z49.object({
4746
- provider: z49.enum(["x", "discord"]),
4747
- subject: z49.string().min(1).max(4096),
4748
- revision: z49.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER - 1),
4749
- 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)
4750
4790
  }).strict())();
4751
4791
  var memberTelegramUnlinkInputSchema = /* @__PURE__ */ (() => memberOAuthUnlinkInputSchema.omit({ provider: true }).strict())();
4752
4792
  var managedMemberIdentitySchema = /* @__PURE__ */ (() => memberIdentitySchema.extend({
@@ -4755,7 +4795,7 @@ var managedMemberIdentitySchema = /* @__PURE__ */ (() => memberIdentitySchema.ex
4755
4795
  * login's server at sign-in), until the member links that provider's account, or signs in with
4756
4796
  * the X account, through Domino. Absent from Relay versions without imports.
4757
4797
  */
4758
- imported: z49.boolean().optional(),
4798
+ imported: z48.boolean().optional(),
4759
4799
  /**
4760
4800
  * The app login that vouched for the account at sign-in, for an `imported` account no member
4761
4801
  * import attached. Absent from Relay versions without it.
@@ -4765,40 +4805,40 @@ var managedMemberIdentitySchema = /* @__PURE__ */ (() => memberIdentitySchema.ex
4765
4805
  * True for a real X or Discord account an operator linked to a test member without OAuth
4766
4806
  * (`testMembers.linkAccount`). Absent from Relay versions without it.
4767
4807
  */
4768
- testLinked: z49.boolean().optional(),
4808
+ testLinked: z48.boolean().optional(),
4769
4809
  ...identitySourceFields,
4770
- status: z49.enum(["linked", "unlinked"]),
4771
- unlinkedAt: z49.number().int().nullable(),
4810
+ status: z48.enum(["linked", "unlinked"]),
4811
+ unlinkedAt: z48.number().int().nullable(),
4772
4812
  /** The operator or key that unlinked it. */
4773
- unlinkedBy: z49.string().nullable()
4813
+ unlinkedBy: z48.string().nullable()
4774
4814
  }))();
4775
- var memberIdentityChangeInputSchema = /* @__PURE__ */ (() => z49.object({
4815
+ var memberIdentityChangeInputSchema = /* @__PURE__ */ (() => z48.object({
4776
4816
  kind: appIdentityKindSchema,
4777
- subject: z49.string().min(1).max(256),
4778
- 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)
4779
4819
  }).strict())();
4780
- var memberDetailSchema = /* @__PURE__ */ (() => z49.object({
4820
+ var memberDetailSchema = /* @__PURE__ */ (() => z48.object({
4781
4821
  snapshot: snapshotSchema,
4782
4822
  member: memberSchema,
4783
4823
  progress: memberProgressSchema,
4784
4824
  /** Up to 25 revoked completions with an unreversed point remainder, newest first. */
4785
- revocationShortfalls: z49.array(completionRevocationShortfallSchema).default([]),
4825
+ revocationShortfalls: z48.array(completionRevocationShortfallSchema).default([]),
4786
4826
  /** Up to 25 revoked completions, newest first. Relay older than restore leaves it out. */
4787
- revokedCompletions: z49.array(revokedCompletionSchema).optional(),
4827
+ revokedCompletions: z48.array(revokedCompletionSchema).optional(),
4788
4828
  /** Current and historical campaign enrollment state, including inactive enrollments. */
4789
- campaignEnrollments: z49.array(campaignEnrollmentSchema).default([]),
4790
- passes: z49.array(
4791
- z49.object({
4792
- provider: z49.string(),
4793
- event: z49.string(),
4794
- 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(),
4795
4835
  attempt: identifier.nullable()
4796
4836
  })
4797
4837
  ).default([]),
4798
4838
  /** Linked and unlinked wallets. */
4799
- wallets: z49.array(managedWalletSchema),
4839
+ wallets: z48.array(managedWalletSchema),
4800
4840
  /** The member's 10 most recent recorded balance reads, newest first. */
4801
- balanceChecks: z49.array(balanceCheckSchema),
4841
+ balanceChecks: z48.array(balanceCheckSchema),
4802
4842
  /** The member's participant profile in this project. */
4803
4843
  profile: managedProfileSchema.nullable(),
4804
4844
  /**
@@ -4806,20 +4846,20 @@ var memberDetailSchema = /* @__PURE__ */ (() => z49.object({
4806
4846
  * member ID: their selected X and Discord accounts and their `app:<name>` identities in this
4807
4847
  * project, including app identities an operator unlinked, by kind.
4808
4848
  */
4809
- identities: z49.array(managedMemberIdentitySchema),
4849
+ identities: z48.array(managedMemberIdentitySchema),
4810
4850
  /**
4811
4851
  * The creator accounts the member linked (a YouTube channel), whose content managed tracker
4812
4852
  * sources attribute to them. Absent from Relay versions without creator accounts.
4813
4853
  */
4814
- creatorAccounts: z49.array(managedCreatorAccountSchema).optional(),
4854
+ creatorAccounts: z48.array(managedCreatorAccountSchema).optional(),
4815
4855
  /**
4816
4856
  * Who invited the member, when they accepted, and the member import that recorded it, or null
4817
4857
  * when nobody invited them. Absent from Relay versions before imported referrals.
4818
4858
  */
4819
- referral: z49.object({
4859
+ referral: z48.object({
4820
4860
  inviter: identifier,
4821
- acceptedAt: z49.number().int().nonnegative(),
4822
- suspended: z49.boolean(),
4861
+ acceptedAt: z48.number().int().nonnegative(),
4862
+ suspended: z48.boolean(),
4823
4863
  import: identifier.nullable()
4824
4864
  }).nullable().optional(),
4825
4865
  /**
@@ -4830,9 +4870,9 @@ var memberDetailSchema = /* @__PURE__ */ (() => z49.object({
4830
4870
  */
4831
4871
  ban: memberBanSchema.nullable().optional()
4832
4872
  }))();
4833
- var managedMemberProgressSchema = /* @__PURE__ */ (() => z49.object({
4873
+ var managedMemberProgressSchema = /* @__PURE__ */ (() => z48.object({
4834
4874
  member: identifier,
4835
- quests: z49.array(
4875
+ quests: z48.array(
4836
4876
  memberProgressSchema.shape.quests.element.extend({
4837
4877
  /** The streak as `members.get` reports it, without the list of qualifying days. */
4838
4878
  streak: streakProgressSchema.omit({ days: true }).nullable().optional()
@@ -4843,10 +4883,10 @@ var managedMemberProgressSchema = /* @__PURE__ */ (() => z49.object({
4843
4883
  /** Each point balance the member has, by balance ID. */
4844
4884
  balances: snapshotSchema.shape.balances
4845
4885
  }))();
4846
- var memberLookupSchema = /* @__PURE__ */ (() => z49.union([
4847
- z49.object({
4848
- provider: z49.string().min(1).max(200),
4849
- 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)
4850
4890
  }).strict(),
4851
4891
  identityReferenceSchema.transform(
4852
4892
  (reference) => reference.kind === "wallet" ? { provider: reference.chain, subject: reference.address } : { provider: reference.kind, subject: reference.subject }
@@ -4857,50 +4897,50 @@ var memberLookupSchema = /* @__PURE__ */ (() => z49.union([
4857
4897
  subject: address
4858
4898
  }))
4859
4899
  ]))();
4860
- var booleanQuery = /* @__PURE__ */ (() => z49.union([
4861
- z49.boolean(),
4862
- 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")
4863
4903
  ]))();
4864
- var managedMemberQuerySchema = /* @__PURE__ */ (() => z49.strictObject({
4865
- q: z49.string().max(200).optional(),
4904
+ var managedMemberQuerySchema = /* @__PURE__ */ (() => z48.strictObject({
4905
+ q: z48.string().max(200).optional(),
4866
4906
  needsReview: booleanQuery.optional(),
4867
- limit: z49.coerce.number().int().min(1).max(100).optional(),
4907
+ limit: z48.coerce.number().int().min(1).max(100).optional(),
4868
4908
  cursor: pageCursorSchema.optional()
4869
4909
  }))();
4870
- var managedMemberPageSchema = /* @__PURE__ */ (() => z49.object({
4871
- items: z49.array(memberSchema),
4872
- total: z49.number().int().nonnegative(),
4873
- 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()
4874
4914
  }))();
4875
4915
 
4876
4916
  // src/server/member-erasure.ts
4877
- import * as z50 from "zod";
4917
+ import * as z49 from "zod";
4878
4918
  var memberErasureInputSchema = evidenceRedactionInputSchema;
4879
- var memberErasureDeletedSchema = /* @__PURE__ */ (() => z50.object({
4919
+ var memberErasureDeletedSchema = /* @__PURE__ */ (() => z49.object({
4880
4920
  /** The profile: display name and avatar. 0 or 1. */
4881
- profiles: z50.number().int().nonnegative(),
4921
+ profiles: z49.number().int().nonnegative(),
4882
4922
  /** Sign-in identities. */
4883
- identities: z50.number().int().nonnegative(),
4923
+ identities: z49.number().int().nonnegative(),
4884
4924
  /** Linked X, Discord, Telegram, Google, Apple and email accounts. */
4885
- accounts: z50.number().int().nonnegative(),
4925
+ accounts: z49.number().int().nonnegative(),
4886
4926
  /** `app:<name>` identities your app's integration or an import gave. */
4887
- appIdentities: z50.number().int().nonnegative(),
4927
+ appIdentities: z49.number().int().nonnegative(),
4888
4928
  /** Linked wallet addresses. */
4889
- wallets: z50.number().int().nonnegative(),
4929
+ wallets: z49.number().int().nonnegative(),
4890
4930
  /** Signed-in sessions, ended at once. */
4891
- sessions: z50.number().int().nonnegative(),
4931
+ sessions: z49.number().int().nonnegative(),
4892
4932
  /** Marketing consent records. */
4893
- consents: z50.number().int().nonnegative(),
4933
+ consents: z49.number().int().nonnegative(),
4894
4934
  /** Leaderboard aliases. */
4895
- aliases: z50.number().int().nonnegative(),
4935
+ aliases: z49.number().int().nonnegative(),
4896
4936
  /** Attempts whose submitted evidence (photo, text, URL or answers) was deleted. */
4897
- evidence: z50.number().int().nonnegative(),
4937
+ evidence: z49.number().int().nonnegative(),
4898
4938
  /** Tracker records the member's accounts authored, whose stored content was forgotten. */
4899
- records: z50.number().int().nonnegative()
4939
+ records: z49.number().int().nonnegative()
4900
4940
  }))();
4901
- var memberErasureResultSchema = /* @__PURE__ */ (() => z50.object({
4941
+ var memberErasureResultSchema = /* @__PURE__ */ (() => z49.object({
4902
4942
  member: identifier,
4903
- erasedAt: z50.number().int(),
4943
+ erasedAt: z49.number().int(),
4904
4944
  deleted: memberErasureDeletedSchema
4905
4945
  }))();
4906
4946
 
@@ -5123,7 +5163,7 @@ function members({ get, post }) {
5123
5163
  /** Who each member is: up to 100 distinct IDs; unknown IDs come back without accounts. */
5124
5164
  people: (members2, call) => get(
5125
5165
  `/people${queryString({ ids: members2.join(",") })}`,
5126
- z51.array(personSchema),
5166
+ z50.array(personSchema),
5127
5167
  call
5128
5168
  ),
5129
5169
  /**
@@ -5133,7 +5173,7 @@ function members({ get, post }) {
5133
5173
  */
5134
5174
  oauthAccounts: (member, call) => get(
5135
5175
  `/members/${encodeURIComponent(member)}/oauth-accounts`,
5136
- z51.array(managedOAuthAccountSchema),
5176
+ z50.array(managedOAuthAccountSchema),
5137
5177
  call
5138
5178
  ),
5139
5179
  /**
@@ -5145,7 +5185,7 @@ function members({ get, post }) {
5145
5185
  */
5146
5186
  unlinkOAuthAccount: (member, input, call) => post(
5147
5187
  `/members/${encodeURIComponent(member)}/oauth-accounts/unlink`,
5148
- z51.array(managedOAuthAccountSchema),
5188
+ z50.array(managedOAuthAccountSchema),
5149
5189
  expectedRevision(memberOAuthUnlinkInputSchema).parse(input),
5150
5190
  call
5151
5191
  ),
@@ -5228,7 +5268,7 @@ function members({ get, post }) {
5228
5268
  */
5229
5269
  unlinkWallet: (member, input, call) => post(
5230
5270
  `/members/${encodeURIComponent(member)}/wallets/unlink`,
5231
- z51.array(managedWalletSchema),
5271
+ z50.array(managedWalletSchema),
5232
5272
  memberWalletUnlinkInputSchema.parse(input),
5233
5273
  call
5234
5274
  ),
@@ -5241,7 +5281,7 @@ function members({ get, post }) {
5241
5281
  */
5242
5282
  unlinkIdentity: (member, input, call) => post(
5243
5283
  `/members/${encodeURIComponent(member)}/identities/unlink`,
5244
- z51.array(managedMemberIdentitySchema),
5284
+ z50.array(managedMemberIdentitySchema),
5245
5285
  memberIdentityChangeInputSchema.parse(input),
5246
5286
  call
5247
5287
  ),
@@ -5252,7 +5292,7 @@ function members({ get, post }) {
5252
5292
  */
5253
5293
  relinkIdentity: (member, input, call) => post(
5254
5294
  `/members/${encodeURIComponent(member)}/identities/relink`,
5255
- z51.array(managedMemberIdentitySchema),
5295
+ z50.array(managedMemberIdentitySchema),
5256
5296
  memberIdentityChangeInputSchema.parse(input),
5257
5297
  call
5258
5298
  ),
@@ -5264,7 +5304,7 @@ function members({ get, post }) {
5264
5304
  */
5265
5305
  setWalletSignIn: (member, input, call) => post(
5266
5306
  `/members/${encodeURIComponent(member)}/wallets/sign-in`,
5267
- z51.array(managedWalletSchema),
5307
+ z50.array(managedWalletSchema),
5268
5308
  memberWalletSignInInputSchema.parse(input),
5269
5309
  call
5270
5310
  )
@@ -5314,77 +5354,77 @@ function domains({ get, post, raw }) {
5314
5354
  var domainsApi = (http) => domains(http);
5315
5355
 
5316
5356
  // src/server/connections.ts
5317
- import { z as z52 } from "zod";
5318
- 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"))();
5319
5359
  var knownConnectionStatuses = [
5320
5360
  "disconnected",
5321
5361
  "ready",
5322
5362
  "attention"
5323
5363
  ];
5324
- var connectionStatusSchema = /* @__PURE__ */ (() => z52.string().min(1))();
5364
+ var connectionStatusSchema = /* @__PURE__ */ (() => z51.string().min(1))();
5325
5365
  var knownConnectionReconnectReasons = ["revoked", "expired"];
5326
- var reconnectReasonSchema = /* @__PURE__ */ (() => z52.string().min(1))();
5327
- var connectionSecretFieldSchema = /* @__PURE__ */ (() => z52.object({
5328
- name: z52.string(),
5329
- label: z52.string(),
5330
- help: z52.string().nullable(),
5331
- set: z52.boolean()
5332
- }))();
5333
- var connectionSchema = /* @__PURE__ */ (() => z52.object({
5334
- plugin: z52.string(),
5335
- name: z52.string(),
5336
- 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"]),
5337
5377
  status: connectionStatusSchema,
5338
- issue: z52.string().nullable(),
5339
- config: z52.record(z52.string(), z52.unknown()).nullable(),
5340
- configSchema: z52.record(z52.string(), z52.unknown()),
5341
- secrets: z52.array(connectionSecretFieldSchema),
5342
- revision: z52.number().int().nonnegative(),
5343
- connectedAt: z52.number().nullable(),
5344
- connectedBy: z52.string().nullable(),
5345
- 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(),
5346
5386
  // A Relay from before OAuth connections answers none.
5347
5387
  reconnectReason: reconnectReasonSchema.nullable().default(null),
5348
5388
  // A Relay from before dry runs answers none.
5349
- dryRun: z52.boolean().default(false)
5389
+ dryRun: z51.boolean().default(false)
5350
5390
  }))();
5351
- var connectionPageSchema = /* @__PURE__ */ (() => z52.object({
5352
- items: z52.array(connectionSchema),
5353
- nextCursor: z52.string().nullable()
5391
+ var connectionPageSchema = /* @__PURE__ */ (() => z51.object({
5392
+ items: z51.array(connectionSchema),
5393
+ nextCursor: z51.string().nullable()
5354
5394
  }))();
5355
- var actionId = /* @__PURE__ */ (() => z52.string().uuid().default(() => crypto.randomUUID()))();
5356
- var config = /* @__PURE__ */ (() => z52.record(z52.string(), z52.unknown()))();
5357
- var secrets = /* @__PURE__ */ (() => z52.record(z52.string().max(64), z52.string().min(1).max(8192)))();
5358
- 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({
5359
5399
  config,
5360
5400
  secrets: secrets.default({}),
5361
- dryRun: z52.boolean().optional(),
5362
- actionId
5401
+ dryRun: z51.boolean().optional(),
5402
+ actionId: actionId2
5363
5403
  }))();
5364
- var connectionAuthorizeInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5404
+ var connectionAuthorizeInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5365
5405
  config: config.default({}),
5366
- returnTo: z52.string().url().max(2048).optional(),
5367
- actionId
5406
+ returnTo: z51.string().url().max(2048).optional(),
5407
+ actionId: actionId2
5368
5408
  }))();
5369
- var connectionAuthorizationSchema = /* @__PURE__ */ (() => z52.object({
5370
- authorizationUrl: z52.string().url(),
5371
- expiresAt: z52.number()
5409
+ var connectionAuthorizationSchema = /* @__PURE__ */ (() => z51.object({
5410
+ authorizationUrl: z51.string().url(),
5411
+ expiresAt: z51.number()
5372
5412
  }))();
5373
- var connectionAuthorizationCompleteInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5374
- code: z52.string().min(1).max(200)
5413
+ var connectionAuthorizationCompleteInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5414
+ code: z51.string().min(1).max(200)
5375
5415
  }))();
5376
- var connectionUpdateInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5416
+ var connectionUpdateInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5377
5417
  config: config.optional(),
5378
5418
  secrets: secrets.optional(),
5379
- expectedRevision: z52.number().int().nonnegative().optional(),
5380
- actionId
5419
+ expectedRevision: z51.number().int().nonnegative().optional(),
5420
+ actionId: actionId2
5381
5421
  }).refine(
5382
5422
  (input) => input.config !== void 0 || Object.keys(input.secrets ?? {}).length,
5383
5423
  { message: "Change the config, a secret, or both" }
5384
5424
  ))();
5385
- var connectionDisconnectInputSchema = /* @__PURE__ */ (() => z52.strictObject({
5386
- expectedRevision: z52.number().int().nonnegative().optional(),
5387
- actionId
5425
+ var connectionDisconnectInputSchema = /* @__PURE__ */ (() => z51.strictObject({
5426
+ expectedRevision: z51.number().int().nonnegative().optional(),
5427
+ actionId: actionId2
5388
5428
  }))();
5389
5429
  var knownPluginSlots = [
5390
5430
  "connection",
@@ -5394,29 +5434,29 @@ var knownPluginSlots = [
5394
5434
  "evaluator-capability",
5395
5435
  "identity"
5396
5436
  ];
5397
- var pluginSlotSchema = /* @__PURE__ */ (() => z52.string().min(1))();
5398
- var pluginSchema = /* @__PURE__ */ (() => z52.object({
5399
- id: z52.string(),
5400
- name: z52.string(),
5401
- slots: z52.array(pluginSlotSchema),
5402
- configSchema: z52.record(z52.string(), z52.unknown()),
5403
- secrets: z52.array(
5404
- z52.object({
5405
- name: z52.string(),
5406
- label: z52.string(),
5407
- 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()
5408
5448
  })
5409
5449
  ),
5410
- events: z52.array(z52.string()),
5450
+ events: z51.array(z51.string()),
5411
5451
  // A Relay from before OAuth connections answers none.
5412
- oauth: z52.object({ configured: z52.boolean(), scopes: z52.array(z52.string()) }).nullable().default(null),
5413
- 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),
5414
5454
  // A Relay from before dry runs answers none.
5415
- dryRun: z52.boolean().default(false)
5455
+ dryRun: z51.boolean().default(false)
5416
5456
  }))();
5417
- var pluginPageSchema = /* @__PURE__ */ (() => z52.object({
5418
- items: z52.array(pluginSchema),
5419
- nextCursor: z52.string().nullable()
5457
+ var pluginPageSchema = /* @__PURE__ */ (() => z51.object({
5458
+ items: z51.array(pluginSchema),
5459
+ nextCursor: z51.string().nullable()
5420
5460
  }))();
5421
5461
  var knownConnectionSyncKinds = ["connect", "resync"];
5422
5462
  var knownConnectionSyncStatuses = [
@@ -5424,53 +5464,53 @@ var knownConnectionSyncStatuses = [
5424
5464
  "finished",
5425
5465
  "failed"
5426
5466
  ];
5427
- var connectionSyncSchema = /* @__PURE__ */ (() => z52.object({
5428
- kind: z52.string().min(1),
5429
- status: z52.string().min(1),
5430
- done: z52.number().int().nonnegative(),
5431
- total: z52.number().int().nonnegative().nullable(),
5432
- startedAt: z52.number(),
5433
- finishedAt: z52.number().nullable()
5434
- }))();
5435
- var connectionActivitySchema = /* @__PURE__ */ (() => z52.object({
5436
- plugin: z52.string(),
5437
- 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"]),
5438
5478
  status: connectionStatusSchema,
5439
- dryRun: z52.boolean(),
5440
- lastSyncAt: z52.number().nullable(),
5441
- failingSince: z52.number().nullable(),
5442
- consecutiveFailures: z52.number().int().nonnegative(),
5443
- members: z52.object({
5444
- synced: z52.number().int().nonnegative(),
5445
- skipped: z52.array(
5446
- z52.object({
5447
- reason: z52.string(),
5448
- 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()
5449
5489
  })
5450
5490
  )
5451
5491
  }),
5452
5492
  sync: connectionSyncSchema.nullable(),
5453
- errors: z52.array(
5454
- 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() })
5455
5495
  )
5456
5496
  }))();
5457
- var connectionDryRunRequestSchema = /* @__PURE__ */ (() => z52.object({
5458
- id: z52.string(),
5459
- at: z52.number(),
5460
- member: z52.string().nullable(),
5461
- method: z52.string(),
5462
- path: z52.string(),
5463
- 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()
5464
5504
  }))();
5465
- var connectionDryRunPageSchema = /* @__PURE__ */ (() => z52.object({
5466
- items: z52.array(connectionDryRunRequestSchema),
5467
- nextCursor: z52.string().nullable()
5505
+ var connectionDryRunPageSchema = /* @__PURE__ */ (() => z51.object({
5506
+ items: z51.array(connectionDryRunRequestSchema),
5507
+ nextCursor: z51.string().nullable()
5468
5508
  }))();
5469
- var connectionDryRunQuerySchema = /* @__PURE__ */ (() => z52.strictObject({
5470
- cursor: z52.string().min(1).max(40).optional(),
5471
- 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()
5472
5512
  }))();
5473
- var connectionResyncInputSchema = /* @__PURE__ */ (() => z52.strictObject({ actionId }))();
5513
+ var connectionResyncInputSchema = /* @__PURE__ */ (() => z51.strictObject({ actionId: actionId2 }))();
5474
5514
 
5475
5515
  // src/server/client/connections.ts
5476
5516
  function connectionPath(plugin) {
@@ -5652,7 +5692,7 @@ function schedules({ request, get, post }) {
5652
5692
  var schedulesApi = (http) => schedules(http);
5653
5693
 
5654
5694
  // src/server/client/storage.ts
5655
- import * as z53 from "zod";
5695
+ import * as z52 from "zod";
5656
5696
  function storage({ get, post, raw }) {
5657
5697
  function clear(kind, name, input, call) {
5658
5698
  const path = `/storage/${kind}/${appSecretNameSchema.parse(name)}/clear`;
@@ -5696,7 +5736,7 @@ function storage({ get, post, raw }) {
5696
5736
  `/storage/sql/${appSecretNameSchema.parse(name)}/cell?${new URLSearchParams(
5697
5737
  {
5698
5738
  table,
5699
- row: String(z53.number().int().min(0).parse(options.row)),
5739
+ row: String(z52.number().int().min(0).parse(options.row)),
5700
5740
  column: options.column,
5701
5741
  ...options.cursor === void 0 ? {} : { cursor: pageCursorSchema.parse(options.cursor) }
5702
5742
  }
@@ -5715,8 +5755,8 @@ function storage({ get, post, raw }) {
5715
5755
  call
5716
5756
  ),
5717
5757
  /** A KV value's size and, when it is UTF-8 text, a preview. */
5718
- value: (name, key, call) => get(
5719
- `/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 })}`,
5720
5760
  appStorageValueSchema,
5721
5761
  call
5722
5762
  ),
@@ -5811,26 +5851,64 @@ var campaignsApi = (http) => campaigns(http);
5811
5851
  import * as z55 from "zod";
5812
5852
 
5813
5853
  // src/server/quests.ts
5814
- import * as z54 from "zod";
5815
- var questLifecycleInputSchema = /* @__PURE__ */ (() => z54.object({
5854
+ import * as z53 from "zod";
5855
+ var questLifecycleInputSchema = /* @__PURE__ */ (() => z53.object({
5816
5856
  quest: identifier,
5817
5857
  expectedRelease: identifier.optional(),
5818
- archived: z54.boolean(),
5819
- reason: z54.string().trim().min(1).max(500),
5858
+ archived: z53.boolean(),
5859
+ reason: z53.string().trim().min(1).max(500),
5820
5860
  actionId: identifier
5821
5861
  }).strict())();
5822
- var questLifecycleSchema = /* @__PURE__ */ (() => z54.object({
5862
+ var questLifecycleSchema = /* @__PURE__ */ (() => z53.object({
5823
5863
  quest: identifier,
5824
5864
  key: identifier.nullable(),
5825
- title: z54.string(),
5865
+ title: z53.string(),
5826
5866
  release: identifier,
5827
- 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(),
5828
5886
  changed: z54.boolean()
5829
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
+ }))();
5830
5902
 
5831
5903
  // src/server/client/quests.ts
5832
5904
  function quests(http) {
5833
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
+ );
5834
5912
  return {
5835
5913
  pause: (quest, input, call) => operationVerb(
5836
5914
  http,
@@ -5846,6 +5924,41 @@ function quests(http) {
5846
5924
  input,
5847
5925
  call
5848
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
+ },
5849
5962
  /**
5850
5963
  * Each quest's current release, the most recently published first, archived quests
5851
5964
  * included; requires `read` permission.
@@ -5988,6 +6101,31 @@ function x({ get }) {
5988
6101
  }
5989
6102
  var xApi = (http) => x(http);
5990
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
+
5991
6129
  // src/server/client/discord.ts
5992
6130
  import * as z56 from "zod";
5993
6131
  function discord({ get, post }) {
@@ -6285,29 +6423,29 @@ function parse(message) {
6285
6423
  }
6286
6424
  const [, scheme, domain, family] = header;
6287
6425
  const address = lines[1] ?? "";
6288
- let index = 2;
6426
+ let index2 = 2;
6289
6427
  let statement = null;
6290
- if (index < lines.length) {
6291
- if (lines[index] !== "") {
6428
+ if (index2 < lines.length) {
6429
+ if (lines[index2] !== "") {
6292
6430
  throw invalid("The address is not followed by an empty line");
6293
6431
  }
6294
- index++;
6295
- if (lines[index] === "") {
6296
- index++;
6297
- } else if (index < lines.length && !fieldLine.test(lines[index])) {
6298
- statement = lines[index];
6299
- index++;
6300
- if (lines[index] !== "") {
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] !== "") {
6301
6439
  throw invalid("The statement is not followed by an empty line");
6302
6440
  }
6303
- index++;
6441
+ index2++;
6304
6442
  }
6305
6443
  }
6306
6444
  const fields = {};
6307
6445
  const resources2 = [];
6308
6446
  let position = -1;
6309
- for (; index < lines.length; index++) {
6310
- const line = lines[index];
6447
+ for (; index2 < lines.length; index2++) {
6448
+ const line = lines[index2];
6311
6449
  const field = fieldLine.exec(line);
6312
6450
  const name = field?.[1];
6313
6451
  const at = name ? fieldOrder.indexOf(name) : -1;
@@ -6319,8 +6457,8 @@ function parse(message) {
6319
6457
  if (field[2] !== void 0) {
6320
6458
  throw invalid("Resources are listed one per line");
6321
6459
  }
6322
- while (lines[index + 1]?.startsWith("- ")) {
6323
- resources2.push(lines[++index].slice(2));
6460
+ while (lines[index2 + 1]?.startsWith("- ")) {
6461
+ resources2.push(lines[++index2].slice(2));
6324
6462
  }
6325
6463
  } else if (field[2] === void 0 || field[2] === "") {
6326
6464
  throw invalid(`${name} has no value`);
@@ -6447,40 +6585,336 @@ async function verifyWalletSignIn(input) {
6447
6585
  };
6448
6586
  }
6449
6587
 
6450
- // src/server/development.ts
6451
- import * as z60 from "zod";
6452
- var developmentPreflightSchema = /* @__PURE__ */ (() => z60.object({
6453
- organization: z60.string(),
6454
- project: z60.string(),
6455
- environment: z60.enum(["test", "live"]),
6456
- identity: z60.object({
6457
- exchange: z60.literal("supported"),
6458
- activeIntegrations: z60.number().int().nonnegative()
6459
- }).optional(),
6460
- staging: z60.enum(["configured", "blocked"]),
6461
- development: z60.object({
6462
- status: z60.enum(["configured", "blocked"]),
6463
- // How `domino dev` reaches the preview origin: a Cloudflare tunnel, or a direct route on a
6464
- // local development stack. APIs that predate the field use tunnels.
6465
- transport: z60.enum(["tunnel", "direct"]).default("tunnel"),
6466
- missing: z60.array(z60.string()),
6467
- authentication: z60.array(z60.string())
6468
- }),
6469
- checks: z60.array(
6470
- z60.object({
6471
- id: z60.string(),
6472
- status: z60.enum(["ok", "error"]),
6473
- message: z60.string(),
6474
- missing: z60.array(z60.string()).optional(),
6475
- issues: z60.array(z60.string()).optional()
6476
- })
6477
- )
6478
- }))();
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
+ }
6479
6913
 
6480
6914
  // src/server/hosted.ts
6481
- import * as z61 from "zod";
6915
+ import * as z60 from "zod";
6482
6916
  var hostedKeyPermissions = ["read", "points", "ingest"];
6483
- var hostedKeyPermissionList = /* @__PURE__ */ (() => z61.array(z61.string()).transform(
6917
+ var hostedKeyPermissionList = /* @__PURE__ */ (() => z60.array(z60.string()).transform(
6484
6918
  (values) => values.filter(
6485
6919
  (value) => hostedKeyPermissions.includes(value)
6486
6920
  )
@@ -6492,17 +6926,17 @@ var hostedManagementBindings = [
6492
6926
  "DOMINO_PROJECT",
6493
6927
  "DOMINO_ENVIRONMENT"
6494
6928
  ];
6495
- var hostedKeySecretSchema = /* @__PURE__ */ (() => z61.string().regex(/^dhk_[A-Za-z0-9_-]{43}$/, "Expected a hosted app key"))();
6496
- var hostedKeySchema = /* @__PURE__ */ (() => z61.object({
6497
- 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(),
6498
6932
  token: hostedKeySecretSchema,
6499
6933
  organization: identifier,
6500
6934
  project: identifier,
6501
- environment: z61.enum(["test", "live"]),
6935
+ environment: z60.enum(["test", "live"]),
6502
6936
  permissions: hostedKeyPermissionList,
6503
- expiresAt: z61.number().nullable()
6937
+ expiresAt: z60.number().nullable()
6504
6938
  }).strict())();
6505
- var hostedDeploymentKeySchema = /* @__PURE__ */ (() => hostedKeySchema.extend({ apiUrl: z61.string().url() }).strict())();
6939
+ var hostedDeploymentKeySchema = /* @__PURE__ */ (() => hostedKeySchema.extend({ apiUrl: z60.string().url() }).strict())();
6506
6940
  function hostedManagementClient(env) {
6507
6941
  const missing = hostedManagementBindings.filter((name) => !env[name]);
6508
6942
  if (missing.length) {
@@ -6510,7 +6944,7 @@ function hostedManagementClient(env) {
6510
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.`
6511
6945
  );
6512
6946
  }
6513
- const environment = z61.enum(["test", "live"]).parse(env.DOMINO_ENVIRONMENT);
6947
+ const environment = z60.enum(["test", "live"]).parse(env.DOMINO_ENVIRONMENT);
6514
6948
  const token = env.DOMINO_MANAGEMENT_KEY;
6515
6949
  return createManagementClient({
6516
6950
  baseUrl: env.DOMINO_API_URL.replace(/\/+$/, ""),
@@ -6521,6 +6955,690 @@ function hostedManagementClient(env) {
6521
6955
  });
6522
6956
  }
6523
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
+
6524
7642
  // src/server/index.ts
6525
7643
  function clientFailure(error) {
6526
7644
  if (error instanceof ManagementError) {
@@ -6535,8 +7653,8 @@ function clientFailure(error) {
6535
7653
  }
6536
7654
  function guarded(api) {
6537
7655
  return Object.fromEntries(
6538
- Object.entries(api).map(([key, value]) => [
6539
- key,
7656
+ Object.entries(api).map(([key2, value]) => [
7657
+ key2,
6540
7658
  typeof value === "function" ? (...args) => {
6541
7659
  try {
6542
7660
  return Promise.resolve(value(...args)).catch((error) => {
@@ -6832,6 +7950,8 @@ function managementClient(options) {
6832
7950
  quests: questsApi(http),
6833
7951
  /** Public X data the project's configuration refers to by ID. */
6834
7952
  x: xApi(http),
7953
+ /** Solana reads for quest development. */
7954
+ solana: solanaApi(http),
6835
7955
  /**
6836
7956
  * This project and environment's Discord connection. An organization administrator installs
6837
7957
  * Domino's bot into a new server in Console; once one project of the organization connects a
@@ -6917,6 +8037,8 @@ var managementResponseTables = /* @__PURE__ */ (() => responseTables({
6917
8037
  collectionPreviewSchema: () => collectionPreviewSchema,
6918
8038
  completionRevocationSchema: () => completionRevocationSchema,
6919
8039
  completionRestorationSchema: () => completionRestorationSchema,
8040
+ completionReceiptSchema: () => completionReceiptSchema,
8041
+ completionReceiptListSchema: () => completionReceiptListSchema,
6920
8042
  connectionPageSchema: () => connectionPageSchema,
6921
8043
  connectionSchema: () => connectionSchema,
6922
8044
  connectionAuthorizationSchema: () => connectionAuthorizationSchema,
@@ -6967,6 +8089,7 @@ var managementResponseTables = /* @__PURE__ */ (() => responseTables({
6967
8089
  managedMemberIdentitySchema: () => managedMemberIdentitySchema,
6968
8090
  managedMemberPageSchema: () => managedMemberPageSchema,
6969
8091
  managedMemberProgressSchema: () => managedMemberProgressSchema,
8092
+ memberCompletionPageSchema: () => memberCompletionPageSchema,
6970
8093
  memberConsentHistorySchema: () => memberConsentHistorySchema,
6971
8094
  memberConsentListSchema: () => memberConsentListSchema,
6972
8095
  memberImportPageSchema: () => memberImportPageSchema,
@@ -7047,6 +8170,7 @@ var managementResponseTables = /* @__PURE__ */ (() => responseTables({
7047
8170
  trackerSummarySchema: () => trackerSummarySchema,
7048
8171
  trackerTriggerOutcomePageSchema: () => trackerTriggerOutcomePageSchema,
7049
8172
  walletBalanceChainsSchema: () => walletBalanceChainsSchema,
8173
+ walletTransactionsSchema: () => walletTransactionsSchema,
7050
8174
  webhookDeliveryPageSchema: () => webhookDeliveryPageSchema,
7051
8175
  webhookDeliverySchema: () => webhookDeliverySchema,
7052
8176
  webhookEndpointSchema: () => webhookEndpointSchema,
@@ -7077,6 +8201,7 @@ export {
7077
8201
  MemberImportRefusalCode,
7078
8202
  MemberImportState,
7079
8203
  PayoutSourceKind,
8204
+ QuestActionRefusal,
7080
8205
  REFERRAL_INTEGRATION_REWARD_ERROR2 as REFERRAL_INTEGRATION_REWARD_ERROR,
7081
8206
  RestoredDeliveryOutcome,
7082
8207
  RestoredEntitlementOutcome,
@@ -7091,6 +8216,7 @@ export {
7091
8216
  accessSchema,
7092
8217
  accountProfileSchema,
7093
8218
  accountVouchedBySchema,
8219
+ actionsJson,
7094
8220
  activeMemberMonthSchema,
7095
8221
  activeMemberUsageSchema,
7096
8222
  activityTypeSchema,
@@ -7169,6 +8295,9 @@ export {
7169
8295
  capturedFactSchema,
7170
8296
  commitSchema,
7171
8297
  compareAppMigrations,
8298
+ completionReceiptInputSchema,
8299
+ completionReceiptListSchema,
8300
+ completionReceiptSchema,
7172
8301
  completionRestorationSchema,
7173
8302
  completionRestoreSchema,
7174
8303
  completionRevocationSchema,
@@ -7208,6 +8337,9 @@ export {
7208
8337
  dashboardReadQuerySchema,
7209
8338
  dashboardReadSchema,
7210
8339
  dashboardSummarySchema,
8340
+ decodeSolanaTransaction,
8341
+ defineQuestAction,
8342
+ defineStationAction,
7211
8343
  deploymentActionSchema,
7212
8344
  deploymentRejectionSchema,
7213
8345
  developmentPreflightSchema,
@@ -7308,6 +8440,9 @@ export {
7308
8440
  managementResponseSchemas,
7309
8441
  managementResponses,
7310
8442
  managementStateQuerySchema,
8443
+ maxCompletionReceipts,
8444
+ maxSolanaActionReference,
8445
+ maxSolanaTransactionBytes,
7311
8446
  memberAccountSchema,
7312
8447
  memberAccountUnlinkInputSchema,
7313
8448
  memberAppIdentitySchema,
@@ -7317,6 +8452,9 @@ export {
7317
8452
  memberBanPreviewSchema,
7318
8453
  memberBanRollbackSchema,
7319
8454
  memberBanSchema,
8455
+ memberCompletionPageSchema,
8456
+ memberCompletionQuerySchema,
8457
+ memberCompletionSchema,
7320
8458
  memberCreatorAccountUnlinkInputSchema,
7321
8459
  memberDetailSchema,
7322
8460
  memberErasureDeletedSchema,
@@ -7376,6 +8514,7 @@ export {
7376
8514
  pageSchema,
7377
8515
  parseImageExtraction,
7378
8516
  parseImageResult,
8517
+ parseSolanaActionMemo,
7379
8518
  participantExchangeAccountResultSchema,
7380
8519
  participantExchangeResultSchema,
7381
8520
  participantExchangeSchema,
@@ -7421,6 +8560,7 @@ export {
7421
8560
  questEnrollmentWithdrawalInputSchema,
7422
8561
  questLifecycleInputSchema,
7423
8562
  questLifecycleSchema,
8563
+ questStationStateSchema,
7424
8564
  readinessSchema,
7425
8565
  realPeopleInTestUsageSchema,
7426
8566
  referralManagementSchema,
@@ -7445,8 +8585,23 @@ export {
7445
8585
  serviceKeySchema,
7446
8586
  settlementPayoutCsv,
7447
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,
7448
8602
  sourceDataSchema2 as sourceDataSchema,
7449
8603
  sourceRoles,
8604
+ squadsProposalUrl,
7450
8605
  stageRequestSchema,
7451
8606
  stagedDeploymentContentSchema,
7452
8607
  stagedDeploymentKey,
@@ -7460,8 +8615,12 @@ export {
7460
8615
  starterIdSchema,
7461
8616
  starterTemplates,
7462
8617
  starters,
8618
+ stationOperationTarget,
8619
+ stationRevocationInputSchema,
8620
+ stationRevocationSchema,
7463
8621
  stockAdditionSchema,
7464
8622
  stockInputSchema,
8623
+ takesSolanaTransaction,
7465
8624
  teamSchema,
7466
8625
  telegramBotIdSchema,
7467
8626
  telegramIdentitySelectorSchema,
@@ -7508,6 +8667,7 @@ export {
7508
8667
  verifyWebhook,
7509
8668
  walletBalanceChainsSchema,
7510
8669
  walletIdentitySelectorSchema,
8670
+ walletLinkedEventDataSchema,
7511
8671
  webhookControlInputSchema,
7512
8672
  webhookCreateInputSchema,
7513
8673
  webhookDeleteInputSchema,