@domino-sdk/relay 1.0.0-next.9 → 1.0.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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/activity-DeKJsRry.d.ts +9112 -0
  3. package/dist/authoring.d.ts +1027 -233
  4. package/dist/authoring.js +478 -277
  5. package/dist/automatic-outcomes-B1xrETxm.d.ts +758 -0
  6. package/dist/avatar.d.ts +2 -2
  7. package/dist/browser-DFe7sWSN.d.ts +4154 -0
  8. package/dist/browser.d.ts +11 -2613
  9. package/dist/browser.js +8 -6
  10. package/dist/{integrations-Ba5TtqTv.d.ts → capability-error-DNMwKmlL.d.ts} +124 -76
  11. package/dist/{chunk-PHU5VDLR.js → chunk-36HTX2BM.js} +389 -169
  12. package/dist/chunk-6QJ3LADK.js +112 -0
  13. package/dist/{chunk-4LBUTHD6.js → chunk-BGGKNIRP.js} +1 -1
  14. package/dist/chunk-EYH5RDIE.js +496 -0
  15. package/dist/chunk-GQKYAQM6.js +84 -0
  16. package/dist/chunk-GUP7YRR4.js +42 -0
  17. package/dist/{chunk-X2F2RAR3.js → chunk-GZ6FJAXN.js} +380 -128
  18. package/dist/chunk-JON5SESL.js +2986 -0
  19. package/dist/chunk-MC6V6VMG.js +49 -0
  20. package/dist/chunk-NPGENI7K.js +37 -0
  21. package/dist/chunk-VFHHLN6A.js +284 -0
  22. package/dist/chunk-WJSSJ7AF.js +151 -0
  23. package/dist/{chunk-7Q4BGGT6.js → chunk-XFMSUPNS.js} +1 -1
  24. package/dist/{chunk-P6FK43GG.js → chunk-ZVIRG24J.js} +145 -42
  25. package/dist/{client-CT4-S5vc.d.ts → client-XiuFnug_.d.ts} +2161 -615
  26. package/dist/{submission-input-0OOGaq8c.d.ts → groups-Ck-OxzjD.d.ts} +916 -1139
  27. package/dist/identity-integration-GxAHdKR2.d.ts +58 -0
  28. package/dist/images-Dv-P5VBw.d.ts +234 -0
  29. package/dist/index.d.ts +13 -9
  30. package/dist/index.js +17 -6
  31. package/dist/internal.d.ts +82 -44
  32. package/dist/internal.js +43 -89
  33. package/dist/offers-Cy-e4o5x.d.ts +431 -0
  34. package/dist/{pages-D3titw5B.d.ts → outcomes-kVB-Juzs.d.ts} +2157 -1448
  35. package/dist/pages-BBYD21IE.d.ts +359 -0
  36. package/dist/participant-rewards-3duLb8YJ.d.ts +668 -0
  37. package/dist/portal-proxy.js +22 -4
  38. package/dist/{profiles-DDMFBRKe.d.ts → profiles-D2aFcOxu.d.ts} +15 -15
  39. package/dist/react/index.d.ts +3038 -1029
  40. package/dist/react/index.js +1627 -779
  41. package/dist/request-error-DWduJCGV.d.ts +62 -0
  42. package/dist/schema-DfJzH2ci.d.ts +5644 -0
  43. package/dist/schema.d.ts +15 -4168
  44. package/dist/schema.js +310 -81
  45. package/dist/server/index.d.ts +81498 -0
  46. package/dist/server/index.js +2520 -0
  47. package/dist/{streaks-CwGReWGt.d.ts → streaks-CWyq8Px5.d.ts} +2 -4
  48. package/dist/submission-input-BZkm6ohU.d.ts +290 -0
  49. package/dist/vite.d.ts +1 -1
  50. package/dist/vite.js +1 -0
  51. package/dist/{wallet-BGOfFkG9.d.ts → wallet-YssWxGg8.d.ts} +35 -38
  52. package/package.json +8 -2
  53. package/dist/chunk-QR7ZA2BJ.js +0 -257
  54. package/dist/chunk-YYD4QUBO.js +0 -2348
  55. package/dist/chunk-ZWY3R6B3.js +0 -26
  56. package/dist/collection-BGneJ6Bk.d.ts +0 -114
  57. package/dist/images-BTgk6OmC.d.ts +0 -1564
  58. package/dist/point-ledgers-iS00Z_v0.d.ts +0 -37
  59. package/dist/schema-Di3aLSiK.d.ts +0 -3532
