@domino-sdk/relay 1.16.0 → 1.18.1

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 (50) hide show
  1. package/dist/{attempt-captures-DHwIVoRP.d.ts → attempt-captures-ByzZyggX.d.ts} +5 -1
  2. package/dist/authoring.d.ts +82 -9
  3. package/dist/authoring.js +14 -9
  4. package/dist/{automatic-outcomes-BcEn_L46.d.ts → automatic-outcomes-BBSdMf0R.d.ts} +2 -1
  5. package/dist/avatar.d.ts +1 -1
  6. package/dist/browser.d.ts +7 -7
  7. package/dist/browser.js +9 -11
  8. package/dist/{chunk-3YCCHTCU.js → chunk-3IX2IYMQ.js} +2 -2
  9. package/dist/{chunk-6QJ3LADK.js → chunk-5P5PTZ3T.js} +1 -1
  10. package/dist/{chunk-W335CWYJ.js → chunk-CVQG2AZZ.js} +2 -2
  11. package/dist/{chunk-46C33ASD.js → chunk-EMLDFUTV.js} +1314 -908
  12. package/dist/{chunk-4OLQYRSA.js → chunk-GMKJPHN4.js} +1 -1
  13. package/dist/{chunk-YT3QKV2L.js → chunk-GTM3XNMQ.js} +1 -1
  14. package/dist/{chunk-LLMJ2SUT.js → chunk-IE4QOQUI.js} +21 -4
  15. package/dist/{chunk-ZGH6NEG6.js → chunk-JIQHUDVZ.js} +1 -1
  16. package/dist/{chunk-ZLYBUM7K.js → chunk-NBYS3NQT.js} +29 -17
  17. package/dist/{chunk-NIYCAW2I.js → chunk-NGP2NMZ4.js} +1 -1
  18. package/dist/{chunk-XMBM2XD5.js → chunk-T47OFHHX.js} +2 -4
  19. package/dist/{chunk-NM3IYYPG.js → chunk-UEPEKXOC.js} +6 -8
  20. package/dist/{chunk-AXRMT33W.js → chunk-UIHPWC4C.js} +3 -0
  21. package/dist/{chunk-UJACD6K2.js → chunk-XSLRNFIY.js} +346 -304
  22. package/dist/{chunk-Y6SRF54G.js → chunk-YGWB6GH3.js} +32 -25
  23. package/dist/{chunk-PT5STHFH.js → chunk-YXAK2637.js} +1 -1
  24. package/dist/{client-DFSCmf3H.d.ts → client-93pUw04R.d.ts} +182 -14
  25. package/dist/{deployments-DIbKJO_Y.d.ts → deployments-Cz-tNK7Z.d.ts} +832 -16
  26. package/dist/{groups-Bi7lc54m.d.ts → groups-jLLG7MML.d.ts} +27 -2
  27. package/dist/{images-Cb8QHGjn.d.ts → images-BPiPqVKn.d.ts} +1 -1
  28. package/dist/index.d.ts +8 -8
  29. package/dist/index.js +12 -16
  30. package/dist/internal.d.ts +10 -10
  31. package/dist/internal.js +9 -10
  32. package/dist/{offers-Catj06u7.d.ts → offers-CPqiF3dZ.d.ts} +92 -3
  33. package/dist/{pages-CpYt56Km.d.ts → pages-1h1387a3.d.ts} +757 -3
  34. package/dist/portal-proxy.js +4 -4
  35. package/dist/react/index.d.ts +47 -19
  36. package/dist/react/index.js +361 -340
  37. package/dist/{schema-BaVl2VBS.d.ts → schema-Br3c1GOu.d.ts} +508 -2
  38. package/dist/schema.d.ts +565 -24
  39. package/dist/schema.js +61 -32
  40. package/dist/server/index.d.ts +10 -10
  41. package/dist/server/index.js +82 -24
  42. package/dist/{sign-in-options-CU1ND6-y.d.ts → sign-in-options--25uHySG.d.ts} +1 -1
  43. package/dist/{submission-input-Bi4HipqI.d.ts → submission-input-BEJ9qENg.d.ts} +2 -2
  44. package/dist/testing.d.ts +3 -3
  45. package/dist/testing.js +10 -13
  46. package/dist/{transport-BdrcbKi_.d.ts → transport-CVac_nGZ.d.ts} +6411 -72
  47. package/package.json +1 -1
  48. package/dist/chunk-2UAVZCMH.js +0 -314
  49. package/dist/chunk-NPGENI7K.js +0 -37
  50. package/dist/{profiles-BHMVj0kM.d.ts → profiles-D29SS12z.d.ts} +1 -1
@@ -1,5 +1,164 @@
1
- // src/response.ts
1
+ // src/request-error.ts
2
+ var requestErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RequestError");
3
+ function isRequestError(value) {
4
+ return typeof value === "object" && value !== null && value[requestErrorBrand] === true;
5
+ }
6
+ var RequestError = class extends Error {
7
+ name = "RequestError";
8
+ [requestErrorBrand] = true;
9
+ kind;
10
+ uncertain;
11
+ status;
12
+ code;
13
+ operationId;
14
+ /** `replay` for a replay-safe operation ID, else `reconcile`; only when `uncertain`. */
15
+ recovery;
16
+ /**
17
+ * Milliseconds the server asked the client to wait before trying again, from the `Retry-After`
18
+ * header of an error answer such as a 429 or 503. The client's own retries never wait past the
19
+ * call's deadline, so a longer wait is left to the caller.
20
+ */
21
+ retryAfter;
22
+ constructor(message, details) {
23
+ super(message, details.cause === void 0 ? {} : { cause: details.cause });
24
+ this.kind = details.kind;
25
+ this.uncertain = details.uncertain ?? false;
26
+ this.status = details.status;
27
+ this.code = details.code;
28
+ this.operationId = details.operationId;
29
+ this.retryAfter = details.retryAfter;
30
+ this.recovery = this.uncertain ? details.operationId && (details.replaySafe ?? true) ? "replay" : "reconcile" : void 0;
31
+ }
32
+ };
33
+
34
+ // src/errors.ts
2
35
  import { z } from "zod";
36
+ var RelayErrorCode = {
37
+ /** The call needs a signed-in member. */
38
+ NotSignedIn: "not-signed-in",
39
+ /** The session changed since the app read it (the `session` option). Reload before retrying. */
40
+ StaleSession: "stale-session",
41
+ /** The input failed validation before it was sent. */
42
+ InvalidInput: "invalid-input",
43
+ /** Relay's answer was not JSON or not the expected shape (kind `invalid-response`). */
44
+ InvalidResponse: "invalid-response",
45
+ /** The transport failed, before a response or while reading its body (kind `network`). */
46
+ Network: "network",
47
+ /** The client's deadline elapsed (kind `timeout`). */
48
+ Timeout: "timeout",
49
+ /** The caller cancelled the request (kind `aborted`). */
50
+ Aborted: "aborted",
51
+ /** A quest or collection the call named is not in the member's experience. */
52
+ NotFound: "not-found",
53
+ /** The quest has no failed attempt the member can retry. */
54
+ RetryUnavailable: "retry-unavailable",
55
+ /**
56
+ * Durable submission storage is missing, blocked or unreadable. Nothing was lost: call the
57
+ * handle's `status()` or `resume()` again once storage is available.
58
+ */
59
+ SubmissionStorage: "submission-storage",
60
+ /** Browser storage is full, so submission progress was not saved. Free space, then resume. */
61
+ SubmissionStorageQuota: "submission-storage-quota",
62
+ /** The saved submission is in a state that does not allow this action. */
63
+ SubmissionConflict: "submission-conflict",
64
+ /** The quest changed since the member saw it; review it before submitting again. */
65
+ QuestUpdated: "quest-updated",
66
+ /** Wait for the deferred attempt before submitting another action. */
67
+ AttemptPending: "attempt-pending",
68
+ /** The quiz changed since the member answered it. */
69
+ StaleQuiz: "stale-quiz",
70
+ /** Relay refused the submitted evidence. */
71
+ InvalidSubmission: "invalid-submission",
72
+ /** A page cursor Relay cannot read; start again from the first page. */
73
+ InvalidCursor: "invalid-cursor",
74
+ /** No point ledger in the project has the key or ID the call named. */
75
+ PointLedgerNotFound: "point-ledger-not-found",
76
+ /** The member has not joined this project, so it holds no points here. */
77
+ NotJoined: "not-joined",
78
+ /** The quest or campaign is not open at this time. */
79
+ OutsideWindow: "outside-window",
80
+ /** The signed-in member must enroll in the campaign first. */
81
+ EnrollmentRequired: "enrollment-required",
82
+ /** The quest's current reward budget has no remaining capacity. */
83
+ BudgetExhausted: "budget-exhausted",
84
+ /** No published offer has the key or ID the call named. */
85
+ OfferNotFound: "offer-not-found",
86
+ /** The operator paused this offer. */
87
+ OfferPaused: "offer-paused",
88
+ /** This member has already used the offer's allowed number of redemptions. */
89
+ OfferLimitReached: "offer-limit-reached",
90
+ /** No declared units remain. */
91
+ OfferOutOfStock: "offer-out-of-stock",
92
+ /** The participant's available point balance is below the offer price. */
93
+ InsufficientPoints: "insufficient-points",
94
+ /** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
95
+ WalletSigner: "wallet-signer",
96
+ /** The member has not met the quest's prerequisites; `missing` lists them. */
97
+ PrerequisitesIncomplete: "prerequisites-incomplete",
98
+ /** The quest is archived or retired: it takes no new participation. */
99
+ QuestClosed: "quest-closed",
100
+ /** An operator paused the quest. */
101
+ QuestPaused: "quest-paused",
102
+ /** An operator locked the member's profile; hiding it is still allowed. */
103
+ ProfileLocked: "profile-locked",
104
+ /** No member in the project has the invitation code the member accepted. */
105
+ InvitationNotFound: "invitation-not-found",
106
+ /** The email sign-in code is wrong; the member can type it again. */
107
+ InvalidCode: "invalid-code",
108
+ /** The email sign-in code expired, was used or had too many attempts; request another. */
109
+ CodeExpired: "code-expired",
110
+ /** The wallet sign-in challenge expired, was used or changed; start sign-in again. */
111
+ ChallengeExpired: "challenge-expired",
112
+ /** Too many requests; `retryAfter` says how long to wait when Relay knows. */
113
+ RateLimited: "rate-limited"
114
+ };
115
+ var relayErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RelayError");
116
+ function isRelayError(value) {
117
+ return isRequestError(value) && value[relayErrorBrand] === true;
118
+ }
119
+ var RelayError = class extends RequestError {
120
+ name = "RelayError";
121
+ [relayErrorBrand] = true;
122
+ /** Which window refused admission when `code` is `outside-window`. */
123
+ window;
124
+ /** Prerequisites the member does not currently meet, when Relay refused for that reason. */
125
+ missing;
126
+ constructor(message, details) {
127
+ super(message, details);
128
+ this.window = details.window;
129
+ this.missing = details.missing ?? [];
130
+ }
131
+ };
132
+ function asRelayError(cause, fallback = "Request failed") {
133
+ if (isRelayError(cause)) {
134
+ return cause;
135
+ }
136
+ return new RelayError(
137
+ cause instanceof Error && cause.message ? cause.message : fallback,
138
+ { kind: "client", cause }
139
+ );
140
+ }
141
+ function clientError(message, code, details = {}) {
142
+ return new RelayError(message, { ...details, kind: "client", code });
143
+ }
144
+ function parseInput(schema, value) {
145
+ const parsed = schema.safeParse(value);
146
+ if (!parsed.success) {
147
+ throw clientError(
148
+ z.prettifyError(parsed.error),
149
+ RelayErrorCode.InvalidInput,
150
+ { cause: parsed.error }
151
+ );
152
+ }
153
+ return parsed.data;
154
+ }
155
+
156
+ // src/identifier.ts
157
+ import { z as z2 } from "zod";
158
+ var identifier = z2.string().min(1).max(100).regex(/^[a-zA-Z0-9_-]+$/);
159
+
160
+ // src/response.ts
161
+ import { z as z3 } from "zod";
3
162
  var responseFormat = /* @__PURE__ */ Symbol("domino.response.tolerant-v1");
