@domino-sdk/relay 1.9.0 → 1.10.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/{activity-CCe1e_7a.d.ts → activity-C0O3g7VJ.d.ts} +115 -115
- package/dist/authoring.d.ts +49 -49
- package/dist/authoring.js +3 -3
- package/dist/{automatic-outcomes-Dyk0VTUs.d.ts → automatic-outcomes-kPIDv6X_.d.ts} +1 -1
- package/dist/avatar.d.ts +2 -2
- package/dist/browser.d.ts +8 -8
- package/dist/browser.js +8 -7
- package/dist/{capability-error-Bv996M-h.d.ts → capability-error-ty3SqD_b.d.ts} +1 -1
- package/dist/{chunk-KGJSKGKI.js → chunk-23JUD56J.js} +1119 -910
- package/dist/{chunk-FWSSMSIA.js → chunk-7BRHUUVB.js} +37 -8
- package/dist/{chunk-2N464DDE.js → chunk-BKLGWPPD.js} +48 -37
- package/dist/{chunk-6ON4RMEN.js → chunk-BUXNTVER.js} +1 -1
- package/dist/{chunk-L3QFIRGO.js → chunk-GEPSEVQO.js} +2 -2
- package/dist/{chunk-ETPL6AAJ.js → chunk-GFAFH7XR.js} +1 -1
- package/dist/{chunk-734LYHWP.js → chunk-GPS546KR.js} +232 -7
- package/dist/{chunk-5ECM6AWV.js → chunk-MMWTHVXW.js} +3 -3
- package/dist/chunk-N2HXMTVA.js +13 -0
- package/dist/{chunk-23QJ7WH4.js → chunk-QL77V77D.js} +1 -1
- package/dist/{chunk-2V74CHDL.js → chunk-UIR6NSYZ.js} +52 -37
- package/dist/{chunk-JW4G3SY5.js → chunk-WRBPLXVP.js} +60 -47
- package/dist/{client-CbASImpi.d.ts → client-Yq11HA_f.d.ts} +26 -11
- package/dist/{groups-Dvmd4CYk.d.ts → groups-BK8ts2yK.d.ts} +94 -6
- package/dist/{images-Dekv3DYF.d.ts → images-aw6W7vFZ.d.ts} +2 -2
- package/dist/index.d.ts +9 -9
- package/dist/index.js +7 -6
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +5 -5
- package/dist/{offers-BEGVSOTD.d.ts → offers-C2FANzrG.d.ts} +3 -3
- package/dist/{pages-HmS6eedC.d.ts → pages-D00JDZB-.d.ts} +33 -2
- package/dist/portal-proxy.js +8 -2
- package/dist/react/index.d.ts +14 -17
- package/dist/react/index.js +8 -7
- package/dist/{referral-reward-kinds-Flbb1D2q.d.ts → referral-reward-kinds-M3f0PdiR.d.ts} +2 -2
- package/dist/{schema-BCuiO7eD.d.ts → schema-DEM8y8Fm.d.ts} +1 -1
- package/dist/schema.d.ts +11239 -13
- package/dist/schema.js +38 -6
- package/dist/server/index.d.ts +43117 -22
- package/dist/server/index.js +303 -14
- package/dist/{sign-in-options-z3wsfizk.d.ts → sign-in-options-Coim0G1u.d.ts} +3 -3
- package/dist/{submission-input-Bs14jIsu.d.ts → submission-input-BbBJTVlT.d.ts} +3 -3
- package/dist/util.d-w9f9t3ua.d.ts +5 -0
- package/dist/{wallet-YssWxGg8.d.ts → wallet-CDyo-U4n.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/{profiles-D2aFcOxu.d.ts → profiles-BHMVj0kM.d.ts} +5 -5
|
@@ -1,114 +1,312 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/response.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
var
|
|
4
|
-
|
|
3
|
+
var responseFormat = /* @__PURE__ */ Symbol("domino.response.tolerant-v1");
|
|
4
|
+
function markResponseSchema(schema) {
|
|
5
|
+
return Object.assign(schema, { [responseFormat]: true });
|
|
6
|
+
}
|
|
7
|
+
var cache = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function responseShape(schema) {
|
|
9
|
+
const definition = { ...schema._zod.def };
|
|
10
|
+
if (schema instanceof z.ZodObject) {
|
|
11
|
+
Object.assign(definition, {
|
|
12
|
+
shape: Object.fromEntries(
|
|
13
|
+
Object.entries(schema.shape).map(([key, child]) => [
|
|
14
|
+
key,
|
|
15
|
+
responseShape(child)
|
|
16
|
+
])
|
|
17
|
+
),
|
|
18
|
+
catchall: schema._zod.def.catchall instanceof z.ZodNever || !schema._zod.def.catchall ? void 0 : responseShape(schema._zod.def.catchall)
|
|
19
|
+
});
|
|
20
|
+
} else if (schema instanceof z.ZodNumber) {
|
|
21
|
+
Object.assign(definition, {
|
|
22
|
+
checks: schema._zod.def.checks?.filter((check) => {
|
|
23
|
+
const rule = check._zod.def;
|
|
24
|
+
return rule.check !== "less_than" || !("value" in rule) || rule.value === Number.MAX_SAFE_INTEGER || rule.value === 864e13;
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
} else if (schema instanceof z.ZodArray) {
|
|
28
|
+
Object.assign(definition, {
|
|
29
|
+
element: responseShape(schema.element),
|
|
30
|
+
checks: []
|
|
31
|
+
});
|
|
32
|
+
} else if (schema instanceof z.ZodUnion) {
|
|
33
|
+
Object.assign(definition, { options: schema.options.map(responseShape) });
|
|
34
|
+
} else if (schema instanceof z.ZodTuple) {
|
|
35
|
+
Object.assign(definition, {
|
|
36
|
+
items: schema._zod.def.items.map(responseShape),
|
|
37
|
+
rest: schema._zod.def.rest ? responseShape(schema._zod.def.rest) : null
|
|
38
|
+
});
|
|
39
|
+
} else if (schema instanceof z.ZodIntersection) {
|
|
40
|
+
Object.assign(definition, {
|
|
41
|
+
left: responseShape(schema._zod.def.left),
|
|
42
|
+
right: responseShape(schema._zod.def.right)
|
|
43
|
+
});
|
|
44
|
+
} else if (schema instanceof z.ZodLazy) {
|
|
45
|
+
Object.assign(definition, {
|
|
46
|
+
getter: () => responseShape(schema._zod.def.getter())
|
|
47
|
+
});
|
|
48
|
+
} else if (schema instanceof z.ZodRecord) {
|
|
49
|
+
Object.assign(definition, { valueType: responseShape(schema.valueType) });
|
|
50
|
+
} else if (schema instanceof z.ZodPipe) {
|
|
51
|
+
Object.assign(definition, {
|
|
52
|
+
in: responseShape(schema.in),
|
|
53
|
+
out: responseShape(schema.out)
|
|
54
|
+
});
|
|
55
|
+
} else if ("innerType" in definition && definition.innerType instanceof z.ZodType) {
|
|
56
|
+
Object.assign(definition, {
|
|
57
|
+
innerType: responseShape(definition.innerType)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return z.clone(schema, definition);
|
|
61
|
+
}
|
|
62
|
+
function knownResponse(schema) {
|
|
63
|
+
const existing = cache.get(schema);
|
|
64
|
+
if (existing) {
|
|
65
|
+
return existing;
|
|
66
|
+
}
|
|
67
|
+
const reader = responseShape(schema);
|
|
68
|
+
cache.set(schema, reader);
|
|
69
|
+
return reader;
|
|
70
|
+
}
|
|
71
|
+
function fields(schema) {
|
|
72
|
+
if (schema instanceof z.ZodObject) {
|
|
73
|
+
return schema.shape;
|
|
74
|
+
}
|
|
75
|
+
if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z.ZodType) {
|
|
76
|
+
return fields(schema._zod.def.innerType);
|
|
77
|
+
}
|
|
78
|
+
return void 0;
|
|
79
|
+
}
|
|
80
|
+
function values(schema) {
|
|
81
|
+
if (schema instanceof z.ZodLiteral) {
|
|
82
|
+
return [...schema.values];
|
|
83
|
+
}
|
|
84
|
+
if (schema instanceof z.ZodEnum) {
|
|
85
|
+
return schema.options;
|
|
86
|
+
}
|
|
87
|
+
if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z.ZodType) {
|
|
88
|
+
return values(schema._zod.def.innerType);
|
|
89
|
+
}
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
function unknownVariant(schema, input) {
|
|
93
|
+
if (schema instanceof z.ZodLiteral) {
|
|
94
|
+
return typeof input === "string" && [...schema.values].every((value) => typeof value === "string") && !schema.values.has(input);
|
|
95
|
+
}
|
|
96
|
+
if (schema instanceof z.ZodEnum) {
|
|
97
|
+
return typeof input === "string" && !schema.options.includes(input);
|
|
98
|
+
}
|
|
99
|
+
if (schema instanceof z.ZodArray && Array.isArray(input)) {
|
|
100
|
+
return input.some((item) => unknownVariant(schema.element, item));
|
|
101
|
+
}
|
|
102
|
+
if (schema instanceof z.ZodTuple && Array.isArray(input)) {
|
|
103
|
+
return input.some((item, index) => {
|
|
104
|
+
const child = schema._zod.def.items[index] ?? schema._zod.def.rest;
|
|
105
|
+
return child ? unknownVariant(child, item) : false;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (schema instanceof z.ZodIntersection) {
|
|
109
|
+
return unknownVariant(schema._zod.def.left, input) || unknownVariant(schema._zod.def.right, input);
|
|
110
|
+
}
|
|
111
|
+
if (schema instanceof z.ZodLazy) {
|
|
112
|
+
return unknownVariant(schema._zod.def.getter(), input);
|
|
113
|
+
}
|
|
114
|
+
if (schema instanceof z.ZodRecord && input !== null && typeof input === "object" && !Array.isArray(input)) {
|
|
115
|
+
return Object.entries(input).some(
|
|
116
|
+
([key, value]) => unknownVariant(schema.keyType, key) || unknownVariant(schema.valueType, value)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
if (schema instanceof z.ZodUnion) {
|
|
120
|
+
let options = [...schema.options];
|
|
121
|
+
if (typeof input === "string") {
|
|
122
|
+
const choices = options.flatMap((option) => values(option) ?? []);
|
|
123
|
+
if (choices.some((choice) => typeof choice === "string") && !choices.includes(input)) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (input !== null && typeof input === "object" && !Array.isArray(input)) {
|
|
128
|
+
const raw = z.record(z.string(), z.unknown()).parse(input);
|
|
129
|
+
const keys = ["kind", "status", "provider", "input", "type", "mode"];
|
|
130
|
+
for (const key of keys) {
|
|
131
|
+
if (typeof raw[key] !== "string") {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const choices = options.map((option) => {
|
|
135
|
+
const field = fields(option)?.[key];
|
|
136
|
+
return field ? values(field) : void 0;
|
|
137
|
+
});
|
|
138
|
+
if (choices.some((choice) => !choice)) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const matching = options.filter(
|
|
142
|
+
(_, index) => choices[index]?.includes(raw[key])
|
|
143
|
+
);
|
|
144
|
+
if (!matching.length) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
options = matching;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return options.every((option) => unknownVariant(option, input));
|
|
151
|
+
}
|
|
152
|
+
if (schema instanceof z.ZodObject && input !== null && typeof input === "object" && !Array.isArray(input)) {
|
|
153
|
+
const raw = z.record(z.string(), z.unknown()).parse(input);
|
|
154
|
+
return Object.entries(schema.shape).some(
|
|
155
|
+
([key, child]) => unknownVariant(child, raw[key])
|
|
156
|
+
) || Object.entries(raw).some(
|
|
157
|
+
([key, value]) => !(key in schema.shape) && !!schema._zod.def.catchall && unknownVariant(schema._zod.def.catchall, value)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
if (schema instanceof z.ZodPipe) {
|
|
161
|
+
if (unknownVariant(schema.in, input)) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
const intermediate = z.safeParse(schema.in, input);
|
|
165
|
+
return intermediate.success && unknownVariant(schema.out, intermediate.data);
|
|
166
|
+
}
|
|
167
|
+
if ("innerType" in schema._zod.def && schema._zod.def.innerType instanceof z.ZodType) {
|
|
168
|
+
return unknownVariant(schema._zod.def.innerType, input);
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
function responseSchema(schema) {
|
|
173
|
+
const reader = knownResponse(schema);
|
|
174
|
+
return markResponseSchema(
|
|
175
|
+
z.json().transform((raw, context) => {
|
|
176
|
+
const parsed = reader.safeParse(raw);
|
|
177
|
+
if (parsed.success) {
|
|
178
|
+
return { kind: "supported", value: parsed.data };
|
|
179
|
+
}
|
|
180
|
+
if (unknownVariant(reader, raw)) {
|
|
181
|
+
return { kind: "unsupported", raw };
|
|
182
|
+
}
|
|
183
|
+
for (const issue of parsed.error.issues) {
|
|
184
|
+
context.addIssue({ ...issue });
|
|
185
|
+
}
|
|
186
|
+
return z.NEVER;
|
|
187
|
+
})
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
function responseListSchema(schema) {
|
|
191
|
+
return markResponseSchema(
|
|
192
|
+
z.array(responseSchema(schema)).transform((items) => ({
|
|
193
|
+
items,
|
|
194
|
+
unsupportedCount: items.filter((item) => item.kind === "unsupported").length
|
|
195
|
+
}))
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/pages.ts
|
|
200
|
+
import { z as z2 } from "zod";
|
|
201
|
+
var pageCursorSchema = z2.string().min(1).max(4096);
|
|
202
|
+
var pageQuerySchema = z2.strictObject({
|
|
5
203
|
cursor: pageCursorSchema.optional()
|
|
6
204
|
});
|
|
7
205
|
|
|
8
206
|
// src/accounts.ts
|
|
9
|
-
import { z as
|
|
10
|
-
var authProviderSchema =
|
|
11
|
-
var accountConnectionSchema =
|
|
207
|
+
import { z as z3 } from "zod";
|
|
208
|
+
var authProviderSchema = z3.enum(["google", "apple", "x", "discord"]);
|
|
209
|
+
var accountConnectionSchema = z3.object({
|
|
12
210
|
provider: authProviderSchema,
|
|
13
|
-
configured:
|
|
14
|
-
status:
|
|
15
|
-
subject:
|
|
16
|
-
revision:
|
|
17
|
-
});
|
|
18
|
-
var discordMemberInputSchema =
|
|
19
|
-
var discordMessageInputSchema =
|
|
20
|
-
channelId:
|
|
21
|
-
messageId:
|
|
211
|
+
configured: z3.boolean(),
|
|
212
|
+
status: z3.enum(["disconnected", "connected", "reconnect"]),
|
|
213
|
+
subject: z3.string().nullable(),
|
|
214
|
+
revision: z3.number().int().nonnegative()
|
|
215
|
+
});
|
|
216
|
+
var discordMemberInputSchema = z3.object({}).strict();
|
|
217
|
+
var discordMessageInputSchema = z3.object({
|
|
218
|
+
channelId: z3.string().regex(/^[0-9]{1,20}$/),
|
|
219
|
+
messageId: z3.string().regex(/^[0-9]{1,20}$/)
|
|
22
220
|
}).strict();
|
|
23
|
-
var discordMemberSchema =
|
|
24
|
-
userId:
|
|
25
|
-
nickname:
|
|
26
|
-
displayName:
|
|
27
|
-
boostingSince:
|
|
28
|
-
roles:
|
|
29
|
-
joinedAt:
|
|
30
|
-
pending:
|
|
221
|
+
var discordMemberSchema = z3.object({
|
|
222
|
+
userId: z3.string().regex(/^[0-9]{1,20}$/).nullable().default(null),
|
|
223
|
+
nickname: z3.string().nullable().default(null),
|
|
224
|
+
displayName: z3.string().nullable().default(null),
|
|
225
|
+
boostingSince: z3.string().datetime({ offset: true }).nullable().default(null),
|
|
226
|
+
roles: z3.array(z3.string().regex(/^[0-9]{1,20}$/)),
|
|
227
|
+
joinedAt: z3.string().datetime({ offset: true }).nullable(),
|
|
228
|
+
pending: z3.boolean()
|
|
31
229
|
});
|
|
32
230
|
|
|
33
231
|
// src/identifier.ts
|
|
34
|
-
import { z as
|
|
35
|
-
var identifier =
|
|
232
|
+
import { z as z4 } from "zod";
|
|
233
|
+
var identifier = z4.string().min(1).max(100).regex(/^[a-zA-Z0-9_-]+$/);
|
|
36
234
|
|
|
37
235
|
// src/discord.ts
|
|
38
|
-
import { z as
|
|
39
|
-
var discordMessageSchema =
|
|
40
|
-
guildId:
|
|
41
|
-
channelId:
|
|
42
|
-
messageId:
|
|
43
|
-
userId:
|
|
44
|
-
content:
|
|
45
|
-
replyTo:
|
|
46
|
-
publishedAt:
|
|
236
|
+
import { z as z5 } from "zod";
|
|
237
|
+
var discordMessageSchema = z5.object({
|
|
238
|
+
guildId: z5.string(),
|
|
239
|
+
channelId: z5.string(),
|
|
240
|
+
messageId: z5.string(),
|
|
241
|
+
userId: z5.string(),
|
|
242
|
+
content: z5.string().nullable(),
|
|
243
|
+
replyTo: z5.string().nullable(),
|
|
244
|
+
publishedAt: z5.number()
|
|
47
245
|
}).strict();
|
|
48
|
-
var discordMessagesSourceSchema =
|
|
49
|
-
kind:
|
|
246
|
+
var discordMessagesSourceSchema = z5.strictObject({
|
|
247
|
+
kind: z5.literal("discord-messages"),
|
|
50
248
|
/** Store each message's text in `data.text`. Off unless set. */
|
|
51
|
-
text:
|
|
249
|
+
text: z5.boolean().optional()
|
|
52
250
|
});
|
|
53
|
-
var discordReactionsSourceSchema =
|
|
54
|
-
kind:
|
|
251
|
+
var discordReactionsSourceSchema = z5.strictObject({
|
|
252
|
+
kind: z5.literal("discord-reactions")
|
|
55
253
|
});
|
|
56
|
-
var discordMessageDataSchema =
|
|
57
|
-
guildId:
|
|
58
|
-
channelId:
|
|
59
|
-
messageId:
|
|
254
|
+
var discordMessageDataSchema = z5.object({
|
|
255
|
+
guildId: z5.string(),
|
|
256
|
+
channelId: z5.string(),
|
|
257
|
+
messageId: z5.string(),
|
|
60
258
|
/** The ID of the message this one replies to, or null. */
|
|
61
|
-
replyTo:
|
|
259
|
+
replyTo: z5.string().nullable(),
|
|
62
260
|
/** When Discord says the message was posted, in epoch milliseconds. */
|
|
63
|
-
publishedAt:
|
|
261
|
+
publishedAt: z5.number()
|
|
64
262
|
});
|
|
65
263
|
var discordMessageTextDataSchema = discordMessageDataSchema.extend({
|
|
66
|
-
text:
|
|
264
|
+
text: z5.string().nullable()
|
|
67
265
|
});
|
|
68
|
-
var discordReactionDataSchema =
|
|
69
|
-
guildId:
|
|
70
|
-
channelId:
|
|
266
|
+
var discordReactionDataSchema = z5.object({
|
|
267
|
+
guildId: z5.string(),
|
|
268
|
+
channelId: z5.string(),
|
|
71
269
|
/** The message reacted to. */
|
|
72
|
-
messageId:
|
|
270
|
+
messageId: z5.string(),
|
|
73
271
|
/** A custom emoji's ID, or null for a Unicode emoji, whose `name` is the emoji itself. */
|
|
74
|
-
emoji:
|
|
272
|
+
emoji: z5.object({ id: z5.string().nullable(), name: z5.string() }),
|
|
75
273
|
/** The role IDs the reactor held in the server when reacting. */
|
|
76
|
-
reactorRoles:
|
|
274
|
+
reactorRoles: z5.array(z5.string()),
|
|
77
275
|
/** When the reacted-to message was posted, in epoch milliseconds. */
|
|
78
|
-
messagePublishedAt:
|
|
79
|
-
});
|
|
80
|
-
var discordRewardSchema =
|
|
81
|
-
kind:
|
|
82
|
-
provider:
|
|
83
|
-
action:
|
|
84
|
-
roleId:
|
|
85
|
-
});
|
|
86
|
-
var discordResourceSourceSchema =
|
|
87
|
-
|
|
88
|
-
provider:
|
|
89
|
-
resource:
|
|
90
|
-
types:
|
|
276
|
+
messagePublishedAt: z5.number()
|
|
277
|
+
});
|
|
278
|
+
var discordRewardSchema = z5.strictObject({
|
|
279
|
+
kind: z5.literal("integration"),
|
|
280
|
+
provider: z5.literal("discord"),
|
|
281
|
+
action: z5.literal("grant-role"),
|
|
282
|
+
roleId: z5.string().regex(/^[0-9]{1,20}$/)
|
|
283
|
+
});
|
|
284
|
+
var discordResourceSourceSchema = z5.union([
|
|
285
|
+
z5.strictObject({
|
|
286
|
+
provider: z5.literal("discord"),
|
|
287
|
+
resource: z5.literal("channel"),
|
|
288
|
+
types: z5.array(z5.enum(["text", "announcement"])).min(1)
|
|
91
289
|
}),
|
|
92
|
-
|
|
93
|
-
provider:
|
|
94
|
-
resource:
|
|
95
|
-
assignable:
|
|
290
|
+
z5.strictObject({
|
|
291
|
+
provider: z5.literal("discord"),
|
|
292
|
+
resource: z5.literal("role"),
|
|
293
|
+
assignable: z5.boolean().default(false)
|
|
96
294
|
})
|
|
97
295
|
]);
|
|
98
296
|
|
|
99
297
|
// src/tracker-data.ts
|
|
100
|
-
import { z as
|
|
298
|
+
import { z as z6 } from "zod";
|
|
101
299
|
var maxDepth = 16;
|
|
102
300
|
var maxBytes = 32768;
|
|
103
301
|
var trackerDataMaxBranches = 16;
|
|
104
302
|
var trackerDataMaxEntries = 256;
|
|
105
|
-
var scalar =
|
|
106
|
-
var size =
|
|
107
|
-
var bound =
|
|
108
|
-
var branches = () =>
|
|
109
|
-
var node =
|
|
110
|
-
() =>
|
|
111
|
-
type:
|
|
303
|
+
var scalar = z6.union([z6.string(), z6.number().finite(), z6.boolean(), z6.null()]);
|
|
304
|
+
var size = z6.number().int().safe().nonnegative();
|
|
305
|
+
var bound = z6.number().finite();
|
|
306
|
+
var branches = () => z6.array(node).min(1).max(trackerDataMaxBranches);
|
|
307
|
+
var node = z6.lazy(
|
|
308
|
+
() => z6.strictObject({
|
|
309
|
+
type: z6.enum([
|
|
112
310
|
"object",
|
|
113
311
|
"array",
|
|
114
312
|
"string",
|
|
@@ -117,15 +315,15 @@ var node = z5.lazy(
|
|
|
117
315
|
"boolean",
|
|
118
316
|
"null"
|
|
119
317
|
]).optional(),
|
|
120
|
-
properties:
|
|
318
|
+
properties: z6.record(z6.string(), node).refine(
|
|
121
319
|
(properties) => Object.keys(properties).length <= trackerDataMaxEntries,
|
|
122
320
|
`An object schema lists at most ${trackerDataMaxEntries} properties`
|
|
123
321
|
).optional(),
|
|
124
|
-
required:
|
|
125
|
-
additionalProperties:
|
|
126
|
-
propertyNames:
|
|
127
|
-
type:
|
|
128
|
-
enum:
|
|
322
|
+
required: z6.array(z6.string()).max(trackerDataMaxEntries).optional(),
|
|
323
|
+
additionalProperties: z6.union([z6.boolean(), node]).optional(),
|
|
324
|
+
propertyNames: z6.strictObject({
|
|
325
|
+
type: z6.literal("string"),
|
|
326
|
+
enum: z6.array(z6.string()).max(trackerDataMaxEntries).optional()
|
|
129
327
|
}).optional(),
|
|
130
328
|
items: node.optional(),
|
|
131
329
|
minItems: size.optional(),
|
|
@@ -136,7 +334,7 @@ var node = z5.lazy(
|
|
|
136
334
|
maximum: bound.optional(),
|
|
137
335
|
exclusiveMinimum: bound.optional(),
|
|
138
336
|
exclusiveMaximum: bound.optional(),
|
|
139
|
-
enum:
|
|
337
|
+
enum: z6.array(scalar).min(1).max(trackerDataMaxEntries).optional(),
|
|
140
338
|
const: scalar.optional(),
|
|
141
339
|
anyOf: branches().optional(),
|
|
142
340
|
oneOf: branches().optional(),
|
|
@@ -198,7 +396,7 @@ function nestedUnionIssue(schema, path, insideUnion) {
|
|
|
198
396
|
}
|
|
199
397
|
return null;
|
|
200
398
|
}
|
|
201
|
-
var trackerDataSchemaSchema =
|
|
399
|
+
var trackerDataSchemaSchema = z6.unknown().superRefine((value, ctx) => {
|
|
202
400
|
const issue = shapeIssue(value);
|
|
203
401
|
if (issue) {
|
|
204
402
|
ctx.addIssue({ code: "custom", message: issue, abort: true });
|
|
@@ -305,7 +503,7 @@ function subset(schema, path) {
|
|
|
305
503
|
function trackerDataSchema(schema) {
|
|
306
504
|
let json;
|
|
307
505
|
try {
|
|
308
|
-
json =
|
|
506
|
+
json = z6.toJSONSchema(schema, {
|
|
309
507
|
target: "draft-2020-12",
|
|
310
508
|
io: "input",
|
|
311
509
|
unrepresentable: "throw",
|
|
@@ -364,16 +562,16 @@ function pathText(path) {
|
|
|
364
562
|
}
|
|
365
563
|
var describe = (value) => value === null ? "null" : Array.isArray(value) ? "an array" : typeof value;
|
|
366
564
|
var shownValues = 10;
|
|
367
|
-
function oneOf(
|
|
368
|
-
const shown =
|
|
369
|
-
return
|
|
565
|
+
function oneOf(values2) {
|
|
566
|
+
const shown = values2.slice(0, shownValues).map((value) => JSON.stringify(value)).join(", ");
|
|
567
|
+
return values2.length > shownValues ? `expected one of ${shown}, or ${values2.length - shownValues} more` : `expected one of ${shown}`;
|
|
370
568
|
}
|
|
371
569
|
var enumSets = /* @__PURE__ */ new WeakMap();
|
|
372
570
|
var literalLists = /* @__PURE__ */ new WeakMap();
|
|
373
|
-
function setOf(owner,
|
|
571
|
+
function setOf(owner, values2) {
|
|
374
572
|
let found = enumSets.get(owner);
|
|
375
573
|
if (!found) {
|
|
376
|
-
found = new Set(
|
|
574
|
+
found = new Set(values2);
|
|
377
575
|
enumSets.set(owner, found);
|
|
378
576
|
}
|
|
379
577
|
return found;
|
|
@@ -395,8 +593,8 @@ function matches(schema, value, at, budget) {
|
|
|
395
593
|
return issue(() => `expected ${JSON.stringify(schema.const)}`);
|
|
396
594
|
}
|
|
397
595
|
if (schema.enum && !setOf(schema, schema.enum).has(value)) {
|
|
398
|
-
const
|
|
399
|
-
return issue(() => oneOf(
|
|
596
|
+
const values2 = schema.enum;
|
|
597
|
+
return issue(() => oneOf(values2));
|
|
400
598
|
}
|
|
401
599
|
switch (schema.type) {
|
|
402
600
|
case "null":
|
|
@@ -673,21 +871,21 @@ function whereSchemaIssue(schema, where) {
|
|
|
673
871
|
}
|
|
674
872
|
|
|
675
873
|
// src/trackers.ts
|
|
676
|
-
import { z as
|
|
677
|
-
var timestamp =
|
|
678
|
-
var count =
|
|
679
|
-
var externalId =
|
|
874
|
+
import { z as z7 } from "zod";
|
|
875
|
+
var timestamp = z7.number().int().safe().nonnegative().max(864e13);
|
|
876
|
+
var count = z7.number().int().safe().nonnegative();
|
|
877
|
+
var externalId = z7.string().min(1).max(256);
|
|
680
878
|
var metric = count.nullable().default(null);
|
|
681
|
-
var xTweetSchema =
|
|
879
|
+
var xTweetSchema = z7.looseObject({
|
|
682
880
|
id: externalId,
|
|
683
881
|
userId: externalId,
|
|
684
|
-
content:
|
|
685
|
-
createdAt:
|
|
686
|
-
author:
|
|
882
|
+
content: z7.string(),
|
|
883
|
+
createdAt: z7.iso.datetime({ offset: true }),
|
|
884
|
+
author: z7.looseObject({
|
|
687
885
|
id: externalId,
|
|
688
|
-
username:
|
|
689
|
-
name:
|
|
690
|
-
verified:
|
|
886
|
+
username: z7.string(),
|
|
887
|
+
name: z7.string(),
|
|
888
|
+
verified: z7.boolean().nullable().default(null)
|
|
691
889
|
}),
|
|
692
890
|
likeCount: metric,
|
|
693
891
|
replyCount: metric,
|
|
@@ -695,84 +893,84 @@ var xTweetSchema = z6.looseObject({
|
|
|
695
893
|
quoteCount: metric,
|
|
696
894
|
viewCount: metric,
|
|
697
895
|
bookmarkCount: metric,
|
|
698
|
-
isReply:
|
|
699
|
-
isRetweet:
|
|
700
|
-
isQuoteTweet:
|
|
701
|
-
});
|
|
702
|
-
var xContentBodySchema =
|
|
703
|
-
version:
|
|
704
|
-
id:
|
|
705
|
-
authorId:
|
|
896
|
+
isReply: z7.boolean(),
|
|
897
|
+
isRetweet: z7.boolean(),
|
|
898
|
+
isQuoteTweet: z7.boolean()
|
|
899
|
+
});
|
|
900
|
+
var xContentBodySchema = z7.strictObject({
|
|
901
|
+
version: z7.literal(1),
|
|
902
|
+
id: z7.string().min(1),
|
|
903
|
+
authorId: z7.string().min(1),
|
|
706
904
|
publishedAt: timestamp,
|
|
707
|
-
text:
|
|
708
|
-
isReply:
|
|
709
|
-
isRetweet:
|
|
710
|
-
isQuoteTweet:
|
|
711
|
-
media:
|
|
712
|
-
mentionedAuthorIds:
|
|
713
|
-
videoLengthSeconds:
|
|
714
|
-
references:
|
|
715
|
-
replyId:
|
|
716
|
-
replyAuthorId:
|
|
717
|
-
quoteId:
|
|
718
|
-
quoteAuthorId:
|
|
719
|
-
repostId:
|
|
720
|
-
repostAuthorId:
|
|
905
|
+
text: z7.string(),
|
|
906
|
+
isReply: z7.boolean(),
|
|
907
|
+
isRetweet: z7.boolean(),
|
|
908
|
+
isQuoteTweet: z7.boolean(),
|
|
909
|
+
media: z7.array(z7.strictObject({ type: z7.string(), url: z7.string() })).nullable(),
|
|
910
|
+
mentionedAuthorIds: z7.array(z7.string().min(1)).nullable(),
|
|
911
|
+
videoLengthSeconds: z7.number().nonnegative().nullable(),
|
|
912
|
+
references: z7.strictObject({
|
|
913
|
+
replyId: z7.string().nullable(),
|
|
914
|
+
replyAuthorId: z7.string().nullable(),
|
|
915
|
+
quoteId: z7.string().nullable(),
|
|
916
|
+
quoteAuthorId: z7.string().nullable(),
|
|
917
|
+
repostId: z7.string().nullable(),
|
|
918
|
+
repostAuthorId: z7.string().nullable()
|
|
721
919
|
})
|
|
722
920
|
});
|
|
723
|
-
var trackerContentQuerySchema =
|
|
921
|
+
var trackerContentQuerySchema = z7.strictObject({
|
|
724
922
|
id: externalId,
|
|
725
|
-
observation:
|
|
923
|
+
observation: z7.string().regex(/^observation_[a-f0-9]{64}$/)
|
|
726
924
|
});
|
|
727
925
|
var trackerContentReadSchema = trackerContentQuerySchema.extend({
|
|
728
926
|
member: identifier
|
|
729
927
|
});
|
|
730
928
|
var attributionContext = { member: identifier, capturedAt: timestamp };
|
|
731
|
-
var trackerEvidenceSchema =
|
|
929
|
+
var trackerEvidenceSchema = z7.strictObject({
|
|
732
930
|
contentRevision: identifier,
|
|
733
931
|
observation: identifier
|
|
734
932
|
});
|
|
735
|
-
var trackerContentSchema =
|
|
933
|
+
var trackerContentSchema = z7.strictObject({
|
|
736
934
|
tracker: identifier,
|
|
737
|
-
source:
|
|
935
|
+
source: z7.literal("x"),
|
|
738
936
|
evidence: trackerEvidenceSchema,
|
|
739
937
|
content: xContentBodySchema,
|
|
740
938
|
observedAt: timestamp,
|
|
741
|
-
removed:
|
|
742
|
-
attribution:
|
|
743
|
-
|
|
939
|
+
removed: z7.boolean(),
|
|
940
|
+
attribution: z7.discriminatedUnion("kind", [
|
|
941
|
+
z7.strictObject({
|
|
744
942
|
...attributionContext,
|
|
745
|
-
kind:
|
|
746
|
-
account:
|
|
747
|
-
provider:
|
|
748
|
-
issuer:
|
|
943
|
+
kind: z7.literal("linked"),
|
|
944
|
+
account: z7.strictObject({
|
|
945
|
+
provider: z7.literal("x"),
|
|
946
|
+
issuer: z7.string().min(1),
|
|
749
947
|
subject: externalId,
|
|
750
948
|
revision: count,
|
|
751
949
|
linkedAt: timestamp.nullable()
|
|
752
950
|
})
|
|
753
951
|
}),
|
|
754
|
-
|
|
755
|
-
|
|
952
|
+
z7.strictObject({ ...attributionContext, kind: z7.literal("unlinked") }),
|
|
953
|
+
z7.strictObject({
|
|
756
954
|
...attributionContext,
|
|
757
|
-
kind:
|
|
955
|
+
kind: z7.literal("different-author")
|
|
758
956
|
})
|
|
759
957
|
])
|
|
760
958
|
});
|
|
761
959
|
var knownIdentityKinds = ["wallet", "x", "discord", "member"];
|
|
762
|
-
var appIdentityKindSchema =
|
|
960
|
+
var appIdentityKindSchema = z7.templateLiteral([
|
|
763
961
|
"app:",
|
|
764
|
-
|
|
962
|
+
z7.string().regex(
|
|
765
963
|
/^[a-z0-9][a-z0-9_-]{0,39}$/,
|
|
766
964
|
"Name an app identity kind like app:telegram: lowercase letters, digits, _ or -, at most 40"
|
|
767
965
|
)
|
|
768
966
|
]);
|
|
769
|
-
var identityKindSchema =
|
|
770
|
-
|
|
967
|
+
var identityKindSchema = z7.union([
|
|
968
|
+
z7.enum(knownIdentityKinds),
|
|
771
969
|
appIdentityKindSchema
|
|
772
970
|
]);
|
|
773
971
|
var isAppIdentityKind = (kind) => kind.startsWith("app:");
|
|
774
|
-
var openIdentityKindSchema =
|
|
775
|
-
var memberIdentitySchema =
|
|
972
|
+
var openIdentityKindSchema = z7.string().min(1).max(64);
|
|
973
|
+
var memberIdentitySchema = z7.object({
|
|
776
974
|
kind: openIdentityKindSchema,
|
|
777
975
|
/** The stable user ID for `x` and `discord`; the subject your app signed the member in with for `app:<name>`. */
|
|
778
976
|
subject: externalId,
|
|
@@ -784,13 +982,13 @@ var memberIdentitySchema = z6.object({
|
|
|
784
982
|
/** The latest link time, refreshed on app identity relink; null when the link time is unknown. */
|
|
785
983
|
linkedAt: timestamp.nullable()
|
|
786
984
|
});
|
|
787
|
-
var accountRoleSchema =
|
|
985
|
+
var accountRoleSchema = z7.string().regex(
|
|
788
986
|
/^[a-zA-Z][a-zA-Z0-9_]{0,39}$/,
|
|
789
987
|
"Name roles like author or recipient: a letter, then letters, digits or underscores"
|
|
790
988
|
);
|
|
791
989
|
var xAccountRoles = ["author", "inReplyTo"];
|
|
792
|
-
var distinct = (
|
|
793
|
-
var contentMetricNameSchema =
|
|
990
|
+
var distinct = (values2) => new Set(values2).size === values2.length;
|
|
991
|
+
var contentMetricNameSchema = z7.string().regex(
|
|
794
992
|
/^[a-z][a-zA-Z0-9]{0,39}$/,
|
|
795
993
|
"Name metrics like likes or watchTime: a lowercase letter, then letters or digits"
|
|
796
994
|
);
|
|
@@ -802,24 +1000,24 @@ var xContentMetrics = [
|
|
|
802
1000
|
"views",
|
|
803
1001
|
"bookmarks"
|
|
804
1002
|
];
|
|
805
|
-
var customContentSchema =
|
|
806
|
-
metrics:
|
|
1003
|
+
var customContentSchema = z7.strictObject({
|
|
1004
|
+
metrics: z7.array(contentMetricNameSchema).max(10).refine(distinct, "List each metric once")
|
|
807
1005
|
});
|
|
808
|
-
var xSearchSourceSchema =
|
|
809
|
-
kind:
|
|
810
|
-
query:
|
|
1006
|
+
var xSearchSourceSchema = z7.object({
|
|
1007
|
+
kind: z7.literal("x-search"),
|
|
1008
|
+
query: z7.string().trim().min(1).max(2e3)
|
|
811
1009
|
}).strict();
|
|
812
|
-
var customSourceSchema =
|
|
813
|
-
kind:
|
|
1010
|
+
var customSourceSchema = z7.object({
|
|
1011
|
+
kind: z7.literal("custom"),
|
|
814
1012
|
namespace: identifier,
|
|
815
1013
|
/**
|
|
816
1014
|
* The identity kinds a record's author and named accounts can be, attributed to members
|
|
817
1015
|
* through verified links: `wallet`, `x`, `discord`, `member`, or your app's own `app:<name>`.
|
|
818
1016
|
* Omitted when authors are opaque IDs, which no quest can pay.
|
|
819
1017
|
*/
|
|
820
|
-
identities:
|
|
1018
|
+
identities: z7.array(identityKindSchema).min(1).max(8).refine(distinct, "List each identity kind once").optional(),
|
|
821
1019
|
/** Roles of the named accounts records can carry besides their author, such as `recipient`. */
|
|
822
|
-
accounts:
|
|
1020
|
+
accounts: z7.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
|
|
823
1021
|
(roles) => !roles.includes("author"),
|
|
824
1022
|
"author is every record's own role; name other accounts"
|
|
825
1023
|
).optional(),
|
|
@@ -842,7 +1040,7 @@ var customSourceSchema = z6.object({
|
|
|
842
1040
|
(source) => !source.accounts || source.identities,
|
|
843
1041
|
"Named accounts need identities"
|
|
844
1042
|
);
|
|
845
|
-
var trackerSourceSchema =
|
|
1043
|
+
var trackerSourceSchema = z7.discriminatedUnion("kind", [
|
|
846
1044
|
xSearchSourceSchema,
|
|
847
1045
|
customSourceSchema,
|
|
848
1046
|
discordMessagesSourceSchema,
|
|
@@ -879,125 +1077,125 @@ function sourceContent(source) {
|
|
|
879
1077
|
return void 0;
|
|
880
1078
|
}
|
|
881
1079
|
}
|
|
882
|
-
var windowSchema =
|
|
1080
|
+
var windowSchema = z7.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
|
|
883
1081
|
(w) => w.end === void 0 || w.end > w.start,
|
|
884
1082
|
"End must follow start"
|
|
885
1083
|
);
|
|
886
|
-
var trackerDefinitionSchema =
|
|
1084
|
+
var trackerDefinitionSchema = z7.object({
|
|
887
1085
|
key: identifier,
|
|
888
|
-
title:
|
|
1086
|
+
title: z7.string().trim().min(1).max(120),
|
|
889
1087
|
source: trackerSourceSchema,
|
|
890
1088
|
window: windowSchema,
|
|
891
|
-
refreshSeconds:
|
|
892
|
-
maxPages:
|
|
1089
|
+
refreshSeconds: z7.number().int().min(300).max(86400).default(21600),
|
|
1090
|
+
maxPages: z7.number().int().min(1).max(1e3).default(60)
|
|
893
1091
|
}).strict();
|
|
894
|
-
var trackerArtifactSchema =
|
|
1092
|
+
var trackerArtifactSchema = z7.union([
|
|
895
1093
|
trackerDefinitionSchema,
|
|
896
|
-
|
|
1094
|
+
z7.object({ code: z7.string().min(1).max(2e6) }).strict()
|
|
897
1095
|
]);
|
|
898
|
-
var knownTrackerSourceResponseSchema =
|
|
899
|
-
|
|
900
|
-
|
|
1096
|
+
var knownTrackerSourceResponseSchema = z7.discriminatedUnion("kind", [
|
|
1097
|
+
z7.object(xSearchSourceSchema.shape),
|
|
1098
|
+
z7.object({
|
|
901
1099
|
...customSourceSchema.shape,
|
|
902
|
-
identities:
|
|
1100
|
+
identities: z7.array(openIdentityKindSchema).optional()
|
|
903
1101
|
}),
|
|
904
|
-
|
|
905
|
-
|
|
1102
|
+
z7.object(discordMessagesSourceSchema.shape),
|
|
1103
|
+
z7.object(discordReactionsSourceSchema.shape)
|
|
906
1104
|
]);
|
|
907
|
-
var trackerSourceResponseSchema =
|
|
1105
|
+
var trackerSourceResponseSchema = z7.union([
|
|
908
1106
|
knownTrackerSourceResponseSchema,
|
|
909
|
-
|
|
910
|
-
kind:
|
|
1107
|
+
z7.object({
|
|
1108
|
+
kind: z7.string().min(1).refine(
|
|
911
1109
|
(kind) => !trackerSourceKinds.some((known) => known === kind),
|
|
912
1110
|
"Known source kinds must match their schema"
|
|
913
1111
|
)
|
|
914
|
-
}).catchall(
|
|
1112
|
+
}).catchall(z7.json())
|
|
915
1113
|
]);
|
|
916
1114
|
function isKnownTrackerSource(source) {
|
|
917
1115
|
return knownTrackerSourceResponseSchema.safeParse(source).success;
|
|
918
1116
|
}
|
|
919
|
-
var trackerDefinitionResponseSchema =
|
|
1117
|
+
var trackerDefinitionResponseSchema = z7.object({
|
|
920
1118
|
...trackerDefinitionSchema.shape,
|
|
921
1119
|
source: trackerSourceResponseSchema,
|
|
922
|
-
window:
|
|
1120
|
+
window: z7.object(windowSchema.shape)
|
|
923
1121
|
});
|
|
924
|
-
var publishedTrackerSchema =
|
|
1122
|
+
var publishedTrackerSchema = z7.object({
|
|
925
1123
|
id: identifier,
|
|
926
1124
|
version: identifier,
|
|
927
1125
|
definition: trackerDefinitionResponseSchema,
|
|
928
1126
|
publishedAt: timestamp,
|
|
929
|
-
actor:
|
|
1127
|
+
actor: z7.string().nullable()
|
|
930
1128
|
});
|
|
931
|
-
var trackerStatusSchema =
|
|
932
|
-
archivedAt:
|
|
1129
|
+
var trackerStatusSchema = z7.object({
|
|
1130
|
+
archivedAt: z7.number().int().nonnegative().nullable().optional(),
|
|
933
1131
|
published: publishedTrackerSchema,
|
|
934
|
-
paused:
|
|
935
|
-
state:
|
|
1132
|
+
paused: z7.boolean(),
|
|
1133
|
+
state: z7.enum(["idle", "syncing", "error", "complete"]),
|
|
936
1134
|
lastStartedAt: timestamp.nullable(),
|
|
937
1135
|
lastCompletedAt: timestamp.nullable(),
|
|
938
1136
|
nextSyncAt: timestamp.nullable(),
|
|
939
|
-
coverage:
|
|
940
|
-
error:
|
|
1137
|
+
coverage: z7.enum(["unknown", "partial", "complete"]),
|
|
1138
|
+
error: z7.string().nullable(),
|
|
941
1139
|
records: count
|
|
942
1140
|
});
|
|
943
|
-
var trackerControlSchema =
|
|
1141
|
+
var trackerControlSchema = z7.object({
|
|
944
1142
|
actionId: identifier,
|
|
945
|
-
action:
|
|
1143
|
+
action: z7.enum(["pause", "resume", "refresh"])
|
|
946
1144
|
}).strict();
|
|
947
|
-
var trackerAccountSchema =
|
|
1145
|
+
var trackerAccountSchema = z7.strictObject({
|
|
948
1146
|
kind: identityKindSchema.optional(),
|
|
949
1147
|
id: externalId
|
|
950
1148
|
});
|
|
951
|
-
var trackerRecordInputSchema =
|
|
1149
|
+
var trackerRecordInputSchema = z7.object({
|
|
952
1150
|
id: externalId,
|
|
953
1151
|
occurredAt: timestamp,
|
|
954
1152
|
observedAt: timestamp,
|
|
955
|
-
author:
|
|
1153
|
+
author: z7.object({
|
|
956
1154
|
id: externalId,
|
|
957
|
-
verified:
|
|
1155
|
+
verified: z7.boolean().nullable().default(null),
|
|
958
1156
|
/** The author's identity kind; needed when the source names more than one. */
|
|
959
1157
|
kind: identityKindSchema.optional()
|
|
960
1158
|
}).strict().nullable().default(null),
|
|
961
1159
|
/** Named accounts besides the author, by the roles the custom source declares. */
|
|
962
|
-
accounts:
|
|
1160
|
+
accounts: z7.record(accountRoleSchema, trackerAccountSchema).refine(
|
|
963
1161
|
(accounts) => Object.keys(accounts).length <= 10,
|
|
964
1162
|
"At most 10 accounts"
|
|
965
1163
|
).optional(),
|
|
966
|
-
data:
|
|
967
|
-
removed:
|
|
1164
|
+
data: z7.record(z7.string(), z7.json()),
|
|
1165
|
+
removed: z7.boolean().default(false)
|
|
968
1166
|
}).strict().refine(
|
|
969
1167
|
(v) => new TextEncoder().encode(JSON.stringify(v.data)).byteLength <= 131072,
|
|
970
1168
|
"Record exceeds 128 KB"
|
|
971
1169
|
);
|
|
972
|
-
var trackerRecordAccountSchema =
|
|
1170
|
+
var trackerRecordAccountSchema = z7.object({
|
|
973
1171
|
kind: openIdentityKindSchema.optional(),
|
|
974
|
-
id:
|
|
1172
|
+
id: z7.string()
|
|
975
1173
|
});
|
|
976
|
-
var trackerRecordSchema =
|
|
977
|
-
id:
|
|
1174
|
+
var trackerRecordSchema = z7.object({
|
|
1175
|
+
id: z7.string(),
|
|
978
1176
|
occurredAt: timestamp,
|
|
979
1177
|
observedAt: timestamp,
|
|
980
|
-
author:
|
|
981
|
-
id:
|
|
982
|
-
verified:
|
|
1178
|
+
author: z7.object({
|
|
1179
|
+
id: z7.string(),
|
|
1180
|
+
verified: z7.boolean().nullable().default(null),
|
|
983
1181
|
kind: openIdentityKindSchema.optional()
|
|
984
1182
|
}).nullable().default(null),
|
|
985
|
-
accounts:
|
|
986
|
-
data:
|
|
987
|
-
removed:
|
|
988
|
-
source:
|
|
1183
|
+
accounts: z7.record(z7.string(), trackerRecordAccountSchema).optional(),
|
|
1184
|
+
data: z7.record(z7.string(), z7.json()),
|
|
1185
|
+
removed: z7.boolean().default(false),
|
|
1186
|
+
source: z7.string(),
|
|
989
1187
|
firstSeenAt: timestamp,
|
|
990
1188
|
/** Present only when includeEvidence is true; custom sources have no X evidence. */
|
|
991
1189
|
evidence: trackerEvidenceSchema.nullable().optional()
|
|
992
1190
|
});
|
|
993
|
-
var trackerIngestSchema =
|
|
1191
|
+
var trackerIngestSchema = z7.object({
|
|
994
1192
|
actionId: identifier,
|
|
995
|
-
records:
|
|
1193
|
+
records: z7.array(trackerRecordInputSchema).min(1).max(100)
|
|
996
1194
|
}).strict();
|
|
997
|
-
var trackerIngestResultSchema =
|
|
1195
|
+
var trackerIngestResultSchema = z7.object({
|
|
998
1196
|
stored: count,
|
|
999
1197
|
/** Tracker-trigger decisions this ingest caused. Absent from servers without tracker triggers. */
|
|
1000
|
-
admissions:
|
|
1198
|
+
admissions: z7.object({
|
|
1001
1199
|
admitted: count,
|
|
1002
1200
|
skipped: count,
|
|
1003
1201
|
/**
|
|
@@ -1018,11 +1216,11 @@ var trackerOutcomeFields = {
|
|
|
1018
1216
|
/** The release admitted, or the one active when the observation was skipped. */
|
|
1019
1217
|
release: identifier,
|
|
1020
1218
|
/** The account attribution resolved or failed to resolve, such as a CAIP-10 wallet ID. */
|
|
1021
|
-
account:
|
|
1219
|
+
account: z7.string().nullable(),
|
|
1022
1220
|
createdAt: timestamp,
|
|
1023
1221
|
updatedAt: timestamp,
|
|
1024
1222
|
/** Null for automatic decisions; the staff actor after a retry. */
|
|
1025
|
-
actor:
|
|
1223
|
+
actor: z7.string().nullable()
|
|
1026
1224
|
};
|
|
1027
1225
|
var trackerSkipCodes = [
|
|
1028
1226
|
/** The quest is paused or no longer active. Catch-up after a pause is an operator decision. */
|
|
@@ -1077,26 +1275,26 @@ var trackerSkipCodes = [
|
|
|
1077
1275
|
/** A prerequisite quest was not complete when the record occurred. */
|
|
1078
1276
|
"prerequisites-incomplete"
|
|
1079
1277
|
];
|
|
1080
|
-
var trackerOutcomeSchema =
|
|
1081
|
-
|
|
1278
|
+
var trackerOutcomeSchema = z7.discriminatedUnion("state", [
|
|
1279
|
+
z7.object({
|
|
1082
1280
|
...trackerOutcomeFields,
|
|
1083
|
-
state:
|
|
1084
|
-
code:
|
|
1085
|
-
reason:
|
|
1281
|
+
state: z7.literal("admitted"),
|
|
1282
|
+
code: z7.null(),
|
|
1283
|
+
reason: z7.null(),
|
|
1086
1284
|
/** The attributed member. */
|
|
1087
1285
|
member: identifier,
|
|
1088
1286
|
/** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
|
|
1089
1287
|
attempt: identifier
|
|
1090
1288
|
}),
|
|
1091
|
-
|
|
1289
|
+
z7.object({
|
|
1092
1290
|
...trackerOutcomeFields,
|
|
1093
|
-
state:
|
|
1291
|
+
state: z7.literal("skipped"),
|
|
1094
1292
|
/** Why the observation was skipped, as one of `trackerSkipCodes`. */
|
|
1095
|
-
code:
|
|
1293
|
+
code: z7.string().min(1),
|
|
1096
1294
|
/** Why the observation was skipped, for people. */
|
|
1097
|
-
reason:
|
|
1295
|
+
reason: z7.string(),
|
|
1098
1296
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
1099
|
-
window:
|
|
1297
|
+
window: z7.enum(["tracker", "quest"]).optional(),
|
|
1100
1298
|
/** The attributed member, when attribution got that far. */
|
|
1101
1299
|
member: identifier.nullable(),
|
|
1102
1300
|
attempt: identifier.nullable()
|
|
@@ -1107,67 +1305,67 @@ var trackerOutcomeFilters = {
|
|
|
1107
1305
|
quest: identifier.optional(),
|
|
1108
1306
|
record: externalId.optional(),
|
|
1109
1307
|
member: identifier.optional(),
|
|
1110
|
-
state:
|
|
1308
|
+
state: z7.enum(["admitted", "skipped"]).optional(),
|
|
1111
1309
|
/** Only skips with this code, such as `unlinked-account`. */
|
|
1112
|
-
code:
|
|
1113
|
-
limit:
|
|
1310
|
+
code: z7.string().min(1).max(100).optional(),
|
|
1311
|
+
limit: z7.coerce.number().int().min(1).max(100).default(25)
|
|
1114
1312
|
};
|
|
1115
|
-
var trackerTriggerOutcomeQuerySchema =
|
|
1313
|
+
var trackerTriggerOutcomeQuerySchema = z7.strictObject({
|
|
1116
1314
|
...trackerOutcomeFilters,
|
|
1117
1315
|
cursor: pageCursorSchema.optional()
|
|
1118
1316
|
});
|
|
1119
|
-
var trackerTriggerOutcomePageSchema =
|
|
1120
|
-
items:
|
|
1317
|
+
var trackerTriggerOutcomePageSchema = z7.object({
|
|
1318
|
+
items: z7.array(trackerOutcomeSchema).max(100),
|
|
1121
1319
|
nextCursor: pageCursorSchema.nullable()
|
|
1122
1320
|
});
|
|
1123
|
-
var trackerOutcomeQuerySchema =
|
|
1321
|
+
var trackerOutcomeQuerySchema = z7.strictObject({
|
|
1124
1322
|
...trackerOutcomeFilters,
|
|
1125
1323
|
/** Opaque cursor from `next`: older outcomes. */
|
|
1126
|
-
before:
|
|
1324
|
+
before: z7.string().max(512).optional()
|
|
1127
1325
|
});
|
|
1128
|
-
var trackerOutcomePageSchema =
|
|
1326
|
+
var trackerOutcomePageSchema = z7.strictObject({
|
|
1129
1327
|
/** Newest first. */
|
|
1130
|
-
items:
|
|
1131
|
-
next:
|
|
1328
|
+
items: z7.array(trackerOutcomeSchema).max(100),
|
|
1329
|
+
next: z7.string().nullable()
|
|
1132
1330
|
});
|
|
1133
|
-
var trackerOutcomeRetrySchema =
|
|
1331
|
+
var trackerOutcomeRetrySchema = z7.strictObject({
|
|
1134
1332
|
actionId: identifier,
|
|
1135
1333
|
/** Quest key or ID. */
|
|
1136
1334
|
quest: identifier,
|
|
1137
1335
|
record: externalId,
|
|
1138
1336
|
observedAt: timestamp
|
|
1139
1337
|
});
|
|
1140
|
-
var booleanQuery =
|
|
1141
|
-
|
|
1142
|
-
|
|
1338
|
+
var booleanQuery = z7.union([
|
|
1339
|
+
z7.boolean(),
|
|
1340
|
+
z7.enum(["true", "false"]).transform((v) => v === "true")
|
|
1143
1341
|
]);
|
|
1144
|
-
var trackerQuerySchema =
|
|
1342
|
+
var trackerQuerySchema = z7.object({
|
|
1145
1343
|
author: externalId.optional(),
|
|
1146
1344
|
member: identifier.optional(),
|
|
1147
1345
|
verified: booleanQuery.optional(),
|
|
1148
|
-
since:
|
|
1149
|
-
until:
|
|
1346
|
+
since: z7.coerce.number().int().safe().nonnegative().optional(),
|
|
1347
|
+
until: z7.coerce.number().int().safe().nonnegative().optional(),
|
|
1150
1348
|
removed: booleanQuery.default(false),
|
|
1151
|
-
minLikes:
|
|
1152
|
-
minViews:
|
|
1153
|
-
limit:
|
|
1154
|
-
cursor:
|
|
1349
|
+
minLikes: z7.coerce.number().int().safe().nonnegative().optional(),
|
|
1350
|
+
minViews: z7.coerce.number().int().safe().nonnegative().optional(),
|
|
1351
|
+
limit: z7.coerce.number().int().min(1).max(100).default(25),
|
|
1352
|
+
cursor: z7.string().max(2048).optional(),
|
|
1155
1353
|
includeEvidence: booleanQuery.optional()
|
|
1156
1354
|
}).strict().refine(
|
|
1157
1355
|
(q) => q.since === void 0 || q.until === void 0 || q.until > q.since,
|
|
1158
1356
|
"Until must follow since"
|
|
1159
1357
|
);
|
|
1160
|
-
var trackerPageSchema =
|
|
1358
|
+
var trackerPageSchema = z7.object({
|
|
1161
1359
|
tracker: identifier,
|
|
1162
|
-
items:
|
|
1163
|
-
nextCursor:
|
|
1360
|
+
items: z7.array(trackerRecordSchema),
|
|
1361
|
+
nextCursor: z7.string().nullable(),
|
|
1164
1362
|
total: count,
|
|
1165
1363
|
status: trackerStatusSchema
|
|
1166
1364
|
});
|
|
1167
|
-
var trackerSummarySchema =
|
|
1365
|
+
var trackerSummarySchema = z7.object({
|
|
1168
1366
|
records: count,
|
|
1169
1367
|
authors: count,
|
|
1170
|
-
metrics:
|
|
1368
|
+
metrics: z7.object({
|
|
1171
1369
|
likes: count,
|
|
1172
1370
|
replies: count,
|
|
1173
1371
|
reposts: count,
|
|
@@ -1183,26 +1381,26 @@ var trackerPreviewLimits = {
|
|
|
1183
1381
|
posts: 100,
|
|
1184
1382
|
days: 30
|
|
1185
1383
|
};
|
|
1186
|
-
var trackerPreviewInputSchema =
|
|
1384
|
+
var trackerPreviewInputSchema = z7.object({
|
|
1187
1385
|
query: xSearchSourceSchema.shape.query,
|
|
1188
1386
|
/** Start of the searched window. The window ends when the sample is fetched. */
|
|
1189
1387
|
since: timestamp
|
|
1190
1388
|
}).strict();
|
|
1191
|
-
var trackerPreviewSchema =
|
|
1192
|
-
query:
|
|
1389
|
+
var trackerPreviewSchema = z7.object({
|
|
1390
|
+
query: z7.string(),
|
|
1193
1391
|
since: timestamp,
|
|
1194
1392
|
fetchedAt: timestamp,
|
|
1195
1393
|
pages: count,
|
|
1196
1394
|
/** Every match in the sample, newest first, verified or not. */
|
|
1197
|
-
posts:
|
|
1395
|
+
posts: z7.array(xTweetSchema).max(trackerPreviewLimits.posts),
|
|
1198
1396
|
/** X had more matches than the sample holds. */
|
|
1199
|
-
more:
|
|
1397
|
+
more: z7.boolean()
|
|
1200
1398
|
});
|
|
1201
1399
|
|
|
1202
1400
|
// src/content.ts
|
|
1203
|
-
import { z as
|
|
1204
|
-
var contentQualificationDecisionSchema =
|
|
1205
|
-
kind:
|
|
1401
|
+
import { z as z8 } from "zod";
|
|
1402
|
+
var contentQualificationDecisionSchema = z8.strictObject({
|
|
1403
|
+
kind: z8.enum([
|
|
1206
1404
|
"accept",
|
|
1207
1405
|
"reject",
|
|
1208
1406
|
"review",
|
|
@@ -1210,26 +1408,26 @@ var contentQualificationDecisionSchema = z7.strictObject({
|
|
|
1210
1408
|
"progress",
|
|
1211
1409
|
"superseded"
|
|
1212
1410
|
]),
|
|
1213
|
-
reason:
|
|
1411
|
+
reason: z8.string().nullable()
|
|
1214
1412
|
});
|
|
1215
|
-
var contentQualificationQuerySchema =
|
|
1413
|
+
var contentQualificationQuerySchema = z8.strictObject({
|
|
1216
1414
|
quest: identifier,
|
|
1217
1415
|
member: identifier.optional(),
|
|
1218
1416
|
/** A content item's record ID in the quest's tracker. */
|
|
1219
|
-
content:
|
|
1417
|
+
content: z8.string().min(1).max(256).optional(),
|
|
1220
1418
|
cursor: pageCursorSchema.optional()
|
|
1221
1419
|
});
|
|
1222
|
-
var contentQualificationSchema =
|
|
1420
|
+
var contentQualificationSchema = z8.strictObject({
|
|
1223
1421
|
quest: identifier,
|
|
1224
1422
|
/** The content item's record ID in the quest's tracker. */
|
|
1225
|
-
content:
|
|
1423
|
+
content: z8.string(),
|
|
1226
1424
|
member: identifier,
|
|
1227
1425
|
release: identifier,
|
|
1228
1426
|
attempt: identifier,
|
|
1229
1427
|
revision: identifier,
|
|
1230
1428
|
observation: identifier,
|
|
1231
|
-
current:
|
|
1232
|
-
state:
|
|
1429
|
+
current: z8.boolean(),
|
|
1430
|
+
state: z8.enum([
|
|
1233
1431
|
"pending",
|
|
1234
1432
|
"qualified",
|
|
1235
1433
|
"unqualified",
|
|
@@ -1240,117 +1438,117 @@ var contentQualificationSchema = z7.strictObject({
|
|
|
1240
1438
|
"blocked",
|
|
1241
1439
|
"unavailable"
|
|
1242
1440
|
]),
|
|
1243
|
-
reason:
|
|
1244
|
-
reward:
|
|
1441
|
+
reason: z8.string().nullable(),
|
|
1442
|
+
reward: z8.strictObject({
|
|
1245
1443
|
attempt: identifier.nullable(),
|
|
1246
1444
|
completion: identifier.nullable(),
|
|
1247
|
-
state:
|
|
1445
|
+
state: z8.enum(["unresolved", "awarded", "excluded"])
|
|
1248
1446
|
})
|
|
1249
1447
|
});
|
|
1250
|
-
var contentQualificationPageSchema =
|
|
1251
|
-
items:
|
|
1448
|
+
var contentQualificationPageSchema = z8.strictObject({
|
|
1449
|
+
items: z8.array(contentQualificationSchema),
|
|
1252
1450
|
nextCursor: pageCursorSchema.nullable()
|
|
1253
1451
|
});
|
|
1254
1452
|
var contentMetricSchema = contentMetricNameSchema;
|
|
1255
|
-
var contentMetricsSchema =
|
|
1453
|
+
var contentMetricsSchema = z8.record(
|
|
1256
1454
|
contentMetricSchema,
|
|
1257
|
-
|
|
1455
|
+
z8.number().int().safe().nonnegative()
|
|
1258
1456
|
);
|
|
1259
|
-
var contentPerformancePolicySchema =
|
|
1260
|
-
metrics:
|
|
1261
|
-
(
|
|
1457
|
+
var contentPerformancePolicySchema = z8.strictObject({
|
|
1458
|
+
metrics: z8.array(contentMetricSchema).min(1).max(10).refine(
|
|
1459
|
+
(values2) => new Set(values2).size === values2.length,
|
|
1262
1460
|
"Metrics must be unique"
|
|
1263
1461
|
),
|
|
1264
|
-
maxAgeMs:
|
|
1462
|
+
maxAgeMs: z8.number().int().positive().max(864e5).default(36e5)
|
|
1265
1463
|
});
|
|
1266
1464
|
|
|
1267
1465
|
// src/counters.ts
|
|
1268
|
-
import { z as
|
|
1466
|
+
import { z as z9 } from "zod";
|
|
1269
1467
|
var day = 864e5;
|
|
1270
|
-
var counterGoalSchema =
|
|
1271
|
-
kind:
|
|
1272
|
-
count:
|
|
1468
|
+
var counterGoalSchema = z9.object({
|
|
1469
|
+
kind: z9.literal("count"),
|
|
1470
|
+
count: z9.number().int().min(1).max(1e4)
|
|
1273
1471
|
}).strict();
|
|
1274
|
-
var counterWindowSchema =
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
kind:
|
|
1278
|
-
period:
|
|
1279
|
-
latenessMs:
|
|
1472
|
+
var counterWindowSchema = z9.discriminatedUnion("kind", [
|
|
1473
|
+
z9.object({ kind: z9.literal("lifetime") }).strict(),
|
|
1474
|
+
z9.object({
|
|
1475
|
+
kind: z9.literal("calendar"),
|
|
1476
|
+
period: z9.enum(["day", "week", "month"]),
|
|
1477
|
+
latenessMs: z9.number().int().min(0).max(90 * day).default(7 * day)
|
|
1280
1478
|
}).strict(),
|
|
1281
|
-
|
|
1282
|
-
kind:
|
|
1283
|
-
durationMs:
|
|
1479
|
+
z9.object({
|
|
1480
|
+
kind: z9.literal("rolling"),
|
|
1481
|
+
durationMs: z9.number().int().min(1).max(365 * day)
|
|
1284
1482
|
}).strict()
|
|
1285
1483
|
]);
|
|
1286
|
-
var counterPolicySchema =
|
|
1287
|
-
kind:
|
|
1484
|
+
var counterPolicySchema = z9.object({
|
|
1485
|
+
kind: z9.literal("progress"),
|
|
1288
1486
|
goal: counterGoalSchema,
|
|
1289
1487
|
window: counterWindowSchema,
|
|
1290
|
-
repeat:
|
|
1488
|
+
repeat: z9.enum(["once", "repeat"]).default("once")
|
|
1291
1489
|
}).strict();
|
|
1292
|
-
var achievementBase =
|
|
1490
|
+
var achievementBase = z9.object({
|
|
1293
1491
|
id: identifier,
|
|
1294
|
-
ordinal:
|
|
1295
|
-
achievedAt:
|
|
1296
|
-
window:
|
|
1492
|
+
ordinal: z9.number().int().positive(),
|
|
1493
|
+
achievedAt: z9.number().int(),
|
|
1494
|
+
window: z9.string()
|
|
1297
1495
|
});
|
|
1298
|
-
var counterAchievementSchema =
|
|
1496
|
+
var counterAchievementSchema = z9.discriminatedUnion("status", [
|
|
1299
1497
|
achievementBase.extend({
|
|
1300
|
-
status:
|
|
1498
|
+
status: z9.literal("revoked"),
|
|
1301
1499
|
completion: identifier,
|
|
1302
|
-
revokedAt:
|
|
1500
|
+
revokedAt: z9.number().int()
|
|
1303
1501
|
}),
|
|
1304
1502
|
achievementBase.extend({
|
|
1305
|
-
status:
|
|
1503
|
+
status: z9.literal("awarded"),
|
|
1306
1504
|
completion: identifier
|
|
1307
1505
|
}),
|
|
1308
1506
|
achievementBase.extend({
|
|
1309
|
-
status:
|
|
1507
|
+
status: z9.literal("budget-exhausted"),
|
|
1310
1508
|
budget: identifier
|
|
1311
1509
|
})
|
|
1312
1510
|
]);
|
|
1313
|
-
var counterProgressSchema =
|
|
1314
|
-
goal:
|
|
1315
|
-
current:
|
|
1316
|
-
window:
|
|
1317
|
-
key:
|
|
1318
|
-
start:
|
|
1319
|
-
end:
|
|
1511
|
+
var counterProgressSchema = z9.object({
|
|
1512
|
+
goal: z9.number().int().positive(),
|
|
1513
|
+
current: z9.number().int().nonnegative(),
|
|
1514
|
+
window: z9.object({
|
|
1515
|
+
key: z9.string(),
|
|
1516
|
+
start: z9.number().int().nullable(),
|
|
1517
|
+
end: z9.number().int().nullable()
|
|
1320
1518
|
}),
|
|
1321
|
-
repeat:
|
|
1322
|
-
settled:
|
|
1519
|
+
repeat: z9.enum(["once", "repeat"]),
|
|
1520
|
+
settled: z9.number().int().nonnegative(),
|
|
1323
1521
|
latest: counterAchievementSchema.nullable()
|
|
1324
1522
|
});
|
|
1325
|
-
var counterContributionSchema =
|
|
1523
|
+
var counterContributionSchema = z9.object({
|
|
1326
1524
|
id: identifier,
|
|
1327
|
-
distinct:
|
|
1525
|
+
distinct: z9.string(),
|
|
1328
1526
|
attempt: identifier,
|
|
1329
|
-
occurredAt:
|
|
1330
|
-
recordedAt:
|
|
1331
|
-
window:
|
|
1332
|
-
status:
|
|
1527
|
+
occurredAt: z9.number().int(),
|
|
1528
|
+
recordedAt: z9.number().int(),
|
|
1529
|
+
window: z9.string(),
|
|
1530
|
+
status: z9.enum(["counted", "late", "future", "excluded"]),
|
|
1333
1531
|
achievement: counterAchievementSchema.nullable(),
|
|
1334
|
-
reason:
|
|
1532
|
+
reason: z9.string().nullable()
|
|
1335
1533
|
});
|
|
1336
|
-
var counterHistorySchema =
|
|
1337
|
-
items:
|
|
1338
|
-
nextCursor:
|
|
1534
|
+
var counterHistorySchema = z9.object({
|
|
1535
|
+
items: z9.array(counterContributionSchema),
|
|
1536
|
+
nextCursor: z9.string().nullable()
|
|
1339
1537
|
});
|
|
1340
|
-
var counterModerationSchema =
|
|
1341
|
-
actionId:
|
|
1342
|
-
excluded:
|
|
1343
|
-
reason:
|
|
1538
|
+
var counterModerationSchema = z9.object({
|
|
1539
|
+
actionId: z9.uuid(),
|
|
1540
|
+
excluded: z9.boolean(),
|
|
1541
|
+
reason: z9.string().trim().min(1).max(2e3)
|
|
1344
1542
|
}).strict();
|
|
1345
|
-
var counterHistoryQuerySchema =
|
|
1346
|
-
cursor:
|
|
1347
|
-
limit:
|
|
1543
|
+
var counterHistoryQuerySchema = z9.object({
|
|
1544
|
+
cursor: z9.string().max(2e3).optional(),
|
|
1545
|
+
limit: z9.coerce.number().int().min(1).max(100).optional()
|
|
1348
1546
|
}).strict();
|
|
1349
|
-
var counterModerationResultSchema =
|
|
1547
|
+
var counterModerationResultSchema = z9.object({ excluded: z9.boolean() });
|
|
1350
1548
|
|
|
1351
1549
|
// src/calendar.ts
|
|
1352
|
-
import { z as
|
|
1353
|
-
var timestamp2 =
|
|
1550
|
+
import { z as z10 } from "zod";
|
|
1551
|
+
var timestamp2 = z10.number().int().safe();
|
|
1354
1552
|
var fixedOffset = /^(?:[+-]|(?:Etc\/)?GMT[+-]\d|(?:EST|MST|HST)$)/i;
|
|
1355
1553
|
function canonicalTimeZone(zone) {
|
|
1356
1554
|
let resolved;
|
|
@@ -1366,18 +1564,18 @@ function canonicalTimeZone(zone) {
|
|
|
1366
1564
|
}
|
|
1367
1565
|
return fixedOffset.test(zone) || fixedOffset.test(resolved) ? null : resolved;
|
|
1368
1566
|
}
|
|
1369
|
-
var timeZoneSchema =
|
|
1567
|
+
var timeZoneSchema = z10.string().min(1).max(100).transform((zone, ctx) => {
|
|
1370
1568
|
const canonical = canonicalTimeZone(zone);
|
|
1371
1569
|
if (canonical === null) {
|
|
1372
1570
|
ctx.addIssue({
|
|
1373
1571
|
code: "custom",
|
|
1374
1572
|
message: fixedOffset.test(zone) ? "Use a named IANA timezone, such as Europe/Budapest or UTC. Fixed offsets have no daylight-saving rules." : "Use an IANA timezone name, such as Europe/Budapest or UTC"
|
|
1375
1573
|
});
|
|
1376
|
-
return
|
|
1574
|
+
return z10.NEVER;
|
|
1377
1575
|
}
|
|
1378
1576
|
return canonical;
|
|
1379
1577
|
});
|
|
1380
|
-
var timeZoneNameSchema =
|
|
1578
|
+
var timeZoneNameSchema = z10.string().min(1).max(100);
|
|
1381
1579
|
var movedTimeZone = (what) => `${what} no longer take a timeZone: they follow the project calendar. Set calendar.timeZone in relay.json or in Console settings.`;
|
|
1382
1580
|
var record = (value) => typeof value === "object" && value !== null;
|
|
1383
1581
|
function refuseStreakTimeZone(value, ctx) {
|
|
@@ -1401,78 +1599,78 @@ function refuseWindowTimeZone(value, ctx) {
|
|
|
1401
1599
|
}
|
|
1402
1600
|
return value;
|
|
1403
1601
|
}
|
|
1404
|
-
var calendarPeriodSchema =
|
|
1405
|
-
var projectCalendarSchema =
|
|
1602
|
+
var calendarPeriodSchema = z10.enum(["lifetime", "day", "week", "month"]);
|
|
1603
|
+
var projectCalendarSchema = z10.object({
|
|
1406
1604
|
/** The timezone of the current calendar day. */
|
|
1407
1605
|
timeZone: timeZoneNameSchema,
|
|
1408
1606
|
/** The current calendar date, such as `2026-10-01`. */
|
|
1409
|
-
today:
|
|
1607
|
+
today: z10.string(),
|
|
1410
1608
|
/** When the current calendar day ends, in epoch milliseconds. */
|
|
1411
1609
|
nextBoundary: timestamp2,
|
|
1412
1610
|
/** A change that takes effect at the next day boundary, or null. */
|
|
1413
|
-
pending:
|
|
1611
|
+
pending: z10.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp2 }).nullable(),
|
|
1414
1612
|
/** The `calendar.timeZone` the last deployment that declared one set, or null. */
|
|
1415
1613
|
declared: timeZoneNameSchema.nullable(),
|
|
1416
1614
|
/**
|
|
1417
1615
|
* A stored timezone the calendar no longer accepts, such as a fixed offset a streak named before
|
|
1418
1616
|
* v1. The calendar reads it as UTC until an operator chooses a timezone. Null otherwise.
|
|
1419
1617
|
*/
|
|
1420
|
-
unsupported:
|
|
1618
|
+
unsupported: z10.string().nullable().default(null)
|
|
1421
1619
|
});
|
|
1422
|
-
var projectCalendarInputSchema =
|
|
1620
|
+
var projectCalendarInputSchema = z10.object({
|
|
1423
1621
|
actionId: identifier,
|
|
1424
1622
|
timeZone: timeZoneSchema,
|
|
1425
|
-
reason:
|
|
1623
|
+
reason: z10.string().trim().min(1).max(500)
|
|
1426
1624
|
}).strict();
|
|
1427
|
-
var projectCalendarDeclarationSchema =
|
|
1625
|
+
var projectCalendarDeclarationSchema = z10.object({ timeZone: timeZoneSchema }).strict();
|
|
1428
1626
|
|
|
1429
1627
|
// src/streaks.ts
|
|
1430
|
-
import { z as
|
|
1431
|
-
var streakPolicySchema =
|
|
1432
|
-
kind:
|
|
1433
|
-
days:
|
|
1434
|
-
});
|
|
1435
|
-
var streakProgressSchema =
|
|
1436
|
-
goal:
|
|
1437
|
-
current:
|
|
1438
|
-
best:
|
|
1439
|
-
today:
|
|
1440
|
-
todayQualified:
|
|
1628
|
+
import { z as z11 } from "zod";
|
|
1629
|
+
var streakPolicySchema = z11.object({
|
|
1630
|
+
kind: z11.literal("streak"),
|
|
1631
|
+
days: z11.number().int().min(1).max(3650)
|
|
1632
|
+
});
|
|
1633
|
+
var streakProgressSchema = z11.object({
|
|
1634
|
+
goal: z11.number().int().positive(),
|
|
1635
|
+
current: z11.number().int().nonnegative(),
|
|
1636
|
+
best: z11.number().int().nonnegative(),
|
|
1637
|
+
today: z11.string(),
|
|
1638
|
+
todayQualified: z11.boolean(),
|
|
1441
1639
|
timeZone: timeZoneNameSchema,
|
|
1442
|
-
nextBoundary:
|
|
1443
|
-
pendingTimeZone:
|
|
1640
|
+
nextBoundary: z11.number().int(),
|
|
1641
|
+
pendingTimeZone: z11.object({
|
|
1444
1642
|
timeZone: timeZoneNameSchema,
|
|
1445
|
-
effectiveAt:
|
|
1643
|
+
effectiveAt: z11.number().int()
|
|
1446
1644
|
}).nullable(),
|
|
1447
|
-
days:
|
|
1448
|
-
|
|
1449
|
-
day:
|
|
1450
|
-
date:
|
|
1645
|
+
days: z11.array(
|
|
1646
|
+
z11.object({
|
|
1647
|
+
day: z11.number().int(),
|
|
1648
|
+
date: z11.string(),
|
|
1451
1649
|
// The zone the day was recorded in, as stored: days from before v1 can name a fixed offset.
|
|
1452
|
-
timeZone:
|
|
1453
|
-
occurredAt:
|
|
1650
|
+
timeZone: z11.string(),
|
|
1651
|
+
occurredAt: z11.number().int()
|
|
1454
1652
|
})
|
|
1455
1653
|
),
|
|
1456
|
-
milestone:
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
status:
|
|
1460
|
-
completion:
|
|
1461
|
-
achievedAt:
|
|
1654
|
+
milestone: z11.discriminatedUnion("status", [
|
|
1655
|
+
z11.object({ status: z11.literal("pending") }),
|
|
1656
|
+
z11.object({
|
|
1657
|
+
status: z11.literal("awarded"),
|
|
1658
|
+
completion: z11.string(),
|
|
1659
|
+
achievedAt: z11.number().int()
|
|
1462
1660
|
}),
|
|
1463
|
-
|
|
1464
|
-
status:
|
|
1465
|
-
budget:
|
|
1466
|
-
achievedAt:
|
|
1661
|
+
z11.object({
|
|
1662
|
+
status: z11.literal("budget-exhausted"),
|
|
1663
|
+
budget: z11.string(),
|
|
1664
|
+
achievedAt: z11.number().int()
|
|
1467
1665
|
})
|
|
1468
1666
|
])
|
|
1469
1667
|
});
|
|
1470
1668
|
|
|
1471
1669
|
// src/tracker-triggers.ts
|
|
1472
|
-
import { z as
|
|
1473
|
-
var timestamp3 =
|
|
1474
|
-
var count2 =
|
|
1475
|
-
var trackerTriggerModeSchema =
|
|
1670
|
+
import { z as z12 } from "zod";
|
|
1671
|
+
var timestamp3 = z12.number().int().safe().nonnegative().max(864e13);
|
|
1672
|
+
var count2 = z12.number().int().safe().nonnegative();
|
|
1673
|
+
var trackerTriggerModeSchema = z12.enum([
|
|
1476
1674
|
"new-record",
|
|
1477
1675
|
"new-observation",
|
|
1478
1676
|
"data-changed"
|
|
@@ -1480,20 +1678,20 @@ var trackerTriggerModeSchema = z11.enum([
|
|
|
1480
1678
|
function defaultTriggerMode(source) {
|
|
1481
1679
|
return source === "custom" ? "new-observation" : "new-record";
|
|
1482
1680
|
}
|
|
1483
|
-
var trackerBoundSchema =
|
|
1484
|
-
|
|
1485
|
-
|
|
1681
|
+
var trackerBoundSchema = z12.union([
|
|
1682
|
+
z12.number().finite(),
|
|
1683
|
+
z12.strictObject({ setting: z12.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
|
|
1486
1684
|
]);
|
|
1487
|
-
var dataPath =
|
|
1685
|
+
var dataPath = z12.string().max(200).regex(
|
|
1488
1686
|
/^[^.\s]+(\.[^.\s]+)*$/,
|
|
1489
1687
|
"Use dot-separated keys, such as metrics.likes"
|
|
1490
1688
|
);
|
|
1491
|
-
var trackerConditionSchema =
|
|
1492
|
-
|
|
1689
|
+
var trackerConditionSchema = z12.union([
|
|
1690
|
+
z12.strictObject({
|
|
1493
1691
|
path: dataPath,
|
|
1494
|
-
equals:
|
|
1692
|
+
equals: z12.union([z12.string().max(1e3), z12.number().finite(), z12.boolean()])
|
|
1495
1693
|
}),
|
|
1496
|
-
|
|
1694
|
+
z12.strictObject({
|
|
1497
1695
|
path: dataPath,
|
|
1498
1696
|
gt: trackerBoundSchema.optional(),
|
|
1499
1697
|
gte: trackerBoundSchema.optional(),
|
|
@@ -1506,9 +1704,9 @@ var trackerConditionSchema = z11.union([
|
|
|
1506
1704
|
"Compare with equals, gt, gte, lt or lte"
|
|
1507
1705
|
)
|
|
1508
1706
|
]);
|
|
1509
|
-
var trackerWhereSchema =
|
|
1707
|
+
var trackerWhereSchema = z12.union([
|
|
1510
1708
|
trackerConditionSchema,
|
|
1511
|
-
|
|
1709
|
+
z12.array(trackerConditionSchema).min(1).max(10)
|
|
1512
1710
|
]);
|
|
1513
1711
|
function whereConditions(where) {
|
|
1514
1712
|
return where === void 0 ? [] : Array.isArray(where) ? where : [where];
|
|
@@ -1520,17 +1718,17 @@ function whereSettings(where) {
|
|
|
1520
1718
|
)
|
|
1521
1719
|
);
|
|
1522
1720
|
}
|
|
1523
|
-
var triggerEnrollmentSchema =
|
|
1524
|
-
var triggerSinceSchema =
|
|
1525
|
-
var triggerHistoricalSchema =
|
|
1526
|
-
var trackerTriggerPolicySchema =
|
|
1721
|
+
var triggerEnrollmentSchema = z12.enum(["none", "required"]);
|
|
1722
|
+
var triggerSinceSchema = z12.enum(["activation", "window", "enrollment"]);
|
|
1723
|
+
var triggerHistoricalSchema = z12.enum(["staff", "claim", "automatic"]);
|
|
1724
|
+
var trackerTriggerPolicySchema = z12.strictObject({
|
|
1527
1725
|
/** The tracker's authoring key; publication binds it to the tracker's stable ID. */
|
|
1528
1726
|
tracker: identifier,
|
|
1529
1727
|
/**
|
|
1530
1728
|
* The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
|
|
1531
1729
|
* releases keep parsing them when a later Relay adds a managed source.
|
|
1532
1730
|
*/
|
|
1533
|
-
source:
|
|
1731
|
+
source: z12.string().min(1).max(100),
|
|
1534
1732
|
/** Which observations fire. */
|
|
1535
1733
|
on: trackerTriggerModeSchema,
|
|
1536
1734
|
where: trackerWhereSchema.optional(),
|
|
@@ -1551,7 +1749,7 @@ var trackerTriggerPolicySchema = z11.strictObject({
|
|
|
1551
1749
|
* that re-evaluates edits and runs `performance`, firing on each new record and paying its
|
|
1552
1750
|
* author.
|
|
1553
1751
|
*/
|
|
1554
|
-
content:
|
|
1752
|
+
content: z12.literal(true).optional()
|
|
1555
1753
|
}).refine(
|
|
1556
1754
|
(policy) => policy.since !== "enrollment" || policy.enrollment === "required",
|
|
1557
1755
|
'since: "enrollment" needs enrollment: "required"'
|
|
@@ -1570,72 +1768,72 @@ function beneficiaryRole(policy) {
|
|
|
1570
1768
|
return policy.beneficiary;
|
|
1571
1769
|
}
|
|
1572
1770
|
var xLink = {
|
|
1573
|
-
issuer:
|
|
1771
|
+
issuer: z12.string().min(1),
|
|
1574
1772
|
/** The account's stable user ID. */
|
|
1575
|
-
subject:
|
|
1773
|
+
subject: z12.string().min(1).max(256),
|
|
1576
1774
|
/** The member's account selection revision. */
|
|
1577
1775
|
revision: count2,
|
|
1578
1776
|
/** When the member linked the account; null when unknown. */
|
|
1579
1777
|
linkedAt: timestamp3.nullable()
|
|
1580
1778
|
};
|
|
1581
|
-
var trackerAttributionSchema =
|
|
1779
|
+
var trackerAttributionSchema = z12.object({
|
|
1582
1780
|
member: identifier,
|
|
1583
1781
|
capturedAt: timestamp3,
|
|
1584
|
-
account:
|
|
1585
|
-
|
|
1586
|
-
provider:
|
|
1782
|
+
account: z12.union([
|
|
1783
|
+
z12.object({
|
|
1784
|
+
provider: z12.literal("wallet"),
|
|
1587
1785
|
/** Canonical CAIP-10 account ID, as the record names it. */
|
|
1588
|
-
id:
|
|
1786
|
+
id: z12.string().min(5).max(256),
|
|
1589
1787
|
/** The wallet link's revision. */
|
|
1590
1788
|
revision: count2,
|
|
1591
1789
|
/** When the member verified the wallet. */
|
|
1592
1790
|
linkedAt: timestamp3.nullable()
|
|
1593
1791
|
}),
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
provider:
|
|
1792
|
+
z12.object({ provider: z12.literal("x"), ...xLink }),
|
|
1793
|
+
z12.object({ provider: z12.literal("discord"), ...xLink }),
|
|
1794
|
+
z12.object({
|
|
1795
|
+
provider: z12.literal("member"),
|
|
1598
1796
|
/** The member ID the record names. */
|
|
1599
1797
|
id: identifier
|
|
1600
1798
|
}),
|
|
1601
|
-
|
|
1799
|
+
z12.object({
|
|
1602
1800
|
/** Your app's identity kind, such as `app:telegram`. */
|
|
1603
1801
|
provider: appIdentityKindSchema,
|
|
1604
1802
|
/** The subject your app signed the member in with, as the record names it. */
|
|
1605
|
-
subject:
|
|
1803
|
+
subject: z12.string().min(1).max(256),
|
|
1606
1804
|
/** The identity's revision in the project. */
|
|
1607
1805
|
revision: count2,
|
|
1608
1806
|
/** When the identity was linked to the member. */
|
|
1609
1807
|
linkedAt: timestamp3.nullable()
|
|
1610
1808
|
}),
|
|
1611
1809
|
/** A kind a later Relay adds. */
|
|
1612
|
-
|
|
1810
|
+
z12.object({ provider: z12.string().min(1) })
|
|
1613
1811
|
])
|
|
1614
1812
|
});
|
|
1615
|
-
var trackerTriggerRecordSchema =
|
|
1616
|
-
id:
|
|
1617
|
-
source:
|
|
1813
|
+
var trackerTriggerRecordSchema = z12.object({
|
|
1814
|
+
id: z12.string().min(1).max(256),
|
|
1815
|
+
source: z12.string(),
|
|
1618
1816
|
occurredAt: timestamp3,
|
|
1619
1817
|
observedAt: timestamp3,
|
|
1620
1818
|
firstSeenAt: timestamp3,
|
|
1621
|
-
author:
|
|
1622
|
-
id:
|
|
1623
|
-
verified:
|
|
1819
|
+
author: z12.object({
|
|
1820
|
+
id: z12.string().min(1).max(256),
|
|
1821
|
+
verified: z12.boolean().nullable(),
|
|
1624
1822
|
kind: openIdentityKindSchema.optional()
|
|
1625
1823
|
}).nullable(),
|
|
1626
|
-
accounts:
|
|
1627
|
-
data:
|
|
1628
|
-
removed:
|
|
1824
|
+
accounts: z12.record(accountRoleSchema, trackerRecordAccountSchema).optional(),
|
|
1825
|
+
data: z12.record(z12.string(), z12.json()),
|
|
1826
|
+
removed: z12.boolean()
|
|
1629
1827
|
});
|
|
1630
|
-
var trackerContentStageSchema =
|
|
1828
|
+
var trackerContentStageSchema = z12.object({
|
|
1631
1829
|
/** The body's revision: the hash of its canonical JSON. Edits make a new one. */
|
|
1632
1830
|
revision: identifier,
|
|
1633
1831
|
/** The captured observation that carried this body. */
|
|
1634
1832
|
observation: identifier,
|
|
1635
1833
|
/** The body: an X post's normalized body, or a custom record's `data.body`. */
|
|
1636
|
-
body:
|
|
1834
|
+
body: z12.record(z12.string(), z12.json())
|
|
1637
1835
|
});
|
|
1638
|
-
var trackerTriggerContextSchema =
|
|
1836
|
+
var trackerTriggerContextSchema = z12.object({
|
|
1639
1837
|
/** The tracker's stable ID. */
|
|
1640
1838
|
tracker: identifier,
|
|
1641
1839
|
/** The tracker's authoring key. */
|
|
@@ -1657,61 +1855,61 @@ var trackerTriggerContextSchema = z11.object({
|
|
|
1657
1855
|
});
|
|
1658
1856
|
|
|
1659
1857
|
// src/completion.ts
|
|
1660
|
-
import { z as
|
|
1661
|
-
var name =
|
|
1662
|
-
var completionPolicySchema =
|
|
1858
|
+
import { z as z13 } from "zod";
|
|
1859
|
+
var name = z13.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
|
|
1860
|
+
var completionPolicySchema = z13.discriminatedUnion("kind", [
|
|
1663
1861
|
streakPolicySchema,
|
|
1664
1862
|
counterPolicySchema,
|
|
1665
|
-
|
|
1666
|
-
|
|
1863
|
+
z13.object({ kind: z13.literal("once") }).strict(),
|
|
1864
|
+
z13.object({ kind: z13.literal("keyed") }).strict()
|
|
1667
1865
|
]);
|
|
1668
|
-
var completionKeySchema =
|
|
1669
|
-
var budgetSchema =
|
|
1866
|
+
var completionKeySchema = z13.string().min(1).max(500);
|
|
1867
|
+
var budgetSchema = z13.object({
|
|
1670
1868
|
id: name,
|
|
1671
|
-
scope:
|
|
1869
|
+
scope: z13.enum(["member", "project"]),
|
|
1672
1870
|
/**
|
|
1673
1871
|
* The project calendar period of the attempt's eligibility time that one bucket covers:
|
|
1674
1872
|
* `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
|
|
1675
1873
|
* `"lifetime"` never resets.
|
|
1676
1874
|
*/
|
|
1677
1875
|
period: calendarPeriodSchema,
|
|
1678
|
-
limit:
|
|
1679
|
-
cost:
|
|
1680
|
-
|
|
1681
|
-
|
|
1876
|
+
limit: z13.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
1877
|
+
cost: z13.union([
|
|
1878
|
+
z13.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
1879
|
+
z13.object({ balance: name }).strict()
|
|
1682
1880
|
])
|
|
1683
1881
|
}).strict();
|
|
1684
1882
|
|
|
1685
1883
|
// src/integrations.ts
|
|
1686
|
-
import { z as
|
|
1687
|
-
var evaluatorIntegrationProviderSchema =
|
|
1688
|
-
var integrationProviderSchema =
|
|
1689
|
-
var discordServerSchema =
|
|
1690
|
-
id:
|
|
1691
|
-
name:
|
|
1692
|
-
icon:
|
|
1693
|
-
});
|
|
1694
|
-
var projectIntegrationSchema =
|
|
1884
|
+
import { z as z14 } from "zod";
|
|
1885
|
+
var evaluatorIntegrationProviderSchema = z14.enum(["discord", "x"]);
|
|
1886
|
+
var integrationProviderSchema = z14.enum(["discord"]);
|
|
1887
|
+
var discordServerSchema = z14.object({
|
|
1888
|
+
id: z14.string().regex(/^[0-9]{1,20}$/),
|
|
1889
|
+
name: z14.string().min(1),
|
|
1890
|
+
icon: z14.string().nullable()
|
|
1891
|
+
});
|
|
1892
|
+
var projectIntegrationSchema = z14.object({
|
|
1695
1893
|
provider: integrationProviderSchema,
|
|
1696
|
-
configured:
|
|
1697
|
-
status:
|
|
1698
|
-
revision:
|
|
1894
|
+
configured: z14.boolean(),
|
|
1895
|
+
status: z14.enum(["disconnected", "ready", "attention"]),
|
|
1896
|
+
revision: z14.number().int().nonnegative(),
|
|
1699
1897
|
server: discordServerSchema.nullable(),
|
|
1700
|
-
issue:
|
|
1701
|
-
connectedAt:
|
|
1898
|
+
issue: z14.string().nullable(),
|
|
1899
|
+
connectedAt: z14.number().default(0)
|
|
1702
1900
|
});
|
|
1703
1901
|
|
|
1704
1902
|
// src/submission-input.ts
|
|
1705
|
-
import { z as
|
|
1706
|
-
var textOptionsSchema =
|
|
1707
|
-
required:
|
|
1708
|
-
minLength:
|
|
1709
|
-
maxLength:
|
|
1903
|
+
import { z as z15 } from "zod";
|
|
1904
|
+
var textOptionsSchema = z15.object({
|
|
1905
|
+
required: z15.boolean().default(true),
|
|
1906
|
+
minLength: z15.number().int().min(0).max(1e4).default(1),
|
|
1907
|
+
maxLength: z15.number().int().min(1).max(1e4).default(1e4)
|
|
1710
1908
|
}).strict().refine(
|
|
1711
1909
|
(v) => v.minLength <= v.maxLength,
|
|
1712
1910
|
"minLength must not exceed maxLength"
|
|
1713
1911
|
);
|
|
1714
|
-
var hostSchema =
|
|
1912
|
+
var hostSchema = z15.string().min(1).max(253).refine((host) => {
|
|
1715
1913
|
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
1716
1914
|
return false;
|
|
1717
1915
|
}
|
|
@@ -1722,13 +1920,13 @@ var hostSchema = z14.string().min(1).max(253).refine((host) => {
|
|
|
1722
1920
|
return false;
|
|
1723
1921
|
}
|
|
1724
1922
|
}, "Use a hostname without a scheme, path, port, or wildcard");
|
|
1725
|
-
var urlOptionsSchema =
|
|
1726
|
-
required:
|
|
1727
|
-
allowedHosts:
|
|
1923
|
+
var urlOptionsSchema = z15.object({
|
|
1924
|
+
required: z15.boolean().default(true),
|
|
1925
|
+
allowedHosts: z15.array(hostSchema).min(1).max(100).optional()
|
|
1728
1926
|
}).strict();
|
|
1729
|
-
var textEvidenceSchema =
|
|
1730
|
-
var urlEvidenceSchema =
|
|
1731
|
-
var valueEvidenceSchema =
|
|
1927
|
+
var textEvidenceSchema = z15.object({ kind: z15.literal("text"), value: z15.string().max(1e4) }).strict();
|
|
1928
|
+
var urlEvidenceSchema = z15.object({ kind: z15.literal("url"), value: z15.string().max(2048) }).strict();
|
|
1929
|
+
var valueEvidenceSchema = z15.discriminatedUnion("kind", [
|
|
1732
1930
|
textEvidenceSchema,
|
|
1733
1931
|
urlEvidenceSchema
|
|
1734
1932
|
]);
|
|
@@ -1791,22 +1989,22 @@ function xPostId(value) {
|
|
|
1791
1989
|
}
|
|
1792
1990
|
|
|
1793
1991
|
// src/quiz.ts
|
|
1794
|
-
import { z as
|
|
1795
|
-
var quizId =
|
|
1796
|
-
var quizChoiceSchema =
|
|
1797
|
-
var quizQuestionSchema =
|
|
1992
|
+
import { z as z16 } from "zod";
|
|
1993
|
+
var quizId = z16.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
1994
|
+
var quizChoiceSchema = z16.object({ id: quizId, label: z16.string().trim().min(1).max(500) }).strict();
|
|
1995
|
+
var quizQuestionSchema = z16.object({
|
|
1798
1996
|
id: quizId,
|
|
1799
|
-
prompt:
|
|
1800
|
-
choices:
|
|
1997
|
+
prompt: z16.string().trim().min(1).max(1e3),
|
|
1998
|
+
choices: z16.array(quizChoiceSchema).min(2).max(8).refine(
|
|
1801
1999
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
1802
2000
|
"Choice IDs must be unique"
|
|
1803
2001
|
)
|
|
1804
2002
|
}).strict();
|
|
1805
|
-
var quizQuestionsSchema =
|
|
2003
|
+
var quizQuestionsSchema = z16.array(quizQuestionSchema).min(1).max(20).refine(
|
|
1806
2004
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
1807
2005
|
"Question IDs must be unique"
|
|
1808
2006
|
);
|
|
1809
|
-
var quizContentSchema =
|
|
2007
|
+
var quizContentSchema = z16.array(
|
|
1810
2008
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
1811
2009
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
1812
2010
|
"Choose a correct answer from the available choices"
|
|
@@ -1817,98 +2015,98 @@ var quizContentSchema = z15.array(
|
|
|
1817
2015
|
);
|
|
1818
2016
|
|
|
1819
2017
|
// src/resources.ts
|
|
1820
|
-
import { z as
|
|
1821
|
-
var resourceSourceSchema =
|
|
1822
|
-
|
|
1823
|
-
provider:
|
|
1824
|
-
resource:
|
|
2018
|
+
import { z as z17 } from "zod";
|
|
2019
|
+
var resourceSourceSchema = z17.union([
|
|
2020
|
+
z17.strictObject({
|
|
2021
|
+
provider: z17.literal("domino"),
|
|
2022
|
+
resource: z17.literal("point-ledger")
|
|
1825
2023
|
}),
|
|
1826
2024
|
discordResourceSourceSchema
|
|
1827
2025
|
]);
|
|
1828
|
-
var resourceRequestSchema =
|
|
2026
|
+
var resourceRequestSchema = z17.object({
|
|
1829
2027
|
source: resourceSourceSchema,
|
|
1830
|
-
query:
|
|
1831
|
-
cursor:
|
|
1832
|
-
ids:
|
|
2028
|
+
query: z17.string().max(100).optional(),
|
|
2029
|
+
cursor: z17.string().regex(/^\d{1,6}$/).optional(),
|
|
2030
|
+
ids: z17.array(z17.string().min(1).max(100)).max(50).optional()
|
|
1833
2031
|
}).strict();
|
|
1834
|
-
var resourceOptionsSchema =
|
|
1835
|
-
revision:
|
|
1836
|
-
options:
|
|
1837
|
-
|
|
1838
|
-
id:
|
|
1839
|
-
label:
|
|
1840
|
-
description:
|
|
1841
|
-
group:
|
|
1842
|
-
disabledReason:
|
|
2032
|
+
var resourceOptionsSchema = z17.object({
|
|
2033
|
+
revision: z17.number().int(),
|
|
2034
|
+
options: z17.array(
|
|
2035
|
+
z17.object({
|
|
2036
|
+
id: z17.string(),
|
|
2037
|
+
label: z17.string(),
|
|
2038
|
+
description: z17.string().optional(),
|
|
2039
|
+
group: z17.string().optional(),
|
|
2040
|
+
disabledReason: z17.string().optional()
|
|
1843
2041
|
})
|
|
1844
2042
|
),
|
|
1845
2043
|
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
1846
|
-
nextCursor:
|
|
2044
|
+
nextCursor: z17.string().nullable().default(null),
|
|
1847
2045
|
/** @deprecated Use `nextCursor`. Removed in 2.0.0. */
|
|
1848
|
-
cursor:
|
|
2046
|
+
cursor: z17.string().nullable()
|
|
1849
2047
|
});
|
|
1850
2048
|
|
|
1851
2049
|
// src/settings.ts
|
|
1852
|
-
import { z as
|
|
2050
|
+
import { z as z19 } from "zod";
|
|
1853
2051
|
|
|
1854
2052
|
// src/setting-values.ts
|
|
1855
|
-
import { z as
|
|
1856
|
-
var settingInstant =
|
|
1857
|
-
var settingResourceId =
|
|
1858
|
-
|
|
1859
|
-
|
|
2053
|
+
import { z as z18 } from "zod";
|
|
2054
|
+
var settingInstant = z18.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
|
|
2055
|
+
var settingResourceId = z18.union([
|
|
2056
|
+
z18.literal(""),
|
|
2057
|
+
z18.string().regex(/^\S{1,200}$/)
|
|
1860
2058
|
]);
|
|
1861
2059
|
|
|
1862
2060
|
// src/settings.ts
|
|
1863
|
-
var base = { label:
|
|
1864
|
-
var settingFieldSchema =
|
|
1865
|
-
|
|
2061
|
+
var base = { label: z19.string().min(1), description: z19.string().optional() };
|
|
2062
|
+
var settingFieldSchema = z19.discriminatedUnion("kind", [
|
|
2063
|
+
z19.object({
|
|
1866
2064
|
...base,
|
|
1867
|
-
kind:
|
|
1868
|
-
default: identifier.or(
|
|
2065
|
+
kind: z19.literal("point-ledger"),
|
|
2066
|
+
default: identifier.or(z19.literal(""))
|
|
1869
2067
|
}).strict(),
|
|
1870
|
-
|
|
1871
|
-
|
|
2068
|
+
z19.object({ ...base, kind: z19.literal("datetime"), default: settingInstant }).strict(),
|
|
2069
|
+
z19.object({
|
|
1872
2070
|
...base,
|
|
1873
|
-
kind:
|
|
2071
|
+
kind: z19.literal("resource"),
|
|
1874
2072
|
default: settingResourceId,
|
|
1875
2073
|
source: resourceSourceSchema
|
|
1876
2074
|
}).strict(),
|
|
1877
|
-
|
|
1878
|
-
|
|
2075
|
+
z19.object({ ...base, kind: z19.literal("quiz"), default: quizContentSchema }).strict(),
|
|
2076
|
+
z19.object({
|
|
1879
2077
|
...base,
|
|
1880
|
-
kind:
|
|
1881
|
-
default:
|
|
1882
|
-
minLength:
|
|
1883
|
-
maxLength:
|
|
1884
|
-
multiline:
|
|
2078
|
+
kind: z19.literal("text"),
|
|
2079
|
+
default: z19.string(),
|
|
2080
|
+
minLength: z19.number().int().nonnegative(),
|
|
2081
|
+
maxLength: z19.number().int().positive(),
|
|
2082
|
+
multiline: z19.boolean()
|
|
1885
2083
|
}).strict(),
|
|
1886
|
-
|
|
2084
|
+
z19.object({
|
|
1887
2085
|
...base,
|
|
1888
|
-
kind:
|
|
1889
|
-
default:
|
|
1890
|
-
min:
|
|
1891
|
-
max:
|
|
2086
|
+
kind: z19.literal("integer"),
|
|
2087
|
+
default: z19.number().int(),
|
|
2088
|
+
min: z19.number().int(),
|
|
2089
|
+
max: z19.number().int()
|
|
1892
2090
|
}).strict(),
|
|
1893
|
-
|
|
1894
|
-
|
|
2091
|
+
z19.object({ ...base, kind: z19.literal("boolean"), default: z19.boolean() }).strict(),
|
|
2092
|
+
z19.object({
|
|
1895
2093
|
...base,
|
|
1896
|
-
kind:
|
|
1897
|
-
default:
|
|
1898
|
-
options:
|
|
2094
|
+
kind: z19.literal("choice"),
|
|
2095
|
+
default: z19.string(),
|
|
2096
|
+
options: z19.array(z19.string().min(1)).min(1)
|
|
1899
2097
|
}).strict()
|
|
1900
2098
|
]);
|
|
1901
|
-
var settingsFieldsSchema =
|
|
1902
|
-
|
|
2099
|
+
var settingsFieldsSchema = z19.record(
|
|
2100
|
+
z19.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
1903
2101
|
settingFieldSchema
|
|
1904
2102
|
);
|
|
1905
|
-
var settingsValuesSchema =
|
|
1906
|
-
|
|
1907
|
-
|
|
2103
|
+
var settingsValuesSchema = z19.record(
|
|
2104
|
+
z19.string(),
|
|
2105
|
+
z19.union([z19.string(), z19.number().finite(), z19.boolean(), quizContentSchema])
|
|
1908
2106
|
);
|
|
1909
|
-
function parseSettings(
|
|
2107
|
+
function parseSettings(fields2, input) {
|
|
1910
2108
|
const shape = {};
|
|
1911
|
-
for (const [key, field] of Object.entries(
|
|
2109
|
+
for (const [key, field] of Object.entries(fields2)) {
|
|
1912
2110
|
switch (field.kind) {
|
|
1913
2111
|
case "point-ledger":
|
|
1914
2112
|
shape[key] = settingResourceId.default(field.default);
|
|
@@ -1923,24 +2121,24 @@ function parseSettings(fields, input) {
|
|
|
1923
2121
|
shape[key] = quizContentSchema.default(field.default);
|
|
1924
2122
|
break;
|
|
1925
2123
|
case "text":
|
|
1926
|
-
shape[key] =
|
|
2124
|
+
shape[key] = z19.string().min(field.minLength).max(field.maxLength).default(field.default);
|
|
1927
2125
|
break;
|
|
1928
2126
|
case "integer":
|
|
1929
|
-
shape[key] =
|
|
2127
|
+
shape[key] = z19.number().int().min(field.min).max(field.max).default(field.default);
|
|
1930
2128
|
break;
|
|
1931
2129
|
case "boolean":
|
|
1932
|
-
shape[key] =
|
|
2130
|
+
shape[key] = z19.boolean().default(field.default);
|
|
1933
2131
|
break;
|
|
1934
2132
|
case "choice":
|
|
1935
|
-
shape[key] =
|
|
2133
|
+
shape[key] = z19.enum(field.options).default(field.default);
|
|
1936
2134
|
break;
|
|
1937
2135
|
}
|
|
1938
2136
|
}
|
|
1939
|
-
return settingsValuesSchema.parse(
|
|
2137
|
+
return settingsValuesSchema.parse(z19.object(shape).strict().parse(input));
|
|
1940
2138
|
}
|
|
1941
|
-
function missingResourceSettings(
|
|
1942
|
-
return Object.entries(
|
|
1943
|
-
([key, field]) => (field.kind === "resource" || field.kind === "point-ledger") && !
|
|
2139
|
+
function missingResourceSettings(fields2, values2) {
|
|
2140
|
+
return Object.entries(fields2).filter(
|
|
2141
|
+
([key, field]) => (field.kind === "resource" || field.kind === "point-ledger") && !values2[key]
|
|
1944
2142
|
).map(([key]) => key);
|
|
1945
2143
|
}
|
|
1946
2144
|
function compatibleSettingKinds(previous, next) {
|
|
@@ -1957,21 +2155,21 @@ function authoringKey(input) {
|
|
|
1957
2155
|
}
|
|
1958
2156
|
|
|
1959
2157
|
// src/campaigns.ts
|
|
1960
|
-
import { z as
|
|
1961
|
-
var timestamp4 =
|
|
1962
|
-
var availabilityWindowSchema =
|
|
2158
|
+
import { z as z20 } from "zod";
|
|
2159
|
+
var timestamp4 = z20.number().int().safe().nonnegative();
|
|
2160
|
+
var availabilityWindowSchema = z20.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
|
|
1963
2161
|
message: "Window end must follow its start",
|
|
1964
2162
|
path: ["until"]
|
|
1965
2163
|
});
|
|
1966
|
-
var campaignDefinitionSchema =
|
|
2164
|
+
var campaignDefinitionSchema = z20.object({
|
|
1967
2165
|
key: identifier,
|
|
1968
|
-
title:
|
|
2166
|
+
title: z20.string().trim().min(1).max(120),
|
|
1969
2167
|
window: availabilityWindowSchema.optional(),
|
|
1970
|
-
enrollment:
|
|
2168
|
+
enrollment: z20.enum(["none", "required"]).default("none")
|
|
1971
2169
|
}).strict();
|
|
1972
2170
|
var campaignAuthoringSchema = campaignDefinitionSchema.omit({ key: true, title: true }).extend({
|
|
1973
2171
|
...authoringIdentityShape,
|
|
1974
|
-
title:
|
|
2172
|
+
title: z20.string().trim().min(1).max(120).optional()
|
|
1975
2173
|
}).strict().transform((value) => {
|
|
1976
2174
|
const normalized = value;
|
|
1977
2175
|
return campaignDefinitionSchema.parse({
|
|
@@ -1985,42 +2183,42 @@ function defineCampaign(input) {
|
|
|
1985
2183
|
var campaignViewSchema = campaignDefinitionSchema.extend({
|
|
1986
2184
|
enrolledAt: timestamp4.nullable(),
|
|
1987
2185
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
1988
|
-
withdrawalReason:
|
|
2186
|
+
withdrawalReason: z20.string().nullable().default(null)
|
|
1989
2187
|
});
|
|
1990
|
-
var campaignEnrollmentInputSchema =
|
|
2188
|
+
var campaignEnrollmentInputSchema = z20.object({ actionId: identifier, campaign: identifier }).strict();
|
|
1991
2189
|
var memberCampaignEnrollmentInputSchema = campaignEnrollmentInputSchema.extend({ member: identifier });
|
|
1992
2190
|
var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
|
|
1993
2191
|
var memberCampaignWithdrawalInputSchema = campaignWithdrawalInputSchema.extend({
|
|
1994
2192
|
member: identifier,
|
|
1995
|
-
reason:
|
|
2193
|
+
reason: z20.string().trim().min(1).max(500)
|
|
1996
2194
|
});
|
|
1997
|
-
var campaignEnrollmentSchema =
|
|
2195
|
+
var campaignEnrollmentSchema = z20.object({
|
|
1998
2196
|
campaign: identifier,
|
|
1999
2197
|
member: identifier,
|
|
2000
2198
|
enrolledAt: timestamp4,
|
|
2001
2199
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
2002
|
-
withdrawalReason:
|
|
2200
|
+
withdrawalReason: z20.string().nullable().default(null)
|
|
2003
2201
|
});
|
|
2004
2202
|
|
|
2005
2203
|
// src/resource-handle.ts
|
|
2006
|
-
import { z as
|
|
2204
|
+
import { z as z21 } from "zod";
|
|
2007
2205
|
function resourceHandle(_kind, definition) {
|
|
2008
2206
|
return definition;
|
|
2009
2207
|
}
|
|
2010
|
-
var ledgerSettingSchema = identifier.or(
|
|
2208
|
+
var ledgerSettingSchema = identifier.or(z21.literal("")).brand();
|
|
2011
2209
|
function ledgerKey(ledger) {
|
|
2012
2210
|
return typeof ledger === "string" ? ledger : ledger.key;
|
|
2013
2211
|
}
|
|
2014
2212
|
|
|
2015
2213
|
// src/groups.ts
|
|
2016
|
-
import { z as
|
|
2017
|
-
var projectGroupSchema =
|
|
2214
|
+
import { z as z22 } from "zod";
|
|
2215
|
+
var projectGroupSchema = z22.object({
|
|
2018
2216
|
key: identifier,
|
|
2019
|
-
title:
|
|
2217
|
+
title: z22.string().trim().min(1).max(120)
|
|
2020
2218
|
}).strict();
|
|
2021
2219
|
var projectGroupAuthoringSchema = projectGroupSchema.omit({ key: true, title: true }).extend({
|
|
2022
2220
|
...authoringIdentityShape,
|
|
2023
|
-
title:
|
|
2221
|
+
title: z22.string().trim().min(1).max(120).optional()
|
|
2024
2222
|
}).strict().transform((value) => {
|
|
2025
2223
|
return projectGroupSchema.parse({
|
|
2026
2224
|
...value,
|
|
@@ -2033,92 +2231,92 @@ function defineGroup(input) {
|
|
|
2033
2231
|
function projectGroupKey(group) {
|
|
2034
2232
|
return identifier.parse(group.key);
|
|
2035
2233
|
}
|
|
2036
|
-
var groupTitle =
|
|
2037
|
-
var reason =
|
|
2038
|
-
var timestamp5 =
|
|
2039
|
-
var createGroupSchema =
|
|
2040
|
-
var updateGroupSchema =
|
|
2041
|
-
var addGroupMemberSchema =
|
|
2042
|
-
var removeGroupMemberSchema =
|
|
2043
|
-
var groupPageQuerySchema =
|
|
2234
|
+
var groupTitle = z22.string().trim().min(1).max(120);
|
|
2235
|
+
var reason = z22.string().trim().min(1).max(1e3);
|
|
2236
|
+
var timestamp5 = z22.number().int().nonnegative().max(864e13);
|
|
2237
|
+
var createGroupSchema = z22.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
|
|
2238
|
+
var updateGroupSchema = z22.object({ title: groupTitle }).strict();
|
|
2239
|
+
var addGroupMemberSchema = z22.object({ actionId: identifier, member: identifier, reason }).strict();
|
|
2240
|
+
var removeGroupMemberSchema = z22.object({ actionId: identifier, reason }).strict();
|
|
2241
|
+
var groupPageQuerySchema = z22.strictObject({
|
|
2044
2242
|
cursor: pageCursorSchema.optional(),
|
|
2045
2243
|
/** Items per page, 1–100; the default is 50. */
|
|
2046
|
-
limit:
|
|
2244
|
+
limit: z22.number().int().min(1).max(100).optional()
|
|
2047
2245
|
});
|
|
2048
|
-
var managedGroupSchema =
|
|
2246
|
+
var managedGroupSchema = z22.object({
|
|
2049
2247
|
key: identifier,
|
|
2050
|
-
title:
|
|
2051
|
-
members:
|
|
2248
|
+
title: z22.string(),
|
|
2249
|
+
members: z22.number().int().nonnegative(),
|
|
2052
2250
|
createdAt: timestamp5,
|
|
2053
2251
|
archivedAt: timestamp5.nullable()
|
|
2054
2252
|
});
|
|
2055
|
-
var groupPageSchema =
|
|
2056
|
-
items:
|
|
2253
|
+
var groupPageSchema = z22.object({
|
|
2254
|
+
items: z22.array(managedGroupSchema),
|
|
2057
2255
|
nextCursor: pageCursorSchema.nullable()
|
|
2058
2256
|
});
|
|
2059
|
-
var groupMemberSchema =
|
|
2257
|
+
var groupMemberSchema = z22.object({
|
|
2060
2258
|
member: identifier,
|
|
2061
2259
|
addedAt: timestamp5.nullable()
|
|
2062
2260
|
});
|
|
2063
|
-
var groupMemberPageSchema =
|
|
2064
|
-
items:
|
|
2261
|
+
var groupMemberPageSchema = z22.object({
|
|
2262
|
+
items: z22.array(groupMemberSchema),
|
|
2065
2263
|
nextCursor: pageCursorSchema.nullable()
|
|
2066
2264
|
});
|
|
2067
2265
|
|
|
2068
2266
|
// src/prerequisites.ts
|
|
2069
|
-
import { z as
|
|
2070
|
-
var amount =
|
|
2267
|
+
import { z as z23 } from "zod";
|
|
2268
|
+
var amount = z23.number().int().safe().nonnegative();
|
|
2071
2269
|
var threshold = amount.positive();
|
|
2072
|
-
var completionPrerequisiteSchema =
|
|
2073
|
-
|
|
2074
|
-
kind:
|
|
2270
|
+
var completionPrerequisiteSchema = z23.discriminatedUnion("scope", [
|
|
2271
|
+
z23.object({
|
|
2272
|
+
kind: z23.literal("completion"),
|
|
2075
2273
|
quest: identifier,
|
|
2076
|
-
scope:
|
|
2274
|
+
scope: z23.literal("ever")
|
|
2077
2275
|
}).strict(),
|
|
2078
|
-
|
|
2079
|
-
kind:
|
|
2276
|
+
z23.object({
|
|
2277
|
+
kind: z23.literal("completion"),
|
|
2080
2278
|
quest: identifier,
|
|
2081
|
-
scope:
|
|
2279
|
+
scope: z23.literal("period"),
|
|
2082
2280
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
2083
2281
|
}).strict()
|
|
2084
2282
|
]);
|
|
2085
|
-
var balancePrerequisiteSchema =
|
|
2086
|
-
kind:
|
|
2283
|
+
var balancePrerequisiteSchema = z23.object({
|
|
2284
|
+
kind: z23.literal("balance"),
|
|
2087
2285
|
balance: identifier,
|
|
2088
2286
|
minimum: threshold
|
|
2089
2287
|
}).strict();
|
|
2090
|
-
var groupPrerequisiteSchema =
|
|
2091
|
-
var prerequisiteSchema =
|
|
2288
|
+
var groupPrerequisiteSchema = z23.object({ kind: z23.literal("group"), group: identifier, title: z23.string() }).strict();
|
|
2289
|
+
var prerequisiteSchema = z23.discriminatedUnion("kind", [
|
|
2092
2290
|
completionPrerequisiteSchema,
|
|
2093
2291
|
balancePrerequisiteSchema,
|
|
2094
2292
|
groupPrerequisiteSchema
|
|
2095
2293
|
]);
|
|
2096
|
-
var missingPrerequisiteSchema =
|
|
2097
|
-
|
|
2098
|
-
kind:
|
|
2294
|
+
var missingPrerequisiteSchema = z23.union([
|
|
2295
|
+
z23.object({
|
|
2296
|
+
kind: z23.literal("completion"),
|
|
2099
2297
|
quest: identifier,
|
|
2100
|
-
title:
|
|
2101
|
-
scope:
|
|
2298
|
+
title: z23.string(),
|
|
2299
|
+
scope: z23.literal("ever")
|
|
2102
2300
|
}),
|
|
2103
|
-
|
|
2104
|
-
kind:
|
|
2301
|
+
z23.object({
|
|
2302
|
+
kind: z23.literal("completion"),
|
|
2105
2303
|
quest: identifier,
|
|
2106
|
-
title:
|
|
2107
|
-
scope:
|
|
2304
|
+
title: z23.string(),
|
|
2305
|
+
scope: z23.literal("period"),
|
|
2108
2306
|
period: calendarPeriodSchema.exclude(["lifetime"]),
|
|
2109
|
-
resetsAt:
|
|
2307
|
+
resetsAt: z23.number().int().safe()
|
|
2110
2308
|
}),
|
|
2111
|
-
|
|
2112
|
-
kind:
|
|
2309
|
+
z23.object({
|
|
2310
|
+
kind: z23.literal("balance"),
|
|
2113
2311
|
balance: identifier,
|
|
2114
|
-
title:
|
|
2312
|
+
title: z23.string(),
|
|
2115
2313
|
minimum: threshold,
|
|
2116
2314
|
current: amount
|
|
2117
2315
|
}),
|
|
2118
|
-
|
|
2119
|
-
kind:
|
|
2316
|
+
z23.object({
|
|
2317
|
+
kind: z23.literal("group"),
|
|
2120
2318
|
group: identifier,
|
|
2121
|
-
title:
|
|
2319
|
+
title: z23.string()
|
|
2122
2320
|
})
|
|
2123
2321
|
]);
|
|
2124
2322
|
function completed(quest, options = {}) {
|
|
@@ -2146,33 +2344,33 @@ function inGroup(group) {
|
|
|
2146
2344
|
}
|
|
2147
2345
|
|
|
2148
2346
|
// src/schema.ts
|
|
2149
|
-
import { z as
|
|
2150
|
-
var pointsRewardSchema =
|
|
2151
|
-
kind:
|
|
2347
|
+
import { z as z24 } from "zod";
|
|
2348
|
+
var pointsRewardSchema = z24.object({
|
|
2349
|
+
kind: z24.literal("points").default("points"),
|
|
2152
2350
|
balance: identifier,
|
|
2153
|
-
amount:
|
|
2351
|
+
amount: z24.number().int().min(0).max(1e4)
|
|
2154
2352
|
}).strict();
|
|
2155
|
-
var tieredRewardDefinitionSchema =
|
|
2353
|
+
var tieredRewardDefinitionSchema = z24.object({
|
|
2156
2354
|
id: identifier,
|
|
2157
|
-
title:
|
|
2158
|
-
tiers:
|
|
2159
|
-
|
|
2355
|
+
title: z24.string().min(1).max(120),
|
|
2356
|
+
tiers: z24.array(
|
|
2357
|
+
z24.object({ id: identifier, title: z24.string().min(1).max(120) }).strict()
|
|
2160
2358
|
).min(1).max(20).refine(
|
|
2161
2359
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
2162
2360
|
"Tier IDs must be unique"
|
|
2163
2361
|
),
|
|
2164
|
-
inventory:
|
|
2165
|
-
fulfillment:
|
|
2166
|
-
|
|
2167
|
-
|
|
2362
|
+
inventory: z24.object({ kind: z24.literal("untracked") }).strict(),
|
|
2363
|
+
fulfillment: z24.discriminatedUnion("kind", [
|
|
2364
|
+
z24.object({ kind: z24.literal("staff-handover") }).strict(),
|
|
2365
|
+
z24.object({ kind: z24.literal("automatic") }).strict()
|
|
2168
2366
|
])
|
|
2169
2367
|
}).strict();
|
|
2170
|
-
var tieredRewardReferenceSchema =
|
|
2368
|
+
var tieredRewardReferenceSchema = z24.object({
|
|
2171
2369
|
id: identifier,
|
|
2172
2370
|
key: identifier.nullable()
|
|
2173
2371
|
});
|
|
2174
|
-
var tierRewardSchema =
|
|
2175
|
-
kind:
|
|
2372
|
+
var tierRewardSchema = z24.object({
|
|
2373
|
+
kind: z24.literal("tier"),
|
|
2176
2374
|
reward: tieredRewardDefinitionSchema,
|
|
2177
2375
|
tier: identifier
|
|
2178
2376
|
}).strict().refine(
|
|
@@ -2180,7 +2378,7 @@ var tierRewardSchema = z23.object({
|
|
|
2180
2378
|
"Unknown reward tier"
|
|
2181
2379
|
);
|
|
2182
2380
|
var integrationRewardSchema = discordRewardSchema;
|
|
2183
|
-
var rewardSchema =
|
|
2381
|
+
var rewardSchema = z24.union([
|
|
2184
2382
|
pointsRewardSchema,
|
|
2185
2383
|
tierRewardSchema,
|
|
2186
2384
|
integrationRewardSchema
|
|
@@ -2191,39 +2389,39 @@ function rewardKey(reward) {
|
|
|
2191
2389
|
}
|
|
2192
2390
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
2193
2391
|
}
|
|
2194
|
-
var triggerSchema =
|
|
2195
|
-
|
|
2196
|
-
kind:
|
|
2197
|
-
input:
|
|
2392
|
+
var triggerSchema = z24.union([
|
|
2393
|
+
z24.object({
|
|
2394
|
+
kind: z24.literal("manual"),
|
|
2395
|
+
input: z24.literal("text"),
|
|
2198
2396
|
constraints: textOptionsSchema,
|
|
2199
|
-
actor:
|
|
2397
|
+
actor: z24.enum(["member", "staff"]).optional()
|
|
2200
2398
|
}).strict(),
|
|
2201
|
-
|
|
2202
|
-
kind:
|
|
2203
|
-
input:
|
|
2399
|
+
z24.object({
|
|
2400
|
+
kind: z24.literal("manual"),
|
|
2401
|
+
input: z24.literal("url"),
|
|
2204
2402
|
constraints: urlOptionsSchema,
|
|
2205
|
-
actor:
|
|
2403
|
+
actor: z24.enum(["member", "staff"]).optional()
|
|
2206
2404
|
}).strict(),
|
|
2207
|
-
|
|
2208
|
-
kind:
|
|
2209
|
-
input:
|
|
2210
|
-
actor:
|
|
2405
|
+
z24.object({
|
|
2406
|
+
kind: z24.literal("manual"),
|
|
2407
|
+
input: z24.enum(["photo", "quiz", "none"]),
|
|
2408
|
+
actor: z24.enum(["member", "staff"]).optional()
|
|
2211
2409
|
}).strict(),
|
|
2212
|
-
|
|
2213
|
-
kind:
|
|
2410
|
+
z24.object({
|
|
2411
|
+
kind: z24.literal("automatic"),
|
|
2214
2412
|
tracker: trackerTriggerPolicySchema.optional()
|
|
2215
2413
|
}).strict()
|
|
2216
2414
|
]);
|
|
2217
|
-
var triggerResponseSchema =
|
|
2415
|
+
var triggerResponseSchema = z24.union(
|
|
2218
2416
|
triggerSchema.options.map((option) => option.strip())
|
|
2219
2417
|
);
|
|
2220
|
-
var photoResultSchema =
|
|
2221
|
-
kind:
|
|
2222
|
-
reason:
|
|
2418
|
+
var photoResultSchema = z24.object({
|
|
2419
|
+
kind: z24.enum(["pass", "fail", "unclear"]),
|
|
2420
|
+
reason: z24.string().min(1).max(2e3)
|
|
2223
2421
|
}).strict();
|
|
2224
|
-
var textReviewInputSchema =
|
|
2225
|
-
text:
|
|
2226
|
-
criteria:
|
|
2422
|
+
var textReviewInputSchema = z24.object({
|
|
2423
|
+
text: z24.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
2424
|
+
criteria: z24.string().trim().min(1).max(2e3)
|
|
2227
2425
|
}).strict();
|
|
2228
2426
|
var textResultSchema = photoResultSchema;
|
|
2229
2427
|
var deferPolicy = {
|
|
@@ -2233,53 +2431,53 @@ var deferPolicy = {
|
|
|
2233
2431
|
horizonMs: 864e5,
|
|
2234
2432
|
maxDefers: 100
|
|
2235
2433
|
};
|
|
2236
|
-
var evaluatorProgressSchema =
|
|
2237
|
-
current:
|
|
2238
|
-
target:
|
|
2239
|
-
reason:
|
|
2434
|
+
var evaluatorProgressSchema = z24.object({
|
|
2435
|
+
current: z24.number().finite().nonnegative(),
|
|
2436
|
+
target: z24.number().finite().positive(),
|
|
2437
|
+
reason: z24.string().min(1).max(2e3)
|
|
2240
2438
|
}).refine((value) => value.current <= value.target, {
|
|
2241
2439
|
message: "Progress current must not exceed target"
|
|
2242
2440
|
});
|
|
2243
|
-
var decisionSchema =
|
|
2244
|
-
|
|
2245
|
-
kind:
|
|
2246
|
-
reason:
|
|
2247
|
-
retryAfterMs:
|
|
2441
|
+
var decisionSchema = z24.discriminatedUnion("kind", [
|
|
2442
|
+
z24.strictObject({
|
|
2443
|
+
kind: z24.literal("defer"),
|
|
2444
|
+
reason: z24.string().min(1).max(2e3),
|
|
2445
|
+
retryAfterMs: z24.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
|
|
2248
2446
|
/** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
|
|
2249
|
-
until:
|
|
2447
|
+
until: z24.number().int().safe().nonnegative().optional()
|
|
2250
2448
|
}),
|
|
2251
|
-
evaluatorProgressSchema.safeExtend({ kind:
|
|
2252
|
-
|
|
2253
|
-
kind:
|
|
2254
|
-
rewards:
|
|
2449
|
+
evaluatorProgressSchema.safeExtend({ kind: z24.literal("progress") }).strict(),
|
|
2450
|
+
z24.object({
|
|
2451
|
+
kind: z24.literal("accept"),
|
|
2452
|
+
rewards: z24.array(rewardSchema).max(10),
|
|
2255
2453
|
completionKey: completionKeySchema.optional()
|
|
2256
2454
|
}).strict(),
|
|
2257
|
-
|
|
2258
|
-
kind:
|
|
2259
|
-
reason:
|
|
2455
|
+
z24.object({
|
|
2456
|
+
kind: z24.literal("reject"),
|
|
2457
|
+
reason: z24.string().min(1).max(2e3),
|
|
2260
2458
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
2261
|
-
requestedReview:
|
|
2459
|
+
requestedReview: z24.literal(true).optional()
|
|
2262
2460
|
}).strict(),
|
|
2263
|
-
|
|
2264
|
-
kind:
|
|
2265
|
-
reason:
|
|
2266
|
-
rewards:
|
|
2461
|
+
z24.object({
|
|
2462
|
+
kind: z24.literal("review"),
|
|
2463
|
+
reason: z24.string().min(1).max(2e3),
|
|
2464
|
+
rewards: z24.array(rewardSchema).max(10).optional(),
|
|
2267
2465
|
completionKey: completionKeySchema.optional()
|
|
2268
2466
|
}).strict()
|
|
2269
2467
|
]);
|
|
2270
|
-
var reviewModeSchema =
|
|
2271
|
-
var storedReviewModeSchema =
|
|
2468
|
+
var reviewModeSchema = z24.enum(["workers-ai"]);
|
|
2469
|
+
var storedReviewModeSchema = z24.enum([
|
|
2272
2470
|
"fixture-pass",
|
|
2273
2471
|
"fixture-fail",
|
|
2274
2472
|
"fixture-unclear",
|
|
2275
2473
|
"fixture-error",
|
|
2276
2474
|
"workers-ai"
|
|
2277
2475
|
]);
|
|
2278
|
-
var rewardBundleSchema =
|
|
2476
|
+
var rewardBundleSchema = z24.array(rewardSchema).max(10).refine(
|
|
2279
2477
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
2280
2478
|
"Use one entry per balance or shared reward"
|
|
2281
2479
|
);
|
|
2282
|
-
var mediaUrlSchema =
|
|
2480
|
+
var mediaUrlSchema = z24.string().max(2e3).refine((value) => {
|
|
2283
2481
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
2284
2482
|
return true;
|
|
2285
2483
|
}
|
|
@@ -2289,79 +2487,81 @@ var mediaUrlSchema = z23.string().max(2e3).refine((value) => {
|
|
|
2289
2487
|
return false;
|
|
2290
2488
|
}
|
|
2291
2489
|
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
2292
|
-
var questPresentationSchema =
|
|
2490
|
+
var questPresentationSchema = z24.object({
|
|
2293
2491
|
quiz: quizQuestionsSchema.optional(),
|
|
2294
|
-
instructions:
|
|
2295
|
-
video:
|
|
2492
|
+
instructions: z24.string().max(4e3).optional(),
|
|
2493
|
+
video: z24.object({
|
|
2296
2494
|
url: mediaUrlSchema,
|
|
2297
2495
|
poster: mediaUrlSchema.optional(),
|
|
2298
|
-
captions:
|
|
2496
|
+
captions: z24.object({
|
|
2299
2497
|
url: mediaUrlSchema,
|
|
2300
|
-
language:
|
|
2301
|
-
label:
|
|
2498
|
+
language: z24.string().min(2).max(20),
|
|
2499
|
+
label: z24.string().min(1).max(80)
|
|
2302
2500
|
}).strict().optional()
|
|
2303
2501
|
}).strict().optional()
|
|
2304
2502
|
}).strict();
|
|
2305
|
-
var questProfileSchema =
|
|
2503
|
+
var questProfileSchema = z24.object({ visible: z24.boolean() }).strict();
|
|
2306
2504
|
var evaluatorProtocol = 2;
|
|
2307
|
-
var evaluatorProtocolSchema =
|
|
2308
|
-
var questDescriptionSchema =
|
|
2505
|
+
var evaluatorProtocolSchema = z24.literal(evaluatorProtocol);
|
|
2506
|
+
var questDescriptionSchema = z24.object({
|
|
2309
2507
|
quest: identifier,
|
|
2310
2508
|
evaluatorProtocol: evaluatorProtocolSchema,
|
|
2311
|
-
title:
|
|
2509
|
+
title: z24.string().min(1).max(120),
|
|
2312
2510
|
presentation: questPresentationSchema.default({}),
|
|
2313
|
-
integrations:
|
|
2511
|
+
integrations: z24.array(evaluatorIntegrationProviderSchema).max(10).default([]),
|
|
2314
2512
|
fields: settingsFieldsSchema,
|
|
2315
2513
|
values: settingsValuesSchema,
|
|
2316
2514
|
rewards: rewardBundleSchema,
|
|
2317
|
-
humanReview:
|
|
2515
|
+
humanReview: z24.boolean(),
|
|
2318
2516
|
trigger: triggerSchema,
|
|
2319
2517
|
performance: contentPerformancePolicySchema.optional(),
|
|
2320
|
-
requires:
|
|
2518
|
+
requires: z24.array(prerequisiteSchema).max(30).default([]),
|
|
2321
2519
|
campaign: campaignDefinitionSchema.optional(),
|
|
2322
2520
|
availability: availabilityWindowSchema.optional(),
|
|
2323
|
-
completion:
|
|
2324
|
-
visibility:
|
|
2521
|
+
completion: z24.preprocess(refuseStreakTimeZone, completionPolicySchema),
|
|
2522
|
+
visibility: z24.enum(["visible", "hidden"]).default("visible"),
|
|
2325
2523
|
/** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
|
|
2326
2524
|
profile: questProfileSchema.default({ visible: false }),
|
|
2327
|
-
budgets:
|
|
2525
|
+
budgets: z24.array(budgetSchema).max(20).default([])
|
|
2328
2526
|
}).strict();
|
|
2329
|
-
var artifactSchema =
|
|
2527
|
+
var artifactSchema = z24.object({ code: z24.string().min(1).max(1e6) }).strict();
|
|
2330
2528
|
var releaseSchema = artifactSchema.extend({
|
|
2331
2529
|
settings: settingsValuesSchema,
|
|
2332
2530
|
provider: reviewModeSchema,
|
|
2333
2531
|
expectedRelease: identifier.nullable().optional(),
|
|
2334
|
-
settingRenames:
|
|
2532
|
+
settingRenames: z24.record(z24.string(), z24.string()).optional()
|
|
2335
2533
|
}).strict();
|
|
2336
|
-
var batchReleaseSchema =
|
|
2337
|
-
var questSettingsInputSchema =
|
|
2534
|
+
var batchReleaseSchema = z24.object({ releases: z24.array(releaseSchema).min(1).max(50) }).strict();
|
|
2535
|
+
var questSettingsInputSchema = z24.object({
|
|
2338
2536
|
quest: identifier,
|
|
2339
2537
|
expectedRelease: identifier,
|
|
2340
2538
|
set: settingsValuesSchema,
|
|
2341
|
-
reset:
|
|
2539
|
+
reset: z24.array(z24.string())
|
|
2342
2540
|
}).strict();
|
|
2343
2541
|
var storedQuestDescriptionSchema = questDescriptionSchema.extend({
|
|
2344
2542
|
completion: completionPolicySchema
|
|
2345
2543
|
});
|
|
2346
|
-
var publishedReleaseSchema =
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
})
|
|
2360
|
-
|
|
2361
|
-
|
|
2544
|
+
var publishedReleaseSchema = responseShape(
|
|
2545
|
+
storedQuestDescriptionSchema.extend({
|
|
2546
|
+
key: identifier.optional(),
|
|
2547
|
+
code: z24.string(),
|
|
2548
|
+
provider: storedReviewModeSchema,
|
|
2549
|
+
id: identifier,
|
|
2550
|
+
createdAt: z24.number(),
|
|
2551
|
+
origin: z24.object({ typeVersion: identifier }).strict().optional(),
|
|
2552
|
+
lifecycle: z24.enum(["active", "paused", "archived"]).default("active"),
|
|
2553
|
+
configuration: z24.object({
|
|
2554
|
+
defaults: settingsValuesSchema,
|
|
2555
|
+
overrides: settingsValuesSchema,
|
|
2556
|
+
preserved: z24.array(z24.string())
|
|
2557
|
+
}).strict().optional()
|
|
2558
|
+
})
|
|
2559
|
+
);
|
|
2560
|
+
var templateSchema = z24.object({
|
|
2561
|
+
code: z24.string(),
|
|
2362
2562
|
definition: questDescriptionSchema
|
|
2363
2563
|
});
|
|
2364
|
-
var quizAnswersSchema =
|
|
2564
|
+
var quizAnswersSchema = z24.record(identifier, identifier).refine(
|
|
2365
2565
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
2366
2566
|
"Provide between 1 and 50 answers"
|
|
2367
2567
|
).transform(
|
|
@@ -2369,17 +2569,17 @@ var quizAnswersSchema = z23.record(identifier, identifier).refine(
|
|
|
2369
2569
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
2370
2570
|
)
|
|
2371
2571
|
);
|
|
2372
|
-
var quizEvidenceSchema =
|
|
2373
|
-
kind:
|
|
2572
|
+
var quizEvidenceSchema = z24.object({
|
|
2573
|
+
kind: z24.literal("quiz"),
|
|
2374
2574
|
release: identifier.optional(),
|
|
2375
2575
|
answers: quizAnswersSchema
|
|
2376
2576
|
}).strict();
|
|
2377
|
-
var submissionEvidenceSchema =
|
|
2577
|
+
var submissionEvidenceSchema = z24.union([
|
|
2378
2578
|
quizEvidenceSchema,
|
|
2379
2579
|
textEvidenceSchema,
|
|
2380
2580
|
urlEvidenceSchema
|
|
2381
2581
|
]);
|
|
2382
|
-
var submitSchema =
|
|
2582
|
+
var submitSchema = z24.object({
|
|
2383
2583
|
actionId: identifier,
|
|
2384
2584
|
quest: identifier,
|
|
2385
2585
|
member: identifier,
|
|
@@ -2387,7 +2587,7 @@ var submitSchema = z23.object({
|
|
|
2387
2587
|
input: submissionEvidenceSchema.optional(),
|
|
2388
2588
|
release: identifier.optional(),
|
|
2389
2589
|
/** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
|
|
2390
|
-
faultAfterReview:
|
|
2590
|
+
faultAfterReview: z24.boolean().optional()
|
|
2391
2591
|
}).strict();
|
|
2392
2592
|
var AttemptStatus = {
|
|
2393
2593
|
Queued: "queued",
|
|
@@ -2399,8 +2599,8 @@ var AttemptStatus = {
|
|
|
2399
2599
|
NeedsReview: "needs-review",
|
|
2400
2600
|
Failed: "failed"
|
|
2401
2601
|
};
|
|
2402
|
-
var attemptStatusSchema =
|
|
2403
|
-
var attemptSchema =
|
|
2602
|
+
var attemptStatusSchema = z24.string();
|
|
2603
|
+
var attemptSchema = z24.object({
|
|
2404
2604
|
id: identifier,
|
|
2405
2605
|
release: identifier,
|
|
2406
2606
|
quest: identifier,
|
|
@@ -2408,83 +2608,83 @@ var attemptSchema = z23.object({
|
|
|
2408
2608
|
evidence: identifier.nullable(),
|
|
2409
2609
|
input: submissionEvidenceSchema.optional(),
|
|
2410
2610
|
status: attemptStatusSchema,
|
|
2411
|
-
reason:
|
|
2412
|
-
retries:
|
|
2413
|
-
generation:
|
|
2414
|
-
completion:
|
|
2611
|
+
reason: z24.string().nullable(),
|
|
2612
|
+
retries: z24.number(),
|
|
2613
|
+
generation: z24.number(),
|
|
2614
|
+
completion: z24.string().nullable(),
|
|
2415
2615
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
2416
2616
|
/** Scheduled reruns advance this number; failure retries preserve it. */
|
|
2417
|
-
evaluationRun:
|
|
2418
|
-
deferCount:
|
|
2419
|
-
deferUntil:
|
|
2420
|
-
nextEvaluationAt:
|
|
2617
|
+
evaluationRun: z24.number().int().nonnegative().default(0),
|
|
2618
|
+
deferCount: z24.number().int().nonnegative().default(0),
|
|
2619
|
+
deferUntil: z24.number().int().safe().nullable().default(null),
|
|
2620
|
+
nextEvaluationAt: z24.number().int().safe().nullable().default(null),
|
|
2421
2621
|
/** Open code: consumers must tolerate new values. */
|
|
2422
|
-
code:
|
|
2622
|
+
code: z24.string().nullable().default(null),
|
|
2423
2623
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
2424
2624
|
/**
|
|
2425
2625
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
2426
2626
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
2427
2627
|
*/
|
|
2428
|
-
requestedReview:
|
|
2429
|
-
createdAt:
|
|
2430
|
-
});
|
|
2431
|
-
var eventSchema =
|
|
2432
|
-
id:
|
|
2433
|
-
attempt:
|
|
2434
|
-
kind:
|
|
2435
|
-
detail:
|
|
2436
|
-
actor:
|
|
2437
|
-
at:
|
|
2438
|
-
});
|
|
2439
|
-
var pickupSelectionSchema =
|
|
2628
|
+
requestedReview: z24.boolean().default(false),
|
|
2629
|
+
createdAt: z24.number()
|
|
2630
|
+
});
|
|
2631
|
+
var eventSchema = z24.object({
|
|
2632
|
+
id: z24.number(),
|
|
2633
|
+
attempt: z24.string().nullable(),
|
|
2634
|
+
kind: z24.string(),
|
|
2635
|
+
detail: z24.string(),
|
|
2636
|
+
actor: z24.string().nullable().default(null),
|
|
2637
|
+
at: z24.number()
|
|
2638
|
+
});
|
|
2639
|
+
var pickupSelectionSchema = z24.object({
|
|
2440
2640
|
item: identifier,
|
|
2441
|
-
revision:
|
|
2641
|
+
revision: z24.number().int().nonnegative()
|
|
2442
2642
|
}).strict();
|
|
2443
|
-
var pickupAllocationSchema =
|
|
2643
|
+
var pickupAllocationSchema = z24.object({
|
|
2444
2644
|
item: identifier,
|
|
2445
|
-
label:
|
|
2645
|
+
label: z24.string().min(1).max(80)
|
|
2446
2646
|
}).strict();
|
|
2447
|
-
var pickupPolicySchema =
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
kind:
|
|
2451
|
-
tiers:
|
|
2452
|
-
|
|
2647
|
+
var pickupPolicySchema = z24.discriminatedUnion("kind", [
|
|
2648
|
+
z24.object({ kind: z24.literal("untracked") }).strict(),
|
|
2649
|
+
z24.object({
|
|
2650
|
+
kind: z24.literal("at-pickup"),
|
|
2651
|
+
tiers: z24.array(
|
|
2652
|
+
z24.object({
|
|
2453
2653
|
tier: identifier,
|
|
2454
|
-
variants:
|
|
2654
|
+
variants: z24.array(pickupAllocationSchema).min(1).max(100)
|
|
2455
2655
|
}).strict()
|
|
2456
2656
|
).min(1).max(100)
|
|
2457
2657
|
}).strict()
|
|
2458
2658
|
]);
|
|
2459
|
-
var pickupCatalogSchema =
|
|
2659
|
+
var pickupCatalogSchema = z24.object({
|
|
2460
2660
|
reward: tieredRewardDefinitionSchema,
|
|
2461
|
-
revision:
|
|
2661
|
+
revision: z24.number().int().nonnegative(),
|
|
2462
2662
|
policy: pickupPolicySchema
|
|
2463
2663
|
});
|
|
2464
|
-
var pickupAvailabilitySchema =
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
kind:
|
|
2468
|
-
revision:
|
|
2469
|
-
variants:
|
|
2664
|
+
var pickupAvailabilitySchema = z24.discriminatedUnion("kind", [
|
|
2665
|
+
z24.object({ kind: z24.literal("untracked") }).strict(),
|
|
2666
|
+
z24.object({
|
|
2667
|
+
kind: z24.literal("at-pickup"),
|
|
2668
|
+
revision: z24.number().int().nonnegative(),
|
|
2669
|
+
variants: z24.array(
|
|
2470
2670
|
pickupAllocationSchema.extend({
|
|
2471
|
-
available:
|
|
2671
|
+
available: z24.number().int().nonnegative()
|
|
2472
2672
|
})
|
|
2473
2673
|
)
|
|
2474
2674
|
}).strict()
|
|
2475
2675
|
]);
|
|
2476
|
-
var configurePickupSchema =
|
|
2676
|
+
var configurePickupSchema = z24.object({
|
|
2477
2677
|
reward: identifier,
|
|
2478
|
-
revision:
|
|
2678
|
+
revision: z24.number().int().nonnegative(),
|
|
2479
2679
|
actionId: identifier,
|
|
2480
|
-
policy:
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
kind:
|
|
2484
|
-
tiers:
|
|
2485
|
-
|
|
2680
|
+
policy: z24.discriminatedUnion("kind", [
|
|
2681
|
+
z24.object({ kind: z24.literal("untracked") }).strict(),
|
|
2682
|
+
z24.object({
|
|
2683
|
+
kind: z24.literal("at-pickup"),
|
|
2684
|
+
tiers: z24.array(
|
|
2685
|
+
z24.object({
|
|
2486
2686
|
tier: identifier,
|
|
2487
|
-
variants:
|
|
2687
|
+
variants: z24.array(
|
|
2488
2688
|
pickupAllocationSchema.extend({
|
|
2489
2689
|
item: identifier.optional()
|
|
2490
2690
|
})
|
|
@@ -2494,10 +2694,10 @@ var configurePickupSchema = z23.object({
|
|
|
2494
2694
|
}).strict()
|
|
2495
2695
|
])
|
|
2496
2696
|
}).strict();
|
|
2497
|
-
var entitlementRecoverySchema =
|
|
2697
|
+
var entitlementRecoverySchema = z24.object({
|
|
2498
2698
|
completion: identifier,
|
|
2499
|
-
reason:
|
|
2500
|
-
flaggedAt:
|
|
2699
|
+
reason: z24.string(),
|
|
2700
|
+
flaggedAt: z24.number(),
|
|
2501
2701
|
/** Null means no accepted completion currently earns this reward. */
|
|
2502
2702
|
remainingTier: identifier.nullable()
|
|
2503
2703
|
});
|
|
@@ -2507,40 +2707,40 @@ var entitlementBase = {
|
|
|
2507
2707
|
reward: tieredRewardDefinitionSchema,
|
|
2508
2708
|
earnedTier: identifier,
|
|
2509
2709
|
tier: identifier,
|
|
2510
|
-
revision:
|
|
2710
|
+
revision: z24.number().int().positive()
|
|
2511
2711
|
};
|
|
2512
|
-
var entitlementStateSchema =
|
|
2513
|
-
|
|
2514
|
-
|
|
2712
|
+
var entitlementStateSchema = z24.discriminatedUnion("status", [
|
|
2713
|
+
z24.object({ ...entitlementBase, status: z24.literal("available") }).strict(),
|
|
2714
|
+
z24.object({
|
|
2515
2715
|
...entitlementBase,
|
|
2516
|
-
status:
|
|
2716
|
+
status: z24.literal("handing-over"),
|
|
2517
2717
|
handover: identifier,
|
|
2518
|
-
startedAt:
|
|
2718
|
+
startedAt: z24.number(),
|
|
2519
2719
|
allocation: pickupAllocationSchema.optional()
|
|
2520
2720
|
}).strict(),
|
|
2521
|
-
|
|
2721
|
+
z24.object({
|
|
2522
2722
|
...entitlementBase,
|
|
2523
|
-
status:
|
|
2723
|
+
status: z24.literal("collected"),
|
|
2524
2724
|
handover: identifier,
|
|
2525
|
-
startedAt:
|
|
2725
|
+
startedAt: z24.number(),
|
|
2526
2726
|
allocation: pickupAllocationSchema.optional(),
|
|
2527
|
-
collectedAt:
|
|
2727
|
+
collectedAt: z24.number(),
|
|
2528
2728
|
recovery: entitlementRecoverySchema.optional()
|
|
2529
2729
|
}).strict(),
|
|
2530
2730
|
// An operator voided it: it can no longer be handed over. A quest grant of the same reward to
|
|
2531
2731
|
// the member (the same grant key) makes it available again; a voided referral reward stays void.
|
|
2532
|
-
|
|
2732
|
+
z24.object({
|
|
2533
2733
|
...entitlementBase,
|
|
2534
|
-
status:
|
|
2535
|
-
voidedAt:
|
|
2734
|
+
status: z24.literal("void"),
|
|
2735
|
+
voidedAt: z24.number()
|
|
2536
2736
|
}).strict()
|
|
2537
2737
|
]);
|
|
2538
|
-
var tieredRewardReadSchema =
|
|
2738
|
+
var tieredRewardReadSchema = z24.object({
|
|
2539
2739
|
id: identifier,
|
|
2540
|
-
title:
|
|
2541
|
-
tiers:
|
|
2542
|
-
inventory:
|
|
2543
|
-
fulfillment:
|
|
2740
|
+
title: z24.string(),
|
|
2741
|
+
tiers: z24.array(z24.object({ id: identifier, title: z24.string() }).loose()),
|
|
2742
|
+
inventory: z24.object({ kind: z24.string() }).loose(),
|
|
2743
|
+
fulfillment: z24.object({ kind: z24.string() }).loose()
|
|
2544
2744
|
}).loose();
|
|
2545
2745
|
var entitlementReadBase = {
|
|
2546
2746
|
id: identifier,
|
|
@@ -2548,63 +2748,63 @@ var entitlementReadBase = {
|
|
|
2548
2748
|
reward: tieredRewardReadSchema,
|
|
2549
2749
|
earnedTier: identifier,
|
|
2550
2750
|
tier: identifier,
|
|
2551
|
-
revision:
|
|
2751
|
+
revision: z24.number().int()
|
|
2552
2752
|
};
|
|
2553
|
-
var allocationReadSchema =
|
|
2554
|
-
var entitlementSchema =
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2753
|
+
var allocationReadSchema = z24.object({ item: identifier, label: z24.string() }).loose();
|
|
2754
|
+
var entitlementSchema = z24.union([
|
|
2755
|
+
z24.discriminatedUnion("status", [
|
|
2756
|
+
z24.object({ ...entitlementReadBase, status: z24.literal("available") }).loose(),
|
|
2757
|
+
z24.object({
|
|
2558
2758
|
...entitlementReadBase,
|
|
2559
|
-
status:
|
|
2759
|
+
status: z24.literal("handing-over"),
|
|
2560
2760
|
handover: identifier,
|
|
2561
|
-
startedAt:
|
|
2761
|
+
startedAt: z24.number(),
|
|
2562
2762
|
allocation: allocationReadSchema.optional()
|
|
2563
2763
|
}).loose(),
|
|
2564
|
-
|
|
2764
|
+
z24.object({
|
|
2565
2765
|
...entitlementReadBase,
|
|
2566
|
-
status:
|
|
2766
|
+
status: z24.literal("collected"),
|
|
2567
2767
|
handover: identifier,
|
|
2568
|
-
startedAt:
|
|
2768
|
+
startedAt: z24.number(),
|
|
2569
2769
|
allocation: allocationReadSchema.optional(),
|
|
2570
|
-
collectedAt:
|
|
2770
|
+
collectedAt: z24.number(),
|
|
2571
2771
|
recovery: entitlementRecoverySchema.optional()
|
|
2572
2772
|
}).loose(),
|
|
2573
|
-
|
|
2773
|
+
z24.object({
|
|
2574
2774
|
...entitlementReadBase,
|
|
2575
|
-
status:
|
|
2576
|
-
voidedAt:
|
|
2775
|
+
status: z24.literal("void"),
|
|
2776
|
+
voidedAt: z24.number()
|
|
2577
2777
|
}).loose()
|
|
2578
2778
|
]),
|
|
2579
|
-
|
|
2779
|
+
z24.object({ ...entitlementReadBase, status: z24.string() }).loose().transform(({ status, ...entitlement }) => ({
|
|
2580
2780
|
...entitlement,
|
|
2581
2781
|
status: "unsupported",
|
|
2582
2782
|
reportedStatus: status
|
|
2583
2783
|
}))
|
|
2584
2784
|
]);
|
|
2585
|
-
var beginHandoverSchema =
|
|
2785
|
+
var beginHandoverSchema = z24.object({
|
|
2586
2786
|
actionId: identifier,
|
|
2587
|
-
revision:
|
|
2787
|
+
revision: z24.number().int().positive(),
|
|
2588
2788
|
selection: pickupSelectionSchema.optional()
|
|
2589
2789
|
}).strict();
|
|
2590
|
-
var confirmHandoverSchema =
|
|
2591
|
-
var entitlementCorrectionSchema =
|
|
2790
|
+
var confirmHandoverSchema = z24.object({ actionId: identifier, handover: identifier }).strict();
|
|
2791
|
+
var entitlementCorrectionSchema = z24.object({
|
|
2592
2792
|
actionId: identifier,
|
|
2593
|
-
revision:
|
|
2594
|
-
reason:
|
|
2793
|
+
revision: z24.number().int().positive(),
|
|
2794
|
+
reason: z24.string().trim().min(1).max(500)
|
|
2595
2795
|
}).strict();
|
|
2596
2796
|
var CompletionSourceKind = {
|
|
2597
2797
|
Quest: "quest",
|
|
2598
2798
|
Leaderboard: "leaderboard"
|
|
2599
2799
|
};
|
|
2600
|
-
var completionSourceKindSchema =
|
|
2601
|
-
var completionSourceSchema =
|
|
2800
|
+
var completionSourceKindSchema = z24.string().min(1).max(64);
|
|
2801
|
+
var completionSourceSchema = z24.object({
|
|
2602
2802
|
kind: completionSourceKindSchema,
|
|
2603
2803
|
id: identifier
|
|
2604
2804
|
});
|
|
2605
|
-
var completionRecordSchema =
|
|
2805
|
+
var completionRecordSchema = z24.object({
|
|
2606
2806
|
/** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
|
|
2607
|
-
key:
|
|
2807
|
+
key: z24.string().default("once"),
|
|
2608
2808
|
id: identifier,
|
|
2609
2809
|
/** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
|
|
2610
2810
|
quest: identifier,
|
|
@@ -2612,19 +2812,19 @@ var completionRecordSchema = z23.object({
|
|
|
2612
2812
|
/** What paid the completion. `source.id` repeats `quest`. */
|
|
2613
2813
|
source: completionSourceSchema.optional()
|
|
2614
2814
|
});
|
|
2615
|
-
var questAvailabilitySchema =
|
|
2616
|
-
|
|
2617
|
-
kind:
|
|
2618
|
-
input:
|
|
2815
|
+
var questAvailabilitySchema = z24.discriminatedUnion("kind", [
|
|
2816
|
+
z24.object({
|
|
2817
|
+
kind: z24.literal("available"),
|
|
2818
|
+
input: z24.enum(["photo", "quiz", "none", "text", "url"])
|
|
2619
2819
|
}).strict(),
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
kind:
|
|
2623
|
-
missing:
|
|
2820
|
+
z24.object({ kind: z24.literal("completed") }).strict(),
|
|
2821
|
+
z24.object({
|
|
2822
|
+
kind: z24.literal("locked"),
|
|
2823
|
+
missing: z24.array(missingPrerequisiteSchema).min(1)
|
|
2624
2824
|
}).strict(),
|
|
2625
|
-
|
|
2626
|
-
kind:
|
|
2627
|
-
reason:
|
|
2825
|
+
z24.object({
|
|
2826
|
+
kind: z24.literal("blocked"),
|
|
2827
|
+
reason: z24.enum([
|
|
2628
2828
|
"budget-exhausted",
|
|
2629
2829
|
"connection-required",
|
|
2630
2830
|
"wallet-required",
|
|
@@ -2633,140 +2833,144 @@ var questAvailabilitySchema = z23.discriminatedUnion("kind", [
|
|
|
2633
2833
|
"enrollment-required"
|
|
2634
2834
|
]),
|
|
2635
2835
|
/** Which window refused admission when `reason` is `outside-window`. */
|
|
2636
|
-
window:
|
|
2637
|
-
resetsAt:
|
|
2836
|
+
window: z24.enum(["tracker", "quest"]).optional(),
|
|
2837
|
+
resetsAt: z24.number().int().safe().optional()
|
|
2638
2838
|
}).strict(),
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2839
|
+
z24.object({ kind: z24.literal("staff-required") }).strict(),
|
|
2840
|
+
z24.object({ kind: z24.literal("automatic") }).strict(),
|
|
2841
|
+
z24.object({ kind: z24.literal("checking"), attempt: identifier }).strict(),
|
|
2842
|
+
z24.object({ kind: z24.literal("needs-review"), attempt: identifier }).strict(),
|
|
2843
|
+
z24.object({ kind: z24.literal("retryable"), attempt: identifier }).strict()
|
|
2644
2844
|
]);
|
|
2645
|
-
var questAvailabilityResponseSchema =
|
|
2845
|
+
var questAvailabilityResponseSchema = z24.union(
|
|
2646
2846
|
questAvailabilitySchema.options.map((option) => option.strip())
|
|
2647
2847
|
);
|
|
2648
|
-
var questBudgetViewSchema =
|
|
2848
|
+
var questBudgetViewSchema = z24.object({
|
|
2649
2849
|
id: identifier,
|
|
2650
|
-
scope:
|
|
2651
|
-
period:
|
|
2652
|
-
remaining:
|
|
2653
|
-
resetsAt:
|
|
2654
|
-
});
|
|
2655
|
-
var memberProgressSchema = z23.object({
|
|
2656
|
-
member: identifier,
|
|
2657
|
-
quests: z23.array(
|
|
2658
|
-
z23.object({
|
|
2659
|
-
quest: identifier,
|
|
2660
|
-
key: identifier.optional(),
|
|
2661
|
-
release: identifier.optional(),
|
|
2662
|
-
title: z23.string(),
|
|
2663
|
-
presentation: questPresentationSchema.default({}),
|
|
2664
|
-
connections: z23.array(authProviderSchema).default([]),
|
|
2665
|
-
trigger: triggerResponseSchema,
|
|
2666
|
-
availability: questAvailabilityResponseSchema,
|
|
2667
|
-
completed: z23.boolean(),
|
|
2668
|
-
completion: completionPolicySchema.default({ kind: "once" }),
|
|
2669
|
-
streak: streakProgressSchema.nullable().optional(),
|
|
2670
|
-
counter: counterProgressSchema.nullable().optional(),
|
|
2671
|
-
/** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
|
|
2672
|
-
progress: evaluatorProgressSchema.nullable().default(null),
|
|
2673
|
-
completionCount: z23.number().int().nonnegative().default(0),
|
|
2674
|
-
visibility: z23.enum(["visible", "hidden"]).default("visible"),
|
|
2675
|
-
missing: z23.array(missingPrerequisiteSchema),
|
|
2676
|
-
campaign: campaignViewSchema.nullable().default(null),
|
|
2677
|
-
window: availabilityWindowSchema.nullable().default(null),
|
|
2678
|
-
budgets: z23.array(questBudgetViewSchema).default([]),
|
|
2679
|
-
attempt: attemptSchema.nullable()
|
|
2680
|
-
})
|
|
2681
|
-
),
|
|
2682
|
-
entitlements: z23.array(entitlementSchema)
|
|
2683
|
-
});
|
|
2684
|
-
var snapshotSchema = z23.object({
|
|
2685
|
-
releases: z23.array(publishedReleaseSchema),
|
|
2686
|
-
completions: z23.array(completionRecordSchema),
|
|
2687
|
-
entitlements: z23.array(entitlementSchema),
|
|
2688
|
-
attempts: z23.array(attemptSchema),
|
|
2689
|
-
balances: z23.array(
|
|
2690
|
-
z23.object({
|
|
2691
|
-
member: z23.string(),
|
|
2692
|
-
balance: z23.string(),
|
|
2693
|
-
earned: z23.number(),
|
|
2694
|
-
held: z23.number(),
|
|
2695
|
-
available: z23.number()
|
|
2696
|
-
})
|
|
2697
|
-
),
|
|
2698
|
-
events: z23.array(eventSchema)
|
|
2850
|
+
scope: z24.enum(["member", "project"]),
|
|
2851
|
+
period: z24.enum(["day", "week", "month", "lifetime"]),
|
|
2852
|
+
remaining: z24.number().int().safe().nonnegative(),
|
|
2853
|
+
resetsAt: z24.number().int().safe().nullable()
|
|
2699
2854
|
});
|
|
2700
|
-
var
|
|
2855
|
+
var memberProgressSchema = responseShape(
|
|
2856
|
+
z24.object({
|
|
2857
|
+
member: identifier,
|
|
2858
|
+
quests: z24.array(
|
|
2859
|
+
z24.object({
|
|
2860
|
+
quest: identifier,
|
|
2861
|
+
key: identifier.optional(),
|
|
2862
|
+
release: identifier.optional(),
|
|
2863
|
+
title: z24.string(),
|
|
2864
|
+
presentation: questPresentationSchema.default({}),
|
|
2865
|
+
connections: z24.array(authProviderSchema).default([]),
|
|
2866
|
+
trigger: triggerResponseSchema,
|
|
2867
|
+
availability: questAvailabilityResponseSchema,
|
|
2868
|
+
completed: z24.boolean(),
|
|
2869
|
+
completion: completionPolicySchema.default({ kind: "once" }),
|
|
2870
|
+
streak: streakProgressSchema.nullable().optional(),
|
|
2871
|
+
counter: counterProgressSchema.nullable().optional(),
|
|
2872
|
+
/** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
|
|
2873
|
+
progress: evaluatorProgressSchema.nullable().default(null),
|
|
2874
|
+
completionCount: z24.number().int().nonnegative().default(0),
|
|
2875
|
+
visibility: z24.enum(["visible", "hidden"]).default("visible"),
|
|
2876
|
+
missing: z24.array(missingPrerequisiteSchema),
|
|
2877
|
+
campaign: campaignViewSchema.nullable().default(null),
|
|
2878
|
+
window: availabilityWindowSchema.nullable().default(null),
|
|
2879
|
+
budgets: z24.array(questBudgetViewSchema).default([]),
|
|
2880
|
+
attempt: attemptSchema.nullable()
|
|
2881
|
+
})
|
|
2882
|
+
),
|
|
2883
|
+
entitlements: z24.array(entitlementSchema)
|
|
2884
|
+
})
|
|
2885
|
+
);
|
|
2886
|
+
var snapshotSchema = responseShape(
|
|
2887
|
+
z24.object({
|
|
2888
|
+
releases: z24.array(publishedReleaseSchema),
|
|
2889
|
+
completions: z24.array(completionRecordSchema),
|
|
2890
|
+
entitlements: z24.array(entitlementSchema),
|
|
2891
|
+
attempts: z24.array(attemptSchema),
|
|
2892
|
+
balances: z24.array(
|
|
2893
|
+
z24.object({
|
|
2894
|
+
member: z24.string(),
|
|
2895
|
+
balance: z24.string(),
|
|
2896
|
+
earned: z24.number(),
|
|
2897
|
+
held: z24.number(),
|
|
2898
|
+
available: z24.number()
|
|
2899
|
+
})
|
|
2900
|
+
),
|
|
2901
|
+
events: z24.array(eventSchema)
|
|
2902
|
+
})
|
|
2903
|
+
);
|
|
2904
|
+
var evidenceSchema = z24.object({
|
|
2701
2905
|
id: identifier,
|
|
2702
2906
|
member: identifier,
|
|
2703
|
-
type:
|
|
2704
|
-
size:
|
|
2907
|
+
type: z24.enum(["image/jpeg", "image/png"]),
|
|
2908
|
+
size: z24.number()
|
|
2705
2909
|
});
|
|
2706
|
-
var errorSchema =
|
|
2707
|
-
error:
|
|
2708
|
-
code:
|
|
2910
|
+
var errorSchema = z24.object({
|
|
2911
|
+
error: z24.string(),
|
|
2912
|
+
code: z24.string().optional(),
|
|
2709
2913
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
2710
|
-
window:
|
|
2711
|
-
missing:
|
|
2914
|
+
window: z24.enum(["tracker", "quest"]).optional(),
|
|
2915
|
+
missing: z24.array(missingPrerequisiteSchema).optional()
|
|
2712
2916
|
});
|
|
2713
|
-
var staffDecisionSchema =
|
|
2917
|
+
var staffDecisionSchema = z24.object({
|
|
2714
2918
|
actionId: identifier,
|
|
2715
|
-
generation:
|
|
2716
|
-
decision:
|
|
2717
|
-
reason:
|
|
2919
|
+
generation: z24.number().int().nonnegative(),
|
|
2920
|
+
decision: z24.enum(["accept", "reject"]),
|
|
2921
|
+
reason: z24.string().trim().min(1).max(2e3)
|
|
2718
2922
|
}).strict();
|
|
2719
|
-
var stockSchema =
|
|
2720
|
-
var reservationSchema =
|
|
2923
|
+
var stockSchema = z24.object({ item: identifier, quantity: z24.number().int().min(0).max(1e4) }).strict();
|
|
2924
|
+
var reservationSchema = z24.object({
|
|
2721
2925
|
actionId: identifier,
|
|
2722
2926
|
member: identifier,
|
|
2723
2927
|
item: identifier,
|
|
2724
2928
|
balance: identifier,
|
|
2725
|
-
price:
|
|
2929
|
+
price: z24.number().int().positive().max(1e4)
|
|
2726
2930
|
}).strict();
|
|
2727
2931
|
var pageOptions = {
|
|
2728
|
-
limit:
|
|
2729
|
-
cursor:
|
|
2932
|
+
limit: z24.number().int().min(1).max(100).default(25),
|
|
2933
|
+
cursor: z24.string().min(1).max(4096).optional()
|
|
2730
2934
|
};
|
|
2731
|
-
var reviewListSchema =
|
|
2935
|
+
var reviewListSchema = z24.object({
|
|
2732
2936
|
...pageOptions,
|
|
2733
2937
|
member: identifier.optional(),
|
|
2734
2938
|
quest: identifier.optional()
|
|
2735
2939
|
}).strict();
|
|
2736
|
-
var memberListSchema =
|
|
2940
|
+
var memberListSchema = z24.object({
|
|
2737
2941
|
...pageOptions,
|
|
2738
2942
|
prefix: identifier.optional()
|
|
2739
2943
|
}).strict();
|
|
2740
|
-
var reviewItemSchema =
|
|
2944
|
+
var reviewItemSchema = z24.object({
|
|
2741
2945
|
attempt: attemptSchema,
|
|
2742
|
-
title:
|
|
2743
|
-
checks:
|
|
2744
|
-
|
|
2946
|
+
title: z24.string(),
|
|
2947
|
+
checks: z24.array(
|
|
2948
|
+
z24.object({ criteria: z24.string(), result: photoResultSchema })
|
|
2745
2949
|
)
|
|
2746
2950
|
});
|
|
2747
|
-
var reviewPageSchema =
|
|
2748
|
-
items:
|
|
2749
|
-
nextCursor:
|
|
2951
|
+
var reviewPageSchema = z24.object({
|
|
2952
|
+
items: z24.array(reviewItemSchema).max(100),
|
|
2953
|
+
nextCursor: z24.string().nullable()
|
|
2750
2954
|
});
|
|
2751
|
-
var memberPageSchema =
|
|
2752
|
-
items:
|
|
2753
|
-
nextCursor:
|
|
2955
|
+
var memberPageSchema = z24.object({
|
|
2956
|
+
items: z24.array(z24.object({ member: identifier })).max(100),
|
|
2957
|
+
nextCursor: z24.string().nullable()
|
|
2754
2958
|
});
|
|
2755
|
-
var createStockItemSchema =
|
|
2756
|
-
var stockItemSchema =
|
|
2757
|
-
var contentPerformanceSnapshotSchema =
|
|
2959
|
+
var createStockItemSchema = z24.object({ actionId: identifier, name: z24.string().trim().min(1).max(80) }).strict();
|
|
2960
|
+
var stockItemSchema = z24.object({ id: identifier, name: z24.string() });
|
|
2961
|
+
var contentPerformanceSnapshotSchema = z24.strictObject({
|
|
2758
2962
|
contentAttempt: identifier,
|
|
2759
2963
|
observation: identifier,
|
|
2760
|
-
observedAt:
|
|
2964
|
+
observedAt: z24.number().int().safe().nonnegative(),
|
|
2761
2965
|
metrics: contentMetricsSchema,
|
|
2762
2966
|
rewards: rewardBundleSchema
|
|
2763
2967
|
});
|
|
2764
2968
|
var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
|
|
2765
|
-
content:
|
|
2969
|
+
content: z24.string().min(1).max(256)
|
|
2766
2970
|
});
|
|
2767
|
-
var contentPerformancePageSchema =
|
|
2768
|
-
current:
|
|
2769
|
-
state:
|
|
2971
|
+
var contentPerformancePageSchema = z24.strictObject({
|
|
2972
|
+
current: z24.strictObject({
|
|
2973
|
+
state: z24.enum([
|
|
2770
2974
|
"content-pending",
|
|
2771
2975
|
"content-unqualified",
|
|
2772
2976
|
"waiting",
|
|
@@ -2777,19 +2981,19 @@ var contentPerformancePageSchema = z23.strictObject({
|
|
|
2777
2981
|
"failed",
|
|
2778
2982
|
"superseded"
|
|
2779
2983
|
]),
|
|
2780
|
-
reason:
|
|
2984
|
+
reason: z24.string().nullable(),
|
|
2781
2985
|
contentAttempt: identifier,
|
|
2782
2986
|
attempt: identifier.nullable(),
|
|
2783
2987
|
reward: contentQualificationSchema.shape.reward
|
|
2784
2988
|
}),
|
|
2785
|
-
items:
|
|
2786
|
-
|
|
2989
|
+
items: z24.array(
|
|
2990
|
+
z24.strictObject({
|
|
2787
2991
|
attempt: identifier,
|
|
2788
2992
|
contentAttempt: identifier,
|
|
2789
2993
|
observation: identifier,
|
|
2790
|
-
observedAt:
|
|
2994
|
+
observedAt: z24.number(),
|
|
2791
2995
|
metrics: contentMetricsSchema,
|
|
2792
|
-
state:
|
|
2996
|
+
state: z24.enum([
|
|
2793
2997
|
"pending",
|
|
2794
2998
|
"qualified",
|
|
2795
2999
|
"unqualified",
|
|
@@ -2797,13 +3001,18 @@ var contentPerformancePageSchema = z23.strictObject({
|
|
|
2797
3001
|
"failed",
|
|
2798
3002
|
"superseded"
|
|
2799
3003
|
]),
|
|
2800
|
-
reason:
|
|
3004
|
+
reason: z24.string().nullable()
|
|
2801
3005
|
})
|
|
2802
3006
|
),
|
|
2803
3007
|
nextCursor: pageCursorSchema.nullable()
|
|
2804
3008
|
});
|
|
2805
3009
|
|
|
2806
3010
|
export {
|
|
3011
|
+
markResponseSchema,
|
|
3012
|
+
responseShape,
|
|
3013
|
+
knownResponse,
|
|
3014
|
+
responseSchema,
|
|
3015
|
+
responseListSchema,
|
|
2807
3016
|
pageCursorSchema,
|
|
2808
3017
|
pageQuerySchema,
|
|
2809
3018
|
authProviderSchema,
|