🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

next-rest-framework

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-rest-framework - npm Package Compare versions

Comparing version

to
0.3.4

6

dist/utils/schemas.d.ts
import { OpenAPIV3_1 } from 'openapi-types';
import { z } from 'zod';
import { ZodSchema } from 'zod';
import { BaseObjectSchemaType, BaseSchemaType } from '../types';
export declare const isZodSchema: (schema: unknown) => schema is z.ZodType<any, z.ZodTypeDef, any>;
export declare const convertZodSchema: (schema: z.ZodSchema) => {};
export declare const isZodSchema: (schema: unknown) => schema is ZodSchema<any, import("zod").ZodTypeDef, any>;
export declare const convertZodSchema: (schema: ZodSchema) => {};
export declare const validateSchema: ({ schema, obj }: {

@@ -7,0 +7,0 @@ schema: BaseSchemaType;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSchemaKeys = exports.getJsonSchema = exports.validateSchema = exports.convertZodSchema = exports.isZodSchema = void 0;
const yup = __importStar(require("yup"));
const isZodSchema = (schema) => !!schema && typeof schema === 'object' && '_def' in schema;

@@ -121,2 +97,3 @@ exports.isZodSchema = isZodSchema;

const isYupSchema = (schema) => !!schema && typeof schema === 'object' && 'spec' in schema;
const isYupValidationError = (error) => error instanceof Error && 'inner' in error;
const yupSchemaValidator = async ({ schema, obj }) => {

@@ -130,3 +107,3 @@ let valid = true;

valid = false;
if (e instanceof yup.ValidationError) {
if (isYupValidationError(e)) {
errors = e.errors;

@@ -133,0 +110,0 @@ }

{
"name": "next-rest-framework",
"version": "0.3.3",
"version": "0.3.4",
"description": "Next REST Framework - write type-safe, self-documenting REST APIs in Next.js",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet