@skyblock-finance/actions
Version:
This package contains actions players can take in Hypixel Skyblock
57 lines (56 loc) • 1.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.actionSchema = exports.actionPlaceSchema = exports.actionIoSchema = exports.actionIoCurrencySchema = exports.actionIoItemSchema = void 0;
const zod_1 = require("zod");
exports.actionIoItemSchema = zod_1.z
.object({
amount: zod_1.z.number().finite(),
id: zod_1.z.string(),
type: zod_1.z.literal('item'),
})
.strict();
exports.actionIoCurrencySchema = zod_1.z
.object({
amount: zod_1.z.number().finite(),
id: zod_1.z.enum(['bit', 'coin', 'gem', 'north-star', 'pest', 'second', 'usd']),
type: zod_1.z.literal('currency'),
})
.strict();
exports.actionIoSchema = zod_1.z.discriminatedUnion('type', [
exports.actionIoCurrencySchema,
exports.actionIoItemSchema,
]);
exports.actionPlaceSchema = zod_1.z.discriminatedUnion('type', [
zod_1.z
.object({
left: exports.actionIoItemSchema,
right: exports.actionIoItemSchema,
type: zod_1.z.literal('anvil'),
})
.strict(),
zod_1.z
.object({
id: zod_1.z.string(),
type: zod_1.z.literal('npc'),
})
.strict(),
zod_1.z
.object({
type: zod_1.z.literal('website'),
url: zod_1.z.string().url(),
})
.strict(),
zod_1.z
.object({
grid: zod_1.z.array(exports.actionIoItemSchema.nullable()).length(9),
type: zod_1.z.literal('workbench'),
})
.strict(),
]);
exports.actionSchema = zod_1.z
.object({
inputs: zod_1.z.array(exports.actionIoSchema),
outputs: zod_1.z.array(exports.actionIoSchema),
place: zod_1.z.array(exports.actionPlaceSchema),
})
.strict();