@domino-sdk/relay 1.62.0 → 1.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/dist/{accounts-CCqCKCVx.d.ts → accounts-_lNsiR2k.d.ts} +42 -4
  3. package/dist/{attempt-captures-Cm-5G0PC.d.ts → attempt-captures-BqPggxTU.d.ts} +1 -1
  4. package/dist/authoring.d.ts +54 -20
  5. package/dist/authoring.js +60 -31
  6. package/dist/{automatic-outcomes-pAsOyIVp.d.ts → automatic-outcomes-BzAvfcpd.d.ts} +11 -1
  7. package/dist/avatar.d.ts +1 -1
  8. package/dist/browser.d.ts +10 -10
  9. package/dist/browser.js +12 -13
  10. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  11. package/dist/{catalog--ZIlskAo.d.ts → catalog-ByZMRS7I.d.ts} +21 -10
  12. package/dist/{chunk-XNKSSE32.js → chunk-4NIV4NPV.js} +7 -7
  13. package/dist/chunk-7H4MRVQF.js +199 -0
  14. package/dist/{chunk-UPQPUJOU.js → chunk-CVQZ2YP7.js} +73 -202
  15. package/dist/{chunk-3PYYGFSB.js → chunk-DLABJSBO.js} +3 -3
  16. package/dist/{chunk-Y322OTCH.js → chunk-E22XSC4L.js} +1 -1
  17. package/dist/{chunk-E6IKQHTX.js → chunk-EDNKKVGU.js} +2 -2
  18. package/dist/{chunk-K2KS3JLY.js → chunk-EOUEAOWJ.js} +35 -4
  19. package/dist/{chunk-6WCIWXUV.js → chunk-EUEW2APU.js} +2 -2
  20. package/dist/{chunk-MK425RXJ.js → chunk-HNR6G3GV.js} +2335 -1538
  21. package/dist/{chunk-UW5232GG.js → chunk-KCUUHT2V.js} +5 -5
  22. package/dist/{chunk-CICDIBOF.js → chunk-MPTE7EIV.js} +76 -74
  23. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  24. package/dist/{chunk-GTDW453U.js → chunk-NG4GZ54I.js} +100 -114
  25. package/dist/chunk-R2KZFX6E.js +405 -0
  26. package/dist/{chunk-HTZHBTIL.js → chunk-RD3XJ4DH.js} +208 -376
  27. package/dist/{chunk-5TEYFX6X.js → chunk-SE7XHQFP.js} +2 -2
  28. package/dist/{chunk-CZFXGGEK.js → chunk-U66GUVSG.js} +2 -2
  29. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  30. package/dist/chunk-UZ765UGH.js +18 -0
  31. package/dist/{chunk-GKIFABGN.js → chunk-VBYOAT46.js} +100 -277
  32. package/dist/{chunk-QYPMPWVX.js → chunk-XVZ4YOF2.js} +43 -43
  33. package/dist/{chunk-3KLC4AMA.js → chunk-ZQ3IPCI6.js} +177 -176
  34. package/dist/chunk-ZXGBDLVB.js +1510 -0
  35. package/dist/{client-B-hbHX30.d.ts → client-D7IiwEq2.d.ts} +31 -62
  36. package/dist/{capability-error-DFMwSuSf.d.ts → dashboards-pVfclkyh.d.ts} +14 -294
  37. package/dist/{deployments-M4OHn7G3.d.ts → deployments-Cr1tfqrr.d.ts} +46 -3
  38. package/dist/{identity-integration-3mX6b5iH.d.ts → identity-integration-Ci2vGKtX.d.ts} +67 -2
  39. package/dist/index.d.ts +11 -11
  40. package/dist/index.js +11 -13
  41. package/dist/internal.d.ts +27 -13
  42. package/dist/internal.js +46 -13
  43. package/dist/{analytics-BwAKLi7O.d.ts → limits-pE04y9O2.d.ts} +131 -3
  44. package/dist/{offers-DhAtss4_.d.ts → offers-Hw2P6tcK.d.ts} +3 -2
  45. package/dist/{participant-activity-D-Drp24G.d.ts → participant-activity-DXRq4s6K.d.ts} +1 -0
  46. package/dist/portal-proxy.d.ts +21 -3
  47. package/dist/portal-proxy.js +72 -22
  48. package/dist/react/index.d.ts +29 -15
  49. package/dist/react/index.js +52 -29
  50. package/dist/{pages-B8q8Y_dQ.d.ts → reward-deliveries-BCV8hznc.d.ts} +300 -233
  51. package/dist/runtime/authoring.js +1 -1
  52. package/dist/runtime/chunks/6EBN6IZU.js +1 -0
  53. package/dist/runtime/manifest.json +3 -3
  54. package/dist/runtime/schema.js +1 -1
  55. package/dist/schema.d.ts +197 -19
  56. package/dist/schema.js +126 -124
  57. package/dist/server/index.d.ts +13 -13
  58. package/dist/server/index.js +5701 -6302
  59. package/dist/{sign-in-providers-BkjcDsFF.d.ts → sign-in-providers-BAkGjSXo.d.ts} +7 -2
  60. package/dist/{submission-input-DHGKhXfp.d.ts → submission-input-ChL1aYNH.d.ts} +3 -2
  61. package/dist/{telegram-browser-BCE7zdOb.d.ts → telegram-browser-K27t4TwM.d.ts} +5 -5
  62. package/dist/telegram.d.ts +9 -9
  63. package/dist/telegram.js +2 -2
  64. package/dist/testing.d.ts +229 -27
  65. package/dist/testing.js +146 -105
  66. package/dist/{tracker-data-Hb1uQnk5.d.ts → tracker-data-Bl-qPIvZ.d.ts} +37 -9
  67. package/dist/{transport-DkhX2Cbs.d.ts → transport-DC1m73Tp.d.ts} +40211 -37736
  68. package/dist/{wallet-DTO7SXj7.d.ts → wallet-B7e06v4m.d.ts} +14 -4
  69. package/package.json +1 -1
  70. package/dist/chunk-D26YNACF.js +0 -320
  71. package/dist/chunk-UAKYDVT3.js +0 -565
  72. package/dist/chunk-WSBYWVTZ.js +0 -717
  73. package/dist/chunk-XJFYAXET.js +0 -87
  74. package/dist/runtime/chunks/Y4OAVXFR.js +0 -1
