@domino-sdk/relay 1.0.0-next.15 → 1.0.0-next.17

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.
@@ -1,15 +1,16 @@
1
1
  import { z } from 'zod';
2
2
  export { z } from 'zod';
3
3
  import { e as ContentPolicy, C as ContentMetric, E as EngagementBudget, T as leaderboardDefinitionSchema, a9 as referralAuthoringSchema, A as AdmittedContent } from './referrals-KQfP4pBf.js';
4
- import { r as discordMessagesSourceSchema, a as DiscordMessageData, b as DiscordMessageTextData, t as discordReactionsSourceSchema, c as DiscordReactionData, e as ResourceSource, S as Setting, j as XReader, D as DiscordMessage, B as Budget, I as IntegerSettings, d as IntegrationProvider } from './integrations-C1vB6Ry6.js';
4
+ import { q as discordMessagesSourceSchema, e as DiscordMessageData, f as DiscordMessageTextData, s as discordReactionsSourceSchema, g as DiscordReactionData, h as DiscordReader, T as TextEvidence, U as UrlEvidence, b as TextOptions, c as UrlOptions } from './submission-input-CkmBmSL1.js';
5
5
  import { Q as QuizContent, a as StreakPolicy } from './streaks-CWyq8Px5.js';
6
- import { j as TrackerDefinition, I as IdentityKind, K as customSourceSchema, G as WithRecordData, t as TrackerSource, a2 as trackerDefinitionSchema, T as Tracker, g as TrackerData, aw as xSearchSourceSchema, X as XTweet, w as TrackerTriggerContext, y as TrackerTriggerPolicy, q as TrackerReader, W as Where, x as TrackerTriggerMode, F as WhereSetting } from './trackers-7lxSWp2g.js';
7
- export { i as TrackerDataSchema, m as TrackerPage, ay as trackerDataSchema, am as trackerTriggerContextSchema } from './trackers-7lxSWp2g.js';
6
+ import { c as ResourceSource, S as Setting, h as XReader, B as Budget, I as IntegerSettings, b as IntegrationProvider } from './capability-error-DO6Q0Qwe.js';
7
+ export { G as CapabilityError, C as CapabilityErrorCode, j as capabilityErrorCodes } from './capability-error-DO6Q0Qwe.js';
8
+ import { j as TrackerDefinition, I as IdentityKind, L as customSourceSchema, H as WithRecordData, u as TrackerSource, a3 as trackerDefinitionSchema, T as Tracker, g as TrackerData, ax as xSearchSourceSchema, X as XTweet, x as TrackerTriggerContext, z as TrackerTriggerPolicy, r as TrackerReader, W as Where, y as TrackerTriggerMode, G as WhereSetting } from './trackers-Cg2MzFEf.js';
9
+ export { i as TrackerDataSchema, m as TrackerPage, q as TrackerReadQuery, az as trackerDataSchema, an as trackerTriggerContextSchema } from './trackers-Cg2MzFEf.js';
8
10
  import { e as ImageReader } from './images-CRxHUuG5.js';
9
- import { D as DiscordMember, T as TextEvidence, U as UrlEvidence, b as TextOptions, c as UrlOptions } from './submission-input-CccwAl5Z.js';
10
11
  import { n as TextReviewInput, m as TextResult, P as PhotoResult, ag as rewardSchema, av as triggerSchema, Q as QuestPresentation, a as QuestProfile, b as QuizEvidence, D as Decision, o as TieredRewardDefinition } from './schema-C4F2K9cm.js';
11
- import { k as WalletConnection, S as SolanaBalance, L as LinkedWallet, j as WalletBalanceQuery, i as WalletBalance } from './wallet-BtiG0Xhr.js';
12
- export { E as EvmChainId, r as isEvmChainId } from './wallet-BtiG0Xhr.js';
12
+ import { l as WalletReader } from './wallet-CYK5E2wj.js';
13
+ export { E as EvmChainId, i as WalletBalance, j as WalletBalanceQuery, s as isEvmChainId } from './wallet-CYK5E2wj.js';
13
14
  export { f as formatUnits, p as parseUnits } from './units-CwgsPB_r.js';
14
15
 
15
16
  /** Legacy `id` names an authoring key, never a server resource ID. */
@@ -610,27 +611,8 @@ type EvaluationContext<T, I = {
610
611
  criteria: string;
611
612
  }): Promise<PhotoResult>;
612
613
  };
613
- discord: {
614
- member(): Promise<DiscordMember | null>;
615
- message(input: {
616
- channelId: string;
617
- messageId: string;
618
- }): Promise<DiscordMessage | null>;
619
- };
620
- wallet: {
621
- /** The member's newest linked Solana wallet. */
622
- connection(): Promise<WalletConnection | null>;
623
- /** SOL held by the newest linked Solana wallet. */
624
- solanaBalance(): Promise<SolanaBalance | null>;
625
- /** Every wallet the member has linked to this project, pinned once per attempt. */
626
- list(): Promise<LinkedWallet[]>;
627
- /**
628
- * The native or token balance of the member's pinned linked wallets on one chain: all wallets of
629
- * that family, or `address` (which must be one of them). No wallets gives `total: "0"` and
630
- * `wallets: []`. Provider failures throw; they never read as a zero balance.
631
- */
632
- balance(query: WalletBalanceQuery): Promise<WalletBalance>;
633
- };
614
+ discord: DiscordReader;
615
+ wallet: WalletReader;
634
616
  };