package/dist/browser.js CHANGED
@@ -11,12 +11,14 @@ import {
11
11
  signInOptions,
12
12
  solanaSigner,
13
13
  walletStandardSolanaSigner
14
- } from "./chunk-P6FK43GG.js";
15
- import "./chunk-X2F2RAR3.js";
16
- import "./chunk-QR7ZA2BJ.js";
17
- import "./chunk-PHU5VDLR.js";
18
- import "./chunk-7Q4BGGT6.js";
19
- import "./chunk-YYD4QUBO.js";
14
+ } from "./chunk-ZVIRG24J.js";
15
+ import "./chunk-GZ6FJAXN.js";
16
+ import "./chunk-EYH5RDIE.js";
17
+ import "./chunk-36HTX2BM.js";
18
+ import "./chunk-6QJ3LADK.js";
19
+ import "./chunk-NPGENI7K.js";
20
+ import "./chunk-XFMSUPNS.js";
21
+ import "./chunk-JON5SESL.js";
20
22
  export {
21
23
  browserSubmissionStore,
22
24
  cosmosChainList,
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  declare const resourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
4
4
  provider: z.ZodLiteral<"domino">;
5
5
  resource: z.ZodLiteral<"point-ledger">;
6
- }, z.core.$strict>, z.ZodObject<{
6
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
7
7
  provider: z.ZodLiteral<"discord">;
8
8
  resource: z.ZodLiteral<"channel">;
9
9
  types: z.ZodArray<z.ZodEnum<{
@@ -14,13 +14,13 @@ declare const resourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
14
14
  provider: z.ZodLiteral<"discord">;
15
15
  resource: z.ZodLiteral<"role">;
16
16
  assignable: z.ZodDefault<z.ZodBoolean>;
17
- }, z.core.$strict>]>;
17
+ }, z.core.$strict>]>]>;
18
18
  type ResourceSource = z.infer<typeof resourceSourceSchema>;
19
19
  declare const resourceRequestSchema: z.ZodObject<{
20
20
  source: z.ZodUnion<readonly [z.ZodObject<{
21
21
  provider: z.ZodLiteral<"domino">;
22
22
  resource: z.ZodLiteral<"point-ledger">;
23
- }, z.core.$strict>, z.ZodObject<{
23
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
24
24
  provider: z.ZodLiteral<"discord">;
25
25
  resource: z.ZodLiteral<"channel">;
26
26
  types: z.ZodArray<z.ZodEnum<{
@@ -31,7 +31,7 @@ declare const resourceRequestSchema: z.ZodObject<{
31
31
  provider: z.ZodLiteral<"discord">;
32
32
  resource: z.ZodLiteral<"role">;
33
33
  assignable: z.ZodDefault<z.ZodBoolean>;
34
- }, z.core.$strict>]>;
34
+ }, z.core.$strict>]>]>;
35
35
  query: z.ZodOptional<z.ZodString>;
36
36
  cursor: z.ZodOptional<z.ZodString>;
37
37
  ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -51,7 +51,7 @@ type ResourceOption = z.infer<typeof resourceOptionsSchema>["options"][number];
51
51
 
52
52
  declare const settingFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
53
53
  kind: z.ZodLiteral<"point-ledger">;
