New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kubernetes-models/validate

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kubernetes-models/validate - npm Package Compare versions

Comparing version 0.0.0-20230407125710 to 0.0.0-20240401155416

dist/formats.d.ts

4

dist/index.d.ts

@@ -1,2 +0,2 @@

export { register } from "./ajv";
export { validate } from "./validate";
export { formats, addFormats } from "./formats";
export { ValidateFunc, runValidateFunc } from "./validate";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validate = exports.register = void 0;
var ajv_1 = require("./ajv.js");
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return ajv_1.register; } });
exports.runValidateFunc = exports.addFormats = exports.formats = void 0;
var formats_1 = require("./formats.js");
Object.defineProperty(exports, "formats", { enumerable: true, get: function () { return formats_1.formats; } });
Object.defineProperty(exports, "addFormats", { enumerable: true, get: function () { return formats_1.addFormats; } });
var validate_1 = require("./validate.js");
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_1.validate; } });
Object.defineProperty(exports, "runValidateFunc", { enumerable: true, get: function () { return validate_1.runValidateFunc; } });
//# sourceMappingURL=index.js.map

@@ -1,1 +0,6 @@

export declare function validate(id: string, data: unknown): void;
import type { ErrorObject } from "ajv";
export interface ValidateFunc<T> {
(data: unknown): data is T;
errors?: ErrorObject[] | null;
}
export declare function runValidateFunc<T>(fn: ValidateFunc<T>, data: unknown): asserts data is T;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validate = void 0;
exports.runValidateFunc = void 0;
const tslib_1 = require("tslib");
const ajv_1 = tslib_1.__importDefault(require("ajv"));
const ajv_2 = require("./ajv.js");
const validation_error_1 = tslib_1.__importDefault(require("ajv/dist/runtime/validation_error"));
function excludeNullableRefErrors(errors) {

@@ -50,11 +49,18 @@ const result = [];

}
function validate(id, data) {
if (!ajv_2.ajv.validate(id, data) && ajv_2.ajv.errors) {
const errors = excludeNullableRefErrors(ajv_2.ajv.errors);
const err = new ajv_1.default.ValidationError(errors);
err.message = ajv_2.ajv.errorsText(errors);
function generateErrorMessage(errors) {
return errors
.map((err) => `data${err.instancePath} ${err.message}`)
.join(", ");
}
function runValidateFunc(fn, data) {
if (!fn(data) && fn.errors) {
const errors = excludeNullableRefErrors(fn.errors);
if (!errors.length)
return;
const err = new validation_error_1.default(errors);
err.message = generateErrorMessage(errors);
throw err;
}
}
exports.validate = validate;
exports.runValidateFunc = runValidateFunc;
//# sourceMappingURL=validate.js.map
{
"name": "@kubernetes-models/validate",
"version": "0.0.0-20230407125710",
"version": "0.0.0-20240401155416",
"main": "dist/index.js",

@@ -9,5 +9,12 @@ "module": "dist/index.mjs",

"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./runtime/*": {
"types": "./dist/runtime/*.d.ts",
"import": "./dist/runtime/*.mjs",
"require": "./dist/runtime/*.js"
}
},

@@ -37,4 +44,6 @@ "description": "Validation library for Kubernetes models.",

"dependencies": {
"ajv": "^8.11.0",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"ajv-formats-draft2019": "^1.6.1",
"is-cidr": "^4.0.0",
"tslib": "^2.4.0"

@@ -41,0 +50,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc