@domino-sdk/relay 1.53.1 → 1.55.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 (66) hide show
  1. package/CHANGELOG.md +1848 -0
  2. package/dist/analytics-URV-mxjH.d.ts +482 -0
  3. package/dist/{attempt-captures-QC4kTA44.d.ts → attempt-captures-CxxO7DeD.d.ts} +1 -1
  4. package/dist/authoring.d.ts +233 -78
  5. package/dist/authoring.js +112 -14
  6. package/dist/{automatic-outcomes-CVyZHxir.d.ts → automatic-outcomes-DxW_v5Wc.d.ts} +5 -2
  7. package/dist/avatar.d.ts +1 -1
  8. package/dist/browser.d.ts +8 -7
  9. package/dist/browser.js +14 -10
  10. package/dist/{capability-error-FQGGb5xS.d.ts → capability-error-DSd8EMQC.d.ts} +76 -2
  11. package/dist/{chunk-53JMTUWG.js → chunk-56DBFNR2.js} +1 -1
  12. package/dist/chunk-C7QZ4UBB.js +937 -0
  13. package/dist/chunk-F6HECAXA.js +661 -0
  14. package/dist/{chunk-VKHSC5MD.js → chunk-GL43VQ5D.js} +16 -16
  15. package/dist/{chunk-GTQJSDBS.js → chunk-IUF7DW76.js} +27 -16
  16. package/dist/{chunk-YBR4BUFK.js → chunk-IZRITLVV.js} +2 -2
  17. package/dist/chunk-KDR2VAJP.js +34 -0
  18. package/dist/{chunk-S2PMKZSX.js → chunk-SABMNPF2.js} +21 -2
  19. package/dist/{chunk-XFAYQFRO.js → chunk-TLK2MD4S.js} +1 -1
  20. package/dist/{chunk-ZJ3FVZRP.js → chunk-UY6KMLQG.js} +10 -3
  21. package/dist/{chunk-JYJAS4E3.js → chunk-VFBQVY4X.js} +1 -1
  22. package/dist/{chunk-YVC3B72P.js → chunk-WHG5WE43.js} +1 -1
  23. package/dist/chunk-WHMXXHPX.js +344 -0
  24. package/dist/{chunk-MP2ZF5U6.js → chunk-WUEQOKJH.js} +4 -4
  25. package/dist/{chunk-7BNCLWAO.js → chunk-XALIFNMD.js} +1 -1
  26. package/dist/{chunk-IELNFM3V.js → chunk-YCOKTQ4E.js} +96 -7
  27. package/dist/{chunk-LPHXTZDA.js → chunk-YE3XYB2F.js} +2 -2
  28. package/dist/{chunk-K6TVMNU4.js → chunk-YEVD4A5X.js} +1 -1
  29. package/dist/{client-CzNtl8UO.d.ts → client-C4zUZKpj.d.ts} +35 -7
  30. package/dist/{deployments-ovtqtAcx.d.ts → deployments-B32QS1CI.d.ts} +1060 -233
  31. package/dist/{groups-B5R1RCsl.d.ts → groups-O6onGPmC.d.ts} +131 -137
  32. package/dist/host-environment-FN4zg3hw.d.ts +30 -0
  33. package/dist/index.d.ts +8 -8
  34. package/dist/index.js +9 -9
  35. package/dist/integrations-C6_uUh-s.d.ts +584 -0
  36. package/dist/internal.d.ts +12 -10
  37. package/dist/internal.js +14 -8
  38. package/dist/{offers-CH1RZekg.d.ts → offers-BMDNcvwB.d.ts} +2 -2
  39. package/dist/{pages-BTlOg8sl.d.ts → pages-BFloMpyQ.d.ts} +25 -1
  40. package/dist/portal-proxy.d.ts +11 -1
  41. package/dist/portal-proxy.js +26 -5
  42. package/dist/{profiles-Cdv4BSd_.d.ts → profiles-BoOK03cR.d.ts} +2 -0
  43. package/dist/react/index.d.ts +488 -13
  44. package/dist/react/index.js +51 -15
  45. package/dist/runtime/authoring.js +1 -1
  46. package/dist/runtime/chunks/WKATKZXE.js +1 -0
  47. package/dist/runtime/manifest.json +3 -3
  48. package/dist/runtime/schema.js +1 -1
  49. package/dist/{schema-BJ9bOgpN.d.ts → schema-C4m9RhCR.d.ts} +166 -6
  50. package/dist/schema.d.ts +392 -334
  51. package/dist/schema.js +84 -40
  52. package/dist/server/index.d.ts +11 -10
  53. package/dist/server/index.js +1604 -838
  54. package/dist/{submission-input-BNah53go.d.ts → submission-input-BbdawqVy.d.ts} +2 -2
  55. package/dist/{telegram-browser-C36j_6v-.d.ts → telegram-browser-CwaxROAZ.d.ts} +1 -1
  56. package/dist/testing.d.ts +85 -12
  57. package/dist/testing.js +322 -37
  58. package/dist/{transport-DuB_fiA2.d.ts → transport-CZJOW5Sr.d.ts} +8018 -3150
  59. package/dist/vite.d.ts +54 -1
  60. package/dist/vite.js +35 -0
  61. package/dist/{x-BfQcsDp0.d.ts → x-1czZFVUW.d.ts} +1 -1
  62. package/package.json +3 -2
  63. package/dist/chunk-2NUD237O.js +0 -102
  64. package/dist/chunk-CCE2JWES.js +0 -1083
  65. package/dist/integrations-CllF-kWg.d.ts +0 -314
  66. package/dist/runtime/chunks/AVRVSLHX.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import * as z from 'zod';
