@domino-sdk/relay 1.5.2 → 1.6.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 (43) hide show
  1. package/dist/{activity-DeKJsRry.d.ts → activity-mPUN4v5Q.d.ts} +147 -116
  2. package/dist/authoring.d.ts +59 -47
  3. package/dist/authoring.js +3 -3
  4. package/dist/{automatic-outcomes-B1xrETxm.d.ts → automatic-outcomes-DmuqzQiH.d.ts} +224 -13
  5. package/dist/browser.d.ts +22 -10
  6. package/dist/browser.js +6 -6
  7. package/dist/{capability-error-DNMwKmlL.d.ts → capability-error-Bv996M-h.d.ts} +2 -0
  8. package/dist/{chunk-GQKYAQM6.js → chunk-23QJ7WH4.js} +1 -1
  9. package/dist/{chunk-XFMSUPNS.js → chunk-6ON4RMEN.js} +1 -1
  10. package/dist/{chunk-VFHHLN6A.js → chunk-6RBF3UDA.js} +49 -6
  11. package/dist/chunk-AXRMT33W.js +112 -0
  12. package/dist/{chunk-24AFCBZN.js → chunk-BFZHJA2B.js} +2 -2
  13. package/dist/{chunk-EYH5RDIE.js → chunk-C25TDFHN.js} +4 -2
  14. package/dist/{chunk-36HTX2BM.js → chunk-GMPPLZKH.js} +61 -4
  15. package/dist/{chunk-BGGKNIRP.js → chunk-JW4G3SY5.js} +1 -1
  16. package/dist/{chunk-JON5SESL.js → chunk-KGJSKGKI.js} +84 -6
  17. package/dist/{chunk-WJSSJ7AF.js → chunk-QGLHZ2E5.js} +24 -4
  18. package/dist/{chunk-DGWMLN35.js → chunk-ZOUEEK5L.js} +16 -5
  19. package/dist/{client-gqnRUHpC.d.ts → client-CQuTAjSs.d.ts} +88 -41
  20. package/dist/{groups-Ck-OxzjD.d.ts → groups-D08JtrZu.d.ts} +175 -3
  21. package/dist/{identity-integration-GxAHdKR2.d.ts → identity-integration-BPovus6e.d.ts} +1 -1
  22. package/dist/{images-Dv-P5VBw.d.ts → images-D7en0Awp.d.ts} +1 -1
  23. package/dist/index.d.ts +9 -9
  24. package/dist/index.js +5 -5
  25. package/dist/internal.d.ts +34 -27
  26. package/dist/internal.js +18 -24
  27. package/dist/{offers-Cy-e4o5x.d.ts → offers-BENZl5l5.d.ts} +3 -2
  28. package/dist/{outcomes-kVB-Juzs.d.ts → pages-CBa-_u_n.d.ts} +142 -99
  29. package/dist/{pages-BBYD21IE.d.ts → participant-activity-DkL3nY5a.d.ts} +1 -14
  30. package/dist/portal-proxy.js +48 -36
  31. package/dist/react/index.d.ts +25 -3949
  32. package/dist/react/index.js +8 -7
  33. package/dist/{request-error-DWduJCGV.d.ts → request-error-D_dUPLwo.d.ts} +5 -0
  34. package/dist/{schema-DfJzH2ci.d.ts → schema-BPdHSCAc.d.ts} +122 -37
  35. package/dist/schema.d.ts +10 -10
  36. package/dist/schema.js +48 -6
  37. package/dist/server/index.d.ts +9672 -66110
  38. package/dist/server/index.js +1009 -548
  39. package/dist/sign-in-options-FPKoZMfo.d.ts +202 -0
  40. package/dist/{submission-input-BZkm6ohU.d.ts → submission-input-BzIWutQi.d.ts} +2 -2
  41. package/package.json +1 -1
  42. package/dist/browser-D_3s8B5e.d.ts +0 -4154
  43. package/dist/chunk-GUP7YRR4.js +0 -42
package/dist/browser.js CHANGED
@@ -11,14 +11,14 @@ import {
11
11
  signInOptions,
12
12
  solanaSigner,
13
13
  walletStandardSolanaSigner
14
- } from "./chunk-24AFCBZN.js";
15
- import "./chunk-DGWMLN35.js";
16
- import "./chunk-EYH5RDIE.js";
17
- import "./chunk-36HTX2BM.js";
14
+ } from "./chunk-BFZHJA2B.js";
15
+ import "./chunk-ZOUEEK5L.js";
16
+ import "./chunk-C25TDFHN.js";
17
+ import "./chunk-GMPPLZKH.js";
18
18
  import "./chunk-6QJ3LADK.js";
19
19
  import "./chunk-NPGENI7K.js";