@@ -0,0 +1,296 @@
1
+ import * as z from 'zod';
2
+
3
+ declare const completionPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ kind: z.ZodLiteral<"streak">;
5
+ days: z.ZodNumber;
6
+ }, z.core.$strip>, z.ZodObject<{
7
+ kind: z.ZodLiteral<"progress">;
8
+ goal: z.ZodObject<{
9
+ kind: z.ZodLiteral<"count">;
10
+ count: z.ZodNumber;
11
+ }, z.core.$strict>;
12
+ window: z.ZodDiscriminatedUnion<[z.ZodObject<{
13
+ kind: z.ZodLiteral<"lifetime">;
14
+ }, z.core.$strict>, z.ZodObject<{
15
+ kind: z.ZodLiteral<"calendar">;
16
+ period: z.ZodEnum<{
17
+ day: "day";
18
+ week: "week";
19
+ month: "month";
20
+ }>;
21
+ latenessMs: z.ZodDefault<z.ZodNumber>;
22
+ }, z.core.$strict>, z.ZodObject<{
23
+ kind: z.ZodLiteral<"rolling">;
24
+ durationMs: z.ZodNumber;
25
+ }, z.core.$strict>], "kind">;
26
+ repeat: z.ZodDefault<z.ZodEnum<{
27
+ repeat: "repeat";
28
+ once: "once";
29
+ }>>;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ kind: z.ZodLiteral<"once">;
32
+ }, z.core.$strict>, z.ZodObject<{
33
+ kind: z.ZodLiteral<"keyed">;
34
+ across: z.ZodOptional<z.ZodLiteral<"members">>;
35
+ }, z.core.$strict>], "kind">;
36
+ declare const completionKeySchema: z.ZodString;
37
+ declare const budgetSchema: z.ZodObject<{
38
+ id: z.ZodString;
39
+ scope: z.ZodEnum<{
40
+ member: "member";
41
+ project: "project";
42
+ }>;
43
+ period: z.ZodEnum<{
44
+ lifetime: "lifetime";
45
+ day: "day";
46
+ week: "week";
47
+ month: "month";
48
+ }>;
49
+ limit: z.ZodNumber;
50
+ cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
51
+ balance: z.ZodString;
52
+ }, z.core.$strict>]>;
53
+ }, z.core.$strict>;
54
+ type Budget = z.infer<typeof budgetSchema>;
55
+ /**
56
+ * A budget counted per tracker record author: the account that caused the record, such as a
57
+ * reaction's reactor, whether or not it belongs to a member. It caps what one person gives when a
58
+ * quest pays someone else. Only quests with a tracker trigger take one, in their `authorBudgets`.
59
+ */
60
+ declare const authorBudgetSchema: z.ZodObject<{
61
+ id: z.ZodString;
62
+ period: z.ZodEnum<{
63
+ lifetime: "lifetime";
64
+ day: "day";
65
+ week: "week";
66
+ month: "month";
67
+ }>;
68
+ limit: z.ZodNumber;
69
+ cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
70
+ balance: z.ZodString;
71
+ }, z.core.$strict>]>;
72
+ scope: z.ZodLiteral<"author">;
73
+ }, z.core.$strict>;
74
+ type AuthorBudget = z.infer<typeof authorBudgetSchema>;
75
+ /**
76
+ * One of the member's accepted, unrevoked quest completions, as `ctx.member.completions()` reads
77
+ * it. `quest` is the quest's key and `key` the completion key. `completedAt` is when it was
78
+ * recorded, in epoch milliseconds on the member's clock (a test member's advanced one); null for
79
+ * older completions recorded without a time.
80
+ */
81
+ declare const memberCompletionSchema: z.ZodObject<{
82
+ quest: z.ZodString;
83
+ key: z.ZodString;
84
+ completedAt: z.ZodNullable<z.ZodNumber>;
85
+ }, z.core.$strip>;
86
+ type MemberCompletion = z.infer<typeof memberCompletionSchema>;
87
+ /**
88
+ * The most completions one `ctx.member.completions()` call returns, and its default `limit`.
89
+ *
90
+ * @deprecated Use `limits.memberCompletions`, which a 1.x release can raise.
91
+ */
92
+ declare const maxMemberCompletions = 100;
93
+
94
+ declare const resourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
95
+ provider: z.ZodLiteral<"domino">;
96
+ resource: z.ZodLiteral<"point-ledger">;
97
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
98
+ provider: z.ZodLiteral<"discord">;
99
+ resource: z.ZodLiteral<"channel">;
100
+ types: z.ZodArray<z.ZodEnum<{
101
+ text: "text";
102
+ announcement: "announcement";
103
+ }>>;
104
+ postable: z.ZodOptional<z.ZodLiteral<true>>;
105
+ }, z.core.$strict>, z.ZodObject<{
106
+ provider: z.ZodLiteral<"discord">;
107
+ resource: z.ZodLiteral<"role">;
108
+ assignable: z.ZodDefault<z.ZodBoolean>;
109
+ }, z.core.$strict>]>]>;
110
+ type ResourceSource = z.infer<typeof resourceSourceSchema>;
111
+ declare const resourceRequestSchema: z.ZodObject<{
112
+ source: z.ZodUnion<readonly [z.ZodObject<{
113
+ provider: z.ZodLiteral<"domino">;
114
+ resource: z.ZodLiteral<"point-ledger">;
115
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
116
+ provider: z.ZodLiteral<"discord">;
117
+ resource: z.ZodLiteral<"channel">;
118
+ types: z.ZodArray<z.ZodEnum<{
119
+ text: "text";
120
+ announcement: "announcement";
121
+ }>>;
122
+ postable: z.ZodOptional<z.ZodLiteral<true>>;
123
+ }, z.core.$strict>, z.ZodObject<{
124
+ provider: z.ZodLiteral<"discord">;
125
+ resource: z.ZodLiteral<"role">;
126
+ assignable: z.ZodDefault<z.ZodBoolean>;
127
+ }, z.core.$strict>]>]>;
128
+ query: z.ZodOptional<z.ZodString>;
129
+ cursor: z.ZodOptional<z.ZodString>;
130
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
+ }, z.core.$strict>;
132
+ declare const resourceOptionsSchema: z.ZodObject<{
133
+ revision: z.ZodNumber;
134
+ options: z.ZodArray<z.ZodObject<{
135
+ id: z.ZodString;
136
+ label: z.ZodString;
137
+ description: z.ZodOptional<z.ZodString>;
138
+ group: z.ZodOptional<z.ZodString>;
139
+ disabledReason: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strip>>;
141
+ nextCursor: z.ZodDefault<z.ZodNullable<z.ZodString>>;
142
+ cursor: z.ZodNullable<z.ZodString>;
143
+ }, z.core.$strip>;
144
+ type ResourceOption = z.infer<typeof resourceOptionsSchema>["options"][number];
145
+
146
+ /**
147
+ * A YouTube Short's body, as `content()` quests read it in `ctx.tracker.content.body`. Every field
148
+ * is what YouTube reported when Relay last read the video.
149
+ *
150
+ * @compat output
151
+ */
152
+ declare const youtubeShortBodySchema: z.ZodObject<{
153
+ title: z.ZodString;
154
+ description: z.ZodString;
155
+ tags: z.ZodArray<z.ZodString>;
156
+ durationSeconds: z.ZodNumber;
157
+ publishedAt: z.ZodNumber;
158
+ }, z.core.$strip>;
159
+ type YouTubeShortBody = z.infer<typeof youtubeShortBodySchema>;
160
+ /** The counters a YouTube Short's samples measure. A counter YouTube hides is unknown, never zero. */
161
+ declare const youtubeShortMetrics: readonly ["views", "likes", "comments"];
162
+ type YouTubeShortMetric = (typeof youtubeShortMetrics)[number];
163
+
164
+ /**
165
+ * A TikTok video's body, as `content()` quests read it in `ctx.tracker.content.body`. Every field
166
+ * is what TikTok reported when Relay last read the video.
167
+ *
168
+ * @compat output
169
+ */
170
+ declare const tiktokVideoBodySchema: z.ZodObject<{
171
+ title: z.ZodString;
172
+ description: z.ZodString;
173
+ durationSeconds: z.ZodNumber;
174
+ width: z.ZodNumber;
175
+ height: z.ZodNumber;
176
+ createdAt: z.ZodNumber;
177
+ shareUrl: z.ZodString;
178
+ isAigc: z.ZodBoolean;
179
+ }, z.core.$strip>;
180
+ type TikTokVideoBody = z.infer<typeof tiktokVideoBodySchema>;
181
+ /** The counters a TikTok video's samples measure. A counter TikTok omits is unknown, never zero. */
182
+ declare const tiktokVideoMetrics: readonly ["views", "likes", "comments", "shares"];
183
+ type TikTokVideoMetric = (typeof tiktokVideoMetrics)[number];
184
+
185
+ /**
186
+ * An announcement's text, at most 1000 characters, with `{placeholder}`s (`announcementPlaceholders`)
187
+ * that Relay fills when it posts. `{{` and `}}` are literal braces.
188
+ */
189
+ declare const announcementTextSchema: z.ZodString;
190
+ /** An announcement Domino's bot posts in one of the project's connected Telegram chats. */
191
+ declare const telegramAnnouncementSchema: z.ZodObject<{
192
+ action: z.ZodLiteral<"post-message">;
193
+ text: z.ZodString;
194
+ replyToTriggeringMessage: z.ZodOptional<z.ZodBoolean>;
195
+ provider: z.ZodLiteral<"telegram">;
196
+ chat: z.ZodString;
197
+ }, z.core.$strict>;
198
+ /** An announcement Domino's bot posts in a channel of the project's connected Discord server. */
199
+ declare const discordAnnouncementSchema: z.ZodObject<{
200
+ action: z.ZodLiteral<"post-message">;
201
+ text: z.ZodString;
202
+ replyToTriggeringMessage: z.ZodOptional<z.ZodBoolean>;
203
+ provider: z.ZodLiteral<"discord">;
204
+ channel: z.ZodString;
205
+ }, z.core.$strict>;
206
+ /**
207
+ * A message Relay posts when a completion of the quest pays, after its rewards commit. A failed
208
+ * post never undoes the rewards. Build one with `telegram.postMessage()` or
209
+ * `discord.postMessage()`.
210
+ */
211
+ declare const announcementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
212
+ action: z.ZodLiteral<"post-message">;
213
+ text: z.ZodString;
214
+ replyToTriggeringMessage: z.ZodOptional<z.ZodBoolean>;
215
+ provider: z.ZodLiteral<"telegram">;
216
+ chat: z.ZodString;
217
+ }, z.core.$strict>, z.ZodObject<{
218
+ action: z.ZodLiteral<"post-message">;
219
+ text: z.ZodString;
220
+ replyToTriggeringMessage: z.ZodOptional<z.ZodBoolean>;
221
+ provider: z.ZodLiteral<"discord">;
222
+ channel: z.ZodString;
223
+ }, z.core.$strict>], "provider">;
224
+ type Announcement = z.infer<typeof announcementSchema>;
225
+
226
+ /**
227
+ * Why an evaluator capability could not answer:
228
+ *
229
+ * - `not-linked`: the call needs a member account that is not linked, and its result cannot be
230
+ * null, such as an image check of the member's X profile picture. Readers of the member's own
231
+ * accounts return `null` instead.
232
+ * - `provider-unavailable`: the provider (X, Discord, a chain RPC, AI review) did not answer, or
233
+ * the project's integration cannot reach it.
234
+ * - `author-error`: the call cannot be answered as written: invalid input, an undeclared
235
+ * integration, an unknown tracker, a chain Relay does not read, a wallet the member never
236
+ * linked, or an image that does not exist.
237
+ *
238
+ * Later versions can add codes. Relay also sends codes this tuple does not list, as SDK 1.x keeps
239
+ * it fixed:
240
+ *
241
+ * - `integration-required`: the project's integration needs configuration before the call can
242
+ * answer.
243
+ * - `capability-limit`: the evaluation run already made its eight capability calls, which all
244
+ * capabilities share. Never retryable: the run makes the same calls again.
245
+ *
246
+ * Treat an unknown code as a failure its `message` explains.
247
+ */
248
+ declare const capabilityErrorCodes: readonly ["not-linked", "provider-unavailable", "author-error"];
249
+ /** @compat open */
250
+ type KnownCapabilityErrorCode = (typeof capabilityErrorCodes)[number];
251
+ /** A known code, or one a newer Relay added. */
252
+ type CapabilityErrorCode = KnownCapabilityErrorCode | (string & {});
253
+ /**
254
+ * A capability failure as it crosses the sandbox boundary and as Relay captures it. Open, so a
255
+ * newer Relay can add codes and fields without breaking an older evaluator or Worker.
256
+ */
257
+ declare const capabilityFailureSchema: z.ZodObject<{
258
+ code: z.ZodString;
259
+ message: z.ZodString;
260
+ retryable: z.ZodBoolean;
261
+ }, z.core.$loose>;
262
+ type CapabilityFailure = z.infer<typeof capabilityFailureSchema>;
263
+ /**
264
+ * Thrown by an evaluator capability (`ctx.x`, `ctx.discord`, `ctx.wallet`, `ctx.trackers`,
265
+ * `ctx.images`, `ctx.review`) that could not answer. A capability whose subject is missing (an
266
+ * account the member has not linked, a deleted post or message) returns `null` instead of
267
+ * throwing.
268
+ *
269
+ * Catch it to decide yourself; rethrow anything else. An uncaught retryable error makes Relay
270
+ * retry the attempt later; an uncaught one that is not retryable fails it.
271
+ *
272
+ * ```ts
273
+ * try {
274
+ * return (await ctx.x.follows({ userId })) ? decision.accept() : decision.reject({ reason })
275
+ * } catch (error) {
276
+ * if (error instanceof CapabilityError && error.code === "provider-unavailable")
277
+ * return decision.review({ reason: "X is unavailable" })
278
+ * throw error
279
+ * }
280
+ * ```
281
+ */
282
+ declare class CapabilityError extends Error {
283
+ readonly code: CapabilityErrorCode;
284
+ readonly retryable: boolean;
285
+ constructor(code: CapabilityErrorCode, message: string, options?: {
286
+ retryable?: boolean;
287
+ });
288
+ static [Symbol.hasInstance](value: unknown): boolean;
289
+ /**
290
+ * The error for a captured or transported failure. A code this SDK does not know is never
291
+ * retryable: nothing tells it a retry would help.
292
+ */
293
+ static from(failure: CapabilityFailure): CapabilityError;
294
+ }
295
+
296
+ export { type AuthorBudget as A, type Budget as B, CapabilityError as C, type KnownCapabilityErrorCode as K, type MemberCompletion as M, type ResourceSource as R, type TikTokVideoBody as T, type YouTubeShortBody as Y, type Announcement as a, type CapabilityErrorCode as b, type TikTokVideoMetric as c, type YouTubeShortMetric as d, capabilityErrorCodes as e, type CapabilityFailure as f, type ResourceOption as g, announcementSchema as h, announcementTextSchema as i, authorBudgetSchema as j, budgetSchema as k, capabilityFailureSchema as l, completionKeySchema as m, completionPolicySchema as n, discordAnnouncementSchema as o, maxMemberCompletions as p, memberCompletionSchema as q, resourceOptionsSchema as r, resourceRequestSchema as s, resourceSourceSchema as t, telegramAnnouncementSchema as u, tiktokVideoBodySchema as v, tiktokVideoMetrics as w, youtubeShortMetrics as x, youtubeShortBodySchema as y };
@@ -1,7 +1,11 @@
1
- import { S as SolanaIdlSource } from './wallet-DTO7SXj7.js';
2
- import { b as AttemptStatus, V as AttemptCodeSource, W as IntegrationModuleProvider, X as RewardType, Y as questDescriptionSchema } from './accounts-CCqCKCVx.js';
1
+ import { S as SolanaIdlSource } from './wallet-B7e06v4m.js';
2
+ import { b as AttemptStatus, V as AttemptCodeSource, W as IntegrationModuleProvider, X as RewardType, Y as questDescriptionSchema } from './accounts-_lNsiR2k.js';
3
3
  import * as z from 'zod';