2
- import { L as LedgerReference, r as QuestHandle } from './schema-BJ9bOgpN.js';
3
- import { r as ProjectGroupReference } from './groups-B5R1RCsl.js';
2
+ import { L as LedgerReference, D as QuestHandle } from './schema-C4m9RhCR.js';
3
+ import { k as ProjectGroupReference } from './groups-O6onGPmC.js';
4
4
 
5
5
  declare const completionPrerequisiteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
6
  kind: z.ZodLiteral<"completion">;
@@ -1,5 +1,5 @@
1
1
  import { a as AuthProvider, b as TelegramSignInMethods } from './accounts-DRPENuZe.js';
2
- import { p as createRelayClient, k as RelayRequestOptions, g as RelayError } from './client-CzNtl8UO.js';
2
+ import { p as createRelayClient, k as RelayRequestOptions, g as RelayError } from './client-C4zUZKpj.js';
3
3
  import { b as ParticipantSession } from './participant-activity-iciCEs_8.js';
4
4
  import { C as CosmosChain, a as CosmosNetwork, f as WalletSigner, d as WalletSignInNetwork } from './wallet-Ac7OFpOr.js';
5
5
 
package/dist/testing.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { bL as memberIdentitySchema, d0 as trackerQuerySchema, cX as trackerPageSchema, d9 as trackerSummarySchema, aO as TrackerContentQuery, cI as trackerContentSchema, bQ as photoResultSchema, Y as TextReviewInput, R as Reward, $ as Decision, aK as TrackerAttribution, y as Tracker, z as TrackerData, a4 as ContentBody, U as TrackerTriggerContext, aa as TrackerPage } from './schema-BJ9bOgpN.js';
1
+ import { bZ as memberIdentitySchema, c8 as pointBalanceSchema, dn as trackerQuerySchema, di as trackerPageSchema, dx as trackerSummarySchema, a_ as TrackerContentQuery, d3 as trackerContentSchema, c2 as photoResultSchema, a6 as TextReviewInput, R as Reward, a9 as Decision, aW as TrackerAttribution, N as Tracker, U as TrackerData, ae as ContentBody, a4 as TrackerTriggerContext, ak as TrackerPage } from './schema-C4m9RhCR.js';
2
2
  import * as z from 'zod';
