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-202145103037 to 0.0.0-202177121237

2

dist/ajv.d.ts
import Ajv from "ajv";
export declare const ajv: Ajv.Ajv;
export declare const ajv: Ajv;
export declare function register(id: string, schema: object): void;

@@ -6,8 +6,18 @@ "use strict";

const ajv_1 = tslib_1.__importDefault(require("ajv"));
const ajv_formats_1 = tslib_1.__importDefault(require("ajv-formats"));
// From: https://github.com/miguelmota/is-base64/blob/0702e189090921a2f11b4342f27906ff8c43d7ec/is-base64.js#L15
const rBase64 = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
// https://github.com/kubernetes/apimachinery/blob/8c18d83/pkg/api/resource/quantity.go
const rSignedNumber = /[+-]?(?:\d+|\d+\.\d+|\d+\.|\.\d+)/;
// https://physics.nist.gov/cuu/Units/binary.html
const rBinarySI = /[KMGTPE]i/;
// https://en.wikipedia.org/wiki/Metric_prefix#List_of_SI_prefixes
const rDecimalSI = /(?:[YZEPTGMkhdcmunpfazy]|da)/;
const rDecimalExponent = new RegExp(`[eE]${rSignedNumber.source}`);
const rQuantitySuffix = new RegExp(`(?:${rBinarySI.source}|${rDecimalSI.source}|${rDecimalExponent.source})?`);
const rQuantity = new RegExp(`^${rSignedNumber.source}${rQuantitySuffix.source}$`);
exports.ajv = new ajv_1.default({
extendRefs: "fail",
format: "full"
strictTypes: false
});
ajv_formats_1.default(exports.ajv);
// eslint-disable-next-line @typescript-eslint/ban-types

@@ -20,41 +30,15 @@ function register(id, schema) {

exports.register = register;
function intFormat(bits) {
const max = BigInt(2) ** BigInt(bits - 1) - BigInt(1);
const min = BigInt(-2) ** BigInt(bits - 1);
return {
validate(input) {
const n = BigInt(input);
return n >= min && n <= max;
},
compare(a, b) {
const diff = BigInt(a) - BigInt(b);
if (diff > 0)
return 1;
if (diff < 0)
return -1;
return 0;
},
type: "number"
};
}
exports.ajv.addFormat("int32", intFormat(32));
exports.ajv.addFormat("int64", intFormat(64));
exports.ajv.addFormat("float", {
type: "number",
validate() {
return true;
}
exports.ajv.addFormat("byte", {
type: "string",
validate: (value) => rBase64.test(value)
});
exports.ajv.addFormat("double", {
type: "number",
validate() {
return true;
}
exports.ajv.addFormat("quantity", {
type: "string",
validate: rQuantity
});
exports.ajv.addFormat("byte", {
// This format is used in Istio.
exports.ajv.addFormat("string", {
type: "string",
validate(input) {
return rBase64.test(input);
}
validate: (value) => typeof value === "string"
});
//# sourceMappingURL=ajv.js.map
{
"name": "@kubernetes-models/validate",
"version": "0.0.0-202145103037",
"version": "0.0.0-202177121237",
"main": "dist/index.js",

@@ -32,8 +32,9 @@ "module": "dist/index.mjs",

"engines": {
"node": ">=10.4.0"
"node": ">=12"
},
"dependencies": {
"ajv": "^6.12.6",
"tslib": "^2.0.3"
"ajv": "^8.6.2",
"ajv-formats": "^2.1.0",
"tslib": "^2.3.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

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