54
- default: z.ZodString;
54
+ default: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
55
55
  label: z.ZodString;
56
56
  description: z.ZodOptional<z.ZodString>;
57
57
  }, z.core.$strict>, z.ZodObject<{
@@ -65,7 +65,7 @@ declare const settingFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
65
  source: z.ZodUnion<readonly [z.ZodObject<{
66
66
  provider: z.ZodLiteral<"domino">;
67
67
  resource: z.ZodLiteral<"point-ledger">;
68
- }, z.core.$strict>, z.ZodObject<{
68
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
69
69
  provider: z.ZodLiteral<"discord">;
70
70
  resource: z.ZodLiteral<"channel">;
71
71
  types: z.ZodArray<z.ZodEnum<{
@@ -76,7 +76,7 @@ declare const settingFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
76
76
  provider: z.ZodLiteral<"discord">;
77
77
  resource: z.ZodLiteral<"role">;
78
78
  assignable: z.ZodDefault<z.ZodBoolean>;
79
- }, z.core.$strict>]>;
79
+ }, z.core.$strict>]>]>;
80
80
  label: z.ZodString;
81
81
  description: z.ZodOptional<z.ZodString>;
82
82
  }, z.core.$strict>, z.ZodObject<{
@@ -122,7 +122,7 @@ declare const settingFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
122
122
  type SettingField = z.infer<typeof settingFieldSchema>;
123
123
  declare const settingsFieldsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
124
124
  kind: z.ZodLiteral<"point-ledger">;
125
- default: z.ZodString;
125
+ default: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
126
126
  label: z.ZodString;
127
127
  description: z.ZodOptional<z.ZodString>;
128
128
  }, z.core.$strict>, z.ZodObject<{
@@ -136,7 +136,7 @@ declare const settingsFieldsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedU
136
136
  source: z.ZodUnion<readonly [z.ZodObject<{
137
137
  provider: z.ZodLiteral<"domino">;
138
138
  resource: z.ZodLiteral<"point-ledger">;
139
- }, z.core.$strict>, z.ZodObject<{
139
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
140
140
  provider: z.ZodLiteral<"discord">;
141
141
  resource: z.ZodLiteral<"channel">;
142
142
  types: z.ZodArray<z.ZodEnum<{
@@ -147,7 +147,7 @@ declare const settingsFieldsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedU
147
147
  provider: z.ZodLiteral<"discord">;
148
148
  resource: z.ZodLiteral<"role">;
149
149
  assignable: z.ZodDefault<z.ZodBoolean>;
150
- }, z.core.$strict>]>;
150
+ }, z.core.$strict>]>]>;
151
151
  label: z.ZodString;
152
152
  description: z.ZodOptional<z.ZodString>;
153
153
  }, z.core.$strict>, z.ZodObject<{
@@ -276,54 +276,54 @@ declare const xRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
276
276
  type XConnection = z.infer<typeof xConnectionSchema>;
277
277
  type XProfile = z.infer<typeof xProfileSchema>;
278
278
  type XPost = z.infer<typeof xPostSchema>;
279
+ /**
280
+ * Reads the member's linked X account and public X data. The account is pinned at the attempt's
281
+ * first X read: later links and unlinks do not change the attempt. `connection()`, `profile()`,
282
+ * `follows()` and `reposted()` resolve to `null` when the member has no linked X account;
283
+ * `post()` reads any public post and resolves to `null` when it does not exist. Provider failures
284
+ * throw `CapabilityError` with code `"provider-unavailable"`.
285
+ */
279
286
  interface XReader {
280
287
  connection(): Promise<XConnection | null>;
281
- profile(): Promise<XProfile>;
288
+ profile(): Promise<XProfile | null>;
282
289
  post(input: {
283
290
  postId: string;
284
- }): Promise<XPost>;
291
+ }): Promise<XPost | null>;
285
292
  follows(input: {
286
293
  userId: string;
287
- }): Promise<boolean>;
294
+ }): Promise<boolean | null>;
288
295
  reposted(input: {
289
296
  postId: string;
290
- }): Promise<boolean>;
297
+ }): Promise<boolean | null>;
291
298
  }
