New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@sinclair/typebox-codegen

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinclair/typebox-codegen - npm Package Compare versions

Comparing version
0.10.5
to
0.11.0
+0
-0
model/model-to-io-ts.js

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

+4
-1
import { TypeBoxModel } from './model';
export interface ModelToValibotSettings {
exactOptionalPropertyTypes: boolean;
}
export declare namespace ModelToValibot {
function Generate(model: TypeBoxModel): string;
function Generate(model: TypeBoxModel, options?: ModelToValibotSettings): string;
}

@@ -35,2 +35,3 @@ "use strict";

// --------------------------------------------------------------------------
// prettier-ignore
var ModelToValibot;

@@ -94,3 +95,2 @@ (function (ModelToValibot) {

function Literal(schema) {
// prettier-ignore
return typeof schema.const === `string`

@@ -104,3 +104,3 @@ ? Type(`v.literal`, `'${schema.const}'`, [])

function Null(schema) {
return Type(`v.null_`, null, []);
return Type(`v.null`, null, []);
}

@@ -128,7 +128,10 @@ function String(schema) {

function Object(schema) {
// prettier-ignore
const properties = globalThis.Object.entries(schema.properties).map(([key, value]) => {
const optional = Types.TypeGuard.IsOptional(value);
const property = index_1.PropertyEncoder.Encode(key);
return optional ? `${property}: v.optional(${Visit(value)})` : `${property}: ${Visit(value)}`;
return optional
? settings.exactOptionalPropertyTypes
? `${property}: v.exactOptional(${Visit(value)})`
: `${property}: v.optional(${Visit(value)})`
: `${property}: ${Visit(value)}`;
}).join(`,`);

@@ -175,3 +178,3 @@ const constraints = [];

function Undefined(schema) {
return Type(`v.undefined_`, null, []);
return Type(`v.undefined`, null, []);
}

@@ -186,3 +189,3 @@ function Union(schema) {

function Void(schema) {
return Type(`v.void_`, null, []);
return Type(`v.void`, null, []);
}

@@ -277,3 +280,9 @@ function UnsupportedType(schema) {

const emitted_set = new Set();
function Generate(model) {
const settings = {
exactOptionalPropertyTypes: false
};
function Generate(model, options = {
exactOptionalPropertyTypes: false
}) {
settings.exactOptionalPropertyTypes = options.exactOptionalPropertyTypes;
reference_map.clear();

@@ -280,0 +289,0 @@ recursive_set.clear();

@@ -0,0 +0,0 @@ "use strict";

{
"name": "@sinclair/typebox-codegen",
"version": "0.10.5",
"version": "0.11.0",
"description": "Code Generation Tools for TypeBox",

@@ -5,0 +5,0 @@ "main": "index.js",