635
617
  type Evaluator<T, I = {
636
618
  photo: string;
@@ -966,4 +948,4 @@ declare function defineQuest<T extends Record<string, Setting>, const G extends
966
948
  * Console instances receive independent quest identities and pinned versions. */
967
949
  declare const defineQuestType: typeof defineQuest;
968
950
 
969
- export { DiscordMessageData, DiscordMessageTextData, DiscordReactionData, type EvaluationContext, ImageReader, type KeyedContext, type PerformanceOutcome, Setting, Tracker, TrackerData, TrackerReader, type TrackerTrigger, TrackerTriggerContext, type TrackerTriggerInput, WalletBalance, WalletBalanceQuery, Where, XReader, automatic, budget, completed, content, customSource, decision, defineEngagementReward, defineLeaderboard, defineQuest, defineQuestType, defineReferral, defineTieredReward, defineTracker, discord, discordRole, evaluators, evidence, keyed, manual, once, perContent, pointLedgers, points, settings, staffHandover, streak, untracked, x };
951
+ export { DiscordMessageData, DiscordMessageTextData, DiscordReactionData, DiscordReader, type EvaluationContext, ImageReader, type KeyedContext, type PerformanceOutcome, Setting, Tracker, TrackerData, TrackerReader, type TrackerTrigger, TrackerTriggerContext, type TrackerTriggerInput, WalletReader, Where, XReader, automatic, budget, completed, content, customSource, decision, defineEngagementReward, defineLeaderboard, defineQuest, defineQuestType, defineReferral, defineTieredReward, defineTracker, discord, discordRole, evaluators, evidence, keyed, manual, once, perContent, pointLedgers, points, settings, staffHandover, streak, untracked, x };
package/dist/authoring.js CHANGED
@@ -2,6 +2,10 @@ import {
2
2
  formatUnits,
3
3
  parseUnits
4
4
  } from "./chunk-V7UKZLHA.js";
5
+ import {
6
+ CapabilityError,
7
+ capabilityErrorCodes
8
+ } from "./chunk-MC6V6VMG.js";
5
9
  import {
6
10
  sourceDataSchema,
7
11
  sourceRoles
@@ -595,8 +599,10 @@ function defineQuest(definition) {
595
599
  }
596
600
  var defineQuestType = defineQuest;
597
601
  export {
602
+ CapabilityError,
598
603
  automatic,
599
604
  budget,
605
+ capabilityErrorCodes,
600
606
  completed,
601
607
  content,
602
608
  customSource,
package/dist/avatar.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as LinkedWallet } from './wallet-BtiG0Xhr.js';
2
- import { P as ProfileAvatar } from './profiles-BtOXMGcC.js';
1
+ import { L as LinkedWallet } from './wallet-CYK5E2wj.js';
2
+ import { P as ProfileAvatar } from './profiles-md0g5fjx.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/browser.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { a6 as referralAcceptSchema, c as LeaderboardQuery, G as engagementPageQuerySchema, s as contentQualificationQuerySchema, i as contentAdmissionQuerySchema, k as contentEnrollmentInputSchema, u as contentReleaseInputSchema } from './referrals-KQfP4pBf.js';
2
2
  import { ao as submitSchema, x as contentPerformanceQuerySchema } from './schema-C4F2K9cm.js';
3
3
  import { h as QuestView, J as questExperienceSchema, e as PointHistoryQuery, c as PointEntryKind } from './catalog-CVXUHxiO.js';
4
- import { n as createRelayClient, g as RelayError, m as SubmissionStore, k as RelayRequestOptions, c as QuestController, a as ProgressObservation, b as ProgressObserver, P as PhotoSubmission, e as QuizSubmission, C as ClaimSubmission, V as ValueSubmission } from './client-dfXT6hhq.js';
4
+ import { n as createRelayClient, g as RelayError, m as SubmissionStore, k as RelayRequestOptions, c as QuestController, a as ProgressObservation, b as ProgressObserver, P as PhotoSubmission, e as QuizSubmission, C as ClaimSubmission, V as ValueSubmission } from './client-DG9qAB4o.js';
5
5
  import { a as PageQuery, f as exchangeSchema } from './pages-KYK1L60W.js';
6
- import { a as AuthProvider } from './submission-input-CccwAl5Z.js';
7
- import { C as CosmosChain, a as CosmosNetwork, f as WalletSigner, d as WalletSignInNetwork, x as walletAddressInputSchema, M as walletSignatureSchema, L as LinkedWallet } from './wallet-BtiG0Xhr.js';
8
- import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-BtOXMGcC.js';
6
+ import { a as AuthProvider } from './submission-input-CkmBmSL1.js';
7
+ import { C as CosmosChain, a as CosmosNetwork, f as WalletSigner, d as WalletSignInNetwork, y as walletAddressInputSchema, N as walletSignatureSchema, L as LinkedWallet } from './wallet-CYK5E2wj.js';
8
+ import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-md0g5fjx.js';
9
9
  import * as zod from 'zod';
10
10
  import './request-error-VnTiMXc3.js';
11
11
 
@@ -1,69 +1,5 @@
1
1
  import { z } from 'zod';
2
2
 
3
- /** A Discord message as `ctx.discord.message()` reads it, from the project's Discord server. */
4
- declare const discordMessageSchema: z.ZodObject<{
5
- guildId: z.ZodString;
6
- channelId: z.ZodString;
7
- messageId: z.ZodString;
8
- userId: z.ZodString;
9
- content: z.ZodNullable<z.ZodString>;
10
- replyTo: z.ZodNullable<z.ZodString>;
11
- publishedAt: z.ZodNumber;
12
- }, z.core.$strict>;
13
- type DiscordMessage = z.infer<typeof discordMessageSchema>;
14
- /**
15
- * Messages posted in the project's Discord server, written by the Discord gateway. The record's
16
- * `author` is the message author's Discord account. Message text is stored only with `text: true`.
17
- */
18
- declare const discordMessagesSourceSchema: z.ZodObject<{
19
- kind: z.ZodLiteral<"discord-messages">;
20
- /** Store each message's text in `data.text`. Off unless set. */
21
- text: z.ZodOptional<z.ZodBoolean>;
22
- }, z.core.$strict>;
23
- /**
24
- * Reactions added in the project's Discord server, written by the Discord gateway. The record's
25
- * `author` is the reactor's Discord account and its `messageAuthor` account is the message's
26
- * author, when Discord could name it.
27
- */
28
- declare const discordReactionsSourceSchema: z.ZodObject<{
29
- kind: z.ZodLiteral<"discord-reactions">;
30
- }, z.core.$strict>;
31
- /** The `data` of a `discord.messages()` record. IDs are Discord snowflakes. */
32
- declare const discordMessageDataSchema: z.ZodObject<{
33
- guildId: z.ZodString;
34
- channelId: z.ZodString;
35
- messageId: z.ZodString;
36
- replyTo: z.ZodNullable<z.ZodString>;
37
- publishedAt: z.ZodNumber;
38
- }, z.core.$strip>;
39
- type DiscordMessageData = z.infer<typeof discordMessageDataSchema>;
40
- /**
41
- * The `data` of a `discord.messages({ text: true })` record. `text` is null when the platform's
42
- * bot does not receive message content.
43
- */
44
- declare const discordMessageTextDataSchema: z.ZodObject<{
45
- guildId: z.ZodString;
46
- channelId: z.ZodString;
47
- messageId: z.ZodString;
48
- replyTo: z.ZodNullable<z.ZodString>;
49
- publishedAt: z.ZodNumber;
50
- text: z.ZodNullable<z.ZodString>;
51
- }, z.core.$strip>;
52
- type DiscordMessageTextData = z.infer<typeof discordMessageTextDataSchema>;
53
- /** The `data` of a `discord.reactions()` record. IDs are Discord snowflakes. */
54
- declare const discordReactionDataSchema: z.ZodObject<{
55
- guildId: z.ZodString;
56
- channelId: z.ZodString;
57
- messageId: z.ZodString;
58
- emoji: z.ZodObject<{
59
- id: z.ZodNullable<z.ZodString>;
60
- name: z.ZodString;
61
- }, z.core.$strip>;
62
- reactorRoles: z.ZodArray<z.ZodString>;
63
- messagePublishedAt: z.ZodNumber;
64
- }, z.core.$strip>;
65
- type DiscordReactionData = z.infer<typeof discordReactionDataSchema>;
66
-
67
3
  declare const resourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
68
4
  provider: z.ZodLiteral<"domino">;
69
5
  resource: z.ZodLiteral<"point-ledger">;
@@ -340,18 +276,25 @@ declare const xRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
340
276
  type XConnection = z.infer<typeof xConnectionSchema>;
341
277
  type XProfile = z.infer<typeof xProfileSchema>;
342
278
  type XPost = z.infer<typeof xPostSchema>;
279
+ /**
280
+ * Reads the member's linked X account and public X data. The account is pinned at the attempt's
281
+ * first X read: later links and unlinks do not change the attempt. `connection()`, `profile()`,
282
+ * `follows()` and `reposted()` resolve to `null` when the member has no linked X account;
283
+ * `post()` reads any public post and resolves to `null` when it does not exist. Provider failures
284
+ * throw `CapabilityError` with code `"provider-unavailable"`.
285
+ */
343
286
  interface XReader {
344
287
  connection(): Promise<XConnection | null>;
345
- profile(): Promise<XProfile>;
288
+ profile(): Promise<XProfile | null>;
346
289
  post(input: {
347
290
  postId: string;
348
- }): Promise<XPost>;
291
+ }): Promise<XPost | null>;
349
292
  follows(input: {
350
293
  userId: string;
351
- }): Promise<boolean>;
294
+ }): Promise<boolean | null>;
352
295
  reposted(input: {
353
296
  postId: string;
354
- }): Promise<boolean>;
297
+ }): Promise<boolean | null>;
355
298
  }
