@domino-sdk/relay 1.36.0 → 1.38.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 (46) hide show
  1. package/dist/{attempt-captures-B2Clh9Df.d.ts → attempt-captures-CSiN1HKd.d.ts} +1 -1
  2. package/dist/authoring.d.ts +62 -47
  3. package/dist/authoring.js +14 -6
  4. package/dist/{automatic-outcomes-BiarOoiy.d.ts → automatic-outcomes-DDbgRubQ.d.ts} +1 -1
  5. package/dist/browser.d.ts +6 -6
  6. package/dist/browser.js +10 -10
  7. package/dist/{chunk-2A4LCKTU.js → chunk-2CP3SULY.js} +9 -2
  8. package/dist/{chunk-FTB7F5IP.js → chunk-B65YJ6K4.js} +1 -1
  9. package/dist/{chunk-LNPV4J53.js → chunk-BYX27T2S.js} +2 -2
  10. package/dist/{chunk-K7PUCZJY.js → chunk-CHQWG5KQ.js} +12 -10
  11. package/dist/{chunk-JXFRKZGL.js → chunk-CRX274HO.js} +1 -1
  12. package/dist/{chunk-R5NQEW5J.js → chunk-DZZ5GSJ6.js} +2 -2
  13. package/dist/{chunk-SB3ODDGR.js → chunk-FTGW72A6.js} +1 -1
  14. package/dist/{chunk-GI6RO43K.js → chunk-JYHRPMCE.js} +8 -2
  15. package/dist/{chunk-JHHTQ73D.js → chunk-KEYQHJHU.js} +6 -6
  16. package/dist/{chunk-S37JPI5O.js → chunk-KTHHGZSJ.js} +1 -1
  17. package/dist/{chunk-RIMESZ4X.js → chunk-OEO5OBY5.js} +35 -3
  18. package/dist/{chunk-U735N4KB.js → chunk-SBW52XXL.js} +1 -1
  19. package/dist/{chunk-Z2EN4ERZ.js → chunk-V7KYVH3Z.js} +1 -1
  20. package/dist/{chunk-NQDZX3D2.js → chunk-YNQPFRQO.js} +7 -2
  21. package/dist/{chunk-L33BQLNF.js → chunk-Z3SG7LKF.js} +4 -4
  22. package/dist/{chunk-3KCKA2XH.js → chunk-ZT7FPD7B.js} +1 -1
  23. package/dist/{client-CraOIr8b.d.ts → client-DjwKrpFo.d.ts} +19 -4
  24. package/dist/{deployments-DTaJPDsl.d.ts → deployments-DYeuxXYg.d.ts} +257 -213
  25. package/dist/{groups-DTsvf0Z2.d.ts → groups-JzAQ2JIN.d.ts} +9 -2
  26. package/dist/index.d.ts +7 -7
  27. package/dist/index.js +9 -9
  28. package/dist/internal.d.ts +9 -9
  29. package/dist/internal.js +8 -8
  30. package/dist/{offers-DFJ4dmR3.d.ts → offers-CIDAJEYs.d.ts} +2 -2
  31. package/dist/{pages-B5agdH0f.d.ts → pages-DR2YRvAp.d.ts} +20 -1
  32. package/dist/portal-proxy.js +3 -3
  33. package/dist/react/index.d.ts +29 -18
  34. package/dist/react/index.js +60 -17
  35. package/dist/{schema--jNn3OfJ.d.ts → schema-Cgmj-CbC.d.ts} +18 -1
  36. package/dist/schema.d.ts +341 -320
  37. package/dist/schema.js +11 -7
  38. package/dist/server/index.d.ts +9 -9
  39. package/dist/server/index.js +104 -16
  40. package/dist/{submission-input-BHzSin84.d.ts → submission-input-UBqB8NFC.d.ts} +2 -2
  41. package/dist/{telegram-browser-B1LFWF_v.d.ts → telegram-browser-2IllFeh-.d.ts} +1 -1
  42. package/dist/testing.d.ts +3 -3
  43. package/dist/testing.js +5 -5
  44. package/dist/{transport-4QyqeZLU.d.ts → transport-B3DkXMNu.d.ts} +3612 -3080
  45. package/dist/{x-imfTy_I1.d.ts → x-vVG6gZqi.d.ts} +1 -1
  46. package/package.json +1 -1
