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