4
4
 
5
+ /**
6
+ * The control a quest needs from a participant app. `"claim"` is a quest the member submits with
7
+ * no input, such as a button; it is unrelated to `quests.claim`, which claims a historical outcome.
8
+ */
5
9
  declare const interactionSchema: z.ZodEnum<{
6
10
  url: "url";
7
11
  text: "text";
@@ -136,6 +140,7 @@ declare const questTypeVersionSchema: z.ZodObject<{
136
140
  multiline: z.ZodBoolean;
137
141
  picker: z.ZodOptional<z.ZodString>;
138
142
  decimals: z.ZodOptional<z.ZodNumber>;
143
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
139
144
  label: z.ZodString;
140
145
  description: z.ZodOptional<z.ZodString>;
141
146
  }, z.core.$strict>, z.ZodObject<{
@@ -618,8 +623,8 @@ declare const questDraftChangesSchema: z.ZodObject<{
618
623
  key: z.ZodOptional<z.ZodString>;
619
624
  id: z.ZodString;
620
625
  title: z.ZodString;
621
- imageAlt: z.ZodOptional<z.ZodString>;
622
626
  quests: z.ZodArray<z.ZodString>;
627
+ imageAlt: z.ZodOptional<z.ZodString>;
623
628
  }, z.core.$strict>>;
624
629
  }, z.core.$strict>;
625
630
  declare const questDraftSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -707,8 +712,8 @@ declare const questDraftSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
707
712
  key: z.ZodOptional<z.ZodString>;
708
713
  id: z.ZodString;
709
714
  title: z.ZodString;
710
- imageAlt: z.ZodOptional<z.ZodString>;
711
715
  quests: z.ZodArray<z.ZodString>;
716
+ imageAlt: z.ZodOptional<z.ZodString>;
712
717
  }, z.core.$strict>>;
