@domino-sdk/relay 1.0.0-next.7 → 1.0.0-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring.d.ts +11 -11
- package/dist/authoring.js +2 -2
- package/dist/avatar.d.ts +2 -2
- package/dist/browser.d.ts +217 -2285
- package/dist/browser.js +6 -6
- package/dist/{chunk-AWLLGCKU.js → chunk-6A6K5RUD.js} +22 -8
- package/dist/{chunk-SKETUPST.js → chunk-77H7APVD.js} +1 -1
- package/dist/{chunk-UFXBQ6FN.js → chunk-MRIURJE3.js} +2 -2
- package/dist/{chunk-ADSP377G.js → chunk-QBOHLT7M.js} +26 -5
- package/dist/{chunk-X6FJIPXR.js → chunk-V5R2DMGY.js} +553 -435
- package/dist/{chunk-DJZB5RY5.js → chunk-V7EZUZ3Z.js} +345 -243
- package/dist/{chunk-UW6R2QGT.js → chunk-VARGF4JS.js} +619 -610
- package/dist/{chunk-7HSTFBMO.js → chunk-ZWY3R6B3.js} +5 -3
- package/dist/{client-BufGakEt.d.ts → client-CK4nwt7V.d.ts} +307 -2253
- package/dist/{images-e6FW9QSx.d.ts → images--vZ9U0kr.d.ts} +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +19 -7
- package/dist/internal.d.ts +16 -5
- package/dist/internal.js +12 -5
- package/dist/{catalog-C09gnPYT.d.ts → pages-BzqJuI69.d.ts} +79 -21
- package/dist/portal-proxy.js +6 -6
- package/dist/{profiles-BtOXMGcC.d.ts → profiles-DDMFBRKe.d.ts} +1 -1
- package/dist/react/index.d.ts +156 -2224
- package/dist/react/index.js +12 -10
- package/dist/{schema-DCapSPHz.d.ts → schema-pnuWqvGn.d.ts} +8 -8
- package/dist/schema.d.ts +64 -64
- package/dist/schema.js +15 -5
- package/dist/{submission-input-Bter6XiI.d.ts → submission-input-C9qm9ixd.d.ts} +8 -8
- package/dist/{wallet-Bu6sqJvQ.d.ts → wallet-BGOfFkG9.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -27,22 +27,29 @@ var discordMemberSchema = z.object({
|
|
|
27
27
|
import { z as z2 } from "zod";
|
|
28
28
|
var identifier = z2.string().min(1).max(100).regex(/^[a-zA-Z0-9_-]+$/);
|
|
29
29
|
|
|
30
|
-
// src/
|
|
30
|
+
// src/pages.ts
|
|
31
31
|
import { z as z3 } from "zod";
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
32
|
+
var pageCursorSchema = z3.string().min(1).max(4096);
|
|
33
|
+
var pageQuerySchema = z3.strictObject({
|
|
34
|
+
cursor: pageCursorSchema.optional()
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// src/trackers.ts
|
|
38
|
+
import { z as z4 } from "zod";
|
|
39
|
+
var timestamp = z4.number().int().safe().nonnegative().max(864e13);
|
|
40
|
+
var count = z4.number().int().safe().nonnegative();
|
|
41
|
+
var externalId = z4.string().min(1).max(256);
|
|
35
42
|
var metric = count.nullable().default(null);
|
|
36
|
-
var xTweetSchema =
|
|
43
|
+
var xTweetSchema = z4.looseObject({
|
|
37
44
|
id: externalId,
|
|
38
45
|
userId: externalId,
|
|
39
|
-
content:
|
|
40
|
-
createdAt:
|
|
41
|
-
author:
|
|
46
|
+
content: z4.string(),
|
|
47
|
+
createdAt: z4.iso.datetime({ offset: true }),
|
|
48
|
+
author: z4.looseObject({
|
|
42
49
|
id: externalId,
|
|
43
|
-
username:
|
|
44
|
-
name:
|
|
45
|
-
verified:
|
|
50
|
+
username: z4.string(),
|
|
51
|
+
name: z4.string(),
|
|
52
|
+
verified: z4.boolean().nullable().default(null)
|
|
46
53
|
}),
|
|
47
54
|
likeCount: metric,
|
|
48
55
|
replyCount: metric,
|
|
@@ -50,90 +57,90 @@ var xTweetSchema = z3.looseObject({
|
|
|
50
57
|
quoteCount: metric,
|
|
51
58
|
viewCount: metric,
|
|
52
59
|
bookmarkCount: metric,
|
|
53
|
-
isReply:
|
|
54
|
-
isRetweet:
|
|
55
|
-
isQuoteTweet:
|
|
60
|
+
isReply: z4.boolean(),
|
|
61
|
+
isRetweet: z4.boolean(),
|
|
62
|
+
isQuoteTweet: z4.boolean()
|
|
56
63
|
});
|
|
57
|
-
var xContentBodySchema =
|
|
58
|
-
version:
|
|
59
|
-
id:
|
|
60
|
-
authorId:
|
|
64
|
+
var xContentBodySchema = z4.strictObject({
|
|
65
|
+
version: z4.literal(1),
|
|
66
|
+
id: z4.string().min(1),
|
|
67
|
+
authorId: z4.string().min(1),
|
|
61
68
|
publishedAt: timestamp,
|
|
62
|
-
text:
|
|
63
|
-
isReply:
|
|
64
|
-
isRetweet:
|
|
65
|
-
isQuoteTweet:
|
|
66
|
-
media:
|
|
67
|
-
mentionedAuthorIds:
|
|
68
|
-
videoLengthSeconds:
|
|
69
|
-
references:
|
|
70
|
-
replyId:
|
|
71
|
-
replyAuthorId:
|
|
72
|
-
quoteId:
|
|
73
|
-
quoteAuthorId:
|
|
74
|
-
repostId:
|
|
75
|
-
repostAuthorId:
|
|
69
|
+
text: z4.string(),
|
|
70
|
+
isReply: z4.boolean(),
|
|
71
|
+
isRetweet: z4.boolean(),
|
|
72
|
+
isQuoteTweet: z4.boolean(),
|
|
73
|
+
media: z4.array(z4.strictObject({ type: z4.string(), url: z4.string() })).nullable(),
|
|
74
|
+
mentionedAuthorIds: z4.array(z4.string().min(1)).nullable(),
|
|
75
|
+
videoLengthSeconds: z4.number().nonnegative().nullable(),
|
|
76
|
+
references: z4.strictObject({
|
|
77
|
+
replyId: z4.string().nullable(),
|
|
78
|
+
replyAuthorId: z4.string().nullable(),
|
|
79
|
+
quoteId: z4.string().nullable(),
|
|
80
|
+
quoteAuthorId: z4.string().nullable(),
|
|
81
|
+
repostId: z4.string().nullable(),
|
|
82
|
+
repostAuthorId: z4.string().nullable()
|
|
76
83
|
})
|
|
77
84
|
});
|
|
78
|
-
var trackerContentQuerySchema =
|
|
85
|
+
var trackerContentQuerySchema = z4.strictObject({
|
|
79
86
|
id: externalId,
|
|
80
|
-
observation:
|
|
87
|
+
observation: z4.string().regex(/^observation_[a-f0-9]{64}$/)
|
|
81
88
|
});
|
|
82
89
|
var trackerContentReadSchema = trackerContentQuerySchema.extend({
|
|
83
90
|
member: identifier
|
|
84
91
|
});
|
|
85
92
|
var attributionContext = { member: identifier, capturedAt: timestamp };
|
|
86
|
-
var trackerEvidenceSchema =
|
|
93
|
+
var trackerEvidenceSchema = z4.strictObject({
|
|
87
94
|
contentRevision: identifier,
|
|
88
95
|
observation: identifier
|
|
89
96
|
});
|
|
90
|
-
var trackerContentSchema =
|
|
97
|
+
var trackerContentSchema = z4.strictObject({
|
|
91
98
|
tracker: identifier,
|
|
92
|
-
source:
|
|
99
|
+
source: z4.literal("x"),
|
|
93
100
|
evidence: trackerEvidenceSchema,
|
|
94
101
|
content: xContentBodySchema,
|
|
95
102
|
observedAt: timestamp,
|
|
96
|
-
removed:
|
|
97
|
-
attribution:
|
|
98
|
-
|
|
103
|
+
removed: z4.boolean(),
|
|
104
|
+
attribution: z4.discriminatedUnion("kind", [
|
|
105
|
+
z4.strictObject({
|
|
99
106
|
...attributionContext,
|
|
100
|
-
kind:
|
|
101
|
-
account:
|
|
102
|
-
provider:
|
|
103
|
-
issuer:
|
|
107
|
+
kind: z4.literal("linked"),
|
|
108
|
+
account: z4.strictObject({
|
|
109
|
+
provider: z4.literal("x"),
|
|
110
|
+
issuer: z4.string().min(1),
|
|
104
111
|
subject: externalId,
|
|
105
112
|
revision: count,
|
|
106
113
|
linkedAt: timestamp.nullable()
|
|
107
114
|
})
|
|
108
115
|
}),
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
z4.strictObject({ ...attributionContext, kind: z4.literal("unlinked") }),
|
|
117
|
+
z4.strictObject({
|
|
111
118
|
...attributionContext,
|
|
112
|
-
kind:
|
|
119
|
+
kind: z4.literal("different-author")
|
|
113
120
|
})
|
|
114
121
|
])
|
|
115
122
|
});
|
|
116
|
-
var identityKindSchema =
|
|
117
|
-
var accountRoleSchema =
|
|
123
|
+
var identityKindSchema = z4.enum(["wallet", "x", "discord", "member"]);
|
|
124
|
+
var accountRoleSchema = z4.string().regex(
|
|
118
125
|
/^[a-zA-Z][a-zA-Z0-9_]{0,39}$/,
|
|
119
126
|
"Name roles like author or recipient: a letter, then letters, digits or underscores"
|
|
120
127
|
);
|
|
121
128
|
var xAccountRoles = ["author", "inReplyTo"];
|
|
122
129
|
var distinct = (values) => new Set(values).size === values.length;
|
|
123
|
-
var xSearchSourceSchema =
|
|
124
|
-
kind:
|
|
125
|
-
query:
|
|
130
|
+
var xSearchSourceSchema = z4.object({
|
|
131
|
+
kind: z4.literal("x-search"),
|
|
132
|
+
query: z4.string().trim().min(1).max(2e3)
|
|
126
133
|
}).strict();
|
|
127
|
-
var customSourceSchema =
|
|
128
|
-
kind:
|
|
134
|
+
var customSourceSchema = z4.object({
|
|
135
|
+
kind: z4.literal("custom"),
|
|
129
136
|
namespace: identifier,
|
|
130
137
|
/**
|
|
131
138
|
* The identity kinds a record's author and named accounts can be, attributed to members
|
|
132
139
|
* through verified links. Omitted when authors are opaque IDs, which no quest can pay.
|
|
133
140
|
*/
|
|
134
|
-
identities:
|
|
141
|
+
identities: z4.array(identityKindSchema).min(1).max(4).refine(distinct, "List each identity kind once").optional(),
|
|
135
142
|
/** Roles of the named accounts records can carry besides their author, such as `recipient`. */
|
|
136
|
-
accounts:
|
|
143
|
+
accounts: z4.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
|
|
137
144
|
(roles) => !roles.includes("author"),
|
|
138
145
|
"author is every record's own role; name other accounts"
|
|
139
146
|
).optional(),
|
|
@@ -143,7 +150,7 @@ var customSourceSchema = z3.object({
|
|
|
143
150
|
*
|
|
144
151
|
* @deprecated Use `identities: ["wallet"]`.
|
|
145
152
|
*/
|
|
146
|
-
authors:
|
|
153
|
+
authors: z4.literal("wallet").optional()
|
|
147
154
|
}).strict().refine(
|
|
148
155
|
(source) => !(source.authors && source.identities),
|
|
149
156
|
"Use identities, not authors"
|
|
@@ -151,7 +158,7 @@ var customSourceSchema = z3.object({
|
|
|
151
158
|
(source) => !source.accounts || source.identities,
|
|
152
159
|
"Named accounts need identities"
|
|
153
160
|
);
|
|
154
|
-
var trackerSourceSchema =
|
|
161
|
+
var trackerSourceSchema = z4.discriminatedUnion("kind", [
|
|
155
162
|
xSearchSourceSchema,
|
|
156
163
|
customSourceSchema
|
|
157
164
|
]);
|
|
@@ -161,83 +168,83 @@ function sourceIdentities(source) {
|
|
|
161
168
|
}
|
|
162
169
|
return source.identities ?? (source.authors === "wallet" ? ["wallet"] : void 0);
|
|
163
170
|
}
|
|
164
|
-
var windowSchema =
|
|
171
|
+
var windowSchema = z4.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
|
|
165
172
|
(w) => w.end === void 0 || w.end > w.start,
|
|
166
173
|
"End must follow start"
|
|
167
174
|
);
|
|
168
|
-
var trackerDefinitionSchema =
|
|
175
|
+
var trackerDefinitionSchema = z4.object({
|
|
169
176
|
key: identifier,
|
|
170
|
-
title:
|
|
177
|
+
title: z4.string().trim().min(1).max(120),
|
|
171
178
|
source: trackerSourceSchema,
|
|
172
179
|
window: windowSchema,
|
|
173
|
-
refreshSeconds:
|
|
174
|
-
maxPages:
|
|
180
|
+
refreshSeconds: z4.number().int().min(300).max(86400).default(21600),
|
|
181
|
+
maxPages: z4.number().int().min(1).max(1e3).default(60)
|
|
175
182
|
}).strict();
|
|
176
|
-
var trackerArtifactSchema =
|
|
183
|
+
var trackerArtifactSchema = z4.union([
|
|
177
184
|
trackerDefinitionSchema,
|
|
178
|
-
|
|
185
|
+
z4.object({ code: z4.string().min(1).max(2e6) }).strict()
|
|
179
186
|
]);
|
|
180
|
-
var publishedTrackerSchema =
|
|
187
|
+
var publishedTrackerSchema = z4.object({
|
|
181
188
|
id: identifier,
|
|
182
189
|
version: identifier,
|
|
183
190
|
definition: trackerDefinitionSchema,
|
|
184
191
|
publishedAt: timestamp,
|
|
185
|
-
actor:
|
|
192
|
+
actor: z4.string().nullable()
|
|
186
193
|
});
|
|
187
|
-
var trackerStatusSchema =
|
|
194
|
+
var trackerStatusSchema = z4.object({
|
|
188
195
|
published: publishedTrackerSchema,
|
|
189
|
-
paused:
|
|
190
|
-
state:
|
|
196
|
+
paused: z4.boolean(),
|
|
197
|
+
state: z4.enum(["idle", "syncing", "error", "complete"]),
|
|
191
198
|
lastStartedAt: timestamp.nullable(),
|
|
192
199
|
lastCompletedAt: timestamp.nullable(),
|
|
193
200
|
nextSyncAt: timestamp.nullable(),
|
|
194
|
-
coverage:
|
|
195
|
-
error:
|
|
201
|
+
coverage: z4.enum(["unknown", "partial", "complete"]),
|
|
202
|
+
error: z4.string().nullable(),
|
|
196
203
|
records: count
|
|
197
204
|
});
|
|
198
|
-
var trackerControlSchema =
|
|
205
|
+
var trackerControlSchema = z4.object({
|
|
199
206
|
actionId: identifier,
|
|
200
|
-
action:
|
|
207
|
+
action: z4.enum(["pause", "resume", "refresh"])
|
|
201
208
|
}).strict();
|
|
202
|
-
var trackerAccountSchema =
|
|
209
|
+
var trackerAccountSchema = z4.strictObject({
|
|
203
210
|
kind: identityKindSchema.optional(),
|
|
204
211
|
id: externalId
|
|
205
212
|
});
|
|
206
|
-
var trackerRecordInputSchema =
|
|
213
|
+
var trackerRecordInputSchema = z4.object({
|
|
207
214
|
id: externalId,
|
|
208
215
|
occurredAt: timestamp,
|
|
209
216
|
observedAt: timestamp,
|
|
210
|
-
author:
|
|
217
|
+
author: z4.object({
|
|
211
218
|
id: externalId,
|
|
212
|
-
verified:
|
|
219
|
+
verified: z4.boolean().nullable().default(null),
|
|
213
220
|
/** The author's identity kind; needed when the source names more than one. */
|
|
214
221
|
kind: identityKindSchema.optional()
|
|
215
222
|
}).strict().nullable().default(null),
|
|
216
223
|
/** Named accounts besides the author, by the roles the custom source declares. */
|
|
217
|
-
accounts:
|
|
224
|
+
accounts: z4.record(accountRoleSchema, trackerAccountSchema).refine(
|
|
218
225
|
(accounts) => Object.keys(accounts).length <= 10,
|
|
219
226
|
"At most 10 accounts"
|
|
220
227
|
).optional(),
|
|
221
|
-
data:
|
|
222
|
-
removed:
|
|
228
|
+
data: z4.record(z4.string(), z4.json()),
|
|
229
|
+
removed: z4.boolean().default(false)
|
|
223
230
|
}).strict().refine(
|
|
224
231
|
(v) => new TextEncoder().encode(JSON.stringify(v.data)).byteLength <= 131072,
|
|
225
232
|
"Record exceeds 128 KB"
|
|
226
233
|
);
|
|
227
234
|
var trackerRecordSchema = trackerRecordInputSchema.safeExtend({
|
|
228
|
-
source:
|
|
235
|
+
source: z4.string(),
|
|
229
236
|
firstSeenAt: timestamp,
|
|
230
237
|
/** Present only when includeEvidence is true; custom sources have no X evidence. */
|
|
231
238
|
evidence: trackerEvidenceSchema.nullable().optional()
|
|
232
239
|
});
|
|
233
|
-
var trackerIngestSchema =
|
|
240
|
+
var trackerIngestSchema = z4.object({
|
|
234
241
|
actionId: identifier,
|
|
235
|
-
records:
|
|
242
|
+
records: z4.array(trackerRecordInputSchema).min(1).max(100)
|
|
236
243
|
}).strict();
|
|
237
|
-
var trackerIngestResultSchema =
|
|
244
|
+
var trackerIngestResultSchema = z4.object({
|
|
238
245
|
stored: count,
|
|
239
246
|
/** Tracker-trigger decisions this ingest caused. Absent from servers without tracker triggers. */
|
|
240
|
-
admissions:
|
|
247
|
+
admissions: z4.object({
|
|
241
248
|
admitted: count,
|
|
242
249
|
skipped: count,
|
|
243
250
|
/**
|
|
@@ -258,11 +265,11 @@ var trackerOutcomeFields = {
|
|
|
258
265
|
/** The release admitted, or the one active when the observation was skipped. */
|
|
259
266
|
release: identifier,
|
|
260
267
|
/** The account attribution resolved or failed to resolve, such as a CAIP-10 wallet ID. */
|
|
261
|
-
account:
|
|
268
|
+
account: z4.string().nullable(),
|
|
262
269
|
createdAt: timestamp,
|
|
263
270
|
updatedAt: timestamp,
|
|
264
271
|
/** Null for automatic decisions; the staff actor after a retry. */
|
|
265
|
-
actor:
|
|
272
|
+
actor: z4.string().nullable()
|
|
266
273
|
};
|
|
267
274
|
var trackerSkipCodes = [
|
|
268
275
|
/** The quest is paused or no longer active. */
|
|
@@ -290,84 +297,84 @@ var trackerSkipCodes = [
|
|
|
290
297
|
/** The attributed member has not completed the quest's prerequisites. */
|
|
291
298
|
"prerequisites-incomplete"
|
|
292
299
|
];
|
|
293
|
-
var trackerOutcomeSchema =
|
|
294
|
-
|
|
300
|
+
var trackerOutcomeSchema = z4.discriminatedUnion("state", [
|
|
301
|
+
z4.strictObject({
|
|
295
302
|
...trackerOutcomeFields,
|
|
296
|
-
state:
|
|
297
|
-
code:
|
|
298
|
-
reason:
|
|
303
|
+
state: z4.literal("admitted"),
|
|
304
|
+
code: z4.null(),
|
|
305
|
+
reason: z4.null(),
|
|
299
306
|
/** The attributed member. */
|
|
300
307
|
member: identifier,
|
|
301
308
|
/** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
|
|
302
309
|
attempt: identifier
|
|
303
310
|
}),
|
|
304
|
-
|
|
311
|
+
z4.strictObject({
|
|
305
312
|
...trackerOutcomeFields,
|
|
306
|
-
state:
|
|
313
|
+
state: z4.literal("skipped"),
|
|
307
314
|
/** Why the observation was skipped, as one of `trackerSkipCodes`. */
|
|
308
|
-
code:
|
|
315
|
+
code: z4.string().min(1),
|
|
309
316
|
/** Why the observation was skipped, for people. */
|
|
310
|
-
reason:
|
|
317
|
+
reason: z4.string(),
|
|
311
318
|
/** The attributed member, when attribution got that far. */
|
|
312
319
|
member: identifier.nullable(),
|
|
313
320
|
attempt: identifier.nullable()
|
|
314
321
|
})
|
|
315
322
|
]);
|
|
316
|
-
var trackerOutcomeQuerySchema =
|
|
323
|
+
var trackerOutcomeQuerySchema = z4.strictObject({
|
|
317
324
|
/** Quest key or ID. */
|
|
318
325
|
quest: identifier.optional(),
|
|
319
326
|
record: externalId.optional(),
|
|
320
327
|
member: identifier.optional(),
|
|
321
|
-
state:
|
|
328
|
+
state: z4.enum(["admitted", "skipped"]).optional(),
|
|
322
329
|
/** Only skips with this code, such as `unlinked-account`. */
|
|
323
|
-
code:
|
|
324
|
-
limit:
|
|
330
|
+
code: z4.string().min(1).max(100).optional(),
|
|
331
|
+
limit: z4.coerce.number().int().min(1).max(100).default(25),
|
|
325
332
|
/** Opaque cursor from `next`: older outcomes. */
|
|
326
|
-
before:
|
|
333
|
+
before: z4.string().max(512).optional()
|
|
327
334
|
});
|
|
328
|
-
var trackerOutcomePageSchema =
|
|
335
|
+
var trackerOutcomePageSchema = z4.strictObject({
|
|
329
336
|
/** Newest first. */
|
|
330
|
-
items:
|
|
331
|
-
next:
|
|
337
|
+
items: z4.array(trackerOutcomeSchema).max(100),
|
|
338
|
+
next: z4.string().nullable()
|
|
332
339
|
});
|
|
333
|
-
var trackerOutcomeRetrySchema =
|
|
340
|
+
var trackerOutcomeRetrySchema = z4.strictObject({
|
|
334
341
|
actionId: identifier,
|
|
335
342
|
/** Quest key or ID. */
|
|
336
343
|
quest: identifier,
|
|
337
344
|
record: externalId,
|
|
338
345
|
observedAt: timestamp
|
|
339
346
|
});
|
|
340
|
-
var booleanQuery =
|
|
341
|
-
|
|
342
|
-
|
|
347
|
+
var booleanQuery = z4.union([
|
|
348
|
+
z4.boolean(),
|
|
349
|
+
z4.enum(["true", "false"]).transform((v) => v === "true")
|
|
343
350
|
]);
|
|
344
|
-
var trackerQuerySchema =
|
|
351
|
+
var trackerQuerySchema = z4.object({
|
|
345
352
|
author: externalId.optional(),
|
|
346
353
|
member: identifier.optional(),
|
|
347
354
|
verified: booleanQuery.optional(),
|
|
348
|
-
since:
|
|
349
|
-
until:
|
|
355
|
+
since: z4.coerce.number().int().safe().nonnegative().optional(),
|
|
356
|
+
until: z4.coerce.number().int().safe().nonnegative().optional(),
|
|
350
357
|
removed: booleanQuery.default(false),
|
|
351
|
-
minLikes:
|
|
352
|
-
minViews:
|
|
353
|
-
limit:
|
|
354
|
-
cursor:
|
|
358
|
+
minLikes: z4.coerce.number().int().safe().nonnegative().optional(),
|
|
359
|
+
minViews: z4.coerce.number().int().safe().nonnegative().optional(),
|
|
360
|
+
limit: z4.coerce.number().int().min(1).max(100).default(25),
|
|
361
|
+
cursor: z4.string().max(2048).optional(),
|
|
355
362
|
includeEvidence: booleanQuery.optional()
|
|
356
363
|
}).strict().refine(
|
|
357
364
|
(q) => q.since === void 0 || q.until === void 0 || q.until > q.since,
|
|
358
365
|
"Until must follow since"
|
|
359
366
|
);
|
|
360
|
-
var trackerPageSchema =
|
|
367
|
+
var trackerPageSchema = z4.object({
|
|
361
368
|
tracker: identifier,
|
|
362
|
-
items:
|
|
363
|
-
nextCursor:
|
|
369
|
+
items: z4.array(trackerRecordSchema),
|
|
370
|
+
nextCursor: z4.string().nullable(),
|
|
364
371
|
total: count,
|
|
365
372
|
status: trackerStatusSchema
|
|
366
373
|
});
|
|
367
|
-
var trackerSummarySchema =
|
|
374
|
+
var trackerSummarySchema = z4.object({
|
|
368
375
|
records: count,
|
|
369
376
|
authors: count,
|
|
370
|
-
metrics:
|
|
377
|
+
metrics: z4.object({
|
|
371
378
|
likes: count,
|
|
372
379
|
replies: count,
|
|
373
380
|
reposts: count,
|
|
@@ -383,31 +390,31 @@ var trackerPreviewLimits = {
|
|
|
383
390
|
posts: 100,
|
|
384
391
|
days: 30
|
|
385
392
|
};
|
|
386
|
-
var trackerPreviewInputSchema =
|
|
393
|
+
var trackerPreviewInputSchema = z4.object({
|
|
387
394
|
query: xSearchSourceSchema.shape.query,
|
|
388
395
|
/** Start of the searched window. The window ends when the sample is fetched. */
|
|
389
396
|
since: timestamp
|
|
390
397
|
}).strict();
|
|
391
|
-
var trackerPreviewSchema =
|
|
392
|
-
query:
|
|
398
|
+
var trackerPreviewSchema = z4.object({
|
|
399
|
+
query: z4.string(),
|
|
393
400
|
since: timestamp,
|
|
394
401
|
fetchedAt: timestamp,
|
|
395
402
|
pages: count,
|
|
396
403
|
/** Every match in the sample, newest first, verified or not. */
|
|
397
|
-
posts:
|
|
404
|
+
posts: z4.array(xTweetSchema).max(trackerPreviewLimits.posts),
|
|
398
405
|
/** X had more matches than the sample holds. */
|
|
399
|
-
more:
|
|
406
|
+
more: z4.boolean()
|
|
400
407
|
});
|
|
401
408
|
|
|
402
409
|
// src/content.ts
|
|
403
|
-
import { z as
|
|
404
|
-
var timestamp2 =
|
|
405
|
-
var contentPolicySchema =
|
|
410
|
+
import { z as z5 } from "zod";
|
|
411
|
+
var timestamp2 = z5.number().int().safe().nonnegative().max(864e13);
|
|
412
|
+
var contentPolicySchema = z5.strictObject({
|
|
406
413
|
tracker: identifier,
|
|
407
414
|
window: trackerDefinitionSchema.shape.window,
|
|
408
|
-
enrollment:
|
|
409
|
-
posts:
|
|
410
|
-
historical:
|
|
415
|
+
enrollment: z5.enum(["none", "required"]).default("none"),
|
|
416
|
+
posts: z5.enum(["after-enrollment", "since-start"]).default("after-enrollment"),
|
|
417
|
+
historical: z5.enum(["automatic", "claim", "staff"]).default("claim")
|
|
411
418
|
});
|
|
412
419
|
var admittedContentSchema = xContentBodySchema.extend({
|
|
413
420
|
tracker: identifier,
|
|
@@ -415,59 +422,59 @@ var admittedContentSchema = xContentBodySchema.extend({
|
|
|
415
422
|
observation: identifier,
|
|
416
423
|
attribution: trackerContentSchema.shape.attribution.options[0],
|
|
417
424
|
enrolledAt: timestamp2.nullable(),
|
|
418
|
-
completionKey:
|
|
425
|
+
completionKey: z5.string().min(1).max(200)
|
|
419
426
|
});
|
|
420
|
-
var contentEnrollmentInputSchema =
|
|
427
|
+
var contentEnrollmentInputSchema = z5.strictObject({
|
|
421
428
|
actionId: identifier,
|
|
422
429
|
quest: identifier,
|
|
423
430
|
member: identifier
|
|
424
431
|
});
|
|
425
|
-
var contentEnrollmentSchema =
|
|
432
|
+
var contentEnrollmentSchema = z5.strictObject({
|
|
426
433
|
quest: identifier,
|
|
427
434
|
member: identifier,
|
|
428
435
|
enrolledAt: timestamp2
|
|
429
436
|
});
|
|
430
437
|
var contentReleaseInputSchema = contentEnrollmentInputSchema.extend({
|
|
431
|
-
content:
|
|
438
|
+
content: z5.string().min(1).max(256)
|
|
432
439
|
});
|
|
433
|
-
var contentAdmissionSchema =
|
|
440
|
+
var contentAdmissionSchema = z5.strictObject({
|
|
434
441
|
quest: identifier,
|
|
435
|
-
content:
|
|
442
|
+
content: z5.string().min(1).max(256),
|
|
436
443
|
release: identifier,
|
|
437
|
-
state:
|
|
438
|
-
reason:
|
|
444
|
+
state: z5.enum(["pending", "admitted", "excluded"]),
|
|
445
|
+
reason: z5.string().nullable(),
|
|
439
446
|
attempt: identifier.nullable()
|
|
440
447
|
});
|
|
441
|
-
var contentAdmissionQuerySchema =
|
|
448
|
+
var contentAdmissionQuerySchema = z5.strictObject({
|
|
442
449
|
quest: identifier,
|
|
443
450
|
member: identifier.optional(),
|
|
444
|
-
content:
|
|
445
|
-
|
|
451
|
+
content: z5.string().min(1).max(256).optional(),
|
|
452
|
+
cursor: pageCursorSchema.optional()
|
|
446
453
|
});
|
|
447
|
-
var contentAdmissionPageSchema =
|
|
448
|
-
items:
|
|
449
|
-
|
|
454
|
+
var contentAdmissionPageSchema = z5.strictObject({
|
|
455
|
+
items: z5.array(contentAdmissionSchema),
|
|
456
|
+
nextCursor: pageCursorSchema.nullable()
|
|
450
457
|
});
|
|
451
|
-
var contentQualificationDecisionSchema =
|
|
452
|
-
kind:
|
|
453
|
-
reason:
|
|
458
|
+
var contentQualificationDecisionSchema = z5.strictObject({
|
|
459
|
+
kind: z5.enum(["accept", "reject", "review", "superseded"]),
|
|
460
|
+
reason: z5.string().nullable()
|
|
454
461
|
});
|
|
455
|
-
var contentQualificationQuerySchema =
|
|
462
|
+
var contentQualificationQuerySchema = z5.strictObject({
|
|
456
463
|
quest: identifier,
|
|
457
464
|
member: identifier.optional(),
|
|
458
|
-
content:
|
|
459
|
-
|
|
465
|
+
content: z5.string().min(1).max(256).optional(),
|
|
466
|
+
cursor: pageCursorSchema.optional()
|
|
460
467
|
});
|
|
461
|
-
var contentQualificationSchema =
|
|
468
|
+
var contentQualificationSchema = z5.strictObject({
|
|
462
469
|
quest: identifier,
|
|
463
|
-
content:
|
|
470
|
+
content: z5.string(),
|
|
464
471
|
member: identifier,
|
|
465
472
|
release: identifier,
|
|
466
473
|
attempt: identifier,
|
|
467
474
|
revision: identifier,
|
|
468
475
|
observation: identifier,
|
|
469
|
-
current:
|
|
470
|
-
state:
|
|
476
|
+
current: z5.boolean(),
|
|
477
|
+
state: z5.enum([
|
|
471
478
|
"pending",
|
|
472
479
|
"qualified",
|
|
473
480
|
"unqualified",
|
|
@@ -478,18 +485,18 @@ var contentQualificationSchema = z4.strictObject({
|
|
|
478
485
|
"blocked",
|
|
479
486
|
"unavailable"
|
|
480
487
|
]),
|
|
481
|
-
reason:
|
|
482
|
-
reward:
|
|
488
|
+
reason: z5.string().nullable(),
|
|
489
|
+
reward: z5.strictObject({
|
|
483
490
|
attempt: identifier.nullable(),
|
|
484
491
|
completion: identifier.nullable(),
|
|
485
|
-
state:
|
|
492
|
+
state: z5.enum(["unresolved", "awarded", "excluded"])
|
|
486
493
|
})
|
|
487
494
|
});
|
|
488
|
-
var contentQualificationPageSchema =
|
|
489
|
-
items:
|
|
490
|
-
|
|
495
|
+
var contentQualificationPageSchema = z5.strictObject({
|
|
496
|
+
items: z5.array(contentQualificationSchema),
|
|
497
|
+
nextCursor: pageCursorSchema.nullable()
|
|
491
498
|
});
|
|
492
|
-
var contentMetricSchema =
|
|
499
|
+
var contentMetricSchema = z5.enum([
|
|
493
500
|
"likes",
|
|
494
501
|
"replies",
|
|
495
502
|
"reposts",
|
|
@@ -497,21 +504,21 @@ var contentMetricSchema = z4.enum([
|
|
|
497
504
|
"views",
|
|
498
505
|
"bookmarks"
|
|
499
506
|
]);
|
|
500
|
-
var contentMetricsSchema =
|
|
507
|
+
var contentMetricsSchema = z5.partialRecord(
|
|
501
508
|
contentMetricSchema,
|
|
502
|
-
|
|
509
|
+
z5.number().int().safe().nonnegative()
|
|
503
510
|
);
|
|
504
|
-
var contentPerformancePolicySchema =
|
|
505
|
-
metrics:
|
|
511
|
+
var contentPerformancePolicySchema = z5.strictObject({
|
|
512
|
+
metrics: z5.array(contentMetricSchema).min(1).max(6).refine(
|
|
506
513
|
(values) => new Set(values).size === values.length,
|
|
507
514
|
"Metrics must be unique"
|
|
508
515
|
),
|
|
509
|
-
maxAgeMs:
|
|
516
|
+
maxAgeMs: z5.number().int().positive().max(864e5).default(36e5)
|
|
510
517
|
});
|
|
511
518
|
|
|
512
519
|
// src/streaks.ts
|
|
513
|
-
import { z as
|
|
514
|
-
var communityTimeZoneSchema =
|
|
520
|
+
import { z as z6 } from "zod";
|
|
521
|
+
var communityTimeZoneSchema = z6.string().min(1).max(100).refine((zone) => {
|
|
515
522
|
try {
|
|
516
523
|
if (/^[+-]/.test(zone)) {
|
|
517
524
|
return false;
|
|
@@ -522,51 +529,51 @@ var communityTimeZoneSchema = z5.string().min(1).max(100).refine((zone) => {
|
|
|
522
529
|
return false;
|
|
523
530
|
}
|
|
524
531
|
}, "Use an IANA community timezone, such as Europe/Budapest");
|
|
525
|
-
var streakPolicySchema =
|
|
526
|
-
kind:
|
|
527
|
-
days:
|
|
532
|
+
var streakPolicySchema = z6.object({
|
|
533
|
+
kind: z6.literal("streak"),
|
|
534
|
+
days: z6.number().int().min(1).max(3650),
|
|
528
535
|
timeZone: communityTimeZoneSchema
|
|
529
536
|
}).strict();
|
|
530
|
-
var streakProgressSchema =
|
|
531
|
-
goal:
|
|
532
|
-
current:
|
|
533
|
-
best:
|
|
534
|
-
today:
|
|
535
|
-
todayQualified:
|
|
537
|
+
var streakProgressSchema = z6.object({
|
|
538
|
+
goal: z6.number().int().positive(),
|
|
539
|
+
current: z6.number().int().nonnegative(),
|
|
540
|
+
best: z6.number().int().nonnegative(),
|
|
541
|
+
today: z6.string(),
|
|
542
|
+
todayQualified: z6.boolean(),
|
|
536
543
|
timeZone: communityTimeZoneSchema,
|
|
537
|
-
nextBoundary:
|
|
538
|
-
pendingTimeZone:
|
|
544
|
+
nextBoundary: z6.number().int(),
|
|
545
|
+
pendingTimeZone: z6.object({
|
|
539
546
|
timeZone: communityTimeZoneSchema,
|
|
540
|
-
effectiveAt:
|
|
547
|
+
effectiveAt: z6.number().int()
|
|
541
548
|
}).nullable(),
|
|
542
|
-
days:
|
|
543
|
-
|
|
544
|
-
day:
|
|
545
|
-
date:
|
|
549
|
+
days: z6.array(
|
|
550
|
+
z6.object({
|
|
551
|
+
day: z6.number().int(),
|
|
552
|
+
date: z6.string(),
|
|
546
553
|
timeZone: communityTimeZoneSchema,
|
|
547
|
-
occurredAt:
|
|
554
|
+
occurredAt: z6.number().int()
|
|
548
555
|
})
|
|
549
556
|
),
|
|
550
|
-
milestone:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
status:
|
|
554
|
-
completion:
|
|
555
|
-
achievedAt:
|
|
557
|
+
milestone: z6.discriminatedUnion("status", [
|
|
558
|
+
z6.object({ status: z6.literal("pending") }),
|
|
559
|
+
z6.object({
|
|
560
|
+
status: z6.literal("awarded"),
|
|
561
|
+
completion: z6.string(),
|
|
562
|
+
achievedAt: z6.number().int()
|
|
556
563
|
}),
|
|
557
|
-
|
|
558
|
-
status:
|
|
559
|
-
budget:
|
|
560
|
-
achievedAt:
|
|
564
|
+
z6.object({
|
|
565
|
+
status: z6.literal("budget-exhausted"),
|
|
566
|
+
budget: z6.string(),
|
|
567
|
+
achievedAt: z6.number().int()
|
|
561
568
|
})
|
|
562
569
|
])
|
|
563
570
|
});
|
|
564
571
|
|
|
565
572
|
// src/tracker-triggers.ts
|
|
566
|
-
import { z as
|
|
567
|
-
var timestamp3 =
|
|
568
|
-
var count2 =
|
|
569
|
-
var trackerTriggerModeSchema =
|
|
573
|
+
import { z as z7 } from "zod";
|
|
574
|
+
var timestamp3 = z7.number().int().safe().nonnegative().max(864e13);
|
|
575
|
+
var count2 = z7.number().int().safe().nonnegative();
|
|
576
|
+
var trackerTriggerModeSchema = z7.enum([
|
|
570
577
|
"new-record",
|
|
571
578
|
"new-observation",
|
|
572
579
|
"data-changed"
|
|
@@ -574,20 +581,20 @@ var trackerTriggerModeSchema = z6.enum([
|
|
|
574
581
|
function defaultTriggerMode(source) {
|
|
575
582
|
return source === "x-search" ? "new-record" : "new-observation";
|
|
576
583
|
}
|
|
577
|
-
var trackerBoundSchema =
|
|
578
|
-
|
|
579
|
-
|
|
584
|
+
var trackerBoundSchema = z7.union([
|
|
585
|
+
z7.number().finite(),
|
|
586
|
+
z7.strictObject({ setting: z7.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
|
|
580
587
|
]);
|
|
581
|
-
var dataPath =
|
|
588
|
+
var dataPath = z7.string().max(200).regex(
|
|
582
589
|
/^[^.\s]+(\.[^.\s]+)*$/,
|
|
583
590
|
"Use dot-separated keys, such as metrics.likes"
|
|
584
591
|
);
|
|
585
|
-
var trackerWhereSchema =
|
|
586
|
-
|
|
592
|
+
var trackerWhereSchema = z7.union([
|
|
593
|
+
z7.strictObject({
|
|
587
594
|
path: dataPath,
|
|
588
|
-
equals:
|
|
595
|
+
equals: z7.union([z7.string().max(1e3), z7.number().finite(), z7.boolean()])
|
|
589
596
|
}),
|
|
590
|
-
|
|
597
|
+
z7.strictObject({
|
|
591
598
|
path: dataPath,
|
|
592
599
|
gt: trackerBoundSchema.optional(),
|
|
593
600
|
gte: trackerBoundSchema.optional(),
|
|
@@ -600,10 +607,10 @@ var trackerWhereSchema = z6.union([
|
|
|
600
607
|
"Compare with equals, gt, gte, lt or lte"
|
|
601
608
|
)
|
|
602
609
|
]);
|
|
603
|
-
var trackerTriggerPolicySchema =
|
|
610
|
+
var trackerTriggerPolicySchema = z7.strictObject({
|
|
604
611
|
/** The tracker's authoring key; publication binds it to the tracker's stable ID. */
|
|
605
612
|
tracker: identifier,
|
|
606
|
-
source:
|
|
613
|
+
source: z7.enum(["x-search", "custom"]),
|
|
607
614
|
/** Which observations fire; absent means the source's default (`defaultTriggerMode`). */
|
|
608
615
|
on: trackerTriggerModeSchema.optional(),
|
|
609
616
|
where: trackerWhereSchema.optional(),
|
|
@@ -612,7 +619,7 @@ var trackerTriggerPolicySchema = z6.strictObject({
|
|
|
612
619
|
* a custom record. Relay attributes it through verified links; evaluators cannot redirect it.
|
|
613
620
|
* Releases published before account roles store `"replied-to"` for `inReplyTo`.
|
|
614
621
|
*/
|
|
615
|
-
beneficiary:
|
|
622
|
+
beneficiary: z7.union([accountRoleSchema, z7.literal("replied-to")])
|
|
616
623
|
});
|
|
617
624
|
function triggerMode(policy) {
|
|
618
625
|
return policy.on ?? defaultTriggerMode(policy.source);
|
|
@@ -621,52 +628,52 @@ function beneficiaryRole(policy) {
|
|
|
621
628
|
return policy.beneficiary === "replied-to" ? "inReplyTo" : policy.beneficiary;
|
|
622
629
|
}
|
|
623
630
|
var xLink = {
|
|
624
|
-
issuer:
|
|
631
|
+
issuer: z7.string().min(1),
|
|
625
632
|
/** The account's stable user ID. */
|
|
626
|
-
subject:
|
|
633
|
+
subject: z7.string().min(1).max(256),
|
|
627
634
|
/** The member's account selection revision. */
|
|
628
635
|
revision: count2,
|
|
629
636
|
/** When the member linked the account; null when unknown. */
|
|
630
637
|
linkedAt: timestamp3.nullable()
|
|
631
638
|
};
|
|
632
|
-
var trackerAttributionSchema =
|
|
639
|
+
var trackerAttributionSchema = z7.strictObject({
|
|
633
640
|
member: identifier,
|
|
634
641
|
capturedAt: timestamp3,
|
|
635
|
-
account:
|
|
636
|
-
|
|
637
|
-
provider:
|
|
642
|
+
account: z7.discriminatedUnion("provider", [
|
|
643
|
+
z7.strictObject({
|
|
644
|
+
provider: z7.literal("wallet"),
|
|
638
645
|
/** Canonical CAIP-10 account ID, as the record names it. */
|
|
639
|
-
id:
|
|
646
|
+
id: z7.string().min(5).max(256),
|
|
640
647
|
/** The wallet link's revision. */
|
|
641
648
|
revision: count2,
|
|
642
649
|
/** When the member verified the wallet. */
|
|
643
650
|
linkedAt: timestamp3.nullable()
|
|
644
651
|
}),
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
provider:
|
|
652
|
+
z7.strictObject({ provider: z7.literal("x"), ...xLink }),
|
|
653
|
+
z7.strictObject({ provider: z7.literal("discord"), ...xLink }),
|
|
654
|
+
z7.strictObject({
|
|
655
|
+
provider: z7.literal("member"),
|
|
649
656
|
/** The member ID the record names. */
|
|
650
657
|
id: identifier
|
|
651
658
|
})
|
|
652
659
|
])
|
|
653
660
|
});
|
|
654
|
-
var trackerTriggerRecordSchema =
|
|
655
|
-
id:
|
|
656
|
-
source:
|
|
661
|
+
var trackerTriggerRecordSchema = z7.strictObject({
|
|
662
|
+
id: z7.string().min(1).max(256),
|
|
663
|
+
source: z7.string(),
|
|
657
664
|
occurredAt: timestamp3,
|
|
658
665
|
observedAt: timestamp3,
|
|
659
666
|
firstSeenAt: timestamp3,
|
|
660
|
-
author:
|
|
661
|
-
id:
|
|
662
|
-
verified:
|
|
667
|
+
author: z7.strictObject({
|
|
668
|
+
id: z7.string().min(1).max(256),
|
|
669
|
+
verified: z7.boolean().nullable(),
|
|
663
670
|
kind: identityKindSchema.optional()
|
|
664
671
|
}).nullable(),
|
|
665
|
-
accounts:
|
|
666
|
-
data:
|
|
667
|
-
removed:
|
|
672
|
+
accounts: z7.record(accountRoleSchema, trackerAccountSchema).optional(),
|
|
673
|
+
data: z7.record(z7.string(), z7.json()),
|
|
674
|
+
removed: z7.boolean()
|
|
668
675
|
});
|
|
669
|
-
var trackerTriggerContextSchema =
|
|
676
|
+
var trackerTriggerContextSchema = z7.strictObject({
|
|
670
677
|
/** The tracker's stable ID. */
|
|
671
678
|
tracker: identifier,
|
|
672
679
|
/** The tracker's authoring key. */
|
|
@@ -675,10 +682,10 @@ var trackerTriggerContextSchema = z6.strictObject({
|
|
|
675
682
|
* The record account the attempt pays, as the quest's release names it. Releases published
|
|
676
683
|
* before account roles name `inReplyTo` `"replied-to"`, which their bundled evaluators expect.
|
|
677
684
|
*/
|
|
678
|
-
beneficiary:
|
|
685
|
+
beneficiary: z7.union([accountRoleSchema, z7.literal("replied-to")]),
|
|
679
686
|
record: trackerTriggerRecordSchema,
|
|
680
687
|
/** The captured X post of this observation; null for custom trackers. */
|
|
681
|
-
x:
|
|
688
|
+
x: z7.strictObject({
|
|
682
689
|
evidence: trackerEvidenceSchema,
|
|
683
690
|
content: xContentBodySchema
|
|
684
691
|
}).nullable(),
|
|
@@ -686,99 +693,99 @@ var trackerTriggerContextSchema = z6.strictObject({
|
|
|
686
693
|
});
|
|
687
694
|
|
|
688
695
|
// src/observations.ts
|
|
689
|
-
import { z as
|
|
690
|
-
var name =
|
|
691
|
-
var observationInputSchema =
|
|
696
|
+
import { z as z8 } from "zod";
|
|
697
|
+
var name = z8.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
|
|
698
|
+
var observationInputSchema = z8.object({
|
|
692
699
|
id: name,
|
|
693
700
|
source: name,
|
|
694
701
|
type: name,
|
|
695
702
|
member: identifier,
|
|
696
|
-
actor:
|
|
697
|
-
occurredAt:
|
|
698
|
-
data:
|
|
703
|
+
actor: z8.object({ provider: identifier, subject: z8.string().min(1).max(200) }).strict().optional(),
|
|
704
|
+
occurredAt: z8.number().int().nonnegative().max(864e13),
|
|
705
|
+
data: z8.record(z8.string(), z8.json())
|
|
699
706
|
}).strict().refine(
|
|
700
707
|
(value) => JSON.stringify(value.data).length <= 32768,
|
|
701
708
|
"Observation data exceeds 32 KB"
|
|
702
709
|
);
|
|
703
710
|
var observationSchema = observationInputSchema.safeExtend({
|
|
704
|
-
receivedAt:
|
|
711
|
+
receivedAt: z8.number().int().nonnegative()
|
|
705
712
|
});
|
|
706
|
-
var observationTriggerSchema =
|
|
707
|
-
var completionPolicySchema =
|
|
713
|
+
var observationTriggerSchema = z8.object({ source: name, type: name }).strict();
|
|
714
|
+
var completionPolicySchema = z8.discriminatedUnion("kind", [
|
|
708
715
|
streakPolicySchema,
|
|
709
|
-
|
|
710
|
-
|
|
716
|
+
z8.object({ kind: z8.literal("once") }).strict(),
|
|
717
|
+
z8.object({ kind: z8.literal("keyed") }).strict()
|
|
711
718
|
]);
|
|
712
|
-
var completionKeySchema =
|
|
713
|
-
var budgetSchema =
|
|
719
|
+
var completionKeySchema = z8.string().min(1).max(500);
|
|
720
|
+
var budgetSchema = z8.object({
|
|
714
721
|
id: name,
|
|
715
|
-
scope:
|
|
722
|
+
scope: z8.enum(["member", "project"]),
|
|
716
723
|
/**
|
|
717
724
|
* `"day"` buckets by UTC date and `"week"` by ISO week (UTC, weeks start on Monday), both of
|
|
718
725
|
* the attempt's eligibility time; `"lifetime"` never resets.
|
|
719
726
|
*/
|
|
720
|
-
period:
|
|
721
|
-
limit:
|
|
722
|
-
cost:
|
|
723
|
-
|
|
724
|
-
|
|
727
|
+
period: z8.enum(["lifetime", "day", "week"]),
|
|
728
|
+
limit: z8.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
729
|
+
cost: z8.union([
|
|
730
|
+
z8.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
731
|
+
z8.object({ balance: name }).strict()
|
|
725
732
|
])
|
|
726
733
|
}).strict();
|
|
727
|
-
var observationReceiptSchema =
|
|
734
|
+
var observationReceiptSchema = z8.object({
|
|
728
735
|
id: name,
|
|
729
736
|
source: name,
|
|
730
|
-
attempts:
|
|
731
|
-
receivedAt:
|
|
737
|
+
attempts: z8.array(z8.string()),
|
|
738
|
+
receivedAt: z8.number()
|
|
732
739
|
});
|
|
733
|
-
var discordReactionSchema =
|
|
734
|
-
guildId:
|
|
735
|
-
channelId:
|
|
736
|
-
messageId:
|
|
737
|
-
userId:
|
|
738
|
-
messageAuthorId:
|
|
739
|
-
actorRoles:
|
|
740
|
-
emoji:
|
|
741
|
-
messagePublishedAt:
|
|
740
|
+
var discordReactionSchema = z8.object({
|
|
741
|
+
guildId: z8.string(),
|
|
742
|
+
channelId: z8.string(),
|
|
743
|
+
messageId: z8.string(),
|
|
744
|
+
userId: z8.string(),
|
|
745
|
+
messageAuthorId: z8.string().nullable().default(null),
|
|
746
|
+
actorRoles: z8.array(z8.string()).default([]),
|
|
747
|
+
emoji: z8.object({ id: z8.string().nullable(), name: z8.string() }),
|
|
748
|
+
messagePublishedAt: z8.number()
|
|
742
749
|
}).strict();
|
|
743
|
-
var discordMessageSchema =
|
|
744
|
-
guildId:
|
|
745
|
-
channelId:
|
|
746
|
-
messageId:
|
|
747
|
-
userId:
|
|
748
|
-
content:
|
|
749
|
-
replyTo:
|
|
750
|
-
publishedAt:
|
|
750
|
+
var discordMessageSchema = z8.object({
|
|
751
|
+
guildId: z8.string(),
|
|
752
|
+
channelId: z8.string(),
|
|
753
|
+
messageId: z8.string(),
|
|
754
|
+
userId: z8.string(),
|
|
755
|
+
content: z8.string().nullable(),
|
|
756
|
+
replyTo: z8.string().nullable(),
|
|
757
|
+
publishedAt: z8.number()
|
|
751
758
|
}).strict();
|
|
752
759
|
|
|
753
760
|
// src/integrations.ts
|
|
754
|
-
import { z as
|
|
755
|
-
var integrationProviderSchema =
|
|
756
|
-
var discordServerSchema =
|
|
757
|
-
id:
|
|
758
|
-
name:
|
|
759
|
-
icon:
|
|
761
|
+
import { z as z9 } from "zod";
|
|
762
|
+
var integrationProviderSchema = z9.enum(["discord"]);
|
|
763
|
+
var discordServerSchema = z9.object({
|
|
764
|
+
id: z9.string().regex(/^[0-9]{1,20}$/),
|
|
765
|
+
name: z9.string().min(1),
|
|
766
|
+
icon: z9.string().nullable()
|
|
760
767
|
});
|
|
761
|
-
var projectIntegrationSchema =
|
|
768
|
+
var projectIntegrationSchema = z9.object({
|
|
762
769
|
provider: integrationProviderSchema,
|
|
763
|
-
configured:
|
|
764
|
-
status:
|
|
765
|
-
revision:
|
|
770
|
+
configured: z9.boolean(),
|
|
771
|
+
status: z9.enum(["disconnected", "ready", "attention"]),
|
|
772
|
+
revision: z9.number().int().nonnegative(),
|
|
766
773
|
server: discordServerSchema.nullable(),
|
|
767
|
-
issue:
|
|
768
|
-
connectedAt:
|
|
774
|
+
issue: z9.string().nullable(),
|
|
775
|
+
connectedAt: z9.number().default(0)
|
|
769
776
|
});
|
|
770
777
|
|
|
771
778
|
// src/submission-input.ts
|
|
772
|
-
import { z as
|
|
773
|
-
var textOptionsSchema =
|
|
774
|
-
required:
|
|
775
|
-
minLength:
|
|
776
|
-
maxLength:
|
|
779
|
+
import { z as z10 } from "zod";
|
|
780
|
+
var textOptionsSchema = z10.object({
|
|
781
|
+
required: z10.boolean().default(true),
|
|
782
|
+
minLength: z10.number().int().min(0).max(1e4).default(1),
|
|
783
|
+
maxLength: z10.number().int().min(1).max(1e4).default(1e4)
|
|
777
784
|
}).strict().refine(
|
|
778
785
|
(v) => v.minLength <= v.maxLength,
|
|
779
786
|
"minLength must not exceed maxLength"
|
|
780
787
|
);
|
|
781
|
-
var hostSchema =
|
|
788
|
+
var hostSchema = z10.string().min(1).max(253).refine((host) => {
|
|
782
789
|
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
783
790
|
return false;
|
|
784
791
|
}
|
|
@@ -789,13 +796,13 @@ var hostSchema = z9.string().min(1).max(253).refine((host) => {
|
|
|
789
796
|
return false;
|
|
790
797
|
}
|
|
791
798
|
}, "Use a hostname without a scheme, path, port, or wildcard");
|
|
792
|
-
var urlOptionsSchema =
|
|
793
|
-
required:
|
|
794
|
-
allowedHosts:
|
|
799
|
+
var urlOptionsSchema = z10.object({
|
|
800
|
+
required: z10.boolean().default(true),
|
|
801
|
+
allowedHosts: z10.array(hostSchema).min(1).max(100).optional()
|
|
795
802
|
}).strict();
|
|
796
|
-
var textEvidenceSchema =
|
|
797
|
-
var urlEvidenceSchema =
|
|
798
|
-
var valueEvidenceSchema =
|
|
803
|
+
var textEvidenceSchema = z10.object({ kind: z10.literal("text"), value: z10.string().max(1e4) }).strict();
|
|
804
|
+
var urlEvidenceSchema = z10.object({ kind: z10.literal("url"), value: z10.string().max(2048) }).strict();
|
|
805
|
+
var valueEvidenceSchema = z10.discriminatedUnion("kind", [
|
|
799
806
|
textEvidenceSchema,
|
|
800
807
|
urlEvidenceSchema
|
|
801
808
|
]);
|
|
@@ -858,22 +865,22 @@ function xPostId(value) {
|
|
|
858
865
|
}
|
|
859
866
|
|
|
860
867
|
// src/quiz.ts
|
|
861
|
-
import { z as
|
|
862
|
-
var quizId =
|
|
863
|
-
var quizChoiceSchema =
|
|
864
|
-
var quizQuestionSchema =
|
|
868
|
+
import { z as z11 } from "zod";
|
|
869
|
+
var quizId = z11.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
870
|
+
var quizChoiceSchema = z11.object({ id: quizId, label: z11.string().trim().min(1).max(500) }).strict();
|
|
871
|
+
var quizQuestionSchema = z11.object({
|
|
865
872
|
id: quizId,
|
|
866
|
-
prompt:
|
|
867
|
-
choices:
|
|
873
|
+
prompt: z11.string().trim().min(1).max(1e3),
|
|
874
|
+
choices: z11.array(quizChoiceSchema).min(2).max(8).refine(
|
|
868
875
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
869
876
|
"Choice IDs must be unique"
|
|
870
877
|
)
|
|
871
878
|
}).strict();
|
|
872
|
-
var quizQuestionsSchema =
|
|
879
|
+
var quizQuestionsSchema = z11.array(quizQuestionSchema).min(1).max(20).refine(
|
|
873
880
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
874
881
|
"Question IDs must be unique"
|
|
875
882
|
);
|
|
876
|
-
var quizContentSchema =
|
|
883
|
+
var quizContentSchema = z11.array(
|
|
877
884
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
878
885
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
879
886
|
"Choose a correct answer from the available choices"
|
|
@@ -884,97 +891,97 @@ var quizContentSchema = z10.array(
|
|
|
884
891
|
);
|
|
885
892
|
|
|
886
893
|
// src/resources.ts
|
|
887
|
-
import { z as
|
|
888
|
-
var channelSourceSchema =
|
|
889
|
-
provider:
|
|
890
|
-
resource:
|
|
891
|
-
types:
|
|
894
|
+
import { z as z12 } from "zod";
|
|
895
|
+
var channelSourceSchema = z12.object({
|
|
896
|
+
provider: z12.literal("discord"),
|
|
897
|
+
resource: z12.literal("channel"),
|
|
898
|
+
types: z12.array(z12.enum(["text", "announcement"])).min(1)
|
|
892
899
|
}).strict();
|
|
893
|
-
var resourceSourceSchema =
|
|
894
|
-
|
|
895
|
-
provider:
|
|
896
|
-
resource:
|
|
900
|
+
var resourceSourceSchema = z12.union([
|
|
901
|
+
z12.object({
|
|
902
|
+
provider: z12.literal("domino"),
|
|
903
|
+
resource: z12.literal("point-ledger")
|
|
897
904
|
}).strict(),
|
|
898
905
|
channelSourceSchema,
|
|
899
|
-
|
|
900
|
-
provider:
|
|
901
|
-
resource:
|
|
902
|
-
assignable:
|
|
906
|
+
z12.object({
|
|
907
|
+
provider: z12.literal("discord"),
|
|
908
|
+
resource: z12.literal("role"),
|
|
909
|
+
assignable: z12.boolean().default(false)
|
|
903
910
|
}).strict()
|
|
904
911
|
]);
|
|
905
|
-
var resourceRequestSchema =
|
|
912
|
+
var resourceRequestSchema = z12.object({
|
|
906
913
|
source: resourceSourceSchema,
|
|
907
|
-
query:
|
|
908
|
-
cursor:
|
|
909
|
-
ids:
|
|
914
|
+
query: z12.string().max(100).optional(),
|
|
915
|
+
cursor: z12.string().regex(/^\d{1,6}$/).optional(),
|
|
916
|
+
ids: z12.array(z12.string().min(1).max(100)).max(50).optional()
|
|
910
917
|
}).strict();
|
|
911
|
-
var resourceOptionsSchema =
|
|
912
|
-
revision:
|
|
913
|
-
options:
|
|
914
|
-
|
|
915
|
-
id:
|
|
916
|
-
label:
|
|
917
|
-
description:
|
|
918
|
-
group:
|
|
919
|
-
disabledReason:
|
|
918
|
+
var resourceOptionsSchema = z12.object({
|
|
919
|
+
revision: z12.number().int(),
|
|
920
|
+
options: z12.array(
|
|
921
|
+
z12.object({
|
|
922
|
+
id: z12.string(),
|
|
923
|
+
label: z12.string(),
|
|
924
|
+
description: z12.string().optional(),
|
|
925
|
+
group: z12.string().optional(),
|
|
926
|
+
disabledReason: z12.string().optional()
|
|
920
927
|
})
|
|
921
928
|
),
|
|
922
|
-
cursor:
|
|
929
|
+
cursor: z12.string().nullable()
|
|
923
930
|
});
|
|
924
931
|
|
|
925
932
|
// src/settings.ts
|
|
926
|
-
import { z as
|
|
933
|
+
import { z as z14 } from "zod";
|
|
927
934
|
|
|
928
935
|
// src/setting-values.ts
|
|
929
|
-
import { z as
|
|
930
|
-
var settingInstant =
|
|
931
|
-
var settingResourceId =
|
|
932
|
-
|
|
933
|
-
|
|
936
|
+
import { z as z13 } from "zod";
|
|
937
|
+
var settingInstant = z13.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
|
|
938
|
+
var settingResourceId = z13.union([
|
|
939
|
+
z13.literal(""),
|
|
940
|
+
z13.string().regex(/^\S{1,200}$/)
|
|
934
941
|
]);
|
|
935
942
|
|
|
936
943
|
// src/settings.ts
|
|
937
|
-
var base = { label:
|
|
938
|
-
var settingFieldSchema =
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
944
|
+
var base = { label: z14.string().min(1), description: z14.string().optional() };
|
|
945
|
+
var settingFieldSchema = z14.discriminatedUnion("kind", [
|
|
946
|
+
z14.object({ ...base, kind: z14.literal("point-ledger"), default: identifier }).strict(),
|
|
947
|
+
z14.object({ ...base, kind: z14.literal("datetime"), default: settingInstant }).strict(),
|
|
948
|
+
z14.object({
|
|
942
949
|
...base,
|
|
943
|
-
kind:
|
|
950
|
+
kind: z14.literal("resource"),
|
|
944
951
|
default: settingResourceId,
|
|
945
952
|
source: resourceSourceSchema
|
|
946
953
|
}).strict(),
|
|
947
|
-
|
|
948
|
-
|
|
954
|
+
z14.object({ ...base, kind: z14.literal("quiz"), default: quizContentSchema }).strict(),
|
|
955
|
+
z14.object({
|
|
949
956
|
...base,
|
|
950
|
-
kind:
|
|
951
|
-
default:
|
|
952
|
-
minLength:
|
|
953
|
-
maxLength:
|
|
954
|
-
multiline:
|
|
957
|
+
kind: z14.literal("text"),
|
|
958
|
+
default: z14.string(),
|
|
959
|
+
minLength: z14.number().int().nonnegative(),
|
|
960
|
+
maxLength: z14.number().int().positive(),
|
|
961
|
+
multiline: z14.boolean()
|
|
955
962
|
}).strict(),
|
|
956
|
-
|
|
963
|
+
z14.object({
|
|
957
964
|
...base,
|
|
958
|
-
kind:
|
|
959
|
-
default:
|
|
960
|
-
min:
|
|
961
|
-
max:
|
|
965
|
+
kind: z14.literal("integer"),
|
|
966
|
+
default: z14.number().int(),
|
|
967
|
+
min: z14.number().int(),
|
|
968
|
+
max: z14.number().int()
|
|
962
969
|
}).strict(),
|
|
963
|
-
|
|
964
|
-
|
|
970
|
+
z14.object({ ...base, kind: z14.literal("boolean"), default: z14.boolean() }).strict(),
|
|
971
|
+
z14.object({
|
|
965
972
|
...base,
|
|
966
|
-
kind:
|
|
967
|
-
default:
|
|
968
|
-
options:
|
|
973
|
+
kind: z14.literal("choice"),
|
|
974
|
+
default: z14.string(),
|
|
975
|
+
options: z14.array(z14.string().min(1)).min(1)
|
|
969
976
|
}).strict()
|
|
970
977
|
]);
|
|
971
|
-
var settingsFieldsSchema =
|
|
972
|
-
|
|
978
|
+
var settingsFieldsSchema = z14.record(
|
|
979
|
+
z14.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
973
980
|
settingFieldSchema
|
|
974
981
|
);
|
|
975
|
-
var settingsValuesSchema =
|
|
976
|
-
|
|
977
|
-
|
|
982
|
+
var settingsValuesSchema = z14.record(
|
|
983
|
+
z14.string(),
|
|
984
|
+
z14.union([z14.string(), z14.number().finite(), z14.boolean(), quizContentSchema])
|
|
978
985
|
);
|
|
979
986
|
function parseSettings(fields, input) {
|
|
980
987
|
const shape = {};
|
|
@@ -993,20 +1000,20 @@ function parseSettings(fields, input) {
|
|
|
993
1000
|
shape[key] = quizContentSchema.default(field.default);
|
|
994
1001
|
break;
|
|
995
1002
|
case "text":
|
|
996
|
-
shape[key] =
|
|
1003
|
+
shape[key] = z14.string().min(field.minLength).max(field.maxLength).default(field.default);
|
|
997
1004
|
break;
|
|
998
1005
|
case "integer":
|
|
999
|
-
shape[key] =
|
|
1006
|
+
shape[key] = z14.number().int().min(field.min).max(field.max).default(field.default);
|
|
1000
1007
|
break;
|
|
1001
1008
|
case "boolean":
|
|
1002
|
-
shape[key] =
|
|
1009
|
+
shape[key] = z14.boolean().default(field.default);
|
|
1003
1010
|
break;
|
|
1004
1011
|
case "choice":
|
|
1005
|
-
shape[key] =
|
|
1012
|
+
shape[key] = z14.enum(field.options).default(field.default);
|
|
1006
1013
|
break;
|
|
1007
1014
|
}
|
|
1008
1015
|
}
|
|
1009
|
-
return settingsValuesSchema.parse(
|
|
1016
|
+
return settingsValuesSchema.parse(z14.object(shape).strict().parse(input));
|
|
1010
1017
|
}
|
|
1011
1018
|
function missingResourceSettings(fields, values) {
|
|
1012
1019
|
return Object.entries(fields).filter(([key, field]) => field.kind === "resource" && !values[key]).map(([key]) => key);
|
|
@@ -1016,43 +1023,43 @@ function compatibleSettingKinds(previous, next) {
|
|
|
1016
1023
|
}
|
|
1017
1024
|
|
|
1018
1025
|
// src/schema.ts
|
|
1019
|
-
import { z as
|
|
1020
|
-
var pointsRewardSchema =
|
|
1021
|
-
kind:
|
|
1026
|
+
import { z as z15 } from "zod";
|
|
1027
|
+
var pointsRewardSchema = z15.object({
|
|
1028
|
+
kind: z15.literal("points").default("points"),
|
|
1022
1029
|
balance: identifier,
|
|
1023
|
-
amount:
|
|
1030
|
+
amount: z15.number().int().min(0).max(1e4)
|
|
1024
1031
|
}).strict();
|
|
1025
|
-
var tieredRewardDefinitionSchema =
|
|
1032
|
+
var tieredRewardDefinitionSchema = z15.object({
|
|
1026
1033
|
id: identifier,
|
|
1027
|
-
title:
|
|
1028
|
-
tiers:
|
|
1029
|
-
|
|
1034
|
+
title: z15.string().min(1).max(120),
|
|
1035
|
+
tiers: z15.array(
|
|
1036
|
+
z15.object({ id: identifier, title: z15.string().min(1).max(120) }).strict()
|
|
1030
1037
|
).min(1).max(20).refine(
|
|
1031
1038
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
1032
1039
|
"Tier IDs must be unique"
|
|
1033
1040
|
),
|
|
1034
|
-
inventory:
|
|
1035
|
-
fulfillment:
|
|
1041
|
+
inventory: z15.object({ kind: z15.literal("untracked") }).strict(),
|
|
1042
|
+
fulfillment: z15.object({ kind: z15.literal("staff-handover") }).strict()
|
|
1036
1043
|
}).strict();
|
|
1037
|
-
var tieredRewardReferenceSchema =
|
|
1044
|
+
var tieredRewardReferenceSchema = z15.object({
|
|
1038
1045
|
id: identifier,
|
|
1039
1046
|
key: identifier.nullable()
|
|
1040
1047
|
});
|
|
1041
|
-
var tierRewardSchema =
|
|
1042
|
-
kind:
|
|
1048
|
+
var tierRewardSchema = z15.object({
|
|
1049
|
+
kind: z15.literal("tier"),
|
|
1043
1050
|
reward: tieredRewardDefinitionSchema,
|
|
1044
1051
|
tier: identifier
|
|
1045
1052
|
}).strict().refine(
|
|
1046
1053
|
(value) => value.reward.tiers.some((t) => t.id === value.tier),
|
|
1047
1054
|
"Unknown reward tier"
|
|
1048
1055
|
);
|
|
1049
|
-
var integrationRewardSchema =
|
|
1050
|
-
kind:
|
|
1051
|
-
provider:
|
|
1052
|
-
action:
|
|
1053
|
-
roleId:
|
|
1056
|
+
var integrationRewardSchema = z15.object({
|
|
1057
|
+
kind: z15.literal("integration"),
|
|
1058
|
+
provider: z15.literal("discord"),
|
|
1059
|
+
action: z15.literal("grant-role"),
|
|
1060
|
+
roleId: z15.string().regex(/^[0-9]{1,20}$/)
|
|
1054
1061
|
}).strict();
|
|
1055
|
-
var rewardSchema =
|
|
1062
|
+
var rewardSchema = z15.union([
|
|
1056
1063
|
pointsRewardSchema,
|
|
1057
1064
|
tierRewardSchema,
|
|
1058
1065
|
integrationRewardSchema
|
|
@@ -1063,26 +1070,26 @@ function rewardKey(reward) {
|
|
|
1063
1070
|
}
|
|
1064
1071
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
1065
1072
|
}
|
|
1066
|
-
var triggerSchema =
|
|
1067
|
-
|
|
1068
|
-
kind:
|
|
1069
|
-
input:
|
|
1073
|
+
var triggerSchema = z15.union([
|
|
1074
|
+
z15.object({
|
|
1075
|
+
kind: z15.literal("manual"),
|
|
1076
|
+
input: z15.literal("text"),
|
|
1070
1077
|
constraints: textOptionsSchema,
|
|
1071
|
-
actor:
|
|
1078
|
+
actor: z15.enum(["member", "staff"]).optional()
|
|
1072
1079
|
}).strict(),
|
|
1073
|
-
|
|
1074
|
-
kind:
|
|
1075
|
-
input:
|
|
1080
|
+
z15.object({
|
|
1081
|
+
kind: z15.literal("manual"),
|
|
1082
|
+
input: z15.literal("url"),
|
|
1076
1083
|
constraints: urlOptionsSchema,
|
|
1077
|
-
actor:
|
|
1084
|
+
actor: z15.enum(["member", "staff"]).optional()
|
|
1078
1085
|
}).strict(),
|
|
1079
|
-
|
|
1080
|
-
kind:
|
|
1081
|
-
input:
|
|
1082
|
-
actor:
|
|
1086
|
+
z15.object({
|
|
1087
|
+
kind: z15.literal("manual"),
|
|
1088
|
+
input: z15.enum(["photo", "quiz", "none"]),
|
|
1089
|
+
actor: z15.enum(["member", "staff"]).optional()
|
|
1083
1090
|
}).strict(),
|
|
1084
|
-
|
|
1085
|
-
kind:
|
|
1091
|
+
z15.object({
|
|
1092
|
+
kind: z15.literal("automatic"),
|
|
1086
1093
|
observation: observationTriggerSchema.optional(),
|
|
1087
1094
|
content: contentPolicySchema.optional(),
|
|
1088
1095
|
tracker: trackerTriggerPolicySchema.optional()
|
|
@@ -1091,48 +1098,48 @@ var triggerSchema = z14.union([
|
|
|
1091
1098
|
"Choose one automatic trigger source"
|
|
1092
1099
|
)
|
|
1093
1100
|
]);
|
|
1094
|
-
var prerequisiteSchema =
|
|
1095
|
-
var photoResultSchema =
|
|
1096
|
-
kind:
|
|
1097
|
-
reason:
|
|
1101
|
+
var prerequisiteSchema = z15.object({ quest: identifier });
|
|
1102
|
+
var photoResultSchema = z15.object({
|
|
1103
|
+
kind: z15.enum(["pass", "fail", "unclear"]),
|
|
1104
|
+
reason: z15.string().min(1).max(2e3)
|
|
1098
1105
|
}).strict();
|
|
1099
|
-
var textReviewInputSchema =
|
|
1100
|
-
text:
|
|
1101
|
-
criteria:
|
|
1106
|
+
var textReviewInputSchema = z15.object({
|
|
1107
|
+
text: z15.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
1108
|
+
criteria: z15.string().trim().min(1).max(2e3)
|
|
1102
1109
|
}).strict();
|
|
1103
1110
|
var textResultSchema = photoResultSchema;
|
|
1104
|
-
var decisionSchema =
|
|
1105
|
-
|
|
1106
|
-
kind:
|
|
1107
|
-
rewards:
|
|
1111
|
+
var decisionSchema = z15.discriminatedUnion("kind", [
|
|
1112
|
+
z15.object({
|
|
1113
|
+
kind: z15.literal("accept"),
|
|
1114
|
+
rewards: z15.array(rewardSchema).max(10),
|
|
1108
1115
|
completionKey: completionKeySchema.optional()
|
|
1109
1116
|
}).strict(),
|
|
1110
|
-
|
|
1111
|
-
kind:
|
|
1112
|
-
reason:
|
|
1117
|
+
z15.object({
|
|
1118
|
+
kind: z15.literal("reject"),
|
|
1119
|
+
reason: z15.string().min(1).max(2e3),
|
|
1113
1120
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
1114
|
-
requestedReview:
|
|
1121
|
+
requestedReview: z15.literal(true).optional()
|
|
1115
1122
|
}).strict(),
|
|
1116
|
-
|
|
1117
|
-
kind:
|
|
1118
|
-
reason:
|
|
1119
|
-
rewards:
|
|
1123
|
+
z15.object({
|
|
1124
|
+
kind: z15.literal("review"),
|
|
1125
|
+
reason: z15.string().min(1).max(2e3),
|
|
1126
|
+
rewards: z15.array(rewardSchema).max(10).optional(),
|
|
1120
1127
|
completionKey: completionKeySchema.optional()
|
|
1121
1128
|
}).strict()
|
|
1122
1129
|
]);
|
|
1123
|
-
var reviewModeSchema =
|
|
1124
|
-
var storedReviewModeSchema =
|
|
1130
|
+
var reviewModeSchema = z15.enum(["workers-ai"]);
|
|
1131
|
+
var storedReviewModeSchema = z15.enum([
|
|
1125
1132
|
"fixture-pass",
|
|
1126
1133
|
"fixture-fail",
|
|
1127
1134
|
"fixture-unclear",
|
|
1128
1135
|
"fixture-error",
|
|
1129
1136
|
"workers-ai"
|
|
1130
1137
|
]);
|
|
1131
|
-
var rewardBundleSchema =
|
|
1138
|
+
var rewardBundleSchema = z15.array(rewardSchema).max(10).refine(
|
|
1132
1139
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
1133
1140
|
"Use one entry per balance or shared reward"
|
|
1134
1141
|
);
|
|
1135
|
-
var mediaUrlSchema =
|
|
1142
|
+
var mediaUrlSchema = z15.string().max(2e3).refine((value) => {
|
|
1136
1143
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
1137
1144
|
return true;
|
|
1138
1145
|
}
|
|
@@ -1142,82 +1149,82 @@ var mediaUrlSchema = z14.string().max(2e3).refine((value) => {
|
|
|
1142
1149
|
return false;
|
|
1143
1150
|
}
|
|
1144
1151
|
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
1145
|
-
var questPresentationSchema =
|
|
1152
|
+
var questPresentationSchema = z15.object({
|
|
1146
1153
|
quiz: quizQuestionsSchema.optional(),
|
|
1147
|
-
instructions:
|
|
1148
|
-
video:
|
|
1154
|
+
instructions: z15.string().max(4e3).optional(),
|
|
1155
|
+
video: z15.object({
|
|
1149
1156
|
url: mediaUrlSchema,
|
|
1150
1157
|
poster: mediaUrlSchema.optional(),
|
|
1151
|
-
captions:
|
|
1158
|
+
captions: z15.object({
|
|
1152
1159
|
url: mediaUrlSchema,
|
|
1153
|
-
language:
|
|
1154
|
-
label:
|
|
1160
|
+
language: z15.string().min(2).max(20),
|
|
1161
|
+
label: z15.string().min(1).max(80)
|
|
1155
1162
|
}).strict().optional()
|
|
1156
1163
|
}).strict().optional()
|
|
1157
1164
|
}).strict();
|
|
1158
|
-
var questProfileSchema =
|
|
1159
|
-
var questDescriptionSchema =
|
|
1165
|
+
var questProfileSchema = z15.object({ visible: z15.boolean() }).strict();
|
|
1166
|
+
var questDescriptionSchema = z15.object({
|
|
1160
1167
|
quest: identifier,
|
|
1161
|
-
runtimeVersion:
|
|
1162
|
-
title:
|
|
1168
|
+
runtimeVersion: z15.union([z15.literal(1), z15.literal(2)]).default(1),
|
|
1169
|
+
title: z15.string().min(1).max(120),
|
|
1163
1170
|
presentation: questPresentationSchema.default({}),
|
|
1164
|
-
integrations:
|
|
1171
|
+
integrations: z15.array(integrationProviderSchema).max(10).default([]),
|
|
1165
1172
|
fields: settingsFieldsSchema,
|
|
1166
1173
|
values: settingsValuesSchema,
|
|
1167
1174
|
rewards: rewardBundleSchema,
|
|
1168
|
-
humanReview:
|
|
1175
|
+
humanReview: z15.boolean(),
|
|
1169
1176
|
trigger: triggerSchema,
|
|
1170
1177
|
performance: contentPerformancePolicySchema.optional(),
|
|
1171
|
-
requires:
|
|
1178
|
+
requires: z15.array(prerequisiteSchema).max(30).default([]),
|
|
1172
1179
|
completion: completionPolicySchema,
|
|
1173
|
-
visibility:
|
|
1180
|
+
visibility: z15.enum(["visible", "hidden"]).default("visible"),
|
|
1174
1181
|
/**
|
|
1175
1182
|
* Whether completions show on participant profiles (`/v1/profiles/:id/completions`). Absent
|
|
1176
1183
|
* is hidden. Optional, not defaulted: releases carry the key only when the author sets it, so
|
|
1177
1184
|
* clients and pods that predate it (strict release schemas) still read every other release.
|
|
1178
1185
|
*/
|
|
1179
1186
|
profile: questProfileSchema.optional(),
|
|
1180
|
-
budgets:
|
|
1187
|
+
budgets: z15.array(budgetSchema).max(20).default([])
|
|
1181
1188
|
}).strict();
|
|
1182
|
-
var artifactSchema =
|
|
1189
|
+
var artifactSchema = z15.object({ code: z15.string().min(1).max(1e6) }).strict();
|
|
1183
1190
|
var releaseSchema = artifactSchema.extend({
|
|
1184
1191
|
settings: settingsValuesSchema,
|
|
1185
1192
|
provider: reviewModeSchema,
|
|
1186
1193
|
expectedRelease: identifier.nullable().optional(),
|
|
1187
|
-
settingRenames:
|
|
1194
|
+
settingRenames: z15.record(z15.string(), z15.string()).optional()
|
|
1188
1195
|
}).strict();
|
|
1189
|
-
var batchReleaseSchema =
|
|
1190
|
-
var questSettingsInputSchema =
|
|
1196
|
+
var batchReleaseSchema = z15.object({ releases: z15.array(releaseSchema).min(1).max(50) }).strict();
|
|
1197
|
+
var questSettingsInputSchema = z15.object({
|
|
1191
1198
|
quest: identifier,
|
|
1192
1199
|
expectedRelease: identifier,
|
|
1193
1200
|
set: settingsValuesSchema,
|
|
1194
|
-
reset:
|
|
1201
|
+
reset: z15.array(z15.string())
|
|
1195
1202
|
}).strict();
|
|
1196
1203
|
var storedReleaseSchema = questDescriptionSchema.extend({
|
|
1197
1204
|
key: identifier.optional(),
|
|
1198
|
-
code:
|
|
1205
|
+
code: z15.string(),
|
|
1199
1206
|
provider: storedReviewModeSchema,
|
|
1200
1207
|
id: identifier,
|
|
1201
|
-
createdAt:
|
|
1202
|
-
legacy:
|
|
1203
|
-
origin:
|
|
1204
|
-
lifecycle:
|
|
1205
|
-
configuration:
|
|
1208
|
+
createdAt: z15.number(),
|
|
1209
|
+
legacy: z15.boolean().default(false),
|
|
1210
|
+
origin: z15.object({ typeVersion: identifier }).strict().optional(),
|
|
1211
|
+
lifecycle: z15.enum(["active", "paused", "archived"]).default("active"),
|
|
1212
|
+
configuration: z15.object({
|
|
1206
1213
|
defaults: settingsValuesSchema,
|
|
1207
1214
|
overrides: settingsValuesSchema,
|
|
1208
|
-
preserved:
|
|
1215
|
+
preserved: z15.array(z15.string())
|
|
1209
1216
|
}).strict().optional()
|
|
1210
1217
|
});
|
|
1211
|
-
var legacyReleaseSchema =
|
|
1218
|
+
var legacyReleaseSchema = z15.object({
|
|
1212
1219
|
quest: identifier,
|
|
1213
|
-
title:
|
|
1214
|
-
criteria:
|
|
1215
|
-
humanReview:
|
|
1220
|
+
title: z15.string(),
|
|
1221
|
+
criteria: z15.string(),
|
|
1222
|
+
humanReview: z15.boolean(),
|
|
1216
1223
|
rewards: rewardBundleSchema,
|
|
1217
|
-
code:
|
|
1224
|
+
code: z15.string(),
|
|
1218
1225
|
provider: storedReviewModeSchema,
|
|
1219
1226
|
id: identifier,
|
|
1220
|
-
createdAt:
|
|
1227
|
+
createdAt: z15.number()
|
|
1221
1228
|
}).transform((r) => {
|
|
1222
1229
|
const { criteria, ...stored } = r;
|
|
1223
1230
|
return storedReleaseSchema.parse({
|
|
@@ -1229,15 +1236,15 @@ var legacyReleaseSchema = z14.object({
|
|
|
1229
1236
|
legacy: true
|
|
1230
1237
|
});
|
|
1231
1238
|
});
|
|
1232
|
-
var publishedReleaseSchema =
|
|
1239
|
+
var publishedReleaseSchema = z15.union([
|
|
1233
1240
|
storedReleaseSchema,
|
|
1234
1241
|
legacyReleaseSchema
|
|
1235
1242
|
]);
|
|
1236
|
-
var templateSchema =
|
|
1237
|
-
code:
|
|
1243
|
+
var templateSchema = z15.object({
|
|
1244
|
+
code: z15.string(),
|
|
1238
1245
|
definition: questDescriptionSchema
|
|
1239
1246
|
});
|
|
1240
|
-
var quizAnswersSchema =
|
|
1247
|
+
var quizAnswersSchema = z15.record(identifier, identifier).refine(
|
|
1241
1248
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
1242
1249
|
"Provide between 1 and 50 answers"
|
|
1243
1250
|
).transform(
|
|
@@ -1245,33 +1252,33 @@ var quizAnswersSchema = z14.record(identifier, identifier).refine(
|
|
|
1245
1252
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
1246
1253
|
)
|
|
1247
1254
|
);
|
|
1248
|
-
var quizEvidenceSchema =
|
|
1249
|
-
kind:
|
|
1255
|
+
var quizEvidenceSchema = z15.object({
|
|
1256
|
+
kind: z15.literal("quiz"),
|
|
1250
1257
|
release: identifier.optional(),
|
|
1251
1258
|
answers: quizAnswersSchema
|
|
1252
1259
|
}).strict();
|
|
1253
|
-
var submissionEvidenceSchema =
|
|
1260
|
+
var submissionEvidenceSchema = z15.union([
|
|
1254
1261
|
quizEvidenceSchema,
|
|
1255
1262
|
textEvidenceSchema,
|
|
1256
1263
|
urlEvidenceSchema
|
|
1257
1264
|
]);
|
|
1258
|
-
var submitSchema =
|
|
1265
|
+
var submitSchema = z15.object({
|
|
1259
1266
|
actionId: identifier,
|
|
1260
1267
|
quest: identifier,
|
|
1261
1268
|
member: identifier,
|
|
1262
1269
|
evidence: identifier.optional(),
|
|
1263
1270
|
input: submissionEvidenceSchema.optional(),
|
|
1264
1271
|
release: identifier.optional(),
|
|
1265
|
-
faultAfterReview:
|
|
1272
|
+
faultAfterReview: z15.boolean().optional()
|
|
1266
1273
|
}).strict();
|
|
1267
|
-
var attemptSchema =
|
|
1274
|
+
var attemptSchema = z15.object({
|
|
1268
1275
|
id: identifier,
|
|
1269
1276
|
release: identifier,
|
|
1270
1277
|
quest: identifier,
|
|
1271
1278
|
member: identifier,
|
|
1272
1279
|
evidence: identifier.nullable(),
|
|
1273
1280
|
input: submissionEvidenceSchema.optional(),
|
|
1274
|
-
status:
|
|
1281
|
+
status: z15.enum([
|
|
1275
1282
|
"queued",
|
|
1276
1283
|
"evaluating",
|
|
1277
1284
|
"accepted",
|
|
@@ -1280,75 +1287,75 @@ var attemptSchema = z14.object({
|
|
|
1280
1287
|
"needs-review",
|
|
1281
1288
|
"failed"
|
|
1282
1289
|
]),
|
|
1283
|
-
reason:
|
|
1284
|
-
retries:
|
|
1285
|
-
generation:
|
|
1286
|
-
completion:
|
|
1290
|
+
reason: z15.string().nullable(),
|
|
1291
|
+
retries: z15.number(),
|
|
1292
|
+
generation: z15.number(),
|
|
1293
|
+
completion: z15.string().nullable(),
|
|
1287
1294
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
1288
1295
|
/**
|
|
1289
1296
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
1290
1297
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
1291
1298
|
*/
|
|
1292
|
-
requestedReview:
|
|
1293
|
-
createdAt:
|
|
1299
|
+
requestedReview: z15.boolean().default(false),
|
|
1300
|
+
createdAt: z15.number()
|
|
1294
1301
|
});
|
|
1295
|
-
var eventSchema =
|
|
1296
|
-
id:
|
|
1297
|
-
attempt:
|
|
1298
|
-
kind:
|
|
1299
|
-
detail:
|
|
1300
|
-
actor:
|
|
1301
|
-
at:
|
|
1302
|
+
var eventSchema = z15.object({
|
|
1303
|
+
id: z15.number(),
|
|
1304
|
+
attempt: z15.string().nullable(),
|
|
1305
|
+
kind: z15.string(),
|
|
1306
|
+
detail: z15.string(),
|
|
1307
|
+
actor: z15.string().nullable().default(null),
|
|
1308
|
+
at: z15.number()
|
|
1302
1309
|
});
|
|
1303
|
-
var pickupSelectionSchema =
|
|
1310
|
+
var pickupSelectionSchema = z15.object({
|
|
1304
1311
|
item: identifier,
|
|
1305
|
-
revision:
|
|
1312
|
+
revision: z15.number().int().nonnegative()
|
|
1306
1313
|
}).strict();
|
|
1307
|
-
var pickupAllocationSchema =
|
|
1314
|
+
var pickupAllocationSchema = z15.object({
|
|
1308
1315
|
item: identifier,
|
|
1309
|
-
label:
|
|
1316
|
+
label: z15.string().min(1).max(80)
|
|
1310
1317
|
}).strict();
|
|
1311
|
-
var pickupPolicySchema =
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
kind:
|
|
1315
|
-
tiers:
|
|
1316
|
-
|
|
1318
|
+
var pickupPolicySchema = z15.discriminatedUnion("kind", [
|
|
1319
|
+
z15.object({ kind: z15.literal("untracked") }).strict(),
|
|
1320
|
+
z15.object({
|
|
1321
|
+
kind: z15.literal("at-pickup"),
|
|
1322
|
+
tiers: z15.array(
|
|
1323
|
+
z15.object({
|
|
1317
1324
|
tier: identifier,
|
|
1318
|
-
variants:
|
|
1325
|
+
variants: z15.array(pickupAllocationSchema).min(1).max(100)
|
|
1319
1326
|
}).strict()
|
|
1320
1327
|
).min(1).max(100)
|
|
1321
1328
|
}).strict()
|
|
1322
1329
|
]);
|
|
1323
|
-
var pickupCatalogSchema =
|
|
1330
|
+
var pickupCatalogSchema = z15.object({
|
|
1324
1331
|
reward: tieredRewardDefinitionSchema,
|
|
1325
|
-
revision:
|
|
1332
|
+
revision: z15.number().int().nonnegative(),
|
|
1326
1333
|
policy: pickupPolicySchema
|
|
1327
1334
|
});
|
|
1328
|
-
var pickupAvailabilitySchema =
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
kind:
|
|
1332
|
-
revision:
|
|
1333
|
-
variants:
|
|
1335
|
+
var pickupAvailabilitySchema = z15.discriminatedUnion("kind", [
|
|
1336
|
+
z15.object({ kind: z15.literal("untracked") }).strict(),
|
|
1337
|
+
z15.object({
|
|
1338
|
+
kind: z15.literal("at-pickup"),
|
|
1339
|
+
revision: z15.number().int().nonnegative(),
|
|
1340
|
+
variants: z15.array(
|
|
1334
1341
|
pickupAllocationSchema.extend({
|
|
1335
|
-
available:
|
|
1342
|
+
available: z15.number().int().nonnegative()
|
|
1336
1343
|
})
|
|
1337
1344
|
)
|
|
1338
1345
|
}).strict()
|
|
1339
1346
|
]);
|
|
1340
|
-
var configurePickupSchema =
|
|
1347
|
+
var configurePickupSchema = z15.object({
|
|
1341
1348
|
reward: identifier,
|
|
1342
|
-
revision:
|
|
1349
|
+
revision: z15.number().int().nonnegative(),
|
|
1343
1350
|
actionId: identifier,
|
|
1344
|
-
policy:
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
kind:
|
|
1348
|
-
tiers:
|
|
1349
|
-
|
|
1351
|
+
policy: z15.discriminatedUnion("kind", [
|
|
1352
|
+
z15.object({ kind: z15.literal("untracked") }).strict(),
|
|
1353
|
+
z15.object({
|
|
1354
|
+
kind: z15.literal("at-pickup"),
|
|
1355
|
+
tiers: z15.array(
|
|
1356
|
+
z15.object({
|
|
1350
1357
|
tier: identifier,
|
|
1351
|
-
variants:
|
|
1358
|
+
variants: z15.array(
|
|
1352
1359
|
pickupAllocationSchema.extend({
|
|
1353
1360
|
item: identifier.optional()
|
|
1354
1361
|
})
|
|
@@ -1364,164 +1371,164 @@ var entitlementBase = {
|
|
|
1364
1371
|
reward: tieredRewardDefinitionSchema,
|
|
1365
1372
|
earnedTier: identifier,
|
|
1366
1373
|
tier: identifier,
|
|
1367
|
-
revision:
|
|
1374
|
+
revision: z15.number().int().positive()
|
|
1368
1375
|
};
|
|
1369
|
-
var entitlementSchema =
|
|
1370
|
-
|
|
1371
|
-
|
|
1376
|
+
var entitlementSchema = z15.discriminatedUnion("status", [
|
|
1377
|
+
z15.object({ ...entitlementBase, status: z15.literal("available") }).strict(),
|
|
1378
|
+
z15.object({
|
|
1372
1379
|
...entitlementBase,
|
|
1373
|
-
status:
|
|
1380
|
+
status: z15.literal("handing-over"),
|
|
1374
1381
|
handover: identifier,
|
|
1375
|
-
startedAt:
|
|
1382
|
+
startedAt: z15.number(),
|
|
1376
1383
|
allocation: pickupAllocationSchema.optional()
|
|
1377
1384
|
}).strict(),
|
|
1378
|
-
|
|
1385
|
+
z15.object({
|
|
1379
1386
|
...entitlementBase,
|
|
1380
|
-
status:
|
|
1387
|
+
status: z15.literal("collected"),
|
|
1381
1388
|
handover: identifier,
|
|
1382
|
-
startedAt:
|
|
1389
|
+
startedAt: z15.number(),
|
|
1383
1390
|
allocation: pickupAllocationSchema.optional(),
|
|
1384
|
-
collectedAt:
|
|
1391
|
+
collectedAt: z15.number()
|
|
1385
1392
|
}).strict()
|
|
1386
1393
|
]);
|
|
1387
|
-
var beginHandoverSchema =
|
|
1394
|
+
var beginHandoverSchema = z15.object({
|
|
1388
1395
|
actionId: identifier,
|
|
1389
|
-
revision:
|
|
1396
|
+
revision: z15.number().int().positive(),
|
|
1390
1397
|
selection: pickupSelectionSchema.optional()
|
|
1391
1398
|
}).strict();
|
|
1392
|
-
var confirmHandoverSchema =
|
|
1393
|
-
var completionRecordSchema =
|
|
1394
|
-
key:
|
|
1399
|
+
var confirmHandoverSchema = z15.object({ actionId: identifier, handover: identifier }).strict();
|
|
1400
|
+
var completionRecordSchema = z15.object({
|
|
1401
|
+
key: z15.string().default("once"),
|
|
1395
1402
|
id: identifier,
|
|
1396
1403
|
quest: identifier,
|
|
1397
1404
|
member: identifier
|
|
1398
1405
|
});
|
|
1399
|
-
var questAvailabilitySchema =
|
|
1400
|
-
|
|
1401
|
-
kind:
|
|
1402
|
-
input:
|
|
1406
|
+
var questAvailabilitySchema = z15.discriminatedUnion("kind", [
|
|
1407
|
+
z15.object({
|
|
1408
|
+
kind: z15.literal("available"),
|
|
1409
|
+
input: z15.enum(["photo", "quiz", "none", "text", "url"])
|
|
1403
1410
|
}).strict(),
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
kind:
|
|
1407
|
-
missing:
|
|
1411
|
+
z15.object({ kind: z15.literal("completed") }).strict(),
|
|
1412
|
+
z15.object({
|
|
1413
|
+
kind: z15.literal("locked"),
|
|
1414
|
+
missing: z15.array(z15.object({ quest: identifier, title: z15.string() })).min(1)
|
|
1408
1415
|
}).strict(),
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
kind:
|
|
1416
|
+
z15.object({ kind: z15.literal("staff-required") }).strict(),
|
|
1417
|
+
z15.object({
|
|
1418
|
+
kind: z15.literal("automatic"),
|
|
1412
1419
|
observation: observationTriggerSchema.optional()
|
|
1413
1420
|
}).strict(),
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1421
|
+
z15.object({ kind: z15.literal("checking"), attempt: identifier }).strict(),
|
|
1422
|
+
z15.object({ kind: z15.literal("needs-review"), attempt: identifier }).strict(),
|
|
1423
|
+
z15.object({ kind: z15.literal("retryable"), attempt: identifier }).strict()
|
|
1417
1424
|
]);
|
|
1418
|
-
var memberProgressSchema =
|
|
1425
|
+
var memberProgressSchema = z15.object({
|
|
1419
1426
|
member: identifier,
|
|
1420
|
-
quests:
|
|
1421
|
-
|
|
1427
|
+
quests: z15.array(
|
|
1428
|
+
z15.object({
|
|
1422
1429
|
quest: identifier,
|
|
1423
1430
|
key: identifier.optional(),
|
|
1424
1431
|
release: identifier.optional(),
|
|
1425
|
-
title:
|
|
1432
|
+
title: z15.string(),
|
|
1426
1433
|
presentation: questPresentationSchema.default({}),
|
|
1427
|
-
connections:
|
|
1434
|
+
connections: z15.array(authProviderSchema).default([]),
|
|
1428
1435
|
trigger: triggerSchema,
|
|
1429
1436
|
availability: questAvailabilitySchema,
|
|
1430
|
-
completed:
|
|
1437
|
+
completed: z15.boolean(),
|
|
1431
1438
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
1432
1439
|
streak: streakProgressSchema.nullable().optional(),
|
|
1433
|
-
completionCount:
|
|
1434
|
-
visibility:
|
|
1435
|
-
missing:
|
|
1440
|
+
completionCount: z15.number().int().nonnegative().default(0),
|
|
1441
|
+
visibility: z15.enum(["visible", "hidden"]).default("visible"),
|
|
1442
|
+
missing: z15.array(z15.object({ quest: identifier, title: z15.string() })),
|
|
1436
1443
|
attempt: attemptSchema.nullable()
|
|
1437
1444
|
})
|
|
1438
1445
|
),
|
|
1439
|
-
entitlements:
|
|
1446
|
+
entitlements: z15.array(entitlementSchema)
|
|
1440
1447
|
});
|
|
1441
|
-
var snapshotSchema =
|
|
1442
|
-
releases:
|
|
1443
|
-
completions:
|
|
1444
|
-
entitlements:
|
|
1445
|
-
attempts:
|
|
1446
|
-
balances:
|
|
1447
|
-
|
|
1448
|
-
member:
|
|
1449
|
-
balance:
|
|
1450
|
-
earned:
|
|
1451
|
-
held:
|
|
1452
|
-
available:
|
|
1448
|
+
var snapshotSchema = z15.object({
|
|
1449
|
+
releases: z15.array(publishedReleaseSchema),
|
|
1450
|
+
completions: z15.array(completionRecordSchema),
|
|
1451
|
+
entitlements: z15.array(entitlementSchema),
|
|
1452
|
+
attempts: z15.array(attemptSchema),
|
|
1453
|
+
balances: z15.array(
|
|
1454
|
+
z15.object({
|
|
1455
|
+
member: z15.string(),
|
|
1456
|
+
balance: z15.string(),
|
|
1457
|
+
earned: z15.number(),
|
|
1458
|
+
held: z15.number(),
|
|
1459
|
+
available: z15.number()
|
|
1453
1460
|
})
|
|
1454
1461
|
),
|
|
1455
|
-
events:
|
|
1462
|
+
events: z15.array(eventSchema)
|
|
1456
1463
|
});
|
|
1457
|
-
var evidenceSchema =
|
|
1464
|
+
var evidenceSchema = z15.object({
|
|
1458
1465
|
id: identifier,
|
|
1459
1466
|
member: identifier,
|
|
1460
|
-
type:
|
|
1461
|
-
size:
|
|
1467
|
+
type: z15.enum(["image/jpeg", "image/png"]),
|
|
1468
|
+
size: z15.number()
|
|
1462
1469
|
});
|
|
1463
|
-
var errorSchema =
|
|
1464
|
-
error:
|
|
1465
|
-
code:
|
|
1466
|
-
missing:
|
|
1470
|
+
var errorSchema = z15.object({
|
|
1471
|
+
error: z15.string(),
|
|
1472
|
+
code: z15.string().optional(),
|
|
1473
|
+
missing: z15.array(z15.object({ quest: identifier, title: z15.string() })).optional()
|
|
1467
1474
|
});
|
|
1468
|
-
var staffDecisionSchema =
|
|
1475
|
+
var staffDecisionSchema = z15.object({
|
|
1469
1476
|
actionId: identifier,
|
|
1470
|
-
generation:
|
|
1471
|
-
decision:
|
|
1472
|
-
reason:
|
|
1477
|
+
generation: z15.number().int().nonnegative(),
|
|
1478
|
+
decision: z15.enum(["accept", "reject"]),
|
|
1479
|
+
reason: z15.string().trim().min(1).max(2e3)
|
|
1473
1480
|
}).strict();
|
|
1474
|
-
var stockSchema =
|
|
1475
|
-
var reservationSchema =
|
|
1481
|
+
var stockSchema = z15.object({ item: identifier, quantity: z15.number().int().min(0).max(1e4) }).strict();
|
|
1482
|
+
var reservationSchema = z15.object({
|
|
1476
1483
|
actionId: identifier,
|
|
1477
1484
|
member: identifier,
|
|
1478
1485
|
item: identifier,
|
|
1479
1486
|
balance: identifier,
|
|
1480
|
-
price:
|
|
1487
|
+
price: z15.number().int().positive().max(1e4)
|
|
1481
1488
|
}).strict();
|
|
1482
1489
|
var pageOptions = {
|
|
1483
|
-
limit:
|
|
1484
|
-
cursor:
|
|
1490
|
+
limit: z15.number().int().min(1).max(100).default(25),
|
|
1491
|
+
cursor: z15.string().min(1).max(4096).optional()
|
|
1485
1492
|
};
|
|
1486
|
-
var reviewListSchema =
|
|
1493
|
+
var reviewListSchema = z15.object({
|
|
1487
1494
|
...pageOptions,
|
|
1488
1495
|
member: identifier.optional(),
|
|
1489
1496
|
quest: identifier.optional()
|
|
1490
1497
|
}).strict();
|
|
1491
|
-
var memberListSchema =
|
|
1498
|
+
var memberListSchema = z15.object({
|
|
1492
1499
|
...pageOptions,
|
|
1493
1500
|
prefix: identifier.optional()
|
|
1494
1501
|
}).strict();
|
|
1495
|
-
var reviewItemSchema =
|
|
1502
|
+
var reviewItemSchema = z15.object({
|
|
1496
1503
|
attempt: attemptSchema,
|
|
1497
|
-
title:
|
|
1498
|
-
checks:
|
|
1499
|
-
|
|
1504
|
+
title: z15.string(),
|
|
1505
|
+
checks: z15.array(
|
|
1506
|
+
z15.object({ criteria: z15.string(), result: photoResultSchema })
|
|
1500
1507
|
)
|
|
1501
1508
|
});
|
|
1502
|
-
var reviewPageSchema =
|
|
1503
|
-
items:
|
|
1504
|
-
nextCursor:
|
|
1509
|
+
var reviewPageSchema = z15.object({
|
|
1510
|
+
items: z15.array(reviewItemSchema).max(100),
|
|
1511
|
+
nextCursor: z15.string().nullable()
|
|
1505
1512
|
});
|
|
1506
|
-
var memberPageSchema =
|
|
1507
|
-
items:
|
|
1508
|
-
nextCursor:
|
|
1513
|
+
var memberPageSchema = z15.object({
|
|
1514
|
+
items: z15.array(z15.object({ member: identifier })).max(100),
|
|
1515
|
+
nextCursor: z15.string().nullable()
|
|
1509
1516
|
});
|
|
1510
|
-
var createStockItemSchema =
|
|
1511
|
-
var stockItemSchema =
|
|
1512
|
-
var contentPerformanceSnapshotSchema =
|
|
1517
|
+
var createStockItemSchema = z15.object({ actionId: identifier, name: z15.string().trim().min(1).max(80) }).strict();
|
|
1518
|
+
var stockItemSchema = z15.object({ id: identifier, name: z15.string() });
|
|
1519
|
+
var contentPerformanceSnapshotSchema = z15.strictObject({
|
|
1513
1520
|
contentAttempt: identifier,
|
|
1514
1521
|
observation: identifier,
|
|
1515
|
-
observedAt:
|
|
1522
|
+
observedAt: z15.number().int().safe().nonnegative(),
|
|
1516
1523
|
metrics: contentMetricsSchema,
|
|
1517
1524
|
rewards: rewardBundleSchema
|
|
1518
1525
|
});
|
|
1519
1526
|
var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
|
|
1520
|
-
content:
|
|
1527
|
+
content: z15.string().min(1).max(256)
|
|
1521
1528
|
});
|
|
1522
|
-
var contentPerformancePageSchema =
|
|
1523
|
-
current:
|
|
1524
|
-
state:
|
|
1529
|
+
var contentPerformancePageSchema = z15.strictObject({
|
|
1530
|
+
current: z15.strictObject({
|
|
1531
|
+
state: z15.enum([
|
|
1525
1532
|
"content-pending",
|
|
1526
1533
|
"content-unqualified",
|
|
1527
1534
|
"waiting",
|
|
@@ -1532,19 +1539,19 @@ var contentPerformancePageSchema = z14.strictObject({
|
|
|
1532
1539
|
"failed",
|
|
1533
1540
|
"superseded"
|
|
1534
1541
|
]),
|
|
1535
|
-
reason:
|
|
1542
|
+
reason: z15.string().nullable(),
|
|
1536
1543
|
contentAttempt: identifier,
|
|
1537
1544
|
attempt: identifier.nullable(),
|
|
1538
1545
|
reward: contentQualificationSchema.shape.reward
|
|
1539
1546
|
}),
|
|
1540
|
-
items:
|
|
1541
|
-
|
|
1547
|
+
items: z15.array(
|
|
1548
|
+
z15.strictObject({
|
|
1542
1549
|
attempt: identifier,
|
|
1543
1550
|
contentAttempt: identifier,
|
|
1544
1551
|
observation: identifier,
|
|
1545
|
-
observedAt:
|
|
1552
|
+
observedAt: z15.number(),
|
|
1546
1553
|
metrics: contentMetricsSchema,
|
|
1547
|
-
state:
|
|
1554
|
+
state: z15.enum([
|
|
1548
1555
|
"pending",
|
|
1549
1556
|
"qualified",
|
|
1550
1557
|
"unqualified",
|
|
@@ -1552,10 +1559,10 @@ var contentPerformancePageSchema = z14.strictObject({
|
|
|
1552
1559
|
"failed",
|
|
1553
1560
|
"superseded"
|
|
1554
1561
|
]),
|
|
1555
|
-
reason:
|
|
1562
|
+
reason: z15.string().nullable()
|
|
1556
1563
|
})
|
|
1557
1564
|
),
|
|
1558
|
-
|
|
1565
|
+
nextCursor: pageCursorSchema.nullable()
|
|
1559
1566
|
});
|
|
1560
1567
|
|
|
1561
1568
|
export {
|
|
@@ -1565,6 +1572,8 @@ export {
|
|
|
1565
1572
|
discordMessageInputSchema,
|
|
1566
1573
|
discordMemberSchema,
|
|
1567
1574
|
identifier,
|
|
1575
|
+
pageCursorSchema,
|
|
1576
|
+
pageQuerySchema,
|
|
1568
1577
|
xTweetSchema,
|
|
1569
1578
|
xContentBodySchema,
|
|
1570
1579
|
trackerContentQuerySchema,
|