356
299
 
357
300
  declare const completionPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -412,4 +355,71 @@ declare const projectIntegrationSchema: z.ZodObject<{
412
355
  }, z.core.$strip>;
413
356
  type ProjectIntegration = z.infer<typeof projectIntegrationSchema>;
414
357
 
415
- export { resourceRequestSchema as A, type Budget as B, resourceSourceSchema as C, type DiscordMessage as D, settingFieldSchema as E, settingsFieldsSchema as F, settingsValuesSchema as G, xConnectionSchema as H, type IntegerSettings as I, xIdSchema as J, xPostSchema as K, xProfileSchema as L, xRequestSchema as M, type ProjectIntegration as P, type ResourceOption as R, type Setting as S, type XConnection as X, type DiscordMessageData as a, type DiscordMessageTextData as b, type DiscordReactionData as c, type IntegrationProvider as d, type ResourceSource as e, type SettingField as f, type SettingsValues as g, type XPost as h, type XProfile as i, type XReader as j, budgetSchema as k, compatibleSettingKinds as l, completionKeySchema as m, completionPolicySchema as n, discordMessageDataSchema as o, discordMessageSchema as p, discordMessageTextDataSchema as q, discordMessagesSourceSchema as r, discordReactionDataSchema as s, discordReactionsSourceSchema as t, discordServerSchema as u, integrationProviderSchema as v, missingResourceSettings as w, parseSettings as x, projectIntegrationSchema as y, resourceOptionsSchema as z };
358
+ /**
359
+ * Why an evaluator capability could not answer:
360
+ *
361
+ * - `not-linked`: the call needs a member account that is not linked, and its result cannot be
362
+ * null, such as an image check of the member's X profile picture. Readers of the member's own
363
+ * accounts return `null` instead.
364
+ * - `provider-unavailable`: the provider (X, Discord, a chain RPC, AI review) did not answer, or
365
+ * the project's integration cannot reach it.
366
+ * - `author-error`: the call cannot be answered as written: invalid input, an undeclared
367
+ * integration, an unknown tracker, a chain Relay does not read, a wallet the member never
368
+ * linked, or an image that does not exist.
369
+ *
370
+ * Later versions can add codes. Treat an unknown code as a failure its `message` explains.
371
+ */
372
+ declare const capabilityErrorCodes: readonly ["not-linked", "provider-unavailable", "author-error"];
373
+ type KnownCapabilityErrorCode = (typeof capabilityErrorCodes)[number];
374
+ /** A known code, or one a newer Relay added. */
375
+ type CapabilityErrorCode = KnownCapabilityErrorCode | (string & {});
376
+ /**
377
+ * A capability failure as it crosses the sandbox boundary and as Relay captures it. Open, so a
378
+ * newer Relay can add codes and fields without breaking an older evaluator or Worker.
379
+ */
380
+ declare const capabilityFailureSchema: z.ZodObject<{
381
+ code: z.ZodString;
382
+ message: z.ZodString;
383
+ /**
384
+ * True when Relay retries the attempt if the error reaches it uncaught, and calls the provider
385
+ * again. A failure that is not retryable is captured (or follows from the attempt's pinned
386
+ * inputs), so every run of the attempt sees it again. A retryable failure that quest code
387
+ * handles and moves past is final for the attempt; one that escapes the evaluation is retried.
388
+ */
389
+ retryable: z.ZodBoolean;
390
+ }, z.core.$loose>;
391
+ type CapabilityFailure = z.infer<typeof capabilityFailureSchema>;
392
+ /**
393
+ * Thrown by an evaluator capability (`ctx.x`, `ctx.discord`, `ctx.wallet`, `ctx.trackers`,
394
+ * `ctx.images`, `ctx.review`) that could not answer. A capability whose subject is missing (an
395
+ * account the member has not linked, a deleted post or message) returns `null` instead of
396
+ * throwing.
397
+ *
398
+ * Catch it to decide yourself; rethrow anything else. An uncaught retryable error makes Relay
399
+ * retry the attempt later; an uncaught one that is not retryable fails it.
400
+ *
401
+ * ```ts
402
+ * try {
403
+ * return (await ctx.x.follows({ userId })) ? decision.accept() : decision.reject({ reason })
404
+ * } catch (error) {
405
+ * if (error instanceof CapabilityError && error.code === "provider-unavailable")
406
+ * return decision.review({ reason: "X is unavailable" })
407
+ * throw error
408
+ * }
409
+ * ```
410
+ */
411
+ declare class CapabilityError extends Error {
412
+ readonly code: CapabilityErrorCode;
413
+ readonly retryable: boolean;
414
+ constructor(code: CapabilityErrorCode, message: string, options?: {
415
+ retryable?: boolean;
416
+ });
417
+ static [Symbol.hasInstance](value: unknown): boolean;
418
+ /**
419
+ * The error for a captured or transported failure. A code this SDK does not know is never
420
+ * retryable: nothing tells it a retry would help.
421
+ */
422
+ static from(failure: CapabilityFailure): CapabilityError;
423
+ }
424
+
425
+ export { xIdSchema as A, type Budget as B, type CapabilityErrorCode as C, xPostSchema as D, xProfileSchema as E, xRequestSchema as F, CapabilityError as G, type IntegerSettings as I, type KnownCapabilityErrorCode as K, type ProjectIntegration as P, type ResourceOption as R, type Setting as S, type XConnection as X, type CapabilityFailure as a, type IntegrationProvider as b, type ResourceSource as c, type SettingField as d, type SettingsValues as e, type XPost as f, type XProfile as g, type XReader as h, budgetSchema as i, capabilityErrorCodes as j, capabilityFailureSchema as k, compatibleSettingKinds as l, completionKeySchema as m, completionPolicySchema as n, discordServerSchema as o, integrationProviderSchema as p, missingResourceSettings as q, parseSettings as r, projectIntegrationSchema as s, resourceOptionsSchema as t, resourceRequestSchema as u, resourceSourceSchema as v, settingFieldSchema as w, settingsFieldsSchema as x, settingsValuesSchema as y, xConnectionSchema as z };
@@ -52,20 +52,25 @@ var participantExchangeSchema = z.object({
52
52
  }).strict();
