@domino-sdk/relay 1.0.0-next.10 → 1.0.0-next.13

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/authoring.d.ts +39 -36
  2. package/dist/authoring.js +10 -3
  3. package/dist/avatar.d.ts +2 -2
  4. package/dist/browser.d.ts +153 -129
  5. package/dist/browser.js +6 -6
  6. package/dist/{pages-D3titw5B.d.ts → catalog-C85V1NgW.d.ts} +178 -216
  7. package/dist/{chunk-ZWY3R6B3.js → chunk-6A2V4L3T.js} +4 -0
  8. package/dist/{chunk-YYD4QUBO.js → chunk-CRNQP7NV.js} +550 -470
  9. package/dist/{chunk-X2F2RAR3.js → chunk-EZWNGI5B.js} +23 -4
  10. package/dist/{chunk-7Q4BGGT6.js → chunk-FXYJ4OMX.js} +1 -1
  11. package/dist/{chunk-4LBUTHD6.js → chunk-II7DRZSL.js} +1 -1
  12. package/dist/chunk-KS33GOUL.js +83 -0
  13. package/dist/{chunk-QR7ZA2BJ.js → chunk-M64XHC42.js} +48 -4
  14. package/dist/chunk-MNQI35OG.js +100 -0
  15. package/dist/{chunk-PHU5VDLR.js → chunk-OA2KMQVZ.js} +41 -26
  16. package/dist/{chunk-P6FK43GG.js → chunk-WQ24ILGO.js} +140 -41
  17. package/dist/{client-CT4-S5vc.d.ts → client-Bf9PNUIi.d.ts} +61 -80
  18. package/dist/deployments-CNCP0JnD.d.ts +4250 -0
  19. package/dist/identity-integration-CBR8l3ju.d.ts +37 -0
  20. package/dist/images-BG4pdO4y.d.ts +234 -0
  21. package/dist/index.d.ts +10 -8
  22. package/dist/index.js +8 -5
  23. package/dist/{integrations-Ba5TtqTv.d.ts → integrations-EjQzIApL.d.ts} +1 -88
  24. package/dist/internal.d.ts +7 -38
  25. package/dist/internal.js +15 -88
  26. package/dist/observations-CQ6IcNuQ.d.ts +90 -0
  27. package/dist/pages-KYK1L60W.d.ts +152 -0
  28. package/dist/portal-proxy.js +5 -4
  29. package/dist/{profiles-DDMFBRKe.d.ts → profiles-BtOXMGcC.d.ts} +1 -1
  30. package/dist/react/index.d.ts +150 -31
  31. package/dist/react/index.js +149 -11
  32. package/dist/{submission-input-0OOGaq8c.d.ts → referrals-KQfP4pBf.d.ts} +189 -182
  33. package/dist/request-error-VnTiMXc3.d.ts +52 -0
  34. package/dist/{schema-Di3aLSiK.d.ts → schema-BF_TQsmT.d.ts} +338 -47
  35. package/dist/schema.d.ts +14 -4126
  36. package/dist/schema.js +46 -40
  37. package/dist/server/index.d.ts +19445 -0
  38. package/dist/server/index.js +1884 -0
  39. package/dist/{streaks-CwGReWGt.d.ts → streaks-CWyq8Px5.d.ts} +2 -4
  40. package/dist/submission-input-CccwAl5Z.d.ts +83 -0
  41. package/dist/{images-BTgk6OmC.d.ts → trackers-W7nRdRr7.d.ts} +1 -232
  42. package/dist/vite.d.ts +1 -1
  43. package/dist/vite.js +1 -0
  44. package/dist/{wallet-BGOfFkG9.d.ts → wallet-BtiG0Xhr.d.ts} +1 -1
  45. package/package.json +5 -1
  46. package/dist/point-ledgers-iS00Z_v0.d.ts +0 -37