4
163
  function markResponseSchema(schema) {
5
164
  return Object.assign(schema, { [responseFormat]: true });
@@ -38,7 +197,7 @@ function responseShape(schema) {
38
197
  Object.getPrototypeOf(schema._zod.def),
39
198
  Object.getOwnPropertyDescriptors(schema._zod.def)
40
199
  );
41
- if (schema instanceof z.ZodObject) {
200
+ if (schema instanceof z3.ZodObject) {
42
201
  let shape;
43
202
  Object.defineProperty(definition, "shape", {
44
203
  get: () => shape ??= Object.fromEntries(
@@ -51,49 +210,49 @@ function responseShape(schema) {
51
210
  enumerable: true
52
211
  });
53
212
  Object.assign(definition, {
54
- catchall: schema._zod.def.catchall instanceof z.ZodNever || !schema._zod.def.catchall ? void 0 : responseShape(schema._zod.def.catchall)
213
+ catchall: schema._zod.def.catchall instanceof z3.ZodNever || !schema._zod.def.catchall ? void 0 : responseShape(schema._zod.def.catchall)
55
214
  });
56
- } else if (schema instanceof z.ZodNumber) {
215
+ } else if (schema instanceof z3.ZodNumber) {
57
216
  Object.assign(definition, {
58
217
  checks: schema._zod.def.checks?.filter((check) => {
59
218
  const rule = check._zod.def;
60
219
  return rule.check !== "less_than" || !("value" in rule) || rule.value === Number.MAX_SAFE_INTEGER || rule.value === 864e13;
61
220
  })
62
221
  });
63
- } else if (schema instanceof z.ZodArray) {
222
+ } else if (schema instanceof z3.ZodArray) {
64
223
  Object.assign(definition, {
65
224
  element: responseShape(schema.element),
66
225
  checks: []
67
226
  });
68
- } else if (schema instanceof z.ZodUnion) {
227
+ } else if (schema instanceof z3.ZodUnion) {
69
228
  Object.assign(definition, { options: schema.options.map(responseShape) });
70
- } else if (schema instanceof z.ZodTuple) {
229
+ } else if (schema instanceof z3.ZodTuple) {
71
230
  Object.assign(definition, {
72
231
  items: schema._zod.def.items.map(responseShape),
73
232
  rest: schema._zod.def.rest ? responseShape(schema._zod.def.rest) : null
74
233
  });
75
- } else if (schema instanceof z.ZodIntersection) {
234
+ } else if (schema instanceof z3.ZodIntersection) {
76
235
  Object.assign(definition, {
77
236
  left: responseShape(schema._zod.def.left),
78
237
  right: responseShape(schema._zod.def.right)
79
238
  });
80
- } else if (schema instanceof z.ZodLazy) {
239
+ } else if (schema instanceof z3.ZodLazy) {
81
240
  Object.assign(definition, {
82
241
  getter: () => responseShape(schema._zod.def.getter())
83
242
  });
84
- } else if (schema instanceof z.ZodRecord) {
243
+ } else if (schema instanceof z3.ZodRecord) {
85
244
  Object.assign(definition, { valueType: responseShape(schema.valueType) });
86
- } else if (schema instanceof z.ZodPipe) {
245
+ } else if (schema instanceof z3.ZodPipe) {
87
246
  Object.assign(definition, {
88
247
  in: responseShape(schema.in),
89
248
  out: responseShape(schema.out)
90
249
  });
91
- } else if ("innerType" in definition && definition.innerType instanceof z.ZodType) {
250
+ } else if ("innerType" in definition && definition.innerType instanceof z3.ZodType) {
92
251
  Object.assign(definition, {
93
252
  innerType: responseShape(definition.innerType)
94
253
  });
95
254
  }
96
- const reader = z.clone(schema, definition);
255
+ const reader = z3.clone(schema, definition);
97
256
  shapes.set(schema, reader);
98
257
  shapes.set(reader, reader);
99
258
  return reader;
@@ -102,54 +261,54 @@ function knownResponse(schema) {
102
261
  return responseShape(schema);
103
262
  }
104
263
  function fields(schema) {
105
- if (schema instanceof z.ZodObject) {
264
+ if (schema instanceof z3.ZodObject) {
106
265
  return schema.shape;
107
266
  }
108
- if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z.ZodType) {
267
+ if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z3.ZodType) {
109
268
  return fields(schema._zod.def.innerType);
110
269
  }
111
270
  return void 0;
112
271
  }
113
272
  function values(schema) {
114
- if (schema instanceof z.ZodLiteral) {
273
+ if (schema instanceof z3.ZodLiteral) {
115
274
  return [...schema.values];
116
275
  }
117
- if (schema instanceof z.ZodEnum) {
276
+ if (schema instanceof z3.ZodEnum) {
118
277
  return schema.options;
119
278
  }
120
- if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z.ZodType) {
279
+ if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z3.ZodType) {
121
280
  return values(schema._zod.def.innerType);
122
281
  }
123
282
  return void 0;
124
283
  }
125
284
  function unknownVariant(schema, input) {
126
- if (schema instanceof z.ZodLiteral) {
285
+ if (schema instanceof z3.ZodLiteral) {
127
286
  return typeof input === "string" && [...schema.values].every((value) => typeof value === "string") && !schema.values.has(input);
128
287
  }
129
- if (schema instanceof z.ZodEnum) {
288
+ if (schema instanceof z3.ZodEnum) {
130
289
  return typeof input === "string" && !schema.options.includes(input);
131
290
  }
132
- if (schema instanceof z.ZodArray && Array.isArray(input)) {
291
+ if (schema instanceof z3.ZodArray && Array.isArray(input)) {
133
292
  return input.some((item) => unknownVariant(schema.element, item));
134
293
  }
135
- if (schema instanceof z.ZodTuple && Array.isArray(input)) {
294
+ if (schema instanceof z3.ZodTuple && Array.isArray(input)) {
136
295
  return input.some((item, index) => {
137
296
  const child = schema._zod.def.items[index] ?? schema._zod.def.rest;
138
297
  return child ? unknownVariant(child, item) : false;
139
298
  });
140
299
  }
141
- if (schema instanceof z.ZodIntersection) {
300
+ if (schema instanceof z3.ZodIntersection) {
142
301
  return unknownVariant(schema._zod.def.left, input) || unknownVariant(schema._zod.def.right, input);
143
302
  }
144
- if (schema instanceof z.ZodLazy) {
303
+ if (schema instanceof z3.ZodLazy) {
145
304
  return unknownVariant(schema._zod.def.getter(), input);
146
305
  }
147
- if (schema instanceof z.ZodRecord && input !== null && typeof input === "object" && !Array.isArray(input)) {
306
+ if (schema instanceof z3.ZodRecord && input !== null && typeof input === "object" && !Array.isArray(input)) {
148
307
  return Object.entries(input).some(
149
308
  ([key, value]) => unknownVariant(schema.keyType, key) || unknownVariant(schema.valueType, value)
150
309
  );
151
310
  }
152
- if (schema instanceof z.ZodUnion) {
311
+ if (schema instanceof z3.ZodUnion) {
153
312
  let options = [...schema.options];
154
313
  if (typeof input === "string") {
155
314
  const choices = options.flatMap((option) => values(option) ?? []);
@@ -158,7 +317,7 @@ function unknownVariant(schema, input) {
158
317
  }
159
318
  }
160
319
  if (input !== null && typeof input === "object" && !Array.isArray(input)) {
161
- const raw = z.record(z.string(), z.unknown()).parse(input);
320
+ const raw = z3.record(z3.string(), z3.unknown()).parse(input);
162
321
  const keys = ["kind", "status", "provider", "input", "type", "mode"];
163
322
  for (const key of keys) {
164
323
  if (typeof raw[key] !== "string") {
@@ -182,29 +341,29 @@ function unknownVariant(schema, input) {
182
341
  }
183
342
  return options.every((option) => unknownVariant(option, input));
184
343
  }
185
- if (schema instanceof z.ZodObject && input !== null && typeof input === "object" && !Array.isArray(input)) {
186
- const raw = z.record(z.string(), z.unknown()).parse(input);
344
+ if (schema instanceof z3.ZodObject && input !== null && typeof input === "object" && !Array.isArray(input)) {
345
+ const raw = z3.record(z3.string(), z3.unknown()).parse(input);
187
346
  return Object.entries(schema.shape).some(
188
347
  ([key, child]) => unknownVariant(child, raw[key])
189
348
  ) || Object.entries(raw).some(
190
349
  ([key, value]) => !(key in schema.shape) && !!schema._zod.def.catchall && unknownVariant(schema._zod.def.catchall, value)
191
350
  );
192
351
  }
193
- if (schema instanceof z.ZodPipe) {
352
+ if (schema instanceof z3.ZodPipe) {
194
353
  if (unknownVariant(schema.in, input)) {
195
354
  return true;
196
355
  }
197
- const intermediate = z.safeParse(schema.in, input);
356
+ const intermediate = z3.safeParse(schema.in, input);
198
357
  return intermediate.success && unknownVariant(schema.out, intermediate.data);
199
358
  }
200
- if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z.ZodType) {
359
+ if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z3.ZodType) {
201
360
  return unknownVariant(schema._zod.def.innerType, input);
202
361
  }
203
362
  return false;
204
363
  }
205
364
  function responseSchema(schema) {
206
365
  return markResponseSchema(
207
- z.json().transform((raw, context) => {
366
+ z3.json().transform((raw, context) => {
208
367
  const reader = knownResponse(schema);
209
368
  const parsed = reader.safeParse(raw);
210
369
  if (parsed.success) {
@@ -216,13 +375,13 @@ function responseSchema(schema) {
216
375
  for (const issue of parsed.error.issues) {
217
376
  context.addIssue({ ...issue });
218
377
  }
219
- return z.NEVER;
378
+ return z3.NEVER;
220
379
  })
221
380
  );
222
381
  }
223
382
  function responseListSchema(schema) {
224
383
  return markResponseSchema(
225
- z.array(responseSchema(schema)).transform((items) => ({
384
+ z3.array(responseSchema(schema)).transform((items) => ({
226
385
  items,
227
386
  unsupportedCount: items.filter((item) => item.kind === "unsupported").length
228
387
  }))
@@ -230,120 +389,116 @@ function responseListSchema(schema) {
230
389
  }
231
390
 
232
391
  // src/pages.ts
233
- import { z as z2 } from "zod";
234
- var pageCursorSchema = z2.string().min(1).max(4096);
235
- var pageQuerySchema = z2.strictObject({
392
+ import { z as z4 } from "zod";
393
+ var pageCursorSchema = z4.string().min(1).max(4096);
394
+ var pageQuerySchema = z4.strictObject({
236
395
  cursor: pageCursorSchema.optional()
237
396
  });
238
- var managementStateQuerySchema = z2.strictObject({
397
+ var managementStateQuerySchema = z4.strictObject({
239
398
  cursor: pageCursorSchema.optional(),
240
- limit: z2.coerce.number().int().min(1).max(100).default(50)
399
+ limit: z4.coerce.number().int().min(1).max(100).default(50)
241
400
  });
242
401
 
243
402
  // src/accounts.ts
244
- import { z as z3 } from "zod";
245
- var authProviderSchema = z3.enum(["google", "apple", "x", "discord"]);
246
- var accountConnectionSchema = z3.object({
403
+ import { z as z5 } from "zod";
404
+ var authProviderSchema = z5.enum(["google", "apple", "x", "discord"]);
405
+ var accountConnectionSchema = z5.object({
247
406
  provider: authProviderSchema,
248
- configured: z3.boolean(),
249
- status: z3.enum(["disconnected", "connected", "reconnect"]),
250
- subject: z3.string().nullable(),
251
- revision: z3.number().int().nonnegative()
252
- });
253
- var discordMemberInputSchema = z3.object({}).strict();
254
- var discordMessageInputSchema = z3.object({
255
- channelId: z3.string().regex(/^[0-9]{1,20}$/),
256
- messageId: z3.string().regex(/^[0-9]{1,20}$/)
407
+ configured: z5.boolean(),
408
+ status: z5.enum(["disconnected", "connected", "reconnect"]),
409
+ subject: z5.string().nullable(),
410
+ revision: z5.number().int().nonnegative()
411
+ });
412
+ var discordMemberInputSchema = z5.object({}).strict();
413
+ var discordMessageInputSchema = z5.object({
414
+ channelId: z5.string().regex(/^[0-9]{1,20}$/),
415
+ messageId: z5.string().regex(/^[0-9]{1,20}$/)
257
416
  }).strict();
258
- var discordMemberSchema = z3.object({
259
- userId: z3.string().regex(/^[0-9]{1,20}$/).nullable().default(null),
260
- nickname: z3.string().nullable().default(null),
261
- displayName: z3.string().nullable().default(null),
262
- boostingSince: z3.string().datetime({ offset: true }).nullable().default(null),
263
- roles: z3.array(z3.string().regex(/^[0-9]{1,20}$/)),
264
- joinedAt: z3.string().datetime({ offset: true }).nullable(),
265
- pending: z3.boolean()
417
+ var discordMemberSchema = z5.object({
418
+ userId: z5.string().regex(/^[0-9]{1,20}$/).nullable().default(null),
419
+ nickname: z5.string().nullable().default(null),
420
+ displayName: z5.string().nullable().default(null),
421
+ boostingSince: z5.string().datetime({ offset: true }).nullable().default(null),
422
+ roles: z5.array(z5.string().regex(/^[0-9]{1,20}$/)),
423
+ joinedAt: z5.string().datetime({ offset: true }).nullable(),
424
+ pending: z5.boolean()
266
425
  });
267
426
 
268
- // src/identifier.ts
269
- import { z as z4 } from "zod";
270
- var identifier = z4.string().min(1).max(100).regex(/^[a-zA-Z0-9_-]+$/);
271
-
272
427
  // src/discord.ts
273
- import { z as z5 } from "zod";
274
- var discordMessageSchema = z5.object({
275
- guildId: z5.string(),
276
- channelId: z5.string(),
277
- messageId: z5.string(),
278
- userId: z5.string(),
279
- content: z5.string().nullable(),
280
- replyTo: z5.string().nullable(),
281
- publishedAt: z5.number()
428
+ import { z as z6 } from "zod";
429
+ var discordMessageSchema = z6.object({
430
+ guildId: z6.string(),
431
+ channelId: z6.string(),
432
+ messageId: z6.string(),
433
+ userId: z6.string(),
434
+ content: z6.string().nullable(),
435
+ replyTo: z6.string().nullable(),
436
+ publishedAt: z6.number()
282
437
  }).strict();
283
- var discordMessagesSourceSchema = z5.strictObject({
284
- kind: z5.literal("discord-messages"),
438
+ var discordMessagesSourceSchema = z6.strictObject({
439
+ kind: z6.literal("discord-messages"),
285
440
  /** Store each message's text in `data.text`. Off unless set. */
286
- text: z5.boolean().optional()
441
+ text: z6.boolean().optional()
287
442
  });
288
- var discordReactionsSourceSchema = z5.strictObject({
289
- kind: z5.literal("discord-reactions")
443
+ var discordReactionsSourceSchema = z6.strictObject({
444
+ kind: z6.literal("discord-reactions")
290
445
  });
291
- var discordMessageDataSchema = z5.object({
292
- guildId: z5.string(),
293
- channelId: z5.string(),
294
- messageId: z5.string(),
446
+ var discordMessageDataSchema = z6.object({
447
+ guildId: z6.string(),
448
+ channelId: z6.string(),
449
+ messageId: z6.string(),
295
450
  /** The ID of the message this one replies to, or null. */
296
- replyTo: z5.string().nullable(),
451
+ replyTo: z6.string().nullable(),
297
452
  /** When Discord says the message was posted, in epoch milliseconds. */
298
- publishedAt: z5.number()
453
+ publishedAt: z6.number()
299
454
  });
300
455
  var discordMessageTextDataSchema = discordMessageDataSchema.extend({
301
- text: z5.string().nullable()
456
+ text: z6.string().nullable()
302
457
  });
303
- var discordReactionDataSchema = z5.object({
304
- guildId: z5.string(),
305
- channelId: z5.string(),
458
+ var discordReactionDataSchema = z6.object({
459
+ guildId: z6.string(),
460
+ channelId: z6.string(),
306
461
  /** The message reacted to. */
307
- messageId: z5.string(),
462
+ messageId: z6.string(),
308
463
  /** A custom emoji's ID, or null for a Unicode emoji, whose `name` is the emoji itself. */
309
- emoji: z5.object({ id: z5.string().nullable(), name: z5.string() }),
464
+ emoji: z6.object({ id: z6.string().nullable(), name: z6.string() }),
310
465
  /** The role IDs the reactor held in the server when reacting. */
311
- reactorRoles: z5.array(z5.string()),
466
+ reactorRoles: z6.array(z6.string()),
312
467
  /** When the reacted-to message was posted, in epoch milliseconds. */
313
- messagePublishedAt: z5.number()
314
- });
315
- var discordRewardSchema = z5.strictObject({
316
- kind: z5.literal("integration"),
317
- provider: z5.literal("discord"),
318
- action: z5.literal("grant-role"),
319
- roleId: z5.string().regex(/^[0-9]{1,20}$/)
320
- });
321
- var discordResourceSourceSchema = z5.union([
322
- z5.strictObject({
323
- provider: z5.literal("discord"),
324
- resource: z5.literal("channel"),
325
- types: z5.array(z5.enum(["text", "announcement"])).min(1)
468
+ messagePublishedAt: z6.number()
469
+ });
470
+ var discordRewardSchema = z6.strictObject({
471
+ kind: z6.literal("integration"),
472
+ provider: z6.literal("discord"),
473
+ action: z6.literal("grant-role"),
474
+ roleId: z6.string().regex(/^[0-9]{1,20}$/)
475
+ });
476
+ var discordResourceSourceSchema = z6.union([
477
+ z6.strictObject({
478
+ provider: z6.literal("discord"),
479
+ resource: z6.literal("channel"),
480
+ types: z6.array(z6.enum(["text", "announcement"])).min(1)
326
481
  }),
327
- z5.strictObject({
328
- provider: z5.literal("discord"),
329
- resource: z5.literal("role"),
330
- assignable: z5.boolean().default(false)
482
+ z6.strictObject({
483
+ provider: z6.literal("discord"),
484
+ resource: z6.literal("role"),
485
+ assignable: z6.boolean().default(false)
331
486
  })
332
487
  ]);
333
488
 
334
489
  // src/tracker-data.ts
335
- import { z as z6 } from "zod";
490
+ import { z as z7 } from "zod";
336
491
  var maxDepth = 16;
337
492
  var maxBytes = 32768;
338
493
  var trackerDataMaxBranches = 16;
339
494
  var trackerDataMaxEntries = 256;
340
- var scalar = z6.union([z6.string(), z6.number().finite(), z6.boolean(), z6.null()]);
341
- var size = z6.number().int().safe().nonnegative();
342
- var bound = z6.number().finite();
343
- var branches = () => z6.array(node).min(1).max(trackerDataMaxBranches);
344
- var node = z6.lazy(
345
- () => z6.strictObject({
346
- type: z6.enum([
495
+ var scalar = z7.union([z7.string(), z7.number().finite(), z7.boolean(), z7.null()]);
496
+ var size = z7.number().int().safe().nonnegative();
497
+ var bound = z7.number().finite();
498
+ var branches = () => z7.array(node).min(1).max(trackerDataMaxBranches);
499
+ var node = z7.lazy(
500
+ () => z7.strictObject({
501
+ type: z7.enum([
347
502
  "object",
348
503
  "array",
349
504
  "string",
@@ -352,15 +507,15 @@ var node = z6.lazy(
352
507
  "boolean",
353
508
  "null"
354
509
  ]).optional(),
355
- properties: z6.record(z6.string(), node).refine(
510
+ properties: z7.record(z7.string(), node).refine(
356
511
  (properties) => Object.keys(properties).length <= trackerDataMaxEntries,
357
512
  `An object schema lists at most ${trackerDataMaxEntries} properties`
358
513
  ).optional(),
359
- required: z6.array(z6.string()).max(trackerDataMaxEntries).optional(),
360
- additionalProperties: z6.union([z6.boolean(), node]).optional(),
361
- propertyNames: z6.strictObject({
362
- type: z6.literal("string"),
363
- enum: z6.array(z6.string()).max(trackerDataMaxEntries).optional()
514
+ required: z7.array(z7.string()).max(trackerDataMaxEntries).optional(),
515
+ additionalProperties: z7.union([z7.boolean(), node]).optional(),
516
+ propertyNames: z7.strictObject({
517
+ type: z7.literal("string"),
518
+ enum: z7.array(z7.string()).max(trackerDataMaxEntries).optional()
364
519
  }).optional(),
365
520
  items: node.optional(),
366
521
  minItems: size.optional(),
@@ -371,7 +526,7 @@ var node = z6.lazy(
371
526
  maximum: bound.optional(),
372
527
  exclusiveMinimum: bound.optional(),
373
528
  exclusiveMaximum: bound.optional(),
374
- enum: z6.array(scalar).min(1).max(trackerDataMaxEntries).optional(),
529
+ enum: z7.array(scalar).min(1).max(trackerDataMaxEntries).optional(),
375
530
  const: scalar.optional(),
376
531
  anyOf: branches().optional(),
377
532
  oneOf: branches().optional(),
@@ -433,7 +588,7 @@ function nestedUnionIssue(schema, path, insideUnion) {
433
588
  }
434
589
  return null;
435
590
  }
436
- var trackerDataSchemaSchema = z6.unknown().superRefine((value, ctx) => {
591
+ var trackerDataSchemaSchema = z7.unknown().superRefine((value, ctx) => {
437
592
  const issue = shapeIssue(value);
438
593
  if (issue) {
439
594
  ctx.addIssue({ code: "custom", message: issue, abort: true });
@@ -540,7 +695,7 @@ function subset(schema, path) {
540
695
  function trackerDataSchema(schema) {
541
696
  let json;
542
697
  try {
543
- json = z6.toJSONSchema(schema, {
698
+ json = z7.toJSONSchema(schema, {
544
699
  target: "draft-2020-12",
545
700
  io: "input",
546
701
  unrepresentable: "throw",
@@ -908,21 +1063,21 @@ function whereSchemaIssue(schema, where) {
908
1063
  }
909
1064
 
910
1065
  // src/trackers.ts
911
- import { z as z7 } from "zod";
912
- var timestamp = z7.number().int().safe().nonnegative().max(864e13);
913
- var count = z7.number().int().safe().nonnegative();
914
- var externalId = z7.string().min(1).max(256);
1066
+ import { z as z8 } from "zod";
1067
+ var timestamp = z8.number().int().safe().nonnegative().max(864e13);
1068
+ var count = z8.number().int().safe().nonnegative();
1069
+ var externalId = z8.string().min(1).max(256);
915
1070
  var metric = count.nullable().default(null);
916
- var xTweetSchema = z7.looseObject({
1071
+ var xTweetSchema = z8.looseObject({
917
1072
  id: externalId,
918
1073
  userId: externalId,
919
- content: z7.string(),
920
- createdAt: z7.iso.datetime({ offset: true }),
921
- author: z7.looseObject({
1074
+ content: z8.string(),
1075
+ createdAt: z8.iso.datetime({ offset: true }),
1076
+ author: z8.looseObject({
922
1077
  id: externalId,
923
- username: z7.string(),
924
- name: z7.string(),
925
- verified: z7.boolean().nullable().default(null)
1078
+ username: z8.string(),
1079
+ name: z8.string(),
1080
+ verified: z8.boolean().nullable().default(null)
926
1081
  }),
927
1082
  likeCount: metric,
928
1083
  replyCount: metric,
@@ -930,84 +1085,84 @@ var xTweetSchema = z7.looseObject({
930
1085
  quoteCount: metric,
931
1086
  viewCount: metric,
932
1087
  bookmarkCount: metric,
933
- isReply: z7.boolean(),
934
- isRetweet: z7.boolean(),
935
- isQuoteTweet: z7.boolean()
936
- });
937
- var xContentBodySchema = z7.strictObject({
938
- version: z7.literal(1),
939
- id: z7.string().min(1),
940
- authorId: z7.string().min(1),
1088
+ isReply: z8.boolean(),
1089
+ isRetweet: z8.boolean(),
1090
+ isQuoteTweet: z8.boolean()
1091
+ });
1092
+ var xContentBodySchema = z8.strictObject({
1093
+ version: z8.literal(1),
1094
+ id: z8.string().min(1),
1095
+ authorId: z8.string().min(1),
941
1096
  publishedAt: timestamp,
942
- text: z7.string(),
943
- isReply: z7.boolean(),
944
- isRetweet: z7.boolean(),
945
- isQuoteTweet: z7.boolean(),
946
- media: z7.array(z7.strictObject({ type: z7.string(), url: z7.string() })).nullable(),
947
- mentionedAuthorIds: z7.array(z7.string().min(1)).nullable(),
948
- videoLengthSeconds: z7.number().nonnegative().nullable(),
949
- references: z7.strictObject({
950
- replyId: z7.string().nullable(),
951
- replyAuthorId: z7.string().nullable(),
952
- quoteId: z7.string().nullable(),
953
- quoteAuthorId: z7.string().nullable(),
954
- repostId: z7.string().nullable(),
955
- repostAuthorId: z7.string().nullable()
1097
+ text: z8.string(),
1098
+ isReply: z8.boolean(),
1099
+ isRetweet: z8.boolean(),
1100
+ isQuoteTweet: z8.boolean(),
1101
+ media: z8.array(z8.strictObject({ type: z8.string(), url: z8.string() })).nullable(),
1102
+ mentionedAuthorIds: z8.array(z8.string().min(1)).nullable(),
1103
+ videoLengthSeconds: z8.number().nonnegative().nullable(),
1104
+ references: z8.strictObject({
1105
+ replyId: z8.string().nullable(),
1106
+ replyAuthorId: z8.string().nullable(),
1107
+ quoteId: z8.string().nullable(),
1108
+ quoteAuthorId: z8.string().nullable(),
1109
+ repostId: z8.string().nullable(),
1110
+ repostAuthorId: z8.string().nullable()
956
1111
  })
957
1112
  });
958
- var trackerContentQuerySchema = z7.strictObject({
1113
+ var trackerContentQuerySchema = z8.strictObject({
959
1114
  id: externalId,
960
- observation: z7.string().regex(/^observation_[a-f0-9]{64}$/)
1115
+ observation: z8.string().regex(/^observation_[a-f0-9]{64}$/)
961
1116
  });
962
1117
  var trackerContentReadSchema = trackerContentQuerySchema.extend({
963
1118
  member: identifier
964
1119
  });
965
1120
  var attributionContext = { member: identifier, capturedAt: timestamp };
966
- var trackerEvidenceSchema = z7.strictObject({
1121
+ var trackerEvidenceSchema = z8.strictObject({
967
1122
  contentRevision: identifier,
968
1123
  observation: identifier
969
1124
  });
970
- var trackerContentSchema = z7.strictObject({
1125
+ var trackerContentSchema = z8.strictObject({
971
1126
  tracker: identifier,
972
- source: z7.literal("x"),
1127
+ source: z8.literal("x"),
973
1128
  evidence: trackerEvidenceSchema,
974
1129
  content: xContentBodySchema,
975
1130
  observedAt: timestamp,
976
- removed: z7.boolean(),
977
- attribution: z7.discriminatedUnion("kind", [
978
- z7.strictObject({
1131
+ removed: z8.boolean(),
1132
+ attribution: z8.discriminatedUnion("kind", [
1133
+ z8.strictObject({
979
1134
  ...attributionContext,
980
- kind: z7.literal("linked"),
981
- account: z7.strictObject({
982
- provider: z7.literal("x"),
983
- issuer: z7.string().min(1),
1135
+ kind: z8.literal("linked"),
1136
+ account: z8.strictObject({
1137
+ provider: z8.literal("x"),
1138
+ issuer: z8.string().min(1),
984
1139
  subject: externalId,
985
1140
  revision: count,
986
1141
  linkedAt: timestamp.nullable()
987
1142
  })
988
1143
  }),
989
- z7.strictObject({ ...attributionContext, kind: z7.literal("unlinked") }),
990
- z7.strictObject({
1144
+ z8.strictObject({ ...attributionContext, kind: z8.literal("unlinked") }),
1145
+ z8.strictObject({
991
1146
  ...attributionContext,
992
- kind: z7.literal("different-author")
1147
+ kind: z8.literal("different-author")
993
1148
  })
994
1149
  ])
995
1150
  });
996
1151
  var knownIdentityKinds = ["wallet", "x", "discord", "member"];
997
- var appIdentityKindSchema = z7.templateLiteral([
1152
+ var appIdentityKindSchema = z8.templateLiteral([
998
1153
  "app:",
999
- z7.string().regex(
1154
+ z8.string().regex(
1000
1155
  /^[a-z0-9][a-z0-9_-]{0,39}$/,
1001
1156
  "Name an app identity kind like app:telegram: lowercase letters, digits, _ or -, at most 40"
1002
1157
  )
1003
1158
  ]);
1004
- var identityKindSchema = z7.union([
1005
- z7.enum(knownIdentityKinds),
1159
+ var identityKindSchema = z8.union([
1160
+ z8.enum(knownIdentityKinds),
1006
1161
  appIdentityKindSchema
1007
1162
  ]);
1008
1163
  var isAppIdentityKind = (kind) => kind.startsWith("app:");
1009
- var openIdentityKindSchema = z7.string().min(1).max(64);
1010
- var memberIdentitySchema = z7.object({
1164
+ var openIdentityKindSchema = z8.string().min(1).max(64);
1165
+ var memberIdentitySchema = z8.object({
1011
1166
  kind: openIdentityKindSchema,
1012
1167
  /** The stable user ID for `x` and `discord`; the subject your app signed the member in with for `app:<name>`. */
1013
1168
  subject: externalId,
@@ -1019,13 +1174,13 @@ var memberIdentitySchema = z7.object({
1019
1174
  /** The latest link time, refreshed on app identity relink; null when the link time is unknown. */
1020
1175
  linkedAt: timestamp.nullable()
1021
1176
  });
1022
- var accountRoleSchema = z7.string().regex(
1177
+ var accountRoleSchema = z8.string().regex(
1023
1178
  /^[a-zA-Z][a-zA-Z0-9_]{0,39}$/,
1024
1179
  "Name roles like author or recipient: a letter, then letters, digits or underscores"
1025
1180
  );
1026
1181
  var xAccountRoles = ["author", "inReplyTo"];
1027
1182
  var distinct = (values2) => new Set(values2).size === values2.length;
1028
- var contentMetricNameSchema = z7.string().regex(
1183
+ var contentMetricNameSchema = z8.string().regex(
1029
1184
  /^[a-z][a-zA-Z0-9]{0,39}$/,
1030
1185
  "Name metrics like likes or watchTime: a lowercase letter, then letters or digits"
1031
1186
  );
@@ -1037,24 +1192,24 @@ var xContentMetrics = [
1037
1192
  "views",
1038
1193
  "bookmarks"
1039
1194
  ];
1040
- var customContentSchema = z7.strictObject({
1041
- metrics: z7.array(contentMetricNameSchema).max(10).refine(distinct, "List each metric once")
1195
+ var customContentSchema = z8.strictObject({
1196
+ metrics: z8.array(contentMetricNameSchema).max(10).refine(distinct, "List each metric once")
1042
1197
  });
1043
- var xSearchSourceSchema = z7.object({
1044
- kind: z7.literal("x-search"),
1045
- query: z7.string().trim().min(1).max(2e3)
1198
+ var xSearchSourceSchema = z8.object({
1199
+ kind: z8.literal("x-search"),
1200
+ query: z8.string().trim().min(1).max(2e3)
1046
1201
  }).strict();
1047
- var customSourceSchema = z7.object({
1048
- kind: z7.literal("custom"),
1202
+ var customSourceSchema = z8.object({
1203
+ kind: z8.literal("custom"),
1049
1204
  namespace: identifier,
1050
1205
  /**
1051
1206
  * The identity kinds a record's author and named accounts can be, attributed to members
1052
1207
  * through verified links: `wallet`, `x`, `discord`, `member`, or your app's own `app:<name>`.
1053
1208
  * Omitted when authors are opaque IDs, which no quest can pay.
1054
1209
  */
1055
- identities: z7.array(identityKindSchema).min(1).max(8).refine(distinct, "List each identity kind once").optional(),
1210
+ identities: z8.array(identityKindSchema).min(1).max(8).refine(distinct, "List each identity kind once").optional(),
1056
1211
  /** Roles of the named accounts records can carry besides their author, such as `recipient`. */
1057
- accounts: z7.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
1212
+ accounts: z8.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
1058
1213
  (roles) => !roles.includes("author"),
1059
1214
  "author is every record's own role; name other accounts"
1060
1215
  ).optional(),
@@ -1077,7 +1232,7 @@ var customSourceSchema = z7.object({
1077
1232
  (source) => !source.accounts || source.identities,
1078
1233
  "Named accounts need identities"
1079
1234
  );
1080
- var trackerSourceSchema = z7.discriminatedUnion("kind", [
1235
+ var trackerSourceSchema = z8.discriminatedUnion("kind", [
1081
1236
  xSearchSourceSchema,
1082
1237
  customSourceSchema,
1083
1238
  discordMessagesSourceSchema,
@@ -1114,125 +1269,125 @@ function sourceContent(source) {
1114
1269
  return void 0;
1115
1270
  }
1116
1271
  }
1117
- var windowSchema = z7.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
1272
+ var windowSchema = z8.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
1118
1273
  (w) => w.end === void 0 || w.end > w.start,
1119
1274
  "End must follow start"
1120
1275
  );
1121
- var trackerDefinitionSchema = z7.object({
1276
+ var trackerDefinitionSchema = z8.object({
1122
1277
  key: identifier,
1123
- title: z7.string().trim().min(1).max(120),
1278
+ title: z8.string().trim().min(1).max(120),
1124
1279
  source: trackerSourceSchema,
1125
1280
  window: windowSchema,
1126
- refreshSeconds: z7.number().int().min(300).max(86400).default(21600),
1127
- maxPages: z7.number().int().min(1).max(1e3).default(60)
1281
+ refreshSeconds: z8.number().int().min(300).max(86400).default(21600),
1282
+ maxPages: z8.number().int().min(1).max(1e3).default(60)
1128
1283
  }).strict();
1129
- var trackerArtifactSchema = z7.union([
1284
+ var trackerArtifactSchema = z8.union([
1130
1285
  trackerDefinitionSchema,
1131
- z7.object({ code: z7.string().min(1).max(2e6) }).strict()
1286
+ z8.object({ code: z8.string().min(1).max(2e6) }).strict()
1132
1287
  ]);
1133
- var knownTrackerSourceResponseSchema = z7.discriminatedUnion("kind", [
1134
- z7.object(xSearchSourceSchema.shape),
1135
- z7.object({
1288
+ var knownTrackerSourceResponseSchema = z8.discriminatedUnion("kind", [
1289
+ z8.object(xSearchSourceSchema.shape),
1290
+ z8.object({
1136
1291
  ...customSourceSchema.shape,
1137
- identities: z7.array(openIdentityKindSchema).optional()
1292
+ identities: z8.array(openIdentityKindSchema).optional()
1138
1293
  }),
1139
- z7.object(discordMessagesSourceSchema.shape),
1140
- z7.object(discordReactionsSourceSchema.shape)
1294
+ z8.object(discordMessagesSourceSchema.shape),
1295
+ z8.object(discordReactionsSourceSchema.shape)
1141
1296
  ]);
1142
- var trackerSourceResponseSchema = z7.union([
1297
+ var trackerSourceResponseSchema = z8.union([
1143
1298
  knownTrackerSourceResponseSchema,
1144
- z7.object({
1145
- kind: z7.string().min(1).refine(
1299
+ z8.object({
1300
+ kind: z8.string().min(1).refine(
1146
1301
  (kind) => !trackerSourceKinds.some((known) => known === kind),
1147
1302
  "Known source kinds must match their schema"
1148
1303
  )
1149
- }).catchall(z7.json())
1304
+ }).catchall(z8.json())
1150
1305
  ]);
1151
1306
  function isKnownTrackerSource(source) {
1152
1307
  return knownTrackerSourceResponseSchema.safeParse(source).success;
1153
1308
  }
1154
- var trackerDefinitionResponseSchema = z7.object({
1309
+ var trackerDefinitionResponseSchema = z8.object({
1155
1310
  ...trackerDefinitionSchema.shape,
1156
1311
  source: trackerSourceResponseSchema,
1157
- window: z7.object(windowSchema.shape)
1312
+ window: z8.object(windowSchema.shape)
1158
1313
  });
1159
- var publishedTrackerSchema = z7.object({
1314
+ var publishedTrackerSchema = z8.object({
1160
1315
  id: identifier,
1161
1316
  version: identifier,
1162
1317
  definition: trackerDefinitionResponseSchema,
1163
1318
  publishedAt: timestamp,
1164
- actor: z7.string().nullable()
1319
+ actor: z8.string().nullable()
1165
1320
  });
1166
- var trackerStatusSchema = z7.object({
1167
- archivedAt: z7.number().int().nonnegative().nullable().optional(),
1321
+ var trackerStatusSchema = z8.object({
1322
+ archivedAt: z8.number().int().nonnegative().nullable().optional(),
1168
1323
  published: publishedTrackerSchema,
1169
- paused: z7.boolean(),
1170
- state: z7.enum(["idle", "syncing", "error", "complete"]),
1324
+ paused: z8.boolean(),
1325
+ state: z8.enum(["idle", "syncing", "error", "complete"]),
1171
1326
  lastStartedAt: timestamp.nullable(),
1172
1327
  lastCompletedAt: timestamp.nullable(),
1173
1328
  nextSyncAt: timestamp.nullable(),
1174
- coverage: z7.enum(["unknown", "partial", "complete"]),
1175
- error: z7.string().nullable(),
1329
+ coverage: z8.enum(["unknown", "partial", "complete"]),
1330
+ error: z8.string().nullable(),
1176
1331
  records: count
1177
1332
  });
1178
- var trackerControlSchema = z7.object({
1333
+ var trackerControlSchema = z8.object({
1179
1334
  actionId: identifier,
1180
- action: z7.enum(["pause", "resume", "refresh"])
1335
+ action: z8.enum(["pause", "resume", "refresh"])
1181
1336
  }).strict();
1182
- var trackerAccountSchema = z7.strictObject({
1337
+ var trackerAccountSchema = z8.strictObject({
1183
1338
  kind: identityKindSchema.optional(),
1184
1339
  id: externalId
1185
1340
  });
1186
- var trackerRecordInputSchema = z7.object({
1341
+ var trackerRecordInputSchema = z8.object({
1187
1342
  id: externalId,
1188
1343
  occurredAt: timestamp,
1189
1344
  observedAt: timestamp,
1190
- author: z7.object({
1345
+ author: z8.object({
1191
1346
  id: externalId,
1192
- verified: z7.boolean().nullable().default(null),
1347
+ verified: z8.boolean().nullable().default(null),
1193
1348
  /** The author's identity kind; needed when the source names more than one. */
1194
1349
  kind: identityKindSchema.optional()
1195
1350
  }).strict().nullable().default(null),
1196
1351
  /** Named accounts besides the author, by the roles the custom source declares. */
1197
- accounts: z7.record(accountRoleSchema, trackerAccountSchema).refine(
1352
+ accounts: z8.record(accountRoleSchema, trackerAccountSchema).refine(
1198
1353
  (accounts) => Object.keys(accounts).length <= 10,
1199
1354
  "At most 10 accounts"
1200
1355
  ).optional(),
1201
- data: z7.record(z7.string(), z7.json()),
1202
- removed: z7.boolean().default(false)
1356
+ data: z8.record(z8.string(), z8.json()),
1357
+ removed: z8.boolean().default(false)
1203
1358
  }).strict().refine(
1204
1359
  (v) => new TextEncoder().encode(JSON.stringify(v.data)).byteLength <= 131072,
1205
1360
  "Record exceeds 128 KB"
1206
1361
  );
1207
- var trackerRecordAccountSchema = z7.object({
1362
+ var trackerRecordAccountSchema = z8.object({
1208
1363
  kind: openIdentityKindSchema.optional(),
1209
- id: z7.string()
1364
+ id: z8.string()
1210
1365
  });
1211
- var trackerRecordSchema = z7.object({
1212
- id: z7.string(),
1366
+ var trackerRecordSchema = z8.object({
1367
+ id: z8.string(),
1213
1368
  occurredAt: timestamp,
1214
1369
  observedAt: timestamp,
1215
- author: z7.object({
1216
- id: z7.string(),
1217
- verified: z7.boolean().nullable().default(null),
1370
+ author: z8.object({
1371
+ id: z8.string(),
1372
+ verified: z8.boolean().nullable().default(null),
1218
1373
  kind: openIdentityKindSchema.optional()
1219
1374
  }).nullable().default(null),
1220
- accounts: z7.record(z7.string(), trackerRecordAccountSchema).optional(),
1221
- data: z7.record(z7.string(), z7.json()),
1222
- removed: z7.boolean().default(false),
1223
- source: z7.string(),
1375
+ accounts: z8.record(z8.string(), trackerRecordAccountSchema).optional(),
1376
+ data: z8.record(z8.string(), z8.json()),
1377
+ removed: z8.boolean().default(false),
1378
+ source: z8.string(),
1224
1379
  firstSeenAt: timestamp,
1225
1380
  /** Present only when includeEvidence is true; custom sources have no X evidence. */
1226
1381
  evidence: trackerEvidenceSchema.nullable().optional()
1227
1382
  });
1228
- var trackerIngestSchema = z7.object({
1383
+ var trackerIngestSchema = z8.object({
1229
1384
  actionId: identifier,
1230
- records: z7.array(trackerRecordInputSchema).min(1).max(100)
1385
+ records: z8.array(trackerRecordInputSchema).min(1).max(100)
1231
1386
  }).strict();
1232
- var trackerIngestResultSchema = z7.object({
1387
+ var trackerIngestResultSchema = z8.object({
1233
1388
  stored: count,
1234
1389
  /** Tracker-trigger decisions this ingest caused. Absent from servers without tracker triggers. */
1235
- admissions: z7.object({
1390
+ admissions: z8.object({
1236
1391
  admitted: count,
1237
1392
  skipped: count,
1238
1393
  /**
@@ -1253,11 +1408,11 @@ var trackerOutcomeFields = {
1253
1408
  /** The release admitted, or the one active when the observation was skipped. */
1254
1409
  release: identifier,
1255
1410
  /** The account attribution resolved or failed to resolve, such as a CAIP-10 wallet ID. */
1256
- account: z7.string().nullable(),
1411
+ account: z8.string().nullable(),
1257
1412
  createdAt: timestamp,
1258
1413
  updatedAt: timestamp,
1259
1414
  /** Null for automatic decisions; the staff actor after a retry. */
1260
- actor: z7.string().nullable()
1415
+ actor: z8.string().nullable()
1261
1416
  };
1262
1417
  var trackerSkipCodes = [
1263
1418
  /** The quest is paused or no longer active. Catch-up after a pause is an operator decision. */
@@ -1312,26 +1467,26 @@ var trackerSkipCodes = [
1312
1467
  /** A prerequisite quest was not complete when the record occurred. */
1313
1468
  "prerequisites-incomplete"
1314
1469
  ];
1315
- var trackerOutcomeSchema = z7.discriminatedUnion("state", [
1316
- z7.object({
1470
+ var trackerOutcomeSchema = z8.discriminatedUnion("state", [
1471
+ z8.object({
1317
1472
  ...trackerOutcomeFields,
1318
- state: z7.literal("admitted"),
1319
- code: z7.null(),
1320
- reason: z7.null(),
1473
+ state: z8.literal("admitted"),
1474
+ code: z8.null(),
1475
+ reason: z8.null(),
1321
1476
  /** The attributed member. */
1322
1477
  member: identifier,
1323
1478
  /** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
1324
1479
  attempt: identifier
1325
1480
  }),
1326
- z7.object({
1481
+ z8.object({
1327
1482
  ...trackerOutcomeFields,
1328
- state: z7.literal("skipped"),
1483
+ state: z8.literal("skipped"),
1329
1484
  /** Why the observation was skipped, as one of `trackerSkipCodes`. */
1330
- code: z7.string().min(1),
1485
+ code: z8.string().min(1),
1331
1486
  /** Why the observation was skipped, for people. */
1332
- reason: z7.string(),
1487
+ reason: z8.string(),
1333
1488
  /** Which window refused admission when `code` is `outside-window`. */
1334
- window: z7.enum(["tracker", "quest"]).optional(),
1489
+ window: z8.enum(["tracker", "quest"]).optional(),
1335
1490
  /** The attributed member, when attribution got that far. */
1336
1491
  member: identifier.nullable(),
1337
1492
  attempt: identifier.nullable()
@@ -1342,67 +1497,67 @@ var trackerOutcomeFilters = {
1342
1497
  quest: identifier.optional(),
1343
1498
  record: externalId.optional(),
1344
1499
  member: identifier.optional(),
1345
- state: z7.enum(["admitted", "skipped"]).optional(),
1500
+ state: z8.enum(["admitted", "skipped"]).optional(),
1346
1501
  /** Only skips with this code, such as `unlinked-account`. */
1347
- code: z7.string().min(1).max(100).optional(),
1348
- limit: z7.coerce.number().int().min(1).max(100).default(25)
1502
+ code: z8.string().min(1).max(100).optional(),
1503
+ limit: z8.coerce.number().int().min(1).max(100).default(25)
1349
1504
  };
1350
- var trackerTriggerOutcomeQuerySchema = z7.strictObject({
1505
+ var trackerTriggerOutcomeQuerySchema = z8.strictObject({
1351
1506
  ...trackerOutcomeFilters,
1352
1507
  cursor: pageCursorSchema.optional()
1353
1508
  });
1354
- var trackerTriggerOutcomePageSchema = z7.object({
1355
- items: z7.array(trackerOutcomeSchema).max(100),
1509
+ var trackerTriggerOutcomePageSchema = z8.object({
1510
+ items: z8.array(trackerOutcomeSchema).max(100),
1356
1511
  nextCursor: pageCursorSchema.nullable()
1357
1512
  });
1358
- var trackerOutcomeQuerySchema = z7.strictObject({
1513
+ var trackerOutcomeQuerySchema = z8.strictObject({
1359
1514
  ...trackerOutcomeFilters,
1360
1515
  /** Opaque cursor from `next`: older outcomes. */
1361
- before: z7.string().max(512).optional()
1516
+ before: z8.string().max(512).optional()
1362
1517
  });
1363
- var trackerOutcomePageSchema = z7.strictObject({
1518
+ var trackerOutcomePageSchema = z8.strictObject({
1364
1519
  /** Newest first. */
1365
- items: z7.array(trackerOutcomeSchema).max(100),
1366
- next: z7.string().nullable()
1520
+ items: z8.array(trackerOutcomeSchema).max(100),
1521
+ next: z8.string().nullable()
1367
1522
  });
1368
- var trackerOutcomeRetrySchema = z7.strictObject({
1523
+ var trackerOutcomeRetrySchema = z8.strictObject({
1369
1524
  actionId: identifier,
1370
1525
  /** Quest key or ID. */
1371
1526
  quest: identifier,
1372
1527
  record: externalId,
1373
1528
  observedAt: timestamp
1374
1529
  });
1375
- var booleanQuery = z7.union([
1376
- z7.boolean(),
1377
- z7.enum(["true", "false"]).transform((v) => v === "true")
1530
+ var booleanQuery = z8.union([
1531
+ z8.boolean(),
1532
+ z8.enum(["true", "false"]).transform((v) => v === "true")
1378
1533
  ]);
1379
- var trackerQuerySchema = z7.object({
1534
+ var trackerQuerySchema = z8.object({
1380
1535
  author: externalId.optional(),
1381
1536
  member: identifier.optional(),
1382
1537
  verified: booleanQuery.optional(),
1383
- since: z7.coerce.number().int().safe().nonnegative().optional(),
1384
- until: z7.coerce.number().int().safe().nonnegative().optional(),
1538
+ since: z8.coerce.number().int().safe().nonnegative().optional(),
1539
+ until: z8.coerce.number().int().safe().nonnegative().optional(),
1385
1540
  removed: booleanQuery.default(false),
1386
- minLikes: z7.coerce.number().int().safe().nonnegative().optional(),
1387
- minViews: z7.coerce.number().int().safe().nonnegative().optional(),
1388
- limit: z7.coerce.number().int().min(1).max(100).default(25),
1389
- cursor: z7.string().max(2048).optional(),
1541
+ minLikes: z8.coerce.number().int().safe().nonnegative().optional(),
1542
+ minViews: z8.coerce.number().int().safe().nonnegative().optional(),
1543
+ limit: z8.coerce.number().int().min(1).max(100).default(25),
1544
+ cursor: z8.string().max(2048).optional(),
1390
1545
  includeEvidence: booleanQuery.optional()
1391
1546
  }).strict().refine(
1392
1547
  (q) => q.since === void 0 || q.until === void 0 || q.until > q.since,
1393
1548
  "Until must follow since"
1394
1549
  );
1395
- var trackerPageSchema = z7.object({
1550
+ var trackerPageSchema = z8.object({
1396
1551
  tracker: identifier,
1397
- items: z7.array(trackerRecordSchema),
1398
- nextCursor: z7.string().nullable(),
1552
+ items: z8.array(trackerRecordSchema),
1553
+ nextCursor: z8.string().nullable(),
1399
1554
  total: count,
1400
1555
  status: trackerStatusSchema
1401
1556
  });
1402
- var trackerSummarySchema = z7.object({
1557
+ var trackerSummarySchema = z8.object({
1403
1558
  records: count,
1404
1559
  authors: count,
1405
- metrics: z7.object({
1560
+ metrics: z8.object({
1406
1561
  likes: count,
1407
1562
  replies: count,
1408
1563
  reposts: count,
@@ -1418,26 +1573,26 @@ var trackerPreviewLimits = {
1418
1573
  posts: 100,
1419
1574
  days: 30
1420
1575
  };
1421
- var trackerPreviewInputSchema = z7.object({
1576
+ var trackerPreviewInputSchema = z8.object({
1422
1577
  query: xSearchSourceSchema.shape.query,
1423
1578
  /** Start of the searched window. The window ends when the sample is fetched. */
1424
1579
  since: timestamp
1425
1580
  }).strict();
1426
- var trackerPreviewSchema = z7.object({
1427
- query: z7.string(),
1581
+ var trackerPreviewSchema = z8.object({
1582
+ query: z8.string(),
1428
1583
  since: timestamp,
1429
1584
  fetchedAt: timestamp,
1430
1585
  pages: count,
1431
1586
  /** Every match in the sample, newest first, verified or not. */
1432
- posts: z7.array(xTweetSchema).max(trackerPreviewLimits.posts),
1587
+ posts: z8.array(xTweetSchema).max(trackerPreviewLimits.posts),
1433
1588
  /** X had more matches than the sample holds. */
1434
- more: z7.boolean()
1589
+ more: z8.boolean()
1435
1590
  });
1436
1591
 
1437
1592
  // src/content.ts
1438
- import { z as z8 } from "zod";
1439
- var contentQualificationDecisionSchema = z8.strictObject({
1440
- kind: z8.enum([
1593
+ import { z as z9 } from "zod";
1594
+ var contentQualificationDecisionSchema = z9.strictObject({
1595
+ kind: z9.enum([
1441
1596
  "accept",
1442
1597
  "reject",
1443
1598
  "review",
@@ -1445,26 +1600,26 @@ var contentQualificationDecisionSchema = z8.strictObject({
1445
1600
  "progress",
1446
1601
  "superseded"
1447
1602
  ]),
1448
- reason: z8.string().nullable()
1603
+ reason: z9.string().nullable()
1449
1604
  });
1450
- var contentQualificationQuerySchema = z8.strictObject({
1605
+ var contentQualificationQuerySchema = z9.strictObject({
1451
1606
  quest: identifier,
1452
1607
  member: identifier.optional(),
1453
1608
  /** A content item's record ID in the quest's tracker. */
1454
- content: z8.string().min(1).max(256).optional(),
1609
+ content: z9.string().min(1).max(256).optional(),
1455
1610
  cursor: pageCursorSchema.optional()
1456
1611
  });
1457
- var contentQualificationSchema = z8.strictObject({
1612
+ var contentQualificationSchema = z9.strictObject({
1458
1613
  quest: identifier,
1459
1614
  /** The content item's record ID in the quest's tracker. */
1460
- content: z8.string(),
1615
+ content: z9.string(),
1461
1616
  member: identifier,
1462
1617
  release: identifier,
1463
1618
  attempt: identifier,
1464
1619
  revision: identifier,
1465
1620
  observation: identifier,
1466
- current: z8.boolean(),
1467
- state: z8.enum([
1621
+ current: z9.boolean(),
1622
+ state: z9.enum([
1468
1623
  "pending",
1469
1624
  "qualified",
1470
1625
  "unqualified",
@@ -1475,117 +1630,117 @@ var contentQualificationSchema = z8.strictObject({
1475
1630
  "blocked",
1476
1631
  "unavailable"
1477
1632
  ]),
1478
- reason: z8.string().nullable(),
1479
- reward: z8.strictObject({
1633
+ reason: z9.string().nullable(),
1634
+ reward: z9.strictObject({
1480
1635
  attempt: identifier.nullable(),
1481
1636
  completion: identifier.nullable(),
1482
- state: z8.enum(["unresolved", "awarded", "excluded"])
1637
+ state: z9.enum(["unresolved", "awarded", "excluded"])
1483
1638
  })
1484
1639
  });
1485
- var contentQualificationPageSchema = z8.strictObject({
1486
- items: z8.array(contentQualificationSchema),
1640
+ var contentQualificationPageSchema = z9.strictObject({
1641
+ items: z9.array(contentQualificationSchema),
1487
1642
  nextCursor: pageCursorSchema.nullable()
1488
1643
  });
1489
1644
  var contentMetricSchema = contentMetricNameSchema;
1490
- var contentMetricsSchema = z8.record(
1645
+ var contentMetricsSchema = z9.record(
1491
1646
  contentMetricSchema,
1492
- z8.number().int().safe().nonnegative()
1647
+ z9.number().int().safe().nonnegative()
1493
1648
  );
1494
- var contentPerformancePolicySchema = z8.strictObject({
1495
- metrics: z8.array(contentMetricSchema).min(1).max(10).refine(
1649
+ var contentPerformancePolicySchema = z9.strictObject({
1650
+ metrics: z9.array(contentMetricSchema).min(1).max(10).refine(
1496
1651
  (values2) => new Set(values2).size === values2.length,
1497
1652
  "Metrics must be unique"
1498
1653
  ),
1499
- maxAgeMs: z8.number().int().positive().max(864e5).default(36e5)
1654
+ maxAgeMs: z9.number().int().positive().max(864e5).default(36e5)
1500
1655
  });
1501
1656
 
1502
1657
  // src/counters.ts
1503
- import { z as z9 } from "zod";
1658
+ import { z as z10 } from "zod";
1504
1659
  var day = 864e5;
1505
- var counterGoalSchema = z9.object({
1506
- kind: z9.literal("count"),
1507
- count: z9.number().int().min(1).max(1e4)
1660
+ var counterGoalSchema = z10.object({
1661
+ kind: z10.literal("count"),
1662
+ count: z10.number().int().min(1).max(1e4)
1508
1663
  }).strict();
1509
- var counterWindowSchema = z9.discriminatedUnion("kind", [
1510
- z9.object({ kind: z9.literal("lifetime") }).strict(),
1511
- z9.object({
1512
- kind: z9.literal("calendar"),
1513
- period: z9.enum(["day", "week", "month"]),
1514
- latenessMs: z9.number().int().min(0).max(90 * day).default(7 * day)
1664
+ var counterWindowSchema = z10.discriminatedUnion("kind", [
1665
+ z10.object({ kind: z10.literal("lifetime") }).strict(),
1666
+ z10.object({
1667
+ kind: z10.literal("calendar"),
1668
+ period: z10.enum(["day", "week", "month"]),
1669
+ latenessMs: z10.number().int().min(0).max(90 * day).default(7 * day)
1515
1670
  }).strict(),
1516
- z9.object({
1517
- kind: z9.literal("rolling"),
1518
- durationMs: z9.number().int().min(1).max(365 * day)
1671
+ z10.object({
1672
+ kind: z10.literal("rolling"),
1673
+ durationMs: z10.number().int().min(1).max(365 * day)
1519
1674
  }).strict()
1520
1675
  ]);
1521
- var counterPolicySchema = z9.object({
1522
- kind: z9.literal("progress"),
1676
+ var counterPolicySchema = z10.object({
1677
+ kind: z10.literal("progress"),
1523
1678
  goal: counterGoalSchema,
1524
1679
  window: counterWindowSchema,
1525
- repeat: z9.enum(["once", "repeat"]).default("once")
1680
+ repeat: z10.enum(["once", "repeat"]).default("once")
1526
1681
  }).strict();
1527
- var achievementBase = z9.object({
1682
+ var achievementBase = z10.object({
1528
1683
  id: identifier,
1529
- ordinal: z9.number().int().positive(),
1530
- achievedAt: z9.number().int(),
1531
- window: z9.string()
1684
+ ordinal: z10.number().int().positive(),
1685
+ achievedAt: z10.number().int(),
1686
+ window: z10.string()
1532
1687
  });
1533
- var counterAchievementSchema = z9.discriminatedUnion("status", [
1688
+ var counterAchievementSchema = z10.discriminatedUnion("status", [
1534
1689
  achievementBase.extend({
1535
- status: z9.literal("revoked"),
1690
+ status: z10.literal("revoked"),
1536
1691
  completion: identifier,
1537
- revokedAt: z9.number().int()
1692
+ revokedAt: z10.number().int()
1538
1693
  }),
1539
1694
  achievementBase.extend({
1540
- status: z9.literal("awarded"),
1695
+ status: z10.literal("awarded"),
1541
1696
  completion: identifier
1542
1697
  }),
1543
1698
  achievementBase.extend({
1544
- status: z9.literal("budget-exhausted"),
1699
+ status: z10.literal("budget-exhausted"),
1545
1700
  budget: identifier
1546
1701
  })
1547
1702
  ]);
1548
- var counterProgressSchema = z9.object({
1549
- goal: z9.number().int().positive(),
1550
- current: z9.number().int().nonnegative(),
1551
- window: z9.object({
1552
- key: z9.string(),
1553
- start: z9.number().int().nullable(),
1554
- end: z9.number().int().nullable()
1703
+ var counterProgressSchema = z10.object({
1704
+ goal: z10.number().int().positive(),
1705
+ current: z10.number().int().nonnegative(),
1706
+ window: z10.object({
1707
+ key: z10.string(),
1708
+ start: z10.number().int().nullable(),
1709
+ end: z10.number().int().nullable()
1555
1710
  }),
1556
- repeat: z9.enum(["once", "repeat"]),
1557
- settled: z9.number().int().nonnegative(),
1711
+ repeat: z10.enum(["once", "repeat"]),
1712
+ settled: z10.number().int().nonnegative(),
1558
1713
  latest: counterAchievementSchema.nullable()
1559
1714
  });
1560
- var counterContributionSchema = z9.object({
1715
+ var counterContributionSchema = z10.object({
1561
1716
  id: identifier,
1562
- distinct: z9.string(),
1717
+ distinct: z10.string(),
1563
1718
  attempt: identifier,
1564
- occurredAt: z9.number().int(),
1565
- recordedAt: z9.number().int(),
1566
- window: z9.string(),
1567
- status: z9.enum(["counted", "late", "future", "excluded"]),
1719
+ occurredAt: z10.number().int(),
1720
+ recordedAt: z10.number().int(),
1721
+ window: z10.string(),
1722
+ status: z10.enum(["counted", "late", "future", "excluded"]),
1568
1723
  achievement: counterAchievementSchema.nullable(),
1569
- reason: z9.string().nullable()
1724
+ reason: z10.string().nullable()
1570
1725
  });
1571
- var counterHistorySchema = z9.object({
1572
- items: z9.array(counterContributionSchema),
1573
- nextCursor: z9.string().nullable()
1726
+ var counterHistorySchema = z10.object({
1727
+ items: z10.array(counterContributionSchema),
1728
+ nextCursor: z10.string().nullable()
1574
1729
  });
1575
- var counterModerationSchema = z9.object({
1576
- actionId: z9.uuid(),
1577
- excluded: z9.boolean(),
1578
- reason: z9.string().trim().min(1).max(2e3)
1730
+ var counterModerationSchema = z10.object({
1731
+ actionId: z10.uuid(),
1732
+ excluded: z10.boolean(),
1733
+ reason: z10.string().trim().min(1).max(2e3)
1579
1734
  }).strict();
1580
- var counterHistoryQuerySchema = z9.object({
1581
- cursor: z9.string().max(2e3).optional(),
1582
- limit: z9.coerce.number().int().min(1).max(100).optional()
1735
+ var counterHistoryQuerySchema = z10.object({
1736
+ cursor: z10.string().max(2e3).optional(),
1737
+ limit: z10.coerce.number().int().min(1).max(100).optional()
1583
1738
  }).strict();
1584
- var counterModerationResultSchema = z9.object({ excluded: z9.boolean() });
1739
+ var counterModerationResultSchema = z10.object({ excluded: z10.boolean() });
1585
1740
 
1586
1741
  // src/calendar.ts
1587
- import { z as z10 } from "zod";
1588
- var timestamp2 = z10.number().int().safe();
1742
+ import { z as z11 } from "zod";
1743
+ var timestamp2 = z11.number().int().safe();
1589
1744
  var fixedOffset = /^(?:[+-]|(?:Etc\/)?GMT[+-]\d|(?:EST|MST|HST)$)/i;
1590
1745
  function canonicalTimeZone(zone) {
1591
1746
  let resolved;
@@ -1601,18 +1756,18 @@ function canonicalTimeZone(zone) {
1601
1756
  }
1602
1757
  return fixedOffset.test(zone) || fixedOffset.test(resolved) ? null : resolved;
1603
1758
  }
1604
- var timeZoneSchema = z10.string().min(1).max(100).transform((zone, ctx) => {
1759
+ var timeZoneSchema = z11.string().min(1).max(100).transform((zone, ctx) => {
1605
1760
  const canonical = canonicalTimeZone(zone);
1606
1761
  if (canonical === null) {
1607
1762
  ctx.addIssue({
1608
1763
  code: "custom",
1609
1764
  message: fixedOffset.test(zone) ? "Use a named IANA timezone, such as Europe/Budapest or UTC. Fixed offsets have no daylight-saving rules." : "Use an IANA timezone name, such as Europe/Budapest or UTC"
1610
1765
  });
1611
- return z10.NEVER;
1766
+ return z11.NEVER;
1612
1767
  }
1613
1768
  return canonical;
1614
1769
  });
1615
- var timeZoneNameSchema = z10.string().min(1).max(100);
1770
+ var timeZoneNameSchema = z11.string().min(1).max(100);
1616
1771
  var movedTimeZone = (what) => `${what} no longer take a timeZone: they follow the project calendar. Set calendar.timeZone in relay.json or in Console settings.`;
1617
1772
  var record = (value) => typeof value === "object" && value !== null;
1618
1773
  function refuseStreakTimeZone(value, ctx) {
@@ -1636,78 +1791,78 @@ function refuseWindowTimeZone(value, ctx) {
1636
1791
  }
1637
1792
  return value;
1638
1793
  }
1639
- var calendarPeriodSchema = z10.enum(["lifetime", "day", "week", "month"]);
1640
- var projectCalendarSchema = z10.object({
1794
+ var calendarPeriodSchema = z11.enum(["lifetime", "day", "week", "month"]);
1795
+ var projectCalendarSchema = z11.object({
1641
1796
  /** The timezone of the current calendar day. */
1642
1797
  timeZone: timeZoneNameSchema,
1643
1798
  /** The current calendar date, such as `2026-10-01`. */
1644
- today: z10.string(),
1799
+ today: z11.string(),
1645
1800
  /** When the current calendar day ends, in epoch milliseconds. */
1646
1801
  nextBoundary: timestamp2,
1647
1802
  /** A change that takes effect at the next day boundary, or null. */
1648
- pending: z10.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp2 }).nullable(),
1803
+ pending: z11.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp2 }).nullable(),
1649
1804
  /** The `calendar.timeZone` the last deployment that declared one set, or null. */
1650
1805
  declared: timeZoneNameSchema.nullable(),
1651
1806
  /**
1652
1807
  * A stored timezone the calendar no longer accepts, such as a fixed offset a streak named before
1653
1808
  * v1. The calendar reads it as UTC until an operator chooses a timezone. Null otherwise.
1654
1809
  */
1655
- unsupported: z10.string().nullable().default(null)
1810
+ unsupported: z11.string().nullable().default(null)
1656
1811
  });
1657
- var projectCalendarInputSchema = z10.object({
1812
+ var projectCalendarInputSchema = z11.object({
1658
1813
  actionId: identifier,
1659
1814
  timeZone: timeZoneSchema,
1660
- reason: z10.string().trim().min(1).max(500)
1815
+ reason: z11.string().trim().min(1).max(500)
1661
1816
  }).strict();
1662
- var projectCalendarDeclarationSchema = z10.object({ timeZone: timeZoneSchema }).strict();
1817
+ var projectCalendarDeclarationSchema = z11.object({ timeZone: timeZoneSchema }).strict();
1663
1818
 
1664
1819
  // src/streaks.ts
1665
- import { z as z11 } from "zod";
1666
- var streakPolicySchema = z11.object({
1667
- kind: z11.literal("streak"),
1668
- days: z11.number().int().min(1).max(3650)
1669
- });
1670
- var streakProgressSchema = z11.object({
1671
- goal: z11.number().int().positive(),
1672
- current: z11.number().int().nonnegative(),
1673
- best: z11.number().int().nonnegative(),
1674
- today: z11.string(),
1675
- todayQualified: z11.boolean(),
1820
+ import { z as z12 } from "zod";
1821
+ var streakPolicySchema = z12.object({
1822
+ kind: z12.literal("streak"),
1823
+ days: z12.number().int().min(1).max(3650)
1824
+ });
1825
+ var streakProgressSchema = z12.object({
1826
+ goal: z12.number().int().positive(),
1827
+ current: z12.number().int().nonnegative(),
1828
+ best: z12.number().int().nonnegative(),
1829
+ today: z12.string(),
1830
+ todayQualified: z12.boolean(),
1676
1831
  timeZone: timeZoneNameSchema,
1677
- nextBoundary: z11.number().int(),
1678
- pendingTimeZone: z11.object({
1832
+ nextBoundary: z12.number().int(),
1833
+ pendingTimeZone: z12.object({
1679
1834
  timeZone: timeZoneNameSchema,
1680
- effectiveAt: z11.number().int()
1835
+ effectiveAt: z12.number().int()
1681
1836
  }).nullable(),
1682
- days: z11.array(
1683
- z11.object({
1684
- day: z11.number().int(),
1685
- date: z11.string(),
1837
+ days: z12.array(
1838
+ z12.object({
1839
+ day: z12.number().int(),
1840
+ date: z12.string(),
1686
1841
  // The zone the day was recorded in, as stored: days from before v1 can name a fixed offset.
1687
- timeZone: z11.string(),
1688
- occurredAt: z11.number().int()
1842
+ timeZone: z12.string(),
1843
+ occurredAt: z12.number().int()
1689
1844
  })
1690
1845
  ),
1691
- milestone: z11.discriminatedUnion("status", [
1692
- z11.object({ status: z11.literal("pending") }),
1693
- z11.object({
1694
- status: z11.literal("awarded"),
1695
- completion: z11.string(),
1696
- achievedAt: z11.number().int()
1846
+ milestone: z12.discriminatedUnion("status", [
1847
+ z12.object({ status: z12.literal("pending") }),
1848
+ z12.object({
1849
+ status: z12.literal("awarded"),
1850
+ completion: z12.string(),
1851
+ achievedAt: z12.number().int()
1697
1852
  }),
1698
- z11.object({
1699
- status: z11.literal("budget-exhausted"),
1700
- budget: z11.string(),
1701
- achievedAt: z11.number().int()
1853
+ z12.object({
1854
+ status: z12.literal("budget-exhausted"),
1855
+ budget: z12.string(),
1856
+ achievedAt: z12.number().int()
1702
1857
  })
1703
1858
  ])
1704
1859
  });
1705
1860
 
1706
1861
  // src/tracker-triggers.ts
1707
- import { z as z12 } from "zod";
1708
- var timestamp3 = z12.number().int().safe().nonnegative().max(864e13);
1709
- var count2 = z12.number().int().safe().nonnegative();
1710
- var trackerTriggerModeSchema = z12.enum([
1862
+ import { z as z13 } from "zod";
1863
+ var timestamp3 = z13.number().int().safe().nonnegative().max(864e13);
1864
+ var count2 = z13.number().int().safe().nonnegative();
1865
+ var trackerTriggerModeSchema = z13.enum([
1711
1866
  "new-record",
1712
1867
  "new-observation",
1713
1868
  "data-changed"
@@ -1715,20 +1870,20 @@ var trackerTriggerModeSchema = z12.enum([
1715
1870
  function defaultTriggerMode(source) {
1716
1871
  return source === "custom" ? "new-observation" : "new-record";
1717
1872
  }
1718
- var trackerBoundSchema = z12.union([
1719
- z12.number().finite(),
1720
- z12.strictObject({ setting: z12.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
1873
+ var trackerBoundSchema = z13.union([
1874
+ z13.number().finite(),
1875
+ z13.strictObject({ setting: z13.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
1721
1876
  ]);
1722
- var dataPath = z12.string().max(200).regex(
1877
+ var dataPath = z13.string().max(200).regex(
1723
1878
  /^[^.\s]+(\.[^.\s]+)*$/,
1724
1879
  "Use dot-separated keys, such as metrics.likes"
1725
1880
  );
1726
- var trackerConditionSchema = z12.union([
1727
- z12.strictObject({
1881
+ var trackerConditionSchema = z13.union([
1882
+ z13.strictObject({
1728
1883
  path: dataPath,
1729
- equals: z12.union([z12.string().max(1e3), z12.number().finite(), z12.boolean()])
1884
+ equals: z13.union([z13.string().max(1e3), z13.number().finite(), z13.boolean()])
1730
1885
  }),
1731
- z12.strictObject({
1886
+ z13.strictObject({
1732
1887
  path: dataPath,
1733
1888
  gt: trackerBoundSchema.optional(),
1734
1889
  gte: trackerBoundSchema.optional(),
@@ -1741,9 +1896,9 @@ var trackerConditionSchema = z12.union([
1741
1896
  "Compare with equals, gt, gte, lt or lte"
1742
1897
  )
1743
1898
  ]);
1744
- var trackerWhereSchema = z12.union([
1899
+ var trackerWhereSchema = z13.union([
1745
1900
  trackerConditionSchema,
1746
- z12.array(trackerConditionSchema).min(1).max(10)
1901
+ z13.array(trackerConditionSchema).min(1).max(10)
1747
1902
  ]);
1748
1903
  function whereConditions(where) {
1749
1904
  return where === void 0 ? [] : Array.isArray(where) ? where : [where];
@@ -1755,17 +1910,17 @@ function whereSettings(where) {
1755
1910
  )
1756
1911
  );
1757
1912
  }
1758
- var triggerEnrollmentSchema = z12.enum(["none", "required"]);
1759
- var triggerSinceSchema = z12.enum(["activation", "window", "enrollment"]);
1760
- var triggerHistoricalSchema = z12.enum(["staff", "claim", "automatic"]);
1761
- var trackerTriggerPolicySchema = z12.strictObject({
1913
+ var triggerEnrollmentSchema = z13.enum(["none", "required"]);
1914
+ var triggerSinceSchema = z13.enum(["activation", "window", "enrollment"]);
1915
+ var triggerHistoricalSchema = z13.enum(["staff", "claim", "automatic"]);
1916
+ var trackerTriggerPolicySchema = z13.strictObject({
1762
1917
  /** The tracker's authoring key; publication binds it to the tracker's stable ID. */
1763
1918
  tracker: identifier,
1764
1919
  /**
1765
1920
  * The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
1766
1921
  * releases keep parsing them when a later Relay adds a managed source.
1767
1922
  */
1768
- source: z12.string().min(1).max(100),
1923
+ source: z13.string().min(1).max(100),
1769
1924
  /** Which observations fire. */
1770
1925
  on: trackerTriggerModeSchema,
1771
1926
  where: trackerWhereSchema.optional(),
@@ -1786,7 +1941,7 @@ var trackerTriggerPolicySchema = z12.strictObject({
1786
1941
  * that re-evaluates edits and runs `performance`, firing on each new record and paying its
1787
1942
  * author.
1788
1943
  */
1789
- content: z12.literal(true).optional()
1944
+ content: z13.literal(true).optional()
1790
1945
  }).refine(
1791
1946
  (policy) => policy.since !== "enrollment" || policy.enrollment === "required",
1792
1947
  'since: "enrollment" needs enrollment: "required"'
@@ -1805,72 +1960,72 @@ function beneficiaryRole(policy) {
1805
1960
  return policy.beneficiary;
1806
1961
  }
1807
1962
  var xLink = {
1808
- issuer: z12.string().min(1),
1963
+ issuer: z13.string().min(1),
1809
1964
  /** The account's stable user ID. */
1810
- subject: z12.string().min(1).max(256),
1965
+ subject: z13.string().min(1).max(256),
1811
1966
  /** The member's account selection revision. */
1812
1967
  revision: count2,
1813
1968
  /** When the member linked the account; null when unknown. */
1814
1969
  linkedAt: timestamp3.nullable()
1815
1970
  };
1816
- var trackerAttributionSchema = z12.object({
1971
+ var trackerAttributionSchema = z13.object({
1817
1972
  member: identifier,
1818
1973
  capturedAt: timestamp3,
1819
- account: z12.union([
1820
- z12.object({
1821
- provider: z12.literal("wallet"),
1974
+ account: z13.union([
1975
+ z13.object({
1976
+ provider: z13.literal("wallet"),
1822
1977
  /** Canonical CAIP-10 account ID, as the record names it. */
1823
- id: z12.string().min(5).max(256),
1978
+ id: z13.string().min(5).max(256),
1824
1979
  /** The wallet link's revision. */
1825
1980
  revision: count2,
1826
1981
  /** When the member verified the wallet. */
1827
1982
  linkedAt: timestamp3.nullable()
1828
1983
  }),
1829
- z12.object({ provider: z12.literal("x"), ...xLink }),
1830
- z12.object({ provider: z12.literal("discord"), ...xLink }),
1831
- z12.object({
1832
- provider: z12.literal("member"),
1984
+ z13.object({ provider: z13.literal("x"), ...xLink }),
1985
+ z13.object({ provider: z13.literal("discord"), ...xLink }),
1986
+ z13.object({
1987
+ provider: z13.literal("member"),
1833
1988
  /** The member ID the record names. */
1834
1989
  id: identifier
1835
1990
  }),
1836
- z12.object({
1991
+ z13.object({
1837
1992
  /** Your app's identity kind, such as `app:telegram`. */
1838
1993
  provider: appIdentityKindSchema,
1839
1994
  /** The subject your app signed the member in with, as the record names it. */
1840
- subject: z12.string().min(1).max(256),
1995
+ subject: z13.string().min(1).max(256),
1841
1996
  /** The identity's revision in the project. */
1842
1997
  revision: count2,
1843
1998
  /** When the identity was linked to the member. */
1844
1999
  linkedAt: timestamp3.nullable()
1845
2000
  }),
1846
2001
  /** A kind a later Relay adds. */
1847
- z12.object({ provider: z12.string().min(1) })
2002
+ z13.object({ provider: z13.string().min(1) })
1848
2003
  ])
1849
2004
  });
1850
- var trackerTriggerRecordSchema = z12.object({
1851
- id: z12.string().min(1).max(256),
1852
- source: z12.string(),
2005
+ var trackerTriggerRecordSchema = z13.object({
2006
+ id: z13.string().min(1).max(256),
2007
+ source: z13.string(),
1853
2008
  occurredAt: timestamp3,
1854
2009
  observedAt: timestamp3,
1855
2010
  firstSeenAt: timestamp3,
1856
- author: z12.object({
1857
- id: z12.string().min(1).max(256),
1858
- verified: z12.boolean().nullable(),
2011
+ author: z13.object({
2012
+ id: z13.string().min(1).max(256),
2013
+ verified: z13.boolean().nullable(),
1859
2014
  kind: openIdentityKindSchema.optional()
1860
2015
  }).nullable(),
1861
- accounts: z12.record(accountRoleSchema, trackerRecordAccountSchema).optional(),
1862
- data: z12.record(z12.string(), z12.json()),
1863
- removed: z12.boolean()
2016
+ accounts: z13.record(accountRoleSchema, trackerRecordAccountSchema).optional(),
2017
+ data: z13.record(z13.string(), z13.json()),
2018
+ removed: z13.boolean()
1864
2019
  });
1865
- var trackerContentStageSchema = z12.object({
2020
+ var trackerContentStageSchema = z13.object({
1866
2021
  /** The body's revision: the hash of its canonical JSON. Edits make a new one. */
1867
2022
  revision: identifier,
1868
2023
  /** The captured observation that carried this body. */
1869
2024
  observation: identifier,
1870
2025
  /** The body: an X post's normalized body, or a custom record's `data.body`. */
1871
- body: z12.record(z12.string(), z12.json())
2026
+ body: z13.record(z13.string(), z13.json())
1872
2027
  });
1873
- var trackerTriggerContextSchema = z12.object({
2028
+ var trackerTriggerContextSchema = z13.object({
1874
2029
  /** The tracker's stable ID. */
1875
2030
  tracker: identifier,
1876
2031
  /** The tracker's authoring key. */
@@ -1892,61 +2047,214 @@ var trackerTriggerContextSchema = z12.object({
1892
2047
  });
1893
2048
 
1894
2049
  // src/completion.ts
1895
- import { z as z13 } from "zod";
1896
- var name = z13.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
1897
- var completionPolicySchema = z13.discriminatedUnion("kind", [
2050
+ import { z as z14 } from "zod";
2051
+ var name = z14.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
2052
+ var completionPolicySchema = z14.discriminatedUnion("kind", [
1898
2053
  streakPolicySchema,
1899
2054
  counterPolicySchema,
1900
- z13.object({ kind: z13.literal("once") }).strict(),
1901
- z13.object({ kind: z13.literal("keyed") }).strict()
2055
+ z14.object({ kind: z14.literal("once") }).strict(),
2056
+ z14.object({ kind: z14.literal("keyed") }).strict()
1902
2057
  ]);
1903
- var completionKeySchema = z13.string().min(1).max(500);
1904
- var budgetSchema = z13.object({
2058
+ var completionKeySchema = z14.string().min(1).max(500);
2059
+ var budgetSchema = z14.object({
1905
2060
  id: name,
1906
- scope: z13.enum(["member", "project"]),
2061
+ scope: z14.enum(["member", "project"]),
1907
2062
  /**
1908
2063
  * The project calendar period of the attempt's eligibility time that one bucket covers:
1909
2064
  * `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
1910
2065
  * `"lifetime"` never resets.
1911
2066
  */
1912
2067
  period: calendarPeriodSchema,
1913
- limit: z13.number().int().positive().max(Number.MAX_SAFE_INTEGER),
1914
- cost: z13.union([
1915
- z13.number().int().positive().max(Number.MAX_SAFE_INTEGER),
1916
- z13.object({ balance: name }).strict()
2068
+ limit: z14.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2069
+ cost: z14.union([
2070
+ z14.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2071
+ z14.object({ balance: name }).strict()
1917
2072
  ])
1918
2073
  }).strict();
1919
2074
 
1920
2075
  // src/integrations.ts
1921
- import { z as z14 } from "zod";
1922
- var evaluatorIntegrationProviderSchema = z14.enum(["discord", "x"]);
1923
- var integrationProviderSchema = z14.enum(["discord"]);
1924
- var discordServerSchema = z14.object({
1925
- id: z14.string().regex(/^[0-9]{1,20}$/),
1926
- name: z14.string().min(1),
1927
- icon: z14.string().nullable()
1928
- });
1929
- var projectIntegrationSchema = z14.object({
2076
+ import { z as z15 } from "zod";
2077
+ var evaluatorIntegrationProviderSchema = z15.enum(["discord", "x"]);
2078
+ var integrationProviderSchema = z15.enum(["discord"]);
2079
+ var discordServerSchema = z15.object({
2080
+ id: z15.string().regex(/^[0-9]{1,20}$/),
2081
+ name: z15.string().min(1),
2082
+ icon: z15.string().nullable()
2083
+ });
2084
+ var projectIntegrationSchema = z15.object({
1930
2085
  provider: integrationProviderSchema,
1931
- configured: z14.boolean(),
1932
- status: z14.enum(["disconnected", "ready", "attention"]),
1933
- revision: z14.number().int().nonnegative(),
2086
+ configured: z15.boolean(),
2087
+ status: z15.enum(["disconnected", "ready", "attention"]),
2088
+ revision: z15.number().int().nonnegative(),
1934
2089
  server: discordServerSchema.nullable(),
1935
- issue: z14.string().nullable(),
1936
- connectedAt: z14.number().default(0)
2090
+ issue: z15.string().nullable(),
2091
+ connectedAt: z15.number().default(0)
1937
2092
  });
1938
2093
 
2094
+ // src/wallet.ts
2095
+ import { z as z16 } from "zod";
2096
+ var solanaAddressSchema = z16.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
2097
+ var walletChainSchema = z16.enum(["solana", "eip155", "cosmos"]);
2098
+ var cosmosNetworkPattern = /^cosmos:[-_a-zA-Z0-9]{1,32}$/;
2099
+ var cosmosNetworkSchema = z16.custom(
2100
+ (value) => typeof value === "string" && cosmosNetworkPattern.test(value),
2101
+ "Use a Cosmos network: cosmos:<chain ID>"
2102
+ );
2103
+ var cosmosDenomSchema = z16.string().regex(
2104
+ /^[a-zA-Z][a-zA-Z0-9/:._-]{2,127}$/,
2105
+ "Use a Cosmos bank denomination such as uatom or uosmo"
2106
+ );
2107
+ function cosmosChain(chain) {
2108
+ if (typeof chain === "string" && !chain.startsWith("cosmos:")) {
2109
+ throw new Error('Use a Cosmos network such as "cosmos:cosmoshub-4"');
2110
+ }
2111
+ const value = typeof chain === "string" ? { chainId: chain.slice("cosmos:".length) } : chain;
2112
+ if (typeof value?.chainId !== "string") {
2113
+ throw new Error(
2114
+ 'Pass a Cosmos chain as { chainId } or a network such as "cosmos:cosmoshub-4"'
2115
+ );
2116
+ }
2117
+ const network = `cosmos:${value.chainId}`;
2118
+ if (!cosmosNetworkPattern.test(network)) {
2119
+ throw new Error(
2120
+ "A Cosmos chain ID has 1 to 32 letters, digits, hyphens or underscores"
2121
+ );
2122
+ }
2123
+ if (value.chainInfo && value.chainInfo.chainId !== value.chainId) {
2124
+ throw new Error("The chain info describes another chain ID");
2125
+ }
2126
+ return { ...value, network };
2127
+ }
2128
+ var solanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
2129
+ var evmAddressSchema = z16.string().regex(/^0x[0-9a-fA-F]{40}$/);
2130
+ var cosmosAddressSchema = z16.string().min(8).max(90).regex(
2131
+ /^(?:[a-z][a-z0-9]{0,82}1[02-9ac-hj-np-z]{38,}|[A-Z][A-Z0-9]{0,82}1[02-9AC-HJ-NP-Z]{38,})$/
2132
+ );
2133
+ var walletAddressInputSchema = z16.discriminatedUnion("chain", [
2134
+ z16.object({ chain: z16.literal("solana"), address: solanaAddressSchema }).strict(),
2135
+ z16.object({
2136
+ chain: z16.literal("eip155"),
2137
+ address: evmAddressSchema,
2138
+ /** Shown in the sign-in message's Chain ID line only: links are chain-agnostic. Defaults to 1. */
2139
+ chainId: z16.number().int().positive().safe().optional()
2140
+ }).strict(),
2141
+ z16.object({
2142
+ chain: z16.literal("cosmos"),
2143
+ network: cosmosNetworkSchema,
2144
+ address: cosmosAddressSchema
2145
+ }).strict()
2146
+ ]);
2147
+ var walletMessageChallengeSchema = z16.object({
2148
+ id: z16.string().min(1).max(200),
2149
+ purpose: z16.enum(["link", "sign-in"]),
2150
+ chain: walletChainSchema,
2151
+ network: cosmosNetworkSchema.nullable(),
2152
+ /** Canonical (base58, EIP-55 or lowercase bech32). The signer must sign with this address. */
2153
+ address: z16.string(),
2154
+ message: z16.string().max(4096),
2155
+ expiresAt: z16.number().int()
2156
+ });
2157
+ var walletSignatureSchema = z16.object({
2158
+ challenge: z16.string().min(1).max(200),
2159
+ /** solana: base58, 64 bytes · eip155: 0x and 130 hex digits (65 bytes) · cosmos: base64, 64 bytes (r‖s) */
2160
+ signature: z16.string().min(1).max(256),
2161
+ /** cosmos only: the base64 33-byte compressed secp256k1 key from signArbitrary's pub_key.value */
2162
+ publicKey: z16.string().max(128).optional()
2163
+ }).strict();
2164
+ var linkedWalletSchema = z16.object({
2165
+ chain: walletChainSchema,
2166
+ network: cosmosNetworkSchema.nullable(),
2167
+ address: z16.string(),
2168
+ verifiedAt: z16.number().int().nonnegative(),
2169
+ revision: z16.number().int().positive(),
2170
+ /** True when this wallet can sign in: it was first used through wallet sign-in. Linking never enables sign-in. */
2171
+ signIn: z16.boolean()
2172
+ });
2173
+ var walletUnlinkInputSchema = z16.object({ chain: walletChainSchema, address: z16.string().min(1).max(100) }).strict();
2174
+ async function walletAddressInput(signer) {
2175
+ const address = await signer.address();
2176
+ switch (signer.chain) {
2177
+ case "solana":
2178
+ return { chain: "solana", address };
2179
+ case "eip155":
2180
+ return {
2181
+ chain: "eip155",
2182
+ address,
2183
+ ...signer.chainId ? { chainId: await signer.chainId() } : {}
2184
+ };
2185
+ case "cosmos":
2186
+ if (!signer.network) {
2187
+ throw clientError(
2188
+ "Choose the Cosmos chain for this wallet",
2189
+ RelayErrorCode.InvalidInput
2190
+ );
2191
+ }
2192
+ return { chain: "cosmos", network: signer.network, address };
2193
+ }
2194
+ }
2195
+ var WALLETS_PER_CHAIN = 5;
2196
+ var walletSignInFamilies = ["solana", "eip155", "cosmos"];
2197
+ var walletSignInNetworkSchema = z16.enum(walletSignInFamilies);
2198
+ var walletSignInNetworksSchema = z16.array(walletSignInNetworkSchema).max(walletSignInFamilies.length).refine((values2) => new Set(values2).size === values2.length, {
2199
+ message: "Duplicate wallet family"
2200
+ }).transform(
2201
+ (values2) => walletSignInFamilies.filter((family) => values2.includes(family))
2202
+ );
2203
+ function walletSignInNetwork(wallet) {
2204
+ return wallet.chain;
2205
+ }
2206
+ function caip10(wallet, network) {
2207
+ if (wallet.chain === "cosmos") {
2208
+ if (!wallet.network || network && network !== wallet.network) {
2209
+ throw new Error("A Cosmos wallet belongs to its own network");
2210
+ }
2211
+ return `${wallet.network}:${wallet.address}`;
2212
+ }
2213
+ const selected = network ?? (wallet.chain === "solana" ? solanaMainnet : "eip155:1");
2214
+ const valid = wallet.chain === "solana" ? /^solana:[1-9A-HJ-NP-Za-km-z]{32}$/.test(selected) : isEvmChainId(selected);
2215
+ if (!valid) {
2216
+ throw new Error(`Use a ${wallet.chain} network for this wallet`);
2217
+ }
2218
+ return `${selected}:${wallet.address}`;
2219
+ }
2220
+ function isEvmChainId(value) {
2221
+ return /^eip155:[1-9][0-9]{0,15}$/.test(value);
2222
+ }
2223
+ var evmChainIdSchema = z16.custom(
2224
+ (value) => typeof value === "string" && isEvmChainId(value),
2225
+ 'Use an EVM chain ID such as "eip155:8453"'
2226
+ );
2227
+ var units = z16.string().regex(/^(0|[1-9][0-9]*)$/);
2228
+ var walletBalanceSchema = responseShape(
2229
+ z16.object({
2230
+ /** Canonical CAIP-2 ID for Solana, EVM or a supported Cosmos SDK chain. */
2231
+ chain: z16.string(),
2232
+ /** The canonical mint, EIP-55 contract or Cosmos bank denom; null for a native coin. */
2233
+ token: z16.string().nullable(),
2234
+ /** Null when token metadata does not report decimals. */
2235
+ decimals: z16.number().int().min(0).max(255).nullable(),
2236
+ /** The sum over `wallets`. */
2237
+ total: units,
2238
+ wallets: z16.array(
2239
+ z16.object({ address: z16.string(), amount: units }).strict()
2240
+ ),
2241
+ /** Solana: lowest slot. EVM: approximate latest block. Cosmos: the fixed queried block. */
2242
+ at: z16.object({ kind: z16.enum(["slot", "block"]), number: units }).strict(),
2243
+ observedAt: z16.number().int().nonnegative()
2244
+ }).strict()
2245
+ );
2246
+
1939
2247
  // src/submission-input.ts
1940
- import { z as z15 } from "zod";
1941
- var textOptionsSchema = z15.object({
1942
- required: z15.boolean().default(true),
1943
- minLength: z15.number().int().min(0).max(1e4).default(1),
1944
- maxLength: z15.number().int().min(1).max(1e4).default(1e4)
2248
+ import { z as z17 } from "zod";
2249
+ var textOptionsSchema = z17.object({
2250
+ required: z17.boolean().default(true),
2251
+ minLength: z17.number().int().min(0).max(1e4).default(1),
2252
+ maxLength: z17.number().int().min(1).max(1e4).default(1e4)
1945
2253
  }).strict().refine(
1946
2254
  (v) => v.minLength <= v.maxLength,
1947
2255
  "minLength must not exceed maxLength"
1948
2256
  );
1949
- var hostSchema = z15.string().min(1).max(253).refine((host) => {
2257
+ var hostSchema = z17.string().min(1).max(253).refine((host) => {
1950
2258
  if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
1951
2259
  return false;
1952
2260
  }
@@ -1957,13 +2265,13 @@ var hostSchema = z15.string().min(1).max(253).refine((host) => {
1957
2265
  return false;
1958
2266
  }
1959
2267
  }, "Use a hostname without a scheme, path, port, or wildcard");
1960
- var urlOptionsSchema = z15.object({
1961
- required: z15.boolean().default(true),
1962
- allowedHosts: z15.array(hostSchema).min(1).max(100).optional()
2268
+ var urlOptionsSchema = z17.object({
2269
+ required: z17.boolean().default(true),
2270
+ allowedHosts: z17.array(hostSchema).min(1).max(100).optional()
1963
2271
  }).strict();
1964
- var textEvidenceSchema = z15.object({ kind: z15.literal("text"), value: z15.string().max(1e4) }).strict();
1965
- var urlEvidenceSchema = z15.object({ kind: z15.literal("url"), value: z15.string().max(2048) }).strict();
1966
- var valueEvidenceSchema = z15.discriminatedUnion("kind", [
2272
+ var textEvidenceSchema = z17.object({ kind: z17.literal("text"), value: z17.string().max(1e4) }).strict();
2273
+ var urlEvidenceSchema = z17.object({ kind: z17.literal("url"), value: z17.string().max(2048) }).strict();
2274
+ var valueEvidenceSchema = z17.discriminatedUnion("kind", [
1967
2275
  textEvidenceSchema,
1968
2276
  urlEvidenceSchema
1969
2277
  ]);
@@ -2026,22 +2334,22 @@ function xPostId(value) {
2026
2334
  }
2027
2335
 
2028
2336
  // src/quiz.ts
2029
- import { z as z16 } from "zod";
2030
- var quizId = z16.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
2031
- var quizChoiceSchema = z16.object({ id: quizId, label: z16.string().trim().min(1).max(500) }).strict();
2032
- var quizQuestionSchema = z16.object({
2337
+ import { z as z18 } from "zod";
2338
+ var quizId = z18.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
2339
+ var quizChoiceSchema = z18.object({ id: quizId, label: z18.string().trim().min(1).max(500) }).strict();
2340
+ var quizQuestionSchema = z18.object({
2033
2341
  id: quizId,
2034
- prompt: z16.string().trim().min(1).max(1e3),
2035
- choices: z16.array(quizChoiceSchema).min(2).max(8).refine(
2342
+ prompt: z18.string().trim().min(1).max(1e3),
2343
+ choices: z18.array(quizChoiceSchema).min(2).max(8).refine(
2036
2344
  (choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
2037
2345
  "Choice IDs must be unique"
2038
2346
  )
2039
2347
  }).strict();
2040
- var quizQuestionsSchema = z16.array(quizQuestionSchema).min(1).max(20).refine(
2348
+ var quizQuestionsSchema = z18.array(quizQuestionSchema).min(1).max(20).refine(
2041
2349
  (questions) => new Set(questions.map((question) => question.id)).size === questions.length,
2042
2350
  "Question IDs must be unique"
2043
2351
  );
2044
- var quizContentSchema = z16.array(
2352
+ var quizContentSchema = z18.array(
2045
2353
  quizQuestionSchema.extend({ correct: quizId }).refine(
2046
2354
  (question) => question.choices.some((choice) => choice.id === question.correct),
2047
2355
  "Choose a correct answer from the available choices"
@@ -2052,94 +2360,94 @@ var quizContentSchema = z16.array(
2052
2360
  );
2053
2361
 
2054
2362
  // src/resources.ts
2055
- import { z as z17 } from "zod";
2056
- var resourceSourceSchema = z17.union([
2057
- z17.strictObject({
2058
- provider: z17.literal("domino"),
2059
- resource: z17.literal("point-ledger")
2363
+ import { z as z19 } from "zod";
2364
+ var resourceSourceSchema = z19.union([
2365
+ z19.strictObject({
2366
+ provider: z19.literal("domino"),
2367
+ resource: z19.literal("point-ledger")
2060
2368
  }),
2061
2369
  discordResourceSourceSchema
2062
2370
  ]);
2063
- var resourceRequestSchema = z17.object({
2371
+ var resourceRequestSchema = z19.object({
2064
2372
  source: resourceSourceSchema,
2065
- query: z17.string().max(100).optional(),
2066
- cursor: z17.string().regex(/^\d{1,6}$/).optional(),
2067
- ids: z17.array(z17.string().min(1).max(100)).max(50).optional()
2373
+ query: z19.string().max(100).optional(),
2374
+ cursor: z19.string().regex(/^\d{1,6}$/).optional(),
2375
+ ids: z19.array(z19.string().min(1).max(100)).max(50).optional()
2068
2376
  }).strict();
2069
- var resourceOptionsSchema = z17.object({
2070
- revision: z17.number().int(),
2071
- options: z17.array(
2072
- z17.object({
2073
- id: z17.string(),
2074
- label: z17.string(),
2075
- description: z17.string().optional(),
2076
- group: z17.string().optional(),
2077
- disabledReason: z17.string().optional()
2377
+ var resourceOptionsSchema = z19.object({
2378
+ revision: z19.number().int(),
2379
+ options: z19.array(
2380
+ z19.object({
2381
+ id: z19.string(),
2382
+ label: z19.string(),
2383
+ description: z19.string().optional(),
2384
+ group: z19.string().optional(),
2385
+ disabledReason: z19.string().optional()
2078
2386
  })
2079
2387
  ),
2080
2388
  /** Pass back as `cursor` for the next page; null on the last one. */
2081
- nextCursor: z17.string().nullable().default(null),
2389
+ nextCursor: z19.string().nullable().default(null),
2082
2390
  /** @deprecated Use `nextCursor`. Removed in 2.0.0. */
2083
- cursor: z17.string().nullable()
2391
+ cursor: z19.string().nullable()
2084
2392
  });
2085
2393
 
2086
2394
  // src/settings.ts
2087
- import { z as z19 } from "zod";
2395
+ import { z as z21 } from "zod";
2088
2396
 
2089
2397
  // src/setting-values.ts
2090
- import { z as z18 } from "zod";
2091
- var settingInstant = z18.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
2092
- var settingResourceId = z18.union([
2093
- z18.literal(""),
2094
- z18.string().regex(/^\S{1,200}$/)
2398
+ import { z as z20 } from "zod";
2399
+ var settingInstant = z20.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
2400
+ var settingResourceId = z20.union([
2401
+ z20.literal(""),
2402
+ z20.string().regex(/^\S{1,200}$/)
2095
2403
  ]);
2096
2404
 
2097
2405
  // src/settings.ts
2098
- var base = { label: z19.string().min(1), description: z19.string().optional() };
2099
- var settingFieldSchema = z19.discriminatedUnion("kind", [
2100
- z19.object({
2406
+ var base = { label: z21.string().min(1), description: z21.string().optional() };
2407
+ var settingFieldSchema = z21.discriminatedUnion("kind", [
2408
+ z21.object({
2101
2409
  ...base,
2102
- kind: z19.literal("point-ledger"),
2103
- default: identifier.or(z19.literal(""))
2410
+ kind: z21.literal("point-ledger"),
2411
+ default: identifier.or(z21.literal(""))
2104
2412
  }).strict(),
2105
- z19.object({ ...base, kind: z19.literal("datetime"), default: settingInstant }).strict(),
2106
- z19.object({
2413
+ z21.object({ ...base, kind: z21.literal("datetime"), default: settingInstant }).strict(),
2414
+ z21.object({
2107
2415
  ...base,
2108
- kind: z19.literal("resource"),
2416
+ kind: z21.literal("resource"),
2109
2417
  default: settingResourceId,
2110
2418
  source: resourceSourceSchema
2111
2419
  }).strict(),
2112
- z19.object({ ...base, kind: z19.literal("quiz"), default: quizContentSchema }).strict(),
2113
- z19.object({
2420
+ z21.object({ ...base, kind: z21.literal("quiz"), default: quizContentSchema }).strict(),
2421
+ z21.object({
2114
2422
  ...base,
2115
- kind: z19.literal("text"),
2116
- default: z19.string(),
2117
- minLength: z19.number().int().nonnegative(),
2118
- maxLength: z19.number().int().positive(),
2119
- multiline: z19.boolean()
2423
+ kind: z21.literal("text"),
2424
+ default: z21.string(),
2425
+ minLength: z21.number().int().nonnegative(),
2426
+ maxLength: z21.number().int().positive(),
2427
+ multiline: z21.boolean()
2120
2428
  }).strict(),
2121
- z19.object({
2429
+ z21.object({
2122
2430
  ...base,
2123
- kind: z19.literal("integer"),
2124
- default: z19.number().int(),
2125
- min: z19.number().int(),
2126
- max: z19.number().int()
2431
+ kind: z21.literal("integer"),
2432
+ default: z21.number().int(),
2433
+ min: z21.number().int(),
2434
+ max: z21.number().int()
2127
2435
  }).strict(),
2128
- z19.object({ ...base, kind: z19.literal("boolean"), default: z19.boolean() }).strict(),
2129
- z19.object({
2436
+ z21.object({ ...base, kind: z21.literal("boolean"), default: z21.boolean() }).strict(),
2437
+ z21.object({
2130
2438
  ...base,
2131
- kind: z19.literal("choice"),
2132
- default: z19.string(),
2133
- options: z19.array(z19.string().min(1)).min(1)
2439
+ kind: z21.literal("choice"),
2440
+ default: z21.string(),
2441
+ options: z21.array(z21.string().min(1)).min(1)
2134
2442
  }).strict()
2135
2443
  ]);
2136
- var settingsFieldsSchema = z19.record(
2137
- z19.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
2444
+ var settingsFieldsSchema = z21.record(
2445
+ z21.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
2138
2446
  settingFieldSchema
2139
2447
  );
2140
- var settingsValuesSchema = z19.record(
2141
- z19.string(),
2142
- z19.union([z19.string(), z19.number().finite(), z19.boolean(), quizContentSchema])
2448
+ var settingsValuesSchema = z21.record(
2449
+ z21.string(),
2450
+ z21.union([z21.string(), z21.number().finite(), z21.boolean(), quizContentSchema])
2143
2451
  );
2144
2452
  function parseSettings(fields2, input) {
2145
2453
  const shape = {};
@@ -2158,20 +2466,20 @@ function parseSettings(fields2, input) {
2158
2466
  shape[key] = quizContentSchema.default(field.default);
2159
2467
  break;
2160
2468
  case "text":
2161
- shape[key] = z19.string().min(field.minLength).max(field.maxLength).default(field.default);
2469
+ shape[key] = z21.string().min(field.minLength).max(field.maxLength).default(field.default);
2162
2470
  break;
2163
2471
  case "integer":
2164
- shape[key] = z19.number().int().min(field.min).max(field.max).default(field.default);
2472
+ shape[key] = z21.number().int().min(field.min).max(field.max).default(field.default);
2165
2473
  break;
2166
2474
  case "boolean":
2167
- shape[key] = z19.boolean().default(field.default);
2475
+ shape[key] = z21.boolean().default(field.default);
2168
2476
  break;
2169
2477
  case "choice":
2170
- shape[key] = z19.enum(field.options).default(field.default);
2478
+ shape[key] = z21.enum(field.options).default(field.default);
2171
2479
  break;
2172
2480
  }
2173
2481
  }
2174
- return settingsValuesSchema.parse(z19.object(shape).strict().parse(input));
2482
+ return settingsValuesSchema.parse(z21.object(shape).strict().parse(input));
2175
2483
  }
2176
2484
  function missingResourceSettings(fields2, values2) {
2177
2485
  return Object.entries(fields2).filter(
@@ -2192,21 +2500,21 @@ function authoringKey(input) {
2192
2500
  }
2193
2501
 
2194
2502
  // src/campaigns.ts
2195
- import { z as z20 } from "zod";
2196
- var timestamp4 = z20.number().int().safe().nonnegative();
2197
- var availabilityWindowSchema = z20.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
2503
+ import { z as z22 } from "zod";
2504
+ var timestamp4 = z22.number().int().safe().nonnegative();
2505
+ var availabilityWindowSchema = z22.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
2198
2506
  message: "Window end must follow its start",
2199
2507
  path: ["until"]
2200
2508
  });
2201
- var campaignDefinitionSchema = z20.object({
2509
+ var campaignDefinitionSchema = z22.object({
2202
2510
  key: identifier,
2203
- title: z20.string().trim().min(1).max(120),
2511
+ title: z22.string().trim().min(1).max(120),
2204
2512
  window: availabilityWindowSchema.optional(),
2205
- enrollment: z20.enum(["none", "required"]).default("none")
2513
+ enrollment: z22.enum(["none", "required"]).default("none")
2206
2514
  }).strict();
2207
2515
  var campaignAuthoringSchema = campaignDefinitionSchema.omit({ key: true, title: true }).extend({
2208
2516
  ...authoringIdentityShape,
2209
- title: z20.string().trim().min(1).max(120).optional()
2517
+ title: z22.string().trim().min(1).max(120).optional()
2210
2518
  }).strict().transform((value) => {
2211
2519
  const normalized = value;
2212
2520
  return campaignDefinitionSchema.parse({
@@ -2220,42 +2528,42 @@ function defineCampaign(input) {
2220
2528
  var campaignViewSchema = campaignDefinitionSchema.extend({
2221
2529
  enrolledAt: timestamp4.nullable(),
2222
2530
  withdrawnAt: timestamp4.nullable().default(null),
2223
- withdrawalReason: z20.string().nullable().default(null)
2531
+ withdrawalReason: z22.string().nullable().default(null)
2224
2532
  });
2225
- var campaignEnrollmentInputSchema = z20.object({ actionId: identifier, campaign: identifier }).strict();
2533
+ var campaignEnrollmentInputSchema = z22.object({ actionId: identifier, campaign: identifier }).strict();
2226
2534
  var memberCampaignEnrollmentInputSchema = campaignEnrollmentInputSchema.extend({ member: identifier });
2227
2535
  var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
2228
2536
  var memberCampaignWithdrawalInputSchema = campaignWithdrawalInputSchema.extend({
2229
2537
  member: identifier,
2230
- reason: z20.string().trim().min(1).max(500)
2538
+ reason: z22.string().trim().min(1).max(500)
2231
2539
  });
2232
- var campaignEnrollmentSchema = z20.object({
2540
+ var campaignEnrollmentSchema = z22.object({
2233
2541
  campaign: identifier,
2234
2542
  member: identifier,
2235
2543
  enrolledAt: timestamp4,
2236
2544
  withdrawnAt: timestamp4.nullable().default(null),
2237
- withdrawalReason: z20.string().nullable().default(null)
2545
+ withdrawalReason: z22.string().nullable().default(null)
2238
2546
  });
2239
2547
 
2240
2548
  // src/resource-handle.ts
2241
- import { z as z21 } from "zod";
2549
+ import { z as z23 } from "zod";
2242
2550
  function resourceHandle(_kind, definition) {
2243
2551
  return definition;
2244
2552
  }
2245
- var ledgerSettingSchema = identifier.or(z21.literal("")).brand();
2553
+ var ledgerSettingSchema = identifier.or(z23.literal("")).brand();
2246
2554
  function ledgerKey(ledger) {
2247
2555
  return typeof ledger === "string" ? ledger : ledger.key;
2248
2556
  }
2249
2557
 
2250
2558
  // src/groups.ts
2251
- import { z as z22 } from "zod";
2252
- var projectGroupSchema = z22.object({
2559
+ import { z as z24 } from "zod";
2560
+ var projectGroupSchema = z24.object({
2253
2561
  key: identifier,
2254
- title: z22.string().trim().min(1).max(120)
2562
+ title: z24.string().trim().min(1).max(120)
2255
2563
  }).strict();
2256
2564
  var projectGroupAuthoringSchema = projectGroupSchema.omit({ key: true, title: true }).extend({
2257
2565
  ...authoringIdentityShape,
2258
- title: z22.string().trim().min(1).max(120).optional()
2566
+ title: z24.string().trim().min(1).max(120).optional()
2259
2567
  }).strict().transform((value) => {
2260
2568
  return projectGroupSchema.parse({
2261
2569
  ...value,
@@ -2268,92 +2576,92 @@ function defineGroup(input) {
2268
2576
  function projectGroupKey(group) {
2269
2577
  return identifier.parse(group.key);
2270
2578
  }
2271
- var groupTitle = z22.string().trim().min(1).max(120);
2272
- var reason = z22.string().trim().min(1).max(1e3);
2273
- var timestamp5 = z22.number().int().nonnegative().max(864e13);
2274
- var createGroupSchema = z22.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
2275
- var updateGroupSchema = z22.object({ title: groupTitle }).strict();
2276
- var addGroupMemberSchema = z22.object({ actionId: identifier, member: identifier, reason }).strict();
2277
- var removeGroupMemberSchema = z22.object({ actionId: identifier, reason }).strict();
2278
- var groupPageQuerySchema = z22.strictObject({
2579
+ var groupTitle = z24.string().trim().min(1).max(120);
2580
+ var reason = z24.string().trim().min(1).max(1e3);
2581
+ var timestamp5 = z24.number().int().nonnegative().max(864e13);
2582
+ var createGroupSchema = z24.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
2583
+ var updateGroupSchema = z24.object({ title: groupTitle }).strict();
2584
+ var addGroupMemberSchema = z24.object({ actionId: identifier, member: identifier, reason }).strict();
2585
+ var removeGroupMemberSchema = z24.object({ actionId: identifier, reason }).strict();
2586
+ var groupPageQuerySchema = z24.strictObject({
2279
2587
  cursor: pageCursorSchema.optional(),
2280
2588
  /** Items per page, 1–100; the default is 50. */
2281
- limit: z22.number().int().min(1).max(100).optional()
2589
+ limit: z24.number().int().min(1).max(100).optional()
2282
2590
  });
2283
- var managedGroupSchema = z22.object({
2591
+ var managedGroupSchema = z24.object({
2284
2592
  key: identifier,
2285
- title: z22.string(),
2286
- members: z22.number().int().nonnegative(),
2593
+ title: z24.string(),
2594
+ members: z24.number().int().nonnegative(),
2287
2595
  createdAt: timestamp5,
2288
2596
  archivedAt: timestamp5.nullable()
2289
2597
  });
2290
- var groupPageSchema = z22.object({
2291
- items: z22.array(managedGroupSchema),
2598
+ var groupPageSchema = z24.object({
2599
+ items: z24.array(managedGroupSchema),
2292
2600
  nextCursor: pageCursorSchema.nullable()
2293
2601
  });
2294
- var groupMemberSchema = z22.object({
2602
+ var groupMemberSchema = z24.object({
2295
2603
  member: identifier,
2296
2604
  addedAt: timestamp5.nullable()
2297
2605
  });
2298
- var groupMemberPageSchema = z22.object({
2299
- items: z22.array(groupMemberSchema),
2606
+ var groupMemberPageSchema = z24.object({
2607
+ items: z24.array(groupMemberSchema),
2300
2608
  nextCursor: pageCursorSchema.nullable()
2301
2609
  });
2302
2610
 
2303
2611
  // src/prerequisites.ts
2304
- import { z as z23 } from "zod";
2305
- var amount = z23.number().int().safe().nonnegative();
2612
+ import { z as z25 } from "zod";
2613
+ var amount = z25.number().int().safe().nonnegative();
2306
2614
  var threshold = amount.positive();
2307
- var completionPrerequisiteSchema = z23.discriminatedUnion("scope", [
2308
- z23.object({
2309
- kind: z23.literal("completion"),
2615
+ var completionPrerequisiteSchema = z25.discriminatedUnion("scope", [
2616
+ z25.object({
2617
+ kind: z25.literal("completion"),
2310
2618
  quest: identifier,
2311
- scope: z23.literal("ever")
2619
+ scope: z25.literal("ever")
2312
2620
  }).strict(),
2313
- z23.object({
2314
- kind: z23.literal("completion"),
2621
+ z25.object({
2622
+ kind: z25.literal("completion"),
2315
2623
  quest: identifier,
2316
- scope: z23.literal("period"),
2624
+ scope: z25.literal("period"),
2317
2625
  period: calendarPeriodSchema.exclude(["lifetime"])
2318
2626
  }).strict()
2319
2627
  ]);
2320
- var balancePrerequisiteSchema = z23.object({
2321
- kind: z23.literal("balance"),
2628
+ var balancePrerequisiteSchema = z25.object({
2629
+ kind: z25.literal("balance"),
2322
2630
  balance: identifier,
2323
2631
  minimum: threshold
2324
2632
  }).strict();
2325
- var groupPrerequisiteSchema = z23.object({ kind: z23.literal("group"), group: identifier, title: z23.string() }).strict();
2326
- var prerequisiteSchema = z23.discriminatedUnion("kind", [
2633
+ var groupPrerequisiteSchema = z25.object({ kind: z25.literal("group"), group: identifier, title: z25.string() }).strict();
2634
+ var prerequisiteSchema = z25.discriminatedUnion("kind", [
2327
2635
  completionPrerequisiteSchema,
2328
2636
  balancePrerequisiteSchema,
2329
2637
  groupPrerequisiteSchema
2330
2638
  ]);
2331
- var missingPrerequisiteSchema = z23.union([
2332
- z23.object({
2333
- kind: z23.literal("completion"),
2639
+ var missingPrerequisiteSchema = z25.union([
2640
+ z25.object({
2641
+ kind: z25.literal("completion"),
2334
2642
  quest: identifier,
2335
- title: z23.string(),
2336
- scope: z23.literal("ever")
2643
+ title: z25.string(),
2644
+ scope: z25.literal("ever")
2337
2645
  }),
2338
- z23.object({
2339
- kind: z23.literal("completion"),
2646
+ z25.object({
2647
+ kind: z25.literal("completion"),
2340
2648
  quest: identifier,
2341
- title: z23.string(),
2342
- scope: z23.literal("period"),
2649
+ title: z25.string(),
2650
+ scope: z25.literal("period"),
2343
2651
  period: calendarPeriodSchema.exclude(["lifetime"]),
2344
- resetsAt: z23.number().int().safe()
2652
+ resetsAt: z25.number().int().safe()
2345
2653
  }),
2346
- z23.object({
2347
- kind: z23.literal("balance"),
2654
+ z25.object({
2655
+ kind: z25.literal("balance"),
2348
2656
  balance: identifier,
2349
- title: z23.string(),
2657
+ title: z25.string(),
2350
2658
  minimum: threshold,
2351
2659
  current: amount
2352
2660
  }),
2353
- z23.object({
2354
- kind: z23.literal("group"),
2661
+ z25.object({
2662
+ kind: z25.literal("group"),
2355
2663
  group: identifier,
2356
- title: z23.string()
2664
+ title: z25.string()
2357
2665
  })
2358
2666
  ]);
2359
2667
  function completed(quest, options = {}) {
@@ -2381,84 +2689,116 @@ function inGroup(group) {
2381
2689
  }
2382
2690
 
2383
2691
  // src/schema.ts
2384
- import { z as z24 } from "zod";
2385
- var pointsRewardSchema = z24.object({
2386
- kind: z24.literal("points").default("points"),
2692
+ import { z as z26 } from "zod";
2693
+ var pointsRewardSchema = z26.object({
2694
+ kind: z26.literal("points").default("points"),
2387
2695
  balance: identifier,
2388
- amount: z24.number().int().min(0).max(1e4)
2696
+ amount: z26.number().int().min(0).max(1e4)
2389
2697
  }).strict();
2390
- var tieredRewardDefinitionSchema = z24.object({
2698
+ var tieredRewardDefinitionSchema = z26.object({
2699
+ /** An automatic achievement backed by the project badge catalog. */
2700
+ badge: identifier.optional(),
2391
2701
  id: identifier,
2392
- title: z24.string().min(1).max(120),
2393
- tiers: z24.array(
2394
- z24.object({ id: identifier, title: z24.string().min(1).max(120) }).strict()
2702
+ title: z26.string().min(1).max(120),
2703
+ tiers: z26.array(
2704
+ z26.object({ id: identifier, title: z26.string().min(1).max(120) }).strict()
2395
2705
  ).min(1).max(20).refine(
2396
2706
  (tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
2397
2707
  "Tier IDs must be unique"
2398
2708
  ),
2399
- inventory: z24.object({ kind: z24.literal("untracked") }).strict(),
2400
- fulfillment: z24.discriminatedUnion("kind", [
2401
- z24.object({ kind: z24.literal("staff-handover") }).strict(),
2402
- z24.object({ kind: z24.literal("automatic") }).strict()
2709
+ inventory: z26.object({ kind: z26.literal("untracked") }).strict(),
2710
+ fulfillment: z26.discriminatedUnion("kind", [
2711
+ z26.object({ kind: z26.literal("staff-handover") }).strict(),
2712
+ z26.object({ kind: z26.literal("automatic") }).strict()
2403
2713
  ])
2404
- }).strict();
2405
- var tieredRewardReferenceSchema = z24.object({
2714
+ }).strict().refine(
2715
+ (value) => value.badge === void 0 || value.fulfillment.kind === "automatic" && value.tiers.length === 1 && value.tiers[0].id === "awarded",
2716
+ "Badge rewards require the fixed automatic achievement envelope"
2717
+ );
2718
+ var tieredRewardReferenceSchema = z26.object({
2406
2719
  id: identifier,
2407
2720
  key: identifier.nullable()
2408
2721
  });
2409
- var tierRewardSchema = z24.object({
2410
- kind: z24.literal("tier"),
2722
+ var tierRewardSchema = z26.object({
2723
+ kind: z26.literal("tier"),
2411
2724
  reward: tieredRewardDefinitionSchema,
2412
2725
  tier: identifier
2413
2726
  }).strict().refine(
2414
2727
  (value) => value.reward.tiers.some((t) => t.id === value.tier),
2415
2728
  "Unknown reward tier"
2416
2729
  );
2730
+ var badgeRewardSchema = tierRewardSchema.transform(
2731
+ (value, context) => {
2732
+ const badge = value.reward.badge;
2733
+ if (!badge || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
2734
+ context.addIssue({ code: "custom", message: "Invalid badge reward" });
2735
+ return z26.NEVER;
2736
+ }
2737
+ return { ...value, reward: { ...value.reward, badge } };
2738
+ }
2739
+ );
2740
+ function badgeReward(reference, title) {
2741
+ return badgeRewardSchema.parse({
2742
+ kind: "tier",
2743
+ tier: "awarded",
2744
+ reward: {
2745
+ id: reference,
2746
+ badge: reference,
2747
+ title,
2748
+ tiers: [{ id: "awarded", title: "Awarded" }],
2749
+ inventory: { kind: "untracked" },
2750
+ fulfillment: { kind: "automatic" }
2751
+ }
2752
+ });
2753
+ }
2417
2754
  var integrationRewardSchema = discordRewardSchema;
2418
- var rewardSchema = z24.union([
2755
+ var rewardSchema = z26.union([
2419
2756
  pointsRewardSchema,
2420
2757
  tierRewardSchema,
2421
2758
  integrationRewardSchema
2422
2759
  ]);
2423
2760
  function rewardKey(reward) {
2761
+ if (reward.kind === "tier" && reward.reward.badge) {
2762
+ return "badge:" + reward.reward.badge;
2763
+ }
2424
2764
  if (reward.kind === "integration") {
2425
2765
  return `integration:${reward.provider}:${reward.action}:${reward.roleId}`;
2426
2766
  }
2427
2767
  return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
2428
2768
  }
2429
- var triggerSchema = z24.union([
2430
- z24.object({
2431
- kind: z24.literal("manual"),
2432
- input: z24.literal("text"),
2769
+ var triggerSchema = z26.union([
2770
+ z26.object({
2771
+ kind: z26.literal("manual"),
2772
+ input: z26.literal("text"),
2433
2773
  constraints: textOptionsSchema,
2434
- actor: z24.enum(["member", "staff"]).optional()
2774
+ actor: z26.enum(["member", "staff"]).optional()
2435
2775
  }).strict(),
2436
- z24.object({
2437
- kind: z24.literal("manual"),
2438
- input: z24.literal("url"),
2776
+ z26.object({
2777
+ kind: z26.literal("manual"),
2778
+ input: z26.literal("url"),
2439
2779
  constraints: urlOptionsSchema,
2440
- actor: z24.enum(["member", "staff"]).optional()
2780
+ actor: z26.enum(["member", "staff"]).optional()
2441
2781
  }).strict(),
2442
- z24.object({
2443
- kind: z24.literal("manual"),
2444
- input: z24.enum(["photo", "quiz", "none"]),
2445
- actor: z24.enum(["member", "staff"]).optional()
2782
+ z26.object({
2783
+ kind: z26.literal("manual"),
2784
+ input: z26.enum(["photo", "quiz", "none"]),
2785
+ actor: z26.enum(["member", "staff"]).optional()
2446
2786
  }).strict(),
2447
- z24.object({
2448
- kind: z24.literal("automatic"),
2787
+ z26.object({
2788
+ kind: z26.literal("automatic"),
2449
2789
  tracker: trackerTriggerPolicySchema.optional()
2450
2790
  }).strict()
2451
2791
  ]);
2452
- var triggerResponseSchema = z24.union(
2792
+ var triggerResponseSchema = z26.union(
2453
2793
  triggerSchema.options.map((option) => option.strip())
2454
2794
  );
2455
- var photoResultSchema = z24.object({
2456
- kind: z24.enum(["pass", "fail", "unclear"]),
2457
- reason: z24.string().min(1).max(2e3)
2795
+ var photoResultSchema = z26.object({
2796
+ kind: z26.enum(["pass", "fail", "unclear"]),
2797
+ reason: z26.string().min(1).max(2e3)
2458
2798
  }).strict();
2459
- var textReviewInputSchema = z24.object({
2460
- text: z24.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
2461
- criteria: z24.string().trim().min(1).max(2e3)
2799
+ var textReviewInputSchema = z26.object({
2800
+ text: z26.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
2801
+ criteria: z26.string().trim().min(1).max(2e3)
2462
2802
  }).strict();
2463
2803
  var textResultSchema = photoResultSchema;
2464
2804
  var deferPolicy = {
@@ -2468,53 +2808,53 @@ var deferPolicy = {
2468
2808
  horizonMs: 864e5,
2469
2809
  maxDefers: 100
2470
2810
  };
2471
- var evaluatorProgressSchema = z24.object({
2472
- current: z24.number().finite().nonnegative(),
2473
- target: z24.number().finite().positive(),
2474
- reason: z24.string().min(1).max(2e3)
2811
+ var evaluatorProgressSchema = z26.object({
2812
+ current: z26.number().finite().nonnegative(),
2813
+ target: z26.number().finite().positive(),
2814
+ reason: z26.string().min(1).max(2e3)
2475
2815
  }).refine((value) => value.current <= value.target, {
2476
2816
  message: "Progress current must not exceed target"
2477
2817
  });
2478
- var decisionSchema = z24.discriminatedUnion("kind", [
2479
- z24.strictObject({
2480
- kind: z24.literal("defer"),
2481
- reason: z24.string().min(1).max(2e3),
2482
- retryAfterMs: z24.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
2818
+ var decisionSchema = z26.discriminatedUnion("kind", [
2819
+ z26.strictObject({
2820
+ kind: z26.literal("defer"),
2821
+ reason: z26.string().min(1).max(2e3),
2822
+ retryAfterMs: z26.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
2483
2823
  /** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
2484
- until: z24.number().int().safe().nonnegative().optional()
2824
+ until: z26.number().int().safe().nonnegative().optional()
2485
2825
  }),
2486
- evaluatorProgressSchema.safeExtend({ kind: z24.literal("progress") }).strict(),
2487
- z24.object({
2488
- kind: z24.literal("accept"),
2489
- rewards: z24.array(rewardSchema).max(10),
2826
+ evaluatorProgressSchema.safeExtend({ kind: z26.literal("progress") }).strict(),
2827
+ z26.object({
2828
+ kind: z26.literal("accept"),
2829
+ rewards: z26.array(rewardSchema).max(10),
2490
2830
  completionKey: completionKeySchema.optional()
2491
2831
  }).strict(),
2492
- z24.object({
2493
- kind: z24.literal("reject"),
2494
- reason: z24.string().min(1).max(2e3),
2832
+ z26.object({
2833
+ kind: z26.literal("reject"),
2834
+ reason: z26.string().min(1).max(2e3),
2495
2835
  /** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
2496
- requestedReview: z24.literal(true).optional()
2836
+ requestedReview: z26.literal(true).optional()
2497
2837
  }).strict(),
2498
- z24.object({
2499
- kind: z24.literal("review"),
2500
- reason: z24.string().min(1).max(2e3),
2501
- rewards: z24.array(rewardSchema).max(10).optional(),
2838
+ z26.object({
2839
+ kind: z26.literal("review"),
2840
+ reason: z26.string().min(1).max(2e3),
2841
+ rewards: z26.array(rewardSchema).max(10).optional(),
2502
2842
  completionKey: completionKeySchema.optional()
2503
2843
  }).strict()
2504
2844
  ]);
2505
- var reviewModeSchema = z24.enum(["workers-ai"]);
2506
- var storedReviewModeSchema = z24.enum([
2845
+ var reviewModeSchema = z26.enum(["workers-ai"]);
2846
+ var storedReviewModeSchema = z26.enum([
2507
2847
  "fixture-pass",
2508
2848
  "fixture-fail",
2509
2849
  "fixture-unclear",
2510
2850
  "fixture-error",
2511
2851
  "workers-ai"
2512
2852
  ]);
2513
- var rewardBundleSchema = z24.array(rewardSchema).max(10).refine(
2853
+ var rewardBundleSchema = z26.array(rewardSchema).max(10).refine(
2514
2854
  (rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
2515
2855
  "Use one entry per balance or shared reward"
2516
2856
  );
2517
- var mediaUrlSchema = z24.string().max(2e3).refine((value) => {
2857
+ var mediaUrlSchema = z26.string().max(2e3).refine((value) => {
2518
2858
  if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
2519
2859
  return true;
2520
2860
  }
@@ -2524,56 +2864,83 @@ var mediaUrlSchema = z24.string().max(2e3).refine((value) => {
2524
2864
  return false;
2525
2865
  }
2526
2866
  }, "Use an HTTPS URL or a same-site path beginning with /");
2527
- var questPresentationSchema = z24.object({
2867
+ var questStepActionSchema = z26.discriminatedUnion("kind", [
2868
+ z26.object({
2869
+ kind: z26.literal("link"),
2870
+ url: mediaUrlSchema.refine(
2871
+ (value) => value.startsWith("https://"),
2872
+ "Use an HTTPS URL"
2873
+ ),
2874
+ label: z26.string().trim().min(1).max(120)
2875
+ }).strict()
2876
+ ]);
2877
+ var questStepSchema = z26.object({
2878
+ title: z26.string().trim().min(1).max(120),
2879
+ description: z26.string().max(4e3).optional(),
2880
+ action: questStepActionSchema.optional()
2881
+ }).strict();
2882
+ var questPresentationRequirementSchema = z26.discriminatedUnion("kind", [
2883
+ z26.object({ kind: z26.literal("account"), provider: authProviderSchema }).strict(),
2884
+ z26.object({ kind: z26.literal("wallet"), chain: walletChainSchema.optional() }).strict()
2885
+ ]);
2886
+ var questPresentationContentSchema = z26.object({
2887
+ steps: z26.array(questStepSchema).max(30).optional(),
2888
+ image: mediaUrlSchema.optional(),
2889
+ imageAlt: z26.string().max(500).optional(),
2890
+ requirements: z26.array(questPresentationRequirementSchema).max(10).optional()
2891
+ }).strict();
2892
+ var questPresentationSchema = questPresentationContentSchema.extend({
2528
2893
  quiz: quizQuestionsSchema.optional(),
2529
- instructions: z24.string().max(4e3).optional(),
2530
- video: z24.object({
2894
+ instructions: z26.string().max(4e3).optional(),
2895
+ video: z26.object({
2531
2896
  url: mediaUrlSchema,
2532
2897
  poster: mediaUrlSchema.optional(),
2533
- captions: z24.object({
2898
+ captions: z26.object({
2534
2899
  url: mediaUrlSchema,
2535
- language: z24.string().min(2).max(20),
2536
- label: z24.string().min(1).max(80)
2900
+ language: z26.string().min(2).max(20),
2901
+ label: z26.string().min(1).max(80)
2537
2902
  }).strict().optional()
2538
2903
  }).strict().optional()
2539
2904
  }).strict();
2540
- var questProfileSchema = z24.object({ visible: z24.boolean() }).strict();
2905
+ var questProfileSchema = z26.object({ visible: z26.boolean() }).strict();
2541
2906
  var evaluatorProtocol = 2;
2542
- var evaluatorProtocolSchema = z24.literal(evaluatorProtocol);
2543
- var questDescriptionSchema = z24.object({
2907
+ var evaluatorProtocolSchema = z26.literal(evaluatorProtocol);
2908
+ var questDescriptionSchema = z26.object({
2544
2909
  quest: identifier,
2545
2910
  evaluatorProtocol: evaluatorProtocolSchema,
2546
- title: z24.string().min(1).max(120),
2911
+ title: z26.string().min(1).max(120),
2547
2912
  presentation: questPresentationSchema.default({}),
2548
- integrations: z24.array(evaluatorIntegrationProviderSchema).max(10).default([]),
2913
+ integrations: z26.array(evaluatorIntegrationProviderSchema).max(10).default([]),
2549
2914
  fields: settingsFieldsSchema,
2550
2915
  values: settingsValuesSchema,
2551
2916
  rewards: rewardBundleSchema,
2552
- humanReview: z24.boolean(),
2917
+ humanReview: z26.boolean(),
2553
2918
  trigger: triggerSchema,
2554
2919
  performance: contentPerformancePolicySchema.optional(),
2555
- requires: z24.array(prerequisiteSchema).max(30).default([]),
2920
+ requires: z26.array(prerequisiteSchema).max(30).default([]),
2556
2921
  campaign: campaignDefinitionSchema.optional(),
2557
2922
  availability: availabilityWindowSchema.optional(),
2558
- completion: z24.preprocess(refuseStreakTimeZone, completionPolicySchema),
2559
- visibility: z24.enum(["visible", "hidden"]).default("visible"),
2923
+ completion: z26.preprocess(refuseStreakTimeZone, completionPolicySchema),
2924
+ visibility: z26.enum(["visible", "hidden"]).default("visible"),
2560
2925
  /** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
2561
2926
  profile: questProfileSchema.default({ visible: false }),
2562
- budgets: z24.array(budgetSchema).max(20).default([])
2927
+ budgets: z26.array(budgetSchema).max(20).default([])
2563
2928
  }).strict();
2564
- var artifactSchema = z24.object({ code: z24.string().min(1).max(1e6) }).strict();
2929
+ var artifactSchema = z26.object({ code: z26.string().min(1).max(1e6) }).strict();
2565
2930
  var releaseSchema = artifactSchema.extend({
2566
2931
  settings: settingsValuesSchema,
2567
2932
  provider: reviewModeSchema,
2568
2933
  expectedRelease: identifier.nullable().optional(),
2569
- settingRenames: z24.record(z24.string(), z24.string()).optional()
2934
+ settingRenames: z26.record(z26.string(), z26.string()).optional()
2570
2935
  }).strict();
2571
- var batchReleaseSchema = z24.object({ releases: z24.array(releaseSchema).min(1).max(50) }).strict();
2572
- var questSettingsInputSchema = z24.object({
2936
+ var batchReleaseSchema = z26.object({ releases: z26.array(releaseSchema).min(1).max(50) }).strict();
2937
+ var questSettingsInputSchema = z26.object({
2573
2938
  quest: identifier,
2574
2939
  expectedRelease: identifier,
2575
2940
  set: settingsValuesSchema,
2576
- reset: z24.array(z24.string())
2941
+ reset: z26.array(z26.string()),
2942
+ /** Replace the editable presentation fields; null restores the code defaults. */
2943
+ presentation: questPresentationContentSchema.nullable().optional()
2577
2944
  }).strict();
2578
2945
  var storedQuestDescriptionSchema = questDescriptionSchema.extend({
2579
2946
  completion: completionPolicySchema
@@ -2581,24 +2948,26 @@ var storedQuestDescriptionSchema = questDescriptionSchema.extend({
2581
2948
  var publishedReleaseSchema = responseShape(
2582
2949
  storedQuestDescriptionSchema.extend({
2583
2950
  key: identifier.optional(),
2584
- code: z24.string(),
2951
+ code: z26.string(),
2585
2952
  provider: storedReviewModeSchema,
2586
2953
  id: identifier,
2587
- createdAt: z24.number(),
2588
- origin: z24.object({ typeVersion: identifier }).strict().optional(),
2589
- lifecycle: z24.enum(["active", "paused", "archived"]).default("active"),
2590
- configuration: z24.object({
2954
+ createdAt: z26.number(),
2955
+ origin: z26.object({ typeVersion: identifier }).strict().optional(),
2956
+ lifecycle: z26.enum(["active", "paused", "archived"]).default("active"),
2957
+ configuration: z26.object({
2591
2958
  defaults: settingsValuesSchema,
2592
2959
  overrides: settingsValuesSchema,
2593
- preserved: z24.array(z24.string())
2960
+ preserved: z26.array(z26.string()),
2961
+ presentation: questPresentationContentSchema.optional(),
2962
+ presentationDefaults: questPresentationContentSchema.optional()
2594
2963
  }).strict().optional()
2595
2964
  })
2596
2965
  );
2597
- var templateSchema = z24.object({
2598
- code: z24.string(),
2966
+ var templateSchema = z26.object({
2967
+ code: z26.string(),
2599
2968
  definition: questDescriptionSchema
2600
2969
  });
2601
- var quizAnswersSchema = z24.record(identifier, identifier).refine(
2970
+ var quizAnswersSchema = z26.record(identifier, identifier).refine(
2602
2971
  (answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
2603
2972
  "Provide between 1 and 50 answers"
2604
2973
  ).transform(
@@ -2606,17 +2975,17 @@ var quizAnswersSchema = z24.record(identifier, identifier).refine(
2606
2975
  Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
2607
2976
  )
2608
2977
  );
2609
- var quizEvidenceSchema = z24.object({
2610
- kind: z24.literal("quiz"),
2978
+ var quizEvidenceSchema = z26.object({
2979
+ kind: z26.literal("quiz"),
2611
2980
  release: identifier.optional(),
2612
2981
  answers: quizAnswersSchema
2613
2982
  }).strict();
2614
- var submissionEvidenceSchema = z24.union([
2983
+ var submissionEvidenceSchema = z26.union([
2615
2984
  quizEvidenceSchema,
2616
2985
  textEvidenceSchema,
2617
2986
  urlEvidenceSchema
2618
2987
  ]);
2619
- var submitSchema = z24.object({
2988
+ var submitSchema = z26.object({
2620
2989
  actionId: identifier,
2621
2990
  quest: identifier,
2622
2991
  member: identifier,
@@ -2624,7 +2993,7 @@ var submitSchema = z24.object({
2624
2993
  input: submissionEvidenceSchema.optional(),
2625
2994
  release: identifier.optional(),
2626
2995
  /** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
2627
- faultAfterReview: z24.boolean().optional()
2996
+ faultAfterReview: z26.boolean().optional()
2628
2997
  }).strict();
2629
2998
  var AttemptStatus = {
2630
2999
  Queued: "queued",
@@ -2636,8 +3005,8 @@ var AttemptStatus = {
2636
3005
  NeedsReview: "needs-review",
2637
3006
  Failed: "failed"
2638
3007
  };
2639
- var attemptStatusSchema = z24.string();
2640
- var attemptSchema = z24.object({
3008
+ var attemptStatusSchema = z26.string();
3009
+ var attemptSchema = z26.object({
2641
3010
  id: identifier,
2642
3011
  release: identifier,
2643
3012
  quest: identifier,
@@ -2645,83 +3014,83 @@ var attemptSchema = z24.object({
2645
3014
  evidence: identifier.nullable(),
2646
3015
  input: submissionEvidenceSchema.optional(),
2647
3016
  status: attemptStatusSchema,
2648
- reason: z24.string().nullable(),
2649
- retries: z24.number(),
2650
- generation: z24.number(),
2651
- completion: z24.string().nullable(),
3017
+ reason: z26.string().nullable(),
3018
+ retries: z26.number(),
3019
+ generation: z26.number(),
3020
+ completion: z26.string().nullable(),
2652
3021
  reviewRewards: rewardBundleSchema.nullable().default(null),
2653
3022
  /** Scheduled reruns advance this number; failure retries preserve it. */
2654
- evaluationRun: z24.number().int().nonnegative().default(0),
2655
- deferCount: z24.number().int().nonnegative().default(0),
2656
- deferUntil: z24.number().int().safe().nullable().default(null),
2657
- nextEvaluationAt: z24.number().int().safe().nullable().default(null),
3023
+ evaluationRun: z26.number().int().nonnegative().default(0),
3024
+ deferCount: z26.number().int().nonnegative().default(0),
3025
+ deferUntil: z26.number().int().safe().nullable().default(null),
3026
+ nextEvaluationAt: z26.number().int().safe().nullable().default(null),
2658
3027
  /** Open code: consumers must tolerate new values. */
2659
- code: z24.string().nullable().default(null),
3028
+ code: z26.string().nullable().default(null),
2660
3029
  progress: evaluatorProgressSchema.nullable().default(null),
2661
3030
  /**
2662
3031
  * The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
2663
3032
  * with the evaluator's reason. Only set on a rejected attempt.
2664
3033
  */
2665
- requestedReview: z24.boolean().default(false),
2666
- createdAt: z24.number()
2667
- });
2668
- var eventSchema = z24.object({
2669
- id: z24.number(),
2670
- attempt: z24.string().nullable(),
2671
- kind: z24.string(),
2672
- detail: z24.string(),
2673
- actor: z24.string().nullable().default(null),
2674
- at: z24.number()
2675
- });
2676
- var pickupSelectionSchema = z24.object({
3034
+ requestedReview: z26.boolean().default(false),
3035
+ createdAt: z26.number()
3036
+ });
3037
+ var eventSchema = z26.object({
3038
+ id: z26.number(),
3039
+ attempt: z26.string().nullable(),
3040
+ kind: z26.string(),
3041
+ detail: z26.string(),
3042
+ actor: z26.string().nullable().default(null),
3043
+ at: z26.number()
3044
+ });
3045
+ var pickupSelectionSchema = z26.object({
2677
3046
  item: identifier,
2678
- revision: z24.number().int().nonnegative()
3047
+ revision: z26.number().int().nonnegative()
2679
3048
  }).strict();
2680
- var pickupAllocationSchema = z24.object({
3049
+ var pickupAllocationSchema = z26.object({
2681
3050
  item: identifier,
2682
- label: z24.string().min(1).max(80)
3051
+ label: z26.string().min(1).max(80)
2683
3052
  }).strict();
2684
- var pickupPolicySchema = z24.discriminatedUnion("kind", [
2685
- z24.object({ kind: z24.literal("untracked") }).strict(),
2686
- z24.object({
2687
- kind: z24.literal("at-pickup"),
2688
- tiers: z24.array(
2689
- z24.object({
3053
+ var pickupPolicySchema = z26.discriminatedUnion("kind", [
3054
+ z26.object({ kind: z26.literal("untracked") }).strict(),
3055
+ z26.object({
3056
+ kind: z26.literal("at-pickup"),
3057
+ tiers: z26.array(
3058
+ z26.object({
2690
3059
  tier: identifier,
2691
- variants: z24.array(pickupAllocationSchema).min(1).max(100)
3060
+ variants: z26.array(pickupAllocationSchema).min(1).max(100)
2692
3061
  }).strict()
2693
3062
  ).min(1).max(100)
2694
3063
  }).strict()
2695
3064
  ]);
2696
- var pickupCatalogSchema = z24.object({
3065
+ var pickupCatalogSchema = z26.object({
2697
3066
  reward: tieredRewardDefinitionSchema,
2698
- revision: z24.number().int().nonnegative(),
3067
+ revision: z26.number().int().nonnegative(),
2699
3068
  policy: pickupPolicySchema
2700
3069
  });
2701
- var pickupAvailabilitySchema = z24.discriminatedUnion("kind", [
2702
- z24.object({ kind: z24.literal("untracked") }).strict(),
2703
- z24.object({
2704
- kind: z24.literal("at-pickup"),
2705
- revision: z24.number().int().nonnegative(),
2706
- variants: z24.array(
3070
+ var pickupAvailabilitySchema = z26.discriminatedUnion("kind", [
3071
+ z26.object({ kind: z26.literal("untracked") }).strict(),
3072
+ z26.object({
3073
+ kind: z26.literal("at-pickup"),
3074
+ revision: z26.number().int().nonnegative(),
3075
+ variants: z26.array(
2707
3076
  pickupAllocationSchema.extend({
2708
- available: z24.number().int().nonnegative()
3077
+ available: z26.number().int().nonnegative()
2709
3078
  })
2710
3079
  )
2711
3080
  }).strict()
2712
3081
  ]);
2713
- var configurePickupSchema = z24.object({
3082
+ var configurePickupSchema = z26.object({
2714
3083
  reward: identifier,
2715
- revision: z24.number().int().nonnegative(),
3084
+ revision: z26.number().int().nonnegative(),
2716
3085
  actionId: identifier,
2717
- policy: z24.discriminatedUnion("kind", [
2718
- z24.object({ kind: z24.literal("untracked") }).strict(),
2719
- z24.object({
2720
- kind: z24.literal("at-pickup"),
2721
- tiers: z24.array(
2722
- z24.object({
3086
+ policy: z26.discriminatedUnion("kind", [
3087
+ z26.object({ kind: z26.literal("untracked") }).strict(),
3088
+ z26.object({
3089
+ kind: z26.literal("at-pickup"),
3090
+ tiers: z26.array(
3091
+ z26.object({
2723
3092
  tier: identifier,
2724
- variants: z24.array(
3093
+ variants: z26.array(
2725
3094
  pickupAllocationSchema.extend({
2726
3095
  item: identifier.optional()
2727
3096
  })
@@ -2731,10 +3100,10 @@ var configurePickupSchema = z24.object({
2731
3100
  }).strict()
2732
3101
  ])
2733
3102
  }).strict();
2734
- var entitlementRecoverySchema = z24.object({
3103
+ var entitlementRecoverySchema = z26.object({
2735
3104
  completion: identifier,
2736
- reason: z24.string(),
2737
- flaggedAt: z24.number(),
3105
+ reason: z26.string(),
3106
+ flaggedAt: z26.number(),
2738
3107
  /** Null means no accepted completion currently earns this reward. */
2739
3108
  remainingTier: identifier.nullable()
2740
3109
  });
@@ -2744,40 +3113,40 @@ var entitlementBase = {
2744
3113
  reward: tieredRewardDefinitionSchema,
2745
3114
  earnedTier: identifier,
2746
3115
  tier: identifier,
2747
- revision: z24.number().int().positive()
3116
+ revision: z26.number().int().positive()
2748
3117
  };
2749
- var entitlementStateSchema = z24.discriminatedUnion("status", [
2750
- z24.object({ ...entitlementBase, status: z24.literal("available") }).strict(),
2751
- z24.object({
3118
+ var entitlementStateSchema = z26.discriminatedUnion("status", [
3119
+ z26.object({ ...entitlementBase, status: z26.literal("available") }).strict(),
3120
+ z26.object({
2752
3121
  ...entitlementBase,
2753
- status: z24.literal("handing-over"),
3122
+ status: z26.literal("handing-over"),
2754
3123
  handover: identifier,
2755
- startedAt: z24.number(),
3124
+ startedAt: z26.number(),
2756
3125
  allocation: pickupAllocationSchema.optional()
2757
3126
  }).strict(),
2758
- z24.object({
3127
+ z26.object({
2759
3128
  ...entitlementBase,
2760
- status: z24.literal("collected"),
3129
+ status: z26.literal("collected"),
2761
3130
  handover: identifier,
2762
- startedAt: z24.number(),
3131
+ startedAt: z26.number(),
2763
3132
  allocation: pickupAllocationSchema.optional(),
2764
- collectedAt: z24.number(),
3133
+ collectedAt: z26.number(),
2765
3134
  recovery: entitlementRecoverySchema.optional()
2766
3135
  }).strict(),
2767
3136
  // An operator voided it: it can no longer be handed over. A quest grant of the same reward to
2768
3137
  // the member (the same grant key) makes it available again; a voided referral reward stays void.
2769
- z24.object({
3138
+ z26.object({
2770
3139
  ...entitlementBase,
2771
- status: z24.literal("void"),
2772
- voidedAt: z24.number()
3140
+ status: z26.literal("void"),
3141
+ voidedAt: z26.number()
2773
3142
  }).strict()
2774
3143
  ]);
2775
- var tieredRewardReadSchema = z24.object({
3144
+ var tieredRewardReadSchema = z26.object({
2776
3145
  id: identifier,
2777
- title: z24.string(),
2778
- tiers: z24.array(z24.object({ id: identifier, title: z24.string() }).loose()),
2779
- inventory: z24.object({ kind: z24.string() }).loose(),
2780
- fulfillment: z24.object({ kind: z24.string() }).loose()
3146
+ title: z26.string(),
3147
+ tiers: z26.array(z26.object({ id: identifier, title: z26.string() }).loose()),
3148
+ inventory: z26.object({ kind: z26.string() }).loose(),
3149
+ fulfillment: z26.object({ kind: z26.string() }).loose()
2781
3150
  }).loose();
2782
3151
  var entitlementReadBase = {
2783
3152
  id: identifier,
@@ -2785,63 +3154,63 @@ var entitlementReadBase = {
2785
3154
  reward: tieredRewardReadSchema,
2786
3155
  earnedTier: identifier,
2787
3156
  tier: identifier,
2788
- revision: z24.number().int()
3157
+ revision: z26.number().int()
2789
3158
  };
2790
- var allocationReadSchema = z24.object({ item: identifier, label: z24.string() }).loose();
2791
- var entitlementSchema = z24.union([
2792
- z24.discriminatedUnion("status", [
2793
- z24.object({ ...entitlementReadBase, status: z24.literal("available") }).loose(),
2794
- z24.object({
3159
+ var allocationReadSchema = z26.object({ item: identifier, label: z26.string() }).loose();
3160
+ var entitlementSchema = z26.union([
3161
+ z26.discriminatedUnion("status", [
3162
+ z26.object({ ...entitlementReadBase, status: z26.literal("available") }).loose(),
3163
+ z26.object({
2795
3164
  ...entitlementReadBase,
2796
- status: z24.literal("handing-over"),
3165
+ status: z26.literal("handing-over"),
2797
3166
  handover: identifier,
2798
- startedAt: z24.number(),
3167
+ startedAt: z26.number(),
2799
3168
  allocation: allocationReadSchema.optional()
2800
3169
  }).loose(),
2801
- z24.object({
3170
+ z26.object({
2802
3171
  ...entitlementReadBase,
2803
- status: z24.literal("collected"),
3172
+ status: z26.literal("collected"),
2804
3173
  handover: identifier,
2805
- startedAt: z24.number(),
3174
+ startedAt: z26.number(),
2806
3175
  allocation: allocationReadSchema.optional(),
2807
- collectedAt: z24.number(),
3176
+ collectedAt: z26.number(),
2808
3177
  recovery: entitlementRecoverySchema.optional()
2809
3178
  }).loose(),
2810
- z24.object({
3179
+ z26.object({
2811
3180
  ...entitlementReadBase,
2812
- status: z24.literal("void"),
2813
- voidedAt: z24.number()
3181
+ status: z26.literal("void"),
3182
+ voidedAt: z26.number()
2814
3183
  }).loose()
2815
3184
  ]),
2816
- z24.object({ ...entitlementReadBase, status: z24.string() }).loose().transform(({ status, ...entitlement }) => ({
3185
+ z26.object({ ...entitlementReadBase, status: z26.string() }).loose().transform(({ status, ...entitlement }) => ({
2817
3186
  ...entitlement,
2818
3187
  status: "unsupported",
2819
3188
  reportedStatus: status
2820
3189
  }))
2821
3190
  ]);
2822
- var beginHandoverSchema = z24.object({
3191
+ var beginHandoverSchema = z26.object({
2823
3192
  actionId: identifier,
2824
- revision: z24.number().int().positive(),
3193
+ revision: z26.number().int().positive(),
2825
3194
  selection: pickupSelectionSchema.optional()
2826
3195
  }).strict();
2827
- var confirmHandoverSchema = z24.object({ actionId: identifier, handover: identifier }).strict();
2828
- var entitlementCorrectionSchema = z24.object({
3196
+ var confirmHandoverSchema = z26.object({ actionId: identifier, handover: identifier }).strict();
3197
+ var entitlementCorrectionSchema = z26.object({
2829
3198
  actionId: identifier,
2830
- revision: z24.number().int().positive(),
2831
- reason: z24.string().trim().min(1).max(500)
3199
+ revision: z26.number().int().positive(),
3200
+ reason: z26.string().trim().min(1).max(500)
2832
3201
  }).strict();
2833
3202
  var CompletionSourceKind = {
2834
3203
  Quest: "quest",
2835
3204
  Leaderboard: "leaderboard"
2836
3205
  };
2837
- var completionSourceKindSchema = z24.string().min(1).max(64);
2838
- var completionSourceSchema = z24.object({
3206
+ var completionSourceKindSchema = z26.string().min(1).max(64);
3207
+ var completionSourceSchema = z26.object({
2839
3208
  kind: completionSourceKindSchema,
2840
3209
  id: identifier
2841
3210
  });
2842
- var completionRecordSchema = z24.object({
3211
+ var completionRecordSchema = z26.object({
2843
3212
  /** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
2844
- key: z24.string().default("once"),
3213
+ key: z26.string().default("once"),
2845
3214
  id: identifier,
2846
3215
  /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
2847
3216
  quest: identifier,
@@ -2849,19 +3218,19 @@ var completionRecordSchema = z24.object({
2849
3218
  /** What paid the completion. `source.id` repeats `quest`. */
2850
3219
  source: completionSourceSchema.optional()
2851
3220
  });
2852
- var questAvailabilitySchema = z24.discriminatedUnion("kind", [
2853
- z24.object({
2854
- kind: z24.literal("available"),
2855
- input: z24.enum(["photo", "quiz", "none", "text", "url"])
3221
+ var questAvailabilitySchema = z26.discriminatedUnion("kind", [
3222
+ z26.object({
3223
+ kind: z26.literal("available"),
3224
+ input: z26.enum(["photo", "quiz", "none", "text", "url"])
2856
3225
  }).strict(),
2857
- z24.object({ kind: z24.literal("completed") }).strict(),
2858
- z24.object({
2859
- kind: z24.literal("locked"),
2860
- missing: z24.array(missingPrerequisiteSchema).min(1)
3226
+ z26.object({ kind: z26.literal("completed") }).strict(),
3227
+ z26.object({
3228
+ kind: z26.literal("locked"),
3229
+ missing: z26.array(missingPrerequisiteSchema).min(1)
2861
3230
  }).strict(),
2862
- z24.object({
2863
- kind: z24.literal("blocked"),
2864
- reason: z24.enum([
3231
+ z26.object({
3232
+ kind: z26.literal("blocked"),
3233
+ reason: z26.enum([
2865
3234
  "budget-exhausted",
2866
3235
  "connection-required",
2867
3236
  "wallet-required",
@@ -2870,144 +3239,144 @@ var questAvailabilitySchema = z24.discriminatedUnion("kind", [
2870
3239
  "enrollment-required"
2871
3240
  ]),
2872
3241
  /** Which window refused admission when `reason` is `outside-window`. */
2873
- window: z24.enum(["tracker", "quest"]).optional(),
2874
- resetsAt: z24.number().int().safe().optional()
3242
+ window: z26.enum(["tracker", "quest"]).optional(),
3243
+ resetsAt: z26.number().int().safe().optional()
2875
3244
  }).strict(),
2876
- z24.object({ kind: z24.literal("staff-required") }).strict(),
2877
- z24.object({ kind: z24.literal("automatic") }).strict(),
2878
- z24.object({ kind: z24.literal("checking"), attempt: identifier }).strict(),
2879
- z24.object({ kind: z24.literal("needs-review"), attempt: identifier }).strict(),
2880
- z24.object({ kind: z24.literal("retryable"), attempt: identifier }).strict()
3245
+ z26.object({ kind: z26.literal("staff-required") }).strict(),
3246
+ z26.object({ kind: z26.literal("automatic") }).strict(),
3247
+ z26.object({ kind: z26.literal("checking"), attempt: identifier }).strict(),
3248
+ z26.object({ kind: z26.literal("needs-review"), attempt: identifier }).strict(),
3249
+ z26.object({ kind: z26.literal("retryable"), attempt: identifier }).strict()
2881
3250
  ]);
2882
- var questAvailabilityResponseSchema = z24.union(
3251
+ var questAvailabilityResponseSchema = z26.union(
2883
3252
  questAvailabilitySchema.options.map((option) => option.strip())
2884
3253
  );
2885
- var questBudgetViewSchema = z24.object({
3254
+ var questBudgetViewSchema = z26.object({
2886
3255
  id: identifier,
2887
- scope: z24.enum(["member", "project"]),
2888
- period: z24.enum(["day", "week", "month", "lifetime"]),
2889
- remaining: z24.number().int().safe().nonnegative(),
2890
- resetsAt: z24.number().int().safe().nullable()
3256
+ scope: z26.enum(["member", "project"]),
3257
+ period: z26.enum(["day", "week", "month", "lifetime"]),
3258
+ remaining: z26.number().int().safe().nonnegative(),
3259
+ resetsAt: z26.number().int().safe().nullable()
2891
3260
  });
2892
3261
  var memberProgressSchema = responseShape(
2893
- z24.object({
3262
+ z26.object({
2894
3263
  member: identifier,
2895
- quests: z24.array(
2896
- z24.object({
3264
+ quests: z26.array(
3265
+ z26.object({
2897
3266
  quest: identifier,
2898
3267
  key: identifier.optional(),
2899
3268
  release: identifier.optional(),
2900
- title: z24.string(),
3269
+ title: z26.string(),
2901
3270
  presentation: questPresentationSchema.default({}),
2902
- connections: z24.array(authProviderSchema).default([]),
3271
+ connections: z26.array(authProviderSchema).default([]),
2903
3272
  trigger: triggerResponseSchema,
2904
3273
  availability: questAvailabilityResponseSchema,
2905
- completed: z24.boolean(),
3274
+ completed: z26.boolean(),
2906
3275
  completion: completionPolicySchema.default({ kind: "once" }),
2907
3276
  streak: streakProgressSchema.nullable().optional(),
2908
3277
  counter: counterProgressSchema.nullable().optional(),
2909
3278
  /** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
2910
3279
  progress: evaluatorProgressSchema.nullable().default(null),
2911
- completionCount: z24.number().int().nonnegative().default(0),
2912
- visibility: z24.enum(["visible", "hidden"]).default("visible"),
2913
- missing: z24.array(missingPrerequisiteSchema),
3280
+ completionCount: z26.number().int().nonnegative().default(0),
3281
+ visibility: z26.enum(["visible", "hidden"]).default("visible"),
3282
+ missing: z26.array(missingPrerequisiteSchema),
2914
3283
  campaign: campaignViewSchema.nullable().default(null),
2915
3284
  window: availabilityWindowSchema.nullable().default(null),
2916
- budgets: z24.array(questBudgetViewSchema).default([]),
3285
+ budgets: z26.array(questBudgetViewSchema).default([]),
2917
3286
  attempt: attemptSchema.nullable()
2918
3287
  })
2919
3288
  ),
2920
- entitlements: z24.array(entitlementSchema)
3289
+ entitlements: z26.array(entitlementSchema)
2921
3290
  })
2922
3291
  );
2923
3292
  var snapshotSchema = responseShape(
2924
- z24.object({
2925
- releases: z24.array(publishedReleaseSchema),
2926
- completions: z24.array(completionRecordSchema),
2927
- entitlements: z24.array(entitlementSchema),
2928
- attempts: z24.array(attemptSchema),
2929
- balances: z24.array(
2930
- z24.object({
2931
- member: z24.string(),
2932
- balance: z24.string(),
2933
- earned: z24.number(),
2934
- held: z24.number(),
2935
- available: z24.number()
3293
+ z26.object({
3294
+ releases: z26.array(publishedReleaseSchema),
3295
+ completions: z26.array(completionRecordSchema),
3296
+ entitlements: z26.array(entitlementSchema),
3297
+ attempts: z26.array(attemptSchema),
3298
+ balances: z26.array(
3299
+ z26.object({
3300
+ member: z26.string(),
3301
+ balance: z26.string(),
3302
+ earned: z26.number(),
3303
+ held: z26.number(),
3304
+ available: z26.number()
2936
3305
  })
2937
3306
  ),
2938
- events: z24.array(eventSchema)
3307
+ events: z26.array(eventSchema)
2939
3308
  })
2940
3309
  );
2941
- var evidenceSchema = z24.object({
3310
+ var evidenceSchema = z26.object({
2942
3311
  id: identifier,
2943
3312
  member: identifier,
2944
- type: z24.enum(["image/jpeg", "image/png"]),
2945
- size: z24.number()
3313
+ type: z26.enum(["image/jpeg", "image/png"]),
3314
+ size: z26.number()
2946
3315
  });
2947
- var errorSchema = z24.object({
2948
- error: z24.string(),
2949
- code: z24.string().optional(),
3316
+ var errorSchema = z26.object({
3317
+ error: z26.string(),
3318
+ code: z26.string().optional(),
2950
3319
  /** Which window refused admission when `code` is `outside-window`. */
2951
- window: z24.enum(["tracker", "quest"]).optional(),
2952
- missing: z24.array(missingPrerequisiteSchema).optional()
3320
+ window: z26.enum(["tracker", "quest"]).optional(),
3321
+ missing: z26.array(missingPrerequisiteSchema).optional()
2953
3322
  });
2954
- var staffDecisionSchema = z24.object({
3323
+ var staffDecisionSchema = z26.object({
2955
3324
  actionId: identifier,
2956
- generation: z24.number().int().nonnegative(),
2957
- decision: z24.enum(["accept", "reject"]),
2958
- reason: z24.string().trim().min(1).max(2e3)
3325
+ generation: z26.number().int().nonnegative(),
3326
+ decision: z26.enum(["accept", "reject"]),
3327
+ reason: z26.string().trim().min(1).max(2e3)
2959
3328
  }).strict();
2960
- var stockSchema = z24.object({ item: identifier, quantity: z24.number().int().min(0).max(1e4) }).strict();
2961
- var reservationSchema = z24.object({
3329
+ var stockSchema = z26.object({ item: identifier, quantity: z26.number().int().min(0).max(1e4) }).strict();
3330
+ var reservationSchema = z26.object({
2962
3331
  actionId: identifier,
2963
3332
  member: identifier,
2964
3333
  item: identifier,
2965
3334
  balance: identifier,
2966
- price: z24.number().int().positive().max(1e4)
3335
+ price: z26.number().int().positive().max(1e4)
2967
3336
  }).strict();
2968
3337
  var pageOptions = {
2969
- limit: z24.number().int().min(1).max(100).default(25),
2970
- cursor: z24.string().min(1).max(4096).optional()
3338
+ limit: z26.number().int().min(1).max(100).default(25),
3339
+ cursor: z26.string().min(1).max(4096).optional()
2971
3340
  };
2972
- var reviewListSchema = z24.object({
3341
+ var reviewListSchema = z26.object({
2973
3342
  ...pageOptions,
2974
3343
  member: identifier.optional(),
2975
3344
  quest: identifier.optional()
2976
3345
  }).strict();
2977
- var memberListSchema = z24.object({
3346
+ var memberListSchema = z26.object({
2978
3347
  ...pageOptions,
2979
3348
  prefix: identifier.optional()
2980
3349
  }).strict();
2981
- var reviewItemSchema = z24.object({
3350
+ var reviewItemSchema = z26.object({
2982
3351
  attempt: attemptSchema,
2983
- title: z24.string(),
2984
- checks: z24.array(
2985
- z24.object({ criteria: z24.string(), result: photoResultSchema })
3352
+ title: z26.string(),
3353
+ checks: z26.array(
3354
+ z26.object({ criteria: z26.string(), result: photoResultSchema })
2986
3355
  )
2987
3356
  });
2988
- var reviewPageSchema = z24.object({
2989
- items: z24.array(reviewItemSchema).max(100),
2990
- nextCursor: z24.string().nullable()
3357
+ var reviewPageSchema = z26.object({
3358
+ items: z26.array(reviewItemSchema).max(100),
3359
+ nextCursor: z26.string().nullable()
2991
3360
  });
2992
- var memberPageSchema = z24.object({
2993
- items: z24.array(z24.object({ member: identifier })).max(100),
2994
- nextCursor: z24.string().nullable()
3361
+ var memberPageSchema = z26.object({
3362
+ items: z26.array(z26.object({ member: identifier })).max(100),
3363
+ nextCursor: z26.string().nullable()
2995
3364
  });
2996
- var createStockItemSchema = z24.object({ actionId: identifier, name: z24.string().trim().min(1).max(80) }).strict();
2997
- var stockItemSchema = z24.object({ id: identifier, name: z24.string() });
2998
- var contentPerformanceSnapshotSchema = z24.strictObject({
3365
+ var createStockItemSchema = z26.object({ actionId: identifier, name: z26.string().trim().min(1).max(80) }).strict();
3366
+ var stockItemSchema = z26.object({ id: identifier, name: z26.string() });
3367
+ var contentPerformanceSnapshotSchema = z26.strictObject({
2999
3368
  contentAttempt: identifier,
3000
3369
  observation: identifier,
3001
- observedAt: z24.number().int().safe().nonnegative(),
3370
+ observedAt: z26.number().int().safe().nonnegative(),
3002
3371
  metrics: contentMetricsSchema,
3003
3372
  rewards: rewardBundleSchema
3004
3373
  });
3005
3374
  var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
3006
- content: z24.string().min(1).max(256)
3375
+ content: z26.string().min(1).max(256)
3007
3376
  });
3008
- var contentPerformancePageSchema = z24.strictObject({
3009
- current: z24.strictObject({
3010
- state: z24.enum([
3377
+ var contentPerformancePageSchema = z26.strictObject({
3378
+ current: z26.strictObject({
3379
+ state: z26.enum([
3011
3380
  "content-pending",
3012
3381
  "content-unqualified",
3013
3382
  "waiting",
@@ -3018,19 +3387,19 @@ var contentPerformancePageSchema = z24.strictObject({
3018
3387
  "failed",
3019
3388
  "superseded"
3020
3389
  ]),
3021
- reason: z24.string().nullable(),
3390
+ reason: z26.string().nullable(),
3022
3391
  contentAttempt: identifier,
3023
3392
  attempt: identifier.nullable(),
3024
3393
  reward: contentQualificationSchema.shape.reward
3025
3394
  }),
3026
- items: z24.array(
3027
- z24.strictObject({
3395
+ items: z26.array(
3396
+ z26.strictObject({
3028
3397
  attempt: identifier,
3029
3398
  contentAttempt: identifier,
3030
3399
  observation: identifier,
3031
- observedAt: z24.number(),
3400
+ observedAt: z26.number(),
3032
3401
  metrics: contentMetricsSchema,
3033
- state: z24.enum([
3402
+ state: z26.enum([
3034
3403
  "pending",
3035
3404
  "qualified",
3036
3405
  "unqualified",
@@ -3038,13 +3407,22 @@ var contentPerformancePageSchema = z24.strictObject({
3038
3407
  "failed",
3039
3408
  "superseded"
3040
3409
  ]),
3041
- reason: z24.string().nullable()
3410
+ reason: z26.string().nullable()
3042
3411
  })
3043
3412
  ),
3044
3413
  nextCursor: pageCursorSchema.nullable()
3045
3414
  });
3046
3415
 
3047
3416
  export {
3417
+ isRequestError,
3418
+ RequestError,
3419
+ RelayErrorCode,
3420
+ isRelayError,
3421
+ RelayError,
3422
+ asRelayError,
3423
+ clientError,
3424
+ parseInput,
3425
+ identifier,
3048
3426
  markResponseSchema,
3049
3427
  lazyResponseReaders,
3050
3428
  responseShape,
@@ -3059,7 +3437,6 @@ export {
3059
3437
  discordMemberInputSchema,
3060
3438
  discordMessageInputSchema,
3061
3439
  discordMemberSchema,
3062
- identifier,
3063
3440
  discordMessageSchema,
3064
3441
  discordMessagesSourceSchema,
3065
3442
  discordReactionsSourceSchema,
@@ -3182,6 +3559,29 @@ export {
3182
3559
  integrationProviderSchema,
3183
3560
  discordServerSchema,
3184
3561
  projectIntegrationSchema,
3562
+ solanaAddressSchema,
3563
+ walletChainSchema,
3564
+ cosmosNetworkSchema,
3565
+ cosmosDenomSchema,
3566
+ cosmosChain,
3567
+ solanaMainnet,
3568
+ evmAddressSchema,
3569
+ cosmosAddressSchema,
3570
+ walletAddressInputSchema,
3571
+ walletMessageChallengeSchema,
3572
+ walletSignatureSchema,
3573
+ linkedWalletSchema,
3574
+ walletUnlinkInputSchema,
3575
+ walletAddressInput,
3576
+ WALLETS_PER_CHAIN,
3577
+ walletSignInFamilies,
3578
+ walletSignInNetworkSchema,
3579
+ walletSignInNetworksSchema,
3580
+ walletSignInNetwork,
3581
+ caip10,
3582
+ isEvmChainId,
3583
+ evmChainIdSchema,
3584
+ walletBalanceSchema,
3185
3585
  textOptionsSchema,
3186
3586
  urlOptionsSchema,
3187
3587
  textEvidenceSchema,
@@ -3242,6 +3642,8 @@ export {
3242
3642
  tieredRewardDefinitionSchema,
3243
3643
  tieredRewardReferenceSchema,
3244
3644
  tierRewardSchema,
3645
+ badgeRewardSchema,
3646
+ badgeReward,
3245
3647
  integrationRewardSchema,
3246
3648
  rewardSchema,
3247
3649
  rewardKey,
@@ -3256,6 +3658,10 @@ export {
3256
3658
  storedReviewModeSchema,
3257
3659
  rewardBundleSchema,
3258
3660
  mediaUrlSchema,
3661
+ questStepActionSchema,
3662
+ questStepSchema,
3663
+ questPresentationRequirementSchema,
3664
+ questPresentationContentSchema,
3259
3665
  questPresentationSchema,
3260
3666
  questProfileSchema,
3261
3667
  evaluatorProtocol,