@domino-sdk/relay 1.56.0 → 1.59.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 (64) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/{accounts-DRPENuZe.d.ts → accounts-CVonEkdb.d.ts} +18 -7
  3. package/dist/{attempt-captures-CxxO7DeD.d.ts → attempt-captures-DBj-rxak.d.ts} +1 -1
  4. package/dist/authoring.d.ts +180 -28
  5. package/dist/authoring.js +236 -11
  6. package/dist/{automatic-outcomes-DxW_v5Wc.d.ts → automatic-outcomes-FS9okvBP.d.ts} +1 -1
  7. package/dist/avatar.d.ts +1 -2
  8. package/dist/browser.d.ts +8 -9
  9. package/dist/browser.js +10 -10
  10. package/dist/{capability-error-DSd8EMQC.d.ts → capability-error-DDJl0LY-.d.ts} +0 -6
  11. package/dist/{chunk-OTITLABX.js → chunk-2LKGAL63.js} +2 -2
  12. package/dist/{chunk-NK6EER33.js → chunk-577DG2IT.js} +8 -8
  13. package/dist/{chunk-RBPMT53S.js → chunk-6U5WWH3W.js} +19 -4
  14. package/dist/{chunk-BHHUSBSD.js → chunk-AWWCEP7F.js} +1402 -881
  15. package/dist/{chunk-QNQNKIAA.js → chunk-EQF4ID47.js} +1 -1
  16. package/dist/{chunk-CK7HO32Z.js → chunk-IBROKMFV.js} +2 -2
  17. package/dist/{chunk-MNU6UPXY.js → chunk-KBCTII6C.js} +1 -1
  18. package/dist/{chunk-INSWI2VZ.js → chunk-KYUQEZZA.js} +1 -1
  19. package/dist/{chunk-G6XVBYH7.js → chunk-LDLOB2UZ.js} +4 -4
  20. package/dist/{chunk-CXKXPB7K.js → chunk-M2JQPDUX.js} +34 -9
  21. package/dist/{chunk-KBVH4XZC.js → chunk-R4S6BFOH.js} +1 -1
  22. package/dist/{chunk-ABJ4G47X.js → chunk-TZJT5CRF.js} +1 -1
  23. package/dist/{chunk-BJYMTCWG.js → chunk-UEMLYPKJ.js} +7 -4
  24. package/dist/{chunk-ULQU7KC4.js → chunk-W42KMMH5.js} +1 -5
  25. package/dist/{chunk-VSHV7FEA.js → chunk-XGXDINGM.js} +16 -3
  26. package/dist/{chunk-H2MD6E7Z.js → chunk-YMWRLAAP.js} +1 -1
  27. package/dist/{chunk-W5U2WXG3.js → chunk-YRSU2X2P.js} +2 -2
  28. package/dist/{client-bX3oTpRu.d.ts → client-3b9HjSzZ.d.ts} +115 -116
  29. package/dist/{deployments-D3lxfQMB.d.ts → deployments-BydFVj4Q.d.ts} +314 -175
  30. package/dist/{groups-DPE004_V.d.ts → groups-CFuTfFqG.d.ts} +11 -7
  31. package/dist/index.d.ts +9 -10
  32. package/dist/index.js +9 -9
  33. package/dist/{integrations-CcD5NPEA.d.ts → integrations-DrbKQSTD.d.ts} +3 -32
  34. package/dist/internal.d.ts +10 -10
  35. package/dist/internal.js +8 -8
  36. package/dist/{offers-CtzMeB7O.d.ts → offers-DAfe1O3_.d.ts} +6 -2
  37. package/dist/{pages-BlLqB8ZQ.d.ts → pages-ChDVLrgR.d.ts} +39 -10
  38. package/dist/portal-proxy.js +3 -3
  39. package/dist/react/index.d.ts +71 -72
  40. package/dist/react/index.js +10 -10
  41. package/dist/runtime/authoring.js +1 -1
  42. package/dist/runtime/chunks/BG43KQ2T.js +1 -0
  43. package/dist/runtime/chunks/EWU4OKSY.js +62 -0
  44. package/dist/runtime/manifest.json +5 -5
  45. package/dist/runtime/schema.js +1 -1
  46. package/dist/runtime/zod.js +1 -1
  47. package/dist/{schema-C4m9RhCR.d.ts → schema-BA0nRRlt.d.ts} +184 -35
  48. package/dist/schema.d.ts +754 -432
  49. package/dist/schema.js +77 -13
  50. package/dist/server/index.d.ts +10 -10
  51. package/dist/server/index.js +434 -55
  52. package/dist/{submission-input-wTiYGdgA.d.ts → submission-input-DxQ6RnKo.d.ts} +2 -2
  53. package/dist/{telegram-browser-Bh3i0HiH.d.ts → telegram-browser-o3OIxGrJ.d.ts} +3 -3
  54. package/dist/testing.d.ts +89 -9
  55. package/dist/testing.js +215 -10
  56. package/dist/{transport-CnKA-_RL.d.ts → transport-D_Eqf78J.d.ts} +3997 -2030
  57. package/dist/wallet-B06zvDXp.d.ts +972 -0
  58. package/dist/{x-1czZFVUW.d.ts → x-C28SNifw.d.ts} +2 -2
  59. package/package.json +2 -2
  60. package/dist/profiles-BoOK03cR.d.ts +0 -299
  61. package/dist/runtime/chunks/IDOMZWRY.js +0 -40
  62. package/dist/runtime/chunks/NDB42VFF.js +0 -1
  63. package/dist/util.d-w9f9t3ua.d.ts +0 -5
  64. package/dist/wallet-Ac7OFpOr.d.ts +0 -228
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  attemptCaptureSchema,
3
3
  capturedFactSchema
4
- } from "../chunk-MNU6UPXY.js";
4
+ } from "../chunk-KBCTII6C.js";
5
5
  import {
6
6
  activityTypeSchema,
7
7
  activityTypes,
@@ -27,7 +27,7 @@ import {
27
27
  publishDeploymentSchema,
28
28
  rejectDeploymentSchema,
29
29
  submitDeploymentSchema
30
- } from "../chunk-CXKXPB7K.js";
30
+ } from "../chunk-M2JQPDUX.js";
31
31
  import {
32
32
  analyticsBreakdowns,
33
33
  analyticsCatalog,
@@ -42,7 +42,7 @@ import {
42
42
  analyticsRanges,
43
43
  analyticsReadSchema,
44
44
  dashboardDefinitionSchema
45
- } from "../chunk-ULQU7KC4.js";
45
+ } from "../chunk-W42KMMH5.js";
46
46
  import "../chunk-4OC7REYX.js";
