@domino-sdk/relay 1.0.0-next.8 → 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 +1135 -285
  4. package/dist/authoring.js +545 -269
  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 -2528
  9. package/dist/browser.js +8 -6
  10. package/dist/capability-error-DNMwKmlL.d.ts +458 -0
  11. package/dist/{chunk-V7EZUZ3Z.js → chunk-36HTX2BM.js} +389 -169
  12. package/dist/chunk-6QJ3LADK.js +112 -0
  13. package/dist/{chunk-77H7APVD.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-V5R2DMGY.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-QBOHLT7M.js → chunk-XFMSUPNS.js} +1 -1
  24. package/dist/{chunk-6A6K5RUD.js → chunk-ZVIRG24J.js} +145 -42
  25. package/dist/{client-CK4nwt7V.d.ts → client-XiuFnug_.d.ts} +2193 -562
  26. package/dist/{submission-input-C9qm9ixd.d.ts → groups-Ck-OxzjD.d.ts} +919 -1142
  27. package/dist/identity-integration-GxAHdKR2.d.ts +58 -0
  28. package/dist/{images--vZ9U0kr.d.ts → images-Dv-P5VBw.d.ts} +2 -2
  29. package/dist/index.d.ts +13 -9
  30. package/dist/index.js +17 -6
  31. package/dist/internal.d.ts +82 -43
  32. package/dist/internal.js +58 -90
  33. package/dist/offers-Cy-e4o5x.d.ts +431 -0
  34. package/dist/{pages-BzqJuI69.d.ts → outcomes-kVB-Juzs.d.ts} +2386 -1490
  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 +3122 -1011
  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 -4216
  44. package/dist/schema.js +322 -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-MRIURJE3.js +0 -257
  54. package/dist/chunk-VARGF4JS.js +0 -1733
  55. package/dist/chunk-ZWY3R6B3.js +0 -26
  56. package/dist/collection-BGneJ6Bk.d.ts +0 -114
  57. package/dist/integrations-C3Sp558f.d.ts +0 -1297
  58. package/dist/point-ledgers-iS00Z_v0.d.ts +0 -37
  59. package/dist/schema-pnuWqvGn.d.ts +0 -3396
@@ -1,60 +1,12 @@
1
- import { V as ValueEvidence, i as referralAcceptSchema, d as LeaderboardQuery, a as AuthProvider, j as engagementPageQuerySchema, k as contentQualificationQuerySchema, m as contentAdmissionQuerySchema, n as contentEnrollmentInputSchema, o as contentReleaseInputSchema } from './submission-input-C9qm9ixd.js';
2
- import { b as QuizEvidence, A as Attempt, M as MemberProgress, s as submitSchema, g as contentPerformanceQuerySchema } from './schema-pnuWqvGn.js';
3
- import { c as ParticipantSession, e as QuestView, a as PageQuery, q as questExperienceSchema, f as exchangeSchema } from './pages-BzqJuI69.js';
1
+ import { aG as referralAcceptSchema, g as LeaderboardQuery, b as CampaignEnrollmentInput, d as CampaignWithdrawalInput, m as PointHistoryQuery, k as PointEntryKind, V as engagementPageQuerySchema } from './groups-Ck-OxzjD.js';
2
+ import { i as QuestView, b as QuestEnrollmentInput, Q as QuestClaimInput, f as QuestOutcomeQuery, P as questExperienceSchema, n as RewardDeliveryAction, A as contentQualificationQuerySchema } from './outcomes-kVB-Juzs.js';
3
+ import { M as MissingPrerequisite, V as ValueEvidence, a as AuthProvider } from './submission-input-BZkm6ohU.js';
4
+ import { R as RequestError, a as RequestErrorDetails, b as RequestErrorKind } from './request-error-DWduJCGV.js';
5
+ import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode, bI as submitSchema, aI as contentPerformanceQuerySchema } from './schema-DfJzH2ci.js';
6
+ import { d as ParticipantSession, a as PageQuery, g as exchangeSchema, R as RelayEvent, b as ParticipantActivity } from './pages-BBYD21IE.js';
4
7
  import { z } from 'zod';