3
3
  import { t as discordMemberSchema, w as discordMessageSchema, G as telegramChatMemberSchema } from './accounts-DRPENuZe.js';
4
- import { b as CapabilityFailure } from './capability-error-FQGGb5xS.js';
5
- export { C as CapabilityError } from './capability-error-FQGGb5xS.js';
6
- import { z as xConnectionSchema, C as xProfileSchema, B as xPostSchema, f as ImageReference, s as imageInspectionSchema, o as imageComparisonSchema, v as imageSightingsSchema } from './x-BfQcsDp0.js';
4
+ import { b as CapabilityFailure, h as memberCompletionSchema } from './capability-error-DSd8EMQC.js';
5
+ export { C as CapabilityError } from './capability-error-DSd8EMQC.js';
6
+ import { z as xConnectionSchema, C as xProfileSchema, B as xPostSchema, f as ImageReference, s as imageInspectionSchema, o as imageComparisonSchema, v as imageSightingsSchema } from './x-1czZFVUW.js';
7
7
  import { v as linkedWalletSchema, A as walletBalanceSchema } from './wallet-Ac7OFpOr.js';
8
- export { A as AttemptCapture, C as CapturedFact } from './attempt-captures-QC4kTA44.js';
8
+ import { C as profileReferralSchema } from './profiles-BoOK03cR.js';
9
+ export { A as AttemptCapture, C as CapturedFact } from './attempt-captures-CxxO7DeD.js';
9
10
 
10
11
  /** One project time-zone change: from `effectiveAt` on, days are counted in `timeZone`. */