713
718
  }, z.core.$strict>;
714
719
  status: z.ZodLiteral<"draft">;
@@ -797,8 +802,8 @@ declare const questDraftSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
797
802
  key: z.ZodOptional<z.ZodString>;
798
803
  id: z.ZodString;
799
804
  title: z.ZodString;
800
- imageAlt: z.ZodOptional<z.ZodString>;
801
805
  quests: z.ZodArray<z.ZodString>;
806
+ imageAlt: z.ZodOptional<z.ZodString>;
802
807
  }, z.core.$strict>>;
803
808
  }, z.core.$strict>;
804
809
  status: z.ZodLiteral<"published">;
@@ -924,6 +929,7 @@ declare const questCatalogSchema: z.ZodObject<{
924
929
  multiline: z.ZodBoolean;
925
930
  picker: z.ZodOptional<z.ZodString>;
926
931
  decimals: z.ZodOptional<z.ZodNumber>;
932
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
927
933
  label: z.ZodString;
928
934
  description: z.ZodOptional<z.ZodString>;
929
935
  }, z.core.$strict>, z.ZodObject<{
@@ -1389,8 +1395,8 @@ declare const questCatalogSchema: z.ZodObject<{
1389
1395
  key: z.ZodOptional<z.ZodString>;
1390
1396
  id: z.ZodString;
1391
1397
  title: z.ZodString;
1392
- imageAlt: z.ZodOptional<z.ZodString>;
1393
1398
  quests: z.ZodArray<z.ZodString>;
1399
+ imageAlt: z.ZodOptional<z.ZodString>;
1394
1400
  }, z.core.$strict>>;
1395
1401
  }, z.core.$strict>;