5
- import { p as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-DDMFBRKe.js';
6
- import { w as walletAddressInputSchema, l as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-BGOfFkG9.js';
7
-
8
- /**
9
- * The request-error core every Domino client error extends: the participant `RelayError` and the
10
- * management client's error share these fields, so one handler serves both.
11
- *
12
- * `kind` says what happened:
13
- *
14
- * - `http`: the server answered with an error status.
15
- * - `network`: the transport failed, including a response body cut off after its headers.
16
- * - `timeout`: the client's deadline passed.
17
- * - `aborted`: the caller cancelled the request.
18
- * - `invalid-response`: a 2xx answer that is not JSON, or not the shape this SDK version expects.
19
- * - `client`: the client refused the call without sending it, such as for invalid input.
20
- */
21
- type RequestErrorKind = "http" | "network" | "timeout" | "aborted" | "invalid-response" | "client";
22
- /**
23
- * What to do when `uncertain` is true. `replay`: sending the call again with the same
24
- * `operationId` is safe, because the server applies it at most once. `reconcile`: read the state
25
- * first, since repeating the call could apply it twice.
26
- */
27
- type RequestRecovery = "replay" | "reconcile";
28
- type RequestErrorDetails = {
29
- kind: RequestErrorKind;
30
- /** True only when a write may have been applied. Reads are never uncertain. */
31
- uncertain?: boolean;
32
- /** The HTTP status, whenever response headers arrived. Never invented. */
33
- status?: number;
34
- /** A machine-readable code: open, so a newer server's codes are kept. */
35
- code?: string;
36
- /** The call's idempotency or action ID, to replay it with. */
37
- operationId?: string;
38
- cause?: unknown;
39
- };
40
- declare const requestErrorBrand: unique symbol;
41
- /**
42
- * Whether `value` is a `RequestError` from any copy of the SDK. Prefer it to `instanceof`, which
43
- * fails when an app bundles two copies of the package.
44
- */
45
- declare function isRequestError(value: unknown): value is RequestError;
46
- declare class RequestError extends Error {
47
- readonly name: string;
48
- readonly [requestErrorBrand] = true;
49
- readonly kind: RequestErrorKind;
50
- readonly uncertain: boolean;
51
- readonly status: number | undefined;
52
- readonly code: string | undefined;
53
- readonly operationId: string | undefined;
54
- /** `replay` when there is an `operationId`, else `reconcile`; only when `uncertain`. */
55
- readonly recovery: RequestRecovery | undefined;
56
- constructor(message: string, details: RequestErrorDetails);
57
- }
8
+ import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-D2aFcOxu.js';
9
+ import { y as walletAddressInputSchema, I as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-YssWxGg8.js';
58
10
 
59
11
  /** What happened, as in every Domino client error (see `RequestError`). */
60
12
  type RelayErrorKind = RequestErrorKind;
@@ -82,18 +34,45 @@ declare const RelayErrorCode: {
82
34
  readonly NotFound: "not-found";
83
35
  /** The quest has no failed attempt the member can retry. */
84
36
  readonly RetryUnavailable: "retry-unavailable";
85
- /** Durable submission storage is missing, blocked or unreadable. */
37
+ /**
38
+ * Durable submission storage is missing, blocked or unreadable. Nothing was lost: call the
39
+ * handle's `status()` or `resume()` again once storage is available.
40
+ */
86
41
  readonly SubmissionStorage: "submission-storage";
42
+ /** Browser storage is full, so submission progress was not saved. Free space, then resume. */
43
+ readonly SubmissionStorageQuota: "submission-storage-quota";
87
44
  /** The saved submission is in a state that does not allow this action. */
88
45
  readonly SubmissionConflict: "submission-conflict";
89
46
  /** The quest changed since the member saw it; review it before submitting again. */
90
47
  readonly QuestUpdated: "quest-updated";
48
+ /** Wait for the deferred attempt before submitting another action. */
49
+ readonly AttemptPending: "attempt-pending";
91
50
  /** The quiz changed since the member answered it. */
92
51
  readonly StaleQuiz: "stale-quiz";
93
52
  /** Relay refused the submitted evidence. */
94
53
  readonly InvalidSubmission: "invalid-submission";
95
54
  /** A page cursor Relay cannot read; start again from the first page. */
96
55
  readonly InvalidCursor: "invalid-cursor";
56
+ /** No point ledger in the project has the key or ID the call named. */
57
+ readonly PointLedgerNotFound: "point-ledger-not-found";
58
+ /** The member has not joined this project, so it holds no points here. */
59
+ readonly NotJoined: "not-joined";
60
+ /** The quest or campaign is not open at this time. */
61
+ readonly OutsideWindow: "outside-window";
62
+ /** The signed-in member must enroll in the campaign first. */
63
+ readonly EnrollmentRequired: "enrollment-required";
64
+ /** The quest's current reward budget has no remaining capacity. */
65
+ readonly BudgetExhausted: "budget-exhausted";
66
+ /** No published offer has the key or ID the call named. */
67
+ readonly OfferNotFound: "offer-not-found";
68
+ /** The operator paused this offer. */
69
+ readonly OfferPaused: "offer-paused";
70
+ /** This member has already used the offer's allowed number of redemptions. */
71
+ readonly OfferLimitReached: "offer-limit-reached";
72
+ /** No declared units remain. */
73
+ readonly OfferOutOfStock: "offer-out-of-stock";
74
+ /** The participant's available point balance is below the offer price. */
75
+ readonly InsufficientPoints: "insufficient-points";
97
76
  /** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
98
77
  readonly WalletSigner: "wallet-signer";
99
78
  };
@@ -101,10 +80,7 @@ declare const RelayErrorCode: {
101
80
  type RelayErrorCode = KnownRelayErrorCode | (string & {});
102
81
  type RelayErrorDetails = RequestErrorDetails & {
103
82
  code?: RelayErrorCode;
104
- missing?: {
105
- quest: string;
106
- title: string;
107
- }[];
83
+ missing?: MissingPrerequisite[];
108
84
  };
109
85
  declare const relayErrorBrand: unique symbol;
110
86
  /** Whether `value` is a `RelayError` from any copy of the SDK. Prefer it to `instanceof`. */
@@ -114,11 +90,8 @@ declare class RelayError extends RequestError {
114
90
  readonly name: string;
115
91
  readonly [relayErrorBrand] = true;
116
92
  readonly code: RelayErrorCode | undefined;
117
- /** Prerequisite quests the member has not completed, when Relay refused for that reason. */
118
- readonly missing: {
119
- quest: string;
120
- title: string;
121
- }[];
93
+ /** Prerequisites the member does not currently meet, when Relay refused for that reason. */
94
+ readonly missing: MissingPrerequisite[];
122
95
  constructor(message: string, details: RelayErrorDetails);
123
96
  }
124
97
 
@@ -234,8 +207,16 @@ type RelayRequestOptions = {
234
207
  * session (wallet linking, collection passes, retries) read the current session when omitted.
235
208
  */
236
209
  session?: string;
237
- /** Cancels the call, which rejects with a `RelayError` of kind `aborted`. */
210
+ /**
211
+ * Cancels the call, which rejects with a `RelayError` of kind `aborted`. Cancelling stops any
212
+ * retry; a write already sent stays `uncertain`, since Relay may have applied it.
213
+ */
238
214
  signal?: AbortSignal;
215
+ /**
216
+ * The call's deadline in milliseconds, covering every attempt, the waits between them and the
217
+ * answer's body. Replaces the client's `timeout` for this call.
218
+ */
219
+ timeout?: number;
239
220
  };
240
221
  type RelayClientOptions = {
241
222
  baseUrl: string;
@@ -244,8 +225,138 @@ type RelayClientOptions = {
244
225
  organization?: string;
245
226
  project?: string;
246
227
  environment?: "test" | "live";
228
+ /**
229
+ * Each call's deadline in milliseconds, covering retries and the answer's body; a call's own
230
+ * `timeout` replaces it. Defaults to 15 seconds.
231
+ */
232
+ timeout?: number;
247
233
  };
248
234
  declare function createRelayClient(options: RelayClientOptions): {
235
+ offers: {
236
+ /** Offers available to this participant, including stock and per-member availability. */
237
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
238
+ id: string;
239
+ title: string;
240
+ price: {
241
+ kind: "points";
242
+ balance: string;
243
+ amount: number;
244
+ };
245
+ reward: {
246
+ kind: "tier";
247
+ reward: {
248
+ id: string;
249
+ title: string;
250
+ tiers: {
251
+ id: string;
252
+ title: string;
253
+ }[];
254
+ inventory: {
255
+ kind: "untracked";
256
+ };
257
+ fulfillment: {
258
+ kind: "staff-handover";
259
+ } | {
260
+ kind: "automatic";
261
+ };
262
+ };
263
+ tier: string;
264
+ };
265
+ stock: number;
266
+ limit: {
267
+ perMember: number;
268
+ };
269
+ enabled: boolean;
270
+ revision: number;
271
+ available: number;
272
+ redeemed: number;
273
+ availability: {
274
+ kind: "available";
275
+ remaining: number;
276
+ } | {
277
+ kind: "out-of-stock";
278
+ } | {
279
+ kind: "limit-reached";
280
+ } | {
281
+ kind: "paused";
282
+ };
283
+ key?: string | undefined;
284
+ }[]>;
285
+ /** Redeems one offer. Persist `actionId` to retry after an uncertain result. */
286
+ redeem: (offer: string, input?: {
287
+ actionId?: string;
288
+ }, requestOptions?: RelayRequestOptions) => Promise<{
289
+ status: "fulfilled";
290
+ id: string;
291
+ offer: string;
292
+ member: string;
293
+ reservation: string;
294
+ price: {
295
+ kind: "points";
296
+ balance: string;
297
+ amount: number;
298
+ };
299
+ reward: {
300
+ kind: "tier";
301
+ reward: {
302
+ id: string;
303
+ title: string;
304
+ tiers: {
305
+ id: string;
306
+ title: string;
307
+ }[];
308
+ inventory: {
309
+ kind: "untracked";
310
+ };
311
+ fulfillment: {
312
+ kind: "staff-handover";
313
+ } | {
314
+ kind: "automatic";
315
+ };
316
+ };
317
+ tier: string;
318
+ };
319
+ entitlement: string;
320
+ revision: number;
321
+ redeemedAt: number;
322
+ } | {
323
+ status: "canceled";
324
+ canceledAt: number;
325
+ reason: string;
326
+ id: string;
327
+ offer: string;
328
+ member: string;
329
+ reservation: string;
330
+ price: {
331
+ kind: "points";
332
+ balance: string;
333
+ amount: number;
334
+ };
335
+ reward: {
336
+ kind: "tier";
337
+ reward: {
338
+ id: string;
339
+ title: string;
340
+ tiers: {
341
+ id: string;
342
+ title: string;
343
+ }[];
344
+ inventory: {
345
+ kind: "untracked";
346
+ };
347
+ fulfillment: {
348
+ kind: "staff-handover";
349
+ } | {
350
+ kind: "automatic";
351
+ };
352
+ };
353
+ tier: string;
354
+ };
355
+ entitlement: string;
356
+ revision: number;
357
+ redeemedAt: number;
358
+ }>;
359
+ };
249
360
  referrals: {
250
361
  list: (requestOptions?: RelayRequestOptions) => Promise<{
251
362
  id: string;
@@ -274,6 +385,8 @@ declare function createRelayClient(options: RelayClientOptions): {
274
385
  };
275
386
  fulfillment: {
276
387
  kind: "staff-handover";
388
+ } | {
389
+ kind: "automatic";
277
390
  };
278
391
  };
279
392
  tier: string;
@@ -296,6 +409,8 @@ declare function createRelayClient(options: RelayClientOptions): {
296
409
  };
297
410
  fulfillment: {
298
411
  kind: "staff-handover";
412
+ } | {
413
+ kind: "automatic";
299
414
  };
300
415
  };
301
416
  tier: string;
@@ -322,6 +437,8 @@ declare function createRelayClient(options: RelayClientOptions): {
322
437
  };
323
438
  fulfillment: {
324
439
  kind: "staff-handover";
440
+ } | {
441
+ kind: "automatic";
325
442
  };
326
443
  };
327
444
  tier: string;
@@ -374,6 +491,8 @@ declare function createRelayClient(options: RelayClientOptions): {
374
491
  };
375
492
  fulfillment: {
376
493
  kind: "staff-handover";
494
+ } | {
495
+ kind: "automatic";
377
496
  };
378
497
  };
379
498
  tier: string;
@@ -396,6 +515,8 @@ declare function createRelayClient(options: RelayClientOptions): {
396
515
  };
397
516
  fulfillment: {
398
517
  kind: "staff-handover";
518
+ } | {
519
+ kind: "automatic";
399
520
  };
400
521
  };
401
522
  tier: string;
@@ -422,6 +543,8 @@ declare function createRelayClient(options: RelayClientOptions): {
422
543
  };
423
544
  fulfillment: {
424
545
  kind: "staff-handover";
546
+ } | {
547
+ kind: "automatic";
425
548
  };
426
549
  };
427
550
  tier: string;
@@ -453,7 +576,7 @@ declare function createRelayClient(options: RelayClientOptions): {
453
576
  accounts: {
454
577
  id: string;
455
578
  program: string;
456
- kind: "milestone" | "fixed" | "bonus";
579
+ kind: "fixed" | "milestone" | "bonus";
457
580
  balance: string;
458
581
  earned: number;
459
582
  settled: number;
@@ -476,125 +599,519 @@ declare function createRelayClient(options: RelayClientOptions): {
476
599
  ok: true;
477
600
  }>;
478
601
  };
479
- tieredRewards: {
480
- /**
481
- * The project's tiered rewards with their keys. Entitlements and reward
482
- * definitions name them by ID: use this to find the ID for a key.
483
- */
484
- list: (requestOptions?: RelayRequestOptions) => Promise<{
485
- id: string;
486
- key: string | null;
487
- }[]>;
488
- };
489
- pointLedgers: {
490
- /**
491
- * The project's point ledgers with their keys and names. Reads return
492
- * ledger IDs: use this to find the ID for a key, or a ledger's name.
493
- */
494
- list: (requestOptions?: RelayRequestOptions) => Promise<{
495
- id: string;
496
- key: string | null;
497
- name: string;
498
- }[]>;
499
- };
500
- leaderboards: {
501
- list: (requestOptions?: RelayRequestOptions) => Promise<{
502
- id: string;
503
- title: string;
504
- balance: string;
505
- score: {
506
- kind: "balance";
507
- } | {
508
- window: {
509
- kind: "fixed";
510
- start: number;
511
- end: number;
512
- } | {
513
- kind: "all-time";
514
- } | {
515
- kind: "rolling";
516
- days: number;
517
- } | {
518
- kind: "calendar";
519
- period: "day" | "week" | "month";
520
- timeZone: string;
602
+ rewards: {
603
+ /** The signed-in member's earned rewards, including pickup allocation and collection state. */
604
+ entitlements: (options?: RelayRequestOptions) => Promise<{
605
+ items: ({
606
+ [x: string]: unknown;
607
+ status: "available";
608
+ id: string;
609
+ member: string;
610
+ reward: {
611
+ [x: string]: unknown;
612
+ id: string;
613
+ title: string;
614
+ tiers: {
615
+ [x: string]: unknown;
616
+ id: string;
617
+ title: string;
618
+ }[];
619
+ inventory: {
620
+ [x: string]: unknown;
621
+ kind: string;
622
+ };
623
+ fulfillment: {
624
+ [x: string]: unknown;
625
+ kind: string;
626
+ };
521
627
  };
522
- kind: "earned";
523
- quests?: string[] | undefined;
628
+ earnedTier: string;
629
+ tier: string;
630
+ revision: number;
524
631
  } | {
525
- kind: "net";
526
- window: {
527
- kind: "fixed";
528
- start: number;
529
- end: number;
530
- } | {
531
- kind: "all-time";
532
- } | {
533
- kind: "rolling";
534
- days: number;
535
- } | {
536
- kind: "calendar";
537
- period: "day" | "week" | "month";
538
- timeZone: string;
539
- };
540
- };
541
- access: "participants" | "public";
542
- key?: string | undefined;
543
- group?: string | undefined;
544
- }[]>;
545
- standings: (board: string, query?: LeaderboardQuery, requestOptions?: RelayRequestOptions) => Promise<{
546
- leaderboard: string;
547
- title: string;
548
- version: string;
549
- calculation: "balance" | "earned" | "net";
550
- period: {
551
- start: number | null;
552
- end: number | null;
553
- };
554
- calculatedAt: number;
555
- lastEntryAt: number | null;
556
- total: number;
557
- items: {
558
- participant: string;
559
- name: string;
560
- score: number;
561
- rank: number;
562
- profile: {
632
+ [x: string]: unknown;
633
+ status: "handing-over";
634
+ handover: string;
635
+ startedAt: number;
636
+ id: string;
637
+ member: string;
638
+ reward: {
639
+ [x: string]: unknown;
563
640
  id: string;
564
- name: string;
565
- avatar: {
566
- source: "upload";
567
- url: string;
568
- seed: string;
569
- } | {
570
- source: "account";
571
- provider: "google" | "x" | "discord";
572
- url: string;
573
- seed: string;
574
- } | {
575
- source: "generated";
576
- seed: string;
641
+ title: string;
642
+ tiers: {
643
+ [x: string]: unknown;
644
+ id: string;
645
+ title: string;
646
+ }[];
647
+ inventory: {
648
+ [x: string]: unknown;
649
+ kind: string;
577
650
  };
578
- } | null;
579
- member?: string | undefined;
580
- }[];
581
- me: {
582
- participant: string;
583
- name: string;
584
- score: number;
585
- rank: number;
586
- profile: {
587
- id: string;
588
- name: string;
589
- avatar: {
590
- source: "upload";
591
- url: string;
592
- seed: string;
593
- } | {
594
- source: "account";
595
- provider: "google" | "x" | "discord";
596
- url: string;
597
- seed: string;
651
+ fulfillment: {
652
+ [x: string]: unknown;
653
+ kind: string;
654
+ };
655
+ };
656
+ earnedTier: string;
657
+ tier: string;
658
+ revision: number;
659
+ allocation?: {
660
+ [x: string]: unknown;
661
+ item: string;
662
+ label: string;
663
+ } | undefined;
664
+ } | {
665
+ [x: string]: unknown;
666
+ status: "collected";
667
+ handover: string;
668
+ startedAt: number;
669
+ collectedAt: number;
670
+ id: string;
671
+ member: string;
672
+ reward: {
673
+ [x: string]: unknown;
674
+ id: string;
675
+ title: string;
676
+ tiers: {
677
+ [x: string]: unknown;
678
+ id: string;
679
+ title: string;
680
+ }[];
681
+ inventory: {
682
+ [x: string]: unknown;
683
+ kind: string;
684
+ };
685
+ fulfillment: {
686
+ [x: string]: unknown;
687
+ kind: string;
688
+ };
689
+ };
690
+ earnedTier: string;
691
+ tier: string;
692
+ revision: number;
693
+ allocation?: {
694
+ [x: string]: unknown;
695
+ item: string;
696
+ label: string;
697
+ } | undefined;
698
+ recovery?: {
699
+ completion: string;
700
+ reason: string;
701
+ flaggedAt: number;
702
+ remainingTier: string | null;
703
+ } | undefined;
704
+ } | {
705
+ [x: string]: unknown;
706
+ status: "void";
707
+ voidedAt: number;
708
+ id: string;
709
+ member: string;
710
+ reward: {
711
+ [x: string]: unknown;
712
+ id: string;
713
+ title: string;
714
+ tiers: {
715
+ [x: string]: unknown;
716
+ id: string;
717
+ title: string;
718
+ }[];
719
+ inventory: {
720
+ [x: string]: unknown;
721
+ kind: string;
722
+ };
723
+ fulfillment: {
724
+ [x: string]: unknown;
725
+ kind: string;
726
+ };
727
+ };
728
+ earnedTier: string;
729
+ tier: string;
730
+ revision: number;
731
+ } | {
732
+ status: "unsupported";
733
+ reportedStatus: string;
734
+ id: string;
735
+ member: string;
736
+ reward: {
737
+ [x: string]: unknown;
738
+ id: string;
739
+ title: string;
740
+ tiers: {
741
+ [x: string]: unknown;
742
+ id: string;
743
+ title: string;
744
+ }[];
745
+ inventory: {
746
+ [x: string]: unknown;
747
+ kind: string;
748
+ };
749
+ fulfillment: {
750
+ [x: string]: unknown;
751
+ kind: string;
752
+ };
753
+ };
754
+ earnedTier: string;
755
+ tier: string;
756
+ revision: number;
757
+ })[];
758
+ }>;
759
+ /** Point awards, current tier entitlements, and integration delivery states. */
760
+ deliveries: (options?: RelayRequestOptions) => Promise<{
761
+ items: ({
762
+ [x: string]: z.core.util.JSONType;
763
+ kind: "points";
764
+ ledger: {
765
+ id: string;
766
+ key: string | null;
767
+ name: string;
768
+ };
769
+ amount: number;
770
+ reversed: number;
771
+ id: string;
772
+ status: string;
773
+ at: number | null;
774
+ quest: string | null;
775
+ completion: string | null;
776
+ } | {
777
+ [x: string]: unknown;
778
+ kind: "tier";
779
+ entitlement: {
780
+ [x: string]: unknown;
781
+ status: "available";
782
+ id: string;
783
+ member: string;
784
+ reward: {
785
+ [x: string]: unknown;
786
+ id: string;
787
+ title: string;
788
+ tiers: {
789
+ [x: string]: unknown;
790
+ id: string;
791
+ title: string;
792
+ }[];
793
+ inventory: {
794
+ [x: string]: unknown;
795
+ kind: string;
796
+ };
797
+ fulfillment: {
798
+ [x: string]: unknown;
799
+ kind: string;
800
+ };
801
+ };
802
+ earnedTier: string;
803
+ tier: string;
804
+ revision: number;
805
+ } | {
806
+ [x: string]: unknown;
807
+ status: "handing-over";
808
+ handover: string;
809
+ startedAt: number;
810
+ id: string;
811
+ member: string;
812
+ reward: {
813
+ [x: string]: unknown;
814
+ id: string;
815
+ title: string;
816
+ tiers: {
817
+ [x: string]: unknown;
818
+ id: string;
819
+ title: string;
820
+ }[];
821
+ inventory: {
822
+ [x: string]: unknown;
823
+ kind: string;
824
+ };
825
+ fulfillment: {
826
+ [x: string]: unknown;
827
+ kind: string;
828
+ };
829
+ };
830
+ earnedTier: string;
831
+ tier: string;
832
+ revision: number;
833
+ allocation?: {
834
+ [x: string]: unknown;
835
+ item: string;
836
+ label: string;
837
+ } | undefined;
838
+ } | {
839
+ [x: string]: unknown;
840
+ status: "collected";
841
+ handover: string;
842
+ startedAt: number;
843
+ collectedAt: number;
844
+ id: string;
845
+ member: string;
846
+ reward: {
847
+ [x: string]: unknown;
848
+ id: string;
849
+ title: string;
850
+ tiers: {
851
+ [x: string]: unknown;
852
+ id: string;
853
+ title: string;
854
+ }[];
855
+ inventory: {
856
+ [x: string]: unknown;
857
+ kind: string;
858
+ };
859
+ fulfillment: {
860
+ [x: string]: unknown;
861
+ kind: string;
862
+ };
863
+ };
864
+ earnedTier: string;
865
+ tier: string;
866
+ revision: number;
867
+ allocation?: {
868
+ [x: string]: unknown;
869
+ item: string;
870
+ label: string;
871
+ } | undefined;
872
+ recovery?: {
873
+ completion: string;
874
+ reason: string;
875
+ flaggedAt: number;
876
+ remainingTier: string | null;
877
+ } | undefined;
878
+ } | {
879
+ [x: string]: unknown;
880
+ status: "void";
881
+ voidedAt: number;
882
+ id: string;
883
+ member: string;
884
+ reward: {
885
+ [x: string]: unknown;
886
+ id: string;
887
+ title: string;
888
+ tiers: {
889
+ [x: string]: unknown;
890
+ id: string;
891
+ title: string;
892
+ }[];
893
+ inventory: {
894
+ [x: string]: unknown;
895
+ kind: string;
896
+ };
897
+ fulfillment: {
898
+ [x: string]: unknown;
899
+ kind: string;
900
+ };
901
+ };
902
+ earnedTier: string;
903
+ tier: string;
904
+ revision: number;
905
+ } | {
906
+ status: "unsupported";
907
+ reportedStatus: string;
908
+ id: string;
909
+ member: string;
910
+ reward: {
911
+ [x: string]: unknown;
912
+ id: string;
913
+ title: string;
914
+ tiers: {
915
+ [x: string]: unknown;
916
+ id: string;
917
+ title: string;
918
+ }[];
919
+ inventory: {
920
+ [x: string]: unknown;
921
+ kind: string;
922
+ };
923
+ fulfillment: {
924
+ [x: string]: unknown;
925
+ kind: string;
926
+ };
927
+ };
928
+ earnedTier: string;
929
+ tier: string;
930
+ revision: number;
931
+ };
932
+ id: string;
933
+ status: string;
934
+ at: number | null;
935
+ quest: string | null;
936
+ completion: string | null;
937
+ } | {
938
+ [x: string]: z.core.util.JSONType | undefined;
939
+ kind: "integration";
940
+ provider: string;
941
+ action: string;
942
+ deliveredAt: number | null;
943
+ revokedAt: number | null;
944
+ reconciliation: {
945
+ [x: string]: z.core.util.JSONType;
946
+ status: string;
947
+ ownership: string;
948
+ at: number;
949
+ } | null;
950
+ id: string;
951
+ status: string;
952
+ at: number | null;
953
+ quest: string | null;
954
+ completion: string | null;
955
+ roleId?: string | undefined;
956
+ } | {
957
+ kind: "unknown";
958
+ reportedKind: string;
959
+ id: string;
960
+ status: string;
961
+ at: number | null;
962
+ quest: string | null;
963
+ completion: string | null;
964
+ })[];
965
+ }>;
966
+ };
967
+ tieredRewards: {
968
+ /**
969
+ * The project's tiered rewards with their keys. Entitlements and reward
970
+ * definitions name them by ID: use this to find the ID for a key.
971
+ */
972
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
973
+ id: string;
974
+ key: string | null;
975
+ }[]>;
976
+ };
977
+ pointLedgers: {
978
+ /**
979
+ * The project's point ledgers with their keys and names. Reads return
980
+ * ledger IDs: use this to find the ID for a key, or a ledger's name.
981
+ */
982
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
983
+ id: string;
984
+ key: string | null;
985
+ name: string;
986
+ }[]>;
987
+ };
988
+ leaderboards: {
989
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
990
+ id: string;
991
+ title: string;
992
+ balance: string;
993
+ score: {
994
+ kind: "balance";
995
+ } | {
996
+ window: {
997
+ kind: "fixed";
998
+ start: number;
999
+ end: number;
1000
+ } | {
1001
+ kind: "all-time";
1002
+ } | {
1003
+ kind: "rolling";
1004
+ days: number;
1005
+ } | {
1006
+ kind: "calendar";
1007
+ period: "day" | "week" | "month";
1008
+ };
1009
+ kind: "earned";
1010
+ quests?: string[] | undefined;
1011
+ } | {
1012
+ kind: "net";
1013
+ window: {
1014
+ kind: "fixed";
1015
+ start: number;
1016
+ end: number;
1017
+ } | {
1018
+ kind: "all-time";
1019
+ } | {
1020
+ kind: "rolling";
1021
+ days: number;
1022
+ } | {
1023
+ kind: "calendar";
1024
+ period: "day" | "week" | "month";
1025
+ };
1026
+ };
1027
+ access: "participants" | "public";
1028
+ key?: string | undefined;
1029
+ group?: string | undefined;
1030
+ settle?: {
1031
+ at: "window-end";
1032
+ ties: "shared" | "earliest";
1033
+ prizes: {
1034
+ ranks: [number, number];
1035
+ rewards: ({
1036
+ kind: "tier";
1037
+ reward: {
1038
+ id: string;
1039
+ title: string;
1040
+ tiers: {
1041
+ id: string;
1042
+ title: string;
1043
+ }[];
1044
+ inventory: {
1045
+ kind: "untracked";
1046
+ };
1047
+ fulfillment: {
1048
+ kind: "staff-handover";
1049
+ } | {
1050
+ kind: "automatic";
1051
+ };
1052
+ };
1053
+ tier: string;
1054
+ } | {
1055
+ kind: "points";
1056
+ balance: string;
1057
+ amount: number;
1058
+ })[];
1059
+ }[];
1060
+ } | undefined;
1061
+ }[]>;
1062
+ standings: (board: string, query?: LeaderboardQuery, requestOptions?: RelayRequestOptions) => Promise<{
1063
+ leaderboard: string;
1064
+ title: string;
1065
+ version: string;
1066
+ calculation: "balance" | "earned" | "net";
1067
+ period: {
1068
+ start: number | null;
1069
+ end: number | null;
1070
+ };
1071
+ calculatedAt: number;
1072
+ lastEntryAt: number | null;
1073
+ total: number;
1074
+ items: {
1075
+ participant: string;
1076
+ name: string;
1077
+ score: number;
1078
+ rank: number;
1079
+ profile: {
1080
+ id: string;
1081
+ name: string;
1082
+ avatar: {
1083
+ source: "upload";
1084
+ url: string;
1085
+ seed: string;
1086
+ } | {
1087
+ source: "account";
1088
+ provider: "discord" | "google" | "x";
1089
+ url: string;
1090
+ seed: string;
1091
+ } | {
1092
+ source: "generated";
1093
+ seed: string;
1094
+ };
1095
+ } | null;
1096
+ member?: string | undefined;
1097
+ }[];
1098
+ me: {
1099
+ participant: string;
1100
+ name: string;
1101
+ score: number;
1102
+ rank: number;
1103
+ profile: {
1104
+ id: string;
1105
+ name: string;
1106
+ avatar: {
1107
+ source: "upload";
1108
+ url: string;
1109
+ seed: string;
1110
+ } | {
1111
+ source: "account";
1112
+ provider: "discord" | "google" | "x";
1113
+ url: string;
1114
+ seed: string;
598
1115
  } | {
599
1116
  source: "generated";
600
1117
  seed: string;
@@ -616,7 +1133,7 @@ declare function createRelayClient(options: RelayClientOptions): {
616
1133
  seed: string;
617
1134
  } | {
618
1135
  source: "account";
619
- provider: "google" | "x" | "discord";
1136
+ provider: "discord" | "google" | "x";
620
1137
  url: string;
621
1138
  seed: string;
622
1139
  } | {
@@ -659,7 +1176,7 @@ declare function createRelayClient(options: RelayClientOptions): {
659
1176
  seed: string;
660
1177
  } | {
661
1178
  source: "account";
662
- provider: "google" | "x" | "discord";
1179
+ provider: "discord" | "google" | "x";
663
1180
  url: string;
664
1181
  seed: string;
665
1182
  } | {
@@ -668,12 +1185,12 @@ declare function createRelayClient(options: RelayClientOptions): {
668
1185
  };
669
1186
  displayName: string | null;
670
1187
  avatarChoice: "default" | "account" | "upload" | "generated";
671
- avatarProvider: "google" | "x" | "discord" | null;
1188
+ avatarProvider: "discord" | "google" | "x" | null;
672
1189
  hidden: boolean;
673
1190
  locked: boolean;
674
1191
  visibility: "private" | "participants" | "public";
675
1192
  options: {
676
- provider: "google" | "x" | "discord";
1193
+ provider: "discord" | "google" | "x";
677
1194
  name: string | null;
678
1195
  imageUrl: string | null;
679
1196
  }[];
@@ -691,7 +1208,7 @@ declare function createRelayClient(options: RelayClientOptions): {
691
1208
  seed: string;
692
1209
  } | {
693
1210
  source: "account";
694
- provider: "google" | "x" | "discord";
1211
+ provider: "discord" | "google" | "x";
695
1212
  url: string;
696
1213
  seed: string;
697
1214
  } | {
@@ -700,19 +1217,20 @@ declare function createRelayClient(options: RelayClientOptions): {
700
1217
  };
701
1218
  displayName: string | null;
702
1219
  avatarChoice: "default" | "account" | "upload" | "generated";
703
- avatarProvider: "google" | "x" | "discord" | null;
1220
+ avatarProvider: "discord" | "google" | "x" | null;
704
1221
  hidden: boolean;
705
1222
  locked: boolean;
706
1223
  visibility: "private" | "participants" | "public";
707
1224
  options: {
708
- provider: "google" | "x" | "discord";
1225
+ provider: "discord" | "google" | "x";
709
1226
  name: string | null;
710
1227
  imageUrl: string | null;
711
1228
  }[];
712
1229
  }>;
713
1230
  /**
714
1231
  * Uploads a JPEG, PNG or WebP of at most 5 MB as the member's avatar. The server crops it to
715
- * a 512×512 WebP without metadata. Retrying with the same `uploadId` is idempotent.
1232
+ * a 512×512 WebP without metadata. The client never resends it: retrying with the same
1233
+ * `uploadId` and file stores no second picture, but only before another upload replaces it.
716
1234
  */
717
1235
  uploadAvatar: (file: Blob, requestOptions?: RelayRequestOptions & {
718
1236
  uploadId?: string;
@@ -725,7 +1243,7 @@ declare function createRelayClient(options: RelayClientOptions): {
725
1243
  seed: string;
726
1244
  } | {
727
1245
  source: "account";
728
- provider: "google" | "x" | "discord";
1246
+ provider: "discord" | "google" | "x";
729
1247
  url: string;
730
1248
  seed: string;
731
1249
  } | {
@@ -734,12 +1252,12 @@ declare function createRelayClient(options: RelayClientOptions): {
734
1252
  };
735
1253
  displayName: string | null;
736
1254
  avatarChoice: "default" | "account" | "upload" | "generated";
737
- avatarProvider: "google" | "x" | "discord" | null;
1255
+ avatarProvider: "discord" | "google" | "x" | null;
738
1256
  hidden: boolean;
739
1257
  locked: boolean;
740
1258
  visibility: "private" | "participants" | "public";
741
1259
  options: {
742
- provider: "google" | "x" | "discord";
1260
+ provider: "discord" | "google" | "x";
743
1261
  name: string | null;
744
1262
  imageUrl: string | null;
745
1263
  }[];
@@ -757,7 +1275,7 @@ declare function createRelayClient(options: RelayClientOptions): {
757
1275
  seed: string;
758
1276
  } | {
759
1277
  source: "account";
760
- provider: "google" | "x" | "discord";
1278
+ provider: "discord" | "google" | "x";
761
1279
  url: string;
762
1280
  seed: string;
763
1281
  } | {
@@ -815,53 +1333,13 @@ declare function createRelayClient(options: RelayClientOptions): {
815
1333
  poster?: string | undefined;
816
1334
  captions?: {
817
1335
  url: string;
818
- language: string;
819
- label: string;
820
- } | undefined;
821
- } | undefined;
822
- };
823
- connections: ("google" | "apple" | "x" | "discord")[];
824
- trigger: {
825
- kind: "automatic";
826
- observation?: {
827
- source: string;
828
- type: string;
829
- } | undefined;
830
- content?: {
831
- tracker: string;
832
- window: {
833
- start: number;
834
- end?: number | undefined;
835
- };
836
- enrollment: "none" | "required";
837
- posts: "after-enrollment" | "since-start";
838
- historical: "automatic" | "claim" | "staff";
839
- } | undefined;
840
- tracker?: {
841
- tracker: string;
842
- source: "custom" | "x-search";
843
- beneficiary: string;
844
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
845
- where?: {
846
- path: string;
847
- gt?: number | {
848
- setting: string;
849
- } | undefined;
850
- gte?: number | {
851
- setting: string;
852
- } | undefined;
853
- lt?: number | {
854
- setting: string;
855
- } | undefined;
856
- lte?: number | {
857
- setting: string;
858
- } | undefined;
859
- } | {
860
- path: string;
861
- equals: string | number | boolean;
1336
+ language: string;
1337
+ label: string;
862
1338
  } | undefined;
863
1339
  } | undefined;
864
- } | {
1340
+ };
1341
+ connections: ("discord" | "google" | "apple" | "x")[];
1342
+ trigger: {
865
1343
  kind: "manual";
866
1344
  input: "text";
867
1345
  constraints: {
@@ -882,26 +1360,92 @@ declare function createRelayClient(options: RelayClientOptions): {
882
1360
  kind: "manual";
883
1361
  input: "none" | "quiz" | "photo";
884
1362
  actor?: "member" | "staff" | undefined;
1363
+ } | {
1364
+ kind: "automatic";
1365
+ tracker?: {
1366
+ tracker: string;
1367
+ source: string;
1368
+ on: "new-record" | "new-observation" | "data-changed";
1369
+ beneficiary: string;
1370
+ where?: {
1371
+ path: string;
1372
+ gt?: number | {
1373
+ setting: string;
1374
+ } | undefined;
1375
+ gte?: number | {
1376
+ setting: string;
1377
+ } | undefined;
1378
+ lt?: number | {
1379
+ setting: string;
1380
+ } | undefined;
1381
+ lte?: number | {
1382
+ setting: string;
1383
+ } | undefined;
1384
+ } | {
1385
+ path: string;
1386
+ equals: string | number | boolean;
1387
+ } | ({
1388
+ path: string;
1389
+ gt?: number | {
1390
+ setting: string;
1391
+ } | undefined;
1392
+ gte?: number | {
1393
+ setting: string;
1394
+ } | undefined;
1395
+ lt?: number | {
1396
+ setting: string;
1397
+ } | undefined;
1398
+ lte?: number | {
1399
+ setting: string;
1400
+ } | undefined;
1401
+ } | {
1402
+ path: string;
1403
+ equals: string | number | boolean;
1404
+ })[] | undefined;
1405
+ enrollment?: "none" | "required" | undefined;
1406
+ since?: "activation" | "window" | "enrollment" | undefined;
1407
+ historical?: "staff" | "claim" | "automatic" | undefined;
1408
+ content?: true | undefined;
1409
+ } | undefined;
885
1410
  };
886
1411
  availability: {
887
1412
  kind: "available";
888
- input: "text" | "url" | "none" | "quiz" | "photo";
1413
+ input: "text" | "none" | "url" | "quiz" | "photo";
889
1414
  } | {
890
1415
  kind: "completed";
891
1416
  } | {
892
1417
  kind: "locked";
893
- missing: {
1418
+ missing: ({
1419
+ kind: "completion";
894
1420
  quest: string;
895
1421
  title: string;
896
- }[];
1422
+ scope: "ever";
1423
+ } | {
1424
+ kind: "completion";
1425
+ quest: string;
1426
+ title: string;
1427
+ scope: "period";
1428
+ period: "day" | "week" | "month";
1429
+ resetsAt: number;
1430
+ } | {
1431
+ kind: "balance";
1432
+ balance: string;
1433
+ title: string;
1434
+ minimum: number;
1435
+ current: number;
1436
+ } | {
1437
+ kind: "group";
1438
+ group: string;
1439
+ title: string;
1440
+ })[];
1441
+ } | {
1442
+ kind: "blocked";
1443
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
1444
+ resetsAt?: number | undefined;
897
1445
  } | {
898
1446
  kind: "staff-required";
899
1447
  } | {
900
1448
  kind: "automatic";
901
- observation?: {
902
- source: string;
903
- type: string;
904
- } | undefined;
905
1449
  } | {
906
1450
  kind: "checking";
907
1451
  attempt: string;
@@ -914,19 +1458,82 @@ declare function createRelayClient(options: RelayClientOptions): {
914
1458
  };
915
1459
  completed: boolean;
916
1460
  completion: {
1461
+ kind: "progress";
1462
+ goal: {
1463
+ kind: "count";
1464
+ count: number;
1465
+ };
1466
+ window: {
1467
+ kind: "lifetime";
1468
+ } | {
1469
+ kind: "calendar";
1470
+ period: "day" | "week" | "month";
1471
+ latenessMs: number;
1472
+ } | {
1473
+ kind: "rolling";
1474
+ durationMs: number;
1475
+ };
1476
+ repeat: "repeat" | "once";
1477
+ } | {
917
1478
  kind: "streak";
918
1479
  days: number;
919
- timeZone: string;
920
1480
  } | {
921
1481
  kind: "once";
922
1482
  } | {
923
1483
  kind: "keyed";
924
1484
  };
1485
+ progress: {
1486
+ current: number;
1487
+ target: number;
1488
+ reason: string;
1489
+ } | null;
925
1490
  completionCount: number;
926
1491
  visibility: "visible" | "hidden";
927
- missing: {
1492
+ missing: ({
1493
+ kind: "completion";
1494
+ quest: string;
1495
+ title: string;
1496
+ scope: "ever";
1497
+ } | {
1498
+ kind: "completion";
928
1499
  quest: string;
929
1500
  title: string;
1501
+ scope: "period";
1502
+ period: "day" | "week" | "month";
1503
+ resetsAt: number;
1504
+ } | {
1505
+ kind: "balance";
1506
+ balance: string;
1507
+ title: string;
1508
+ minimum: number;
1509
+ current: number;
1510
+ } | {
1511
+ kind: "group";
1512
+ group: string;
1513
+ title: string;
1514
+ })[];
1515
+ campaign: {
1516
+ key: string;
1517
+ title: string;
1518
+ enrollment: "none" | "required";
1519
+ enrolledAt: number | null;
1520
+ withdrawnAt: number | null;
1521
+ withdrawalReason: string | null;
1522
+ window?: {
1523
+ from: number;
1524
+ until: number;
1525
+ } | undefined;
1526
+ } | null;
1527
+ window: {
1528
+ from: number;
1529
+ until: number;
1530
+ } | null;
1531
+ budgets: {
1532
+ id: string;
1533
+ scope: "member" | "project";
1534
+ period: "lifetime" | "day" | "week" | "month";
1535
+ remaining: number;
1536
+ resetsAt: number | null;
930
1537
  }[];
931
1538
  attempt: {
932
1539
  id: string;
@@ -934,7 +1541,7 @@ declare function createRelayClient(options: RelayClientOptions): {
934
1541
  quest: string;
935
1542
  member: string;
936
1543
  evidence: string | null;
937
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
1544
+ status: AttemptStatus;
938
1545
  reason: string | null;
939
1546
  retries: number;
940
1547
  generation: number;
@@ -953,19 +1560,31 @@ declare function createRelayClient(options: RelayClientOptions): {
953
1560
  };
954
1561
  fulfillment: {
955
1562
  kind: "staff-handover";
1563
+ } | {
1564
+ kind: "automatic";
956
1565
  };
957
1566
  };
958
1567
  tier: string;
959
- } | {
960
- kind: "points";
961
- balance: string;
962
- amount: number;
963
1568
  } | {
964
1569
  kind: "integration";
965
1570
  provider: "discord";
966
1571
  action: "grant-role";
967
1572
  roleId: string;
1573
+ } | {
1574
+ kind: "points";
1575
+ balance: string;
1576
+ amount: number;
968
1577
  })[] | null;
1578
+ evaluationRun: number;
1579
+ deferCount: number;
1580
+ deferUntil: number | null;
1581
+ nextEvaluationAt: number | null;
1582
+ code: string | null;
1583
+ progress: {
1584
+ current: number;
1585
+ target: number;
1586
+ reason: string;
1587
+ } | null;
969
1588
  requestedReview: boolean;
970
1589
  createdAt: number;
971
1590
  input?: {
@@ -983,7 +1602,7 @@ declare function createRelayClient(options: RelayClientOptions): {
983
1602
  } | undefined;
984
1603
  } | null;
985
1604
  release: string;
986
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
1605
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
987
1606
  lifecycle: "paused" | "active" | "archived";
988
1607
  rewards: ({
989
1608
  kind: "points";
@@ -1038,6 +1657,91 @@ declare function createRelayClient(options: RelayClientOptions): {
1038
1657
  achievedAt: number;
1039
1658
  };
1040
1659
  } | null | undefined;
1660
+ counter?: {
1661
+ goal: number;
1662
+ current: number;
1663
+ window: {
1664
+ key: string;
1665
+ start: number | null;
1666
+ end: number | null;
1667
+ };
1668
+ repeat: "repeat" | "once";
1669
+ settled: number;
1670
+ latest: {
1671
+ id: string;
1672
+ ordinal: number;
1673
+ achievedAt: number;
1674
+ window: string;
1675
+ status: "revoked";
1676
+ completion: string;
1677
+ revokedAt: number;
1678
+ } | {
1679
+ id: string;
1680
+ ordinal: number;
1681
+ achievedAt: number;
1682
+ window: string;
1683
+ status: "awarded";
1684
+ completion: string;
1685
+ } | {
1686
+ id: string;
1687
+ ordinal: number;
1688
+ achievedAt: number;
1689
+ window: string;
1690
+ status: "budget-exhausted";
1691
+ budget: string;
1692
+ } | null;
1693
+ } | null | undefined;
1694
+ }>;
1695
+ /**
1696
+ * Enrolls the signed-in member in a quest whose tracker trigger requires enrollment. Activity
1697
+ * counts from then on; earlier activity is historical, or skipped with `before-enrollment`
1698
+ * on a quest that counts from enrollment. Enrolling again returns the first enrollment.
1699
+ */
1700
+ enroll: (value: QuestEnrollmentInput, requestOptions?: RelayRequestOptions) => Promise<{
1701
+ quest: string;
1702
+ member: string;
1703
+ enrolledAt: number;
1704
+ }>;
1705
+ /**
1706
+ * Claims one of the signed-in member's outcomes skipped as `historical`, on a quest whose
1707
+ * historical policy is `"claim"` (`outcome.claimable`). Relay decides it again with
1708
+ * historical activity released and returns the outcome; a rule that still fails rejects
1709
+ * with a `RelayError` whose code is that rule's skip code.
1710
+ */
1711
+ claim: (value: QuestClaimInput, requestOptions?: RelayRequestOptions) => Promise<{
1712
+ quest: string;
1713
+ tracker: string | null;
1714
+ record: string | null;
1715
+ observedAt: number | null;
1716
+ state: "admitted" | "skipped";
1717
+ code: TrackerSkipCode | null;
1718
+ reason: string | null;
1719
+ attempt: string | null;
1720
+ claimable: boolean;
1721
+ createdAt: number;
1722
+ updatedAt: number;
1723
+ automatic?: string | undefined;
1724
+ }>;
1725
+ /**
1726
+ * Why automatic quests did or did not run for the signed-in member's activity, newest first:
1727
+ * each admission, and each skip with its stable code.
1728
+ */
1729
+ outcomes: (query?: QuestOutcomeQuery, requestOptions?: RelayRequestOptions) => Promise<{
1730
+ items: {
1731
+ quest: string;
1732
+ tracker: string | null;
1733
+ record: string | null;
1734
+ observedAt: number | null;
1735
+ state: "admitted" | "skipped";
1736
+ code: TrackerSkipCode | null;
1737
+ reason: string | null;
1738
+ attempt: string | null;
1739
+ claimable: boolean;
1740
+ createdAt: number;
1741
+ updatedAt: number;
1742
+ automatic?: string | undefined;
1743
+ }[];
1744
+ nextCursor: string | null;
1041
1745
  }>;
1042
1746
  /** Retries verification of the quest's failed attempt. */
1043
1747
  retry: (view: QuestView, requestOptions?: RelayRequestOptions) => Promise<{
@@ -1046,7 +1750,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1046
1750
  quest: string;
1047
1751
  member: string;
1048
1752
  evidence: string | null;
1049
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
1753
+ status: AttemptStatus;
1050
1754
  reason: string | null;
1051
1755
  retries: number;
1052
1756
  generation: number;
@@ -1061,40 +1765,205 @@ declare function createRelayClient(options: RelayClientOptions): {
1061
1765
  title: string;
1062
1766
  }[];
1063
1767
  inventory: {
1064
- kind: "untracked";
1768
+ kind: "untracked";
1769
+ };
1770
+ fulfillment: {
1771
+ kind: "staff-handover";
1772
+ } | {
1773
+ kind: "automatic";
1774
+ };
1775
+ };
1776
+ tier: string;
1777
+ } | {
1778
+ kind: "integration";
1779
+ provider: "discord";
1780
+ action: "grant-role";
1781
+ roleId: string;
1782
+ } | {
1783
+ kind: "points";
1784
+ balance: string;
1785
+ amount: number;
1786
+ })[] | null;
1787
+ evaluationRun: number;
1788
+ deferCount: number;
1789
+ deferUntil: number | null;
1790
+ nextEvaluationAt: number | null;
1791
+ code: string | null;
1792
+ progress: {
1793
+ current: number;
1794
+ target: number;
1795
+ reason: string;
1796
+ } | null;
1797
+ requestedReview: boolean;
1798
+ createdAt: number;
1799
+ input?: {
1800
+ kind: "text";
1801
+ value: string;
1802
+ } | {
1803
+ kind: "url";
1804
+ value: string;
1805
+ } | {
1806
+ kind: "quiz";
1807
+ answers: {
1808
+ [k: string]: string;
1809
+ };
1810
+ release?: string | undefined;
1811
+ } | undefined;
1812
+ }>;
1813
+ experience: (requestOptions?: RelayRequestOptions) => Promise<{
1814
+ entitlements: ({
1815
+ [x: string]: unknown;
1816
+ status: "available";
1817
+ id: string;
1818
+ member: string;
1819
+ reward: {
1820
+ [x: string]: unknown;
1821
+ id: string;
1822
+ title: string;
1823
+ tiers: {
1824
+ [x: string]: unknown;
1825
+ id: string;
1826
+ title: string;
1827
+ }[];
1828
+ inventory: {
1829
+ [x: string]: unknown;
1830
+ kind: string;
1831
+ };
1832
+ fulfillment: {
1833
+ [x: string]: unknown;
1834
+ kind: string;
1835
+ };
1836
+ };
1837
+ earnedTier: string;
1838
+ tier: string;
1839
+ revision: number;
1840
+ } | {
1841
+ [x: string]: unknown;
1842
+ status: "handing-over";
1843
+ handover: string;
1844
+ startedAt: number;
1845
+ id: string;
1846
+ member: string;
1847
+ reward: {
1848
+ [x: string]: unknown;
1849
+ id: string;
1850
+ title: string;
1851
+ tiers: {
1852
+ [x: string]: unknown;
1853
+ id: string;
1854
+ title: string;
1855
+ }[];
1856
+ inventory: {
1857
+ [x: string]: unknown;
1858
+ kind: string;
1859
+ };
1860
+ fulfillment: {
1861
+ [x: string]: unknown;
1862
+ kind: string;
1863
+ };
1864
+ };
1865
+ earnedTier: string;
1866
+ tier: string;
1867
+ revision: number;
1868
+ allocation?: {
1869
+ [x: string]: unknown;
1870
+ item: string;
1871
+ label: string;
1872
+ } | undefined;
1873
+ } | {
1874
+ [x: string]: unknown;
1875
+ status: "collected";
1876
+ handover: string;
1877
+ startedAt: number;
1878
+ collectedAt: number;
1879
+ id: string;
1880
+ member: string;
1881
+ reward: {
1882
+ [x: string]: unknown;
1883
+ id: string;
1884
+ title: string;
1885
+ tiers: {
1886
+ [x: string]: unknown;
1887
+ id: string;
1888
+ title: string;
1889
+ }[];
1890
+ inventory: {
1891
+ [x: string]: unknown;
1892
+ kind: string;
1893
+ };
1894
+ fulfillment: {
1895
+ [x: string]: unknown;
1896
+ kind: string;
1897
+ };
1898
+ };
1899
+ earnedTier: string;
1900
+ tier: string;
1901
+ revision: number;
1902
+ allocation?: {
1903
+ [x: string]: unknown;
1904
+ item: string;
1905
+ label: string;
1906
+ } | undefined;
1907
+ recovery?: {
1908
+ completion: string;
1909
+ reason: string;
1910
+ flaggedAt: number;
1911
+ remainingTier: string | null;
1912
+ } | undefined;
1913
+ } | {
1914
+ [x: string]: unknown;
1915
+ status: "void";
1916
+ voidedAt: number;
1917
+ id: string;
1918
+ member: string;
1919
+ reward: {
1920
+ [x: string]: unknown;
1921
+ id: string;
1922
+ title: string;
1923
+ tiers: {
1924
+ [x: string]: unknown;
1925
+ id: string;
1926
+ title: string;
1927
+ }[];
1928
+ inventory: {
1929
+ [x: string]: unknown;
1930
+ kind: string;
1065
1931
  };
1066
1932
  fulfillment: {
1067
- kind: "staff-handover";
1933
+ [x: string]: unknown;
1934
+ kind: string;
1068
1935
  };
1069
1936
  };
1937
+ earnedTier: string;
1070
1938
  tier: string;
1939
+ revision: number;
1071
1940
  } | {
1072
- kind: "points";
1073
- balance: string;
1074
- amount: number;
1075
- } | {
1076
- kind: "integration";
1077
- provider: "discord";
1078
- action: "grant-role";
1079
- roleId: string;
1080
- })[] | null;
1081
- requestedReview: boolean;
1082
- createdAt: number;
1083
- input?: {
1084
- kind: "text";
1085
- value: string;
1086
- } | {
1087
- kind: "url";
1088
- value: string;
1089
- } | {
1090
- kind: "quiz";
1091
- answers: {
1092
- [k: string]: string;
1941
+ status: "unsupported";
1942
+ reportedStatus: string;
1943
+ id: string;
1944
+ member: string;
1945
+ reward: {
1946
+ [x: string]: unknown;
1947
+ id: string;
1948
+ title: string;
1949
+ tiers: {
1950
+ [x: string]: unknown;
1951
+ id: string;
1952
+ title: string;
1953
+ }[];
1954
+ inventory: {
1955
+ [x: string]: unknown;
1956
+ kind: string;
1957
+ };
1958
+ fulfillment: {
1959
+ [x: string]: unknown;
1960
+ kind: string;
1961
+ };
1093
1962
  };
1094
- release?: string | undefined;
1095
- } | undefined;
1096
- }>;
1097
- experience: (requestOptions?: RelayRequestOptions) => Promise<{
1963
+ earnedTier: string;
1964
+ tier: string;
1965
+ revision: number;
1966
+ })[];
1098
1967
  member: string;
1099
1968
  quests: {
1100
1969
  quest: string;
@@ -1119,28 +1988,35 @@ declare function createRelayClient(options: RelayClientOptions): {
1119
1988
  } | undefined;
1120
1989
  } | undefined;
1121
1990
  };
1122
- connections: ("google" | "apple" | "x" | "discord")[];
1991
+ connections: ("discord" | "google" | "apple" | "x")[];
1123
1992
  trigger: {
1993
+ kind: "manual";
1994
+ input: "text";
1995
+ constraints: {
1996
+ required: boolean;
1997
+ minLength: number;
1998
+ maxLength: number;
1999
+ };
2000
+ actor?: "member" | "staff" | undefined;
2001
+ } | {
2002
+ kind: "manual";
2003
+ input: "url";
2004
+ constraints: {
2005
+ required: boolean;
2006
+ allowedHosts?: string[] | undefined;
2007
+ };
2008
+ actor?: "member" | "staff" | undefined;
2009
+ } | {
2010
+ kind: "manual";
2011
+ input: "none" | "quiz" | "photo";
2012
+ actor?: "member" | "staff" | undefined;
2013
+ } | {
1124
2014
  kind: "automatic";
1125
- observation?: {
1126
- source: string;
1127
- type: string;
1128
- } | undefined;
1129
- content?: {
1130
- tracker: string;
1131
- window: {
1132
- start: number;
1133
- end?: number | undefined;
1134
- };
1135
- enrollment: "none" | "required";
1136
- posts: "after-enrollment" | "since-start";
1137
- historical: "automatic" | "claim" | "staff";
1138
- } | undefined;
1139
2015
  tracker?: {
1140
2016
  tracker: string;
1141
- source: "custom" | "x-search";
2017
+ source: string;
2018
+ on: "new-record" | "new-observation" | "data-changed";
1142
2019
  beneficiary: string;
1143
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
1144
2020
  where?: {
1145
2021
  path: string;
1146
2022
  gt?: number | {
@@ -1158,49 +2034,68 @@ declare function createRelayClient(options: RelayClientOptions): {
1158
2034
  } | {
1159
2035
  path: string;
1160
2036
  equals: string | number | boolean;
1161
- } | undefined;
2037
+ } | ({
2038
+ path: string;
2039
+ gt?: number | {
2040
+ setting: string;
2041
+ } | undefined;
2042
+ gte?: number | {
2043
+ setting: string;
2044
+ } | undefined;
2045
+ lt?: number | {
2046
+ setting: string;
2047
+ } | undefined;
2048
+ lte?: number | {
2049
+ setting: string;
2050
+ } | undefined;
2051
+ } | {
2052
+ path: string;
2053
+ equals: string | number | boolean;
2054
+ })[] | undefined;
2055
+ enrollment?: "none" | "required" | undefined;
2056
+ since?: "activation" | "window" | "enrollment" | undefined;
2057
+ historical?: "staff" | "claim" | "automatic" | undefined;
2058
+ content?: true | undefined;
1162
2059
  } | undefined;
1163
- } | {
1164
- kind: "manual";
1165
- input: "text";
1166
- constraints: {
1167
- required: boolean;
1168
- minLength: number;
1169
- maxLength: number;
1170
- };
1171
- actor?: "member" | "staff" | undefined;
1172
- } | {
1173
- kind: "manual";
1174
- input: "url";
1175
- constraints: {
1176
- required: boolean;
1177
- allowedHosts?: string[] | undefined;
1178
- };
1179
- actor?: "member" | "staff" | undefined;
1180
- } | {
1181
- kind: "manual";
1182
- input: "none" | "quiz" | "photo";
1183
- actor?: "member" | "staff" | undefined;
1184
2060
  };
1185
2061
  availability: {
1186
2062
  kind: "available";
1187
- input: "text" | "url" | "none" | "quiz" | "photo";
2063
+ input: "text" | "none" | "url" | "quiz" | "photo";
1188
2064
  } | {
1189
2065
  kind: "completed";
1190
2066
  } | {
1191
2067
  kind: "locked";
1192
- missing: {
2068
+ missing: ({
2069
+ kind: "completion";
1193
2070
  quest: string;
1194
2071
  title: string;
1195
- }[];
2072
+ scope: "ever";
2073
+ } | {
2074
+ kind: "completion";
2075
+ quest: string;
2076
+ title: string;
2077
+ scope: "period";
2078
+ period: "day" | "week" | "month";
2079
+ resetsAt: number;
2080
+ } | {
2081
+ kind: "balance";
2082
+ balance: string;
2083
+ title: string;
2084
+ minimum: number;
2085
+ current: number;
2086
+ } | {
2087
+ kind: "group";
2088
+ group: string;
2089
+ title: string;
2090
+ })[];
2091
+ } | {
2092
+ kind: "blocked";
2093
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
2094
+ resetsAt?: number | undefined;
1196
2095
  } | {
1197
2096
  kind: "staff-required";
1198
2097
  } | {
1199
2098
  kind: "automatic";
1200
- observation?: {
1201
- source: string;
1202
- type: string;
1203
- } | undefined;
1204
2099
  } | {
1205
2100
  kind: "checking";
1206
2101
  attempt: string;
@@ -1213,19 +2108,82 @@ declare function createRelayClient(options: RelayClientOptions): {
1213
2108
  };
1214
2109
  completed: boolean;
1215
2110
  completion: {
2111
+ kind: "progress";
2112
+ goal: {
2113
+ kind: "count";
2114
+ count: number;
2115
+ };
2116
+ window: {
2117
+ kind: "lifetime";
2118
+ } | {
2119
+ kind: "calendar";
2120
+ period: "day" | "week" | "month";
2121
+ latenessMs: number;
2122
+ } | {
2123
+ kind: "rolling";
2124
+ durationMs: number;
2125
+ };
2126
+ repeat: "repeat" | "once";
2127
+ } | {
1216
2128
  kind: "streak";
1217
2129
  days: number;
1218
- timeZone: string;
1219
2130
  } | {
1220
2131
  kind: "once";
1221
2132
  } | {
1222
2133
  kind: "keyed";
1223
2134
  };
2135
+ progress: {
2136
+ current: number;
2137
+ target: number;
2138
+ reason: string;
2139
+ } | null;
1224
2140
  completionCount: number;
1225
2141
  visibility: "visible" | "hidden";
1226
- missing: {
2142
+ missing: ({
2143
+ kind: "completion";
1227
2144
  quest: string;
1228
2145
  title: string;
2146
+ scope: "ever";
2147
+ } | {
2148
+ kind: "completion";
2149
+ quest: string;
2150
+ title: string;
2151
+ scope: "period";
2152
+ period: "day" | "week" | "month";
2153
+ resetsAt: number;
2154
+ } | {
2155
+ kind: "balance";
2156
+ balance: string;
2157
+ title: string;
2158
+ minimum: number;
2159
+ current: number;
2160
+ } | {
2161
+ kind: "group";
2162
+ group: string;
2163
+ title: string;
2164
+ })[];
2165
+ campaign: {
2166
+ key: string;
2167
+ title: string;
2168
+ enrollment: "none" | "required";
2169
+ enrolledAt: number | null;
2170
+ withdrawnAt: number | null;
2171
+ withdrawalReason: string | null;
2172
+ window?: {
2173
+ from: number;
2174
+ until: number;
2175
+ } | undefined;
2176
+ } | null;
2177
+ window: {
2178
+ from: number;
2179
+ until: number;
2180
+ } | null;
2181
+ budgets: {
2182
+ id: string;
2183
+ scope: "member" | "project";
2184
+ period: "lifetime" | "day" | "week" | "month";
2185
+ remaining: number;
2186
+ resetsAt: number | null;
1229
2187
  }[];
1230
2188
  attempt: {
1231
2189
  id: string;
@@ -1233,7 +2191,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1233
2191
  quest: string;
1234
2192
  member: string;
1235
2193
  evidence: string | null;
1236
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
2194
+ status: AttemptStatus;
1237
2195
  reason: string | null;
1238
2196
  retries: number;
1239
2197
  generation: number;
@@ -1252,19 +2210,31 @@ declare function createRelayClient(options: RelayClientOptions): {
1252
2210
  };
1253
2211
  fulfillment: {
1254
2212
  kind: "staff-handover";
2213
+ } | {
2214
+ kind: "automatic";
1255
2215
  };
1256
2216
  };
1257
2217
  tier: string;
1258
- } | {
1259
- kind: "points";
1260
- balance: string;
1261
- amount: number;
1262
2218
  } | {
1263
2219
  kind: "integration";
1264
2220
  provider: "discord";
1265
2221
  action: "grant-role";
1266
2222
  roleId: string;
2223
+ } | {
2224
+ kind: "points";
2225
+ balance: string;
2226
+ amount: number;
1267
2227
  })[] | null;
2228
+ evaluationRun: number;
2229
+ deferCount: number;
2230
+ deferUntil: number | null;
2231
+ nextEvaluationAt: number | null;
2232
+ code: string | null;
2233
+ progress: {
2234
+ current: number;
2235
+ target: number;
2236
+ reason: string;
2237
+ } | null;
1268
2238
  requestedReview: boolean;
1269
2239
  createdAt: number;
1270
2240
  input?: {
@@ -1282,7 +2252,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1282
2252
  } | undefined;
1283
2253
  } | null;
1284
2254
  release: string;
1285
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
2255
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1286
2256
  lifecycle: "paused" | "active" | "archived";
1287
2257
  rewards: ({
1288
2258
  kind: "points";
@@ -1337,6 +2307,40 @@ declare function createRelayClient(options: RelayClientOptions): {
1337
2307
  achievedAt: number;
1338
2308
  };
1339
2309
  } | null | undefined;
2310
+ counter?: {
2311
+ goal: number;
2312
+ current: number;
2313
+ window: {
2314
+ key: string;
2315
+ start: number | null;
2316
+ end: number | null;
2317
+ };
2318
+ repeat: "repeat" | "once";
2319
+ settled: number;
2320
+ latest: {
2321
+ id: string;
2322
+ ordinal: number;
2323
+ achievedAt: number;
2324
+ window: string;
2325
+ status: "revoked";
2326
+ completion: string;
2327
+ revokedAt: number;
2328
+ } | {
2329
+ id: string;
2330
+ ordinal: number;
2331
+ achievedAt: number;
2332
+ window: string;
2333
+ status: "awarded";
2334
+ completion: string;
2335
+ } | {
2336
+ id: string;
2337
+ ordinal: number;
2338
+ achievedAt: number;
2339
+ window: string;
2340
+ status: "budget-exhausted";
2341
+ budget: string;
2342
+ } | null;
2343
+ } | null | undefined;
1340
2344
  }[];
1341
2345
  collections: {
1342
2346
  id: string;
@@ -1364,28 +2368,35 @@ declare function createRelayClient(options: RelayClientOptions): {
1364
2368
  } | undefined;
1365
2369
  } | undefined;
1366
2370
  };
1367
- connections: ("google" | "apple" | "x" | "discord")[];
2371
+ connections: ("discord" | "google" | "apple" | "x")[];
1368
2372
  trigger: {
2373
+ kind: "manual";
2374
+ input: "text";
2375
+ constraints: {
2376
+ required: boolean;
2377
+ minLength: number;
2378
+ maxLength: number;
2379
+ };
2380
+ actor?: "member" | "staff" | undefined;
2381
+ } | {
2382
+ kind: "manual";
2383
+ input: "url";
2384
+ constraints: {
2385
+ required: boolean;
2386
+ allowedHosts?: string[] | undefined;
2387
+ };
2388
+ actor?: "member" | "staff" | undefined;
2389
+ } | {
2390
+ kind: "manual";
2391
+ input: "none" | "quiz" | "photo";
2392
+ actor?: "member" | "staff" | undefined;
2393
+ } | {
1369
2394
  kind: "automatic";
1370
- observation?: {
1371
- source: string;
1372
- type: string;
1373
- } | undefined;
1374
- content?: {
1375
- tracker: string;
1376
- window: {
1377
- start: number;
1378
- end?: number | undefined;
1379
- };
1380
- enrollment: "none" | "required";
1381
- posts: "after-enrollment" | "since-start";
1382
- historical: "automatic" | "claim" | "staff";
1383
- } | undefined;
1384
2395
  tracker?: {
1385
2396
  tracker: string;
1386
- source: "custom" | "x-search";
2397
+ source: string;
2398
+ on: "new-record" | "new-observation" | "data-changed";
1387
2399
  beneficiary: string;
1388
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
1389
2400
  where?: {
1390
2401
  path: string;
1391
2402
  gt?: number | {
@@ -1403,49 +2414,68 @@ declare function createRelayClient(options: RelayClientOptions): {
1403
2414
  } | {
1404
2415
  path: string;
1405
2416
  equals: string | number | boolean;
1406
- } | undefined;
1407
- } | undefined;
1408
- } | {
1409
- kind: "manual";
1410
- input: "text";
1411
- constraints: {
1412
- required: boolean;
1413
- minLength: number;
1414
- maxLength: number;
1415
- };
1416
- actor?: "member" | "staff" | undefined;
1417
- } | {
1418
- kind: "manual";
1419
- input: "url";
1420
- constraints: {
1421
- required: boolean;
1422
- allowedHosts?: string[] | undefined;
1423
- };
1424
- actor?: "member" | "staff" | undefined;
1425
- } | {
1426
- kind: "manual";
1427
- input: "none" | "quiz" | "photo";
1428
- actor?: "member" | "staff" | undefined;
2417
+ } | ({
2418
+ path: string;
2419
+ gt?: number | {
2420
+ setting: string;
2421
+ } | undefined;
2422
+ gte?: number | {
2423
+ setting: string;
2424
+ } | undefined;
2425
+ lt?: number | {
2426
+ setting: string;
2427
+ } | undefined;
2428
+ lte?: number | {
2429
+ setting: string;
2430
+ } | undefined;
2431
+ } | {
2432
+ path: string;
2433
+ equals: string | number | boolean;
2434
+ })[] | undefined;
2435
+ enrollment?: "none" | "required" | undefined;
2436
+ since?: "activation" | "window" | "enrollment" | undefined;
2437
+ historical?: "staff" | "claim" | "automatic" | undefined;
2438
+ content?: true | undefined;
2439
+ } | undefined;
1429
2440
  };
1430
2441
  availability: {
1431
2442
  kind: "available";
1432
- input: "text" | "url" | "none" | "quiz" | "photo";
2443
+ input: "text" | "none" | "url" | "quiz" | "photo";
1433
2444
  } | {
1434
2445
  kind: "completed";
1435
2446
  } | {
1436
2447
  kind: "locked";
1437
- missing: {
2448
+ missing: ({
2449
+ kind: "completion";
1438
2450
  quest: string;
1439
2451
  title: string;
1440
- }[];
2452
+ scope: "ever";
2453
+ } | {
2454
+ kind: "completion";
2455
+ quest: string;
2456
+ title: string;
2457
+ scope: "period";
2458
+ period: "day" | "week" | "month";
2459
+ resetsAt: number;
2460
+ } | {
2461
+ kind: "balance";
2462
+ balance: string;
2463
+ title: string;
2464
+ minimum: number;
2465
+ current: number;
2466
+ } | {
2467
+ kind: "group";
2468
+ group: string;
2469
+ title: string;
2470
+ })[];
2471
+ } | {
2472
+ kind: "blocked";
2473
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
2474
+ resetsAt?: number | undefined;
1441
2475
  } | {
1442
2476
  kind: "staff-required";
1443
2477
  } | {
1444
2478
  kind: "automatic";
1445
- observation?: {
1446
- source: string;
1447
- type: string;
1448
- } | undefined;
1449
2479
  } | {
1450
2480
  kind: "checking";
1451
2481
  attempt: string;
@@ -1458,19 +2488,82 @@ declare function createRelayClient(options: RelayClientOptions): {
1458
2488
  };
1459
2489
  completed: boolean;
1460
2490
  completion: {
2491
+ kind: "progress";
2492
+ goal: {
2493
+ kind: "count";
2494
+ count: number;
2495
+ };
2496
+ window: {
2497
+ kind: "lifetime";
2498
+ } | {
2499
+ kind: "calendar";
2500
+ period: "day" | "week" | "month";
2501
+ latenessMs: number;
2502
+ } | {
2503
+ kind: "rolling";
2504
+ durationMs: number;
2505
+ };
2506
+ repeat: "repeat" | "once";
2507
+ } | {
1461
2508
  kind: "streak";
1462
2509
  days: number;
1463
- timeZone: string;
1464
2510
  } | {
1465
2511
  kind: "once";
1466
2512
  } | {
1467
2513
  kind: "keyed";
1468
2514
  };
2515
+ progress: {
2516
+ current: number;
2517
+ target: number;
2518
+ reason: string;
2519
+ } | null;
1469
2520
  completionCount: number;
1470
2521
  visibility: "visible" | "hidden";
1471
- missing: {
2522
+ missing: ({
2523
+ kind: "completion";
2524
+ quest: string;
2525
+ title: string;
2526
+ scope: "ever";
2527
+ } | {
2528
+ kind: "completion";
1472
2529
  quest: string;
1473
2530
  title: string;
2531
+ scope: "period";
2532
+ period: "day" | "week" | "month";
2533
+ resetsAt: number;
2534
+ } | {
2535
+ kind: "balance";
2536
+ balance: string;
2537
+ title: string;
2538
+ minimum: number;
2539
+ current: number;
2540
+ } | {
2541
+ kind: "group";
2542
+ group: string;
2543
+ title: string;
2544
+ })[];
2545
+ campaign: {
2546
+ key: string;
2547
+ title: string;
2548
+ enrollment: "none" | "required";
2549
+ enrolledAt: number | null;
2550
+ withdrawnAt: number | null;
2551
+ withdrawalReason: string | null;
2552
+ window?: {
2553
+ from: number;
2554
+ until: number;
2555
+ } | undefined;
2556
+ } | null;
2557
+ window: {
2558
+ from: number;
2559
+ until: number;
2560
+ } | null;
2561
+ budgets: {
2562
+ id: string;
2563
+ scope: "member" | "project";
2564
+ period: "lifetime" | "day" | "week" | "month";
2565
+ remaining: number;
2566
+ resetsAt: number | null;
1474
2567
  }[];
1475
2568
  attempt: {
1476
2569
  id: string;
@@ -1478,7 +2571,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1478
2571
  quest: string;
1479
2572
  member: string;
1480
2573
  evidence: string | null;
1481
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
2574
+ status: AttemptStatus;
1482
2575
  reason: string | null;
1483
2576
  retries: number;
1484
2577
  generation: number;
@@ -1497,19 +2590,31 @@ declare function createRelayClient(options: RelayClientOptions): {
1497
2590
  };
1498
2591
  fulfillment: {
1499
2592
  kind: "staff-handover";
2593
+ } | {
2594
+ kind: "automatic";
1500
2595
  };
1501
2596
  };
1502
2597
  tier: string;
1503
- } | {
1504
- kind: "points";
1505
- balance: string;
1506
- amount: number;
1507
2598
  } | {
1508
2599
  kind: "integration";
1509
2600
  provider: "discord";
1510
2601
  action: "grant-role";
1511
2602
  roleId: string;
2603
+ } | {
2604
+ kind: "points";
2605
+ balance: string;
2606
+ amount: number;
1512
2607
  })[] | null;
2608
+ evaluationRun: number;
2609
+ deferCount: number;
2610
+ deferUntil: number | null;
2611
+ nextEvaluationAt: number | null;
2612
+ code: string | null;
2613
+ progress: {
2614
+ current: number;
2615
+ target: number;
2616
+ reason: string;
2617
+ } | null;
1513
2618
  requestedReview: boolean;
1514
2619
  createdAt: number;
1515
2620
  input?: {
@@ -1527,7 +2632,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1527
2632
  } | undefined;
1528
2633
  } | null;
1529
2634
  release: string;
1530
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
2635
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1531
2636
  lifecycle: "paused" | "active" | "archived";
1532
2637
  rewards: ({
1533
2638
  kind: "points";
@@ -1582,6 +2687,40 @@ declare function createRelayClient(options: RelayClientOptions): {
1582
2687
  achievedAt: number;
1583
2688
  };
1584
2689
  } | null | undefined;
2690
+ counter?: {
2691
+ goal: number;
2692
+ current: number;
2693
+ window: {
2694
+ key: string;
2695
+ start: number | null;
2696
+ end: number | null;
2697
+ };
2698
+ repeat: "repeat" | "once";
2699
+ settled: number;
2700
+ latest: {
2701
+ id: string;
2702
+ ordinal: number;
2703
+ achievedAt: number;
2704
+ window: string;
2705
+ status: "revoked";
2706
+ completion: string;
2707
+ revokedAt: number;
2708
+ } | {
2709
+ id: string;
2710
+ ordinal: number;
2711
+ achievedAt: number;
2712
+ window: string;
2713
+ status: "awarded";
2714
+ completion: string;
2715
+ } | {
2716
+ id: string;
2717
+ ordinal: number;
2718
+ achievedAt: number;
2719
+ window: string;
2720
+ status: "budget-exhausted";
2721
+ budget: string;
2722
+ } | null;
2723
+ } | null | undefined;
1585
2724
  }[];
1586
2725
  key?: string | undefined;
1587
2726
  }[];
@@ -1612,28 +2751,35 @@ declare function createRelayClient(options: RelayClientOptions): {
1612
2751
  } | undefined;
1613
2752
  } | undefined;
1614
2753
  };
1615
- connections: ("google" | "apple" | "x" | "discord")[];
2754
+ connections: ("discord" | "google" | "apple" | "x")[];
1616
2755
  trigger: {
2756
+ kind: "manual";
2757
+ input: "text";
2758
+ constraints: {
2759
+ required: boolean;
2760
+ minLength: number;
2761
+ maxLength: number;
2762
+ };
2763
+ actor?: "member" | "staff" | undefined;
2764
+ } | {
2765
+ kind: "manual";
2766
+ input: "url";
2767
+ constraints: {
2768
+ required: boolean;
2769
+ allowedHosts?: string[] | undefined;
2770
+ };
2771
+ actor?: "member" | "staff" | undefined;
2772
+ } | {
2773
+ kind: "manual";
2774
+ input: "none" | "quiz" | "photo";
2775
+ actor?: "member" | "staff" | undefined;
2776
+ } | {
1617
2777
  kind: "automatic";
1618
- observation?: {
1619
- source: string;
1620
- type: string;
1621
- } | undefined;
1622
- content?: {
1623
- tracker: string;
1624
- window: {
1625
- start: number;
1626
- end?: number | undefined;
1627
- };
1628
- enrollment: "none" | "required";
1629
- posts: "after-enrollment" | "since-start";
1630
- historical: "automatic" | "claim" | "staff";
1631
- } | undefined;
1632
2778
  tracker?: {
1633
2779
  tracker: string;
1634
- source: "custom" | "x-search";
2780
+ source: string;
2781
+ on: "new-record" | "new-observation" | "data-changed";
1635
2782
  beneficiary: string;
1636
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
1637
2783
  where?: {
1638
2784
  path: string;
1639
2785
  gt?: number | {
@@ -1651,49 +2797,68 @@ declare function createRelayClient(options: RelayClientOptions): {
1651
2797
  } | {
1652
2798
  path: string;
1653
2799
  equals: string | number | boolean;
1654
- } | undefined;
2800
+ } | ({
2801
+ path: string;
2802
+ gt?: number | {
2803
+ setting: string;
2804
+ } | undefined;
2805
+ gte?: number | {
2806
+ setting: string;
2807
+ } | undefined;
2808
+ lt?: number | {
2809
+ setting: string;
2810
+ } | undefined;
2811
+ lte?: number | {
2812
+ setting: string;
2813
+ } | undefined;
2814
+ } | {
2815
+ path: string;
2816
+ equals: string | number | boolean;
2817
+ })[] | undefined;
2818
+ enrollment?: "none" | "required" | undefined;
2819
+ since?: "activation" | "window" | "enrollment" | undefined;
2820
+ historical?: "staff" | "claim" | "automatic" | undefined;
2821
+ content?: true | undefined;
1655
2822
  } | undefined;
1656
- } | {
1657
- kind: "manual";
1658
- input: "text";
1659
- constraints: {
1660
- required: boolean;
1661
- minLength: number;
1662
- maxLength: number;
1663
- };
1664
- actor?: "member" | "staff" | undefined;
1665
- } | {
1666
- kind: "manual";
1667
- input: "url";
1668
- constraints: {
1669
- required: boolean;
1670
- allowedHosts?: string[] | undefined;
1671
- };
1672
- actor?: "member" | "staff" | undefined;
1673
- } | {
1674
- kind: "manual";
1675
- input: "none" | "quiz" | "photo";
1676
- actor?: "member" | "staff" | undefined;
1677
2823
  };
1678
2824
  availability: {
1679
2825
  kind: "available";
1680
- input: "text" | "url" | "none" | "quiz" | "photo";
2826
+ input: "text" | "none" | "url" | "quiz" | "photo";
1681
2827
  } | {
1682
2828
  kind: "completed";
1683
2829
  } | {
1684
2830
  kind: "locked";
1685
- missing: {
2831
+ missing: ({
2832
+ kind: "completion";
1686
2833
  quest: string;
1687
2834
  title: string;
1688
- }[];
2835
+ scope: "ever";
2836
+ } | {
2837
+ kind: "completion";
2838
+ quest: string;
2839
+ title: string;
2840
+ scope: "period";
2841
+ period: "day" | "week" | "month";
2842
+ resetsAt: number;
2843
+ } | {
2844
+ kind: "balance";
2845
+ balance: string;
2846
+ title: string;
2847
+ minimum: number;
2848
+ current: number;
2849
+ } | {
2850
+ kind: "group";
2851
+ group: string;
2852
+ title: string;
2853
+ })[];
2854
+ } | {
2855
+ kind: "blocked";
2856
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
2857
+ resetsAt?: number | undefined;
1689
2858
  } | {
1690
2859
  kind: "staff-required";
1691
2860
  } | {
1692
2861
  kind: "automatic";
1693
- observation?: {
1694
- source: string;
1695
- type: string;
1696
- } | undefined;
1697
2862
  } | {
1698
2863
  kind: "checking";
1699
2864
  attempt: string;
@@ -1706,19 +2871,82 @@ declare function createRelayClient(options: RelayClientOptions): {
1706
2871
  };
1707
2872
  completed: boolean;
1708
2873
  completion: {
2874
+ kind: "progress";
2875
+ goal: {
2876
+ kind: "count";
2877
+ count: number;
2878
+ };
2879
+ window: {
2880
+ kind: "lifetime";
2881
+ } | {
2882
+ kind: "calendar";
2883
+ period: "day" | "week" | "month";
2884
+ latenessMs: number;
2885
+ } | {
2886
+ kind: "rolling";
2887
+ durationMs: number;
2888
+ };
2889
+ repeat: "repeat" | "once";
2890
+ } | {
1709
2891
  kind: "streak";
1710
2892
  days: number;
1711
- timeZone: string;
1712
2893
  } | {
1713
2894
  kind: "once";
1714
2895
  } | {
1715
2896
  kind: "keyed";
1716
2897
  };
2898
+ progress: {
2899
+ current: number;
2900
+ target: number;
2901
+ reason: string;
2902
+ } | null;
1717
2903
  completionCount: number;
1718
2904
  visibility: "visible" | "hidden";
1719
- missing: {
2905
+ missing: ({
2906
+ kind: "completion";
2907
+ quest: string;
2908
+ title: string;
2909
+ scope: "ever";
2910
+ } | {
2911
+ kind: "completion";
1720
2912
  quest: string;
1721
2913
  title: string;
2914
+ scope: "period";
2915
+ period: "day" | "week" | "month";
2916
+ resetsAt: number;
2917
+ } | {
2918
+ kind: "balance";
2919
+ balance: string;
2920
+ title: string;
2921
+ minimum: number;
2922
+ current: number;
2923
+ } | {
2924
+ kind: "group";
2925
+ group: string;
2926
+ title: string;
2927
+ })[];
2928
+ campaign: {
2929
+ key: string;
2930
+ title: string;
2931
+ enrollment: "none" | "required";
2932
+ enrolledAt: number | null;
2933
+ withdrawnAt: number | null;
2934
+ withdrawalReason: string | null;
2935
+ window?: {
2936
+ from: number;
2937
+ until: number;
2938
+ } | undefined;
2939
+ } | null;
2940
+ window: {
2941
+ from: number;
2942
+ until: number;
2943
+ } | null;
2944
+ budgets: {
2945
+ id: string;
2946
+ scope: "member" | "project";
2947
+ period: "lifetime" | "day" | "week" | "month";
2948
+ remaining: number;
2949
+ resetsAt: number | null;
1722
2950
  }[];
1723
2951
  attempt: {
1724
2952
  id: string;
@@ -1726,7 +2954,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1726
2954
  quest: string;
1727
2955
  member: string;
1728
2956
  evidence: string | null;
1729
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
2957
+ status: AttemptStatus;
1730
2958
  reason: string | null;
1731
2959
  retries: number;
1732
2960
  generation: number;
@@ -1745,19 +2973,31 @@ declare function createRelayClient(options: RelayClientOptions): {
1745
2973
  };
1746
2974
  fulfillment: {
1747
2975
  kind: "staff-handover";
2976
+ } | {
2977
+ kind: "automatic";
1748
2978
  };
1749
2979
  };
1750
2980
  tier: string;
1751
- } | {
1752
- kind: "points";
1753
- balance: string;
1754
- amount: number;
1755
2981
  } | {
1756
2982
  kind: "integration";
1757
2983
  provider: "discord";
1758
2984
  action: "grant-role";
1759
2985
  roleId: string;
2986
+ } | {
2987
+ kind: "points";
2988
+ balance: string;
2989
+ amount: number;
1760
2990
  })[] | null;
2991
+ evaluationRun: number;
2992
+ deferCount: number;
2993
+ deferUntil: number | null;
2994
+ nextEvaluationAt: number | null;
2995
+ code: string | null;
2996
+ progress: {
2997
+ current: number;
2998
+ target: number;
2999
+ reason: string;
3000
+ } | null;
1761
3001
  requestedReview: boolean;
1762
3002
  createdAt: number;
1763
3003
  input?: {
@@ -1775,7 +3015,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1775
3015
  } | undefined;
1776
3016
  } | null;
1777
3017
  release: string;
1778
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
3018
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1779
3019
  lifecycle: "paused" | "active" | "archived";
1780
3020
  rewards: ({
1781
3021
  kind: "points";
@@ -1830,6 +3070,40 @@ declare function createRelayClient(options: RelayClientOptions): {
1830
3070
  achievedAt: number;
1831
3071
  };
1832
3072
  } | null | undefined;
3073
+ counter?: {
3074
+ goal: number;
3075
+ current: number;
3076
+ window: {
3077
+ key: string;
3078
+ start: number | null;
3079
+ end: number | null;
3080
+ };
3081
+ repeat: "repeat" | "once";
3082
+ settled: number;
3083
+ latest: {
3084
+ id: string;
3085
+ ordinal: number;
3086
+ achievedAt: number;
3087
+ window: string;
3088
+ status: "revoked";
3089
+ completion: string;
3090
+ revokedAt: number;
3091
+ } | {
3092
+ id: string;
3093
+ ordinal: number;
3094
+ achievedAt: number;
3095
+ window: string;
3096
+ status: "awarded";
3097
+ completion: string;
3098
+ } | {
3099
+ id: string;
3100
+ ordinal: number;
3101
+ achievedAt: number;
3102
+ window: string;
3103
+ status: "budget-exhausted";
3104
+ budget: string;
3105
+ } | null;
3106
+ } | null | undefined;
1833
3107
  }[];
1834
3108
  key?: string | undefined;
1835
3109
  }>;
@@ -1839,6 +3113,24 @@ declare function createRelayClient(options: RelayClientOptions): {
1839
3113
  maxBackoffMs?: number;
1840
3114
  }) => ProgressObserver;
1841
3115
  };
3116
+ campaigns: {
3117
+ /** Enrolls the signed-in member once in every quest of a campaign that requires it. */
3118
+ enroll: (value: CampaignEnrollmentInput, requestOptions?: RelayRequestOptions) => Promise<{
3119
+ campaign: string;
3120
+ member: string;
3121
+ enrolledAt: number;
3122
+ withdrawnAt: number | null;
3123
+ withdrawalReason: string | null;
3124
+ }>;
3125
+ /** Pauses the signed-in member's campaign enrollment without erasing its history. */
3126
+ withdraw: (value: CampaignWithdrawalInput, requestOptions?: RelayRequestOptions) => Promise<{
3127
+ campaign: string;
3128
+ member: string;
3129
+ enrolledAt: number;
3130
+ withdrawnAt: number | null;
3131
+ withdrawalReason: string | null;
3132
+ }>;
3133
+ };
1842
3134
  /** The signed-in member's linked Solana, EVM and Cosmos wallets for this project. */
1843
3135
  wallets: {
1844
3136
  list: (requestOptions?: RelayRequestOptions) => Promise<{
@@ -1870,7 +3162,11 @@ declare function createRelayClient(options: RelayClientOptions): {
1870
3162
  unlink: (wallet: Pick<LinkedWallet, "chain" | "address">, requestOptions?: RelayRequestOptions) => Promise<{
1871
3163
  ok: true;
1872
3164
  }>;
1873
- /** Asks the signer for its address, signs the returned challenge, and links the wallet. */
3165
+ /**
3166
+ * Asks the signer for its address, signs the returned challenge, and links the wallet. The
3167
+ * session read and the challenge share one deadline, and the verification gets its own:
3168
+ * the time the member takes in the wallet counts against neither.
3169
+ */
1874
3170
  link: (signer: WalletSigner, requestOptions?: RelayRequestOptions) => Promise<{
1875
3171
  chain: "solana" | "eip155" | "cosmos";
1876
3172
  network: `cosmos:${string}` | null;
@@ -1883,7 +3179,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1883
3179
  auth: {
1884
3180
  providers: (requestOptions?: RelayRequestOptions) => Promise<{
1885
3181
  providers: {
1886
- provider: "google" | "apple" | "x" | "discord";
3182
+ provider: "discord" | "google" | "apple" | "x";
1887
3183
  configured: boolean;
1888
3184
  }[];
1889
3185
  email: boolean;
@@ -1976,7 +3272,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1976
3272
  };
1977
3273
  /** The member's connected sign-in accounts, one per provider. */
1978
3274
  accounts: (requestOptions?: RelayRequestOptions) => Promise<{
1979
- provider: "google" | "apple" | "x" | "discord";
3275
+ provider: "discord" | "google" | "apple" | "x";
1980
3276
  configured: boolean;
1981
3277
  status: "disconnected" | "connected" | "reconnect";
1982
3278
  subject: string | null;
@@ -2030,6 +3326,82 @@ declare function createRelayClient(options: RelayClientOptions): {
2030
3326
  }>;
2031
3327
  };
2032
3328
  me: {
3329
+ activity: {
3330
+ list: (query?: {
3331
+ cursor?: string;
3332
+ limit?: number;
3333
+ }, options?: RelayRequestOptions) => Promise<{
3334
+ member: string;
3335
+ items: ({
3336
+ kind: "attempt.accepted";
3337
+ quest: string;
3338
+ attempt: string;
3339
+ completion: string | null;
3340
+ id: string;
3341
+ at: number;
3342
+ } | {
3343
+ kind: "attempt.rejected";
3344
+ quest: string;
3345
+ attempt: string;
3346
+ completion: string | null;
3347
+ id: string;
3348
+ at: number;
3349
+ } | {
3350
+ kind: "attempt.review";
3351
+ quest: string;
3352
+ attempt: string;
3353
+ completion: string | null;
3354
+ id: string;
3355
+ at: number;
3356
+ } | {
3357
+ kind: "points.awarded";
3358
+ entry: string;
3359
+ ledger: string;
3360
+ amount: number;
3361
+ quest: string | null;
3362
+ completion: string | null;
3363
+ id: string;
3364
+ at: number;
3365
+ } | {
3366
+ kind: "entitlement.granted";
3367
+ entitlement: string;
3368
+ tier: string;
3369
+ status: string;
3370
+ id: string;
3371
+ at: number;
3372
+ } | {
3373
+ kind: "entitlement.collected";
3374
+ entitlement: string;
3375
+ id: string;
3376
+ at: number;
3377
+ } | {
3378
+ kind: "delivery.updated";
3379
+ delivery: string;
3380
+ quest: string;
3381
+ completion: string;
3382
+ status: string;
3383
+ id: string;
3384
+ at: number;
3385
+ } | {
3386
+ kind: "referral.qualified";
3387
+ program: string;
3388
+ id: string;
3389
+ at: number;
3390
+ } | {
3391
+ kind: "unknown";
3392
+ reportedKind: string;
3393
+ id: string;
3394
+ at: number;
3395
+ })[];
3396
+ nextCursor: string;
3397
+ }>;
3398
+ observe: (listener: (event: RelayEvent) => void, options?: {
3399
+ cursor?: string;
3400
+ intervalMs?: number;
3401
+ maxBackoffMs?: number;
3402
+ onState?: (state: ProgressObservation<ParticipantActivity>) => void;
3403
+ }) => ProgressObserver;
3404
+ };
2033
3405
  /** The signed-in member, and the seed of their generated avatar: `defaultAvatar(avatarSeed)`. */
2034
3406
  get: (requestOptions?: RelayRequestOptions) => Promise<{
2035
3407
  member: string;
@@ -2095,28 +3467,35 @@ declare function createRelayClient(options: RelayClientOptions): {
2095
3467
  } | undefined;
2096
3468
  } | undefined;
2097
3469
  };
2098
- connections: ("google" | "apple" | "x" | "discord")[];
3470
+ connections: ("discord" | "google" | "apple" | "x")[];
2099
3471
  trigger: {
3472
+ kind: "manual";
3473
+ input: "text";
3474
+ constraints: {
3475
+ required: boolean;
3476
+ minLength: number;
3477
+ maxLength: number;
3478
+ };
3479
+ actor?: "member" | "staff" | undefined;
3480
+ } | {
3481
+ kind: "manual";
3482
+ input: "url";
3483
+ constraints: {
3484
+ required: boolean;
3485
+ allowedHosts?: string[] | undefined;
3486
+ };
3487
+ actor?: "member" | "staff" | undefined;
3488
+ } | {
3489
+ kind: "manual";
3490
+ input: "none" | "quiz" | "photo";
3491
+ actor?: "member" | "staff" | undefined;
3492
+ } | {
2100
3493
  kind: "automatic";
2101
- observation?: {
2102
- source: string;
2103
- type: string;
2104
- } | undefined;
2105
- content?: {
2106
- tracker: string;
2107
- window: {
2108
- start: number;
2109
- end?: number | undefined;
2110
- };
2111
- enrollment: "none" | "required";
2112
- posts: "after-enrollment" | "since-start";
2113
- historical: "automatic" | "claim" | "staff";
2114
- } | undefined;
2115
3494
  tracker?: {
2116
3495
  tracker: string;
2117
- source: "custom" | "x-search";
3496
+ source: string;
3497
+ on: "new-record" | "new-observation" | "data-changed";
2118
3498
  beneficiary: string;
2119
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
2120
3499
  where?: {
2121
3500
  path: string;
2122
3501
  gt?: number | {
@@ -2134,49 +3513,68 @@ declare function createRelayClient(options: RelayClientOptions): {
2134
3513
  } | {
2135
3514
  path: string;
2136
3515
  equals: string | number | boolean;
2137
- } | undefined;
3516
+ } | ({
3517
+ path: string;
3518
+ gt?: number | {
3519
+ setting: string;
3520
+ } | undefined;
3521
+ gte?: number | {
3522
+ setting: string;
3523
+ } | undefined;
3524
+ lt?: number | {
3525
+ setting: string;
3526
+ } | undefined;
3527
+ lte?: number | {
3528
+ setting: string;
3529
+ } | undefined;
3530
+ } | {
3531
+ path: string;
3532
+ equals: string | number | boolean;
3533
+ })[] | undefined;
3534
+ enrollment?: "none" | "required" | undefined;
3535
+ since?: "activation" | "window" | "enrollment" | undefined;
3536
+ historical?: "staff" | "claim" | "automatic" | undefined;
3537
+ content?: true | undefined;
2138
3538
  } | undefined;
2139
- } | {
2140
- kind: "manual";
2141
- input: "text";
2142
- constraints: {
2143
- required: boolean;
2144
- minLength: number;
2145
- maxLength: number;
2146
- };
2147
- actor?: "member" | "staff" | undefined;
2148
- } | {
2149
- kind: "manual";
2150
- input: "url";
2151
- constraints: {
2152
- required: boolean;
2153
- allowedHosts?: string[] | undefined;
2154
- };
2155
- actor?: "member" | "staff" | undefined;
2156
- } | {
2157
- kind: "manual";
2158
- input: "none" | "quiz" | "photo";
2159
- actor?: "member" | "staff" | undefined;
2160
3539
  };
2161
3540
  availability: {
2162
3541
  kind: "available";
2163
- input: "text" | "url" | "none" | "quiz" | "photo";
3542
+ input: "text" | "none" | "url" | "quiz" | "photo";
2164
3543
  } | {
2165
3544
  kind: "completed";
2166
3545
  } | {
2167
3546
  kind: "locked";
2168
- missing: {
3547
+ missing: ({
3548
+ kind: "completion";
2169
3549
  quest: string;
2170
3550
  title: string;
2171
- }[];
3551
+ scope: "ever";
3552
+ } | {
3553
+ kind: "completion";
3554
+ quest: string;
3555
+ title: string;
3556
+ scope: "period";
3557
+ period: "day" | "week" | "month";
3558
+ resetsAt: number;
3559
+ } | {
3560
+ kind: "balance";
3561
+ balance: string;
3562
+ title: string;
3563
+ minimum: number;
3564
+ current: number;
3565
+ } | {
3566
+ kind: "group";
3567
+ group: string;
3568
+ title: string;
3569
+ })[];
3570
+ } | {
3571
+ kind: "blocked";
3572
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
3573
+ resetsAt?: number | undefined;
2172
3574
  } | {
2173
3575
  kind: "staff-required";
2174
3576
  } | {
2175
3577
  kind: "automatic";
2176
- observation?: {
2177
- source: string;
2178
- type: string;
2179
- } | undefined;
2180
3578
  } | {
2181
3579
  kind: "checking";
2182
3580
  attempt: string;
@@ -2189,19 +3587,82 @@ declare function createRelayClient(options: RelayClientOptions): {
2189
3587
  };
2190
3588
  completed: boolean;
2191
3589
  completion: {
3590
+ kind: "progress";
3591
+ goal: {
3592
+ kind: "count";
3593
+ count: number;
3594
+ };
3595
+ window: {
3596
+ kind: "lifetime";
3597
+ } | {
3598
+ kind: "calendar";
3599
+ period: "day" | "week" | "month";
3600
+ latenessMs: number;
3601
+ } | {
3602
+ kind: "rolling";
3603
+ durationMs: number;
3604
+ };
3605
+ repeat: "repeat" | "once";
3606
+ } | {
2192
3607
  kind: "streak";
2193
3608
  days: number;
2194
- timeZone: string;
2195
3609
  } | {
2196
3610
  kind: "once";
2197
3611
  } | {
2198
3612
  kind: "keyed";
2199
3613
  };
3614
+ progress: {
3615
+ current: number;
3616
+ target: number;
3617
+ reason: string;
3618
+ } | null;
2200
3619
  completionCount: number;
2201
3620
  visibility: "visible" | "hidden";
2202
- missing: {
3621
+ missing: ({
3622
+ kind: "completion";
3623
+ quest: string;
3624
+ title: string;
3625
+ scope: "ever";
3626
+ } | {
3627
+ kind: "completion";
2203
3628
  quest: string;
2204
3629
  title: string;
3630
+ scope: "period";
3631
+ period: "day" | "week" | "month";
3632
+ resetsAt: number;
3633
+ } | {
3634
+ kind: "balance";
3635
+ balance: string;
3636
+ title: string;
3637
+ minimum: number;
3638
+ current: number;
3639
+ } | {
3640
+ kind: "group";
3641
+ group: string;
3642
+ title: string;
3643
+ })[];
3644
+ campaign: {
3645
+ key: string;
3646
+ title: string;
3647
+ enrollment: "none" | "required";
3648
+ enrolledAt: number | null;
3649
+ withdrawnAt: number | null;
3650
+ withdrawalReason: string | null;
3651
+ window?: {
3652
+ from: number;
3653
+ until: number;
3654
+ } | undefined;
3655
+ } | null;
3656
+ window: {
3657
+ from: number;
3658
+ until: number;
3659
+ } | null;
3660
+ budgets: {
3661
+ id: string;
3662
+ scope: "member" | "project";
3663
+ period: "lifetime" | "day" | "week" | "month";
3664
+ remaining: number;
3665
+ resetsAt: number | null;
2205
3666
  }[];
2206
3667
  attempt: {
2207
3668
  id: string;
@@ -2209,7 +3670,7 @@ declare function createRelayClient(options: RelayClientOptions): {
2209
3670
  quest: string;
2210
3671
  member: string;
2211
3672
  evidence: string | null;
2212
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
3673
+ status: AttemptStatus;
2213
3674
  reason: string | null;
2214
3675
  retries: number;
2215
3676
  generation: number;
@@ -2228,19 +3689,31 @@ declare function createRelayClient(options: RelayClientOptions): {
2228
3689
  };
2229
3690
  fulfillment: {
2230
3691
  kind: "staff-handover";
3692
+ } | {
3693
+ kind: "automatic";
2231
3694
  };
2232
3695
  };
2233
3696
  tier: string;
2234
- } | {
2235
- kind: "points";
2236
- balance: string;
2237
- amount: number;
2238
3697
  } | {
2239
3698
  kind: "integration";
2240
3699
  provider: "discord";
2241
3700
  action: "grant-role";
2242
3701
  roleId: string;
3702
+ } | {
3703
+ kind: "points";
3704
+ balance: string;
3705
+ amount: number;
2243
3706
  })[] | null;
3707
+ evaluationRun: number;
3708
+ deferCount: number;
3709
+ deferUntil: number | null;
3710
+ nextEvaluationAt: number | null;
3711
+ code: string | null;
3712
+ progress: {
3713
+ current: number;
3714
+ target: number;
3715
+ reason: string;
3716
+ } | null;
2244
3717
  requestedReview: boolean;
2245
3718
  createdAt: number;
2246
3719
  input?: {
@@ -2289,56 +3762,102 @@ declare function createRelayClient(options: RelayClientOptions): {
2289
3762
  achievedAt: number;
2290
3763
  };
2291
3764
  } | null | undefined;
3765
+ counter?: {
3766
+ goal: number;
3767
+ current: number;
3768
+ window: {
3769
+ key: string;
3770
+ start: number | null;
3771
+ end: number | null;
3772
+ };
3773
+ repeat: "repeat" | "once";
3774
+ settled: number;
3775
+ latest: {
3776
+ id: string;
3777
+ ordinal: number;
3778
+ achievedAt: number;
3779
+ window: string;
3780
+ status: "revoked";
3781
+ completion: string;
3782
+ revokedAt: number;
3783
+ } | {
3784
+ id: string;
3785
+ ordinal: number;
3786
+ achievedAt: number;
3787
+ window: string;
3788
+ status: "awarded";
3789
+ completion: string;
3790
+ } | {
3791
+ id: string;
3792
+ ordinal: number;
3793
+ achievedAt: number;
3794
+ window: string;
3795
+ status: "budget-exhausted";
3796
+ budget: string;
3797
+ } | null;
3798
+ } | null | undefined;
2292
3799
  }[];
2293
3800
  entitlements: ({
3801
+ [x: string]: unknown;
2294
3802
  status: "available";
2295
3803
  id: string;
2296
3804
  member: string;
2297
3805
  reward: {
3806
+ [x: string]: unknown;
2298
3807
  id: string;
2299
3808
  title: string;
2300
3809
  tiers: {
3810
+ [x: string]: unknown;
2301
3811
  id: string;
2302
3812
  title: string;
2303
3813
  }[];
2304
3814
  inventory: {
2305
- kind: "untracked";
3815
+ [x: string]: unknown;
3816
+ kind: string;
2306
3817
  };
2307
3818
  fulfillment: {
2308
- kind: "staff-handover";
3819
+ [x: string]: unknown;
3820
+ kind: string;
2309
3821
  };
2310
3822
  };
2311
3823
  earnedTier: string;
2312
3824
  tier: string;
2313
3825
  revision: number;
2314
3826
  } | {
3827
+ [x: string]: unknown;
2315
3828
  status: "handing-over";
2316
3829
  handover: string;
2317
3830
  startedAt: number;
2318
3831
  id: string;
2319
3832
  member: string;
2320
3833
  reward: {
3834
+ [x: string]: unknown;
2321
3835
  id: string;
2322
3836
  title: string;
2323
3837
  tiers: {
3838
+ [x: string]: unknown;
2324
3839
  id: string;
2325
3840
  title: string;
2326
3841
  }[];
2327
3842
  inventory: {
2328
- kind: "untracked";
3843
+ [x: string]: unknown;
3844
+ kind: string;
2329
3845
  };
2330
3846
  fulfillment: {
2331
- kind: "staff-handover";
3847
+ [x: string]: unknown;
3848
+ kind: string;
2332
3849
  };
2333
3850
  };
2334
3851
  earnedTier: string;
2335
3852
  tier: string;
2336
3853
  revision: number;
2337
3854
  allocation?: {
3855
+ [x: string]: unknown;
2338
3856
  item: string;
2339
3857
  label: string;
2340
3858
  } | undefined;
2341
3859
  } | {
3860
+ [x: string]: unknown;
2342
3861
  status: "collected";
2343
3862
  handover: string;
2344
3863
  startedAt: number;
@@ -2346,36 +3865,125 @@ declare function createRelayClient(options: RelayClientOptions): {
2346
3865
  id: string;
2347
3866
  member: string;
2348
3867
  reward: {
3868
+ [x: string]: unknown;
2349
3869
  id: string;
2350
3870
  title: string;
2351
3871
  tiers: {
3872
+ [x: string]: unknown;
2352
3873
  id: string;
2353
3874
  title: string;
2354
3875
  }[];
2355
3876
  inventory: {
2356
- kind: "untracked";
3877
+ [x: string]: unknown;
3878
+ kind: string;
2357
3879
  };
2358
3880
  fulfillment: {
2359
- kind: "staff-handover";
3881
+ [x: string]: unknown;
3882
+ kind: string;
2360
3883
  };
2361
3884
  };
2362
3885
  earnedTier: string;
2363
3886
  tier: string;
2364
3887
  revision: number;
2365
3888
  allocation?: {
3889
+ [x: string]: unknown;
2366
3890
  item: string;
2367
3891
  label: string;
2368
3892
  } | undefined;
3893
+ recovery?: {
3894
+ completion: string;
3895
+ reason: string;
3896
+ flaggedAt: number;
3897
+ remainingTier: string | null;
3898
+ } | undefined;
3899
+ } | {
3900
+ [x: string]: unknown;
3901
+ status: "void";
3902
+ voidedAt: number;
3903
+ id: string;
3904
+ member: string;
3905
+ reward: {
3906
+ [x: string]: unknown;
3907
+ id: string;
3908
+ title: string;
3909
+ tiers: {
3910
+ [x: string]: unknown;
3911
+ id: string;
3912
+ title: string;
3913
+ }[];
3914
+ inventory: {
3915
+ [x: string]: unknown;
3916
+ kind: string;
3917
+ };
3918
+ fulfillment: {
3919
+ [x: string]: unknown;
3920
+ kind: string;
3921
+ };
3922
+ };
3923
+ earnedTier: string;
3924
+ tier: string;
3925
+ revision: number;
3926
+ } | {
3927
+ status: "unsupported";
3928
+ reportedStatus: string;
3929
+ id: string;
3930
+ member: string;
3931
+ reward: {
3932
+ [x: string]: unknown;
3933
+ id: string;
3934
+ title: string;
3935
+ tiers: {
3936
+ [x: string]: unknown;
3937
+ id: string;
3938
+ title: string;
3939
+ }[];
3940
+ inventory: {
3941
+ [x: string]: unknown;
3942
+ kind: string;
3943
+ };
3944
+ fulfillment: {
3945
+ [x: string]: unknown;
3946
+ kind: string;
3947
+ };
3948
+ };
3949
+ earnedTier: string;
3950
+ tier: string;
3951
+ revision: number;
2369
3952
  })[];
2370
3953
  }>;
2371
3954
  rewardDeliveries: (requestOptions?: RelayRequestOptions) => Promise<{
2372
- deliveries: {
3955
+ deliveries: ({
3956
+ [x: string]: z.core.util.JSONType | undefined;
3957
+ id: string;
3958
+ quest: string;
3959
+ completion: string;
3960
+ member: string;
3961
+ action: RewardDeliveryAction;
3962
+ attempts: number;
3963
+ nextAt: number;
3964
+ lastError: string | null;
3965
+ createdAt: number;
3966
+ deliveredAt: number | null;
3967
+ provider: string;
3968
+ status: string;
3969
+ dispatchedAt?: number | null | undefined;
3970
+ revokedAt?: number | null | undefined;
3971
+ roleId?: string | undefined;
3972
+ reconciliation?: {
3973
+ [x: string]: z.core.util.JSONType;
3974
+ status: string;
3975
+ ownership: string;
3976
+ at: number;
3977
+ reason: string | null;
3978
+ } | null | undefined;
3979
+ } | {
3980
+ [x: string]: z.core.util.JSONType | undefined;
2373
3981
  id: string;
2374
3982
  quest: string;
2375
3983
  completion: string;
2376
3984
  member: string;
2377
3985
  provider: "discord";
2378
- action: "grant-role";
3986
+ action: RewardDeliveryAction;
2379
3987
  roleId: string;
2380
3988
  status: "pending" | "failed" | "delivered";
2381
3989
  attempts: number;
@@ -2383,7 +3991,42 @@ declare function createRelayClient(options: RelayClientOptions): {
2383
3991
  lastError: string | null;
2384
3992
  createdAt: number;
2385
3993
  deliveredAt: number | null;
3994
+ dispatchedAt?: number | null | undefined;
3995
+ revokedAt?: number | null | undefined;
3996
+ reconciliation?: {
3997
+ status: "pending" | "removed" | "failed" | "preserved" | "granted";
3998
+ ownership: "external" | "unclaimed" | "relay";
3999
+ at: number;
4000
+ reason: string | null;
4001
+ } | null | undefined;
4002
+ })[];
4003
+ }>;
4004
+ /**
4005
+ * `{ items }`: the member's balance in each of the project's point ledgers, in the project's
4006
+ * ledger order, zero in a ledger they have no entries in.
4007
+ */
4008
+ balances: (requestOptions?: RelayRequestOptions) => Promise<{
4009
+ items: {
4010
+ ledger: {
4011
+ id: string;
4012
+ key: string | null;
4013
+ name: string;
4014
+ };
4015
+ balance: number;
4016
+ available: number;
4017
+ }[];
4018
+ }>;
4019
+ /** The member's own entries in one ledger, by key or ID, most recently recorded first. */
4020
+ pointHistory: (query: PointHistoryQuery, requestOptions?: RelayRequestOptions) => Promise<{
4021
+ items: {
4022
+ id: string;
4023
+ amount: number;
4024
+ kind: PointEntryKind;
4025
+ at: number;
4026
+ quest: string | null;
4027
+ reverses: string | null;
2386
4028
  }[];
4029
+ nextCursor: string | null;
2387
4030
  }>;
2388
4031
  /** Claims a quest for the signed-in member. Quest controllers (`quests.open`) call this. */
2389
4032
  claim: (value: Omit<z.input<typeof submitSchema>, "member">, requestOptions?: RelayRequestOptions) => Promise<{
@@ -2392,7 +4035,7 @@ declare function createRelayClient(options: RelayClientOptions): {
2392
4035
  quest: string;
2393
4036
  member: string;
2394
4037
  evidence: string | null;
2395
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
4038
+ status: AttemptStatus;
2396
4039
  reason: string | null;
2397
4040
  retries: number;
2398
4041
  generation: number;
@@ -2411,19 +4054,31 @@ declare function createRelayClient(options: RelayClientOptions): {
2411
4054
  };
2412
4055
  fulfillment: {
2413
4056
  kind: "staff-handover";
4057
+ } | {
4058
+ kind: "automatic";
2414
4059
  };
2415
4060
  };
2416
4061
  tier: string;
2417
- } | {
2418
- kind: "points";
2419
- balance: string;
2420
- amount: number;
2421
4062
  } | {
2422
4063
  kind: "integration";
2423
4064
  provider: "discord";
2424
4065
  action: "grant-role";
2425
4066
  roleId: string;
4067
+ } | {
4068
+ kind: "points";
4069
+ balance: string;
4070
+ amount: number;
2426
4071
  })[] | null;
4072
+ evaluationRun: number;
4073
+ deferCount: number;
4074
+ deferUntil: number | null;
4075
+ nextEvaluationAt: number | null;
4076
+ code: string | null;
4077
+ progress: {
4078
+ current: number;
4079
+ target: number;
4080
+ reason: string;
4081
+ } | null;
2427
4082
  requestedReview: boolean;
2428
4083
  createdAt: number;
2429
4084
  input?: {
@@ -2460,14 +4115,14 @@ declare function createRelayClient(options: RelayClientOptions): {
2460
4115
  key: string;
2461
4116
  qualifiedBy: string;
2462
4117
  balance: string;
2463
- metrics: ("likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks")[];
4118
+ metrics: string[];
2464
4119
  baseline: "historical";
2465
4120
  maxAgeMs: number;
2466
- budget: {
2467
- projectDaily?: number | undefined;
2468
- memberDaily?: number | undefined;
2469
- projectLifetime?: number | undefined;
2470
- };
4121
+ budgets: {
4122
+ scope: "member" | "project";
4123
+ period: "lifetime" | "day" | "week" | "month";
4124
+ limit: number;
4125
+ }[];
2471
4126
  };
2472
4127
  publishedAt: number;
2473
4128
  };
@@ -2478,8 +4133,8 @@ declare function createRelayClient(options: RelayClientOptions): {
2478
4133
  paid: number;
2479
4134
  excluded: number;
2480
4135
  pending: number;
2481
- counters: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
2482
- baseline: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
4136
+ counters: Record<string, number>;
4137
+ baseline: Record<string, number>;
2483
4138
  observation: string | null;
2484
4139
  nextSettlementAt: number | null;
2485
4140
  reason: string | null;
@@ -2506,14 +4161,14 @@ declare function createRelayClient(options: RelayClientOptions): {
2506
4161
  key: string;
2507
4162
  qualifiedBy: string;
2508
4163
  balance: string;
2509
- metrics: ("likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks")[];
4164
+ metrics: string[];
2510
4165
  baseline: "historical";
2511
4166
  maxAgeMs: number;
2512
- budget: {
2513
- projectDaily?: number | undefined;
2514
- memberDaily?: number | undefined;
2515
- projectLifetime?: number | undefined;
2516
- };
4167
+ budgets: {
4168
+ scope: "member" | "project";
4169
+ period: "lifetime" | "day" | "week" | "month";
4170
+ limit: number;
4171
+ }[];
2517
4172
  };
2518
4173
  publishedAt: number;
2519
4174
  } | null;
@@ -2523,21 +4178,21 @@ declare function createRelayClient(options: RelayClientOptions): {
2523
4178
  key: string;
2524
4179
  qualifiedBy: string;
2525
4180
  balance: string;
2526
- metrics: ("likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks")[];
4181
+ metrics: string[];
2527
4182
  baseline: "historical";
2528
4183
  maxAgeMs: number;
2529
- budget: {
2530
- projectDaily?: number | undefined;
2531
- memberDaily?: number | undefined;
2532
- projectLifetime?: number | undefined;
2533
- };
4184
+ budgets: {
4185
+ scope: "member" | "project";
4186
+ period: "lifetime" | "day" | "week" | "month";
4187
+ limit: number;
4188
+ }[];
2534
4189
  };
2535
4190
  publishedAt: number;
2536
4191
  };
2537
4192
  items: {
2538
4193
  from: string;
2539
4194
  to: string;
2540
- baseline: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
4195
+ baseline: Record<string, number>;
2541
4196
  observedAt: number;
2542
4197
  settlement: {
2543
4198
  id: string;
@@ -2573,7 +4228,7 @@ declare function createRelayClient(options: RelayClientOptions): {
2573
4228
  contentAttempt: string;
2574
4229
  observation: string;
2575
4230
  observedAt: number;
2576
- metrics: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
4231
+ metrics: Record<string, number>;
2577
4232
  state: "pending" | "superseded" | "qualified" | "unqualified" | "needs-review" | "failed";
2578
4233
  reason: string | null;
2579
4234
  }[];
@@ -2599,33 +4254,9 @@ declare function createRelayClient(options: RelayClientOptions): {
2599
4254
  }[];
2600
4255
  nextCursor: string | null;
2601
4256
  }>;
2602
- admissions: (query: z.input<typeof contentAdmissionQuerySchema>, requestOptions?: RelayRequestOptions) => Promise<{
2603
- items: {
2604
- quest: string;
2605
- content: string;
2606
- release: string;
2607
- state: "pending" | "admitted" | "excluded";
2608
- reason: string | null;
2609
- attempt: string | null;
2610
- }[];
2611
- nextCursor: string | null;
2612
- }>;
2613
- enroll: (value: z.input<typeof contentEnrollmentInputSchema>, requestOptions?: RelayRequestOptions) => Promise<{
2614
- quest: string;
2615
- member: string;
2616
- enrolledAt: number;
2617
- }>;
2618
- claim: (value: z.input<typeof contentReleaseInputSchema>, requestOptions?: RelayRequestOptions) => Promise<{
2619
- quest: string;
2620
- content: string;
2621
- release: string;
2622
- state: "pending" | "admitted" | "excluded";
2623
- reason: string | null;
2624
- attempt: string | null;
2625
- }>;
2626
4257
  };
2627
4258
  };
2628
4259
  /** The participant client `createRelayClient` returns. */
2629
4260
  type RelayClient = ReturnType<typeof createRelayClient>;
2630
4261
 
2631
- export { type ClaimSubmission as C, type KnownRelayErrorCode as K, type PhotoSubmission as P, type QuestActionResult as Q, type RelayClient as R, type SubmissionDraft as S, type ValueSubmission as V, type ProgressObservation as a, type ProgressObserver as b, type QuestController as c, QuestUpdatedError as d, type QuizSubmission as e, type RelayClientOptions as f, RelayError as g, RelayErrorCode as h, type RelayErrorDetails as i, type RelayErrorKind as j, type RelayRequestOptions as k, RequestError as l, type RequestErrorDetails as m, type RequestErrorKind as n, type RequestRecovery as o, type SubmissionStatus as p, type SubmissionStore as q, createRelayClient as r, isRelayError as s, isRequestError as t };
4262
+ export { type ClaimSubmission as C, type KnownRelayErrorCode as K, type PhotoSubmission as P, type QuestActionResult as Q, type RelayClient as R, type SubmissionDraft as S, type ValueSubmission as V, type ProgressObservation as a, type ProgressObserver as b, type QuestController as c, QuestUpdatedError as d, type QuizSubmission as e, type RelayClientOptions as f, RelayError as g, RelayErrorCode as h, type RelayErrorDetails as i, type RelayErrorKind as j, type RelayRequestOptions as k, type SubmissionStatus as l, type SubmissionStore as m, createRelayClient as n, isRelayError as o };