Linux v69820.1blu.de 4.15.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
Apache/2.4.58
Server IP : 195.90.215.149 & Your IP : 216.73.217.80
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
share /
nodejs /
ajv /
lib /
vocabularies /
jtd /
Delete
Unzip
Name
Size
Permission
Date
Action
discriminator.ts
2.59
KB
-rw-r--r--
2023-12-16 08:36
elements.ts
976
B
-rw-r--r--
2023-12-16 08:36
enum.ts
1.59
KB
-rw-r--r--
2023-12-16 08:36
error.ts
746
B
-rw-r--r--
2023-12-16 08:36
index.ts
1007
B
-rw-r--r--
2023-12-16 08:36
metadata.ts
716
B
-rw-r--r--
2023-12-16 08:36
nullable.ts
649
B
-rw-r--r--
2023-12-16 08:36
optionalProperties.ts
394
B
-rw-r--r--
2023-12-16 08:36
properties.ts
6.1
KB
-rw-r--r--
2023-12-16 08:36
ref.ts
2.29
KB
-rw-r--r--
2023-12-16 08:36
type.ts
2.49
KB
-rw-r--r--
2023-12-16 08:36
union.ts
292
B
-rw-r--r--
2023-12-16 08:36
values.ts
1.64
KB
-rw-r--r--
2023-12-16 08:36
Save
Rename
import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" import type {KeywordCxt} from "../../compile/validate" import {_, nil, or, Code} from "../../compile/codegen" import validTimestamp from "../../runtime/timestamp" import {useFunc} from "../../compile/util" import {checkMetadata} from "./metadata" import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" export type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType> export type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" export const intRange: {[T in IntType]: [number, number, number]} = { int8: [-128, 127, 3], uint8: [0, 255, 3], int16: [-32768, 32767, 5], uint16: [0, 65535, 5], int32: [-2147483648, 2147483647, 10], uint32: [0, 4294967295, 10], } export type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType const error: KeywordErrorDefinition = { message: (cxt) => typeErrorMessage(cxt, cxt.schema), params: (cxt) => typeErrorParams(cxt, cxt.schema), } function timestampCode(cxt: KeywordCxt): Code { const {gen, data, it} = cxt const {timestamp, allowDate} = it.opts if (timestamp === "date") return _`${data} instanceof Date ` const vts = useFunc(gen, validTimestamp) const allowDateArg = allowDate ? _`, true` : nil const validString = _`typeof ${data} == "string" && ${vts}(${data}${allowDateArg})` return timestamp === "string" ? validString : or(_`${data} instanceof Date`, validString) } const def: CodeKeywordDefinition = { keyword: "type", schemaType: "string", error, code(cxt: KeywordCxt) { checkMetadata(cxt) const {data, schema, parentSchema, it} = cxt let cond: Code switch (schema) { case "boolean": case "string": cond = _`typeof ${data} == ${schema}` break case "timestamp": { cond = timestampCode(cxt) break } case "float32": case "float64": cond = _`typeof ${data} == "number"` break default: { const sch = schema as IntType cond = _`typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)` if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { if (sch === "uint32") cond = _`${cond} && ${data} >= 0` } else { const [min, max] = intRange[sch] cond = _`${cond} && ${data} >= ${min} && ${data} <= ${max}` } } } cxt.pass(parentSchema.nullable ? or(_`${data} === null`, cond) : cond) }, } export default def