@@ -6,7 +6,7 @@ import {
6
6
  imageSightingsSchema,
7
7
  imageUploadsSchema,
8
8
  publishedImageSchema
9
- } from "./chunk-Z2EN4ERZ.js";
9
+ } from "./chunk-V7KYVH3Z.js";
10
10
  import {
11
11
  catalogDeploymentSchema,
12
12
  collectionPassSchema,
@@ -24,7 +24,7 @@ import {
24
24
  questTypeVersionSchema,
25
25
  questViewSchema,
26
26
  rewardDeliveriesSchema
27
- } from "./chunk-GI6RO43K.js";
27
+ } from "./chunk-JYHRPMCE.js";
28
28
  import {
29
29
  badgeArtifactSchema,
30
30
  badgeSchema,
@@ -57,15 +57,15 @@ import {
57
57
  referralDefinitionSchema,
58
58
  referralHistorySchema,
59
59
  referralSummarySchema
60
- } from "./chunk-2A4LCKTU.js";
60
+ } from "./chunk-2CP3SULY.js";
61
61
  import {
62
62
  telegramAccountConnectionSchema
63
- } from "./chunk-FTB7F5IP.js";
63
+ } from "./chunk-B65YJ6K4.js";
64
64
  import {
65
65
  exchangeResultSchema,
66
66
  memberSummarySchema,
67
67
  participantSessionSchema
68
- } from "./chunk-SB3ODDGR.js";
68
+ } from "./chunk-FTGW72A6.js";
69
69
  import {
70
70
  accountConnectionSchema,
71
71
  attemptSchema,
@@ -96,7 +96,7 @@ import {
96
96
  walletBalanceSchema,
97
97
  walletMessageChallengeSchema,
98
98
  walletSignInNetworksSchema
99
- } from "./chunk-RIMESZ4X.js";
99
+ } from "./chunk-OEO5OBY5.js";
100
100
 
101
101
  // src/deployments.ts
102
102
  import * as z from "zod";
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var name = "@domino-sdk/relay";
3
- var version = "1.36.0";
3
+ var version = "1.38.0";
4
4
 
5
5
  // src/client-identity.ts