@@ -0,0 +1,1884 @@
1
+ import {
2
+ deploymentPreviewSchema,
3
+ deploymentResultSchema,
4
+ projectDeploymentSchema,
5
+ publishDeploymentSchema
6
+ } from "../chunk-KS33GOUL.js";
7
+ import {
8
+ identityIntegrationInputSchema,
9
+ identityIntegrationSchema,
10
+ identityIntegrationSecretSchema
11
+ } from "../chunk-MNQI35OG.js";
12
+ import {
13
+ imageAssetArtifactSchema
14
+ } from "../chunk-II7DRZSL.js";
15
+ import "../chunk-6A2V4L3T.js";
16
+ import {
17
+ allocateQuestSchema,
18
+ allocatedQuestSchema,
19
+ catalogDeploymentPreviewSchema,
20
+ catalogDeploymentSchema,
21
+ collectionBeginSchema,
22
+ collectionPreviewSchema,
23
+ collectionResolveSchema,
24
+ createPointLedgerSchema,
25
+ pointLedgerSchema,
26
+ publishQuestDraftSchema,
27
+ questCatalogSchema,
28
+ questDraftSchema,
29
+ questPublicationPreviewSchema,
30
+ rewardDeliveriesSchema,
31
+ rewardDeliverySchema,
32
+ saveQuestDraftSchema
33
+ } from "../chunk-M64XHC42.js";
34
+ import {
35
+ RequestError,
36
+ engagementBoundaryPageSchema,
37
+ engagementChangePreviewInputSchema,
38
+ engagementChangePreviewSchema,
39
+ engagementChangeSchema,
40
+ engagementPageQuerySchema,
41
+ engagementPageSchema,
42
+ engagementPublishSchema,
43
+ engagementRuleSchema,
44
+ engagementVersionPageSchema,
45
+ engagementVersionQuerySchema,
46
+ evmChainIdSchema,
47
+ isRequestError,
48
+ leaderboardExclusionSchema,
49
+ leaderboardGroupSchema,
50
+ leaderboardPageSchema,
51
+ leaderboardQuerySchema,
52
+ linkedWalletSchema,
53
+ managedProfileSchema,
54
+ pointsAccountSchema,
55
+ pointsEntrySchema,
56
+ pointsMutationSchema,
57
+ pointsResultSchema,
58
+ profileModerationSchema,
59
+ profileSettingsInputSchema,
60
+ profileSettingsSchema,
61
+ publishedLeaderboardSchema,
62
+ publishedReferralSchema,
63
+ referralControlSchema,
64
+ referralHistorySchema,
65
+ referralManagementSchema,
66
+ solanaBalanceSchema,
67
+ solanaMainnet,
68
+ walletBalanceSchema,
69
+ walletConnectionSchema,
70
+ walletSignInNetworksSchema,
71
+ walletUnlinkInputSchema
72
+ } from "../chunk-OA2KMQVZ.js";
73
+ import "../chunk-FXYJ4OMX.js";
74
+ import {
75
+ attemptSchema,
76
+ authProviderSchema,
77
+ beginHandoverSchema,
78
+ configurePickupSchema,
79
+ confirmHandoverSchema,
80
+ contentAdmissionPageSchema,
81
+ contentAdmissionQuerySchema,
82
+ contentAdmissionSchema,
83
+ contentEnrollmentInputSchema,
84
+ contentEnrollmentSchema,
85
+ contentPerformancePageSchema,
86
+ contentPerformanceQuerySchema,
87
+ contentQualificationPageSchema,
88
+ contentQualificationQuerySchema,
89
+ contentReleaseInputSchema,
90
+ createStockItemSchema,
91
+ entitlementSchema,
92
+ identifier,
93
+ memberProgressSchema,
94
+ observationInputSchema,
95
+ observationReceiptSchema,
96
+ pickupAvailabilitySchema,
97
+ pickupCatalogSchema,
98
+ projectCalendarInputSchema,
99
+ projectCalendarSchema,
100
+ publishedReleaseSchema,
101
+ questSettingsInputSchema,
102
+ snapshotSchema,
103
+ staffDecisionSchema,
104
+ stockItemSchema,
105
+ submitSchema,
106
+ trackerContentReadSchema,
107
+ trackerContentSchema,
108
+ trackerControlSchema,
109
+ trackerIngestResultSchema,
110
+ trackerIngestSchema,
111
+ trackerOutcomePageSchema,
112
+ trackerOutcomeQuerySchema,
113
+ trackerOutcomeRetrySchema,
114
+ trackerOutcomeSchema,
115
+ trackerPageSchema,
116
+ trackerPreviewInputSchema,
117
+ trackerPreviewSchema,
118
+ trackerQuerySchema,
119
+ trackerStatusSchema,
120
+ trackerSummarySchema
121
+ } from "../chunk-CRNQP7NV.js";
122
+
123
+ // src/server/index.ts
124
+ import { z as z5 } from "zod";
125
+
126
+ // src/server/errors.ts
127
+ var ManagementErrorCode = {
128
+ /** The input or an option failed validation before anything was sent (kind `client`). */
129
+ InvalidInput: "invalid-input",
130
+ /** The client's `getToken` failed before anything was sent (kind `client` or `network`). */
131
+ Credential: "credential",
132
+ Network: "network",
133
+ Timeout: "timeout",
134
+ Aborted: "aborted",
135
+ InvalidResponse: "invalid-response"
136
+ };
137
+ var uncertainStatuses = /* @__PURE__ */ new Set([500, 502, 504]);
138
+ function uncertainOutcome(init) {
139
+ if (init.method === void 0 || init.method === "GET") {
140
+ return false;
141
+ }
142
+ switch (init.kind) {
143
+ case "network":
144
+ case "timeout":
145
+ case "aborted":
146
+ return true;
147
+ case "http":
148
+ return uncertainStatuses.has(init.status ?? 0);
149
+ case "invalid-response":
150
+ return (init.status ?? 0) >= 200 && (init.status ?? 0) < 300;
151
+ default:
152
+ return false;
153
+ }
154
+ }
155
+ var managementErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.ManagementError");
156
+ function isManagementError(value) {
157
+ return isRequestError(value) && value[managementErrorBrand] === true;
158
+ }
159
+ var ManagementError = class extends RequestError {
160
+ name = "ManagementError";
161
+ [managementErrorBrand] = true;
162
+ /** The rest of the server's error body besides `error` and `code`, such as `moved`; absent when there is none. */
163
+ details;
164
+ /** The request's method; absent when the call failed before forming a request. */
165
+ method;
166
+ /** The management API path, below `/management/v1`, without its query; absent like `method`. */
167
+ path;
168
+ constructor(init) {
169
+ super(init.message, {
170
+ kind: init.kind,
171
+ uncertain: init.uncertain ?? uncertainOutcome(init),
172
+ status: init.status,
173
+ code: init.code,
174
+ operationId: init.actionId,
175
+ cause: init.cause
176
+ });
177
+ this.details = init.details && Object.keys(init.details).length ? init.details : void 0;
178
+ this.method = init.method;
179
+ this.path = init.path;
180
+ }
181
+ };
182
+ var DEFAULT_MANAGEMENT_TIMEOUT = 3e4;
183
+
184
+ // src/server/hosting.ts
185
+ import { z as z2 } from "zod";
186
+
187
+ // src/server/starters.ts
188
+ import { z } from "zod";
189
+ var starterTemplates = [
190
+ {
191
+ id: "campaign",
192
+ title: "Campaign tour",
193
+ summary: "A neutral quest app with a guided tour of every quest kind. The blank canvas for anything."
194
+ },
195
+ {
196
+ id: "classic",
197
+ title: "Classic questboard",
198
+ summary: "The familiar Domino portal: quests in a grid grouped by section, a claim page, points, and a leaderboard."
199
+ },
200
+ {
201
+ id: "waitlist",
202
+ title: "Waitlist",
203
+ summary: "Collect sign-ups before launch. People move up the line by inviting friends."
204
+ },
205
+ {
206
+ id: "referral",
207
+ title: "Referral program",
208
+ summary: "Give every member an invite link and reward them when friends join and qualify."
209
+ },
210
+ {
211
+ id: "discord",
212
+ title: "Discord activation",
213
+ summary: "Turn new Discord members into regulars with quests for joining, introducing themselves, and taking part, rewarded with roles."
214
+ },
215
+ {
216
+ id: "api",
217
+ title: "API",
218
+ summary: "A headless Worker with typed routes and interactive API docs, for plugging Domino into your own product."
219
+ }
220
+ ];
221
+ var starterIdSchema = z.enum(
222
+ starterTemplates.map((template) => template.id)
223
+ );
224
+
225
+ // src/server/hosting.ts
226
+ var outputPathSchema = z2.string().min(1).max(512).refine(
227
+ (path) => path.split("/").every(
228
+ (part) => /^[\w-][\w.-]*$/.test(part) && part !== "node_modules"
229
+ ),
230
+ "Expected a relative build output path without hidden segments"
231
+ );
232
+ var appRoutingSchema = z2.enum(["legacy", "transparent"]).default("legacy");
233
+ var APP_SECRET_LIMIT = 50;
234
+ var appSecretNameSchema = z2.string().regex(
235
+ /^[A-Z_][A-Z0-9_]{0,63}$/,
236
+ "Use 1-64 uppercase letters, digits, and underscores, not starting with a digit"
237
+ ).refine(
238
+ (name) => !name.startsWith("DOMINO_") && name !== "ASSETS",
239
+ "DOMINO_ names and ASSETS are reserved for Domino's own bindings"
240
+ );
241
+ var appSecretValueSchema = z2.string().min(1).refine(
242
+ (value) => new TextEncoder().encode(value).length <= 5120,
243
+ "Secret values can be at most 5 KiB"
244
+ );
245
+ var appSecretInputSchema = z2.object({ value: appSecretValueSchema }).strict();
246
+ var appSecretSchema = z2.object({
247
+ name: appSecretNameSchema,
248
+ updatedAt: z2.number(),
249
+ updatedBy: z2.string()
250
+ });
251
+ var appSecretDeclarationSchema = z2.object({
252
+ description: z2.string().trim().min(1).max(500),
253
+ required: z2.boolean().default(true)
254
+ }).strict();
255
+ var appSecretDeclarationsSchema = z2.record(appSecretNameSchema, appSecretDeclarationSchema).refine(
256
+ (secrets) => Object.keys(secrets).length <= APP_SECRET_LIMIT,
257
+ `Declare at most ${APP_SECRET_LIMIT} app secrets`
258
+ );
259
+ var appSecretListSchema = z2.object({
260
+ secrets: z2.array(appSecretSchema),
261
+ declared: z2.array(appSecretDeclarationSchema.extend({ name: appSecretNameSchema })).default([])
262
+ });
263
+ var hostedAppSecretsSchema = z2.object({ secrets: z2.record(appSecretNameSchema, appSecretValueSchema) }).strict();
264
+ var appScripts = {
265
+ routing: appRoutingSchema,
266
+ devScript: z2.string().regex(/^[\w:-]+$/),
267
+ checkScript: z2.string().regex(/^[\w:-]+$/),
268
+ buildScript: z2.string().regex(/^[\w:-]+$/)
269
+ };
270
+ var workerSettings = {
271
+ runWorkerFirst: z2.boolean().default(false),
272
+ main: outputPathSchema.refine(
273
+ (path) => /\.m?js$/.test(path),
274
+ "Expected a compiled JavaScript entry"
275
+ ),
276
+ compatibilityDate: z2.string().regex(/^\d{4}-\d{2}-\d{2}$/),
277
+ compatibilityFlags: z2.array(z2.string().min(1)).max(50).default([]),
278
+ vars: z2.record(
279
+ z2.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).refine((name) => name !== "ASSETS"),
280
+ z2.string()
281
+ ).default({}),
282
+ secrets: appSecretDeclarationsSchema.default({})
283
+ };
284
+ var distinctBindings = (worker) => !Object.keys(worker.secrets).some((name) => name in worker.vars);
285
+ var distinctBindingsMessage = {
286
+ message: "A name can't be both an app var and a declared secret",
287
+ path: ["secrets"]
288
+ };
289
+ var hostedAppSchema = z2.discriminatedUnion("kind", [
290
+ z2.object({
291
+ kind: z2.literal("static"),
292
+ directory: outputPathSchema,
293
+ ...appScripts
294
+ }).strict(),
295
+ z2.object({
296
+ kind: z2.literal("worker"),
297
+ directory: outputPathSchema,
298
+ assetsDirectory: outputPathSchema.optional(),
299
+ ...appScripts,
300
+ ...workerSettings
301
+ }).strict().refine(distinctBindings, distinctBindingsMessage)
302
+ ]);
303
+ var repositorySchema = z2.object({
304
+ id: z2.string().uuid(),
305
+ organization: identifier,
306
+ project: identifier,
307
+ remote: z2.string().url(),
308
+ defaultBranch: z2.string(),
309
+ status: z2.enum(["provisioning", "ready"])
310
+ });
311
+ var createRepositorySchema = z2.object({
312
+ /** Omitted: the starter chosen at project setup, else `campaign`. */
313
+ starter: starterIdSchema.optional()
314
+ }).strict();
315
+ var deviceStartSchema = z2.object({
316
+ challenge: z2.string().regex(/^[a-f0-9]{64}$/)
317
+ }).strict();
318
+ var deviceRedeemSchema = z2.object({
319
+ id: z2.string().uuid(),
320
+ verifier: z2.string().min(43).max(128)
321
+ }).strict();
322
+ var deviceApproveSchema = z2.object({
323
+ id: z2.string().uuid(),
324
+ code: z2.string().regex(/^[A-F0-9]{4}-[A-F0-9]{4}$/)
325
+ }).strict();
326
+ var commitSchema = z2.string().regex(/^[a-f0-9]{40}$/);
327
+ var stageRequestSchema = z2.object({
328
+ commit: commitSchema,
329
+ requestId: z2.string().uuid()
330
+ }).strict();
331
+ var buildIdentitySchema = z2.object({
332
+ routing: appRoutingSchema,
333
+ slug: z2.string().min(1).max(35).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).optional(),
334
+ runtime: z2.enum(["simulation", "hosted-test"]).default("simulation"),
335
+ id: z2.string().uuid(),
336
+ repository: z2.string().uuid(),
337
+ organization: identifier,
338
+ project: identifier,
339
+ commit: commitSchema,
340
+ createdAt: z2.number(),
341
+ actor: z2.string(),
342
+ commitMessage: z2.string().max(500).optional()
343
+ });
344
+ var buildPhaseSchema = z2.enum([
345
+ "queued",
346
+ "source",
347
+ "install",
348
+ "check",
349
+ "build",
350
+ "deploy",
351
+ "ready",
352
+ "failed"
353
+ ]);
354
+ var buildStatusSchema = z2.object({
355
+ phase: buildPhaseSchema,
356
+ failedPhase: buildPhaseSchema.optional(),
357
+ updatedAt: z2.number(),
358
+ message: z2.string()
359
+ });
360
+ var hostedBuildSchema = buildIdentitySchema.extend({
361
+ ...buildStatusSchema.shape,
362
+ finished: z2.boolean(),
363
+ current: z2.boolean(),
364
+ stagingUrl: z2.string().url()
365
+ });
366
+ var stagingAccessModeSchema = z2.enum(["console", "password"]);
367
+ var stagingAccessSchema = z2.object({ mode: stagingAccessModeSchema });
368
+ var stagingAccessInputSchema = z2.discriminatedUnion("mode", [
369
+ z2.object({ mode: z2.literal("console") }).strict(),
370
+ z2.object({
371
+ mode: z2.literal("password"),
372
+ password: z2.string().min(8).max(128)
373
+ }).strict()
374
+ ]);
375
+ var stagingPathSchema = z2.string().max(2048).refine(
376
+ (path) => path.startsWith("/") && !path.startsWith("//") && !path.includes("\\"),
377
+ "Expected a path on the staging host"
378
+ );
379
+ var stagingLinkSchema = z2.object({
380
+ url: z2.string().url(),
381
+ expiresAt: z2.number()
382
+ });
383
+ var buildSnapshotSchema = z2.object({
384
+ builds: z2.array(hostedBuildSchema),
385
+ current: hostedBuildSchema.nullable(),
386
+ selected: hostedBuildSchema.nullable(),
387
+ logs: z2.string()
388
+ });
389
+ var assetPathSchema = z2.string().max(512).refine(
390
+ (path) => path.startsWith("/") && // oxlint-disable-next-line no-control-regex -- Asset paths must reject control characters.
391
+ !/[\\\u0000-\u001f?#%]/.test(path) && path.slice(1).split("/").every((part) => part.length > 0 && !part.startsWith(".")),
392
+ "Expected a public asset path without hidden segments"
393
+ );
394
+ var base64Schema = z2.string().regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/);
395
+ var stagedDeploymentLimits = {
396
+ /** Bytes of JSON, uncompressed. */
397
+ size: 64e6,
398
+ /** Bytes of the Brotli-compressed object. */
399
+ compressedSize: 1e7
400
+ };
401
+ var stagedDeploymentSchema = z2.object({
402
+ encoding: z2.literal("br"),
403
+ sha256: z2.string().regex(/^[0-9a-f]{64}$/),
404
+ compressedSize: z2.number().int().positive().max(stagedDeploymentLimits.compressedSize),
405
+ size: z2.number().int().positive().max(stagedDeploymentLimits.size)
406
+ }).strict();
407
+ var stagedDeploymentContentSchema = stagedDeploymentSchema.extend({
408
+ content: z2.string().max(Math.ceil(stagedDeploymentLimits.compressedSize / 3) * 4)
409
+ }).strict();
410
+ var stagedDeploymentKey = (build, sha256) => `builds/${build}/deployment/${sha256}.br`;
411
+ var artifactFields = {
412
+ routing: appRoutingSchema,
413
+ worker: z2.object({
414
+ ...workerSettings,
415
+ modules: z2.array(
416
+ z2.object({
417
+ path: outputPathSchema.refine((path) => path !== "metadata"),
418
+ type: z2.enum([
419
+ "application/javascript+module",
420
+ "application/wasm",
421
+ "text/plain",
422
+ "application/octet-stream"
423
+ ]),
424
+ content: base64Schema.max(14e6)
425
+ }).strict()
426
+ ).min(1).max(500)
427
+ }).strict().refine(distinctBindings, distinctBindingsMessage).optional(),
428
+ assets: z2.array(
429
+ z2.object({
430
+ path: assetPathSchema,
431
+ content: base64Schema.max(14e6),
432
+ size: z2.number().int().min(0).max(1e7)
433
+ }).strict()
434
+ ).max(500)
435
+ };
436
+ var buildArtifactsSchema = z2.discriminatedUnion("format", [
437
+ z2.object({
438
+ format: z2.literal(1),
439
+ ...artifactFields,
440
+ quests: z2.unknown(),
441
+ catalog: z2.unknown()
442
+ }).strict(),
443
+ z2.object({
444
+ format: z2.literal(2),
445
+ ...artifactFields,
446
+ deployment: stagedDeploymentSchema,
447
+ images: z2.array(imageAssetArtifactSchema).max(10)
448
+ }).strict()
449
+ ]).superRefine((value, ctx) => {
450
+ if (value.worker) {
451
+ const modules = value.worker.modules;
452
+ if (new Set(modules.map((m) => m.path)).size !== modules.length) {
453
+ ctx.addIssue({
454
+ code: "custom",
455
+ message: "Duplicate Worker module paths"
456
+ });
457
+ }
458
+ if (!modules.some(
459
+ (m) => m.path === value.worker?.main && m.type === "application/javascript+module"
460
+ )) {
461
+ ctx.addIssue({
462
+ code: "custom",
463
+ message: "Worker entry module is missing"
464
+ });
465
+ }
466
+ if (modules.reduce(
467
+ (sum, m) => sum + m.content.length * 3 / 4 - (m.content.endsWith("==") ? 2 : m.content.endsWith("=") ? 1 : 0),
468
+ 0
469
+ ) > 1e7) {
470
+ ctx.addIssue({
471
+ code: "custom",
472
+ message: "Worker modules exceed 10 MB"
473
+ });
474
+ }
475
+ }
476
+ if (new Set(value.assets.map((a) => a.path)).size !== value.assets.length) {
477
+ ctx.addIssue({ code: "custom", message: "Duplicate asset paths" });
478
+ }
479
+ if (!value.worker && !value.assets.some((a) => a.path === "/index.html")) {
480
+ ctx.addIssue({
481
+ code: "custom",
482
+ message: "Build must include index.html"
483
+ });
484
+ }
485
+ if (value.assets.reduce((sum, a) => sum + a.size, 0) > 1e7) {
486
+ ctx.addIssue({ code: "custom", message: "Staging assets exceed 10 MB" });
487
+ }
488
+ });
489
+
490
+ // src/server/development.ts
491
+ import { z as z3 } from "zod";
492
+ var developmentPreflightSchema = z3.object({
493
+ organization: z3.string(),
494
+ project: z3.string(),
495
+ environment: z3.enum(["test", "live"]),
496
+ identity: z3.object({
497
+ exchange: z3.literal("supported"),
498
+ activeIntegrations: z3.number().int().nonnegative()
499
+ }).optional(),
500
+ staging: z3.enum(["configured", "blocked"]),
501
+ development: z3.object({
502
+ status: z3.enum(["configured", "blocked"]),
503
+ // How `domino dev` reaches the preview origin: a Cloudflare tunnel, or a direct route on a
504
+ // local development stack. APIs that predate the field use tunnels.
505
+ transport: z3.enum(["tunnel", "direct"]).default("tunnel"),
506
+ missing: z3.array(z3.string()),
507
+ authentication: z3.array(z3.string())
508
+ }),
509
+ checks: z3.array(
510
+ z3.object({
511
+ id: z3.string(),
512
+ status: z3.enum(["ok", "error"]),
513
+ message: z3.string(),
514
+ missing: z3.array(z3.string()).optional(),
515
+ issues: z3.array(z3.string()).optional()
516
+ })
517
+ )
518
+ });
519
+
520
+ // src/server/hosted.ts
521
+ import { z as z4 } from "zod";
522
+ var hostedKeyPermissions = ["read", "points", "ingest"];
523
+ var hostedKeyPermissionList = z4.array(z4.string()).transform(
524
+ (values) => values.filter(
525
+ (value) => hostedKeyPermissions.includes(value)
526
+ )
527
+ );
528
+ var hostedManagementBindings = [
529
+ "DOMINO_MANAGEMENT_KEY",
530
+ "DOMINO_API_URL",
531
+ "DOMINO_ORGANIZATION",
532
+ "DOMINO_PROJECT",
533
+ "DOMINO_ENVIRONMENT"
534
+ ];
535
+ var hostedKeySecretSchema = z4.string().regex(/^dhk_[A-Za-z0-9_-]{43}$/, "Expected a hosted app key");
536
+ var hostedKeySchema = z4.object({
537
+ id: z4.string().uuid(),
538
+ token: hostedKeySecretSchema,
539
+ organization: identifier,
540
+ project: identifier,
541
+ environment: z4.enum(["test", "live"]),
542
+ permissions: hostedKeyPermissionList,
543
+ expiresAt: z4.number().nullable()
544
+ }).strict();
545
+ var hostedDeploymentKeySchema = hostedKeySchema.extend({ apiUrl: z4.string().url() }).strict();
546
+ function hostedManagementClient(env) {
547
+ const missing = hostedManagementBindings.filter((name) => !env[name]);
548
+ if (missing.length) {
549
+ throw new Error(
550
+ `Missing ${missing.join(", ")}. Domino sets these for hosted apps and domino dev; update the project's vite.config.ts to forward them in development.`
551
+ );
552
+ }
553
+ const environment = z4.enum(["test", "live"]).parse(env.DOMINO_ENVIRONMENT);
554
+ const token = env.DOMINO_MANAGEMENT_KEY;
555
+ return createManagementClient({
556
+ baseUrl: env.DOMINO_API_URL.replace(/\/+$/, ""),
557
+ getToken: async () => token,
558
+ organization: env.DOMINO_ORGANIZATION,
559
+ project: env.DOMINO_PROJECT,
560
+ environment
561
+ });
562
+ }
563
+
564
+ // src/server/index.ts
565
+ var environmentSchema = z5.enum(["test", "live"]);
566
+ var roleSchema = z5.enum(["editor", "reviewer", "staff"]);
567
+ var permissionSchema = z5.enum([
568
+ "read",
569
+ "publish",
570
+ "review",
571
+ "confirm",
572
+ "handover",
573
+ "inventory",
574
+ "access",
575
+ "points",
576
+ "observe",
577
+ /**
578
+ * Custom tracker ingestion only (`trackers.ingest`), such as for an indexer's key. Editors and
579
+ * hosted-app keys hold it. `observe` also allows ingestion, so keys issued with only `observe`
580
+ * keep ingesting.
581
+ */
582
+ "ingest"
583
+ ]);
584
+ var permissionListSchema = z5.array(z5.string()).transform(
585
+ (values) => values.filter(
586
+ (value) => permissionSchema.safeParse(value).success
587
+ )
588
+ );
589
+ var rolePermissions = {
590
+ editor: ["read", "publish", "inventory", "points", "observe", "ingest"],
591
+ reviewer: ["read", "review"],
592
+ staff: ["read", "confirm", "handover"]
593
+ };
594
+ var projectSetupSchema = z5.object({
595
+ mode: z5.enum(["new", "existing"]),
596
+ brief: z5.string().trim().min(1).max(4e3)
597
+ }).strict();
598
+ var projectSchema = z5.object({
599
+ slug: z5.string().min(1).max(35).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
600
+ /** A response, so fields a newer server adds to the setup are dropped, not rejected. */
601
+ setup: z5.object(projectSetupSchema.shape).optional(),
602
+ /** The starter chosen at setup. A plain string, so later starters still parse. */
603
+ starter: z5.string().optional(),
604
+ id: z5.string().min(1),
605
+ organization: identifier,
606
+ project: identifier,
607
+ name: z5.string(),
608
+ subtitle: z5.string(),
609
+ initials: z5.string(),
610
+ color: z5.string(),
611
+ permissions: permissionListSchema,
612
+ environments: z5.array(environmentSchema)
613
+ });
614
+ var projectInputSchema = z5.object({
615
+ actionId: identifier,
616
+ name: z5.string().trim().min(1).max(80),
617
+ setup: projectSetupSchema.optional(),
618
+ /** The starter a new hosted app begins from, with `setup.mode` "new". */
619
+ starter: starterIdSchema.optional()
620
+ }).strict();
621
+ var projectDeletionInputSchema = z5.object({ confirm: z5.string().min(1).max(80) }).strict();
622
+ var projectDeletionSchema = z5.object({
623
+ project: identifier,
624
+ purgeAfter: z5.number().int()
625
+ });
626
+ var projectTransferInputSchema = z5.object({ organization: identifier, confirm: z5.string().min(1).max(80) }).strict();
627
+ var projectTransferSchema = z5.object({
628
+ organization: identifier,
629
+ project: identifier
630
+ });
631
+ var grantSchema = z5.object({
632
+ subject: z5.string().min(1).max(200),
633
+ roles: z5.array(roleSchema),
634
+ environments: z5.array(environmentSchema)
635
+ }).strict();
636
+ var grantRecordSchema = z5.object(grantSchema.shape);
637
+ var stockAdditionSchema = z5.object({
638
+ item: identifier,
639
+ quantity: z5.number().int(),
640
+ actionId: identifier
641
+ });
642
+ var [availableEntitlement, handingOverEntitlement, collectedEntitlement] = entitlementSchema.options;
643
+ var entitlementRecordSchema = z5.discriminatedUnion("status", [
644
+ z5.object(availableEntitlement.shape),
645
+ z5.object(handingOverEntitlement.shape),
646
+ z5.object(collectedEntitlement.shape)
647
+ ]);
648
+ var accessSchema = z5.object({
649
+ actor: z5.string(),
650
+ organization: z5.string(),
651
+ admin: z5.boolean(),
652
+ local: z5.boolean(),
653
+ projects: z5.array(projectSchema)
654
+ });
655
+ var querySchema = z5.object({
656
+ q: z5.string().max(200).default(""),
657
+ filter: z5.string().max(50).default("all"),
658
+ offset: z5.coerce.number().int().min(0).max(1e6).default(0),
659
+ limit: z5.coerce.number().int().min(1).max(100).default(25)
660
+ });
661
+ var accountProfileSchema = z5.object({
662
+ name: z5.string().optional(),
663
+ /** The account's handle, where the provider has one (X and Discord). */
664
+ username: z5.string().optional(),
665
+ email: z5.string().optional(),
666
+ emailVerified: z5.boolean().default(false),
667
+ imageUrl: z5.string().url().optional()
668
+ });
669
+ var memberAccountSchema = z5.object({
670
+ /**
671
+ * `wallet` for a wallet the member signs in with (listed with the member's wallets), `account`
672
+ * for any other sign-in or connected account. Older servers omit it: it then reads `account`.
673
+ */
674
+ kind: z5.enum(["account", "wallet"]).default("account"),
675
+ provider: z5.string(),
676
+ subject: z5.string(),
677
+ signInEnabled: z5.boolean(),
678
+ profile: accountProfileSchema.optional()
679
+ });
680
+ var operationSchema = z5.object({
681
+ target: z5.string(),
682
+ paused: z5.boolean(),
683
+ revision: z5.number().int(),
684
+ reason: z5.string(),
685
+ actor: z5.string().nullable(),
686
+ changedAt: z5.number()
687
+ });
688
+ var operationInputSchema = z5.object({
689
+ target: z5.union([
690
+ z5.literal("redemptions"),
691
+ z5.string().regex(/^quest:[\w-]+$/)
692
+ ]),
693
+ paused: z5.boolean(),
694
+ revision: z5.number().int().nonnegative(),
695
+ reason: z5.string().trim().min(1).max(500),
696
+ actionId: identifier
697
+ }).strict();
698
+ var questLifecycleInputSchema = z5.object({
699
+ quest: identifier,
700
+ expectedRelease: identifier.optional(),
701
+ archived: z5.boolean(),
702
+ reason: z5.string().trim().min(1).max(500),
703
+ actionId: identifier
704
+ }).strict();
705
+ var questLifecycleSchema = z5.object({
706
+ quest: identifier,
707
+ key: identifier.nullable(),
708
+ title: z5.string(),
709
+ release: identifier,
710
+ lifecycle: z5.enum(["active", "paused", "archived"]),
711
+ changed: z5.boolean()
712
+ });
713
+ var memberSchema = z5.object({
714
+ id: z5.string(),
715
+ accounts: z5.array(memberAccountSchema).default([]),
716
+ attempts: z5.number(),
717
+ completions: z5.number(),
718
+ rewards: z5.number(),
719
+ lastActivity: z5.number().nullable()
720
+ });
721
+ var personSchema = z5.object({
722
+ id: z5.string(),
723
+ accounts: z5.array(memberAccountSchema).default([])
724
+ });
725
+ var metricsSchema = z5.object({
726
+ quests: z5.number(),
727
+ members: z5.number(),
728
+ attempts: z5.number(),
729
+ completions: z5.number(),
730
+ review: z5.number(),
731
+ failed: z5.number(),
732
+ entitlements: z5.number()
733
+ });
734
+ var readinessSchema = z5.object({
735
+ checks: z5.array(
736
+ z5.object({
737
+ id: z5.string(),
738
+ status: z5.enum(["ready", "blocked"]),
739
+ title: z5.string(),
740
+ detail: z5.string()
741
+ })
742
+ )
743
+ });
744
+ var inventorySchema = z5.object({
745
+ item: z5.string(),
746
+ name: z5.string().nullable().default(null),
747
+ available: z5.number(),
748
+ reserved: z5.number(),
749
+ allocated: z5.number().default(0)
750
+ });
751
+ var auditRecordSchema = z5.object({
752
+ id: z5.string(),
753
+ action: z5.string(),
754
+ actor: z5.string().nullable(),
755
+ detail: z5.string(),
756
+ at: z5.number(),
757
+ attempt: z5.string().nullable()
758
+ });
759
+ var pageSchema = z5.object({
760
+ snapshot: snapshotSchema,
761
+ members: z5.array(memberSchema),
762
+ people: z5.array(personSchema).default([]),
763
+ metrics: metricsSchema,
764
+ total: z5.number(),
765
+ offset: z5.number(),
766
+ limit: z5.number(),
767
+ inventory: z5.array(inventorySchema),
768
+ operations: z5.array(operationSchema).default([]),
769
+ audit: z5.array(auditRecordSchema).default([]),
770
+ questCounts: z5.record(z5.string(), z5.number())
771
+ });
772
+ var managedWalletSchema = linkedWalletSchema.extend({
773
+ status: z5.enum(["linked", "unlinked"]),
774
+ unlinkedAt: z5.number().int().nullable(),
775
+ /** "member", or the operator or key that unlinked it. */
776
+ unlinkedBy: z5.string().nullable()
777
+ });
778
+ var balanceCheckSchema = walletBalanceSchema.pick({
779
+ chain: true,
780
+ token: true,
781
+ decimals: true,
782
+ total: true,
783
+ wallets: true,
784
+ observedAt: true
785
+ }).extend({ attempt: identifier });
786
+ var walletBalanceChainsSchema = z5.object({
787
+ chains: z5.array(
788
+ z5.object({
789
+ chain: z5.union([z5.literal(solanaMainnet), evmChainIdSchema]),
790
+ name: z5.string(),
791
+ testnet: z5.boolean()
792
+ })
793
+ )
794
+ });
795
+ var memberWalletUnlinkInputSchema = walletUnlinkInputSchema.extend({ reason: z5.string().trim().min(1).max(500) }).strict();
796
+ var memberWalletSignInInputSchema = walletUnlinkInputSchema.extend({
797
+ enabled: z5.boolean(),
798
+ reason: z5.string().trim().min(1).max(500)
799
+ }).strict();
800
+ var participantSignInSchema = z5.object({
801
+ providers: z5.array(
802
+ z5.object({ provider: authProviderSchema, configured: z5.boolean() })
803
+ ),
804
+ email: z5.boolean(),
805
+ /** Wallet families: `"solana"`, `"eip155"`, `"cosmos"`. */
806
+ wallets: walletSignInNetworksSchema,
807
+ /** Why participants cannot sign in to this project, or null. */
808
+ issue: z5.string().nullable(),
809
+ updatedAt: z5.number().nullable(),
810
+ updatedBy: z5.string().nullable()
811
+ });
812
+ var participantSignInInputSchema = z5.object({
813
+ wallets: z5.array(z5.string()).max(4).refine(
814
+ (value) => new Set(value).size === value.length,
815
+ "Duplicate wallet network"
816
+ ).pipe(walletSignInNetworksSchema)
817
+ }).strict();
818
+ var memberDetailSchema = z5.object({
819
+ snapshot: snapshotSchema,
820
+ member: memberSchema,
821
+ progress: memberProgressSchema,
822
+ passes: z5.array(
823
+ z5.object({
824
+ provider: z5.string(),
825
+ event: z5.string(),
826
+ subject: z5.string(),
827
+ attempt: identifier.nullable()
828
+ })
829
+ ).default([]),
830
+ wallet: z5.object({
831
+ connection: walletConnectionSchema.nullable(),
832
+ observation: z5.object({ attempt: identifier, balance: solanaBalanceSchema }).nullable()
833
+ }).default({ connection: null, observation: null }),
834
+ /** Linked and unlinked wallets; `wallet` keeps the legacy newest-Solana view for older clients. */
835
+ wallets: z5.array(managedWalletSchema).default([]),
836
+ /** The member's 10 most recent recorded balance reads, newest first. */
837
+ balanceChecks: z5.array(balanceCheckSchema).default([]),
838
+ /** The member's participant profile in this project; older servers omit it. */
839
+ profile: managedProfileSchema.nullable().default(null)
840
+ });
841
+ var stockInputSchema = z5.object({
842
+ item: identifier,
843
+ quantity: z5.number().int().positive().max(1e6),
844
+ actionId: identifier
845
+ }).strict();
846
+ var tokenInputSchema = z5.object({
847
+ name: z5.string().trim().min(1).max(80),
848
+ project: identifier,
849
+ environment: environmentSchema,
850
+ permissions: z5.array(permissionSchema).min(1),
851
+ days: z5.number().int().min(1).max(90).default(30)
852
+ }).strict();
853
+ var tokenSchema = z5.object({
854
+ id: z5.string(),
855
+ name: z5.string(),
856
+ project: z5.string(),
857
+ environment: environmentSchema,
858
+ permissions: permissionListSchema,
859
+ expiresAt: z5.number()
860
+ });
861
+ var issuedTokenSchema = tokenSchema.extend({ token: z5.string() });
862
+ var teamSchema = z5.array(
863
+ z5.object({ id: z5.string(), label: z5.string() })
864
+ );
865
+ var memberLookupSchema = z5.object({
866
+ provider: z5.string().min(1).max(200),
867
+ subject: z5.string().min(1).max(2048)
868
+ }).strict();
869
+ var verifiedPassSchema = z5.object({
870
+ provider: identifier,
871
+ event: identifier,
872
+ subject: z5.string().min(1).max(2048),
873
+ member: identifier,
874
+ quest: identifier
875
+ }).strict();
876
+ function withActionId(input) {
877
+ return { ...input, actionId: input.actionId ?? crypto.randomUUID() };
878
+ }
879
+ function actionIdOf(input) {
880
+ return typeof input === "object" && input !== null && "actionId" in input && typeof input.actionId === "string" ? input.actionId : void 0;
881
+ }
882
+ function queryString(values) {
883
+ const query = new URLSearchParams(
884
+ Object.entries(values).flatMap(
885
+ ([key, value]) => value === void 0 ? [] : [[key, String(value)]]
886
+ )
887
+ ).toString();
888
+ return query ? "?" + query : "";
889
+ }
890
+ var serverErrorSchema = z5.looseObject({
891
+ error: z5.string(),
892
+ code: z5.string().optional()
893
+ });
894
+ function checkedTimeout(timeout) {
895
+ if (timeout !== void 0 && !(Number.isFinite(timeout) && timeout > 0)) {
896
+ throw new ManagementError({
897
+ kind: "client",
898
+ code: ManagementErrorCode.InvalidInput,
899
+ message: "Management timeout must be a positive, finite number of milliseconds"
900
+ });
901
+ }
902
+ return timeout;
903
+ }
904
+ function clientFailure(error) {
905
+ if (error instanceof ManagementError) {
906
+ return error;
907
+ }
908
+ return new ManagementError({
909
+ kind: "client",
910
+ code: ManagementErrorCode.InvalidInput,
911
+ message: error instanceof z5.ZodError ? `Invalid management request: ${z5.prettifyError(error)}` : error instanceof Error ? error.message : "Invalid management request",
912
+ cause: error
913
+ });
914
+ }
915
+ function guarded(api) {
916
+ return Object.fromEntries(
917
+ Object.entries(api).map(([key, value]) => [
918
+ key,
919
+ typeof value === "function" ? (...args) => {
920
+ try {
921
+ return Promise.resolve(value(...args)).catch((error) => {
922
+ throw clientFailure(error);
923
+ });
924
+ } catch (error) {
925
+ return Promise.reject(clientFailure(error));
926
+ }
927
+ } : value && typeof value === "object" ? guarded(value) : value
928
+ ])
929
+ );
930
+ }
931
+ function createManagementClient(options) {
932
+ const clientTimeout = checkedTimeout(options.timeout) ?? DEFAULT_MANAGEMENT_TIMEOUT;
933
+ function transportFailure(error, context, lifetime, sent, status) {
934
+ if (error instanceof ManagementError) {
935
+ return error;
936
+ }
937
+ const unsent = {
938
+ ...sent ? {} : { uncertain: false },
939
+ ...status === void 0 ? {} : { status }
940
+ };
941
+ if (lifetime.caller?.aborted) {
942
+ return new ManagementError({
943
+ ...context,
944
+ ...unsent,
945
+ kind: "aborted",
946
+ code: ManagementErrorCode.Aborted,
947
+ message: "The management request was cancelled",
948
+ cause: lifetime.caller.reason
949
+ });
950
+ }
951
+ if (lifetime.timer.aborted) {
952
+ return new ManagementError({
953
+ ...context,
954
+ ...unsent,
955
+ kind: "timeout",
956
+ code: ManagementErrorCode.Timeout,
957
+ message: `The management request did not finish within ${lifetime.timeout} ms`,
958
+ cause: error
959
+ });
960
+ }
961
+ return new ManagementError({
962
+ ...context,
963
+ ...unsent,
964
+ kind: "network",
965
+ code: ManagementErrorCode.Network,
966
+ message: "The management request failed before Domino answered",
967
+ cause: error
968
+ });
969
+ }
970
+ async function send(path, init, actionId) {
971
+ const { timeout, signal: callerSignal, ...fetchInit } = init ?? {};
972
+ const context = {
973
+ method: (fetchInit.method ?? "GET").toUpperCase(),
974
+ path: path.split("?")[0],
975
+ ...actionId ? { actionId } : {}
976
+ };
977
+ const limit = checkedTimeout(timeout) ?? clientTimeout;
978
+ const deadline = new AbortController();
979
+ const caller = callerSignal ?? void 0;
980
+ const lifetime = {
981
+ signal: caller ? AbortSignal.any([caller, deadline.signal]) : deadline.signal,
982
+ caller,
983
+ timer: deadline.signal,
984
+ timeout: limit,
985
+ end: () => clearTimeout(timer)
986
+ };
987
+ const timer = setTimeout(
988
+ () => deadline.abort(
989
+ new DOMException("The management request timed out", "TimeoutError")
990
+ ),
991
+ limit
992
+ );
993
+ if (lifetime.signal.aborted) {
994
+ lifetime.end();
995
+ throw transportFailure(lifetime.signal.reason, context, lifetime, false);
996
+ }
997
+ try {
998
+ return await exchange(path, fetchInit, context, lifetime);
999
+ } catch (error) {
1000
+ lifetime.end();
1001
+ throw error;
1002
+ }
1003
+ }
1004
+ async function credential(context, lifetime) {
1005
+ if (!options.getToken) {
1006
+ return null;
1007
+ }
1008
+ const getToken = options.getToken;
1009
+ try {
1010
+ return await new Promise((resolve, reject) => {
1011
+ const stop = () => reject(lifetime.signal.reason);
1012
+ lifetime.signal.addEventListener("abort", stop, { once: true });
1013
+ getToken().then(resolve, reject).finally(() => lifetime.signal.removeEventListener("abort", stop));
1014
+ });
1015
+ } catch (error) {
1016
+ if (lifetime.signal.aborted) {
1017
+ throw transportFailure(error, context, lifetime, false);
1018
+ }
1019
+ throw new ManagementError({
1020
+ ...context,
1021
+ // A token source that could not reach its own service failed like a network call.
1022
+ kind: error instanceof TypeError ? "network" : "client",
1023
+ code: ManagementErrorCode.Credential,
1024
+ uncertain: false,
1025
+ message: "Could not get a management credential",
1026
+ cause: error
1027
+ });
1028
+ }
1029
+ }
1030
+ async function exchange(path, fetchInit, context, lifetime) {
1031
+ const headers = new Headers(fetchInit.headers);
1032
+ const token = await credential(context, lifetime);
1033
+ if (token) {
1034
+ headers.set("Authorization", `Bearer ${token}`);
1035
+ }
1036
+ if (options.organization) {
1037
+ headers.set("X-Relay-Organization", options.organization);
1038
+ }
1039
+ if (options.project) {
1040
+ headers.set("X-Relay-Project", options.project);
1041
+ }
1042
+ if (options.environment) {
1043
+ headers.set("X-Relay-Environment", options.environment);
1044
+ }
1045
+ let response;
1046
+ try {
1047
+ response = await fetch(`${options.baseUrl}/management/v1${path}`, {
1048
+ ...fetchInit,
1049
+ headers,
1050
+ signal: lifetime.signal
1051
+ });
1052
+ } catch (error) {
1053
+ throw transportFailure(error, context, lifetime, true);
1054
+ }
1055
+ if (!response.ok) {
1056
+ const body = await response.json().catch(() => null);
1057
+ const parsed = serverErrorSchema.safeParse(body);
1058
+ const { error, code, ...details } = parsed.success ? parsed.data : { error: `Request failed (${response.status})`, code: void 0 };
1059
+ throw new ManagementError({
1060
+ ...context,
1061
+ kind: "http",
1062
+ status: response.status,
1063
+ message: error,
1064
+ ...code === void 0 ? {} : { code },
1065
+ details
1066
+ });
1067
+ }
1068
+ return { response, context, lifetime };
1069
+ }
1070
+ async function raw(path, init) {
1071
+ const { response, lifetime } = await send(path, init, void 0);
1072
+ lifetime.end();
1073
+ return response;
1074
+ }
1075
+ async function request(path, schema, input, method = input === void 0 ? "GET" : "POST", call) {
1076
+ const { response, context, lifetime } = await send(
1077
+ path,
1078
+ {
1079
+ ...call,
1080
+ ...method === "GET" ? {} : { method },
1081
+ ...input === void 0 ? {} : {
1082
+ headers: { "Content-Type": "application/json" },
1083
+ body: JSON.stringify(input)
1084
+ }
1085
+ },
1086
+ actionIdOf(input)
1087
+ );
1088
+ let body;
1089
+ try {
1090
+ body = await response.json();
1091
+ } catch (error) {
1092
+ if (error instanceof SyntaxError && !lifetime.signal.aborted) {
1093
+ throw new ManagementError({
1094
+ ...context,
1095
+ kind: "invalid-response",
1096
+ code: ManagementErrorCode.InvalidResponse,
1097
+ status: response.status,
1098
+ message: "Domino answered with a body that is not JSON",
1099
+ cause: error
1100
+ });
1101
+ }
1102
+ throw transportFailure(error, context, lifetime, true, response.status);
1103
+ } finally {
1104
+ lifetime.end();
1105
+ }
1106
+ const parsed = schema.safeParse(body);
1107
+ if (!parsed.success) {
1108
+ throw new ManagementError({
1109
+ ...context,
1110
+ kind: "invalid-response",
1111
+ code: ManagementErrorCode.InvalidResponse,
1112
+ status: response.status,
1113
+ message: "Domino answered with a response this client does not recognize",
1114
+ cause: parsed.error
1115
+ });
1116
+ }
1117
+ return parsed.data;
1118
+ }
1119
+ const get = (path, schema, call) => request(path, schema, void 0, "GET", call);
1120
+ const post = (path, schema, input, call) => request(path, schema, input, "POST", call);
1121
+ async function create(path, responseSchema, inputSchema, input, call) {
1122
+ const payload = inputSchema.parse(withActionId(input));
1123
+ try {
1124
+ return await post(path, responseSchema, payload, call);
1125
+ } catch (error) {
1126
+ if (error instanceof ManagementError && error.uncertain && (error.kind === "network" || error.kind === "http")) {
1127
+ return await post(path, responseSchema, payload, call);
1128
+ }
1129
+ throw error;
1130
+ }
1131
+ }
1132
+ const ok = z5.object({ ok: z5.literal(true) });
1133
+ return guarded({
1134
+ raw,
1135
+ request,
1136
+ trackers: {
1137
+ list: (call) => get("/trackers", z5.array(trackerStatusSchema), call),
1138
+ get: (reference, call) => get(
1139
+ `/trackers/${identifier.parse(reference)}`,
1140
+ trackerStatusSchema,
1141
+ call
1142
+ ),
1143
+ records: (reference, query = {}, call) => get(
1144
+ `/trackers/${identifier.parse(reference)}/records${queryString(trackerQuerySchema.parse(query))}`,
1145
+ trackerPageSchema,
1146
+ call
1147
+ ),
1148
+ summary: (reference, query = {}, call) => get(
1149
+ `/trackers/${identifier.parse(reference)}/summary${queryString(trackerQuerySchema.parse(query))}`,
1150
+ trackerSummarySchema,
1151
+ call
1152
+ ),
1153
+ content: (reference, query, call) => get(
1154
+ `/trackers/${identifier.parse(reference)}/content${queryString(trackerContentReadSchema.parse(query))}`,
1155
+ trackerContentSchema,
1156
+ call
1157
+ ),
1158
+ control: (reference, input, call) => post(
1159
+ `/trackers/${identifier.parse(reference)}/control`,
1160
+ trackerStatusSchema,
1161
+ trackerControlSchema.parse(input),
1162
+ call
1163
+ ),
1164
+ ingest: (reference, input, call) => post(
1165
+ `/trackers/${identifier.parse(reference)}/records`,
1166
+ trackerIngestResultSchema,
1167
+ trackerIngestSchema.parse(input),
1168
+ call
1169
+ ),
1170
+ /** Why each tracker-triggered quest admitted or skipped a record observation, newest first. */
1171
+ outcomes: (reference, query = {}, call) => get(
1172
+ `/trackers/${identifier.parse(reference)}/outcomes${queryString(trackerOutcomeQuerySchema.parse(query))}`,
1173
+ trackerOutcomePageSchema,
1174
+ call
1175
+ ),
1176
+ /**
1177
+ * Re-runs admission for a skipped observation under the quest's current release, links and
1178
+ * membership; requires `review` permission. Fails with 409 and the current reason when it
1179
+ * still cannot admit.
1180
+ */
1181
+ retryOutcome: (reference, input, call) => post(
1182
+ `/trackers/${identifier.parse(reference)}/outcomes/retry`,
1183
+ trackerOutcomeSchema,
1184
+ trackerOutcomeRetrySchema.parse(input),
1185
+ call
1186
+ ),
1187
+ /** A bounded X search sample to explore a query before defining a tracker. Stores nothing. */
1188
+ preview: (input, call) => post(
1189
+ "/tracker-preview",
1190
+ trackerPreviewSchema,
1191
+ trackerPreviewInputSchema.parse(input),
1192
+ call
1193
+ )
1194
+ },
1195
+ engagement: {
1196
+ previewChange: (input, call) => post(
1197
+ "/engagement/preview-change",
1198
+ engagementChangePreviewSchema,
1199
+ engagementChangePreviewInputSchema.parse(input),
1200
+ call
1201
+ ),
1202
+ change: (input, call) => post(
1203
+ "/engagement/change",
1204
+ engagementRuleSchema,
1205
+ engagementChangeSchema.parse(input),
1206
+ call
1207
+ ),
1208
+ versions: (input, call) => get(
1209
+ "/engagement/versions" + queryString(engagementVersionQuerySchema.parse(input)),
1210
+ engagementVersionPageSchema,
1211
+ call
1212
+ ),
1213
+ boundaries: (input, call) => get(
1214
+ "/engagement/boundaries" + queryString(engagementPageQuerySchema.parse(input)),
1215
+ engagementBoundaryPageSchema,
1216
+ call
1217
+ ),
1218
+ publish: (input, call) => post(
1219
+ "/engagement/publish",
1220
+ engagementRuleSchema,
1221
+ engagementPublishSchema.parse(input),
1222
+ call
1223
+ ),
1224
+ list: (call) => get("/engagement", z5.array(engagementRuleSchema), call),
1225
+ page: (input, call) => get(
1226
+ "/engagement/history" + queryString(engagementPageQuerySchema.parse(input)),
1227
+ engagementPageSchema,
1228
+ call
1229
+ )
1230
+ },
1231
+ content: {
1232
+ performance: (input, call) => get(
1233
+ "/content/performance" + queryString(contentPerformanceQuerySchema.parse(input)),
1234
+ contentPerformancePageSchema,
1235
+ call
1236
+ ),
1237
+ qualifications: (input, call) => get(
1238
+ "/content/qualifications" + queryString(contentQualificationQuerySchema.parse(input)),
1239
+ contentQualificationPageSchema,
1240
+ call
1241
+ ),
1242
+ admissions: (input, call) => get(
1243
+ "/content/admissions" + queryString(contentAdmissionQuerySchema.parse(input)),
1244
+ contentAdmissionPageSchema,
1245
+ call
1246
+ ),
1247
+ enroll: (input, call) => post(
1248
+ "/content/enrollments",
1249
+ contentEnrollmentSchema,
1250
+ contentEnrollmentInputSchema.parse(input),
1251
+ call
1252
+ ),
1253
+ approve: (input, call) => post(
1254
+ "/content/approvals",
1255
+ contentAdmissionSchema,
1256
+ contentReleaseInputSchema.parse(input),
1257
+ call
1258
+ )
1259
+ },
1260
+ observations: {
1261
+ submit: (input, call) => post(
1262
+ "/observations",
1263
+ observationReceiptSchema,
1264
+ observationInputSchema.parse(input),
1265
+ call
1266
+ )
1267
+ },
1268
+ pointLedgers: {
1269
+ list: (call) => get("/point-ledgers", z5.array(pointLedgerSchema), call),
1270
+ save: (input, call) => post(
1271
+ "/point-ledgers/update",
1272
+ pointLedgerSchema,
1273
+ pointLedgerSchema.parse(input),
1274
+ call
1275
+ )
1276
+ },
1277
+ points: {
1278
+ ledgers: (call) => get("/point-ledgers", z5.array(pointLedgerSchema), call),
1279
+ createLedger: (input, call) => create(
1280
+ "/point-ledgers",
1281
+ pointLedgerSchema,
1282
+ createPointLedgerSchema,
1283
+ input,
1284
+ call
1285
+ ),
1286
+ update: (input, call) => post(
1287
+ "/points",
1288
+ pointsResultSchema,
1289
+ pointsMutationSchema.parse(input),
1290
+ call
1291
+ ),
1292
+ balance: (member, balance, call) => get(
1293
+ `/points/${identifier.parse(member)}/${identifier.parse(balance)}`,
1294
+ pointsAccountSchema,
1295
+ call
1296
+ ),
1297
+ history: (member, balance, before, call) => get(
1298
+ `/points/${identifier.parse(member)}/${identifier.parse(balance)}/history${queryString({ before })}`,
1299
+ z5.object({
1300
+ items: z5.array(pointsEntrySchema),
1301
+ next: z5.number().nullable()
1302
+ }),
1303
+ call
1304
+ )
1305
+ },
1306
+ referrals: {
1307
+ /** A member's referral point history, newest first. Pass `nextCursor` as `cursor`. */
1308
+ history: (member, query = {}, call) => get(
1309
+ `/referrals/history/${identifier.parse(member)}${queryString({ cursor: query.cursor })}`,
1310
+ referralHistorySchema,
1311
+ call
1312
+ ),
1313
+ list: (call) => get("/referrals", z5.array(publishedReferralSchema), call),
1314
+ participants: (before, call) => get(
1315
+ `/referrals/participants${queryString({ before })}`,
1316
+ referralManagementSchema,
1317
+ call
1318
+ ),
1319
+ control: (input, call) => post(
1320
+ "/referrals/control",
1321
+ ok,
1322
+ referralControlSchema.parse(input),
1323
+ call
1324
+ )
1325
+ },
1326
+ leaderboards: {
1327
+ list: (call) => get("/leaderboards", z5.array(publishedLeaderboardSchema), call),
1328
+ standings: (board, input = {}, call) => {
1329
+ const query = leaderboardQuerySchema.parse(input);
1330
+ return get(
1331
+ `/leaderboards/${identifier.parse(board)}${queryString({
1332
+ limit: query.limit,
1333
+ cursor: query.cursor || void 0
1334
+ })}`,
1335
+ leaderboardPageSchema,
1336
+ call
1337
+ );
1338
+ },
1339
+ history: (board, call) => get(
1340
+ `/leaderboards/${identifier.parse(board)}/history`,
1341
+ z5.array(publishedLeaderboardSchema),
1342
+ call
1343
+ ),
1344
+ exclusions: (board, call) => get(
1345
+ `/leaderboards/${identifier.parse(board)}/exclusions`,
1346
+ z5.array(z5.object({ member: identifier })),
1347
+ call
1348
+ ),
1349
+ exclude: (board, input, call) => post(
1350
+ `/leaderboards/${identifier.parse(board)}/exclusions`,
1351
+ ok,
1352
+ leaderboardExclusionSchema.parse(input),
1353
+ call
1354
+ ),
1355
+ group: (group, input, call) => post(
1356
+ `/leaderboard-groups/${identifier.parse(group)}`,
1357
+ ok,
1358
+ leaderboardGroupSchema.parse(input),
1359
+ call
1360
+ )
1361
+ },
1362
+ deployments: {
1363
+ preview: (input, call) => {
1364
+ const { engagement, ...deployment } = projectDeploymentSchema.parse(input);
1365
+ return post(
1366
+ "/deployments/preview",
1367
+ deploymentPreviewSchema,
1368
+ { ...deployment, ...engagement.length ? { engagement } : {} },
1369
+ call
1370
+ );
1371
+ },
1372
+ publish: (input, call) => post(
1373
+ "/deployments/publish",
1374
+ deploymentResultSchema,
1375
+ publishDeploymentSchema.parse(input),
1376
+ call
1377
+ )
1378
+ },
1379
+ catalog: {
1380
+ allocateQuest: (input = {}, call) => create(
1381
+ "/catalog/quests",
1382
+ allocatedQuestSchema,
1383
+ allocateQuestSchema,
1384
+ input,
1385
+ call
1386
+ ),
1387
+ read: (call) => get("/catalog", questCatalogSchema, call),
1388
+ previewDeployment: (input, call) => post(
1389
+ "/catalog/deploy/preview",
1390
+ catalogDeploymentPreviewSchema,
1391
+ catalogDeploymentSchema.parse(input),
1392
+ call
1393
+ ),
1394
+ deploy: (input, call) => post(
1395
+ "/catalog/deploy",
1396
+ questCatalogSchema,
1397
+ catalogDeploymentSchema.parse(input),
1398
+ call
1399
+ ),
1400
+ saveDraft: (input, call) => post(
1401
+ "/catalog/drafts",
1402
+ questDraftSchema,
1403
+ saveQuestDraftSchema.parse(input),
1404
+ call
1405
+ ),
1406
+ preview: (input, call) => post(
1407
+ "/catalog/preview",
1408
+ questPublicationPreviewSchema,
1409
+ publishQuestDraftSchema.parse(input),
1410
+ call
1411
+ ),
1412
+ publish: (input, call) => post(
1413
+ "/catalog/publish",
1414
+ questPublicationPreviewSchema,
1415
+ publishQuestDraftSchema.parse(input),
1416
+ call
1417
+ )
1418
+ },
1419
+ /** Staff-confirmed quests and reviews. */
1420
+ attempts: {
1421
+ /**
1422
+ * Submits a staff-confirmed quest (`manual({ actor: "staff" })`) for a member; requires
1423
+ * `confirm` permission. Resolves with the queued attempt, or with the original attempt when
1424
+ * the action ID repeats. Any other quest fails with 403.
1425
+ */
1426
+ confirm: (input, call) => post(
1427
+ "/attempts",
1428
+ attemptSchema,
1429
+ submitSchema.parse(withActionId(input)),
1430
+ call
1431
+ ),
1432
+ /**
1433
+ * Accepts or rejects an attempt waiting for review, at the `generation` the reviewer saw,
1434
+ * with a reason; requires `review` permission.
1435
+ */
1436
+ review: (attempt, input, call) => post(
1437
+ `/attempts/${identifier.parse(attempt)}/review`,
1438
+ attemptSchema,
1439
+ staffDecisionSchema.parse(withActionId(input)),
1440
+ call
1441
+ ),
1442
+ /** Evaluates a failed attempt again under a new generation; requires `review` permission. */
1443
+ retry: (attempt, call) => post(
1444
+ `/attempts/${identifier.parse(attempt)}/retry`,
1445
+ attemptSchema,
1446
+ {},
1447
+ call
1448
+ )
1449
+ },
1450
+ passes: {
1451
+ /**
1452
+ * Records a member's external event pass, which the app verified, and submits the entry
1453
+ * quest (`manual({ actor: "staff" })`); requires `confirm` permission. The same pass for
1454
+ * the same member resolves with the original attempt.
1455
+ */
1456
+ verify: (input, call) => post(
1457
+ "/passes/verify",
1458
+ attemptSchema,
1459
+ verifiedPassSchema.parse(input),
1460
+ call
1461
+ )
1462
+ },
1463
+ /** Staff handover of a member's reward entitlement; requires `handover` permission. */
1464
+ handover: {
1465
+ /** Starts handing over an entitlement at the `revision` staff saw, with an optional pickup selection. */
1466
+ begin: (entitlement, input, call) => post(
1467
+ `/entitlements/${identifier.parse(entitlement)}/begin`,
1468
+ entitlementRecordSchema,
1469
+ beginHandoverSchema.parse(withActionId(input)),
1470
+ call
1471
+ ),
1472
+ /** Completes the handover `begin` started; the entitlement becomes collected. */
1473
+ confirm: (entitlement, input, call) => post(
1474
+ `/entitlements/${identifier.parse(entitlement)}/confirm`,
1475
+ entitlementRecordSchema,
1476
+ confirmHandoverSchema.parse(withActionId(input)),
1477
+ call
1478
+ )
1479
+ },
1480
+ collection: {
1481
+ resolve: (code, call) => post(
1482
+ "/collection/resolve",
1483
+ collectionPreviewSchema,
1484
+ collectionResolveSchema.parse({ code }),
1485
+ call
1486
+ ),
1487
+ begin: (input, call) => post(
1488
+ "/collection/begin",
1489
+ entitlementRecordSchema,
1490
+ collectionBeginSchema.parse(input),
1491
+ call
1492
+ )
1493
+ },
1494
+ operations: {
1495
+ /**
1496
+ * Pauses or resumes redemptions or one quest's participation, against the `revision` the
1497
+ * operator saw, with a reason; requires `publish` permission.
1498
+ */
1499
+ configure: (input, call) => post(
1500
+ "/operations",
1501
+ operationSchema,
1502
+ operationInputSchema.parse(withActionId(input)),
1503
+ call
1504
+ )
1505
+ },
1506
+ inventory: {
1507
+ createItem: (input, call) => create(
1508
+ "/stock-items",
1509
+ stockItemSchema,
1510
+ createStockItemSchema,
1511
+ input,
1512
+ call
1513
+ ),
1514
+ /** Adds `quantity` units to a stock item; requires `inventory` permission. */
1515
+ addStock: (input, call) => post(
1516
+ "/stock",
1517
+ stockAdditionSchema,
1518
+ stockInputSchema.parse(withActionId(input)),
1519
+ call
1520
+ ),
1521
+ catalog: (call) => get("/pickup-inventory", z5.array(pickupCatalogSchema), call),
1522
+ configure: (input, call) => post(
1523
+ "/pickup-inventory",
1524
+ pickupCatalogSchema,
1525
+ configurePickupSchema.parse(input),
1526
+ call
1527
+ ),
1528
+ availability: (entitlement, call) => get(
1529
+ `/pickup-inventory/${encodeURIComponent(entitlement)}`,
1530
+ pickupAvailabilitySchema,
1531
+ call
1532
+ )
1533
+ },
1534
+ readiness: (call) => get("/readiness", readinessSchema, call),
1535
+ access: (call) => get("/access", accessSchema, call),
1536
+ createProject: (input, call) => create("/projects", projectSchema, projectInputSchema, input, call),
1537
+ /** Delete the client's current project. Domino support can restore it for 30 days. */
1538
+ deleteProject: (input, call) => request(
1539
+ "/project",
1540
+ projectDeletionSchema,
1541
+ projectDeletionInputSchema.parse(input),
1542
+ "DELETE",
1543
+ call
1544
+ ),
1545
+ /** Move the client's current project to another organization the caller administers. */
1546
+ transferProject: (input, call) => post(
1547
+ "/project/transfer",
1548
+ projectTransferSchema,
1549
+ projectTransferInputSchema.parse(input),
1550
+ call
1551
+ ),
1552
+ /**
1553
+ * The signed-in person's personal API keys. Only a Console session manages them; an API key
1554
+ * cannot list, create or revoke keys.
1555
+ */
1556
+ tokens: {
1557
+ list: (call) => get("/tokens", z5.array(tokenSchema), call),
1558
+ /**
1559
+ * Issues a key for one project and environment, limited to permissions the caller holds
1560
+ * there. The secret `token` is in this response only.
1561
+ */
1562
+ create: (input, call) => post("/tokens", issuedTokenSchema, tokenInputSchema.parse(input), call),
1563
+ revoke: (id, call) => request(
1564
+ `/tokens/${encodeURIComponent(z5.string().min(1).parse(id))}`,
1565
+ ok,
1566
+ void 0,
1567
+ "DELETE",
1568
+ call
1569
+ )
1570
+ },
1571
+ /** Who holds which roles on the client's project; organization administrators only. */
1572
+ grants: {
1573
+ list: (call) => get("/grants", z5.array(grantRecordSchema), call),
1574
+ /** Replaces one person's roles and environments on the project. The audit log records it. */
1575
+ set: (input, call) => request(
1576
+ "/grants",
1577
+ grantRecordSchema,
1578
+ grantSchema.parse(input),
1579
+ "PUT",
1580
+ call
1581
+ )
1582
+ },
1583
+ /** The organization's people, to choose a grant's `subject`; organization administrators only. */
1584
+ team: {
1585
+ list: (call) => get("/team", teamSchema, call)
1586
+ },
1587
+ /**
1588
+ * Keys that let an existing app exchange its own login for member sessions, per project and
1589
+ * environment. Organization administrators, from a Console session only.
1590
+ */
1591
+ identityIntegrations: {
1592
+ list: (call) => get("/identity-integrations", z5.array(identityIntegrationSchema), call),
1593
+ /** The secret `token` is in this response only. */
1594
+ create: (input, call) => post(
1595
+ "/identity-integrations",
1596
+ identityIntegrationSecretSchema,
1597
+ identityIntegrationInputSchema.parse(input),
1598
+ call
1599
+ ),
1600
+ /** Replaces the key's secret and extends it by 90 days; the old secret stops working. */
1601
+ rotate: (id, call) => post(
1602
+ `/identity-integrations/${z5.string().uuid().parse(id)}/rotate`,
1603
+ identityIntegrationSecretSchema,
1604
+ {},
1605
+ call
1606
+ ),
1607
+ /** Deletes the key and ends every member session it issued. */
1608
+ revoke: (id, call) => request(
1609
+ `/identity-integrations/${z5.string().uuid().parse(id)}`,
1610
+ z5.null(),
1611
+ void 0,
1612
+ "DELETE",
1613
+ call
1614
+ )
1615
+ },
1616
+ page: (page, query, call) => get(`/${page}${queryString(query)}`, pageSchema, call),
1617
+ rewardDeliveries: (member, call) => get(
1618
+ `/reward-deliveries${queryString({ member })}`,
1619
+ rewardDeliveriesSchema,
1620
+ call
1621
+ ),
1622
+ /** Moves a failed delivery back to pending under a new generation; requires `review` permission. */
1623
+ retryRewardDelivery: (id, call) => post(
1624
+ `/reward-deliveries/${encodeURIComponent(id)}/retry`,
1625
+ rewardDeliverySchema,
1626
+ {},
1627
+ call
1628
+ ),
1629
+ /** The project's members, as operators see them. */
1630
+ members: {
1631
+ /** A member's detail: accounts, progress, passes, wallets and profile. */
1632
+ get: (member, call) => get(`/members/${encodeURIComponent(member)}`, memberDetailSchema, call),
1633
+ /**
1634
+ * The one member of the client's project holding exactly this account, with `provider` and `subject` as a member's
1635
+ * `accounts` list them; requires `read` permission. Fails with 404 `member-not-found` when
1636
+ * nobody holds it. Unlike the members page's `q` search, it never matches part of a value
1637
+ * or another letter case.
1638
+ */
1639
+ lookup: (input, call) => get(
1640
+ `/members/lookup${queryString(memberLookupSchema.parse(input))}`,
1641
+ personSchema,
1642
+ call
1643
+ ),
1644
+ /** Who each member is: up to 100 distinct IDs; unknown IDs come back without accounts. */
1645
+ people: (members, call) => get(
1646
+ `/people${queryString({ ids: members.join(",") })}`,
1647
+ z5.array(personSchema),
1648
+ call
1649
+ ),
1650
+ /** Unlinks a member's wallet from the project with a reason; requires `review` permission. The address stays bound to the member. */
1651
+ unlinkWallet: (member, input, call) => post(
1652
+ `/members/${encodeURIComponent(member)}/wallets/unlink`,
1653
+ z5.array(managedWalletSchema),
1654
+ memberWalletUnlinkInputSchema.parse(input),
1655
+ call
1656
+ ),
1657
+ /**
1658
+ * Enables or disables sign-in with a member's wallet, across the organization and environment,
1659
+ * with a reason; requires `review` permission. Sessions it already issued run out within 8 hours.
1660
+ */
1661
+ setWalletSignIn: (member, input, call) => post(
1662
+ `/members/${encodeURIComponent(member)}/wallets/sign-in`,
1663
+ z5.array(managedWalletSchema),
1664
+ memberWalletSignInInputSchema.parse(input),
1665
+ call
1666
+ )
1667
+ },
1668
+ /** The hosted app's secrets. Values are write-only; builds staged after a change receive it. */
1669
+ secrets: {
1670
+ list: (call) => get("/secrets", appSecretListSchema, call),
1671
+ set: (name, value, call) => request(
1672
+ `/secrets/${appSecretNameSchema.parse(name)}`,
1673
+ appSecretSchema,
1674
+ appSecretInputSchema.parse({ value }),
1675
+ "PUT",
1676
+ call
1677
+ ),
1678
+ delete: async (name, call) => {
1679
+ await raw(`/secrets/${appSecretNameSchema.parse(name)}`, {
1680
+ ...call,
1681
+ method: "DELETE"
1682
+ });
1683
+ }
1684
+ },
1685
+ /**
1686
+ * The chains quest code can read token balances on with `ctx.wallet.balance()`, with their
1687
+ * names; requires `read` permission. Any other chain fails the evaluation.
1688
+ */
1689
+ walletBalanceChains: (call) => get("/wallet-balance-chains", walletBalanceChainsSchema, call),
1690
+ /**
1691
+ * The project calendar in this environment: the timezone that sets where days, weeks and months
1692
+ * begin for budgets, streaks and leaderboards.
1693
+ */
1694
+ calendar: {
1695
+ /**
1696
+ * The timezone in effect, today's date, when today ends, any pending change, and a stored
1697
+ * timezone the calendar no longer accepts (`unsupported`, read as UTC).
1698
+ */
1699
+ read: (call) => get("/calendar", projectCalendarSchema, call),
1700
+ /**
1701
+ * Changes the project timezone from the next day boundary, with a reason; requires `publish`
1702
+ * permission. The current timezone cancels a pending change; a call that changes nothing
1703
+ * records nothing. In live, only a person in Console can change it, not an API key.
1704
+ */
1705
+ configure: (input, call) => post(
1706
+ "/calendar",
1707
+ projectCalendarSchema,
1708
+ projectCalendarInputSchema.parse(withActionId(input)),
1709
+ call
1710
+ )
1711
+ },
1712
+ /** Participant profiles in this project and environment. */
1713
+ profiles: {
1714
+ /** Who sees profiles, and which accounts supply default names and pictures, in order. */
1715
+ settings: (call) => get("/profile-settings", profileSettingsSchema, call),
1716
+ /**
1717
+ * Changes the profile settings against `expectedRevision`, with a reason; requires `publish`
1718
+ * permission. In live, only a person in Console can change them, not an API key.
1719
+ */
1720
+ configure: (input, call) => post(
1721
+ "/profile-settings",
1722
+ profileSettingsSchema,
1723
+ profileSettingsInputSchema.parse(withActionId(input)),
1724
+ call
1725
+ ),
1726
+ /**
1727
+ * Resets a member's name, removes their picture, or locks or unlocks their profile, with a
1728
+ * reason; requires `review` permission.
1729
+ */
1730
+ moderate: (member, input, call) => post(
1731
+ `/members/${identifier.parse(member)}/profile`,
1732
+ managedProfileSchema,
1733
+ profileModerationSchema.parse(withActionId(input)),
1734
+ call
1735
+ )
1736
+ },
1737
+ /**
1738
+ * Code-authored quests. Quests created in Console change participation through a catalog draft
1739
+ * instead. These methods require `publish` permission; in live, only a person in Console can
1740
+ * use them.
1741
+ */
1742
+ quests: {
1743
+ /**
1744
+ * Stops new participation and hides the quest from collections, with a reason. Completions,
1745
+ * attempts and rewards stay. Deploying the quest's code again keeps it archived.
1746
+ */
1747
+ archive: (quest, input, call) => post(
1748
+ "/releases/lifecycle",
1749
+ questLifecycleSchema,
1750
+ questLifecycleInputSchema.parse(
1751
+ withActionId({ ...input, quest, archived: true })
1752
+ ),
1753
+ call
1754
+ ),
1755
+ /**
1756
+ * Opens an archived quest again, with a reason. It must pass the prerequisite graph and the
1757
+ * app's supported interactions; it stays paused while a resource setting is empty.
1758
+ */
1759
+ unarchive: (quest, input, call) => post(
1760
+ "/releases/lifecycle",
1761
+ questLifecycleSchema,
1762
+ questLifecycleInputSchema.parse(
1763
+ withActionId({ ...input, quest, archived: false })
1764
+ ),
1765
+ call
1766
+ ),
1767
+ /**
1768
+ * Changes a quest's settings values (`set`) or returns them to their defaults (`reset`),
1769
+ * publishing a new release from `expectedRelease`, the release the operator saw.
1770
+ */
1771
+ updateSettings: (input, call) => post(
1772
+ "/releases/settings",
1773
+ publishedReleaseSchema,
1774
+ questSettingsInputSchema.parse(input),
1775
+ call
1776
+ )
1777
+ },
1778
+ /** How participants sign in to this project and environment. */
1779
+ participantSignIn: (call) => get("/participant-sign-in", participantSignInSchema, call),
1780
+ /** Sets the wallet networks participants can sign in with; requires `publish` permission. */
1781
+ configureParticipantSignIn: (input, call) => request(
1782
+ "/participant-sign-in",
1783
+ participantSignInSchema,
1784
+ participantSignInInputSchema.parse(input),
1785
+ "PUT",
1786
+ call
1787
+ )
1788
+ });
1789
+ }
1790
+ export {
1791
+ APP_SECRET_LIMIT,
1792
+ DEFAULT_MANAGEMENT_TIMEOUT,
1793
+ ManagementError,
1794
+ ManagementErrorCode,
1795
+ accessSchema,
1796
+ accountProfileSchema,
1797
+ appRoutingSchema,
1798
+ appSecretDeclarationSchema,
1799
+ appSecretDeclarationsSchema,
1800
+ appSecretInputSchema,
1801
+ appSecretListSchema,
1802
+ appSecretNameSchema,
1803
+ appSecretSchema,
1804
+ appSecretValueSchema,
1805
+ assetPathSchema,
1806
+ auditRecordSchema,
1807
+ balanceCheckSchema,
1808
+ buildArtifactsSchema,
1809
+ buildIdentitySchema,
1810
+ buildPhaseSchema,
1811
+ buildSnapshotSchema,
1812
+ buildStatusSchema,
1813
+ commitSchema,
1814
+ createManagementClient,
1815
+ createRepositorySchema,
1816
+ developmentPreflightSchema,
1817
+ deviceApproveSchema,
1818
+ deviceRedeemSchema,
1819
+ deviceStartSchema,
1820
+ entitlementRecordSchema,
1821
+ environmentSchema,
1822
+ grantRecordSchema,
1823
+ grantSchema,
1824
+ hostedAppSchema,
1825
+ hostedAppSecretsSchema,
1826
+ hostedBuildSchema,
1827
+ hostedDeploymentKeySchema,
1828
+ hostedKeyPermissions,
1829
+ hostedKeySchema,
1830
+ hostedKeySecretSchema,
1831
+ hostedManagementBindings,
1832
+ hostedManagementClient,
1833
+ inventorySchema,
1834
+ isManagementError,
1835
+ issuedTokenSchema,
1836
+ managedWalletSchema,
1837
+ memberAccountSchema,
1838
+ memberDetailSchema,
1839
+ memberLookupSchema,
1840
+ memberSchema,
1841
+ memberWalletSignInInputSchema,
1842
+ memberWalletUnlinkInputSchema,
1843
+ metricsSchema,
1844
+ operationInputSchema,
1845
+ operationSchema,
1846
+ pageSchema,
1847
+ participantSignInInputSchema,
1848
+ participantSignInSchema,
1849
+ permissionSchema,
1850
+ personSchema,
1851
+ projectDeletionInputSchema,
1852
+ projectDeletionSchema,
1853
+ projectInputSchema,
1854
+ projectSchema,
1855
+ projectSetupSchema,
1856
+ projectTransferInputSchema,
1857
+ projectTransferSchema,
1858
+ querySchema,
1859
+ questLifecycleInputSchema,
1860
+ questLifecycleSchema,
1861
+ readinessSchema,
1862
+ repositorySchema,
1863
+ rolePermissions,
1864
+ roleSchema,
1865
+ stageRequestSchema,
1866
+ stagedDeploymentContentSchema,
1867
+ stagedDeploymentKey,
1868
+ stagedDeploymentLimits,
1869
+ stagedDeploymentSchema,
1870
+ stagingAccessInputSchema,
1871
+ stagingAccessModeSchema,
1872
+ stagingAccessSchema,
1873
+ stagingLinkSchema,
1874
+ stagingPathSchema,
1875
+ starterIdSchema,
1876
+ starterTemplates,
1877
+ stockAdditionSchema,
1878
+ stockInputSchema,
1879
+ teamSchema,
1880
+ tokenInputSchema,
1881
+ tokenSchema,
1882
+ verifiedPassSchema,
1883
+ walletBalanceChainsSchema
1884
+ };