@domino-sdk/relay 1.0.0 → 1.1.1
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.
- package/dist/authoring.d.ts +37 -37
- package/dist/{browser-DFe7sWSN.d.ts → browser-Cf1opQjX.d.ts} +115 -115
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +2 -2
- package/dist/{chunk-ZVIRG24J.js → chunk-24AFCBZN.js} +1 -1
- package/dist/{chunk-GZ6FJAXN.js → chunk-DGWMLN35.js} +52 -11
- package/dist/{client-XiuFnug_.d.ts → client-gqnRUHpC.d.ts} +12 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.d.ts +5 -3
- package/dist/react/index.js +25 -4
- package/dist/schema.d.ts +1 -1
- package/dist/server/index.d.ts +229 -5
- package/dist/server/index.js +494 -445
- package/package.json +1 -1
- package/dist/{activity-DeKJsRry.d.ts → activity-B8k9Sa_a.d.ts} +114 -114
package/dist/server/index.js
CHANGED
|
@@ -161,59 +161,79 @@ import {
|
|
|
161
161
|
trackerSummarySchema
|
|
162
162
|
} from "../chunk-JON5SESL.js";
|
|
163
163
|
|
|
164
|
-
// src/server/
|
|
164
|
+
// src/server/test-members.ts
|
|
165
165
|
import { z } from "zod";
|
|
166
|
-
var
|
|
167
|
-
id:
|
|
168
|
-
|
|
166
|
+
var testMemberSchema = z.object({
|
|
167
|
+
id: identifier,
|
|
168
|
+
name: z.string(),
|
|
169
|
+
test: z.literal(true)
|
|
170
|
+
});
|
|
171
|
+
var testMemberCreateSchema = z.object({
|
|
172
|
+
actionId: identifier,
|
|
173
|
+
name: z.string().trim().min(1).max(40)
|
|
174
|
+
}).strict();
|
|
175
|
+
var testMemberActionSchema = submitSchema.omit({ member: true, faultAfterReview: true }).extend({
|
|
176
|
+
operation: z.literal("attempts.submit")
|
|
177
|
+
}).strict();
|
|
178
|
+
var testMemberResetSchema = z.object({ actionId: identifier }).strict();
|
|
179
|
+
var testMemberResetResultSchema = z.object({
|
|
180
|
+
member: identifier,
|
|
181
|
+
deleted: z.literal(true)
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// src/server/webhooks.ts
|
|
185
|
+
import { z as z2 } from "zod";
|
|
186
|
+
var webhookEventSchema = z2.object({
|
|
187
|
+
id: z2.string().uuid(),
|
|
188
|
+
version: z2.literal(1),
|
|
169
189
|
type: activityTypeSchema,
|
|
170
|
-
createdAt:
|
|
171
|
-
organization:
|
|
172
|
-
project:
|
|
173
|
-
environment:
|
|
174
|
-
data:
|
|
190
|
+
createdAt: z2.number().int().nonnegative(),
|
|
191
|
+
organization: z2.string(),
|
|
192
|
+
project: z2.string(),
|
|
193
|
+
environment: z2.enum(["test", "live"]),
|
|
194
|
+
data: z2.record(z2.string(), z2.json())
|
|
175
195
|
});
|
|
176
|
-
var webhookInputSchema =
|
|
177
|
-
url:
|
|
196
|
+
var webhookInputSchema = z2.object({
|
|
197
|
+
url: z2.url().max(2048).refine((value) => {
|
|
178
198
|
const url = new URL(value);
|
|
179
199
|
return url.protocol === "https:" && !url.username && !url.password && !url.hash;
|
|
180
200
|
}, "Use an HTTPS URL without credentials or a fragment"),
|
|
181
|
-
types:
|
|
201
|
+
types: z2.array(activityTypeSchema).min(1).max(100).refine((v) => new Set(v).size === v.length)
|
|
182
202
|
}).strict();
|
|
183
|
-
var webhookUpdateSchema = webhookInputSchema.partial().extend({ enabled:
|
|
184
|
-
var webhookEndpointSchema =
|
|
203
|
+
var webhookUpdateSchema = webhookInputSchema.partial().extend({ enabled: z2.boolean().optional() }).strict();
|
|
204
|
+
var webhookEndpointSchema = z2.object({
|
|
185
205
|
...webhookInputSchema.shape,
|
|
186
|
-
id:
|
|
187
|
-
enabled:
|
|
188
|
-
disabledReason:
|
|
189
|
-
consecutiveFailures:
|
|
190
|
-
createdAt:
|
|
191
|
-
updatedAt:
|
|
206
|
+
id: z2.string().uuid(),
|
|
207
|
+
enabled: z2.boolean(),
|
|
208
|
+
disabledReason: z2.string().nullable(),
|
|
209
|
+
consecutiveFailures: z2.number().int().nonnegative(),
|
|
210
|
+
createdAt: z2.number(),
|
|
211
|
+
updatedAt: z2.number()
|
|
192
212
|
});
|
|
193
|
-
var webhookSecretSchema =
|
|
213
|
+
var webhookSecretSchema = z2.object({
|
|
194
214
|
endpoint: webhookEndpointSchema,
|
|
195
|
-
secret:
|
|
196
|
-
previousValidUntil:
|
|
215
|
+
secret: z2.string(),
|
|
216
|
+
previousValidUntil: z2.number().nullable()
|
|
197
217
|
});
|
|
198
|
-
var webhookDeliverySchema =
|
|
199
|
-
id:
|
|
200
|
-
endpoint:
|
|
218
|
+
var webhookDeliverySchema = z2.object({
|
|
219
|
+
id: z2.string().uuid(),
|
|
220
|
+
endpoint: z2.string().uuid(),
|
|
201
221
|
event: webhookEventSchema,
|
|
202
|
-
status:
|
|
203
|
-
attempts:
|
|
204
|
-
responseStatus:
|
|
205
|
-
lastError:
|
|
206
|
-
createdAt:
|
|
207
|
-
deliveredAt:
|
|
208
|
-
replayOf:
|
|
222
|
+
status: z2.enum(["pending", "delivered", "failed", "skipped"]),
|
|
223
|
+
attempts: z2.number().int().nonnegative(),
|
|
224
|
+
responseStatus: z2.number().nullable(),
|
|
225
|
+
lastError: z2.string().nullable(),
|
|
226
|
+
createdAt: z2.number(),
|
|
227
|
+
deliveredAt: z2.number().nullable(),
|
|
228
|
+
replayOf: z2.string().uuid().nullable()
|
|
209
229
|
});
|
|
210
|
-
var webhookQuerySchema =
|
|
211
|
-
before:
|
|
212
|
-
limit:
|
|
230
|
+
var webhookQuerySchema = z2.object({
|
|
231
|
+
before: z2.string().uuid().optional(),
|
|
232
|
+
limit: z2.coerce.number().int().min(1).max(100).default(50)
|
|
213
233
|
}).strict();
|
|
214
|
-
var webhookDeliveryPageSchema =
|
|
215
|
-
items:
|
|
216
|
-
next:
|
|
234
|
+
var webhookDeliveryPageSchema = z2.object({
|
|
235
|
+
items: z2.array(webhookDeliverySchema),
|
|
236
|
+
next: z2.string().uuid().nullable()
|
|
217
237
|
});
|
|
218
238
|
var WEBHOOK_MAX_BYTES = 64 * 1024;
|
|
219
239
|
async function verifyWebhook(input) {
|
|
@@ -257,8 +277,8 @@ async function verifyWebhook(input) {
|
|
|
257
277
|
}
|
|
258
278
|
|
|
259
279
|
// src/server/resource-lifecycle.ts
|
|
260
|
-
import { z as
|
|
261
|
-
var resourceLifecycleKindSchema =
|
|
280
|
+
import { z as z3 } from "zod";
|
|
281
|
+
var resourceLifecycleKindSchema = z3.enum([
|
|
262
282
|
"tracker",
|
|
263
283
|
"referral",
|
|
264
284
|
"leaderboard",
|
|
@@ -268,28 +288,28 @@ var resourceLifecycleKindSchema = z2.enum([
|
|
|
268
288
|
"image",
|
|
269
289
|
"point-ledger"
|
|
270
290
|
]);
|
|
271
|
-
var managedResourceSchema =
|
|
291
|
+
var managedResourceSchema = z3.object({
|
|
272
292
|
kind: resourceLifecycleKindSchema,
|
|
273
293
|
id: identifier,
|
|
274
294
|
key: identifier.nullable(),
|
|
275
|
-
title:
|
|
276
|
-
archivedAt:
|
|
295
|
+
title: z3.string(),
|
|
296
|
+
archivedAt: z3.number().int().nonnegative().nullable()
|
|
277
297
|
});
|
|
278
|
-
var resourceLifecycleInputSchema =
|
|
279
|
-
actionId:
|
|
298
|
+
var resourceLifecycleInputSchema = z3.object({
|
|
299
|
+
actionId: z3.string().uuid(),
|
|
280
300
|
kind: resourceLifecycleKindSchema,
|
|
281
301
|
resource: identifier,
|
|
282
|
-
archived:
|
|
283
|
-
reason:
|
|
284
|
-
expectedArchivedAt:
|
|
302
|
+
archived: z3.boolean(),
|
|
303
|
+
reason: z3.string().trim().min(1).max(500),
|
|
304
|
+
expectedArchivedAt: z3.number().int().nonnegative().nullable().optional()
|
|
285
305
|
}).strict();
|
|
286
|
-
var resourceLifecycleResultSchema =
|
|
306
|
+
var resourceLifecycleResultSchema = z3.object({
|
|
287
307
|
resource: managedResourceSchema,
|
|
288
|
-
changed:
|
|
308
|
+
changed: z3.boolean()
|
|
289
309
|
});
|
|
290
310
|
|
|
291
311
|
// src/server/index.ts
|
|
292
|
-
import { z as
|
|
312
|
+
import { z as z8 } from "zod";
|
|
293
313
|
|
|
294
314
|
// src/server/errors.ts
|
|
295
315
|
var ManagementErrorCode = {
|
|
@@ -352,10 +372,10 @@ var ManagementError = class extends RequestError {
|
|
|
352
372
|
var DEFAULT_MANAGEMENT_TIMEOUT = MANAGEMENT_TIMEOUT;
|
|
353
373
|
|
|
354
374
|
// src/server/hosting.ts
|
|
355
|
-
import { z as
|
|
375
|
+
import { z as z5 } from "zod";
|
|
356
376
|
|
|
357
377
|
// src/server/starters.ts
|
|
358
|
-
import { z as
|
|
378
|
+
import { z as z4 } from "zod";
|
|
359
379
|
var starterTemplates = [
|
|
360
380
|
{
|
|
361
381
|
id: "campaign",
|
|
@@ -388,66 +408,66 @@ var starterTemplates = [
|
|
|
388
408
|
summary: "A headless Worker with typed routes and interactive API docs, for plugging Domino into your own product."
|
|
389
409
|
}
|
|
390
410
|
];
|
|
391
|
-
var starterIdSchema =
|
|
411
|
+
var starterIdSchema = z4.enum(
|
|
392
412
|
starterTemplates.map((template) => template.id)
|
|
393
413
|
);
|
|
394
414
|
|
|
395
415
|
// src/server/hosting.ts
|
|
396
|
-
var outputPathSchema =
|
|
416
|
+
var outputPathSchema = z5.string().min(1).max(512).refine(
|
|
397
417
|
(path) => path.split("/").every(
|
|
398
418
|
(part) => /^[\w-][\w.-]*$/.test(part) && part !== "node_modules"
|
|
399
419
|
),
|
|
400
420
|
"Expected a relative build output path without hidden segments"
|
|
401
421
|
);
|
|
402
|
-
var appRoutingSchema =
|
|
422
|
+
var appRoutingSchema = z5.enum(["legacy", "transparent"]).default("legacy");
|
|
403
423
|
var APP_SECRET_LIMIT = 50;
|
|
404
|
-
var appSecretNameSchema =
|
|
424
|
+
var appSecretNameSchema = z5.string().regex(
|
|
405
425
|
/^[A-Z_][A-Z0-9_]{0,63}$/,
|
|
406
426
|
"Use 1-64 uppercase letters, digits, and underscores, not starting with a digit"
|
|
407
427
|
).refine(
|
|
408
428
|
(name) => !name.startsWith("DOMINO_") && name !== "ASSETS",
|
|
409
429
|
"DOMINO_ names and ASSETS are reserved for Domino's own bindings"
|
|
410
430
|
);
|
|
411
|
-
var appSecretValueSchema =
|
|
431
|
+
var appSecretValueSchema = z5.string().min(1).refine(
|
|
412
432
|
(value) => new TextEncoder().encode(value).length <= 5120,
|
|
413
433
|
"Secret values can be at most 5 KiB"
|
|
414
434
|
);
|
|
415
|
-
var appSecretInputSchema =
|
|
416
|
-
var appSecretSchema =
|
|
435
|
+
var appSecretInputSchema = z5.object({ value: appSecretValueSchema }).strict();
|
|
436
|
+
var appSecretSchema = z5.object({
|
|
417
437
|
name: appSecretNameSchema,
|
|
418
|
-
updatedAt:
|
|
419
|
-
updatedBy:
|
|
438
|
+
updatedAt: z5.number(),
|
|
439
|
+
updatedBy: z5.string()
|
|
420
440
|
});
|
|
421
|
-
var appSecretDeclarationSchema =
|
|
422
|
-
description:
|
|
423
|
-
required:
|
|
441
|
+
var appSecretDeclarationSchema = z5.object({
|
|
442
|
+
description: z5.string().trim().min(1).max(500),
|
|
443
|
+
required: z5.boolean().default(true)
|
|
424
444
|
}).strict();
|
|
425
|
-
var appSecretDeclarationsSchema =
|
|
445
|
+
var appSecretDeclarationsSchema = z5.record(appSecretNameSchema, appSecretDeclarationSchema).refine(
|
|
426
446
|
(secrets) => Object.keys(secrets).length <= APP_SECRET_LIMIT,
|
|
427
447
|
`Declare at most ${APP_SECRET_LIMIT} app secrets`
|
|
428
448
|
);
|
|
429
|
-
var appSecretListSchema =
|
|
430
|
-
secrets:
|
|
431
|
-
declared:
|
|
449
|
+
var appSecretListSchema = z5.object({
|
|
450
|
+
secrets: z5.array(appSecretSchema),
|
|
451
|
+
declared: z5.array(appSecretDeclarationSchema.extend({ name: appSecretNameSchema })).default([])
|
|
432
452
|
});
|
|
433
|
-
var hostedAppSecretsSchema =
|
|
453
|
+
var hostedAppSecretsSchema = z5.object({ secrets: z5.record(appSecretNameSchema, appSecretValueSchema) }).strict();
|
|
434
454
|
var appScripts = {
|
|
435
455
|
routing: appRoutingSchema,
|
|
436
|
-
devScript:
|
|
437
|
-
checkScript:
|
|
438
|
-
buildScript:
|
|
456
|
+
devScript: z5.string().regex(/^[\w:-]+$/),
|
|
457
|
+
checkScript: z5.string().regex(/^[\w:-]+$/),
|
|
458
|
+
buildScript: z5.string().regex(/^[\w:-]+$/)
|
|
439
459
|
};
|
|
440
460
|
var workerSettings = {
|
|
441
|
-
runWorkerFirst:
|
|
461
|
+
runWorkerFirst: z5.boolean().default(false),
|
|
442
462
|
main: outputPathSchema.refine(
|
|
443
463
|
(path) => /\.m?js$/.test(path),
|
|
444
464
|
"Expected a compiled JavaScript entry"
|
|
445
465
|
),
|
|
446
|
-
compatibilityDate:
|
|
447
|
-
compatibilityFlags:
|
|
448
|
-
vars:
|
|
449
|
-
|
|
450
|
-
|
|
466
|
+
compatibilityDate: z5.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
467
|
+
compatibilityFlags: z5.array(z5.string().min(1)).max(50).default([]),
|
|
468
|
+
vars: z5.record(
|
|
469
|
+
z5.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).refine((name) => name !== "ASSETS"),
|
|
470
|
+
z5.string()
|
|
451
471
|
).default({}),
|
|
452
472
|
secrets: appSecretDeclarationsSchema.default({})
|
|
453
473
|
};
|
|
@@ -456,62 +476,62 @@ var distinctBindingsMessage = {
|
|
|
456
476
|
message: "A name can't be both an app var and a declared secret",
|
|
457
477
|
path: ["secrets"]
|
|
458
478
|
};
|
|
459
|
-
var hostedAppSchema =
|
|
460
|
-
|
|
461
|
-
kind:
|
|
479
|
+
var hostedAppSchema = z5.discriminatedUnion("kind", [
|
|
480
|
+
z5.object({
|
|
481
|
+
kind: z5.literal("static"),
|
|
462
482
|
directory: outputPathSchema,
|
|
463
483
|
...appScripts
|
|
464
484
|
}).strict(),
|
|
465
|
-
|
|
466
|
-
kind:
|
|
485
|
+
z5.object({
|
|
486
|
+
kind: z5.literal("worker"),
|
|
467
487
|
directory: outputPathSchema,
|
|
468
488
|
assetsDirectory: outputPathSchema.optional(),
|
|
469
489
|
...appScripts,
|
|
470
490
|
...workerSettings
|
|
471
491
|
}).strict().refine(distinctBindings, distinctBindingsMessage)
|
|
472
492
|
]);
|
|
473
|
-
var repositorySchema =
|
|
474
|
-
id:
|
|
493
|
+
var repositorySchema = z5.object({
|
|
494
|
+
id: z5.string().uuid(),
|
|
475
495
|
organization: identifier,
|
|
476
496
|
project: identifier,
|
|
477
|
-
remote:
|
|
478
|
-
defaultBranch:
|
|
479
|
-
status:
|
|
497
|
+
remote: z5.string().url(),
|
|
498
|
+
defaultBranch: z5.string(),
|
|
499
|
+
status: z5.enum(["provisioning", "ready"])
|
|
480
500
|
});
|
|
481
|
-
var createRepositorySchema =
|
|
501
|
+
var createRepositorySchema = z5.object({
|
|
482
502
|
/** Omitted: the starter chosen at project setup, else `campaign`. */
|
|
483
503
|
starter: starterIdSchema.optional()
|
|
484
504
|
}).strict();
|
|
485
|
-
var deviceStartSchema =
|
|
486
|
-
challenge:
|
|
505
|
+
var deviceStartSchema = z5.object({
|
|
506
|
+
challenge: z5.string().regex(/^[a-f0-9]{64}$/)
|
|
487
507
|
}).strict();
|
|
488
|
-
var deviceRedeemSchema =
|
|
489
|
-
id:
|
|
490
|
-
verifier:
|
|
508
|
+
var deviceRedeemSchema = z5.object({
|
|
509
|
+
id: z5.string().uuid(),
|
|
510
|
+
verifier: z5.string().min(43).max(128)
|
|
491
511
|
}).strict();
|
|
492
|
-
var deviceApproveSchema =
|
|
493
|
-
id:
|
|
494
|
-
code:
|
|
512
|
+
var deviceApproveSchema = z5.object({
|
|
513
|
+
id: z5.string().uuid(),
|
|
514
|
+
code: z5.string().regex(/^[A-F0-9]{4}-[A-F0-9]{4}$/)
|
|
495
515
|
}).strict();
|
|
496
|
-
var commitSchema =
|
|
497
|
-
var stageRequestSchema =
|
|
516
|
+
var commitSchema = z5.string().regex(/^[a-f0-9]{40}$/);
|
|
517
|
+
var stageRequestSchema = z5.object({
|
|
498
518
|
commit: commitSchema,
|
|
499
|
-
requestId:
|
|
519
|
+
requestId: z5.string().uuid()
|
|
500
520
|
}).strict();
|
|
501
|
-
var buildIdentitySchema =
|
|
521
|
+
var buildIdentitySchema = z5.object({
|
|
502
522
|
routing: appRoutingSchema,
|
|
503
|
-
slug:
|
|
504
|
-
runtime:
|
|
505
|
-
id:
|
|
506
|
-
repository:
|
|
523
|
+
slug: z5.string().min(1).max(35).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).optional(),
|
|
524
|
+
runtime: z5.enum(["simulation", "hosted-test"]).default("simulation"),
|
|
525
|
+
id: z5.string().uuid(),
|
|
526
|
+
repository: z5.string().uuid(),
|
|
507
527
|
organization: identifier,
|
|
508
528
|
project: identifier,
|
|
509
529
|
commit: commitSchema,
|
|
510
|
-
createdAt:
|
|
511
|
-
actor:
|
|
512
|
-
commitMessage:
|
|
530
|
+
createdAt: z5.number(),
|
|
531
|
+
actor: z5.string(),
|
|
532
|
+
commitMessage: z5.string().max(500).optional()
|
|
513
533
|
});
|
|
514
|
-
var buildPhaseSchema =
|
|
534
|
+
var buildPhaseSchema = z5.enum([
|
|
515
535
|
"queued",
|
|
516
536
|
"source",
|
|
517
537
|
"install",
|
|
@@ -521,71 +541,71 @@ var buildPhaseSchema = z4.enum([
|
|
|
521
541
|
"ready",
|
|
522
542
|
"failed"
|
|
523
543
|
]);
|
|
524
|
-
var buildStatusSchema =
|
|
544
|
+
var buildStatusSchema = z5.object({
|
|
525
545
|
phase: buildPhaseSchema,
|
|
526
546
|
failedPhase: buildPhaseSchema.optional(),
|
|
527
|
-
updatedAt:
|
|
528
|
-
message:
|
|
547
|
+
updatedAt: z5.number(),
|
|
548
|
+
message: z5.string()
|
|
529
549
|
});
|
|
530
550
|
var hostedBuildSchema = buildIdentitySchema.extend({
|
|
531
551
|
...buildStatusSchema.shape,
|
|
532
|
-
finished:
|
|
533
|
-
current:
|
|
534
|
-
stagingUrl:
|
|
552
|
+
finished: z5.boolean(),
|
|
553
|
+
current: z5.boolean(),
|
|
554
|
+
stagingUrl: z5.string().url()
|
|
535
555
|
});
|
|
536
|
-
var stagingAccessModeSchema =
|
|
537
|
-
var stagingAccessSchema =
|
|
538
|
-
var stagingAccessInputSchema =
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
mode:
|
|
542
|
-
password:
|
|
556
|
+
var stagingAccessModeSchema = z5.enum(["console", "password"]);
|
|
557
|
+
var stagingAccessSchema = z5.object({ mode: stagingAccessModeSchema });
|
|
558
|
+
var stagingAccessInputSchema = z5.discriminatedUnion("mode", [
|
|
559
|
+
z5.object({ mode: z5.literal("console") }).strict(),
|
|
560
|
+
z5.object({
|
|
561
|
+
mode: z5.literal("password"),
|
|
562
|
+
password: z5.string().min(8).max(128)
|
|
543
563
|
}).strict()
|
|
544
564
|
]);
|
|
545
|
-
var stagingPathSchema =
|
|
565
|
+
var stagingPathSchema = z5.string().max(2048).refine(
|
|
546
566
|
(path) => path.startsWith("/") && !path.startsWith("//") && !path.includes("\\"),
|
|
547
567
|
"Expected a path on the staging host"
|
|
548
568
|
);
|
|
549
|
-
var stagingLinkSchema =
|
|
550
|
-
url:
|
|
551
|
-
expiresAt:
|
|
569
|
+
var stagingLinkSchema = z5.object({
|
|
570
|
+
url: z5.string().url(),
|
|
571
|
+
expiresAt: z5.number()
|
|
552
572
|
});
|
|
553
|
-
var buildSnapshotSchema =
|
|
554
|
-
builds:
|
|
573
|
+
var buildSnapshotSchema = z5.object({
|
|
574
|
+
builds: z5.array(hostedBuildSchema),
|
|
555
575
|
current: hostedBuildSchema.nullable(),
|
|
556
576
|
selected: hostedBuildSchema.nullable(),
|
|
557
|
-
logs:
|
|
577
|
+
logs: z5.string()
|
|
558
578
|
});
|
|
559
|
-
var assetPathSchema =
|
|
579
|
+
var assetPathSchema = z5.string().max(512).refine(
|
|
560
580
|
(path) => path.startsWith("/") && // oxlint-disable-next-line no-control-regex -- Asset paths must reject control characters.
|
|
561
581
|
!/[\\\u0000-\u001f?#%]/.test(path) && path.slice(1).split("/").every((part) => part.length > 0 && !part.startsWith(".")),
|
|
562
582
|
"Expected a public asset path without hidden segments"
|
|
563
583
|
);
|
|
564
|
-
var base64Schema =
|
|
584
|
+
var base64Schema = z5.string().regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/);
|
|
565
585
|
var stagedDeploymentLimits = {
|
|
566
586
|
/** Bytes of JSON, uncompressed. */
|
|
567
587
|
size: 64e6,
|
|
568
588
|
/** Bytes of the Brotli-compressed object. */
|
|
569
589
|
compressedSize: 1e7
|
|
570
590
|
};
|
|
571
|
-
var stagedDeploymentSchema =
|
|
572
|
-
encoding:
|
|
573
|
-
sha256:
|
|
574
|
-
compressedSize:
|
|
575
|
-
size:
|
|
591
|
+
var stagedDeploymentSchema = z5.object({
|
|
592
|
+
encoding: z5.literal("br"),
|
|
593
|
+
sha256: z5.string().regex(/^[0-9a-f]{64}$/),
|
|
594
|
+
compressedSize: z5.number().int().positive().max(stagedDeploymentLimits.compressedSize),
|
|
595
|
+
size: z5.number().int().positive().max(stagedDeploymentLimits.size)
|
|
576
596
|
}).strict();
|
|
577
597
|
var stagedDeploymentContentSchema = stagedDeploymentSchema.extend({
|
|
578
|
-
content:
|
|
598
|
+
content: z5.string().max(Math.ceil(stagedDeploymentLimits.compressedSize / 3) * 4)
|
|
579
599
|
}).strict();
|
|
580
600
|
var stagedDeploymentKey = (build, sha256) => `builds/${build}/deployment/${sha256}.br`;
|
|
581
601
|
var artifactFields = {
|
|
582
602
|
routing: appRoutingSchema,
|
|
583
|
-
worker:
|
|
603
|
+
worker: z5.object({
|
|
584
604
|
...workerSettings,
|
|
585
|
-
modules:
|
|
586
|
-
|
|
605
|
+
modules: z5.array(
|
|
606
|
+
z5.object({
|
|
587
607
|
path: outputPathSchema.refine((path) => path !== "metadata"),
|
|
588
|
-
type:
|
|
608
|
+
type: z5.enum([
|
|
589
609
|
"application/javascript+module",
|
|
590
610
|
"application/wasm",
|
|
591
611
|
"text/plain",
|
|
@@ -595,26 +615,26 @@ var artifactFields = {
|
|
|
595
615
|
}).strict()
|
|
596
616
|
).min(1).max(500)
|
|
597
617
|
}).strict().refine(distinctBindings, distinctBindingsMessage).optional(),
|
|
598
|
-
assets:
|
|
599
|
-
|
|
618
|
+
assets: z5.array(
|
|
619
|
+
z5.object({
|
|
600
620
|
path: assetPathSchema,
|
|
601
621
|
content: base64Schema.max(14e6),
|
|
602
|
-
size:
|
|
622
|
+
size: z5.number().int().min(0).max(1e7)
|
|
603
623
|
}).strict()
|
|
604
624
|
).max(500)
|
|
605
625
|
};
|
|
606
|
-
var buildArtifactsSchema =
|
|
607
|
-
|
|
608
|
-
format:
|
|
626
|
+
var buildArtifactsSchema = z5.discriminatedUnion("format", [
|
|
627
|
+
z5.object({
|
|
628
|
+
format: z5.literal(1),
|
|
609
629
|
...artifactFields,
|
|
610
|
-
quests:
|
|
611
|
-
catalog:
|
|
630
|
+
quests: z5.unknown(),
|
|
631
|
+
catalog: z5.unknown()
|
|
612
632
|
}).strict(),
|
|
613
|
-
|
|
614
|
-
format:
|
|
633
|
+
z5.object({
|
|
634
|
+
format: z5.literal(2),
|
|
615
635
|
...artifactFields,
|
|
616
636
|
deployment: stagedDeploymentSchema,
|
|
617
|
-
images:
|
|
637
|
+
images: z5.array(imageAssetArtifactSchema).max(10)
|
|
618
638
|
}).strict()
|
|
619
639
|
]).superRefine((value, ctx) => {
|
|
620
640
|
if (value.worker) {
|
|
@@ -658,39 +678,39 @@ var buildArtifactsSchema = z4.discriminatedUnion("format", [
|
|
|
658
678
|
});
|
|
659
679
|
|
|
660
680
|
// src/server/development.ts
|
|
661
|
-
import { z as
|
|
662
|
-
var developmentPreflightSchema =
|
|
663
|
-
organization:
|
|
664
|
-
project:
|
|
665
|
-
environment:
|
|
666
|
-
identity:
|
|
667
|
-
exchange:
|
|
668
|
-
activeIntegrations:
|
|
681
|
+
import { z as z6 } from "zod";
|
|
682
|
+
var developmentPreflightSchema = z6.object({
|
|
683
|
+
organization: z6.string(),
|
|
684
|
+
project: z6.string(),
|
|
685
|
+
environment: z6.enum(["test", "live"]),
|
|
686
|
+
identity: z6.object({
|
|
687
|
+
exchange: z6.literal("supported"),
|
|
688
|
+
activeIntegrations: z6.number().int().nonnegative()
|
|
669
689
|
}).optional(),
|
|
670
|
-
staging:
|
|
671
|
-
development:
|
|
672
|
-
status:
|
|
690
|
+
staging: z6.enum(["configured", "blocked"]),
|
|
691
|
+
development: z6.object({
|
|
692
|
+
status: z6.enum(["configured", "blocked"]),
|
|
673
693
|
// How `domino dev` reaches the preview origin: a Cloudflare tunnel, or a direct route on a
|
|
674
694
|
// local development stack. APIs that predate the field use tunnels.
|
|
675
|
-
transport:
|
|
676
|
-
missing:
|
|
677
|
-
authentication:
|
|
695
|
+
transport: z6.enum(["tunnel", "direct"]).default("tunnel"),
|
|
696
|
+
missing: z6.array(z6.string()),
|
|
697
|
+
authentication: z6.array(z6.string())
|
|
678
698
|
}),
|
|
679
|
-
checks:
|
|
680
|
-
|
|
681
|
-
id:
|
|
682
|
-
status:
|
|
683
|
-
message:
|
|
684
|
-
missing:
|
|
685
|
-
issues:
|
|
699
|
+
checks: z6.array(
|
|
700
|
+
z6.object({
|
|
701
|
+
id: z6.string(),
|
|
702
|
+
status: z6.enum(["ok", "error"]),
|
|
703
|
+
message: z6.string(),
|
|
704
|
+
missing: z6.array(z6.string()).optional(),
|
|
705
|
+
issues: z6.array(z6.string()).optional()
|
|
686
706
|
})
|
|
687
707
|
)
|
|
688
708
|
});
|
|
689
709
|
|
|
690
710
|
// src/server/hosted.ts
|
|
691
|
-
import { z as
|
|
711
|
+
import { z as z7 } from "zod";
|
|
692
712
|
var hostedKeyPermissions = ["read", "points", "ingest"];
|
|
693
|
-
var hostedKeyPermissionList =
|
|
713
|
+
var hostedKeyPermissionList = z7.array(z7.string()).transform(
|
|
694
714
|
(values) => values.filter(
|
|
695
715
|
(value) => hostedKeyPermissions.includes(value)
|
|
696
716
|
)
|
|
@@ -702,17 +722,17 @@ var hostedManagementBindings = [
|
|
|
702
722
|
"DOMINO_PROJECT",
|
|
703
723
|
"DOMINO_ENVIRONMENT"
|
|
704
724
|
];
|
|
705
|
-
var hostedKeySecretSchema =
|
|
706
|
-
var hostedKeySchema =
|
|
707
|
-
id:
|
|
725
|
+
var hostedKeySecretSchema = z7.string().regex(/^dhk_[A-Za-z0-9_-]{43}$/, "Expected a hosted app key");
|
|
726
|
+
var hostedKeySchema = z7.object({
|
|
727
|
+
id: z7.string().uuid(),
|
|
708
728
|
token: hostedKeySecretSchema,
|
|
709
729
|
organization: identifier,
|
|
710
730
|
project: identifier,
|
|
711
|
-
environment:
|
|
731
|
+
environment: z7.enum(["test", "live"]),
|
|
712
732
|
permissions: hostedKeyPermissionList,
|
|
713
|
-
expiresAt:
|
|
733
|
+
expiresAt: z7.number().nullable()
|
|
714
734
|
}).strict();
|
|
715
|
-
var hostedDeploymentKeySchema = hostedKeySchema.extend({ apiUrl:
|
|
735
|
+
var hostedDeploymentKeySchema = hostedKeySchema.extend({ apiUrl: z7.string().url() }).strict();
|
|
716
736
|
function hostedManagementClient(env) {
|
|
717
737
|
const missing = hostedManagementBindings.filter((name) => !env[name]);
|
|
718
738
|
if (missing.length) {
|
|
@@ -720,7 +740,7 @@ function hostedManagementClient(env) {
|
|
|
720
740
|
`Missing ${missing.join(", ")}. Domino sets these for hosted apps and domino dev; update the project's vite.config.ts to forward them in development.`
|
|
721
741
|
);
|
|
722
742
|
}
|
|
723
|
-
const environment =
|
|
743
|
+
const environment = z7.enum(["test", "live"]).parse(env.DOMINO_ENVIRONMENT);
|
|
724
744
|
const token = env.DOMINO_MANAGEMENT_KEY;
|
|
725
745
|
return createManagementClient({
|
|
726
746
|
baseUrl: env.DOMINO_API_URL.replace(/\/+$/, ""),
|
|
@@ -732,9 +752,9 @@ function hostedManagementClient(env) {
|
|
|
732
752
|
}
|
|
733
753
|
|
|
734
754
|
// src/server/index.ts
|
|
735
|
-
var environmentSchema =
|
|
736
|
-
var roleSchema =
|
|
737
|
-
var permissionSchema =
|
|
755
|
+
var environmentSchema = z8.enum(["test", "live"]);
|
|
756
|
+
var roleSchema = z8.enum(["editor", "reviewer", "staff"]);
|
|
757
|
+
var permissionSchema = z8.enum([
|
|
738
758
|
"read",
|
|
739
759
|
"publish",
|
|
740
760
|
"review",
|
|
@@ -754,7 +774,7 @@ var permissionSchema = z7.enum([
|
|
|
754
774
|
*/
|
|
755
775
|
"enroll"
|
|
756
776
|
]);
|
|
757
|
-
var permissionListSchema =
|
|
777
|
+
var permissionListSchema = z8.array(z8.string()).transform(
|
|
758
778
|
(values) => values.filter(
|
|
759
779
|
(value) => permissionSchema.safeParse(value).success
|
|
760
780
|
)
|
|
@@ -764,58 +784,58 @@ var rolePermissions = {
|
|
|
764
784
|
reviewer: ["read", "review"],
|
|
765
785
|
staff: ["read", "confirm", "handover"]
|
|
766
786
|
};
|
|
767
|
-
var projectSetupSchema =
|
|
768
|
-
mode:
|
|
769
|
-
brief:
|
|
787
|
+
var projectSetupSchema = z8.object({
|
|
788
|
+
mode: z8.enum(["new", "existing"]),
|
|
789
|
+
brief: z8.string().trim().min(1).max(4e3)
|
|
770
790
|
}).strict();
|
|
771
|
-
var projectSchema =
|
|
772
|
-
slug:
|
|
791
|
+
var projectSchema = z8.object({
|
|
792
|
+
slug: z8.string().min(1).max(35).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
|
773
793
|
/** A response, so fields a newer server adds to the setup are dropped, not rejected. */
|
|
774
|
-
setup:
|
|
794
|
+
setup: z8.object(projectSetupSchema.shape).optional(),
|
|
775
795
|
/** The starter chosen at setup. A plain string, so later starters still parse. */
|
|
776
|
-
starter:
|
|
777
|
-
id:
|
|
796
|
+
starter: z8.string().optional(),
|
|
797
|
+
id: z8.string().min(1),
|
|
778
798
|
organization: identifier,
|
|
779
799
|
project: identifier,
|
|
780
|
-
name:
|
|
781
|
-
subtitle:
|
|
782
|
-
initials:
|
|
783
|
-
color:
|
|
800
|
+
name: z8.string(),
|
|
801
|
+
subtitle: z8.string(),
|
|
802
|
+
initials: z8.string(),
|
|
803
|
+
color: z8.string(),
|
|
784
804
|
permissions: permissionListSchema,
|
|
785
|
-
environments:
|
|
805
|
+
environments: z8.array(environmentSchema)
|
|
786
806
|
});
|
|
787
|
-
var projectInputSchema =
|
|
807
|
+
var projectInputSchema = z8.object({
|
|
788
808
|
actionId: identifier,
|
|
789
|
-
name:
|
|
809
|
+
name: z8.string().trim().min(1).max(80),
|
|
790
810
|
setup: projectSetupSchema.optional(),
|
|
791
811
|
/** The starter a new hosted app begins from, with `setup.mode` "new". */
|
|
792
812
|
starter: starterIdSchema.optional()
|
|
793
813
|
}).strict();
|
|
794
|
-
var projectDeletionInputSchema =
|
|
795
|
-
var projectDeletionSchema =
|
|
814
|
+
var projectDeletionInputSchema = z8.object({ confirm: z8.string().min(1).max(80) }).strict();
|
|
815
|
+
var projectDeletionSchema = z8.object({
|
|
796
816
|
project: identifier,
|
|
797
|
-
purgeAfter:
|
|
817
|
+
purgeAfter: z8.number().int()
|
|
798
818
|
});
|
|
799
|
-
var projectTransferInputSchema =
|
|
800
|
-
var projectTransferSchema =
|
|
819
|
+
var projectTransferInputSchema = z8.object({ organization: identifier, confirm: z8.string().min(1).max(80) }).strict();
|
|
820
|
+
var projectTransferSchema = z8.object({
|
|
801
821
|
organization: identifier,
|
|
802
822
|
project: identifier
|
|
803
823
|
});
|
|
804
|
-
var grantSchema =
|
|
805
|
-
subject:
|
|
806
|
-
roles:
|
|
807
|
-
environments:
|
|
824
|
+
var grantSchema = z8.object({
|
|
825
|
+
subject: z8.string().min(1).max(200),
|
|
826
|
+
roles: z8.array(roleSchema),
|
|
827
|
+
environments: z8.array(environmentSchema)
|
|
808
828
|
}).strict();
|
|
809
|
-
var grantRecordSchema =
|
|
810
|
-
var stockAdditionSchema =
|
|
829
|
+
var grantRecordSchema = z8.object(grantSchema.shape);
|
|
830
|
+
var stockAdditionSchema = z8.object({
|
|
811
831
|
item: identifier,
|
|
812
|
-
quantity:
|
|
832
|
+
quantity: z8.number().int(),
|
|
813
833
|
actionId: identifier
|
|
814
834
|
});
|
|
815
|
-
var completionRevokeSchema =
|
|
835
|
+
var completionRevokeSchema = z8.object({
|
|
816
836
|
actionId: identifier,
|
|
817
|
-
reason:
|
|
818
|
-
freeOccurrence:
|
|
837
|
+
reason: z8.string().trim().min(1).max(500),
|
|
838
|
+
freeOccurrence: z8.boolean().default(false)
|
|
819
839
|
}).strict();
|
|
820
840
|
var RevokedEntitlementOutcome = {
|
|
821
841
|
/** No other completion grants the reward: it is void, after cancelling a handover in progress. */
|
|
@@ -843,207 +863,209 @@ var RevokedReferralOutcome = {
|
|
|
843
863
|
/** Qualified on another accepted completion of the program's quest instead. */
|
|
844
864
|
Requalified: "requalified"
|
|
845
865
|
};
|
|
846
|
-
var entitlementOutcomeSchema =
|
|
847
|
-
var deliveryOutcomeSchema =
|
|
848
|
-
var referralOutcomeSchema =
|
|
849
|
-
var completionRevocationSchema =
|
|
866
|
+
var entitlementOutcomeSchema = z8.string().min(1).max(64);
|
|
867
|
+
var deliveryOutcomeSchema = z8.string().min(1).max(64);
|
|
868
|
+
var referralOutcomeSchema = z8.string().min(1).max(64);
|
|
869
|
+
var completionRevocationSchema = z8.object({
|
|
850
870
|
completion: identifier,
|
|
851
871
|
quest: identifier,
|
|
852
872
|
member: identifier,
|
|
853
|
-
revokedAt:
|
|
854
|
-
occurrenceFreed:
|
|
855
|
-
points:
|
|
856
|
-
|
|
873
|
+
revokedAt: z8.number(),
|
|
874
|
+
occurrenceFreed: z8.boolean(),
|
|
875
|
+
points: z8.array(
|
|
876
|
+
z8.object({
|
|
857
877
|
entry: identifier,
|
|
858
878
|
balance: identifier,
|
|
859
879
|
reversal: identifier.nullable(),
|
|
860
|
-
reversed:
|
|
861
|
-
unreversed:
|
|
880
|
+
reversed: z8.number().int(),
|
|
881
|
+
unreversed: z8.number().int()
|
|
862
882
|
})
|
|
863
883
|
),
|
|
864
|
-
entitlements:
|
|
865
|
-
|
|
884
|
+
entitlements: z8.array(
|
|
885
|
+
z8.object({
|
|
866
886
|
entitlement: identifier,
|
|
867
887
|
reward: identifier,
|
|
868
888
|
outcome: entitlementOutcomeSchema,
|
|
869
|
-
status:
|
|
889
|
+
status: z8.string()
|
|
870
890
|
})
|
|
871
891
|
),
|
|
872
|
-
deliveries:
|
|
873
|
-
|
|
874
|
-
delivery:
|
|
875
|
-
roleId:
|
|
892
|
+
deliveries: z8.array(
|
|
893
|
+
z8.object({
|
|
894
|
+
delivery: z8.string(),
|
|
895
|
+
roleId: z8.string(),
|
|
876
896
|
outcome: deliveryOutcomeSchema,
|
|
877
897
|
/**
|
|
878
898
|
* By Relay's records, another accepted, unrevoked completion of the member also granted this
|
|
879
899
|
* role to the same Discord account and server. Relay does not read Discord's membership.
|
|
880
900
|
*/
|
|
881
|
-
stillGranted:
|
|
901
|
+
stillGranted: z8.boolean()
|
|
882
902
|
})
|
|
883
903
|
),
|
|
884
|
-
referrals:
|
|
885
|
-
|
|
904
|
+
referrals: z8.array(
|
|
905
|
+
z8.object({
|
|
886
906
|
program: identifier,
|
|
887
907
|
outcome: referralOutcomeSchema
|
|
888
908
|
})
|
|
889
909
|
),
|
|
890
|
-
streakMilestone:
|
|
910
|
+
streakMilestone: z8.boolean()
|
|
891
911
|
});
|
|
892
|
-
var accessSchema =
|
|
893
|
-
actor:
|
|
894
|
-
organization:
|
|
895
|
-
admin:
|
|
896
|
-
local:
|
|
897
|
-
projects:
|
|
912
|
+
var accessSchema = z8.object({
|
|
913
|
+
actor: z8.string(),
|
|
914
|
+
organization: z8.string(),
|
|
915
|
+
admin: z8.boolean(),
|
|
916
|
+
local: z8.boolean(),
|
|
917
|
+
projects: z8.array(projectSchema)
|
|
898
918
|
});
|
|
899
|
-
var querySchema =
|
|
900
|
-
q:
|
|
901
|
-
filter:
|
|
902
|
-
offset:
|
|
903
|
-
limit:
|
|
919
|
+
var querySchema = z8.object({
|
|
920
|
+
q: z8.string().max(200).default(""),
|
|
921
|
+
filter: z8.string().max(50).default("all"),
|
|
922
|
+
offset: z8.coerce.number().int().min(0).max(1e6).default(0),
|
|
923
|
+
limit: z8.coerce.number().int().min(1).max(100).default(25)
|
|
904
924
|
});
|
|
905
|
-
var accountProfileSchema =
|
|
906
|
-
name:
|
|
925
|
+
var accountProfileSchema = z8.object({
|
|
926
|
+
name: z8.string().optional(),
|
|
907
927
|
/** The account's handle, where the provider has one (X and Discord). */
|
|
908
|
-
username:
|
|
909
|
-
email:
|
|
910
|
-
emailVerified:
|
|
911
|
-
imageUrl:
|
|
928
|
+
username: z8.string().optional(),
|
|
929
|
+
email: z8.string().optional(),
|
|
930
|
+
emailVerified: z8.boolean().default(false),
|
|
931
|
+
imageUrl: z8.string().url().optional()
|
|
912
932
|
});
|
|
913
|
-
var memberAccountSchema =
|
|
933
|
+
var memberAccountSchema = z8.object({
|
|
914
934
|
/** `wallet` for wallet sign-in, `account` for every other connected account. */
|
|
915
|
-
kind:
|
|
916
|
-
provider:
|
|
917
|
-
subject:
|
|
918
|
-
signInEnabled:
|
|
935
|
+
kind: z8.enum(["account", "wallet"]),
|
|
936
|
+
provider: z8.string(),
|
|
937
|
+
subject: z8.string(),
|
|
938
|
+
signInEnabled: z8.boolean(),
|
|
919
939
|
profile: accountProfileSchema.optional()
|
|
920
940
|
});
|
|
921
|
-
var operationSchema =
|
|
922
|
-
target:
|
|
923
|
-
paused:
|
|
924
|
-
revision:
|
|
925
|
-
reason:
|
|
926
|
-
actor:
|
|
927
|
-
changedAt:
|
|
941
|
+
var operationSchema = z8.object({
|
|
942
|
+
target: z8.string(),
|
|
943
|
+
paused: z8.boolean(),
|
|
944
|
+
revision: z8.number().int(),
|
|
945
|
+
reason: z8.string(),
|
|
946
|
+
actor: z8.string().nullable(),
|
|
947
|
+
changedAt: z8.number()
|
|
928
948
|
});
|
|
929
|
-
var operationInputSchema =
|
|
930
|
-
target:
|
|
931
|
-
|
|
932
|
-
|
|
949
|
+
var operationInputSchema = z8.object({
|
|
950
|
+
target: z8.union([
|
|
951
|
+
z8.literal("redemptions"),
|
|
952
|
+
z8.string().regex(/^quest:[\w-]+$/)
|
|
933
953
|
]),
|
|
934
|
-
paused:
|
|
935
|
-
revision:
|
|
936
|
-
reason:
|
|
954
|
+
paused: z8.boolean(),
|
|
955
|
+
revision: z8.number().int().nonnegative(),
|
|
956
|
+
reason: z8.string().trim().min(1).max(500),
|
|
937
957
|
actionId: identifier
|
|
938
958
|
}).strict();
|
|
939
|
-
var questLifecycleInputSchema =
|
|
959
|
+
var questLifecycleInputSchema = z8.object({
|
|
940
960
|
quest: identifier,
|
|
941
961
|
expectedRelease: identifier.optional(),
|
|
942
|
-
archived:
|
|
943
|
-
reason:
|
|
962
|
+
archived: z8.boolean(),
|
|
963
|
+
reason: z8.string().trim().min(1).max(500),
|
|
944
964
|
actionId: identifier
|
|
945
965
|
}).strict();
|
|
946
|
-
var questLifecycleSchema =
|
|
966
|
+
var questLifecycleSchema = z8.object({
|
|
947
967
|
quest: identifier,
|
|
948
968
|
key: identifier.nullable(),
|
|
949
|
-
title:
|
|
969
|
+
title: z8.string(),
|
|
950
970
|
release: identifier,
|
|
951
|
-
lifecycle:
|
|
952
|
-
changed:
|
|
971
|
+
lifecycle: z8.enum(["active", "paused", "archived"]),
|
|
972
|
+
changed: z8.boolean()
|
|
953
973
|
});
|
|
954
|
-
var memberSchema =
|
|
955
|
-
id:
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
974
|
+
var memberSchema = z8.object({
|
|
975
|
+
id: z8.string(),
|
|
976
|
+
test: z8.boolean().optional(),
|
|
977
|
+
name: z8.string().nullable().optional(),
|
|
978
|
+
accounts: z8.array(memberAccountSchema).default([]),
|
|
979
|
+
attempts: z8.number(),
|
|
980
|
+
completions: z8.number(),
|
|
981
|
+
rewards: z8.number(),
|
|
982
|
+
lastActivity: z8.number().nullable()
|
|
961
983
|
});
|
|
962
|
-
var personSchema =
|
|
963
|
-
id:
|
|
964
|
-
accounts:
|
|
984
|
+
var personSchema = z8.object({
|
|
985
|
+
id: z8.string(),
|
|
986
|
+
accounts: z8.array(memberAccountSchema).default([])
|
|
965
987
|
});
|
|
966
|
-
var metricsSchema =
|
|
967
|
-
quests:
|
|
968
|
-
members:
|
|
969
|
-
attempts:
|
|
970
|
-
completions:
|
|
971
|
-
review:
|
|
972
|
-
failed:
|
|
973
|
-
entitlements:
|
|
988
|
+
var metricsSchema = z8.object({
|
|
989
|
+
quests: z8.number(),
|
|
990
|
+
members: z8.number(),
|
|
991
|
+
attempts: z8.number(),
|
|
992
|
+
completions: z8.number(),
|
|
993
|
+
review: z8.number(),
|
|
994
|
+
failed: z8.number(),
|
|
995
|
+
entitlements: z8.number()
|
|
974
996
|
});
|
|
975
|
-
var readinessSchema =
|
|
976
|
-
checks:
|
|
977
|
-
|
|
978
|
-
id:
|
|
979
|
-
status:
|
|
980
|
-
title:
|
|
981
|
-
detail:
|
|
997
|
+
var readinessSchema = z8.object({
|
|
998
|
+
checks: z8.array(
|
|
999
|
+
z8.object({
|
|
1000
|
+
id: z8.string(),
|
|
1001
|
+
status: z8.enum(["ready", "blocked"]),
|
|
1002
|
+
title: z8.string(),
|
|
1003
|
+
detail: z8.string()
|
|
982
1004
|
})
|
|
983
1005
|
)
|
|
984
1006
|
});
|
|
985
|
-
var inventorySchema =
|
|
986
|
-
item:
|
|
987
|
-
name:
|
|
988
|
-
available:
|
|
989
|
-
reserved:
|
|
990
|
-
allocated:
|
|
1007
|
+
var inventorySchema = z8.object({
|
|
1008
|
+
item: z8.string(),
|
|
1009
|
+
name: z8.string().nullable().default(null),
|
|
1010
|
+
available: z8.number(),
|
|
1011
|
+
reserved: z8.number(),
|
|
1012
|
+
allocated: z8.number().default(0)
|
|
991
1013
|
});
|
|
992
|
-
var auditRecordSchema =
|
|
993
|
-
id:
|
|
994
|
-
action:
|
|
995
|
-
actor:
|
|
996
|
-
detail:
|
|
997
|
-
at:
|
|
998
|
-
attempt:
|
|
1014
|
+
var auditRecordSchema = z8.object({
|
|
1015
|
+
id: z8.string(),
|
|
1016
|
+
action: z8.string(),
|
|
1017
|
+
actor: z8.string().nullable(),
|
|
1018
|
+
detail: z8.string(),
|
|
1019
|
+
at: z8.number(),
|
|
1020
|
+
attempt: z8.string().nullable()
|
|
999
1021
|
});
|
|
1000
|
-
var pageSchema =
|
|
1022
|
+
var pageSchema = z8.object({
|
|
1001
1023
|
snapshot: snapshotSchema,
|
|
1002
|
-
members:
|
|
1003
|
-
people:
|
|
1024
|
+
members: z8.array(memberSchema),
|
|
1025
|
+
people: z8.array(personSchema).default([]),
|
|
1004
1026
|
metrics: metricsSchema,
|
|
1005
|
-
total:
|
|
1006
|
-
offset:
|
|
1007
|
-
limit:
|
|
1008
|
-
inventory:
|
|
1009
|
-
operations:
|
|
1010
|
-
audit:
|
|
1011
|
-
questCounts:
|
|
1027
|
+
total: z8.number(),
|
|
1028
|
+
offset: z8.number(),
|
|
1029
|
+
limit: z8.number(),
|
|
1030
|
+
inventory: z8.array(inventorySchema),
|
|
1031
|
+
operations: z8.array(operationSchema).default([]),
|
|
1032
|
+
audit: z8.array(auditRecordSchema).default([]),
|
|
1033
|
+
questCounts: z8.record(z8.string(), z8.number())
|
|
1012
1034
|
});
|
|
1013
|
-
var managedOAuthAccountBaseSchema =
|
|
1014
|
-
provider:
|
|
1015
|
-
revision:
|
|
1035
|
+
var managedOAuthAccountBaseSchema = z8.object({
|
|
1036
|
+
provider: z8.enum(["x", "discord"]),
|
|
1037
|
+
revision: z8.number().int().nonnegative()
|
|
1016
1038
|
});
|
|
1017
|
-
var managedOAuthAccountSchema =
|
|
1039
|
+
var managedOAuthAccountSchema = z8.discriminatedUnion("status", [
|
|
1018
1040
|
managedOAuthAccountBaseSchema.extend({
|
|
1019
|
-
status:
|
|
1020
|
-
subject:
|
|
1021
|
-
linkedAt:
|
|
1041
|
+
status: z8.literal("connected"),
|
|
1042
|
+
subject: z8.string().min(1),
|
|
1043
|
+
linkedAt: z8.number()
|
|
1022
1044
|
}),
|
|
1023
|
-
managedOAuthAccountBaseSchema.extend({ status:
|
|
1045
|
+
managedOAuthAccountBaseSchema.extend({ status: z8.literal("disconnected") })
|
|
1024
1046
|
]);
|
|
1025
|
-
var memberOAuthUnlinkInputSchema =
|
|
1026
|
-
provider:
|
|
1027
|
-
subject:
|
|
1028
|
-
revision:
|
|
1029
|
-
reason:
|
|
1047
|
+
var memberOAuthUnlinkInputSchema = z8.object({
|
|
1048
|
+
provider: z8.enum(["x", "discord"]),
|
|
1049
|
+
subject: z8.string().min(1).max(4096),
|
|
1050
|
+
revision: z8.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER - 1),
|
|
1051
|
+
reason: z8.string().trim().min(1).max(500)
|
|
1030
1052
|
}).strict();
|
|
1031
1053
|
var managedWalletSchema = linkedWalletSchema.extend({
|
|
1032
|
-
status:
|
|
1033
|
-
unlinkedAt:
|
|
1054
|
+
status: z8.enum(["linked", "unlinked"]),
|
|
1055
|
+
unlinkedAt: z8.number().int().nullable(),
|
|
1034
1056
|
/** "member", or the operator or key that unlinked it. */
|
|
1035
|
-
unlinkedBy:
|
|
1057
|
+
unlinkedBy: z8.string().nullable()
|
|
1036
1058
|
});
|
|
1037
1059
|
var managedMemberIdentitySchema = memberIdentitySchema.extend({
|
|
1038
|
-
status:
|
|
1039
|
-
unlinkedAt:
|
|
1060
|
+
status: z8.enum(["linked", "unlinked"]),
|
|
1061
|
+
unlinkedAt: z8.number().int().nullable(),
|
|
1040
1062
|
/** The operator or key that unlinked it. */
|
|
1041
|
-
unlinkedBy:
|
|
1063
|
+
unlinkedBy: z8.string().nullable()
|
|
1042
1064
|
});
|
|
1043
|
-
var memberIdentityChangeInputSchema =
|
|
1065
|
+
var memberIdentityChangeInputSchema = z8.object({
|
|
1044
1066
|
kind: appIdentityKindSchema,
|
|
1045
|
-
subject:
|
|
1046
|
-
reason:
|
|
1067
|
+
subject: z8.string().min(1).max(256),
|
|
1068
|
+
reason: z8.string().trim().min(1).max(500)
|
|
1047
1069
|
}).strict();
|
|
1048
1070
|
var balanceCheckSchema = walletBalanceSchema.pick({
|
|
1049
1071
|
chain: true,
|
|
@@ -1053,57 +1075,57 @@ var balanceCheckSchema = walletBalanceSchema.pick({
|
|
|
1053
1075
|
wallets: true,
|
|
1054
1076
|
observedAt: true
|
|
1055
1077
|
}).extend({ attempt: identifier });
|
|
1056
|
-
var walletBalanceChainsSchema =
|
|
1057
|
-
chains:
|
|
1058
|
-
|
|
1059
|
-
chain:
|
|
1060
|
-
|
|
1078
|
+
var walletBalanceChainsSchema = z8.object({
|
|
1079
|
+
chains: z8.array(
|
|
1080
|
+
z8.object({
|
|
1081
|
+
chain: z8.union([
|
|
1082
|
+
z8.literal(solanaMainnet),
|
|
1061
1083
|
cosmosNetworkSchema,
|
|
1062
1084
|
evmChainIdSchema
|
|
1063
1085
|
]),
|
|
1064
|
-
name:
|
|
1065
|
-
testnet:
|
|
1086
|
+
name: z8.string(),
|
|
1087
|
+
testnet: z8.boolean()
|
|
1066
1088
|
})
|
|
1067
1089
|
)
|
|
1068
1090
|
});
|
|
1069
|
-
var memberWalletUnlinkInputSchema = walletUnlinkInputSchema.extend({ reason:
|
|
1091
|
+
var memberWalletUnlinkInputSchema = walletUnlinkInputSchema.extend({ reason: z8.string().trim().min(1).max(500) }).strict();
|
|
1070
1092
|
var memberWalletSignInInputSchema = walletUnlinkInputSchema.extend({
|
|
1071
|
-
enabled:
|
|
1072
|
-
reason:
|
|
1093
|
+
enabled: z8.boolean(),
|
|
1094
|
+
reason: z8.string().trim().min(1).max(500)
|
|
1073
1095
|
}).strict();
|
|
1074
|
-
var participantSignInSchema =
|
|
1075
|
-
providers:
|
|
1076
|
-
|
|
1096
|
+
var participantSignInSchema = z8.object({
|
|
1097
|
+
providers: z8.array(
|
|
1098
|
+
z8.object({ provider: authProviderSchema, configured: z8.boolean() })
|
|
1077
1099
|
),
|
|
1078
|
-
email:
|
|
1100
|
+
email: z8.boolean(),
|
|
1079
1101
|
/** Wallet families: `"solana"`, `"eip155"`, `"cosmos"`. */
|
|
1080
1102
|
wallets: walletSignInNetworksSchema,
|
|
1081
1103
|
/** Why participants cannot sign in to this project, or null. */
|
|
1082
|
-
issue:
|
|
1083
|
-
updatedAt:
|
|
1084
|
-
updatedBy:
|
|
1104
|
+
issue: z8.string().nullable(),
|
|
1105
|
+
updatedAt: z8.number().nullable(),
|
|
1106
|
+
updatedBy: z8.string().nullable()
|
|
1085
1107
|
});
|
|
1086
|
-
var participantSignInInputSchema =
|
|
1108
|
+
var participantSignInInputSchema = z8.object({
|
|
1087
1109
|
wallets: walletSignInNetworksSchema
|
|
1088
1110
|
}).strict();
|
|
1089
|
-
var memberDetailSchema =
|
|
1111
|
+
var memberDetailSchema = z8.object({
|
|
1090
1112
|
snapshot: snapshotSchema,
|
|
1091
1113
|
member: memberSchema,
|
|
1092
1114
|
progress: memberProgressSchema,
|
|
1093
1115
|
/** Current and historical campaign enrollment state, including inactive enrollments. */
|
|
1094
|
-
campaignEnrollments:
|
|
1095
|
-
passes:
|
|
1096
|
-
|
|
1097
|
-
provider:
|
|
1098
|
-
event:
|
|
1099
|
-
subject:
|
|
1116
|
+
campaignEnrollments: z8.array(campaignEnrollmentSchema).default([]),
|
|
1117
|
+
passes: z8.array(
|
|
1118
|
+
z8.object({
|
|
1119
|
+
provider: z8.string(),
|
|
1120
|
+
event: z8.string(),
|
|
1121
|
+
subject: z8.string(),
|
|
1100
1122
|
attempt: identifier.nullable()
|
|
1101
1123
|
})
|
|
1102
1124
|
).default([]),
|
|
1103
1125
|
/** Linked and unlinked wallets. */
|
|
1104
|
-
wallets:
|
|
1126
|
+
wallets: z8.array(managedWalletSchema),
|
|
1105
1127
|
/** The member's 10 most recent recorded balance reads, newest first. */
|
|
1106
|
-
balanceChecks:
|
|
1128
|
+
balanceChecks: z8.array(balanceCheckSchema),
|
|
1107
1129
|
/** The member's participant profile in this project. */
|
|
1108
1130
|
profile: managedProfileSchema.nullable(),
|
|
1109
1131
|
/**
|
|
@@ -1111,44 +1133,44 @@ var memberDetailSchema = z7.object({
|
|
|
1111
1133
|
* member ID: their selected X and Discord accounts and their `app:<name>` identities in this
|
|
1112
1134
|
* project, including app identities an operator unlinked, by kind.
|
|
1113
1135
|
*/
|
|
1114
|
-
identities:
|
|
1136
|
+
identities: z8.array(managedMemberIdentitySchema)
|
|
1115
1137
|
});
|
|
1116
|
-
var stockInputSchema =
|
|
1138
|
+
var stockInputSchema = z8.object({
|
|
1117
1139
|
item: identifier,
|
|
1118
|
-
quantity:
|
|
1140
|
+
quantity: z8.number().int().positive().max(1e6),
|
|
1119
1141
|
actionId: identifier
|
|
1120
1142
|
}).strict();
|
|
1121
|
-
var ingestTrackerScopeSchema =
|
|
1122
|
-
var tokenScopeInputSchema =
|
|
1123
|
-
var tokenInputSchema =
|
|
1124
|
-
name:
|
|
1143
|
+
var ingestTrackerScopeSchema = z8.array(identifier).min(1).max(100).nullable();
|
|
1144
|
+
var tokenScopeInputSchema = z8.object({ ingestTrackers: ingestTrackerScopeSchema }).strict();
|
|
1145
|
+
var tokenInputSchema = z8.object({
|
|
1146
|
+
name: z8.string().trim().min(1).max(80),
|
|
1125
1147
|
project: identifier,
|
|
1126
1148
|
environment: environmentSchema,
|
|
1127
|
-
permissions:
|
|
1149
|
+
permissions: z8.array(permissionSchema).min(1),
|
|
1128
1150
|
ingestTrackers: ingestTrackerScopeSchema.optional(),
|
|
1129
|
-
days:
|
|
1151
|
+
days: z8.number().int().min(1).max(90).default(30)
|
|
1130
1152
|
}).strict();
|
|
1131
|
-
var tokenSchema =
|
|
1132
|
-
id:
|
|
1133
|
-
name:
|
|
1134
|
-
project:
|
|
1153
|
+
var tokenSchema = z8.object({
|
|
1154
|
+
id: z8.string(),
|
|
1155
|
+
name: z8.string(),
|
|
1156
|
+
project: z8.string(),
|
|
1135
1157
|
environment: environmentSchema,
|
|
1136
1158
|
permissions: permissionListSchema,
|
|
1137
1159
|
ingestTrackers: ingestTrackerScopeSchema.optional(),
|
|
1138
|
-
expiresAt:
|
|
1160
|
+
expiresAt: z8.number()
|
|
1139
1161
|
});
|
|
1140
|
-
var issuedTokenSchema = tokenSchema.extend({ token:
|
|
1141
|
-
var teamSchema =
|
|
1142
|
-
|
|
1162
|
+
var issuedTokenSchema = tokenSchema.extend({ token: z8.string() });
|
|
1163
|
+
var teamSchema = z8.array(
|
|
1164
|
+
z8.object({ id: z8.string(), label: z8.string() })
|
|
1143
1165
|
);
|
|
1144
|
-
var memberLookupSchema =
|
|
1145
|
-
provider:
|
|
1146
|
-
subject:
|
|
1166
|
+
var memberLookupSchema = z8.object({
|
|
1167
|
+
provider: z8.string().min(1).max(200),
|
|
1168
|
+
subject: z8.string().min(1).max(2048)
|
|
1147
1169
|
}).strict();
|
|
1148
|
-
var verifiedPassSchema =
|
|
1170
|
+
var verifiedPassSchema = z8.object({
|
|
1149
1171
|
provider: identifier,
|
|
1150
1172
|
event: identifier,
|
|
1151
|
-
subject:
|
|
1173
|
+
subject: z8.string().min(1).max(2048),
|
|
1152
1174
|
member: identifier,
|
|
1153
1175
|
quest: identifier
|
|
1154
1176
|
}).strict();
|
|
@@ -1166,9 +1188,9 @@ function queryString(values) {
|
|
|
1166
1188
|
).toString();
|
|
1167
1189
|
return query ? "?" + query : "";
|
|
1168
1190
|
}
|
|
1169
|
-
var serverErrorSchema =
|
|
1170
|
-
error:
|
|
1171
|
-
code:
|
|
1191
|
+
var serverErrorSchema = z8.looseObject({
|
|
1192
|
+
error: z8.string(),
|
|
1193
|
+
code: z8.string().optional()
|
|
1172
1194
|
});
|
|
1173
1195
|
function checkedTimeout(timeout) {
|
|
1174
1196
|
if (timeout !== void 0 && !validTimeout(timeout)) {
|
|
@@ -1187,7 +1209,7 @@ function clientFailure(error) {
|
|
|
1187
1209
|
return new ManagementError({
|
|
1188
1210
|
kind: "client",
|
|
1189
1211
|
code: ManagementErrorCode.InvalidInput,
|
|
1190
|
-
message: error instanceof
|
|
1212
|
+
message: error instanceof z8.ZodError ? `Invalid management request: ${z8.prettifyError(error)}` : error instanceof Error ? error.message : "Invalid management request",
|
|
1191
1213
|
cause: error
|
|
1192
1214
|
});
|
|
1193
1215
|
}
|
|
@@ -1439,12 +1461,12 @@ function createManagementClient(options) {
|
|
|
1439
1461
|
call
|
|
1440
1462
|
);
|
|
1441
1463
|
}
|
|
1442
|
-
const ok =
|
|
1464
|
+
const ok = z8.object({ ok: z8.literal(true) });
|
|
1443
1465
|
return guarded({
|
|
1444
1466
|
raw,
|
|
1445
1467
|
request,
|
|
1446
1468
|
trackers: {
|
|
1447
|
-
list: (call) => get("/trackers",
|
|
1469
|
+
list: (call) => get("/trackers", z8.array(trackerStatusSchema), call),
|
|
1448
1470
|
get: (reference, call) => get(
|
|
1449
1471
|
`/trackers/${identifier.parse(reference)}`,
|
|
1450
1472
|
trackerStatusSchema,
|
|
@@ -1532,7 +1554,7 @@ function createManagementClient(options) {
|
|
|
1532
1554
|
engagementPublishSchema.parse(input),
|
|
1533
1555
|
call
|
|
1534
1556
|
),
|
|
1535
|
-
list: (call) => get("/engagement",
|
|
1557
|
+
list: (call) => get("/engagement", z8.array(engagementRuleSchema), call),
|
|
1536
1558
|
page: (input, call) => get(
|
|
1537
1559
|
"/engagement/history" + queryString(engagementPageQuerySchema.parse(input)),
|
|
1538
1560
|
engagementPageSchema,
|
|
@@ -1552,7 +1574,7 @@ function createManagementClient(options) {
|
|
|
1552
1574
|
)
|
|
1553
1575
|
},
|
|
1554
1576
|
pointLedgers: {
|
|
1555
|
-
list: (call) => get("/point-ledgers",
|
|
1577
|
+
list: (call) => get("/point-ledgers", z8.array(managedPointLedgerSchema), call),
|
|
1556
1578
|
save: (input, call) => post(
|
|
1557
1579
|
"/point-ledgers/update",
|
|
1558
1580
|
managedPointLedgerSchema,
|
|
@@ -1567,7 +1589,7 @@ function createManagementClient(options) {
|
|
|
1567
1589
|
)
|
|
1568
1590
|
},
|
|
1569
1591
|
points: {
|
|
1570
|
-
ledgers: (call) => get("/point-ledgers",
|
|
1592
|
+
ledgers: (call) => get("/point-ledgers", z8.array(managedPointLedgerSchema), call),
|
|
1571
1593
|
createLedger: (input, call) => create(
|
|
1572
1594
|
"/point-ledgers",
|
|
1573
1595
|
pointLedgerSchema,
|
|
@@ -1588,9 +1610,9 @@ function createManagementClient(options) {
|
|
|
1588
1610
|
),
|
|
1589
1611
|
history: (member, balance, before, call) => get(
|
|
1590
1612
|
`/points/${identifier.parse(member)}/${identifier.parse(balance)}/history${queryString({ before })}`,
|
|
1591
|
-
|
|
1592
|
-
items:
|
|
1593
|
-
next:
|
|
1613
|
+
z8.object({
|
|
1614
|
+
items: z8.array(pointsEntrySchema),
|
|
1615
|
+
next: z8.number().nullable()
|
|
1594
1616
|
}),
|
|
1595
1617
|
call
|
|
1596
1618
|
)
|
|
@@ -1602,7 +1624,7 @@ function createManagementClient(options) {
|
|
|
1602
1624
|
referralHistorySchema,
|
|
1603
1625
|
call
|
|
1604
1626
|
),
|
|
1605
|
-
list: (call) => get("/referrals",
|
|
1627
|
+
list: (call) => get("/referrals", z8.array(publishedReferralSchema), call),
|
|
1606
1628
|
participants: (before, call) => get(
|
|
1607
1629
|
`/referrals/participants${queryString({ before })}`,
|
|
1608
1630
|
referralManagementSchema,
|
|
@@ -1616,7 +1638,7 @@ function createManagementClient(options) {
|
|
|
1616
1638
|
)
|
|
1617
1639
|
},
|
|
1618
1640
|
leaderboards: {
|
|
1619
|
-
list: (call) => get("/leaderboards",
|
|
1641
|
+
list: (call) => get("/leaderboards", z8.array(publishedLeaderboardSchema), call),
|
|
1620
1642
|
standings: (board, input = {}, call) => {
|
|
1621
1643
|
const query = leaderboardQuerySchema.parse(input);
|
|
1622
1644
|
return get(
|
|
@@ -1630,12 +1652,12 @@ function createManagementClient(options) {
|
|
|
1630
1652
|
},
|
|
1631
1653
|
history: (board, call) => get(
|
|
1632
1654
|
`/leaderboards/${identifier.parse(board)}/history`,
|
|
1633
|
-
|
|
1655
|
+
z8.array(publishedLeaderboardSchema),
|
|
1634
1656
|
call
|
|
1635
1657
|
),
|
|
1636
1658
|
exclusions: (board, call) => get(
|
|
1637
1659
|
`/leaderboards/${identifier.parse(board)}/exclusions`,
|
|
1638
|
-
|
|
1660
|
+
z8.array(z8.object({ member: identifier })),
|
|
1639
1661
|
call
|
|
1640
1662
|
),
|
|
1641
1663
|
exclude: (board, input, call) => post(
|
|
@@ -1652,7 +1674,7 @@ function createManagementClient(options) {
|
|
|
1652
1674
|
),
|
|
1653
1675
|
settlements: (board, call) => get(
|
|
1654
1676
|
`/leaderboards/${identifier.parse(board)}/settlements`,
|
|
1655
|
-
|
|
1677
|
+
z8.array(leaderboardSettlementSummarySchema),
|
|
1656
1678
|
call
|
|
1657
1679
|
),
|
|
1658
1680
|
settlement: (settlement, call) => get(
|
|
@@ -1668,7 +1690,7 @@ function createManagementClient(options) {
|
|
|
1668
1690
|
)
|
|
1669
1691
|
},
|
|
1670
1692
|
deployments: {
|
|
1671
|
-
list: (call) => get("/deployments",
|
|
1693
|
+
list: (call) => get("/deployments", z8.array(deploymentRecordSchema), call),
|
|
1672
1694
|
get: (deployment, call) => get(
|
|
1673
1695
|
`/deployments/${identifier.parse(deployment)}`,
|
|
1674
1696
|
deploymentRecordSchema,
|
|
@@ -1916,7 +1938,7 @@ function createManagementClient(options) {
|
|
|
1916
1938
|
stockInputSchema.parse(withActionId(input)),
|
|
1917
1939
|
call
|
|
1918
1940
|
),
|
|
1919
|
-
catalog: (call) => get("/pickup-inventory",
|
|
1941
|
+
catalog: (call) => get("/pickup-inventory", z8.array(pickupCatalogSchema), call),
|
|
1920
1942
|
configure: (input, call) => post(
|
|
1921
1943
|
"/pickup-inventory",
|
|
1922
1944
|
pickupCatalogSchema,
|
|
@@ -1930,10 +1952,10 @@ function createManagementClient(options) {
|
|
|
1930
1952
|
)
|
|
1931
1953
|
},
|
|
1932
1954
|
offers: {
|
|
1933
|
-
list: (call) => get("/offers",
|
|
1955
|
+
list: (call) => get("/offers", z8.array(offerSchema), call),
|
|
1934
1956
|
redemptions: (input = {}, call) => get(
|
|
1935
1957
|
`/redemptions${queryString({ member: input.member })}`,
|
|
1936
|
-
|
|
1958
|
+
z8.array(redemptionSchema),
|
|
1937
1959
|
call
|
|
1938
1960
|
),
|
|
1939
1961
|
/** Pauses or resumes an offer at the revision the operator saw. */
|
|
@@ -1974,7 +1996,7 @@ function createManagementClient(options) {
|
|
|
1974
1996
|
* them; API keys and project-scoped playground sessions cannot.
|
|
1975
1997
|
*/
|
|
1976
1998
|
tokens: {
|
|
1977
|
-
list: (call) => get("/tokens",
|
|
1999
|
+
list: (call) => get("/tokens", z8.array(tokenSchema), call),
|
|
1978
2000
|
/**
|
|
1979
2001
|
* Issues a key for one project and environment, limited to permissions the caller holds
|
|
1980
2002
|
* there. The secret `token` is in this response only.
|
|
@@ -1982,14 +2004,14 @@ function createManagementClient(options) {
|
|
|
1982
2004
|
create: (input, call) => post("/tokens", issuedTokenSchema, tokenInputSchema.parse(input), call),
|
|
1983
2005
|
/** Replace a personal key's ingestion restriction without changing its secret. */
|
|
1984
2006
|
scope: (id, input, call) => request(
|
|
1985
|
-
`/tokens/${encodeURIComponent(
|
|
2007
|
+
`/tokens/${encodeURIComponent(z8.string().min(1).parse(id))}/scope`,
|
|
1986
2008
|
tokenSchema,
|
|
1987
2009
|
tokenScopeInputSchema.parse(input),
|
|
1988
2010
|
"PUT",
|
|
1989
2011
|
call
|
|
1990
2012
|
),
|
|
1991
2013
|
revoke: (id, call) => request(
|
|
1992
|
-
`/tokens/${encodeURIComponent(
|
|
2014
|
+
`/tokens/${encodeURIComponent(z8.string().min(1).parse(id))}`,
|
|
1993
2015
|
ok,
|
|
1994
2016
|
void 0,
|
|
1995
2017
|
"DELETE",
|
|
@@ -1998,7 +2020,7 @@ function createManagementClient(options) {
|
|
|
1998
2020
|
},
|
|
1999
2021
|
/** Who holds which roles on the client's project; organization administrators only. */
|
|
2000
2022
|
grants: {
|
|
2001
|
-
list: (call) => get("/grants",
|
|
2023
|
+
list: (call) => get("/grants", z8.array(grantRecordSchema), call),
|
|
2002
2024
|
/** Replaces one person's roles and environments on the project. The audit log records it. */
|
|
2003
2025
|
set: (input, call) => request(
|
|
2004
2026
|
"/grants",
|
|
@@ -2014,7 +2036,7 @@ function createManagementClient(options) {
|
|
|
2014
2036
|
},
|
|
2015
2037
|
/** Signed activity notifications for one project/environment; writes require publish permission. */
|
|
2016
2038
|
webhooks: {
|
|
2017
|
-
list: (call) => get("/webhooks",
|
|
2039
|
+
list: (call) => get("/webhooks", z8.array(webhookEndpointSchema), call),
|
|
2018
2040
|
create: (input, call) => post(
|
|
2019
2041
|
"/webhooks",
|
|
2020
2042
|
webhookSecretSchema,
|
|
@@ -2022,31 +2044,31 @@ function createManagementClient(options) {
|
|
|
2022
2044
|
call
|
|
2023
2045
|
),
|
|
2024
2046
|
update: (id, input, call) => request(
|
|
2025
|
-
`/webhooks/${
|
|
2047
|
+
`/webhooks/${z8.string().uuid().parse(id)}`,
|
|
2026
2048
|
webhookEndpointSchema,
|
|
2027
2049
|
webhookUpdateSchema.parse(input),
|
|
2028
2050
|
"PUT",
|
|
2029
2051
|
call
|
|
2030
2052
|
),
|
|
2031
2053
|
disable: (id, call) => post(
|
|
2032
|
-
`/webhooks/${
|
|
2054
|
+
`/webhooks/${z8.string().uuid().parse(id)}/disable`,
|
|
2033
2055
|
webhookEndpointSchema,
|
|
2034
2056
|
{},
|
|
2035
2057
|
call
|
|
2036
2058
|
),
|
|
2037
2059
|
rotateSecret: (id, call) => post(
|
|
2038
|
-
`/webhooks/${
|
|
2060
|
+
`/webhooks/${z8.string().uuid().parse(id)}/rotate-secret`,
|
|
2039
2061
|
webhookSecretSchema,
|
|
2040
2062
|
{},
|
|
2041
2063
|
call
|
|
2042
2064
|
),
|
|
2043
2065
|
deliveries: (id, query = {}, call) => get(
|
|
2044
|
-
`/webhooks/${
|
|
2066
|
+
`/webhooks/${z8.string().uuid().parse(id)}/deliveries${queryString(webhookQuerySchema.parse(query))}`,
|
|
2045
2067
|
webhookDeliveryPageSchema,
|
|
2046
2068
|
call
|
|
2047
2069
|
),
|
|
2048
2070
|
replay: (id, delivery, call) => post(
|
|
2049
|
-
`/webhooks/${
|
|
2071
|
+
`/webhooks/${z8.string().uuid().parse(id)}/deliveries/${z8.string().uuid().parse(delivery)}/replay`,
|
|
2050
2072
|
webhookDeliverySchema,
|
|
2051
2073
|
{},
|
|
2052
2074
|
call
|
|
@@ -2057,7 +2079,7 @@ function createManagementClient(options) {
|
|
|
2057
2079
|
* environment. Organization administrators, from a Console session only.
|
|
2058
2080
|
*/
|
|
2059
2081
|
identityIntegrations: {
|
|
2060
|
-
list: (call) => get("/identity-integrations",
|
|
2082
|
+
list: (call) => get("/identity-integrations", z8.array(identityIntegrationSchema), call),
|
|
2061
2083
|
/** The secret `token` is in this response only. */
|
|
2062
2084
|
create: (input, call) => post(
|
|
2063
2085
|
"/identity-integrations",
|
|
@@ -2067,7 +2089,7 @@ function createManagementClient(options) {
|
|
|
2067
2089
|
),
|
|
2068
2090
|
/** Replaces the key's secret and extends it by 90 days; the old secret stops working. */
|
|
2069
2091
|
rotate: (id, call) => post(
|
|
2070
|
-
`/identity-integrations/${
|
|
2092
|
+
`/identity-integrations/${z8.string().uuid().parse(id)}/rotate`,
|
|
2071
2093
|
identityIntegrationSecretSchema,
|
|
2072
2094
|
{},
|
|
2073
2095
|
call
|
|
@@ -2079,7 +2101,7 @@ function createManagementClient(options) {
|
|
|
2079
2101
|
*/
|
|
2080
2102
|
kinds: (call) => get(
|
|
2081
2103
|
"/identity-integrations/kinds",
|
|
2082
|
-
|
|
2104
|
+
z8.array(identityKindClaimSchema),
|
|
2083
2105
|
call
|
|
2084
2106
|
),
|
|
2085
2107
|
/**
|
|
@@ -2087,8 +2109,8 @@ function createManagementClient(options) {
|
|
|
2087
2109
|
* and keep attributing tracker records; unlink them on the member to stop that.
|
|
2088
2110
|
*/
|
|
2089
2111
|
revoke: (id, call) => request(
|
|
2090
|
-
`/identity-integrations/${
|
|
2091
|
-
|
|
2112
|
+
`/identity-integrations/${z8.string().uuid().parse(id)}`,
|
|
2113
|
+
z8.null(),
|
|
2092
2114
|
void 0,
|
|
2093
2115
|
"DELETE",
|
|
2094
2116
|
call
|
|
@@ -2098,7 +2120,7 @@ function createManagementClient(options) {
|
|
|
2098
2120
|
resources: {
|
|
2099
2121
|
list: (call) => get(
|
|
2100
2122
|
"/resources",
|
|
2101
|
-
|
|
2123
|
+
z8.object({ resources: z8.array(managedResourceSchema) }),
|
|
2102
2124
|
call
|
|
2103
2125
|
),
|
|
2104
2126
|
lifecycle: (input, call) => post(
|
|
@@ -2126,6 +2148,28 @@ function createManagementClient(options) {
|
|
|
2126
2148
|
{},
|
|
2127
2149
|
call
|
|
2128
2150
|
),
|
|
2151
|
+
/** Console sessions with publish permission, in test only. Reset deletes the member. */
|
|
2152
|
+
testMembers: {
|
|
2153
|
+
create: (input, call) => post(
|
|
2154
|
+
"/test-members",
|
|
2155
|
+
testMemberSchema,
|
|
2156
|
+
testMemberCreateSchema.parse(input),
|
|
2157
|
+
call
|
|
2158
|
+
),
|
|
2159
|
+
list: (call) => get("/test-members", z8.array(testMemberSchema), call),
|
|
2160
|
+
act: (member, input, call) => post(
|
|
2161
|
+
`/test-members/${identifier.parse(member)}/actions`,
|
|
2162
|
+
attemptSchema,
|
|
2163
|
+
testMemberActionSchema.parse(input),
|
|
2164
|
+
call
|
|
2165
|
+
),
|
|
2166
|
+
reset: (member, input, call) => post(
|
|
2167
|
+
`/test-members/${identifier.parse(member)}/reset`,
|
|
2168
|
+
testMemberResetResultSchema,
|
|
2169
|
+
testMemberResetSchema.parse(input),
|
|
2170
|
+
call
|
|
2171
|
+
)
|
|
2172
|
+
},
|
|
2129
2173
|
/** The project's members, as operators see them. */
|
|
2130
2174
|
members: {
|
|
2131
2175
|
counters: {
|
|
@@ -2157,26 +2201,26 @@ function createManagementClient(options) {
|
|
|
2157
2201
|
/** Who each member is: up to 100 distinct IDs; unknown IDs come back without accounts. */
|
|
2158
2202
|
people: (members, call) => get(
|
|
2159
2203
|
`/people${queryString({ ids: members.join(",") })}`,
|
|
2160
|
-
|
|
2204
|
+
z8.array(personSchema),
|
|
2161
2205
|
call
|
|
2162
2206
|
),
|
|
2163
2207
|
/** Current X and Discord quest account selections; requires read permission. */
|
|
2164
2208
|
oauthAccounts: (member, call) => get(
|
|
2165
2209
|
`/members/${encodeURIComponent(member)}/oauth-accounts`,
|
|
2166
|
-
|
|
2210
|
+
z8.array(managedOAuthAccountSchema),
|
|
2167
2211
|
call
|
|
2168
2212
|
),
|
|
2169
2213
|
/** Unlinks the reviewed selection across this organization/environment, preserving ownership and sign-in. */
|
|
2170
2214
|
unlinkOAuthAccount: (member, input, call) => post(
|
|
2171
2215
|
`/members/${encodeURIComponent(member)}/oauth-accounts/unlink`,
|
|
2172
|
-
|
|
2216
|
+
z8.array(managedOAuthAccountSchema),
|
|
2173
2217
|
memberOAuthUnlinkInputSchema.parse(input),
|
|
2174
2218
|
call
|
|
2175
2219
|
),
|
|
2176
2220
|
/** Unlinks a member's wallet from the project with a reason; requires `review` permission. The address stays bound to the member. */
|
|
2177
2221
|
unlinkWallet: (member, input, call) => post(
|
|
2178
2222
|
`/members/${encodeURIComponent(member)}/wallets/unlink`,
|
|
2179
|
-
|
|
2223
|
+
z8.array(managedWalletSchema),
|
|
2180
2224
|
memberWalletUnlinkInputSchema.parse(input),
|
|
2181
2225
|
call
|
|
2182
2226
|
),
|
|
@@ -2187,14 +2231,14 @@ function createManagementClient(options) {
|
|
|
2187
2231
|
*/
|
|
2188
2232
|
unlinkIdentity: (member, input, call) => post(
|
|
2189
2233
|
`/members/${encodeURIComponent(member)}/identities/unlink`,
|
|
2190
|
-
|
|
2234
|
+
z8.array(managedMemberIdentitySchema),
|
|
2191
2235
|
memberIdentityChangeInputSchema.parse(input),
|
|
2192
2236
|
call
|
|
2193
2237
|
),
|
|
2194
2238
|
/** Relinks an `app:<name>` identity an operator unlinked from this member, with a reason; requires `review` permission. */
|
|
2195
2239
|
relinkIdentity: (member, input, call) => post(
|
|
2196
2240
|
`/members/${encodeURIComponent(member)}/identities/relink`,
|
|
2197
|
-
|
|
2241
|
+
z8.array(managedMemberIdentitySchema),
|
|
2198
2242
|
memberIdentityChangeInputSchema.parse(input),
|
|
2199
2243
|
call
|
|
2200
2244
|
),
|
|
@@ -2204,7 +2248,7 @@ function createManagementClient(options) {
|
|
|
2204
2248
|
*/
|
|
2205
2249
|
setWalletSignIn: (member, input, call) => post(
|
|
2206
2250
|
`/members/${encodeURIComponent(member)}/wallets/sign-in`,
|
|
2207
|
-
|
|
2251
|
+
z8.array(managedWalletSchema),
|
|
2208
2252
|
memberWalletSignInInputSchema.parse(input),
|
|
2209
2253
|
call
|
|
2210
2254
|
)
|
|
@@ -2503,6 +2547,11 @@ export {
|
|
|
2503
2547
|
stockAdditionSchema,
|
|
2504
2548
|
stockInputSchema,
|
|
2505
2549
|
teamSchema,
|
|
2550
|
+
testMemberActionSchema,
|
|
2551
|
+
testMemberCreateSchema,
|
|
2552
|
+
testMemberResetResultSchema,
|
|
2553
|
+
testMemberResetSchema,
|
|
2554
|
+
testMemberSchema,
|
|
2506
2555
|
tokenInputSchema,
|
|
2507
2556
|
tokenSchema,
|
|
2508
2557
|
tokenScopeInputSchema,
|