@domino-sdk/relay 1.61.0 → 1.63.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 (88) hide show
  1. package/CHANGELOG.md +276 -8
  2. package/README.md +3 -2
  3. package/dist/{schema-CZ6Rj0ZF.d.ts → accounts-nz3mzfRQ.d.ts} +3146 -1765
  4. package/dist/action-9Xl0StBg.d.ts +33 -0
  5. package/dist/{attempt-captures-DYnJVkfg.d.ts → attempt-captures-DMi8oR9T.d.ts} +1 -1
  6. package/dist/authoring.d.ts +171 -49
  7. package/dist/authoring.js +158 -49
  8. package/dist/{automatic-outcomes-If88LR9f.d.ts → automatic-outcomes-C_LLQU1p.d.ts} +15 -1
  9. package/dist/avatar.d.ts +1 -1
  10. package/dist/browser.d.ts +15 -11
  11. package/dist/browser.js +18 -12
  12. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  13. package/dist/{pages-K7-KjSXw.d.ts → catalog-BaTOKpNw.d.ts} +56 -567
  14. package/dist/{chunk-XBV2CK2H.js → chunk-3RFP6GT5.js} +15 -3
  15. package/dist/{chunk-VURRFVNP.js → chunk-4GQW43UU.js} +239 -361
  16. package/dist/chunk-4NOFSGAL.js +320 -0
  17. package/dist/{chunk-24I4R732.js → chunk-5XLZ34PV.js} +34 -19
  18. package/dist/{chunk-L77O64I4.js → chunk-7X67QLPB.js} +43 -43
  19. package/dist/{chunk-RHBS5FJL.js → chunk-7Z4SZ6YM.js} +3 -3
  20. package/dist/{chunk-QEAS4ZGS.js → chunk-AQOL3SK5.js} +1 -1
  21. package/dist/chunk-EHUSD3O2.js +377 -0
  22. package/dist/chunk-FO2LCZTL.js +19 -0
  23. package/dist/{chunk-DYXDZFKA.js → chunk-FU5CGNTR.js} +166 -178
  24. package/dist/chunk-FWLQ5XCS.js +21 -0
  25. package/dist/chunk-GLH6MEI2.js +193 -0
  26. package/dist/chunk-ICXZZNPS.js +199 -0
  27. package/dist/{chunk-ZDJLPN4L.js → chunk-ID3BZXFZ.js} +2696 -2693
  28. package/dist/chunk-KP2MCX3R.js +587 -0
  29. package/dist/{chunk-SKGTNTLF.js → chunk-LZWXCBUB.js} +213 -297
  30. package/dist/chunk-MTKRIQEU.js +31 -0
  31. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  32. package/dist/{chunk-PPB7HALD.js → chunk-N4BDKS6Y.js} +27 -26
  33. package/dist/{chunk-5I54XBK2.js → chunk-N4LNEGQX.js} +2 -2
  34. package/dist/chunk-NQDEWJWE.js +554 -0
  35. package/dist/chunk-QR6HH4DI.js +508 -0
  36. package/dist/chunk-TLSQETTY.js +41 -0
  37. package/dist/{chunk-MHPKEVEW.js → chunk-U66GUVSG.js} +7 -2
  38. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  39. package/dist/chunk-UZ765UGH.js +18 -0
  40. package/dist/{chunk-7A4J67ZL.js → chunk-VWQGWGCH.js} +7 -7
  41. package/dist/chunk-W7YSMSGC.js +725 -0
  42. package/dist/{client-C51w7fMb.d.ts → client-DHmG7rn6.d.ts} +126 -93
  43. package/dist/{announcements-CHx3-HBw.d.ts → dashboards-CLemT6kj.d.ts} +14 -137
  44. package/dist/{deployments-kWoHFaqj.d.ts → deployments-DTULi7dF.d.ts} +450 -18
  45. package/dist/identity-integration-DOeNZaxF.d.ts +1271 -0
  46. package/dist/index.d.ts +13 -11
  47. package/dist/index.js +16 -11
  48. package/dist/internal.d.ts +29 -13
  49. package/dist/internal.js +57 -17
  50. package/dist/{integrations-B3y36OaB.d.ts → limits-kNzYdZ00.d.ts} +464 -53
  51. package/dist/{offers-BoV4ryUc.d.ts → offers-CYeN_I0Y.d.ts} +22 -4
  52. package/dist/{participant-activity-DHL8QYks.d.ts → participant-activity-D-Drp24G.d.ts} +16 -3
  53. package/dist/portal-proxy.d.ts +75 -2
  54. package/dist/portal-proxy.js +153 -25
  55. package/dist/react/index.d.ts +214 -27
  56. package/dist/react/index.js +196 -42
  57. package/dist/{action-DBzILFx9.d.ts → request-error-D_dUPLwo.d.ts} +1 -31
  58. package/dist/reward-deliveries-drp-x1G-.d.ts +782 -0
  59. package/dist/runtime/authoring.js +1 -1
  60. package/dist/runtime/chunks/UGDV5W4N.js +1 -0
  61. package/dist/runtime/manifest.json +3 -3
  62. package/dist/runtime/schema.js +1 -1
  63. package/dist/schema.d.ts +330 -31
  64. package/dist/schema.js +147 -91
  65. package/dist/server/index.d.ts +14 -12
  66. package/dist/server/index.js +6425 -6260
  67. package/dist/sign-in-providers-B1Q9eDRm.d.ts +44 -0
  68. package/dist/submission-input-DZCbjQUH.d.ts +343 -0
  69. package/dist/{telegram-browser-BUceZIGZ.d.ts → telegram-browser-NL0Asmsi.d.ts} +46 -6
  70. package/dist/telegram.d.ts +64 -0
  71. package/dist/telegram.js +23 -0
  72. package/dist/testing.d.ts +326 -27
  73. package/dist/testing.js +440 -90
  74. package/dist/tracker-data-esm3WG8R.d.ts +1881 -0
  75. package/dist/{transport-BrX9pIGN.d.ts → transport-Czht_irp.d.ts} +43483 -38512
  76. package/dist/{wallet-CIqFoxdm.d.ts → wallet-B7e06v4m.d.ts} +32 -9
  77. package/package.json +5 -1
  78. package/dist/accounts-DoabriBX.d.ts +0 -306
  79. package/dist/capability-error-DufwG3G0.d.ts +0 -159
  80. package/dist/chunk-3Y3L2F54.js +0 -982
  81. package/dist/chunk-DHXDBAJF.js +0 -544
  82. package/dist/chunk-EN3M5Z4J.js +0 -13
  83. package/dist/chunk-QNUHWK7R.js +0 -602
  84. package/dist/chunk-SE4PFJPT.js +0 -247
  85. package/dist/groups-CqcA2Ycs.d.ts +0 -2827
  86. package/dist/runtime/chunks/5QVFB4TU.js +0 -1
  87. package/dist/submission-input-C54Q8yAD.d.ts +0 -146
  88. package/dist/x-D1PGi8Sq.d.ts +0 -331
@@ -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 };