@domino-sdk/relay 1.0.0-next.12 → 1.0.0-next.13
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 +25 -25
- package/dist/authoring.js +10 -3
- package/dist/browser.d.ts +19 -26
- package/dist/browser.js +6 -6
- package/dist/{catalog-qrYne8qV.d.ts → catalog-C85V1NgW.d.ts} +73 -79
- package/dist/{chunk-YYD4QUBO.js → chunk-CRNQP7NV.js} +550 -470
- package/dist/{chunk-22J4K7ED.js → chunk-EZWNGI5B.js} +4 -4
- package/dist/{chunk-7Q4BGGT6.js → chunk-FXYJ4OMX.js} +1 -1
- package/dist/{chunk-4LBUTHD6.js → chunk-II7DRZSL.js} +1 -1
- package/dist/{chunk-NZA2TLBF.js → chunk-KS33GOUL.js} +23 -8
- package/dist/{chunk-LY7SXUNW.js → chunk-M64XHC42.js} +4 -4
- package/dist/{chunk-UW5CQHPQ.js → chunk-MNQI35OG.js} +3 -3
- package/dist/{chunk-5L7XZA4Y.js → chunk-OA2KMQVZ.js} +31 -25
- package/dist/{chunk-EWFB35JW.js → chunk-WQ24ILGO.js} +2 -2
- package/dist/{client-CW72TaAs.d.ts → client-Bf9PNUIi.d.ts} +18 -25
- package/dist/{deployments-Bc0dPSXN.d.ts → deployments-CNCP0JnD.d.ts} +269 -138
- package/dist/{images-D0Txfte6.d.ts → images-BG4pdO4y.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +4 -4
- package/dist/{observations-bFY4yv2K.d.ts → observations-CQ6IcNuQ.d.ts} +3 -3
- package/dist/portal-proxy.js +2 -2
- package/dist/react/index.d.ts +19 -27
- package/dist/react/index.js +7 -7
- package/dist/{referrals-CvSmxvjm.d.ts → referrals-KQfP4pBf.d.ts} +189 -102
- package/dist/{schema-ZfjL-d1N.d.ts → schema-BF_TQsmT.d.ts} +338 -47
- package/dist/schema.d.ts +8 -8
- package/dist/schema.js +28 -8
- package/dist/server/index.d.ts +542 -508
- package/dist/server/index.js +31 -7
- package/dist/{streaks-CwGReWGt.d.ts → streaks-CWyq8Px5.d.ts} +2 -4
- package/dist/{trackers-BsUh5Ky0.d.ts → trackers-W7nRdRr7.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -588,7 +588,7 @@ function schemaCheckedReader(reader) {
|
|
|
588
588
|
}
|
|
589
589
|
const issues = trackerDataIssues(
|
|
590
590
|
schema,
|
|
591
|
-
page.items.map((
|
|
591
|
+
page.items.map((record2) => record2.data)
|
|
592
592
|
);
|
|
593
593
|
const items = page.items.filter((_, index) => !issues[index]);
|
|
594
594
|
return { ...page, items, excluded: page.items.length - items.length };
|
|
@@ -1103,64 +1103,131 @@ var contentPerformancePolicySchema = z6.strictObject({
|
|
|
1103
1103
|
maxAgeMs: z6.number().int().positive().max(864e5).default(36e5)
|
|
1104
1104
|
});
|
|
1105
1105
|
|
|
1106
|
-
// src/
|
|
1106
|
+
// src/calendar.ts
|
|
1107
1107
|
import { z as z7 } from "zod";
|
|
1108
|
-
var
|
|
1108
|
+
var timestamp3 = z7.number().int().safe();
|
|
1109
|
+
var fixedOffset = /^(?:[+-]|(?:Etc\/)?GMT[+-]\d|(?:EST|MST|HST)$)/i;
|
|
1110
|
+
function canonicalTimeZone(zone) {
|
|
1111
|
+
let resolved;
|
|
1109
1112
|
try {
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1113
|
-
new Intl.DateTimeFormat("en", { timeZone: zone });
|
|
1114
|
-
return true;
|
|
1113
|
+
resolved = new Intl.DateTimeFormat("en", {
|
|
1114
|
+
timeZone: zone
|
|
1115
|
+
}).resolvedOptions().timeZone;
|
|
1115
1116
|
} catch {
|
|
1116
|
-
return
|
|
1117
|
+
return null;
|
|
1117
1118
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1119
|
+
if (resolved === "UTC") {
|
|
1120
|
+
return "UTC";
|
|
1121
|
+
}
|
|
1122
|
+
return fixedOffset.test(zone) || fixedOffset.test(resolved) ? null : resolved;
|
|
1123
|
+
}
|
|
1124
|
+
var timeZoneSchema = z7.string().min(1).max(100).transform((zone, ctx) => {
|
|
1125
|
+
const canonical = canonicalTimeZone(zone);
|
|
1126
|
+
if (canonical === null) {
|
|
1127
|
+
ctx.addIssue({
|
|
1128
|
+
code: "custom",
|
|
1129
|
+
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"
|
|
1130
|
+
});
|
|
1131
|
+
return z7.NEVER;
|
|
1132
|
+
}
|
|
1133
|
+
return canonical;
|
|
1134
|
+
});
|
|
1135
|
+
var timeZoneNameSchema = z7.string().min(1).max(100);
|
|
1136
|
+
var movedTimeZone = (what) => `${what} no longer take a timeZone: they follow the project calendar. Set calendar.timeZone in relay.json or in Console settings.`;
|
|
1137
|
+
var record = (value) => typeof value === "object" && value !== null;
|
|
1138
|
+
function refuseStreakTimeZone(value, ctx) {
|
|
1139
|
+
if (record(value) && value.kind === "streak" && "timeZone" in value) {
|
|
1140
|
+
ctx.addIssue({
|
|
1141
|
+
code: "custom",
|
|
1142
|
+
path: ["timeZone"],
|
|
1143
|
+
message: movedTimeZone("Streaks")
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
return value;
|
|
1147
|
+
}
|
|
1148
|
+
function refuseWindowTimeZone(value, ctx) {
|
|
1149
|
+
const window = record(value) ? value.window : void 0;
|
|
1150
|
+
if (record(window) && window.kind === "calendar" && "timeZone" in window) {
|
|
1151
|
+
ctx.addIssue({
|
|
1152
|
+
code: "custom",
|
|
1153
|
+
path: ["window", "timeZone"],
|
|
1154
|
+
message: movedTimeZone("Calendar leaderboard windows")
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
return value;
|
|
1158
|
+
}
|
|
1159
|
+
var calendarPeriodSchema = z7.enum(["lifetime", "day", "week", "month"]);
|
|
1160
|
+
var projectCalendarSchema = z7.object({
|
|
1161
|
+
/** The timezone of the current calendar day. */
|
|
1162
|
+
timeZone: timeZoneNameSchema,
|
|
1163
|
+
/** The current calendar date, such as `2026-10-01`. */
|
|
1128
1164
|
today: z7.string(),
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1165
|
+
/** When the current calendar day ends, in epoch milliseconds. */
|
|
1166
|
+
nextBoundary: timestamp3,
|
|
1167
|
+
/** A change that takes effect at the next day boundary, or null. */
|
|
1168
|
+
pending: z7.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp3 }).nullable(),
|
|
1169
|
+
/** The `calendar.timeZone` the last deployment that declared one set, or null. */
|
|
1170
|
+
declared: timeZoneNameSchema.nullable(),
|
|
1171
|
+
/**
|
|
1172
|
+
* A stored timezone the calendar no longer accepts, such as a fixed offset a streak named before
|
|
1173
|
+
* v1. The calendar reads it as UTC until an operator chooses a timezone. Null otherwise.
|
|
1174
|
+
*/
|
|
1175
|
+
unsupported: z7.string().nullable().default(null)
|
|
1176
|
+
});
|
|
1177
|
+
var projectCalendarInputSchema = z7.object({
|
|
1178
|
+
actionId: identifier,
|
|
1179
|
+
timeZone: timeZoneSchema,
|
|
1180
|
+
reason: z7.string().trim().min(1).max(500)
|
|
1181
|
+
}).strict();
|
|
1182
|
+
var projectCalendarDeclarationSchema = z7.object({ timeZone: timeZoneSchema }).strict();
|
|
1183
|
+
|
|
1184
|
+
// src/streaks.ts
|
|
1185
|
+
import { z as z8 } from "zod";
|
|
1186
|
+
var streakPolicySchema = z8.object({
|
|
1187
|
+
kind: z8.literal("streak"),
|
|
1188
|
+
days: z8.number().int().min(1).max(3650)
|
|
1189
|
+
});
|
|
1190
|
+
var streakProgressSchema = z8.object({
|
|
1191
|
+
goal: z8.number().int().positive(),
|
|
1192
|
+
current: z8.number().int().nonnegative(),
|
|
1193
|
+
best: z8.number().int().nonnegative(),
|
|
1194
|
+
today: z8.string(),
|
|
1195
|
+
todayQualified: z8.boolean(),
|
|
1196
|
+
timeZone: timeZoneNameSchema,
|
|
1197
|
+
nextBoundary: z8.number().int(),
|
|
1198
|
+
pendingTimeZone: z8.object({
|
|
1199
|
+
timeZone: timeZoneNameSchema,
|
|
1200
|
+
effectiveAt: z8.number().int()
|
|
1135
1201
|
}).nullable(),
|
|
1136
|
-
days:
|
|
1137
|
-
|
|
1138
|
-
day:
|
|
1139
|
-
date:
|
|
1140
|
-
|
|
1141
|
-
|
|
1202
|
+
days: z8.array(
|
|
1203
|
+
z8.object({
|
|
1204
|
+
day: z8.number().int(),
|
|
1205
|
+
date: z8.string(),
|
|
1206
|
+
// The zone the day was recorded in, as stored: days from before v1 can name a fixed offset.
|
|
1207
|
+
timeZone: z8.string(),
|
|
1208
|
+
occurredAt: z8.number().int()
|
|
1142
1209
|
})
|
|
1143
1210
|
),
|
|
1144
|
-
milestone:
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
status:
|
|
1148
|
-
completion:
|
|
1149
|
-
achievedAt:
|
|
1211
|
+
milestone: z8.discriminatedUnion("status", [
|
|
1212
|
+
z8.object({ status: z8.literal("pending") }),
|
|
1213
|
+
z8.object({
|
|
1214
|
+
status: z8.literal("awarded"),
|
|
1215
|
+
completion: z8.string(),
|
|
1216
|
+
achievedAt: z8.number().int()
|
|
1150
1217
|
}),
|
|
1151
|
-
|
|
1152
|
-
status:
|
|
1153
|
-
budget:
|
|
1154
|
-
achievedAt:
|
|
1218
|
+
z8.object({
|
|
1219
|
+
status: z8.literal("budget-exhausted"),
|
|
1220
|
+
budget: z8.string(),
|
|
1221
|
+
achievedAt: z8.number().int()
|
|
1155
1222
|
})
|
|
1156
1223
|
])
|
|
1157
1224
|
});
|
|
1158
1225
|
|
|
1159
1226
|
// src/tracker-triggers.ts
|
|
1160
|
-
import { z as
|
|
1161
|
-
var
|
|
1162
|
-
var count2 =
|
|
1163
|
-
var trackerTriggerModeSchema =
|
|
1227
|
+
import { z as z9 } from "zod";
|
|
1228
|
+
var timestamp4 = z9.number().int().safe().nonnegative().max(864e13);
|
|
1229
|
+
var count2 = z9.number().int().safe().nonnegative();
|
|
1230
|
+
var trackerTriggerModeSchema = z9.enum([
|
|
1164
1231
|
"new-record",
|
|
1165
1232
|
"new-observation",
|
|
1166
1233
|
"data-changed"
|
|
@@ -1168,20 +1235,20 @@ var trackerTriggerModeSchema = z8.enum([
|
|
|
1168
1235
|
function defaultTriggerMode(source) {
|
|
1169
1236
|
return source === "x-search" ? "new-record" : "new-observation";
|
|
1170
1237
|
}
|
|
1171
|
-
var trackerBoundSchema =
|
|
1172
|
-
|
|
1173
|
-
|
|
1238
|
+
var trackerBoundSchema = z9.union([
|
|
1239
|
+
z9.number().finite(),
|
|
1240
|
+
z9.strictObject({ setting: z9.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
|
|
1174
1241
|
]);
|
|
1175
|
-
var dataPath =
|
|
1242
|
+
var dataPath = z9.string().max(200).regex(
|
|
1176
1243
|
/^[^.\s]+(\.[^.\s]+)*$/,
|
|
1177
1244
|
"Use dot-separated keys, such as metrics.likes"
|
|
1178
1245
|
);
|
|
1179
|
-
var trackerConditionSchema =
|
|
1180
|
-
|
|
1246
|
+
var trackerConditionSchema = z9.union([
|
|
1247
|
+
z9.strictObject({
|
|
1181
1248
|
path: dataPath,
|
|
1182
|
-
equals:
|
|
1249
|
+
equals: z9.union([z9.string().max(1e3), z9.number().finite(), z9.boolean()])
|
|
1183
1250
|
}),
|
|
1184
|
-
|
|
1251
|
+
z9.strictObject({
|
|
1185
1252
|
path: dataPath,
|
|
1186
1253
|
gt: trackerBoundSchema.optional(),
|
|
1187
1254
|
gte: trackerBoundSchema.optional(),
|
|
@@ -1194,9 +1261,9 @@ var trackerConditionSchema = z8.union([
|
|
|
1194
1261
|
"Compare with equals, gt, gte, lt or lte"
|
|
1195
1262
|
)
|
|
1196
1263
|
]);
|
|
1197
|
-
var trackerWhereSchema =
|
|
1264
|
+
var trackerWhereSchema = z9.union([
|
|
1198
1265
|
trackerConditionSchema,
|
|
1199
|
-
|
|
1266
|
+
z9.array(trackerConditionSchema).min(1).max(10)
|
|
1200
1267
|
]);
|
|
1201
1268
|
function whereConditions(where) {
|
|
1202
1269
|
return where === void 0 ? [] : Array.isArray(where) ? where : [where];
|
|
@@ -1208,10 +1275,10 @@ function whereSettings(where) {
|
|
|
1208
1275
|
)
|
|
1209
1276
|
);
|
|
1210
1277
|
}
|
|
1211
|
-
var trackerTriggerPolicySchema =
|
|
1278
|
+
var trackerTriggerPolicySchema = z9.strictObject({
|
|
1212
1279
|
/** The tracker's authoring key; publication binds it to the tracker's stable ID. */
|
|
1213
1280
|
tracker: identifier,
|
|
1214
|
-
source:
|
|
1281
|
+
source: z9.enum(["x-search", "custom"]),
|
|
1215
1282
|
/** Which observations fire; absent means the source's default (`defaultTriggerMode`). */
|
|
1216
1283
|
on: trackerTriggerModeSchema.optional(),
|
|
1217
1284
|
where: trackerWhereSchema.optional(),
|
|
@@ -1220,7 +1287,7 @@ var trackerTriggerPolicySchema = z8.strictObject({
|
|
|
1220
1287
|
* a custom record. Relay attributes it through verified links; evaluators cannot redirect it.
|
|
1221
1288
|
* Releases published before account roles store `"replied-to"` for `inReplyTo`.
|
|
1222
1289
|
*/
|
|
1223
|
-
beneficiary:
|
|
1290
|
+
beneficiary: z9.union([accountRoleSchema, z9.literal("replied-to")])
|
|
1224
1291
|
});
|
|
1225
1292
|
function triggerMode(policy) {
|
|
1226
1293
|
return policy.on ?? defaultTriggerMode(policy.source);
|
|
@@ -1229,52 +1296,52 @@ function beneficiaryRole(policy) {
|
|
|
1229
1296
|
return policy.beneficiary === "replied-to" ? "inReplyTo" : policy.beneficiary;
|
|
1230
1297
|
}
|
|
1231
1298
|
var xLink = {
|
|
1232
|
-
issuer:
|
|
1299
|
+
issuer: z9.string().min(1),
|
|
1233
1300
|
/** The account's stable user ID. */
|
|
1234
|
-
subject:
|
|
1301
|
+
subject: z9.string().min(1).max(256),
|
|
1235
1302
|
/** The member's account selection revision. */
|
|
1236
1303
|
revision: count2,
|
|
1237
1304
|
/** When the member linked the account; null when unknown. */
|
|
1238
|
-
linkedAt:
|
|
1305
|
+
linkedAt: timestamp4.nullable()
|
|
1239
1306
|
};
|
|
1240
|
-
var trackerAttributionSchema =
|
|
1307
|
+
var trackerAttributionSchema = z9.strictObject({
|
|
1241
1308
|
member: identifier,
|
|
1242
|
-
capturedAt:
|
|
1243
|
-
account:
|
|
1244
|
-
|
|
1245
|
-
provider:
|
|
1309
|
+
capturedAt: timestamp4,
|
|
1310
|
+
account: z9.discriminatedUnion("provider", [
|
|
1311
|
+
z9.strictObject({
|
|
1312
|
+
provider: z9.literal("wallet"),
|
|
1246
1313
|
/** Canonical CAIP-10 account ID, as the record names it. */
|
|
1247
|
-
id:
|
|
1314
|
+
id: z9.string().min(5).max(256),
|
|
1248
1315
|
/** The wallet link's revision. */
|
|
1249
1316
|
revision: count2,
|
|
1250
1317
|
/** When the member verified the wallet. */
|
|
1251
|
-
linkedAt:
|
|
1318
|
+
linkedAt: timestamp4.nullable()
|
|
1252
1319
|
}),
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
provider:
|
|
1320
|
+
z9.strictObject({ provider: z9.literal("x"), ...xLink }),
|
|
1321
|
+
z9.strictObject({ provider: z9.literal("discord"), ...xLink }),
|
|
1322
|
+
z9.strictObject({
|
|
1323
|
+
provider: z9.literal("member"),
|
|
1257
1324
|
/** The member ID the record names. */
|
|
1258
1325
|
id: identifier
|
|
1259
1326
|
})
|
|
1260
1327
|
])
|
|
1261
1328
|
});
|
|
1262
|
-
var trackerTriggerRecordSchema =
|
|
1263
|
-
id:
|
|
1264
|
-
source:
|
|
1265
|
-
occurredAt:
|
|
1266
|
-
observedAt:
|
|
1267
|
-
firstSeenAt:
|
|
1268
|
-
author:
|
|
1269
|
-
id:
|
|
1270
|
-
verified:
|
|
1329
|
+
var trackerTriggerRecordSchema = z9.strictObject({
|
|
1330
|
+
id: z9.string().min(1).max(256),
|
|
1331
|
+
source: z9.string(),
|
|
1332
|
+
occurredAt: timestamp4,
|
|
1333
|
+
observedAt: timestamp4,
|
|
1334
|
+
firstSeenAt: timestamp4,
|
|
1335
|
+
author: z9.strictObject({
|
|
1336
|
+
id: z9.string().min(1).max(256),
|
|
1337
|
+
verified: z9.boolean().nullable(),
|
|
1271
1338
|
kind: identityKindSchema.optional()
|
|
1272
1339
|
}).nullable(),
|
|
1273
|
-
accounts:
|
|
1274
|
-
data:
|
|
1275
|
-
removed:
|
|
1340
|
+
accounts: z9.record(accountRoleSchema, trackerAccountSchema).optional(),
|
|
1341
|
+
data: z9.record(z9.string(), z9.json()),
|
|
1342
|
+
removed: z9.boolean()
|
|
1276
1343
|
});
|
|
1277
|
-
var trackerTriggerContextSchema =
|
|
1344
|
+
var trackerTriggerContextSchema = z9.strictObject({
|
|
1278
1345
|
/** The tracker's stable ID. */
|
|
1279
1346
|
tracker: identifier,
|
|
1280
1347
|
/** The tracker's authoring key. */
|
|
@@ -1283,10 +1350,10 @@ var trackerTriggerContextSchema = z8.strictObject({
|
|
|
1283
1350
|
* The record account the attempt pays, as the quest's release names it. Releases published
|
|
1284
1351
|
* before account roles name `inReplyTo` `"replied-to"`, which their bundled evaluators expect.
|
|
1285
1352
|
*/
|
|
1286
|
-
beneficiary:
|
|
1353
|
+
beneficiary: z9.union([accountRoleSchema, z9.literal("replied-to")]),
|
|
1287
1354
|
record: trackerTriggerRecordSchema,
|
|
1288
1355
|
/** The captured X post of this observation; null for custom trackers. */
|
|
1289
|
-
x:
|
|
1356
|
+
x: z9.strictObject({
|
|
1290
1357
|
evidence: trackerEvidenceSchema,
|
|
1291
1358
|
content: xContentBodySchema
|
|
1292
1359
|
}).nullable(),
|
|
@@ -1294,99 +1361,100 @@ var trackerTriggerContextSchema = z8.strictObject({
|
|
|
1294
1361
|
});
|
|
1295
1362
|
|
|
1296
1363
|
// src/observations.ts
|
|
1297
|
-
import { z as
|
|
1298
|
-
var name =
|
|
1299
|
-
var observationInputSchema =
|
|
1364
|
+
import { z as z10 } from "zod";
|
|
1365
|
+
var name = z10.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
|
|
1366
|
+
var observationInputSchema = z10.object({
|
|
1300
1367
|
id: name,
|
|
1301
1368
|
source: name,
|
|
1302
1369
|
type: name,
|
|
1303
1370
|
member: identifier,
|
|
1304
|
-
actor:
|
|
1305
|
-
occurredAt:
|
|
1306
|
-
data:
|
|
1371
|
+
actor: z10.object({ provider: identifier, subject: z10.string().min(1).max(200) }).strict().optional(),
|
|
1372
|
+
occurredAt: z10.number().int().nonnegative().max(864e13),
|
|
1373
|
+
data: z10.record(z10.string(), z10.json())
|
|
1307
1374
|
}).strict().refine(
|
|
1308
1375
|
(value) => JSON.stringify(value.data).length <= 32768,
|
|
1309
1376
|
"Observation data exceeds 32 KB"
|
|
1310
1377
|
);
|
|
1311
1378
|
var observationSchema = observationInputSchema.safeExtend({
|
|
1312
|
-
receivedAt:
|
|
1379
|
+
receivedAt: z10.number().int().nonnegative()
|
|
1313
1380
|
});
|
|
1314
|
-
var observationTriggerSchema =
|
|
1315
|
-
var completionPolicySchema =
|
|
1381
|
+
var observationTriggerSchema = z10.object({ source: name, type: name }).strict();
|
|
1382
|
+
var completionPolicySchema = z10.discriminatedUnion("kind", [
|
|
1316
1383
|
streakPolicySchema,
|
|
1317
|
-
|
|
1318
|
-
|
|
1384
|
+
z10.object({ kind: z10.literal("once") }).strict(),
|
|
1385
|
+
z10.object({ kind: z10.literal("keyed") }).strict()
|
|
1319
1386
|
]);
|
|
1320
|
-
var completionKeySchema =
|
|
1321
|
-
var budgetSchema =
|
|
1387
|
+
var completionKeySchema = z10.string().min(1).max(500);
|
|
1388
|
+
var budgetSchema = z10.object({
|
|
1322
1389
|
id: name,
|
|
1323
|
-
scope:
|
|
1390
|
+
scope: z10.enum(["member", "project"]),
|
|
1324
1391
|
/**
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1392
|
+
* The project calendar period of the attempt's eligibility time that one bucket covers:
|
|
1393
|
+
* `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
|
|
1394
|
+
* `"lifetime"` never resets.
|
|
1327
1395
|
*/
|
|
1328
|
-
period:
|
|
1329
|
-
limit:
|
|
1330
|
-
cost:
|
|
1331
|
-
|
|
1332
|
-
|
|
1396
|
+
period: calendarPeriodSchema,
|
|
1397
|
+
limit: z10.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
1398
|
+
cost: z10.union([
|
|
1399
|
+
z10.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
1400
|
+
z10.object({ balance: name }).strict()
|
|
1333
1401
|
])
|
|
1334
1402
|
}).strict();
|
|
1335
|
-
var observationReceiptSchema =
|
|
1403
|
+
var observationReceiptSchema = z10.object({
|
|
1336
1404
|
id: name,
|
|
1337
1405
|
source: name,
|
|
1338
|
-
attempts:
|
|
1339
|
-
receivedAt:
|
|
1340
|
-
});
|
|
1341
|
-
var discordReactionSchema =
|
|
1342
|
-
guildId:
|
|
1343
|
-
channelId:
|
|
1344
|
-
messageId:
|
|
1345
|
-
userId:
|
|
1346
|
-
messageAuthorId:
|
|
1347
|
-
actorRoles:
|
|
1348
|
-
emoji:
|
|
1349
|
-
messagePublishedAt:
|
|
1406
|
+
attempts: z10.array(z10.string()),
|
|
1407
|
+
receivedAt: z10.number()
|
|
1408
|
+
});
|
|
1409
|
+
var discordReactionSchema = z10.object({
|
|
1410
|
+
guildId: z10.string(),
|
|
1411
|
+
channelId: z10.string(),
|
|
1412
|
+
messageId: z10.string(),
|
|
1413
|
+
userId: z10.string(),
|
|
1414
|
+
messageAuthorId: z10.string().nullable().default(null),
|
|
1415
|
+
actorRoles: z10.array(z10.string()).default([]),
|
|
1416
|
+
emoji: z10.object({ id: z10.string().nullable(), name: z10.string() }),
|
|
1417
|
+
messagePublishedAt: z10.number()
|
|
1350
1418
|
}).strict();
|
|
1351
|
-
var discordMessageSchema =
|
|
1352
|
-
guildId:
|
|
1353
|
-
channelId:
|
|
1354
|
-
messageId:
|
|
1355
|
-
userId:
|
|
1356
|
-
content:
|
|
1357
|
-
replyTo:
|
|
1358
|
-
publishedAt:
|
|
1419
|
+
var discordMessageSchema = z10.object({
|
|
1420
|
+
guildId: z10.string(),
|
|
1421
|
+
channelId: z10.string(),
|
|
1422
|
+
messageId: z10.string(),
|
|
1423
|
+
userId: z10.string(),
|
|
1424
|
+
content: z10.string().nullable(),
|
|
1425
|
+
replyTo: z10.string().nullable(),
|
|
1426
|
+
publishedAt: z10.number()
|
|
1359
1427
|
}).strict();
|
|
1360
1428
|
|
|
1361
1429
|
// src/integrations.ts
|
|
1362
|
-
import { z as
|
|
1363
|
-
var integrationProviderSchema =
|
|
1364
|
-
var discordServerSchema =
|
|
1365
|
-
id:
|
|
1366
|
-
name:
|
|
1367
|
-
icon:
|
|
1430
|
+
import { z as z11 } from "zod";
|
|
1431
|
+
var integrationProviderSchema = z11.enum(["discord"]);
|
|
1432
|
+
var discordServerSchema = z11.object({
|
|
1433
|
+
id: z11.string().regex(/^[0-9]{1,20}$/),
|
|
1434
|
+
name: z11.string().min(1),
|
|
1435
|
+
icon: z11.string().nullable()
|
|
1368
1436
|
});
|
|
1369
|
-
var projectIntegrationSchema =
|
|
1437
|
+
var projectIntegrationSchema = z11.object({
|
|
1370
1438
|
provider: integrationProviderSchema,
|
|
1371
|
-
configured:
|
|
1372
|
-
status:
|
|
1373
|
-
revision:
|
|
1439
|
+
configured: z11.boolean(),
|
|
1440
|
+
status: z11.enum(["disconnected", "ready", "attention"]),
|
|
1441
|
+
revision: z11.number().int().nonnegative(),
|
|
1374
1442
|
server: discordServerSchema.nullable(),
|
|
1375
|
-
issue:
|
|
1376
|
-
connectedAt:
|
|
1443
|
+
issue: z11.string().nullable(),
|
|
1444
|
+
connectedAt: z11.number().default(0)
|
|
1377
1445
|
});
|
|
1378
1446
|
|
|
1379
1447
|
// src/submission-input.ts
|
|
1380
|
-
import { z as
|
|
1381
|
-
var textOptionsSchema =
|
|
1382
|
-
required:
|
|
1383
|
-
minLength:
|
|
1384
|
-
maxLength:
|
|
1448
|
+
import { z as z12 } from "zod";
|
|
1449
|
+
var textOptionsSchema = z12.object({
|
|
1450
|
+
required: z12.boolean().default(true),
|
|
1451
|
+
minLength: z12.number().int().min(0).max(1e4).default(1),
|
|
1452
|
+
maxLength: z12.number().int().min(1).max(1e4).default(1e4)
|
|
1385
1453
|
}).strict().refine(
|
|
1386
1454
|
(v) => v.minLength <= v.maxLength,
|
|
1387
1455
|
"minLength must not exceed maxLength"
|
|
1388
1456
|
);
|
|
1389
|
-
var hostSchema =
|
|
1457
|
+
var hostSchema = z12.string().min(1).max(253).refine((host) => {
|
|
1390
1458
|
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
1391
1459
|
return false;
|
|
1392
1460
|
}
|
|
@@ -1397,13 +1465,13 @@ var hostSchema = z11.string().min(1).max(253).refine((host) => {
|
|
|
1397
1465
|
return false;
|
|
1398
1466
|
}
|
|
1399
1467
|
}, "Use a hostname without a scheme, path, port, or wildcard");
|
|
1400
|
-
var urlOptionsSchema =
|
|
1401
|
-
required:
|
|
1402
|
-
allowedHosts:
|
|
1468
|
+
var urlOptionsSchema = z12.object({
|
|
1469
|
+
required: z12.boolean().default(true),
|
|
1470
|
+
allowedHosts: z12.array(hostSchema).min(1).max(100).optional()
|
|
1403
1471
|
}).strict();
|
|
1404
|
-
var textEvidenceSchema =
|
|
1405
|
-
var urlEvidenceSchema =
|
|
1406
|
-
var valueEvidenceSchema =
|
|
1472
|
+
var textEvidenceSchema = z12.object({ kind: z12.literal("text"), value: z12.string().max(1e4) }).strict();
|
|
1473
|
+
var urlEvidenceSchema = z12.object({ kind: z12.literal("url"), value: z12.string().max(2048) }).strict();
|
|
1474
|
+
var valueEvidenceSchema = z12.discriminatedUnion("kind", [
|
|
1407
1475
|
textEvidenceSchema,
|
|
1408
1476
|
urlEvidenceSchema
|
|
1409
1477
|
]);
|
|
@@ -1466,22 +1534,22 @@ function xPostId(value) {
|
|
|
1466
1534
|
}
|
|
1467
1535
|
|
|
1468
1536
|
// src/quiz.ts
|
|
1469
|
-
import { z as
|
|
1470
|
-
var quizId =
|
|
1471
|
-
var quizChoiceSchema =
|
|
1472
|
-
var quizQuestionSchema =
|
|
1537
|
+
import { z as z13 } from "zod";
|
|
1538
|
+
var quizId = z13.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
1539
|
+
var quizChoiceSchema = z13.object({ id: quizId, label: z13.string().trim().min(1).max(500) }).strict();
|
|
1540
|
+
var quizQuestionSchema = z13.object({
|
|
1473
1541
|
id: quizId,
|
|
1474
|
-
prompt:
|
|
1475
|
-
choices:
|
|
1542
|
+
prompt: z13.string().trim().min(1).max(1e3),
|
|
1543
|
+
choices: z13.array(quizChoiceSchema).min(2).max(8).refine(
|
|
1476
1544
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
1477
1545
|
"Choice IDs must be unique"
|
|
1478
1546
|
)
|
|
1479
1547
|
}).strict();
|
|
1480
|
-
var quizQuestionsSchema =
|
|
1548
|
+
var quizQuestionsSchema = z13.array(quizQuestionSchema).min(1).max(20).refine(
|
|
1481
1549
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
1482
1550
|
"Question IDs must be unique"
|
|
1483
1551
|
);
|
|
1484
|
-
var quizContentSchema =
|
|
1552
|
+
var quizContentSchema = z13.array(
|
|
1485
1553
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
1486
1554
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
1487
1555
|
"Choose a correct answer from the available choices"
|
|
@@ -1492,97 +1560,97 @@ var quizContentSchema = z12.array(
|
|
|
1492
1560
|
);
|
|
1493
1561
|
|
|
1494
1562
|
// src/resources.ts
|
|
1495
|
-
import { z as
|
|
1496
|
-
var channelSourceSchema =
|
|
1497
|
-
provider:
|
|
1498
|
-
resource:
|
|
1499
|
-
types:
|
|
1563
|
+
import { z as z14 } from "zod";
|
|
1564
|
+
var channelSourceSchema = z14.object({
|
|
1565
|
+
provider: z14.literal("discord"),
|
|
1566
|
+
resource: z14.literal("channel"),
|
|
1567
|
+
types: z14.array(z14.enum(["text", "announcement"])).min(1)
|
|
1500
1568
|
}).strict();
|
|
1501
|
-
var resourceSourceSchema =
|
|
1502
|
-
|
|
1503
|
-
provider:
|
|
1504
|
-
resource:
|
|
1569
|
+
var resourceSourceSchema = z14.union([
|
|
1570
|
+
z14.object({
|
|
1571
|
+
provider: z14.literal("domino"),
|
|
1572
|
+
resource: z14.literal("point-ledger")
|
|
1505
1573
|
}).strict(),
|
|
1506
1574
|
channelSourceSchema,
|
|
1507
|
-
|
|
1508
|
-
provider:
|
|
1509
|
-
resource:
|
|
1510
|
-
assignable:
|
|
1575
|
+
z14.object({
|
|
1576
|
+
provider: z14.literal("discord"),
|
|
1577
|
+
resource: z14.literal("role"),
|
|
1578
|
+
assignable: z14.boolean().default(false)
|
|
1511
1579
|
}).strict()
|
|
1512
1580
|
]);
|
|
1513
|
-
var resourceRequestSchema =
|
|
1581
|
+
var resourceRequestSchema = z14.object({
|
|
1514
1582
|
source: resourceSourceSchema,
|
|
1515
|
-
query:
|
|
1516
|
-
cursor:
|
|
1517
|
-
ids:
|
|
1583
|
+
query: z14.string().max(100).optional(),
|
|
1584
|
+
cursor: z14.string().regex(/^\d{1,6}$/).optional(),
|
|
1585
|
+
ids: z14.array(z14.string().min(1).max(100)).max(50).optional()
|
|
1518
1586
|
}).strict();
|
|
1519
|
-
var resourceOptionsSchema =
|
|
1520
|
-
revision:
|
|
1521
|
-
options:
|
|
1522
|
-
|
|
1523
|
-
id:
|
|
1524
|
-
label:
|
|
1525
|
-
description:
|
|
1526
|
-
group:
|
|
1527
|
-
disabledReason:
|
|
1587
|
+
var resourceOptionsSchema = z14.object({
|
|
1588
|
+
revision: z14.number().int(),
|
|
1589
|
+
options: z14.array(
|
|
1590
|
+
z14.object({
|
|
1591
|
+
id: z14.string(),
|
|
1592
|
+
label: z14.string(),
|
|
1593
|
+
description: z14.string().optional(),
|
|
1594
|
+
group: z14.string().optional(),
|
|
1595
|
+
disabledReason: z14.string().optional()
|
|
1528
1596
|
})
|
|
1529
1597
|
),
|
|
1530
|
-
cursor:
|
|
1598
|
+
cursor: z14.string().nullable()
|
|
1531
1599
|
});
|
|
1532
1600
|
|
|
1533
1601
|
// src/settings.ts
|
|
1534
|
-
import { z as
|
|
1602
|
+
import { z as z16 } from "zod";
|
|
1535
1603
|
|
|
1536
1604
|
// src/setting-values.ts
|
|
1537
|
-
import { z as
|
|
1538
|
-
var settingInstant =
|
|
1539
|
-
var settingResourceId =
|
|
1540
|
-
|
|
1541
|
-
|
|
1605
|
+
import { z as z15 } from "zod";
|
|
1606
|
+
var settingInstant = z15.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
|
|
1607
|
+
var settingResourceId = z15.union([
|
|
1608
|
+
z15.literal(""),
|
|
1609
|
+
z15.string().regex(/^\S{1,200}$/)
|
|
1542
1610
|
]);
|
|
1543
1611
|
|
|
1544
1612
|
// src/settings.ts
|
|
1545
|
-
var base = { label:
|
|
1546
|
-
var settingFieldSchema =
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1613
|
+
var base = { label: z16.string().min(1), description: z16.string().optional() };
|
|
1614
|
+
var settingFieldSchema = z16.discriminatedUnion("kind", [
|
|
1615
|
+
z16.object({ ...base, kind: z16.literal("point-ledger"), default: identifier }).strict(),
|
|
1616
|
+
z16.object({ ...base, kind: z16.literal("datetime"), default: settingInstant }).strict(),
|
|
1617
|
+
z16.object({
|
|
1550
1618
|
...base,
|
|
1551
|
-
kind:
|
|
1619
|
+
kind: z16.literal("resource"),
|
|
1552
1620
|
default: settingResourceId,
|
|
1553
1621
|
source: resourceSourceSchema
|
|
1554
1622
|
}).strict(),
|
|
1555
|
-
|
|
1556
|
-
|
|
1623
|
+
z16.object({ ...base, kind: z16.literal("quiz"), default: quizContentSchema }).strict(),
|
|
1624
|
+
z16.object({
|
|
1557
1625
|
...base,
|
|
1558
|
-
kind:
|
|
1559
|
-
default:
|
|
1560
|
-
minLength:
|
|
1561
|
-
maxLength:
|
|
1562
|
-
multiline:
|
|
1626
|
+
kind: z16.literal("text"),
|
|
1627
|
+
default: z16.string(),
|
|
1628
|
+
minLength: z16.number().int().nonnegative(),
|
|
1629
|
+
maxLength: z16.number().int().positive(),
|
|
1630
|
+
multiline: z16.boolean()
|
|
1563
1631
|
}).strict(),
|
|
1564
|
-
|
|
1632
|
+
z16.object({
|
|
1565
1633
|
...base,
|
|
1566
|
-
kind:
|
|
1567
|
-
default:
|
|
1568
|
-
min:
|
|
1569
|
-
max:
|
|
1634
|
+
kind: z16.literal("integer"),
|
|
1635
|
+
default: z16.number().int(),
|
|
1636
|
+
min: z16.number().int(),
|
|
1637
|
+
max: z16.number().int()
|
|
1570
1638
|
}).strict(),
|
|
1571
|
-
|
|
1572
|
-
|
|
1639
|
+
z16.object({ ...base, kind: z16.literal("boolean"), default: z16.boolean() }).strict(),
|
|
1640
|
+
z16.object({
|
|
1573
1641
|
...base,
|
|
1574
|
-
kind:
|
|
1575
|
-
default:
|
|
1576
|
-
options:
|
|
1642
|
+
kind: z16.literal("choice"),
|
|
1643
|
+
default: z16.string(),
|
|
1644
|
+
options: z16.array(z16.string().min(1)).min(1)
|
|
1577
1645
|
}).strict()
|
|
1578
1646
|
]);
|
|
1579
|
-
var settingsFieldsSchema =
|
|
1580
|
-
|
|
1647
|
+
var settingsFieldsSchema = z16.record(
|
|
1648
|
+
z16.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
1581
1649
|
settingFieldSchema
|
|
1582
1650
|
);
|
|
1583
|
-
var settingsValuesSchema =
|
|
1584
|
-
|
|
1585
|
-
|
|
1651
|
+
var settingsValuesSchema = z16.record(
|
|
1652
|
+
z16.string(),
|
|
1653
|
+
z16.union([z16.string(), z16.number().finite(), z16.boolean(), quizContentSchema])
|
|
1586
1654
|
);
|
|
1587
1655
|
function parseSettings(fields, input) {
|
|
1588
1656
|
const shape = {};
|
|
@@ -1601,20 +1669,20 @@ function parseSettings(fields, input) {
|
|
|
1601
1669
|
shape[key] = quizContentSchema.default(field.default);
|
|
1602
1670
|
break;
|
|
1603
1671
|
case "text":
|
|
1604
|
-
shape[key] =
|
|
1672
|
+
shape[key] = z16.string().min(field.minLength).max(field.maxLength).default(field.default);
|
|
1605
1673
|
break;
|
|
1606
1674
|
case "integer":
|
|
1607
|
-
shape[key] =
|
|
1675
|
+
shape[key] = z16.number().int().min(field.min).max(field.max).default(field.default);
|
|
1608
1676
|
break;
|
|
1609
1677
|
case "boolean":
|
|
1610
|
-
shape[key] =
|
|
1678
|
+
shape[key] = z16.boolean().default(field.default);
|
|
1611
1679
|
break;
|
|
1612
1680
|
case "choice":
|
|
1613
|
-
shape[key] =
|
|
1681
|
+
shape[key] = z16.enum(field.options).default(field.default);
|
|
1614
1682
|
break;
|
|
1615
1683
|
}
|
|
1616
1684
|
}
|
|
1617
|
-
return settingsValuesSchema.parse(
|
|
1685
|
+
return settingsValuesSchema.parse(z16.object(shape).strict().parse(input));
|
|
1618
1686
|
}
|
|
1619
1687
|
function missingResourceSettings(fields, values) {
|
|
1620
1688
|
return Object.entries(fields).filter(([key, field]) => field.kind === "resource" && !values[key]).map(([key]) => key);
|
|
@@ -1624,43 +1692,43 @@ function compatibleSettingKinds(previous, next) {
|
|
|
1624
1692
|
}
|
|
1625
1693
|
|
|
1626
1694
|
// src/schema.ts
|
|
1627
|
-
import { z as
|
|
1628
|
-
var pointsRewardSchema =
|
|
1629
|
-
kind:
|
|
1695
|
+
import { z as z17 } from "zod";
|
|
1696
|
+
var pointsRewardSchema = z17.object({
|
|
1697
|
+
kind: z17.literal("points").default("points"),
|
|
1630
1698
|
balance: identifier,
|
|
1631
|
-
amount:
|
|
1699
|
+
amount: z17.number().int().min(0).max(1e4)
|
|
1632
1700
|
}).strict();
|
|
1633
|
-
var tieredRewardDefinitionSchema =
|
|
1701
|
+
var tieredRewardDefinitionSchema = z17.object({
|
|
1634
1702
|
id: identifier,
|
|
1635
|
-
title:
|
|
1636
|
-
tiers:
|
|
1637
|
-
|
|
1703
|
+
title: z17.string().min(1).max(120),
|
|
1704
|
+
tiers: z17.array(
|
|
1705
|
+
z17.object({ id: identifier, title: z17.string().min(1).max(120) }).strict()
|
|
1638
1706
|
).min(1).max(20).refine(
|
|
1639
1707
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
1640
1708
|
"Tier IDs must be unique"
|
|
1641
1709
|
),
|
|
1642
|
-
inventory:
|
|
1643
|
-
fulfillment:
|
|
1710
|
+
inventory: z17.object({ kind: z17.literal("untracked") }).strict(),
|
|
1711
|
+
fulfillment: z17.object({ kind: z17.literal("staff-handover") }).strict()
|
|
1644
1712
|
}).strict();
|
|
1645
|
-
var tieredRewardReferenceSchema =
|
|
1713
|
+
var tieredRewardReferenceSchema = z17.object({
|
|
1646
1714
|
id: identifier,
|
|
1647
1715
|
key: identifier.nullable()
|
|
1648
1716
|
});
|
|
1649
|
-
var tierRewardSchema =
|
|
1650
|
-
kind:
|
|
1717
|
+
var tierRewardSchema = z17.object({
|
|
1718
|
+
kind: z17.literal("tier"),
|
|
1651
1719
|
reward: tieredRewardDefinitionSchema,
|
|
1652
1720
|
tier: identifier
|
|
1653
1721
|
}).strict().refine(
|
|
1654
1722
|
(value) => value.reward.tiers.some((t) => t.id === value.tier),
|
|
1655
1723
|
"Unknown reward tier"
|
|
1656
1724
|
);
|
|
1657
|
-
var integrationRewardSchema =
|
|
1658
|
-
kind:
|
|
1659
|
-
provider:
|
|
1660
|
-
action:
|
|
1661
|
-
roleId:
|
|
1725
|
+
var integrationRewardSchema = z17.object({
|
|
1726
|
+
kind: z17.literal("integration"),
|
|
1727
|
+
provider: z17.literal("discord"),
|
|
1728
|
+
action: z17.literal("grant-role"),
|
|
1729
|
+
roleId: z17.string().regex(/^[0-9]{1,20}$/)
|
|
1662
1730
|
}).strict();
|
|
1663
|
-
var rewardSchema =
|
|
1731
|
+
var rewardSchema = z17.union([
|
|
1664
1732
|
pointsRewardSchema,
|
|
1665
1733
|
tierRewardSchema,
|
|
1666
1734
|
integrationRewardSchema
|
|
@@ -1671,26 +1739,26 @@ function rewardKey(reward) {
|
|
|
1671
1739
|
}
|
|
1672
1740
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
1673
1741
|
}
|
|
1674
|
-
var triggerSchema =
|
|
1675
|
-
|
|
1676
|
-
kind:
|
|
1677
|
-
input:
|
|
1742
|
+
var triggerSchema = z17.union([
|
|
1743
|
+
z17.object({
|
|
1744
|
+
kind: z17.literal("manual"),
|
|
1745
|
+
input: z17.literal("text"),
|
|
1678
1746
|
constraints: textOptionsSchema,
|
|
1679
|
-
actor:
|
|
1747
|
+
actor: z17.enum(["member", "staff"]).optional()
|
|
1680
1748
|
}).strict(),
|
|
1681
|
-
|
|
1682
|
-
kind:
|
|
1683
|
-
input:
|
|
1749
|
+
z17.object({
|
|
1750
|
+
kind: z17.literal("manual"),
|
|
1751
|
+
input: z17.literal("url"),
|
|
1684
1752
|
constraints: urlOptionsSchema,
|
|
1685
|
-
actor:
|
|
1753
|
+
actor: z17.enum(["member", "staff"]).optional()
|
|
1686
1754
|
}).strict(),
|
|
1687
|
-
|
|
1688
|
-
kind:
|
|
1689
|
-
input:
|
|
1690
|
-
actor:
|
|
1755
|
+
z17.object({
|
|
1756
|
+
kind: z17.literal("manual"),
|
|
1757
|
+
input: z17.enum(["photo", "quiz", "none"]),
|
|
1758
|
+
actor: z17.enum(["member", "staff"]).optional()
|
|
1691
1759
|
}).strict(),
|
|
1692
|
-
|
|
1693
|
-
kind:
|
|
1760
|
+
z17.object({
|
|
1761
|
+
kind: z17.literal("automatic"),
|
|
1694
1762
|
observation: observationTriggerSchema.optional(),
|
|
1695
1763
|
content: contentPolicySchema.optional(),
|
|
1696
1764
|
tracker: trackerTriggerPolicySchema.optional()
|
|
@@ -1699,48 +1767,48 @@ var triggerSchema = z16.union([
|
|
|
1699
1767
|
"Choose one automatic trigger source"
|
|
1700
1768
|
)
|
|
1701
1769
|
]);
|
|
1702
|
-
var prerequisiteSchema =
|
|
1703
|
-
var photoResultSchema =
|
|
1704
|
-
kind:
|
|
1705
|
-
reason:
|
|
1770
|
+
var prerequisiteSchema = z17.object({ quest: identifier });
|
|
1771
|
+
var photoResultSchema = z17.object({
|
|
1772
|
+
kind: z17.enum(["pass", "fail", "unclear"]),
|
|
1773
|
+
reason: z17.string().min(1).max(2e3)
|
|
1706
1774
|
}).strict();
|
|
1707
|
-
var textReviewInputSchema =
|
|
1708
|
-
text:
|
|
1709
|
-
criteria:
|
|
1775
|
+
var textReviewInputSchema = z17.object({
|
|
1776
|
+
text: z17.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
1777
|
+
criteria: z17.string().trim().min(1).max(2e3)
|
|
1710
1778
|
}).strict();
|
|
1711
1779
|
var textResultSchema = photoResultSchema;
|
|
1712
|
-
var decisionSchema =
|
|
1713
|
-
|
|
1714
|
-
kind:
|
|
1715
|
-
rewards:
|
|
1780
|
+
var decisionSchema = z17.discriminatedUnion("kind", [
|
|
1781
|
+
z17.object({
|
|
1782
|
+
kind: z17.literal("accept"),
|
|
1783
|
+
rewards: z17.array(rewardSchema).max(10),
|
|
1716
1784
|
completionKey: completionKeySchema.optional()
|
|
1717
1785
|
}).strict(),
|
|
1718
|
-
|
|
1719
|
-
kind:
|
|
1720
|
-
reason:
|
|
1786
|
+
z17.object({
|
|
1787
|
+
kind: z17.literal("reject"),
|
|
1788
|
+
reason: z17.string().min(1).max(2e3),
|
|
1721
1789
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
1722
|
-
requestedReview:
|
|
1790
|
+
requestedReview: z17.literal(true).optional()
|
|
1723
1791
|
}).strict(),
|
|
1724
|
-
|
|
1725
|
-
kind:
|
|
1726
|
-
reason:
|
|
1727
|
-
rewards:
|
|
1792
|
+
z17.object({
|
|
1793
|
+
kind: z17.literal("review"),
|
|
1794
|
+
reason: z17.string().min(1).max(2e3),
|
|
1795
|
+
rewards: z17.array(rewardSchema).max(10).optional(),
|
|
1728
1796
|
completionKey: completionKeySchema.optional()
|
|
1729
1797
|
}).strict()
|
|
1730
1798
|
]);
|
|
1731
|
-
var reviewModeSchema =
|
|
1732
|
-
var storedReviewModeSchema =
|
|
1799
|
+
var reviewModeSchema = z17.enum(["workers-ai"]);
|
|
1800
|
+
var storedReviewModeSchema = z17.enum([
|
|
1733
1801
|
"fixture-pass",
|
|
1734
1802
|
"fixture-fail",
|
|
1735
1803
|
"fixture-unclear",
|
|
1736
1804
|
"fixture-error",
|
|
1737
1805
|
"workers-ai"
|
|
1738
1806
|
]);
|
|
1739
|
-
var rewardBundleSchema =
|
|
1807
|
+
var rewardBundleSchema = z17.array(rewardSchema).max(10).refine(
|
|
1740
1808
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
1741
1809
|
"Use one entry per balance or shared reward"
|
|
1742
1810
|
);
|
|
1743
|
-
var mediaUrlSchema =
|
|
1811
|
+
var mediaUrlSchema = z17.string().max(2e3).refine((value) => {
|
|
1744
1812
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
1745
1813
|
return true;
|
|
1746
1814
|
}
|
|
@@ -1750,82 +1818,85 @@ var mediaUrlSchema = z16.string().max(2e3).refine((value) => {
|
|
|
1750
1818
|
return false;
|
|
1751
1819
|
}
|
|
1752
1820
|
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
1753
|
-
var questPresentationSchema =
|
|
1821
|
+
var questPresentationSchema = z17.object({
|
|
1754
1822
|
quiz: quizQuestionsSchema.optional(),
|
|
1755
|
-
instructions:
|
|
1756
|
-
video:
|
|
1823
|
+
instructions: z17.string().max(4e3).optional(),
|
|
1824
|
+
video: z17.object({
|
|
1757
1825
|
url: mediaUrlSchema,
|
|
1758
1826
|
poster: mediaUrlSchema.optional(),
|
|
1759
|
-
captions:
|
|
1827
|
+
captions: z17.object({
|
|
1760
1828
|
url: mediaUrlSchema,
|
|
1761
|
-
language:
|
|
1762
|
-
label:
|
|
1829
|
+
language: z17.string().min(2).max(20),
|
|
1830
|
+
label: z17.string().min(1).max(80)
|
|
1763
1831
|
}).strict().optional()
|
|
1764
1832
|
}).strict().optional()
|
|
1765
1833
|
}).strict();
|
|
1766
|
-
var questProfileSchema =
|
|
1767
|
-
var questDescriptionSchema =
|
|
1834
|
+
var questProfileSchema = z17.object({ visible: z17.boolean() }).strict();
|
|
1835
|
+
var questDescriptionSchema = z17.object({
|
|
1768
1836
|
quest: identifier,
|
|
1769
|
-
runtimeVersion:
|
|
1770
|
-
title:
|
|
1837
|
+
runtimeVersion: z17.union([z17.literal(1), z17.literal(2)]).default(1),
|
|
1838
|
+
title: z17.string().min(1).max(120),
|
|
1771
1839
|
presentation: questPresentationSchema.default({}),
|
|
1772
|
-
integrations:
|
|
1840
|
+
integrations: z17.array(integrationProviderSchema).max(10).default([]),
|
|
1773
1841
|
fields: settingsFieldsSchema,
|
|
1774
1842
|
values: settingsValuesSchema,
|
|
1775
1843
|
rewards: rewardBundleSchema,
|
|
1776
|
-
humanReview:
|
|
1844
|
+
humanReview: z17.boolean(),
|
|
1777
1845
|
trigger: triggerSchema,
|
|
1778
1846
|
performance: contentPerformancePolicySchema.optional(),
|
|
1779
|
-
requires:
|
|
1780
|
-
completion: completionPolicySchema,
|
|
1781
|
-
visibility:
|
|
1847
|
+
requires: z17.array(prerequisiteSchema).max(30).default([]),
|
|
1848
|
+
completion: z17.preprocess(refuseStreakTimeZone, completionPolicySchema),
|
|
1849
|
+
visibility: z17.enum(["visible", "hidden"]).default("visible"),
|
|
1782
1850
|
/**
|
|
1783
1851
|
* Whether completions show on participant profiles (`/v1/profiles/:id/completions`). Absent
|
|
1784
1852
|
* is hidden. Optional, not defaulted: releases carry the key only when the author sets it, so
|
|
1785
1853
|
* clients and pods that predate it (strict release schemas) still read every other release.
|
|
1786
1854
|
*/
|
|
1787
1855
|
profile: questProfileSchema.optional(),
|
|
1788
|
-
budgets:
|
|
1856
|
+
budgets: z17.array(budgetSchema).max(20).default([])
|
|
1789
1857
|
}).strict();
|
|
1790
|
-
var artifactSchema =
|
|
1858
|
+
var artifactSchema = z17.object({ code: z17.string().min(1).max(1e6) }).strict();
|
|
1791
1859
|
var releaseSchema = artifactSchema.extend({
|
|
1792
1860
|
settings: settingsValuesSchema,
|
|
1793
1861
|
provider: reviewModeSchema,
|
|
1794
1862
|
expectedRelease: identifier.nullable().optional(),
|
|
1795
|
-
settingRenames:
|
|
1863
|
+
settingRenames: z17.record(z17.string(), z17.string()).optional()
|
|
1796
1864
|
}).strict();
|
|
1797
|
-
var batchReleaseSchema =
|
|
1798
|
-
var questSettingsInputSchema =
|
|
1865
|
+
var batchReleaseSchema = z17.object({ releases: z17.array(releaseSchema).min(1).max(50) }).strict();
|
|
1866
|
+
var questSettingsInputSchema = z17.object({
|
|
1799
1867
|
quest: identifier,
|
|
1800
1868
|
expectedRelease: identifier,
|
|
1801
1869
|
set: settingsValuesSchema,
|
|
1802
|
-
reset:
|
|
1870
|
+
reset: z17.array(z17.string())
|
|
1803
1871
|
}).strict();
|
|
1804
|
-
var
|
|
1872
|
+
var storedQuestDescriptionSchema = questDescriptionSchema.extend({
|
|
1873
|
+
completion: completionPolicySchema
|
|
1874
|
+
});
|
|
1875
|
+
var storedReleaseSchema = storedQuestDescriptionSchema.extend({
|
|
1805
1876
|
key: identifier.optional(),
|
|
1806
|
-
code:
|
|
1877
|
+
code: z17.string(),
|
|
1807
1878
|
provider: storedReviewModeSchema,
|
|
1808
1879
|
id: identifier,
|
|
1809
|
-
createdAt:
|
|
1810
|
-
legacy:
|
|
1811
|
-
origin:
|
|
1812
|
-
lifecycle:
|
|
1813
|
-
configuration:
|
|
1880
|
+
createdAt: z17.number(),
|
|
1881
|
+
legacy: z17.boolean().default(false),
|
|
1882
|
+
origin: z17.object({ typeVersion: identifier }).strict().optional(),
|
|
1883
|
+
lifecycle: z17.enum(["active", "paused", "archived"]).default("active"),
|
|
1884
|
+
configuration: z17.object({
|
|
1814
1885
|
defaults: settingsValuesSchema,
|
|
1815
1886
|
overrides: settingsValuesSchema,
|
|
1816
|
-
preserved:
|
|
1887
|
+
preserved: z17.array(z17.string())
|
|
1817
1888
|
}).strict().optional()
|
|
1818
1889
|
});
|
|
1819
|
-
var legacyReleaseSchema =
|
|
1890
|
+
var legacyReleaseSchema = z17.object({
|
|
1820
1891
|
quest: identifier,
|
|
1821
|
-
title:
|
|
1822
|
-
criteria:
|
|
1823
|
-
humanReview:
|
|
1892
|
+
title: z17.string(),
|
|
1893
|
+
criteria: z17.string(),
|
|
1894
|
+
humanReview: z17.boolean(),
|
|
1824
1895
|
rewards: rewardBundleSchema,
|
|
1825
|
-
code:
|
|
1896
|
+
code: z17.string(),
|
|
1826
1897
|
provider: storedReviewModeSchema,
|
|
1827
1898
|
id: identifier,
|
|
1828
|
-
createdAt:
|
|
1899
|
+
createdAt: z17.number()
|
|
1829
1900
|
}).transform((r) => {
|
|
1830
1901
|
const { criteria, ...stored } = r;
|
|
1831
1902
|
return storedReleaseSchema.parse({
|
|
@@ -1837,15 +1908,15 @@ var legacyReleaseSchema = z16.object({
|
|
|
1837
1908
|
legacy: true
|
|
1838
1909
|
});
|
|
1839
1910
|
});
|
|
1840
|
-
var publishedReleaseSchema =
|
|
1911
|
+
var publishedReleaseSchema = z17.union([
|
|
1841
1912
|
storedReleaseSchema,
|
|
1842
1913
|
legacyReleaseSchema
|
|
1843
1914
|
]);
|
|
1844
|
-
var templateSchema =
|
|
1845
|
-
code:
|
|
1915
|
+
var templateSchema = z17.object({
|
|
1916
|
+
code: z17.string(),
|
|
1846
1917
|
definition: questDescriptionSchema
|
|
1847
1918
|
});
|
|
1848
|
-
var quizAnswersSchema =
|
|
1919
|
+
var quizAnswersSchema = z17.record(identifier, identifier).refine(
|
|
1849
1920
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
1850
1921
|
"Provide between 1 and 50 answers"
|
|
1851
1922
|
).transform(
|
|
@@ -1853,33 +1924,33 @@ var quizAnswersSchema = z16.record(identifier, identifier).refine(
|
|
|
1853
1924
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
1854
1925
|
)
|
|
1855
1926
|
);
|
|
1856
|
-
var quizEvidenceSchema =
|
|
1857
|
-
kind:
|
|
1927
|
+
var quizEvidenceSchema = z17.object({
|
|
1928
|
+
kind: z17.literal("quiz"),
|
|
1858
1929
|
release: identifier.optional(),
|
|
1859
1930
|
answers: quizAnswersSchema
|
|
1860
1931
|
}).strict();
|
|
1861
|
-
var submissionEvidenceSchema =
|
|
1932
|
+
var submissionEvidenceSchema = z17.union([
|
|
1862
1933
|
quizEvidenceSchema,
|
|
1863
1934
|
textEvidenceSchema,
|
|
1864
1935
|
urlEvidenceSchema
|
|
1865
1936
|
]);
|
|
1866
|
-
var submitSchema =
|
|
1937
|
+
var submitSchema = z17.object({
|
|
1867
1938
|
actionId: identifier,
|
|
1868
1939
|
quest: identifier,
|
|
1869
1940
|
member: identifier,
|
|
1870
1941
|
evidence: identifier.optional(),
|
|
1871
1942
|
input: submissionEvidenceSchema.optional(),
|
|
1872
1943
|
release: identifier.optional(),
|
|
1873
|
-
faultAfterReview:
|
|
1944
|
+
faultAfterReview: z17.boolean().optional()
|
|
1874
1945
|
}).strict();
|
|
1875
|
-
var attemptSchema =
|
|
1946
|
+
var attemptSchema = z17.object({
|
|
1876
1947
|
id: identifier,
|
|
1877
1948
|
release: identifier,
|
|
1878
1949
|
quest: identifier,
|
|
1879
1950
|
member: identifier,
|
|
1880
1951
|
evidence: identifier.nullable(),
|
|
1881
1952
|
input: submissionEvidenceSchema.optional(),
|
|
1882
|
-
status:
|
|
1953
|
+
status: z17.enum([
|
|
1883
1954
|
"queued",
|
|
1884
1955
|
"evaluating",
|
|
1885
1956
|
"accepted",
|
|
@@ -1888,75 +1959,75 @@ var attemptSchema = z16.object({
|
|
|
1888
1959
|
"needs-review",
|
|
1889
1960
|
"failed"
|
|
1890
1961
|
]),
|
|
1891
|
-
reason:
|
|
1892
|
-
retries:
|
|
1893
|
-
generation:
|
|
1894
|
-
completion:
|
|
1962
|
+
reason: z17.string().nullable(),
|
|
1963
|
+
retries: z17.number(),
|
|
1964
|
+
generation: z17.number(),
|
|
1965
|
+
completion: z17.string().nullable(),
|
|
1895
1966
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
1896
1967
|
/**
|
|
1897
1968
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
1898
1969
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
1899
1970
|
*/
|
|
1900
|
-
requestedReview:
|
|
1901
|
-
createdAt:
|
|
1902
|
-
});
|
|
1903
|
-
var eventSchema =
|
|
1904
|
-
id:
|
|
1905
|
-
attempt:
|
|
1906
|
-
kind:
|
|
1907
|
-
detail:
|
|
1908
|
-
actor:
|
|
1909
|
-
at:
|
|
1910
|
-
});
|
|
1911
|
-
var pickupSelectionSchema =
|
|
1971
|
+
requestedReview: z17.boolean().default(false),
|
|
1972
|
+
createdAt: z17.number()
|
|
1973
|
+
});
|
|
1974
|
+
var eventSchema = z17.object({
|
|
1975
|
+
id: z17.number(),
|
|
1976
|
+
attempt: z17.string().nullable(),
|
|
1977
|
+
kind: z17.string(),
|
|
1978
|
+
detail: z17.string(),
|
|
1979
|
+
actor: z17.string().nullable().default(null),
|
|
1980
|
+
at: z17.number()
|
|
1981
|
+
});
|
|
1982
|
+
var pickupSelectionSchema = z17.object({
|
|
1912
1983
|
item: identifier,
|
|
1913
|
-
revision:
|
|
1984
|
+
revision: z17.number().int().nonnegative()
|
|
1914
1985
|
}).strict();
|
|
1915
|
-
var pickupAllocationSchema =
|
|
1986
|
+
var pickupAllocationSchema = z17.object({
|
|
1916
1987
|
item: identifier,
|
|
1917
|
-
label:
|
|
1988
|
+
label: z17.string().min(1).max(80)
|
|
1918
1989
|
}).strict();
|
|
1919
|
-
var pickupPolicySchema =
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
kind:
|
|
1923
|
-
tiers:
|
|
1924
|
-
|
|
1990
|
+
var pickupPolicySchema = z17.discriminatedUnion("kind", [
|
|
1991
|
+
z17.object({ kind: z17.literal("untracked") }).strict(),
|
|
1992
|
+
z17.object({
|
|
1993
|
+
kind: z17.literal("at-pickup"),
|
|
1994
|
+
tiers: z17.array(
|
|
1995
|
+
z17.object({
|
|
1925
1996
|
tier: identifier,
|
|
1926
|
-
variants:
|
|
1997
|
+
variants: z17.array(pickupAllocationSchema).min(1).max(100)
|
|
1927
1998
|
}).strict()
|
|
1928
1999
|
).min(1).max(100)
|
|
1929
2000
|
}).strict()
|
|
1930
2001
|
]);
|
|
1931
|
-
var pickupCatalogSchema =
|
|
2002
|
+
var pickupCatalogSchema = z17.object({
|
|
1932
2003
|
reward: tieredRewardDefinitionSchema,
|
|
1933
|
-
revision:
|
|
2004
|
+
revision: z17.number().int().nonnegative(),
|
|
1934
2005
|
policy: pickupPolicySchema
|
|
1935
2006
|
});
|
|
1936
|
-
var pickupAvailabilitySchema =
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
kind:
|
|
1940
|
-
revision:
|
|
1941
|
-
variants:
|
|
2007
|
+
var pickupAvailabilitySchema = z17.discriminatedUnion("kind", [
|
|
2008
|
+
z17.object({ kind: z17.literal("untracked") }).strict(),
|
|
2009
|
+
z17.object({
|
|
2010
|
+
kind: z17.literal("at-pickup"),
|
|
2011
|
+
revision: z17.number().int().nonnegative(),
|
|
2012
|
+
variants: z17.array(
|
|
1942
2013
|
pickupAllocationSchema.extend({
|
|
1943
|
-
available:
|
|
2014
|
+
available: z17.number().int().nonnegative()
|
|
1944
2015
|
})
|
|
1945
2016
|
)
|
|
1946
2017
|
}).strict()
|
|
1947
2018
|
]);
|
|
1948
|
-
var configurePickupSchema =
|
|
2019
|
+
var configurePickupSchema = z17.object({
|
|
1949
2020
|
reward: identifier,
|
|
1950
|
-
revision:
|
|
2021
|
+
revision: z17.number().int().nonnegative(),
|
|
1951
2022
|
actionId: identifier,
|
|
1952
|
-
policy:
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
kind:
|
|
1956
|
-
tiers:
|
|
1957
|
-
|
|
2023
|
+
policy: z17.discriminatedUnion("kind", [
|
|
2024
|
+
z17.object({ kind: z17.literal("untracked") }).strict(),
|
|
2025
|
+
z17.object({
|
|
2026
|
+
kind: z17.literal("at-pickup"),
|
|
2027
|
+
tiers: z17.array(
|
|
2028
|
+
z17.object({
|
|
1958
2029
|
tier: identifier,
|
|
1959
|
-
variants:
|
|
2030
|
+
variants: z17.array(
|
|
1960
2031
|
pickupAllocationSchema.extend({
|
|
1961
2032
|
item: identifier.optional()
|
|
1962
2033
|
})
|
|
@@ -1972,164 +2043,164 @@ var entitlementBase = {
|
|
|
1972
2043
|
reward: tieredRewardDefinitionSchema,
|
|
1973
2044
|
earnedTier: identifier,
|
|
1974
2045
|
tier: identifier,
|
|
1975
|
-
revision:
|
|
2046
|
+
revision: z17.number().int().positive()
|
|
1976
2047
|
};
|
|
1977
|
-
var entitlementSchema =
|
|
1978
|
-
|
|
1979
|
-
|
|
2048
|
+
var entitlementSchema = z17.discriminatedUnion("status", [
|
|
2049
|
+
z17.object({ ...entitlementBase, status: z17.literal("available") }).strict(),
|
|
2050
|
+
z17.object({
|
|
1980
2051
|
...entitlementBase,
|
|
1981
|
-
status:
|
|
2052
|
+
status: z17.literal("handing-over"),
|
|
1982
2053
|
handover: identifier,
|
|
1983
|
-
startedAt:
|
|
2054
|
+
startedAt: z17.number(),
|
|
1984
2055
|
allocation: pickupAllocationSchema.optional()
|
|
1985
2056
|
}).strict(),
|
|
1986
|
-
|
|
2057
|
+
z17.object({
|
|
1987
2058
|
...entitlementBase,
|
|
1988
|
-
status:
|
|
2059
|
+
status: z17.literal("collected"),
|
|
1989
2060
|
handover: identifier,
|
|
1990
|
-
startedAt:
|
|
2061
|
+
startedAt: z17.number(),
|
|
1991
2062
|
allocation: pickupAllocationSchema.optional(),
|
|
1992
|
-
collectedAt:
|
|
2063
|
+
collectedAt: z17.number()
|
|
1993
2064
|
}).strict()
|
|
1994
2065
|
]);
|
|
1995
|
-
var beginHandoverSchema =
|
|
2066
|
+
var beginHandoverSchema = z17.object({
|
|
1996
2067
|
actionId: identifier,
|
|
1997
|
-
revision:
|
|
2068
|
+
revision: z17.number().int().positive(),
|
|
1998
2069
|
selection: pickupSelectionSchema.optional()
|
|
1999
2070
|
}).strict();
|
|
2000
|
-
var confirmHandoverSchema =
|
|
2001
|
-
var completionRecordSchema =
|
|
2002
|
-
key:
|
|
2071
|
+
var confirmHandoverSchema = z17.object({ actionId: identifier, handover: identifier }).strict();
|
|
2072
|
+
var completionRecordSchema = z17.object({
|
|
2073
|
+
key: z17.string().default("once"),
|
|
2003
2074
|
id: identifier,
|
|
2004
2075
|
quest: identifier,
|
|
2005
2076
|
member: identifier
|
|
2006
2077
|
});
|
|
2007
|
-
var questAvailabilitySchema =
|
|
2008
|
-
|
|
2009
|
-
kind:
|
|
2010
|
-
input:
|
|
2078
|
+
var questAvailabilitySchema = z17.discriminatedUnion("kind", [
|
|
2079
|
+
z17.object({
|
|
2080
|
+
kind: z17.literal("available"),
|
|
2081
|
+
input: z17.enum(["photo", "quiz", "none", "text", "url"])
|
|
2011
2082
|
}).strict(),
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
kind:
|
|
2015
|
-
missing:
|
|
2083
|
+
z17.object({ kind: z17.literal("completed") }).strict(),
|
|
2084
|
+
z17.object({
|
|
2085
|
+
kind: z17.literal("locked"),
|
|
2086
|
+
missing: z17.array(z17.object({ quest: identifier, title: z17.string() })).min(1)
|
|
2016
2087
|
}).strict(),
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
kind:
|
|
2088
|
+
z17.object({ kind: z17.literal("staff-required") }).strict(),
|
|
2089
|
+
z17.object({
|
|
2090
|
+
kind: z17.literal("automatic"),
|
|
2020
2091
|
observation: observationTriggerSchema.optional()
|
|
2021
2092
|
}).strict(),
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2093
|
+
z17.object({ kind: z17.literal("checking"), attempt: identifier }).strict(),
|
|
2094
|
+
z17.object({ kind: z17.literal("needs-review"), attempt: identifier }).strict(),
|
|
2095
|
+
z17.object({ kind: z17.literal("retryable"), attempt: identifier }).strict()
|
|
2025
2096
|
]);
|
|
2026
|
-
var memberProgressSchema =
|
|
2097
|
+
var memberProgressSchema = z17.object({
|
|
2027
2098
|
member: identifier,
|
|
2028
|
-
quests:
|
|
2029
|
-
|
|
2099
|
+
quests: z17.array(
|
|
2100
|
+
z17.object({
|
|
2030
2101
|
quest: identifier,
|
|
2031
2102
|
key: identifier.optional(),
|
|
2032
2103
|
release: identifier.optional(),
|
|
2033
|
-
title:
|
|
2104
|
+
title: z17.string(),
|
|
2034
2105
|
presentation: questPresentationSchema.default({}),
|
|
2035
|
-
connections:
|
|
2106
|
+
connections: z17.array(authProviderSchema).default([]),
|
|
2036
2107
|
trigger: triggerSchema,
|
|
2037
2108
|
availability: questAvailabilitySchema,
|
|
2038
|
-
completed:
|
|
2109
|
+
completed: z17.boolean(),
|
|
2039
2110
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
2040
2111
|
streak: streakProgressSchema.nullable().optional(),
|
|
2041
|
-
completionCount:
|
|
2042
|
-
visibility:
|
|
2043
|
-
missing:
|
|
2112
|
+
completionCount: z17.number().int().nonnegative().default(0),
|
|
2113
|
+
visibility: z17.enum(["visible", "hidden"]).default("visible"),
|
|
2114
|
+
missing: z17.array(z17.object({ quest: identifier, title: z17.string() })),
|
|
2044
2115
|
attempt: attemptSchema.nullable()
|
|
2045
2116
|
})
|
|
2046
2117
|
),
|
|
2047
|
-
entitlements:
|
|
2048
|
-
});
|
|
2049
|
-
var snapshotSchema =
|
|
2050
|
-
releases:
|
|
2051
|
-
completions:
|
|
2052
|
-
entitlements:
|
|
2053
|
-
attempts:
|
|
2054
|
-
balances:
|
|
2055
|
-
|
|
2056
|
-
member:
|
|
2057
|
-
balance:
|
|
2058
|
-
earned:
|
|
2059
|
-
held:
|
|
2060
|
-
available:
|
|
2118
|
+
entitlements: z17.array(entitlementSchema)
|
|
2119
|
+
});
|
|
2120
|
+
var snapshotSchema = z17.object({
|
|
2121
|
+
releases: z17.array(publishedReleaseSchema),
|
|
2122
|
+
completions: z17.array(completionRecordSchema),
|
|
2123
|
+
entitlements: z17.array(entitlementSchema),
|
|
2124
|
+
attempts: z17.array(attemptSchema),
|
|
2125
|
+
balances: z17.array(
|
|
2126
|
+
z17.object({
|
|
2127
|
+
member: z17.string(),
|
|
2128
|
+
balance: z17.string(),
|
|
2129
|
+
earned: z17.number(),
|
|
2130
|
+
held: z17.number(),
|
|
2131
|
+
available: z17.number()
|
|
2061
2132
|
})
|
|
2062
2133
|
),
|
|
2063
|
-
events:
|
|
2134
|
+
events: z17.array(eventSchema)
|
|
2064
2135
|
});
|
|
2065
|
-
var evidenceSchema =
|
|
2136
|
+
var evidenceSchema = z17.object({
|
|
2066
2137
|
id: identifier,
|
|
2067
2138
|
member: identifier,
|
|
2068
|
-
type:
|
|
2069
|
-
size:
|
|
2139
|
+
type: z17.enum(["image/jpeg", "image/png"]),
|
|
2140
|
+
size: z17.number()
|
|
2070
2141
|
});
|
|
2071
|
-
var errorSchema =
|
|
2072
|
-
error:
|
|
2073
|
-
code:
|
|
2074
|
-
missing:
|
|
2142
|
+
var errorSchema = z17.object({
|
|
2143
|
+
error: z17.string(),
|
|
2144
|
+
code: z17.string().optional(),
|
|
2145
|
+
missing: z17.array(z17.object({ quest: identifier, title: z17.string() })).optional()
|
|
2075
2146
|
});
|
|
2076
|
-
var staffDecisionSchema =
|
|
2147
|
+
var staffDecisionSchema = z17.object({
|
|
2077
2148
|
actionId: identifier,
|
|
2078
|
-
generation:
|
|
2079
|
-
decision:
|
|
2080
|
-
reason:
|
|
2149
|
+
generation: z17.number().int().nonnegative(),
|
|
2150
|
+
decision: z17.enum(["accept", "reject"]),
|
|
2151
|
+
reason: z17.string().trim().min(1).max(2e3)
|
|
2081
2152
|
}).strict();
|
|
2082
|
-
var stockSchema =
|
|
2083
|
-
var reservationSchema =
|
|
2153
|
+
var stockSchema = z17.object({ item: identifier, quantity: z17.number().int().min(0).max(1e4) }).strict();
|
|
2154
|
+
var reservationSchema = z17.object({
|
|
2084
2155
|
actionId: identifier,
|
|
2085
2156
|
member: identifier,
|
|
2086
2157
|
item: identifier,
|
|
2087
2158
|
balance: identifier,
|
|
2088
|
-
price:
|
|
2159
|
+
price: z17.number().int().positive().max(1e4)
|
|
2089
2160
|
}).strict();
|
|
2090
2161
|
var pageOptions = {
|
|
2091
|
-
limit:
|
|
2092
|
-
cursor:
|
|
2162
|
+
limit: z17.number().int().min(1).max(100).default(25),
|
|
2163
|
+
cursor: z17.string().min(1).max(4096).optional()
|
|
2093
2164
|
};
|
|
2094
|
-
var reviewListSchema =
|
|
2165
|
+
var reviewListSchema = z17.object({
|
|
2095
2166
|
...pageOptions,
|
|
2096
2167
|
member: identifier.optional(),
|
|
2097
2168
|
quest: identifier.optional()
|
|
2098
2169
|
}).strict();
|
|
2099
|
-
var memberListSchema =
|
|
2170
|
+
var memberListSchema = z17.object({
|
|
2100
2171
|
...pageOptions,
|
|
2101
2172
|
prefix: identifier.optional()
|
|
2102
2173
|
}).strict();
|
|
2103
|
-
var reviewItemSchema =
|
|
2174
|
+
var reviewItemSchema = z17.object({
|
|
2104
2175
|
attempt: attemptSchema,
|
|
2105
|
-
title:
|
|
2106
|
-
checks:
|
|
2107
|
-
|
|
2176
|
+
title: z17.string(),
|
|
2177
|
+
checks: z17.array(
|
|
2178
|
+
z17.object({ criteria: z17.string(), result: photoResultSchema })
|
|
2108
2179
|
)
|
|
2109
2180
|
});
|
|
2110
|
-
var reviewPageSchema =
|
|
2111
|
-
items:
|
|
2112
|
-
nextCursor:
|
|
2181
|
+
var reviewPageSchema = z17.object({
|
|
2182
|
+
items: z17.array(reviewItemSchema).max(100),
|
|
2183
|
+
nextCursor: z17.string().nullable()
|
|
2113
2184
|
});
|
|
2114
|
-
var memberPageSchema =
|
|
2115
|
-
items:
|
|
2116
|
-
nextCursor:
|
|
2185
|
+
var memberPageSchema = z17.object({
|
|
2186
|
+
items: z17.array(z17.object({ member: identifier })).max(100),
|
|
2187
|
+
nextCursor: z17.string().nullable()
|
|
2117
2188
|
});
|
|
2118
|
-
var createStockItemSchema =
|
|
2119
|
-
var stockItemSchema =
|
|
2120
|
-
var contentPerformanceSnapshotSchema =
|
|
2189
|
+
var createStockItemSchema = z17.object({ actionId: identifier, name: z17.string().trim().min(1).max(80) }).strict();
|
|
2190
|
+
var stockItemSchema = z17.object({ id: identifier, name: z17.string() });
|
|
2191
|
+
var contentPerformanceSnapshotSchema = z17.strictObject({
|
|
2121
2192
|
contentAttempt: identifier,
|
|
2122
2193
|
observation: identifier,
|
|
2123
|
-
observedAt:
|
|
2194
|
+
observedAt: z17.number().int().safe().nonnegative(),
|
|
2124
2195
|
metrics: contentMetricsSchema,
|
|
2125
2196
|
rewards: rewardBundleSchema
|
|
2126
2197
|
});
|
|
2127
2198
|
var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
|
|
2128
|
-
content:
|
|
2199
|
+
content: z17.string().min(1).max(256)
|
|
2129
2200
|
});
|
|
2130
|
-
var contentPerformancePageSchema =
|
|
2131
|
-
current:
|
|
2132
|
-
state:
|
|
2201
|
+
var contentPerformancePageSchema = z17.strictObject({
|
|
2202
|
+
current: z17.strictObject({
|
|
2203
|
+
state: z17.enum([
|
|
2133
2204
|
"content-pending",
|
|
2134
2205
|
"content-unqualified",
|
|
2135
2206
|
"waiting",
|
|
@@ -2140,19 +2211,19 @@ var contentPerformancePageSchema = z16.strictObject({
|
|
|
2140
2211
|
"failed",
|
|
2141
2212
|
"superseded"
|
|
2142
2213
|
]),
|
|
2143
|
-
reason:
|
|
2214
|
+
reason: z17.string().nullable(),
|
|
2144
2215
|
contentAttempt: identifier,
|
|
2145
2216
|
attempt: identifier.nullable(),
|
|
2146
2217
|
reward: contentQualificationSchema.shape.reward
|
|
2147
2218
|
}),
|
|
2148
|
-
items:
|
|
2149
|
-
|
|
2219
|
+
items: z17.array(
|
|
2220
|
+
z17.strictObject({
|
|
2150
2221
|
attempt: identifier,
|
|
2151
2222
|
contentAttempt: identifier,
|
|
2152
2223
|
observation: identifier,
|
|
2153
|
-
observedAt:
|
|
2224
|
+
observedAt: z17.number(),
|
|
2154
2225
|
metrics: contentMetricsSchema,
|
|
2155
|
-
state:
|
|
2226
|
+
state: z17.enum([
|
|
2156
2227
|
"pending",
|
|
2157
2228
|
"qualified",
|
|
2158
2229
|
"unqualified",
|
|
@@ -2160,7 +2231,7 @@ var contentPerformancePageSchema = z16.strictObject({
|
|
|
2160
2231
|
"failed",
|
|
2161
2232
|
"superseded"
|
|
2162
2233
|
]),
|
|
2163
|
-
reason:
|
|
2234
|
+
reason: z17.string().nullable()
|
|
2164
2235
|
})
|
|
2165
2236
|
),
|
|
2166
2237
|
nextCursor: pageCursorSchema.nullable()
|
|
@@ -2235,7 +2306,15 @@ export {
|
|
|
2235
2306
|
contentMetricSchema,
|
|
2236
2307
|
contentMetricsSchema,
|
|
2237
2308
|
contentPerformancePolicySchema,
|
|
2238
|
-
|
|
2309
|
+
canonicalTimeZone,
|
|
2310
|
+
timeZoneSchema,
|
|
2311
|
+
timeZoneNameSchema,
|
|
2312
|
+
refuseStreakTimeZone,
|
|
2313
|
+
refuseWindowTimeZone,
|
|
2314
|
+
calendarPeriodSchema,
|
|
2315
|
+
projectCalendarSchema,
|
|
2316
|
+
projectCalendarInputSchema,
|
|
2317
|
+
projectCalendarDeclarationSchema,
|
|
2239
2318
|
streakPolicySchema,
|
|
2240
2319
|
streakProgressSchema,
|
|
2241
2320
|
trackerTriggerModeSchema,
|
|
@@ -2309,6 +2388,7 @@ export {
|
|
|
2309
2388
|
releaseSchema,
|
|
2310
2389
|
batchReleaseSchema,
|
|
2311
2390
|
questSettingsInputSchema,
|
|
2391
|
+
storedQuestDescriptionSchema,
|
|
2312
2392
|
publishedReleaseSchema,
|
|
2313
2393
|
templateSchema,
|
|
2314
2394
|
quizAnswersSchema,
|