11
12
  type CalendarSegment = {
@@ -220,6 +221,12 @@ type CapabilityRequest = {
220
221
 
221
222
  /** A result as a fake writes it: Relay's result schema fills defaults before quest code reads it. */
222
223
  type Result<S extends z.ZodType> = z.input<S>;
224
+ /** One campaign the member's enrollment state is known for, as `facts.member.campaigns` lists it. */
225
+ declare const campaignFactSchema: z.ZodObject<{
226
+ key: z.ZodString;
227
+ enrolled: z.ZodBoolean;
228
+ }, z.core.$strict>;
229
+ type CampaignFact = z.output<typeof campaignFactSchema>;
223
230
  /**
224
231
  * A fake capability answer: the value the reader resolves with, or a function of the call's
225
232
  * arguments that returns it. Throw a `CapabilityError` from the function to fail the call as
@@ -256,8 +263,9 @@ type TrackerFacts = {
256
263
  * `member.identities()`, `wallet.list()`, `wallet.balance()`, `x.connection()`, `x.profile()`,
257
264
  * `x.follows()`, `x.reposted()`, `discord.member()` and `telegram.member()` resolve to null. Once the test links an
258
265
  * account (`wallet.list` or `x.connection` set to a value), supply every read of it the quest
259
- * makes. Every other read (an X post, a Discord message, trackers, images and AI review) needs an
260
- * answer: a call without one fails the run.
266
+ * makes. Every other read (the member's balances, completions, groups, campaigns and referrals, an
267
+ * X post, a Discord message, trackers, images and AI review) needs an answer: a call without one
268
+ * fails the run.
261
269
  *
262
270
  * Answers pass the result schemas Relay applies before quest code sees them, and arrive as JSON,
263
271
  * as in a hosted run.
@@ -267,6 +275,33 @@ type TrackerFacts = {
267
275
  type TestFacts = {
268
276
  member?: {
269
277
  identities?: FakeAnswer<[], Result<typeof memberIdentitySchema>[] | null>;
278
+ /**
279
+ * The member's balance in each of the project's ledgers, as `relay.me.balances()` lists them,
280
+ * read once per run as Relay pins them. `ctx.member.balance(ledger)` returns the one whose
281
+ * ledger key or ID it names, and fails with `author-error` for a ledger not listed.
282
+ */
283
+ balances?: FakeAnswer<[], Result<typeof pointBalanceSchema>[]>;
284
+ /**
285
+ * The member's accepted, unrevoked quest completions, each naming its quest by key, read once
286
+ * per run as Relay pins them. `ctx.member.completions()` filters, orders and limits them as Relay
287
+ * does.
288
+ */
289
+ completions?: FakeAnswer<[], Result<typeof memberCompletionSchema>[]>;
290
+ /** Keys of the unarchived groups the member belongs to, read once per run as Relay pins them. */
291
+ groups?: FakeAnswer<[], string[]>;
292
+ /**
293
+ * The campaigns the project knows, each with whether the member's enrollment is active, read
294
+ * once per run as Relay pins them. `ctx.member.enrolled(campaign)` fails with `author-error`
295
+ * for a campaign not listed.
296
+ */
297
+ campaigns?: FakeAnswer<[], CampaignFact[]>;
298
+ /**
299
+ * The member's progress as inviter in each of the project's referral programs, as
300
+ * `relay.profiles.referral()` returns it, read once per run as Relay pins them.
301
+ * `ctx.member.referrals(program)` returns the one whose key or program ID it names, and fails
302
+ * with `author-error` for a program not listed.
303
+ */
304
+ referrals?: FakeAnswer<[], Result<typeof profileReferralSchema>[]>;
270
305
  };
271
306
  wallet?: {
272
307
  list?: FakeAnswer<[], Result<typeof linkedWalletSchema>[] | null>;
@@ -370,6 +405,11 @@ declare const defaultNow: number;
370
405
  declare const defaultMember = "member_test";
371
406
  /** The attempt ID that seeds a run's randomness unless the test sets `seed`. */
372
407
  declare const defaultSeed = "attempt_test";
408
+ /**
409
+ * The most capability calls one hosted evaluation run can make, shared by all capabilities. The
410
+ * next call throws a `CapabilityError` with code `capability-limit`.
411
+ */
412
+ declare const maxCapabilityCalls = 8;
373
413
  /**
374
414
  * A quest handle from `defineQuest` or `defineQuestType`, as the testing kit uses it.
375
415
  *
@@ -470,12 +510,24 @@ type TestRelease = {
470
510
  humanReview: boolean;
471
511
  integrations: readonly string[];
472
512
  };
513
+ /**
514
+ * Something a run did that had no effect, reported without failing the run. `code` is
515
+ * `completion-key-ignored`: the evaluator returned a `completionKey` its completion policy ignores.
516
+ *
517
+ * @compat output
518
+ */
519
+ type QuestDiagnostic = {
520
+ code: string;
521
+ message: string;
522
+ };
473
523
  /** @compat output */
474
524
  type TestContext<Q extends TestableQuest = TestableQuest> = {
475
525
  /** The host context to pass to `quest.evaluate`. */
476
526
  context: QuestHostContext<Q>;
477
527
  /** The capability calls quest code has made so far, in order. */
478
528
  calls: CapabilityCall[];
529
+ /** What `quest.evaluate` has reported so far that had no effect. */
530
+ diagnostics: QuestDiagnostic[];
479
531
  release: TestRelease;
480
532
  /** The run's start time and seed. */
481
533
  now: number;
@@ -486,7 +538,27 @@ type QuestRun = {
486
538
  decision: Decision;
487
539
  calls: CapabilityCall[];
488
540
  release: TestRelease;
541
+ /**
542
+ * What the run did that had no effect; Relay records none of it for hosted attempts. `runQuest`
543
+ * always sets it.
544
+ */
545
+ diagnostics?: QuestDiagnostic[];
546
+ };
547
+ /** What `runQuest` resolves with. */
548
+ type DiagnosedRun = QuestRun & {
549
+ /** What the run did that had no effect; Relay records none of it for hosted attempts. */
550
+ diagnostics: QuestDiagnostic[];
489
551
  };
552
+ /**
553
+ * Quest code failed on its own: `evaluate` threw something other than a capability failure it
554
+ * received, or returned no decision. Relay fails the attempt at once, without retrying, with code
555
+ * `evaluator-error` and this message; `cause` is what quest code threw.
556
+ */
557
+ declare class EvaluatorError extends Error {
558
+ readonly code = "evaluator-error";
559
+ readonly retryable = false;
560
+ constructor(thrown: unknown);
561
+ }
490
562
  /**
491
563
  * Builds the host context `quest.evaluate` takes, with fake readers that answer from `facts`. Use
492
564
  * it to call `quest.evaluate` yourself; `runQuest` also freezes the clock, seeds randomness and
@@ -499,11 +571,12 @@ declare function createTestContext<Q extends TestableQuest>(quest: Q, options?:
499
571
  * capability readers answered from `facts` and checked against Relay's capability contracts, and
500
572
  * the decision's rewards checked against the published bundle.
501
573
  *
502
- * Resolves with the decision and every capability call. Rejects with what quest code threw, such
503
- * as an uncaught `CapabilityError` (Relay retries a retryable one), or with a `TestSetupError` for
504
- * a call the facts cannot answer.
574
+ * Resolves with the decision and every capability call. Rejects with a capability failure that
575
+ * escaped quest code, as thrown or wrapped (Relay retries a retryable one); with an
576
+ * `EvaluatorError` for anything else quest code threw, which Relay fails the attempt with once;
577
+ * or with a `TestSetupError` for a call the facts cannot answer.
505
578
  */
506
- declare function runQuest<Q extends TestableQuest>(quest: Q, options?: RunQuestOptions<Q>): Promise<QuestRun>;
579
+ declare function runQuest<Q extends TestableQuest>(quest: Q, options?: RunQuestOptions<Q>): Promise<DiagnosedRun>;
507
580
 
508
581
  type Kind = Decision["kind"];
509
582
  type DecisionOf<K extends Kind> = Extract<Decision, {
@@ -650,4 +723,4 @@ type AttemptReplay = {
650
723
  */
651
724
  declare function replayAttempt<Q extends TestableQuest>(quest: Q, capture: unknown, options?: ReplayOptions): Promise<AttemptReplay>;
652
725
 
653
- export { type AttemptReplay, type CalendarSegment, type CapabilityCall, type CapabilityOutcome, type CapabilityRequest, Decision, DecisionAssertionError, type FakeAnswer, type QuestHostContext, type QuestInputOf, type QuestRun, type ReplayDivergence, type ReplayOptions, type RunQuestOptions, type TestContext, type TestFacts, type TestRelease, TestSetupError, type TestableQuest, type TrackerFacts, type TrackerObservationInput, type TrackerReadRequest, type TrackerRecordInput, type WalletBalanceRequest, createTestContext, defaultMember, defaultNow, defaultSeed, expectAccept, expectDefer, expectProgress, expectReject, expectReview, replayAttempt, runQuest, trackerObservation, trackerPage };
726
+ export { type AttemptReplay, type CalendarSegment, type CapabilityCall, type CapabilityOutcome, type CapabilityRequest, Decision, DecisionAssertionError, EvaluatorError, type FakeAnswer, type QuestDiagnostic, type QuestHostContext, type QuestInputOf, type QuestRun, type ReplayDivergence, type ReplayOptions, type RunQuestOptions, type TestContext, type TestFacts, type TestRelease, TestSetupError, type TestableQuest, type TrackerFacts, type TrackerObservationInput, type TrackerReadRequest, type TrackerRecordInput, type WalletBalanceRequest, createTestContext, defaultMember, defaultNow, defaultSeed, expectAccept, expectDefer, expectProgress, expectReject, expectReview, maxCapabilityCalls, replayAttempt, runQuest, trackerObservation, trackerPage };