1396
1402
  status: z.ZodLiteral<"draft">;
@@ -1479,8 +1485,8 @@ declare const questCatalogSchema: z.ZodObject<{
1479
1485
  key: z.ZodOptional<z.ZodString>;
1480
1486
  id: z.ZodString;
1481
1487
  title: z.ZodString;
1482
- imageAlt: z.ZodOptional<z.ZodString>;
1483
1488
  quests: z.ZodArray<z.ZodString>;
1489
+ imageAlt: z.ZodOptional<z.ZodString>;
1484
1490
  }, z.core.$strict>>;
1485
1491
  }, z.core.$strict>;
1486
1492
  status: z.ZodLiteral<"published">;
@@ -1594,6 +1600,7 @@ declare const questCatalogSchema: z.ZodObject<{
1594
1600
  multiline: z.ZodBoolean;
1595
1601
  picker: z.ZodOptional<z.ZodString>;
1596
1602
  decimals: z.ZodOptional<z.ZodNumber>;
1603
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
1597
1604
  label: z.ZodString;
1598
1605
  description: z.ZodOptional<z.ZodString>;
1599
1606
  }, z.core.$strict>, z.ZodObject<{
@@ -1992,6 +1999,7 @@ declare const questCatalogSchema: z.ZodObject<{
1992
1999
  source: z.ZodType<SolanaIdlSource>;
1993
2000
  idl: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1994
2001
  }, z.core.$strict>>>;
2002
+ withheldSettings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1995
2003
  }, z.core.$strict>>>;