53
53
 
54
54
  // src/image-results.ts
55
+ import { z as z2 } from "zod";
56
+ var invalid = (message, path) => new z2.ZodError([{ code: "custom", message, path, input: void 0 }]);
55
57
  function parseImageExtraction(raw, value) {
56
58
  const result = imageExtractionSchema.parse(value);
57
59
  const fields = imageFieldsSchema.parse(raw);
58
60
  for (const [key, field] of Object.entries(fields)) {
59
61
  const extracted = result.values[key];
60
62
  if (extracted === void 0) {
61
- throw new Error("Image extraction omitted " + key);
63
+ throw invalid("Image extraction omitted " + key, ["values", key]);
62
64
  }
63
65
  if (extracted !== null && typeof extracted !== field.type) {
64
- throw new Error("Image extraction returned the wrong type for " + key);
66
+ throw invalid("Image extraction returned the wrong type for " + key, [
67
+ "values",
68
+ key
69
+ ]);
65
70
  }
66
71
  }
67
72
  if (Object.keys(result.values).some((key) => !Object.hasOwn(fields, key))) {
68
- throw new Error("Image extraction returned an undeclared field");
73
+ throw invalid("Image extraction returned an undeclared field", ["values"]);
69
74
  }
70
75
  return result;
71
76
  }
@@ -85,8 +90,8 @@ function parseImageResult(request, value) {
85
90
  }
86
91
 
87
92
  // src/sequence-cursor.ts
88
- import { z as z2 } from "zod";
89
- var sequenceCursorSchema = z2.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z2.number().int().positive().safe());
93
+ import { z as z3 } from "zod";
94
+ var sequenceCursorSchema = z3.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z3.number().int().positive().safe());
90
95
 
