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