1996
2004
  supportedInteractions: z.ZodArray<z.ZodEnum<{
1997
2005
  url: "url";
@@ -2152,6 +2160,7 @@ declare const catalogDeploymentPreviewSchema: z.ZodObject<{
2152
2160
  multiline: z.ZodBoolean;
2153
2161
  picker: z.ZodOptional<z.ZodString>;
2154
2162
  decimals: z.ZodOptional<z.ZodNumber>;
2163
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
2155
2164
  label: z.ZodString;
2156
2165
  description: z.ZodOptional<z.ZodString>;
2157
2166
  }, z.core.$strict>, z.ZodObject<{
@@ -2554,8 +2563,8 @@ declare const saveQuestDraftSchema: z.ZodObject<{
2554
2563
  key: z.ZodOptional<z.ZodString>;
2555
2564
  id: z.ZodString;
2556
2565
  title: z.ZodString;
2557
- imageAlt: z.ZodOptional<z.ZodString>;
2558
2566
  quests: z.ZodArray<z.ZodString>;
2567
+ imageAlt: z.ZodOptional<z.ZodString>;
2559
2568
  }, z.core.$strict>>;
2560
2569
  }, z.core.$strict>;
2561
2570
  }, z.core.$strict>;
@@ -4949,8 +4958,8 @@ declare const questPublicationPreviewSchema: z.ZodObject<{
4949
4958
  key: z.ZodOptional<z.ZodString>;
4950
4959
  id: z.ZodString;
4951
4960
  title: z.ZodString;
4952
- imageAlt: z.ZodOptional<z.ZodString>;
4953
4961
  quests: z.ZodArray<z.ZodString>;
4962
+ imageAlt: z.ZodOptional<z.ZodString>;
4954
4963
  }, z.core.$strict>>;
4955
4964
  }, z.core.$strict>;
4956
4965
  status: z.ZodLiteral<"draft">;
@@ -5039,8 +5048,8 @@ declare const questPublicationPreviewSchema: z.ZodObject<{
5039
5048
  key: z.ZodOptional<z.ZodString>;
5040
5049
  id: z.ZodString;
5041
5050
  title: z.ZodString;
5042
- imageAlt: z.ZodOptional<z.ZodString>;
5043
5051
  quests: z.ZodArray<z.ZodString>;
5052
+ imageAlt: z.ZodOptional<z.ZodString>;
5044
5053
  }, z.core.$strict>>;
5045
5054
  }, z.core.$strict>;
5046
5055
  status: z.ZodLiteral<"published">;
