@domino-sdk/relay 0.14.1 → 0.16.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 +49 -4
- package/dist/authoring.js +17 -3
- package/dist/browser.d.ts +289 -12
- package/dist/browser.js +7 -58
- package/dist/{chunk-I2CCMGN6.js → chunk-GEJK7LMK.js} +1 -1
- package/dist/chunk-MK2E36HR.js +61 -0
- package/dist/{chunk-YZJOZL4V.js → chunk-TI22MU2X.js} +121 -30
- package/dist/{chunk-CJARNIVP.js → chunk-XNS25KST.js} +1 -1
- package/dist/{chunk-FUQYKTOJ.js → chunk-YUAE6PFY.js} +406 -285
- package/dist/index.d.ts +735 -23
- package/dist/index.js +36 -6
- package/dist/portal-proxy.d.ts +26 -1
- package/dist/portal-proxy.js +45 -2
- package/dist/react/index.d.ts +4150 -0
- package/dist/react/index.js +836 -0
- package/dist/schema.d.ts +255 -13
- package/dist/schema.js +7 -1
- package/dist/{settings-CU2y-wUM.d.ts → submission-input-Cktvl71b.d.ts} +110 -1
- package/dist/vite.d.ts +32 -0
- package/dist/vite.js +42 -0
- package/package.json +22 -2
|
@@ -160,23 +160,112 @@ var discordMemberSchema = z5.object({
|
|
|
160
160
|
pending: z5.boolean()
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
// src/
|
|
163
|
+
// src/submission-input.ts
|
|
164
164
|
import { z as z6 } from "zod";
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
var textOptionsSchema = z6.object({
|
|
166
|
+
required: z6.boolean().default(true),
|
|
167
|
+
minLength: z6.number().int().min(0).max(1e4).default(1),
|
|
168
|
+
maxLength: z6.number().int().min(1).max(1e4).default(1e4)
|
|
169
|
+
}).strict().refine(
|
|
170
|
+
(v) => v.minLength <= v.maxLength,
|
|
171
|
+
"minLength must not exceed maxLength"
|
|
172
|
+
);
|
|
173
|
+
var hostSchema = z6.string().min(1).max(253).refine((host) => {
|
|
174
|
+
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const url = new URL(`https://${host}`);
|
|
179
|
+
return url.hostname === host.toLowerCase() && !url.port && !url.username && !url.password && url.pathname === "/" && !url.search && !url.hash;
|
|
180
|
+
} catch {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}, "Use a hostname without a scheme, path, port, or wildcard");
|
|
184
|
+
var urlOptionsSchema = z6.object({
|
|
185
|
+
required: z6.boolean().default(true),
|
|
186
|
+
allowedHosts: z6.array(hostSchema).min(1).max(100).optional()
|
|
187
|
+
}).strict();
|
|
188
|
+
var textEvidenceSchema = z6.object({ kind: z6.literal("text"), value: z6.string().max(1e4) }).strict();
|
|
189
|
+
var urlEvidenceSchema = z6.object({ kind: z6.literal("url"), value: z6.string().max(2048) }).strict();
|
|
190
|
+
var valueEvidenceSchema = z6.discriminatedUnion("kind", [
|
|
191
|
+
textEvidenceSchema,
|
|
192
|
+
urlEvidenceSchema
|
|
193
|
+
]);
|
|
194
|
+
function validateSubmissionValue(input, contract) {
|
|
195
|
+
const maximum = input.kind === "text" ? 1e4 : 2048;
|
|
196
|
+
if (input.value.length > maximum) {
|
|
197
|
+
return `Enter no more than ${maximum} characters`;
|
|
198
|
+
}
|
|
199
|
+
if (input.kind !== contract.input) {
|
|
200
|
+
return `This quest requires ${contract.input} input`;
|
|
201
|
+
}
|
|
202
|
+
if (!input.value.trim()) {
|
|
203
|
+
return contract.constraints.required ? "This field is required" : null;
|
|
204
|
+
}
|
|
205
|
+
if (contract.input === "text") {
|
|
206
|
+
if (input.value.length < contract.constraints.minLength) {
|
|
207
|
+
return `Enter at least ${contract.constraints.minLength} characters`;
|
|
208
|
+
}
|
|
209
|
+
if (input.value.length > contract.constraints.maxLength) {
|
|
210
|
+
return `Enter no more than ${contract.constraints.maxLength} characters`;
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
const url = parseHttpUrl(input.value);
|
|
215
|
+
if (!url) {
|
|
216
|
+
return "Enter a valid HTTP or HTTPS URL without credentials";
|
|
217
|
+
}
|
|
218
|
+
if (contract.constraints.allowedHosts && !contract.constraints.allowedHosts.some(
|
|
219
|
+
(host) => host.toLowerCase() === url.hostname.toLowerCase()
|
|
220
|
+
)) {
|
|
221
|
+
return `Use a URL hosted on: ${contract.constraints.allowedHosts.join(", ")}`;
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
function parseHttpUrl(value) {
|
|
226
|
+
if (value !== value.trim() || /[\\\s]/.test(value) || !/^https?:\/\//i.test(value)) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
const url = new URL(value);
|
|
231
|
+
return ["http:", "https:"].includes(url.protocol) && !url.username && !url.password ? url : null;
|
|
232
|
+
} catch {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function xPostId(value) {
|
|
237
|
+
const url = parseHttpUrl(value);
|
|
238
|
+
if (!url || url.port || ![
|
|
239
|
+
"x.com",
|
|
240
|
+
"www.x.com",
|
|
241
|
+
"twitter.com",
|
|
242
|
+
"www.twitter.com",
|
|
243
|
+
"mobile.twitter.com"
|
|
244
|
+
].includes(url.hostname)) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
return /^\/(?:[A-Za-z0-9_]+|i\/web)\/status\/([0-9]{1,20})\/?$/.exec(
|
|
248
|
+
url.pathname
|
|
249
|
+
)?.[1] ?? null;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/quiz.ts
|
|
253
|
+
import { z as z7 } from "zod";
|
|
254
|
+
var quizId = z7.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
255
|
+
var quizChoiceSchema = z7.object({ id: quizId, label: z7.string().trim().min(1).max(500) }).strict();
|
|
256
|
+
var quizQuestionSchema = z7.object({
|
|
168
257
|
id: quizId,
|
|
169
|
-
prompt:
|
|
170
|
-
choices:
|
|
258
|
+
prompt: z7.string().trim().min(1).max(1e3),
|
|
259
|
+
choices: z7.array(quizChoiceSchema).min(2).max(8).refine(
|
|
171
260
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
172
261
|
"Choice IDs must be unique"
|
|
173
262
|
)
|
|
174
263
|
}).strict();
|
|
175
|
-
var quizQuestionsSchema =
|
|
264
|
+
var quizQuestionsSchema = z7.array(quizQuestionSchema).min(1).max(20).refine(
|
|
176
265
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
177
266
|
"Question IDs must be unique"
|
|
178
267
|
);
|
|
179
|
-
var quizContentSchema =
|
|
268
|
+
var quizContentSchema = z7.array(
|
|
180
269
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
181
270
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
182
271
|
"Choose a correct answer from the available choices"
|
|
@@ -187,48 +276,48 @@ var quizContentSchema = z6.array(
|
|
|
187
276
|
);
|
|
188
277
|
|
|
189
278
|
// src/schema.ts
|
|
190
|
-
import { z as
|
|
279
|
+
import { z as z10 } from "zod";
|
|
191
280
|
|
|
192
281
|
// src/settings.ts
|
|
193
|
-
import { z as
|
|
282
|
+
import { z as z9 } from "zod";
|
|
194
283
|
|
|
195
284
|
// src/resources.ts
|
|
196
|
-
import { z as
|
|
197
|
-
var channelSourceSchema =
|
|
198
|
-
provider:
|
|
199
|
-
resource:
|
|
200
|
-
types:
|
|
285
|
+
import { z as z8 } from "zod";
|
|
286
|
+
var channelSourceSchema = z8.object({
|
|
287
|
+
provider: z8.literal("discord"),
|
|
288
|
+
resource: z8.literal("channel"),
|
|
289
|
+
types: z8.array(z8.enum(["text", "announcement"])).min(1)
|
|
201
290
|
}).strict();
|
|
202
|
-
var resourceSourceSchema =
|
|
203
|
-
|
|
204
|
-
provider:
|
|
205
|
-
resource:
|
|
291
|
+
var resourceSourceSchema = z8.union([
|
|
292
|
+
z8.object({
|
|
293
|
+
provider: z8.literal("domino"),
|
|
294
|
+
resource: z8.literal("point-ledger")
|
|
206
295
|
}).strict(),
|
|
207
296
|
channelSourceSchema,
|
|
208
|
-
|
|
209
|
-
provider:
|
|
210
|
-
resource:
|
|
211
|
-
assignable:
|
|
297
|
+
z8.object({
|
|
298
|
+
provider: z8.literal("discord"),
|
|
299
|
+
resource: z8.literal("role"),
|
|
300
|
+
assignable: z8.boolean().default(false)
|
|
212
301
|
}).strict()
|
|
213
302
|
]);
|
|
214
|
-
var resourceRequestSchema =
|
|
303
|
+
var resourceRequestSchema = z8.object({
|
|
215
304
|
source: resourceSourceSchema,
|
|
216
|
-
query:
|
|
217
|
-
cursor:
|
|
218
|
-
ids:
|
|
305
|
+
query: z8.string().max(100).optional(),
|
|
306
|
+
cursor: z8.string().regex(/^\d{1,6}$/).optional(),
|
|
307
|
+
ids: z8.array(z8.string().min(1).max(100)).max(50).optional()
|
|
219
308
|
}).strict();
|
|
220
|
-
var resourceOptionsSchema =
|
|
221
|
-
revision:
|
|
222
|
-
options:
|
|
223
|
-
|
|
224
|
-
id:
|
|
225
|
-
label:
|
|
226
|
-
description:
|
|
227
|
-
group:
|
|
228
|
-
disabledReason:
|
|
309
|
+
var resourceOptionsSchema = z8.object({
|
|
310
|
+
revision: z8.number().int(),
|
|
311
|
+
options: z8.array(
|
|
312
|
+
z8.object({
|
|
313
|
+
id: z8.string(),
|
|
314
|
+
label: z8.string(),
|
|
315
|
+
description: z8.string().optional(),
|
|
316
|
+
group: z8.string().optional(),
|
|
317
|
+
disabledReason: z8.string().optional()
|
|
229
318
|
})
|
|
230
319
|
),
|
|
231
|
-
cursor:
|
|
320
|
+
cursor: z8.string().nullable()
|
|
232
321
|
});
|
|
233
322
|
var discord = {
|
|
234
323
|
roles(options = {}) {
|
|
@@ -252,49 +341,49 @@ var pointLedgers = () => ({
|
|
|
252
341
|
});
|
|
253
342
|
|
|
254
343
|
// src/settings.ts
|
|
255
|
-
var instant =
|
|
256
|
-
var resourceId =
|
|
257
|
-
var base = { label:
|
|
258
|
-
var settingFieldSchema =
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
344
|
+
var instant = z9.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
|
|
345
|
+
var resourceId = z9.union([z9.literal(""), z9.string().regex(/^\S{1,200}$/)]);
|
|
346
|
+
var base = { label: z9.string().min(1), description: z9.string().optional() };
|
|
347
|
+
var settingFieldSchema = z9.discriminatedUnion("kind", [
|
|
348
|
+
z9.object({ ...base, kind: z9.literal("point-ledger"), default: identifier }).strict(),
|
|
349
|
+
z9.object({ ...base, kind: z9.literal("datetime"), default: instant }).strict(),
|
|
350
|
+
z9.object({
|
|
262
351
|
...base,
|
|
263
|
-
kind:
|
|
352
|
+
kind: z9.literal("resource"),
|
|
264
353
|
default: resourceId,
|
|
265
354
|
source: resourceSourceSchema
|
|
266
355
|
}).strict(),
|
|
267
|
-
|
|
268
|
-
|
|
356
|
+
z9.object({ ...base, kind: z9.literal("quiz"), default: quizContentSchema }).strict(),
|
|
357
|
+
z9.object({
|
|
269
358
|
...base,
|
|
270
|
-
kind:
|
|
271
|
-
default:
|
|
272
|
-
minLength:
|
|
273
|
-
maxLength:
|
|
274
|
-
multiline:
|
|
359
|
+
kind: z9.literal("text"),
|
|
360
|
+
default: z9.string(),
|
|
361
|
+
minLength: z9.number().int().nonnegative(),
|
|
362
|
+
maxLength: z9.number().int().positive(),
|
|
363
|
+
multiline: z9.boolean()
|
|
275
364
|
}).strict(),
|
|
276
|
-
|
|
365
|
+
z9.object({
|
|
277
366
|
...base,
|
|
278
|
-
kind:
|
|
279
|
-
default:
|
|
280
|
-
min:
|
|
281
|
-
max:
|
|
367
|
+
kind: z9.literal("integer"),
|
|
368
|
+
default: z9.number().int(),
|
|
369
|
+
min: z9.number().int(),
|
|
370
|
+
max: z9.number().int()
|
|
282
371
|
}).strict(),
|
|
283
|
-
|
|
284
|
-
|
|
372
|
+
z9.object({ ...base, kind: z9.literal("boolean"), default: z9.boolean() }).strict(),
|
|
373
|
+
z9.object({
|
|
285
374
|
...base,
|
|
286
|
-
kind:
|
|
287
|
-
default:
|
|
288
|
-
options:
|
|
375
|
+
kind: z9.literal("choice"),
|
|
376
|
+
default: z9.string(),
|
|
377
|
+
options: z9.array(z9.string().min(1)).min(1)
|
|
289
378
|
}).strict()
|
|
290
379
|
]);
|
|
291
|
-
var settingsFieldsSchema =
|
|
292
|
-
|
|
380
|
+
var settingsFieldsSchema = z9.record(
|
|
381
|
+
z9.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
293
382
|
settingFieldSchema
|
|
294
383
|
);
|
|
295
|
-
var settingsValuesSchema =
|
|
296
|
-
|
|
297
|
-
|
|
384
|
+
var settingsValuesSchema = z9.record(
|
|
385
|
+
z9.string(),
|
|
386
|
+
z9.union([z9.string(), z9.number().finite(), z9.boolean(), quizContentSchema])
|
|
298
387
|
);
|
|
299
388
|
var settings = {
|
|
300
389
|
pointLedger(options) {
|
|
@@ -334,19 +423,19 @@ var settings = {
|
|
|
334
423
|
maxLength: options.maxLength ?? 2e3,
|
|
335
424
|
multiline: options.multiline ?? false
|
|
336
425
|
};
|
|
337
|
-
return
|
|
426
|
+
return z9.string().min(field.minLength).max(field.maxLength).default(field.default).meta(field);
|
|
338
427
|
},
|
|
339
428
|
integer(options) {
|
|
340
|
-
return
|
|
429
|
+
return z9.number().int().min(options.min).max(options.max).default(options.default).meta({ ...options, kind: "integer" });
|
|
341
430
|
},
|
|
342
431
|
boolean(options) {
|
|
343
|
-
return
|
|
432
|
+
return z9.boolean().default(options.default).meta({ ...options, kind: "boolean" });
|
|
344
433
|
},
|
|
345
434
|
choice(options) {
|
|
346
|
-
return
|
|
435
|
+
return z9.enum(options.options).default(options.default).meta({ ...options, kind: "choice" });
|
|
347
436
|
},
|
|
348
437
|
object(shape) {
|
|
349
|
-
return
|
|
438
|
+
return z9.object(shape).strict();
|
|
350
439
|
}
|
|
351
440
|
};
|
|
352
441
|
function parseSettings(fields, input) {
|
|
@@ -366,20 +455,20 @@ function parseSettings(fields, input) {
|
|
|
366
455
|
shape[key] = quizContentSchema.default(field.default);
|
|
367
456
|
break;
|
|
368
457
|
case "text":
|
|
369
|
-
shape[key] =
|
|
458
|
+
shape[key] = z9.string().min(field.minLength).max(field.maxLength).default(field.default);
|
|
370
459
|
break;
|
|
371
460
|
case "integer":
|
|
372
|
-
shape[key] =
|
|
461
|
+
shape[key] = z9.number().int().min(field.min).max(field.max).default(field.default);
|
|
373
462
|
break;
|
|
374
463
|
case "boolean":
|
|
375
|
-
shape[key] =
|
|
464
|
+
shape[key] = z9.boolean().default(field.default);
|
|
376
465
|
break;
|
|
377
466
|
case "choice":
|
|
378
|
-
shape[key] =
|
|
467
|
+
shape[key] = z9.enum(field.options).default(field.default);
|
|
379
468
|
break;
|
|
380
469
|
}
|
|
381
470
|
}
|
|
382
|
-
return settingsValuesSchema.parse(
|
|
471
|
+
return settingsValuesSchema.parse(z9.object(shape).strict().parse(input));
|
|
383
472
|
}
|
|
384
473
|
function missingResourceSettings(fields, values) {
|
|
385
474
|
return Object.entries(fields).filter(([key, field]) => field.kind === "resource" && !values[key]).map(([key]) => key);
|
|
@@ -389,38 +478,38 @@ function compatibleSettingKinds(previous, next) {
|
|
|
389
478
|
}
|
|
390
479
|
|
|
391
480
|
// src/schema.ts
|
|
392
|
-
var pointsRewardSchema =
|
|
393
|
-
kind:
|
|
481
|
+
var pointsRewardSchema = z10.object({
|
|
482
|
+
kind: z10.literal("points").default("points"),
|
|
394
483
|
balance: identifier,
|
|
395
|
-
amount:
|
|
484
|
+
amount: z10.number().int().min(0).max(1e4)
|
|
396
485
|
}).strict();
|
|
397
|
-
var tieredRewardDefinitionSchema =
|
|
486
|
+
var tieredRewardDefinitionSchema = z10.object({
|
|
398
487
|
id: identifier,
|
|
399
|
-
title:
|
|
400
|
-
tiers:
|
|
401
|
-
|
|
488
|
+
title: z10.string().min(1).max(120),
|
|
489
|
+
tiers: z10.array(
|
|
490
|
+
z10.object({ id: identifier, title: z10.string().min(1).max(120) }).strict()
|
|
402
491
|
).min(1).max(20).refine(
|
|
403
492
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
404
493
|
"Tier IDs must be unique"
|
|
405
494
|
),
|
|
406
|
-
inventory:
|
|
407
|
-
fulfillment:
|
|
495
|
+
inventory: z10.object({ kind: z10.literal("untracked") }).strict(),
|
|
496
|
+
fulfillment: z10.object({ kind: z10.literal("staff-handover") }).strict()
|
|
408
497
|
}).strict();
|
|
409
|
-
var tierRewardSchema =
|
|
410
|
-
kind:
|
|
498
|
+
var tierRewardSchema = z10.object({
|
|
499
|
+
kind: z10.literal("tier"),
|
|
411
500
|
reward: tieredRewardDefinitionSchema,
|
|
412
501
|
tier: identifier
|
|
413
502
|
}).strict().refine(
|
|
414
503
|
(value) => value.reward.tiers.some((t) => t.id === value.tier),
|
|
415
504
|
"Unknown reward tier"
|
|
416
505
|
);
|
|
417
|
-
var integrationRewardSchema =
|
|
418
|
-
kind:
|
|
419
|
-
provider:
|
|
420
|
-
action:
|
|
421
|
-
roleId:
|
|
506
|
+
var integrationRewardSchema = z10.object({
|
|
507
|
+
kind: z10.literal("integration"),
|
|
508
|
+
provider: z10.literal("discord"),
|
|
509
|
+
action: z10.literal("grant-role"),
|
|
510
|
+
roleId: z10.string().regex(/^[0-9]{1,20}$/)
|
|
422
511
|
}).strict();
|
|
423
|
-
var rewardSchema =
|
|
512
|
+
var rewardSchema = z10.union([
|
|
424
513
|
pointsRewardSchema,
|
|
425
514
|
tierRewardSchema,
|
|
426
515
|
integrationRewardSchema
|
|
@@ -431,49 +520,66 @@ function rewardKey(reward) {
|
|
|
431
520
|
}
|
|
432
521
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
433
522
|
}
|
|
434
|
-
var triggerSchema =
|
|
435
|
-
|
|
436
|
-
kind:
|
|
437
|
-
input:
|
|
438
|
-
|
|
523
|
+
var triggerSchema = z10.union([
|
|
524
|
+
z10.object({
|
|
525
|
+
kind: z10.literal("manual"),
|
|
526
|
+
input: z10.literal("text"),
|
|
527
|
+
constraints: textOptionsSchema,
|
|
528
|
+
actor: z10.enum(["member", "staff"]).optional()
|
|
439
529
|
}).strict(),
|
|
440
|
-
|
|
441
|
-
kind:
|
|
530
|
+
z10.object({
|
|
531
|
+
kind: z10.literal("manual"),
|
|
532
|
+
input: z10.literal("url"),
|
|
533
|
+
constraints: urlOptionsSchema,
|
|
534
|
+
actor: z10.enum(["member", "staff"]).optional()
|
|
535
|
+
}).strict(),
|
|
536
|
+
z10.object({
|
|
537
|
+
kind: z10.literal("manual"),
|
|
538
|
+
input: z10.enum(["photo", "quiz", "none"]),
|
|
539
|
+
actor: z10.enum(["member", "staff"]).optional()
|
|
540
|
+
}).strict(),
|
|
541
|
+
z10.object({
|
|
542
|
+
kind: z10.literal("automatic"),
|
|
442
543
|
observation: observationTriggerSchema.optional()
|
|
443
544
|
}).strict()
|
|
444
545
|
]);
|
|
445
|
-
var prerequisiteSchema =
|
|
446
|
-
var photoResultSchema =
|
|
447
|
-
kind:
|
|
448
|
-
reason:
|
|
546
|
+
var prerequisiteSchema = z10.object({ quest: identifier, scope: z10.literal("ever") }).strict();
|
|
547
|
+
var photoResultSchema = z10.object({
|
|
548
|
+
kind: z10.enum(["pass", "fail", "unclear"]),
|
|
549
|
+
reason: z10.string().min(1).max(2e3)
|
|
449
550
|
}).strict();
|
|
450
|
-
var
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
551
|
+
var textReviewInputSchema = z10.object({
|
|
552
|
+
text: z10.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
553
|
+
criteria: z10.string().trim().min(1).max(2e3)
|
|
554
|
+
}).strict();
|
|
555
|
+
var textResultSchema = photoResultSchema;
|
|
556
|
+
var decisionSchema = z10.discriminatedUnion("kind", [
|
|
557
|
+
z10.object({
|
|
558
|
+
kind: z10.literal("accept"),
|
|
559
|
+
rewards: z10.array(rewardSchema).max(10),
|
|
454
560
|
completionKey: completionKeySchema.optional()
|
|
455
561
|
}).strict(),
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
kind:
|
|
459
|
-
reason:
|
|
460
|
-
rewards:
|
|
562
|
+
z10.object({ kind: z10.literal("reject"), reason: z10.string().min(1).max(2e3) }).strict(),
|
|
563
|
+
z10.object({
|
|
564
|
+
kind: z10.literal("review"),
|
|
565
|
+
reason: z10.string().min(1).max(2e3),
|
|
566
|
+
rewards: z10.array(rewardSchema).max(10).optional(),
|
|
461
567
|
completionKey: completionKeySchema.optional()
|
|
462
568
|
}).strict()
|
|
463
569
|
]);
|
|
464
|
-
var reviewModeSchema =
|
|
465
|
-
var storedReviewModeSchema =
|
|
570
|
+
var reviewModeSchema = z10.enum(["workers-ai"]);
|
|
571
|
+
var storedReviewModeSchema = z10.enum([
|
|
466
572
|
"fixture-pass",
|
|
467
573
|
"fixture-fail",
|
|
468
574
|
"fixture-unclear",
|
|
469
575
|
"fixture-error",
|
|
470
576
|
"workers-ai"
|
|
471
577
|
]);
|
|
472
|
-
var rewardBundleSchema =
|
|
578
|
+
var rewardBundleSchema = z10.array(rewardSchema).max(10).refine(
|
|
473
579
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
474
580
|
"Use one entry per balance or shared reward"
|
|
475
581
|
);
|
|
476
|
-
var mediaUrlSchema =
|
|
582
|
+
var mediaUrlSchema = z10.string().max(2e3).refine((value) => {
|
|
477
583
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
478
584
|
return true;
|
|
479
585
|
}
|
|
@@ -483,74 +589,74 @@ var mediaUrlSchema = z9.string().max(2e3).refine((value) => {
|
|
|
483
589
|
return false;
|
|
484
590
|
}
|
|
485
591
|
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
486
|
-
var questPresentationSchema =
|
|
592
|
+
var questPresentationSchema = z10.object({
|
|
487
593
|
quiz: quizQuestionsSchema.optional(),
|
|
488
|
-
instructions:
|
|
489
|
-
video:
|
|
594
|
+
instructions: z10.string().max(4e3).optional(),
|
|
595
|
+
video: z10.object({
|
|
490
596
|
url: mediaUrlSchema,
|
|
491
597
|
poster: mediaUrlSchema.optional(),
|
|
492
|
-
captions:
|
|
598
|
+
captions: z10.object({
|
|
493
599
|
url: mediaUrlSchema,
|
|
494
|
-
language:
|
|
495
|
-
label:
|
|
600
|
+
language: z10.string().min(2).max(20),
|
|
601
|
+
label: z10.string().min(1).max(80)
|
|
496
602
|
}).strict().optional()
|
|
497
603
|
}).strict().optional()
|
|
498
604
|
}).strict();
|
|
499
|
-
var questDescriptionSchema =
|
|
605
|
+
var questDescriptionSchema = z10.object({
|
|
500
606
|
quest: identifier,
|
|
501
|
-
runtimeVersion:
|
|
502
|
-
title:
|
|
607
|
+
runtimeVersion: z10.union([z10.literal(1), z10.literal(2)]).default(1),
|
|
608
|
+
title: z10.string().min(1).max(120),
|
|
503
609
|
presentation: questPresentationSchema.default({}),
|
|
504
|
-
integrations:
|
|
610
|
+
integrations: z10.array(integrationProviderSchema).max(10).default([]),
|
|
505
611
|
fields: settingsFieldsSchema,
|
|
506
612
|
values: settingsValuesSchema,
|
|
507
613
|
rewards: rewardBundleSchema,
|
|
508
|
-
humanReview:
|
|
614
|
+
humanReview: z10.boolean(),
|
|
509
615
|
trigger: triggerSchema,
|
|
510
|
-
requires:
|
|
616
|
+
requires: z10.array(prerequisiteSchema).max(30).default([]),
|
|
511
617
|
completion: completionPolicySchema,
|
|
512
|
-
visibility:
|
|
513
|
-
budgets:
|
|
618
|
+
visibility: z10.enum(["visible", "hidden"]).default("visible"),
|
|
619
|
+
budgets: z10.array(budgetSchema).max(20).default([])
|
|
514
620
|
}).strict();
|
|
515
|
-
var artifactSchema =
|
|
621
|
+
var artifactSchema = z10.object({ code: z10.string().min(1).max(1e6) }).strict();
|
|
516
622
|
var releaseSchema = artifactSchema.extend({
|
|
517
623
|
settings: settingsValuesSchema,
|
|
518
624
|
provider: reviewModeSchema,
|
|
519
625
|
expectedRelease: identifier.nullable().optional(),
|
|
520
|
-
settingRenames:
|
|
626
|
+
settingRenames: z10.record(z10.string(), z10.string()).optional()
|
|
521
627
|
}).strict();
|
|
522
|
-
var batchReleaseSchema =
|
|
523
|
-
var questSettingsInputSchema =
|
|
628
|
+
var batchReleaseSchema = z10.object({ releases: z10.array(releaseSchema).min(1).max(50) }).strict();
|
|
629
|
+
var questSettingsInputSchema = z10.object({
|
|
524
630
|
quest: identifier,
|
|
525
631
|
expectedRelease: identifier,
|
|
526
632
|
set: settingsValuesSchema,
|
|
527
|
-
reset:
|
|
633
|
+
reset: z10.array(z10.string())
|
|
528
634
|
}).strict();
|
|
529
635
|
var storedReleaseSchema = questDescriptionSchema.extend({
|
|
530
636
|
key: identifier.optional(),
|
|
531
|
-
code:
|
|
637
|
+
code: z10.string(),
|
|
532
638
|
provider: storedReviewModeSchema,
|
|
533
639
|
id: identifier,
|
|
534
|
-
createdAt:
|
|
535
|
-
legacy:
|
|
536
|
-
origin:
|
|
537
|
-
lifecycle:
|
|
538
|
-
configuration:
|
|
640
|
+
createdAt: z10.number(),
|
|
641
|
+
legacy: z10.boolean().default(false),
|
|
642
|
+
origin: z10.object({ typeVersion: identifier }).strict().optional(),
|
|
643
|
+
lifecycle: z10.enum(["active", "paused", "archived"]).default("active"),
|
|
644
|
+
configuration: z10.object({
|
|
539
645
|
defaults: settingsValuesSchema,
|
|
540
646
|
overrides: settingsValuesSchema,
|
|
541
|
-
preserved:
|
|
647
|
+
preserved: z10.array(z10.string())
|
|
542
648
|
}).strict().optional()
|
|
543
649
|
});
|
|
544
|
-
var legacyReleaseSchema =
|
|
650
|
+
var legacyReleaseSchema = z10.object({
|
|
545
651
|
quest: identifier,
|
|
546
|
-
title:
|
|
547
|
-
criteria:
|
|
548
|
-
humanReview:
|
|
652
|
+
title: z10.string(),
|
|
653
|
+
criteria: z10.string(),
|
|
654
|
+
humanReview: z10.boolean(),
|
|
549
655
|
rewards: rewardBundleSchema,
|
|
550
|
-
code:
|
|
656
|
+
code: z10.string(),
|
|
551
657
|
provider: storedReviewModeSchema,
|
|
552
658
|
id: identifier,
|
|
553
|
-
createdAt:
|
|
659
|
+
createdAt: z10.number()
|
|
554
660
|
}).transform((r) => {
|
|
555
661
|
const { criteria, ...stored } = r;
|
|
556
662
|
return storedReleaseSchema.parse({
|
|
@@ -562,15 +668,15 @@ var legacyReleaseSchema = z9.object({
|
|
|
562
668
|
legacy: true
|
|
563
669
|
});
|
|
564
670
|
});
|
|
565
|
-
var publishedReleaseSchema =
|
|
671
|
+
var publishedReleaseSchema = z10.union([
|
|
566
672
|
storedReleaseSchema,
|
|
567
673
|
legacyReleaseSchema
|
|
568
674
|
]);
|
|
569
|
-
var templateSchema =
|
|
570
|
-
code:
|
|
675
|
+
var templateSchema = z10.object({
|
|
676
|
+
code: z10.string(),
|
|
571
677
|
definition: questDescriptionSchema
|
|
572
678
|
});
|
|
573
|
-
var quizAnswersSchema =
|
|
679
|
+
var quizAnswersSchema = z10.record(identifier, identifier).refine(
|
|
574
680
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
575
681
|
"Provide between 1 and 50 answers"
|
|
576
682
|
).transform(
|
|
@@ -578,28 +684,33 @@ var quizAnswersSchema = z9.record(identifier, identifier).refine(
|
|
|
578
684
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
579
685
|
)
|
|
580
686
|
);
|
|
581
|
-
var quizEvidenceSchema =
|
|
582
|
-
kind:
|
|
687
|
+
var quizEvidenceSchema = z10.object({
|
|
688
|
+
kind: z10.literal("quiz"),
|
|
583
689
|
release: identifier.optional(),
|
|
584
690
|
answers: quizAnswersSchema
|
|
585
691
|
}).strict();
|
|
586
|
-
var
|
|
692
|
+
var submissionEvidenceSchema = z10.union([
|
|
693
|
+
quizEvidenceSchema,
|
|
694
|
+
textEvidenceSchema,
|
|
695
|
+
urlEvidenceSchema
|
|
696
|
+
]);
|
|
697
|
+
var submitSchema = z10.object({
|
|
587
698
|
actionId: identifier,
|
|
588
699
|
quest: identifier,
|
|
589
700
|
member: identifier,
|
|
590
701
|
evidence: identifier.optional(),
|
|
591
|
-
input:
|
|
702
|
+
input: submissionEvidenceSchema.optional(),
|
|
592
703
|
release: identifier.optional(),
|
|
593
|
-
faultAfterReview:
|
|
704
|
+
faultAfterReview: z10.boolean().optional()
|
|
594
705
|
}).strict();
|
|
595
|
-
var attemptSchema =
|
|
706
|
+
var attemptSchema = z10.object({
|
|
596
707
|
id: identifier,
|
|
597
708
|
release: identifier,
|
|
598
709
|
quest: identifier,
|
|
599
710
|
member: identifier,
|
|
600
711
|
evidence: identifier.nullable(),
|
|
601
|
-
input:
|
|
602
|
-
status:
|
|
712
|
+
input: submissionEvidenceSchema.optional(),
|
|
713
|
+
status: z10.enum([
|
|
603
714
|
"queued",
|
|
604
715
|
"evaluating",
|
|
605
716
|
"accepted",
|
|
@@ -608,70 +719,70 @@ var attemptSchema = z9.object({
|
|
|
608
719
|
"needs-review",
|
|
609
720
|
"failed"
|
|
610
721
|
]),
|
|
611
|
-
reason:
|
|
612
|
-
retries:
|
|
613
|
-
generation:
|
|
614
|
-
completion:
|
|
722
|
+
reason: z10.string().nullable(),
|
|
723
|
+
retries: z10.number(),
|
|
724
|
+
generation: z10.number(),
|
|
725
|
+
completion: z10.string().nullable(),
|
|
615
726
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
616
|
-
createdAt:
|
|
727
|
+
createdAt: z10.number()
|
|
617
728
|
});
|
|
618
|
-
var eventSchema =
|
|
619
|
-
id:
|
|
620
|
-
attempt:
|
|
621
|
-
kind:
|
|
622
|
-
detail:
|
|
623
|
-
actor:
|
|
624
|
-
at:
|
|
729
|
+
var eventSchema = z10.object({
|
|
730
|
+
id: z10.number(),
|
|
731
|
+
attempt: z10.string().nullable(),
|
|
732
|
+
kind: z10.string(),
|
|
733
|
+
detail: z10.string(),
|
|
734
|
+
actor: z10.string().nullable().default(null),
|
|
735
|
+
at: z10.number()
|
|
625
736
|
});
|
|
626
|
-
var pickupSelectionSchema =
|
|
737
|
+
var pickupSelectionSchema = z10.object({
|
|
627
738
|
item: identifier,
|
|
628
|
-
revision:
|
|
739
|
+
revision: z10.number().int().nonnegative()
|
|
629
740
|
}).strict();
|
|
630
|
-
var pickupAllocationSchema =
|
|
741
|
+
var pickupAllocationSchema = z10.object({
|
|
631
742
|
item: identifier,
|
|
632
|
-
label:
|
|
743
|
+
label: z10.string().min(1).max(80)
|
|
633
744
|
}).strict();
|
|
634
|
-
var pickupPolicySchema =
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
kind:
|
|
638
|
-
tiers:
|
|
639
|
-
|
|
745
|
+
var pickupPolicySchema = z10.discriminatedUnion("kind", [
|
|
746
|
+
z10.object({ kind: z10.literal("untracked") }).strict(),
|
|
747
|
+
z10.object({
|
|
748
|
+
kind: z10.literal("at-pickup"),
|
|
749
|
+
tiers: z10.array(
|
|
750
|
+
z10.object({
|
|
640
751
|
tier: identifier,
|
|
641
|
-
variants:
|
|
752
|
+
variants: z10.array(pickupAllocationSchema).min(1).max(100)
|
|
642
753
|
}).strict()
|
|
643
754
|
).min(1).max(100)
|
|
644
755
|
}).strict()
|
|
645
756
|
]);
|
|
646
|
-
var pickupCatalogSchema =
|
|
757
|
+
var pickupCatalogSchema = z10.object({
|
|
647
758
|
reward: tieredRewardDefinitionSchema,
|
|
648
|
-
revision:
|
|
759
|
+
revision: z10.number().int().nonnegative(),
|
|
649
760
|
policy: pickupPolicySchema
|
|
650
761
|
});
|
|
651
|
-
var pickupAvailabilitySchema =
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
kind:
|
|
655
|
-
revision:
|
|
656
|
-
variants:
|
|
762
|
+
var pickupAvailabilitySchema = z10.discriminatedUnion("kind", [
|
|
763
|
+
z10.object({ kind: z10.literal("untracked") }).strict(),
|
|
764
|
+
z10.object({
|
|
765
|
+
kind: z10.literal("at-pickup"),
|
|
766
|
+
revision: z10.number().int().nonnegative(),
|
|
767
|
+
variants: z10.array(
|
|
657
768
|
pickupAllocationSchema.extend({
|
|
658
|
-
available:
|
|
769
|
+
available: z10.number().int().nonnegative()
|
|
659
770
|
})
|
|
660
771
|
)
|
|
661
772
|
}).strict()
|
|
662
773
|
]);
|
|
663
|
-
var configurePickupSchema =
|
|
774
|
+
var configurePickupSchema = z10.object({
|
|
664
775
|
reward: identifier,
|
|
665
|
-
revision:
|
|
776
|
+
revision: z10.number().int().nonnegative(),
|
|
666
777
|
actionId: identifier,
|
|
667
|
-
policy:
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
kind:
|
|
671
|
-
tiers:
|
|
672
|
-
|
|
778
|
+
policy: z10.discriminatedUnion("kind", [
|
|
779
|
+
z10.object({ kind: z10.literal("untracked") }).strict(),
|
|
780
|
+
z10.object({
|
|
781
|
+
kind: z10.literal("at-pickup"),
|
|
782
|
+
tiers: z10.array(
|
|
783
|
+
z10.object({
|
|
673
784
|
tier: identifier,
|
|
674
|
-
variants:
|
|
785
|
+
variants: z10.array(
|
|
675
786
|
pickupAllocationSchema.extend({
|
|
676
787
|
item: identifier.optional()
|
|
677
788
|
})
|
|
@@ -687,151 +798,151 @@ var entitlementBase = {
|
|
|
687
798
|
reward: tieredRewardDefinitionSchema,
|
|
688
799
|
earnedTier: identifier,
|
|
689
800
|
tier: identifier,
|
|
690
|
-
revision:
|
|
801
|
+
revision: z10.number().int().positive()
|
|
691
802
|
};
|
|
692
|
-
var entitlementSchema =
|
|
693
|
-
|
|
694
|
-
|
|
803
|
+
var entitlementSchema = z10.discriminatedUnion("status", [
|
|
804
|
+
z10.object({ ...entitlementBase, status: z10.literal("available") }).strict(),
|
|
805
|
+
z10.object({
|
|
695
806
|
...entitlementBase,
|
|
696
|
-
status:
|
|
807
|
+
status: z10.literal("handing-over"),
|
|
697
808
|
handover: identifier,
|
|
698
|
-
startedAt:
|
|
809
|
+
startedAt: z10.number(),
|
|
699
810
|
allocation: pickupAllocationSchema.optional()
|
|
700
811
|
}).strict(),
|
|
701
|
-
|
|
812
|
+
z10.object({
|
|
702
813
|
...entitlementBase,
|
|
703
|
-
status:
|
|
814
|
+
status: z10.literal("collected"),
|
|
704
815
|
handover: identifier,
|
|
705
|
-
startedAt:
|
|
816
|
+
startedAt: z10.number(),
|
|
706
817
|
allocation: pickupAllocationSchema.optional(),
|
|
707
|
-
collectedAt:
|
|
818
|
+
collectedAt: z10.number()
|
|
708
819
|
}).strict()
|
|
709
820
|
]);
|
|
710
|
-
var beginHandoverSchema =
|
|
821
|
+
var beginHandoverSchema = z10.object({
|
|
711
822
|
actionId: identifier,
|
|
712
|
-
revision:
|
|
823
|
+
revision: z10.number().int().positive(),
|
|
713
824
|
selection: pickupSelectionSchema.optional()
|
|
714
825
|
}).strict();
|
|
715
|
-
var confirmHandoverSchema =
|
|
716
|
-
var completionRecordSchema =
|
|
717
|
-
key:
|
|
826
|
+
var confirmHandoverSchema = z10.object({ actionId: identifier, handover: identifier }).strict();
|
|
827
|
+
var completionRecordSchema = z10.object({
|
|
828
|
+
key: z10.string().default("once"),
|
|
718
829
|
id: identifier,
|
|
719
830
|
quest: identifier,
|
|
720
831
|
member: identifier
|
|
721
832
|
});
|
|
722
|
-
var questAvailabilitySchema =
|
|
723
|
-
|
|
724
|
-
kind:
|
|
725
|
-
input:
|
|
833
|
+
var questAvailabilitySchema = z10.discriminatedUnion("kind", [
|
|
834
|
+
z10.object({
|
|
835
|
+
kind: z10.literal("available"),
|
|
836
|
+
input: z10.enum(["photo", "quiz", "none", "text", "url"])
|
|
726
837
|
}).strict(),
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
kind:
|
|
730
|
-
missing:
|
|
838
|
+
z10.object({ kind: z10.literal("completed") }).strict(),
|
|
839
|
+
z10.object({
|
|
840
|
+
kind: z10.literal("locked"),
|
|
841
|
+
missing: z10.array(z10.object({ quest: identifier, title: z10.string() })).min(1)
|
|
731
842
|
}).strict(),
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
kind:
|
|
843
|
+
z10.object({ kind: z10.literal("staff-required") }).strict(),
|
|
844
|
+
z10.object({
|
|
845
|
+
kind: z10.literal("automatic"),
|
|
735
846
|
observation: observationTriggerSchema.optional()
|
|
736
847
|
}).strict(),
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
848
|
+
z10.object({ kind: z10.literal("checking"), attempt: identifier }).strict(),
|
|
849
|
+
z10.object({ kind: z10.literal("needs-review"), attempt: identifier }).strict(),
|
|
850
|
+
z10.object({ kind: z10.literal("retryable"), attempt: identifier }).strict()
|
|
740
851
|
]);
|
|
741
|
-
var memberProgressSchema =
|
|
852
|
+
var memberProgressSchema = z10.object({
|
|
742
853
|
member: identifier,
|
|
743
|
-
quests:
|
|
744
|
-
|
|
854
|
+
quests: z10.array(
|
|
855
|
+
z10.object({
|
|
745
856
|
quest: identifier,
|
|
746
857
|
key: identifier.optional(),
|
|
747
858
|
release: identifier.optional(),
|
|
748
|
-
title:
|
|
859
|
+
title: z10.string(),
|
|
749
860
|
presentation: questPresentationSchema.default({}),
|
|
750
|
-
connections:
|
|
861
|
+
connections: z10.array(authProviderSchema).default([]),
|
|
751
862
|
trigger: triggerSchema,
|
|
752
863
|
availability: questAvailabilitySchema,
|
|
753
|
-
completed:
|
|
864
|
+
completed: z10.boolean(),
|
|
754
865
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
755
866
|
streak: streakProgressSchema.nullable().optional(),
|
|
756
|
-
completionCount:
|
|
757
|
-
visibility:
|
|
758
|
-
missing:
|
|
867
|
+
completionCount: z10.number().int().nonnegative().default(0),
|
|
868
|
+
visibility: z10.enum(["visible", "hidden"]).default("visible"),
|
|
869
|
+
missing: z10.array(z10.object({ quest: identifier, title: z10.string() })),
|
|
759
870
|
attempt: attemptSchema.nullable()
|
|
760
871
|
})
|
|
761
872
|
),
|
|
762
|
-
entitlements:
|
|
873
|
+
entitlements: z10.array(entitlementSchema)
|
|
763
874
|
});
|
|
764
|
-
var snapshotSchema =
|
|
765
|
-
releases:
|
|
766
|
-
completions:
|
|
767
|
-
entitlements:
|
|
768
|
-
attempts:
|
|
769
|
-
balances:
|
|
770
|
-
|
|
771
|
-
member:
|
|
772
|
-
balance:
|
|
773
|
-
earned:
|
|
774
|
-
held:
|
|
775
|
-
available:
|
|
875
|
+
var snapshotSchema = z10.object({
|
|
876
|
+
releases: z10.array(publishedReleaseSchema),
|
|
877
|
+
completions: z10.array(completionRecordSchema),
|
|
878
|
+
entitlements: z10.array(entitlementSchema),
|
|
879
|
+
attempts: z10.array(attemptSchema),
|
|
880
|
+
balances: z10.array(
|
|
881
|
+
z10.object({
|
|
882
|
+
member: z10.string(),
|
|
883
|
+
balance: z10.string(),
|
|
884
|
+
earned: z10.number(),
|
|
885
|
+
held: z10.number(),
|
|
886
|
+
available: z10.number()
|
|
776
887
|
})
|
|
777
888
|
),
|
|
778
|
-
events:
|
|
889
|
+
events: z10.array(eventSchema)
|
|
779
890
|
});
|
|
780
|
-
var evidenceSchema =
|
|
891
|
+
var evidenceSchema = z10.object({
|
|
781
892
|
id: identifier,
|
|
782
893
|
member: identifier,
|
|
783
|
-
type:
|
|
784
|
-
size:
|
|
894
|
+
type: z10.enum(["image/jpeg", "image/png"]),
|
|
895
|
+
size: z10.number()
|
|
785
896
|
});
|
|
786
|
-
var errorSchema =
|
|
787
|
-
error:
|
|
788
|
-
code:
|
|
789
|
-
missing:
|
|
897
|
+
var errorSchema = z10.object({
|
|
898
|
+
error: z10.string(),
|
|
899
|
+
code: z10.enum(["stale-quiz", "quest-updated", "invalid-submission"]).optional(),
|
|
900
|
+
missing: z10.array(z10.object({ quest: identifier, title: z10.string() })).optional()
|
|
790
901
|
});
|
|
791
|
-
var staffDecisionSchema =
|
|
902
|
+
var staffDecisionSchema = z10.object({
|
|
792
903
|
actionId: identifier,
|
|
793
|
-
generation:
|
|
794
|
-
decision:
|
|
795
|
-
reason:
|
|
904
|
+
generation: z10.number().int().nonnegative(),
|
|
905
|
+
decision: z10.enum(["accept", "reject"]),
|
|
906
|
+
reason: z10.string().trim().min(1).max(2e3)
|
|
796
907
|
}).strict();
|
|
797
|
-
var stockSchema =
|
|
798
|
-
var reservationSchema =
|
|
908
|
+
var stockSchema = z10.object({ item: identifier, quantity: z10.number().int().min(0).max(1e4) }).strict();
|
|
909
|
+
var reservationSchema = z10.object({
|
|
799
910
|
actionId: identifier,
|
|
800
911
|
member: identifier,
|
|
801
912
|
item: identifier,
|
|
802
913
|
balance: identifier,
|
|
803
|
-
price:
|
|
914
|
+
price: z10.number().int().positive().max(1e4)
|
|
804
915
|
}).strict();
|
|
805
916
|
var pageOptions = {
|
|
806
|
-
limit:
|
|
807
|
-
cursor:
|
|
917
|
+
limit: z10.number().int().min(1).max(100).default(25),
|
|
918
|
+
cursor: z10.string().min(1).max(4096).optional()
|
|
808
919
|
};
|
|
809
|
-
var reviewListSchema =
|
|
920
|
+
var reviewListSchema = z10.object({
|
|
810
921
|
...pageOptions,
|
|
811
922
|
member: identifier.optional(),
|
|
812
923
|
quest: identifier.optional()
|
|
813
924
|
}).strict();
|
|
814
|
-
var memberListSchema =
|
|
925
|
+
var memberListSchema = z10.object({
|
|
815
926
|
...pageOptions,
|
|
816
927
|
prefix: identifier.optional()
|
|
817
928
|
}).strict();
|
|
818
|
-
var reviewItemSchema =
|
|
929
|
+
var reviewItemSchema = z10.object({
|
|
819
930
|
attempt: attemptSchema,
|
|
820
|
-
title:
|
|
821
|
-
checks:
|
|
822
|
-
|
|
931
|
+
title: z10.string(),
|
|
932
|
+
checks: z10.array(
|
|
933
|
+
z10.object({ criteria: z10.string(), result: photoResultSchema })
|
|
823
934
|
)
|
|
824
935
|
});
|
|
825
|
-
var reviewPageSchema =
|
|
826
|
-
items:
|
|
827
|
-
nextCursor:
|
|
936
|
+
var reviewPageSchema = z10.object({
|
|
937
|
+
items: z10.array(reviewItemSchema).max(100),
|
|
938
|
+
nextCursor: z10.string().nullable()
|
|
828
939
|
});
|
|
829
|
-
var memberPageSchema =
|
|
830
|
-
items:
|
|
831
|
-
nextCursor:
|
|
940
|
+
var memberPageSchema = z10.object({
|
|
941
|
+
items: z10.array(z10.object({ member: identifier })).max(100),
|
|
942
|
+
nextCursor: z10.string().nullable()
|
|
832
943
|
});
|
|
833
|
-
var createStockItemSchema =
|
|
834
|
-
var stockItemSchema =
|
|
944
|
+
var createStockItemSchema = z10.object({ actionId: identifier, name: z10.string().trim().min(1).max(80) }).strict();
|
|
945
|
+
var stockItemSchema = z10.object({ id: identifier, name: z10.string() });
|
|
835
946
|
|
|
836
947
|
export {
|
|
837
948
|
communityTimeZoneSchema,
|
|
@@ -856,6 +967,13 @@ export {
|
|
|
856
967
|
discordMemberInputSchema,
|
|
857
968
|
discordMessageInputSchema,
|
|
858
969
|
discordMemberSchema,
|
|
970
|
+
textOptionsSchema,
|
|
971
|
+
urlOptionsSchema,
|
|
972
|
+
textEvidenceSchema,
|
|
973
|
+
urlEvidenceSchema,
|
|
974
|
+
valueEvidenceSchema,
|
|
975
|
+
validateSubmissionValue,
|
|
976
|
+
xPostId,
|
|
859
977
|
quizChoiceSchema,
|
|
860
978
|
quizQuestionSchema,
|
|
861
979
|
quizQuestionsSchema,
|
|
@@ -881,6 +999,8 @@ export {
|
|
|
881
999
|
triggerSchema,
|
|
882
1000
|
prerequisiteSchema,
|
|
883
1001
|
photoResultSchema,
|
|
1002
|
+
textReviewInputSchema,
|
|
1003
|
+
textResultSchema,
|
|
884
1004
|
decisionSchema,
|
|
885
1005
|
reviewModeSchema,
|
|
886
1006
|
storedReviewModeSchema,
|
|
@@ -896,6 +1016,7 @@ export {
|
|
|
896
1016
|
templateSchema,
|
|
897
1017
|
quizAnswersSchema,
|
|
898
1018
|
quizEvidenceSchema,
|
|
1019
|
+
submissionEvidenceSchema,
|
|
899
1020
|
submitSchema,
|
|
900
1021
|
attemptSchema,
|
|
901
1022
|
eventSchema,
|