20
- import "./chunk-XFMSUPNS.js";
21
- import "./chunk-JON5SESL.js";
20
+ import "./chunk-6ON4RMEN.js";
21
+ import "./chunk-KGJSKGKI.js";
22
22
  export {
23
23
  browserSubmissionStore,
24
24
  cosmosChainList,
@@ -45,6 +45,7 @@ declare const resourceOptionsSchema: z.ZodObject<{
45
45
  group: z.ZodOptional<z.ZodString>;
46
46
  disabledReason: z.ZodOptional<z.ZodString>;
47
47
  }, z.core.$strip>>;
48
+ nextCursor: z.ZodDefault<z.ZodNullable<z.ZodString>>;
48
49
  cursor: z.ZodNullable<z.ZodString>;
49
50
  }, z.core.$strip>;
50
51
  type ResourceOption = z.infer<typeof resourceOptionsSchema>["options"][number];
@@ -403,6 +404,7 @@ type ProjectIntegration = z.infer<typeof projectIntegrationSchema>;
403
404
  * Later versions can add codes. Treat an unknown code as a failure its `message` explains.
404
405
  */
405
406
  declare const capabilityErrorCodes: readonly ["not-linked", "provider-unavailable", "author-error"];
407
+ /** @compat open */
406
408
  type KnownCapabilityErrorCode = (typeof capabilityErrorCodes)[number];
407
409
  /** A known code, or one a newer Relay added. */
408
410
  type CapabilityErrorCode = KnownCapabilityErrorCode | (string & {});
@@ -5,7 +5,7 @@ import {
5
5
  isKnownTrackerSource,
6
6
  trackerDataSchema,
7
7
  xAccountRoles
8
- } from "./chunk-JON5SESL.js";
8
+ } from "./chunk-KGJSKGKI.js";
9
9
 
10
10
  // src/quest-shape.ts
11
11
  function validateQuestShape(description, options = {}) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  identifier
3
- } from "./chunk-JON5SESL.js";
3
+ } from "./chunk-KGJSKGKI.js";
4
4
 
5
5
  // src/auth.ts
6
6
  import { z } from "zod";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  imageAssetArtifactSchema,
3
3
  publishedImageSchema
4
- } from "./chunk-BGGKNIRP.js";
4
+ } from "./chunk-JW4G3SY5.js";
5
5
  import {
6
6
  catalogDeploymentSchema,
7
7
  interactionSchema,
8
8
  questCollectionSchema,
9
9
  questTypeVersionSchema
10
- } from "./chunk-EYH5RDIE.js";
10
+ } from "./chunk-C25TDFHN.js";
11
11
  import {
12
12
  engagementArtifactSchema,
13
13
  engagementDeploymentEntrySchema,
@@ -19,8 +19,9 @@ import {
19
19
  pointLedgerSchema,
20
20
  publishedReferralSchema,
21
21
  referralArtifactSchema
22
- } from "./chunk-36HTX2BM.js";
22
+ } from "./chunk-GMPPLZKH.js";
23
23
  import {
24
+ attemptSchema,
24
25
  identifier,
25
26
  pageCursorSchema,
26
27
  projectCalendarDeclarationSchema,
@@ -31,7 +32,7 @@ import {
31
32
  rewardSchema,
32
33
  timeZoneNameSchema,
33
34
  trackerArtifactSchema
34
- } from "./chunk-JON5SESL.js";
35
+ } from "./chunk-KGJSKGKI.js";
35
36
 
36
37
  // src/deployments.ts
37
38
  import { z } from "zod";
@@ -126,6 +127,10 @@ var rejectDeploymentSchema = z.object({
126
127
  id: identifier,
127
128
  reason: z.string().trim().min(1).max(1e3)
128
129
  }).strict();
130
+ var deploymentRejectionSchema = rejectDeploymentSchema.omit({
131
+ id: true
132
+ });
133
+ var deploymentActionSchema = z.object({ actionId: z.string().uuid() }).strict();
129
134
  var repeatableDeploymentSchema = z.object({ actionId: z.string().uuid(), id: identifier }).strict();
130
135
  var promoteDeploymentSchema = repeatableDeploymentSchema;
131
136
  var rollbackDeploymentSchema = repeatableDeploymentSchema;
@@ -168,7 +173,13 @@ var automaticEventResponseSchema = z3.union([
168
173
  kind: z3.string().refine((kind) => !knownEventKinds.has(kind))
169
174
  }).catchall(z3.json())
170
175
  ]);