6
6
  function clientIdentity() {
@@ -70,6 +70,11 @@ var RelayErrorCode = {
70
70
  QuestUpdated: "quest-updated",
71
71
  /** Wait for the deferred attempt before submitting another action. */
72
72
  AttemptPending: "attempt-pending",
73
+ /**
74
+ * The member's last attempt was rejected and the quest's retry cooldown is running; `retryAt`
75
+ * says when they may submit again.
76
+ */
77
+ RetryCooldown: "retry-cooldown",
73
78
  /** The quiz changed since the member answered it. */
74
79
  StaleQuiz: "stale-quiz",
75
80
  /** Relay refused the submitted evidence. */
@@ -130,10 +135,13 @@ var RelayError = class extends RequestError {
130
135
  window;
131
136
  /** Prerequisites the member does not currently meet, when Relay refused for that reason. */
132
137
  missing;
138
+ /** Unix milliseconds when the member may submit again, when `code` is `retry-cooldown`. */
139
+ retryAt;
133
140
  constructor(message, details) {
134
141
  super(message, details);
135
142
  this.window = details.window;
136
143
  this.missing = details.missing ?? [];
144
+ this.retryAt = details.retryAt;
137
145
  }
138
146
  };
139
147
  function asRelayError(cause, fallback = "Request failed") {
@@ -2734,12 +2742,15 @@ function inGroup(group) {
2734
2742
  });
2735
2743
  }
2736
2744
 
2745
+ // src/points-amount.ts
2746
+ var maxPointsAmount = 2147483647;
2747
+
2737
2748
  // src/schema.ts
2738
2749
  import * as z26 from "zod";
2739
2750
  var pointsRewardSchema = z26.object({
2740
2751
  kind: z26.literal("points").default("points"),
2741
2752
  balance: identifier,
2742
- amount: z26.number().int().min(0).max(1e4)
2753
+ amount: z26.number().int().min(0).max(maxPointsAmount)
2743
2754
  }).strict();
2744
2755
  var tieredRewardDefinitionSchema = z26.object({
2745
2756
  /** An automatic achievement backed by the project badge catalog. */
@@ -2854,6 +2865,11 @@ var deferPolicy = {
2854
2865
  horizonMs: 864e5,
2855
2866
  maxDefers: 100
2856
2867
  };
2868
+ var retryCooldownPolicy = {
2869
+ minMs: 1e3,
2870
+ maxMs: 6048e5
2871
+ };
2872
+ var retryCooldownMsSchema = z26.number().int().min(retryCooldownPolicy.minMs).max(retryCooldownPolicy.maxMs);
2857
2873
  var evaluatorProgressSchema = z26.object({
2858
2874
  current: z26.number().finite().nonnegative(),
2859
2875
  target: z26.number().finite().positive(),
@@ -2970,7 +2986,12 @@ var questDescriptionSchema = z26.object({
2970
2986
  visibility: z26.enum(["visible", "hidden"]).default("visible"),
2971
2987
  /** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
2972
2988
  profile: questProfileSchema.default({ visible: false }),
2973
- budgets: z26.array(budgetSchema).max(20).default([])
2989
+ budgets: z26.array(budgetSchema).max(20).default([]),
2990
+ /**
2991
+ * Milliseconds a member waits after an attempt is rejected (by the evaluator or a reviewer)
2992
+ * before submitting this quest again. Only for quests members submit. Omitted: no cooldown.
2993
+ */
2994
+ retryCooldownMs: retryCooldownMsSchema.optional()
2974
2995
  }).strict();
2975
2996
  var artifactSchema = z26.object({ code: z26.string().min(1).max(1e6) }).strict();
2976
2997
  var releaseSchema = artifactSchema.extend({
@@ -3369,6 +3390,12 @@ var memberProgressSchema = responseShape(
3369
3390
  campaign: campaignViewSchema.nullable().default(null),
3370
3391
  window: availabilityWindowSchema.nullable().default(null),
3371
3392
  budgets: z26.array(questBudgetViewSchema).default([]),
3393
+ /**
3394
+ * Unix milliseconds when the member may submit again, while the quest's retry cooldown
3395
+ * after their rejected attempt runs. Until then a new attempt is refused with
3396
+ * `retry-cooldown`. Absent when no cooldown is running.
3397
+ */
3398
+ retryAt: z26.number().int().safe().optional(),
3372
3399
  attempt: attemptSchema.nullable()
3373
3400
  })
3374
3401
  ),
@@ -3404,7 +3431,9 @@ var errorSchema = z26.object({
3404
3431
  code: z26.string().optional(),
3405
3432
  /** Which window refused admission when `code` is `outside-window`. */
3406
3433
  window: z26.enum(["tracker", "quest"]).optional(),
3407
- missing: z26.array(missingPrerequisiteSchema).optional()
3434
+ missing: z26.array(missingPrerequisiteSchema).optional(),
3435
+ /** Unix milliseconds when the member may submit again, when `code` is `retry-cooldown`. */
3436
+ retryAt: z26.number().int().safe().optional()
3408
3437
  });
3409
3438
  var staffDecisionSchema = z26.object({
3410
3439
  actionId: identifier,
@@ -3642,6 +3671,7 @@ export {
3642
3671
  trackerTriggerRecordSchema,
3643
3672
  trackerContentStageSchema,
3644
3673
  trackerTriggerContextSchema,
3674
+ maxPointsAmount,
3645
3675
  completionPolicySchema,
3646
3676
  completionKeySchema,
3647
3677
  budgetSchema,
@@ -3742,6 +3772,8 @@ export {
3742
3772
  textReviewInputSchema,
3743
3773
  textResultSchema,
3744
3774
  deferPolicy,
3775
+ retryCooldownPolicy,
3776
+ retryCooldownMsSchema,
3745
3777
  evaluatorProgressSchema,
3746
3778
  decisionSchema,
3747
3779
  reviewModeSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isRequestError
3
- } from "./chunk-RIMESZ4X.js";
3
+ } from "./chunk-OEO5OBY5.js";
4
4
 
5
5
  // src/request-lifetime.ts
6
6
  var PARTICIPANT_TIMEOUT = 15e3;
@@ -2,7 +2,7 @@ import {
2
2
  identifier,
3
3
  responseShape,
4
4
  xTweetSchema
5
- } from "./chunk-RIMESZ4X.js";
5
+ } from "./chunk-OEO5OBY5.js";
6
6
 
7
7
  // src/x.ts
8
8
  import * as z from "zod";
@@ -5,11 +5,11 @@ import {
5
5
  isKnownTrackerSource,
6
6
  trackerDataSchema,
7
7
  xAccountRoles
8
- } from "./chunk-RIMESZ4X.js";
8
+ } from "./chunk-OEO5OBY5.js";
9
9
 
10
10
  // src/quest-shape.ts
11
11
  function validateQuestShape(description, options = {}) {
12
- const { trigger, completion, requires, performance } = description;
12
+ const { trigger, completion, requires, performance, retryCooldownMs } = description;
13
13
  const tracker = trigger.kind === "automatic" ? trigger.tracker : void 0;
14
14
  const content = tracker?.content === true;
15
15
  if (performance && !content) {
@@ -25,6 +25,11 @@ function validateQuestShape(description, options = {}) {
25
25
  );
26
26
  }
27
27
  }
28
+ if (retryCooldownMs !== void 0 && (trigger.kind !== "manual" || trigger.actor === "staff")) {
29
+ throw new Error(
30
+ "A retry cooldown applies only to quests members submit themselves"
31
+ );
32
+ }
28
33
  if (trigger.kind === "automatic" && !tracker) {
29
34
  if (!options.template && requires.length === 0) {
30
35
  throw new Error("Automatic quests need at least one prerequisite");
@@ -4,20 +4,20 @@ import {
4
4
  retryAfter,
5
5
  retrying,
6
6
  validTimeout
7
- } from "./chunk-U735N4KB.js";
7
+ } from "./chunk-SBW52XXL.js";
8
8
  import {
9
9
  clientIdentity
10
- } from "./chunk-S37JPI5O.js";
10
+ } from "./chunk-KTHHGZSJ.js";
11
11
  import {
12
12
  authScopeSchema
13
- } from "./chunk-SB3ODDGR.js";
13
+ } from "./chunk-FTGW72A6.js";
14
14
  import {
15
15
  RequestError,
16
16
  appIdentityKindSchema,
17
17
  isRequestError,
18
18
  knownResponse,
19
19
  openIdentityKindSchema
20
- } from "./chunk-RIMESZ4X.js";
20
+ } from "./chunk-OEO5OBY5.js";
21
21
 
22
22
  // src/configuration.ts
23
23
  function questConfiguration(release) {
@@ -8,7 +8,7 @@ import {
8
8
  rewardBundleSchema,
9
9
  settingsValuesSchema,
10
10
  trackerTriggerContextSchema
11
- } from "./chunk-RIMESZ4X.js";
11
+ } from "./chunk-OEO5OBY5.js";
12
12
 
13
13
  // src/server/attempt-captures.ts
14
14
  import * as z from "zod";
@@ -1,8 +1,8 @@
1
- import { b0 as referralAcceptSchema, g as LeaderboardQuery, b as CampaignEnrollmentInput, d as CampaignWithdrawalInput, m as PointHistoryQuery, k as PointEntryKind, a7 as engagementPageQuerySchema } from './groups-DTsvf0Z2.js';
2
- import { j as QuestView, k as ResponseSchema, a as PageQuery, c as QuestEnrollmentInput, Q as QuestClaimInput, g as QuestOutcomeQuery, a0 as questExperienceSchema, t as RewardDeliveryQuery, l as RewardDeliveryAction, H as contentQualificationQuerySchema } from './pages-B5agdH0f.js';
3
- import { M as MissingPrerequisite, V as ValueEvidence } from './submission-input-BHzSin84.js';
1
+ import { b0 as referralAcceptSchema, g as LeaderboardQuery, b as CampaignEnrollmentInput, d as CampaignWithdrawalInput, m as PointHistoryQuery, k as PointEntryKind, a7 as engagementPageQuerySchema } from './groups-JzAQ2JIN.js';
2
+ import { j as QuestView, k as ResponseSchema, a as PageQuery, c as QuestEnrollmentInput, Q as QuestClaimInput, g as QuestOutcomeQuery, a0 as questExperienceSchema, t as RewardDeliveryQuery, l as RewardDeliveryAction, H as contentQualificationQuerySchema } from './pages-DR2YRvAp.js';
3
+ import { M as MissingPrerequisite, V as ValueEvidence } from './submission-input-UBqB8NFC.js';
4
4
  import { a as RequestError, b as RequestErrorDetails, c as RequestErrorKind, e as createRelayAction, O as OptionalActionId } from './action-DBzILFx9.js';
5
- import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode, cq as submitSchema, bl as contentPerformanceQuerySchema } from './schema--jNn3OfJ.js';
5
+ import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode, cs as submitSchema, bl as contentPerformanceQuerySchema } from './schema-Cgmj-CbC.js';
6
6
  import { b as ParticipantSession, d as exchangeSchema, R as RelayEvent, P as ParticipantActivity } from './participant-activity-CoB2F30C.js';
7
7
  import * as z from 'zod';
8
8
  import { a as AuthProvider } from './accounts-DRPENuZe.js';
@@ -54,6 +54,11 @@ declare const RelayErrorCode: {
54
54
  readonly QuestUpdated: "quest-updated";
55
55
  /** Wait for the deferred attempt before submitting another action. */
56
56
  readonly AttemptPending: "attempt-pending";
57
+ /**
58
+ * The member's last attempt was rejected and the quest's retry cooldown is running; `retryAt`
59
+ * says when they may submit again.
60
+ */
61
+ readonly RetryCooldown: "retry-cooldown";
57
62
  /** The quiz changed since the member answered it. */
58
63
  readonly StaleQuiz: "stale-quiz";
59
64
  /** Relay refused the submitted evidence. */
@@ -110,6 +115,8 @@ type RelayErrorDetails = RequestErrorDetails & {
110
115
  /** Which window refused admission when `code` is `outside-window`. */
111
116
  window?: "tracker" | "quest";
112
117
  missing?: MissingPrerequisite[];
118
+ /** Unix milliseconds when the member may submit again, when `code` is `retry-cooldown`. */
119
+ retryAt?: number;
113
120
  };
114
121
  declare const relayErrorBrand: unique symbol;
115
122
  /** Whether `value` is a `RelayError` from any copy of the SDK. Prefer it to `instanceof`. */
@@ -127,6 +134,8 @@ declare class RelayError extends RequestError {
127
134
  readonly window: "tracker" | "quest" | undefined;
128
135
  /** Prerequisites the member does not currently meet, when Relay refused for that reason. */
129
136
  readonly missing: MissingPrerequisite[];
137
+ /** Unix milliseconds when the member may submit again, when `code` is `retry-cooldown`. */
138
+ readonly retryAt: number | undefined;
130
139
  constructor(message: string, details: RelayErrorDetails);
131
140
  }
132
141
 
@@ -1166,6 +1175,7 @@ declare function relayClient(options: RelayClientOptions): {
1166
1175
  access: "public" | "participants";
1167
1176
  key?: string | undefined;
1168
1177
  group?: string | undefined;
1178
+ includeUnscored?: boolean | undefined;
1169
1179
  settle?: {
1170
1180
  at: "window-end";
1171
1181
  ties: "shared" | "earliest";
@@ -1873,6 +1883,7 @@ declare function relayClient(options: RelayClientOptions): {
1873
1883
  budget: string;
1874
1884
  } | null;
1875
1885
  } | null | undefined;
1886
+ retryAt?: number | undefined;
1876
1887
  }>;
1877
1888
  /**
1878
1889
  * Enrolls the signed-in member in a quest whose tracker trigger requires enrollment. Activity
@@ -2553,6 +2564,7 @@ declare function relayClient(options: RelayClientOptions): {
2553
2564
  budget: string;
2554
2565
  } | null;
2555
2566
  } | null | undefined;
2567
+ retryAt?: number | undefined;
2556
2568
  }[];
2557
2569
  collections: {
2558
2570
  id: string;
@@ -2960,6 +2972,7 @@ declare function relayClient(options: RelayClientOptions): {
2960
2972
  budget: string;
2961
2973
  } | null;
2962
2974
  } | null | undefined;
2975
+ retryAt?: number | undefined;
2963
2976
  }[];
2964
2977
  key?: string | undefined;
2965
2978
  description?: string | undefined;
@@ -3373,6 +3386,7 @@ declare function relayClient(options: RelayClientOptions): {
3373
3386
  budget: string;
3374
3387
  } | null;
3375
3388
  } | null | undefined;
3389
+ retryAt?: number | undefined;
3376
3390
  }[];
3377
3391
  key?: string | undefined;
3378
3392
  description?: string | undefined;
@@ -4177,6 +4191,7 @@ declare function relayClient(options: RelayClientOptions): {
4177
4191
  budget: string;
4178
4192
  } | null;
4179
4193
  } | null | undefined;
4194
+ retryAt?: number | undefined;
4180
4195
  }[];
4181
4196
  entitlements: ({
4182
4197
  [x: string]: unknown;