292
299
 
293
- declare const observationInputSchema: z.ZodObject<{
294
- id: z.ZodString;
295
- source: z.ZodString;
296
- type: z.ZodString;
297
- member: z.ZodString;
298
- actor: z.ZodOptional<z.ZodObject<{
299
- provider: z.ZodString;
300
- subject: z.ZodString;
301
- }, z.core.$strict>>;
302
- occurredAt: z.ZodNumber;
303
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
304
- }, z.core.$strict>;
305
- declare const observationSchema: z.ZodObject<{
306
- id: z.ZodString;
307
- source: z.ZodString;
308
- type: z.ZodString;
309
- member: z.ZodString;
310
- actor: z.ZodOptional<z.ZodObject<{
311
- provider: z.ZodString;
312
- subject: z.ZodString;
313
- }, z.core.$strict>>;
314
- occurredAt: z.ZodNumber;
315
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
316
- receivedAt: z.ZodNumber;
317
- }, z.core.$strict>;
318
- type Observation = z.infer<typeof observationSchema>;
319
- declare const observationTriggerSchema: z.ZodObject<{
320
- source: z.ZodString;
321
- type: z.ZodString;
322
- }, z.core.$strict>;
323
300
  declare const completionPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
324
301
  kind: z.ZodLiteral<"streak">;
325
302
  days: z.ZodNumber;
326
- timeZone: z.ZodString;
303
+ }, z.core.$strip>, z.ZodObject<{
304
+ kind: z.ZodLiteral<"progress">;
305
+ goal: z.ZodObject<{
306
+ kind: z.ZodLiteral<"count">;
307
+ count: z.ZodNumber;
308
+ }, z.core.$strict>;
309
+ window: z.ZodDiscriminatedUnion<[z.ZodObject<{
310
+ kind: z.ZodLiteral<"lifetime">;
311
+ }, z.core.$strict>, z.ZodObject<{
312
+ kind: z.ZodLiteral<"calendar">;
313
+ period: z.ZodEnum<{
314
+ day: "day";
315
+ week: "week";
316
+ month: "month";
317
+ }>;
318
+ latenessMs: z.ZodDefault<z.ZodNumber>;
319
+ }, z.core.$strict>, z.ZodObject<{
320
+ kind: z.ZodLiteral<"rolling">;
321
+ durationMs: z.ZodNumber;
322
+ }, z.core.$strict>], "kind">;
323
+ repeat: z.ZodDefault<z.ZodEnum<{
324
+ repeat: "repeat";
325
+ once: "once";
326
+ }>>;
327
327
  }, z.core.$strict>, z.ZodObject<{
328
328
  kind: z.ZodLiteral<"once">;
329
329
  }, z.core.$strict>, z.ZodObject<{
@@ -337,9 +337,10 @@ declare const budgetSchema: z.ZodObject<{
337
337
  project: "project";
338
338
  }>;
339
339
  period: z.ZodEnum<{
340
- day: "day";
341
340
  lifetime: "lifetime";
341
+ day: "day";
342
342
  week: "week";
343
+ month: "month";
343
344
  }>;
344
345
  limit: z.ZodNumber;
345
346
  cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
@@ -347,36 +348,16 @@ declare const budgetSchema: z.ZodObject<{
347
348
  }, z.core.$strict>]>;
348
349
  }, z.core.$strict>;
349
350
  type Budget = z.infer<typeof budgetSchema>;
