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