47
47
  import {
48
48
  DEFAULT_MANAGEMENT_TIMEOUT,
@@ -63,22 +63,22 @@ import {
63
63
  participantExchangeSchema,
64
64
  questConfiguration,
65
65
  sequenceCursorSchema
66
- } from "../chunk-G6XVBYH7.js";
66
+ } from "../chunk-LDLOB2UZ.js";
67
67
  import {
68
68
  parseImageExtraction,
69
69
  parseImageResult
70
- } from "../chunk-W5U2WXG3.js";
70
+ } from "../chunk-YRSU2X2P.js";
71
71
  import {
72
72
  imageAssetArtifactSchema,
73
73
  xUserLookupInputSchema,
74
74
  xUserSchema,
75
75
  xUsernameSchema
76
- } from "../chunk-CK7HO32Z.js";
76
+ } from "../chunk-IBROKMFV.js";
77
77
  import {
78
78
  sourceDataSchema,
79
79
  sourceRoles,
80
80
  validateQuestShape
81
- } from "../chunk-H2MD6E7Z.js";
81
+ } from "../chunk-YMWRLAAP.js";
82
82
  import {
83
83
  isIntegrationParticipantPath,
84
84
  isParticipantRoute,
@@ -87,7 +87,7 @@ import {
87
87
  } from "../chunk-MHPKEVEW.js";
88
88
  import {
89
89
  withActionId
90
- } from "../chunk-INSWI2VZ.js";
90
+ } from "../chunk-KYUQEZZA.js";
91
91
  import {
92
92
  allocateQuestSchema,
93
93
  allocatedQuestSchema,
@@ -97,6 +97,7 @@ import {
97
97
  collectionPreviewSchema,
98
98
  collectionResolveSchema,
99
99
  creatorAccountProviderSchema,
100
+ discordRoleRewardsSchema,
100
101
  memberEnrollmentInputSchema,
101
102
  publishQuestDraftSchema,
102
103
  questCatalogSchema,
@@ -107,7 +108,7 @@ import {
107
108
  rewardDeliveryQuerySchema,
108
109
  rewardDeliverySchema,
109
110
  saveQuestDraftSchema
110
- } from "../chunk-RBPMT53S.js";
111
+ } from "../chunk-6U5WWH3W.js";
111
112
  import {
112
113
  badgeMutationResultSchema,
113
114
  badgeMutationSchema,
@@ -155,7 +156,7 @@ import {
155
156
  referralQualificationSchema,
156
157
  referralRewardResolutionSchema,
157
158
  referralSuspensionSchema
158
- } from "../chunk-BJYMTCWG.js";
159
+ } from "../chunk-UEMLYPKJ.js";
159
160
  import {
160
161
  createPointLedgerSchema,
161
162
  managedPointLedgerSchema,
@@ -168,12 +169,13 @@ import {
168
169
  telegramChatConnectionSchema,
169
170
  telegramChatIdSchema,
170
171
  telegramChatsSchema
171
- } from "../chunk-VSHV7FEA.js";
172
- import "../chunk-KBVH4XZC.js";
173
- import "../chunk-ABJ4G47X.js";
174
- import "../chunk-QNQNKIAA.js";
172
+ } from "../chunk-XGXDINGM.js";
173
+ import "../chunk-R4S6BFOH.js";
174
+ import "../chunk-TZJT5CRF.js";
175
+ import "../chunk-EQF4ID47.js";
175
176
  import {
176
177
  CompletionSourceKind,
178
+ acceptAnywaySchema,
177
179
  addGroupMemberSchema,
178
180
  appIdentityKindSchema,
179
181
  attemptSchema,
@@ -201,6 +203,7 @@ import {
201
203
  eventSchema,
202
204
  evmAddressSchema,
203
205
  evmChainIdSchema,
206
+ groupArchiveInputSchema,
204
207
  groupMemberPageSchema,
205
208
  groupMemberSchema,
206
209
  groupPageQuerySchema,
@@ -208,13 +211,16 @@ import {
208
211
  identifier,
209
212
  knownResponse,
210
213
  lazyResponseReaders,
214
+ lifecycleReasonSchema,
211
215
  linkedWalletSchema,
212
216
  managedGroupSchema,
217
+ managedTrackerCreateSchema,
213
218
  managementStateQuerySchema,
214
219
  memberCampaignEnrollmentInputSchema,
215
220
  memberCampaignWithdrawalInputSchema,
216
221
  memberIdentitySchema,
217
222
  memberProgressSchema,
223
+ offsetDateTimeSchema,
218
224
  pageCursorSchema,
219
225
  pageQuerySchema,
220
226
  pickupAvailabilitySchema,
@@ -237,7 +243,6 @@ import {
237
243
  trackerContentReadSchema,
238
244
  trackerContentSchema,
239
245
  trackerControlSchema,
240
- trackerCreateSchema,
241
246
  trackerDataIssue,
242
247
  trackerDataIssues,
243
248
  trackerIngestResultSchema,
@@ -261,7 +266,7 @@ import {
261
266
  walletSignInNetworksSchema,
262
267
  walletUnlinkInputSchema,
263
268
  whereSchemaIssue
264
- } from "../chunk-BHHUSBSD.js";
269
+ } from "../chunk-AWWCEP7F.js";
265
270
 
266
271
  // src/server/identity-links.ts
267
272
  import * as z from "zod";
@@ -472,6 +477,25 @@ var leaderboardSettlementExportSchema = z4.object({
472
477
  })
473
478
  )
474
479
  });
480
+ var csvField = (value) => {
481
+ const text = value == null ? "" : String(value);
482
+ return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
483
+ };
484
+ function settlementPayoutCsv(exported) {
485
+ const unit = exported.pool === null ? "" : exported.pool.unit === "points" ? "points" : exported.pool.unit.code;
486
+ return [
487
+ ["member", "score", "rank", "share", "amount", "unit", "wallets"],
488
+ ...exported.rows.map((row) => [
489
+ row.member,
490
+ row.score,
491
+ row.rank,
492
+ row.share,
493
+ row.amount,
494
+ row.share === null ? "" : unit,
495
+ row.wallets.map((wallet) => `${wallet.network ?? wallet.chain}:${wallet.address}`).join(" ")
496
+ ])
497
+ ].map((fields) => fields.map(csvField).join(",")).join("\n");
498
+ }
475
499
 
476
500
  // src/server/inventory-items.ts
477
501
  import * as z5 from "zod";
@@ -739,7 +763,7 @@ var testMemberHistorySchema = z7.object({
739
763
  import * as z8 from "zod";
740
764
  var importTimeSchema = z8.union([
741
765
  z8.number().int().nonnegative().safe(),
742
- z8.iso.datetime({ offset: true }).transform((value) => Date.parse(value))
766
+ offsetDateTimeSchema().transform((value) => Date.parse(value))
743
767
  ]);
744
768
  var importWalletSchema = z8.discriminatedUnion("chain", [
745
769
  z8.object({
@@ -1062,7 +1086,7 @@ var resourceLifecycleInputSchema = z10.object({
1062
1086
  kind: resourceLifecycleKindSchema,
1063
1087
  resource: identifier,
1064
1088
  archived: z10.boolean(),
1065
- reason: z10.string().trim().min(1).max(500),
1089
+ reason: lifecycleReasonSchema,
1066
1090
  expectedArchivedAt: z10.number().int().nonnegative().nullable().optional()
1067
1091
  }).strict();
1068
1092
  var resourceLifecycleResultSchema = z10.object({
@@ -1407,6 +1431,10 @@ function nextScheduleRun(schedule, after) {
1407
1431
  return next.getTime();
1408
1432
  }
1409
1433
  var appScheduleStateSchema = z14.enum(["active", "paused", "archived"]);
1434
+ var appScheduleStateInputSchema = z14.object({
1435
+ state: appScheduleStateSchema,
1436
+ reason: lifecycleReasonSchema.optional()
1437
+ }).strict();
1410
1438
  var APP_SCHEDULE_RESULT_BYTES = 16384;
1411
1439
  var appScheduleDiagnosticSchema = z14.object({
1412
1440
  level: z14.enum(["error", "warning", "info"]),
@@ -1537,6 +1565,46 @@ ${body}`)
1537
1565
 
1538
1566
  // src/server/starters.ts
1539
1567
  import * as z15 from "zod";
1568
+ var starters = [
1569
+ {
1570
+ id: "campaign",
1571
+ title: "Campaign tour",
1572
+ summary: "A neutral quest app with a guided tour of every quest kind. The blank canvas for anything."
1573
+ },
1574
+ {
1575
+ id: "classic",
1576
+ title: "Classic questboard",
1577
+ summary: "The familiar Domino portal: quests in a grid grouped by section, a claim page, points, and a leaderboard."
1578
+ },
1579
+ {
1580
+ id: "waitlist",
1581
+ title: "Waitlist",
1582
+ summary: "Collect sign-ups before launch. People move up the line by inviting friends."
1583
+ },
1584
+ {
1585
+ id: "referral",
1586
+ title: "Referral program",
1587
+ summary: "Give every member an invite link and reward them when friends join and qualify."
1588
+ },
1589
+ {
1590
+ id: "discord",
1591
+ title: "Discord activation",
1592
+ summary: "Turn new Discord members into regulars with quests for joining, introducing themselves, and taking part, rewarded with roles."
1593
+ },
1594
+ {
1595
+ id: "loyalty",
1596
+ title: "Loyalty program",
1597
+ summary: "Members earn points in a campaign, qualify into a members' group, and spend points on offers, some for members only."
1598
+ },
1599
+ {
1600
+ id: "api",
1601
+ title: "API",
1602
+ summary: "A headless Worker with typed routes and interactive API docs, for plugging Domino into your own product."
1603
+ }
1604
+ ];
1605
+ var offeredStarterSchema = z15.string().refine((id) => starters.some((starter) => starter.id === id), {
1606
+ error: `Unknown starter. Choose one of: ${starters.map((starter) => starter.id).join(", ")}.`
1607
+ });
1540
1608
  var starterTemplates = [
1541
1609
  {
1542
1610
  id: "campaign",
@@ -1810,6 +1878,10 @@ var repositorySchema = z16.object({
1810
1878
  defaultBranch: z16.string(),
1811
1879
  status: z16.enum(["provisioning", "ready"])
1812
1880
  });
1881
+ var repositoryCreateSchema = z16.object({
1882
+ /** Omitted: the starter chosen at project setup, else `campaign`. */
1883
+ starter: offeredStarterSchema.optional()
1884
+ }).strict();
1813
1885
  var createRepositorySchema = z16.object({
1814
1886
  /** Omitted: the starter chosen at project setup, else `campaign`. */
1815
1887
  starter: starterIdSchema.optional()
@@ -1922,10 +1994,18 @@ var stagingAccessInputSchema = z16.discriminatedUnion("mode", [
1922
1994
  password: z16.string().min(8).max(128)
1923
1995
  }).strict()
1924
1996
  ]);
1925
- var stagingPathSchema = z16.string().max(2048).refine(
1926
- (path) => path.startsWith("/") && !path.startsWith("//") && !path.includes("\\"),
1927
- "Expected a path on the staging host"
1928
- );
1997
+ var stagingOrigin = "https://staging.invalid";
1998
+ var stagingPathSchema = z16.string().max(2048).refine((path) => {
1999
+ if (!path.startsWith("/") || path.startsWith("//") || path.includes("\\") || // oxlint-disable-next-line no-control-regex
2000
+ /[\u0000-\u001f\u007f]/.test(path)) {
2001
+ return false;
2002
+ }
2003
+ try {
2004
+ return new URL(path, stagingOrigin).origin === stagingOrigin;
2005
+ } catch {
2006
+ return false;
2007
+ }
2008
+ }, "Expected a path on the staging host");
1929
2009
  var stagingLinkSchema = z16.object({
1930
2010
  url: z16.string().url(),
1931
2011
  expiresAt: z16.number()
@@ -1984,12 +2064,13 @@ var artifactFields = {
1984
2064
  }).strict()
1985
2065
  ).max(500)
1986
2066
  };
2067
+ var inlineCode = () => z16.unknown().optional().transform((value) => value);
1987
2068
  var buildArtifactsSchema = z16.discriminatedUnion("format", [
1988
2069
  z16.object({
1989
2070
  format: z16.literal(1),
1990
2071
  ...artifactFields,
1991
- quests: z16.unknown(),
1992
- catalog: z16.unknown()
2072
+ quests: inlineCode(),
2073
+ catalog: inlineCode()
1993
2074
  }).strict(),
1994
2075
  z16.object({
1995
2076
  format: z16.literal(2),
@@ -2192,6 +2273,13 @@ var projectSchema = z19.object({
2192
2273
  path: ["creator"]
2193
2274
  }
2194
2275
  );
2276
+ var projectCreateInputSchema = z19.object({
2277
+ actionId: identifier,
2278
+ name: z19.string().trim().min(1).max(80),
2279
+ setup: projectSetupSchema.optional(),
2280
+ /** The starter a new hosted app begins from, with `setup.mode` "new". */
2281
+ starter: offeredStarterSchema.optional()
2282
+ }).strict();
2195
2283
  var projectInputSchema = z19.object({
2196
2284
  actionId: identifier,
2197
2285
  name: z19.string().trim().min(1).max(80),
@@ -2200,7 +2288,7 @@ var projectInputSchema = z19.object({
2200
2288
  starter: starterIdSchema.optional()
2201
2289
  }).strict();
2202
2290
  var projectUpdateInputSchema = z19.union([
2203
- z19.object({ name: projectInputSchema.shape.name }).strict(),
2291
+ z19.object({ name: projectCreateInputSchema.shape.name }).strict(),
2204
2292
  z19.object({
2205
2293
  slug: projectSchema.shape.slug,
2206
2294
  confirm: z19.string().min(1).max(80)
@@ -2309,12 +2397,87 @@ var completionRevocationSchema = z19.object({
2309
2397
  ),
2310
2398
  streakMilestone: z19.boolean()
2311
2399
  });
2400
+ var completionRestoreSchema = z19.object({
2401
+ actionId: identifier,
2402
+ reason: z19.string().trim().min(1).max(500)
2403
+ }).strict();
2404
+ var RestoredEntitlementOutcome = {
2405
+ /** The revocation voided it, and it is available again. */
2406
+ Restored: "restored",
2407
+ /** The revocation lowered or flagged it: its earned tier is the completion's again. */
2408
+ Raised: "raised",
2409
+ /** It changed since the revocation (an operator restored, voided or corrected it), so it stays. */
2410
+ Kept: "kept"
2411
+ };
2412
+ var RestoredDeliveryOutcome = {
2413
+ /** The grant had not reached Discord, and it is queued again. */
2414
+ Requeued: "requeued",
2415
+ /** The grant counts again for reconciliation, and its delivery status stays. */
2416
+ Kept: "kept"
2417
+ };
2418
+ var RestoredReferralOutcome = {
2419
+ /** The member qualifies on this completion again. */
2420
+ Qualified: "qualified",
2421
+ /** The program is disabled or gone, or the referral is suspended, so nothing changed. */
2422
+ Kept: "kept"
2423
+ };
2424
+ var openOutcome = z19.string().min(1).max(64);
2425
+ var completionRestorationSchema = z19.object({
2426
+ completion: identifier,
2427
+ /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
2428
+ quest: identifier,
2429
+ member: identifier,
2430
+ source: completionSourceSchema.optional(),
2431
+ restoredAt: z19.number(),
2432
+ points: z19.array(
2433
+ z19.object({
2434
+ entry: identifier,
2435
+ balance: identifier,
2436
+ reversal: identifier,
2437
+ amount: z19.number().int()
2438
+ })
2439
+ ),
2440
+ badges: z19.array(z19.object({ badge: identifier })),
2441
+ groups: z19.array(z19.object({ group: identifier, added: z19.boolean() })),
2442
+ entitlements: z19.array(
2443
+ z19.object({
2444
+ entitlement: identifier,
2445
+ reward: identifier,
2446
+ outcome: openOutcome,
2447
+ status: z19.string()
2448
+ })
2449
+ ),
2450
+ deliveries: z19.array(
2451
+ z19.object({
2452
+ delivery: z19.string(),
2453
+ roleId: z19.string(),
2454
+ outcome: openOutcome
2455
+ })
2456
+ ),
2457
+ referrals: z19.array(
2458
+ z19.object({
2459
+ program: identifier,
2460
+ outcome: openOutcome
2461
+ })
2462
+ ),
2463
+ streakMilestone: z19.boolean()
2464
+ });
2312
2465
  var accessSchema = z19.object({
2313
2466
  actor: z19.string(),
2314
2467
  organization: z19.string(),
2315
2468
  admin: z19.boolean(),
2316
2469
  local: z19.boolean(),
2317
- projects: z19.array(projectSchema)
2470
+ projects: z19.array(projectSchema),
2471
+ /** The credential's own kind and scope, when it is an organization automation key. */
2472
+ credential: z19.object({
2473
+ kind: z19.string(),
2474
+ id: z19.string(),
2475
+ name: z19.string(),
2476
+ /** The projects it reaches; null for every project of the organization. */
2477
+ projects: z19.array(z19.string()).nullable(),
2478
+ createProjects: z19.boolean(),
2479
+ permissions: permissionListSchema
2480
+ }).optional()
2318
2481
  });
2319
2482
  var querySchema = z19.object({
2320
2483
  q: z19.string().max(200).default(""),
@@ -2569,6 +2732,17 @@ var participantSignInSchema = z19.object({
2569
2732
  login: z19.boolean(),
2570
2733
  miniAppBotId: telegramBotIdSchema.nullable()
2571
2734
  }).optional(),
2735
+ /**
2736
+ * The creator-account providers, such as `youtube`, and whether Domino configured each, so
2737
+ * members can link accounts that trackers like `youtube.shorts()` read. Absent from older Relay
2738
+ * versions.
2739
+ */
2740
+ creatorAccounts: z19.array(
2741
+ z19.object({
2742
+ provider: creatorAccountProviderSchema,
2743
+ configured: z19.boolean()
2744
+ })
2745
+ ).optional(),
2572
2746
  updatedAt: z19.number().nullable(),
2573
2747
  updatedBy: z19.string().nullable()
2574
2748
  });
@@ -2582,12 +2756,24 @@ var completionRevocationShortfallSchema = z19.object({
2582
2756
  revokedAt: z19.number().int().nonnegative().safe(),
2583
2757
  unreversedPoints: z19.record(identifier, z19.number().int().positive().safe())
2584
2758
  });
2759
+ var revokedCompletionSchema = z19.object({
2760
+ completion: identifier,
2761
+ quest: identifier,
2762
+ /** The completion key: its occurrence, such as `once` or a day. */
2763
+ key: z19.string(),
2764
+ revokedAt: z19.number().int().nonnegative().safe(),
2765
+ /** Why it was revoked, and what the revoke did, which a restore re-applies. */
2766
+ reason: z19.string().optional(),
2767
+ revocation: completionRevocationSchema.optional()
2768
+ });
2585
2769
  var memberDetailSchema = z19.object({
2586
2770
  snapshot: snapshotSchema,
2587
2771
  member: memberSchema,
2588
2772
  progress: memberProgressSchema,
2589
2773
  /** Up to 25 revoked completions with an unreversed point remainder, newest first. */
2590
2774
  revocationShortfalls: z19.array(completionRevocationShortfallSchema).default([]),
2775
+ /** Up to 25 revoked completions, newest first. Relay older than restore leaves it out. */
2776
+ revokedCompletions: z19.array(revokedCompletionSchema).optional(),
2591
2777
  /** Current and historical campaign enrollment state, including inactive enrollments. */
2592
2778
  campaignEnrollments: z19.array(campaignEnrollmentSchema).default([]),
2593
2779
  passes: z19.array(
@@ -2682,6 +2868,44 @@ var issuedServiceKeySchema = serviceKeySchema.extend({
2682
2868
  secret: z19.string().uuid(),
2683
2869
  token: z19.string()
2684
2870
  });
2871
+ var automationKeyPermissionSchema = z19.enum([
2872
+ "read",
2873
+ "publish",
2874
+ "inventory",
2875
+ "points",
2876
+ "ingest",
2877
+ "enroll"
2878
+ ]);
2879
+ var automationKeyInputSchema = z19.object({
2880
+ name: z19.string().trim().min(1).max(80),
2881
+ permissions: z19.array(automationKeyPermissionSchema).min(1),
2882
+ /** The projects it reaches. Omit it for every project of the organization, current and future. */
2883
+ projects: z19.array(identifier).min(1).max(100).optional(),
2884
+ /** Whether it may create projects. A project it creates joins its `projects` list. */
2885
+ createProjects: z19.boolean().default(false),
2886
+ /** Days until the first secret expires. Omit it for a key that never expires. */
2887
+ expiresInDays: z19.number().int().min(1).max(3650).optional()
2888
+ }).strict();
2889
+ var automationKeySchema = z19.object({
2890
+ id: z19.string().uuid(),
2891
+ organization: z19.string(),
2892
+ name: z19.string(),
2893
+ permissions: permissionListSchema,
2894
+ /** The projects it reaches; null for every project of the organization. */
2895
+ projects: z19.array(z19.string()).nullable(),
2896
+ createProjects: z19.boolean(),
2897
+ /** The Clerk user ID of the administrator who created it. */
2898
+ createdBy: z19.string(),
2899
+ createdAt: z19.number(),
2900
+ /** The latest use of any of its secrets, revoked ones included; null when none was used. */
2901
+ lastUsedAt: z19.number().nullable(),
2902
+ /** Its working secrets, oldest first. Any of them authenticates the key. */
2903
+ secrets: z19.array(credentialSecretSchema)
2904
+ });
2905
+ var issuedAutomationKeySchema = automationKeySchema.extend({
2906
+ secret: z19.string().uuid(),
2907
+ token: z19.string()
2908
+ });
2685
2909
  var teamSchema = z19.array(
2686
2910
  z19.object({ id: z19.string(), label: z19.string() })
2687
2911
  );
@@ -2753,6 +2977,7 @@ var managedAttemptSchema = z19.object({
2753
2977
  attempt: attemptSchema,
2754
2978
  release: publishedReleaseSchema.nullable(),
2755
2979
  events: z19.array(eventSchema),
2980
+ supersededBy: z19.string().nullable().optional(),
2756
2981
  person: personSchema
2757
2982
  });
2758
2983
  var managedEntitlementQuerySchema = z19.strictObject({
@@ -2938,6 +3163,31 @@ function managementClient(options) {
2938
3163
  typeof target === "string" ? call : inputOrCall
2939
3164
  );
2940
3165
  }
3166
+ function setAppScheduleState(state3, inputOrCall, call) {
3167
+ const reasoned = call !== void 0 || inputOrCall !== void 0 && "reason" in inputOrCall;
3168
+ return request(
3169
+ "/schedules/state",
3170
+ appScheduleListSchema,
3171
+ appScheduleStateInputSchema.parse({
3172
+ ...reasoned ? inputOrCall : {},
3173
+ state: state3
3174
+ }),
3175
+ "PUT",
3176
+ reasoned ? call : inputOrCall
3177
+ );
3178
+ }
3179
+ function archiveManagedGroup(verb) {
3180
+ function change(group, inputOrCall, call) {
3181
+ const reasoned = call !== void 0 || inputOrCall !== void 0 && "reason" in inputOrCall;
3182
+ return post(
3183
+ `/groups/${groupKey(group)}/${verb}`,
3184
+ managedGroupSchema,
3185
+ reasoned ? groupArchiveInputSchema.parse(inputOrCall) : {},
3186
+ reasoned ? call : inputOrCall
3187
+ );
3188
+ }
3189
+ return change;
3190
+ }
2941
3191
  function archiveManagedPointLedger(ledger, inputOrCall, call) {
2942
3192
  const input = inputOrCall && "reason" in inputOrCall ? resourceArchiveInputSchema.parse(withActionId(inputOrCall)) : {};
2943
3193
  const options2 = inputOrCall && "reason" in inputOrCall ? call : inputOrCall;
@@ -3015,22 +3265,25 @@ function managementClient(options) {
3015
3265
  },
3016
3266
  trackers: {
3017
3267
  /**
3018
- * Creates an X search tracker as data in test, with the same validation as `defineTracker`;
3019
- * requires `publish`. Its first collection searches from `window.start`. Live refuses it with
3020
- * `promotion-required`: the tracker reaches live through a promotion. A key a deployment
3021
- * already publishes is refused with `tracker-owned-by-code`.
3268
+ * Creates a tracker as data in test, with the same validation as `defineTracker`; requires
3269
+ * `publish`. Name its source with `source`, such as `{ kind: "discord-messages", text: true }`,
3270
+ * or an X search with `query` alone. An X tracker's first collection searches from
3271
+ * `window.start`. Live refuses it with `promotion-required`: the tracker reaches live through
3272
+ * a promotion. A key a deployment already publishes is refused with `tracker-owned-by-code`.
3022
3273
  */
3023
3274
  create: (input, call) => create(
3024
3275
  "/trackers",
3025
3276
  trackerStatusSchema,
3026
- trackerCreateSchema,
3277
+ managedTrackerCreateSchema,
3027
3278
  input,
3028
3279
  call
3029
3280
  ),
3030
3281
  /**
3031
- * Changes a tracker created with `create`, in test; fields left out keep their value. A new
3032
- * query or window collects from now on and never searches the past. A tracker defined in
3033
- * code changes only through a deployment (`tracker-owned-by-code`).
3282
+ * Changes a tracker created with `create`, in test; fields left out keep their value. `source`
3283
+ * replaces the source's settings but never its kind (`validation-failed`). A new query or
3284
+ * window collects from now on and never searches the past, and turning Discord message text
3285
+ * off erases the text already stored. A tracker defined in code changes only through a
3286
+ * deployment (`tracker-owned-by-code`).
3034
3287
  */
3035
3288
  update: (reference, input, call) => post(
3036
3289
  `/trackers/${identifier.parse(reference)}/update`,
@@ -3512,20 +3765,11 @@ function managementClient(options) {
3512
3765
  ),
3513
3766
  /**
3514
3767
  * Freezes a group's membership. Its members still count for prerequisites, leaderboards
3515
- * and referral rules.
3768
+ * and referral rules. Pass `{ reason }` to record why in the audit log.
3516
3769
  */
3517
- archive: (group, call) => post(
3518
- `/groups/${groupKey(group)}/archive`,
3519
- managedGroupSchema,
3520
- {},
3521
- call
3522
- ),
3523
- unarchive: (group, call) => post(
3524
- `/groups/${groupKey(group)}/unarchive`,
3525
- managedGroupSchema,
3526
- {},
3527
- call
3528
- ),
3770
+ archive: archiveManagedGroup("archive"),
3771
+ /** Lets a group's membership change again, with an optional `{ reason }` for the audit log. */
3772
+ unarchive: archiveManagedGroup("unarchive"),
3529
3773
  /** A group's current members by member ID. Pass `nextCursor` back as `cursor`. */
3530
3774
  members: (group, query = {}, call) => get(
3531
3775
  `/groups/${groupKey(group)}/members${queryString(groupPageQuerySchema.parse(query))}`,
@@ -3927,6 +4171,24 @@ function managementClient(options) {
3927
4171
  staffDecisionSchema.parse(withActionId(input)),
3928
4172
  call
3929
4173
  ),
4174
+ /**
4175
+ * Accepts a rejected attempt anyway, with a reason, for any member; requires `review`
4176
+ * permission. The evaluator's or a reviewer's rejection stays in the attempt's events, its
4177
+ * retry cooldown ends, and the acceptance pays as a reviewer's approval would, with the
4178
+ * normal accepted events and webhook. Only the member's latest attempt on a quest that isn't
4179
+ * archived (409 `attempt-superseded`, `quest-archived`); a cap the acceptance would break is
4180
+ * refused, not bypassed (409 `completion-cooldown`, `budget-exhausted`, `completion-revoked`,
4181
+ * `already-completed`). Replaying the action ID returns the first result.
4182
+ */
4183
+ acceptAnyway: (input, call) => {
4184
+ const { attempt, ...body } = input;
4185
+ return post(
4186
+ `/attempts/${identifier.parse(attempt)}/accept-anyway`,
4187
+ attemptSchema,
4188
+ acceptAnywaySchema.parse(withActionId(body)),
4189
+ call
4190
+ );
4191
+ },
3930
4192
  /** Evaluates a failed attempt again under a new generation; requires `review` permission. */
3931
4193
  retry: (attempt, call) => post(
3932
4194
  `/attempts/${identifier.parse(attempt)}/retry`,
@@ -3966,6 +4228,26 @@ function managementClient(options) {
3966
4228
  completionRevokeSchema.parse(withActionId(body)),
3967
4229
  call
3968
4230
  );
4231
+ },
4232
+ /**
4233
+ * Restores a revoked completion with a reason; requires `review` permission. In one
4234
+ * transaction it clears the revocation and re-applies what the revocation recorded: awards
4235
+ * back the points it reversed (not those it could not reverse), re-awards its badges, re-adds
4236
+ * its group memberships, restores the tiered rewards it voided and raises those it lowered,
4237
+ * queues its stopped Discord role grants again, re-qualifies its referrals, and restores a
4238
+ * streak milestone. Budgets stay spent. Fails with 409 `completion-not-revoked` when the
4239
+ * completion counts already, and with 409 `occurrence-taken` when the revocation freed the
4240
+ * occurrence and another completion holds it now. Replaying the action ID returns the first
4241
+ * result.
4242
+ */
4243
+ restore: (input, call) => {
4244
+ const { completion, ...body } = input;
4245
+ return post(
4246
+ `/completions/${identifier.parse(completion)}/restore`,
4247
+ completionRestorationSchema,
4248
+ completionRestoreSchema.parse(withActionId(body)),
4249
+ call
4250
+ );
3969
4251
  }
3970
4252
  },
3971
4253
  /** Staff handover of a member's reward entitlement; requires `handover` permission. */
@@ -4027,6 +4309,20 @@ function managementClient(options) {
4027
4309
  entitlementCorrectionSchema.parse(withActionId(input)),
4028
4310
  call
4029
4311
  ),
4312
+ /**
4313
+ * Restores an entitlement an operator voided, at the `revision` the operator saw, with a
4314
+ * reason. It is available again at the tier an accepted completion still earns, with any
4315
+ * referral review the void settled. Fails with 409 `entitlement-status` when it isn't void;
4316
+ * when a completion revocation voided it, or no accepted completion still earns it, with the
4317
+ * revoked `completion` to restore instead; when canceling a redemption voided it; and for a
4318
+ * referral reward voided before voids kept their referral reviews.
4319
+ */
4320
+ restore: (entitlement, input, call) => post(
4321
+ `/entitlements/${identifier.parse(entitlement)}/restore`,
4322
+ entitlementSchema,
4323
+ entitlementCorrectionSchema.parse(withActionId(input)),
4324
+ call
4325
+ ),
4030
4326
  /**
4031
4327
  * Corrects a collection recorded by mistake, at the `revision` the operator saw, with a
4032
4328
  * reason. The entitlement is available again and any pickup size it held returns to stock.
@@ -4182,7 +4478,7 @@ function managementClient(options) {
4182
4478
  },
4183
4479
  readiness: (call) => get("/readiness", readinessSchema, call),
4184
4480
  access: (call) => get("/access", accessSchema, call),
4185
- createProject: (input, call) => create("/projects", projectSchema, projectInputSchema, input, call),
4481
+ createProject: (input, call) => create("/projects", projectSchema, projectCreateInputSchema, input, call),
4186
4482
  updateProject: (input, call) => request(
4187
4483
  "/project",
4188
4484
  projectSchema,
@@ -4272,6 +4568,47 @@ function managementClient(options) {
4272
4568
  call
4273
4569
  )
4274
4570
  },
4571
+ /**
4572
+ * Organization automation keys (`dak_`): credentials for a headless agent or CI across the
4573
+ * organization's projects, owned by no person. They write in test only. Only an organization
4574
+ * administrator in Console manages them.
4575
+ */
4576
+ automationKeys: {
4577
+ list: (call) => get("/automation-keys", z19.array(automationKeySchema), call),
4578
+ /** The secret `token` is in this response only. */
4579
+ create: (input, call) => post(
4580
+ "/automation-keys",
4581
+ issuedAutomationKeySchema,
4582
+ automationKeyInputSchema.parse(input),
4583
+ call
4584
+ ),
4585
+ /**
4586
+ * Rotation: issues another secret. The key's other secrets keep working until you revoke
4587
+ * them with `revokeSecret`. The new `token` is in this response only.
4588
+ */
4589
+ addSecret: (id, input = {}, call) => post(
4590
+ `/automation-keys/${z19.string().uuid().parse(id)}/secrets`,
4591
+ issuedAutomationKeySchema,
4592
+ credentialSecretInputSchema.parse(input),
4593
+ call
4594
+ ),
4595
+ /** Stops one secret working. A key's last secret cannot be revoked; revoke the key instead. */
4596
+ revokeSecret: (id, secret, call) => request(
4597
+ `/automation-keys/${z19.string().uuid().parse(id)}/secrets/${z19.string().uuid().parse(secret)}`,
4598
+ automationKeySchema,
4599
+ void 0,
4600
+ "DELETE",
4601
+ call
4602
+ ),
4603
+ /** Deletes the key; every secret stops working. */
4604
+ revoke: (id, call) => request(
4605
+ `/automation-keys/${z19.string().uuid().parse(id)}`,
4606
+ z19.null(),
4607
+ void 0,
4608
+ "DELETE",
4609
+ call
4610
+ )
4611
+ },
4275
4612
  /** Who holds which roles on the client's project; organization administrators only. */
4276
4613
  grants: {
4277
4614
  list: (call) => get("/grants", z19.array(grantRecordSchema), call),
@@ -4515,6 +4852,12 @@ function managementClient(options) {
4515
4852
  ),
4516
4853
  /** Operations of the Discord role reward kind on assignments it delivered. */
4517
4854
  discordRoles: {
4855
+ /**
4856
+ * Every Discord role the project's reward deliveries grant in this environment, with the
4857
+ * quests that requested it and its deliveries counted by status. Unlike `rewardDeliveries`,
4858
+ * it covers the whole history, so a role granted only long ago still appears.
4859
+ */
4860
+ list: (call) => get("/reward-deliveries/roles", discordRoleRewardsSchema, call),
4518
4861
  /**
4519
4862
  * Hands the role assignment a delivery made to an external administrator or bot: Relay stops
4520
4863
  * removing it automatically, in every project and environment that shares the assignment.
@@ -5022,13 +5365,8 @@ function managementClient(options) {
5022
5365
  {},
5023
5366
  call
5024
5367
  ),
5025
- setState: (state3, call) => request(
5026
- "/schedules/state",
5027
- appScheduleListSchema,
5028
- { state: appScheduleStateSchema.parse(state3) },
5029
- "PUT",
5030
- call
5031
- ),
5368
+ /** Activates, pauses or archives the project's schedules, with an optional audited reason. */
5369
+ setState: setAppScheduleState,
5032
5370
  recover: (name, input, call) => post(
5033
5371
  `/schedules/${appScheduleNameSchema.parse(name)}/recover`,
5034
5372
  appScheduleListSchema,
@@ -5480,6 +5818,9 @@ var managementResponseSchemas = lazyResponseReaders({
5480
5818
  get completionRevocationSchema() {
5481
5819
  return knownResponse(completionRevocationSchema);
5482
5820
  },
5821
+ get completionRestorationSchema() {
5822
+ return knownResponse(completionRestorationSchema);
5823
+ },
5483
5824
  get contentPerformancePageSchema() {
5484
5825
  return knownResponse(contentPerformancePageSchema);
5485
5826
  },
@@ -5504,6 +5845,9 @@ var managementResponseSchemas = lazyResponseReaders({
5504
5845
  get deploymentResultSchema() {
5505
5846
  return knownResponse(deploymentResultSchema);
5506
5847
  },
5848
+ get discordRoleRewardsSchema() {
5849
+ return knownResponse(discordRoleRewardsSchema);
5850
+ },
5507
5851
  get engagementBoundaryPageSchema() {
5508
5852
  return knownResponse(engagementBoundaryPageSchema);
5509
5853
  },
@@ -5555,6 +5899,12 @@ var managementResponseSchemas = lazyResponseReaders({
5555
5899
  get issuedServiceKeySchema() {
5556
5900
  return knownResponse(issuedServiceKeySchema);
5557
5901
  },
5902
+ get automationKeySchema() {
5903
+ return knownResponse(automationKeySchema);
5904
+ },
5905
+ get issuedAutomationKeySchema() {
5906
+ return knownResponse(issuedAutomationKeySchema);
5907
+ },
5558
5908
  get leaderboardPageSchema() {
5559
5909
  return knownResponse(leaderboardPageSchema);
5560
5910
  },
@@ -5956,6 +6306,9 @@ var managementResponses = lazyResponseReaders({
5956
6306
  get completionRevocationSchema() {
5957
6307
  return responseSchema(completionRevocationSchema);
5958
6308
  },
6309
+ get completionRestorationSchema() {
6310
+ return responseSchema(completionRestorationSchema);
6311
+ },
5959
6312
  get contentPerformancePageSchema() {
5960
6313
  return responseSchema(contentPerformancePageSchema);
5961
6314
  },
@@ -5980,6 +6333,9 @@ var managementResponses = lazyResponseReaders({
5980
6333
  get deploymentResultSchema() {
5981
6334
  return responseSchema(deploymentResultSchema);
5982
6335
  },
6336
+ get discordRoleRewardsSchema() {
6337
+ return responseSchema(discordRoleRewardsSchema);
6338
+ },
5983
6339
  get engagementBoundaryPageSchema() {
5984
6340
  return responseSchema(engagementBoundaryPageSchema);
5985
6341
  },
@@ -6031,6 +6387,12 @@ var managementResponses = lazyResponseReaders({
6031
6387
  get issuedServiceKeySchema() {
6032
6388
  return responseSchema(issuedServiceKeySchema);
6033
6389
  },
6390
+ get automationKeySchema() {
6391
+ return responseSchema(automationKeySchema);
6392
+ },
6393
+ get issuedAutomationKeySchema() {
6394
+ return responseSchema(issuedAutomationKeySchema);
6395
+ },
6034
6396
  get leaderboardPageSchema() {
6035
6397
  return responseSchema(leaderboardPageSchema);
6036
6398
  },
@@ -6317,6 +6679,9 @@ export {
6317
6679
  MemberImportRefusalCode,
6318
6680
  PayoutSourceKind,
6319
6681
  REFERRAL_INTEGRATION_REWARD_ERROR,
6682
+ RestoredDeliveryOutcome,
6683
+ RestoredEntitlementOutcome,
6684
+ RestoredReferralOutcome,
6320
6685
  RevokedDeliveryOutcome,
6321
6686
  RevokedEntitlementOutcome,
6322
6687
  RevokedReferralOutcome,
@@ -6353,6 +6718,7 @@ export {
6353
6718
  appScheduleRunSchema,
6354
6719
  appScheduleRunsSchema,
6355
6720
  appScheduleSchema,
6721
+ appScheduleStateInputSchema,
6356
6722
  appScheduleStateSchema,
6357
6723
  appSchedulesSchema,
6358
6724
  appSecretDeclarationSchema,
@@ -6377,6 +6743,9 @@ export {
6377
6743
  auditPageSchema,
6378
6744
  auditQuerySchema,
6379
6745
  auditRecordSchema,
6746
+ automationKeyInputSchema,
6747
+ automationKeyPermissionSchema,
6748
+ automationKeySchema,
6380
6749
  balanceCheckSchema,
6381
6750
  billingCheckoutInputSchema,
6382
6751
  billingIntervals,
@@ -6395,6 +6764,8 @@ export {
6395
6764
  capturedFactSchema,
6396
6765
  commitSchema,
6397
6766
  compareAppMigrations,
6767
+ completionRestorationSchema,
6768
+ completionRestoreSchema,
6398
6769
  completionRevocationSchema,
6399
6770
  completionRevocationShortfallSchema,
6400
6771
  completionRevokeSchema,
@@ -6428,6 +6799,7 @@ export {
6428
6799
  environmentSchema,
6429
6800
  grantRecordSchema,
6430
6801
  grantSchema,
6802
+ groupArchiveInputSchema,
6431
6803
  groupMemberPageSchema,
6432
6804
  groupMemberSchema,
6433
6805
  groupPageQuerySchema,
@@ -6456,6 +6828,7 @@ export {
6456
6828
  isIntegrationParticipantPath,
6457
6829
  isManagementError,
6458
6830
  isParticipantRoute,
6831
+ issuedAutomationKeySchema,
6459
6832
  issuedServiceKeySchema,
6460
6833
  issuedTokenSchema,
6461
6834
  leaderboardSettlementExportSchema,
@@ -6528,6 +6901,7 @@ export {
6528
6901
  metricsSchema,
6529
6902
  nextScheduleRun,
6530
6903
  oauthIdentitySelectorSchema,
6904
+ offeredStarterSchema,
6531
6905
  operationInputSchema,
6532
6906
  operationSchema,
6533
6907
  operatorUserSchema,
@@ -6544,6 +6918,7 @@ export {
6544
6918
  personSchema,
6545
6919
  pointLedgerPropertiesSchema,
6546
6920
  projectBillingSchema,
6921
+ projectCreateInputSchema,
6547
6922
  projectDeletionInputSchema,
6548
6923
  projectDeletionSchema,
6549
6924
  projectInputSchema,
@@ -6577,12 +6952,14 @@ export {
6577
6952
  referralRewardResolutionSchema,
6578
6953
  referralSuspensionSchema,
6579
6954
  removeGroupMemberSchema,
6955
+ repositoryCreateSchema,
6580
6956
  repositorySchema,
6581
6957
  resourceArchiveInputSchema,
6582
6958
  resourceLifecycleInputSchema,
6583
6959
  resourceLifecycleKindSchema,
6584
6960
  resourceLifecyclePaths,
6585
6961
  resourceLifecycleResultSchema,
6962
+ revokedCompletionSchema,
6586
6963
  rolePermissions,
6587
6964
  roleSchema,
6588
6965
  scheduleResult,
@@ -6590,6 +6967,7 @@ export {
6590
6967
  sequenceCursorSchema,
6591
6968
  serviceKeyInputSchema,
6592
6969
  serviceKeySchema,
6970
+ settlementPayoutCsv,
6593
6971
  sourceDataSchema,
6594
6972
  sourceRoles,
6595
6973
  stageRequestSchema,
@@ -6604,6 +6982,7 @@ export {
6604
6982
  stagingPathSchema,
6605
6983
  starterIdSchema,
6606
6984
  starterTemplates,
6985
+ starters,
6607
6986
  stockAdditionSchema,
6608
6987
  stockInputSchema,
6609
6988
  teamSchema,