91
96
  export {
92
97
  questConfiguration,
@@ -0,0 +1,49 @@
1
+ // src/capability-error.ts
2
+ import { z } from "zod";
3
+ var capabilityErrorCodes = [
4
+ "not-linked",
5
+ "provider-unavailable",
6
+ "author-error"
7
+ ];
8
+ var isKnown = (code) => capabilityErrorCodes.includes(code);
9
+ var capabilityFailureSchema = z.looseObject({
10
+ code: z.string().min(1),
11
+ message: z.string().min(1),
12
+ /**
13
+ * True when Relay retries the attempt if the error reaches it uncaught, and calls the provider
14
+ * again. A failure that is not retryable is captured (or follows from the attempt's pinned
15
+ * inputs), so every run of the attempt sees it again. A retryable failure that quest code
16
+ * handles and moves past is final for the attempt; one that escapes the evaluation is retried.
17
+ */
18
+ retryable: z.boolean()
19
+ });
20
+ var brand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay/CapabilityError");
21
+ var CapabilityError = class _CapabilityError extends Error {
22
+ code;
23
+ retryable;
24
+ constructor(code, message, options = {}) {
25
+ super(message);
26
+ this.name = "CapabilityError";
27
+ this.code = code;
28
+ this.retryable = options.retryable ?? code === "provider-unavailable";
29
+ Object.defineProperty(this, brand, { value: true });
30
+ }
31
+ static [Symbol.hasInstance](value) {
32
+ return typeof value === "object" && value !== null && value[brand] === true;
33
+ }
34
+ /**
35
+ * The error for a captured or transported failure. A code this SDK does not know is never
36
+ * retryable: nothing tells it a retry would help.
37
+ */
38
+ static from(failure) {
39
+ return new _CapabilityError(failure.code, failure.message, {
40
+ retryable: isKnown(failure.code) && failure.retryable
41
+ });
42
+ }
43
+ };
44
+
45
+ export {
46
+ capabilityErrorCodes,
47
+ capabilityFailureSchema,
48
+ CapabilityError
49
+ };
@@ -1,12 +1,12 @@
1
1
  import { h as QuestView, J as questExperienceSchema, e as PointHistoryQuery, c as PointEntryKind } from './catalog-CVXUHxiO.js';
2
- import { V as ValueEvidence, a as AuthProvider } from './submission-input-CccwAl5Z.js';
2
+ import { V as ValueEvidence, a as AuthProvider } from './submission-input-CkmBmSL1.js';
3
3
  import { R as RequestError, a as RequestErrorDetails, b as RequestErrorKind } from './request-error-VnTiMXc3.js';
4
4
  import { b as QuizEvidence, A as Attempt, M as MemberProgress, ao as submitSchema, x as contentPerformanceQuerySchema } from './schema-C4F2K9cm.js';
5
5
  import { z } from 'zod';
6
6
  import { c as ParticipantSession, a as PageQuery, f as exchangeSchema } from './pages-KYK1L60W.js';
7
7
  import { a6 as referralAcceptSchema, c as LeaderboardQuery, G as engagementPageQuerySchema, s as contentQualificationQuerySchema, i as contentAdmissionQuerySchema, k as contentEnrollmentInputSchema, u as contentReleaseInputSchema } from './referrals-KQfP4pBf.js';
8
- import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-BtOXMGcC.js';
9
- import { x as walletAddressInputSchema, M as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-BtiG0Xhr.js';
8
+ import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-md0g5fjx.js';
9
+ import { y as walletAddressInputSchema, N as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-CYK5E2wj.js';
10
10
 
11
11
  /** What happened, as in every Domino client error (see `RequestError`). */
12
12
  type RelayErrorKind = RequestErrorKind;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { i as TrackerDataSchema } from './trackers-7lxSWp2g.js';
2
+ import { i as TrackerDataSchema } from './trackers-Cg2MzFEf.js';
3
3
 
4
4
  /**
5
5
  * The canonical name of a named IANA timezone, or null for an unknown name or a fixed offset.
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export { C as ClaimSubmission, K as KnownRelayErrorCode, P as PhotoSubmission, a as ProgressObservation, b as ProgressObserver, Q as QuestActionResult, c as QuestController, d as QuestUpdatedError, e as QuizSubmission, R as RelayClient, f as RelayClientOptions, g as RelayError, h as RelayErrorCode, i as RelayErrorDetails, j as RelayErrorKind, k as RelayRequestOptions, S as SubmissionDraft, l as SubmissionStatus, m as SubmissionStore, V as ValueSubmission, n as createRelayClient, o as isRelayError } from './client-dfXT6hhq.js';
1
+ export { C as ClaimSubmission, K as KnownRelayErrorCode, P as PhotoSubmission, a as ProgressObservation, b as ProgressObserver, Q as QuestActionResult, c as QuestController, d as QuestUpdatedError, e as QuizSubmission, R as RelayClient, f as RelayClientOptions, g as RelayError, h as RelayErrorCode, i as RelayErrorDetails, j as RelayErrorKind, k as RelayRequestOptions, S as SubmissionDraft, l as SubmissionStatus, m as SubmissionStore, V as ValueSubmission, n as createRelayClient, o as isRelayError } from './client-DG9qAB4o.js';
2
2
  export { R as RequestError, a as RequestErrorDetails, b as RequestErrorKind, c as RequestRecovery, i as isRequestError } from './request-error-VnTiMXc3.js';
3
3
  export { f as formatUnits, p as parseUnits } from './units-CwgsPB_r.js';
4
- export { A as AccountConnection, a as AuthProvider, T as TextEvidence, b as TextOptions, U as UrlEvidence, c as UrlOptions, V as ValueEvidence } from './submission-input-CccwAl5Z.js';
4
+ export { A as AccountConnection, a as AuthProvider, T as TextEvidence, b as TextOptions, U as UrlEvidence, c as UrlOptions, V as ValueEvidence } from './submission-input-CkmBmSL1.js';
5
5
  export { E as ExchangeInput, M as MemberSummary, P as Page, a as PageQuery, b as ParticipantPrincipal, c as ParticipantSession, S as Session, s as sessionMember } from './pages-KYK1L60W.js';
6
6
  export { K as KnownPointEntryKind, P as PointBalance, a as PointBalances, b as PointEntry, c as PointEntryKind, d as PointHistoryPage, e as PointHistoryQuery, f as PointLedgerReference, Q as QuestInteraction, g as QuestRewardView, h as QuestView } from './catalog-CVXUHxiO.js';
7
7
  export { C as CollectionPass } from './collection-BGneJ6Bk.js';
8
8
  export { L as LeaderboardDefinition, a as LeaderboardPage, b as LeaderboardPlacement, c as LeaderboardQuery, R as ReferralDefinition } from './referrals-KQfP4pBf.js';
9
- export { A as AvatarProvider, O as OwnProfile, P as ProfileAvatar, a as ProfileCompletion, b as ProfileCompletionPage, c as ProfileCompletionQuery, d as ProfileReferral, e as ProfileSummary, f as ProfileUpdate, g as ProfileVisibility } from './profiles-BtOXMGcC.js';
9
+ export { A as AvatarProvider, O as OwnProfile, P as ProfileAvatar, a as ProfileCompletion, b as ProfileCompletionPage, c as ProfileCompletionQuery, d as ProfileReferral, e as ProfileSummary, f as ProfileUpdate, g as ProfileVisibility } from './profiles-md0g5fjx.js';
10
10
  export { Q as QuizContent, S as StreakProgress } from './streaks-CWyq8Px5.js';
11
11
  export { A as Attempt, E as Entitlement, M as MemberProgress, Q as QuestPresentation, a as QuestProfile, b as QuizEvidence, R as Reward, S as SubmissionEvidence, c as SubmitInput, T as TieredRewardReference } from './schema-C4F2K9cm.js';
12
- export { C as CosmosChain, a as CosmosNetwork, L as LinkedWallet, W as WalletAddressInput, b as WalletChain, c as WalletMessageChallenge, d as WalletSignInNetwork, e as WalletSignature, f as WalletSigner, g as WalletUnlinkInput } from './wallet-BtiG0Xhr.js';
12
+ export { C as CosmosChain, a as CosmosNetwork, L as LinkedWallet, W as WalletAddressInput, b as WalletChain, c as WalletMessageChallenge, d as WalletSignInNetwork, e as WalletSignature, f as WalletSigner, g as WalletUnlinkInput } from './wallet-CYK5E2wj.js';
13
13
  import 'zod';
@@ -2,8 +2,8 @@ import { f as PublishedRelease } from './schema-C4F2K9cm.js';
2
2
  export { i as identityIntegrationInputSchema, a as identityIntegrationSchema, b as identityIntegrationSecretSchema, p as participantExchangeSchema } from './identity-integration-CBR8l3ju.js';
3
3
  import { c as ImageFields, g as ImageRequest } from './images-CRxHUuG5.js';
4
4
  import { z } from 'zod';
5
- import { t as TrackerSource, i as TrackerDataSchema } from './trackers-7lxSWp2g.js';
6
- export { az as TrackerDataBudget, aA as schemaCheckedReader, aB as trackerDataBatchSteps, aC as trackerDataIssue, aD as trackerDataIssues, aE as trackerDataPathTypes, aF as trackerDataRecordSteps, aG as whereSchemaIssue } from './trackers-7lxSWp2g.js';
5
+ import { u as TrackerSource, i as TrackerDataSchema } from './trackers-Cg2MzFEf.js';
6
+ export { aA as TrackerDataBudget, aB as schemaCheckedReader, aC as trackerDataBatchSteps, aD as trackerDataIssue, aE as trackerDataIssues, aF as trackerDataPathTypes, aG as trackerDataRecordSteps, aH as whereSchemaIssue } from './trackers-Cg2MzFEf.js';
7
7
 
8
8
  /** Older releases did not record ownership. Preserve every value, including defaults. */
9
9
  declare function questConfiguration(release: PublishedRelease): {
package/dist/internal.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  participantExchangeSchema,
8
8
  questConfiguration,
9
9
  sequenceCursorSchema
10
- } from "./chunk-HWRBLM7E.js";
10
+ } from "./chunk-JZ74VJX4.js";
11
11
  import "./chunk-CYD6QMHU.js";
12
12
  import {
13
13
  sourceDataSchema,
@@ -3,13 +3,13 @@ import { ReactNode } from 'react';
3
3
  import { a6 as referralAcceptSchema, c as LeaderboardQuery, G as engagementPageQuerySchema, s as contentQualificationQuerySchema, i as contentAdmissionQuerySchema, k as contentEnrollmentInputSchema, u as contentReleaseInputSchema, b as LeaderboardPlacement, af as referralSummarySchema, a as LeaderboardPage } from '../referrals-KQfP4pBf.js';
4
4
  import { ao as submitSchema, x as contentPerformanceQuerySchema, T as TieredRewardReference } from '../schema-C4F2K9cm.js';
5
5
  import { a as PageQuery, f as exchangeSchema, P as Page, c as ParticipantSession, M as MemberSummary } from '../pages-KYK1L60W.js';
6
- import { x as walletAddressInputSchema, M as walletSignatureSchema, L as LinkedWallet, f as WalletSigner, d as WalletSignInNetwork } from '../wallet-BtiG0Xhr.js';
6
+ import { y as walletAddressInputSchema, N as walletSignatureSchema, L as LinkedWallet, f as WalletSigner, d as WalletSignInNetwork } from '../wallet-CYK5E2wj.js';
7
7
  import { h as QuestView, J as questExperienceSchema, e as PointHistoryQuery, c as PointEntryKind, a as PointBalances, b as PointEntry, f as PointLedgerReference } from '../catalog-CVXUHxiO.js';
8
- import { F as profileUpdateSchema, c as ProfileCompletionQuery, f as ProfileUpdate, e as ProfileSummary, a as ProfileCompletion, d as ProfileReferral } from '../profiles-BtOXMGcC.js';
8
+ import { F as profileUpdateSchema, c as ProfileCompletionQuery, f as ProfileUpdate, e as ProfileSummary, a as ProfileCompletion, d as ProfileReferral } from '../profiles-md0g5fjx.js';
9
9
  import * as zod from 'zod';
10
10
  import { z } from 'zod';
11
- import { g as RelayError, k as RelayRequestOptions, c as QuestController, a as ProgressObservation, b as ProgressObserver, P as PhotoSubmission, e as QuizSubmission, C as ClaimSubmission, V as ValueSubmission, S as SubmissionDraft } from '../client-dfXT6hhq.js';
12
- import { a as AuthProvider, A as AccountConnection } from '../submission-input-CccwAl5Z.js';
11
+ import { g as RelayError, k as RelayRequestOptions, c as QuestController, a as ProgressObservation, b as ProgressObserver, P as PhotoSubmission, e as QuizSubmission, C as ClaimSubmission, V as ValueSubmission, S as SubmissionDraft } from '../client-DG9qAB4o.js';
12
+ import { a as AuthProvider, A as AccountConnection } from '../submission-input-CkmBmSL1.js';
13
13
  import { createBrowserRelayClient, SignInMethods, CosmosChains, SignInOption, SignInUnavailable, SignInWallet, DiscoveredWallet } from '../browser.js';
14
14
  export { EmailSignInOption, OAuthSignInOption, SignInIcon, WalletSignInOption } from '../browser.js';
15
15
  import '../request-error-VnTiMXc3.js';
@@ -2598,7 +2598,7 @@ type RoleDeliveryStatus = KnownRoleDeliveryStatus | (string & {});
2598
2598
  * changes whether the quest is completed: the role follows the completion.
2599
2599
  * `failed` means Domino gave up; only the organizer can grant the role now.
2600
2600
  */
2601
- declare function roleDeliveryStatus(deliveries: RoleDelivery[], quest: string): KnownRoleDeliveryStatus | null;
2601
+ declare function roleDeliveryStatus(deliveries: readonly RoleDelivery[], quest: string): RoleDeliveryStatus | null;
2602
2602
  /** `roleDeliveryStatus` in English, or null for null. */
2603
2603
  declare function roleDeliveryLabel(status: RoleDeliveryStatus | null): "Role delivery pending" | "Role delivery failed" | "Role granted" | null;
2604
2604
 
@@ -2609,7 +2609,7 @@ declare function roleDeliveryLabel(status: RoleDeliveryStatus | null): "Role del
2609
2609
  * has arrived yet.
2610
2610
  */
2611
2611
  declare function useExperience(): MemberQuery<ExperienceData> & {
2612
- deliveries: RoleDelivery[];
2612
+ deliveries: readonly RoleDelivery[];
2613
2613
  };
2614
2614
 
2615
2615
  type QuestInput = {
@@ -2636,8 +2636,20 @@ type QuestNotice = "received" | "quest-updated" | null;
2636
2636
  * - When the quest changed underneath the participant, nothing is resubmitted
2637
2637
  * for them. They see the latest version with whatever draft still applies.
2638
2638
  * - An interrupted submission is resumed, never duplicated.
2639
+ *
2640
+ * The actions keep their identity across renders and act on the latest `view`; the returned object
2641
+ * changes only when something in it does.
2639
2642
  */
2640
2643
  declare function useQuest(observed: QuestView): {
2644
+ restart: () => Promise<void>;
2645
+ submit: (input: QuestInput) => Promise<void>;
2646
+ /** Finish an interrupted submission, or reopen an outdated draft. */
2647
+ resume: () => Promise<void>;
2648
+ /**
2649
+ * Re-run verification that failed to run. Never creates a new attempt.
2650
+ * Domino refuses this for automatic quests, so never offer it for them.
2651
+ */
2652
+ retry: () => Promise<void>;
2641
2653
  /** The newest known version of the quest. Render this, not the prop. */
2642
2654
  view: {
2643
2655
  quest: string;
@@ -2898,15 +2910,6 @@ declare function useQuest(observed: QuestView): {
2898
2910
  /** The attempt the last "received" notice is about. */
2899
2911
  receipt: string | null;
2900
2912
  startingFresh: boolean;
2901
- restart: () => Promise<void>;
2902
- submit: (input: QuestInput) => Promise<void>;
2903
- /** Finish an interrupted submission, or reopen an outdated draft. */
2904
- resume: () => Promise<void>;
2905
- /**
2906
- * Re-run verification that failed to run. Never creates a new attempt.
2907
- * Domino refuses this for automatic quests, so never offer it for them.
2908
- */
2909
- retry: () => Promise<void>;
2910
2913
  };
2911
2914
 
2912
2915
  type QuestTone = "open" | "done" | "waiting" | "attention" | "locked" | "off";
@@ -2956,8 +2959,12 @@ declare function isFinished(view: QuestView): boolean;
2956
2959
  * status and nothing to press.
2957
2960
  */
2958
2961
  declare function isAutomatic(view: QuestView): boolean;
2959
- /** "Completed 3 times" for repeatable quests, otherwise nothing. */
2960
- declare function completionCountLabel(view: QuestView): string | null;
2962
+ /**
2963
+ * How often a repeatable quest was completed, in English ("Completed once", "Completed 3 times"),
2964
+ * or null for a quest that is not repeatable or was never completed. To use your own words, read
2965
+ * `view.completionCount` where `view.completion.kind` is `keyed`.
2966
+ */
2967
+ declare function completionCountText(view: QuestView): string | null;
2961
2968
  /**
2962
2969
  * True when a repeatable quest's latest submission was accepted. The quest is
2963
2970
  * open again, so show the normal submit action rather than a finished state.
@@ -2965,11 +2972,10 @@ declare function completionCountLabel(view: QuestView): string | null;
2965
2972
  declare function canRepeat(view: QuestView): boolean;
2966
2973
  /**
2967
2974
  * What a QuestView means for the participant, as a tone and a code. Pure and free of copy: render
2968
- * the code in your own words, or call `questStatusText` for English.
2975
+ * the code in your own words, or call `questStatusText` for English. The code is an open string,
2976
+ * so a `switch` over it needs a `default` for codes a newer SDK adds.
2969
2977
  */
2970
- declare function questStatus(view: QuestView): QuestStatus & {
2971
- code: KnownQuestStatusCode;
2972
- };
2978
+ declare function questStatus(view: QuestView): QuestStatus;
2973
2979
  /**
2974
2980
  * `questStatus` in English, for apps that do not localize: a `label` such as "In review", and a
2975
2981
  * `detail` sentence when there is more to say.
@@ -2977,6 +2983,12 @@ declare function questStatus(view: QuestView): QuestStatus & {
2977
2983
  declare function questStatusText(view: QuestView): QuestStatusText;
2978
2984
  /** True when the participant can submit something right now. */
2979
2985
  declare function canSubmit(view: QuestView): boolean;
2986
+ /**
2987
+ * "x of y completed" for a list of quests: `total` counts every quest that is not archived or
2988
+ * repeatable, including locked and paused ones, because they are still part of what the
2989
+ * participant works through; `done` counts those that are finished (`isFinished`). A repeatable
2990
+ * quest is never finished, so it stays out of both.
2991
+ */
2980
2992
  declare function progressOf(quests: QuestView[]): {
2981
2993
  total: number;
2982
2994
  done: number;
@@ -3012,6 +3024,11 @@ declare function useSignIn(): {
3012
3024
  /** Signs in, or signs up, with a wallet; the wallet asks the participant to sign a message. */
3013
3025
  withWallet: (signer: WalletSigner) => Promise<void>;
3014
3026
  };
3027
+ /**
3028
+ * Signs the participant out. Once Relay confirms, the previous member's cached values are gone and
3029
+ * the member hooks report `signed-out`. `signOut` keeps its identity across renders, and rejects
3030
+ * when Relay could not sign out.
3031
+ */
3015
3032
  declare function useSignOut(): {
3016
3033
  busy: boolean;
3017
3034
  signOut: () => Promise<void>;
@@ -3296,7 +3313,7 @@ declare function useProfileReferral(profile: string, program: string, options?:
3296
3313
  * A profile's completions of quests that show on profiles (`relay.profiles.completions`), most
3297
3314
  * recently completed first, `limit` quests at a time: `data.items`, and `data.nextCursor` while
3298
3315
  * there are more. `loadMore()` appends the next page; `refresh()` starts again from the first, as a
3299
- * quest submission or a profile change does.
3316
+ * new completion in the experience or a profile change does.
3300
3317
  */
3301
3318
  declare function useProfileCompletions(profile: string, options?: {
3302
3319
  limit?: number;
@@ -3349,11 +3366,14 @@ declare function useInvitation(param?: string): {
3349
3366
  /**
3350
3367
  * The signed-in participant's invitation code and progress in `data`: attributed friends,
3351
3368
  * qualified friends per program, milestones, and points. `link` is the share link, null until the
3352
- * summary is read. Read again after an invitation is accepted and after a quest submission.
3369
+ * summary is read. Read again every `intervalMs` (default 60 seconds) while the page is visible, so
3370
+ * friends who qualify show up, after an invitation is accepted, and when a new completion appears
3371
+ * in the experience.
3353
3372
  */
3354
3373
  declare function useReferralSummary(options?: {
3355
3374
  path?: string;
3356
3375
  param?: string;
3376
+ intervalMs?: number;
3357
3377
  }): MemberQuery<ReferralSummary> & {
3358
3378
  link: string | null;
3359
3379
  };
@@ -3361,9 +3381,9 @@ declare function useReferralSummary(options?: {
3361
3381
  /**
3362
3382
  * One leaderboard's top rows plus the participant's own row and neighbours, in `data`.
3363
3383
  *
3364
- * Read again every `intervalMs` while the page is visible, after a quest submission, and for each
3365
- * participant who signs in. Boards default to participants-only access: signed-out visitors get
3366
- * an error unless the board is published as public.
3384
+ * Read again every `intervalMs` while the page is visible, when a new completion appears in the
3385
+ * experience, and for each participant who signs in. Boards default to participants-only access:
3386
+ * signed-out visitors get an error unless the board is published as public.
3367
3387
  */
3368
3388
  declare function useLeaderboard(board: string, options?: {
3369
3389
  limit?: number;
@@ -3402,4 +3422,4 @@ declare function usePointLedgers(): Query<PointLedgerReference[]>;
3402
3422
  */
3403
3423
  declare function useTieredRewards(): Query<TieredRewardReference[]>;
3404
3424
 
3405
- export { type Collection, CosmosChains, DiscoveredWallet, type ExperienceData, type Invitation, type KnownQuestStatusCode, type KnownRoleDeliveryStatus, type MemberPagedQuery, type MemberQuery, type MemberSnapshot, type OAuthProvider, Page, type PageLoader, type PageRead, type PagedQuery, type Query, type QueryContext, type QueryKey, type QueryOptions, type QueryRead, type QuerySnapshot, type QuestInput, type QuestNotice, type QuestStatus, type QuestStatusCode, type QuestStatusText, type QuestTone, type ReferralSummary, type RelayClient, RelayProvider, type RoleDelivery, type RoleDeliveryStatus, type SavedSubmission, SignInMethods, SignInOption, SignInUnavailable, SignInWallet, canRepeat, canSubmit, captureReferralCode, completionCountLabel, isAutomatic, isConnected, isFinished, progressOf, questGroups, questStatus, questStatusText, relayKeys, roleDeliveryLabel, roleDeliveryStatus, useAccounts, useBalances, useExperience, useInvalidate, useInvitation, useLeaderboard, useLeaderboardPlacement, useMe, useMemberPages, useMemberQuery, useMyProfile, usePointHistory, usePointLedgers, useProfile, useProfileCompletions, useProfileReferral, useQuest, useReferralSummary, useRelay, useRelayPages, useRelayQuery, useSession, useSignIn, useSignInMethods, useSignInOptions, useSignInWallets, useSignOut, useTieredRewards, useWalletDiscovery, useWallets };
3425
+ export { type Collection, CosmosChains, DiscoveredWallet, type ExperienceData, type Invitation, type KnownQuestStatusCode, type KnownRoleDeliveryStatus, type MemberPagedQuery, type MemberQuery, type MemberSnapshot, type OAuthProvider, Page, type PageLoader, type PageRead, type PagedQuery, type Query, type QueryContext, type QueryKey, type QueryOptions, type QueryRead, type QuerySnapshot, type QuestInput, type QuestNotice, type QuestStatus, type QuestStatusCode, type QuestStatusText, type QuestTone, type ReferralSummary, type RelayClient, RelayProvider, type RoleDelivery, type RoleDeliveryStatus, type SavedSubmission, SignInMethods, SignInOption, SignInUnavailable, SignInWallet, canRepeat, canSubmit, captureReferralCode, completionCountText, isAutomatic, isConnected, isFinished, progressOf, questGroups, questStatus, questStatusText, relayKeys, roleDeliveryLabel, roleDeliveryStatus, useAccounts, useBalances, useExperience, useInvalidate, useInvitation, useLeaderboard, useLeaderboardPlacement, useMe, useMemberPages, useMemberQuery, useMyProfile, usePointHistory, usePointLedgers, useProfile, useProfileCompletions, useProfileReferral, useQuest, useReferralSummary, useRelay, useRelayPages, useRelayQuery, useSession, useSignIn, useSignInMethods, useSignInOptions, useSignInWallets, useSignOut, useTieredRewards, useWalletDiscovery, useWallets };