
Research
6 Malicious Packagist Themes Ship Trojanized jQuery and FUNNULL Redirect Payloads
Six malicious Packagist packages posing as OphimCMS themes contain trojanized jQuery that exfiltrates URLs, injects ads, and loads FUNNULL-linked redirects.
@xylabs/zod
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
@xylabs/zod
| Interface | Description |
|---|---|
| ZodFactoryConfigObject | Configuration object for zod factory functions, providing a name for error messages. |
| Type Alias | Description |
|---|---|
| ZodFactoryConfig | Configuration for zod factory assertion behavior, either an AssertConfig or a named config object. |
| AllZodFactories | - |
| Function | Description |
|---|---|
| zodAllFactory | Creates a bundle of is, as, and to factory functions for a given zod schema. |
| zodAsAsyncFactory | Creates an async function that validates a value against a zod schema and returns it with a narrowed type. Uses safeParseAsync for schemas with async refinements. When called without an assert config, returns undefined on failure. |
| zodAsFactory | Creates a function that validates a value against a zod schema and returns it with a narrowed type. When called without an assert config, returns undefined on failure. When called with an assert config, throws on failure. |
| zodIsFactory | Creates a type guard function that checks if a value matches a zod schema. |
| zodToAsyncFactory | Creates an async function that converts a value to the zod schema type, delegating to zodAsAsyncFactory internally. Provides overloads for optional assertion: without assert config resolves to undefined on failure, with assert config throws on failure. |
| zodToFactory | Creates a function that converts a value to the zod schema type, delegating to zodAsFactory internally. Provides overloads for optional assertion: without assert config returns undefined on failure, with assert config throws on failure. |
function zodAllFactory<T, TName>(zod: ZodType<T>, name: TName): {
[key: string]: {
<T> (value: T): T & T | undefined;
<T> (value: T, assert: ZodFactoryConfig): T & T;
};
};
Alpha
Creates a bundle of is, as, and to factory functions for a given zod schema.
| Type Parameter |
|---|
T |
TName extends string |
| Parameter | Type | Description |
|---|---|---|
zod | ZodType<T> | The zod schema to validate against |
name | TName | The name used to suffix the generated function names (e.g. 'Address' produces isAddress, asAddress, toAddress) |
{
[key: string]: {
<T> (value: T): T & T | undefined;
<T> (value: T, assert: ZodFactoryConfig): T & T;
};
}
An object containing is<Name>, as<Name>, and to<Name> functions
function zodAsAsyncFactory<TZod>(zod: ZodType<TZod>, name: string): {
<T> (value: T): Promise<T & TZod | undefined>;
<T> (value: T, assert: ZodFactoryConfig): Promise<T & TZod>;
};
Creates an async function that validates a value against a zod schema and returns it with a narrowed type.
Uses safeParseAsync for schemas with async refinements. When called without an assert config, returns undefined on failure.
| Type Parameter |
|---|
TZod |
| Parameter | Type | Description |
|---|---|---|
zod | ZodType<TZod> | The zod schema to validate against |
name | string | A name used in error messages for identification |
An async function that validates and narrows the type of a value
<T>(value: T): Promise<T & TZod | undefined>;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
Promise<T & TZod | undefined>
<T>(value: T, assert: ZodFactoryConfig): Promise<T & TZod>;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
assert | ZodFactoryConfig |
Promise<T & TZod>
function zodAsFactory<TZod>(zod: ZodType<TZod>, name: string): {
<T> (value: T): T & TZod | undefined;
<T> (value: T, assert: ZodFactoryConfig): T & TZod;
};
Creates a function that validates a value against a zod schema and returns it with a narrowed type. When called without an assert config, returns undefined on failure. When called with an assert config, throws on failure.
| Type Parameter |
|---|
TZod |
| Parameter | Type | Description |
|---|---|---|
zod | ZodType<TZod> | The zod schema to validate against |
name | string | A name used in error messages for identification |
A function that validates and narrows the type of a value
<T>(value: T): T & TZod | undefined;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
T & TZod | undefined
<T>(value: T, assert: ZodFactoryConfig): T & TZod;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
assert | ZodFactoryConfig |
T & TZod
function zodIsFactory<TZod>(zod: ZodType<TZod>): <T>(value: T) => value is T & TZod;
Creates a type guard function that checks if a value matches a zod schema.
| Type Parameter |
|---|
TZod |
| Parameter | Type | Description |
|---|---|---|
zod | ZodType<TZod> | The zod schema to validate against |
A type guard function that returns true if the value passes validation
<T>(value: T): value is T & TZod;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
value is T & TZod
function zodToAsyncFactory<TZod>(zod: ZodType<TZod>, name: string): {
<T> (value: T): Promise<T & TZod | undefined>;
<T> (value: T, assert: ZodFactoryConfig): Promise<T & TZod>;
};
Creates an async function that converts a value to the zod schema type, delegating to zodAsAsyncFactory internally.
Provides overloads for optional assertion: without assert config resolves to undefined on failure, with assert config throws on failure.
| Type Parameter |
|---|
TZod |
| Parameter | Type | Description |
|---|---|---|
zod | ZodType<TZod> | The zod schema to validate against |
name | string | A name used in error messages for identification |
An async function that validates and converts a value to the schema type
<T>(value: T): Promise<T & TZod | undefined>;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
Promise<T & TZod | undefined>
<T>(value: T, assert: ZodFactoryConfig): Promise<T & TZod>;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
assert | ZodFactoryConfig |
Promise<T & TZod>
function zodToFactory<TZod>(zod: ZodType<TZod>, name: string): {
<T> (value: T): T & TZod | undefined;
<T> (value: T, assert: ZodFactoryConfig): T & TZod;
};
Creates a function that converts a value to the zod schema type, delegating to zodAsFactory internally.
Provides overloads for optional assertion: without assert config returns undefined on failure, with assert config throws on failure.
| Type Parameter |
|---|
TZod |
| Parameter | Type | Description |
|---|---|---|
zod | ZodType<TZod> | The zod schema to validate against |
name | string | A name used in error messages for identification |
A function that validates and converts a value to the schema type
<T>(value: T): T & TZod | undefined;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
T & TZod | undefined
<T>(value: T, assert: ZodFactoryConfig): T & TZod;
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
assert | ZodFactoryConfig |
T & TZod
Configuration object for zod factory functions, providing a name for error messages.
| Property | Type |
|---|---|
name | string |
type AllZodFactories<TType, TName> = { [K in `is${TName}`]: ReturnType<typeof zodIsFactory> } & { [K in `as${TName}`]: ReturnType<typeof zodAsFactory> } & { [K in `to${TName}`]: ReturnType<typeof zodToFactory> };
Alpha
| Type Parameter |
|---|
TType |
TName extends string |
type ZodFactoryConfig =
| AssertConfig
| ZodFactoryConfigObject;
Configuration for zod factory assertion behavior, either an AssertConfig or a named config object.
Part of sdk-js
See the LICENSE file for license details
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/zod receives a total of 959 weekly downloads. As such, @xylabs/zod popularity was classified as not popular.
We found that @xylabs/zod demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Six malicious Packagist packages posing as OphimCMS themes contain trojanized jQuery that exfiltrates URLs, injects ads, and loads FUNNULL-linked redirects.

Security News
The GCVE initiative operated by CIRCL has officially opened its publishing ecosystem, letting organizations issue and share vulnerability identifiers without routing through a central authority.

Security News
The project is retiring its odd/even release model in favor of a simpler annual cadence where every major version becomes LTS.