@domino-sdk/relay 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.mjs +3 -1
- package/dist/authoring.d.ts +7 -2
- package/dist/authoring.js +10 -2
- package/dist/browser.d.ts +330 -19
- package/dist/browser.js +4 -3
- package/dist/chunk-3IQ4KUKF.js +613 -0
- package/dist/{chunk-L757OYXZ.js → chunk-LUCL63DS.js} +92 -12
- package/dist/{chunk-6IXQRMGW.js → chunk-QWRSUSNB.js} +1 -1
- package/dist/chunk-TXL43HL3.js +335 -0
- package/dist/index.d.ts +1244 -65
- package/dist/index.js +75 -3
- package/dist/portal-proxy.d.ts +3 -1
- package/dist/portal-proxy.js +13 -9
- package/dist/schema.d.ts +20 -0
- package/dist/schema.js +1 -1
- package/dist/settings-B7vsT8nd.d.ts +1383 -0
- package/package.json +1 -1
- package/dist/chunk-C2KOMNLG.js +0 -570
- package/dist/settings-BEbCiuhH.d.ts +0 -195
package/package.json
CHANGED
package/dist/chunk-C2KOMNLG.js
DELETED
|
@@ -1,570 +0,0 @@
|
|
|
1
|
-
// src/quiz.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
var quizId = z.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
4
|
-
var quizChoiceSchema = z.object({ id: quizId, label: z.string().trim().min(1).max(500) }).strict();
|
|
5
|
-
var quizQuestionSchema = z.object({
|
|
6
|
-
id: quizId,
|
|
7
|
-
prompt: z.string().trim().min(1).max(1e3),
|
|
8
|
-
choices: z.array(quizChoiceSchema).min(2).max(8).refine(
|
|
9
|
-
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
10
|
-
"Choice IDs must be unique"
|
|
11
|
-
)
|
|
12
|
-
}).strict();
|
|
13
|
-
var quizQuestionsSchema = z.array(quizQuestionSchema).min(1).max(20).refine(
|
|
14
|
-
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
15
|
-
"Question IDs must be unique"
|
|
16
|
-
);
|
|
17
|
-
var quizContentSchema = z.array(
|
|
18
|
-
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
19
|
-
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
20
|
-
"Choose a correct answer from the available choices"
|
|
21
|
-
)
|
|
22
|
-
).min(1).max(20).refine(
|
|
23
|
-
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
24
|
-
"Question IDs must be unique"
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
// src/schema.ts
|
|
28
|
-
import { z as z3 } from "zod";
|
|
29
|
-
|
|
30
|
-
// src/settings.ts
|
|
31
|
-
import { z as z2 } from "zod";
|
|
32
|
-
var base = { label: z2.string().min(1), description: z2.string().optional() };
|
|
33
|
-
var settingFieldSchema = z2.discriminatedUnion("kind", [
|
|
34
|
-
z2.object({ ...base, kind: z2.literal("quiz"), default: quizContentSchema }).strict(),
|
|
35
|
-
z2.object({
|
|
36
|
-
...base,
|
|
37
|
-
kind: z2.literal("text"),
|
|
38
|
-
default: z2.string(),
|
|
39
|
-
minLength: z2.number().int().nonnegative(),
|
|
40
|
-
maxLength: z2.number().int().positive(),
|
|
41
|
-
multiline: z2.boolean()
|
|
42
|
-
}).strict(),
|
|
43
|
-
z2.object({
|
|
44
|
-
...base,
|
|
45
|
-
kind: z2.literal("integer"),
|
|
46
|
-
default: z2.number().int(),
|
|
47
|
-
min: z2.number().int(),
|
|
48
|
-
max: z2.number().int()
|
|
49
|
-
}).strict(),
|
|
50
|
-
z2.object({ ...base, kind: z2.literal("boolean"), default: z2.boolean() }).strict(),
|
|
51
|
-
z2.object({
|
|
52
|
-
...base,
|
|
53
|
-
kind: z2.literal("choice"),
|
|
54
|
-
default: z2.string(),
|
|
55
|
-
options: z2.array(z2.string().min(1)).min(1)
|
|
56
|
-
}).strict()
|
|
57
|
-
]);
|
|
58
|
-
var settingsFieldsSchema = z2.record(
|
|
59
|
-
z2.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
60
|
-
settingFieldSchema
|
|
61
|
-
);
|
|
62
|
-
var settingsValuesSchema = z2.record(
|
|
63
|
-
z2.string(),
|
|
64
|
-
z2.union([z2.string(), z2.number().finite(), z2.boolean(), quizContentSchema])
|
|
65
|
-
);
|
|
66
|
-
var settings = {
|
|
67
|
-
quiz(options) {
|
|
68
|
-
const value = quizContentSchema.parse(options.default);
|
|
69
|
-
return quizContentSchema.default(value).meta({ ...options, default: value, kind: "quiz" });
|
|
70
|
-
},
|
|
71
|
-
text(options) {
|
|
72
|
-
const field = {
|
|
73
|
-
...options,
|
|
74
|
-
kind: "text",
|
|
75
|
-
minLength: options.minLength ?? 1,
|
|
76
|
-
maxLength: options.maxLength ?? 2e3,
|
|
77
|
-
multiline: options.multiline ?? false
|
|
78
|
-
};
|
|
79
|
-
return z2.string().min(field.minLength).max(field.maxLength).default(field.default).meta(field);
|
|
80
|
-
},
|
|
81
|
-
integer(options) {
|
|
82
|
-
return z2.number().int().min(options.min).max(options.max).default(options.default).meta({ ...options, kind: "integer" });
|
|
83
|
-
},
|
|
84
|
-
boolean(options) {
|
|
85
|
-
return z2.boolean().default(options.default).meta({ ...options, kind: "boolean" });
|
|
86
|
-
},
|
|
87
|
-
choice(options) {
|
|
88
|
-
return z2.enum(options.options).default(options.default).meta({ ...options, kind: "choice" });
|
|
89
|
-
},
|
|
90
|
-
object(shape) {
|
|
91
|
-
return z2.object(shape).strict();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
function parseSettings(fields, input) {
|
|
95
|
-
const shape = {};
|
|
96
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
97
|
-
switch (field.kind) {
|
|
98
|
-
case "quiz":
|
|
99
|
-
shape[key] = quizContentSchema.default(field.default);
|
|
100
|
-
break;
|
|
101
|
-
case "text":
|
|
102
|
-
shape[key] = z2.string().min(field.minLength).max(field.maxLength).default(field.default);
|
|
103
|
-
break;
|
|
104
|
-
case "integer":
|
|
105
|
-
shape[key] = z2.number().int().min(field.min).max(field.max).default(field.default);
|
|
106
|
-
break;
|
|
107
|
-
case "boolean":
|
|
108
|
-
shape[key] = z2.boolean().default(field.default);
|
|
109
|
-
break;
|
|
110
|
-
case "choice":
|
|
111
|
-
shape[key] = z2.enum(field.options).default(field.default);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return settingsValuesSchema.parse(z2.object(shape).strict().parse(input));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/schema.ts
|
|
119
|
-
var identifier = z3.string().min(1).max(100).regex(/^[a-zA-Z0-9_-]+$/);
|
|
120
|
-
var pointsRewardSchema = z3.object({
|
|
121
|
-
kind: z3.literal("points").default("points"),
|
|
122
|
-
balance: identifier,
|
|
123
|
-
amount: z3.number().int().min(0).max(1e4)
|
|
124
|
-
}).strict();
|
|
125
|
-
var tieredRewardDefinitionSchema = z3.object({
|
|
126
|
-
id: identifier,
|
|
127
|
-
title: z3.string().min(1).max(120),
|
|
128
|
-
tiers: z3.array(
|
|
129
|
-
z3.object({ id: identifier, title: z3.string().min(1).max(120) }).strict()
|
|
130
|
-
).min(1).max(20).refine(
|
|
131
|
-
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
132
|
-
"Tier IDs must be unique"
|
|
133
|
-
),
|
|
134
|
-
inventory: z3.object({ kind: z3.literal("untracked") }).strict(),
|
|
135
|
-
fulfillment: z3.object({ kind: z3.literal("staff-handover") }).strict()
|
|
136
|
-
}).strict();
|
|
137
|
-
var tierRewardSchema = z3.object({
|
|
138
|
-
kind: z3.literal("tier"),
|
|
139
|
-
reward: tieredRewardDefinitionSchema,
|
|
140
|
-
tier: identifier
|
|
141
|
-
}).strict().refine(
|
|
142
|
-
(value) => value.reward.tiers.some((t) => t.id === value.tier),
|
|
143
|
-
"Unknown reward tier"
|
|
144
|
-
);
|
|
145
|
-
var rewardSchema = z3.union([pointsRewardSchema, tierRewardSchema]);
|
|
146
|
-
function rewardKey(reward) {
|
|
147
|
-
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
148
|
-
}
|
|
149
|
-
var triggerSchema = z3.union([
|
|
150
|
-
z3.object({
|
|
151
|
-
kind: z3.literal("manual"),
|
|
152
|
-
input: z3.enum(["photo", "quiz", "none"]),
|
|
153
|
-
actor: z3.enum(["member", "staff"]).optional()
|
|
154
|
-
}).strict(),
|
|
155
|
-
z3.object({ kind: z3.literal("automatic") }).strict()
|
|
156
|
-
]);
|
|
157
|
-
var prerequisiteSchema = z3.object({ quest: identifier, scope: z3.literal("ever") }).strict();
|
|
158
|
-
var photoResultSchema = z3.object({
|
|
159
|
-
kind: z3.enum(["pass", "fail", "unclear"]),
|
|
160
|
-
reason: z3.string().min(1).max(2e3)
|
|
161
|
-
}).strict();
|
|
162
|
-
var decisionSchema = z3.discriminatedUnion("kind", [
|
|
163
|
-
z3.object({
|
|
164
|
-
kind: z3.literal("accept"),
|
|
165
|
-
rewards: z3.array(rewardSchema).max(10)
|
|
166
|
-
}).strict(),
|
|
167
|
-
z3.object({ kind: z3.literal("reject"), reason: z3.string().min(1).max(2e3) }).strict(),
|
|
168
|
-
z3.object({
|
|
169
|
-
kind: z3.literal("review"),
|
|
170
|
-
reason: z3.string().min(1).max(2e3),
|
|
171
|
-
rewards: z3.array(rewardSchema).max(10).optional()
|
|
172
|
-
}).strict()
|
|
173
|
-
]);
|
|
174
|
-
var reviewModeSchema = z3.enum([
|
|
175
|
-
"fixture-pass",
|
|
176
|
-
"fixture-fail",
|
|
177
|
-
"fixture-unclear",
|
|
178
|
-
"fixture-error",
|
|
179
|
-
"workers-ai"
|
|
180
|
-
]);
|
|
181
|
-
var rewardBundleSchema = z3.array(rewardSchema).max(10).refine(
|
|
182
|
-
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
183
|
-
"Use one entry per balance or shared reward"
|
|
184
|
-
);
|
|
185
|
-
var mediaUrlSchema = z3.string().max(2e3).refine((value) => {
|
|
186
|
-
if (/^\/(?!\/)[^\\\s]*$/.test(value)) return true;
|
|
187
|
-
try {
|
|
188
|
-
return new URL(value).protocol === "https:";
|
|
189
|
-
} catch {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
193
|
-
var questPresentationSchema = z3.object({
|
|
194
|
-
quiz: quizQuestionsSchema.optional(),
|
|
195
|
-
instructions: z3.string().max(4e3).optional(),
|
|
196
|
-
video: z3.object({
|
|
197
|
-
url: mediaUrlSchema,
|
|
198
|
-
poster: mediaUrlSchema.optional(),
|
|
199
|
-
captions: z3.object({
|
|
200
|
-
url: mediaUrlSchema,
|
|
201
|
-
language: z3.string().min(2).max(20),
|
|
202
|
-
label: z3.string().min(1).max(80)
|
|
203
|
-
}).strict().optional()
|
|
204
|
-
}).strict().optional()
|
|
205
|
-
}).strict();
|
|
206
|
-
var questDescriptionSchema = z3.object({
|
|
207
|
-
quest: identifier,
|
|
208
|
-
runtimeVersion: z3.union([z3.literal(1), z3.literal(2)]).default(1),
|
|
209
|
-
title: z3.string().min(1).max(120),
|
|
210
|
-
presentation: questPresentationSchema.default({}),
|
|
211
|
-
fields: settingsFieldsSchema,
|
|
212
|
-
values: settingsValuesSchema,
|
|
213
|
-
rewards: rewardBundleSchema,
|
|
214
|
-
humanReview: z3.boolean(),
|
|
215
|
-
trigger: triggerSchema,
|
|
216
|
-
requires: z3.array(prerequisiteSchema).max(30).default([]),
|
|
217
|
-
completion: z3.object({ kind: z3.literal("once") }).strict()
|
|
218
|
-
}).strict();
|
|
219
|
-
var artifactSchema = z3.object({ code: z3.string().min(1).max(1e6) }).strict();
|
|
220
|
-
var releaseSchema = artifactSchema.extend({
|
|
221
|
-
settings: settingsValuesSchema,
|
|
222
|
-
provider: reviewModeSchema,
|
|
223
|
-
expectedRelease: identifier.nullable().optional(),
|
|
224
|
-
settingRenames: z3.record(z3.string(), z3.string()).optional()
|
|
225
|
-
}).strict();
|
|
226
|
-
var batchReleaseSchema = z3.object({ releases: z3.array(releaseSchema).min(1).max(50) }).strict();
|
|
227
|
-
var questSettingsInputSchema = z3.object({
|
|
228
|
-
quest: identifier,
|
|
229
|
-
expectedRelease: identifier,
|
|
230
|
-
set: settingsValuesSchema,
|
|
231
|
-
reset: z3.array(z3.string())
|
|
232
|
-
}).strict();
|
|
233
|
-
var storedReleaseSchema = questDescriptionSchema.extend({
|
|
234
|
-
code: z3.string(),
|
|
235
|
-
provider: reviewModeSchema,
|
|
236
|
-
id: identifier,
|
|
237
|
-
createdAt: z3.number(),
|
|
238
|
-
legacy: z3.boolean().default(false),
|
|
239
|
-
origin: z3.object({ typeVersion: identifier }).strict().optional(),
|
|
240
|
-
lifecycle: z3.enum(["active", "paused", "archived"]).default("active"),
|
|
241
|
-
configuration: z3.object({
|
|
242
|
-
defaults: settingsValuesSchema,
|
|
243
|
-
overrides: settingsValuesSchema,
|
|
244
|
-
preserved: z3.array(z3.string())
|
|
245
|
-
}).strict().optional()
|
|
246
|
-
});
|
|
247
|
-
var legacyReleaseSchema = z3.object({
|
|
248
|
-
quest: identifier,
|
|
249
|
-
title: z3.string(),
|
|
250
|
-
criteria: z3.string(),
|
|
251
|
-
humanReview: z3.boolean(),
|
|
252
|
-
rewards: rewardBundleSchema,
|
|
253
|
-
code: z3.string(),
|
|
254
|
-
provider: reviewModeSchema,
|
|
255
|
-
id: identifier,
|
|
256
|
-
createdAt: z3.number()
|
|
257
|
-
}).transform((r) => {
|
|
258
|
-
const { criteria, ...stored } = r;
|
|
259
|
-
return storedReleaseSchema.parse({
|
|
260
|
-
...stored,
|
|
261
|
-
fields: {},
|
|
262
|
-
values: { criteria, humanReview: r.humanReview },
|
|
263
|
-
trigger: { kind: "manual", input: "photo" },
|
|
264
|
-
completion: { kind: "once" },
|
|
265
|
-
legacy: true
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
var publishedReleaseSchema = z3.union([
|
|
269
|
-
storedReleaseSchema,
|
|
270
|
-
legacyReleaseSchema
|
|
271
|
-
]);
|
|
272
|
-
var templateSchema = z3.object({
|
|
273
|
-
code: z3.string(),
|
|
274
|
-
definition: questDescriptionSchema
|
|
275
|
-
});
|
|
276
|
-
var quizAnswersSchema = z3.record(identifier, identifier).refine(
|
|
277
|
-
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
278
|
-
"Provide between 1 and 50 answers"
|
|
279
|
-
).transform(
|
|
280
|
-
(answers) => Object.fromEntries(
|
|
281
|
-
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
282
|
-
)
|
|
283
|
-
);
|
|
284
|
-
var quizEvidenceSchema = z3.object({
|
|
285
|
-
kind: z3.literal("quiz"),
|
|
286
|
-
release: identifier.optional(),
|
|
287
|
-
answers: quizAnswersSchema
|
|
288
|
-
}).strict();
|
|
289
|
-
var submitSchema = z3.object({
|
|
290
|
-
actionId: identifier,
|
|
291
|
-
quest: identifier,
|
|
292
|
-
member: identifier,
|
|
293
|
-
evidence: identifier.optional(),
|
|
294
|
-
input: quizEvidenceSchema.optional(),
|
|
295
|
-
release: identifier.optional(),
|
|
296
|
-
faultAfterReview: z3.boolean().optional()
|
|
297
|
-
}).strict();
|
|
298
|
-
var attemptSchema = z3.object({
|
|
299
|
-
id: identifier,
|
|
300
|
-
release: identifier,
|
|
301
|
-
quest: identifier,
|
|
302
|
-
member: identifier,
|
|
303
|
-
evidence: identifier.nullable(),
|
|
304
|
-
input: quizEvidenceSchema.optional(),
|
|
305
|
-
status: z3.enum([
|
|
306
|
-
"queued",
|
|
307
|
-
"evaluating",
|
|
308
|
-
"accepted",
|
|
309
|
-
"rejected",
|
|
310
|
-
"needs-review",
|
|
311
|
-
"failed"
|
|
312
|
-
]),
|
|
313
|
-
reason: z3.string().nullable(),
|
|
314
|
-
retries: z3.number(),
|
|
315
|
-
generation: z3.number(),
|
|
316
|
-
completion: z3.string().nullable(),
|
|
317
|
-
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
318
|
-
createdAt: z3.number()
|
|
319
|
-
});
|
|
320
|
-
var eventSchema = z3.object({
|
|
321
|
-
id: z3.number(),
|
|
322
|
-
attempt: z3.string().nullable(),
|
|
323
|
-
kind: z3.string(),
|
|
324
|
-
detail: z3.string(),
|
|
325
|
-
actor: z3.string().nullable().default(null),
|
|
326
|
-
at: z3.number()
|
|
327
|
-
});
|
|
328
|
-
var pickupSelectionSchema = z3.object({
|
|
329
|
-
item: identifier,
|
|
330
|
-
revision: z3.number().int().nonnegative()
|
|
331
|
-
}).strict();
|
|
332
|
-
var pickupAllocationSchema = z3.object({
|
|
333
|
-
item: identifier,
|
|
334
|
-
label: z3.string().min(1).max(80)
|
|
335
|
-
}).strict();
|
|
336
|
-
var pickupPolicySchema = z3.discriminatedUnion("kind", [
|
|
337
|
-
z3.object({ kind: z3.literal("untracked") }).strict(),
|
|
338
|
-
z3.object({
|
|
339
|
-
kind: z3.literal("at-pickup"),
|
|
340
|
-
tiers: z3.array(
|
|
341
|
-
z3.object({
|
|
342
|
-
tier: identifier,
|
|
343
|
-
variants: z3.array(pickupAllocationSchema).min(1).max(100)
|
|
344
|
-
}).strict()
|
|
345
|
-
).min(1).max(100)
|
|
346
|
-
}).strict()
|
|
347
|
-
]);
|
|
348
|
-
var pickupCatalogSchema = z3.object({
|
|
349
|
-
reward: tieredRewardDefinitionSchema,
|
|
350
|
-
revision: z3.number().int().nonnegative(),
|
|
351
|
-
policy: pickupPolicySchema
|
|
352
|
-
});
|
|
353
|
-
var pickupAvailabilitySchema = z3.discriminatedUnion("kind", [
|
|
354
|
-
z3.object({ kind: z3.literal("untracked") }).strict(),
|
|
355
|
-
z3.object({
|
|
356
|
-
kind: z3.literal("at-pickup"),
|
|
357
|
-
revision: z3.number().int().nonnegative(),
|
|
358
|
-
variants: z3.array(
|
|
359
|
-
pickupAllocationSchema.extend({
|
|
360
|
-
available: z3.number().int().nonnegative()
|
|
361
|
-
})
|
|
362
|
-
)
|
|
363
|
-
}).strict()
|
|
364
|
-
]);
|
|
365
|
-
var configurePickupSchema = z3.object({
|
|
366
|
-
reward: identifier,
|
|
367
|
-
revision: z3.number().int().nonnegative(),
|
|
368
|
-
actionId: identifier,
|
|
369
|
-
policy: pickupPolicySchema
|
|
370
|
-
}).strict();
|
|
371
|
-
var entitlementBase = {
|
|
372
|
-
id: identifier,
|
|
373
|
-
member: identifier,
|
|
374
|
-
reward: tieredRewardDefinitionSchema,
|
|
375
|
-
earnedTier: identifier,
|
|
376
|
-
tier: identifier,
|
|
377
|
-
revision: z3.number().int().positive()
|
|
378
|
-
};
|
|
379
|
-
var entitlementSchema = z3.discriminatedUnion("status", [
|
|
380
|
-
z3.object({ ...entitlementBase, status: z3.literal("available") }).strict(),
|
|
381
|
-
z3.object({
|
|
382
|
-
...entitlementBase,
|
|
383
|
-
status: z3.literal("handing-over"),
|
|
384
|
-
handover: identifier,
|
|
385
|
-
startedAt: z3.number(),
|
|
386
|
-
allocation: pickupAllocationSchema.optional()
|
|
387
|
-
}).strict(),
|
|
388
|
-
z3.object({
|
|
389
|
-
...entitlementBase,
|
|
390
|
-
status: z3.literal("collected"),
|
|
391
|
-
handover: identifier,
|
|
392
|
-
startedAt: z3.number(),
|
|
393
|
-
allocation: pickupAllocationSchema.optional(),
|
|
394
|
-
collectedAt: z3.number()
|
|
395
|
-
}).strict()
|
|
396
|
-
]);
|
|
397
|
-
var beginHandoverSchema = z3.object({
|
|
398
|
-
actionId: identifier,
|
|
399
|
-
revision: z3.number().int().positive(),
|
|
400
|
-
selection: pickupSelectionSchema.optional()
|
|
401
|
-
}).strict();
|
|
402
|
-
var confirmHandoverSchema = z3.object({ actionId: identifier, handover: identifier }).strict();
|
|
403
|
-
var completionRecordSchema = z3.object({
|
|
404
|
-
id: identifier,
|
|
405
|
-
quest: identifier,
|
|
406
|
-
member: identifier
|
|
407
|
-
});
|
|
408
|
-
var questAvailabilitySchema = z3.discriminatedUnion("kind", [
|
|
409
|
-
z3.object({
|
|
410
|
-
kind: z3.literal("available"),
|
|
411
|
-
input: z3.enum(["photo", "quiz", "none"])
|
|
412
|
-
}).strict(),
|
|
413
|
-
z3.object({ kind: z3.literal("completed") }).strict(),
|
|
414
|
-
z3.object({
|
|
415
|
-
kind: z3.literal("locked"),
|
|
416
|
-
missing: z3.array(z3.object({ quest: identifier, title: z3.string() })).min(1)
|
|
417
|
-
}).strict(),
|
|
418
|
-
z3.object({ kind: z3.literal("staff-required") }).strict(),
|
|
419
|
-
z3.object({ kind: z3.literal("automatic") }).strict(),
|
|
420
|
-
z3.object({ kind: z3.literal("checking"), attempt: identifier }).strict(),
|
|
421
|
-
z3.object({ kind: z3.literal("needs-review"), attempt: identifier }).strict(),
|
|
422
|
-
z3.object({ kind: z3.literal("retryable"), attempt: identifier }).strict()
|
|
423
|
-
]);
|
|
424
|
-
var memberProgressSchema = z3.object({
|
|
425
|
-
member: identifier,
|
|
426
|
-
quests: z3.array(
|
|
427
|
-
z3.object({
|
|
428
|
-
quest: identifier,
|
|
429
|
-
release: identifier.optional(),
|
|
430
|
-
title: z3.string(),
|
|
431
|
-
presentation: questPresentationSchema.default({}),
|
|
432
|
-
trigger: triggerSchema,
|
|
433
|
-
availability: questAvailabilitySchema,
|
|
434
|
-
completed: z3.boolean(),
|
|
435
|
-
missing: z3.array(z3.object({ quest: identifier, title: z3.string() })),
|
|
436
|
-
attempt: attemptSchema.nullable()
|
|
437
|
-
})
|
|
438
|
-
),
|
|
439
|
-
entitlements: z3.array(entitlementSchema)
|
|
440
|
-
});
|
|
441
|
-
var snapshotSchema = z3.object({
|
|
442
|
-
releases: z3.array(publishedReleaseSchema),
|
|
443
|
-
completions: z3.array(completionRecordSchema),
|
|
444
|
-
entitlements: z3.array(entitlementSchema),
|
|
445
|
-
attempts: z3.array(attemptSchema),
|
|
446
|
-
balances: z3.array(
|
|
447
|
-
z3.object({
|
|
448
|
-
member: z3.string(),
|
|
449
|
-
balance: z3.string(),
|
|
450
|
-
earned: z3.number(),
|
|
451
|
-
held: z3.number(),
|
|
452
|
-
available: z3.number()
|
|
453
|
-
})
|
|
454
|
-
),
|
|
455
|
-
events: z3.array(eventSchema)
|
|
456
|
-
});
|
|
457
|
-
var evidenceSchema = z3.object({
|
|
458
|
-
id: identifier,
|
|
459
|
-
member: identifier,
|
|
460
|
-
type: z3.enum(["image/jpeg", "image/png"]),
|
|
461
|
-
size: z3.number()
|
|
462
|
-
});
|
|
463
|
-
var errorSchema = z3.object({
|
|
464
|
-
error: z3.string(),
|
|
465
|
-
code: z3.enum(["stale-quiz", "quest-updated"]).optional(),
|
|
466
|
-
missing: z3.array(z3.object({ quest: identifier, title: z3.string() })).optional()
|
|
467
|
-
});
|
|
468
|
-
var staffDecisionSchema = z3.object({
|
|
469
|
-
actionId: identifier,
|
|
470
|
-
generation: z3.number().int().nonnegative(),
|
|
471
|
-
decision: z3.enum(["accept", "reject"]),
|
|
472
|
-
reason: z3.string().trim().min(1).max(2e3)
|
|
473
|
-
}).strict();
|
|
474
|
-
var stockSchema = z3.object({ item: identifier, quantity: z3.number().int().min(0).max(1e4) }).strict();
|
|
475
|
-
var reservationSchema = z3.object({
|
|
476
|
-
actionId: identifier,
|
|
477
|
-
member: identifier,
|
|
478
|
-
item: identifier,
|
|
479
|
-
balance: identifier,
|
|
480
|
-
price: z3.number().int().positive().max(1e4)
|
|
481
|
-
}).strict();
|
|
482
|
-
var pageOptions = {
|
|
483
|
-
limit: z3.number().int().min(1).max(100).default(25),
|
|
484
|
-
cursor: z3.string().min(1).max(4096).optional()
|
|
485
|
-
};
|
|
486
|
-
var reviewListSchema = z3.object({
|
|
487
|
-
...pageOptions,
|
|
488
|
-
member: identifier.optional(),
|
|
489
|
-
quest: identifier.optional()
|
|
490
|
-
}).strict();
|
|
491
|
-
var memberListSchema = z3.object({
|
|
492
|
-
...pageOptions,
|
|
493
|
-
prefix: identifier.optional()
|
|
494
|
-
}).strict();
|
|
495
|
-
var reviewItemSchema = z3.object({
|
|
496
|
-
attempt: attemptSchema,
|
|
497
|
-
title: z3.string(),
|
|
498
|
-
checks: z3.array(
|
|
499
|
-
z3.object({ criteria: z3.string(), result: photoResultSchema })
|
|
500
|
-
)
|
|
501
|
-
});
|
|
502
|
-
var reviewPageSchema = z3.object({
|
|
503
|
-
items: z3.array(reviewItemSchema).max(100),
|
|
504
|
-
nextCursor: z3.string().nullable()
|
|
505
|
-
});
|
|
506
|
-
var memberPageSchema = z3.object({
|
|
507
|
-
items: z3.array(z3.object({ member: identifier })).max(100),
|
|
508
|
-
nextCursor: z3.string().nullable()
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
export {
|
|
512
|
-
quizChoiceSchema,
|
|
513
|
-
quizQuestionSchema,
|
|
514
|
-
quizQuestionsSchema,
|
|
515
|
-
quizContentSchema,
|
|
516
|
-
settingFieldSchema,
|
|
517
|
-
settingsFieldsSchema,
|
|
518
|
-
settingsValuesSchema,
|
|
519
|
-
settings,
|
|
520
|
-
parseSettings,
|
|
521
|
-
identifier,
|
|
522
|
-
pointsRewardSchema,
|
|
523
|
-
tieredRewardDefinitionSchema,
|
|
524
|
-
tierRewardSchema,
|
|
525
|
-
rewardSchema,
|
|
526
|
-
rewardKey,
|
|
527
|
-
triggerSchema,
|
|
528
|
-
prerequisiteSchema,
|
|
529
|
-
photoResultSchema,
|
|
530
|
-
decisionSchema,
|
|
531
|
-
reviewModeSchema,
|
|
532
|
-
rewardBundleSchema,
|
|
533
|
-
mediaUrlSchema,
|
|
534
|
-
questPresentationSchema,
|
|
535
|
-
questDescriptionSchema,
|
|
536
|
-
artifactSchema,
|
|
537
|
-
releaseSchema,
|
|
538
|
-
batchReleaseSchema,
|
|
539
|
-
questSettingsInputSchema,
|
|
540
|
-
publishedReleaseSchema,
|
|
541
|
-
templateSchema,
|
|
542
|
-
quizAnswersSchema,
|
|
543
|
-
quizEvidenceSchema,
|
|
544
|
-
submitSchema,
|
|
545
|
-
attemptSchema,
|
|
546
|
-
eventSchema,
|
|
547
|
-
pickupSelectionSchema,
|
|
548
|
-
pickupAllocationSchema,
|
|
549
|
-
pickupPolicySchema,
|
|
550
|
-
pickupCatalogSchema,
|
|
551
|
-
pickupAvailabilitySchema,
|
|
552
|
-
configurePickupSchema,
|
|
553
|
-
entitlementSchema,
|
|
554
|
-
beginHandoverSchema,
|
|
555
|
-
confirmHandoverSchema,
|
|
556
|
-
completionRecordSchema,
|
|
557
|
-
questAvailabilitySchema,
|
|
558
|
-
memberProgressSchema,
|
|
559
|
-
snapshotSchema,
|
|
560
|
-
evidenceSchema,
|
|
561
|
-
errorSchema,
|
|
562
|
-
staffDecisionSchema,
|
|
563
|
-
stockSchema,
|
|
564
|
-
reservationSchema,
|
|
565
|
-
reviewListSchema,
|
|
566
|
-
memberListSchema,
|
|
567
|
-
reviewItemSchema,
|
|
568
|
-
reviewPageSchema,
|
|
569
|
-
memberPageSchema
|
|
570
|
-
};
|