350
- declare const observationReceiptSchema: z.ZodObject<{
351
- id: z.ZodString;
352
- source: z.ZodString;
353
- attempts: z.ZodArray<z.ZodString>;
354
- receivedAt: z.ZodNumber;
355
- }, z.core.$strip>;
356
- declare const discordReactionSchema: z.ZodObject<{
357
- guildId: z.ZodString;
358
- channelId: z.ZodString;
359
- messageId: z.ZodString;
360
- userId: z.ZodString;
361
- messageAuthorId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
362
- actorRoles: z.ZodDefault<z.ZodArray<z.ZodString>>;
363
- emoji: z.ZodObject<{
364
- id: z.ZodNullable<z.ZodString>;
365
- name: z.ZodString;
366
- }, z.core.$strip>;
367
- messagePublishedAt: z.ZodNumber;
368
- }, z.core.$strict>;
369
- declare const discordMessageSchema: z.ZodObject<{
370
- guildId: z.ZodString;
371
- channelId: z.ZodString;
372
- messageId: z.ZodString;
373
- userId: z.ZodString;
374
- content: z.ZodNullable<z.ZodString>;
375
- replyTo: z.ZodNullable<z.ZodString>;
376
- publishedAt: z.ZodNumber;
377
- }, z.core.$strict>;
378
- type DiscordMessage = z.infer<typeof discordMessageSchema>;
379
351
 
352
+ /** Modules a quest can declare to enable provider readers. Project connections are separate. */
353
+ declare const evaluatorIntegrationProviderSchema: z.ZodEnum<{
354
+ discord: "discord";
355
+ x: "x";
356
+ }>;
357
+ type EvaluatorIntegrationProvider = z.infer<typeof evaluatorIntegrationProviderSchema>;
358
+ type IntegrationModule = {
359
+ readonly provider: EvaluatorIntegrationProvider;
360
+ };
380
361
  declare const integrationProviderSchema: z.ZodEnum<{
381
362
  discord: "discord";
382
363
  }>;
@@ -407,4 +388,71 @@ declare const projectIntegrationSchema: z.ZodObject<{
407
388
  }, z.core.$strip>;
408
389
  type ProjectIntegration = z.infer<typeof projectIntegrationSchema>;
409
390
 