171
- var automaticOutcomeSchema = z3.object({
176
+ var automaticLinkedAttemptSchema = z3.object({
177
+ id: identifier,
178
+ status: attemptSchema.shape.status,
179
+ /** Open code for the linked attempt. Consumers must tolerate new values. */
180
+ code: z3.string().nullable()
181
+ });
182
+ var automaticOutcomeFields = {
172
183
  id: identifier,
173
184
  quest: identifier,
174
185
  member: identifier,
@@ -177,11 +188,39 @@ var automaticOutcomeSchema = z3.object({
177
188
  state: z3.enum(["admitted", "skipped"]),
178
189
  code: z3.string().nullable(),
179
190
  reason: z3.string().nullable(),
180
- attempt: identifier.nullable(),
191
+ /** Which window refused admission when `code` is `outside-window`. */
192
+ window: z3.enum(["tracker", "quest"]).optional(),
181
193
  revision: z3.number().int().nonnegative(),
182
194
  createdAt: z3.number().int().safe(),
183
195
  updatedAt: z3.number().int().safe()
196
+ };
197
+ var automaticOutcomeWithoutAttemptSchema = z3.object({
198
+ ...automaticOutcomeFields,
199
+ /** @deprecated Use `linkedAttempt` instead. Removed in 2.0.0. */
200
+ attempt: z3.null(),
201
+ /** Current linked attempt. Optional so responses from older Relay versions remain readable. */
202
+ linkedAttempt: z3.null().optional()
184
203
  });
204
+ var automaticOutcomeWithAttemptSchema = z3.object({
205
+ ...automaticOutcomeFields,
206
+ /** @deprecated Use `linkedAttempt` instead. Removed in 2.0.0. */
207
+ attempt: identifier,
208
+ /** Current linked attempt. Optional so responses from older Relay versions remain readable. */
209
+ linkedAttempt: automaticLinkedAttemptSchema.nullable().optional()
210
+ }).superRefine((outcome, context) => {
211
+ if (outcome.linkedAttempt !== null && outcome.linkedAttempt !== void 0 && outcome.linkedAttempt.id !== outcome.attempt) {
212
+ context.addIssue({
213
+ code: "custom",
214
+ path: ["linkedAttempt", "id"],
215
+ message: "Linked attempt ID must match the legacy attempt ID"
216
+ });
217
+ }
218
+ });
219
+ var automaticOutcomeSchema = z3.union([
220
+ automaticOutcomeWithoutAttemptSchema,
221
+ automaticOutcomeWithAttemptSchema
222
+ ]);
223
+ var isRetryableAutomaticOutcome = (outcome) => outcome.linkedAttempt?.status === "rejected" && outcome.linkedAttempt.code === "budget-exhausted";
185
224
  var automaticOutcomeQuerySchema = z3.strictObject({
186
225
  quest: identifier.optional(),
187
226
  member: identifier.optional(),
@@ -206,6 +245,7 @@ var automaticCatchUpPreviewSchema = z3.object({
206
245
  outcome: automaticOutcomeSchema,
207
246
  code: z3.string().nullable(),
208
247
  reason: z3.string().nullable(),
248
+ window: z3.enum(["tracker", "quest"]).optional(),
209
249
  attempt: identifier.nullable(),
210
250
  wouldAdmit: z3.boolean(),
211
251
  budgets: z3.array(questBudgetViewSchema)
@@ -265,12 +305,15 @@ export {
265
305
  deploymentRecordSchema,
266
306
  submitDeploymentSchema,
267
307
  rejectDeploymentSchema,
308
+ deploymentRejectionSchema,
309
+ deploymentActionSchema,
268
310
  promoteDeploymentSchema,
269
311
  rollbackDeploymentSchema,
270
312
  activityTypes,
271
313
  activityTypeSchema,
272
314
  automaticEventSchema,
273
315
  automaticOutcomeSchema,
316
+ isRetryableAutomaticOutcome,
274
317
  automaticOutcomeQuerySchema,
275
318
  automaticOutcomePageSchema,
276
319
  automaticCatchUpInputSchema,
@@ -0,0 +1,112 @@
1
+ // src/participant-routes.ts
2
+ var id = "{[\\w-]+}";
3
+ var participantRoutes = [
4
+ // Sign-in, the session and connected accounts. Integrations reach /v1/auth/start in connect
5
+ // mode only (Relay checks the mode).
6
+ { method: "GET", path: "/v1/auth/providers", hostedOnly: true },
7
+ { method: "POST", path: "/v1/auth/start" },
8
+ { method: "GET", path: "/v1/auth/authorize", hostedOnly: true },
9
+ {
10
+ method: "GET",
11
+ path: "/v1/auth/callback/:provider{[a-z][a-z0-9-]*}",
12
+ hostedOnly: true
13
+ },
14
+ { method: "GET", path: "/v1/auth/complete" },
15
+ { method: "POST", path: "/v1/auth/email/start", hostedOnly: true },
16
+ { method: "POST", path: "/v1/auth/email/verify", hostedOnly: true },
17
+ { method: "POST", path: "/v1/auth/wallet/start", hostedOnly: true },
18
+ { method: "POST", path: "/v1/auth/wallet/verify", hostedOnly: true },
19
+ { method: "GET", path: "/v1/auth/session" },
20
+ { method: "POST", path: "/v1/auth/logout" },
21
+ { method: "GET", path: "/v1/auth/accounts" },
22
+ { method: "POST", path: "/v1/auth/accounts/disconnect" },
23
+ // The signed-in member: progress, submissions, rewards, points, activity and linked wallets.
24
+ { method: "GET", path: "/v1/me" },
25
+ { method: "GET", path: "/v1/me/progress" },
26
+ { method: "GET", path: "/v1/me/experience" },
27
+ { method: "POST", path: "/v1/me/attempts" },
28
+ { method: "POST", path: `/v1/attempts/:attempt${id}/retry` },
29
+ { method: "POST", path: "/v1/me/evidence" },
30
+ { method: "POST", path: "/v1/me/collection-pass" },
31
+ { method: "GET", path: "/v1/me/entitlements" },
32
+ { method: "GET", path: "/v1/me/deliveries" },
33
+ { method: "GET", path: "/v1/me/points" },
34
+ { method: "GET", path: `/v1/me/points/:ledger${id}/history` },
35
+ { method: "GET", path: "/v1/me/activity" },
36
+ { method: "GET", path: "/v1/me/wallets" },
37
+ { method: "POST", path: "/v1/me/wallets/challenge" },
38
+ { method: "POST", path: "/v1/me/wallets/verify" },
39
+ { method: "POST", path: "/v1/me/wallets/unlink" },
40
+ // Profiles: the member's own, and the reads keyed by a public profile ID.
41
+ { method: "GET", path: "/v1/me/profile" },
42
+ { method: "POST", path: "/v1/me/profile" },
43
+ { method: "POST", path: "/v1/me/profile/avatar" },
44
+ { method: "GET", path: `/v1/profiles/:profile${id}` },
45
+ { method: "GET", path: `/v1/profiles/:profile${id}/completions` },
46
+ {
47
+ method: "GET",
48
+ path: `/v1/profiles/:profile${id}/referrals/:program${id}`
49
+ },
50
+ {
51
+ method: "GET",
52
+ path: `/v1/leaderboards/:board${id}/profiles/:profile${id}`
53
+ },
54
+ // Quest and campaign enrollment, automatic-quest outcomes and historical claims.
55
+ { method: "POST", path: "/v1/quests/enrollments" },
56
+ { method: "POST", path: "/v1/quests/claims" },
57
+ { method: "GET", path: "/v1/quests/outcomes" },
58
+ { method: "POST", path: "/v1/campaigns/enrollments" },
59
+ { method: "POST", path: "/v1/campaigns/enrollments/withdraw" },
60
+ // Content stages and engagement.
61
+ { method: "GET", path: "/v1/content/qualifications" },
62
+ { method: "GET", path: "/v1/content/performance" },
63
+ { method: "GET", path: "/v1/engagement/history" },
64
+ { method: "GET", path: "/v1/engagement/boundaries" },
65
+ // Referrals, offers, reward deliveries, leaderboards and the project's reference lists.
66
+ { method: "GET", path: "/v1/referrals" },
67
+ { method: "GET", path: "/v1/referrals/me" },
68
+ { method: "GET", path: "/v1/referrals/history" },
69
+ { method: "POST", path: "/v1/referrals/accept" },
70
+ { method: "GET", path: "/v1/offers" },
71
+ { method: "POST", path: `/v1/offers/:offer${id}/redeem` },
72
+ { method: "GET", path: "/v1/reward-deliveries" },
73
+ { method: "GET", path: "/v1/leaderboards" },
74
+ { method: "GET", path: `/v1/leaderboards/:board${id}` },
75
+ { method: "GET", path: "/v1/point-ledgers" },
76
+ { method: "GET", path: "/v1/tiered-rewards" }
77
+ ];
78
+ function participantRoutePattern(path) {
79
+ const parts = path.split(/:\w+\{([^}]+)\}/);
80
+ const source = parts.map((part, index) => {
81
+ if (index % 2 === 0) {
82
+ if (/[:{}]/.test(part)) {
83
+ throw new Error(`${path}: write each parameter as :name{pattern}`);
84
+ }
85
+ return part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
86
+ }
87
+ if (part.includes("/") || new RegExp(`^(?:${part})$`).test("/")) {
88
+ throw new Error(`${path}: a parameter pattern cannot match "/"`);
89
+ }
90
+ return `(?:${part})`;
91
+ });
92
+ return new RegExp("^" + source.join("") + "$");
93
+ }
94
+ var compiled = participantRoutes.map((route) => ({
95
+ ...route,
96
+ pattern: participantRoutePattern(route.path)
97
+ }));
98
+ function isParticipantRoute(path, method) {
99
+ return compiled.some(
100
+ (route) => route.method === method && route.pattern.test(path)
101
+ );
102
+ }
103
+ function isIntegrationParticipantPath(path) {
104
+ return compiled.some((route) => !route.hostedOnly && route.pattern.test(path));
105
+ }
106
+
107
+ export {
108
+ participantRoutes,
109
+ participantRoutePattern,
110
+ isParticipantRoute,
111
+ isIntegrationParticipantPath
112
+ };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createRelayClient
3
- } from "./chunk-DGWMLN35.js";
3
+ } from "./chunk-ZOUEEK5L.js";
4
4
  import {
5
5
  RelayErrorCode,
6
6
  asRelayError,
7
7
  clientError,
8
8
  cosmosChain
9
- } from "./chunk-36HTX2BM.js";
9
+ } from "./chunk-GMPPLZKH.js";
10
10
 
11
11
  // src/base58.ts
12
12
  var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pointLedgerReferenceSchema
3
- } from "./chunk-36HTX2BM.js";
3
+ } from "./chunk-GMPPLZKH.js";
4
4
  import {
5
5
  authoringIdentityShape,
6
6
  entitlementSchema,
@@ -16,7 +16,7 @@ import {
16
16
  storedQuestDescriptionSchema,
17
17
  storedReviewModeSchema,
18
18
  tieredRewardReferenceSchema
19
- } from "./chunk-JON5SESL.js";
19
+ } from "./chunk-KGJSKGKI.js";
20
20
 
21
21
  // src/participant-activity.ts
22
22
  import { z } from "zod";
@@ -307,6 +307,8 @@ var questOutcomeSchema = z4.object({
307
307
  code: z4.string().nullable(),
308
308
  /** Why it was skipped, for people; null when admitted. */
309
309
  reason: z4.string().nullable(),
310
+ /** Which window refused admission when `code` is `outside-window`. */
311
+ window: z4.enum(["tracker", "quest"]).optional(),
310
312
  /** The admitted attempt. */
311
313
  attempt: identifier.nullable(),
312
314
  /** The member can claim it with `relay.quests.claim()`. */
@@ -14,7 +14,7 @@ import {
14
14
  resourceHandle,
15
15
  rewardKey,
16
16
  tierRewardSchema
17
- } from "./chunk-JON5SESL.js";
17
+ } from "./chunk-KGJSKGKI.js";
18
18
 
19
19
  // src/point-ledgers.ts
20
20
  import { z } from "zod";
@@ -180,10 +180,25 @@ var engagementChangePreviewSchema = z2.strictObject({
180
180
  pending: total
181
181
  })
182
182
  });
183
- var engagementVersionPageSchema = z2.strictObject({
183
+ var engagementVersionSchema = engagementRuleSchema.extend({
184
+ previousVersion: identifier.nullable()
185
+ });
186
+ var engagementRuleVersionPageSchema = z2.object({
184
187
  items: z2.array(
185
- engagementRuleSchema.extend({ previousVersion: identifier.nullable() })
188
+ z2.object({
189
+ version: identifier,
190
+ definition: z2.object({
191
+ ...engagementDefinitionSchema.shape,
192
+ budgets: z2.array(z2.object(engagementBudgetSchema.shape)).max(8).default([])
193
+ }),
194
+ publishedAt: amount,
195
+ previousVersion: identifier.nullable()
196
+ })
186
197
  ),
198
+ nextCursor: pageCursorSchema.nullable()
199
+ });
200
+ var engagementVersionPageSchema = z2.strictObject({
201
+ items: z2.array(engagementVersionSchema),
187
202
  next: amount.nullable()
188
203
  });
189
204
  var engagementVersionQuerySchema = z2.strictObject({
@@ -280,7 +295,25 @@ var RelayErrorCode = {
280
295
  /** The participant's available point balance is below the offer price. */
281
296
  InsufficientPoints: "insufficient-points",
282
297
  /** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
283
- WalletSigner: "wallet-signer"
298
+ WalletSigner: "wallet-signer",
299
+ /** The member has not met the quest's prerequisites; `missing` lists them. */
300
+ PrerequisitesIncomplete: "prerequisites-incomplete",
301
+ /** The quest is archived or retired: it takes no new participation. */
302
+ QuestClosed: "quest-closed",
303
+ /** An operator paused the quest. */
304
+ QuestPaused: "quest-paused",
305
+ /** An operator locked the member's profile; hiding it is still allowed. */
306
+ ProfileLocked: "profile-locked",
307
+ /** No member in the project has the invitation code the member accepted. */
308
+ InvitationNotFound: "invitation-not-found",
309
+ /** The email sign-in code is wrong; the member can type it again. */
310
+ InvalidCode: "invalid-code",
311
+ /** The email sign-in code expired, was used or had too many attempts; request another. */
312
+ CodeExpired: "code-expired",
313
+ /** The wallet sign-in challenge expired, was used or changed; start sign-in again. */
314
+ ChallengeExpired: "challenge-expired",
315
+ /** Too many requests; `retryAfter` says how long to wait when Relay knows. */
316
+ RateLimited: "rate-limited"
284
317
  };
285
318
  var relayErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RelayError");
286
319
  function isRelayError(value) {
@@ -289,10 +322,13 @@ function isRelayError(value) {
289
322
  var RelayError = class extends RequestError {
290
323
  name = "RelayError";
291
324
  [relayErrorBrand] = true;
325
+ /** Which window refused admission when `code` is `outside-window`. */
326
+ window;
292
327
  /** Prerequisites the member does not currently meet, when Relay refused for that reason. */
293
328
  missing;
294
329
  constructor(message, details) {
295
330
  super(message, details);
331
+ this.window = details.window;
296
332
  this.missing = details.missing ?? [];
297
333
  }
298
334
  };
@@ -653,6 +689,12 @@ var pointsEntrySchema = z5.object({
653
689
  reason: z5.string(),
654
690
  actor: z5.string().nullable()
655
691
  });
692
+ var managedPointHistoryPageSchema = z5.object({
693
+ items: z5.array(pointsEntrySchema),
694
+ nextCursor: pageCursorSchema.nullable(),
695
+ /** @deprecated Use `nextCursor`, passed back as `cursor`. Removed in 2.0.0. */
696
+ next: z5.number().nullable()
697
+ });
656
698
  var pointsResultSchema = z5.object({
657
699
  entry: pointsEntrySchema,
658
700
  total: integer.nonnegative()
@@ -778,6 +820,9 @@ var publishedReferralSchema = z6.object({
778
820
  actor: z6.string().nullable()
779
821
  });
780
822
  var referralAcceptSchema = z6.object({ actionId: identifier, code: identifier }).strict();
823
+ var referralSuspensionSchema = z6.object({ actionId: identifier, suspended: z6.boolean(), reason }).strict();
824
+ var referralQualificationSchema = z6.object({ actionId: identifier, qualified: z6.boolean(), reason }).strict();
825
+ var referralRewardResolutionSchema = z6.object({ actionId: identifier, reason }).strict();
781
826
  var referralControlSchema = z6.discriminatedUnion("kind", [
782
827
  z6.object({
783
828
  kind: z6.literal("suspend"),
@@ -864,6 +909,8 @@ var referralManagementSchema = z6.object({
864
909
  reason: z6.string()
865
910
  })
866
911
  ),
912
+ nextCursor: pageCursorSchema.nullable().default(null),
913
+ /** @deprecated Use `nextCursor`, passed back as `cursor`. Removed in 2.0.0. */
867
914
  next: amount2.nullable()
868
915
  });
869
916
 
@@ -913,6 +960,11 @@ var redemptionBase = {
913
960
  id: identifier,
914
961
  offer: identifier,
915
962
  member: identifier,
963
+ /**
964
+ * @deprecated Use `id` to refer to a redemption. A redemption is fulfilled in the request that
965
+ * makes it, so nothing is reserved beforehand; the ID refers to no other record. Removed in
966
+ * 2.0.0.
967
+ */
916
968
  reservation: identifier,
917
969
  price: offerPriceSchema,
918
970
  reward: tierRewardSchema,
@@ -1119,6 +1171,7 @@ export {
1119
1171
  engagementChangePreviewInputSchema,
1120
1172
  engagementChangeSchema,
1121
1173
  engagementChangePreviewSchema,
1174
+ engagementRuleVersionPageSchema,
1122
1175
  engagementVersionPageSchema,
1123
1176
  engagementVersionQuerySchema,
1124
1177
  engagementBoundaryPageSchema,
@@ -1165,6 +1218,7 @@ export {
1165
1218
  leaderboardPreviewSchema,
1166
1219
  pointsMutationSchema,
1167
1220
  pointsEntrySchema,
1221
+ managedPointHistoryPageSchema,
1168
1222
  pointsResultSchema,
1169
1223
  pointsAccountSchema,
1170
1224
  leaderboardExclusionSchema,
@@ -1179,6 +1233,9 @@ export {
1179
1233
  referralArtifactSchema,
1180
1234
  publishedReferralSchema,
1181
1235
  referralAcceptSchema,
1236
+ referralSuspensionSchema,
1237
+ referralQualificationSchema,
1238
+ referralRewardResolutionSchema,
1182
1239
  referralControlSchema,
1183
1240
  referralRelationshipSchema,
1184
1241
  referralAccountSchema,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  identifier,
3
3
  xTweetSchema
4
- } from "./chunk-JON5SESL.js";
4
+ } from "./chunk-KGJSKGKI.js";
5
5
 
6
6
  // src/x.ts
7
7
  import { z } from "zod";
@@ -390,7 +390,7 @@ function literalsOf(schema) {
390
390
  }
391
391
  function matches(schema, value, at, budget) {
392
392
  charge(budget, 1);
393
- const issue = (reason) => ({ at, reason });
393
+ const issue = (reason2) => ({ at, reason: reason2 });
394
394
  if (schema.const !== void 0 && value !== schema.const) {
395
395
  return issue(() => `expected ${JSON.stringify(schema.const)}`);
396
396
  }
@@ -1078,7 +1078,7 @@ var trackerSkipCodes = [
1078
1078
  "prerequisites-incomplete"
1079
1079
  ];
1080
1080
  var trackerOutcomeSchema = z6.discriminatedUnion("state", [
1081
- z6.strictObject({
1081
+ z6.object({
1082
1082
  ...trackerOutcomeFields,
1083
1083
  state: z6.literal("admitted"),
1084
1084
  code: z6.null(),
@@ -1088,19 +1088,21 @@ var trackerOutcomeSchema = z6.discriminatedUnion("state", [
1088
1088
  /** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
1089
1089
  attempt: identifier
1090
1090
  }),
1091
- z6.strictObject({
1091
+ z6.object({
1092
1092
  ...trackerOutcomeFields,
1093
1093
  state: z6.literal("skipped"),
1094
1094
  /** Why the observation was skipped, as one of `trackerSkipCodes`. */
1095
1095
  code: z6.string().min(1),
1096
1096
  /** Why the observation was skipped, for people. */
1097
1097
  reason: z6.string(),
1098
+ /** Which window refused admission when `code` is `outside-window`. */
1099
+ window: z6.enum(["tracker", "quest"]).optional(),
1098
1100
  /** The attributed member, when attribution got that far. */
1099
1101
  member: identifier.nullable(),
1100
1102
  attempt: identifier.nullable()
1101
1103
  })
1102
1104
  ]);
1103
- var trackerOutcomeQuerySchema = z6.strictObject({
1105
+ var trackerOutcomeFilters = {
1104
1106
  /** Quest key or ID. */
1105
1107
  quest: identifier.optional(),
1106
1108
  record: externalId.optional(),
@@ -1108,7 +1110,18 @@ var trackerOutcomeQuerySchema = z6.strictObject({
1108
1110
  state: z6.enum(["admitted", "skipped"]).optional(),
1109
1111
  /** Only skips with this code, such as `unlinked-account`. */
1110
1112
  code: z6.string().min(1).max(100).optional(),
1111
- limit: z6.coerce.number().int().min(1).max(100).default(25),
1113
+ limit: z6.coerce.number().int().min(1).max(100).default(25)
1114
+ };
1115
+ var trackerTriggerOutcomeQuerySchema = z6.strictObject({
1116
+ ...trackerOutcomeFilters,
1117
+ cursor: pageCursorSchema.optional()
1118
+ });
1119
+ var trackerTriggerOutcomePageSchema = z6.object({
1120
+ items: z6.array(trackerOutcomeSchema).max(100),
1121
+ nextCursor: pageCursorSchema.nullable()
1122
+ });
1123
+ var trackerOutcomeQuerySchema = z6.strictObject({
1124
+ ...trackerOutcomeFilters,
1112
1125
  /** Opaque cursor from `next`: older outcomes. */
1113
1126
  before: z6.string().max(512).optional()
1114
1127
  });
@@ -1829,6 +1842,9 @@ var resourceOptionsSchema = z16.object({
1829
1842
  disabledReason: z16.string().optional()
1830
1843
  })
1831
1844
  ),
1845
+ /** Pass back as `cursor` for the next page; null on the last one. */
1846
+ nextCursor: z16.string().nullable().default(null),
1847
+ /** @deprecated Use `nextCursor`. Removed in 2.0.0. */
1832
1848
  cursor: z16.string().nullable()
1833
1849
  });
1834
1850
 
@@ -2017,6 +2033,37 @@ function defineGroup(input) {
2017
2033
  function projectGroupKey(group) {
2018
2034
  return identifier.parse(group.key);
2019
2035
  }
2036
+ var groupTitle = z21.string().trim().min(1).max(120);
2037
+ var reason = z21.string().trim().min(1).max(1e3);
2038
+ var timestamp5 = z21.number().int().nonnegative().max(864e13);
2039
+ var createGroupSchema = z21.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
2040
+ var updateGroupSchema = z21.object({ title: groupTitle }).strict();
2041
+ var addGroupMemberSchema = z21.object({ actionId: identifier, member: identifier, reason }).strict();
2042
+ var removeGroupMemberSchema = z21.object({ actionId: identifier, reason }).strict();
2043
+ var groupPageQuerySchema = z21.strictObject({
2044
+ cursor: pageCursorSchema.optional(),
2045
+ /** Items per page, 1–100; the default is 50. */
2046
+ limit: z21.number().int().min(1).max(100).optional()
2047
+ });
2048
+ var managedGroupSchema = z21.object({
2049
+ key: identifier,
2050
+ title: z21.string(),
2051
+ members: z21.number().int().nonnegative(),
2052
+ createdAt: timestamp5,
2053
+ archivedAt: timestamp5.nullable()
2054
+ });
2055
+ var groupPageSchema = z21.object({
2056
+ items: z21.array(managedGroupSchema),
2057
+ nextCursor: pageCursorSchema.nullable()
2058
+ });
2059
+ var groupMemberSchema = z21.object({
2060
+ member: identifier,
2061
+ addedAt: timestamp5.nullable()
2062
+ });
2063
+ var groupMemberPageSchema = z21.object({
2064
+ items: z21.array(groupMemberSchema),
2065
+ nextCursor: pageCursorSchema.nullable()
2066
+ });
2020
2067
 
2021
2068
  // src/prerequisites.ts
2022
2069
  import { z as z22 } from "zod";
@@ -2339,6 +2386,7 @@ var submitSchema = z23.object({
2339
2386
  evidence: identifier.optional(),
2340
2387
  input: submissionEvidenceSchema.optional(),
2341
2388
  release: identifier.optional(),
2389
+ /** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
2342
2390
  faultAfterReview: z23.boolean().optional()
2343
2391
  }).strict();
2344
2392
  var AttemptStatus = {
@@ -2545,11 +2593,24 @@ var entitlementCorrectionSchema = z23.object({
2545
2593
  revision: z23.number().int().positive(),
2546
2594
  reason: z23.string().trim().min(1).max(500)
2547
2595
  }).strict();
2596
+ var CompletionSourceKind = {
2597
+ Quest: "quest",
2598
+ Leaderboard: "leaderboard"
2599
+ };
2600
+ var completionSourceKindSchema = z23.string().min(1).max(64);
2601
+ var completionSourceSchema = z23.object({
2602
+ kind: completionSourceKindSchema,
2603
+ id: identifier
2604
+ });
2548
2605
  var completionRecordSchema = z23.object({
2606
+ /** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
2549
2607
  key: z23.string().default("once"),
2550
2608
  id: identifier,
2609
+ /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
2551
2610
  quest: identifier,
2552
- member: identifier
2611
+ member: identifier,
2612
+ /** What paid the completion. `source.id` repeats `quest`. */
2613
+ source: completionSourceSchema.optional()
2553
2614
  });
2554
2615
  var questAvailabilitySchema = z23.discriminatedUnion("kind", [
2555
2616
  z23.object({
@@ -2571,6 +2632,8 @@ var questAvailabilitySchema = z23.discriminatedUnion("kind", [
2571
2632
  "outside-window",
2572
2633
  "enrollment-required"
2573
2634
  ]),
2635
+ /** Which window refused admission when `reason` is `outside-window`. */
2636
+ window: z23.enum(["tracker", "quest"]).optional(),
2574
2637
  resetsAt: z23.number().int().safe().optional()
2575
2638
  }).strict(),
2576
2639
  z23.object({ kind: z23.literal("staff-required") }).strict(),
@@ -2643,6 +2706,8 @@ var evidenceSchema = z23.object({
2643
2706
  var errorSchema = z23.object({
2644
2707
  error: z23.string(),
2645
2708
  code: z23.string().optional(),
2709
+ /** Which window refused admission when `code` is `outside-window`. */
2710
+ window: z23.enum(["tracker", "quest"]).optional(),
2646
2711
  missing: z23.array(missingPrerequisiteSchema).optional()
2647
2712
  });
2648
2713
  var staffDecisionSchema = z23.object({
@@ -2805,6 +2870,8 @@ export {
2805
2870
  trackerIngestResultSchema,
2806
2871
  trackerSkipCodes,
2807
2872
  trackerOutcomeSchema,
2873
+ trackerTriggerOutcomeQuerySchema,
2874
+ trackerTriggerOutcomePageSchema,
2808
2875
  trackerOutcomeQuerySchema,
2809
2876
  trackerOutcomePageSchema,
2810
2877
  trackerOutcomeRetrySchema,
@@ -2906,6 +2973,15 @@ export {
2906
2973
  projectGroupSchema,
2907
2974
  defineGroup,
2908
2975
  projectGroupKey,
2976
+ createGroupSchema,
2977
+ updateGroupSchema,
2978
+ addGroupMemberSchema,
2979
+ removeGroupMemberSchema,
2980
+ groupPageQuerySchema,
2981
+ managedGroupSchema,
2982
+ groupPageSchema,
2983
+ groupMemberSchema,
2984
+ groupMemberPageSchema,
2909
2985
  completionPrerequisiteSchema,
2910
2986
  balancePrerequisiteSchema,
2911
2987
  groupPrerequisiteSchema,
@@ -2963,6 +3039,8 @@ export {
2963
3039
  beginHandoverSchema,
2964
3040
  confirmHandoverSchema,
2965
3041
  entitlementCorrectionSchema,
3042
+ CompletionSourceKind,
3043
+ completionSourceSchema,
2966
3044
  completionRecordSchema,
2967
3045
  questAvailabilitySchema,
2968
3046
  questBudgetViewSchema,