@domino-sdk/relay 1.55.0 → 1.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/dist/{accounts-DRPENuZe.d.ts → accounts-CVonEkdb.d.ts} +18 -7
- package/dist/{attempt-captures-CxxO7DeD.d.ts → attempt-captures-DBj-rxak.d.ts} +1 -1
- package/dist/authoring.d.ts +306 -72
- package/dist/authoring.js +264 -9
- package/dist/{automatic-outcomes-DxW_v5Wc.d.ts → automatic-outcomes-FS9okvBP.d.ts} +1 -1
- package/dist/avatar.d.ts +1 -2
- package/dist/browser.d.ts +8 -9
- package/dist/browser.js +10 -10
- package/dist/{capability-error-DSd8EMQC.d.ts → capability-error-DDJl0LY-.d.ts} +0 -6
- package/dist/{chunk-IZRITLVV.js → chunk-2LKGAL63.js} +2 -2
- package/dist/{chunk-GL43VQ5D.js → chunk-577DG2IT.js} +38 -8
- package/dist/{chunk-UY6KMLQG.js → chunk-6U5WWH3W.js} +141 -100
- package/dist/{chunk-YCOKTQ4E.js → chunk-AWWCEP7F.js} +1403 -882
- package/dist/{chunk-56DBFNR2.js → chunk-EQF4ID47.js} +1 -1
- package/dist/{chunk-YEVD4A5X.js → chunk-IBROKMFV.js} +2 -2
- package/dist/{chunk-XALIFNMD.js → chunk-KBCTII6C.js} +1 -1
- package/dist/{chunk-WHG5WE43.js → chunk-KYUQEZZA.js} +1 -1
- package/dist/{chunk-WUEQOKJH.js → chunk-LDLOB2UZ.js} +4 -4
- package/dist/{chunk-IUF7DW76.js → chunk-M2JQPDUX.js} +39 -9
- package/dist/{chunk-MLIXJPKL.js → chunk-MHPKEVEW.js} +1 -0
- package/dist/{chunk-TLK2MD4S.js → chunk-R4S6BFOH.js} +1 -1
- package/dist/{chunk-VFBQVY4X.js → chunk-TZJT5CRF.js} +1 -1
- package/dist/{chunk-C7QZ4UBB.js → chunk-UEMLYPKJ.js} +21 -5
- package/dist/{chunk-F6HECAXA.js → chunk-W42KMMH5.js} +140 -101
- package/dist/{chunk-WHMXXHPX.js → chunk-XGXDINGM.js} +16 -3
- package/dist/{chunk-SABMNPF2.js → chunk-YMWRLAAP.js} +1 -1
- package/dist/{chunk-YE3XYB2F.js → chunk-YRSU2X2P.js} +2 -2
- package/dist/{client-C4zUZKpj.d.ts → client-3b9HjSzZ.d.ts} +191 -117
- package/dist/{deployments-B32QS1CI.d.ts → deployments-BydFVj4Q.d.ts} +798 -235
- package/dist/{groups-O6onGPmC.d.ts → groups-CFuTfFqG.d.ts} +15 -9
- package/dist/index.d.ts +9 -10
- package/dist/index.js +9 -9
- package/dist/{integrations-C6_uUh-s.d.ts → integrations-DrbKQSTD.d.ts} +42 -22
- package/dist/internal.d.ts +10 -10
- package/dist/internal.js +9 -9
- package/dist/{offers-BMDNcvwB.d.ts → offers-DAfe1O3_.d.ts} +211 -2
- package/dist/{pages-BFloMpyQ.d.ts → pages-ChDVLrgR.d.ts} +95 -10
- package/dist/portal-proxy.js +4 -4
- package/dist/react/index.d.ts +149 -72
- package/dist/react/index.js +65 -10
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/BG43KQ2T.js +1 -0
- package/dist/runtime/chunks/EWU4OKSY.js +62 -0
- package/dist/runtime/manifest.json +5 -5
- package/dist/runtime/schema.js +1 -1
- package/dist/runtime/zod.js +1 -1
- package/dist/{schema-C4m9RhCR.d.ts → schema-BA0nRRlt.d.ts} +184 -35
- package/dist/schema.d.ts +1265 -697
- package/dist/schema.js +96 -12
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +1644 -1105
- package/dist/{submission-input-BbdawqVy.d.ts → submission-input-DxQ6RnKo.d.ts} +2 -2
- package/dist/{telegram-browser-CwaxROAZ.d.ts → telegram-browser-o3OIxGrJ.d.ts} +3 -3
- package/dist/testing.d.ts +89 -9
- package/dist/testing.js +215 -10
- package/dist/{transport-CZJOW5Sr.d.ts → transport-D_Eqf78J.d.ts} +8592 -4384
- package/dist/wallet-B06zvDXp.d.ts +972 -0
- package/dist/{x-1czZFVUW.d.ts → x-C28SNifw.d.ts} +2 -2
- package/package.json +2 -2
- package/dist/profiles-BoOK03cR.d.ts +0 -299
- package/dist/runtime/chunks/IDOMZWRY.js +0 -40
- package/dist/runtime/chunks/WKATKZXE.js +0 -1
- package/dist/util.d-w9f9t3ua.d.ts +0 -5
- package/dist/wallet-Ac7OFpOr.d.ts +0 -228
|
@@ -110,7 +110,7 @@ var RelayErrorCode = {
|
|
|
110
110
|
Credential: "credential",
|
|
111
111
|
/** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
|
|
112
112
|
WalletSigner: "wallet-signer",
|
|
113
|
-
/** The member has not met the quest's prerequisites; `missing` lists them. */
|
|
113
|
+
/** The member has not met the quest's or offer's prerequisites; `missing` lists them. */
|
|
114
114
|
PrerequisitesIncomplete: "prerequisites-incomplete",
|
|
115
115
|
/** The quest is archived or retired: it takes no new participation. */
|
|
116
116
|
QuestClosed: "quest-closed",
|
|
@@ -692,6 +692,26 @@ var annotations = /* @__PURE__ */ new Set([
|
|
|
692
692
|
"readOnly",
|
|
693
693
|
"writeOnly"
|
|
694
694
|
]);
|
|
695
|
+
function singleTypes(schema) {
|
|
696
|
+
if (Array.isArray(schema)) {
|
|
697
|
+
return schema.map(singleTypes);
|
|
698
|
+
}
|
|
699
|
+
if (typeof schema !== "object" || schema === null) {
|
|
700
|
+
return schema;
|
|
701
|
+
}
|
|
702
|
+
const node2 = Object.fromEntries(
|
|
703
|
+
Object.entries(schema).map(([key, value]) => [key, singleTypes(value)])
|
|
704
|
+
);
|
|
705
|
+
if (!Array.isArray(node2.type)) {
|
|
706
|
+
return node2;
|
|
707
|
+
}
|
|
708
|
+
const { type, ...rest } = node2;
|
|
709
|
+
return {
|
|
710
|
+
anyOf: type.map(
|
|
711
|
+
(each) => each === "null" ? { type: each } : { ...rest, type: each }
|
|
712
|
+
)
|
|
713
|
+
};
|
|
714
|
+
}
|
|
695
715
|
function subset(schema, path) {
|
|
696
716
|
if (typeof schema !== "object" || schema === null || Array.isArray(schema)) {
|
|
697
717
|
return schema;
|
|
@@ -725,9 +745,9 @@ function subset(schema, path) {
|
|
|
725
745
|
return kept;
|
|
726
746
|
}
|
|
727
747
|
function trackerDataSchema(schema) {
|
|
728
|
-
let
|
|
748
|
+
let json5;
|
|
729
749
|
try {
|
|
730
|
-
|
|
750
|
+
json5 = z7.toJSONSchema(schema, {
|
|
731
751
|
target: "draft-2020-12",
|
|
732
752
|
io: "input",
|
|
733
753
|
unrepresentable: "throw",
|
|
@@ -754,7 +774,9 @@ function trackerDataSchema(schema) {
|
|
|
754
774
|
message.startsWith("Tracker data schemas") ? message : `Tracker data schemas describe JSON: ${message}. Use z.unknown() for any JSON value.`
|
|
755
775
|
);
|
|
756
776
|
}
|
|
757
|
-
const parsed = trackerDataSchemaSchema.safeParse(
|
|
777
|
+
const parsed = trackerDataSchemaSchema.safeParse(
|
|
778
|
+
subset(singleTypes(json5), "data")
|
|
779
|
+
);
|
|
758
780
|
if (!parsed.success) {
|
|
759
781
|
throw new Error(
|
|
760
782
|
parsed.error.issues.map((issue) => issue.message).join("; ")
|
|
@@ -1072,7 +1094,7 @@ function schemaCheckedReader(reader) {
|
|
|
1072
1094
|
}
|
|
1073
1095
|
const issues = trackerDataIssues(
|
|
1074
1096
|
schema,
|
|
1075
|
-
page.items.map((
|
|
1097
|
+
page.items.map((record11) => record11.data)
|
|
1076
1098
|
);
|
|
1077
1099
|
const items = page.items.filter((_, index) => !issues[index]);
|
|
1078
1100
|
return { ...page, items, excluded: page.items.length - items.length };
|
|
@@ -1094,22 +1116,42 @@ function whereSchemaIssue(schema, where) {
|
|
|
1094
1116
|
return null;
|
|
1095
1117
|
}
|
|
1096
1118
|
|
|
1119
|
+
// src/tracker-namespaces.ts
|
|
1120
|
+
var telegramReactionsNamespace = "telegram-reactions";
|
|
1121
|
+
var telegramMessagesNamespace = "telegram-messages";
|
|
1122
|
+
var youtubeShortsNamespace = "youtube-shorts";
|
|
1123
|
+
var tiktokVideosNamespace = "tiktok-videos";
|
|
1124
|
+
var walletBalancesNamespace = "wallet-balances";
|
|
1125
|
+
|
|
1097
1126
|
// src/trackers.ts
|
|
1127
|
+
import * as z10 from "zod";
|
|
1128
|
+
|
|
1129
|
+
// src/lifecycle-reason.ts
|
|
1098
1130
|
import * as z8 from "zod";
|
|
1099
|
-
var
|
|
1100
|
-
|
|
1101
|
-
|
|
1131
|
+
var lifecycleReasonSchema = z8.string().trim().min(1).max(500);
|
|
1132
|
+
|
|
1133
|
+
// src/offset-date-time.ts
|
|
1134
|
+
import * as z9 from "zod";
|
|
1135
|
+
var offsetDateTime = /^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/;
|
|
1136
|
+
function offsetDateTimeSchema() {
|
|
1137
|
+
return z9.iso.datetime({ offset: true, pattern: offsetDateTime });
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
// src/trackers.ts
|
|
1141
|
+
var timestamp = z10.number().int().safe().nonnegative().max(864e13);
|
|
1142
|
+
var count = z10.number().int().safe().nonnegative();
|
|
1143
|
+
var externalId = z10.string().min(1).max(256);
|
|
1102
1144
|
var metric = count.nullable().default(null);
|
|
1103
|
-
var xTweetSchema =
|
|
1145
|
+
var xTweetSchema = z10.looseObject({
|
|
1104
1146
|
id: externalId,
|
|
1105
1147
|
userId: externalId,
|
|
1106
|
-
content:
|
|
1107
|
-
createdAt:
|
|
1108
|
-
author:
|
|
1148
|
+
content: z10.string(),
|
|
1149
|
+
createdAt: offsetDateTimeSchema(),
|
|
1150
|
+
author: z10.looseObject({
|
|
1109
1151
|
id: externalId,
|
|
1110
|
-
username:
|
|
1111
|
-
name:
|
|
1112
|
-
verified:
|
|
1152
|
+
username: z10.string(),
|
|
1153
|
+
name: z10.string(),
|
|
1154
|
+
verified: z10.boolean().nullable().default(null)
|
|
1113
1155
|
}),
|
|
1114
1156
|
likeCount: metric,
|
|
1115
1157
|
replyCount: metric,
|
|
@@ -1117,84 +1159,84 @@ var xTweetSchema = z8.looseObject({
|
|
|
1117
1159
|
quoteCount: metric,
|
|
1118
1160
|
viewCount: metric,
|
|
1119
1161
|
bookmarkCount: metric,
|
|
1120
|
-
isReply:
|
|
1121
|
-
isRetweet:
|
|
1122
|
-
isQuoteTweet:
|
|
1123
|
-
});
|
|
1124
|
-
var xContentBodySchema =
|
|
1125
|
-
version:
|
|
1126
|
-
id:
|
|
1127
|
-
authorId:
|
|
1162
|
+
isReply: z10.boolean(),
|
|
1163
|
+
isRetweet: z10.boolean(),
|
|
1164
|
+
isQuoteTweet: z10.boolean()
|
|
1165
|
+
});
|
|
1166
|
+
var xContentBodySchema = z10.strictObject({
|
|
1167
|
+
version: z10.literal(1),
|
|
1168
|
+
id: z10.string().min(1),
|
|
1169
|
+
authorId: z10.string().min(1),
|
|
1128
1170
|
publishedAt: timestamp,
|
|
1129
|
-
text:
|
|
1130
|
-
isReply:
|
|
1131
|
-
isRetweet:
|
|
1132
|
-
isQuoteTweet:
|
|
1133
|
-
media:
|
|
1134
|
-
mentionedAuthorIds:
|
|
1135
|
-
videoLengthSeconds:
|
|
1136
|
-
references:
|
|
1137
|
-
replyId:
|
|
1138
|
-
replyAuthorId:
|
|
1139
|
-
quoteId:
|
|
1140
|
-
quoteAuthorId:
|
|
1141
|
-
repostId:
|
|
1142
|
-
repostAuthorId:
|
|
1171
|
+
text: z10.string(),
|
|
1172
|
+
isReply: z10.boolean(),
|
|
1173
|
+
isRetweet: z10.boolean(),
|
|
1174
|
+
isQuoteTweet: z10.boolean(),
|
|
1175
|
+
media: z10.array(z10.strictObject({ type: z10.string(), url: z10.string() })).nullable(),
|
|
1176
|
+
mentionedAuthorIds: z10.array(z10.string().min(1)).nullable(),
|
|
1177
|
+
videoLengthSeconds: z10.number().nonnegative().nullable(),
|
|
1178
|
+
references: z10.strictObject({
|
|
1179
|
+
replyId: z10.string().nullable(),
|
|
1180
|
+
replyAuthorId: z10.string().nullable(),
|
|
1181
|
+
quoteId: z10.string().nullable(),
|
|
1182
|
+
quoteAuthorId: z10.string().nullable(),
|
|
1183
|
+
repostId: z10.string().nullable(),
|
|
1184
|
+
repostAuthorId: z10.string().nullable()
|
|
1143
1185
|
})
|
|
1144
1186
|
});
|
|
1145
|
-
var trackerContentQuerySchema =
|
|
1187
|
+
var trackerContentQuerySchema = z10.strictObject({
|
|
1146
1188
|
id: externalId,
|
|
1147
|
-
observation:
|
|
1189
|
+
observation: z10.string().regex(/^observation_[a-f0-9]{64}$/)
|
|
1148
1190
|
});
|
|
1149
1191
|
var trackerContentReadSchema = trackerContentQuerySchema.extend({
|
|
1150
1192
|
member: identifier
|
|
1151
1193
|
});
|
|
1152
1194
|
var attributionContext = { member: identifier, capturedAt: timestamp };
|
|
1153
|
-
var trackerEvidenceSchema =
|
|
1195
|
+
var trackerEvidenceSchema = z10.strictObject({
|
|
1154
1196
|
contentRevision: identifier,
|
|
1155
1197
|
observation: identifier
|
|
1156
1198
|
});
|
|
1157
|
-
var trackerContentSchema =
|
|
1199
|
+
var trackerContentSchema = z10.strictObject({
|
|
1158
1200
|
tracker: identifier,
|
|
1159
|
-
source:
|
|
1201
|
+
source: z10.literal("x"),
|
|
1160
1202
|
evidence: trackerEvidenceSchema,
|
|
1161
1203
|
content: xContentBodySchema,
|
|
1162
1204
|
observedAt: timestamp,
|
|
1163
|
-
removed:
|
|
1164
|
-
attribution:
|
|
1165
|
-
|
|
1205
|
+
removed: z10.boolean(),
|
|
1206
|
+
attribution: z10.discriminatedUnion("kind", [
|
|
1207
|
+
z10.strictObject({
|
|
1166
1208
|
...attributionContext,
|
|
1167
|
-
kind:
|
|
1168
|
-
account:
|
|
1169
|
-
provider:
|
|
1170
|
-
issuer:
|
|
1209
|
+
kind: z10.literal("linked"),
|
|
1210
|
+
account: z10.strictObject({
|
|
1211
|
+
provider: z10.literal("x"),
|
|
1212
|
+
issuer: z10.string().min(1),
|
|
1171
1213
|
subject: externalId,
|
|
1172
1214
|
revision: count,
|
|
1173
1215
|
linkedAt: timestamp.nullable()
|
|
1174
1216
|
})
|
|
1175
1217
|
}),
|
|
1176
|
-
|
|
1177
|
-
|
|
1218
|
+
z10.strictObject({ ...attributionContext, kind: z10.literal("unlinked") }),
|
|
1219
|
+
z10.strictObject({
|
|
1178
1220
|
...attributionContext,
|
|
1179
|
-
kind:
|
|
1221
|
+
kind: z10.literal("different-author")
|
|
1180
1222
|
})
|
|
1181
1223
|
])
|
|
1182
1224
|
});
|
|
1183
1225
|
var knownIdentityKinds = ["wallet", "x", "discord", "member"];
|
|
1184
|
-
var appIdentityKindSchema =
|
|
1226
|
+
var appIdentityKindSchema = z10.templateLiteral([
|
|
1185
1227
|
"app:",
|
|
1186
|
-
|
|
1228
|
+
z10.string().regex(
|
|
1187
1229
|
/^[a-z0-9][a-z0-9_-]{0,39}$/,
|
|
1188
1230
|
"Name an app identity kind like app:telegram: lowercase letters, digits, _ or -, at most 40"
|
|
1189
1231
|
)
|
|
1190
1232
|
]);
|
|
1191
|
-
var identityKindSchema =
|
|
1192
|
-
|
|
1233
|
+
var identityKindSchema = z10.union([
|
|
1234
|
+
z10.enum(knownIdentityKinds),
|
|
1193
1235
|
appIdentityKindSchema
|
|
1194
1236
|
]);
|
|
1195
1237
|
var isAppIdentityKind = (kind) => kind.startsWith("app:");
|
|
1196
|
-
var openIdentityKindSchema =
|
|
1197
|
-
var memberIdentitySchema =
|
|
1238
|
+
var openIdentityKindSchema = z10.string().min(1).max(64);
|
|
1239
|
+
var memberIdentitySchema = z10.object({
|
|
1198
1240
|
kind: openIdentityKindSchema,
|
|
1199
1241
|
/** The stable user ID for `x` and `discord`; the subject your app signed the member in with for `app:<name>`. */
|
|
1200
1242
|
subject: externalId,
|
|
@@ -1206,13 +1248,13 @@ var memberIdentitySchema = z8.object({
|
|
|
1206
1248
|
/** The latest link time, refreshed on app identity relink; null when the link time is unknown. */
|
|
1207
1249
|
linkedAt: timestamp.nullable()
|
|
1208
1250
|
});
|
|
1209
|
-
var accountRoleSchema =
|
|
1251
|
+
var accountRoleSchema = z10.string().regex(
|
|
1210
1252
|
/^[a-zA-Z][a-zA-Z0-9_]{0,39}$/,
|
|
1211
1253
|
"Name roles like author or recipient: a letter, then letters, digits or underscores"
|
|
1212
1254
|
);
|
|
1213
1255
|
var xAccountRoles = ["author", "inReplyTo"];
|
|
1214
1256
|
var distinct = (values2) => new Set(values2).size === values2.length;
|
|
1215
|
-
var contentMetricNameSchema =
|
|
1257
|
+
var contentMetricNameSchema = z10.string().regex(
|
|
1216
1258
|
/^[a-z][a-zA-Z0-9]{0,39}$/,
|
|
1217
1259
|
"Name metrics like likes or watchTime: a lowercase letter, then letters or digits"
|
|
1218
1260
|
);
|
|
@@ -1224,24 +1266,31 @@ var xContentMetrics = [
|
|
|
1224
1266
|
"views",
|
|
1225
1267
|
"bookmarks"
|
|
1226
1268
|
];
|
|
1227
|
-
var customContentSchema =
|
|
1228
|
-
metrics:
|
|
1269
|
+
var customContentSchema = z10.strictObject({
|
|
1270
|
+
metrics: z10.array(contentMetricNameSchema).max(10).refine(distinct, "List each metric once")
|
|
1229
1271
|
});
|
|
1230
|
-
var
|
|
1231
|
-
|
|
1232
|
-
|
|
1272
|
+
var walletBalanceSourceSchema = z10.strictObject({
|
|
1273
|
+
chain: z10.string().regex(
|
|
1274
|
+
/^(?:solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp|eip155:[1-9][0-9]{0,15}|cosmos:[-_a-zA-Z0-9]{1,32})$/,
|
|
1275
|
+
'Use "solana", an EVM chain such as "eip155:8453" or a Cosmos network such as "cosmos:cosmoshub-4"'
|
|
1276
|
+
),
|
|
1277
|
+
token: z10.string().min(1).max(128).nullable()
|
|
1278
|
+
});
|
|
1279
|
+
var xSearchSourceSchema = z10.object({
|
|
1280
|
+
kind: z10.literal("x-search"),
|
|
1281
|
+
query: z10.string().trim().min(1).max(2e3)
|
|
1233
1282
|
}).strict();
|
|
1234
|
-
var customSourceSchema =
|
|
1235
|
-
kind:
|
|
1283
|
+
var customSourceSchema = z10.object({
|
|
1284
|
+
kind: z10.literal("custom"),
|
|
1236
1285
|
namespace: identifier,
|
|
1237
1286
|
/**
|
|
1238
1287
|
* The identity kinds a record's author and named accounts can be, attributed to members
|
|
1239
1288
|
* through verified links: `wallet`, `x`, `discord`, `member`, or your app's own `app:<name>`.
|
|
1240
1289
|
* Omitted when authors are opaque IDs, which no quest can pay.
|
|
1241
1290
|
*/
|
|
1242
|
-
identities:
|
|
1291
|
+
identities: z10.array(identityKindSchema).min(1).max(8).refine(distinct, "List each identity kind once").optional(),
|
|
1243
1292
|
/** Roles of the named accounts records can carry besides their author, such as `recipient`. */
|
|
1244
|
-
accounts:
|
|
1293
|
+
accounts: z10.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
|
|
1245
1294
|
(roles) => !roles.includes("author"),
|
|
1246
1295
|
"author is every record's own role; name other accounts"
|
|
1247
1296
|
).optional(),
|
|
@@ -1256,15 +1305,23 @@ var customSourceSchema = z8.object({
|
|
|
1256
1305
|
* use the tracker with `content()`. `customSource(namespace, { content })` sets it with the
|
|
1257
1306
|
* matching `data` schema.
|
|
1258
1307
|
*/
|
|
1259
|
-
content: customContentSchema.optional()
|
|
1308
|
+
content: customContentSchema.optional(),
|
|
1309
|
+
/**
|
|
1310
|
+
* The chain and token Relay samples, on `wallet.balances()`'s reserved namespace only.
|
|
1311
|
+
* `wallet.balances()` sets it.
|
|
1312
|
+
*/
|
|
1313
|
+
balance: walletBalanceSourceSchema.optional()
|
|
1260
1314
|
}).strict().refine(
|
|
1315
|
+
(source) => source.balance === void 0 || source.namespace === walletBalancesNamespace,
|
|
1316
|
+
"Only wallet.balances() samples a balance"
|
|
1317
|
+
).refine(
|
|
1261
1318
|
(source) => !source.content || source.data?.properties?.body?.type === "object" && (source.data.required ?? []).includes("body"),
|
|
1262
1319
|
"A content source's data schema has a required object body"
|
|
1263
1320
|
).refine(
|
|
1264
1321
|
(source) => !source.accounts || source.identities,
|
|
1265
1322
|
"Named accounts need identities"
|
|
1266
1323
|
);
|
|
1267
|
-
var trackerSourceSchema =
|
|
1324
|
+
var trackerSourceSchema = z10.discriminatedUnion("kind", [
|
|
1268
1325
|
xSearchSourceSchema,
|
|
1269
1326
|
customSourceSchema,
|
|
1270
1327
|
discordMessagesSourceSchema,
|
|
@@ -1301,59 +1358,59 @@ function sourceContent(source) {
|
|
|
1301
1358
|
return void 0;
|
|
1302
1359
|
}
|
|
1303
1360
|
}
|
|
1304
|
-
var windowSchema =
|
|
1361
|
+
var windowSchema = z10.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
|
|
1305
1362
|
(w) => w.end === void 0 || w.end > w.start,
|
|
1306
1363
|
"End must follow start"
|
|
1307
1364
|
);
|
|
1308
|
-
var trackerDefinitionSchema =
|
|
1365
|
+
var trackerDefinitionSchema = z10.object({
|
|
1309
1366
|
key: identifier,
|
|
1310
|
-
title:
|
|
1367
|
+
title: z10.string().trim().min(1).max(120),
|
|
1311
1368
|
source: trackerSourceSchema,
|
|
1312
1369
|
window: windowSchema,
|
|
1313
|
-
refreshSeconds:
|
|
1314
|
-
maxPages:
|
|
1370
|
+
refreshSeconds: z10.number().int().min(300).max(86400).default(21600),
|
|
1371
|
+
maxPages: z10.number().int().min(1).max(1e3).default(60)
|
|
1315
1372
|
}).strict();
|
|
1316
|
-
var trackerArtifactSchema =
|
|
1373
|
+
var trackerArtifactSchema = z10.union([
|
|
1317
1374
|
trackerDefinitionSchema,
|
|
1318
|
-
|
|
1375
|
+
z10.object({ code: z10.string().min(1).max(2e6) }).strict()
|
|
1319
1376
|
]);
|
|
1320
|
-
var knownTrackerSourceResponseSchema =
|
|
1321
|
-
|
|
1322
|
-
|
|
1377
|
+
var knownTrackerSourceResponseSchema = z10.discriminatedUnion("kind", [
|
|
1378
|
+
z10.object(xSearchSourceSchema.shape),
|
|
1379
|
+
z10.object({
|
|
1323
1380
|
...customSourceSchema.shape,
|
|
1324
|
-
identities:
|
|
1381
|
+
identities: z10.array(openIdentityKindSchema).optional()
|
|
1325
1382
|
}),
|
|
1326
|
-
|
|
1327
|
-
|
|
1383
|
+
z10.object(discordMessagesSourceSchema.shape),
|
|
1384
|
+
z10.object(discordReactionsSourceSchema.shape)
|
|
1328
1385
|
]);
|
|
1329
|
-
var trackerSourceResponseSchema =
|
|
1386
|
+
var trackerSourceResponseSchema = z10.union([
|
|
1330
1387
|
knownTrackerSourceResponseSchema,
|
|
1331
|
-
|
|
1332
|
-
kind:
|
|
1388
|
+
z10.object({
|
|
1389
|
+
kind: z10.string().min(1).refine(
|
|
1333
1390
|
(kind) => !trackerSourceKinds.some((known) => known === kind),
|
|
1334
1391
|
"Known source kinds must match their schema"
|
|
1335
1392
|
)
|
|
1336
|
-
}).catchall(
|
|
1393
|
+
}).catchall(z10.json())
|
|
1337
1394
|
]);
|
|
1338
1395
|
function isKnownTrackerSource(source) {
|
|
1339
1396
|
return knownTrackerSourceResponseSchema.safeParse(source).success;
|
|
1340
1397
|
}
|
|
1341
|
-
var trackerDefinitionResponseSchema =
|
|
1398
|
+
var trackerDefinitionResponseSchema = z10.object({
|
|
1342
1399
|
...trackerDefinitionSchema.shape,
|
|
1343
1400
|
source: trackerSourceResponseSchema,
|
|
1344
|
-
window:
|
|
1401
|
+
window: z10.object(windowSchema.shape)
|
|
1345
1402
|
});
|
|
1346
|
-
var publishedTrackerSchema =
|
|
1403
|
+
var publishedTrackerSchema = z10.object({
|
|
1347
1404
|
id: identifier,
|
|
1348
1405
|
version: identifier,
|
|
1349
1406
|
definition: trackerDefinitionResponseSchema,
|
|
1350
1407
|
publishedAt: timestamp,
|
|
1351
|
-
actor:
|
|
1408
|
+
actor: z10.string().nullable()
|
|
1352
1409
|
});
|
|
1353
|
-
var trackerStatusSchema =
|
|
1354
|
-
archivedAt:
|
|
1410
|
+
var trackerStatusSchema = z10.object({
|
|
1411
|
+
archivedAt: z10.number().int().nonnegative().nullable().optional(),
|
|
1355
1412
|
published: publishedTrackerSchema,
|
|
1356
|
-
paused:
|
|
1413
|
+
paused: z10.boolean(),
|
|
1357
1414
|
/**
|
|
1358
1415
|
* Why a paused tracker is paused, null when it isn't: `operator` (paused by hand),
|
|
1359
1416
|
* `x-budget-exhausted` (the project's monthly X budget, or in test the organization's, is spent;
|
|
@@ -1361,29 +1418,79 @@ var trackerStatusSchema = z8.object({
|
|
|
1361
1418
|
* `test-window-ended` (a test X tracker collects for 14 days; resume it for another 14). Treat an
|
|
1362
1419
|
* unknown reason, which a newer Relay can add, as paused. Older servers leave it out.
|
|
1363
1420
|
*/
|
|
1364
|
-
pauseReason:
|
|
1421
|
+
pauseReason: z10.string().nullable().optional(),
|
|
1365
1422
|
/** When a tracker paused on its X budget resumes on its own: the start of the next UTC month. */
|
|
1366
1423
|
resumesAt: timestamp.nullable().optional(),
|
|
1367
1424
|
/**
|
|
1368
1425
|
* The interval a scheduled tracker actually runs at: `refreshSeconds`, but no shorter than the
|
|
1369
1426
|
* project's plan allows (6 hours, shorter on Enterprise). Older servers leave it out.
|
|
1370
1427
|
*/
|
|
1371
|
-
effectiveRefreshSeconds:
|
|
1372
|
-
state:
|
|
1428
|
+
effectiveRefreshSeconds: z10.number().int().positive().optional(),
|
|
1429
|
+
state: z10.enum(["idle", "syncing", "error", "complete"]),
|
|
1373
1430
|
lastStartedAt: timestamp.nullable(),
|
|
1374
1431
|
lastCompletedAt: timestamp.nullable(),
|
|
1375
1432
|
nextSyncAt: timestamp.nullable(),
|
|
1376
|
-
coverage:
|
|
1377
|
-
error:
|
|
1433
|
+
coverage: z10.enum(["unknown", "partial", "complete"]),
|
|
1434
|
+
error: z10.string().nullable(),
|
|
1378
1435
|
records: count,
|
|
1379
1436
|
/**
|
|
1380
1437
|
* Who owns the definition: `code` for a tracker a deployment publishes from `defineTracker`,
|
|
1381
|
-
* `data` for
|
|
1382
|
-
*
|
|
1438
|
+
* `data` for a tracker created with `management.trackers.create` or in Console, which only
|
|
1439
|
+
* `management.trackers.update` changes. Older servers leave it out.
|
|
1383
1440
|
*/
|
|
1384
|
-
origin:
|
|
1441
|
+
origin: z10.enum(["code", "data"]).optional()
|
|
1385
1442
|
});
|
|
1386
|
-
var
|
|
1443
|
+
var managedTrackerSourceSchema = z10.discriminatedUnion("kind", [
|
|
1444
|
+
xSearchSourceSchema,
|
|
1445
|
+
discordMessagesSourceSchema,
|
|
1446
|
+
discordReactionsSourceSchema,
|
|
1447
|
+
z10.strictObject({ kind: z10.literal("telegram-messages") }),
|
|
1448
|
+
z10.strictObject({ kind: z10.literal("telegram-reactions") }),
|
|
1449
|
+
z10.strictObject({ kind: z10.literal("youtube-shorts") }),
|
|
1450
|
+
z10.strictObject({ kind: z10.literal("tiktok-videos") }),
|
|
1451
|
+
/** `wallet.balances({ chain, token })`, with the chain's CAIP-2 ID and a null `token` for a native coin. */
|
|
1452
|
+
z10.strictObject({
|
|
1453
|
+
kind: z10.literal("wallet-balances"),
|
|
1454
|
+
...walletBalanceSourceSchema.shape
|
|
1455
|
+
})
|
|
1456
|
+
]);
|
|
1457
|
+
var managedTrackerSourceKinds = [
|
|
1458
|
+
"x-search",
|
|
1459
|
+
"discord-messages",
|
|
1460
|
+
"discord-reactions",
|
|
1461
|
+
"telegram-messages",
|
|
1462
|
+
"telegram-reactions",
|
|
1463
|
+
"youtube-shorts",
|
|
1464
|
+
"tiktok-videos",
|
|
1465
|
+
"wallet-balances"
|
|
1466
|
+
];
|
|
1467
|
+
var namespacedSourceKinds = {
|
|
1468
|
+
[telegramMessagesNamespace]: "telegram-messages",
|
|
1469
|
+
[telegramReactionsNamespace]: "telegram-reactions",
|
|
1470
|
+
[youtubeShortsNamespace]: "youtube-shorts",
|
|
1471
|
+
[tiktokVideosNamespace]: "tiktok-videos"
|
|
1472
|
+
};
|
|
1473
|
+
function managedTrackerSource(source) {
|
|
1474
|
+
if (!isKnownTrackerSource(source)) {
|
|
1475
|
+
return void 0;
|
|
1476
|
+
}
|
|
1477
|
+
switch (source.kind) {
|
|
1478
|
+
case "x-search":
|
|
1479
|
+
return { kind: "x-search", query: source.query };
|
|
1480
|
+
case "discord-messages":
|
|
1481
|
+
return { kind: "discord-messages", text: source.text ?? false };
|
|
1482
|
+
case "discord-reactions":
|
|
1483
|
+
return { kind: "discord-reactions" };
|
|
1484
|
+
case "custom":
|
|
1485
|
+
if (source.namespace === walletBalancesNamespace) {
|
|
1486
|
+
return source.balance ? { kind: "wallet-balances", ...source.balance } : void 0;
|
|
1487
|
+
}
|
|
1488
|
+
return Object.hasOwn(namespacedSourceKinds, source.namespace) ? {
|
|
1489
|
+
kind: namespacedSourceKinds[source.namespace]
|
|
1490
|
+
} : void 0;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
var trackerPropertiesSchema = z10.object({
|
|
1387
1494
|
title: trackerDefinitionSchema.shape.title,
|
|
1388
1495
|
/** The X search query. A new query collects from now on; it never searches the past. */
|
|
1389
1496
|
query: xSearchSourceSchema.shape.query,
|
|
@@ -1398,73 +1505,87 @@ var trackerCreateSchema = trackerPropertiesSchema.extend({
|
|
|
1398
1505
|
maxPages: trackerDefinitionSchema.shape.maxPages,
|
|
1399
1506
|
actionId: identifier
|
|
1400
1507
|
}).strict();
|
|
1401
|
-
var
|
|
1508
|
+
var managedTrackerCreateSchema = trackerCreateSchema.extend({
|
|
1509
|
+
query: xSearchSourceSchema.shape.query.optional(),
|
|
1510
|
+
source: managedTrackerSourceSchema.optional()
|
|
1511
|
+
}).refine(
|
|
1512
|
+
(input) => input.query === void 0 !== (input.source === void 0),
|
|
1513
|
+
"Name the source with source, or an X search with query, not both"
|
|
1514
|
+
);
|
|
1515
|
+
var trackerUpdateSchema = trackerPropertiesSchema.partial().extend({
|
|
1516
|
+
source: managedTrackerSourceSchema.optional(),
|
|
1517
|
+
actionId: identifier
|
|
1518
|
+
}).strict().refine(
|
|
1402
1519
|
({ actionId: _, ...changes }) => Object.values(changes).some((value) => value !== void 0),
|
|
1403
1520
|
"Change at least one field"
|
|
1521
|
+
).refine(
|
|
1522
|
+
(input) => input.query === void 0 || input.source === void 0,
|
|
1523
|
+
"Change the query with source or query, not both"
|
|
1404
1524
|
);
|
|
1405
|
-
var trackerControlSchema =
|
|
1525
|
+
var trackerControlSchema = z10.object({
|
|
1406
1526
|
actionId: identifier,
|
|
1407
|
-
action:
|
|
1527
|
+
action: z10.enum(["pause", "resume", "refresh"]),
|
|
1528
|
+
reason: lifecycleReasonSchema.optional()
|
|
1408
1529
|
}).strict();
|
|
1409
|
-
var trackerAccountSchema =
|
|
1530
|
+
var trackerAccountSchema = z10.strictObject({
|
|
1410
1531
|
kind: identityKindSchema.optional(),
|
|
1411
1532
|
id: externalId
|
|
1412
1533
|
});
|
|
1413
|
-
var trackerRecordInputSchema =
|
|
1534
|
+
var trackerRecordInputSchema = z10.object({
|
|
1414
1535
|
id: externalId,
|
|
1415
1536
|
occurredAt: timestamp,
|
|
1416
1537
|
observedAt: timestamp,
|
|
1417
|
-
author:
|
|
1538
|
+
author: z10.object({
|
|
1418
1539
|
id: externalId,
|
|
1419
|
-
verified:
|
|
1540
|
+
verified: z10.boolean().nullable().default(null),
|
|
1420
1541
|
/** The author's identity kind; needed when the source names more than one. */
|
|
1421
1542
|
kind: identityKindSchema.optional()
|
|
1422
1543
|
}).strict().nullable().default(null),
|
|
1423
1544
|
/** Named accounts besides the author, by the roles the custom source declares. */
|
|
1424
|
-
accounts:
|
|
1545
|
+
accounts: z10.record(accountRoleSchema, trackerAccountSchema).refine(
|
|
1425
1546
|
(accounts) => Object.keys(accounts).length <= 10,
|
|
1426
1547
|
"At most 10 accounts"
|
|
1427
1548
|
).optional(),
|
|
1428
|
-
data:
|
|
1429
|
-
removed:
|
|
1549
|
+
data: z10.record(z10.string(), z10.json()),
|
|
1550
|
+
removed: z10.boolean().default(false)
|
|
1430
1551
|
}).strict().refine(
|
|
1431
1552
|
(v) => new TextEncoder().encode(JSON.stringify(v.data)).byteLength <= 131072,
|
|
1432
1553
|
"Record exceeds 128 KB"
|
|
1433
1554
|
);
|
|
1434
|
-
var trackerRecordAccountSchema =
|
|
1555
|
+
var trackerRecordAccountSchema = z10.object({
|
|
1435
1556
|
kind: openIdentityKindSchema.optional(),
|
|
1436
|
-
id:
|
|
1557
|
+
id: z10.string()
|
|
1437
1558
|
});
|
|
1438
|
-
var trackerRecordSchema =
|
|
1439
|
-
id:
|
|
1559
|
+
var trackerRecordSchema = z10.object({
|
|
1560
|
+
id: z10.string(),
|
|
1440
1561
|
occurredAt: timestamp,
|
|
1441
1562
|
observedAt: timestamp,
|
|
1442
|
-
author:
|
|
1443
|
-
id:
|
|
1444
|
-
verified:
|
|
1563
|
+
author: z10.object({
|
|
1564
|
+
id: z10.string(),
|
|
1565
|
+
verified: z10.boolean().nullable().default(null),
|
|
1445
1566
|
kind: openIdentityKindSchema.optional()
|
|
1446
1567
|
}).nullable().default(null),
|
|
1447
|
-
accounts:
|
|
1448
|
-
data:
|
|
1449
|
-
removed:
|
|
1450
|
-
source:
|
|
1568
|
+
accounts: z10.record(z10.string(), trackerRecordAccountSchema).optional(),
|
|
1569
|
+
data: z10.record(z10.string(), z10.json()),
|
|
1570
|
+
removed: z10.boolean().default(false),
|
|
1571
|
+
source: z10.string(),
|
|
1451
1572
|
firstSeenAt: timestamp,
|
|
1452
1573
|
/**
|
|
1453
1574
|
* True on a record an operator sent for a test member (`management.testMembers.record`), in
|
|
1454
1575
|
* test only. Absent on every other record.
|
|
1455
1576
|
*/
|
|
1456
|
-
synthetic:
|
|
1577
|
+
synthetic: z10.literal(true).optional(),
|
|
1457
1578
|
/** Present only when includeEvidence is true; custom sources have no X evidence. */
|
|
1458
1579
|
evidence: trackerEvidenceSchema.nullable().optional()
|
|
1459
1580
|
});
|
|
1460
|
-
var trackerIngestSchema =
|
|
1581
|
+
var trackerIngestSchema = z10.object({
|
|
1461
1582
|
actionId: identifier,
|
|
1462
|
-
records:
|
|
1583
|
+
records: z10.array(trackerRecordInputSchema).min(1).max(100)
|
|
1463
1584
|
}).strict();
|
|
1464
|
-
var trackerIngestResultSchema =
|
|
1585
|
+
var trackerIngestResultSchema = z10.object({
|
|
1465
1586
|
stored: count,
|
|
1466
1587
|
/** Tracker-trigger decisions this ingest caused. Absent from servers without tracker triggers. */
|
|
1467
|
-
admissions:
|
|
1588
|
+
admissions: z10.object({
|
|
1468
1589
|
admitted: count,
|
|
1469
1590
|
skipped: count,
|
|
1470
1591
|
/**
|
|
@@ -1485,11 +1606,11 @@ var trackerOutcomeFields = {
|
|
|
1485
1606
|
/** The release admitted, or the one active when the observation was skipped. */
|
|
1486
1607
|
release: identifier,
|
|
1487
1608
|
/** The account attribution resolved or failed to resolve, such as a CAIP-10 wallet ID. */
|
|
1488
|
-
account:
|
|
1609
|
+
account: z10.string().nullable(),
|
|
1489
1610
|
createdAt: timestamp,
|
|
1490
1611
|
updatedAt: timestamp,
|
|
1491
1612
|
/** Null for automatic decisions; the staff actor after a retry. */
|
|
1492
|
-
actor:
|
|
1613
|
+
actor: z10.string().nullable()
|
|
1493
1614
|
};
|
|
1494
1615
|
var trackerSkipCodes = [
|
|
1495
1616
|
/** The quest is paused or no longer active. Catch-up after a pause is an operator decision. */
|
|
@@ -1544,26 +1665,26 @@ var trackerSkipCodes = [
|
|
|
1544
1665
|
/** A prerequisite quest was not complete when the record occurred. */
|
|
1545
1666
|
"prerequisites-incomplete"
|
|
1546
1667
|
];
|
|
1547
|
-
var trackerOutcomeSchema =
|
|
1548
|
-
|
|
1668
|
+
var trackerOutcomeSchema = z10.discriminatedUnion("state", [
|
|
1669
|
+
z10.object({
|
|
1549
1670
|
...trackerOutcomeFields,
|
|
1550
|
-
state:
|
|
1551
|
-
code:
|
|
1552
|
-
reason:
|
|
1671
|
+
state: z10.literal("admitted"),
|
|
1672
|
+
code: z10.null(),
|
|
1673
|
+
reason: z10.null(),
|
|
1553
1674
|
/** The attributed member. */
|
|
1554
1675
|
member: identifier,
|
|
1555
1676
|
/** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
|
|
1556
1677
|
attempt: identifier
|
|
1557
1678
|
}),
|
|
1558
|
-
|
|
1679
|
+
z10.object({
|
|
1559
1680
|
...trackerOutcomeFields,
|
|
1560
|
-
state:
|
|
1681
|
+
state: z10.literal("skipped"),
|
|
1561
1682
|
/** Why the observation was skipped, as one of `trackerSkipCodes`. */
|
|
1562
|
-
code:
|
|
1683
|
+
code: z10.string().min(1),
|
|
1563
1684
|
/** Why the observation was skipped, for people. */
|
|
1564
|
-
reason:
|
|
1685
|
+
reason: z10.string(),
|
|
1565
1686
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
1566
|
-
window:
|
|
1687
|
+
window: z10.enum(["tracker", "quest"]).optional(),
|
|
1567
1688
|
/** The attributed member, when attribution got that far. */
|
|
1568
1689
|
member: identifier.nullable(),
|
|
1569
1690
|
attempt: identifier.nullable()
|
|
@@ -1574,67 +1695,67 @@ var trackerOutcomeFilters = {
|
|
|
1574
1695
|
quest: identifier.optional(),
|
|
1575
1696
|
record: externalId.optional(),
|
|
1576
1697
|
member: identifier.optional(),
|
|
1577
|
-
state:
|
|
1698
|
+
state: z10.enum(["admitted", "skipped"]).optional(),
|
|
1578
1699
|
/** Only skips with this code, such as `unlinked-account`. */
|
|
1579
|
-
code:
|
|
1580
|
-
limit:
|
|
1700
|
+
code: z10.string().min(1).max(100).optional(),
|
|
1701
|
+
limit: z10.coerce.number().int().min(1).max(100).default(25)
|
|
1581
1702
|
};
|
|
1582
|
-
var trackerTriggerOutcomeQuerySchema =
|
|
1703
|
+
var trackerTriggerOutcomeQuerySchema = z10.strictObject({
|
|
1583
1704
|
...trackerOutcomeFilters,
|
|
1584
1705
|
cursor: pageCursorSchema.optional()
|
|
1585
1706
|
});
|
|
1586
|
-
var trackerTriggerOutcomePageSchema =
|
|
1587
|
-
items:
|
|
1707
|
+
var trackerTriggerOutcomePageSchema = z10.object({
|
|
1708
|
+
items: z10.array(trackerOutcomeSchema).max(100),
|
|
1588
1709
|
nextCursor: pageCursorSchema.nullable()
|
|
1589
1710
|
});
|
|
1590
|
-
var trackerOutcomeQuerySchema =
|
|
1711
|
+
var trackerOutcomeQuerySchema = z10.strictObject({
|
|
1591
1712
|
...trackerOutcomeFilters,
|
|
1592
1713
|
/** Opaque cursor from `next`: older outcomes. */
|
|
1593
|
-
before:
|
|
1714
|
+
before: z10.string().max(512).optional()
|
|
1594
1715
|
});
|
|
1595
|
-
var trackerOutcomePageSchema =
|
|
1716
|
+
var trackerOutcomePageSchema = z10.strictObject({
|
|
1596
1717
|
/** Newest first. */
|
|
1597
|
-
items:
|
|
1598
|
-
next:
|
|
1718
|
+
items: z10.array(trackerOutcomeSchema).max(100),
|
|
1719
|
+
next: z10.string().nullable()
|
|
1599
1720
|
});
|
|
1600
|
-
var trackerOutcomeRetrySchema =
|
|
1721
|
+
var trackerOutcomeRetrySchema = z10.strictObject({
|
|
1601
1722
|
actionId: identifier,
|
|
1602
1723
|
/** Quest key or ID. */
|
|
1603
1724
|
quest: identifier,
|
|
1604
1725
|
record: externalId,
|
|
1605
1726
|
observedAt: timestamp
|
|
1606
1727
|
});
|
|
1607
|
-
var booleanQuery =
|
|
1608
|
-
|
|
1609
|
-
|
|
1728
|
+
var booleanQuery = z10.union([
|
|
1729
|
+
z10.boolean(),
|
|
1730
|
+
z10.enum(["true", "false"]).transform((v) => v === "true")
|
|
1610
1731
|
]);
|
|
1611
|
-
var trackerQuerySchema =
|
|
1732
|
+
var trackerQuerySchema = z10.object({
|
|
1612
1733
|
author: externalId.optional(),
|
|
1613
1734
|
member: identifier.optional(),
|
|
1614
1735
|
verified: booleanQuery.optional(),
|
|
1615
|
-
since:
|
|
1616
|
-
until:
|
|
1736
|
+
since: z10.coerce.number().int().safe().nonnegative().optional(),
|
|
1737
|
+
until: z10.coerce.number().int().safe().nonnegative().optional(),
|
|
1617
1738
|
removed: booleanQuery.default(false),
|
|
1618
|
-
minLikes:
|
|
1619
|
-
minViews:
|
|
1620
|
-
limit:
|
|
1621
|
-
cursor:
|
|
1739
|
+
minLikes: z10.coerce.number().int().safe().nonnegative().optional(),
|
|
1740
|
+
minViews: z10.coerce.number().int().safe().nonnegative().optional(),
|
|
1741
|
+
limit: z10.coerce.number().int().min(1).max(100).default(25),
|
|
1742
|
+
cursor: z10.string().max(2048).optional(),
|
|
1622
1743
|
includeEvidence: booleanQuery.optional()
|
|
1623
1744
|
}).strict().refine(
|
|
1624
1745
|
(q) => q.since === void 0 || q.until === void 0 || q.until > q.since,
|
|
1625
1746
|
"Until must follow since"
|
|
1626
1747
|
);
|
|
1627
|
-
var trackerPageSchema =
|
|
1748
|
+
var trackerPageSchema = z10.object({
|
|
1628
1749
|
tracker: identifier,
|
|
1629
|
-
items:
|
|
1630
|
-
nextCursor:
|
|
1750
|
+
items: z10.array(trackerRecordSchema),
|
|
1751
|
+
nextCursor: z10.string().nullable(),
|
|
1631
1752
|
total: count,
|
|
1632
1753
|
status: trackerStatusSchema
|
|
1633
1754
|
});
|
|
1634
|
-
var trackerSummarySchema =
|
|
1755
|
+
var trackerSummarySchema = z10.object({
|
|
1635
1756
|
records: count,
|
|
1636
1757
|
authors: count,
|
|
1637
|
-
metrics:
|
|
1758
|
+
metrics: z10.object({
|
|
1638
1759
|
likes: count,
|
|
1639
1760
|
replies: count,
|
|
1640
1761
|
reposts: count,
|
|
@@ -1650,26 +1771,26 @@ var trackerPreviewLimits = {
|
|
|
1650
1771
|
posts: 100,
|
|
1651
1772
|
days: 30
|
|
1652
1773
|
};
|
|
1653
|
-
var trackerPreviewInputSchema =
|
|
1774
|
+
var trackerPreviewInputSchema = z10.object({
|
|
1654
1775
|
query: xSearchSourceSchema.shape.query,
|
|
1655
1776
|
/** Start of the searched window. The window ends when the sample is fetched. */
|
|
1656
1777
|
since: timestamp
|
|
1657
1778
|
}).strict();
|
|
1658
|
-
var trackerPreviewSchema =
|
|
1659
|
-
query:
|
|
1779
|
+
var trackerPreviewSchema = z10.object({
|
|
1780
|
+
query: z10.string(),
|
|
1660
1781
|
since: timestamp,
|
|
1661
1782
|
fetchedAt: timestamp,
|
|
1662
1783
|
pages: count,
|
|
1663
1784
|
/** Every match in the sample, newest first, verified or not. */
|
|
1664
|
-
posts:
|
|
1785
|
+
posts: z10.array(xTweetSchema).max(trackerPreviewLimits.posts),
|
|
1665
1786
|
/** X had more matches than the sample holds. */
|
|
1666
|
-
more:
|
|
1787
|
+
more: z10.boolean()
|
|
1667
1788
|
});
|
|
1668
1789
|
|
|
1669
1790
|
// src/content.ts
|
|
1670
|
-
import * as
|
|
1671
|
-
var contentQualificationDecisionSchema =
|
|
1672
|
-
kind:
|
|
1791
|
+
import * as z11 from "zod";
|
|
1792
|
+
var contentQualificationDecisionSchema = z11.strictObject({
|
|
1793
|
+
kind: z11.enum([
|
|
1673
1794
|
"accept",
|
|
1674
1795
|
"reject",
|
|
1675
1796
|
"review",
|
|
@@ -1677,26 +1798,26 @@ var contentQualificationDecisionSchema = z9.strictObject({
|
|
|
1677
1798
|
"progress",
|
|
1678
1799
|
"superseded"
|
|
1679
1800
|
]),
|
|
1680
|
-
reason:
|
|
1801
|
+
reason: z11.string().nullable()
|
|
1681
1802
|
});
|
|
1682
|
-
var contentQualificationQuerySchema =
|
|
1803
|
+
var contentQualificationQuerySchema = z11.strictObject({
|
|
1683
1804
|
quest: identifier,
|
|
1684
1805
|
member: identifier.optional(),
|
|
1685
1806
|
/** A content item's record ID in the quest's tracker. */
|
|
1686
|
-
content:
|
|
1807
|
+
content: z11.string().min(1).max(256).optional(),
|
|
1687
1808
|
cursor: pageCursorSchema.optional()
|
|
1688
1809
|
});
|
|
1689
|
-
var contentQualificationSchema =
|
|
1810
|
+
var contentQualificationSchema = z11.strictObject({
|
|
1690
1811
|
quest: identifier,
|
|
1691
1812
|
/** The content item's record ID in the quest's tracker. */
|
|
1692
|
-
content:
|
|
1813
|
+
content: z11.string(),
|
|
1693
1814
|
member: identifier,
|
|
1694
1815
|
release: identifier,
|
|
1695
1816
|
attempt: identifier,
|
|
1696
1817
|
revision: identifier,
|
|
1697
1818
|
observation: identifier,
|
|
1698
|
-
current:
|
|
1699
|
-
state:
|
|
1819
|
+
current: z11.boolean(),
|
|
1820
|
+
state: z11.enum([
|
|
1700
1821
|
"pending",
|
|
1701
1822
|
"qualified",
|
|
1702
1823
|
"unqualified",
|
|
@@ -1707,117 +1828,117 @@ var contentQualificationSchema = z9.strictObject({
|
|
|
1707
1828
|
"blocked",
|
|
1708
1829
|
"unavailable"
|
|
1709
1830
|
]),
|
|
1710
|
-
reason:
|
|
1711
|
-
reward:
|
|
1831
|
+
reason: z11.string().nullable(),
|
|
1832
|
+
reward: z11.strictObject({
|
|
1712
1833
|
attempt: identifier.nullable(),
|
|
1713
1834
|
completion: identifier.nullable(),
|
|
1714
|
-
state:
|
|
1835
|
+
state: z11.enum(["unresolved", "awarded", "excluded"])
|
|
1715
1836
|
})
|
|
1716
1837
|
});
|
|
1717
|
-
var contentQualificationPageSchema =
|
|
1718
|
-
items:
|
|
1838
|
+
var contentQualificationPageSchema = z11.strictObject({
|
|
1839
|
+
items: z11.array(contentQualificationSchema),
|
|
1719
1840
|
nextCursor: pageCursorSchema.nullable()
|
|
1720
1841
|
});
|
|
1721
1842
|
var contentMetricSchema = contentMetricNameSchema;
|
|
1722
|
-
var contentMetricsSchema =
|
|
1843
|
+
var contentMetricsSchema = z11.record(
|
|
1723
1844
|
contentMetricSchema,
|
|
1724
|
-
|
|
1845
|
+
z11.number().int().safe().nonnegative()
|
|
1725
1846
|
);
|
|
1726
|
-
var contentPerformancePolicySchema =
|
|
1727
|
-
metrics:
|
|
1847
|
+
var contentPerformancePolicySchema = z11.strictObject({
|
|
1848
|
+
metrics: z11.array(contentMetricSchema).min(1).max(10).refine(
|
|
1728
1849
|
(values2) => new Set(values2).size === values2.length,
|
|
1729
1850
|
"Metrics must be unique"
|
|
1730
1851
|
),
|
|
1731
|
-
maxAgeMs:
|
|
1852
|
+
maxAgeMs: z11.number().int().positive().max(864e5).default(36e5)
|
|
1732
1853
|
});
|
|
1733
1854
|
|
|
1734
1855
|
// src/counters.ts
|
|
1735
|
-
import * as
|
|
1856
|
+
import * as z12 from "zod";
|
|
1736
1857
|
var day = 864e5;
|
|
1737
|
-
var counterGoalSchema =
|
|
1738
|
-
kind:
|
|
1739
|
-
count:
|
|
1858
|
+
var counterGoalSchema = z12.object({
|
|
1859
|
+
kind: z12.literal("count"),
|
|
1860
|
+
count: z12.number().int().min(1).max(1e4)
|
|
1740
1861
|
}).strict();
|
|
1741
|
-
var counterWindowSchema =
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
kind:
|
|
1745
|
-
period:
|
|
1746
|
-
latenessMs:
|
|
1862
|
+
var counterWindowSchema = z12.discriminatedUnion("kind", [
|
|
1863
|
+
z12.object({ kind: z12.literal("lifetime") }).strict(),
|
|
1864
|
+
z12.object({
|
|
1865
|
+
kind: z12.literal("calendar"),
|
|
1866
|
+
period: z12.enum(["day", "week", "month"]),
|
|
1867
|
+
latenessMs: z12.number().int().min(0).max(90 * day).default(7 * day)
|
|
1747
1868
|
}).strict(),
|
|
1748
|
-
|
|
1749
|
-
kind:
|
|
1750
|
-
durationMs:
|
|
1869
|
+
z12.object({
|
|
1870
|
+
kind: z12.literal("rolling"),
|
|
1871
|
+
durationMs: z12.number().int().min(1).max(365 * day)
|
|
1751
1872
|
}).strict()
|
|
1752
1873
|
]);
|
|
1753
|
-
var counterPolicySchema =
|
|
1754
|
-
kind:
|
|
1874
|
+
var counterPolicySchema = z12.object({
|
|
1875
|
+
kind: z12.literal("progress"),
|
|
1755
1876
|
goal: counterGoalSchema,
|
|
1756
1877
|
window: counterWindowSchema,
|
|
1757
|
-
repeat:
|
|
1878
|
+
repeat: z12.enum(["once", "repeat"]).default("once")
|
|
1758
1879
|
}).strict();
|
|
1759
|
-
var achievementBase =
|
|
1880
|
+
var achievementBase = z12.object({
|
|
1760
1881
|
id: identifier,
|
|
1761
|
-
ordinal:
|
|
1762
|
-
achievedAt:
|
|
1763
|
-
window:
|
|
1882
|
+
ordinal: z12.number().int().positive(),
|
|
1883
|
+
achievedAt: z12.number().int(),
|
|
1884
|
+
window: z12.string()
|
|
1764
1885
|
});
|
|
1765
|
-
var counterAchievementSchema =
|
|
1886
|
+
var counterAchievementSchema = z12.discriminatedUnion("status", [
|
|
1766
1887
|
achievementBase.extend({
|
|
1767
|
-
status:
|
|
1888
|
+
status: z12.literal("revoked"),
|
|
1768
1889
|
completion: identifier,
|
|
1769
|
-
revokedAt:
|
|
1890
|
+
revokedAt: z12.number().int()
|
|
1770
1891
|
}),
|
|
1771
1892
|
achievementBase.extend({
|
|
1772
|
-
status:
|
|
1893
|
+
status: z12.literal("awarded"),
|
|
1773
1894
|
completion: identifier
|
|
1774
1895
|
}),
|
|
1775
1896
|
achievementBase.extend({
|
|
1776
|
-
status:
|
|
1897
|
+
status: z12.literal("budget-exhausted"),
|
|
1777
1898
|
budget: identifier
|
|
1778
1899
|
})
|
|
1779
1900
|
]);
|
|
1780
|
-
var counterProgressSchema =
|
|
1781
|
-
goal:
|
|
1782
|
-
current:
|
|
1783
|
-
window:
|
|
1784
|
-
key:
|
|
1785
|
-
start:
|
|
1786
|
-
end:
|
|
1901
|
+
var counterProgressSchema = z12.object({
|
|
1902
|
+
goal: z12.number().int().positive(),
|
|
1903
|
+
current: z12.number().int().nonnegative(),
|
|
1904
|
+
window: z12.object({
|
|
1905
|
+
key: z12.string(),
|
|
1906
|
+
start: z12.number().int().nullable(),
|
|
1907
|
+
end: z12.number().int().nullable()
|
|
1787
1908
|
}),
|
|
1788
|
-
repeat:
|
|
1789
|
-
settled:
|
|
1909
|
+
repeat: z12.enum(["once", "repeat"]),
|
|
1910
|
+
settled: z12.number().int().nonnegative(),
|
|
1790
1911
|
latest: counterAchievementSchema.nullable()
|
|
1791
1912
|
});
|
|
1792
|
-
var counterContributionSchema =
|
|
1913
|
+
var counterContributionSchema = z12.object({
|
|
1793
1914
|
id: identifier,
|
|
1794
|
-
distinct:
|
|
1915
|
+
distinct: z12.string(),
|
|
1795
1916
|
attempt: identifier,
|
|
1796
|
-
occurredAt:
|
|
1797
|
-
recordedAt:
|
|
1798
|
-
window:
|
|
1799
|
-
status:
|
|
1917
|
+
occurredAt: z12.number().int(),
|
|
1918
|
+
recordedAt: z12.number().int(),
|
|
1919
|
+
window: z12.string(),
|
|
1920
|
+
status: z12.enum(["counted", "late", "future", "excluded"]),
|
|
1800
1921
|
achievement: counterAchievementSchema.nullable(),
|
|
1801
|
-
reason:
|
|
1922
|
+
reason: z12.string().nullable()
|
|
1802
1923
|
});
|
|
1803
|
-
var counterHistorySchema =
|
|
1804
|
-
items:
|
|
1805
|
-
nextCursor:
|
|
1924
|
+
var counterHistorySchema = z12.object({
|
|
1925
|
+
items: z12.array(counterContributionSchema),
|
|
1926
|
+
nextCursor: z12.string().nullable()
|
|
1806
1927
|
});
|
|
1807
|
-
var counterModerationSchema =
|
|
1808
|
-
actionId:
|
|
1809
|
-
excluded:
|
|
1810
|
-
reason:
|
|
1928
|
+
var counterModerationSchema = z12.object({
|
|
1929
|
+
actionId: z12.uuid(),
|
|
1930
|
+
excluded: z12.boolean(),
|
|
1931
|
+
reason: z12.string().trim().min(1).max(2e3)
|
|
1811
1932
|
}).strict();
|
|
1812
|
-
var counterHistoryQuerySchema =
|
|
1813
|
-
cursor:
|
|
1814
|
-
limit:
|
|
1933
|
+
var counterHistoryQuerySchema = z12.object({
|
|
1934
|
+
cursor: z12.string().max(2e3).optional(),
|
|
1935
|
+
limit: z12.coerce.number().int().min(1).max(100).optional()
|
|
1815
1936
|
}).strict();
|
|
1816
|
-
var counterModerationResultSchema =
|
|
1937
|
+
var counterModerationResultSchema = z12.object({ excluded: z12.boolean() });
|
|
1817
1938
|
|
|
1818
1939
|
// src/calendar.ts
|
|
1819
|
-
import * as
|
|
1820
|
-
var timestamp2 =
|
|
1940
|
+
import * as z13 from "zod";
|
|
1941
|
+
var timestamp2 = z13.number().int().safe();
|
|
1821
1942
|
var fixedOffset = /^(?:[+-]|(?:Etc\/)?GMT[+-]\d|(?:EST|MST|HST)$)/i;
|
|
1822
1943
|
function canonicalTimeZone(zone) {
|
|
1823
1944
|
let resolved;
|
|
@@ -1833,18 +1954,18 @@ function canonicalTimeZone(zone) {
|
|
|
1833
1954
|
}
|
|
1834
1955
|
return fixedOffset.test(zone) || fixedOffset.test(resolved) ? null : resolved;
|
|
1835
1956
|
}
|
|
1836
|
-
var timeZoneSchema =
|
|
1957
|
+
var timeZoneSchema = z13.string().min(1).max(100).transform((zone, ctx) => {
|
|
1837
1958
|
const canonical = canonicalTimeZone(zone);
|
|
1838
1959
|
if (canonical === null) {
|
|
1839
1960
|
ctx.addIssue({
|
|
1840
1961
|
code: "custom",
|
|
1841
1962
|
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"
|
|
1842
1963
|
});
|
|
1843
|
-
return
|
|
1964
|
+
return z13.NEVER;
|
|
1844
1965
|
}
|
|
1845
1966
|
return canonical;
|
|
1846
1967
|
});
|
|
1847
|
-
var timeZoneNameSchema =
|
|
1968
|
+
var timeZoneNameSchema = z13.string().min(1).max(100);
|
|
1848
1969
|
var movedTimeZone = (what) => `${what} no longer take a timeZone: they follow the project calendar. Set calendar.timeZone in relay.json or in Console settings.`;
|
|
1849
1970
|
var record5 = (value) => typeof value === "object" && value !== null;
|
|
1850
1971
|
function refuseStreakTimeZone(value, ctx) {
|
|
@@ -1868,78 +1989,78 @@ function refuseWindowTimeZone(value, ctx) {
|
|
|
1868
1989
|
}
|
|
1869
1990
|
return value;
|
|
1870
1991
|
}
|
|
1871
|
-
var calendarPeriodSchema =
|
|
1872
|
-
var projectCalendarSchema =
|
|
1992
|
+
var calendarPeriodSchema = z13.enum(["lifetime", "day", "week", "month"]);
|
|
1993
|
+
var projectCalendarSchema = z13.object({
|
|
1873
1994
|
/** The timezone of the current calendar day. */
|
|
1874
1995
|
timeZone: timeZoneNameSchema,
|
|
1875
1996
|
/** The current calendar date, such as `2026-10-01`. */
|
|
1876
|
-
today:
|
|
1997
|
+
today: z13.string(),
|
|
1877
1998
|
/** When the current calendar day ends, in epoch milliseconds. */
|
|
1878
1999
|
nextBoundary: timestamp2,
|
|
1879
2000
|
/** A change that takes effect at the next day boundary, or null. */
|
|
1880
|
-
pending:
|
|
2001
|
+
pending: z13.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp2 }).nullable(),
|
|
1881
2002
|
/** The `calendar.timeZone` the last deployment that declared one set, or null. */
|
|
1882
2003
|
declared: timeZoneNameSchema.nullable(),
|
|
1883
2004
|
/**
|
|
1884
2005
|
* A stored timezone the calendar no longer accepts, such as a fixed offset a streak named before
|
|
1885
2006
|
* v1. The calendar reads it as UTC until an operator chooses a timezone. Null otherwise.
|
|
1886
2007
|
*/
|
|
1887
|
-
unsupported:
|
|
2008
|
+
unsupported: z13.string().nullable().default(null)
|
|
1888
2009
|
});
|
|
1889
|
-
var projectCalendarInputSchema =
|
|
2010
|
+
var projectCalendarInputSchema = z13.object({
|
|
1890
2011
|
actionId: identifier,
|
|
1891
2012
|
timeZone: timeZoneSchema,
|
|
1892
|
-
reason:
|
|
2013
|
+
reason: z13.string().trim().min(1).max(500)
|
|
1893
2014
|
}).strict();
|
|
1894
|
-
var projectCalendarDeclarationSchema =
|
|
2015
|
+
var projectCalendarDeclarationSchema = z13.object({ timeZone: timeZoneSchema }).strict();
|
|
1895
2016
|
|
|
1896
2017
|
// src/streaks.ts
|
|
1897
|
-
import * as
|
|
1898
|
-
var streakPolicySchema =
|
|
1899
|
-
kind:
|
|
1900
|
-
days:
|
|
2018
|
+
import * as z14 from "zod";
|
|
2019
|
+
var streakPolicySchema = z14.object({
|
|
2020
|
+
kind: z14.literal("streak"),
|
|
2021
|
+
days: z14.number().int().min(1).max(3650)
|
|
1901
2022
|
});
|
|
1902
|
-
var streakProgressSchema =
|
|
1903
|
-
goal:
|
|
1904
|
-
current:
|
|
1905
|
-
best:
|
|
1906
|
-
today:
|
|
1907
|
-
todayQualified:
|
|
2023
|
+
var streakProgressSchema = z14.object({
|
|
2024
|
+
goal: z14.number().int().positive(),
|
|
2025
|
+
current: z14.number().int().nonnegative(),
|
|
2026
|
+
best: z14.number().int().nonnegative(),
|
|
2027
|
+
today: z14.string(),
|
|
2028
|
+
todayQualified: z14.boolean(),
|
|
1908
2029
|
timeZone: timeZoneNameSchema,
|
|
1909
|
-
nextBoundary:
|
|
1910
|
-
pendingTimeZone:
|
|
2030
|
+
nextBoundary: z14.number().int(),
|
|
2031
|
+
pendingTimeZone: z14.object({
|
|
1911
2032
|
timeZone: timeZoneNameSchema,
|
|
1912
|
-
effectiveAt:
|
|
2033
|
+
effectiveAt: z14.number().int()
|
|
1913
2034
|
}).nullable(),
|
|
1914
|
-
days:
|
|
1915
|
-
|
|
1916
|
-
day:
|
|
1917
|
-
date:
|
|
2035
|
+
days: z14.array(
|
|
2036
|
+
z14.object({
|
|
2037
|
+
day: z14.number().int(),
|
|
2038
|
+
date: z14.string(),
|
|
1918
2039
|
// The zone the day was recorded in, as stored: days from before v1 can name a fixed offset.
|
|
1919
|
-
timeZone:
|
|
1920
|
-
occurredAt:
|
|
2040
|
+
timeZone: z14.string(),
|
|
2041
|
+
occurredAt: z14.number().int()
|
|
1921
2042
|
})
|
|
1922
2043
|
),
|
|
1923
|
-
milestone:
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
status:
|
|
1927
|
-
completion:
|
|
1928
|
-
achievedAt:
|
|
2044
|
+
milestone: z14.discriminatedUnion("status", [
|
|
2045
|
+
z14.object({ status: z14.literal("pending") }),
|
|
2046
|
+
z14.object({
|
|
2047
|
+
status: z14.literal("awarded"),
|
|
2048
|
+
completion: z14.string(),
|
|
2049
|
+
achievedAt: z14.number().int()
|
|
1929
2050
|
}),
|
|
1930
|
-
|
|
1931
|
-
status:
|
|
1932
|
-
budget:
|
|
1933
|
-
achievedAt:
|
|
2051
|
+
z14.object({
|
|
2052
|
+
status: z14.literal("budget-exhausted"),
|
|
2053
|
+
budget: z14.string(),
|
|
2054
|
+
achievedAt: z14.number().int()
|
|
1934
2055
|
})
|
|
1935
2056
|
])
|
|
1936
2057
|
});
|
|
1937
2058
|
|
|
1938
2059
|
// src/tracker-triggers.ts
|
|
1939
|
-
import * as
|
|
1940
|
-
var timestamp3 =
|
|
1941
|
-
var count2 =
|
|
1942
|
-
var trackerTriggerModeSchema =
|
|
2060
|
+
import * as z15 from "zod";
|
|
2061
|
+
var timestamp3 = z15.number().int().safe().nonnegative().max(864e13);
|
|
2062
|
+
var count2 = z15.number().int().safe().nonnegative();
|
|
2063
|
+
var trackerTriggerModeSchema = z15.enum([
|
|
1943
2064
|
"new-record",
|
|
1944
2065
|
"new-observation",
|
|
1945
2066
|
"data-changed"
|
|
@@ -1947,20 +2068,20 @@ var trackerTriggerModeSchema = z13.enum([
|
|
|
1947
2068
|
function defaultTriggerMode(source) {
|
|
1948
2069
|
return source === "custom" ? "new-observation" : "new-record";
|
|
1949
2070
|
}
|
|
1950
|
-
var trackerBoundSchema =
|
|
1951
|
-
|
|
1952
|
-
|
|
2071
|
+
var trackerBoundSchema = z15.union([
|
|
2072
|
+
z15.number().finite(),
|
|
2073
|
+
z15.strictObject({ setting: z15.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
|
|
1953
2074
|
]);
|
|
1954
|
-
var dataPath =
|
|
2075
|
+
var dataPath = z15.string().max(200).regex(
|
|
1955
2076
|
/^[^.\s]+(\.[^.\s]+)*$/,
|
|
1956
2077
|
"Use dot-separated keys, such as metrics.likes"
|
|
1957
2078
|
);
|
|
1958
|
-
var trackerConditionSchema =
|
|
1959
|
-
|
|
2079
|
+
var trackerConditionSchema = z15.union([
|
|
2080
|
+
z15.strictObject({
|
|
1960
2081
|
path: dataPath,
|
|
1961
|
-
equals:
|
|
2082
|
+
equals: z15.union([z15.string().max(1e3), z15.number().finite(), z15.boolean()])
|
|
1962
2083
|
}),
|
|
1963
|
-
|
|
2084
|
+
z15.strictObject({
|
|
1964
2085
|
path: dataPath,
|
|
1965
2086
|
gt: trackerBoundSchema.optional(),
|
|
1966
2087
|
gte: trackerBoundSchema.optional(),
|
|
@@ -1973,9 +2094,9 @@ var trackerConditionSchema = z13.union([
|
|
|
1973
2094
|
"Compare with equals, gt, gte, lt or lte"
|
|
1974
2095
|
)
|
|
1975
2096
|
]);
|
|
1976
|
-
var trackerWhereSchema =
|
|
2097
|
+
var trackerWhereSchema = z15.union([
|
|
1977
2098
|
trackerConditionSchema,
|
|
1978
|
-
|
|
2099
|
+
z15.array(trackerConditionSchema).min(1).max(10)
|
|
1979
2100
|
]);
|
|
1980
2101
|
function whereConditions(where) {
|
|
1981
2102
|
return where === void 0 ? [] : Array.isArray(where) ? where : [where];
|
|
@@ -1987,17 +2108,17 @@ function whereSettings(where) {
|
|
|
1987
2108
|
)
|
|
1988
2109
|
);
|
|
1989
2110
|
}
|
|
1990
|
-
var triggerEnrollmentSchema =
|
|
1991
|
-
var triggerSinceSchema =
|
|
1992
|
-
var triggerHistoricalSchema =
|
|
1993
|
-
var trackerTriggerPolicySchema =
|
|
2111
|
+
var triggerEnrollmentSchema = z15.enum(["none", "required"]);
|
|
2112
|
+
var triggerSinceSchema = z15.enum(["activation", "window", "enrollment"]);
|
|
2113
|
+
var triggerHistoricalSchema = z15.enum(["staff", "claim", "automatic"]);
|
|
2114
|
+
var trackerTriggerPolicySchema = z15.strictObject({
|
|
1994
2115
|
/** The tracker's authoring key; publication binds it to the tracker's stable ID. */
|
|
1995
2116
|
tracker: identifier,
|
|
1996
2117
|
/**
|
|
1997
2118
|
* The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
|
|
1998
2119
|
* releases keep parsing them when a later Relay adds a managed source.
|
|
1999
2120
|
*/
|
|
2000
|
-
source:
|
|
2121
|
+
source: z15.string().min(1).max(100),
|
|
2001
2122
|
/** Which observations fire. */
|
|
2002
2123
|
on: trackerTriggerModeSchema,
|
|
2003
2124
|
where: trackerWhereSchema.optional(),
|
|
@@ -2018,7 +2139,7 @@ var trackerTriggerPolicySchema = z13.strictObject({
|
|
|
2018
2139
|
* that re-evaluates edits and runs `performance`, firing on each new record and paying its
|
|
2019
2140
|
* author.
|
|
2020
2141
|
*/
|
|
2021
|
-
content:
|
|
2142
|
+
content: z15.literal(true).optional()
|
|
2022
2143
|
}).refine(
|
|
2023
2144
|
(policy) => policy.since !== "enrollment" || policy.enrollment === "required",
|
|
2024
2145
|
'since: "enrollment" needs enrollment: "required"'
|
|
@@ -2037,72 +2158,72 @@ function beneficiaryRole(policy) {
|
|
|
2037
2158
|
return policy.beneficiary;
|
|
2038
2159
|
}
|
|
2039
2160
|
var xLink = {
|
|
2040
|
-
issuer:
|
|
2161
|
+
issuer: z15.string().min(1),
|
|
2041
2162
|
/** The account's stable user ID. */
|
|
2042
|
-
subject:
|
|
2163
|
+
subject: z15.string().min(1).max(256),
|
|
2043
2164
|
/** The member's account selection revision. */
|
|
2044
2165
|
revision: count2,
|
|
2045
2166
|
/** When the member linked the account; null when unknown. */
|
|
2046
2167
|
linkedAt: timestamp3.nullable()
|
|
2047
2168
|
};
|
|
2048
|
-
var trackerAttributionSchema =
|
|
2169
|
+
var trackerAttributionSchema = z15.object({
|
|
2049
2170
|
member: identifier,
|
|
2050
2171
|
capturedAt: timestamp3,
|
|
2051
|
-
account:
|
|
2052
|
-
|
|
2053
|
-
provider:
|
|
2172
|
+
account: z15.union([
|
|
2173
|
+
z15.object({
|
|
2174
|
+
provider: z15.literal("wallet"),
|
|
2054
2175
|
/** Canonical CAIP-10 account ID, as the record names it. */
|
|
2055
|
-
id:
|
|
2176
|
+
id: z15.string().min(5).max(256),
|
|
2056
2177
|
/** The wallet link's revision. */
|
|
2057
2178
|
revision: count2,
|
|
2058
2179
|
/** When the member verified the wallet. */
|
|
2059
2180
|
linkedAt: timestamp3.nullable()
|
|
2060
2181
|
}),
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
provider:
|
|
2182
|
+
z15.object({ provider: z15.literal("x"), ...xLink }),
|
|
2183
|
+
z15.object({ provider: z15.literal("discord"), ...xLink }),
|
|
2184
|
+
z15.object({
|
|
2185
|
+
provider: z15.literal("member"),
|
|
2065
2186
|
/** The member ID the record names. */
|
|
2066
2187
|
id: identifier
|
|
2067
2188
|
}),
|
|
2068
|
-
|
|
2189
|
+
z15.object({
|
|
2069
2190
|
/** Your app's identity kind, such as `app:telegram`. */
|
|
2070
2191
|
provider: appIdentityKindSchema,
|
|
2071
2192
|
/** The subject your app signed the member in with, as the record names it. */
|
|
2072
|
-
subject:
|
|
2193
|
+
subject: z15.string().min(1).max(256),
|
|
2073
2194
|
/** The identity's revision in the project. */
|
|
2074
2195
|
revision: count2,
|
|
2075
2196
|
/** When the identity was linked to the member. */
|
|
2076
2197
|
linkedAt: timestamp3.nullable()
|
|
2077
2198
|
}),
|
|
2078
2199
|
/** A kind a later Relay adds. */
|
|
2079
|
-
|
|
2200
|
+
z15.object({ provider: z15.string().min(1) })
|
|
2080
2201
|
])
|
|
2081
2202
|
});
|
|
2082
|
-
var trackerTriggerRecordSchema =
|
|
2083
|
-
id:
|
|
2084
|
-
source:
|
|
2203
|
+
var trackerTriggerRecordSchema = z15.object({
|
|
2204
|
+
id: z15.string().min(1).max(256),
|
|
2205
|
+
source: z15.string(),
|
|
2085
2206
|
occurredAt: timestamp3,
|
|
2086
2207
|
observedAt: timestamp3,
|
|
2087
2208
|
firstSeenAt: timestamp3,
|
|
2088
|
-
author:
|
|
2089
|
-
id:
|
|
2090
|
-
verified:
|
|
2209
|
+
author: z15.object({
|
|
2210
|
+
id: z15.string().min(1).max(256),
|
|
2211
|
+
verified: z15.boolean().nullable(),
|
|
2091
2212
|
kind: openIdentityKindSchema.optional()
|
|
2092
2213
|
}).nullable(),
|
|
2093
|
-
accounts:
|
|
2094
|
-
data:
|
|
2095
|
-
removed:
|
|
2214
|
+
accounts: z15.record(accountRoleSchema, trackerRecordAccountSchema).optional(),
|
|
2215
|
+
data: z15.record(z15.string(), z15.json()),
|
|
2216
|
+
removed: z15.boolean()
|
|
2096
2217
|
});
|
|
2097
|
-
var trackerContentStageSchema =
|
|
2218
|
+
var trackerContentStageSchema = z15.object({
|
|
2098
2219
|
/** The body's revision: the hash of its canonical JSON. Edits make a new one. */
|
|
2099
2220
|
revision: identifier,
|
|
2100
2221
|
/** The captured observation that carried this body. */
|
|
2101
2222
|
observation: identifier,
|
|
2102
2223
|
/** The body: an X post's normalized body, or a custom record's `data.body`. */
|
|
2103
|
-
body:
|
|
2224
|
+
body: z15.record(z15.string(), z15.json())
|
|
2104
2225
|
});
|
|
2105
|
-
var trackerTriggerContextSchema =
|
|
2226
|
+
var trackerTriggerContextSchema = z15.object({
|
|
2106
2227
|
/** The tracker's stable ID. */
|
|
2107
2228
|
tracker: identifier,
|
|
2108
2229
|
/** The tracker's authoring key. */
|
|
@@ -2124,7 +2245,7 @@ var trackerTriggerContextSchema = z13.object({
|
|
|
2124
2245
|
});
|
|
2125
2246
|
|
|
2126
2247
|
// src/reject-codes.ts
|
|
2127
|
-
import * as
|
|
2248
|
+
import * as z16 from "zod";
|
|
2128
2249
|
var reservedAttemptCodes = Object.freeze([
|
|
2129
2250
|
"budget-exhausted",
|
|
2130
2251
|
"defer-expired",
|
|
@@ -2150,7 +2271,7 @@ function rejectCodeIssue(code) {
|
|
|
2150
2271
|
}
|
|
2151
2272
|
return null;
|
|
2152
2273
|
}
|
|
2153
|
-
var rejectCodeSchema =
|
|
2274
|
+
var rejectCodeSchema = z16.string().superRefine((code, context) => {
|
|
2154
2275
|
const issue = rejectCodeIssue(code);
|
|
2155
2276
|
if (issue) {
|
|
2156
2277
|
context.addIssue({ code: "custom", message: issue });
|
|
@@ -2158,7 +2279,7 @@ var rejectCodeSchema = z14.string().superRefine((code, context) => {
|
|
|
2158
2279
|
});
|
|
2159
2280
|
|
|
2160
2281
|
// src/sdk-runtime.ts
|
|
2161
|
-
import * as
|
|
2282
|
+
import * as z17 from "zod";
|
|
2162
2283
|
var questScaleLimits = {
|
|
2163
2284
|
quests: 1e3,
|
|
2164
2285
|
questTypes: 200,
|
|
@@ -2169,22 +2290,22 @@ var sdkRuntimeLimits = {
|
|
|
2169
2290
|
/** Characters of module source, summed over all modules. */
|
|
2170
2291
|
size: 2e6
|
|
2171
2292
|
};
|
|
2172
|
-
var sha256 =
|
|
2173
|
-
var sdkRuntimeModulePathSchema =
|
|
2293
|
+
var sha256 = z17.string().regex(/^[0-9a-f]{64}$/);
|
|
2294
|
+
var sdkRuntimeModulePathSchema = z17.string().max(200).regex(/^[a-z0-9_][a-z0-9_.-]*(\/[a-z0-9_][a-z0-9_.-]*)*\.js$/i).refine(
|
|
2174
2295
|
(path) => !path.split("/").some((part) => part === "." || part === ".."),
|
|
2175
2296
|
"Runtime module paths cannot contain . or .. segments"
|
|
2176
2297
|
);
|
|
2177
|
-
var sdkRuntimeReferenceSchema =
|
|
2298
|
+
var sdkRuntimeReferenceSchema = z17.object({
|
|
2178
2299
|
digest: sha256,
|
|
2179
2300
|
/** The SDK version that built the runtime, for display. The digest is what pins it. */
|
|
2180
|
-
sdkVersion:
|
|
2301
|
+
sdkVersion: z17.string().min(1).max(64)
|
|
2181
2302
|
}).strict();
|
|
2182
|
-
var sdkRuntimeModulesSchema =
|
|
2303
|
+
var sdkRuntimeModulesSchema = z17.record(sdkRuntimeModulePathSchema, z17.string().min(1)).refine((modules) => {
|
|
2183
2304
|
const entries = Object.values(modules);
|
|
2184
2305
|
return entries.length > 0 && entries.length <= sdkRuntimeLimits.modules && entries.reduce((sum, source) => sum + source.length, 0) <= sdkRuntimeLimits.size;
|
|
2185
2306
|
}, `A runtime has 1 to ${sdkRuntimeLimits.modules} modules and at most ${sdkRuntimeLimits.size} characters of source`);
|
|
2186
2307
|
var sdkRuntimeSchema = sdkRuntimeReferenceSchema.extend({
|
|
2187
|
-
zodVersion:
|
|
2308
|
+
zodVersion: z17.string().min(1).max(64),
|
|
2188
2309
|
modules: sdkRuntimeModulesSchema
|
|
2189
2310
|
}).strict();
|
|
2190
2311
|
async function sdkRuntimeDigest(modules) {
|
|
@@ -2199,66 +2320,66 @@ async function sdkRuntimeDigest(modules) {
|
|
|
2199
2320
|
}
|
|
2200
2321
|
|
|
2201
2322
|
// src/completion.ts
|
|
2202
|
-
import * as
|
|
2203
|
-
var name =
|
|
2204
|
-
var completionPolicySchema =
|
|
2323
|
+
import * as z18 from "zod";
|
|
2324
|
+
var name = z18.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
|
|
2325
|
+
var completionPolicySchema = z18.discriminatedUnion("kind", [
|
|
2205
2326
|
streakPolicySchema,
|
|
2206
2327
|
counterPolicySchema,
|
|
2207
|
-
|
|
2208
|
-
|
|
2328
|
+
z18.object({ kind: z18.literal("once") }).strict(),
|
|
2329
|
+
z18.object({ kind: z18.literal("keyed") }).strict()
|
|
2209
2330
|
]);
|
|
2210
|
-
var completionKeySchema =
|
|
2211
|
-
var budgetSchema =
|
|
2331
|
+
var completionKeySchema = z18.string().min(1).max(500);
|
|
2332
|
+
var budgetSchema = z18.object({
|
|
2212
2333
|
id: name,
|
|
2213
|
-
scope:
|
|
2334
|
+
scope: z18.enum(["member", "project"]),
|
|
2214
2335
|
/**
|
|
2215
2336
|
* The project calendar period of the attempt's eligibility time that one bucket covers:
|
|
2216
2337
|
* `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
|
|
2217
2338
|
* `"lifetime"` never resets.
|
|
2218
2339
|
*/
|
|
2219
2340
|
period: calendarPeriodSchema,
|
|
2220
|
-
limit:
|
|
2221
|
-
cost:
|
|
2222
|
-
|
|
2223
|
-
|
|
2341
|
+
limit: z18.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
2342
|
+
cost: z18.union([
|
|
2343
|
+
z18.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
2344
|
+
z18.object({ balance: name }).strict()
|
|
2224
2345
|
])
|
|
2225
2346
|
}).strict();
|
|
2226
|
-
var memberCompletionSchema =
|
|
2227
|
-
quest:
|
|
2347
|
+
var memberCompletionSchema = z18.object({
|
|
2348
|
+
quest: z18.string().min(1).max(200),
|
|
2228
2349
|
key: completionKeySchema,
|
|
2229
|
-
completedAt:
|
|
2350
|
+
completedAt: z18.number().int().nonnegative().safe().nullable()
|
|
2230
2351
|
});
|
|
2231
2352
|
var maxMemberCompletions = 100;
|
|
2232
2353
|
|
|
2233
2354
|
// src/integrations.ts
|
|
2234
|
-
import * as
|
|
2235
|
-
var evaluatorIntegrationProviderSchema =
|
|
2236
|
-
var integrationProviderSchema =
|
|
2237
|
-
var discordServerSchema =
|
|
2238
|
-
id:
|
|
2239
|
-
name:
|
|
2240
|
-
icon:
|
|
2241
|
-
});
|
|
2242
|
-
var projectIntegrationSchema =
|
|
2355
|
+
import * as z19 from "zod";
|
|
2356
|
+
var evaluatorIntegrationProviderSchema = z19.enum(["discord", "x"]);
|
|
2357
|
+
var integrationProviderSchema = z19.enum(["discord"]);
|
|
2358
|
+
var discordServerSchema = z19.object({
|
|
2359
|
+
id: z19.string().regex(/^[0-9]{1,20}$/),
|
|
2360
|
+
name: z19.string().min(1),
|
|
2361
|
+
icon: z19.string().nullable()
|
|
2362
|
+
});
|
|
2363
|
+
var projectIntegrationSchema = z19.object({
|
|
2243
2364
|
provider: integrationProviderSchema,
|
|
2244
|
-
configured:
|
|
2245
|
-
status:
|
|
2246
|
-
revision:
|
|
2365
|
+
configured: z19.boolean(),
|
|
2366
|
+
status: z19.enum(["disconnected", "ready", "attention"]),
|
|
2367
|
+
revision: z19.number().int().nonnegative(),
|
|
2247
2368
|
server: discordServerSchema.nullable(),
|
|
2248
|
-
issue:
|
|
2249
|
-
connectedAt:
|
|
2369
|
+
issue: z19.string().nullable(),
|
|
2370
|
+
connectedAt: z19.number().default(0)
|
|
2250
2371
|
});
|
|
2251
2372
|
|
|
2252
2373
|
// src/wallet.ts
|
|
2253
|
-
import * as
|
|
2254
|
-
var solanaAddressSchema =
|
|
2255
|
-
var walletChainSchema =
|
|
2374
|
+
import * as z20 from "zod";
|
|
2375
|
+
var solanaAddressSchema = z20.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
|
|
2376
|
+
var walletChainSchema = z20.enum(["solana", "eip155", "cosmos"]);
|
|
2256
2377
|
var cosmosNetworkPattern = /^cosmos:[-_a-zA-Z0-9]{1,32}$/;
|
|
2257
|
-
var cosmosNetworkSchema =
|
|
2378
|
+
var cosmosNetworkSchema = z20.custom(
|
|
2258
2379
|
(value) => typeof value === "string" && cosmosNetworkPattern.test(value),
|
|
2259
2380
|
"Use a Cosmos network: cosmos:<chain ID>"
|
|
2260
2381
|
);
|
|
2261
|
-
var cosmosDenomSchema =
|
|
2382
|
+
var cosmosDenomSchema = z20.string().regex(
|
|
2262
2383
|
/^[a-zA-Z][a-zA-Z0-9/:._-]{2,127}$/,
|
|
2263
2384
|
"Use a Cosmos bank denomination such as uatom or uosmo"
|
|
2264
2385
|
);
|
|
@@ -2284,51 +2405,51 @@ function cosmosChain(chain) {
|
|
|
2284
2405
|
return { ...value, network };
|
|
2285
2406
|
}
|
|
2286
2407
|
var solanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
2287
|
-
var evmAddressSchema =
|
|
2288
|
-
var cosmosAddressSchema =
|
|
2408
|
+
var evmAddressSchema = z20.string().regex(/^0x[0-9a-fA-F]{40}$/);
|
|
2409
|
+
var cosmosAddressSchema = z20.string().min(8).max(90).regex(
|
|
2289
2410
|
/^(?:[a-z][a-z0-9]{0,82}1[02-9ac-hj-np-z]{38,}|[A-Z][A-Z0-9]{0,82}1[02-9AC-HJ-NP-Z]{38,})$/
|
|
2290
2411
|
);
|
|
2291
|
-
var walletAddressInputSchema =
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
chain:
|
|
2412
|
+
var walletAddressInputSchema = z20.discriminatedUnion("chain", [
|
|
2413
|
+
z20.object({ chain: z20.literal("solana"), address: solanaAddressSchema }).strict(),
|
|
2414
|
+
z20.object({
|
|
2415
|
+
chain: z20.literal("eip155"),
|
|
2295
2416
|
address: evmAddressSchema,
|
|
2296
2417
|
/** Shown in the sign-in message's Chain ID line only: links are chain-agnostic. Defaults to 1. */
|
|
2297
|
-
chainId:
|
|
2418
|
+
chainId: z20.number().int().positive().safe().optional()
|
|
2298
2419
|
}).strict(),
|
|
2299
|
-
|
|
2300
|
-
chain:
|
|
2420
|
+
z20.object({
|
|
2421
|
+
chain: z20.literal("cosmos"),
|
|
2301
2422
|
network: cosmosNetworkSchema,
|
|
2302
2423
|
address: cosmosAddressSchema
|
|
2303
2424
|
}).strict()
|
|
2304
2425
|
]);
|
|
2305
|
-
var walletMessageChallengeSchema =
|
|
2306
|
-
id:
|
|
2307
|
-
purpose:
|
|
2426
|
+
var walletMessageChallengeSchema = z20.object({
|
|
2427
|
+
id: z20.string().min(1).max(200),
|
|
2428
|
+
purpose: z20.enum(["link", "sign-in"]),
|
|
2308
2429
|
chain: walletChainSchema,
|
|
2309
2430
|
network: cosmosNetworkSchema.nullable(),
|
|
2310
2431
|
/** Canonical (base58, EIP-55 or lowercase bech32). The signer must sign with this address. */
|
|
2311
|
-
address:
|
|
2312
|
-
message:
|
|
2313
|
-
expiresAt:
|
|
2432
|
+
address: z20.string(),
|
|
2433
|
+
message: z20.string().max(4096),
|
|
2434
|
+
expiresAt: z20.number().int()
|
|
2314
2435
|
});
|
|
2315
|
-
var walletSignatureSchema =
|
|
2316
|
-
challenge:
|
|
2436
|
+
var walletSignatureSchema = z20.object({
|
|
2437
|
+
challenge: z20.string().min(1).max(200),
|
|
2317
2438
|
/** solana: base58, 64 bytes · eip155: 0x and 130 hex digits (65 bytes) · cosmos: base64, 64 bytes (r‖s) */
|
|
2318
|
-
signature:
|
|
2439
|
+
signature: z20.string().min(1).max(256),
|
|
2319
2440
|
/** cosmos only: the base64 33-byte compressed secp256k1 key from signArbitrary's pub_key.value */
|
|
2320
|
-
publicKey:
|
|
2441
|
+
publicKey: z20.string().max(128).optional()
|
|
2321
2442
|
}).strict();
|
|
2322
|
-
var linkedWalletSchema =
|
|
2443
|
+
var linkedWalletSchema = z20.object({
|
|
2323
2444
|
chain: walletChainSchema,
|
|
2324
2445
|
network: cosmosNetworkSchema.nullable(),
|
|
2325
|
-
address:
|
|
2326
|
-
verifiedAt:
|
|
2327
|
-
revision:
|
|
2446
|
+
address: z20.string(),
|
|
2447
|
+
verifiedAt: z20.number().int().nonnegative(),
|
|
2448
|
+
revision: z20.number().int().positive(),
|
|
2328
2449
|
/** True when this wallet can sign in: it was first used through wallet sign-in. Linking never enables sign-in. */
|
|
2329
|
-
signIn:
|
|
2450
|
+
signIn: z20.boolean()
|
|
2330
2451
|
});
|
|
2331
|
-
var walletUnlinkInputSchema =
|
|
2452
|
+
var walletUnlinkInputSchema = z20.object({ chain: walletChainSchema, address: z20.string().min(1).max(100) }).strict();
|
|
2332
2453
|
async function walletAddressInput(signer) {
|
|
2333
2454
|
const address = await signer.address();
|
|
2334
2455
|
switch (signer.chain) {
|
|
@@ -2352,8 +2473,8 @@ async function walletAddressInput(signer) {
|
|
|
2352
2473
|
}
|
|
2353
2474
|
var WALLETS_PER_CHAIN = 5;
|
|
2354
2475
|
var walletSignInFamilies = ["solana", "eip155", "cosmos"];
|
|
2355
|
-
var walletSignInNetworkSchema =
|
|
2356
|
-
var walletSignInNetworksSchema =
|
|
2476
|
+
var walletSignInNetworkSchema = z20.enum(walletSignInFamilies);
|
|
2477
|
+
var walletSignInNetworksSchema = z20.array(walletSignInNetworkSchema).max(walletSignInFamilies.length).refine((values2) => new Set(values2).size === values2.length, {
|
|
2357
2478
|
message: "Duplicate wallet family"
|
|
2358
2479
|
}).transform(
|
|
2359
2480
|
(values2) => walletSignInFamilies.filter((family) => values2.includes(family))
|
|
@@ -2378,41 +2499,361 @@ function caip10(wallet, network) {
|
|
|
2378
2499
|
function isEvmChainId(value) {
|
|
2379
2500
|
return /^eip155:[1-9][0-9]{0,15}$/.test(value);
|
|
2380
2501
|
}
|
|
2381
|
-
var evmChainIdSchema =
|
|
2502
|
+
var evmChainIdSchema = z20.custom(
|
|
2382
2503
|
(value) => typeof value === "string" && isEvmChainId(value),
|
|
2383
2504
|
'Use an EVM chain ID such as "eip155:8453"'
|
|
2384
2505
|
);
|
|
2385
|
-
var units =
|
|
2506
|
+
var units = z20.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
2386
2507
|
var walletBalanceSchema = responseShape(
|
|
2387
|
-
|
|
2508
|
+
z20.object({
|
|
2388
2509
|
/** Canonical CAIP-2 ID for Solana, EVM or a supported Cosmos SDK chain. */
|
|
2389
|
-
chain:
|
|
2510
|
+
chain: z20.string(),
|
|
2390
2511
|
/** The canonical mint, EIP-55 contract or Cosmos bank denom; null for a native coin. */
|
|
2391
|
-
token:
|
|
2512
|
+
token: z20.string().nullable(),
|
|
2392
2513
|
/** Null when token metadata does not report decimals. */
|
|
2393
|
-
decimals:
|
|
2514
|
+
decimals: z20.number().int().min(0).max(255).nullable(),
|
|
2394
2515
|
/** The sum over `wallets`. */
|
|
2395
2516
|
total: units,
|
|
2396
|
-
wallets:
|
|
2397
|
-
|
|
2517
|
+
wallets: z20.array(
|
|
2518
|
+
z20.object({ address: z20.string(), amount: units }).strict()
|
|
2398
2519
|
),
|
|
2399
2520
|
/** Solana: lowest slot. EVM: approximate latest block. Cosmos: the fixed queried block. */
|
|
2400
|
-
at:
|
|
2401
|
-
observedAt:
|
|
2521
|
+
at: z20.object({ kind: z20.enum(["slot", "block"]), number: units }).strict(),
|
|
2522
|
+
observedAt: z20.number().int().nonnegative()
|
|
2523
|
+
}).strict()
|
|
2524
|
+
);
|
|
2525
|
+
var walletBalanceSampleSchema = z20.object({
|
|
2526
|
+
/** The balance in base units, as a decimal integer string. */
|
|
2527
|
+
amount: z20.string(),
|
|
2528
|
+
/** The token's decimals; null when token metadata does not report them. */
|
|
2529
|
+
decimals: z20.number().int().min(0).max(255).nullable(),
|
|
2530
|
+
/**
|
|
2531
|
+
* Where the run read: the EVM block number or Cosmos height every wallet of the run was read at,
|
|
2532
|
+
* or on Solana the slot this wallet's answer reflects (at or after the run's pinned slot), as
|
|
2533
|
+
* a decimal integer string.
|
|
2534
|
+
*/
|
|
2535
|
+
block: z20.string()
|
|
2536
|
+
});
|
|
2537
|
+
var nftCollectionPattern = /^(eip155:[1-9][0-9]{0,15})\/(erc721|erc1155):(0x[0-9a-fA-F]{40})(?:\/(0|[1-9][0-9]{0,77}))?$/;
|
|
2538
|
+
var solanaNftCollectionPrefix = `${solanaMainnet}/nft:`;
|
|
2539
|
+
var maxTokenId = 2n ** 256n - 1n;
|
|
2540
|
+
function parseNftCollection(value) {
|
|
2541
|
+
if (value.startsWith(solanaNftCollectionPrefix)) {
|
|
2542
|
+
const mint = value.slice(solanaNftCollectionPrefix.length);
|
|
2543
|
+
return solanaAddressSchema.safeParse(mint).success ? { chain: solanaMainnet, standard: "metaplex", mint } : null;
|
|
2544
|
+
}
|
|
2545
|
+
const match = nftCollectionPattern.exec(value);
|
|
2546
|
+
if (!match) {
|
|
2547
|
+
return null;
|
|
2548
|
+
}
|
|
2549
|
+
const [, chain, standard, contract, tokenId] = match;
|
|
2550
|
+
if (standard === "erc1155" !== (tokenId !== void 0) || tokenId !== void 0 && BigInt(tokenId) > maxTokenId) {
|
|
2551
|
+
return null;
|
|
2552
|
+
}
|
|
2553
|
+
return {
|
|
2554
|
+
chain,
|
|
2555
|
+
standard,
|
|
2556
|
+
contract,
|
|
2557
|
+
tokenId: tokenId ?? null
|
|
2558
|
+
};
|
|
2559
|
+
}
|
|
2560
|
+
function isNftCollection(value) {
|
|
2561
|
+
return parseNftCollection(value) !== null;
|
|
2562
|
+
}
|
|
2563
|
+
var walletNftsSchema = responseShape(
|
|
2564
|
+
z20.object({
|
|
2565
|
+
/** The collection read, in canonical form: an EVM contract EIP-55 checksummed. */
|
|
2566
|
+
collection: z20.string(),
|
|
2567
|
+
/** The collection's chain, canonical CAIP-2. */
|
|
2568
|
+
chain: z20.string(),
|
|
2569
|
+
standard: z20.enum(["erc721", "erc1155", "metaplex"]),
|
|
2570
|
+
/** How many the wallets hold together: the sum over `wallets`. */
|
|
2571
|
+
total: units,
|
|
2572
|
+
wallets: z20.array(
|
|
2573
|
+
z20.object({ address: z20.string(), count: units }).strict()
|
|
2574
|
+
),
|
|
2575
|
+
/** Solana: the lowest slot of the reads. EVM: the approximate latest block. */
|
|
2576
|
+
at: z20.object({ kind: z20.enum(["slot", "block"]), number: units }).strict(),
|
|
2577
|
+
observedAt: z20.number().int().nonnegative()
|
|
2578
|
+
}).strict()
|
|
2579
|
+
);
|
|
2580
|
+
var integerType = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
2581
|
+
var bytesType = /^bytes([1-9]|[12][0-9]|3[0-2])?$/;
|
|
2582
|
+
function elementaryType(type) {
|
|
2583
|
+
const integer = integerType.exec(type);
|
|
2584
|
+
if (integer) {
|
|
2585
|
+
return `${integer[1]}${integer[2] ?? "256"}`;
|
|
2586
|
+
}
|
|
2587
|
+
return type === "address" || type === "bool" || type === "string" || bytesType.test(type) ? type : null;
|
|
2588
|
+
}
|
|
2589
|
+
function parameterType(parameter) {
|
|
2590
|
+
const match = /^([a-z0-9]+)(?:\s+[A-Za-z_$][A-Za-z0-9_$]*)?$/.exec(
|
|
2591
|
+
parameter.trim()
|
|
2592
|
+
);
|
|
2593
|
+
return match ? elementaryType(match[1]) : null;
|
|
2594
|
+
}
|
|
2595
|
+
function parseContractFunction(signature) {
|
|
2596
|
+
const match = /^function\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*\(([^()]*)\)\s+(?:external\s+)?(view|pure)\s+returns\s*\(([^()]*)\)$/.exec(
|
|
2597
|
+
signature.trim()
|
|
2598
|
+
);
|
|
2599
|
+
if (!match) {
|
|
2600
|
+
return null;
|
|
2601
|
+
}
|
|
2602
|
+
const [, name2, parameters, mutability, returned] = match;
|
|
2603
|
+
const inputs = parameters.trim() ? parameters.split(",").map(parameterType) : [];
|
|
2604
|
+
const output = returned.includes(",") ? null : parameterType(returned);
|
|
2605
|
+
if (inputs.length > 16 || inputs.some((type) => type === null) || !output || !(output === "bool" || output === "address" || integerType.test(output))) {
|
|
2606
|
+
return null;
|
|
2607
|
+
}
|
|
2608
|
+
return {
|
|
2609
|
+
name: name2,
|
|
2610
|
+
inputs,
|
|
2611
|
+
returns: output,
|
|
2612
|
+
mutability,
|
|
2613
|
+
signature: `function ${name2}(${inputs.join(",")}) ${mutability} returns (${output})`
|
|
2614
|
+
};
|
|
2615
|
+
}
|
|
2616
|
+
function parseContractCall(value) {
|
|
2617
|
+
const match = /^(eip155:[1-9][0-9]{0,15}):(0x[0-9a-fA-F]{40}) (function .+)$/.exec(value);
|
|
2618
|
+
const parsed = match && value.length <= 400 ? parseContractFunction(match[3]) : null;
|
|
2619
|
+
return parsed ? {
|
|
2620
|
+
chain: match[1],
|
|
2621
|
+
contract: match[2],
|
|
2622
|
+
function: parsed
|
|
2623
|
+
} : null;
|
|
2624
|
+
}
|
|
2625
|
+
function isContractCall(value) {
|
|
2626
|
+
return parseContractCall(value) !== null;
|
|
2627
|
+
}
|
|
2628
|
+
var signedUnits = z20.string().regex(/^(0|-?[1-9][0-9]*)$/);
|
|
2629
|
+
var walletCallSchema = responseShape(
|
|
2630
|
+
z20.object({
|
|
2631
|
+
/** The call read, canonical: the contract EIP-55 checksummed, the signature without names. */
|
|
2632
|
+
call: z20.string(),
|
|
2633
|
+
/** The contract's chain, canonical CAIP-2. */
|
|
2634
|
+
chain: z20.string(),
|
|
2635
|
+
/** The contract, EIP-55 checksummed. */
|
|
2636
|
+
contract: z20.string(),
|
|
2637
|
+
/** The return value's ABI type, such as `"uint256"` or `"bool"`. */
|
|
2638
|
+
returns: z20.string(),
|
|
2639
|
+
/** The sum of the wallets' values when the function returns an integer; null otherwise. */
|
|
2640
|
+
total: signedUnits.nullable(),
|
|
2641
|
+
wallets: z20.array(
|
|
2642
|
+
z20.object({
|
|
2643
|
+
address: z20.string(),
|
|
2644
|
+
/** An integer as a decimal string, a bool, or an EIP-55 address. */
|
|
2645
|
+
value: z20.union([z20.string(), z20.boolean()])
|
|
2646
|
+
}).strict()
|
|
2647
|
+
),
|
|
2648
|
+
/** The block every call read. */
|
|
2649
|
+
at: z20.object({ kind: z20.enum(["block"]), number: units }).strict(),
|
|
2650
|
+
observedAt: z20.number().int().nonnegative()
|
|
2651
|
+
}).strict()
|
|
2652
|
+
);
|
|
2653
|
+
var walletDelegationsSchema = responseShape(
|
|
2654
|
+
z20.object({
|
|
2655
|
+
chain: z20.string(),
|
|
2656
|
+
/** The chain's staking denomination, such as `uatom`: every amount is in its base units. */
|
|
2657
|
+
denom: z20.string(),
|
|
2658
|
+
/** The validator the read counted, or null for every validator. */
|
|
2659
|
+
validator: z20.string().nullable(),
|
|
2660
|
+
/** The sum over `wallets`. */
|
|
2661
|
+
total: units,
|
|
2662
|
+
wallets: z20.array(
|
|
2663
|
+
z20.object({ address: z20.string(), amount: units }).strict()
|
|
2664
|
+
),
|
|
2665
|
+
/** What the wallets delegate to each validator, summed over the wallets; none at zero. */
|
|
2666
|
+
validators: z20.array(
|
|
2667
|
+
z20.object({ validator: z20.string(), amount: units }).strict()
|
|
2668
|
+
),
|
|
2669
|
+
/** The block every request read. */
|
|
2670
|
+
at: z20.object({ kind: z20.enum(["block"]), number: units }).strict(),
|
|
2671
|
+
observedAt: z20.number().int().nonnegative()
|
|
2672
|
+
}).strict()
|
|
2673
|
+
);
|
|
2674
|
+
var contractEventPattern = /^(eip155:[1-9][0-9]{0,15}):(0x[0-9a-fA-F]{40})\s+(?:event\s+)?([A-Za-z_$][A-Za-z0-9_$]*)\s*\(([^()]*)\)\s*;?$/;
|
|
2675
|
+
var eventArgumentPattern = /^([a-z0-9]+(?:\[[0-9]*\])*)(\s+indexed)?\s+([A-Za-z_$][A-Za-z0-9_$]*)$/;
|
|
2676
|
+
function eventArgumentType(type) {
|
|
2677
|
+
const match = /^([a-z]+)([0-9]*)((?:\[[0-9]*\])*)$/.exec(type);
|
|
2678
|
+
if (!match) {
|
|
2679
|
+
return null;
|
|
2680
|
+
}
|
|
2681
|
+
const [, base2, size2, arrays] = match;
|
|
2682
|
+
const bits = size2 === "" ? 256 : Number(size2);
|
|
2683
|
+
let canonical = null;
|
|
2684
|
+
if (size2.startsWith("0")) {
|
|
2685
|
+
return null;
|
|
2686
|
+
}
|
|
2687
|
+
if (base2 === "uint" || base2 === "int") {
|
|
2688
|
+
canonical = bits >= 8 && bits <= 256 && bits % 8 === 0 ? base2 + bits : null;
|
|
2689
|
+
} else if (base2 === "bytes") {
|
|
2690
|
+
canonical = size2 === "" || bits <= 32 ? base2 + size2 : null;
|
|
2691
|
+
} else if ((base2 === "address" || base2 === "bool" || base2 === "string") && size2 === "") {
|
|
2692
|
+
canonical = base2;
|
|
2693
|
+
}
|
|
2694
|
+
return canonical && /^(\[([1-9][0-9]*)?\])?$/.test(arrays) ? canonical + arrays : null;
|
|
2695
|
+
}
|
|
2696
|
+
function parseContractEvent(value) {
|
|
2697
|
+
const match = contractEventPattern.exec(value.trim());
|
|
2698
|
+
if (!match) {
|
|
2699
|
+
return null;
|
|
2700
|
+
}
|
|
2701
|
+
const [, chain, contract, name2, list] = match;
|
|
2702
|
+
const inputs = [];
|
|
2703
|
+
for (const part of list.trim() ? list.split(",") : []) {
|
|
2704
|
+
const argument = eventArgumentPattern.exec(part.trim());
|
|
2705
|
+
const type = argument && eventArgumentType(argument[1]);
|
|
2706
|
+
if (!argument || !type || argument[3] === "indexed" || inputs.some((input) => input.name === argument[3])) {
|
|
2707
|
+
return null;
|
|
2708
|
+
}
|
|
2709
|
+
inputs.push({ name: argument[3], type, indexed: !!argument[2] });
|
|
2710
|
+
}
|
|
2711
|
+
const indexed = inputs.filter((input) => input.indexed);
|
|
2712
|
+
if (indexed.length > 3 || !indexed.some((input) => input.type === "address")) {
|
|
2713
|
+
return null;
|
|
2714
|
+
}
|
|
2715
|
+
return {
|
|
2716
|
+
chain,
|
|
2717
|
+
contract,
|
|
2718
|
+
name: name2,
|
|
2719
|
+
inputs,
|
|
2720
|
+
signature: `${name2}(${inputs.map((input) => input.type).join(",")})`
|
|
2721
|
+
};
|
|
2722
|
+
}
|
|
2723
|
+
function isContractEvent(value) {
|
|
2724
|
+
return parseContractEvent(value) !== null;
|
|
2725
|
+
}
|
|
2726
|
+
var maxWalletEventLogs = 1e3;
|
|
2727
|
+
var maxWalletEventLookback = 30 * 24 * 60 * 60 * 1e3;
|
|
2728
|
+
var walletEventScalarSchema = z20.union([z20.string(), z20.boolean()]);
|
|
2729
|
+
var walletEventValueSchema = z20.union([
|
|
2730
|
+
walletEventScalarSchema,
|
|
2731
|
+
z20.array(walletEventScalarSchema)
|
|
2732
|
+
]);
|
|
2733
|
+
var walletEventsSchema = responseShape(
|
|
2734
|
+
z20.object({
|
|
2735
|
+
/** The event read, in canonical form: the contract EIP-55 checksummed. */
|
|
2736
|
+
event: z20.string(),
|
|
2737
|
+
/** The event's chain, canonical CAIP-2. */
|
|
2738
|
+
chain: z20.string(),
|
|
2739
|
+
contract: z20.string(),
|
|
2740
|
+
/** The earliest block time read, in epoch milliseconds: `since`, or the activation. */
|
|
2741
|
+
since: z20.number().int().nonnegative(),
|
|
2742
|
+
/**
|
|
2743
|
+
* The newest block read: the chain's `finalized` block, or its `safe` block on a chain without
|
|
2744
|
+
* finality. Events in later blocks are not read yet.
|
|
2745
|
+
*/
|
|
2746
|
+
at: z20.object({ kind: z20.enum(["block"]), number: units }).strict(),
|
|
2747
|
+
finality: z20.enum(["finalized", "safe"]),
|
|
2748
|
+
/** The matching events, oldest first. */
|
|
2749
|
+
logs: z20.array(
|
|
2750
|
+
z20.object({
|
|
2751
|
+
/** The member's linked wallet the `account` argument names. */
|
|
2752
|
+
wallet: z20.string(),
|
|
2753
|
+
block: units,
|
|
2754
|
+
/** The block's time, in epoch milliseconds. */
|
|
2755
|
+
timestamp: z20.number().int().nonnegative(),
|
|
2756
|
+
tx: z20.string(),
|
|
2757
|
+
logIndex: z20.number().int().nonnegative(),
|
|
2758
|
+
/** Every argument, by name. */
|
|
2759
|
+
args: z20.record(z20.string(), walletEventValueSchema)
|
|
2760
|
+
}).strict()
|
|
2761
|
+
).max(maxWalletEventLogs),
|
|
2762
|
+
observedAt: z20.number().int().nonnegative()
|
|
2763
|
+
}).strict()
|
|
2764
|
+
);
|
|
2765
|
+
function isSolanaProgram(value) {
|
|
2766
|
+
return solanaAddressSchema.safeParse(value).success;
|
|
2767
|
+
}
|
|
2768
|
+
var anchorIdlSchema = z20.record(z20.string(), z20.json());
|
|
2769
|
+
var solanaProgramIdlSchema = z20.object({
|
|
2770
|
+
/** The program the setting held when the IDL was stored. */
|
|
2771
|
+
program: z20.string(),
|
|
2772
|
+
source: z20.string(),
|
|
2773
|
+
idl: anchorIdlSchema
|
|
2774
|
+
}).strict();
|
|
2775
|
+
var maxWalletTransactions = 1e3;
|
|
2776
|
+
var maxWalletTransactionLookback = 30 * 24 * 60 * 60 * 1e3;
|
|
2777
|
+
var walletTransactionsSchema = responseShape(
|
|
2778
|
+
z20.object({
|
|
2779
|
+
program: z20.string(),
|
|
2780
|
+
/** Solana mainnet's CAIP-2 ID. */
|
|
2781
|
+
chain: z20.string(),
|
|
2782
|
+
/** The mint whose associated token accounts were read, or null for the wallets themselves. */
|
|
2783
|
+
mint: z20.string().nullable(),
|
|
2784
|
+
/** The earliest block time read, in epoch milliseconds: `since`, or the activation. */
|
|
2785
|
+
since: z20.number().int().nonnegative(),
|
|
2786
|
+
/** The newest finalized slot read. Transactions in later slots are not read yet. */
|
|
2787
|
+
at: z20.object({ kind: z20.enum(["slot"]), number: units }).strict(),
|
|
2788
|
+
/**
|
|
2789
|
+
* False when a wallet had more than {@link maxWalletTransactions} transactions to read since
|
|
2790
|
+
* `since`: its newest ones are returned and older ones are not.
|
|
2791
|
+
*/
|
|
2792
|
+
complete: z20.boolean(),
|
|
2793
|
+
/** The matching transactions, oldest first: one entry per linked wallet a transaction touched. */
|
|
2794
|
+
transactions: z20.array(
|
|
2795
|
+
z20.object({
|
|
2796
|
+
/** The member's linked wallet whose history holds the transaction. */
|
|
2797
|
+
wallet: z20.string(),
|
|
2798
|
+
signature: z20.string(),
|
|
2799
|
+
slot: units,
|
|
2800
|
+
/** The block's time, in epoch milliseconds. */
|
|
2801
|
+
timestamp: z20.number().int().nonnegative(),
|
|
2802
|
+
/**
|
|
2803
|
+
* Whether the wallet signed the transaction. False for one someone else signed that only
|
|
2804
|
+
* touched the wallet, such as a transfer into it. Check it before rewarding an action.
|
|
2805
|
+
* Results captured before Relay reported it read as false.
|
|
2806
|
+
*/
|
|
2807
|
+
signer: z20.boolean().default(false),
|
|
2808
|
+
/**
|
|
2809
|
+
* Every program the transaction invoked, in call order: each top-level instruction's
|
|
2810
|
+
* program, then the programs it called.
|
|
2811
|
+
*/
|
|
2812
|
+
programs: z20.array(z20.string()),
|
|
2813
|
+
/**
|
|
2814
|
+
* The wallet's balance changes: `"SOL"` from its lamports (rent included, the fee left out
|
|
2815
|
+
* when the wallet paid it), and
|
|
2816
|
+
* each mint from the token accounts it owns. Mints whose balance did not change are left out.
|
|
2817
|
+
*/
|
|
2818
|
+
balanceChanges: z20.array(
|
|
2819
|
+
z20.object({ mint: z20.string(), delta: signedUnits }).strict()
|
|
2820
|
+
),
|
|
2821
|
+
/**
|
|
2822
|
+
* The program's instructions in the transaction, top-level and inner, in call order,
|
|
2823
|
+
* decoded with the program's Anchor IDL. Instructions the IDL does not describe are left
|
|
2824
|
+
* out. Absent when the program's setting has no IDL.
|
|
2825
|
+
*/
|
|
2826
|
+
instructions: z20.array(
|
|
2827
|
+
z20.object({
|
|
2828
|
+
/** The instruction's name, as the IDL spells it. */
|
|
2829
|
+
name: z20.string(),
|
|
2830
|
+
/**
|
|
2831
|
+
* Its arguments by name: integers up to 32 bits and floats as numbers, wider
|
|
2832
|
+
* integers as decimal strings, public keys in base58, `bytes` and arrays as arrays,
|
|
2833
|
+
* an absent option as null, and an enum as `{ Variant: fields }`.
|
|
2834
|
+
*/
|
|
2835
|
+
args: z20.record(z20.string(), z20.json()),
|
|
2836
|
+
/** The accounts the IDL names, by name: each a base58 address. */
|
|
2837
|
+
accounts: z20.record(z20.string(), z20.string())
|
|
2838
|
+
}).strict()
|
|
2839
|
+
).optional()
|
|
2840
|
+
}).strict()
|
|
2841
|
+
),
|
|
2842
|
+
observedAt: z20.number().int().nonnegative()
|
|
2402
2843
|
}).strict()
|
|
2403
2844
|
);
|
|
2404
2845
|
|
|
2405
2846
|
// src/submission-input.ts
|
|
2406
|
-
import * as
|
|
2407
|
-
var textOptionsSchema =
|
|
2408
|
-
required:
|
|
2409
|
-
minLength:
|
|
2410
|
-
maxLength:
|
|
2847
|
+
import * as z21 from "zod";
|
|
2848
|
+
var textOptionsSchema = z21.object({
|
|
2849
|
+
required: z21.boolean().default(true),
|
|
2850
|
+
minLength: z21.number().int().min(0).max(1e4).default(1),
|
|
2851
|
+
maxLength: z21.number().int().min(1).max(1e4).default(1e4)
|
|
2411
2852
|
}).strict().refine(
|
|
2412
2853
|
(v) => v.minLength <= v.maxLength,
|
|
2413
2854
|
"minLength must not exceed maxLength"
|
|
2414
2855
|
);
|
|
2415
|
-
var hostSchema =
|
|
2856
|
+
var hostSchema = z21.string().min(1).max(253).refine((host) => {
|
|
2416
2857
|
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
2417
2858
|
return false;
|
|
2418
2859
|
}
|
|
@@ -2423,13 +2864,13 @@ var hostSchema = z19.string().min(1).max(253).refine((host) => {
|
|
|
2423
2864
|
return false;
|
|
2424
2865
|
}
|
|
2425
2866
|
}, "Use a hostname without a scheme, path, port, or wildcard");
|
|
2426
|
-
var urlOptionsSchema =
|
|
2427
|
-
required:
|
|
2428
|
-
allowedHosts:
|
|
2867
|
+
var urlOptionsSchema = z21.object({
|
|
2868
|
+
required: z21.boolean().default(true),
|
|
2869
|
+
allowedHosts: z21.array(hostSchema).min(1).max(100).optional()
|
|
2429
2870
|
}).strict();
|
|
2430
|
-
var textEvidenceSchema =
|
|
2431
|
-
var urlEvidenceSchema =
|
|
2432
|
-
var valueEvidenceSchema =
|
|
2871
|
+
var textEvidenceSchema = z21.object({ kind: z21.literal("text"), value: z21.string().max(1e4) }).strict();
|
|
2872
|
+
var urlEvidenceSchema = z21.object({ kind: z21.literal("url"), value: z21.string().max(2048) }).strict();
|
|
2873
|
+
var valueEvidenceSchema = z21.discriminatedUnion("kind", [
|
|
2433
2874
|
textEvidenceSchema,
|
|
2434
2875
|
urlEvidenceSchema
|
|
2435
2876
|
]);
|
|
@@ -2492,22 +2933,22 @@ function xPostId(value) {
|
|
|
2492
2933
|
}
|
|
2493
2934
|
|
|
2494
2935
|
// src/quiz.ts
|
|
2495
|
-
import * as
|
|
2496
|
-
var quizId =
|
|
2497
|
-
var quizChoiceSchema =
|
|
2498
|
-
var quizQuestionSchema =
|
|
2936
|
+
import * as z22 from "zod";
|
|
2937
|
+
var quizId = z22.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
2938
|
+
var quizChoiceSchema = z22.object({ id: quizId, label: z22.string().trim().min(1).max(500) }).strict();
|
|
2939
|
+
var quizQuestionSchema = z22.object({
|
|
2499
2940
|
id: quizId,
|
|
2500
|
-
prompt:
|
|
2501
|
-
choices:
|
|
2941
|
+
prompt: z22.string().trim().min(1).max(1e3),
|
|
2942
|
+
choices: z22.array(quizChoiceSchema).min(2).max(8).refine(
|
|
2502
2943
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
2503
2944
|
"Choice IDs must be unique"
|
|
2504
2945
|
)
|
|
2505
2946
|
}).strict();
|
|
2506
|
-
var quizQuestionsSchema =
|
|
2947
|
+
var quizQuestionsSchema = z22.array(quizQuestionSchema).min(1).max(20).refine(
|
|
2507
2948
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
2508
2949
|
"Question IDs must be unique"
|
|
2509
2950
|
);
|
|
2510
|
-
var quizContentSchema =
|
|
2951
|
+
var quizContentSchema = z22.array(
|
|
2511
2952
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
2512
2953
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
2513
2954
|
"Choose a correct answer from the available choices"
|
|
@@ -2518,107 +2959,116 @@ var quizContentSchema = z20.array(
|
|
|
2518
2959
|
);
|
|
2519
2960
|
|
|
2520
2961
|
// src/resources.ts
|
|
2521
|
-
import * as
|
|
2522
|
-
var resourceSourceSchema =
|
|
2523
|
-
|
|
2524
|
-
provider:
|
|
2525
|
-
resource:
|
|
2962
|
+
import * as z23 from "zod";
|
|
2963
|
+
var resourceSourceSchema = z23.union([
|
|
2964
|
+
z23.strictObject({
|
|
2965
|
+
provider: z23.literal("domino"),
|
|
2966
|
+
resource: z23.literal("point-ledger")
|
|
2526
2967
|
}),
|
|
2527
2968
|
discordResourceSourceSchema
|
|
2528
2969
|
]);
|
|
2529
|
-
var resourceRequestSchema =
|
|
2970
|
+
var resourceRequestSchema = z23.object({
|
|
2530
2971
|
source: resourceSourceSchema,
|
|
2531
|
-
query:
|
|
2532
|
-
cursor:
|
|
2533
|
-
ids:
|
|
2972
|
+
query: z23.string().max(100).optional(),
|
|
2973
|
+
cursor: z23.string().regex(/^\d{1,6}$/).optional(),
|
|
2974
|
+
ids: z23.array(z23.string().min(1).max(100)).max(50).optional()
|
|
2534
2975
|
}).strict();
|
|
2535
|
-
var resourceOptionsSchema =
|
|
2536
|
-
revision:
|
|
2537
|
-
options:
|
|
2538
|
-
|
|
2539
|
-
id:
|
|
2540
|
-
label:
|
|
2541
|
-
description:
|
|
2542
|
-
group:
|
|
2543
|
-
disabledReason:
|
|
2976
|
+
var resourceOptionsSchema = z23.object({
|
|
2977
|
+
revision: z23.number().int(),
|
|
2978
|
+
options: z23.array(
|
|
2979
|
+
z23.object({
|
|
2980
|
+
id: z23.string(),
|
|
2981
|
+
label: z23.string(),
|
|
2982
|
+
description: z23.string().optional(),
|
|
2983
|
+
group: z23.string().optional(),
|
|
2984
|
+
disabledReason: z23.string().optional()
|
|
2544
2985
|
})
|
|
2545
2986
|
),
|
|
2546
2987
|
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
2547
|
-
nextCursor:
|
|
2988
|
+
nextCursor: z23.string().nullable().default(null),
|
|
2548
2989
|
/** @deprecated Use `nextCursor`. Removed in 2.0.0. */
|
|
2549
|
-
cursor:
|
|
2990
|
+
cursor: z23.string().nullable()
|
|
2550
2991
|
});
|
|
2551
2992
|
|
|
2552
2993
|
// src/settings.ts
|
|
2553
|
-
import * as
|
|
2994
|
+
import * as z25 from "zod";
|
|
2554
2995
|
|
|
2555
2996
|
// src/setting-values.ts
|
|
2556
|
-
import * as
|
|
2557
|
-
var settingInstant =
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2997
|
+
import * as z24 from "zod";
|
|
2998
|
+
var settingInstant = offsetDateTimeSchema().transform(
|
|
2999
|
+
(value) => new Date(value).toISOString()
|
|
3000
|
+
);
|
|
3001
|
+
var settingResourceId = z24.union([
|
|
3002
|
+
z24.literal(""),
|
|
3003
|
+
z24.string().regex(/^\S{1,200}$/)
|
|
2561
3004
|
]);
|
|
2562
3005
|
|
|
2563
3006
|
// src/settings.ts
|
|
2564
|
-
var base = { label:
|
|
2565
|
-
var settingFieldSchema =
|
|
2566
|
-
|
|
3007
|
+
var base = { label: z25.string().min(1), description: z25.string().optional() };
|
|
3008
|
+
var settingFieldSchema = z25.discriminatedUnion("kind", [
|
|
3009
|
+
z25.object({
|
|
2567
3010
|
...base,
|
|
2568
|
-
kind:
|
|
2569
|
-
default: identifier.or(
|
|
3011
|
+
kind: z25.literal("point-ledger"),
|
|
3012
|
+
default: identifier.or(z25.literal(""))
|
|
2570
3013
|
}).strict(),
|
|
2571
|
-
|
|
2572
|
-
|
|
3014
|
+
z25.object({ ...base, kind: z25.literal("datetime"), default: settingInstant }).strict(),
|
|
3015
|
+
z25.object({
|
|
2573
3016
|
...base,
|
|
2574
|
-
kind:
|
|
3017
|
+
kind: z25.literal("resource"),
|
|
2575
3018
|
default: settingResourceId,
|
|
2576
3019
|
source: resourceSourceSchema
|
|
2577
3020
|
}).strict(),
|
|
2578
|
-
|
|
2579
|
-
|
|
3021
|
+
z25.object({ ...base, kind: z25.literal("quiz"), default: quizContentSchema }).strict(),
|
|
3022
|
+
z25.object({
|
|
2580
3023
|
...base,
|
|
2581
|
-
kind:
|
|
2582
|
-
default:
|
|
2583
|
-
minLength:
|
|
2584
|
-
maxLength:
|
|
2585
|
-
multiline:
|
|
3024
|
+
kind: z25.literal("text"),
|
|
3025
|
+
default: z25.string(),
|
|
3026
|
+
minLength: z25.number().int().nonnegative(),
|
|
3027
|
+
maxLength: z25.number().int().positive(),
|
|
3028
|
+
multiline: z25.boolean(),
|
|
2586
3029
|
/**
|
|
2587
3030
|
* A list Console offers the value from, beside free text: `telegram-chat` lists the
|
|
2588
|
-
* project's connected Telegram chats. Unknown pickers read as free text.
|
|
3031
|
+
* project's connected Telegram chats. Unknown pickers read as free text. Six pickers also
|
|
2589
3032
|
* constrain the value, at publication and when an operator edits it: `amount`, a
|
|
2590
|
-
* non-negative integer in a token's base units (`settings.amount()`),
|
|
2591
|
-
* `ctx.wallet.balance()` reads (`settings.chain()`)
|
|
3033
|
+
* non-negative integer in a token's base units (`settings.amount()`), `chain`, a chain
|
|
3034
|
+
* `ctx.wallet.balance()` reads (`settings.chain()`), `nft`, an NFT collection
|
|
3035
|
+
* `ctx.wallet.nfts()` reads (`settings.nft()`), whose contract or Solana collection mint
|
|
3036
|
+
* Relay also checks on its chain, `contract-call`, a contract function `ctx.wallet.call()`
|
|
3037
|
+
* reads (`settings.contractCall()`), whose chain Relay also checks, and `contract-event`, a
|
|
3038
|
+
* contract event `ctx.wallet.events()` reads (`settings.contractEvent()`), whose chain and
|
|
3039
|
+
* contract Relay also checks, and `solana-program`, a Solana program
|
|
3040
|
+
* `ctx.wallet.transactions()` reads (`settings.solanaProgram()`), which Relay also checks is
|
|
3041
|
+
* an executable program.
|
|
2592
3042
|
*/
|
|
2593
|
-
picker:
|
|
3043
|
+
picker: z25.string().optional(),
|
|
2594
3044
|
/**
|
|
2595
3045
|
* On an `amount` setting, the token's decimals: Console shows and edits the value in whole
|
|
2596
3046
|
* tokens.
|
|
2597
3047
|
*/
|
|
2598
|
-
decimals:
|
|
3048
|
+
decimals: z25.number().int().min(0).max(255).optional()
|
|
2599
3049
|
}).strict(),
|
|
2600
|
-
|
|
3050
|
+
z25.object({
|
|
2601
3051
|
...base,
|
|
2602
|
-
kind:
|
|
2603
|
-
default:
|
|
2604
|
-
min:
|
|
2605
|
-
max:
|
|
3052
|
+
kind: z25.literal("integer"),
|
|
3053
|
+
default: z25.number().int(),
|
|
3054
|
+
min: z25.number().int(),
|
|
3055
|
+
max: z25.number().int()
|
|
2606
3056
|
}).strict(),
|
|
2607
|
-
|
|
2608
|
-
|
|
3057
|
+
z25.object({ ...base, kind: z25.literal("boolean"), default: z25.boolean() }).strict(),
|
|
3058
|
+
z25.object({
|
|
2609
3059
|
...base,
|
|
2610
|
-
kind:
|
|
2611
|
-
default:
|
|
2612
|
-
options:
|
|
3060
|
+
kind: z25.literal("choice"),
|
|
3061
|
+
default: z25.string(),
|
|
3062
|
+
options: z25.array(z25.string().min(1)).min(1)
|
|
2613
3063
|
}).strict()
|
|
2614
3064
|
]);
|
|
2615
|
-
var settingsFieldsSchema =
|
|
2616
|
-
|
|
3065
|
+
var settingsFieldsSchema = z25.record(
|
|
3066
|
+
z25.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
2617
3067
|
settingFieldSchema
|
|
2618
3068
|
);
|
|
2619
|
-
var settingsValuesSchema =
|
|
2620
|
-
|
|
2621
|
-
|
|
3069
|
+
var settingsValuesSchema = z25.record(
|
|
3070
|
+
z25.string(),
|
|
3071
|
+
z25.union([z25.string(), z25.number().finite(), z25.boolean(), quizContentSchema])
|
|
2622
3072
|
);
|
|
2623
3073
|
function isAmount(value) {
|
|
2624
3074
|
return value.length <= 100 && /^(0|[1-9][0-9]*)$/.test(value);
|
|
@@ -2630,7 +3080,7 @@ function isBoundSetting(field) {
|
|
|
2630
3080
|
return field?.kind === "integer" || field?.kind === "text" && field.picker === "amount";
|
|
2631
3081
|
}
|
|
2632
3082
|
function textSettingSchema(field) {
|
|
2633
|
-
const text =
|
|
3083
|
+
const text = z25.string().min(field.minLength).max(field.maxLength);
|
|
2634
3084
|
switch (field.picker) {
|
|
2635
3085
|
case "amount":
|
|
2636
3086
|
return text.refine(
|
|
@@ -2642,6 +3092,26 @@ function textSettingSchema(field) {
|
|
|
2642
3092
|
isBalanceChain,
|
|
2643
3093
|
'Use "solana" or an EVM chain ID such as "eip155:8453"'
|
|
2644
3094
|
);
|
|
3095
|
+
case "nft":
|
|
3096
|
+
return text.refine(
|
|
3097
|
+
isNftCollection,
|
|
3098
|
+
'Use an NFT collection such as "eip155:1/erc721:0x\u2026", "eip155:8453/erc1155:0x\u2026/1" for one ERC-1155 token ID, or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/nft:<collection mint>"'
|
|
3099
|
+
);
|
|
3100
|
+
case "contract-call":
|
|
3101
|
+
return text.refine(
|
|
3102
|
+
isContractCall,
|
|
3103
|
+
`Use a contract call: the contract's CAIP-10 ID and a view or pure function returning one uint, int, bool or address, such as "eip155:8453:0x\u2026 function stakedOf(address) view returns (uint256)"`
|
|
3104
|
+
);
|
|
3105
|
+
case "contract-event":
|
|
3106
|
+
return text.refine(
|
|
3107
|
+
isContractEvent,
|
|
3108
|
+
'Use a contract event such as "eip155:8453:0x\u2026 Transfer(address indexed from, address indexed to, uint256 value)": name every argument, and index at least one address argument'
|
|
3109
|
+
);
|
|
3110
|
+
case "solana-program":
|
|
3111
|
+
return text.refine(
|
|
3112
|
+
isSolanaProgram,
|
|
3113
|
+
'Use a Solana program address in base58, such as "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"'
|
|
3114
|
+
);
|
|
2645
3115
|
default:
|
|
2646
3116
|
return text;
|
|
2647
3117
|
}
|
|
@@ -2666,17 +3136,17 @@ function parseSettings(fields2, input) {
|
|
|
2666
3136
|
shape[key] = textSettingSchema(field).default(field.default);
|
|
2667
3137
|
break;
|
|
2668
3138
|
case "integer":
|
|
2669
|
-
shape[key] =
|
|
3139
|
+
shape[key] = z25.number().int().min(field.min).max(field.max).default(field.default);
|
|
2670
3140
|
break;
|
|
2671
3141
|
case "boolean":
|
|
2672
|
-
shape[key] =
|
|
3142
|
+
shape[key] = z25.boolean().default(field.default);
|
|
2673
3143
|
break;
|
|
2674
3144
|
case "choice":
|
|
2675
|
-
shape[key] =
|
|
3145
|
+
shape[key] = z25.enum(field.options).default(field.default);
|
|
2676
3146
|
break;
|
|
2677
3147
|
}
|
|
2678
3148
|
}
|
|
2679
|
-
return settingsValuesSchema.parse(
|
|
3149
|
+
return settingsValuesSchema.parse(z25.object(shape).strict().parse(input));
|
|
2680
3150
|
}
|
|
2681
3151
|
function missingResourceSettings(fields2, values2) {
|
|
2682
3152
|
return Object.entries(fields2).filter(
|
|
@@ -2697,21 +3167,21 @@ function authoringKey(input) {
|
|
|
2697
3167
|
}
|
|
2698
3168
|
|
|
2699
3169
|
// src/campaigns.ts
|
|
2700
|
-
import * as
|
|
2701
|
-
var timestamp4 =
|
|
2702
|
-
var availabilityWindowSchema =
|
|
3170
|
+
import * as z26 from "zod";
|
|
3171
|
+
var timestamp4 = z26.number().int().safe().nonnegative();
|
|
3172
|
+
var availabilityWindowSchema = z26.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
|
|
2703
3173
|
message: "Window end must follow its start",
|
|
2704
3174
|
path: ["until"]
|
|
2705
3175
|
});
|
|
2706
|
-
var campaignDefinitionSchema =
|
|
3176
|
+
var campaignDefinitionSchema = z26.object({
|
|
2707
3177
|
key: identifier,
|
|
2708
|
-
title:
|
|
3178
|
+
title: z26.string().trim().min(1).max(120),
|
|
2709
3179
|
window: availabilityWindowSchema.optional(),
|
|
2710
|
-
enrollment:
|
|
3180
|
+
enrollment: z26.enum(["none", "required"]).default("none")
|
|
2711
3181
|
}).strict();
|
|
2712
3182
|
var campaignAuthoringSchema = campaignDefinitionSchema.omit({ key: true, title: true }).extend({
|
|
2713
3183
|
...authoringIdentityShape,
|
|
2714
|
-
title:
|
|
3184
|
+
title: z26.string().trim().min(1).max(120).optional()
|
|
2715
3185
|
}).strict().transform((value) => {
|
|
2716
3186
|
const normalized = value;
|
|
2717
3187
|
return campaignDefinitionSchema.parse({
|
|
@@ -2725,42 +3195,42 @@ function defineCampaign(input) {
|
|
|
2725
3195
|
var campaignViewSchema = campaignDefinitionSchema.extend({
|
|
2726
3196
|
enrolledAt: timestamp4.nullable(),
|
|
2727
3197
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
2728
|
-
withdrawalReason:
|
|
3198
|
+
withdrawalReason: z26.string().nullable().default(null)
|
|
2729
3199
|
});
|
|
2730
|
-
var campaignEnrollmentInputSchema =
|
|
3200
|
+
var campaignEnrollmentInputSchema = z26.object({ actionId: identifier, campaign: identifier }).strict();
|
|
2731
3201
|
var memberCampaignEnrollmentInputSchema = campaignEnrollmentInputSchema.extend({ member: identifier });
|
|
2732
3202
|
var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
|
|
2733
3203
|
var memberCampaignWithdrawalInputSchema = campaignWithdrawalInputSchema.extend({
|
|
2734
3204
|
member: identifier,
|
|
2735
|
-
reason:
|
|
3205
|
+
reason: z26.string().trim().min(1).max(500)
|
|
2736
3206
|
});
|
|
2737
|
-
var campaignEnrollmentSchema =
|
|
3207
|
+
var campaignEnrollmentSchema = z26.object({
|
|
2738
3208
|
campaign: identifier,
|
|
2739
3209
|
member: identifier,
|
|
2740
3210
|
enrolledAt: timestamp4,
|
|
2741
3211
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
2742
|
-
withdrawalReason:
|
|
3212
|
+
withdrawalReason: z26.string().nullable().default(null)
|
|
2743
3213
|
});
|
|
2744
3214
|
|
|
2745
3215
|
// src/resource-handle.ts
|
|
2746
|
-
import * as
|
|
3216
|
+
import * as z27 from "zod";
|
|
2747
3217
|
function resourceHandle(_kind, definition) {
|
|
2748
3218
|
return definition;
|
|
2749
3219
|
}
|
|
2750
|
-
var ledgerSettingSchema = identifier.or(
|
|
3220
|
+
var ledgerSettingSchema = identifier.or(z27.literal("")).brand();
|
|
2751
3221
|
function ledgerKey(ledger) {
|
|
2752
3222
|
return typeof ledger === "string" ? ledger : ledger.key;
|
|
2753
3223
|
}
|
|
2754
3224
|
|
|
2755
3225
|
// src/groups.ts
|
|
2756
|
-
import * as
|
|
2757
|
-
var projectGroupSchema =
|
|
3226
|
+
import * as z28 from "zod";
|
|
3227
|
+
var projectGroupSchema = z28.object({
|
|
2758
3228
|
key: identifier,
|
|
2759
|
-
title:
|
|
3229
|
+
title: z28.string().trim().min(1).max(120)
|
|
2760
3230
|
}).strict();
|
|
2761
3231
|
var projectGroupAuthoringSchema = projectGroupSchema.omit({ key: true, title: true }).extend({
|
|
2762
3232
|
...authoringIdentityShape,
|
|
2763
|
-
title:
|
|
3233
|
+
title: z28.string().trim().min(1).max(120).optional()
|
|
2764
3234
|
}).strict().transform((value) => {
|
|
2765
3235
|
return projectGroupSchema.parse({
|
|
2766
3236
|
...value,
|
|
@@ -2773,92 +3243,93 @@ function defineGroup(input) {
|
|
|
2773
3243
|
function projectGroupKey(group) {
|
|
2774
3244
|
return identifier.parse(group.key);
|
|
2775
3245
|
}
|
|
2776
|
-
var groupTitle =
|
|
2777
|
-
var reason =
|
|
2778
|
-
var timestamp5 =
|
|
2779
|
-
var createGroupSchema =
|
|
2780
|
-
var updateGroupSchema =
|
|
2781
|
-
var addGroupMemberSchema =
|
|
2782
|
-
var removeGroupMemberSchema =
|
|
2783
|
-
var
|
|
3246
|
+
var groupTitle = z28.string().trim().min(1).max(120);
|
|
3247
|
+
var reason = z28.string().trim().min(1).max(1e3);
|
|
3248
|
+
var timestamp5 = z28.number().int().nonnegative().max(864e13);
|
|
3249
|
+
var createGroupSchema = z28.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
|
|
3250
|
+
var updateGroupSchema = z28.object({ title: groupTitle }).strict();
|
|
3251
|
+
var addGroupMemberSchema = z28.object({ actionId: identifier, member: identifier, reason }).strict();
|
|
3252
|
+
var removeGroupMemberSchema = z28.object({ actionId: identifier, reason }).strict();
|
|
3253
|
+
var groupArchiveInputSchema = z28.object({ reason: lifecycleReasonSchema.optional() }).strict();
|
|
3254
|
+
var groupPageQuerySchema = z28.strictObject({
|
|
2784
3255
|
cursor: pageCursorSchema.optional(),
|
|
2785
3256
|
/** Items per page, 1–100; the default is 50. */
|
|
2786
|
-
limit:
|
|
3257
|
+
limit: z28.number().int().min(1).max(100).optional()
|
|
2787
3258
|
});
|
|
2788
|
-
var managedGroupSchema =
|
|
3259
|
+
var managedGroupSchema = z28.object({
|
|
2789
3260
|
key: identifier,
|
|
2790
|
-
title:
|
|
2791
|
-
members:
|
|
3261
|
+
title: z28.string(),
|
|
3262
|
+
members: z28.number().int().nonnegative(),
|
|
2792
3263
|
createdAt: timestamp5,
|
|
2793
3264
|
archivedAt: timestamp5.nullable()
|
|
2794
3265
|
});
|
|
2795
|
-
var groupPageSchema =
|
|
2796
|
-
items:
|
|
3266
|
+
var groupPageSchema = z28.object({
|
|
3267
|
+
items: z28.array(managedGroupSchema),
|
|
2797
3268
|
nextCursor: pageCursorSchema.nullable()
|
|
2798
3269
|
});
|
|
2799
|
-
var groupMemberSchema =
|
|
3270
|
+
var groupMemberSchema = z28.object({
|
|
2800
3271
|
member: identifier,
|
|
2801
3272
|
addedAt: timestamp5.nullable()
|
|
2802
3273
|
});
|
|
2803
|
-
var groupMemberPageSchema =
|
|
2804
|
-
items:
|
|
3274
|
+
var groupMemberPageSchema = z28.object({
|
|
3275
|
+
items: z28.array(groupMemberSchema),
|
|
2805
3276
|
nextCursor: pageCursorSchema.nullable()
|
|
2806
3277
|
});
|
|
2807
3278
|
|
|
2808
3279
|
// src/prerequisites.ts
|
|
2809
|
-
import * as
|
|
2810
|
-
var amount =
|
|
3280
|
+
import * as z29 from "zod";
|
|
3281
|
+
var amount = z29.number().int().safe().nonnegative();
|
|
2811
3282
|
var threshold = amount.positive();
|
|
2812
|
-
var completionPrerequisiteSchema =
|
|
2813
|
-
|
|
2814
|
-
kind:
|
|
3283
|
+
var completionPrerequisiteSchema = z29.discriminatedUnion("scope", [
|
|
3284
|
+
z29.object({
|
|
3285
|
+
kind: z29.literal("completion"),
|
|
2815
3286
|
quest: identifier,
|
|
2816
|
-
scope:
|
|
3287
|
+
scope: z29.literal("ever")
|
|
2817
3288
|
}).strict(),
|
|
2818
|
-
|
|
2819
|
-
kind:
|
|
3289
|
+
z29.object({
|
|
3290
|
+
kind: z29.literal("completion"),
|
|
2820
3291
|
quest: identifier,
|
|
2821
|
-
scope:
|
|
3292
|
+
scope: z29.literal("period"),
|
|
2822
3293
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
2823
3294
|
}).strict()
|
|
2824
3295
|
]);
|
|
2825
|
-
var balancePrerequisiteSchema =
|
|
2826
|
-
kind:
|
|
3296
|
+
var balancePrerequisiteSchema = z29.object({
|
|
3297
|
+
kind: z29.literal("balance"),
|
|
2827
3298
|
balance: identifier,
|
|
2828
3299
|
minimum: threshold
|
|
2829
3300
|
}).strict();
|
|
2830
|
-
var groupPrerequisiteSchema =
|
|
2831
|
-
var prerequisiteSchema =
|
|
3301
|
+
var groupPrerequisiteSchema = z29.object({ kind: z29.literal("group"), group: identifier, title: z29.string() }).strict();
|
|
3302
|
+
var prerequisiteSchema = z29.discriminatedUnion("kind", [
|
|
2832
3303
|
completionPrerequisiteSchema,
|
|
2833
3304
|
balancePrerequisiteSchema,
|
|
2834
3305
|
groupPrerequisiteSchema
|
|
2835
3306
|
]);
|
|
2836
|
-
var missingPrerequisiteSchema =
|
|
2837
|
-
|
|
2838
|
-
kind:
|
|
3307
|
+
var missingPrerequisiteSchema = z29.union([
|
|
3308
|
+
z29.object({
|
|
3309
|
+
kind: z29.literal("completion"),
|
|
2839
3310
|
quest: identifier,
|
|
2840
|
-
title:
|
|
2841
|
-
scope:
|
|
3311
|
+
title: z29.string(),
|
|
3312
|
+
scope: z29.literal("ever")
|
|
2842
3313
|
}),
|
|
2843
|
-
|
|
2844
|
-
kind:
|
|
3314
|
+
z29.object({
|
|
3315
|
+
kind: z29.literal("completion"),
|
|
2845
3316
|
quest: identifier,
|
|
2846
|
-
title:
|
|
2847
|
-
scope:
|
|
3317
|
+
title: z29.string(),
|
|
3318
|
+
scope: z29.literal("period"),
|
|
2848
3319
|
period: calendarPeriodSchema.exclude(["lifetime"]),
|
|
2849
|
-
resetsAt:
|
|
3320
|
+
resetsAt: z29.number().int().safe()
|
|
2850
3321
|
}),
|
|
2851
|
-
|
|
2852
|
-
kind:
|
|
3322
|
+
z29.object({
|
|
3323
|
+
kind: z29.literal("balance"),
|
|
2853
3324
|
balance: identifier,
|
|
2854
|
-
title:
|
|
3325
|
+
title: z29.string(),
|
|
2855
3326
|
minimum: threshold,
|
|
2856
3327
|
current: amount
|
|
2857
3328
|
}),
|
|
2858
|
-
|
|
2859
|
-
kind:
|
|
3329
|
+
z29.object({
|
|
3330
|
+
kind: z29.literal("group"),
|
|
2860
3331
|
group: identifier,
|
|
2861
|
-
title:
|
|
3332
|
+
title: z29.string()
|
|
2862
3333
|
})
|
|
2863
3334
|
]);
|
|
2864
3335
|
function completed(quest, options = {}) {
|
|
@@ -2889,29 +3360,29 @@ function inGroup(group) {
|
|
|
2889
3360
|
var maxPointsAmount = 2147483647;
|
|
2890
3361
|
|
|
2891
3362
|
// src/schema.ts
|
|
2892
|
-
import * as
|
|
2893
|
-
var pointsRewardSchema =
|
|
2894
|
-
kind:
|
|
3363
|
+
import * as z30 from "zod";
|
|
3364
|
+
var pointsRewardSchema = z30.object({
|
|
3365
|
+
kind: z30.literal("points").default("points"),
|
|
2895
3366
|
balance: identifier,
|
|
2896
|
-
amount:
|
|
3367
|
+
amount: z30.number().int().min(0).max(maxPointsAmount)
|
|
2897
3368
|
}).strict();
|
|
2898
|
-
var tieredRewardDefinitionSchema =
|
|
3369
|
+
var tieredRewardDefinitionSchema = z30.object({
|
|
2899
3370
|
/** An automatic achievement backed by the project badge catalog. */
|
|
2900
3371
|
badge: identifier.optional(),
|
|
2901
3372
|
/** Membership in the project group with this key, added when the reward is delivered. */
|
|
2902
3373
|
group: identifier.optional(),
|
|
2903
3374
|
id: identifier,
|
|
2904
|
-
title:
|
|
2905
|
-
tiers:
|
|
2906
|
-
|
|
3375
|
+
title: z30.string().min(1).max(120),
|
|
3376
|
+
tiers: z30.array(
|
|
3377
|
+
z30.object({ id: identifier, title: z30.string().min(1).max(120) }).strict()
|
|
2907
3378
|
).min(1).max(20).refine(
|
|
2908
3379
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
2909
3380
|
"Tier IDs must be unique"
|
|
2910
3381
|
),
|
|
2911
|
-
inventory:
|
|
2912
|
-
fulfillment:
|
|
2913
|
-
|
|
2914
|
-
|
|
3382
|
+
inventory: z30.object({ kind: z30.literal("untracked") }).strict(),
|
|
3383
|
+
fulfillment: z30.discriminatedUnion("kind", [
|
|
3384
|
+
z30.object({ kind: z30.literal("staff-handover") }).strict(),
|
|
3385
|
+
z30.object({ kind: z30.literal("automatic") }).strict()
|
|
2915
3386
|
])
|
|
2916
3387
|
}).strict().refine(
|
|
2917
3388
|
(value) => value.badge === void 0 && value.group === void 0 || value.fulfillment.kind === "automatic" && value.tiers.length === 1 && value.tiers[0].id === "awarded",
|
|
@@ -2920,12 +3391,12 @@ var tieredRewardDefinitionSchema = z28.object({
|
|
|
2920
3391
|
(value) => value.badge === void 0 || value.group === void 0,
|
|
2921
3392
|
"A reward is either a badge or a group membership"
|
|
2922
3393
|
);
|
|
2923
|
-
var tieredRewardReferenceSchema =
|
|
3394
|
+
var tieredRewardReferenceSchema = z30.object({
|
|
2924
3395
|
id: identifier,
|
|
2925
3396
|
key: identifier.nullable()
|
|
2926
3397
|
});
|
|
2927
|
-
var tierRewardSchema =
|
|
2928
|
-
kind:
|
|
3398
|
+
var tierRewardSchema = z30.object({
|
|
3399
|
+
kind: z30.literal("tier"),
|
|
2929
3400
|
reward: tieredRewardDefinitionSchema,
|
|
2930
3401
|
tier: identifier
|
|
2931
3402
|
}).strict().refine(
|
|
@@ -2937,7 +3408,7 @@ var badgeRewardSchema = tierRewardSchema.transform(
|
|
|
2937
3408
|
const badge = value.reward.badge;
|
|
2938
3409
|
if (!badge || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
2939
3410
|
context.addIssue({ code: "custom", message: "Invalid badge reward" });
|
|
2940
|
-
return
|
|
3411
|
+
return z30.NEVER;
|
|
2941
3412
|
}
|
|
2942
3413
|
return { ...value, reward: { ...value.reward, badge } };
|
|
2943
3414
|
}
|
|
@@ -2961,7 +3432,7 @@ var groupRewardSchema = tierRewardSchema.transform(
|
|
|
2961
3432
|
const group = value.reward.group;
|
|
2962
3433
|
if (!group || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
2963
3434
|
context.addIssue({ code: "custom", message: "Invalid group reward" });
|
|
2964
|
-
return
|
|
3435
|
+
return z30.NEVER;
|
|
2965
3436
|
}
|
|
2966
3437
|
return { ...value, reward: { ...value.reward, group } };
|
|
2967
3438
|
}
|
|
@@ -2981,7 +3452,7 @@ function groupReward(key, title) {
|
|
|
2981
3452
|
});
|
|
2982
3453
|
}
|
|
2983
3454
|
var integrationRewardSchema = discordRewardSchema;
|
|
2984
|
-
var rewardSchema =
|
|
3455
|
+
var rewardSchema = z30.union([
|
|
2985
3456
|
pointsRewardSchema,
|
|
2986
3457
|
tierRewardSchema,
|
|
2987
3458
|
integrationRewardSchema
|
|
@@ -2998,39 +3469,39 @@ function rewardKey(reward) {
|
|
|
2998
3469
|
}
|
|
2999
3470
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
3000
3471
|
}
|
|
3001
|
-
var triggerSchema =
|
|
3002
|
-
|
|
3003
|
-
kind:
|
|
3004
|
-
input:
|
|
3472
|
+
var triggerSchema = z30.union([
|
|
3473
|
+
z30.object({
|
|
3474
|
+
kind: z30.literal("manual"),
|
|
3475
|
+
input: z30.literal("text"),
|
|
3005
3476
|
constraints: textOptionsSchema,
|
|
3006
|
-
actor:
|
|
3477
|
+
actor: z30.enum(["member", "staff"]).optional()
|
|
3007
3478
|
}).strict(),
|
|
3008
|
-
|
|
3009
|
-
kind:
|
|
3010
|
-
input:
|
|
3479
|
+
z30.object({
|
|
3480
|
+
kind: z30.literal("manual"),
|
|
3481
|
+
input: z30.literal("url"),
|
|
3011
3482
|
constraints: urlOptionsSchema,
|
|
3012
|
-
actor:
|
|
3483
|
+
actor: z30.enum(["member", "staff"]).optional()
|
|
3013
3484
|
}).strict(),
|
|
3014
|
-
|
|
3015
|
-
kind:
|
|
3016
|
-
input:
|
|
3017
|
-
actor:
|
|
3485
|
+
z30.object({
|
|
3486
|
+
kind: z30.literal("manual"),
|
|
3487
|
+
input: z30.enum(["photo", "quiz", "none"]),
|
|
3488
|
+
actor: z30.enum(["member", "staff"]).optional()
|
|
3018
3489
|
}).strict(),
|
|
3019
|
-
|
|
3020
|
-
kind:
|
|
3490
|
+
z30.object({
|
|
3491
|
+
kind: z30.literal("automatic"),
|
|
3021
3492
|
tracker: trackerTriggerPolicySchema.optional()
|
|
3022
3493
|
}).strict()
|
|
3023
3494
|
]);
|
|
3024
|
-
var triggerResponseSchema =
|
|
3495
|
+
var triggerResponseSchema = z30.union(
|
|
3025
3496
|
triggerSchema.options.map((option) => option.strip())
|
|
3026
3497
|
);
|
|
3027
|
-
var photoResultSchema =
|
|
3028
|
-
kind:
|
|
3029
|
-
reason:
|
|
3498
|
+
var photoResultSchema = z30.object({
|
|
3499
|
+
kind: z30.enum(["pass", "fail", "unclear"]),
|
|
3500
|
+
reason: z30.string().min(1).max(2e3)
|
|
3030
3501
|
}).strict();
|
|
3031
|
-
var textReviewInputSchema =
|
|
3032
|
-
text:
|
|
3033
|
-
criteria:
|
|
3502
|
+
var textReviewInputSchema = z30.object({
|
|
3503
|
+
text: z30.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
3504
|
+
criteria: z30.string().trim().min(1).max(2e3)
|
|
3034
3505
|
}).strict();
|
|
3035
3506
|
var textResultSchema = photoResultSchema;
|
|
3036
3507
|
var deferPolicy = {
|
|
@@ -3044,31 +3515,31 @@ var retryCooldownPolicy = {
|
|
|
3044
3515
|
minMs: 1e3,
|
|
3045
3516
|
maxMs: 6048e5
|
|
3046
3517
|
};
|
|
3047
|
-
var retryCooldownMsSchema =
|
|
3048
|
-
var evaluatorProgressSchema =
|
|
3049
|
-
current:
|
|
3050
|
-
target:
|
|
3051
|
-
reason:
|
|
3518
|
+
var retryCooldownMsSchema = z30.number().int().min(retryCooldownPolicy.minMs).max(retryCooldownPolicy.maxMs);
|
|
3519
|
+
var evaluatorProgressSchema = z30.object({
|
|
3520
|
+
current: z30.number().finite().nonnegative(),
|
|
3521
|
+
target: z30.number().finite().positive(),
|
|
3522
|
+
reason: z30.string().min(1).max(2e3)
|
|
3052
3523
|
}).refine((value) => value.current <= value.target, {
|
|
3053
3524
|
message: "Progress current must not exceed target"
|
|
3054
3525
|
});
|
|
3055
|
-
var decisionSchema =
|
|
3056
|
-
|
|
3057
|
-
kind:
|
|
3058
|
-
reason:
|
|
3059
|
-
retryAfterMs:
|
|
3526
|
+
var decisionSchema = z30.discriminatedUnion("kind", [
|
|
3527
|
+
z30.strictObject({
|
|
3528
|
+
kind: z30.literal("defer"),
|
|
3529
|
+
reason: z30.string().min(1).max(2e3),
|
|
3530
|
+
retryAfterMs: z30.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
|
|
3060
3531
|
/** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
|
|
3061
|
-
until:
|
|
3532
|
+
until: z30.number().int().safe().nonnegative().optional()
|
|
3062
3533
|
}),
|
|
3063
|
-
evaluatorProgressSchema.safeExtend({ kind:
|
|
3064
|
-
|
|
3065
|
-
kind:
|
|
3066
|
-
rewards:
|
|
3534
|
+
evaluatorProgressSchema.safeExtend({ kind: z30.literal("progress") }).strict(),
|
|
3535
|
+
z30.object({
|
|
3536
|
+
kind: z30.literal("accept"),
|
|
3537
|
+
rewards: z30.array(rewardSchema).max(10),
|
|
3067
3538
|
completionKey: completionKeySchema.optional()
|
|
3068
3539
|
}).strict(),
|
|
3069
|
-
|
|
3070
|
-
kind:
|
|
3071
|
-
reason:
|
|
3540
|
+
z30.object({
|
|
3541
|
+
kind: z30.literal("reject"),
|
|
3542
|
+
reason: z30.string().min(1).max(2e3),
|
|
3072
3543
|
/**
|
|
3073
3544
|
* A stable key for the rejection's cause, such as `wrong-answers`, stored as the attempt's
|
|
3074
3545
|
* `code`: lowercase letters, digits and hyphens, at most 64 characters, and none of the
|
|
@@ -3076,28 +3547,28 @@ var decisionSchema = z28.discriminatedUnion("kind", [
|
|
|
3076
3547
|
*/
|
|
3077
3548
|
code: rejectCodeSchema.optional(),
|
|
3078
3549
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
3079
|
-
requestedReview:
|
|
3550
|
+
requestedReview: z30.literal(true).optional()
|
|
3080
3551
|
}).strict(),
|
|
3081
|
-
|
|
3082
|
-
kind:
|
|
3083
|
-
reason:
|
|
3084
|
-
rewards:
|
|
3552
|
+
z30.object({
|
|
3553
|
+
kind: z30.literal("review"),
|
|
3554
|
+
reason: z30.string().min(1).max(2e3),
|
|
3555
|
+
rewards: z30.array(rewardSchema).max(10).optional(),
|
|
3085
3556
|
completionKey: completionKeySchema.optional()
|
|
3086
3557
|
}).strict()
|
|
3087
3558
|
]);
|
|
3088
|
-
var reviewModeSchema =
|
|
3089
|
-
var storedReviewModeSchema =
|
|
3559
|
+
var reviewModeSchema = z30.enum(["workers-ai"]);
|
|
3560
|
+
var storedReviewModeSchema = z30.enum([
|
|
3090
3561
|
"fixture-pass",
|
|
3091
3562
|
"fixture-fail",
|
|
3092
3563
|
"fixture-unclear",
|
|
3093
3564
|
"fixture-error",
|
|
3094
3565
|
"workers-ai"
|
|
3095
3566
|
]);
|
|
3096
|
-
var rewardBundleSchema =
|
|
3567
|
+
var rewardBundleSchema = z30.array(rewardSchema).max(10).refine(
|
|
3097
3568
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
3098
3569
|
"Use one entry per balance or shared reward"
|
|
3099
3570
|
);
|
|
3100
|
-
var mediaUrlSchema =
|
|
3571
|
+
var mediaUrlSchema = z30.string().max(2e3).refine((value) => {
|
|
3101
3572
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
3102
3573
|
return true;
|
|
3103
3574
|
}
|
|
@@ -3107,67 +3578,67 @@ var mediaUrlSchema = z28.string().max(2e3).refine((value) => {
|
|
|
3107
3578
|
return false;
|
|
3108
3579
|
}
|
|
3109
3580
|
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
3110
|
-
var questStepActionSchema =
|
|
3111
|
-
|
|
3112
|
-
kind:
|
|
3581
|
+
var questStepActionSchema = z30.discriminatedUnion("kind", [
|
|
3582
|
+
z30.object({
|
|
3583
|
+
kind: z30.literal("link"),
|
|
3113
3584
|
url: mediaUrlSchema.refine(
|
|
3114
3585
|
(value) => value.startsWith("https://"),
|
|
3115
3586
|
"Use an HTTPS URL"
|
|
3116
3587
|
),
|
|
3117
|
-
label:
|
|
3588
|
+
label: z30.string().trim().min(1).max(120)
|
|
3118
3589
|
}).strict()
|
|
3119
3590
|
]);
|
|
3120
|
-
var questStepSchema =
|
|
3121
|
-
title:
|
|
3122
|
-
description:
|
|
3591
|
+
var questStepSchema = z30.object({
|
|
3592
|
+
title: z30.string().trim().min(1).max(120),
|
|
3593
|
+
description: z30.string().max(4e3).optional(),
|
|
3123
3594
|
action: questStepActionSchema.optional()
|
|
3124
3595
|
}).strict();
|
|
3125
|
-
var questPresentationRequirementSchema =
|
|
3126
|
-
|
|
3127
|
-
|
|
3596
|
+
var questPresentationRequirementSchema = z30.discriminatedUnion("kind", [
|
|
3597
|
+
z30.object({ kind: z30.literal("account"), provider: authProviderSchema }).strict(),
|
|
3598
|
+
z30.object({ kind: z30.literal("wallet"), chain: walletChainSchema.optional() }).strict()
|
|
3128
3599
|
]);
|
|
3129
|
-
var questPresentationContentSchema =
|
|
3130
|
-
steps:
|
|
3600
|
+
var questPresentationContentSchema = z30.object({
|
|
3601
|
+
steps: z30.array(questStepSchema).max(30).optional(),
|
|
3131
3602
|
image: mediaUrlSchema.optional(),
|
|
3132
|
-
imageAlt:
|
|
3133
|
-
requirements:
|
|
3603
|
+
imageAlt: z30.string().max(500).optional(),
|
|
3604
|
+
requirements: z30.array(questPresentationRequirementSchema).max(10).optional()
|
|
3134
3605
|
}).strict();
|
|
3135
3606
|
var questPresentationSchema = questPresentationContentSchema.extend({
|
|
3136
3607
|
quiz: quizQuestionsSchema.optional(),
|
|
3137
|
-
instructions:
|
|
3138
|
-
video:
|
|
3608
|
+
instructions: z30.string().max(4e3).optional(),
|
|
3609
|
+
video: z30.object({
|
|
3139
3610
|
url: mediaUrlSchema,
|
|
3140
3611
|
poster: mediaUrlSchema.optional(),
|
|
3141
|
-
captions:
|
|
3612
|
+
captions: z30.object({
|
|
3142
3613
|
url: mediaUrlSchema,
|
|
3143
|
-
language:
|
|
3144
|
-
label:
|
|
3614
|
+
language: z30.string().min(2).max(20),
|
|
3615
|
+
label: z30.string().min(1).max(80)
|
|
3145
3616
|
}).strict().optional()
|
|
3146
3617
|
}).strict().optional()
|
|
3147
3618
|
}).strict();
|
|
3148
|
-
var questProfileSchema =
|
|
3619
|
+
var questProfileSchema = z30.object({ visible: z30.boolean() }).strict();
|
|
3149
3620
|
var evaluatorProtocol = 2;
|
|
3150
|
-
var evaluatorProtocolSchema =
|
|
3151
|
-
var questDescriptionSchema =
|
|
3621
|
+
var evaluatorProtocolSchema = z30.literal(evaluatorProtocol);
|
|
3622
|
+
var questDescriptionSchema = z30.object({
|
|
3152
3623
|
quest: identifier,
|
|
3153
3624
|
evaluatorProtocol: evaluatorProtocolSchema,
|
|
3154
|
-
title:
|
|
3625
|
+
title: z30.string().min(1).max(120),
|
|
3155
3626
|
presentation: questPresentationSchema.default({}),
|
|
3156
|
-
integrations:
|
|
3627
|
+
integrations: z30.array(evaluatorIntegrationProviderSchema).max(10).default([]),
|
|
3157
3628
|
fields: settingsFieldsSchema,
|
|
3158
3629
|
values: settingsValuesSchema,
|
|
3159
3630
|
rewards: rewardBundleSchema,
|
|
3160
|
-
humanReview:
|
|
3631
|
+
humanReview: z30.boolean(),
|
|
3161
3632
|
trigger: triggerSchema,
|
|
3162
3633
|
performance: contentPerformancePolicySchema.optional(),
|
|
3163
|
-
requires:
|
|
3634
|
+
requires: z30.array(prerequisiteSchema).max(30).default([]),
|
|
3164
3635
|
campaign: campaignDefinitionSchema.optional(),
|
|
3165
3636
|
availability: availabilityWindowSchema.optional(),
|
|
3166
|
-
completion:
|
|
3167
|
-
visibility:
|
|
3637
|
+
completion: z30.preprocess(refuseStreakTimeZone, completionPolicySchema),
|
|
3638
|
+
visibility: z30.enum(["visible", "hidden"]).default("visible"),
|
|
3168
3639
|
/** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
|
|
3169
3640
|
profile: questProfileSchema.default({ visible: false }),
|
|
3170
|
-
budgets:
|
|
3641
|
+
budgets: z30.array(budgetSchema).max(20).default([]),
|
|
3171
3642
|
/**
|
|
3172
3643
|
* Milliseconds a member waits after an attempt is rejected (by the evaluator or a reviewer)
|
|
3173
3644
|
* before submitting this quest again. Only for quests members submit. Omitted: no cooldown.
|
|
@@ -3180,25 +3651,31 @@ var questDescriptionSchema = z28.object({
|
|
|
3180
3651
|
*/
|
|
3181
3652
|
completionCooldownMs: retryCooldownMsSchema.optional()
|
|
3182
3653
|
}).strict();
|
|
3183
|
-
var artifactSchema =
|
|
3654
|
+
var artifactSchema = z30.object({ code: z30.string().min(1).max(1e6) }).strict();
|
|
3184
3655
|
var releaseSchema = artifactSchema.extend({
|
|
3185
3656
|
/** The SDK runtime the code imports. Absent, the code bundles its own SDK. */
|
|
3186
3657
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
3187
3658
|
settings: settingsValuesSchema,
|
|
3188
3659
|
provider: reviewModeSchema,
|
|
3189
3660
|
expectedRelease: identifier.nullable().optional(),
|
|
3190
|
-
settingRenames:
|
|
3661
|
+
settingRenames: z30.record(z30.string(), z30.string()).optional()
|
|
3191
3662
|
}).strict();
|
|
3192
|
-
var batchReleaseSchema =
|
|
3193
|
-
releases:
|
|
3663
|
+
var batchReleaseSchema = z30.object({
|
|
3664
|
+
releases: z30.array(releaseSchema).min(1).max(questScaleLimits.quests)
|
|
3194
3665
|
}).strict();
|
|
3195
|
-
var questSettingsInputSchema =
|
|
3666
|
+
var questSettingsInputSchema = z30.object({
|
|
3196
3667
|
quest: identifier,
|
|
3197
3668
|
expectedRelease: identifier,
|
|
3198
3669
|
set: settingsValuesSchema,
|
|
3199
|
-
reset:
|
|
3670
|
+
reset: z30.array(z30.string()),
|
|
3200
3671
|
/** Replace the editable presentation fields; null restores the code defaults. */
|
|
3201
|
-
presentation: questPresentationContentSchema.nullable().optional()
|
|
3672
|
+
presentation: questPresentationContentSchema.nullable().optional(),
|
|
3673
|
+
/**
|
|
3674
|
+
* Anchor IDLs to paste, by `settings.solanaProgram()` setting key, for programs that publish
|
|
3675
|
+
* none on chain; null removes a pasted one. An IDL the program publishes on chain takes
|
|
3676
|
+
* precedence.
|
|
3677
|
+
*/
|
|
3678
|
+
solanaIdls: z30.record(z30.string(), anchorIdlSchema.nullable()).optional()
|
|
3202
3679
|
}).strict();
|
|
3203
3680
|
var storedQuestDescriptionSchema = questDescriptionSchema.extend({
|
|
3204
3681
|
completion: completionPolicySchema
|
|
@@ -3206,28 +3683,34 @@ var storedQuestDescriptionSchema = questDescriptionSchema.extend({
|
|
|
3206
3683
|
var publishedReleaseSchema = responseShape(
|
|
3207
3684
|
storedQuestDescriptionSchema.extend({
|
|
3208
3685
|
key: identifier.optional(),
|
|
3209
|
-
code:
|
|
3686
|
+
code: z30.string(),
|
|
3210
3687
|
/** The SDK runtime `code` imports. Absent, the code bundles its own SDK. */
|
|
3211
3688
|
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
3212
3689
|
provider: storedReviewModeSchema,
|
|
3213
3690
|
id: identifier,
|
|
3214
|
-
createdAt:
|
|
3215
|
-
origin:
|
|
3216
|
-
lifecycle:
|
|
3217
|
-
configuration:
|
|
3691
|
+
createdAt: z30.number(),
|
|
3692
|
+
origin: z30.object({ typeVersion: identifier }).strict().optional(),
|
|
3693
|
+
lifecycle: z30.enum(["active", "paused", "archived"]).default("active"),
|
|
3694
|
+
configuration: z30.object({
|
|
3218
3695
|
defaults: settingsValuesSchema,
|
|
3219
3696
|
overrides: settingsValuesSchema,
|
|
3220
|
-
preserved:
|
|
3697
|
+
preserved: z30.array(z30.string()),
|
|
3221
3698
|
presentation: questPresentationContentSchema.optional(),
|
|
3222
3699
|
presentationDefaults: questPresentationContentSchema.optional()
|
|
3223
|
-
}).strict().optional()
|
|
3700
|
+
}).strict().optional(),
|
|
3701
|
+
/**
|
|
3702
|
+
* The Anchor IDLs `ctx.wallet.transactions()` decodes instructions with, by
|
|
3703
|
+
* `settings.solanaProgram()` setting key. Stored when the setting is saved; a setting without
|
|
3704
|
+
* an IDL has no entry.
|
|
3705
|
+
*/
|
|
3706
|
+
solanaIdls: z30.record(z30.string(), solanaProgramIdlSchema).optional()
|
|
3224
3707
|
})
|
|
3225
3708
|
);
|
|
3226
|
-
var templateSchema =
|
|
3227
|
-
code:
|
|
3709
|
+
var templateSchema = z30.object({
|
|
3710
|
+
code: z30.string(),
|
|
3228
3711
|
definition: questDescriptionSchema
|
|
3229
3712
|
});
|
|
3230
|
-
var quizAnswersSchema =
|
|
3713
|
+
var quizAnswersSchema = z30.record(identifier, identifier).refine(
|
|
3231
3714
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
3232
3715
|
"Provide between 1 and 50 answers"
|
|
3233
3716
|
).transform(
|
|
@@ -3235,17 +3718,17 @@ var quizAnswersSchema = z28.record(identifier, identifier).refine(
|
|
|
3235
3718
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
3236
3719
|
)
|
|
3237
3720
|
);
|
|
3238
|
-
var quizEvidenceSchema =
|
|
3239
|
-
kind:
|
|
3721
|
+
var quizEvidenceSchema = z30.object({
|
|
3722
|
+
kind: z30.literal("quiz"),
|
|
3240
3723
|
release: identifier.optional(),
|
|
3241
3724
|
answers: quizAnswersSchema
|
|
3242
3725
|
}).strict();
|
|
3243
|
-
var submissionEvidenceSchema =
|
|
3726
|
+
var submissionEvidenceSchema = z30.union([
|
|
3244
3727
|
quizEvidenceSchema,
|
|
3245
3728
|
textEvidenceSchema,
|
|
3246
3729
|
urlEvidenceSchema
|
|
3247
3730
|
]);
|
|
3248
|
-
var submitSchema =
|
|
3731
|
+
var submitSchema = z30.object({
|
|
3249
3732
|
actionId: identifier,
|
|
3250
3733
|
quest: identifier,
|
|
3251
3734
|
member: identifier,
|
|
@@ -3253,7 +3736,7 @@ var submitSchema = z28.object({
|
|
|
3253
3736
|
input: submissionEvidenceSchema.optional(),
|
|
3254
3737
|
release: identifier.optional(),
|
|
3255
3738
|
/** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
|
|
3256
|
-
faultAfterReview:
|
|
3739
|
+
faultAfterReview: z30.boolean().optional()
|
|
3257
3740
|
}).strict();
|
|
3258
3741
|
var AttemptStatus = {
|
|
3259
3742
|
Queued: "queued",
|
|
@@ -3265,8 +3748,8 @@ var AttemptStatus = {
|
|
|
3265
3748
|
NeedsReview: "needs-review",
|
|
3266
3749
|
Failed: "failed"
|
|
3267
3750
|
};
|
|
3268
|
-
var attemptStatusSchema =
|
|
3269
|
-
var attemptSchema =
|
|
3751
|
+
var attemptStatusSchema = z30.string();
|
|
3752
|
+
var attemptSchema = z30.object({
|
|
3270
3753
|
id: identifier,
|
|
3271
3754
|
release: identifier,
|
|
3272
3755
|
quest: identifier,
|
|
@@ -3274,29 +3757,29 @@ var attemptSchema = z28.object({
|
|
|
3274
3757
|
evidence: identifier.nullable(),
|
|
3275
3758
|
input: submissionEvidenceSchema.optional(),
|
|
3276
3759
|
status: attemptStatusSchema,
|
|
3277
|
-
reason:
|
|
3278
|
-
retries:
|
|
3279
|
-
generation:
|
|
3280
|
-
completion:
|
|
3760
|
+
reason: z30.string().nullable(),
|
|
3761
|
+
retries: z30.number(),
|
|
3762
|
+
generation: z30.number(),
|
|
3763
|
+
completion: z30.string().nullable(),
|
|
3281
3764
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
3282
3765
|
/** Scheduled reruns advance this number; failure retries preserve it. */
|
|
3283
|
-
evaluationRun:
|
|
3284
|
-
deferCount:
|
|
3285
|
-
deferUntil:
|
|
3286
|
-
nextEvaluationAt:
|
|
3766
|
+
evaluationRun: z30.number().int().nonnegative().default(0),
|
|
3767
|
+
deferCount: z30.number().int().nonnegative().default(0),
|
|
3768
|
+
deferUntil: z30.number().int().safe().nullable().default(null),
|
|
3769
|
+
nextEvaluationAt: z30.number().int().safe().nullable().default(null),
|
|
3287
3770
|
/**
|
|
3288
3771
|
* Open code: consumers must tolerate new values. Relay writes its own codes, such as
|
|
3289
3772
|
* `budget-exhausted`; an attempt the evaluator rejected with `decision.reject({ reason, code })`
|
|
3290
3773
|
* carries the evaluator's code in management reads, and null in responses to members.
|
|
3291
3774
|
*/
|
|
3292
|
-
code:
|
|
3775
|
+
code: z30.string().nullable().default(null),
|
|
3293
3776
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
3294
3777
|
/**
|
|
3295
3778
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
3296
3779
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
3297
3780
|
*/
|
|
3298
|
-
requestedReview:
|
|
3299
|
-
createdAt:
|
|
3781
|
+
requestedReview: z30.boolean().default(false),
|
|
3782
|
+
createdAt: z30.number()
|
|
3300
3783
|
});
|
|
3301
3784
|
var QuestSubmissionStatus = {
|
|
3302
3785
|
Open: "open",
|
|
@@ -3304,9 +3787,9 @@ var QuestSubmissionStatus = {
|
|
|
3304
3787
|
Discarded: "discarded",
|
|
3305
3788
|
Expired: "expired"
|
|
3306
3789
|
};
|
|
3307
|
-
var questSubmissionStatusSchema =
|
|
3790
|
+
var questSubmissionStatusSchema = z30.string();
|
|
3308
3791
|
var questSubmissionSchema = responseShape(
|
|
3309
|
-
|
|
3792
|
+
z30.object({
|
|
3310
3793
|
id: identifier,
|
|
3311
3794
|
quest: identifier,
|
|
3312
3795
|
member: identifier,
|
|
@@ -3316,85 +3799,85 @@ var questSubmissionSchema = responseShape(
|
|
|
3316
3799
|
/** An uploaded photo's evidence ID. */
|
|
3317
3800
|
evidence: identifier.nullable(),
|
|
3318
3801
|
/** Submitting was refused because the quest changed: review the draft before submitting again. */
|
|
3319
|
-
reviewRequired:
|
|
3802
|
+
reviewRequired: z30.boolean(),
|
|
3320
3803
|
status: questSubmissionStatusSchema,
|
|
3321
3804
|
/** The attempt a `submitted` submission admitted. */
|
|
3322
3805
|
attempt: identifier.nullable(),
|
|
3323
|
-
createdAt:
|
|
3324
|
-
updatedAt:
|
|
3806
|
+
createdAt: z30.number(),
|
|
3807
|
+
updatedAt: z30.number(),
|
|
3325
3808
|
/** When an open submission expires unless it changes again. */
|
|
3326
|
-
expiresAt:
|
|
3809
|
+
expiresAt: z30.number()
|
|
3327
3810
|
})
|
|
3328
3811
|
);
|
|
3329
|
-
var questSubmissionUpdateSchema =
|
|
3812
|
+
var questSubmissionUpdateSchema = z30.object({
|
|
3330
3813
|
release: identifier.nullable().optional(),
|
|
3331
3814
|
input: submissionEvidenceSchema.nullable().optional(),
|
|
3332
3815
|
evidence: identifier.nullable().optional()
|
|
3333
3816
|
}).strict();
|
|
3334
3817
|
var questSubmissionResultSchema = responseShape(
|
|
3335
|
-
|
|
3818
|
+
z30.object({
|
|
3336
3819
|
submission: questSubmissionSchema,
|
|
3337
3820
|
attempt: attemptSchema,
|
|
3338
|
-
replayed:
|
|
3821
|
+
replayed: z30.boolean()
|
|
3339
3822
|
})
|
|
3340
3823
|
);
|
|
3341
|
-
var eventSchema =
|
|
3342
|
-
id:
|
|
3343
|
-
attempt:
|
|
3344
|
-
kind:
|
|
3345
|
-
detail:
|
|
3346
|
-
actor:
|
|
3347
|
-
at:
|
|
3348
|
-
});
|
|
3349
|
-
var pickupSelectionSchema =
|
|
3824
|
+
var eventSchema = z30.object({
|
|
3825
|
+
id: z30.number(),
|
|
3826
|
+
attempt: z30.string().nullable(),
|
|
3827
|
+
kind: z30.string(),
|
|
3828
|
+
detail: z30.string(),
|
|
3829
|
+
actor: z30.string().nullable().default(null),
|
|
3830
|
+
at: z30.number()
|
|
3831
|
+
});
|
|
3832
|
+
var pickupSelectionSchema = z30.object({
|
|
3350
3833
|
item: identifier,
|
|
3351
|
-
revision:
|
|
3834
|
+
revision: z30.number().int().nonnegative()
|
|
3352
3835
|
}).strict();
|
|
3353
|
-
var pickupAllocationSchema =
|
|
3836
|
+
var pickupAllocationSchema = z30.object({
|
|
3354
3837
|
item: identifier,
|
|
3355
|
-
label:
|
|
3838
|
+
label: z30.string().min(1).max(80)
|
|
3356
3839
|
}).strict();
|
|
3357
|
-
var pickupPolicySchema =
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
kind:
|
|
3361
|
-
tiers:
|
|
3362
|
-
|
|
3840
|
+
var pickupPolicySchema = z30.discriminatedUnion("kind", [
|
|
3841
|
+
z30.object({ kind: z30.literal("untracked") }).strict(),
|
|
3842
|
+
z30.object({
|
|
3843
|
+
kind: z30.literal("at-pickup"),
|
|
3844
|
+
tiers: z30.array(
|
|
3845
|
+
z30.object({
|
|
3363
3846
|
tier: identifier,
|
|
3364
|
-
variants:
|
|
3847
|
+
variants: z30.array(pickupAllocationSchema).min(1).max(100)
|
|
3365
3848
|
}).strict()
|
|
3366
3849
|
).min(1).max(100)
|
|
3367
3850
|
}).strict()
|
|
3368
3851
|
]);
|
|
3369
|
-
var pickupCatalogSchema =
|
|
3852
|
+
var pickupCatalogSchema = z30.object({
|
|
3370
3853
|
reward: tieredRewardDefinitionSchema,
|
|
3371
|
-
revision:
|
|
3854
|
+
revision: z30.number().int().nonnegative(),
|
|
3372
3855
|
policy: pickupPolicySchema
|
|
3373
3856
|
});
|
|
3374
|
-
var pickupAvailabilitySchema =
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
kind:
|
|
3378
|
-
revision:
|
|
3379
|
-
variants:
|
|
3857
|
+
var pickupAvailabilitySchema = z30.discriminatedUnion("kind", [
|
|
3858
|
+
z30.object({ kind: z30.literal("untracked") }).strict(),
|
|
3859
|
+
z30.object({
|
|
3860
|
+
kind: z30.literal("at-pickup"),
|
|
3861
|
+
revision: z30.number().int().nonnegative(),
|
|
3862
|
+
variants: z30.array(
|
|
3380
3863
|
pickupAllocationSchema.extend({
|
|
3381
|
-
available:
|
|
3864
|
+
available: z30.number().int().nonnegative()
|
|
3382
3865
|
})
|
|
3383
3866
|
)
|
|
3384
3867
|
}).strict()
|
|
3385
3868
|
]);
|
|
3386
|
-
var configurePickupSchema =
|
|
3869
|
+
var configurePickupSchema = z30.object({
|
|
3387
3870
|
reward: identifier,
|
|
3388
|
-
revision:
|
|
3871
|
+
revision: z30.number().int().nonnegative(),
|
|
3389
3872
|
actionId: identifier,
|
|
3390
|
-
policy:
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
kind:
|
|
3394
|
-
tiers:
|
|
3395
|
-
|
|
3873
|
+
policy: z30.discriminatedUnion("kind", [
|
|
3874
|
+
z30.object({ kind: z30.literal("untracked") }).strict(),
|
|
3875
|
+
z30.object({
|
|
3876
|
+
kind: z30.literal("at-pickup"),
|
|
3877
|
+
tiers: z30.array(
|
|
3878
|
+
z30.object({
|
|
3396
3879
|
tier: identifier,
|
|
3397
|
-
variants:
|
|
3880
|
+
variants: z30.array(
|
|
3398
3881
|
pickupAllocationSchema.extend({
|
|
3399
3882
|
item: identifier.optional()
|
|
3400
3883
|
})
|
|
@@ -3404,10 +3887,10 @@ var configurePickupSchema = z28.object({
|
|
|
3404
3887
|
}).strict()
|
|
3405
3888
|
])
|
|
3406
3889
|
}).strict();
|
|
3407
|
-
var entitlementRecoverySchema =
|
|
3890
|
+
var entitlementRecoverySchema = z30.object({
|
|
3408
3891
|
completion: identifier,
|
|
3409
|
-
reason:
|
|
3410
|
-
flaggedAt:
|
|
3892
|
+
reason: z30.string(),
|
|
3893
|
+
flaggedAt: z30.number(),
|
|
3411
3894
|
/** Null means no accepted completion currently earns this reward. */
|
|
3412
3895
|
remainingTier: identifier.nullable()
|
|
3413
3896
|
});
|
|
@@ -3417,40 +3900,40 @@ var entitlementBase = {
|
|
|
3417
3900
|
reward: tieredRewardDefinitionSchema,
|
|
3418
3901
|
earnedTier: identifier,
|
|
3419
3902
|
tier: identifier,
|
|
3420
|
-
revision:
|
|
3903
|
+
revision: z30.number().int().positive()
|
|
3421
3904
|
};
|
|
3422
|
-
var entitlementStateSchema =
|
|
3423
|
-
|
|
3424
|
-
|
|
3905
|
+
var entitlementStateSchema = z30.discriminatedUnion("status", [
|
|
3906
|
+
z30.object({ ...entitlementBase, status: z30.literal("available") }).strict(),
|
|
3907
|
+
z30.object({
|
|
3425
3908
|
...entitlementBase,
|
|
3426
|
-
status:
|
|
3909
|
+
status: z30.literal("handing-over"),
|
|
3427
3910
|
handover: identifier,
|
|
3428
|
-
startedAt:
|
|
3911
|
+
startedAt: z30.number(),
|
|
3429
3912
|
allocation: pickupAllocationSchema.optional()
|
|
3430
3913
|
}).strict(),
|
|
3431
|
-
|
|
3914
|
+
z30.object({
|
|
3432
3915
|
...entitlementBase,
|
|
3433
|
-
status:
|
|
3916
|
+
status: z30.literal("collected"),
|
|
3434
3917
|
handover: identifier,
|
|
3435
|
-
startedAt:
|
|
3918
|
+
startedAt: z30.number(),
|
|
3436
3919
|
allocation: pickupAllocationSchema.optional(),
|
|
3437
|
-
collectedAt:
|
|
3920
|
+
collectedAt: z30.number(),
|
|
3438
3921
|
recovery: entitlementRecoverySchema.optional()
|
|
3439
3922
|
}).strict(),
|
|
3440
3923
|
// An operator voided it: it can no longer be handed over. A quest grant of the same reward to
|
|
3441
3924
|
// the member (the same grant key) makes it available again; a voided referral reward stays void.
|
|
3442
|
-
|
|
3925
|
+
z30.object({
|
|
3443
3926
|
...entitlementBase,
|
|
3444
|
-
status:
|
|
3445
|
-
voidedAt:
|
|
3927
|
+
status: z30.literal("void"),
|
|
3928
|
+
voidedAt: z30.number()
|
|
3446
3929
|
}).strict()
|
|
3447
3930
|
]);
|
|
3448
|
-
var tieredRewardReadSchema =
|
|
3931
|
+
var tieredRewardReadSchema = z30.object({
|
|
3449
3932
|
id: identifier,
|
|
3450
|
-
title:
|
|
3451
|
-
tiers:
|
|
3452
|
-
inventory:
|
|
3453
|
-
fulfillment:
|
|
3933
|
+
title: z30.string(),
|
|
3934
|
+
tiers: z30.array(z30.object({ id: identifier, title: z30.string() }).loose()),
|
|
3935
|
+
inventory: z30.object({ kind: z30.string() }).loose(),
|
|
3936
|
+
fulfillment: z30.object({ kind: z30.string() }).loose()
|
|
3454
3937
|
}).loose();
|
|
3455
3938
|
var entitlementReadBase = {
|
|
3456
3939
|
id: identifier,
|
|
@@ -3458,63 +3941,63 @@ var entitlementReadBase = {
|
|
|
3458
3941
|
reward: tieredRewardReadSchema,
|
|
3459
3942
|
earnedTier: identifier,
|
|
3460
3943
|
tier: identifier,
|
|
3461
|
-
revision:
|
|
3944
|
+
revision: z30.number().int()
|
|
3462
3945
|
};
|
|
3463
|
-
var allocationReadSchema =
|
|
3464
|
-
var entitlementSchema =
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3946
|
+
var allocationReadSchema = z30.object({ item: identifier, label: z30.string() }).loose();
|
|
3947
|
+
var entitlementSchema = z30.union([
|
|
3948
|
+
z30.discriminatedUnion("status", [
|
|
3949
|
+
z30.object({ ...entitlementReadBase, status: z30.literal("available") }).loose(),
|
|
3950
|
+
z30.object({
|
|
3468
3951
|
...entitlementReadBase,
|
|
3469
|
-
status:
|
|
3952
|
+
status: z30.literal("handing-over"),
|
|
3470
3953
|
handover: identifier,
|
|
3471
|
-
startedAt:
|
|
3954
|
+
startedAt: z30.number(),
|
|
3472
3955
|
allocation: allocationReadSchema.optional()
|
|
3473
3956
|
}).loose(),
|
|
3474
|
-
|
|
3957
|
+
z30.object({
|
|
3475
3958
|
...entitlementReadBase,
|
|
3476
|
-
status:
|
|
3959
|
+
status: z30.literal("collected"),
|
|
3477
3960
|
handover: identifier,
|
|
3478
|
-
startedAt:
|
|
3961
|
+
startedAt: z30.number(),
|
|
3479
3962
|
allocation: allocationReadSchema.optional(),
|
|
3480
|
-
collectedAt:
|
|
3963
|
+
collectedAt: z30.number(),
|
|
3481
3964
|
recovery: entitlementRecoverySchema.optional()
|
|
3482
3965
|
}).loose(),
|
|
3483
|
-
|
|
3966
|
+
z30.object({
|
|
3484
3967
|
...entitlementReadBase,
|
|
3485
|
-
status:
|
|
3486
|
-
voidedAt:
|
|
3968
|
+
status: z30.literal("void"),
|
|
3969
|
+
voidedAt: z30.number()
|
|
3487
3970
|
}).loose()
|
|
3488
3971
|
]),
|
|
3489
|
-
|
|
3972
|
+
z30.object({ ...entitlementReadBase, status: z30.string() }).loose().transform(({ status, ...entitlement }) => ({
|
|
3490
3973
|
...entitlement,
|
|
3491
3974
|
status: "unsupported",
|
|
3492
3975
|
reportedStatus: status
|
|
3493
3976
|
}))
|
|
3494
3977
|
]);
|
|
3495
|
-
var beginHandoverSchema =
|
|
3978
|
+
var beginHandoverSchema = z30.object({
|
|
3496
3979
|
actionId: identifier,
|
|
3497
|
-
revision:
|
|
3980
|
+
revision: z30.number().int().positive(),
|
|
3498
3981
|
selection: pickupSelectionSchema.optional()
|
|
3499
3982
|
}).strict();
|
|
3500
|
-
var confirmHandoverSchema =
|
|
3501
|
-
var entitlementCorrectionSchema =
|
|
3983
|
+
var confirmHandoverSchema = z30.object({ actionId: identifier, handover: identifier }).strict();
|
|
3984
|
+
var entitlementCorrectionSchema = z30.object({
|
|
3502
3985
|
actionId: identifier,
|
|
3503
|
-
revision:
|
|
3504
|
-
reason:
|
|
3986
|
+
revision: z30.number().int().positive(),
|
|
3987
|
+
reason: z30.string().trim().min(1).max(500)
|
|
3505
3988
|
}).strict();
|
|
3506
3989
|
var CompletionSourceKind = {
|
|
3507
3990
|
Quest: "quest",
|
|
3508
3991
|
Leaderboard: "leaderboard"
|
|
3509
3992
|
};
|
|
3510
|
-
var completionSourceKindSchema =
|
|
3511
|
-
var completionSourceSchema =
|
|
3993
|
+
var completionSourceKindSchema = z30.string().min(1).max(64);
|
|
3994
|
+
var completionSourceSchema = z30.object({
|
|
3512
3995
|
kind: completionSourceKindSchema,
|
|
3513
3996
|
id: identifier
|
|
3514
3997
|
});
|
|
3515
|
-
var completionRecordSchema =
|
|
3998
|
+
var completionRecordSchema = z30.object({
|
|
3516
3999
|
/** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
|
|
3517
|
-
key:
|
|
4000
|
+
key: z30.string().default("once"),
|
|
3518
4001
|
id: identifier,
|
|
3519
4002
|
/** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
|
|
3520
4003
|
quest: identifier,
|
|
@@ -3522,19 +4005,19 @@ var completionRecordSchema = z28.object({
|
|
|
3522
4005
|
/** What paid the completion. `source.id` repeats `quest`. */
|
|
3523
4006
|
source: completionSourceSchema.optional()
|
|
3524
4007
|
});
|
|
3525
|
-
var questAvailabilitySchema =
|
|
3526
|
-
|
|
3527
|
-
kind:
|
|
3528
|
-
input:
|
|
4008
|
+
var questAvailabilitySchema = z30.discriminatedUnion("kind", [
|
|
4009
|
+
z30.object({
|
|
4010
|
+
kind: z30.literal("available"),
|
|
4011
|
+
input: z30.enum(["photo", "quiz", "none", "text", "url"])
|
|
3529
4012
|
}).strict(),
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
kind:
|
|
3533
|
-
missing:
|
|
4013
|
+
z30.object({ kind: z30.literal("completed") }).strict(),
|
|
4014
|
+
z30.object({
|
|
4015
|
+
kind: z30.literal("locked"),
|
|
4016
|
+
missing: z30.array(missingPrerequisiteSchema).min(1)
|
|
3534
4017
|
}).strict(),
|
|
3535
|
-
|
|
3536
|
-
kind:
|
|
3537
|
-
reason:
|
|
4018
|
+
z30.object({
|
|
4019
|
+
kind: z30.literal("blocked"),
|
|
4020
|
+
reason: z30.enum([
|
|
3538
4021
|
"budget-exhausted",
|
|
3539
4022
|
"connection-required",
|
|
3540
4023
|
"wallet-required",
|
|
@@ -3543,56 +4026,56 @@ var questAvailabilitySchema = z28.discriminatedUnion("kind", [
|
|
|
3543
4026
|
"enrollment-required"
|
|
3544
4027
|
]),
|
|
3545
4028
|
/** Which window refused admission when `reason` is `outside-window`. */
|
|
3546
|
-
window:
|
|
3547
|
-
resetsAt:
|
|
4029
|
+
window: z30.enum(["tracker", "quest"]).optional(),
|
|
4030
|
+
resetsAt: z30.number().int().safe().optional()
|
|
3548
4031
|
}).strict(),
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
4032
|
+
z30.object({ kind: z30.literal("staff-required") }).strict(),
|
|
4033
|
+
z30.object({ kind: z30.literal("automatic") }).strict(),
|
|
4034
|
+
z30.object({ kind: z30.literal("checking"), attempt: identifier }).strict(),
|
|
4035
|
+
z30.object({ kind: z30.literal("needs-review"), attempt: identifier }).strict(),
|
|
4036
|
+
z30.object({ kind: z30.literal("retryable"), attempt: identifier }).strict()
|
|
3554
4037
|
]);
|
|
3555
|
-
var questAvailabilityResponseSchema =
|
|
4038
|
+
var questAvailabilityResponseSchema = z30.union(
|
|
3556
4039
|
questAvailabilitySchema.options.map((option) => option.strip())
|
|
3557
4040
|
);
|
|
3558
|
-
var questBudgetViewSchema =
|
|
4041
|
+
var questBudgetViewSchema = z30.object({
|
|
3559
4042
|
id: identifier,
|
|
3560
|
-
scope:
|
|
3561
|
-
period:
|
|
3562
|
-
remaining:
|
|
3563
|
-
resetsAt:
|
|
4043
|
+
scope: z30.enum(["member", "project"]),
|
|
4044
|
+
period: z30.enum(["day", "week", "month", "lifetime"]),
|
|
4045
|
+
remaining: z30.number().int().safe().nonnegative(),
|
|
4046
|
+
resetsAt: z30.number().int().safe().nullable()
|
|
3564
4047
|
});
|
|
3565
4048
|
var memberProgressSchema = responseShape(
|
|
3566
|
-
|
|
4049
|
+
z30.object({
|
|
3567
4050
|
member: identifier,
|
|
3568
|
-
quests:
|
|
3569
|
-
|
|
4051
|
+
quests: z30.array(
|
|
4052
|
+
z30.object({
|
|
3570
4053
|
quest: identifier,
|
|
3571
4054
|
key: identifier.optional(),
|
|
3572
4055
|
release: identifier.optional(),
|
|
3573
|
-
title:
|
|
4056
|
+
title: z30.string(),
|
|
3574
4057
|
presentation: questPresentationSchema.default({}),
|
|
3575
|
-
connections:
|
|
4058
|
+
connections: z30.array(authProviderSchema).default([]),
|
|
3576
4059
|
trigger: triggerResponseSchema,
|
|
3577
4060
|
availability: questAvailabilityResponseSchema,
|
|
3578
|
-
completed:
|
|
4061
|
+
completed: z30.boolean(),
|
|
3579
4062
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
3580
4063
|
streak: streakProgressSchema.nullable().optional(),
|
|
3581
4064
|
counter: counterProgressSchema.nullable().optional(),
|
|
3582
4065
|
/** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
|
|
3583
4066
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
3584
|
-
completionCount:
|
|
3585
|
-
visibility:
|
|
3586
|
-
missing:
|
|
4067
|
+
completionCount: z30.number().int().nonnegative().default(0),
|
|
4068
|
+
visibility: z30.enum(["visible", "hidden"]).default("visible"),
|
|
4069
|
+
missing: z30.array(missingPrerequisiteSchema),
|
|
3587
4070
|
campaign: campaignViewSchema.nullable().default(null),
|
|
3588
4071
|
window: availabilityWindowSchema.nullable().default(null),
|
|
3589
|
-
budgets:
|
|
4072
|
+
budgets: z30.array(questBudgetViewSchema).default([]),
|
|
3590
4073
|
/**
|
|
3591
4074
|
* Unix milliseconds when the member may submit again, while the quest's retry cooldown
|
|
3592
4075
|
* after their rejected attempt runs. Until then a new attempt is refused with
|
|
3593
4076
|
* `retry-cooldown`. Absent when no cooldown is running.
|
|
3594
4077
|
*/
|
|
3595
|
-
retryAt:
|
|
4078
|
+
retryAt: z30.number().int().safe().optional(),
|
|
3596
4079
|
/**
|
|
3597
4080
|
* Unix milliseconds when the member may next submit the quest, while it waits on something
|
|
3598
4081
|
* that ends by itself: the retry cooldown after a rejection, the completion cooldown after
|
|
@@ -3601,106 +4084,110 @@ var memberProgressSchema = responseShape(
|
|
|
3601
4084
|
* several apply; use it for countdowns. Absent when the member can submit now, or when
|
|
3602
4085
|
* nothing will reopen the quest (a used-up lifetime budget, a closed window).
|
|
3603
4086
|
*/
|
|
3604
|
-
nextAvailableAt:
|
|
4087
|
+
nextAvailableAt: z30.number().int().safe().optional(),
|
|
3605
4088
|
attempt: attemptSchema.nullable()
|
|
3606
4089
|
})
|
|
3607
4090
|
),
|
|
3608
|
-
entitlements:
|
|
4091
|
+
entitlements: z30.array(entitlementSchema)
|
|
3609
4092
|
})
|
|
3610
4093
|
);
|
|
3611
4094
|
var snapshotSchema = responseShape(
|
|
3612
|
-
|
|
3613
|
-
releases:
|
|
3614
|
-
completions:
|
|
3615
|
-
entitlements:
|
|
3616
|
-
attempts:
|
|
3617
|
-
balances:
|
|
3618
|
-
|
|
3619
|
-
member:
|
|
3620
|
-
balance:
|
|
3621
|
-
earned:
|
|
3622
|
-
held:
|
|
3623
|
-
available:
|
|
4095
|
+
z30.object({
|
|
4096
|
+
releases: z30.array(publishedReleaseSchema),
|
|
4097
|
+
completions: z30.array(completionRecordSchema),
|
|
4098
|
+
entitlements: z30.array(entitlementSchema),
|
|
4099
|
+
attempts: z30.array(attemptSchema),
|
|
4100
|
+
balances: z30.array(
|
|
4101
|
+
z30.object({
|
|
4102
|
+
member: z30.string(),
|
|
4103
|
+
balance: z30.string(),
|
|
4104
|
+
earned: z30.number(),
|
|
4105
|
+
held: z30.number(),
|
|
4106
|
+
available: z30.number()
|
|
3624
4107
|
})
|
|
3625
4108
|
),
|
|
3626
|
-
events:
|
|
4109
|
+
events: z30.array(eventSchema)
|
|
3627
4110
|
})
|
|
3628
4111
|
);
|
|
3629
|
-
var evidenceSchema =
|
|
4112
|
+
var evidenceSchema = z30.object({
|
|
3630
4113
|
id: identifier,
|
|
3631
4114
|
member: identifier,
|
|
3632
|
-
type:
|
|
3633
|
-
size:
|
|
4115
|
+
type: z30.enum(["image/jpeg", "image/png"]),
|
|
4116
|
+
size: z30.number()
|
|
3634
4117
|
});
|
|
3635
|
-
var errorSchema =
|
|
3636
|
-
error:
|
|
3637
|
-
code:
|
|
4118
|
+
var errorSchema = z30.object({
|
|
4119
|
+
error: z30.string(),
|
|
4120
|
+
code: z30.string().optional(),
|
|
3638
4121
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
3639
|
-
window:
|
|
3640
|
-
missing:
|
|
4122
|
+
window: z30.enum(["tracker", "quest"]).optional(),
|
|
4123
|
+
missing: z30.array(missingPrerequisiteSchema).optional(),
|
|
3641
4124
|
/**
|
|
3642
4125
|
* Unix milliseconds when the member may submit again, when `code` is `retry-cooldown` or
|
|
3643
4126
|
* `completion-cooldown`.
|
|
3644
4127
|
*/
|
|
3645
|
-
retryAt:
|
|
4128
|
+
retryAt: z30.number().int().safe().optional()
|
|
3646
4129
|
});
|
|
3647
|
-
var staffDecisionSchema =
|
|
4130
|
+
var staffDecisionSchema = z30.object({
|
|
3648
4131
|
actionId: identifier,
|
|
3649
|
-
generation:
|
|
3650
|
-
decision:
|
|
3651
|
-
reason:
|
|
4132
|
+
generation: z30.number().int().nonnegative(),
|
|
4133
|
+
decision: z30.enum(["accept", "reject"]),
|
|
4134
|
+
reason: z30.string().trim().min(1).max(2e3)
|
|
3652
4135
|
}).strict();
|
|
3653
|
-
var
|
|
3654
|
-
|
|
4136
|
+
var acceptAnywaySchema = z30.object({
|
|
4137
|
+
actionId: identifier,
|
|
4138
|
+
reason: z30.string().trim().min(1).max(2e3)
|
|
4139
|
+
}).strict();
|
|
4140
|
+
var stockSchema = z30.object({ item: identifier, quantity: z30.number().int().min(0).max(1e4) }).strict();
|
|
4141
|
+
var reservationSchema = z30.object({
|
|
3655
4142
|
actionId: identifier,
|
|
3656
4143
|
member: identifier,
|
|
3657
4144
|
item: identifier,
|
|
3658
4145
|
balance: identifier,
|
|
3659
|
-
price:
|
|
4146
|
+
price: z30.number().int().positive().max(1e4)
|
|
3660
4147
|
}).strict();
|
|
3661
4148
|
var pageOptions = {
|
|
3662
|
-
limit:
|
|
3663
|
-
cursor:
|
|
4149
|
+
limit: z30.number().int().min(1).max(100).default(25),
|
|
4150
|
+
cursor: z30.string().min(1).max(4096).optional()
|
|
3664
4151
|
};
|
|
3665
|
-
var reviewListSchema =
|
|
4152
|
+
var reviewListSchema = z30.object({
|
|
3666
4153
|
...pageOptions,
|
|
3667
4154
|
member: identifier.optional(),
|
|
3668
4155
|
quest: identifier.optional()
|
|
3669
4156
|
}).strict();
|
|
3670
|
-
var memberListSchema =
|
|
4157
|
+
var memberListSchema = z30.object({
|
|
3671
4158
|
...pageOptions,
|
|
3672
4159
|
prefix: identifier.optional()
|
|
3673
4160
|
}).strict();
|
|
3674
|
-
var reviewItemSchema =
|
|
4161
|
+
var reviewItemSchema = z30.object({
|
|
3675
4162
|
attempt: attemptSchema,
|
|
3676
|
-
title:
|
|
3677
|
-
checks:
|
|
3678
|
-
|
|
4163
|
+
title: z30.string(),
|
|
4164
|
+
checks: z30.array(
|
|
4165
|
+
z30.object({ criteria: z30.string(), result: photoResultSchema })
|
|
3679
4166
|
)
|
|
3680
4167
|
});
|
|
3681
|
-
var reviewPageSchema =
|
|
3682
|
-
items:
|
|
3683
|
-
nextCursor:
|
|
4168
|
+
var reviewPageSchema = z30.object({
|
|
4169
|
+
items: z30.array(reviewItemSchema).max(100),
|
|
4170
|
+
nextCursor: z30.string().nullable()
|
|
3684
4171
|
});
|
|
3685
|
-
var memberPageSchema =
|
|
3686
|
-
items:
|
|
3687
|
-
nextCursor:
|
|
4172
|
+
var memberPageSchema = z30.object({
|
|
4173
|
+
items: z30.array(z30.object({ member: identifier })).max(100),
|
|
4174
|
+
nextCursor: z30.string().nullable()
|
|
3688
4175
|
});
|
|
3689
|
-
var createStockItemSchema =
|
|
3690
|
-
var stockItemSchema =
|
|
3691
|
-
var contentPerformanceSnapshotSchema =
|
|
4176
|
+
var createStockItemSchema = z30.object({ actionId: identifier, name: z30.string().trim().min(1).max(80) }).strict();
|
|
4177
|
+
var stockItemSchema = z30.object({ id: identifier, name: z30.string() });
|
|
4178
|
+
var contentPerformanceSnapshotSchema = z30.strictObject({
|
|
3692
4179
|
contentAttempt: identifier,
|
|
3693
4180
|
observation: identifier,
|
|
3694
|
-
observedAt:
|
|
4181
|
+
observedAt: z30.number().int().safe().nonnegative(),
|
|
3695
4182
|
metrics: contentMetricsSchema,
|
|
3696
4183
|
rewards: rewardBundleSchema
|
|
3697
4184
|
});
|
|
3698
4185
|
var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
|
|
3699
|
-
content:
|
|
4186
|
+
content: z30.string().min(1).max(256)
|
|
3700
4187
|
});
|
|
3701
|
-
var contentPerformancePageSchema =
|
|
3702
|
-
current:
|
|
3703
|
-
state:
|
|
4188
|
+
var contentPerformancePageSchema = z30.strictObject({
|
|
4189
|
+
current: z30.strictObject({
|
|
4190
|
+
state: z30.enum([
|
|
3704
4191
|
"content-pending",
|
|
3705
4192
|
"content-unqualified",
|
|
3706
4193
|
"waiting",
|
|
@@ -3711,19 +4198,19 @@ var contentPerformancePageSchema = z28.strictObject({
|
|
|
3711
4198
|
"failed",
|
|
3712
4199
|
"superseded"
|
|
3713
4200
|
]),
|
|
3714
|
-
reason:
|
|
4201
|
+
reason: z30.string().nullable(),
|
|
3715
4202
|
contentAttempt: identifier,
|
|
3716
4203
|
attempt: identifier.nullable(),
|
|
3717
4204
|
reward: contentQualificationSchema.shape.reward
|
|
3718
4205
|
}),
|
|
3719
|
-
items:
|
|
3720
|
-
|
|
4206
|
+
items: z30.array(
|
|
4207
|
+
z30.strictObject({
|
|
3721
4208
|
attempt: identifier,
|
|
3722
4209
|
contentAttempt: identifier,
|
|
3723
4210
|
observation: identifier,
|
|
3724
|
-
observedAt:
|
|
4211
|
+
observedAt: z30.number(),
|
|
3725
4212
|
metrics: contentMetricsSchema,
|
|
3726
|
-
state:
|
|
4213
|
+
state: z30.enum([
|
|
3727
4214
|
"pending",
|
|
3728
4215
|
"qualified",
|
|
3729
4216
|
"unqualified",
|
|
@@ -3731,7 +4218,7 @@ var contentPerformancePageSchema = z28.strictObject({
|
|
|
3731
4218
|
"failed",
|
|
3732
4219
|
"superseded"
|
|
3733
4220
|
]),
|
|
3734
|
-
reason:
|
|
4221
|
+
reason: z30.string().nullable()
|
|
3735
4222
|
})
|
|
3736
4223
|
),
|
|
3737
4224
|
nextCursor: pageCursorSchema.nullable()
|
|
@@ -3762,6 +4249,8 @@ export {
|
|
|
3762
4249
|
discordMemberInputSchema,
|
|
3763
4250
|
discordMessageInputSchema,
|
|
3764
4251
|
discordMemberSchema,
|
|
4252
|
+
lifecycleReasonSchema,
|
|
4253
|
+
offsetDateTimeSchema,
|
|
3765
4254
|
discordMessageSchema,
|
|
3766
4255
|
discordMessagesSourceSchema,
|
|
3767
4256
|
discordReactionsSourceSchema,
|
|
@@ -3781,6 +4270,11 @@ export {
|
|
|
3781
4270
|
trackerDataPathTypes,
|
|
3782
4271
|
schemaCheckedReader,
|
|
3783
4272
|
whereSchemaIssue,
|
|
4273
|
+
telegramReactionsNamespace,
|
|
4274
|
+
telegramMessagesNamespace,
|
|
4275
|
+
youtubeShortsNamespace,
|
|
4276
|
+
tiktokVideosNamespace,
|
|
4277
|
+
walletBalancesNamespace,
|
|
3784
4278
|
xTweetSchema,
|
|
3785
4279
|
xContentBodySchema,
|
|
3786
4280
|
trackerContentQuerySchema,
|
|
@@ -3798,6 +4292,7 @@ export {
|
|
|
3798
4292
|
contentMetricNameSchema,
|
|
3799
4293
|
xContentMetrics,
|
|
3800
4294
|
customContentSchema,
|
|
4295
|
+
walletBalanceSourceSchema,
|
|
3801
4296
|
xSearchSourceSchema,
|
|
3802
4297
|
customSourceSchema,
|
|
3803
4298
|
trackerSourceSchema,
|
|
@@ -3811,8 +4306,12 @@ export {
|
|
|
3811
4306
|
trackerDefinitionResponseSchema,
|
|
3812
4307
|
publishedTrackerSchema,
|
|
3813
4308
|
trackerStatusSchema,
|
|
4309
|
+
managedTrackerSourceSchema,
|
|
4310
|
+
managedTrackerSourceKinds,
|
|
4311
|
+
managedTrackerSource,
|
|
3814
4312
|
trackerPropertiesSchema,
|
|
3815
4313
|
trackerCreateSchema,
|
|
4314
|
+
managedTrackerCreateSchema,
|
|
3816
4315
|
trackerUpdateSchema,
|
|
3817
4316
|
trackerControlSchema,
|
|
3818
4317
|
trackerAccountSchema,
|
|
@@ -3922,6 +4421,26 @@ export {
|
|
|
3922
4421
|
isEvmChainId,
|
|
3923
4422
|
evmChainIdSchema,
|
|
3924
4423
|
walletBalanceSchema,
|
|
4424
|
+
walletBalanceSampleSchema,
|
|
4425
|
+
parseNftCollection,
|
|
4426
|
+
isNftCollection,
|
|
4427
|
+
walletNftsSchema,
|
|
4428
|
+
parseContractFunction,
|
|
4429
|
+
parseContractCall,
|
|
4430
|
+
isContractCall,
|
|
4431
|
+
walletCallSchema,
|
|
4432
|
+
walletDelegationsSchema,
|
|
4433
|
+
parseContractEvent,
|
|
4434
|
+
isContractEvent,
|
|
4435
|
+
maxWalletEventLogs,
|
|
4436
|
+
maxWalletEventLookback,
|
|
4437
|
+
walletEventsSchema,
|
|
4438
|
+
isSolanaProgram,
|
|
4439
|
+
anchorIdlSchema,
|
|
4440
|
+
solanaProgramIdlSchema,
|
|
4441
|
+
maxWalletTransactions,
|
|
4442
|
+
maxWalletTransactionLookback,
|
|
4443
|
+
walletTransactionsSchema,
|
|
3925
4444
|
textOptionsSchema,
|
|
3926
4445
|
urlOptionsSchema,
|
|
3927
4446
|
textEvidenceSchema,
|
|
@@ -3969,6 +4488,7 @@ export {
|
|
|
3969
4488
|
updateGroupSchema,
|
|
3970
4489
|
addGroupMemberSchema,
|
|
3971
4490
|
removeGroupMemberSchema,
|
|
4491
|
+
groupArchiveInputSchema,
|
|
3972
4492
|
groupPageQuerySchema,
|
|
3973
4493
|
managedGroupSchema,
|
|
3974
4494
|
groupPageSchema,
|
|
@@ -4055,6 +4575,7 @@ export {
|
|
|
4055
4575
|
evidenceSchema,
|
|
4056
4576
|
errorSchema,
|
|
4057
4577
|
staffDecisionSchema,
|
|
4578
|
+
acceptAnywaySchema,
|
|
4058
4579
|
stockSchema,
|
|
4059
4580
|
reservationSchema,
|
|
4060
4581
|
reviewListSchema,
|