@domino-sdk/relay 1.39.1 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attempt-captures-CSiN1HKd.d.ts → attempt-captures-p7JPb7Xi.d.ts} +1 -1
- package/dist/authoring.d.ts +11 -11
- package/dist/authoring.js +4 -4
- package/dist/{automatic-outcomes-DDbgRubQ.d.ts → automatic-outcomes-YkGhnxsc.d.ts} +1 -1
- package/dist/avatar.d.ts +2 -2
- package/dist/browser.d.ts +9 -9
- package/dist/browser.js +10 -10
- package/dist/{chunk-JIHWQCVW.js → chunk-4XC24SUM.js} +2 -2
- package/dist/{chunk-BYX27T2S.js → chunk-HO4FZJSH.js} +2 -2
- package/dist/{chunk-VYAANO5L.js → chunk-IIKQH5L6.js} +8 -8
- package/dist/{chunk-V7KYVH3Z.js → chunk-ILH73K3H.js} +1 -1
- package/dist/{chunk-B65YJ6K4.js → chunk-J7YJHMF7.js} +1 -1
- package/dist/{chunk-X7LHRYAO.js → chunk-JISXC5ZB.js} +4 -4
- package/dist/{chunk-SBW52XXL.js → chunk-NNGGEUMQ.js} +1 -1
- package/dist/{chunk-OEO5OBY5.js → chunk-PMSCHJKX.js} +584 -533
- package/dist/{chunk-FTGW72A6.js → chunk-Q5PX3GDA.js} +1 -1
- package/dist/{chunk-XZKZJIES.js → chunk-TEPZZXDI.js} +6 -2
- package/dist/{chunk-CRX274HO.js → chunk-UOHYYB7V.js} +1 -1
- package/dist/{chunk-ZT7FPD7B.js → chunk-W5UBRNDT.js} +1 -1
- package/dist/{chunk-RW4XQN4Z.js → chunk-WSOUOG6S.js} +1 -1
- package/dist/{chunk-E4CDOF4H.js → chunk-YBMCF54E.js} +13 -7
- package/dist/{chunk-4PYFM2YF.js → chunk-YNKJMRA7.js} +1 -1
- package/dist/{chunk-YNQPFRQO.js → chunk-ZY4RI4DJ.js} +1 -1
- package/dist/{client-CxHKODc4.d.ts → client-CVG_MoXx.d.ts} +7 -7
- package/dist/{deployments-DYeuxXYg.d.ts → deployments-BWav9s6t.d.ts} +137 -1
- package/dist/{groups-DY5rZssO.d.ts → groups-CMZROR9a.d.ts} +2 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.js +9 -9
- package/dist/internal.d.ts +10 -10
- package/dist/internal.js +8 -8
- package/dist/{offers-DtYGNKdQ.d.ts → offers-Cvk4uBjo.d.ts} +2 -2
- package/dist/{pages-DR2YRvAp.d.ts → pages-BXZP4o-w.d.ts} +26 -2
- package/dist/{participant-activity-CoB2F30C.d.ts → participant-activity-iciCEs_8.d.ts} +1 -1
- package/dist/portal-proxy.js +3 -3
- package/dist/{profiles-BHuQdzsW.d.ts → profiles-Cdv4BSd_.d.ts} +1 -1
- package/dist/react/index.d.ts +14 -11
- package/dist/react/index.js +17 -10
- package/dist/{schema-Cgmj-CbC.d.ts → schema-BgjSnV9D.d.ts} +19 -1
- package/dist/schema.d.ts +58 -16
- package/dist/schema.js +19 -7
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +846 -613
- package/dist/{submission-input-BkIbBPRU.d.ts → submission-input-CD59rLYk.d.ts} +2 -2
- package/dist/{telegram-browser-laDdm730.d.ts → telegram-browser-bnRKW9KG.d.ts} +3 -3
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +5 -5
- package/dist/{transport-CkTEfXL9.d.ts → transport-xSupcGFD.d.ts} +2189 -11
- package/dist/{wallet-t7uNDg9p.d.ts → wallet-Ac7OFpOr.d.ts} +1 -1
- package/dist/{x-vVG6gZqi.d.ts → x-B_7RCkOo.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -893,26 +893,26 @@ function matches(schema, value, at, budget) {
|
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
895
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
896
|
-
const
|
|
896
|
+
const object20 = value;
|
|
897
897
|
const properties = schema.properties ?? {};
|
|
898
898
|
const required = schema.required ?? [];
|
|
899
899
|
charge(budget, required.length);
|
|
900
900
|
for (const key of required) {
|
|
901
|
-
if (!Object.hasOwn(
|
|
901
|
+
if (!Object.hasOwn(object20, key)) {
|
|
902
902
|
return issue(() => `missing required key "${clip(key, maxKeyText)}"`);
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
const literals = literalsOf(schema);
|
|
906
906
|
charge(budget, literals.length);
|
|
907
907
|
for (const [key, property] of literals) {
|
|
908
|
-
if (Object.hasOwn(
|
|
908
|
+
if (Object.hasOwn(object20, key) && object20[key] !== property.const) {
|
|
909
909
|
return {
|
|
910
910
|
at: { parent: at, key },
|
|
911
911
|
reason: () => `expected ${JSON.stringify(property.const)}`
|
|
912
912
|
};
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
const keys = Object.keys(
|
|
915
|
+
const keys = Object.keys(object20);
|
|
916
916
|
charge(budget, keys.length);
|
|
917
917
|
const names = schema.propertyNames?.enum;
|
|
918
918
|
const allowed = names && setOf(schema.propertyNames, names);
|
|
@@ -933,7 +933,7 @@ function matches(schema, value, at, budget) {
|
|
|
933
933
|
if (property && property !== true) {
|
|
934
934
|
const found = matches(
|
|
935
935
|
property,
|
|
936
|
-
|
|
936
|
+
object20[key],
|
|
937
937
|
{ parent: at, key },
|
|
938
938
|
budget
|
|
939
939
|
);
|
|
@@ -1064,7 +1064,7 @@ function schemaCheckedReader(reader) {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
const issues = trackerDataIssues(
|
|
1066
1066
|
schema,
|
|
1067
|
-
page.items.map((
|
|
1067
|
+
page.items.map((record10) => record10.data)
|
|
1068
1068
|
);
|
|
1069
1069
|
const items = page.items.filter((_, index) => !issues[index]);
|
|
1070
1070
|
return { ...page, items, excluded: page.items.length - items.length };
|
|
@@ -1426,6 +1426,11 @@ var trackerRecordSchema = z8.object({
|
|
|
1426
1426
|
removed: z8.boolean().default(false),
|
|
1427
1427
|
source: z8.string(),
|
|
1428
1428
|
firstSeenAt: timestamp,
|
|
1429
|
+
/**
|
|
1430
|
+
* True on a record an operator sent for a test member (`management.testMembers.record`), in
|
|
1431
|
+
* test only. Absent on every other record.
|
|
1432
|
+
*/
|
|
1433
|
+
synthetic: z8.literal(true).optional(),
|
|
1429
1434
|
/** Present only when includeEvidence is true; custom sources have no X evidence. */
|
|
1430
1435
|
evidence: trackerEvidenceSchema.nullable().optional()
|
|
1431
1436
|
});
|
|
@@ -2095,61 +2100,97 @@ var trackerTriggerContextSchema = z13.object({
|
|
|
2095
2100
|
enrolledAt: timestamp3.optional()
|
|
2096
2101
|
});
|
|
2097
2102
|
|
|
2098
|
-
// src/
|
|
2103
|
+
// src/sdk-runtime.ts
|
|
2099
2104
|
import * as z14 from "zod";
|
|
2100
|
-
var
|
|
2101
|
-
|
|
2105
|
+
var sdkRuntimeLimits = {
|
|
2106
|
+
modules: 200,
|
|
2107
|
+
/** Characters of module source, summed over all modules. */
|
|
2108
|
+
size: 2e6
|
|
2109
|
+
};
|
|
2110
|
+
var sha256 = z14.string().regex(/^[0-9a-f]{64}$/);
|
|
2111
|
+
var sdkRuntimeModulePathSchema = z14.string().max(200).regex(/^[a-z0-9_][a-z0-9_.-]*(\/[a-z0-9_][a-z0-9_.-]*)*\.js$/i).refine(
|
|
2112
|
+
(path) => !path.split("/").some((part) => part === "." || part === ".."),
|
|
2113
|
+
"Runtime module paths cannot contain . or .. segments"
|
|
2114
|
+
);
|
|
2115
|
+
var sdkRuntimeReferenceSchema = z14.object({
|
|
2116
|
+
digest: sha256,
|
|
2117
|
+
/** The SDK version that built the runtime, for display. The digest is what pins it. */
|
|
2118
|
+
sdkVersion: z14.string().min(1).max(64)
|
|
2119
|
+
}).strict();
|
|
2120
|
+
var sdkRuntimeModulesSchema = z14.record(sdkRuntimeModulePathSchema, z14.string().min(1)).refine((modules) => {
|
|
2121
|
+
const entries = Object.values(modules);
|
|
2122
|
+
return entries.length > 0 && entries.length <= sdkRuntimeLimits.modules && entries.reduce((sum, source) => sum + source.length, 0) <= sdkRuntimeLimits.size;
|
|
2123
|
+
}, `A runtime has 1 to ${sdkRuntimeLimits.modules} modules and at most ${sdkRuntimeLimits.size} characters of source`);
|
|
2124
|
+
var sdkRuntimeSchema = sdkRuntimeReferenceSchema.extend({
|
|
2125
|
+
zodVersion: z14.string().min(1).max(64),
|
|
2126
|
+
modules: sdkRuntimeModulesSchema
|
|
2127
|
+
}).strict();
|
|
2128
|
+
async function sdkRuntimeDigest(modules) {
|
|
2129
|
+
const canonical = JSON.stringify(
|
|
2130
|
+
Object.entries(modules).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)
|
|
2131
|
+
);
|
|
2132
|
+
const bytes = await crypto.subtle.digest(
|
|
2133
|
+
"SHA-256",
|
|
2134
|
+
new TextEncoder().encode(canonical)
|
|
2135
|
+
);
|
|
2136
|
+
return [...new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
// src/completion.ts
|
|
2140
|
+
import * as z15 from "zod";
|
|
2141
|
+
var name = z15.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
|
|
2142
|
+
var completionPolicySchema = z15.discriminatedUnion("kind", [
|
|
2102
2143
|
streakPolicySchema,
|
|
2103
2144
|
counterPolicySchema,
|
|
2104
|
-
|
|
2105
|
-
|
|
2145
|
+
z15.object({ kind: z15.literal("once") }).strict(),
|
|
2146
|
+
z15.object({ kind: z15.literal("keyed") }).strict()
|
|
2106
2147
|
]);
|
|
2107
|
-
var completionKeySchema =
|
|
2108
|
-
var budgetSchema =
|
|
2148
|
+
var completionKeySchema = z15.string().min(1).max(500);
|
|
2149
|
+
var budgetSchema = z15.object({
|
|
2109
2150
|
id: name,
|
|
2110
|
-
scope:
|
|
2151
|
+
scope: z15.enum(["member", "project"]),
|
|
2111
2152
|
/**
|
|
2112
2153
|
* The project calendar period of the attempt's eligibility time that one bucket covers:
|
|
2113
2154
|
* `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
|
|
2114
2155
|
* `"lifetime"` never resets.
|
|
2115
2156
|
*/
|
|
2116
2157
|
period: calendarPeriodSchema,
|
|
2117
|
-
limit:
|
|
2118
|
-
cost:
|
|
2119
|
-
|
|
2120
|
-
|
|
2158
|
+
limit: z15.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
2159
|
+
cost: z15.union([
|
|
2160
|
+
z15.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
2161
|
+
z15.object({ balance: name }).strict()
|
|
2121
2162
|
])
|
|
2122
2163
|
}).strict();
|
|
2123
2164
|
|
|
2124
2165
|
// src/integrations.ts
|
|
2125
|
-
import * as
|
|
2126
|
-
var evaluatorIntegrationProviderSchema =
|
|
2127
|
-
var integrationProviderSchema =
|
|
2128
|
-
var discordServerSchema =
|
|
2129
|
-
id:
|
|
2130
|
-
name:
|
|
2131
|
-
icon:
|
|
2132
|
-
});
|
|
2133
|
-
var projectIntegrationSchema =
|
|
2166
|
+
import * as z16 from "zod";
|
|
2167
|
+
var evaluatorIntegrationProviderSchema = z16.enum(["discord", "x"]);
|
|
2168
|
+
var integrationProviderSchema = z16.enum(["discord"]);
|
|
2169
|
+
var discordServerSchema = z16.object({
|
|
2170
|
+
id: z16.string().regex(/^[0-9]{1,20}$/),
|
|
2171
|
+
name: z16.string().min(1),
|
|
2172
|
+
icon: z16.string().nullable()
|
|
2173
|
+
});
|
|
2174
|
+
var projectIntegrationSchema = z16.object({
|
|
2134
2175
|
provider: integrationProviderSchema,
|
|
2135
|
-
configured:
|
|
2136
|
-
status:
|
|
2137
|
-
revision:
|
|
2176
|
+
configured: z16.boolean(),
|
|
2177
|
+
status: z16.enum(["disconnected", "ready", "attention"]),
|
|
2178
|
+
revision: z16.number().int().nonnegative(),
|
|
2138
2179
|
server: discordServerSchema.nullable(),
|
|
2139
|
-
issue:
|
|
2140
|
-
connectedAt:
|
|
2180
|
+
issue: z16.string().nullable(),
|
|
2181
|
+
connectedAt: z16.number().default(0)
|
|
2141
2182
|
});
|
|
2142
2183
|
|
|
2143
2184
|
// src/wallet.ts
|
|
2144
|
-
import * as
|
|
2145
|
-
var solanaAddressSchema =
|
|
2146
|
-
var walletChainSchema =
|
|
2185
|
+
import * as z17 from "zod";
|
|
2186
|
+
var solanaAddressSchema = z17.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
|
|
2187
|
+
var walletChainSchema = z17.enum(["solana", "eip155", "cosmos"]);
|
|
2147
2188
|
var cosmosNetworkPattern = /^cosmos:[-_a-zA-Z0-9]{1,32}$/;
|
|
2148
|
-
var cosmosNetworkSchema =
|
|
2189
|
+
var cosmosNetworkSchema = z17.custom(
|
|
2149
2190
|
(value) => typeof value === "string" && cosmosNetworkPattern.test(value),
|
|
2150
2191
|
"Use a Cosmos network: cosmos:<chain ID>"
|
|
2151
2192
|
);
|
|
2152
|
-
var cosmosDenomSchema =
|
|
2193
|
+
var cosmosDenomSchema = z17.string().regex(
|
|
2153
2194
|
/^[a-zA-Z][a-zA-Z0-9/:._-]{2,127}$/,
|
|
2154
2195
|
"Use a Cosmos bank denomination such as uatom or uosmo"
|
|
2155
2196
|
);
|
|
@@ -2175,51 +2216,51 @@ function cosmosChain(chain) {
|
|
|
2175
2216
|
return { ...value, network };
|
|
2176
2217
|
}
|
|
2177
2218
|
var solanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
2178
|
-
var evmAddressSchema =
|
|
2179
|
-
var cosmosAddressSchema =
|
|
2219
|
+
var evmAddressSchema = z17.string().regex(/^0x[0-9a-fA-F]{40}$/);
|
|
2220
|
+
var cosmosAddressSchema = z17.string().min(8).max(90).regex(
|
|
2180
2221
|
/^(?:[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,})$/
|
|
2181
2222
|
);
|
|
2182
|
-
var walletAddressInputSchema =
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
chain:
|
|
2223
|
+
var walletAddressInputSchema = z17.discriminatedUnion("chain", [
|
|
2224
|
+
z17.object({ chain: z17.literal("solana"), address: solanaAddressSchema }).strict(),
|
|
2225
|
+
z17.object({
|
|
2226
|
+
chain: z17.literal("eip155"),
|
|
2186
2227
|
address: evmAddressSchema,
|
|
2187
2228
|
/** Shown in the sign-in message's Chain ID line only: links are chain-agnostic. Defaults to 1. */
|
|
2188
|
-
chainId:
|
|
2229
|
+
chainId: z17.number().int().positive().safe().optional()
|
|
2189
2230
|
}).strict(),
|
|
2190
|
-
|
|
2191
|
-
chain:
|
|
2231
|
+
z17.object({
|
|
2232
|
+
chain: z17.literal("cosmos"),
|
|
2192
2233
|
network: cosmosNetworkSchema,
|
|
2193
2234
|
address: cosmosAddressSchema
|
|
2194
2235
|
}).strict()
|
|
2195
2236
|
]);
|
|
2196
|
-
var walletMessageChallengeSchema =
|
|
2197
|
-
id:
|
|
2198
|
-
purpose:
|
|
2237
|
+
var walletMessageChallengeSchema = z17.object({
|
|
2238
|
+
id: z17.string().min(1).max(200),
|
|
2239
|
+
purpose: z17.enum(["link", "sign-in"]),
|
|
2199
2240
|
chain: walletChainSchema,
|
|
2200
2241
|
network: cosmosNetworkSchema.nullable(),
|
|
2201
2242
|
/** Canonical (base58, EIP-55 or lowercase bech32). The signer must sign with this address. */
|
|
2202
|
-
address:
|
|
2203
|
-
message:
|
|
2204
|
-
expiresAt:
|
|
2243
|
+
address: z17.string(),
|
|
2244
|
+
message: z17.string().max(4096),
|
|
2245
|
+
expiresAt: z17.number().int()
|
|
2205
2246
|
});
|
|
2206
|
-
var walletSignatureSchema =
|
|
2207
|
-
challenge:
|
|
2247
|
+
var walletSignatureSchema = z17.object({
|
|
2248
|
+
challenge: z17.string().min(1).max(200),
|
|
2208
2249
|
/** solana: base58, 64 bytes · eip155: 0x and 130 hex digits (65 bytes) · cosmos: base64, 64 bytes (r‖s) */
|
|
2209
|
-
signature:
|
|
2250
|
+
signature: z17.string().min(1).max(256),
|
|
2210
2251
|
/** cosmos only: the base64 33-byte compressed secp256k1 key from signArbitrary's pub_key.value */
|
|
2211
|
-
publicKey:
|
|
2252
|
+
publicKey: z17.string().max(128).optional()
|
|
2212
2253
|
}).strict();
|
|
2213
|
-
var linkedWalletSchema =
|
|
2254
|
+
var linkedWalletSchema = z17.object({
|
|
2214
2255
|
chain: walletChainSchema,
|
|
2215
2256
|
network: cosmosNetworkSchema.nullable(),
|
|
2216
|
-
address:
|
|
2217
|
-
verifiedAt:
|
|
2218
|
-
revision:
|
|
2257
|
+
address: z17.string(),
|
|
2258
|
+
verifiedAt: z17.number().int().nonnegative(),
|
|
2259
|
+
revision: z17.number().int().positive(),
|
|
2219
2260
|
/** True when this wallet can sign in: it was first used through wallet sign-in. Linking never enables sign-in. */
|
|
2220
|
-
signIn:
|
|
2261
|
+
signIn: z17.boolean()
|
|
2221
2262
|
});
|
|
2222
|
-
var walletUnlinkInputSchema =
|
|
2263
|
+
var walletUnlinkInputSchema = z17.object({ chain: walletChainSchema, address: z17.string().min(1).max(100) }).strict();
|
|
2223
2264
|
async function walletAddressInput(signer) {
|
|
2224
2265
|
const address = await signer.address();
|
|
2225
2266
|
switch (signer.chain) {
|
|
@@ -2243,8 +2284,8 @@ async function walletAddressInput(signer) {
|
|
|
2243
2284
|
}
|
|
2244
2285
|
var WALLETS_PER_CHAIN = 5;
|
|
2245
2286
|
var walletSignInFamilies = ["solana", "eip155", "cosmos"];
|
|
2246
|
-
var walletSignInNetworkSchema =
|
|
2247
|
-
var walletSignInNetworksSchema =
|
|
2287
|
+
var walletSignInNetworkSchema = z17.enum(walletSignInFamilies);
|
|
2288
|
+
var walletSignInNetworksSchema = z17.array(walletSignInNetworkSchema).max(walletSignInFamilies.length).refine((values2) => new Set(values2).size === values2.length, {
|
|
2248
2289
|
message: "Duplicate wallet family"
|
|
2249
2290
|
}).transform(
|
|
2250
2291
|
(values2) => walletSignInFamilies.filter((family) => values2.includes(family))
|
|
@@ -2269,41 +2310,41 @@ function caip10(wallet, network) {
|
|
|
2269
2310
|
function isEvmChainId(value) {
|
|
2270
2311
|
return /^eip155:[1-9][0-9]{0,15}$/.test(value);
|
|
2271
2312
|
}
|
|
2272
|
-
var evmChainIdSchema =
|
|
2313
|
+
var evmChainIdSchema = z17.custom(
|
|
2273
2314
|
(value) => typeof value === "string" && isEvmChainId(value),
|
|
2274
2315
|
'Use an EVM chain ID such as "eip155:8453"'
|
|
2275
2316
|
);
|
|
2276
|
-
var units =
|
|
2317
|
+
var units = z17.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
2277
2318
|
var walletBalanceSchema = responseShape(
|
|
2278
|
-
|
|
2319
|
+
z17.object({
|
|
2279
2320
|
/** Canonical CAIP-2 ID for Solana, EVM or a supported Cosmos SDK chain. */
|
|
2280
|
-
chain:
|
|
2321
|
+
chain: z17.string(),
|
|
2281
2322
|
/** The canonical mint, EIP-55 contract or Cosmos bank denom; null for a native coin. */
|
|
2282
|
-
token:
|
|
2323
|
+
token: z17.string().nullable(),
|
|
2283
2324
|
/** Null when token metadata does not report decimals. */
|
|
2284
|
-
decimals:
|
|
2325
|
+
decimals: z17.number().int().min(0).max(255).nullable(),
|
|
2285
2326
|
/** The sum over `wallets`. */
|
|
2286
2327
|
total: units,
|
|
2287
|
-
wallets:
|
|
2288
|
-
|
|
2328
|
+
wallets: z17.array(
|
|
2329
|
+
z17.object({ address: z17.string(), amount: units }).strict()
|
|
2289
2330
|
),
|
|
2290
2331
|
/** Solana: lowest slot. EVM: approximate latest block. Cosmos: the fixed queried block. */
|
|
2291
|
-
at:
|
|
2292
|
-
observedAt:
|
|
2332
|
+
at: z17.object({ kind: z17.enum(["slot", "block"]), number: units }).strict(),
|
|
2333
|
+
observedAt: z17.number().int().nonnegative()
|
|
2293
2334
|
}).strict()
|
|
2294
2335
|
);
|
|
2295
2336
|
|
|
2296
2337
|
// src/submission-input.ts
|
|
2297
|
-
import * as
|
|
2298
|
-
var textOptionsSchema =
|
|
2299
|
-
required:
|
|
2300
|
-
minLength:
|
|
2301
|
-
maxLength:
|
|
2338
|
+
import * as z18 from "zod";
|
|
2339
|
+
var textOptionsSchema = z18.object({
|
|
2340
|
+
required: z18.boolean().default(true),
|
|
2341
|
+
minLength: z18.number().int().min(0).max(1e4).default(1),
|
|
2342
|
+
maxLength: z18.number().int().min(1).max(1e4).default(1e4)
|
|
2302
2343
|
}).strict().refine(
|
|
2303
2344
|
(v) => v.minLength <= v.maxLength,
|
|
2304
2345
|
"minLength must not exceed maxLength"
|
|
2305
2346
|
);
|
|
2306
|
-
var hostSchema =
|
|
2347
|
+
var hostSchema = z18.string().min(1).max(253).refine((host) => {
|
|
2307
2348
|
if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
|
|
2308
2349
|
return false;
|
|
2309
2350
|
}
|
|
@@ -2314,13 +2355,13 @@ var hostSchema = z17.string().min(1).max(253).refine((host) => {
|
|
|
2314
2355
|
return false;
|
|
2315
2356
|
}
|
|
2316
2357
|
}, "Use a hostname without a scheme, path, port, or wildcard");
|
|
2317
|
-
var urlOptionsSchema =
|
|
2318
|
-
required:
|
|
2319
|
-
allowedHosts:
|
|
2358
|
+
var urlOptionsSchema = z18.object({
|
|
2359
|
+
required: z18.boolean().default(true),
|
|
2360
|
+
allowedHosts: z18.array(hostSchema).min(1).max(100).optional()
|
|
2320
2361
|
}).strict();
|
|
2321
|
-
var textEvidenceSchema =
|
|
2322
|
-
var urlEvidenceSchema =
|
|
2323
|
-
var valueEvidenceSchema =
|
|
2362
|
+
var textEvidenceSchema = z18.object({ kind: z18.literal("text"), value: z18.string().max(1e4) }).strict();
|
|
2363
|
+
var urlEvidenceSchema = z18.object({ kind: z18.literal("url"), value: z18.string().max(2048) }).strict();
|
|
2364
|
+
var valueEvidenceSchema = z18.discriminatedUnion("kind", [
|
|
2324
2365
|
textEvidenceSchema,
|
|
2325
2366
|
urlEvidenceSchema
|
|
2326
2367
|
]);
|
|
@@ -2383,22 +2424,22 @@ function xPostId(value) {
|
|
|
2383
2424
|
}
|
|
2384
2425
|
|
|
2385
2426
|
// src/quiz.ts
|
|
2386
|
-
import * as
|
|
2387
|
-
var quizId =
|
|
2388
|
-
var quizChoiceSchema =
|
|
2389
|
-
var quizQuestionSchema =
|
|
2427
|
+
import * as z19 from "zod";
|
|
2428
|
+
var quizId = z19.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
|
|
2429
|
+
var quizChoiceSchema = z19.object({ id: quizId, label: z19.string().trim().min(1).max(500) }).strict();
|
|
2430
|
+
var quizQuestionSchema = z19.object({
|
|
2390
2431
|
id: quizId,
|
|
2391
|
-
prompt:
|
|
2392
|
-
choices:
|
|
2432
|
+
prompt: z19.string().trim().min(1).max(1e3),
|
|
2433
|
+
choices: z19.array(quizChoiceSchema).min(2).max(8).refine(
|
|
2393
2434
|
(choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
|
|
2394
2435
|
"Choice IDs must be unique"
|
|
2395
2436
|
)
|
|
2396
2437
|
}).strict();
|
|
2397
|
-
var quizQuestionsSchema =
|
|
2438
|
+
var quizQuestionsSchema = z19.array(quizQuestionSchema).min(1).max(20).refine(
|
|
2398
2439
|
(questions) => new Set(questions.map((question) => question.id)).size === questions.length,
|
|
2399
2440
|
"Question IDs must be unique"
|
|
2400
2441
|
);
|
|
2401
|
-
var quizContentSchema =
|
|
2442
|
+
var quizContentSchema = z19.array(
|
|
2402
2443
|
quizQuestionSchema.extend({ correct: quizId }).refine(
|
|
2403
2444
|
(question) => question.choices.some((choice) => choice.id === question.correct),
|
|
2404
2445
|
"Choose a correct answer from the available choices"
|
|
@@ -2409,99 +2450,99 @@ var quizContentSchema = z18.array(
|
|
|
2409
2450
|
);
|
|
2410
2451
|
|
|
2411
2452
|
// src/resources.ts
|
|
2412
|
-
import * as
|
|
2413
|
-
var resourceSourceSchema =
|
|
2414
|
-
|
|
2415
|
-
provider:
|
|
2416
|
-
resource:
|
|
2453
|
+
import * as z20 from "zod";
|
|
2454
|
+
var resourceSourceSchema = z20.union([
|
|
2455
|
+
z20.strictObject({
|
|
2456
|
+
provider: z20.literal("domino"),
|
|
2457
|
+
resource: z20.literal("point-ledger")
|
|
2417
2458
|
}),
|
|
2418
2459
|
discordResourceSourceSchema
|
|
2419
2460
|
]);
|
|
2420
|
-
var resourceRequestSchema =
|
|
2461
|
+
var resourceRequestSchema = z20.object({
|
|
2421
2462
|
source: resourceSourceSchema,
|
|
2422
|
-
query:
|
|
2423
|
-
cursor:
|
|
2424
|
-
ids:
|
|
2463
|
+
query: z20.string().max(100).optional(),
|
|
2464
|
+
cursor: z20.string().regex(/^\d{1,6}$/).optional(),
|
|
2465
|
+
ids: z20.array(z20.string().min(1).max(100)).max(50).optional()
|
|
2425
2466
|
}).strict();
|
|
2426
|
-
var resourceOptionsSchema =
|
|
2427
|
-
revision:
|
|
2428
|
-
options:
|
|
2429
|
-
|
|
2430
|
-
id:
|
|
2431
|
-
label:
|
|
2432
|
-
description:
|
|
2433
|
-
group:
|
|
2434
|
-
disabledReason:
|
|
2467
|
+
var resourceOptionsSchema = z20.object({
|
|
2468
|
+
revision: z20.number().int(),
|
|
2469
|
+
options: z20.array(
|
|
2470
|
+
z20.object({
|
|
2471
|
+
id: z20.string(),
|
|
2472
|
+
label: z20.string(),
|
|
2473
|
+
description: z20.string().optional(),
|
|
2474
|
+
group: z20.string().optional(),
|
|
2475
|
+
disabledReason: z20.string().optional()
|
|
2435
2476
|
})
|
|
2436
2477
|
),
|
|
2437
2478
|
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
2438
|
-
nextCursor:
|
|
2479
|
+
nextCursor: z20.string().nullable().default(null),
|
|
2439
2480
|
/** @deprecated Use `nextCursor`. Removed in 2.0.0. */
|
|
2440
|
-
cursor:
|
|
2481
|
+
cursor: z20.string().nullable()
|
|
2441
2482
|
});
|
|
2442
2483
|
|
|
2443
2484
|
// src/settings.ts
|
|
2444
|
-
import * as
|
|
2485
|
+
import * as z22 from "zod";
|
|
2445
2486
|
|
|
2446
2487
|
// src/setting-values.ts
|
|
2447
|
-
import * as
|
|
2448
|
-
var settingInstant =
|
|
2449
|
-
var settingResourceId =
|
|
2450
|
-
|
|
2451
|
-
|
|
2488
|
+
import * as z21 from "zod";
|
|
2489
|
+
var settingInstant = z21.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
|
|
2490
|
+
var settingResourceId = z21.union([
|
|
2491
|
+
z21.literal(""),
|
|
2492
|
+
z21.string().regex(/^\S{1,200}$/)
|
|
2452
2493
|
]);
|
|
2453
2494
|
|
|
2454
2495
|
// src/settings.ts
|
|
2455
|
-
var base = { label:
|
|
2456
|
-
var settingFieldSchema =
|
|
2457
|
-
|
|
2496
|
+
var base = { label: z22.string().min(1), description: z22.string().optional() };
|
|
2497
|
+
var settingFieldSchema = z22.discriminatedUnion("kind", [
|
|
2498
|
+
z22.object({
|
|
2458
2499
|
...base,
|
|
2459
|
-
kind:
|
|
2460
|
-
default: identifier.or(
|
|
2500
|
+
kind: z22.literal("point-ledger"),
|
|
2501
|
+
default: identifier.or(z22.literal(""))
|
|
2461
2502
|
}).strict(),
|
|
2462
|
-
|
|
2463
|
-
|
|
2503
|
+
z22.object({ ...base, kind: z22.literal("datetime"), default: settingInstant }).strict(),
|
|
2504
|
+
z22.object({
|
|
2464
2505
|
...base,
|
|
2465
|
-
kind:
|
|
2506
|
+
kind: z22.literal("resource"),
|
|
2466
2507
|
default: settingResourceId,
|
|
2467
2508
|
source: resourceSourceSchema
|
|
2468
2509
|
}).strict(),
|
|
2469
|
-
|
|
2470
|
-
|
|
2510
|
+
z22.object({ ...base, kind: z22.literal("quiz"), default: quizContentSchema }).strict(),
|
|
2511
|
+
z22.object({
|
|
2471
2512
|
...base,
|
|
2472
|
-
kind:
|
|
2473
|
-
default:
|
|
2474
|
-
minLength:
|
|
2475
|
-
maxLength:
|
|
2476
|
-
multiline:
|
|
2513
|
+
kind: z22.literal("text"),
|
|
2514
|
+
default: z22.string(),
|
|
2515
|
+
minLength: z22.number().int().nonnegative(),
|
|
2516
|
+
maxLength: z22.number().int().positive(),
|
|
2517
|
+
multiline: z22.boolean(),
|
|
2477
2518
|
/**
|
|
2478
2519
|
* A list Console offers the value from, beside free text: `telegram-chat` lists the
|
|
2479
2520
|
* project's connected Telegram chats. Unknown pickers read as free text.
|
|
2480
2521
|
*/
|
|
2481
|
-
picker:
|
|
2522
|
+
picker: z22.string().optional()
|
|
2482
2523
|
}).strict(),
|
|
2483
|
-
|
|
2524
|
+
z22.object({
|
|
2484
2525
|
...base,
|
|
2485
|
-
kind:
|
|
2486
|
-
default:
|
|
2487
|
-
min:
|
|
2488
|
-
max:
|
|
2526
|
+
kind: z22.literal("integer"),
|
|
2527
|
+
default: z22.number().int(),
|
|
2528
|
+
min: z22.number().int(),
|
|
2529
|
+
max: z22.number().int()
|
|
2489
2530
|
}).strict(),
|
|
2490
|
-
|
|
2491
|
-
|
|
2531
|
+
z22.object({ ...base, kind: z22.literal("boolean"), default: z22.boolean() }).strict(),
|
|
2532
|
+
z22.object({
|
|
2492
2533
|
...base,
|
|
2493
|
-
kind:
|
|
2494
|
-
default:
|
|
2495
|
-
options:
|
|
2534
|
+
kind: z22.literal("choice"),
|
|
2535
|
+
default: z22.string(),
|
|
2536
|
+
options: z22.array(z22.string().min(1)).min(1)
|
|
2496
2537
|
}).strict()
|
|
2497
2538
|
]);
|
|
2498
|
-
var settingsFieldsSchema =
|
|
2499
|
-
|
|
2539
|
+
var settingsFieldsSchema = z22.record(
|
|
2540
|
+
z22.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
2500
2541
|
settingFieldSchema
|
|
2501
2542
|
);
|
|
2502
|
-
var settingsValuesSchema =
|
|
2503
|
-
|
|
2504
|
-
|
|
2543
|
+
var settingsValuesSchema = z22.record(
|
|
2544
|
+
z22.string(),
|
|
2545
|
+
z22.union([z22.string(), z22.number().finite(), z22.boolean(), quizContentSchema])
|
|
2505
2546
|
);
|
|
2506
2547
|
function parseSettings(fields2, input) {
|
|
2507
2548
|
const shape = {};
|
|
@@ -2520,20 +2561,20 @@ function parseSettings(fields2, input) {
|
|
|
2520
2561
|
shape[key] = quizContentSchema.default(field.default);
|
|
2521
2562
|
break;
|
|
2522
2563
|
case "text":
|
|
2523
|
-
shape[key] =
|
|
2564
|
+
shape[key] = z22.string().min(field.minLength).max(field.maxLength).default(field.default);
|
|
2524
2565
|
break;
|
|
2525
2566
|
case "integer":
|
|
2526
|
-
shape[key] =
|
|
2567
|
+
shape[key] = z22.number().int().min(field.min).max(field.max).default(field.default);
|
|
2527
2568
|
break;
|
|
2528
2569
|
case "boolean":
|
|
2529
|
-
shape[key] =
|
|
2570
|
+
shape[key] = z22.boolean().default(field.default);
|
|
2530
2571
|
break;
|
|
2531
2572
|
case "choice":
|
|
2532
|
-
shape[key] =
|
|
2573
|
+
shape[key] = z22.enum(field.options).default(field.default);
|
|
2533
2574
|
break;
|
|
2534
2575
|
}
|
|
2535
2576
|
}
|
|
2536
|
-
return settingsValuesSchema.parse(
|
|
2577
|
+
return settingsValuesSchema.parse(z22.object(shape).strict().parse(input));
|
|
2537
2578
|
}
|
|
2538
2579
|
function missingResourceSettings(fields2, values2) {
|
|
2539
2580
|
return Object.entries(fields2).filter(
|
|
@@ -2554,21 +2595,21 @@ function authoringKey(input) {
|
|
|
2554
2595
|
}
|
|
2555
2596
|
|
|
2556
2597
|
// src/campaigns.ts
|
|
2557
|
-
import * as
|
|
2558
|
-
var timestamp4 =
|
|
2559
|
-
var availabilityWindowSchema =
|
|
2598
|
+
import * as z23 from "zod";
|
|
2599
|
+
var timestamp4 = z23.number().int().safe().nonnegative();
|
|
2600
|
+
var availabilityWindowSchema = z23.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
|
|
2560
2601
|
message: "Window end must follow its start",
|
|
2561
2602
|
path: ["until"]
|
|
2562
2603
|
});
|
|
2563
|
-
var campaignDefinitionSchema =
|
|
2604
|
+
var campaignDefinitionSchema = z23.object({
|
|
2564
2605
|
key: identifier,
|
|
2565
|
-
title:
|
|
2606
|
+
title: z23.string().trim().min(1).max(120),
|
|
2566
2607
|
window: availabilityWindowSchema.optional(),
|
|
2567
|
-
enrollment:
|
|
2608
|
+
enrollment: z23.enum(["none", "required"]).default("none")
|
|
2568
2609
|
}).strict();
|
|
2569
2610
|
var campaignAuthoringSchema = campaignDefinitionSchema.omit({ key: true, title: true }).extend({
|
|
2570
2611
|
...authoringIdentityShape,
|
|
2571
|
-
title:
|
|
2612
|
+
title: z23.string().trim().min(1).max(120).optional()
|
|
2572
2613
|
}).strict().transform((value) => {
|
|
2573
2614
|
const normalized = value;
|
|
2574
2615
|
return campaignDefinitionSchema.parse({
|
|
@@ -2582,42 +2623,42 @@ function defineCampaign(input) {
|
|
|
2582
2623
|
var campaignViewSchema = campaignDefinitionSchema.extend({
|
|
2583
2624
|
enrolledAt: timestamp4.nullable(),
|
|
2584
2625
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
2585
|
-
withdrawalReason:
|
|
2626
|
+
withdrawalReason: z23.string().nullable().default(null)
|
|
2586
2627
|
});
|
|
2587
|
-
var campaignEnrollmentInputSchema =
|
|
2628
|
+
var campaignEnrollmentInputSchema = z23.object({ actionId: identifier, campaign: identifier }).strict();
|
|
2588
2629
|
var memberCampaignEnrollmentInputSchema = campaignEnrollmentInputSchema.extend({ member: identifier });
|
|
2589
2630
|
var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
|
|
2590
2631
|
var memberCampaignWithdrawalInputSchema = campaignWithdrawalInputSchema.extend({
|
|
2591
2632
|
member: identifier,
|
|
2592
|
-
reason:
|
|
2633
|
+
reason: z23.string().trim().min(1).max(500)
|
|
2593
2634
|
});
|
|
2594
|
-
var campaignEnrollmentSchema =
|
|
2635
|
+
var campaignEnrollmentSchema = z23.object({
|
|
2595
2636
|
campaign: identifier,
|
|
2596
2637
|
member: identifier,
|
|
2597
2638
|
enrolledAt: timestamp4,
|
|
2598
2639
|
withdrawnAt: timestamp4.nullable().default(null),
|
|
2599
|
-
withdrawalReason:
|
|
2640
|
+
withdrawalReason: z23.string().nullable().default(null)
|
|
2600
2641
|
});
|
|
2601
2642
|
|
|
2602
2643
|
// src/resource-handle.ts
|
|
2603
|
-
import * as
|
|
2644
|
+
import * as z24 from "zod";
|
|
2604
2645
|
function resourceHandle(_kind, definition) {
|
|
2605
2646
|
return definition;
|
|
2606
2647
|
}
|
|
2607
|
-
var ledgerSettingSchema = identifier.or(
|
|
2648
|
+
var ledgerSettingSchema = identifier.or(z24.literal("")).brand();
|
|
2608
2649
|
function ledgerKey(ledger) {
|
|
2609
2650
|
return typeof ledger === "string" ? ledger : ledger.key;
|
|
2610
2651
|
}
|
|
2611
2652
|
|
|
2612
2653
|
// src/groups.ts
|
|
2613
|
-
import * as
|
|
2614
|
-
var projectGroupSchema =
|
|
2654
|
+
import * as z25 from "zod";
|
|
2655
|
+
var projectGroupSchema = z25.object({
|
|
2615
2656
|
key: identifier,
|
|
2616
|
-
title:
|
|
2657
|
+
title: z25.string().trim().min(1).max(120)
|
|
2617
2658
|
}).strict();
|
|
2618
2659
|
var projectGroupAuthoringSchema = projectGroupSchema.omit({ key: true, title: true }).extend({
|
|
2619
2660
|
...authoringIdentityShape,
|
|
2620
|
-
title:
|
|
2661
|
+
title: z25.string().trim().min(1).max(120).optional()
|
|
2621
2662
|
}).strict().transform((value) => {
|
|
2622
2663
|
return projectGroupSchema.parse({
|
|
2623
2664
|
...value,
|
|
@@ -2630,92 +2671,92 @@ function defineGroup(input) {
|
|
|
2630
2671
|
function projectGroupKey(group) {
|
|
2631
2672
|
return identifier.parse(group.key);
|
|
2632
2673
|
}
|
|
2633
|
-
var groupTitle =
|
|
2634
|
-
var reason =
|
|
2635
|
-
var timestamp5 =
|
|
2636
|
-
var createGroupSchema =
|
|
2637
|
-
var updateGroupSchema =
|
|
2638
|
-
var addGroupMemberSchema =
|
|
2639
|
-
var removeGroupMemberSchema =
|
|
2640
|
-
var groupPageQuerySchema =
|
|
2674
|
+
var groupTitle = z25.string().trim().min(1).max(120);
|
|
2675
|
+
var reason = z25.string().trim().min(1).max(1e3);
|
|
2676
|
+
var timestamp5 = z25.number().int().nonnegative().max(864e13);
|
|
2677
|
+
var createGroupSchema = z25.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
|
|
2678
|
+
var updateGroupSchema = z25.object({ title: groupTitle }).strict();
|
|
2679
|
+
var addGroupMemberSchema = z25.object({ actionId: identifier, member: identifier, reason }).strict();
|
|
2680
|
+
var removeGroupMemberSchema = z25.object({ actionId: identifier, reason }).strict();
|
|
2681
|
+
var groupPageQuerySchema = z25.strictObject({
|
|
2641
2682
|
cursor: pageCursorSchema.optional(),
|
|
2642
2683
|
/** Items per page, 1–100; the default is 50. */
|
|
2643
|
-
limit:
|
|
2684
|
+
limit: z25.number().int().min(1).max(100).optional()
|
|
2644
2685
|
});
|
|
2645
|
-
var managedGroupSchema =
|
|
2686
|
+
var managedGroupSchema = z25.object({
|
|
2646
2687
|
key: identifier,
|
|
2647
|
-
title:
|
|
2648
|
-
members:
|
|
2688
|
+
title: z25.string(),
|
|
2689
|
+
members: z25.number().int().nonnegative(),
|
|
2649
2690
|
createdAt: timestamp5,
|
|
2650
2691
|
archivedAt: timestamp5.nullable()
|
|
2651
2692
|
});
|
|
2652
|
-
var groupPageSchema =
|
|
2653
|
-
items:
|
|
2693
|
+
var groupPageSchema = z25.object({
|
|
2694
|
+
items: z25.array(managedGroupSchema),
|
|
2654
2695
|
nextCursor: pageCursorSchema.nullable()
|
|
2655
2696
|
});
|
|
2656
|
-
var groupMemberSchema =
|
|
2697
|
+
var groupMemberSchema = z25.object({
|
|
2657
2698
|
member: identifier,
|
|
2658
2699
|
addedAt: timestamp5.nullable()
|
|
2659
2700
|
});
|
|
2660
|
-
var groupMemberPageSchema =
|
|
2661
|
-
items:
|
|
2701
|
+
var groupMemberPageSchema = z25.object({
|
|
2702
|
+
items: z25.array(groupMemberSchema),
|
|
2662
2703
|
nextCursor: pageCursorSchema.nullable()
|
|
2663
2704
|
});
|
|
2664
2705
|
|
|
2665
2706
|
// src/prerequisites.ts
|
|
2666
|
-
import * as
|
|
2667
|
-
var amount =
|
|
2707
|
+
import * as z26 from "zod";
|
|
2708
|
+
var amount = z26.number().int().safe().nonnegative();
|
|
2668
2709
|
var threshold = amount.positive();
|
|
2669
|
-
var completionPrerequisiteSchema =
|
|
2670
|
-
|
|
2671
|
-
kind:
|
|
2710
|
+
var completionPrerequisiteSchema = z26.discriminatedUnion("scope", [
|
|
2711
|
+
z26.object({
|
|
2712
|
+
kind: z26.literal("completion"),
|
|
2672
2713
|
quest: identifier,
|
|
2673
|
-
scope:
|
|
2714
|
+
scope: z26.literal("ever")
|
|
2674
2715
|
}).strict(),
|
|
2675
|
-
|
|
2676
|
-
kind:
|
|
2716
|
+
z26.object({
|
|
2717
|
+
kind: z26.literal("completion"),
|
|
2677
2718
|
quest: identifier,
|
|
2678
|
-
scope:
|
|
2719
|
+
scope: z26.literal("period"),
|
|
2679
2720
|
period: calendarPeriodSchema.exclude(["lifetime"])
|
|
2680
2721
|
}).strict()
|
|
2681
2722
|
]);
|
|
2682
|
-
var balancePrerequisiteSchema =
|
|
2683
|
-
kind:
|
|
2723
|
+
var balancePrerequisiteSchema = z26.object({
|
|
2724
|
+
kind: z26.literal("balance"),
|
|
2684
2725
|
balance: identifier,
|
|
2685
2726
|
minimum: threshold
|
|
2686
2727
|
}).strict();
|
|
2687
|
-
var groupPrerequisiteSchema =
|
|
2688
|
-
var prerequisiteSchema =
|
|
2728
|
+
var groupPrerequisiteSchema = z26.object({ kind: z26.literal("group"), group: identifier, title: z26.string() }).strict();
|
|
2729
|
+
var prerequisiteSchema = z26.discriminatedUnion("kind", [
|
|
2689
2730
|
completionPrerequisiteSchema,
|
|
2690
2731
|
balancePrerequisiteSchema,
|
|
2691
2732
|
groupPrerequisiteSchema
|
|
2692
2733
|
]);
|
|
2693
|
-
var missingPrerequisiteSchema =
|
|
2694
|
-
|
|
2695
|
-
kind:
|
|
2734
|
+
var missingPrerequisiteSchema = z26.union([
|
|
2735
|
+
z26.object({
|
|
2736
|
+
kind: z26.literal("completion"),
|
|
2696
2737
|
quest: identifier,
|
|
2697
|
-
title:
|
|
2698
|
-
scope:
|
|
2738
|
+
title: z26.string(),
|
|
2739
|
+
scope: z26.literal("ever")
|
|
2699
2740
|
}),
|
|
2700
|
-
|
|
2701
|
-
kind:
|
|
2741
|
+
z26.object({
|
|
2742
|
+
kind: z26.literal("completion"),
|
|
2702
2743
|
quest: identifier,
|
|
2703
|
-
title:
|
|
2704
|
-
scope:
|
|
2744
|
+
title: z26.string(),
|
|
2745
|
+
scope: z26.literal("period"),
|
|
2705
2746
|
period: calendarPeriodSchema.exclude(["lifetime"]),
|
|
2706
|
-
resetsAt:
|
|
2747
|
+
resetsAt: z26.number().int().safe()
|
|
2707
2748
|
}),
|
|
2708
|
-
|
|
2709
|
-
kind:
|
|
2749
|
+
z26.object({
|
|
2750
|
+
kind: z26.literal("balance"),
|
|
2710
2751
|
balance: identifier,
|
|
2711
|
-
title:
|
|
2752
|
+
title: z26.string(),
|
|
2712
2753
|
minimum: threshold,
|
|
2713
2754
|
current: amount
|
|
2714
2755
|
}),
|
|
2715
|
-
|
|
2716
|
-
kind:
|
|
2756
|
+
z26.object({
|
|
2757
|
+
kind: z26.literal("group"),
|
|
2717
2758
|
group: identifier,
|
|
2718
|
-
title:
|
|
2759
|
+
title: z26.string()
|
|
2719
2760
|
})
|
|
2720
2761
|
]);
|
|
2721
2762
|
function completed(quest, options = {}) {
|
|
@@ -2746,38 +2787,38 @@ function inGroup(group) {
|
|
|
2746
2787
|
var maxPointsAmount = 2147483647;
|
|
2747
2788
|
|
|
2748
2789
|
// src/schema.ts
|
|
2749
|
-
import * as
|
|
2750
|
-
var pointsRewardSchema =
|
|
2751
|
-
kind:
|
|
2790
|
+
import * as z27 from "zod";
|
|
2791
|
+
var pointsRewardSchema = z27.object({
|
|
2792
|
+
kind: z27.literal("points").default("points"),
|
|
2752
2793
|
balance: identifier,
|
|
2753
|
-
amount:
|
|
2794
|
+
amount: z27.number().int().min(0).max(maxPointsAmount)
|
|
2754
2795
|
}).strict();
|
|
2755
|
-
var tieredRewardDefinitionSchema =
|
|
2796
|
+
var tieredRewardDefinitionSchema = z27.object({
|
|
2756
2797
|
/** An automatic achievement backed by the project badge catalog. */
|
|
2757
2798
|
badge: identifier.optional(),
|
|
2758
2799
|
id: identifier,
|
|
2759
|
-
title:
|
|
2760
|
-
tiers:
|
|
2761
|
-
|
|
2800
|
+
title: z27.string().min(1).max(120),
|
|
2801
|
+
tiers: z27.array(
|
|
2802
|
+
z27.object({ id: identifier, title: z27.string().min(1).max(120) }).strict()
|
|
2762
2803
|
).min(1).max(20).refine(
|
|
2763
2804
|
(tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
|
|
2764
2805
|
"Tier IDs must be unique"
|
|
2765
2806
|
),
|
|
2766
|
-
inventory:
|
|
2767
|
-
fulfillment:
|
|
2768
|
-
|
|
2769
|
-
|
|
2807
|
+
inventory: z27.object({ kind: z27.literal("untracked") }).strict(),
|
|
2808
|
+
fulfillment: z27.discriminatedUnion("kind", [
|
|
2809
|
+
z27.object({ kind: z27.literal("staff-handover") }).strict(),
|
|
2810
|
+
z27.object({ kind: z27.literal("automatic") }).strict()
|
|
2770
2811
|
])
|
|
2771
2812
|
}).strict().refine(
|
|
2772
2813
|
(value) => value.badge === void 0 || value.fulfillment.kind === "automatic" && value.tiers.length === 1 && value.tiers[0].id === "awarded",
|
|
2773
2814
|
"Badge rewards require the fixed automatic achievement envelope"
|
|
2774
2815
|
);
|
|
2775
|
-
var tieredRewardReferenceSchema =
|
|
2816
|
+
var tieredRewardReferenceSchema = z27.object({
|
|
2776
2817
|
id: identifier,
|
|
2777
2818
|
key: identifier.nullable()
|
|
2778
2819
|
});
|
|
2779
|
-
var tierRewardSchema =
|
|
2780
|
-
kind:
|
|
2820
|
+
var tierRewardSchema = z27.object({
|
|
2821
|
+
kind: z27.literal("tier"),
|
|
2781
2822
|
reward: tieredRewardDefinitionSchema,
|
|
2782
2823
|
tier: identifier
|
|
2783
2824
|
}).strict().refine(
|
|
@@ -2789,7 +2830,7 @@ var badgeRewardSchema = tierRewardSchema.transform(
|
|
|
2789
2830
|
const badge = value.reward.badge;
|
|
2790
2831
|
if (!badge || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
|
|
2791
2832
|
context.addIssue({ code: "custom", message: "Invalid badge reward" });
|
|
2792
|
-
return
|
|
2833
|
+
return z27.NEVER;
|
|
2793
2834
|
}
|
|
2794
2835
|
return { ...value, reward: { ...value.reward, badge } };
|
|
2795
2836
|
}
|
|
@@ -2809,7 +2850,7 @@ function badgeReward(reference, title) {
|
|
|
2809
2850
|
});
|
|
2810
2851
|
}
|
|
2811
2852
|
var integrationRewardSchema = discordRewardSchema;
|
|
2812
|
-
var rewardSchema =
|
|
2853
|
+
var rewardSchema = z27.union([
|
|
2813
2854
|
pointsRewardSchema,
|
|
2814
2855
|
tierRewardSchema,
|
|
2815
2856
|
integrationRewardSchema
|
|
@@ -2823,39 +2864,39 @@ function rewardKey(reward) {
|
|
|
2823
2864
|
}
|
|
2824
2865
|
return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
|
|
2825
2866
|
}
|
|
2826
|
-
var triggerSchema =
|
|
2827
|
-
|
|
2828
|
-
kind:
|
|
2829
|
-
input:
|
|
2867
|
+
var triggerSchema = z27.union([
|
|
2868
|
+
z27.object({
|
|
2869
|
+
kind: z27.literal("manual"),
|
|
2870
|
+
input: z27.literal("text"),
|
|
2830
2871
|
constraints: textOptionsSchema,
|
|
2831
|
-
actor:
|
|
2872
|
+
actor: z27.enum(["member", "staff"]).optional()
|
|
2832
2873
|
}).strict(),
|
|
2833
|
-
|
|
2834
|
-
kind:
|
|
2835
|
-
input:
|
|
2874
|
+
z27.object({
|
|
2875
|
+
kind: z27.literal("manual"),
|
|
2876
|
+
input: z27.literal("url"),
|
|
2836
2877
|
constraints: urlOptionsSchema,
|
|
2837
|
-
actor:
|
|
2878
|
+
actor: z27.enum(["member", "staff"]).optional()
|
|
2838
2879
|
}).strict(),
|
|
2839
|
-
|
|
2840
|
-
kind:
|
|
2841
|
-
input:
|
|
2842
|
-
actor:
|
|
2880
|
+
z27.object({
|
|
2881
|
+
kind: z27.literal("manual"),
|
|
2882
|
+
input: z27.enum(["photo", "quiz", "none"]),
|
|
2883
|
+
actor: z27.enum(["member", "staff"]).optional()
|
|
2843
2884
|
}).strict(),
|
|
2844
|
-
|
|
2845
|
-
kind:
|
|
2885
|
+
z27.object({
|
|
2886
|
+
kind: z27.literal("automatic"),
|
|
2846
2887
|
tracker: trackerTriggerPolicySchema.optional()
|
|
2847
2888
|
}).strict()
|
|
2848
2889
|
]);
|
|
2849
|
-
var triggerResponseSchema =
|
|
2890
|
+
var triggerResponseSchema = z27.union(
|
|
2850
2891
|
triggerSchema.options.map((option) => option.strip())
|
|
2851
2892
|
);
|
|
2852
|
-
var photoResultSchema =
|
|
2853
|
-
kind:
|
|
2854
|
-
reason:
|
|
2893
|
+
var photoResultSchema = z27.object({
|
|
2894
|
+
kind: z27.enum(["pass", "fail", "unclear"]),
|
|
2895
|
+
reason: z27.string().min(1).max(2e3)
|
|
2855
2896
|
}).strict();
|
|
2856
|
-
var textReviewInputSchema =
|
|
2857
|
-
text:
|
|
2858
|
-
criteria:
|
|
2897
|
+
var textReviewInputSchema = z27.object({
|
|
2898
|
+
text: z27.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
|
|
2899
|
+
criteria: z27.string().trim().min(1).max(2e3)
|
|
2859
2900
|
}).strict();
|
|
2860
2901
|
var textResultSchema = photoResultSchema;
|
|
2861
2902
|
var deferPolicy = {
|
|
@@ -2869,54 +2910,54 @@ var retryCooldownPolicy = {
|
|
|
2869
2910
|
minMs: 1e3,
|
|
2870
2911
|
maxMs: 6048e5
|
|
2871
2912
|
};
|
|
2872
|
-
var retryCooldownMsSchema =
|
|
2873
|
-
var evaluatorProgressSchema =
|
|
2874
|
-
current:
|
|
2875
|
-
target:
|
|
2876
|
-
reason:
|
|
2913
|
+
var retryCooldownMsSchema = z27.number().int().min(retryCooldownPolicy.minMs).max(retryCooldownPolicy.maxMs);
|
|
2914
|
+
var evaluatorProgressSchema = z27.object({
|
|
2915
|
+
current: z27.number().finite().nonnegative(),
|
|
2916
|
+
target: z27.number().finite().positive(),
|
|
2917
|
+
reason: z27.string().min(1).max(2e3)
|
|
2877
2918
|
}).refine((value) => value.current <= value.target, {
|
|
2878
2919
|
message: "Progress current must not exceed target"
|
|
2879
2920
|
});
|
|
2880
|
-
var decisionSchema =
|
|
2881
|
-
|
|
2882
|
-
kind:
|
|
2883
|
-
reason:
|
|
2884
|
-
retryAfterMs:
|
|
2921
|
+
var decisionSchema = z27.discriminatedUnion("kind", [
|
|
2922
|
+
z27.strictObject({
|
|
2923
|
+
kind: z27.literal("defer"),
|
|
2924
|
+
reason: z27.string().min(1).max(2e3),
|
|
2925
|
+
retryAfterMs: z27.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
|
|
2885
2926
|
/** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
|
|
2886
|
-
until:
|
|
2927
|
+
until: z27.number().int().safe().nonnegative().optional()
|
|
2887
2928
|
}),
|
|
2888
|
-
evaluatorProgressSchema.safeExtend({ kind:
|
|
2889
|
-
|
|
2890
|
-
kind:
|
|
2891
|
-
rewards:
|
|
2929
|
+
evaluatorProgressSchema.safeExtend({ kind: z27.literal("progress") }).strict(),
|
|
2930
|
+
z27.object({
|
|
2931
|
+
kind: z27.literal("accept"),
|
|
2932
|
+
rewards: z27.array(rewardSchema).max(10),
|
|
2892
2933
|
completionKey: completionKeySchema.optional()
|
|
2893
2934
|
}).strict(),
|
|
2894
|
-
|
|
2895
|
-
kind:
|
|
2896
|
-
reason:
|
|
2935
|
+
z27.object({
|
|
2936
|
+
kind: z27.literal("reject"),
|
|
2937
|
+
reason: z27.string().min(1).max(2e3),
|
|
2897
2938
|
/** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
|
|
2898
|
-
requestedReview:
|
|
2939
|
+
requestedReview: z27.literal(true).optional()
|
|
2899
2940
|
}).strict(),
|
|
2900
|
-
|
|
2901
|
-
kind:
|
|
2902
|
-
reason:
|
|
2903
|
-
rewards:
|
|
2941
|
+
z27.object({
|
|
2942
|
+
kind: z27.literal("review"),
|
|
2943
|
+
reason: z27.string().min(1).max(2e3),
|
|
2944
|
+
rewards: z27.array(rewardSchema).max(10).optional(),
|
|
2904
2945
|
completionKey: completionKeySchema.optional()
|
|
2905
2946
|
}).strict()
|
|
2906
2947
|
]);
|
|
2907
|
-
var reviewModeSchema =
|
|
2908
|
-
var storedReviewModeSchema =
|
|
2948
|
+
var reviewModeSchema = z27.enum(["workers-ai"]);
|
|
2949
|
+
var storedReviewModeSchema = z27.enum([
|
|
2909
2950
|
"fixture-pass",
|
|
2910
2951
|
"fixture-fail",
|
|
2911
2952
|
"fixture-unclear",
|
|
2912
2953
|
"fixture-error",
|
|
2913
2954
|
"workers-ai"
|
|
2914
2955
|
]);
|
|
2915
|
-
var rewardBundleSchema =
|
|
2956
|
+
var rewardBundleSchema = z27.array(rewardSchema).max(10).refine(
|
|
2916
2957
|
(rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
|
|
2917
2958
|
"Use one entry per balance or shared reward"
|
|
2918
2959
|
);
|
|
2919
|
-
var mediaUrlSchema =
|
|
2960
|
+
var mediaUrlSchema = z27.string().max(2e3).refine((value) => {
|
|
2920
2961
|
if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
|
|
2921
2962
|
return true;
|
|
2922
2963
|
}
|
|
@@ -2926,86 +2967,88 @@ var mediaUrlSchema = z26.string().max(2e3).refine((value) => {
|
|
|
2926
2967
|
return false;
|
|
2927
2968
|
}
|
|
2928
2969
|
}, "Use an HTTPS URL or a same-site path beginning with /");
|
|
2929
|
-
var questStepActionSchema =
|
|
2930
|
-
|
|
2931
|
-
kind:
|
|
2970
|
+
var questStepActionSchema = z27.discriminatedUnion("kind", [
|
|
2971
|
+
z27.object({
|
|
2972
|
+
kind: z27.literal("link"),
|
|
2932
2973
|
url: mediaUrlSchema.refine(
|
|
2933
2974
|
(value) => value.startsWith("https://"),
|
|
2934
2975
|
"Use an HTTPS URL"
|
|
2935
2976
|
),
|
|
2936
|
-
label:
|
|
2977
|
+
label: z27.string().trim().min(1).max(120)
|
|
2937
2978
|
}).strict()
|
|
2938
2979
|
]);
|
|
2939
|
-
var questStepSchema =
|
|
2940
|
-
title:
|
|
2941
|
-
description:
|
|
2980
|
+
var questStepSchema = z27.object({
|
|
2981
|
+
title: z27.string().trim().min(1).max(120),
|
|
2982
|
+
description: z27.string().max(4e3).optional(),
|
|
2942
2983
|
action: questStepActionSchema.optional()
|
|
2943
2984
|
}).strict();
|
|
2944
|
-
var questPresentationRequirementSchema =
|
|
2945
|
-
|
|
2946
|
-
|
|
2985
|
+
var questPresentationRequirementSchema = z27.discriminatedUnion("kind", [
|
|
2986
|
+
z27.object({ kind: z27.literal("account"), provider: authProviderSchema }).strict(),
|
|
2987
|
+
z27.object({ kind: z27.literal("wallet"), chain: walletChainSchema.optional() }).strict()
|
|
2947
2988
|
]);
|
|
2948
|
-
var questPresentationContentSchema =
|
|
2949
|
-
steps:
|
|
2989
|
+
var questPresentationContentSchema = z27.object({
|
|
2990
|
+
steps: z27.array(questStepSchema).max(30).optional(),
|
|
2950
2991
|
image: mediaUrlSchema.optional(),
|
|
2951
|
-
imageAlt:
|
|
2952
|
-
requirements:
|
|
2992
|
+
imageAlt: z27.string().max(500).optional(),
|
|
2993
|
+
requirements: z27.array(questPresentationRequirementSchema).max(10).optional()
|
|
2953
2994
|
}).strict();
|
|
2954
2995
|
var questPresentationSchema = questPresentationContentSchema.extend({
|
|
2955
2996
|
quiz: quizQuestionsSchema.optional(),
|
|
2956
|
-
instructions:
|
|
2957
|
-
video:
|
|
2997
|
+
instructions: z27.string().max(4e3).optional(),
|
|
2998
|
+
video: z27.object({
|
|
2958
2999
|
url: mediaUrlSchema,
|
|
2959
3000
|
poster: mediaUrlSchema.optional(),
|
|
2960
|
-
captions:
|
|
3001
|
+
captions: z27.object({
|
|
2961
3002
|
url: mediaUrlSchema,
|
|
2962
|
-
language:
|
|
2963
|
-
label:
|
|
3003
|
+
language: z27.string().min(2).max(20),
|
|
3004
|
+
label: z27.string().min(1).max(80)
|
|
2964
3005
|
}).strict().optional()
|
|
2965
3006
|
}).strict().optional()
|
|
2966
3007
|
}).strict();
|
|
2967
|
-
var questProfileSchema =
|
|
3008
|
+
var questProfileSchema = z27.object({ visible: z27.boolean() }).strict();
|
|
2968
3009
|
var evaluatorProtocol = 2;
|
|
2969
|
-
var evaluatorProtocolSchema =
|
|
2970
|
-
var questDescriptionSchema =
|
|
3010
|
+
var evaluatorProtocolSchema = z27.literal(evaluatorProtocol);
|
|
3011
|
+
var questDescriptionSchema = z27.object({
|
|
2971
3012
|
quest: identifier,
|
|
2972
3013
|
evaluatorProtocol: evaluatorProtocolSchema,
|
|
2973
|
-
title:
|
|
3014
|
+
title: z27.string().min(1).max(120),
|
|
2974
3015
|
presentation: questPresentationSchema.default({}),
|
|
2975
|
-
integrations:
|
|
3016
|
+
integrations: z27.array(evaluatorIntegrationProviderSchema).max(10).default([]),
|
|
2976
3017
|
fields: settingsFieldsSchema,
|
|
2977
3018
|
values: settingsValuesSchema,
|
|
2978
3019
|
rewards: rewardBundleSchema,
|
|
2979
|
-
humanReview:
|
|
3020
|
+
humanReview: z27.boolean(),
|
|
2980
3021
|
trigger: triggerSchema,
|
|
2981
3022
|
performance: contentPerformancePolicySchema.optional(),
|
|
2982
|
-
requires:
|
|
3023
|
+
requires: z27.array(prerequisiteSchema).max(30).default([]),
|
|
2983
3024
|
campaign: campaignDefinitionSchema.optional(),
|
|
2984
3025
|
availability: availabilityWindowSchema.optional(),
|
|
2985
|
-
completion:
|
|
2986
|
-
visibility:
|
|
3026
|
+
completion: z27.preprocess(refuseStreakTimeZone, completionPolicySchema),
|
|
3027
|
+
visibility: z27.enum(["visible", "hidden"]).default("visible"),
|
|
2987
3028
|
/** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
|
|
2988
3029
|
profile: questProfileSchema.default({ visible: false }),
|
|
2989
|
-
budgets:
|
|
3030
|
+
budgets: z27.array(budgetSchema).max(20).default([]),
|
|
2990
3031
|
/**
|
|
2991
3032
|
* Milliseconds a member waits after an attempt is rejected (by the evaluator or a reviewer)
|
|
2992
3033
|
* before submitting this quest again. Only for quests members submit. Omitted: no cooldown.
|
|
2993
3034
|
*/
|
|
2994
3035
|
retryCooldownMs: retryCooldownMsSchema.optional()
|
|
2995
3036
|
}).strict();
|
|
2996
|
-
var artifactSchema =
|
|
3037
|
+
var artifactSchema = z27.object({ code: z27.string().min(1).max(1e6) }).strict();
|
|
2997
3038
|
var releaseSchema = artifactSchema.extend({
|
|
3039
|
+
/** The SDK runtime the code imports. Absent, the code bundles its own SDK. */
|
|
3040
|
+
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
2998
3041
|
settings: settingsValuesSchema,
|
|
2999
3042
|
provider: reviewModeSchema,
|
|
3000
3043
|
expectedRelease: identifier.nullable().optional(),
|
|
3001
|
-
settingRenames:
|
|
3044
|
+
settingRenames: z27.record(z27.string(), z27.string()).optional()
|
|
3002
3045
|
}).strict();
|
|
3003
|
-
var batchReleaseSchema =
|
|
3004
|
-
var questSettingsInputSchema =
|
|
3046
|
+
var batchReleaseSchema = z27.object({ releases: z27.array(releaseSchema).min(1).max(50) }).strict();
|
|
3047
|
+
var questSettingsInputSchema = z27.object({
|
|
3005
3048
|
quest: identifier,
|
|
3006
3049
|
expectedRelease: identifier,
|
|
3007
3050
|
set: settingsValuesSchema,
|
|
3008
|
-
reset:
|
|
3051
|
+
reset: z27.array(z27.string()),
|
|
3009
3052
|
/** Replace the editable presentation fields; null restores the code defaults. */
|
|
3010
3053
|
presentation: questPresentationContentSchema.nullable().optional()
|
|
3011
3054
|
}).strict();
|
|
@@ -3015,26 +3058,28 @@ var storedQuestDescriptionSchema = questDescriptionSchema.extend({
|
|
|
3015
3058
|
var publishedReleaseSchema = responseShape(
|
|
3016
3059
|
storedQuestDescriptionSchema.extend({
|
|
3017
3060
|
key: identifier.optional(),
|
|
3018
|
-
code:
|
|
3061
|
+
code: z27.string(),
|
|
3062
|
+
/** The SDK runtime `code` imports. Absent, the code bundles its own SDK. */
|
|
3063
|
+
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
3019
3064
|
provider: storedReviewModeSchema,
|
|
3020
3065
|
id: identifier,
|
|
3021
|
-
createdAt:
|
|
3022
|
-
origin:
|
|
3023
|
-
lifecycle:
|
|
3024
|
-
configuration:
|
|
3066
|
+
createdAt: z27.number(),
|
|
3067
|
+
origin: z27.object({ typeVersion: identifier }).strict().optional(),
|
|
3068
|
+
lifecycle: z27.enum(["active", "paused", "archived"]).default("active"),
|
|
3069
|
+
configuration: z27.object({
|
|
3025
3070
|
defaults: settingsValuesSchema,
|
|
3026
3071
|
overrides: settingsValuesSchema,
|
|
3027
|
-
preserved:
|
|
3072
|
+
preserved: z27.array(z27.string()),
|
|
3028
3073
|
presentation: questPresentationContentSchema.optional(),
|
|
3029
3074
|
presentationDefaults: questPresentationContentSchema.optional()
|
|
3030
3075
|
}).strict().optional()
|
|
3031
3076
|
})
|
|
3032
3077
|
);
|
|
3033
|
-
var templateSchema =
|
|
3034
|
-
code:
|
|
3078
|
+
var templateSchema = z27.object({
|
|
3079
|
+
code: z27.string(),
|
|
3035
3080
|
definition: questDescriptionSchema
|
|
3036
3081
|
});
|
|
3037
|
-
var quizAnswersSchema =
|
|
3082
|
+
var quizAnswersSchema = z27.record(identifier, identifier).refine(
|
|
3038
3083
|
(answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
|
|
3039
3084
|
"Provide between 1 and 50 answers"
|
|
3040
3085
|
).transform(
|
|
@@ -3042,17 +3087,17 @@ var quizAnswersSchema = z26.record(identifier, identifier).refine(
|
|
|
3042
3087
|
Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
|
|
3043
3088
|
)
|
|
3044
3089
|
);
|
|
3045
|
-
var quizEvidenceSchema =
|
|
3046
|
-
kind:
|
|
3090
|
+
var quizEvidenceSchema = z27.object({
|
|
3091
|
+
kind: z27.literal("quiz"),
|
|
3047
3092
|
release: identifier.optional(),
|
|
3048
3093
|
answers: quizAnswersSchema
|
|
3049
3094
|
}).strict();
|
|
3050
|
-
var submissionEvidenceSchema =
|
|
3095
|
+
var submissionEvidenceSchema = z27.union([
|
|
3051
3096
|
quizEvidenceSchema,
|
|
3052
3097
|
textEvidenceSchema,
|
|
3053
3098
|
urlEvidenceSchema
|
|
3054
3099
|
]);
|
|
3055
|
-
var submitSchema =
|
|
3100
|
+
var submitSchema = z27.object({
|
|
3056
3101
|
actionId: identifier,
|
|
3057
3102
|
quest: identifier,
|
|
3058
3103
|
member: identifier,
|
|
@@ -3060,7 +3105,7 @@ var submitSchema = z26.object({
|
|
|
3060
3105
|
input: submissionEvidenceSchema.optional(),
|
|
3061
3106
|
release: identifier.optional(),
|
|
3062
3107
|
/** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
|
|
3063
|
-
faultAfterReview:
|
|
3108
|
+
faultAfterReview: z27.boolean().optional()
|
|
3064
3109
|
}).strict();
|
|
3065
3110
|
var AttemptStatus = {
|
|
3066
3111
|
Queued: "queued",
|
|
@@ -3072,8 +3117,8 @@ var AttemptStatus = {
|
|
|
3072
3117
|
NeedsReview: "needs-review",
|
|
3073
3118
|
Failed: "failed"
|
|
3074
3119
|
};
|
|
3075
|
-
var attemptStatusSchema =
|
|
3076
|
-
var attemptSchema =
|
|
3120
|
+
var attemptStatusSchema = z27.string();
|
|
3121
|
+
var attemptSchema = z27.object({
|
|
3077
3122
|
id: identifier,
|
|
3078
3123
|
release: identifier,
|
|
3079
3124
|
quest: identifier,
|
|
@@ -3081,25 +3126,25 @@ var attemptSchema = z26.object({
|
|
|
3081
3126
|
evidence: identifier.nullable(),
|
|
3082
3127
|
input: submissionEvidenceSchema.optional(),
|
|
3083
3128
|
status: attemptStatusSchema,
|
|
3084
|
-
reason:
|
|
3085
|
-
retries:
|
|
3086
|
-
generation:
|
|
3087
|
-
completion:
|
|
3129
|
+
reason: z27.string().nullable(),
|
|
3130
|
+
retries: z27.number(),
|
|
3131
|
+
generation: z27.number(),
|
|
3132
|
+
completion: z27.string().nullable(),
|
|
3088
3133
|
reviewRewards: rewardBundleSchema.nullable().default(null),
|
|
3089
3134
|
/** Scheduled reruns advance this number; failure retries preserve it. */
|
|
3090
|
-
evaluationRun:
|
|
3091
|
-
deferCount:
|
|
3092
|
-
deferUntil:
|
|
3093
|
-
nextEvaluationAt:
|
|
3135
|
+
evaluationRun: z27.number().int().nonnegative().default(0),
|
|
3136
|
+
deferCount: z27.number().int().nonnegative().default(0),
|
|
3137
|
+
deferUntil: z27.number().int().safe().nullable().default(null),
|
|
3138
|
+
nextEvaluationAt: z27.number().int().safe().nullable().default(null),
|
|
3094
3139
|
/** Open code: consumers must tolerate new values. */
|
|
3095
|
-
code:
|
|
3140
|
+
code: z27.string().nullable().default(null),
|
|
3096
3141
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
3097
3142
|
/**
|
|
3098
3143
|
* The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
|
|
3099
3144
|
* with the evaluator's reason. Only set on a rejected attempt.
|
|
3100
3145
|
*/
|
|
3101
|
-
requestedReview:
|
|
3102
|
-
createdAt:
|
|
3146
|
+
requestedReview: z27.boolean().default(false),
|
|
3147
|
+
createdAt: z27.number()
|
|
3103
3148
|
});
|
|
3104
3149
|
var QuestSubmissionStatus = {
|
|
3105
3150
|
Open: "open",
|
|
@@ -3107,9 +3152,9 @@ var QuestSubmissionStatus = {
|
|
|
3107
3152
|
Discarded: "discarded",
|
|
3108
3153
|
Expired: "expired"
|
|
3109
3154
|
};
|
|
3110
|
-
var questSubmissionStatusSchema =
|
|
3155
|
+
var questSubmissionStatusSchema = z27.string();
|
|
3111
3156
|
var questSubmissionSchema = responseShape(
|
|
3112
|
-
|
|
3157
|
+
z27.object({
|
|
3113
3158
|
id: identifier,
|
|
3114
3159
|
quest: identifier,
|
|
3115
3160
|
member: identifier,
|
|
@@ -3119,85 +3164,85 @@ var questSubmissionSchema = responseShape(
|
|
|
3119
3164
|
/** An uploaded photo's evidence ID. */
|
|
3120
3165
|
evidence: identifier.nullable(),
|
|
3121
3166
|
/** Submitting was refused because the quest changed: review the draft before submitting again. */
|
|
3122
|
-
reviewRequired:
|
|
3167
|
+
reviewRequired: z27.boolean(),
|
|
3123
3168
|
status: questSubmissionStatusSchema,
|
|
3124
3169
|
/** The attempt a `submitted` submission admitted. */
|
|
3125
3170
|
attempt: identifier.nullable(),
|
|
3126
|
-
createdAt:
|
|
3127
|
-
updatedAt:
|
|
3171
|
+
createdAt: z27.number(),
|
|
3172
|
+
updatedAt: z27.number(),
|
|
3128
3173
|
/** When an open submission expires unless it changes again. */
|
|
3129
|
-
expiresAt:
|
|
3174
|
+
expiresAt: z27.number()
|
|
3130
3175
|
})
|
|
3131
3176
|
);
|
|
3132
|
-
var questSubmissionUpdateSchema =
|
|
3177
|
+
var questSubmissionUpdateSchema = z27.object({
|
|
3133
3178
|
release: identifier.nullable().optional(),
|
|
3134
3179
|
input: submissionEvidenceSchema.nullable().optional(),
|
|
3135
3180
|
evidence: identifier.nullable().optional()
|
|
3136
3181
|
}).strict();
|
|
3137
3182
|
var questSubmissionResultSchema = responseShape(
|
|
3138
|
-
|
|
3183
|
+
z27.object({
|
|
3139
3184
|
submission: questSubmissionSchema,
|
|
3140
3185
|
attempt: attemptSchema,
|
|
3141
|
-
replayed:
|
|
3186
|
+
replayed: z27.boolean()
|
|
3142
3187
|
})
|
|
3143
3188
|
);
|
|
3144
|
-
var eventSchema =
|
|
3145
|
-
id:
|
|
3146
|
-
attempt:
|
|
3147
|
-
kind:
|
|
3148
|
-
detail:
|
|
3149
|
-
actor:
|
|
3150
|
-
at:
|
|
3151
|
-
});
|
|
3152
|
-
var pickupSelectionSchema =
|
|
3189
|
+
var eventSchema = z27.object({
|
|
3190
|
+
id: z27.number(),
|
|
3191
|
+
attempt: z27.string().nullable(),
|
|
3192
|
+
kind: z27.string(),
|
|
3193
|
+
detail: z27.string(),
|
|
3194
|
+
actor: z27.string().nullable().default(null),
|
|
3195
|
+
at: z27.number()
|
|
3196
|
+
});
|
|
3197
|
+
var pickupSelectionSchema = z27.object({
|
|
3153
3198
|
item: identifier,
|
|
3154
|
-
revision:
|
|
3199
|
+
revision: z27.number().int().nonnegative()
|
|
3155
3200
|
}).strict();
|
|
3156
|
-
var pickupAllocationSchema =
|
|
3201
|
+
var pickupAllocationSchema = z27.object({
|
|
3157
3202
|
item: identifier,
|
|
3158
|
-
label:
|
|
3203
|
+
label: z27.string().min(1).max(80)
|
|
3159
3204
|
}).strict();
|
|
3160
|
-
var pickupPolicySchema =
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
kind:
|
|
3164
|
-
tiers:
|
|
3165
|
-
|
|
3205
|
+
var pickupPolicySchema = z27.discriminatedUnion("kind", [
|
|
3206
|
+
z27.object({ kind: z27.literal("untracked") }).strict(),
|
|
3207
|
+
z27.object({
|
|
3208
|
+
kind: z27.literal("at-pickup"),
|
|
3209
|
+
tiers: z27.array(
|
|
3210
|
+
z27.object({
|
|
3166
3211
|
tier: identifier,
|
|
3167
|
-
variants:
|
|
3212
|
+
variants: z27.array(pickupAllocationSchema).min(1).max(100)
|
|
3168
3213
|
}).strict()
|
|
3169
3214
|
).min(1).max(100)
|
|
3170
3215
|
}).strict()
|
|
3171
3216
|
]);
|
|
3172
|
-
var pickupCatalogSchema =
|
|
3217
|
+
var pickupCatalogSchema = z27.object({
|
|
3173
3218
|
reward: tieredRewardDefinitionSchema,
|
|
3174
|
-
revision:
|
|
3219
|
+
revision: z27.number().int().nonnegative(),
|
|
3175
3220
|
policy: pickupPolicySchema
|
|
3176
3221
|
});
|
|
3177
|
-
var pickupAvailabilitySchema =
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
kind:
|
|
3181
|
-
revision:
|
|
3182
|
-
variants:
|
|
3222
|
+
var pickupAvailabilitySchema = z27.discriminatedUnion("kind", [
|
|
3223
|
+
z27.object({ kind: z27.literal("untracked") }).strict(),
|
|
3224
|
+
z27.object({
|
|
3225
|
+
kind: z27.literal("at-pickup"),
|
|
3226
|
+
revision: z27.number().int().nonnegative(),
|
|
3227
|
+
variants: z27.array(
|
|
3183
3228
|
pickupAllocationSchema.extend({
|
|
3184
|
-
available:
|
|
3229
|
+
available: z27.number().int().nonnegative()
|
|
3185
3230
|
})
|
|
3186
3231
|
)
|
|
3187
3232
|
}).strict()
|
|
3188
3233
|
]);
|
|
3189
|
-
var configurePickupSchema =
|
|
3234
|
+
var configurePickupSchema = z27.object({
|
|
3190
3235
|
reward: identifier,
|
|
3191
|
-
revision:
|
|
3236
|
+
revision: z27.number().int().nonnegative(),
|
|
3192
3237
|
actionId: identifier,
|
|
3193
|
-
policy:
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
kind:
|
|
3197
|
-
tiers:
|
|
3198
|
-
|
|
3238
|
+
policy: z27.discriminatedUnion("kind", [
|
|
3239
|
+
z27.object({ kind: z27.literal("untracked") }).strict(),
|
|
3240
|
+
z27.object({
|
|
3241
|
+
kind: z27.literal("at-pickup"),
|
|
3242
|
+
tiers: z27.array(
|
|
3243
|
+
z27.object({
|
|
3199
3244
|
tier: identifier,
|
|
3200
|
-
variants:
|
|
3245
|
+
variants: z27.array(
|
|
3201
3246
|
pickupAllocationSchema.extend({
|
|
3202
3247
|
item: identifier.optional()
|
|
3203
3248
|
})
|
|
@@ -3207,10 +3252,10 @@ var configurePickupSchema = z26.object({
|
|
|
3207
3252
|
}).strict()
|
|
3208
3253
|
])
|
|
3209
3254
|
}).strict();
|
|
3210
|
-
var entitlementRecoverySchema =
|
|
3255
|
+
var entitlementRecoverySchema = z27.object({
|
|
3211
3256
|
completion: identifier,
|
|
3212
|
-
reason:
|
|
3213
|
-
flaggedAt:
|
|
3257
|
+
reason: z27.string(),
|
|
3258
|
+
flaggedAt: z27.number(),
|
|
3214
3259
|
/** Null means no accepted completion currently earns this reward. */
|
|
3215
3260
|
remainingTier: identifier.nullable()
|
|
3216
3261
|
});
|
|
@@ -3220,40 +3265,40 @@ var entitlementBase = {
|
|
|
3220
3265
|
reward: tieredRewardDefinitionSchema,
|
|
3221
3266
|
earnedTier: identifier,
|
|
3222
3267
|
tier: identifier,
|
|
3223
|
-
revision:
|
|
3268
|
+
revision: z27.number().int().positive()
|
|
3224
3269
|
};
|
|
3225
|
-
var entitlementStateSchema =
|
|
3226
|
-
|
|
3227
|
-
|
|
3270
|
+
var entitlementStateSchema = z27.discriminatedUnion("status", [
|
|
3271
|
+
z27.object({ ...entitlementBase, status: z27.literal("available") }).strict(),
|
|
3272
|
+
z27.object({
|
|
3228
3273
|
...entitlementBase,
|
|
3229
|
-
status:
|
|
3274
|
+
status: z27.literal("handing-over"),
|
|
3230
3275
|
handover: identifier,
|
|
3231
|
-
startedAt:
|
|
3276
|
+
startedAt: z27.number(),
|
|
3232
3277
|
allocation: pickupAllocationSchema.optional()
|
|
3233
3278
|
}).strict(),
|
|
3234
|
-
|
|
3279
|
+
z27.object({
|
|
3235
3280
|
...entitlementBase,
|
|
3236
|
-
status:
|
|
3281
|
+
status: z27.literal("collected"),
|
|
3237
3282
|
handover: identifier,
|
|
3238
|
-
startedAt:
|
|
3283
|
+
startedAt: z27.number(),
|
|
3239
3284
|
allocation: pickupAllocationSchema.optional(),
|
|
3240
|
-
collectedAt:
|
|
3285
|
+
collectedAt: z27.number(),
|
|
3241
3286
|
recovery: entitlementRecoverySchema.optional()
|
|
3242
3287
|
}).strict(),
|
|
3243
3288
|
// An operator voided it: it can no longer be handed over. A quest grant of the same reward to
|
|
3244
3289
|
// the member (the same grant key) makes it available again; a voided referral reward stays void.
|
|
3245
|
-
|
|
3290
|
+
z27.object({
|
|
3246
3291
|
...entitlementBase,
|
|
3247
|
-
status:
|
|
3248
|
-
voidedAt:
|
|
3292
|
+
status: z27.literal("void"),
|
|
3293
|
+
voidedAt: z27.number()
|
|
3249
3294
|
}).strict()
|
|
3250
3295
|
]);
|
|
3251
|
-
var tieredRewardReadSchema =
|
|
3296
|
+
var tieredRewardReadSchema = z27.object({
|
|
3252
3297
|
id: identifier,
|
|
3253
|
-
title:
|
|
3254
|
-
tiers:
|
|
3255
|
-
inventory:
|
|
3256
|
-
fulfillment:
|
|
3298
|
+
title: z27.string(),
|
|
3299
|
+
tiers: z27.array(z27.object({ id: identifier, title: z27.string() }).loose()),
|
|
3300
|
+
inventory: z27.object({ kind: z27.string() }).loose(),
|
|
3301
|
+
fulfillment: z27.object({ kind: z27.string() }).loose()
|
|
3257
3302
|
}).loose();
|
|
3258
3303
|
var entitlementReadBase = {
|
|
3259
3304
|
id: identifier,
|
|
@@ -3261,63 +3306,63 @@ var entitlementReadBase = {
|
|
|
3261
3306
|
reward: tieredRewardReadSchema,
|
|
3262
3307
|
earnedTier: identifier,
|
|
3263
3308
|
tier: identifier,
|
|
3264
|
-
revision:
|
|
3309
|
+
revision: z27.number().int()
|
|
3265
3310
|
};
|
|
3266
|
-
var allocationReadSchema =
|
|
3267
|
-
var entitlementSchema =
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3311
|
+
var allocationReadSchema = z27.object({ item: identifier, label: z27.string() }).loose();
|
|
3312
|
+
var entitlementSchema = z27.union([
|
|
3313
|
+
z27.discriminatedUnion("status", [
|
|
3314
|
+
z27.object({ ...entitlementReadBase, status: z27.literal("available") }).loose(),
|
|
3315
|
+
z27.object({
|
|
3271
3316
|
...entitlementReadBase,
|
|
3272
|
-
status:
|
|
3317
|
+
status: z27.literal("handing-over"),
|
|
3273
3318
|
handover: identifier,
|
|
3274
|
-
startedAt:
|
|
3319
|
+
startedAt: z27.number(),
|
|
3275
3320
|
allocation: allocationReadSchema.optional()
|
|
3276
3321
|
}).loose(),
|
|
3277
|
-
|
|
3322
|
+
z27.object({
|
|
3278
3323
|
...entitlementReadBase,
|
|
3279
|
-
status:
|
|
3324
|
+
status: z27.literal("collected"),
|
|
3280
3325
|
handover: identifier,
|
|
3281
|
-
startedAt:
|
|
3326
|
+
startedAt: z27.number(),
|
|
3282
3327
|
allocation: allocationReadSchema.optional(),
|
|
3283
|
-
collectedAt:
|
|
3328
|
+
collectedAt: z27.number(),
|
|
3284
3329
|
recovery: entitlementRecoverySchema.optional()
|
|
3285
3330
|
}).loose(),
|
|
3286
|
-
|
|
3331
|
+
z27.object({
|
|
3287
3332
|
...entitlementReadBase,
|
|
3288
|
-
status:
|
|
3289
|
-
voidedAt:
|
|
3333
|
+
status: z27.literal("void"),
|
|
3334
|
+
voidedAt: z27.number()
|
|
3290
3335
|
}).loose()
|
|
3291
3336
|
]),
|
|
3292
|
-
|
|
3337
|
+
z27.object({ ...entitlementReadBase, status: z27.string() }).loose().transform(({ status, ...entitlement }) => ({
|
|
3293
3338
|
...entitlement,
|
|
3294
3339
|
status: "unsupported",
|
|
3295
3340
|
reportedStatus: status
|
|
3296
3341
|
}))
|
|
3297
3342
|
]);
|
|
3298
|
-
var beginHandoverSchema =
|
|
3343
|
+
var beginHandoverSchema = z27.object({
|
|
3299
3344
|
actionId: identifier,
|
|
3300
|
-
revision:
|
|
3345
|
+
revision: z27.number().int().positive(),
|
|
3301
3346
|
selection: pickupSelectionSchema.optional()
|
|
3302
3347
|
}).strict();
|
|
3303
|
-
var confirmHandoverSchema =
|
|
3304
|
-
var entitlementCorrectionSchema =
|
|
3348
|
+
var confirmHandoverSchema = z27.object({ actionId: identifier, handover: identifier }).strict();
|
|
3349
|
+
var entitlementCorrectionSchema = z27.object({
|
|
3305
3350
|
actionId: identifier,
|
|
3306
|
-
revision:
|
|
3307
|
-
reason:
|
|
3351
|
+
revision: z27.number().int().positive(),
|
|
3352
|
+
reason: z27.string().trim().min(1).max(500)
|
|
3308
3353
|
}).strict();
|
|
3309
3354
|
var CompletionSourceKind = {
|
|
3310
3355
|
Quest: "quest",
|
|
3311
3356
|
Leaderboard: "leaderboard"
|
|
3312
3357
|
};
|
|
3313
|
-
var completionSourceKindSchema =
|
|
3314
|
-
var completionSourceSchema =
|
|
3358
|
+
var completionSourceKindSchema = z27.string().min(1).max(64);
|
|
3359
|
+
var completionSourceSchema = z27.object({
|
|
3315
3360
|
kind: completionSourceKindSchema,
|
|
3316
3361
|
id: identifier
|
|
3317
3362
|
});
|
|
3318
|
-
var completionRecordSchema =
|
|
3363
|
+
var completionRecordSchema = z27.object({
|
|
3319
3364
|
/** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
|
|
3320
|
-
key:
|
|
3365
|
+
key: z27.string().default("once"),
|
|
3321
3366
|
id: identifier,
|
|
3322
3367
|
/** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
|
|
3323
3368
|
quest: identifier,
|
|
@@ -3325,19 +3370,19 @@ var completionRecordSchema = z26.object({
|
|
|
3325
3370
|
/** What paid the completion. `source.id` repeats `quest`. */
|
|
3326
3371
|
source: completionSourceSchema.optional()
|
|
3327
3372
|
});
|
|
3328
|
-
var questAvailabilitySchema =
|
|
3329
|
-
|
|
3330
|
-
kind:
|
|
3331
|
-
input:
|
|
3373
|
+
var questAvailabilitySchema = z27.discriminatedUnion("kind", [
|
|
3374
|
+
z27.object({
|
|
3375
|
+
kind: z27.literal("available"),
|
|
3376
|
+
input: z27.enum(["photo", "quiz", "none", "text", "url"])
|
|
3332
3377
|
}).strict(),
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
kind:
|
|
3336
|
-
missing:
|
|
3378
|
+
z27.object({ kind: z27.literal("completed") }).strict(),
|
|
3379
|
+
z27.object({
|
|
3380
|
+
kind: z27.literal("locked"),
|
|
3381
|
+
missing: z27.array(missingPrerequisiteSchema).min(1)
|
|
3337
3382
|
}).strict(),
|
|
3338
|
-
|
|
3339
|
-
kind:
|
|
3340
|
-
reason:
|
|
3383
|
+
z27.object({
|
|
3384
|
+
kind: z27.literal("blocked"),
|
|
3385
|
+
reason: z27.enum([
|
|
3341
3386
|
"budget-exhausted",
|
|
3342
3387
|
"connection-required",
|
|
3343
3388
|
"wallet-required",
|
|
@@ -3346,152 +3391,152 @@ var questAvailabilitySchema = z26.discriminatedUnion("kind", [
|
|
|
3346
3391
|
"enrollment-required"
|
|
3347
3392
|
]),
|
|
3348
3393
|
/** Which window refused admission when `reason` is `outside-window`. */
|
|
3349
|
-
window:
|
|
3350
|
-
resetsAt:
|
|
3394
|
+
window: z27.enum(["tracker", "quest"]).optional(),
|
|
3395
|
+
resetsAt: z27.number().int().safe().optional()
|
|
3351
3396
|
}).strict(),
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3397
|
+
z27.object({ kind: z27.literal("staff-required") }).strict(),
|
|
3398
|
+
z27.object({ kind: z27.literal("automatic") }).strict(),
|
|
3399
|
+
z27.object({ kind: z27.literal("checking"), attempt: identifier }).strict(),
|
|
3400
|
+
z27.object({ kind: z27.literal("needs-review"), attempt: identifier }).strict(),
|
|
3401
|
+
z27.object({ kind: z27.literal("retryable"), attempt: identifier }).strict()
|
|
3357
3402
|
]);
|
|
3358
|
-
var questAvailabilityResponseSchema =
|
|
3403
|
+
var questAvailabilityResponseSchema = z27.union(
|
|
3359
3404
|
questAvailabilitySchema.options.map((option) => option.strip())
|
|
3360
3405
|
);
|
|
3361
|
-
var questBudgetViewSchema =
|
|
3406
|
+
var questBudgetViewSchema = z27.object({
|
|
3362
3407
|
id: identifier,
|
|
3363
|
-
scope:
|
|
3364
|
-
period:
|
|
3365
|
-
remaining:
|
|
3366
|
-
resetsAt:
|
|
3408
|
+
scope: z27.enum(["member", "project"]),
|
|
3409
|
+
period: z27.enum(["day", "week", "month", "lifetime"]),
|
|
3410
|
+
remaining: z27.number().int().safe().nonnegative(),
|
|
3411
|
+
resetsAt: z27.number().int().safe().nullable()
|
|
3367
3412
|
});
|
|
3368
3413
|
var memberProgressSchema = responseShape(
|
|
3369
|
-
|
|
3414
|
+
z27.object({
|
|
3370
3415
|
member: identifier,
|
|
3371
|
-
quests:
|
|
3372
|
-
|
|
3416
|
+
quests: z27.array(
|
|
3417
|
+
z27.object({
|
|
3373
3418
|
quest: identifier,
|
|
3374
3419
|
key: identifier.optional(),
|
|
3375
3420
|
release: identifier.optional(),
|
|
3376
|
-
title:
|
|
3421
|
+
title: z27.string(),
|
|
3377
3422
|
presentation: questPresentationSchema.default({}),
|
|
3378
|
-
connections:
|
|
3423
|
+
connections: z27.array(authProviderSchema).default([]),
|
|
3379
3424
|
trigger: triggerResponseSchema,
|
|
3380
3425
|
availability: questAvailabilityResponseSchema,
|
|
3381
|
-
completed:
|
|
3426
|
+
completed: z27.boolean(),
|
|
3382
3427
|
completion: completionPolicySchema.default({ kind: "once" }),
|
|
3383
3428
|
streak: streakProgressSchema.nullable().optional(),
|
|
3384
3429
|
counter: counterProgressSchema.nullable().optional(),
|
|
3385
3430
|
/** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
|
|
3386
3431
|
progress: evaluatorProgressSchema.nullable().default(null),
|
|
3387
|
-
completionCount:
|
|
3388
|
-
visibility:
|
|
3389
|
-
missing:
|
|
3432
|
+
completionCount: z27.number().int().nonnegative().default(0),
|
|
3433
|
+
visibility: z27.enum(["visible", "hidden"]).default("visible"),
|
|
3434
|
+
missing: z27.array(missingPrerequisiteSchema),
|
|
3390
3435
|
campaign: campaignViewSchema.nullable().default(null),
|
|
3391
3436
|
window: availabilityWindowSchema.nullable().default(null),
|
|
3392
|
-
budgets:
|
|
3437
|
+
budgets: z27.array(questBudgetViewSchema).default([]),
|
|
3393
3438
|
/**
|
|
3394
3439
|
* Unix milliseconds when the member may submit again, while the quest's retry cooldown
|
|
3395
3440
|
* after their rejected attempt runs. Until then a new attempt is refused with
|
|
3396
3441
|
* `retry-cooldown`. Absent when no cooldown is running.
|
|
3397
3442
|
*/
|
|
3398
|
-
retryAt:
|
|
3443
|
+
retryAt: z27.number().int().safe().optional(),
|
|
3399
3444
|
attempt: attemptSchema.nullable()
|
|
3400
3445
|
})
|
|
3401
3446
|
),
|
|
3402
|
-
entitlements:
|
|
3447
|
+
entitlements: z27.array(entitlementSchema)
|
|
3403
3448
|
})
|
|
3404
3449
|
);
|
|
3405
3450
|
var snapshotSchema = responseShape(
|
|
3406
|
-
|
|
3407
|
-
releases:
|
|
3408
|
-
completions:
|
|
3409
|
-
entitlements:
|
|
3410
|
-
attempts:
|
|
3411
|
-
balances:
|
|
3412
|
-
|
|
3413
|
-
member:
|
|
3414
|
-
balance:
|
|
3415
|
-
earned:
|
|
3416
|
-
held:
|
|
3417
|
-
available:
|
|
3451
|
+
z27.object({
|
|
3452
|
+
releases: z27.array(publishedReleaseSchema),
|
|
3453
|
+
completions: z27.array(completionRecordSchema),
|
|
3454
|
+
entitlements: z27.array(entitlementSchema),
|
|
3455
|
+
attempts: z27.array(attemptSchema),
|
|
3456
|
+
balances: z27.array(
|
|
3457
|
+
z27.object({
|
|
3458
|
+
member: z27.string(),
|
|
3459
|
+
balance: z27.string(),
|
|
3460
|
+
earned: z27.number(),
|
|
3461
|
+
held: z27.number(),
|
|
3462
|
+
available: z27.number()
|
|
3418
3463
|
})
|
|
3419
3464
|
),
|
|
3420
|
-
events:
|
|
3465
|
+
events: z27.array(eventSchema)
|
|
3421
3466
|
})
|
|
3422
3467
|
);
|
|
3423
|
-
var evidenceSchema =
|
|
3468
|
+
var evidenceSchema = z27.object({
|
|
3424
3469
|
id: identifier,
|
|
3425
3470
|
member: identifier,
|
|
3426
|
-
type:
|
|
3427
|
-
size:
|
|
3471
|
+
type: z27.enum(["image/jpeg", "image/png"]),
|
|
3472
|
+
size: z27.number()
|
|
3428
3473
|
});
|
|
3429
|
-
var errorSchema =
|
|
3430
|
-
error:
|
|
3431
|
-
code:
|
|
3474
|
+
var errorSchema = z27.object({
|
|
3475
|
+
error: z27.string(),
|
|
3476
|
+
code: z27.string().optional(),
|
|
3432
3477
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
3433
|
-
window:
|
|
3434
|
-
missing:
|
|
3478
|
+
window: z27.enum(["tracker", "quest"]).optional(),
|
|
3479
|
+
missing: z27.array(missingPrerequisiteSchema).optional(),
|
|
3435
3480
|
/** Unix milliseconds when the member may submit again, when `code` is `retry-cooldown`. */
|
|
3436
|
-
retryAt:
|
|
3481
|
+
retryAt: z27.number().int().safe().optional()
|
|
3437
3482
|
});
|
|
3438
|
-
var staffDecisionSchema =
|
|
3483
|
+
var staffDecisionSchema = z27.object({
|
|
3439
3484
|
actionId: identifier,
|
|
3440
|
-
generation:
|
|
3441
|
-
decision:
|
|
3442
|
-
reason:
|
|
3485
|
+
generation: z27.number().int().nonnegative(),
|
|
3486
|
+
decision: z27.enum(["accept", "reject"]),
|
|
3487
|
+
reason: z27.string().trim().min(1).max(2e3)
|
|
3443
3488
|
}).strict();
|
|
3444
|
-
var stockSchema =
|
|
3445
|
-
var reservationSchema =
|
|
3489
|
+
var stockSchema = z27.object({ item: identifier, quantity: z27.number().int().min(0).max(1e4) }).strict();
|
|
3490
|
+
var reservationSchema = z27.object({
|
|
3446
3491
|
actionId: identifier,
|
|
3447
3492
|
member: identifier,
|
|
3448
3493
|
item: identifier,
|
|
3449
3494
|
balance: identifier,
|
|
3450
|
-
price:
|
|
3495
|
+
price: z27.number().int().positive().max(1e4)
|
|
3451
3496
|
}).strict();
|
|
3452
3497
|
var pageOptions = {
|
|
3453
|
-
limit:
|
|
3454
|
-
cursor:
|
|
3498
|
+
limit: z27.number().int().min(1).max(100).default(25),
|
|
3499
|
+
cursor: z27.string().min(1).max(4096).optional()
|
|
3455
3500
|
};
|
|
3456
|
-
var reviewListSchema =
|
|
3501
|
+
var reviewListSchema = z27.object({
|
|
3457
3502
|
...pageOptions,
|
|
3458
3503
|
member: identifier.optional(),
|
|
3459
3504
|
quest: identifier.optional()
|
|
3460
3505
|
}).strict();
|
|
3461
|
-
var memberListSchema =
|
|
3506
|
+
var memberListSchema = z27.object({
|
|
3462
3507
|
...pageOptions,
|
|
3463
3508
|
prefix: identifier.optional()
|
|
3464
3509
|
}).strict();
|
|
3465
|
-
var reviewItemSchema =
|
|
3510
|
+
var reviewItemSchema = z27.object({
|
|
3466
3511
|
attempt: attemptSchema,
|
|
3467
|
-
title:
|
|
3468
|
-
checks:
|
|
3469
|
-
|
|
3512
|
+
title: z27.string(),
|
|
3513
|
+
checks: z27.array(
|
|
3514
|
+
z27.object({ criteria: z27.string(), result: photoResultSchema })
|
|
3470
3515
|
)
|
|
3471
3516
|
});
|
|
3472
|
-
var reviewPageSchema =
|
|
3473
|
-
items:
|
|
3474
|
-
nextCursor:
|
|
3517
|
+
var reviewPageSchema = z27.object({
|
|
3518
|
+
items: z27.array(reviewItemSchema).max(100),
|
|
3519
|
+
nextCursor: z27.string().nullable()
|
|
3475
3520
|
});
|
|
3476
|
-
var memberPageSchema =
|
|
3477
|
-
items:
|
|
3478
|
-
nextCursor:
|
|
3521
|
+
var memberPageSchema = z27.object({
|
|
3522
|
+
items: z27.array(z27.object({ member: identifier })).max(100),
|
|
3523
|
+
nextCursor: z27.string().nullable()
|
|
3479
3524
|
});
|
|
3480
|
-
var createStockItemSchema =
|
|
3481
|
-
var stockItemSchema =
|
|
3482
|
-
var contentPerformanceSnapshotSchema =
|
|
3525
|
+
var createStockItemSchema = z27.object({ actionId: identifier, name: z27.string().trim().min(1).max(80) }).strict();
|
|
3526
|
+
var stockItemSchema = z27.object({ id: identifier, name: z27.string() });
|
|
3527
|
+
var contentPerformanceSnapshotSchema = z27.strictObject({
|
|
3483
3528
|
contentAttempt: identifier,
|
|
3484
3529
|
observation: identifier,
|
|
3485
|
-
observedAt:
|
|
3530
|
+
observedAt: z27.number().int().safe().nonnegative(),
|
|
3486
3531
|
metrics: contentMetricsSchema,
|
|
3487
3532
|
rewards: rewardBundleSchema
|
|
3488
3533
|
});
|
|
3489
3534
|
var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
|
|
3490
|
-
content:
|
|
3535
|
+
content: z27.string().min(1).max(256)
|
|
3491
3536
|
});
|
|
3492
|
-
var contentPerformancePageSchema =
|
|
3493
|
-
current:
|
|
3494
|
-
state:
|
|
3537
|
+
var contentPerformancePageSchema = z27.strictObject({
|
|
3538
|
+
current: z27.strictObject({
|
|
3539
|
+
state: z27.enum([
|
|
3495
3540
|
"content-pending",
|
|
3496
3541
|
"content-unqualified",
|
|
3497
3542
|
"waiting",
|
|
@@ -3502,19 +3547,19 @@ var contentPerformancePageSchema = z26.strictObject({
|
|
|
3502
3547
|
"failed",
|
|
3503
3548
|
"superseded"
|
|
3504
3549
|
]),
|
|
3505
|
-
reason:
|
|
3550
|
+
reason: z27.string().nullable(),
|
|
3506
3551
|
contentAttempt: identifier,
|
|
3507
3552
|
attempt: identifier.nullable(),
|
|
3508
3553
|
reward: contentQualificationSchema.shape.reward
|
|
3509
3554
|
}),
|
|
3510
|
-
items:
|
|
3511
|
-
|
|
3555
|
+
items: z27.array(
|
|
3556
|
+
z27.strictObject({
|
|
3512
3557
|
attempt: identifier,
|
|
3513
3558
|
contentAttempt: identifier,
|
|
3514
3559
|
observation: identifier,
|
|
3515
|
-
observedAt:
|
|
3560
|
+
observedAt: z27.number(),
|
|
3516
3561
|
metrics: contentMetricsSchema,
|
|
3517
|
-
state:
|
|
3562
|
+
state: z27.enum([
|
|
3518
3563
|
"pending",
|
|
3519
3564
|
"qualified",
|
|
3520
3565
|
"unqualified",
|
|
@@ -3522,7 +3567,7 @@ var contentPerformancePageSchema = z26.strictObject({
|
|
|
3522
3567
|
"failed",
|
|
3523
3568
|
"superseded"
|
|
3524
3569
|
]),
|
|
3525
|
-
reason:
|
|
3570
|
+
reason: z27.string().nullable()
|
|
3526
3571
|
})
|
|
3527
3572
|
),
|
|
3528
3573
|
nextCursor: pageCursorSchema.nullable()
|
|
@@ -3672,6 +3717,12 @@ export {
|
|
|
3672
3717
|
trackerContentStageSchema,
|
|
3673
3718
|
trackerTriggerContextSchema,
|
|
3674
3719
|
maxPointsAmount,
|
|
3720
|
+
sdkRuntimeLimits,
|
|
3721
|
+
sdkRuntimeModulePathSchema,
|
|
3722
|
+
sdkRuntimeReferenceSchema,
|
|
3723
|
+
sdkRuntimeModulesSchema,
|
|
3724
|
+
sdkRuntimeSchema,
|
|
3725
|
+
sdkRuntimeDigest,
|
|
3675
3726
|
completionPolicySchema,
|
|
3676
3727
|
completionKeySchema,
|
|
3677
3728
|
budgetSchema,
|