@@ -5154,6 +5163,7 @@ declare const questPublicationPreviewSchema: z.ZodObject<{
5154
5163
  multiline: z.ZodBoolean;
5155
5164
  picker: z.ZodOptional<z.ZodString>;
5156
5165
  decimals: z.ZodOptional<z.ZodNumber>;
5166
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
5157
5167
  label: z.ZodString;
5158
5168
  description: z.ZodOptional<z.ZodString>;
5159
5169
  }, z.core.$strict>, z.ZodObject<{
@@ -5552,6 +5562,7 @@ declare const questPublicationPreviewSchema: z.ZodObject<{
5552
5562
  source: z.ZodType<SolanaIdlSource>;
5553
5563
  idl: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
5554
5564
  }, z.core.$strict>>>;
5565
+ withheldSettings: z.ZodOptional<z.ZodArray<z.ZodString>>;
5555
5566
  }, z.core.$strict>>;
5556
5567
  affectedCollections: z.ZodArray<z.ZodObject<{
5557
5568
  archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  capabilityFailureSchema
3
- } from "./chunk-4OC7REYX.js";
3
+ } from "./chunk-MWMCQLCG.js";
4
4
  import {
5
5
  contentPerformanceSnapshotSchema,
6
6
  decisionSchema,
@@ -8,12 +8,12 @@ import {
8
8
  rewardBundleSchema,
9
9
  settingsValuesSchema,
10
10
  trackerTriggerContextSchema
11
- } from "./chunk-MK425RXJ.js";
11
+ } from "./chunk-HNR6G3GV.js";
12
12
 
13
13
  // src/server/attempt-captures.ts
14
14
  import * as z from "zod";