410
- export { settingsFieldsSchema as A, type Budget as B, settingsValuesSchema as C, type DiscordMessage as D, xConnectionSchema as E, xIdSchema as F, xPostSchema as G, xProfileSchema as H, type IntegerSettings as I, xRequestSchema as J, type Observation as O, type ProjectIntegration as P, type ResourceSource as R, type Setting as S, type XReader as X, type IntegrationProvider as a, type ResourceOption as b, type SettingField as c, type SettingsValues as d, type XConnection as e, type XPost as f, type XProfile as g, budgetSchema as h, compatibleSettingKinds as i, completionKeySchema as j, completionPolicySchema as k, discordMessageSchema as l, discordReactionSchema as m, discordServerSchema as n, observationTriggerSchema as o, integrationProviderSchema as p, missingResourceSettings as q, observationInputSchema as r, observationReceiptSchema as s, observationSchema as t, parseSettings as u, projectIntegrationSchema as v, resourceOptionsSchema as w, resourceRequestSchema as x, resourceSourceSchema as y, settingFieldSchema as z };
391
+ /**
392
+ * Why an evaluator capability could not answer:
393
+ *
394
+ * - `not-linked`: the call needs a member account that is not linked, and its result cannot be
395
+ * null, such as an image check of the member's X profile picture. Readers of the member's own
396
+ * accounts return `null` instead.
397
+ * - `provider-unavailable`: the provider (X, Discord, a chain RPC, AI review) did not answer, or
398
+ * the project's integration cannot reach it.
399
+ * - `author-error`: the call cannot be answered as written: invalid input, an undeclared
400
+ * integration, an unknown tracker, a chain Relay does not read, a wallet the member never
401
+ * linked, or an image that does not exist.
402
+ *
403
+ * Later versions can add codes. Treat an unknown code as a failure its `message` explains.
404
+ */
405
+ declare const capabilityErrorCodes: readonly ["not-linked", "provider-unavailable", "author-error"];
406
+ type KnownCapabilityErrorCode = (typeof capabilityErrorCodes)[number];
407
+ /** A known code, or one a newer Relay added. */
408
+ type CapabilityErrorCode = KnownCapabilityErrorCode | (string & {});
409
+ /**
410
+ * A capability failure as it crosses the sandbox boundary and as Relay captures it. Open, so a
411
+ * newer Relay can add codes and fields without breaking an older evaluator or Worker.
412
+ */
413
+ declare const capabilityFailureSchema: z.ZodObject<{
414
+ code: z.ZodString;
415
+ message: z.ZodString;
416
+ /**
417
+ * True when Relay retries the attempt if the error reaches it uncaught, and calls the provider
418
+ * again. A failure that is not retryable is captured (or follows from the attempt's pinned
419
+ * inputs), so every run of the attempt sees it again. A retryable failure that quest code
420
+ * handles and moves past is final for the attempt; one that escapes the evaluation is retried.
421
+ */
422
+ retryable: z.ZodBoolean;
423
+ }, z.core.$loose>;
424
+ type CapabilityFailure = z.infer<typeof capabilityFailureSchema>;
425
+ /**
426
+ * Thrown by an evaluator capability (`ctx.x`, `ctx.discord`, `ctx.wallet`, `ctx.trackers`,
427
+ * `ctx.images`, `ctx.review`) that could not answer. A capability whose subject is missing (an
428
+ * account the member has not linked, a deleted post or message) returns `null` instead of
429
+ * throwing.
430
+ *
431
+ * Catch it to decide yourself; rethrow anything else. An uncaught retryable error makes Relay
432
+ * retry the attempt later; an uncaught one that is not retryable fails it.
433
+ *
434
+ * ```ts
435
+ * try {
436
+ * return (await ctx.x.follows({ userId })) ? decision.accept() : decision.reject({ reason })
437
+ * } catch (error) {
438
+ * if (error instanceof CapabilityError && error.code === "provider-unavailable")
439
+ * return decision.review({ reason: "X is unavailable" })
440
+ * throw error
441
+ * }
442
+ * ```
443
+ */
444
+ declare class CapabilityError extends Error {
445
+ readonly code: CapabilityErrorCode;
446
+ readonly retryable: boolean;
447
+ constructor(code: CapabilityErrorCode, message: string, options?: {
448
+ retryable?: boolean;
449
+ });
450
+ static [Symbol.hasInstance](value: unknown): boolean;
451
+ /**
452
+ * The error for a captured or transported failure. A code this SDK does not know is never
453
+ * retryable: nothing tells it a retry would help.
454
+ */
455
+ static from(failure: CapabilityFailure): CapabilityError;
456
+ }
457
+
458
+ export { settingsValuesSchema as A, type Budget as B, type CapabilityErrorCode as C, xConnectionSchema as D, type EvaluatorIntegrationProvider as E, xIdSchema as F, xPostSchema as G, xProfileSchema as H, type IntegerSettings as I, xRequestSchema as J, type KnownCapabilityErrorCode as K, CapabilityError as L, type ProjectIntegration as P, type ResourceOption as R, type Setting as S, type XConnection as X, type CapabilityFailure as a, type IntegrationModule as b, type IntegrationProvider as c, type ResourceSource as d, type SettingField as e, type SettingsValues as f, type XPost as g, type XProfile as h, type XReader as i, budgetSchema as j, capabilityErrorCodes as k, capabilityFailureSchema as l, compatibleSettingKinds as m, completionKeySchema as n, completionPolicySchema as o, discordServerSchema as p, evaluatorIntegrationProviderSchema as q, integrationProviderSchema as r, missingResourceSettings as s, parseSettings as t, projectIntegrationSchema as u, resourceOptionsSchema as v, resourceRequestSchema as w, resourceSourceSchema as x, settingFieldSchema as y, settingsFieldsSchema as z };