15
- var timestamp = z.number().int().nonnegative().safe();
16
- var capturedFactSchema = z.object({
15
+ var timestamp = /* @__PURE__ */ (() => z.number().int().nonnegative().safe())();
16
+ var capturedFactSchema = /* @__PURE__ */ (() => z.object({
17
17
  /** The call's position in the run, from 0. */
18
18
  sequence: z.number().int().nonnegative(),
19
19
  /** The capability request quest code sent, after validation. */
@@ -31,8 +31,8 @@ var capturedFactSchema = z.object({
31
31
  * did not keep, or a call without an answer. A replay cannot answer such a call.
32
32
  */
33
33
  captured: z.boolean()
34
- });
35
- var attemptCaptureSchema = z.object({
34
+ }))();
35
+ var attemptCaptureSchema = /* @__PURE__ */ (() => z.object({
36
36
  format: z.literal(1),
37
37
  attempt: identifier,
38
38
  environment: z.literal("test"),
@@ -71,7 +71,7 @@ var attemptCaptureSchema = z.object({
71
71
  * has decided nothing, and for runs decided before Relay kept decisions.
72
72
  */
73
73
  recorded: decisionSchema.nullable()
74
- });
74
+ }))();
75
75
 
76
76
  export {
77
77
  capturedFactSchema,
@@ -0,0 +1,199 @@
1
+ import {
2
+ clientIdentity,
3
+ retryAfter
4
+ } from "./chunk-DLABJSBO.js";
5
+
6
+ // src/http-exchange.ts
7
+ var uncertainStatuses = /* @__PURE__ */ (() => /* @__PURE__ */ new Set([500, 502, 504]))();
8
+ function withQuery(path, values) {
9
+ const query = new URLSearchParams(
10
+ Object.entries(values).flatMap(
11
+ ([key, value]) => value === void 0 ? [] : [[key, String(value)]]
12
+ )
13
+ ).toString();
14
+ return query ? path + "?" + query : path;
15
+ }
16
+ function untilAborted(step, signal) {
17
+ return new Promise((resolve, reject) => {
18
+ const stop = () => reject(signal.reason);
19
+ if (signal?.aborted) {
20
+ return stop();
21
+ }
22
+ signal?.addEventListener("abort", stop, { once: true });
23
+ step().then(resolve, reject).finally(() => signal?.removeEventListener("abort", stop));
24
+ });
25
+ }
26
+ function createHttpExchange(options, policy) {
27
+ const { messages, makeError } = policy;
28
+ const failure = (kind, code, message, cause, context) => makeError(message, { kind, code, uncertain: false, cause }, context);
29
+ try {
30
+ const headers = new Headers(options.headers);
31
+ if (options.token) {
32
+ headers.set("Authorization", `Bearer ${options.token}`);
33
+ }
34
+ headers.set("X-Relay-Organization", options.organization ?? "");
35
+ headers.set("X-Relay-Project", options.project ?? "");
36
+ } catch (error) {
37
+ throw failure("client", "invalid-input", messages.invalidOptions, error);
38
+ }
39
+ function interrupted(error, method, context, life, stage) {
40
+ const kind = life.ended() ?? "network";
41
+ return makeError(
42
+ kind === "aborted" ? messages.aborted : kind === "timeout" ? messages.timeout(life.timeout) : messages.network(stage.status),
43
+ {
44
+ kind,
45
+ code: kind,
46
+ uncertain: stage.sent && method !== "GET" && // An error status whose body broke off still refused the write, unless the status itself
47
+ // does not prove that.
48
+ (!stage.refused || uncertainStatuses.has(stage.status ?? 0)),
49
+ status: stage.status,
50
+ retryAfter: stage.headers ? retryAfter(stage.headers) : void 0,
51
+ cause: kind === "aborted" && policy.abortReason ? life.reason() : error
52
+ },
53
+ context
54
+ );
55
+ }
56
+ async function credential(method, context, life) {
57
+ const getToken = options.getToken;
58
+ if (!getToken) {
59
+ return options.token;
60
+ }
61
+ try {
62
+ return await untilAborted(getToken, life.signal);
63
+ } catch (error) {
64
+ throw life.signal.aborted ? interrupted(error, method, context, life, { sent: false }) : failure(
65
+ // A token source that could not reach its own service failed like a network call.
66
+ error instanceof TypeError ? "network" : "client",
67
+ "credential",
68
+ messages.credential,
69
+ error,
70
+ context
71
+ );
72
+ }
73
+ }
74
+ async function send(path, request, context, life) {
75
+ const { json } = request;
76
+ const method = (request.method ?? (json === void 0 ? "GET" : "POST")).toUpperCase();
77
+ if (life.signal.aborted) {
78
+ throw interrupted(life.reason(), method, context, life, { sent: false });
79
+ }
80
+ const last = policy.credentialLast;
81
+ let token = last ? void 0 : await credential(method, context, life);
82
+ const headers = new Headers();
83
+ let body = request.body;
84
+ let invalidToken;
85
+ const authorize = () => {
86
+ if (token) {
87
+ try {
88
+ headers.set("Authorization", `Bearer ${token}`);
89
+ } catch (error) {
90
+ throw invalidToken = failure(
91
+ "client",
92
+ "credential",
93
+ messages.invalidToken,
94
+ error,
95
+ context
96
+ );
97
+ }
98
+ } else if (options.getToken) {
99
+ headers.delete("Authorization");
100
+ }
101
+ };
102
+ try {
103
+ for (const source of [options.headers, request.headers]) {
104
+ new Headers(source).forEach((value, name) => headers.set(name, value));
105
+ }
106
+ headers.set("X-Domino-Client", policy.client ?? clientIdentity());
107
+ if (!last) {
108
+ authorize();
109
+ }
110
+ const scope = [
111
+ ["X-Relay-Organization", options.organization],
112
+ ["X-Relay-Project", options.project],
113
+ ["X-Relay-Environment", options.environment],
114
+ ["X-Relay-Session", policy.session?.(context)]
115
+ ];
116
+ for (const [name, value] of scope) {
117
+ if (value) {
118
+ headers.set(name, value);
119
+ }
120
+ }
121
+ if (json !== void 0) {
122
+ headers.set("Content-Type", "application/json");
123
+ body = JSON.stringify(json);
124
+ }
125
+ if (policy.csrf && method !== "GET") {
126
+ headers.set("X-Relay-CSRF", "1");
127
+ }
128
+ } catch (error) {
129
+ throw error === invalidToken || !messages.unsendable ? error : failure(
130
+ "client",
131
+ "invalid-input",
132
+ messages.unsendable,
133
+ error,
134
+ context
135
+ );
136
+ }
137
+ if (last) {
138
+ token = await credential(method, context, life);
139
+ authorize();
140
+ }
141
+ if (life.signal.aborted) {
142
+ throw interrupted(life.reason(), method, context, life, { sent: false });
143
+ }
144
+ let response;
145
+ try {
146
+ response = await (options.fetch ?? fetch)(options.baseUrl + path, {
147
+ ...request.init,
148
+ method: request.method ?? method,
149
+ headers,
150
+ body,
151
+ signal: life.signal
152
+ });
153
+ } catch (error) {
154
+ throw interrupted(error, method, context, life, {
155
+ sent: !policy.neverSent?.(error)
156
+ });
157
+ }
158
+ if (!response.ok) {
159
+ let text;
160
+ try {
161
+ text = await response.text();
162
+ } catch (error) {
163
+ throw interrupted(error, method, context, life, {
164
+ sent: true,
165
+ status: response.status,
166
+ headers: response.headers,
167
+ refused: true
168
+ });
169
+ }
170
+ let value = null;
171
+ try {
172
+ value = JSON.parse(text);
173
+ } catch {
174
+ }
175
+ const { status } = response;
176
+ const { message, ...refusal } = policy.parseRefusal(value);
177
+ throw makeError(
178
+ message ?? `Request failed (${status})`,
179
+ {
180
+ ...refusal,
181
+ kind: "http",
182
+ status,
183
+ retryAfter: retryAfter(response.headers),
184
+ uncertain: method !== "GET" && uncertainStatuses.has(status)
185
+ },
186
+ context
187
+ );
188
+ }
189
+ return response;
190
+ }
191
+ return { send, interrupted };
192
+ }
193
+
194
+ export {
195
+ uncertainStatuses,
196
+ withQuery,
197
+ untilAborted,
198
+ createHttpExchange
199
+ };