diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e63a9a9e7379ee606164ad4d5257241a42f6261f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.d.ts @@ -0,0 +1,9 @@ +import type { Format } from "ajv"; +export type FormatMode = "fast" | "full"; +export type FormatName = "date" | "time" | "date-time" | "iso-time" | "iso-date-time" | "duration" | "uri" | "uri-reference" | "uri-template" | "url" | "email" | "hostname" | "ipv4" | "ipv6" | "regex" | "uuid" | "json-pointer" | "json-pointer-uri-fragment" | "relative-json-pointer" | "byte" | "int32" | "int64" | "float" | "double" | "password" | "binary"; +export type DefinedFormats = { + [key in FormatName]: Format; +}; +export declare const fullFormats: DefinedFormats; +export declare const fastFormats: DefinedFormats; +export declare const formatNames: FormatName[]; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.js new file mode 100644 index 0000000000000000000000000000000000000000..cf01ed84529c9465e8e19f0f454c85acbc3d16ed --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.js @@ -0,0 +1,208 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatNames = exports.fastFormats = exports.fullFormats = void 0; +function fmtDef(validate, compare) { + return { validate, compare }; +} +exports.fullFormats = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: fmtDef(date, compareDate), + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: fmtDef(getTime(true), compareTime), + "date-time": fmtDef(getDateTime(true), compareDateTime), + "iso-time": fmtDef(getTime(), compareIsoTime), + "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime), + // duration: https://tools.ietf.org/html/rfc3339#appendix-A + duration: /^P(?!$)((\d+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\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, + // uri-template: https://tools.ietf.org/html/rfc6570 + "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, + // For the source: https://gist.github.com/dperini/729294 + // For test cases: https://mathiasbynens.be/demo/url-regex + url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, + email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, + ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, + "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, + // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types + // byte: https://github.com/miguelmota/is-base64 + byte, + // signed 32 bit integer + int32: { type: "number", validate: validateInt32 }, + // signed 64 bit integer + int64: { type: "number", validate: validateInt64 }, + // C-type float + float: { type: "number", validate: validateNumber }, + // C-type double + double: { type: "number", validate: validateNumber }, + // hint to the UI to hide input strings + password: true, + // unchecked string payload + binary: true, +}; +exports.fastFormats = { + ...exports.fullFormats, + date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate), + time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime), + "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime), + "iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime), + "iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime), + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation') + email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, +}; +exports.formatNames = Object.keys(exports.fullFormats); +function isLeapYear(year) { + // https://tools.ietf.org/html/rfc3339#appendix-C + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +function date(str) { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + const matches = DATE.exec(str); + if (!matches) + return false; + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + return (month >= 1 && + month <= 12 && + day >= 1 && + day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month])); +} +function compareDate(d1, d2) { + if (!(d1 && d2)) + return undefined; + if (d1 > d2) + return 1; + if (d1 < d2) + return -1; + return 0; +} +const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i; +function getTime(strictTimeZone) { + return function time(str) { + const matches = TIME.exec(str); + if (!matches) + return false; + const hr = +matches[1]; + const min = +matches[2]; + const sec = +matches[3]; + const tz = matches[4]; + const tzSign = matches[5] === "-" ? -1 : 1; + const tzH = +(matches[6] || 0); + const tzM = +(matches[7] || 0); + if (tzH > 23 || tzM > 59 || (strictTimeZone && !tz)) + return false; + if (hr <= 23 && min <= 59 && sec < 60) + return true; + // leap second + const utcMin = min - tzM * tzSign; + const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0); + return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61; + }; +} +function compareTime(s1, s2) { + if (!(s1 && s2)) + return undefined; + const t1 = new Date("2020-01-01T" + s1).valueOf(); + const t2 = new Date("2020-01-01T" + s2).valueOf(); + if (!(t1 && t2)) + return undefined; + return t1 - t2; +} +function compareIsoTime(t1, t2) { + if (!(t1 && t2)) + return undefined; + const a1 = TIME.exec(t1); + const a2 = TIME.exec(t2); + if (!(a1 && a2)) + return undefined; + t1 = a1[1] + a1[2] + a1[3]; + t2 = a2[1] + a2[2] + a2[3]; + if (t1 > t2) + return 1; + if (t1 < t2) + return -1; + return 0; +} +const DATE_TIME_SEPARATOR = /t|\s/i; +function getDateTime(strictTimeZone) { + const time = getTime(strictTimeZone); + return function date_time(str) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]); + }; +} +function compareDateTime(dt1, dt2) { + if (!(dt1 && dt2)) + return undefined; + const d1 = new Date(dt1).valueOf(); + const d2 = new Date(dt2).valueOf(); + if (!(d1 && d2)) + return undefined; + return d1 - d2; +} +function compareIsoDateTime(dt1, dt2) { + if (!(dt1 && dt2)) + return undefined; + const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR); + const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR); + const res = compareDate(d1, d2); + if (res === undefined) + return undefined; + return res || compareTime(t1, t2); +} +const NOT_URI_FRAGMENT = /\/|:/; +const UR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f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +function uri(str) { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str); +} +const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm; +function byte(str) { + BYTE.lastIndex = 0; + return BYTE.test(str); +} +const MIN_INT32 = -(2 ** 31); +const MAX_INT32 = 2 ** 31 - 1; +function validateInt32(value) { + return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32; +} +function validateInt64(value) { + // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64 + return Number.isInteger(value); +} +function validateNumber() { + return true; +} +const Z_ANCHOR = /[^\\]\\Z/; +function regex(str) { + if (Z_ANCHOR.test(str)) + return false; + try { + new RegExp(str); + return true; + } + catch (e) { + return false; + } +} +//# sourceMappingURL=formats.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a6be97f7065c58cf2b85910cd5e3bfdf7c96cc0a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/formats.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formats.js","sourceRoot":"","sources":["../src/formats.ts"],"names":[],"mappings":";;;AAqCA,SAAS,MAAM,CACb,QAA0C,EAC1C,OAA8B;IAE9B,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAA;AAC5B,CAAC;AAEY,QAAA,WAAW,GAAmB;IACzC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAC/B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,E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O,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,CAAA;AAC5E,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,4FAA4F;IAC5F,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,QAAQ,GAAG,UAAU,CAAA;AAC3B,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IACpC,IAAI;QACF,IAAI,MAAM,CAAC,GAAG,CAAC,CAAA;QACf,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAA;KACb;AACH,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..045a0960ae4fb9dfd92c78b788c8627e390ec929 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.d.ts @@ -0,0 +1,15 @@ +import { FormatMode, FormatName } from "./formats"; +import type { Plugin, Format } from "ajv"; +export { FormatMode, FormatName } from "./formats"; +export { LimitFormatError } from "./limit"; +export interface FormatOptions { + mode?: FormatMode; + formats?: FormatName[]; + keywords?: boolean; +} +export type FormatsPluginOptions = FormatName[] | FormatOptions; +export interface FormatsPlugin extends Plugin { + get: (format: FormatName, mode?: FormatMode) => Format; +} +declare const formatsPlugin: FormatsPlugin; +export default formatsPlugin; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a3b71f91dd3dc738cdbdbe79aca2a373d9e645b4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const formats_1 = require("./formats"); +const limit_1 = require("./limit"); +const codegen_1 = require("ajv/dist/compile/codegen"); +const fullName = new codegen_1.Name("fullFormats"); +const fastName = new codegen_1.Name("fastFormats"); +const formatsPlugin = (ajv, opts = { keywords: true }) => { + if (Array.isArray(opts)) { + addFormats(ajv, opts, formats_1.fullFormats, fullName); + return ajv; + } + const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName]; + const list = opts.formats || formats_1.formatNames; + addFormats(ajv, list, formats, exportName); + if (opts.keywords) + (0, limit_1.default)(ajv); + return ajv; +}; +formatsPlugin.get = (name, mode = "full") => { + const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats; + const f = formats[name]; + if (!f) + throw new Error(`Unknown format "${name}"`); + return f; +}; +function addFormats(ajv, list, fs, exportName) { + var _a; + var _b; + (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : (_b.formats = (0, codegen_1._) `require("ajv-formats/dist/formats").${exportName}`); + for (const f of list) + ajv.addFormat(f, fs[f]); +} +module.exports = exports = formatsPlugin; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = formatsPlugin; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fead22d7800cc85073f1aab0cff461334251639d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,uCAOkB;AAClB,mCAAiC;A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EAAkB,EAAE,UAAgB;;;IACpF,YAAA,GAAG,CAAC,IAAI,CAAC,IAAI,EAAC,OAAO,uCAAP,OAAO,GAAK,IAAA,WAAC,EAAA,uCAAuC,UAAU,EAAE,EAAA;IAC9E,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/C,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,aAAa,CAAA;AACxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..139fe1e73cc6a9f51a8127f9d381f6c3d07f7209 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.d.ts @@ -0,0 +1,10 @@ +import type { Plugin, CodeKeywordDefinition, ErrorObject } from "ajv"; +type Kwd = "formatMaximum" | "formatMinimum" | "formatExclusiveMaximum" | "formatExclusiveMinimum"; +type Comparison = "<=" | ">=" | "<" | ">"; +export type LimitFormatError = ErrorObject; +export declare const formatLimitDefinition: CodeKeywordDefinition; +declare const formatLimitPlugin: Plugin; +export default formatLimitPlugin; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.js new file mode 100644 index 0000000000000000000000000000000000000000..64979f839783feceddc0386cbe98ca97e8e39717 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatLimitDefinition = void 0; +const ajv_1 = require("ajv"); +const codegen_1 = require("ajv/dist/compile/codegen"); +const ops = codegen_1.operators; +const KWDs = { + formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, +}; +const error = { + message: ({ keyword, schemaCode }) => (0, codegen_1.str) `should be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, +}; +exports.formatLimitDefinition = { + keyword: Object.keys(KWDs), + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, keyword, it } = cxt; + const { opts, self } = it; + if (!opts.validateFormats) + return; + const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format"); + if (fCxt.$data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }); + const fmt = gen.const("fmt", (0, codegen_1._) `${fmts}[${fCxt.schemaCode}]`); + cxt.fail$data((0, codegen_1.or)((0, codegen_1._) `typeof ${fmt} != "object"`, (0, codegen_1._) `${fmt} instanceof RegExp`, (0, codegen_1._) `typeof ${fmt}.compare != "function"`, compareCode(fmt))); + } + function validateFormat() { + const format = fCxt.schema; + const fmtDef = self.formats[format]; + if (!fmtDef || fmtDef === true) + return; + if (typeof fmtDef != "object" || + fmtDef instanceof RegExp || + typeof fmtDef.compare != "function") { + throw new Error(`"${keyword}": format "${format}" does not define "compare" function`); + } + const fmt = gen.scopeValue("formats", { + key: format, + ref: fmtDef, + code: opts.code.formats ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : undefined, + }); + cxt.fail$data(compareCode(fmt)); + } + function compareCode(fmt) { + return (0, codegen_1._) `${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`; + } + }, + dependencies: ["format"], +}; +const formatLimitPlugin = (ajv) => { + ajv.addKeyword(exports.formatLimitDefinition); + return ajv; +}; +exports.default = formatLimitPlugin; +//# sourceMappingURL=limit.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f4a31b6bc2ab2279019a2fb74e0a4b9337f50a5a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/dist/limit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limit.js","sourceRoot":"","sources":["../src/limit.ts"],"names":[],"mappings":";;;AAWA,6BAA8B;AAC9B,sDAA2E;AAM3E,MAAM,GAAG,GAAG,mBAAS,CAAA;AAErB,MAAM,IAAI,GAA4D;IACpE,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACvD,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACvD,sBAAsB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;IAC/D,sBAAsB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;CAChE,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,a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,CAAC,6BAAqB,CAAC,CAAA;IACrC,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,kBAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/formats.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/formats.ts new file mode 100644 index 0000000000000000000000000000000000000000..d3cde9bcaf124a57fd49ba15fdb979e24259a17f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/formats.ts @@ -0,0 +1,269 @@ +import type {Format, FormatDefinition} from "ajv" +import type {FormatValidator, FormatCompare} from "ajv/dist/types" + +export type FormatMode = "fast" | "full" + +export type FormatName = + | "date" + | "time" + | "date-time" + | "iso-time" + | "iso-date-time" + | "duration" + | "uri" + | "uri-reference" + | "uri-template" + | "url" + | "email" + | "hostname" + | "ipv4" + | "ipv6" + | "regex" + | "uuid" + | "json-pointer" + | "json-pointer-uri-fragment" + | "relative-json-pointer" + | "byte" + | "int32" + | "int64" + | "float" + | "double" + | "password" + | "binary" + +export type DefinedFormats = { + [key in FormatName]: Format +} + +function fmtDef( + validate: RegExp | FormatValidator, + compare: FormatCompare +): FormatDefinition { + return {validate, compare} +} + +export const fullFormats: DefinedFormats = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: fmtDef(date, compareDate), + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: fmtDef(getTime(true), compareTime), + "date-time": fmtDef(getDateTime(true), compareDateTime), + "iso-time": fmtDef(getTime(), compareIsoTime), + "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime), + // duration: https://tools.ietf.org/html/rfc3339#appendix-A + duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, + uri, + "uri-reference": + /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0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/i, + // uri-template: https://tools.ietf.org/html/rfc6570 + "uri-template": + /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, + // For the source: https://gist.github.com/dperini/729294 + // For test cases: https://mathiasbynens.be/demo/url-regex + url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, + email: + /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: + /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, + ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, + "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, + // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types + // byte: https://github.com/miguelmota/is-base64 + byte, + // signed 32 bit integer + int32: {type: "number", validate: validateInt32}, + // signed 64 bit integer + int64: {type: "number", validate: validateInt64}, + // C-type float + float: {type: "number", validate: validateNumber}, + // C-type double + double: {type: "number", validate: validateNumber}, + // hint to the UI to hide input strings + password: true, + // unchecked string payload + binary: true, +} + +export const fastFormats: DefinedFormats = { + ...fullFormats, + date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate), + time: fmtDef( + /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, + compareTime + ), + "date-time": fmtDef( + /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, + compareDateTime + ), + "iso-time": fmtDef( + /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, + compareIsoTime + ), + "iso-date-time": fmtDef( + /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, + compareIsoDateTime + ), + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation') + email: + /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, +} + +export const formatNames = Object.keys(fullFormats) as FormatName[] + +function isLeapYear(year: number): boolean { + // https://tools.ietf.org/html/rfc3339#appendix-C + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) +} + +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + +function date(str: string): boolean { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + const matches: string[] | null = DATE.exec(str) + if (!matches) return false + const year: number = +matches[1] + const month: number = +matches[2] + const day: number = +matches[3] + return ( + month >= 1 && + month <= 12 && + day >= 1 && + day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]) + ) +} + +function compareDate(d1: string, d2: string): number | undefined { + if (!(d1 && d2)) return undefined + if (d1 > d2) return 1 + if (d1 < d2) return -1 + return 0 +} + +const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i + +function getTime(strictTimeZone?: boolean): (str: string) => boolean { + return function time(str: string): boolean { + const matches: string[] | null = TIME.exec(str) + if (!matches) return false + const hr: number = +matches[1] + const min: number = +matches[2] + const sec: number = +matches[3] + const tz: string | undefined = matches[4] + const tzSign: number = matches[5] === "-" ? -1 : 1 + const tzH: number = +(matches[6] || 0) + const tzM: number = +(matches[7] || 0) + if (tzH > 23 || tzM > 59 || (strictTimeZone && !tz)) return false + if (hr <= 23 && min <= 59 && sec < 60) return true + // leap second + const utcMin = min - tzM * tzSign + const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0) + return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61 + } +} + +function compareTime(s1: string, s2: string): number | undefined { + if (!(s1 && s2)) return undefined + const t1 = new Date("2020-01-01T" + s1).valueOf() + const t2 = new Date("2020-01-01T" + s2).valueOf() + if (!(t1 && t2)) return undefined + return t1 - t2 +} + +function compareIsoTime(t1: string, t2: string): number | undefined { + if (!(t1 && t2)) return undefined + const a1 = TIME.exec(t1) + const a2 = TIME.exec(t2) + if (!(a1 && a2)) return undefined + t1 = a1[1] + a1[2] + a1[3] + t2 = a2[1] + a2[2] + a2[3] + if (t1 > t2) return 1 + if (t1 < t2) return -1 + return 0 +} + +const DATE_TIME_SEPARATOR = /t|\s/i +function getDateTime(strictTimeZone?: boolean): (str: string) => boolean { + const time = getTime(strictTimeZone) + + return function date_time(str: string): boolean { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dateTime: string[] = str.split(DATE_TIME_SEPARATOR) + return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]) + } +} + +function compareDateTime(dt1: string, dt2: string): number | undefined { + if (!(dt1 && dt2)) return undefined + const d1 = new Date(dt1).valueOf() + const d2 = new Date(dt2).valueOf() + if (!(d1 && d2)) return undefined + return d1 - d2 +} + +function compareIsoDateTime(dt1: string, dt2: string): number | undefined { + if (!(dt1 && dt2)) return undefined + const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR) + const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR) + const res = compareDate(d1, d2) + if (res === undefined) return undefined + return res || compareTime(t1, t2) +} + +const NOT_URI_FRAGMENT = /\/|:/ +const URI = + /^(?:[a-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:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i + +function uri(str: string): boolean { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str) +} + +const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm + +function byte(str: string): boolean { + BYTE.lastIndex = 0 + return BYTE.test(str) +} + +const MIN_INT32 = -(2 ** 31) +const MAX_INT32 = 2 ** 31 - 1 + +function validateInt32(value: number): boolean { + return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32 +} + +function validateInt64(value: number): boolean { + // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64 + return Number.isInteger(value) +} + +function validateNumber(): boolean { + return true +} + +const Z_ANCHOR = /[^\\]\\Z/ +function regex(str: string): boolean { + if (Z_ANCHOR.test(str)) return false + try { + new RegExp(str) + return true + } catch (e) { + return false + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..8fd944a09021a795e86c3285c838f65ca0a957d9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/index.ts @@ -0,0 +1,62 @@ +import { + DefinedFormats, + FormatMode, + FormatName, + formatNames, + fastFormats, + fullFormats, +} from "./formats" +import formatLimit from "./limit" +import type Ajv from "ajv" +import type {Plugin, Format} from "ajv" +import {_, Name} from "ajv/dist/compile/codegen" + +export {FormatMode, FormatName} from "./formats" +export {LimitFormatError} from "./limit" +export interface FormatOptions { + mode?: FormatMode + formats?: FormatName[] + keywords?: boolean +} + +export type FormatsPluginOptions = FormatName[] | FormatOptions + +export interface FormatsPlugin extends Plugin { + get: (format: FormatName, mode?: FormatMode) => Format +} + +const fullName = new Name("fullFormats") +const fastName = new Name("fastFormats") + +const formatsPlugin: FormatsPlugin = ( + ajv: Ajv, + opts: FormatsPluginOptions = {keywords: true} +): Ajv => { + if (Array.isArray(opts)) { + addFormats(ajv, opts, fullFormats, fullName) + return ajv + } + const [formats, exportName] = + opts.mode === "fast" ? [fastFormats, fastName] : [fullFormats, fullName] + const list = opts.formats || formatNames + addFormats(ajv, list, formats, exportName) + if (opts.keywords) formatLimit(ajv) + return ajv +} + +formatsPlugin.get = (name: FormatName, mode: FormatMode = "full"): Format => { + const formats = mode === "fast" ? fastFormats : fullFormats + const f = formats[name] + if (!f) throw new Error(`Unknown format "${name}"`) + return f +} + +function addFormats(ajv: Ajv, list: FormatName[], fs: DefinedFormats, exportName: Name): void { + ajv.opts.code.formats ??= _`require("ajv-formats/dist/formats").${exportName}` + for (const f of list) ajv.addFormat(f, fs[f]) +} + +module.exports = exports = formatsPlugin +Object.defineProperty(exports, "__esModule", {value: true}) + +export default formatsPlugin diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/limit.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/limit.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf6a57cb9d728658e8461b9e02b5d59fcaff74b1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv-formats/src/limit.ts @@ -0,0 +1,99 @@ +import type Ajv from "ajv" +import type { + Plugin, + CodeKeywordDefinition, + KeywordErrorDefinition, + Code, + Name, + ErrorObject, +} from "ajv" +import type {AddedFormat} from "ajv/dist/types" +import type {Rule} from "ajv/dist/compile/rules" +import {KeywordCxt} from "ajv" +import {_, str, or, getProperty, operators} from "ajv/dist/compile/codegen" + +type Kwd = "formatMaximum" | "formatMinimum" | "formatExclusiveMaximum" | "formatExclusiveMinimum" + +type Comparison = "<=" | ">=" | "<" | ">" + +const ops = operators + +const KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = { + formatMaximum: {okStr: "<=", ok: ops.LTE, fail: ops.GT}, + formatMinimum: {okStr: ">=", ok: ops.GTE, fail: ops.LT}, + formatExclusiveMaximum: {okStr: "<", ok: ops.LT, fail: ops.GTE}, + formatExclusiveMinimum: {okStr: ">", ok: ops.GT, fail: ops.LTE}, +} + +export type LimitFormatError = ErrorObject + +const error: KeywordErrorDefinition = { + message: ({keyword, schemaCode}) => str`should be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`, + params: ({keyword, schemaCode}) => + _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`, +} + +export const formatLimitDefinition: CodeKeywordDefinition = { + keyword: Object.keys(KWDs), + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const {gen, data, schemaCode, keyword, it} = cxt + const {opts, self} = it + if (!opts.validateFormats) return + + const fCxt = new KeywordCxt(it, (self.RULES.all.format as Rule).definition, "format") + if (fCxt.$data) validate$DataFormat() + else validateFormat() + + function validate$DataFormat(): void { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }) + const fmt = gen.const("fmt", _`${fmts}[${fCxt.schemaCode}]`) + cxt.fail$data( + or( + _`typeof ${fmt} != "object"`, + _`${fmt} instanceof RegExp`, + _`typeof ${fmt}.compare != "function"`, + compareCode(fmt) + ) + ) + } + + function validateFormat(): void { + const format = fCxt.schema as string + const fmtDef: AddedFormat | undefined = self.formats[format] + if (!fmtDef || fmtDef === true) return + if ( + typeof fmtDef != "object" || + fmtDef instanceof RegExp || + typeof fmtDef.compare != "function" + ) { + throw new Error(`"${keyword}": format "${format}" does not define "compare" function`) + } + const fmt = gen.scopeValue("formats", { + key: format, + ref: fmtDef, + code: opts.code.formats ? _`${opts.code.formats}${getProperty(format)}` : undefined, + }) + + cxt.fail$data(compareCode(fmt)) + } + + function compareCode(fmt: Name): Code { + return _`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword as Kwd].fail} 0` + } + }, + dependencies: ["format"], +} + +const formatLimitPlugin: Plugin = (ajv: Ajv): Ajv => { + ajv.addKeyword(formatLimitDefinition) + return ajv +} + +export default formatLimitPlugin diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e835e2b27aabeef769edf00ec4d6bae06fcbf0cc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.d.ts @@ -0,0 +1,19 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore, { Options } from "./core"; +export declare class Ajv2019 extends AjvCore { + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv2019; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +export { default as ValidationError } from "./runtime/validation_error"; +export { default as MissingRefError } from "./compile/ref_error"; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.js new file mode 100644 index 0000000000000000000000000000000000000000..bad415cc2cc55ebd392e59f9988e00f9af65325f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2019 = void 0; +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const dynamic_1 = require("./vocabularies/dynamic"); +const next_1 = require("./vocabularies/next"); +const unevaluated_1 = require("./vocabularies/unevaluated"); +const discriminator_1 = require("./vocabularies/discriminator"); +const json_schema_2019_09_1 = require("./refs/json-schema-2019-09"); +const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema"; +class Ajv2019 extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(dynamic_1.default); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + this.addVocabulary(next_1.default); + this.addVocabulary(unevaluated_1.default); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2019_09_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +exports.Ajv2019 = Ajv2019; +module.exports = exports = Ajv2019; +module.exports.Ajv2019 = Ajv2019; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv2019; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +var validation_error_1 = require("./runtime/validation_error"); +Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); +var ref_error_1 = require("./compile/ref_error"); +Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); +//# sourceMappingURL=2019.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7e55d957747f0887fe25ee101220614dc5cf5506 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2019.js.map @@ -0,0 +1 @@ +{"version":3,"file":"2019.js","sourceRoot":"","sources":["../lib/2019.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,kDAAsD;AACtD,oDAAsD;AACtD,8CAAgD;AAChD,4DAA8D;AAC9D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAa,OAAQ,SAAQ,cAAO;IAClC,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAA;QACrC,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAClC,IAAI,CAAC,aAAa,CAAC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modules/ajv/dist/2020.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2e56c8fcfc1e5867a46ba93ae39a0d75566868d2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.d.ts @@ -0,0 +1,19 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore, { Options } from "./core"; +export declare class Ajv2020 extends AjvCore { + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv2020; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +export { default as ValidationError } from "./runtime/validation_error"; +export { default as MissingRefError } from "./compile/ref_error"; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.js new file mode 100644 index 0000000000000000000000000000000000000000..b3fe71cb83414dab13fba69b1ce6526426ac038b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2020 = void 0; +const core_1 = require("./core"); +const draft2020_1 = require("./vocabularies/draft2020"); +const discriminator_1 = require("./vocabularies/discriminator"); +const json_schema_2020_12_1 = require("./refs/json-schema-2020-12"); +const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema"; +class Ajv2020 extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + draft2020_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2020_12_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +exports.Ajv2020 = Ajv2020; +module.exports = exports = Ajv2020; +module.exports.Ajv2020 = Ajv2020; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv2020; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +var validation_error_1 = require("./runtime/validation_error"); +Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); +var ref_error_1 = require("./compile/ref_error"); +Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); +//# sourceMappingURL=2020.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2f4fda81e2d88e6743a809cb453e063ae3dc3a02 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"2020.js","sourceRoot":"","sources":["../lib/2020.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,wDAA4D;AAC5D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAa,OAAQ,SAAQ,cAAO;IAClC,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,mBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AA5BD,0BA4BC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;AAChC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AACnD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fce3b03b8600efd7109ef5a535911967e617d58a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.d.ts @@ -0,0 +1,18 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore from "./core"; +export declare class Ajv extends AjvCore { + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +export { default as ValidationError } from "./runtime/validation_error"; +export { default as MissingRefError } from "./compile/ref_error"; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.js new file mode 100644 index 0000000000000000000000000000000000000000..8eecf1bea7979d28682960a45abb1af0e90e6708 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0; +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const discriminator_1 = require("./vocabularies/discriminator"); +const draft7MetaSchema = require("./refs/json-schema-draft-07.json"); +const META_SUPPORT_DATA = ["/properties"]; +const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"; +class Ajv extends core_1.default { + _addVocabularies() { + super._addVocabularies(); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) + return; + const metaSchema = this.opts.$data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema; + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +exports.Ajv = Ajv; +module.exports = exports = Ajv; +module.exports.Ajv = Ajv; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +var validation_error_1 = require("./runtime/validation_error"); +Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); +var ref_error_1 = require("./compile/ref_error"); +Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); +//# sourceMappingURL=ajv.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.js.map new file mode 100644 index 0000000000000000000000000000000000000000..42c3edf1af41150fb372e91220c08553b6f1a6a6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/ajv.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../lib/ajv.ts"],"names":[],"mappings":";;;AACA,iCAA4B;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AAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AACnD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a0220ad7648c57f5ef2838b251e1280910efe591 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.d.ts @@ -0,0 +1,40 @@ +export declare abstract class _CodeOrName { + abstract readonly str: string; + abstract readonly names: UsedNames; + abstract toString(): string; + abstract emptyStr(): boolean; +} +export declare const IDENTIFIER: RegExp; +export declare class Name extends _CodeOrName { + readonly str: string; + constructor(s: string); + toString(): string; + emptyStr(): boolean; + get names(): UsedNames; +} +export declare class _Code extends _CodeOrName { + readonly _items: readonly CodeItem[]; + private _str?; + private _names?; + constructor(code: string | readonly CodeItem[]); + toString(): string; + emptyStr(): boolean; + get str(): string; + get names(): UsedNames; +} +export type CodeItem = Name | string | number | boolean | null; +export type UsedNames = Record; +export type Code = _Code | Name; +export type SafeExpr = Code | number | boolean | null; +export declare const nil: _Code; +type CodeArg = SafeExpr | string | undefined; +export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code; +export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code; +export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void; +export declare function strConcat(c1: Code, c2: Code): Code; +export declare function stringify(x: unknown): Code; +export declare function safeStringify(x: unknown): string; +export declare function getProperty(key: Code | string | number): Code; +export declare function getEsmExportName(key: Code | string | number): Code; +export declare function regexpCode(rx: RegExp): Code; +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.js new file mode 100644 index 0000000000000000000000000000000000000000..f9ea5259a70b0e2517885fe9504f8abb9603e7c6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.js @@ -0,0 +1,156 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; +// eslint-disable-next-line @typescript-eslint/no-extraneous-class +class _CodeOrName { +} +exports._CodeOrName = _CodeOrName; +exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; +class Name extends _CodeOrName { + constructor(s) { + super(); + if (!exports.IDENTIFIER.test(s)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = s; + } + toString() { + return this.str; + } + emptyStr() { + return false; + } + get names() { + return { [this.str]: 1 }; + } +} +exports.Name = Name; +class _Code extends _CodeOrName { + constructor(code) { + super(); + this._items = typeof code === "string" ? [code] : code; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return false; + const item = this._items[0]; + return item === "" || item === '""'; + } + get str() { + var _a; + return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, ""))); + } + get names() { + var _a; + return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => { + if (c instanceof Name) + names[c.str] = (names[c.str] || 0) + 1; + return names; + }, {}))); + } +} +exports._Code = _Code; +exports.nil = new _Code(""); +function _(strs, ...args) { + const code = [strs[0]]; + let i = 0; + while (i < args.length) { + addCodeArg(code, args[i]); + code.push(strs[++i]); + } + return new _Code(code); +} +exports._ = _; +const plus = new _Code("+"); +function str(strs, ...args) { + const expr = [safeStringify(strs[0])]; + let i = 0; + while (i < args.length) { + expr.push(plus); + addCodeArg(expr, args[i]); + expr.push(plus, safeStringify(strs[++i])); + } + optimize(expr); + return new _Code(expr); +} +exports.str = str; +function addCodeArg(code, arg) { + if (arg instanceof _Code) + code.push(...arg._items); + else if (arg instanceof Name) + code.push(arg); + else + code.push(interpolate(arg)); +} +exports.addCodeArg = addCodeArg; +function optimize(expr) { + let i = 1; + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]); + if (res !== undefined) { + expr.splice(i - 1, 3, res); + continue; + } + expr[i++] = "+"; + } + i++; + } +} +function mergeExprItems(a, b) { + if (b === '""') + return a; + if (a === '""') + return b; + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') + return; + if (typeof b != "string") + return `${a.slice(0, -1)}${b}"`; + if (b[0] === '"') + return a.slice(0, -1) + b.slice(1); + return; + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) + return `"${a}${b.slice(1)}`; + return; +} +function strConcat(c1, c2) { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`; +} +exports.strConcat = strConcat; +// TODO do not allow arrays here +function interpolate(x) { + return typeof x == "number" || typeof x == "boolean" || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(",") : x); +} +function stringify(x) { + return new _Code(safeStringify(x)); +} +exports.stringify = stringify; +function safeStringify(x) { + return JSON.stringify(x) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029"); +} +exports.safeStringify = safeStringify; +function getProperty(key) { + return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`; +} +exports.getProperty = getProperty; +//Does best effort to format the name properly +function getEsmExportName(key) { + if (typeof key == "string" && exports.IDENTIFIER.test(key)) { + return new _Code(`${key}`); + } + throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`); +} +exports.getEsmExportName = getEsmExportName; +function regexpCode(rx) { + return new _Code(rx.toString()); +} +exports.regexpCode = regexpCode; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2fe66c15e15080574645f1e721a7b84a93824f6e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"code.js","sourceRoot":"","sources":["../../../lib/compile/codegen/code.ts"],"names":[],"mappings":";;;AAAA,kEAAkE;AAClE,MAAsB,WAAW;CAKhC;AALD,kCAKC;AAEY,QAAA,UAAU,GAAG,uBAAuB,CAAA;AAEjD,MAAa,IAAK,SAAQ,WAAW;IAEnC,YAAY,CAAS;QACnB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,kBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACpF,IAAI,CAAC,GAAG,GAAG,CAAC,CAAA;IACd,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK;QACP,OAAO,EAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAC,CAAA;IACxB,CAAC;CACF;AAnBD,oBAmBC;AAED,MAAa,KAAM,SAAQ,WAAW;IAKpC,YAAY,IAAkC;QAC5C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GA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AAC,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,IAAI,GAAG,GAAG,CAAA;AAC5F,CAAC;AAFD,kCAEC;AAED,8CAA8C;AAC9C,SAAgB,gBAAgB,CAAC,GAA2B;IAC1D,IAAI,OAAO,GAAG,IAAI,QAAQ,IAAI,kBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnD,OAAO,IAAI,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA;IAC5B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC,CAAA;AACxF,CAAC;AALD,4CAKC;AAED,SAAgB,UAAU,CAAC,EAAU;IACnC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d586a4b49f79d65f71598781c6beed3c9ec332e4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.d.ts @@ -0,0 +1,79 @@ +import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope"; +import { _Code, Code, Name } from "./code"; +import { Scope } from "./scope"; +export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code"; +export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope"; +export type SafeExpr = Code | number | boolean | null; +export type Block = Code | (() => void); +export declare const operators: { + GT: _Code; + GTE: _Code; + LT: _Code; + LTE: _Code; + EQ: _Code; + NEQ: _Code; + NOT: _Code; + OR: _Code; + AND: _Code; + ADD: _Code; +}; +export interface CodeGenOptions { + es5?: boolean; + lines?: boolean; + ownProperties?: boolean; +} +export declare class CodeGen { + readonly _scope: Scope; + readonly _extScope: ValueScope; + readonly _values: ScopeValueSets; + private readonly _nodes; + private readonly _blockStarts; + private readonly _constants; + private readonly opts; + constructor(extScope: ValueScope, opts?: CodeGenOptions); + toString(): string; + name(prefix: string): Name; + scopeName(prefix: string): ValueScopeName; + scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name; + getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; + scopeRefs(scopeName: Name): Code; + scopeCode(): Code; + private _def; + const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name; + let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; + var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; + assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen; + add(lhs: Code, rhs: SafeExpr): CodeGen; + code(c: Block | SafeExpr): CodeGen; + object(...keyValues: [Name | string, SafeExpr | string][]): _Code; + if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen; + elseIf(condition: Code | boolean): CodeGen; + else(): CodeGen; + endIf(): CodeGen; + private _for; + for(iteration: Code, forBody?: Block): CodeGen; + forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen; + forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; + forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; + endFor(): CodeGen; + label(label: Name): CodeGen; + break(label?: Code): CodeGen; + return(value: Block | SafeExpr): CodeGen; + try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen; + throw(error: Code): CodeGen; + block(body?: Block, nodeCount?: number): CodeGen; + endBlock(nodeCount?: number): CodeGen; + func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen; + endFunc(): CodeGen; + optimize(n?: number): void; + private _leafNode; + private _blockNode; + private _endBlockNode; + private _elseNode; + private get _root(); + private get _currNode(); + private set _currNode(value); +} +export declare function not(x: T): T; +export declare function and(...args: Code[]): Code; +export declare function or(...args: Code[]): Code; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a6c805af14539cf6180f2536992ce13a8a4d0615 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.js @@ -0,0 +1,697 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0; +const code_1 = require("./code"); +const scope_1 = require("./scope"); +var code_2 = require("./code"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } }); +Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } }); +Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } }); +Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } }); +var scope_2 = require("./scope"); +Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } }); +Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } }); +Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } }); +Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } }); +exports.operators = { + GT: new code_1._Code(">"), + GTE: new code_1._Code(">="), + LT: new code_1._Code("<"), + LTE: new code_1._Code("<="), + EQ: new code_1._Code("==="), + NEQ: new code_1._Code("!=="), + NOT: new code_1._Code("!"), + OR: new code_1._Code("||"), + AND: new code_1._Code("&&"), + ADD: new code_1._Code("+"), +}; +class Node { + optimizeNodes() { + return this; + } + optimizeNames(_names, _constants) { + return this; + } +} +class Def extends Node { + constructor(varKind, name, rhs) { + super(); + this.varKind = varKind; + this.name = name; + this.rhs = rhs; + } + render({ es5, _n }) { + const varKind = es5 ? scope_1.varKinds.var : this.varKind; + const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`; + return `${varKind} ${this.name}${rhs};` + _n; + } + optimizeNames(names, constants) { + if (!names[this.name.str]) + return; + if (this.rhs) + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {}; + } +} +class Assign extends Node { + constructor(lhs, rhs, sideEffects) { + super(); + this.lhs = lhs; + this.rhs = rhs; + this.sideEffects = sideEffects; + } + render({ _n }) { + return `${this.lhs} = ${this.rhs};` + _n; + } + optimizeNames(names, constants) { + if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects) + return; + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names }; + return addExprNames(names, this.rhs); + } +} +class AssignOp extends Assign { + constructor(lhs, op, rhs, sideEffects) { + super(lhs, rhs, sideEffects); + this.op = op; + } + render({ _n }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n; + } +} +class Label extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + return `${this.label}:` + _n; + } +} +class Break extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + const label = this.label ? ` ${this.label}` : ""; + return `break${label};` + _n; + } +} +class Throw extends Node { + constructor(error) { + super(); + this.error = error; + } + render({ _n }) { + return `throw ${this.error};` + _n; + } + get names() { + return this.error.names; + } +} +class AnyCode extends Node { + constructor(code) { + super(); + this.code = code; + } + render({ _n }) { + return `${this.code};` + _n; + } + optimizeNodes() { + return `${this.code}` ? this : undefined; + } + optimizeNames(names, constants) { + this.code = optimizeExpr(this.code, names, constants); + return this; + } + get names() { + return this.code instanceof code_1._CodeOrName ? this.code.names : {}; + } +} +class ParentNode extends Node { + constructor(nodes = []) { + super(); + this.nodes = nodes; + } + render(opts) { + return this.nodes.reduce((code, n) => code + n.render(opts), ""); + } + optimizeNodes() { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i].optimizeNodes(); + if (Array.isArray(n)) + nodes.splice(i, 1, ...n); + else if (n) + nodes[i] = n; + else + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + optimizeNames(names, constants) { + const { nodes } = this; + let i = nodes.length; + while (i--) { + // iterating backwards improves 1-pass optimization + const n = nodes[i]; + if (n.optimizeNames(names, constants)) + continue; + subtractNames(names, n.names); + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + get names() { + return this.nodes.reduce((names, n) => addNames(names, n.names), {}); + } +} +class BlockNode extends ParentNode { + render(opts) { + return "{" + opts._n + super.render(opts) + "}" + opts._n; + } +} +class Root extends ParentNode { +} +class Else extends BlockNode { +} +Else.kind = "else"; +class If extends BlockNode { + constructor(condition, nodes) { + super(nodes); + this.condition = condition; + } + render(opts) { + let code = `if(${this.condition})` + super.render(opts); + if (this.else) + code += "else " + this.else.render(opts); + return code; + } + optimizeNodes() { + super.optimizeNodes(); + const cond = this.condition; + if (cond === true) + return this.nodes; // else is ignored here + let e = this.else; + if (e) { + const ns = e.optimizeNodes(); + e = this.else = Array.isArray(ns) ? new Else(ns) : ns; + } + if (e) { + if (cond === false) + return e instanceof If ? e : e.nodes; + if (this.nodes.length) + return this; + return new If(not(cond), e instanceof If ? [e] : e.nodes); + } + if (cond === false || !this.nodes.length) + return undefined; + return this; + } + optimizeNames(names, constants) { + var _a; + this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + if (!(super.optimizeNames(names, constants) || this.else)) + return; + this.condition = optimizeExpr(this.condition, names, constants); + return this; + } + get names() { + const names = super.names; + addExprNames(names, this.condition); + if (this.else) + addNames(names, this.else.names); + return names; + } +} +If.kind = "if"; +class For extends BlockNode { +} +For.kind = "for"; +class ForLoop extends For { + constructor(iteration) { + super(); + this.iteration = iteration; + } + render(opts) { + return `for(${this.iteration})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iteration = optimizeExpr(this.iteration, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iteration.names); + } +} +class ForRange extends For { + constructor(varKind, name, from, to) { + super(); + this.varKind = varKind; + this.name = name; + this.from = from; + this.to = to; + } + render(opts) { + const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind; + const { name, from, to } = this; + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts); + } + get names() { + const names = addExprNames(super.names, this.from); + return addExprNames(names, this.to); + } +} +class ForIter extends For { + constructor(loop, varKind, name, iterable) { + super(); + this.loop = loop; + this.varKind = varKind; + this.name = name; + this.iterable = iterable; + } + render(opts) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iterable = optimizeExpr(this.iterable, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iterable.names); + } +} +class Func extends BlockNode { + constructor(name, args, async) { + super(); + this.name = name; + this.args = args; + this.async = async; + } + render(opts) { + const _async = this.async ? "async " : ""; + return `${_async}function ${this.name}(${this.args})` + super.render(opts); + } +} +Func.kind = "func"; +class Return extends ParentNode { + render(opts) { + return "return " + super.render(opts); + } +} +Return.kind = "return"; +class Try extends BlockNode { + render(opts) { + let code = "try" + super.render(opts); + if (this.catch) + code += this.catch.render(opts); + if (this.finally) + code += this.finally.render(opts); + return code; + } + optimizeNodes() { + var _a, _b; + super.optimizeNodes(); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes(); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes(); + return this; + } + optimizeNames(names, constants) { + var _a, _b; + super.optimizeNames(names, constants); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants); + return this; + } + get names() { + const names = super.names; + if (this.catch) + addNames(names, this.catch.names); + if (this.finally) + addNames(names, this.finally.names); + return names; + } +} +class Catch extends BlockNode { + constructor(error) { + super(); + this.error = error; + } + render(opts) { + return `catch(${this.error})` + super.render(opts); + } +} +Catch.kind = "catch"; +class Finally extends BlockNode { + render(opts) { + return "finally" + super.render(opts); + } +} +Finally.kind = "finally"; +class CodeGen { + constructor(extScope, opts = {}) { + this._values = {}; + this._blockStarts = []; + this._constants = {}; + this.opts = { ...opts, _n: opts.lines ? "\n" : "" }; + this._extScope = extScope; + this._scope = new scope_1.Scope({ parent: extScope }); + this._nodes = [new Root()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(prefix) { + return this._scope.name(prefix); + } + // reserves unique name in the external scope + scopeName(prefix) { + return this._extScope.name(prefix); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName, value) { + const name = this._extScope.value(prefixOrName, value); + const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()); + vs.add(name); + return name; + } + getScopeValue(prefix, keyOrRef) { + return this._extScope.getValue(prefix, keyOrRef); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName) { + return this._extScope.scopeRefs(scopeName, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(varKind, nameOrPrefix, rhs, constant) { + const name = this._scope.toName(nameOrPrefix); + if (rhs !== undefined && constant) + this._constants[name.str] = rhs; + this._leafNode(new Def(varKind, name, rhs)); + return name; + } + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant); + } + // `var` declaration with optional assignment + var(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant); + } + // assignment code + assign(lhs, rhs, sideEffects) { + return this._leafNode(new Assign(lhs, rhs, sideEffects)); + } + // `+=` code + add(lhs, rhs) { + return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs)); + } + // appends passed SafeExpr to code or executes Block + code(c) { + if (typeof c == "function") + c(); + else if (c !== code_1.nil) + this._leafNode(new AnyCode(c)); + return this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues) { + const code = ["{"]; + for (const [key, value] of keyValues) { + if (code.length > 1) + code.push(","); + code.push(key); + if (key !== value || this.opts.es5) { + code.push(":"); + (0, code_1.addCodeArg)(code, value); + } + } + code.push("}"); + return new code_1._Code(code); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition, thenBody, elseBody) { + this._blockNode(new If(condition)); + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf(); + } + else if (thenBody) { + this.code(thenBody).endIf(); + } + else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body'); + } + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition) { + return this._elseNode(new If(condition)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new Else()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode(If, Else); + } + _for(node, forBody) { + this._blockNode(node); + if (forBody) + this.code(forBody).endFor(); + return this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration, forBody) { + return this._for(new ForLoop(iteration), forBody); + } + // `for` statement for a range of values + forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) { + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) { + const name = this._scope.toName(nameOrPrefix); + if (this.opts.es5) { + const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable); + return this.forRange("_i", 0, (0, code_1._) `${arr}.length`, (i) => { + this.var(name, (0, code_1._) `${arr}[${i}]`); + forBody(name); + }); + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, (0, code_1._) `Object.keys(${obj})`, forBody); + } + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)); + } + // end `for` loop + endFor() { + return this._endBlockNode(For); + } + // `label` statement + label(label) { + return this._leafNode(new Label(label)); + } + // `break` statement + break(label) { + return this._leafNode(new Break(label)); + } + // `return` statement + return(value) { + const node = new Return(); + this._blockNode(node); + this.code(value); + if (node.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(Return); + } + // `try` statement + try(tryBody, catchCode, finallyCode) { + if (!catchCode && !finallyCode) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const node = new Try(); + this._blockNode(node); + this.code(tryBody); + if (catchCode) { + const error = this.name("e"); + this._currNode = node.catch = new Catch(error); + catchCode(error); + } + if (finallyCode) { + this._currNode = node.finally = new Finally(); + this.code(finallyCode); + } + return this._endBlockNode(Catch, Finally); + } + // `throw` statement + throw(error) { + return this._leafNode(new Throw(error)); + } + // start self-balancing block + block(body, nodeCount) { + this._blockStarts.push(this._nodes.length); + if (body) + this.code(body).endBlock(nodeCount); + return this; + } + // end the current self-balancing block + endBlock(nodeCount) { + const len = this._blockStarts.pop(); + if (len === undefined) + throw new Error("CodeGen: not in self-balancing block"); + const toClose = this._nodes.length - len; + if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`); + } + this._nodes.length = len; + return this; + } + // `function` heading (or definition if funcBody is passed) + func(name, args = code_1.nil, async, funcBody) { + this._blockNode(new Func(name, args, async)); + if (funcBody) + this.code(funcBody).endFunc(); + return this; + } + // end function definition + endFunc() { + return this._endBlockNode(Func); + } + optimize(n = 1) { + while (n-- > 0) { + this._root.optimizeNodes(); + this._root.optimizeNames(this._root.names, this._constants); + } + } + _leafNode(node) { + this._currNode.nodes.push(node); + return this; + } + _blockNode(node) { + this._currNode.nodes.push(node); + this._nodes.push(node); + } + _endBlockNode(N1, N2) { + const n = this._currNode; + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop(); + return this; + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); + } + _elseNode(node) { + const n = this._currNode; + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"'); + } + this._currNode = n.else = node; + return this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const ns = this._nodes; + return ns[ns.length - 1]; + } + set _currNode(node) { + const ns = this._nodes; + ns[ns.length - 1] = node; + } +} +exports.CodeGen = CodeGen; +function addNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) + (from[n] || 0); + return names; +} +function addExprNames(names, from) { + return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names; +} +function optimizeExpr(expr, names, constants) { + if (expr instanceof code_1.Name) + return replaceName(expr); + if (!canOptimize(expr)) + return expr; + return new code_1._Code(expr._items.reduce((items, c) => { + if (c instanceof code_1.Name) + c = replaceName(c); + if (c instanceof code_1._Code) + items.push(...c._items); + else + items.push(c); + return items; + }, [])); + function replaceName(n) { + const c = constants[n.str]; + if (c === undefined || names[n.str] !== 1) + return n; + delete names[n.str]; + return c; + } + function canOptimize(e) { + return (e instanceof code_1._Code && + e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined)); + } +} +function subtractNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) - (from[n] || 0); +} +function not(x) { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`; +} +exports.not = not; +const andCode = mappend(exports.operators.AND); +// boolean AND (&&) expression with the passed arguments +function and(...args) { + return args.reduce(andCode); +} +exports.and = and; +const orCode = mappend(exports.operators.OR); +// boolean OR (||) expression with the passed arguments +function or(...args) { + return args.reduce(orCode); +} +exports.or = or; +function mappend(op) { + return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`); +} +function par(x) { + return x instanceof code_1.Name ? x : (0, code_1._) `(${x})`; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..baef9cff5623858c70b4b5f37eddc4209d726bf4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/compile/codegen/index.ts"],"names":[],"mappings":";;;AACA,iCAA8F;AAC9F,mCAAuC;AAEvC,+BAA6F;AAArF,yFAAA,CAAC,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,mGAAA,W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C,GAAG,IAAY;IACjC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAC;AAFD,kBAEC;AAED,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAS,CAAC,EAAE,CAAC,CAAA;AAEpC,uDAAuD;AACvD,SAAgB,EAAE,CAAC,GAAG,IAAY;IAChC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC5B,CAAC;AAFD,gBAEC;AAID,SAAS,OAAO,CAAC,EAAQ;IACvB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,UAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,UAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AACjF,CAAC;AAED,SAAS,GAAG,CAAC,CAAO;IAClB,OAAO,CAAC,YAAY,WAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,IAAI,CAAC,GAAG,CAAA;AAC1C,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d953053877f1a646c763426c51b3ca2fe113cb0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.d.ts @@ -0,0 +1,79 @@ +import { Code, Name } from "./code"; +interface NameGroup { + prefix: string; + index: number; +} +export interface NameValue { + ref: ValueReference; + key?: unknown; + code?: Code; +} +export type ValueReference = unknown; +interface ScopeOptions { + prefixes?: Set; + parent?: Scope; +} +interface ValueScopeOptions extends ScopeOptions { + scope: ScopeStore; + es5?: boolean; + lines?: boolean; +} +export type ScopeStore = Record; +type ScopeValues = { + [Prefix in string]?: Map; +}; +export type ScopeValueSets = { + [Prefix in string]?: Set; +}; +export declare enum UsedValueState { + Started = 0, + Completed = 1 +} +export type UsedScopeValues = { + [Prefix in string]?: Map; +}; +export declare const varKinds: { + const: Name; + let: Name; + var: Name; +}; +export declare class Scope { + protected readonly _names: { + [Prefix in string]?: NameGroup; + }; + protected readonly _prefixes?: Set; + protected readonly _parent?: Scope; + constructor({ prefixes, parent }?: ScopeOptions); + toName(nameOrPrefix: Name | string): Name; + name(prefix: string): Name; + protected _newName(prefix: string): string; + private _nameGroup; +} +interface ScopePath { + property: string; + itemIndex: number; +} +export declare class ValueScopeName extends Name { + readonly prefix: string; + value?: NameValue; + scopePath?: Code; + constructor(prefix: string, nameStr: string); + setValue(value: NameValue, { property, itemIndex }: ScopePath): void; +} +interface VSOptions extends ValueScopeOptions { + _n: Code; +} +export declare class ValueScope extends Scope { + protected readonly _values: ScopeValues; + protected readonly _scope: ScopeStore; + readonly opts: VSOptions; + constructor(opts: ValueScopeOptions); + get(): ScopeStore; + name(prefix: string): ValueScopeName; + value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName; + getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; + scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code; + scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code; + private _reduceValues; +} +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.js new file mode 100644 index 0000000000000000000000000000000000000000..4bc7794e3215d7b22edd0b43a7d5ee7d034d801b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.js @@ -0,0 +1,143 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0; +const code_1 = require("./code"); +class ValueError extends Error { + constructor(name) { + super(`CodeGen: "code" for ${name} not defined`); + this.value = name.value; + } +} +var UsedValueState; +(function (UsedValueState) { + UsedValueState[UsedValueState["Started"] = 0] = "Started"; + UsedValueState[UsedValueState["Completed"] = 1] = "Completed"; +})(UsedValueState || (exports.UsedValueState = UsedValueState = {})); +exports.varKinds = { + const: new code_1.Name("const"), + let: new code_1.Name("let"), + var: new code_1.Name("var"), +}; +class Scope { + constructor({ prefixes, parent } = {}) { + this._names = {}; + this._prefixes = prefixes; + this._parent = parent; + } + toName(nameOrPrefix) { + return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix); + } + name(prefix) { + return new code_1.Name(this._newName(prefix)); + } + _newName(prefix) { + const ng = this._names[prefix] || this._nameGroup(prefix); + return `${prefix}${ng.index++}`; + } + _nameGroup(prefix) { + var _a, _b; + if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`); + } + return (this._names[prefix] = { prefix, index: 0 }); + } +} +exports.Scope = Scope; +class ValueScopeName extends code_1.Name { + constructor(prefix, nameStr) { + super(nameStr); + this.prefix = prefix; + } + setValue(value, { property, itemIndex }) { + this.value = value; + this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`; + } +} +exports.ValueScopeName = ValueScopeName; +const line = (0, code_1._) `\n`; +class ValueScope extends Scope { + constructor(opts) { + super(opts); + this._values = {}; + this._scope = opts.scope; + this.opts = { ...opts, _n: opts.lines ? line : code_1.nil }; + } + get() { + return this._scope; + } + name(prefix) { + return new ValueScopeName(prefix, this._newName(prefix)); + } + value(nameOrPrefix, value) { + var _a; + if (value.ref === undefined) + throw new Error("CodeGen: ref must be passed in value"); + const name = this.toName(nameOrPrefix); + const { prefix } = name; + const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref; + let vs = this._values[prefix]; + if (vs) { + const _name = vs.get(valueKey); + if (_name) + return _name; + } + else { + vs = this._values[prefix] = new Map(); + } + vs.set(valueKey, name); + const s = this._scope[prefix] || (this._scope[prefix] = []); + const itemIndex = s.length; + s[itemIndex] = value.ref; + name.setValue(value, { property: prefix, itemIndex }); + return name; + } + getValue(prefix, keyOrRef) { + const vs = this._values[prefix]; + if (!vs) + return; + return vs.get(keyOrRef); + } + scopeRefs(scopeName, values = this._values) { + return this._reduceValues(values, (name) => { + if (name.scopePath === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return (0, code_1._) `${scopeName}${name.scopePath}`; + }); + } + scopeCode(values = this._values, usedValues, getCode) { + return this._reduceValues(values, (name) => { + if (name.value === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return name.value.code; + }, usedValues, getCode); + } + _reduceValues(values, valueCode, usedValues = {}, getCode) { + let code = code_1.nil; + for (const prefix in values) { + const vs = values[prefix]; + if (!vs) + continue; + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()); + vs.forEach((name) => { + if (nameSet.has(name)) + return; + nameSet.set(name, UsedValueState.Started); + let c = valueCode(name); + if (c) { + const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const; + code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`; + } + else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) { + code = (0, code_1._) `${code}${c}${this.opts._n}`; + } + else { + throw new ValueError(name); + } + nameSet.set(name, UsedValueState.Completed); + }); + } + return code; + } +} +exports.ValueScope = ValueScope; +//# sourceMappingURL=scope.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.js.map new file mode 100644 index 0000000000000000000000000000000000000000..911769f871e30c9b701a894a5b8b697f2cb6f381 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/codegen/scope.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../lib/compile/codegen/scope.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAezC,MAAM,UAAW,SAAQ,KAAK;IAE5B,YAAY,IAAoB;QAC9B,KAAK,CAAC,uBAAuB,IAAI,cAAc,CAAC,CAAA;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACzB,CAAC;CACF;AAuBD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yDAAO,CAAA;IACP,6DAAS,CAAA;AACX,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAMY,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,IAAI,WAAI,CAAC,OAAO,CAAC;IACxB,GAAG,EAAE,IAAI,WAAI,CAAC,KAAK,CAAC;IACpB,GAAG,EAAE,IAAI,WAAI,CAAC,KAAK,CAAC;CACrB,CAAA;AAED,MAAa,KAAK;IAKhB,YAAY,EAAC,QAAQ,EAAE,MAAM,KAAkB,EAAE;QAJ9B,WAAM,GAAqC,EAAE,CAAA;QAK9D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAED,MAAM,CAAC,YAA2B;QAChC,OAAO,YAAY,YAAY,WAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAC9E,CAAC;IAED,IAAI,CAAC,MAAc;QACjB,OAAO,IAAI,WAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IACxC,CAAC;IAES,QAAQ,CAAC,MAAc;QAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,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AA;IACb,CAAC;CACF;AAjGD,gCAiGC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..74eef7e21fd5c75e4e5086f4248c4fc99e1af429 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.d.ts @@ -0,0 +1,13 @@ +import type { KeywordErrorCxt, KeywordErrorDefinition } from "../types"; +import { CodeGen, Code, Name } from "./codegen"; +export declare const keywordError: KeywordErrorDefinition; +export declare const keyword$DataError: KeywordErrorDefinition; +export interface ErrorPaths { + instancePath?: Code; + schemaPath?: string; + parentSchema?: boolean; +} +export declare function reportError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths, overrideAllErrors?: boolean): void; +export declare function reportExtraError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths): void; +export declare function resetErrorsCount(gen: CodeGen, errsCount: Name): void; +export declare function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }: KeywordErrorCxt): void; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..24d721d80e17418eaf298fbced2aac260ac7bb24 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0; +const codegen_1 = require("./codegen"); +const util_1 = require("./util"); +const names_1 = require("./names"); +exports.keywordError = { + message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`, +}; +exports.keyword$DataError = { + message: ({ keyword, schemaType }) => schemaType + ? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)` + : (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`, +}; +function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) { + addError(gen, errObj); + } + else { + returnErrors(it, (0, codegen_1._) `[${errObj}]`); + } +} +exports.reportError = reportError; +function reportExtraError(cxt, error = exports.keywordError, errorPaths) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + addError(gen, errObj); + if (!(compositeRule || allErrors)) { + returnErrors(it, names_1.default.vErrors); + } +} +exports.reportExtraError = reportExtraError; +function resetErrorsCount(gen, errsCount) { + gen.assign(names_1.default.errors, errsCount); + gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null))); +} +exports.resetErrorsCount = resetErrorsCount; +function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) { + /* istanbul ignore if */ + if (errsCount === undefined) + throw new Error("ajv implementation error"); + const err = gen.name("err"); + gen.forRange("i", errsCount, names_1.default.errors, (i) => { + gen.const(err, (0, codegen_1._) `${names_1.default.vErrors}[${i}]`); + gen.if((0, codegen_1._) `${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._) `${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath))); + gen.assign((0, codegen_1._) `${err}.schemaPath`, (0, codegen_1.str) `${it.errSchemaPath}/${keyword}`); + if (it.opts.verbose) { + gen.assign((0, codegen_1._) `${err}.schema`, schemaValue); + gen.assign((0, codegen_1._) `${err}.data`, data); + } + }); +} +exports.extendErrors = extendErrors; +function addError(gen, errObj) { + const err = gen.const("err", errObj); + gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`); + gen.code((0, codegen_1._) `${names_1.default.errors}++`); +} +function returnErrors(it, errs) { + const { gen, validateName, schemaEnv } = it; + if (schemaEnv.$async) { + gen.throw((0, codegen_1._) `new ${it.ValidationError}(${errs})`); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, errs); + gen.return(false); + } +} +const E = { + keyword: new codegen_1.Name("keyword"), + schemaPath: new codegen_1.Name("schemaPath"), // also used in JTD errors + params: new codegen_1.Name("params"), + propertyName: new codegen_1.Name("propertyName"), + message: new codegen_1.Name("message"), + schema: new codegen_1.Name("schema"), + parentSchema: new codegen_1.Name("parentSchema"), +}; +function errorObjectCode(cxt, error, errorPaths) { + const { createErrors } = cxt.it; + if (createErrors === false) + return (0, codegen_1._) `{}`; + return errorObject(cxt, error, errorPaths); +} +function errorObject(cxt, error, errorPaths = {}) { + const { gen, it } = cxt; + const keyValues = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths), + ]; + extraErrorProps(cxt, error, keyValues); + return gen.object(...keyValues); +} +function errorInstancePath({ errorPath }, { instancePath }) { + const instPath = instancePath + ? (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` + : errorPath; + return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)]; +} +function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) { + let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str) `${errSchemaPath}/${keyword}`; + if (schemaPath) { + schPath = (0, codegen_1.str) `${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`; + } + return [E.schemaPath, schPath]; +} +function extraErrorProps(cxt, { params, message }, keyValues) { + const { keyword, data, schemaValue, it } = cxt; + const { opts, propertyName, topSchemaRef, schemaPath } = it; + keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._) `{}`]); + if (opts.messages) { + keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]); + } + if (opts.verbose) { + keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._) `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]); + } + if (propertyName) + keyValues.push([E.propertyName, propertyName]); +} +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ea08e4e311fd642690d4077ffa55199c84e26ff1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/compile/errors.ts"],"names":[],"mappings":";;;AAEA,uCAAgE;AAEhE,iCAAyC;AACzC,mCAAuB;AAEV,QAAA,YAAY,GAA2B;IAClD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,cAAc,OAAO,sBAAsB;CACvE,CAAA;AAEY,QAAA,iBAAiB,GAA2B;IACvD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CACjC,UAAU;QACR,CAAC,CAAC,IAAA,aAAG,EAAA,IAAI,OAAO,qBAAqB,UAAU,UAAU;QACzD,CAAC,CAAC,IAAA,aAAG,EAAA,IAAI,OAAO,8BAA8B;CACnD,CAAA;AAQD,SAAgB,WAAW,CACzB,GAAoB,EACpB,QAAgC,oBAAY,EAC5C,UAAuB,EACvB,iBAA2B;IAE3B,MAAM,EAAC,EAAE,EAAC,GAAG,GAAG,CAAA;IAChB,MAAM,EAAC,GAAG,EAAE,aAAa,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CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EACvB,CAAC,CAAC,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,GAAG,YAAY,GAAG,UAAU,EAAE,CAAC,EACjD,CAAC,eAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CACf,CAAA;IACH,CAAC;IACD,IAAI,YAAY;QAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;AAClE,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2809353d734c0629250f1a4facf3691fedcaf50c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.d.ts @@ -0,0 +1,80 @@ +import type { AnySchema, AnySchemaObject, AnyValidateFunction, EvaluatedProperties, EvaluatedItems } from "../types"; +import type Ajv from "../core"; +import type { InstanceOptions } from "../core"; +import { CodeGen, Name, Code, ValueScopeName } from "./codegen"; +import { LocalRefs } from "./resolve"; +import { JSONType } from "./rules"; +export type SchemaRefs = { + [Ref in string]?: SchemaEnv | AnySchema; +}; +export interface SchemaCxt { + readonly gen: CodeGen; + readonly allErrors?: boolean; + readonly data: Name; + readonly parentData: Name; + readonly parentDataProperty: Code | number; + readonly dataNames: Name[]; + readonly dataPathArr: (Code | number)[]; + readonly dataLevel: number; + dataTypes: JSONType[]; + definedProperties: Set; + readonly topSchemaRef: Code; + readonly validateName: Name; + evaluated?: Name; + readonly ValidationError?: Name; + readonly schema: AnySchema; + readonly schemaEnv: SchemaEnv; + readonly rootId: string; + baseId: string; + readonly schemaPath: Code; + readonly errSchemaPath: string; + readonly errorPath: Code; + readonly propertyName?: Name; + readonly compositeRule?: boolean; + props?: EvaluatedProperties | Name; + items?: EvaluatedItems | Name; + jtdDiscriminator?: string; + jtdMetadata?: boolean; + readonly createErrors?: boolean; + readonly opts: InstanceOptions; + readonly self: Ajv; +} +export interface SchemaObjCxt extends SchemaCxt { + readonly schema: AnySchemaObject; +} +interface SchemaEnvArgs { + readonly schema: AnySchema; + readonly schemaId?: "$id" | "id"; + readonly root?: SchemaEnv; + readonly baseId?: string; + readonly schemaPath?: string; + readonly localRefs?: LocalRefs; + readonly meta?: boolean; +} +export declare class SchemaEnv implements SchemaEnvArgs { + readonly schema: AnySchema; + readonly schemaId?: "$id" | "id"; + readonly root: SchemaEnv; + baseId: string; + schemaPath?: string; + localRefs?: LocalRefs; + readonly meta?: boolean; + readonly $async?: boolean; + readonly refs: SchemaRefs; + readonly dynamicAnchors: { + [Ref in string]?: true; + }; + validate?: AnyValidateFunction; + validateName?: ValueScopeName; + serialize?: (data: unknown) => string; + serializeName?: ValueScopeName; + parse?: (data: string) => unknown; + parseName?: ValueScopeName; + constructor(env: SchemaEnvArgs); +} +export declare function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv; +export declare function resolveRef(this: Ajv, root: SchemaEnv, baseId: string, ref: string): AnySchema | SchemaEnv | undefined; +export declare function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void; +export declare function resolveSchema(this: Ajv, root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it +ref: string): SchemaEnv | undefined; +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.js new file mode 100644 index 0000000000000000000000000000000000000000..9e42a55880d77f51c4b21c92bee27a88b98cac4d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.js @@ -0,0 +1,242 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0; +const codegen_1 = require("./codegen"); +const validation_error_1 = require("../runtime/validation_error"); +const names_1 = require("./names"); +const resolve_1 = require("./resolve"); +const util_1 = require("./util"); +const validate_1 = require("./validate"); +class SchemaEnv { + constructor(env) { + var _a; + this.refs = {}; + this.dynamicAnchors = {}; + let schema; + if (typeof env.schema == "object") + schema = env.schema; + this.schema = env.schema; + this.schemaId = env.schemaId; + this.root = env.root || this; + this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]); + this.schemaPath = env.schemaPath; + this.localRefs = env.localRefs; + this.meta = env.meta; + this.$async = schema === null || schema === void 0 ? void 0 : schema.$async; + this.refs = {}; + } +} +exports.SchemaEnv = SchemaEnv; +// let codeSize = 0 +// let nodeCount = 0 +// Compiles schema in SchemaEnv +function compileSchema(sch) { + // TODO refactor - remove compilations + const _sch = getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + let _ValidationError; + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: validation_error_1.default, + code: (0, codegen_1._) `require("ajv/dist/runtime/validation_error").default`, + }); + } + const validateName = gen.scopeName("validate"); + sch.validateName = validateName; + const schemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: names_1.default.data, + parentData: names_1.default.parentData, + parentDataProperty: names_1.default.parentDataProperty, + dataNames: [names_1.default.data], + dataPathArr: [codegen_1.nil], // TODO can its length be used as dataLevel if nil is removed? + dataLevel: 0, + dataTypes: [], + definedProperties: new Set(), + topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true + ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } + : { ref: sch.schema }), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: codegen_1.nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: (0, codegen_1._) `""`, + opts: this.opts, + self: this, + }; + let sourceCode; + try { + this._compilations.add(sch); + (0, validate_1.validateFunctionCode)(schemaCxt); + gen.optimize(this.opts.code.optimize); + // gen.optimize(1) + const validateCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`; + // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) + if (this.opts.code.process) + sourceCode = this.opts.code.process(sourceCode, sch); + // console.log("\n\n\n *** \n", sourceCode) + const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); + const validate = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate }); + validate.errors = null; + validate.schema = sch.schema; + validate.schemaEnv = sch; + if (sch.$async) + validate.$async = true; + if (this.opts.code.source === true) { + validate.source = { validateName, validateCode, scopeValues: gen._values }; + } + if (this.opts.unevaluated) { + const { props, items } = schemaCxt; + validate.evaluated = { + props: props instanceof codegen_1.Name ? undefined : props, + items: items instanceof codegen_1.Name ? undefined : items, + dynamicProps: props instanceof codegen_1.Name, + dynamicItems: items instanceof codegen_1.Name, + }; + if (validate.source) + validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated); + } + sch.validate = validate; + return sch; + } + catch (e) { + delete sch.validate; + delete sch.validateName; + if (sourceCode) + this.logger.error("Error compiling schema, function code:", sourceCode); + // console.log("\n\n\n *** \n", sourceCode, this.opts) + throw e; + } + finally { + this._compilations.delete(sch); + } +} +exports.compileSchema = compileSchema; +function resolveRef(root, baseId, ref) { + var _a; + ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref); + const schOrFunc = root.refs[ref]; + if (schOrFunc) + return schOrFunc; + let _sch = resolve.call(this, root, ref); + if (_sch === undefined) { + const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv + const { schemaId } = this.opts; + if (schema) + _sch = new SchemaEnv({ schema, schemaId, root, baseId }); + } + if (_sch === undefined) + return; + return (root.refs[ref] = inlineOrCompile.call(this, _sch)); +} +exports.resolveRef = resolveRef; +function inlineOrCompile(sch) { + if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) + return sch.schema; + return sch.validate ? sch : compileSchema.call(this, sch); +} +// Index of schema compilation in the currently compiled list +function getCompilingSchema(schEnv) { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) + return sch; + } +} +exports.getCompilingSchema = getCompilingSchema; +function sameSchemaEnv(s1, s2) { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId; +} +// resolve and compile the references ($ref) +// TODO returns AnySchemaObject (if the schema can be inlined) or validation function +function resolve(root, // information about the root schema for the current schema +ref // reference to resolve +) { + let sch; + while (typeof (sch = this.refs[ref]) == "string") + ref = sch; + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref); +} +// Resolve schema, its root and baseId +function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it +ref // reference to resolve +) { + const p = this.opts.uriResolver.parse(ref); + const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p); + let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined); + // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root); + } + const id = (0, resolve_1.normalizeId)(refPath); + const schOrRef = this.refs[id] || this.schemas[id]; + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef); + if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") + return; + return getJsonPointer.call(this, p, sch); + } + if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") + return; + if (!schOrRef.validate) + compileSchema.call(this, schOrRef); + if (id === (0, resolve_1.normalizeId)(ref)) { + const { schema } = schOrRef; + const { schemaId } = this.opts; + const schId = schema[schemaId]; + if (schId) + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + return new SchemaEnv({ schema, schemaId, root, baseId }); + } + return getJsonPointer.call(this, p, schOrRef); +} +exports.resolveSchema = resolveSchema; +const PREVENT_SCOPE_CHANGE = new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions", +]); +function getJsonPointer(parsedRef, { baseId, schema, root }) { + var _a; + if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/") + return; + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema === "boolean") + return; + const partSchema = schema[(0, util_1.unescapeFragment)(part)]; + if (partSchema === undefined) + return; + schema = partSchema; + // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? + const schId = typeof schema === "object" && schema[this.opts.schemaId]; + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + } + } + let env; + if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) { + const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref); + env = resolveSchema.call(this, root, $ref); + } + // even though resolution failed we need to return SchemaEnv to throw exception + // so that compileAsync loads missing schema. + const { schemaId } = this.opts; + env = env || new SchemaEnv({ schema, schemaId, root, baseId }); + if (env.schema !== env.root.schema) + return env; + return undefined; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..22dcc0bb61766fa23fb5461dbcfdc0b2d0b0326c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":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M;QACpC,MAAM,GAAG,UAAU,CAAA;QACnB,6DAA6D;QAC7D,MAAM,KAAK,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtE,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;YAC7C,MAAM,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QAC3D,CAAC;IACH,CAAC;IACD,IAAI,GAA0B,CAAA;IAC9B,IAAI,OAAO,MAAM,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAA,2BAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3F,MAAM,IAAI,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QACnE,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAC5C,CAAC;IACD,+EAA+E;IAC/E,6CAA6C;IAC7C,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC5B,GAAG,GAAG,GAAG,IAAI,IAAI,SAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAA;IAC9C,OAAO,SAAS,CAAA;AAClB,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..618c64aea0e5c2a23e145245f5ad9c9d6b24922a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.d.ts @@ -0,0 +1,4 @@ +import type Ajv from "../../core"; +import { SchemaObjectMap } from "./types"; +import { SchemaEnv } from ".."; +export default function compileParser(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.js new file mode 100644 index 0000000000000000000000000000000000000000..8fc94fd0eae5349e3513ce79e3f2ba1a3ffbdc6a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.js @@ -0,0 +1,350 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const types_1 = require("./types"); +const __1 = require(".."); +const codegen_1 = require("../codegen"); +const ref_error_1 = require("../ref_error"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const ref_1 = require("../../vocabularies/jtd/ref"); +const type_1 = require("../../vocabularies/jtd/type"); +const parseJson_1 = require("../../runtime/parseJson"); +const util_1 = require("../util"); +const timestamp_1 = require("../../runtime/timestamp"); +const genParse = { + elements: parseElements, + values: parseValues, + discriminator: parseDiscriminator, + properties: parseProperties, + optionalProperties: parseProperties, + enum: parseEnum, + type: parseType, + ref: parseRef, +}; +function compileParser(sch, definitions) { + const _sch = __1.getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + const parseName = gen.scopeName("parse"); + const cxt = { + self: this, + gen, + schema: sch.schema, + schemaEnv: sch, + definitions, + data: names_1.default.data, + parseName, + char: gen.name("c"), + }; + let sourceCode; + try { + this._compilations.add(sch); + sch.parseName = parseName; + parserFunction(cxt); + gen.optimize(this.opts.code.optimize); + const parseFuncCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${parseFuncCode}`; + const makeParse = new Function(`${names_1.default.scope}`, sourceCode); + const parse = makeParse(this.scope.get()); + this.scope.value(parseName, { ref: parse }); + sch.parse = parse; + } + catch (e) { + if (sourceCode) + this.logger.error("Error compiling parser, function code:", sourceCode); + delete sch.parse; + delete sch.parseName; + throw e; + } + finally { + this._compilations.delete(sch); + } + return sch; +} +exports.default = compileParser; +const undef = (0, codegen_1._) `undefined`; +function parserFunction(cxt) { + const { gen, parseName, char } = cxt; + gen.func(parseName, (0, codegen_1._) `${names_1.default.json}, ${names_1.default.jsonPos}, ${names_1.default.jsonPart}`, false, () => { + gen.let(names_1.default.data); + gen.let(char); + gen.assign((0, codegen_1._) `${parseName}.message`, undef); + gen.assign((0, codegen_1._) `${parseName}.position`, undef); + gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${names_1.default.jsonPos} || 0`); + gen.const(names_1.default.jsonLen, (0, codegen_1._) `${names_1.default.json}.length`); + parseCode(cxt); + skipWhitespace(cxt); + gen.if(names_1.default.jsonPart, () => { + gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); + gen.return(names_1.default.data); + }); + gen.if((0, codegen_1._) `${names_1.default.jsonPos} === ${names_1.default.jsonLen}`, () => gen.return(names_1.default.data)); + jsonSyntaxError(cxt); + }); +} +function parseCode(cxt) { + let form; + for (const key of types_1.jtdForms) { + if (key in cxt.schema) { + form = key; + break; + } + } + if (form) + parseNullable(cxt, genParse[form]); + else + parseEmpty(cxt); +} +const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)); +function parseNullable(cxt, parseForm) { + const { gen, schema, data } = cxt; + if (!schema.nullable) + return parseForm(cxt); + tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)); +} +function parseElements(cxt) { + const { gen, schema, data } = cxt; + parseToken(cxt, "["); + const ix = gen.let("i", 0); + gen.assign(data, (0, codegen_1._) `[]`); + parseItems(cxt, "]", () => { + const el = gen.let("el"); + parseCode({ ...cxt, schema: schema.elements, data: el }); + gen.assign((0, codegen_1._) `${data}[${ix}++]`, el); + }); +} +function parseValues(cxt) { + const { gen, schema, data } = cxt; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)); +} +function parseItems(cxt, endToken, block) { + tryParseItems(cxt, endToken, block); + parseToken(cxt, endToken); +} +function tryParseItems(cxt, endToken, block) { + const { gen } = cxt; + gen.for((0, codegen_1._) `;${names_1.default.jsonPos}<${names_1.default.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { + block(); + tryParseToken(cxt, ",", () => gen.break(), hasItem); + }); + function hasItem() { + tryParseToken(cxt, endToken, () => { }, jsonSyntaxError); + } +} +function parseKeyValue(cxt, schema) { + const { gen } = cxt; + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + parsePropertyValue(cxt, key, schema); +} +function parseDiscriminator(cxt) { + const { gen, data, schema } = cxt; + const { discriminator, mapping } = schema; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + const startPos = gen.const("pos", names_1.default.jsonPos); + const value = gen.let("value"); + const tag = gen.let("tag"); + tryParseItems(cxt, "}", () => { + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + gen.if((0, codegen_1._) `${key} === ${discriminator}`, () => { + parseString({ ...cxt, data: tag }); + gen.assign((0, codegen_1._) `${data}[${key}]`, tag); + gen.break(); + }, () => parseEmpty({ ...cxt, data: value }) // can be discarded/skipped + ); + }); + gen.assign(names_1.default.jsonPos, startPos); + gen.if((0, codegen_1._) `${tag} === undefined`); + parsingError(cxt, (0, codegen_1.str) `discriminator tag not found`); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + parseSchemaProperties({ ...cxt, schema: mapping[tagValue] }, discriminator); + } + gen.else(); + parsingError(cxt, (0, codegen_1.str) `discriminator value not in schema`); + gen.endIf(); +} +function parseProperties(cxt) { + const { gen, data } = cxt; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + parseSchemaProperties(cxt); +} +function parseSchemaProperties(cxt, discriminator) { + const { gen, schema, data } = cxt; + const { properties, optionalProperties, additionalProperties } = schema; + parseItems(cxt, "}", () => { + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + gen.if(false); + parseDefinedProperty(cxt, key, properties); + parseDefinedProperty(cxt, key, optionalProperties); + if (discriminator) { + gen.elseIf((0, codegen_1._) `${key} === ${discriminator}`); + const tag = gen.let("tag"); + parseString({ ...cxt, data: tag }); // can be discarded, it is already assigned + } + gen.else(); + if (additionalProperties) { + parseEmpty({ ...cxt, data: (0, codegen_1._) `${data}[${key}]` }); + } + else { + parsingError(cxt, (0, codegen_1.str) `property ${key} not allowed`); + } + gen.endIf(); + }); + if (properties) { + const hasProp = (0, code_1.hasPropFunc)(gen); + const allProps = (0, codegen_1.and)(...Object.keys(properties).map((p) => (0, codegen_1._) `${hasProp}.call(${data}, ${p})`)); + gen.if((0, codegen_1.not)(allProps), () => parsingError(cxt, (0, codegen_1.str) `missing required properties`)); + } +} +function parseDefinedProperty(cxt, key, schemas = {}) { + const { gen } = cxt; + for (const prop in schemas) { + gen.elseIf((0, codegen_1._) `${key} === ${prop}`); + parsePropertyValue(cxt, key, schemas[prop]); + } +} +function parsePropertyValue(cxt, key, schema) { + parseCode({ ...cxt, schema, data: (0, codegen_1._) `${cxt.data}[${key}]` }); +} +function parseType(cxt) { + const { gen, schema, data, self } = cxt; + switch (schema.type) { + case "boolean": + parseBoolean(cxt); + break; + case "string": + parseString(cxt); + break; + case "timestamp": { + parseString(cxt); + const vts = (0, util_1.useFunc)(gen, timestamp_1.default); + const { allowDate, parseDate } = self.opts; + const notValid = allowDate ? (0, codegen_1._) `!${vts}(${data}, true)` : (0, codegen_1._) `!${vts}(${data})`; + const fail = parseDate + ? (0, codegen_1.or)(notValid, (0, codegen_1._) `(${data} = new Date(${data}), false)`, (0, codegen_1._) `isNaN(${data}.valueOf())`) + : notValid; + gen.if(fail, () => parsingError(cxt, (0, codegen_1.str) `invalid timestamp`)); + break; + } + case "float32": + case "float64": + parseNumber(cxt); + break; + default: { + const t = schema.type; + if (!self.opts.int32range && (t === "int32" || t === "uint32")) { + parseNumber(cxt, 16); // 2 ** 53 - max safe integer + if (t === "uint32") { + gen.if((0, codegen_1._) `${data} < 0`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); + } + } + else { + const [min, max, maxDigits] = type_1.intRange[t]; + parseNumber(cxt, maxDigits); + gen.if((0, codegen_1._) `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); + } + } + } +} +function parseString(cxt) { + parseToken(cxt, '"'); + parseWith(cxt, parseJson_1.parseJsonString); +} +function parseEnum(cxt) { + const { gen, data, schema } = cxt; + const enumSch = schema.enum; + parseToken(cxt, '"'); + // TODO loopEnum + gen.if(false); + for (const value of enumSch) { + const valueStr = JSON.stringify(value).slice(1); // remove starting quote + gen.elseIf((0, codegen_1._) `${jsonSlice(valueStr.length)} === ${valueStr}`); + gen.assign(data, (0, codegen_1.str) `${value}`); + gen.add(names_1.default.jsonPos, valueStr.length); + } + gen.else(); + jsonSyntaxError(cxt); + gen.endIf(); +} +function parseNumber(cxt, maxDigits) { + const { gen } = cxt; + skipWhitespace(cxt); + gen.if((0, codegen_1._) `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits)); +} +function parseBooleanToken(bool, fail) { + return (cxt) => { + const { gen, data } = cxt; + tryParseToken(cxt, `${bool}`, () => fail(cxt), () => gen.assign(data, bool)); + }; +} +function parseRef(cxt) { + const { gen, self, definitions, schema, schemaEnv } = cxt; + const { ref } = schema; + const refSchema = definitions[ref]; + if (!refSchema) + throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); + if (!(0, ref_1.hasRef)(refSchema)) + return parseCode({ ...cxt, schema: refSchema }); + const { root } = schemaEnv; + const sch = compileParser.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); + partialParse(cxt, getParser(gen, sch), true); +} +function getParser(gen, sch) { + return sch.parse + ? gen.scopeValue("parse", { ref: sch.parse }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.parse`; +} +function parseEmpty(cxt) { + parseWith(cxt, parseJson_1.parseJson); +} +function parseWith(cxt, parseFunc, args) { + partialParse(cxt, (0, util_1.useFunc)(cxt.gen, parseFunc), args); +} +function partialParse(cxt, parseFunc, args) { + const { gen, data } = cxt; + gen.assign(data, (0, codegen_1._) `${parseFunc}(${names_1.default.json}, ${names_1.default.jsonPos}${args ? (0, codegen_1._) `, ${args}` : codegen_1.nil})`); + gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${parseFunc}.position`); + gen.if((0, codegen_1._) `${data} === undefined`, () => parsingError(cxt, (0, codegen_1._) `${parseFunc}.message`)); +} +function parseToken(cxt, tok) { + tryParseToken(cxt, tok, jsonSyntaxError); +} +function tryParseToken(cxt, tok, fail, success) { + const { gen } = cxt; + const n = tok.length; + skipWhitespace(cxt); + gen.if((0, codegen_1._) `${jsonSlice(n)} === ${tok}`, () => { + gen.add(names_1.default.jsonPos, n); + success === null || success === void 0 ? void 0 : success(cxt); + }, () => fail(cxt)); +} +function skipWhitespace({ gen, char: c }) { + gen.code((0, codegen_1._) `while((${c}=${names_1.default.json}[${names_1.default.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${names_1.default.jsonPos}++;`); +} +function jsonSlice(len) { + return len === 1 + ? (0, codegen_1._) `${names_1.default.json}[${names_1.default.jsonPos}]` + : (0, codegen_1._) `${names_1.default.json}.slice(${names_1.default.jsonPos}, ${names_1.default.jsonPos}+${len})`; +} +function jsonSyntaxError(cxt) { + parsingError(cxt, (0, codegen_1._) `"unexpected token " + ${names_1.default.json}[${names_1.default.jsonPos}]`); +} +function parsingError({ gen, parseName }, msg) { + gen.assign((0, codegen_1._) `${parseName}.message`, msg); + gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); + gen.return(undef); +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.js.map new file mode 100644 index 0000000000000000000000000000000000000000..87bd922aef155cde52e2a9f0bba94493ad5182bf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../lib/compile/jtd/parse.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AAC1D,0BAAgD;AAChD,wCAAmF;AACnF,4CAA0C;AAC1C,oCAAwB;AACxB,kDAAmD;AACnD,oDAAiD;AACjD,sDAA6D;AAC7D,uDAAmF;AACnF,kCAA+B;AAC/B,uDAAoD;AAIpD,MAAM,QAAQ,GAA+B;IAC3C,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,WAAW;IACnB,aAAa,EAAE,kBAAkB;IACjC,UAAU,EAAE,eAAe;IAC3B,kBAAkB,EAAE,eAAe;IACnC,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,QAAQ;CACd,CAAA;AAaD,SAAwB,aAAa,CAEnC,GAAc,EACd,WAA4B;IAE5B,MAAM,IAAI,GAAG,sBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACnC,MAAM,E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,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,UAAU,eAAC,CAAC,OAAO,KAAK,eAAC,CAAC,OAAO,IAAI,GAAG,GAAG,CAAA;AAC3D,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,YAAY,CAAC,GAAG,EAAE,IAAA,WAAC,EAAA,yBAAyB,eAAC,CAAC,IAAI,IAAI,eAAC,CAAC,OAAO,GAAG,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,YAAY,CAAC,EAAC,GAAG,EAAE,SAAS,EAAW,EAAE,GAAS;IACzD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,UAAU,EAAE,GAAG,CAAC,CAAA;IACxC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,WAAW,EAAE,eAAC,CAAC,OAAO,CAAC,CAAA;IAC/C,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACnB,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0413d716df0dcbe79c101405610a29075c61bfd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.d.ts @@ -0,0 +1,4 @@ +import type Ajv from "../../core"; +import { SchemaObjectMap } from "./types"; +import { SchemaEnv } from ".."; +export default function compileSerializer(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.js new file mode 100644 index 0000000000000000000000000000000000000000..341c50078a07361c50496a94a113d08f198160b5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.js @@ -0,0 +1,229 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const types_1 = require("./types"); +const __1 = require(".."); +const codegen_1 = require("../codegen"); +const ref_error_1 = require("../ref_error"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const ref_1 = require("../../vocabularies/jtd/ref"); +const util_1 = require("../util"); +const quote_1 = require("../../runtime/quote"); +const genSerialize = { + elements: serializeElements, + values: serializeValues, + discriminator: serializeDiscriminator, + properties: serializeProperties, + optionalProperties: serializeProperties, + enum: serializeString, + type: serializeType, + ref: serializeRef, +}; +function compileSerializer(sch, definitions) { + const _sch = __1.getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + const serializeName = gen.scopeName("serialize"); + const cxt = { + self: this, + gen, + schema: sch.schema, + schemaEnv: sch, + definitions, + data: names_1.default.data, + }; + let sourceCode; + try { + this._compilations.add(sch); + sch.serializeName = serializeName; + gen.func(serializeName, names_1.default.data, false, () => { + gen.let(names_1.default.json, (0, codegen_1.str) ``); + serializeCode(cxt); + gen.return(names_1.default.json); + }); + gen.optimize(this.opts.code.optimize); + const serializeFuncCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${serializeFuncCode}`; + const makeSerialize = new Function(`${names_1.default.scope}`, sourceCode); + const serialize = makeSerialize(this.scope.get()); + this.scope.value(serializeName, { ref: serialize }); + sch.serialize = serialize; + } + catch (e) { + if (sourceCode) + this.logger.error("Error compiling serializer, function code:", sourceCode); + delete sch.serialize; + delete sch.serializeName; + throw e; + } + finally { + this._compilations.delete(sch); + } + return sch; +} +exports.default = compileSerializer; +function serializeCode(cxt) { + let form; + for (const key of types_1.jtdForms) { + if (key in cxt.schema) { + form = key; + break; + } + } + serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty); +} +function serializeNullable(cxt, serializeForm) { + const { gen, schema, data } = cxt; + if (!schema.nullable) + return serializeForm(cxt); + gen.if((0, codegen_1._) `${data} === undefined || ${data} === null`, () => gen.add(names_1.default.json, (0, codegen_1._) `"null"`), () => serializeForm(cxt)); +} +function serializeElements(cxt) { + const { gen, schema, data } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `[`); + const first = gen.let("first", true); + gen.forOf("el", data, (el) => { + addComma(cxt, first); + serializeCode({ ...cxt, schema: schema.elements, data: el }); + }); + gen.add(names_1.default.json, (0, codegen_1.str) `]`); +} +function serializeValues(cxt) { + const { gen, schema, data } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `{`); + const first = gen.let("first", true); + gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeKeyValue(cxt, key, schema, first) { + const { gen, data } = cxt; + addComma(cxt, first); + serializeString({ ...cxt, data: key }); + gen.add(names_1.default.json, (0, codegen_1.str) `:`); + const value = gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); + serializeCode({ ...cxt, schema, data: value }); +} +function serializeDiscriminator(cxt) { + const { gen, schema, data } = cxt; + const { discriminator } = schema; + gen.add(names_1.default.json, (0, codegen_1.str) `{${JSON.stringify(discriminator)}:`); + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(discriminator)}`); + serializeString({ ...cxt, data: tag }); + gen.if(false); + for (const tagValue in schema.mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + const sch = schema.mapping[tagValue]; + serializeSchemaProperties({ ...cxt, schema: sch }, discriminator); + } + gen.endIf(); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeProperties(cxt) { + const { gen } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `{`); + serializeSchemaProperties(cxt); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeSchemaProperties(cxt, discriminator) { + const { gen, schema, data } = cxt; + const { properties, optionalProperties } = schema; + const props = keys(properties); + const optProps = keys(optionalProperties); + const allProps = allProperties(props.concat(optProps)); + let first = !discriminator; + let firstProp; + for (const key of props) { + if (first) + first = false; + else + gen.add(names_1.default.json, (0, codegen_1.str) `,`); + serializeProperty(key, properties[key], keyValue(key)); + } + if (first) + firstProp = gen.let("first", true); + for (const key of optProps) { + const value = keyValue(key); + gen.if((0, codegen_1.and)((0, codegen_1._) `${value} !== undefined`, (0, code_1.isOwnProperty)(gen, data, key)), () => { + addComma(cxt, firstProp); + serializeProperty(key, optionalProperties[key], value); + }); + } + if (schema.additionalProperties) { + gen.forIn("key", data, (key) => gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, firstProp))); + } + function keys(ps) { + return ps ? Object.keys(ps) : []; + } + function allProperties(ps) { + if (discriminator) + ps.push(discriminator); + if (new Set(ps).size !== ps.length) { + throw new Error("JTD: properties/optionalProperties/disciminator overlap"); + } + return ps; + } + function keyValue(key) { + return gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); + } + function serializeProperty(key, propSchema, value) { + gen.add(names_1.default.json, (0, codegen_1.str) `${JSON.stringify(key)}:`); + serializeCode({ ...cxt, schema: propSchema, data: value }); + } + function isAdditional(key, ps) { + return ps.length ? (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`)) : true; + } +} +function serializeType(cxt) { + const { gen, schema, data } = cxt; + switch (schema.type) { + case "boolean": + gen.add(names_1.default.json, (0, codegen_1._) `${data} ? "true" : "false"`); + break; + case "string": + serializeString(cxt); + break; + case "timestamp": + gen.if((0, codegen_1._) `${data} instanceof Date`, () => gen.add(names_1.default.json, (0, codegen_1._) `'"' + ${data}.toISOString() + '"'`), () => serializeString(cxt)); + break; + default: + serializeNumber(cxt); + } +} +function serializeString({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `${(0, util_1.useFunc)(gen, quote_1.default)}(${data})`); +} +function serializeNumber({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `"" + ${data}`); +} +function serializeRef(cxt) { + const { gen, self, data, definitions, schema, schemaEnv } = cxt; + const { ref } = schema; + const refSchema = definitions[ref]; + if (!refSchema) + throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); + if (!(0, ref_1.hasRef)(refSchema)) + return serializeCode({ ...cxt, schema: refSchema }); + const { root } = schemaEnv; + const sch = compileSerializer.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); + gen.add(names_1.default.json, (0, codegen_1._) `${getSerialize(gen, sch)}(${data})`); +} +function getSerialize(gen, sch) { + return sch.serialize + ? gen.scopeValue("serialize", { ref: sch.serialize }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.serialize`; +} +function serializeEmpty({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `JSON.stringify(${data})`); +} +function addComma({ gen }, first) { + if (first) { + gen.if(first, () => gen.assign(first, false), () => gen.add(names_1.default.json, (0, codegen_1.str) `,`)); + } + else { + gen.add(names_1.default.json, (0, codegen_1.str) `,`); + } +} +//# sourceMappingURL=serialize.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.js.map new file mode 100644 index 0000000000000000000000000000000000000000..15c82c7147427d9801eec5d386652a5b5170e7cd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/serialize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../lib/compile/jtd/serialize.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AAC1D,0BAAgD;AAChD,wCAAwE;AACxE,4CAA0C;AAC1C,oCAAwB;AACxB,kDAAqD;AACrD,oDAAiD;AACjD,kCAA+B;AAC/B,+CAAuC;AAEvC,MAAM,YAAY,GAAkD;IAClE,QAAQ,EAAE,iBAAi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,CAAC,SAAS,EAAC,CAAC;QACnD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,YAAY,CAAA;AAC3D,CAAC;AAED,SAAS,cAAc,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;IAC/C,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,kBAAkB,IAAI,GAAG,CAAC,CAAA;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,EAAC,GAAG,EAAe,EAAE,KAAY;IACjD,IAAI,KAAK,EAAE,CAAC;QACV,GAAG,CAAC,EAAE,CACJ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAC9B,CAAA;IACH,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;IACzB,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..678986f1bd93cdb821e40d3a0ffcb804df79e95b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.d.ts @@ -0,0 +1,6 @@ +import type { SchemaObject } from "../../types"; +export type SchemaObjectMap = { + [Ref in string]?: SchemaObject; +}; +export declare const jtdForms: readonly ["elements", "values", "discriminator", "properties", "optionalProperties", "enum", "type", "ref"]; +export type JTDForm = (typeof jtdForms)[number]; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.js new file mode 100644 index 0000000000000000000000000000000000000000..b9c60a90fdd7ff01af7ea51ccf0fdfe39459bc3f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jtdForms = void 0; +exports.jtdForms = [ + "elements", + "values", + "discriminator", + "properties", + "optionalProperties", + "enum", + "type", + "ref", +]; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..53439e002a07c221fe548ea439001cd8c2487521 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/jtd/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/compile/jtd/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5740e82c66e6abce4a181b3e3816504980d75406 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.d.ts @@ -0,0 +1,20 @@ +import { Name } from "./codegen"; +declare const names: { + data: Name; + valCxt: Name; + instancePath: Name; + parentData: Name; + parentDataProperty: Name; + rootData: Name; + dynamicAnchors: Name; + vErrors: Name; + errors: Name; + this: Name; + self: Name; + scope: Name; + json: Name; + jsonPos: Name; + jsonLen: Name; + jsonPart: Name; +}; +export default names; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.js new file mode 100644 index 0000000000000000000000000000000000000000..3bce5aaa9a63cdbdab5e10e3dc053fcccffede1b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("./codegen"); +const names = { + // validation function arguments + data: new codegen_1.Name("data"), // data passed to validation function + // args passed from referencing schema + valCxt: new codegen_1.Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below + instancePath: new codegen_1.Name("instancePath"), + parentData: new codegen_1.Name("parentData"), + parentDataProperty: new codegen_1.Name("parentDataProperty"), + rootData: new codegen_1.Name("rootData"), // root data - same as the data passed to the first/top validation function + dynamicAnchors: new codegen_1.Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef + // function scoped variables + vErrors: new codegen_1.Name("vErrors"), // null or array of validation errors + errors: new codegen_1.Name("errors"), // counter of validation errors + this: new codegen_1.Name("this"), + // "globals" + self: new codegen_1.Name("self"), + scope: new codegen_1.Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new codegen_1.Name("json"), + jsonPos: new codegen_1.Name("jsonPos"), + jsonLen: new codegen_1.Name("jsonLen"), + jsonPart: new codegen_1.Name("jsonPart"), +}; +exports.default = names; +//# sourceMappingURL=names.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.js.map new file mode 100644 index 0000000000000000000000000000000000000000..971fcbf70e6ef5305d7f9627983fe22f922840f8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/names.js.map @@ -0,0 +1 @@ +{"version":3,"file":"names.js","sourceRoot":"","sources":["../../lib/compile/names.ts"],"names":[],"mappings":";;AAAA,uCAA8B;AAE9B,MAAM,KAAK,GAAG;IACZ,gCAAgC;IAChC,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC,EAAE,qCAAqC;IAC7D,sCAAsC;IACtC,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC,EAAE,+FAA+F;IAC3H,YAAY,EAAE,IAAI,cAAI,CAAC,cAAc,CAAC;IACtC,UAAU,EAAE,IAAI,cAAI,CAAC,YAAY,CAAC;IAClC,kBAAkB,EAAE,IAAI,cAAI,CAAC,oBAAoB,CAAC;IAClD,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC,EAAE,2EAA2E;IAC3G,cAAc,EAAE,IAAI,cAAI,CAAC,gBAAgB,CAAC,EAAE,8CAA8C;IAC1F,4BAA4B;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC,EAAE,qCAAqC;IACnE,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC,EAAE,+BAA+B;IAC3D,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,YAAY;IACZ,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,KAAK,EAAE,IAAI,cAAI,CAAC,OAAO,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;CAC/B,CAAA;AAED,kBAAe,KAAK,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..43374439e5908ab68ef9926a3a85451426b452f0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.d.ts @@ -0,0 +1,6 @@ +import type { UriResolver } from "../types"; +export default class MissingRefError extends Error { + readonly missingRef: string; + readonly missingSchema: string; + constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string); +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.js new file mode 100644 index 0000000000000000000000000000000000000000..3916dec8a369a8df657b94c9e79d41a588c805fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const resolve_1 = require("./resolve"); +class MissingRefError extends Error { + constructor(resolver, baseId, ref, msg) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`); + this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref); + this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef)); + } +} +exports.default = MissingRefError; +//# sourceMappingURL=ref_error.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d13f5f2dd01895442ec50e24964c4e0aaf323c0c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/ref_error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref_error.js","sourceRoot":"","sources":["../../lib/compile/ref_error.ts"],"names":[],"mappings":";;AAAA,uCAA8D;AAG9D,MAAqB,eAAgB,SAAQ,KAAK;IAIhD,YAAY,QAAqB,EAAE,MAAc,EAAE,GAAW,EAAE,GAAY;QAC1E,KAAK,CAAC,GAAG,IAAI,2BAA2B,GAAG,YAAY,MAAM,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,UAAU,GAAG,IAAA,oBAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;QACnD,IAAI,CAAC,aAAa,GAAG,IAAA,qBAAW,EAAC,IAAA,qBAAW,EAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;IAC1E,CAAC;CACF;AATD,kCASC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c20fffcb76a1e6479fad2b9c4d653a8641c2b54 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.d.ts @@ -0,0 +1,12 @@ +import type { AnySchema, AnySchemaObject, UriResolver } from "../types"; +import type Ajv from "../ajv"; +import type { URIComponent } from "fast-uri"; +export type LocalRefs = { + [Ref in string]?: AnySchemaObject; +}; +export declare function inlineRef(schema: AnySchema, limit?: boolean | number): boolean; +export declare function getFullPath(resolver: UriResolver, id?: string, normalize?: boolean): string; +export declare function _getFullPath(resolver: UriResolver, p: URIComponent): string; +export declare function normalizeId(id: string | undefined): string; +export declare function resolveUrl(resolver: UriResolver, baseId: string, id: string): string; +export declare function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.js new file mode 100644 index 0000000000000000000000000000000000000000..f12f968dc07d94a435186b32108551f4d429f23a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0; +const util_1 = require("./util"); +const equal = require("fast-deep-equal"); +const traverse = require("json-schema-traverse"); +// TODO refactor to use keyword definitions +const SIMPLE_INLINED = new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const", +]); +function inlineRef(schema, limit = true) { + if (typeof schema == "boolean") + return true; + if (limit === true) + return !hasRef(schema); + if (!limit) + return false; + return countKeys(schema) <= limit; +} +exports.inlineRef = inlineRef; +const REF_KEYWORDS = new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor", +]); +function hasRef(schema) { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) + return true; + const sch = schema[key]; + if (Array.isArray(sch) && sch.some(hasRef)) + return true; + if (typeof sch == "object" && hasRef(sch)) + return true; + } + return false; +} +function countKeys(schema) { + let count = 0; + for (const key in schema) { + if (key === "$ref") + return Infinity; + count++; + if (SIMPLE_INLINED.has(key)) + continue; + if (typeof schema[key] == "object") { + (0, util_1.eachItem)(schema[key], (sch) => (count += countKeys(sch))); + } + if (count === Infinity) + return Infinity; + } + return count; +} +function getFullPath(resolver, id = "", normalize) { + if (normalize !== false) + id = normalizeId(id); + const p = resolver.parse(id); + return _getFullPath(resolver, p); +} +exports.getFullPath = getFullPath; +function _getFullPath(resolver, p) { + const serialized = resolver.serialize(p); + return serialized.split("#")[0] + "#"; +} +exports._getFullPath = _getFullPath; +const TRAILING_SLASH_HASH = /#\/?$/; +function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; +} +exports.normalizeId = normalizeId; +function resolveUrl(resolver, baseId, id) { + id = normalizeId(id); + return resolver.resolve(baseId, id); +} +exports.resolveUrl = resolveUrl; +const ANCHOR = /^[a-z_][-a-z0-9._]*$/i; +function getSchemaRefs(schema, baseId) { + if (typeof schema == "boolean") + return {}; + const { schemaId, uriResolver } = this.opts; + const schId = normalizeId(schema[schemaId] || baseId); + const baseIds = { "": schId }; + const pathPrefix = getFullPath(uriResolver, schId, false); + const localRefs = {}; + const schemaRefs = new Set(); + traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) + return; + const fullPath = pathPrefix + jsonPtr; + let innerBaseId = baseIds[parentJsonPtr]; + if (typeof sch[schemaId] == "string") + innerBaseId = addRef.call(this, sch[schemaId]); + addAnchor.call(this, sch.$anchor); + addAnchor.call(this, sch.$dynamicAnchor); + baseIds[jsonPtr] = innerBaseId; + function addRef(ref) { + // eslint-disable-next-line @typescript-eslint/unbound-method + const _resolve = this.opts.uriResolver.resolve; + ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref); + if (schemaRefs.has(ref)) + throw ambiguos(ref); + schemaRefs.add(ref); + let schOrRef = this.refs[ref]; + if (typeof schOrRef == "string") + schOrRef = this.refs[schOrRef]; + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref); + } + else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref); + localRefs[ref] = sch; + } + else { + this.refs[ref] = fullPath; + } + } + return ref; + } + function addAnchor(anchor) { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) + throw new Error(`invalid anchor "${anchor}"`); + addRef.call(this, `#${anchor}`); + } + } + }); + return localRefs; + function checkAmbiguosRef(sch1, sch2, ref) { + if (sch2 !== undefined && !equal(sch1, sch2)) + throw ambiguos(ref); + } + function ambiguos(ref) { + return new Error(`reference "${ref}" resolves to more than one schema`); + } +} +exports.getSchemaRefs = getSchemaRefs; +//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f579194547d8564fb332465f1d9851d4053902b9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/resolve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../lib/compile/resolve.ts"],"names":[],"mappings":";;;AAGA,iCAA+B;AAC/B,yCAAwC;AACxC,iDAAgD;AAKhD,2CAA2C;AAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,eAAe;IACf,eAAe;IACf,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,aAAa;IACb,YAAY;IACZ,UAAU;IACV,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF,SAAgB,SAAS,CAAC,MAAiB,EAAE,QAA0B,IAAI;IACzE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,IAAI,CAAA;IAC3C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IACxB,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAA;AACnC,CAAC;AALD,8BAKC;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,MAAM;IACN,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAA;AAEF,SAAS,MAAM,CAAC,MAAuB;IACrC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CA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CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;oBAC1C,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;gBACtB,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;gBAC3B,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAA;QACZ,CAAC;QAED,SAAS,SAAS,CAAY,MAAe;YAC3C,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE,CAAC;gBAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,GAAG,CAAC,CAAA;gBACvE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC,CAAA;YACjC,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;IAEhB,SAAS,gBAAgB,CAAC,IAAe,EAAE,IAA2B,EAAE,GAAW;QACjF,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;IACnE,CAAC;IAED,SAAS,QAAQ,CAAC,GAAW;QAC3B,OAAO,IAAI,KAAK,CAAC,cAAc,GAAG,oCAAoC,CAAC,CAAA;IACzE,CAAC;AACH,CAAC;AAxDD,sCAwDC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..51ec46ab34151cf34fbbbba1b438f2b06b3f7ce2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.d.ts @@ -0,0 +1,28 @@ +import type { AddedKeywordDefinition } from "../types"; +declare const _jsonTypes: readonly ["string", "number", "integer", "boolean", "null", "object", "array"]; +export type JSONType = (typeof _jsonTypes)[number]; +export declare function isJSONType(x: unknown): x is JSONType; +type ValidationTypes = { + [K in JSONType]: boolean | RuleGroup | undefined; +}; +export interface ValidationRules { + rules: RuleGroup[]; + post: RuleGroup; + all: { + [Key in string]?: boolean | Rule; + }; + keywords: { + [Key in string]?: boolean; + }; + types: ValidationTypes; +} +export interface RuleGroup { + type?: JSONType; + rules: Rule[]; +} +export interface Rule { + keyword: string; + definition: AddedKeywordDefinition; +} +export declare function getRules(): ValidationRules; +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.js new file mode 100644 index 0000000000000000000000000000000000000000..82a591ff4dbdd8cec80b533c6df9854403162f29 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRules = exports.isJSONType = void 0; +const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"]; +const jsonTypes = new Set(_jsonTypes); +function isJSONType(x) { + return typeof x == "string" && jsonTypes.has(x); +} +exports.isJSONType = isJSONType; +function getRules() { + const groups = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] }, + }; + return { + types: { ...groups, integer: true, boolean: true, null: true }, + rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object], + post: { rules: [] }, + all: {}, + keywords: {}, + }; +} +exports.getRules = getRules; +//# sourceMappingURL=rules.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.js.map new file mode 100644 index 0000000000000000000000000000000000000000..084c70f821051d8745bfc66ad3fd9c78f72717b3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/rules.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../lib/compile/rules.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAIjG,MAAM,SAAS,GAAgB,IAAI,GAAG,CAAC,UAAU,CAAC,CAAA;AAElD,SAAgB,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC;AAFD,gCAEC;AAyBD,SAAgB,QAAQ;IACtB,MAAM,MAAM,GAAgE;QAC1E,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,KAAK,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAC;QACjC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;KACpC,CAAA;IACD,OAAO;QACL,KAAK,EAAE,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;QAC5D,KAAK,EAAE,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QAC/E,IAAI,EAAE,EAAC,KAAK,EAAE,EAAE,EAAC;QACjB,GAAG,EAAE,EAAE;QACP,QAAQ,EAAE,EAAE;KACb,CAAA;AACH,CAAC;AAdD,4BAcC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ec282aee87956ea05a6f552adbcc25e5d0e9b3a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.d.ts @@ -0,0 +1,40 @@ +import type { AnySchema, EvaluatedProperties, EvaluatedItems } from "../types"; +import type { SchemaCxt, SchemaObjCxt } from "."; +import { Code, Name, CodeGen } from "./codegen"; +import type { Rule, ValidationRules } from "./rules"; +export declare function toHash(arr: T[]): { + [K in T]?: true; +}; +export declare function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void; +export declare function checkUnknownRules(it: SchemaCxt, schema?: AnySchema): void; +export declare function schemaHasRules(schema: AnySchema, rules: { + [Key in string]?: boolean | Rule; +}): boolean; +export declare function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean; +export declare function schemaRefOrVal({ topSchemaRef, schemaPath }: SchemaObjCxt, schema: unknown, keyword: string, $data?: string | false): Code | number | boolean; +export declare function unescapeFragment(str: string): string; +export declare function escapeFragment(str: string | number): string; +export declare function escapeJsonPointer(str: string | number): string; +export declare function unescapeJsonPointer(str: string): string; +export declare function eachItem(xs: T | T[], f: (x: T) => void): void; +type SomeEvaluated = EvaluatedProperties | EvaluatedItems; +type MergeEvaluatedFunc = (gen: CodeGen, from: Name | T, to: Name | Exclude | undefined, toName?: typeof Name) => Name | T; +interface MergeEvaluated { + props: MergeEvaluatedFunc; + items: MergeEvaluatedFunc; +} +export declare const mergeEvaluated: MergeEvaluated; +export declare function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name; +export declare function setEvaluated(gen: CodeGen, props: Name, ps: { + [K in string]?: true; +}): void; +export declare function useFunc(gen: CodeGen, f: { + code: string; +}): Name; +export declare enum Type { + Num = 0, + Str = 1 +} +export declare function getErrorPath(dataProp: Name | string | number, dataPropType?: Type, jsPropertySyntax?: boolean): Code | string; +export declare function checkStrictMode(it: SchemaCxt, msg: string, mode?: boolean | "log"): void; +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.js new file mode 100644 index 0000000000000000000000000000000000000000..73c87c854d2a8f61483e7a15ba186f81e72d1bc4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.js @@ -0,0 +1,178 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0; +const codegen_1 = require("./codegen"); +const code_1 = require("./codegen/code"); +// TODO refactor to use Set +function toHash(arr) { + const hash = {}; + for (const item of arr) + hash[item] = true; + return hash; +} +exports.toHash = toHash; +function alwaysValidSchema(it, schema) { + if (typeof schema == "boolean") + return schema; + if (Object.keys(schema).length === 0) + return true; + checkUnknownRules(it, schema); + return !schemaHasRules(schema, it.self.RULES.all); +} +exports.alwaysValidSchema = alwaysValidSchema; +function checkUnknownRules(it, schema = it.schema) { + const { opts, self } = it; + if (!opts.strictSchema) + return; + if (typeof schema === "boolean") + return; + const rules = self.RULES.keywords; + for (const key in schema) { + if (!rules[key]) + checkStrictMode(it, `unknown keyword: "${key}"`); + } +} +exports.checkUnknownRules = checkUnknownRules; +function schemaHasRules(schema, rules) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (rules[key]) + return true; + return false; +} +exports.schemaHasRules = schemaHasRules; +function schemaHasRulesButRef(schema, RULES) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (key !== "$ref" && RULES.all[key]) + return true; + return false; +} +exports.schemaHasRulesButRef = schemaHasRulesButRef; +function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") + return schema; + if (typeof schema == "string") + return (0, codegen_1._) `${schema}`; + } + return (0, codegen_1._) `${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`; +} +exports.schemaRefOrVal = schemaRefOrVal; +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} +exports.unescapeFragment = unescapeFragment; +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} +exports.escapeFragment = escapeFragment; +function escapeJsonPointer(str) { + if (typeof str == "number") + return `${str}`; + return str.replace(/~/g, "~0").replace(/\//g, "~1"); +} +exports.escapeJsonPointer = escapeJsonPointer; +function unescapeJsonPointer(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); +} +exports.unescapeJsonPointer = unescapeJsonPointer; +function eachItem(xs, f) { + if (Array.isArray(xs)) { + for (const x of xs) + f(x); + } + else { + f(xs); + } +} +exports.eachItem = eachItem; +function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) { + return (gen, from, to, toName) => { + const res = to === undefined + ? from + : to instanceof codegen_1.Name + ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) + : from instanceof codegen_1.Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to); + return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res; + }; +} +exports.mergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => { + gen.if((0, codegen_1._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._) `${to} || {}`).code((0, codegen_1._) `Object.assign(${to}, ${from})`)); + }), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => { + if (from === true) { + gen.assign(to, true); + } + else { + gen.assign(to, (0, codegen_1._) `${to} || {}`); + setEvaluated(gen, to, from); + } + }), + mergeValues: (from, to) => (from === true ? true : { ...from, ...to }), + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._) `${to} > ${from} ? ${to} : ${from}`)), + mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), + resultToName: (gen, items) => gen.var("items", items), + }), +}; +function evaluatedPropsToName(gen, ps) { + if (ps === true) + return gen.var("props", true); + const props = gen.var("props", (0, codegen_1._) `{}`); + if (ps !== undefined) + setEvaluated(gen, props, ps); + return props; +} +exports.evaluatedPropsToName = evaluatedPropsToName; +function setEvaluated(gen, props, ps) { + Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._) `${props}${(0, codegen_1.getProperty)(p)}`, true)); +} +exports.setEvaluated = setEvaluated; +const snippets = {}; +function useFunc(gen, f) { + return gen.scopeValue("func", { + ref: f, + code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)), + }); +} +exports.useFunc = useFunc; +var Type; +(function (Type) { + Type[Type["Num"] = 0] = "Num"; + Type[Type["Str"] = 1] = "Str"; +})(Type || (exports.Type = Type = {})); +function getErrorPath(dataProp, dataPropType, jsPropertySyntax) { + // let path + if (dataProp instanceof codegen_1.Name) { + const isNumber = dataPropType === Type.Num; + return jsPropertySyntax + ? isNumber + ? (0, codegen_1._) `"[" + ${dataProp} + "]"` + : (0, codegen_1._) `"['" + ${dataProp} + "']"` + : isNumber + ? (0, codegen_1._) `"/" + ${dataProp}` + : (0, codegen_1._) `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer + } + return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp); +} +exports.getErrorPath = getErrorPath; +function checkStrictMode(it, msg, mode = it.opts.strictSchema) { + if (!mode) + return; + msg = `strict mode: ${msg}`; + if (mode === true) + throw new Error(msg); + it.self.logger.warn(msg); +} +exports.checkStrictMode = checkStrictMode; +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ee0100890465bf4157299d905f6d1371a10811fa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["../../lib/compile/util.ts"],"names":[],"mappings":";;;AAEA,uCAA6D;AAC7D,yCAAoC;AAGpC,2BAA2B;AAC3B,SAAgB,MAAM,CAA4B,GAAQ;IACxD,MAAM,IAAI,GAAsB,EAAE,CAAA;IAClC,KAAK,MAAM,IAAI,IAAI,GAAG;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACzC,OAAO,IAAI,CAAA;AACb,CAAC;AAJD,wBAIC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,MAAiB;IAChE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,MAAM,CAAA;IAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACjD,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7B,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACnD,CAAC;AALD,8CAKC;AAED,SAAgB,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,CAAC,IAAI;QAAE,OAAM;IACjB,GAAG,GAAG,gBAAgB,GAAG,EAAE,CAAA;IAC3B,IAAI,IAAI,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AATD,0CASC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..165d375dca3805dffe22386d05e3c2be450d4673 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.d.ts @@ -0,0 +1,6 @@ +import type { AnySchemaObject } from "../../types"; +import type { SchemaObjCxt } from ".."; +import type { JSONType, RuleGroup, Rule } from "../rules"; +export declare function schemaHasRulesForType({ schema, self }: SchemaObjCxt, type: JSONType): boolean | undefined; +export declare function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean; +export declare function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.js new file mode 100644 index 0000000000000000000000000000000000000000..6187dbbeeebb3f9a1b3f74cba4b669685a6d49f0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0; +function schemaHasRulesForType({ schema, self }, type) { + const group = self.RULES.types[type]; + return group && group !== true && shouldUseGroup(schema, group); +} +exports.schemaHasRulesForType = schemaHasRulesForType; +function shouldUseGroup(schema, group) { + return group.rules.some((rule) => shouldUseRule(schema, rule)); +} +exports.shouldUseGroup = shouldUseGroup; +function shouldUseRule(schema, rule) { + var _a; + return (schema[rule.keyword] !== undefined || + ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined))); +} +exports.shouldUseRule = shouldUseRule; +//# sourceMappingURL=applicability.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.js.map new file mode 100644 index 0000000000000000000000000000000000000000..450cfe75a3e181b39cef02acd6ace4ed2785bccb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/applicability.js.map @@ -0,0 +1 @@ +{"version":3,"file":"applicability.js","sourceRoot":"","sources":["../../../lib/compile/validate/applicability.ts"],"names":[],"mappings":";;;AAIA,SAAgB,qBAAqB,CACnC,EAAC,MAAM,EAAE,IAAI,EAAe,EAC5B,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AACjE,CAAC;AAND,sDAMC;AAED,SAAgB,cAAc,CAAC,MAAuB,EAAE,KAAgB;IACtE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,MAAuB,EAAE,IAAU;;IAC/D,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS;SAClC,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAA,CACrE,CAAA;AACH,CAAC;AALD,sCAKC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ce795201e5720ea39b575d486c53d2392445784 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.d.ts @@ -0,0 +1,4 @@ +import type { SchemaCxt } from ".."; +import { Name } from "../codegen"; +export declare function topBoolOrEmptySchema(it: SchemaCxt): void; +export declare function boolOrEmptySchema(it: SchemaCxt, valid: Name): void; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.js new file mode 100644 index 0000000000000000000000000000000000000000..8eeb7b5eee3d137c0f85b4a9405bca8181e60f19 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0; +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const boolError = { + message: "boolean schema is false", +}; +function topBoolOrEmptySchema(it) { + const { gen, schema, validateName } = it; + if (schema === false) { + falseSchemaError(it, false); + } + else if (typeof schema == "object" && schema.$async === true) { + gen.return(names_1.default.data); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, null); + gen.return(true); + } +} +exports.topBoolOrEmptySchema = topBoolOrEmptySchema; +function boolOrEmptySchema(it, valid) { + const { gen, schema } = it; + if (schema === false) { + gen.var(valid, false); // TODO var + falseSchemaError(it); + } + else { + gen.var(valid, true); // TODO var + } +} +exports.boolOrEmptySchema = boolOrEmptySchema; +function falseSchemaError(it, overrideAllErrors) { + const { gen, data } = it; + // TODO maybe some other interface should be used for non-keyword validation errors... + const cxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + }; + (0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors); +} +//# sourceMappingURL=boolSchema.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b7444a20fc9a624bde2fea6d736cbf4392e303ee --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/boolSchema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"boolSchema.js","sourceRoot":"","sources":["../../../lib/compile/validate/boolSchema.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AACrC,wCAAkC;AAClC,oCAAwB;AAExB,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,yBAAyB;CACnC,CAAA;AAED,SAAgB,oBAAoB,CAAC,EAAa;IAChD,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,EAAE,CAAA;IACtC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IAC7B,CAAC;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC/D,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,IAAI,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;AACH,CAAC;AAVD,oDAUC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,KAAW;IAC1D,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IACxB,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA,CAAC,WAAW;QACjC,gBAAgB,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;IAClC,CAAC;AACH,CAAC;AARD,8CAQC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAE,iBAA2B;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACtB,sFAAsF;IACtF,MAAM,GAAG,GAAoB;QAC3B,GAAG;QACH,OAAO,EAAE,cAAc;QACvB,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;IACD,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAC3D,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..91a6194aef45b42620afd5af492f3461e23f9613 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.d.ts @@ -0,0 +1,17 @@ +import type { ErrorObject, AnySchemaObject } from "../../types"; +import type { SchemaObjCxt } from ".."; +import { JSONType } from "../rules"; +import { Code, Name } from "../codegen"; +export declare enum DataType { + Correct = 0, + Wrong = 1 +} +export declare function getSchemaTypes(schema: AnySchemaObject): JSONType[]; +export declare function getJSONTypes(ts: unknown | unknown[]): JSONType[]; +export declare function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean; +export declare function checkDataType(dataType: JSONType, data: Name, strictNums?: boolean | "log", correct?: DataType): Code; +export declare function checkDataTypes(dataTypes: JSONType[], data: Name, strictNums?: boolean | "log", correct?: DataType): Code; +export type TypeError = ErrorObject<"type", { + type: string; +}>; +export declare function reportTypeError(it: SchemaObjCxt): void; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.js new file mode 100644 index 0000000000000000000000000000000000000000..6d03e0dc0ee4b009c075f037940dbe7b41004c90 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.js @@ -0,0 +1,203 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0; +const rules_1 = require("../rules"); +const applicability_1 = require("./applicability"); +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +var DataType; +(function (DataType) { + DataType[DataType["Correct"] = 0] = "Correct"; + DataType[DataType["Wrong"] = 1] = "Wrong"; +})(DataType || (exports.DataType = DataType = {})); +function getSchemaTypes(schema) { + const types = getJSONTypes(schema.type); + const hasNull = types.includes("null"); + if (hasNull) { + if (schema.nullable === false) + throw new Error("type: null contradicts nullable: false"); + } + else { + if (!types.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"'); + } + if (schema.nullable === true) + types.push("null"); + } + return types; +} +exports.getSchemaTypes = getSchemaTypes; +// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents +function getJSONTypes(ts) { + const types = Array.isArray(ts) ? ts : ts ? [ts] : []; + if (types.every(rules_1.isJSONType)) + return types; + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")); +} +exports.getJSONTypes = getJSONTypes; +function coerceAndCheckDataType(it, types) { + const { gen, data, opts } = it; + const coerceTo = coerceToTypes(types, opts.coerceTypes); + const checkTypes = types.length > 0 && + !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0])); + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong); + gen.if(wrongType, () => { + if (coerceTo.length) + coerceData(it, types, coerceTo); + else + reportTypeError(it); + }); + } + return checkTypes; +} +exports.coerceAndCheckDataType = coerceAndCheckDataType; +const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]); +function coerceToTypes(types, coerceTypes) { + return coerceTypes + ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) + : []; +} +function coerceData(it, types, coerceTo) { + const { gen, data, opts } = it; + const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`); + const coerced = gen.let("coerced", (0, codegen_1._) `undefined`); + if (opts.coerceTypes === "array") { + gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen + .assign(data, (0, codegen_1._) `${data}[0]`) + .assign(dataType, (0, codegen_1._) `typeof ${data}`) + .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data))); + } + gen.if((0, codegen_1._) `${coerced} !== undefined`); + for (const t of coerceTo) { + if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { + coerceSpecificType(t); + } + } + gen.else(); + reportTypeError(it); + gen.endIf(); + gen.if((0, codegen_1._) `${coerced} !== undefined`, () => { + gen.assign(data, coerced); + assignParentData(it, coerced); + }); + function coerceSpecificType(t) { + switch (t) { + case "string": + gen + .elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`) + .assign(coerced, (0, codegen_1._) `"" + ${data}`) + .elseIf((0, codegen_1._) `${data} === null`) + .assign(coerced, (0, codegen_1._) `""`); + return; + case "number": + gen + .elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})`) + .assign(coerced, (0, codegen_1._) `+${data}`); + return; + case "integer": + gen + .elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`) + .assign(coerced, (0, codegen_1._) `+${data}`); + return; + case "boolean": + gen + .elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`) + .assign(coerced, false) + .elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`) + .assign(coerced, true); + return; + case "null": + gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`); + gen.assign(coerced, null); + return; + case "array": + gen + .elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null`) + .assign(coerced, (0, codegen_1._) `[${data}]`); + } + } +} +function assignParentData({ gen, parentData, parentDataProperty }, expr) { + // TODO use gen.property + gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr)); +} +function checkDataType(dataType, data, strictNums, correct = DataType.Correct) { + const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ; + let cond; + switch (dataType) { + case "null": + return (0, codegen_1._) `${data} ${EQ} null`; + case "array": + cond = (0, codegen_1._) `Array.isArray(${data})`; + break; + case "object": + cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`; + break; + case "integer": + cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`); + break; + case "number": + cond = numCond(); + break; + default: + return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`; + } + return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond); + function numCond(_cond = codegen_1.nil) { + return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil); + } +} +exports.checkDataType = checkDataType; +function checkDataTypes(dataTypes, data, strictNums, correct) { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct); + } + let cond; + const types = (0, util_1.toHash)(dataTypes); + if (types.array && types.object) { + const notObj = (0, codegen_1._) `typeof ${data} != "object"`; + cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`; + delete types.null; + delete types.array; + delete types.object; + } + else { + cond = codegen_1.nil; + } + if (types.number) + delete types.integer; + for (const t in types) + cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct)); + return cond; +} +exports.checkDataTypes = checkDataTypes; +const typeError = { + message: ({ schema }) => `must be ${schema}`, + params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`, +}; +function reportTypeError(it) { + const cxt = getTypeErrorContext(it); + (0, errors_1.reportError)(cxt, typeError); +} +exports.reportTypeError = reportTypeError; +function getTypeErrorContext(it) { + const { gen, data, schema } = it; + const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type"); + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + }; +} +//# sourceMappingURL=dataType.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c8fb1c6e84a78d2ed9dd2f779e1640ed91c71989 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/dataType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dataType.js","sourceRoot":"","sources":["../../../lib/compile/validate/dataType.ts"],"names":[],"mappings":";;;AAOA,oCAA6C;AAC7C,mDAAqD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C;AAHD,0CAGC;AAED,SAAS,mBAAmB,CAAC,EAAgB;IAC3C,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IAC9B,MAAM,UAAU,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACrD,OAAO;QACL,GAAG;QACH,OAAO,EAAE,MAAM;QACf,IAAI;QACJ,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,UAAU;QACV,WAAW,EAAE,UAAU;QACvB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..02ba453b23436f94efeffd493bc5f5d49a052158 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.d.ts @@ -0,0 +1,2 @@ +import type { SchemaObjCxt } from ".."; +export declare function assignDefaults(it: SchemaObjCxt, ty?: string): void; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.js new file mode 100644 index 0000000000000000000000000000000000000000..cd9c42d9aa4a49adda2c844d2e1f9386e626399e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assignDefaults = void 0; +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +function assignDefaults(it, ty) { + const { properties, items } = it.schema; + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default); + } + } + else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i) => assignDefault(it, i, sch.default)); + } +} +exports.assignDefaults = assignDefaults; +function assignDefault(it, prop, defaultValue) { + const { gen, compositeRule, data, opts } = it; + if (defaultValue === undefined) + return; + const childData = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(prop)}`; + if (compositeRule) { + (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`); + return; + } + let condition = (0, codegen_1._) `${childData} === undefined`; + if (opts.useDefaults === "empty") { + condition = (0, codegen_1._) `${condition} || ${childData} === null || ${childData} === ""`; + } + // `${childData} === undefined` + + // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") + gen.if(condition, (0, codegen_1._) `${childData} = ${(0, codegen_1.stringify)(defaultValue)}`); +} +//# sourceMappingURL=defaults.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.js.map new file mode 100644 index 0000000000000000000000000000000000000000..88d3672e9ac6cdf13d317a0c956a8a2e1c850d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/defaults.js.map @@ -0,0 +1 @@ +{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../lib/compile/validate/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAoD;AACpD,kCAAuC;AAEvC,SAAgB,cAAc,CAAC,EAAgB,EAAE,EAAW;IAC1D,MAAM,EAAC,UAAU,EAAE,KAAK,EAAC,GAAG,EAAE,CAAC,MAAM,CAAA;IACrC,IAAI,EAAE,KAAK,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC7B,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;QACjD,CAAC;IACH,CAAC;SAAM,IAAI,EAAE,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IACtE,CAAC;AACH,CAAC;AATD,wCASC;AAED,SAAS,aAAa,CAAC,EAAgB,EAAE,IAAqB,EAAE,YAAqB;IACnF,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC3C,IAAI,YAAY,KAAK,SAAS;QAAE,OAAM;IACtC,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,EAAE,CAAA;IAChD,IAAI,aAAa,EAAE,CAAC;QAClB,IAAA,sBAAe,EAAC,EAAE,EAAE,2BAA2B,SAAS,EAAE,CAAC,CAAA;QAC3D,OAAM;IACR,CAAC;IAED,IAAI,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,gBAAgB,CAAA;IAC7C,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;QACjC,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,OAAO,SAAS,gBAAgB,SAAS,SAAS,CAAA;IAC7E,CAAC;IACD,iCAAiC;IACjC,2FAA2F;IAC3F,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,MAAM,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AACjE,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c533ed72eb333790a7809b58d6ace1081f96fd3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.d.ts @@ -0,0 +1,42 @@ +import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types"; +import type { SchemaCxt, SchemaObjCxt } from ".."; +import { SubschemaArgs } from "./subschema"; +import { Code, Name, CodeGen } from "../codegen"; +import type { JSONType } from "../rules"; +import { ErrorPaths } from "../errors"; +export declare function validateFunctionCode(it: SchemaCxt): void; +export declare class KeywordCxt implements KeywordErrorCxt { + readonly gen: CodeGen; + readonly allErrors?: boolean; + readonly keyword: string; + readonly data: Name; + readonly $data?: string | false; + schema: any; + readonly schemaValue: Code | number | boolean; + readonly schemaCode: Code | number | boolean; + readonly schemaType: JSONType[]; + readonly parentSchema: AnySchemaObject; + readonly errsCount?: Name; + params: KeywordCxtParams; + readonly it: SchemaObjCxt; + readonly def: AddedKeywordDefinition; + constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string); + result(condition: Code, successAction?: () => void, failAction?: () => void): void; + failResult(condition: Code, successAction?: () => void, failAction?: () => void): void; + pass(condition: Code, failAction?: () => void): void; + fail(condition?: Code): void; + fail$data(condition: Code): void; + error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void; + private _error; + $dataError(): void; + reset(): void; + ok(cond: Code | boolean): void; + setParams(obj: KeywordCxtParams, assign?: true): void; + block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void; + check$data(valid?: Name, $dataValid?: Code): void; + invalid$data(): Code; + subschema(appl: SubschemaArgs, valid: Name): SchemaCxt; + mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void; + mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void; +} +export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.js new file mode 100644 index 0000000000000000000000000000000000000000..0d683322abf18fc5b418bf776dc53f00a49e00ed --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.js @@ -0,0 +1,520 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0; +const boolSchema_1 = require("./boolSchema"); +const dataType_1 = require("./dataType"); +const applicability_1 = require("./applicability"); +const dataType_2 = require("./dataType"); +const defaults_1 = require("./defaults"); +const keyword_1 = require("./keyword"); +const subschema_1 = require("./subschema"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const resolve_1 = require("../resolve"); +const util_1 = require("../util"); +const errors_1 = require("../errors"); +// schema compilation - generates validation function, subschemaCode (below) is used for subschemas +function validateFunctionCode(it) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it); + return; + } + } + validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it)); +} +exports.validateFunctionCode = validateFunctionCode; +function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) { + if (opts.code.es5) { + gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => { + gen.code((0, codegen_1._) `"use strict"; ${funcSourceUrl(schema, opts)}`); + destructureValCxtES5(gen, opts); + gen.code(body); + }); + } + else { + gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body)); + } +} +function destructureValCxt(opts) { + return (0, codegen_1._) `{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._) `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`; +} +function destructureValCxtES5(gen, opts) { + gen.if(names_1.default.valCxt, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.instancePath}`); + gen.var(names_1.default.parentData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentData}`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`); + gen.var(names_1.default.rootData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.rootData}`); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`); + }, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._) `""`); + gen.var(names_1.default.parentData, (0, codegen_1._) `undefined`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `undefined`); + gen.var(names_1.default.rootData, names_1.default.data); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `{}`); + }); +} +function topSchemaObjCode(it) { + const { schema, opts, gen } = it; + validateFunction(it, () => { + if (opts.$comment && schema.$comment) + commentKeyword(it); + checkNoDefault(it); + gen.let(names_1.default.vErrors, null); + gen.let(names_1.default.errors, 0); + if (opts.unevaluated) + resetEvaluated(it); + typeAndKeywords(it); + returnResults(it); + }); + return; +} +function resetEvaluated(it) { + // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated + const { gen, validateName } = it; + it.evaluated = gen.const("evaluated", (0, codegen_1._) `${validateName}.evaluated`); + gen.if((0, codegen_1._) `${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._) `${it.evaluated}.props`, (0, codegen_1._) `undefined`)); + gen.if((0, codegen_1._) `${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._) `${it.evaluated}.items`, (0, codegen_1._) `undefined`)); +} +function funcSourceUrl(schema, opts) { + const schId = typeof schema == "object" && schema[opts.schemaId]; + return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._) `/*# sourceURL=${schId} */` : codegen_1.nil; +} +// schema compilation - this function is used recursively to generate code for sub-schemas +function subschemaCode(it, valid) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid); + return; + } + } + (0, boolSchema_1.boolOrEmptySchema)(it, valid); +} +function schemaCxtHasRules({ schema, self }) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (self.RULES.all[key]) + return true; + return false; +} +function isSchemaObj(it) { + return typeof it.schema != "boolean"; +} +function subSchemaObjCode(it, valid) { + const { schema, gen, opts } = it; + if (opts.$comment && schema.$comment) + commentKeyword(it); + updateContext(it); + checkAsyncSchema(it); + const errsCount = gen.const("_errs", names_1.default.errors); + typeAndKeywords(it, errsCount); + // TODO var + gen.var(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); +} +function checkKeywords(it) { + (0, util_1.checkUnknownRules)(it); + checkRefsAndKeywords(it); +} +function typeAndKeywords(it, errsCount) { + if (it.opts.jtd) + return schemaKeywords(it, [], false, errsCount); + const types = (0, dataType_1.getSchemaTypes)(it.schema); + const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types); + schemaKeywords(it, types, !checkedTypes, errsCount); +} +function checkRefsAndKeywords(it) { + const { schema, errSchemaPath, opts, self } = it; + if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) { + self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`); + } +} +function checkNoDefault(it) { + const { schema, opts } = it; + if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { + (0, util_1.checkStrictMode)(it, "default is ignored in the schema root"); + } +} +function updateContext(it) { + const schId = it.schema[it.opts.schemaId]; + if (schId) + it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId); +} +function checkAsyncSchema(it) { + if (it.schema.$async && !it.schemaEnv.$async) + throw new Error("async schema in sync schema"); +} +function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) { + const msg = schema.$comment; + if (opts.$comment === true) { + gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`); + } + else if (typeof opts.$comment == "function") { + const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`; + const rootName = gen.scopeValue("root", { ref: schemaEnv.root }); + gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`); + } +} +function returnResults(it) { + const { gen, schemaEnv, validateName, ValidationError, opts } = it; + if (schemaEnv.$async) { + // TODO assign unevaluated + gen.if((0, codegen_1._) `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._) `new ${ValidationError}(${names_1.default.vErrors})`)); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, names_1.default.vErrors); + if (opts.unevaluated) + assignEvaluated(it); + gen.return((0, codegen_1._) `${names_1.default.errors} === 0`); + } +} +function assignEvaluated({ gen, evaluated, props, items }) { + if (props instanceof codegen_1.Name) + gen.assign((0, codegen_1._) `${evaluated}.props`, props); + if (items instanceof codegen_1.Name) + gen.assign((0, codegen_1._) `${evaluated}.items`, items); +} +function schemaKeywords(it, types, typeErrors, errsCount) { + const { gen, schema, data, allErrors, opts, self } = it; + const { RULES } = self; + if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) { + gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition)); // TODO typecast + return; + } + if (!opts.jtd) + checkStrictTypes(it, types); + gen.block(() => { + for (const group of RULES.rules) + groupKeywords(group); + groupKeywords(RULES.post); + }); + function groupKeywords(group) { + if (!(0, applicability_1.shouldUseGroup)(schema, group)) + return; + if (group.type) { + gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers)); + iterateKeywords(it, group); + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else(); + (0, dataType_2.reportTypeError)(it); + } + gen.endIf(); + } + else { + iterateKeywords(it, group); + } + // TODO make it "ok" call? + if (!allErrors) + gen.if((0, codegen_1._) `${names_1.default.errors} === ${errsCount || 0}`); + } +} +function iterateKeywords(it, group) { + const { gen, schema, opts: { useDefaults }, } = it; + if (useDefaults) + (0, defaults_1.assignDefaults)(it, group.type); + gen.block(() => { + for (const rule of group.rules) { + if ((0, applicability_1.shouldUseRule)(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type); + } + } + }); +} +function checkStrictTypes(it, types) { + if (it.schemaEnv.meta || !it.opts.strictTypes) + return; + checkContextTypes(it, types); + if (!it.opts.allowUnionTypes) + checkMultipleTypes(it, types); + checkKeywordTypes(it, it.dataTypes); +} +function checkContextTypes(it, types) { + if (!types.length) + return; + if (!it.dataTypes.length) { + it.dataTypes = types; + return; + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`); + } + }); + narrowSchemaTypes(it, types); +} +function checkMultipleTypes(it, ts) { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword"); + } +} +function checkKeywordTypes(it, ts) { + const rules = it.self.RULES.all; + for (const keyword in rules) { + const rule = rules[keyword]; + if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) { + const { type } = rule.definition; + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`); + } + } + } +} +function hasApplicableType(schTs, kwdT) { + return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")); +} +function includesType(ts, t) { + return ts.includes(t) || (t === "integer" && ts.includes("number")); +} +function narrowSchemaTypes(it, withTypes) { + const ts = []; + for (const t of it.dataTypes) { + if (includesType(withTypes, t)) + ts.push(t); + else if (withTypes.includes("integer") && t === "number") + ts.push("integer"); + } + it.dataTypes = ts; +} +function strictTypesError(it, msg) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + msg += ` at "${schemaPath}" (strictTypes)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes); +} +class KeywordCxt { + constructor(it, def, keyword) { + (0, keyword_1.validateKeywordUsage)(it, def, keyword); + this.gen = it.gen; + this.allErrors = it.allErrors; + this.keyword = keyword; + this.data = it.data; + this.schema = it.schema[keyword]; + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data; + this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data); + this.schemaType = def.schemaType; + this.parentSchema = it.schema; + this.params = {}; + this.it = it; + this.def = def; + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)); + } + else { + this.schemaCode = this.schemaValue; + if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`); + } + } + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", names_1.default.errors); + } + } + result(condition, successAction, failAction) { + this.failResult((0, codegen_1.not)(condition), successAction, failAction); + } + failResult(condition, successAction, failAction) { + this.gen.if(condition); + if (failAction) + failAction(); + else + this.error(); + if (successAction) { + this.gen.else(); + successAction(); + if (this.allErrors) + this.gen.endIf(); + } + else { + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + } + pass(condition, failAction) { + this.failResult((0, codegen_1.not)(condition), undefined, failAction); + } + fail(condition) { + if (condition === undefined) { + this.error(); + if (!this.allErrors) + this.gen.if(false); // this branch will be removed by gen.optimize + return; + } + this.gen.if(condition); + this.error(); + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + fail$data(condition) { + if (!this.$data) + return this.fail(condition); + const { schemaCode } = this; + this.fail((0, codegen_1._) `${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`); + } + error(append, errorParams, errorPaths) { + if (errorParams) { + this.setParams(errorParams); + this._error(append, errorPaths); + this.setParams({}); + return; + } + this._error(append, errorPaths); + } + _error(append, errorPaths) { + ; + (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths); + } + $dataError() { + (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError); + } + reset() { + if (this.errsCount === undefined) + throw new Error('add "trackErrors" to keyword definition'); + (0, errors_1.resetErrorsCount)(this.gen, this.errsCount); + } + ok(cond) { + if (!this.allErrors) + this.gen.if(cond); + } + setParams(obj, assign) { + if (assign) + Object.assign(this.params, obj); + else + this.params = obj; + } + block$data(valid, codeBlock, $dataValid = codegen_1.nil) { + this.gen.block(() => { + this.check$data(valid, $dataValid); + codeBlock(); + }); + } + check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) { + if (!this.$data) + return; + const { gen, schemaCode, schemaType, def } = this; + gen.if((0, codegen_1.or)((0, codegen_1._) `${schemaCode} === undefined`, $dataValid)); + if (valid !== codegen_1.nil) + gen.assign(valid, true); + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()); + this.$dataError(); + if (valid !== codegen_1.nil) + gen.assign(valid, false); + } + gen.else(); + } + invalid$data() { + const { gen, schemaCode, schemaType, def, it } = this; + return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema()); + function wrong$DataType() { + if (schemaType.length) { + /* istanbul ignore if */ + if (!(schemaCode instanceof codegen_1.Name)) + throw new Error("ajv implementation error"); + const st = Array.isArray(schemaType) ? schemaType : [schemaType]; + return (0, codegen_1._) `${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`; + } + return codegen_1.nil; + } + function invalid$DataSchema() { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); // TODO value.code for standalone + return (0, codegen_1._) `!${validateSchemaRef}(${schemaCode})`; + } + return codegen_1.nil; + } + } + subschema(appl, valid) { + const subschema = (0, subschema_1.getSubschema)(this.it, appl); + (0, subschema_1.extendSubschemaData)(subschema, this.it, appl); + (0, subschema_1.extendSubschemaMode)(subschema, appl); + const nextContext = { ...this.it, ...subschema, items: undefined, props: undefined }; + subschemaCode(nextContext, valid); + return nextContext; + } + mergeEvaluated(schemaCxt, toName) { + const { it, gen } = this; + if (!it.opts.unevaluated) + return; + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName); + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName); + } + } + mergeValidEvaluated(schemaCxt, valid) { + const { it, gen } = this; + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name)); + return true; + } + } +} +exports.KeywordCxt = KeywordCxt; +function keywordCode(it, keyword, def, ruleType) { + const cxt = new KeywordCxt(it, def, keyword); + if ("code" in def) { + def.code(cxt, ruleType); + } + else if (cxt.$data && def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } + else if ("macro" in def) { + (0, keyword_1.macroKeywordCode)(cxt, def); + } + else if (def.compile || def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } +} +const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; +const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, { dataLevel, dataNames, dataPathArr }) { + let jsonPointer; + let data; + if ($data === "") + return names_1.default.rootData; + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) + throw new Error(`Invalid JSON-pointer: ${$data}`); + jsonPointer = $data; + data = names_1.default.rootData; + } + else { + const matches = RELATIVE_JSON_POINTER.exec($data); + if (!matches) + throw new Error(`Invalid JSON-pointer: ${$data}`); + const up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer === "#") { + if (up >= dataLevel) + throw new Error(errorMsg("property/index", up)); + return dataPathArr[dataLevel - up]; + } + if (up > dataLevel) + throw new Error(errorMsg("data", up)); + data = dataNames[dataLevel - up]; + if (!jsonPointer) + return data; + } + let expr = data; + const segments = jsonPointer.split("/"); + for (const segment of segments) { + if (segment) { + data = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`; + expr = (0, codegen_1._) `${expr} && ${data}`; + } + } + return expr; + function errorMsg(pointerType, up) { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`; + } +} +exports.getData = getData; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cdf5854ea02a98faecbbffbb39d073d09636a4ef --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/compile/validate/index.ts"],"names":[],"mappings":";;;AASA,6CAAoE;AACpE,yCAAiE;AACjE,mDAA6D;AAC7D,yCAAmF;AACnF,yCAAyC;AACzC,uCAAkG;AAClG,2CAAiG;AACjG,wCAAwF;AACxF,oCAAwB;AACxB,wCAAqC;AACrC,kCAOgB;AAEhB,sCAMkB;AAElB,mGAAmG;AACnG,SAAgB,oBAAoB,CAAC,EAAa;IAChD,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;QACpB,aAAa,CAAC,EAAE,CAAC,CAAA;QACjB,IAAI,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1B,gBAAgB,CAAC,EAAE,CAAC,CAAA;YACpB,OAAM;QACR,CAAC;IACH,CAAC;IACD,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAA,iCAAoB,EAAC,EAAE,CAAC,CAAC,CAAA;AACtD,CAAC;AATD,oDASC;AAED,SAAS,gBAAgB,CACvB,EAAC,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAY,EACvD,IAAW;IAEX,IA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/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d15cee8780717c043c89e6f1056f5a1c97ea1480 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.d.ts @@ -0,0 +1,8 @@ +import type { KeywordCxt } from "."; +import type { AddedKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition } from "../../types"; +import type { SchemaObjCxt } from ".."; +import type { JSONType } from "../rules"; +export declare function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void; +export declare function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void; +export declare function validSchemaType(schema: unknown, schemaType: JSONType[], allowUndefined?: boolean): boolean; +export declare function validateKeywordUsage({ schema, opts, self, errSchemaPath }: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string): void; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.js new file mode 100644 index 0000000000000000000000000000000000000000..1109d3a4519ead22d62104f47151377d5f78299c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0; +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const errors_1 = require("../errors"); +function macroKeywordCode(cxt, def) { + const { gen, keyword, schema, parentSchema, it } = cxt; + const macroSchema = def.macro.call(it.self, schema, parentSchema, it); + const schemaRef = useKeyword(gen, keyword, macroSchema); + if (it.opts.validateSchema !== false) + it.self.validateSchema(macroSchema, true); + const valid = gen.name("valid"); + cxt.subschema({ + schema: macroSchema, + schemaPath: codegen_1.nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, valid); + cxt.pass(valid, () => cxt.error(true)); +} +exports.macroKeywordCode = macroKeywordCode; +function funcKeywordCode(cxt, def) { + var _a; + const { gen, keyword, schema, parentSchema, $data, it } = cxt; + checkAsyncKeyword(it, def); + const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate); + const valid = gen.let("valid"); + cxt.block$data(valid, validateKeyword); + cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid); + function validateKeyword() { + if (def.errors === false) { + assignValid(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => cxt.error()); + } + else { + const ruleErrs = def.async ? validateAsync() : validateSync(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => addErrs(cxt, ruleErrs)); + } + } + function validateAsync() { + const ruleErrs = gen.let("ruleErrs", null); + gen.try(() => assignValid((0, codegen_1._) `await `), (e) => gen.assign(valid, false).if((0, codegen_1._) `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._) `${e}.errors`), () => gen.throw(e))); + return ruleErrs; + } + function validateSync() { + const validateErrs = (0, codegen_1._) `${validateRef}.errors`; + gen.assign(validateErrs, null); + assignValid(codegen_1.nil); + return validateErrs; + } + function assignValid(_await = def.async ? (0, codegen_1._) `await ` : codegen_1.nil) { + const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self; + const passSchema = !(("compile" in def && !$data) || def.schema === false); + gen.assign(valid, (0, codegen_1._) `${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying); + } + function reportErrs(errors) { + var _a; + gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors); + } +} +exports.funcKeywordCode = funcKeywordCode; +function modifyData(cxt) { + const { gen, data, it } = cxt; + gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._) `${it.parentData}[${it.parentDataProperty}]`)); +} +function addErrs(cxt, errs) { + const { gen } = cxt; + gen.if((0, codegen_1._) `Array.isArray(${errs})`, () => { + gen + .assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`) + .assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); + (0, errors_1.extendErrors)(cxt); + }, () => cxt.error()); +} +function checkAsyncKeyword({ schemaEnv }, def) { + if (def.async && !schemaEnv.$async) + throw new Error("async keyword in sync schema"); +} +function useKeyword(gen, keyword, result) { + if (result === undefined) + throw new Error(`keyword "${keyword}" failed to compile`); + return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) }); +} +function validSchemaType(schema, schemaType, allowUndefined = false) { + // TODO add tests + return (!schemaType.length || + schemaType.some((st) => st === "array" + ? Array.isArray(schema) + : st === "object" + ? schema && typeof schema == "object" && !Array.isArray(schema) + : typeof schema == st || (allowUndefined && typeof schema == "undefined"))); +} +exports.validSchemaType = validSchemaType; +function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) { + /* istanbul ignore if */ + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error"); + } + const deps = def.dependencies; + if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`); + } + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]); + if (!valid) { + const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self.errorsText(def.validateSchema.errors); + if (opts.validateSchema === "log") + self.logger.error(msg); + else + throw new Error(msg); + } + } +} +exports.validateKeywordUsage = validateKeywordUsage; +//# sourceMappingURL=keyword.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad1d1b99ab4521fbd559eaaa9c4887c566674e2d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/keyword.js.map @@ -0,0 +1 @@ +{"version":3,"file":"keyword.js","sourceRoot":"","sources":["../../../lib/compile/validate/keyword.ts"],"names":[],"mappings":";;;AAUA,wCAAsE;AACtE,oCAAwB;AAExB,kDAAwD;AACxD,sCAAsC;AAItC,SAAgB,gBAAgB,CAAC,GAAe,EAAE,GAA2B;IAC3E,MAAM,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACpD,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC,CAAA;IACrE,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;IACvD,IAAI,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,KAAK;QAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IAE/E,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,GAAG,CAAC,SAAS,CACX;QACE,MAAM,EAAE,WAAW;QACnB,UAAU,EAAE,aAAG;QACf,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,EAAE;QAC/C,YAAY,EAAE,SAAS;QACvB,aAAa,EAAE,IAAI;KACpB,EACD,KAAK,CACN,CAAA;IACD,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AACxC,CAAC;AAlBD,4CAkBC;AAED,SAAgB,eAAe,CAAC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C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1F,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IAC7C,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAA;IAC7B,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1F,CAAC;IAED,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,GAAG,GACP,YAAY,OAAO,+BAA+B,aAAa,KAAK;gBACpE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAC5C,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;gBAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;;gBACpD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;QAC3B,CAAC;IACH,CAAC;AACH,CAAC;AAzBD,oDAyBC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b92785f2d7803aadd00c49d6cb9b0bb59946b574 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.d.ts @@ -0,0 +1,47 @@ +import type { AnySchema } from "../../types"; +import type { SchemaObjCxt } from ".."; +import { Code, Name } from "../codegen"; +import { Type } from "../util"; +import type { JSONType } from "../rules"; +export interface SubschemaContext { + schema: AnySchema; + schemaPath: Code; + errSchemaPath: string; + topSchemaRef?: Code; + errorPath?: Code; + dataLevel?: number; + dataTypes?: JSONType[]; + data?: Name; + parentData?: Name; + parentDataProperty?: Code | number; + dataNames?: Name[]; + dataPathArr?: (Code | number)[]; + propertyName?: Name; + jtdDiscriminator?: string; + jtdMetadata?: boolean; + compositeRule?: true; + createErrors?: boolean; + allErrors?: boolean; +} +export type SubschemaArgs = Partial<{ + keyword: string; + schemaProp: string | number; + schema: AnySchema; + schemaPath: Code; + errSchemaPath: string; + topSchemaRef: Code; + data: Name | Code; + dataProp: Code | string | number; + dataTypes: JSONType[]; + definedProperties: Set; + propertyName: Name; + dataPropType: Type; + jtdDiscriminator: string; + jtdMetadata: boolean; + compositeRule: true; + createErrors: boolean; + allErrors: boolean; +}>; +export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext; +export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void; +export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.js new file mode 100644 index 0000000000000000000000000000000000000000..9de2828690d6c41170d734c66b1a214cb0b9925c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0; +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) { + if (keyword !== undefined && schema !== undefined) { + throw new Error('both "keyword" and "schema" passed, only one allowed'); + } + if (keyword !== undefined) { + const sch = it.schema[keyword]; + return schemaProp === undefined + ? { + schema: sch, + schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`, + }; + } + if (schema !== undefined) { + if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath, + }; + } + throw new Error('either "keyword" or "schema" must be passed'); +} +exports.getSubschema = getSubschema; +function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) { + if (data !== undefined && dataProp !== undefined) { + throw new Error('both "data" and "dataProp" passed, only one allowed'); + } + const { gen } = it; + if (dataProp !== undefined) { + const { errorPath, dataPathArr, opts } = it; + const nextData = gen.let("data", (0, codegen_1._) `${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true); + dataContextProps(nextData); + subschema.errorPath = (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`; + subschema.parentDataProperty = (0, codegen_1._) `${dataProp}`; + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]; + } + if (data !== undefined) { + const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); // replaceable if used once? + dataContextProps(nextData); + if (propertyName !== undefined) + subschema.propertyName = propertyName; + // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr + } + if (dataTypes) + subschema.dataTypes = dataTypes; + function dataContextProps(_nextData) { + subschema.data = _nextData; + subschema.dataLevel = it.dataLevel + 1; + subschema.dataTypes = []; + it.definedProperties = new Set(); + subschema.parentData = it.data; + subschema.dataNames = [...it.dataNames, _nextData]; + } +} +exports.extendSubschemaData = extendSubschemaData; +function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) { + if (compositeRule !== undefined) + subschema.compositeRule = compositeRule; + if (createErrors !== undefined) + subschema.createErrors = createErrors; + if (allErrors !== undefined) + subschema.allErrors = allErrors; + subschema.jtdDiscriminator = jtdDiscriminator; // not inherited + subschema.jtdMetadata = jtdMetadata; // not inherited +} +exports.extendSubschemaMode = extendSubschemaMode; +//# sourceMappingURL=subschema.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e4f903fbb4f73d1ac9f056dab89ed33e8ac04381 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/compile/validate/subschema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subschema.js","sourceRoot":"","sources":["../../../lib/compile/validate/subschema.ts"],"names":[],"mappings":";;;AAEA,wCAA0D;AAC1D,kCAA0D;AA6C1D,SAAgB,YAAY,CAC1B,EAAgB,EAChB,EAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAgB;IAErF,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAClD,MA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SAAS,gBAAgB,CAAC,SAAe;QACvC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAA;QAC1B,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,GAAG,CAAC,CAAA;QACtC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAA;QACxB,EAAE,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;QACxC,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC,IAAI,CAAA;QAC9B,SAAS,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AArCD,kDAqCC;AAED,SAAgB,mBAAmB,CACjC,SAA2B,EAC3B,EAAC,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAgB;IAEtF,IAAI,aAAa,KAAK,SAAS;QAAE,SAAS,CAAC,aAAa,GAAG,aAAa,CAAA;IACxE,IAAI,YAAY,KAAK,SAAS;QAAE,SAAS,CAAC,YAAY,GAAG,YAAY,CAAA;IACrE,IAAI,SAAS,KAAK,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5D,SAAS,CAAC,gBAAgB,GAAG,gBAAgB,CAAA,CAAC,gBAAgB;IAC9D,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA,CAAC,gBAAgB;AACtD,CAAC;AATD,kDASC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4591ed9ecb1f470042a42472c0b0f65aa538d8f3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.d.ts @@ -0,0 +1,173 @@ +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, AnyValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export interface Plugin { + (ajv: Ajv, options?: Opts): Ajv; + [prop: string]: any; +} +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +import type { Schema, AnySchema, AnySchemaObject, SchemaObject, AsyncSchema, Vocabulary, KeywordDefinition, AddedKeywordDefinition, AnyValidateFunction, ValidateFunction, AsyncValidateFunction, ErrorObject, Format, AddedFormat, RegExpEngine, UriResolver } from "./types"; +import type { JSONSchemaType } from "./types/json-schema"; +import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +import ValidationError from "./runtime/validation_error"; +import MissingRefError from "./compile/ref_error"; +import { ValidationRules } from "./compile/rules"; +import { SchemaEnv } from "./compile"; +import { Code, ValueScope } from "./compile/codegen"; +export type Options = CurrentOptions & DeprecatedOptions; +export interface CurrentOptions { + strict?: boolean | "log"; + strictSchema?: boolean | "log"; + strictNumbers?: boolean | "log"; + strictTypes?: boolean | "log"; + strictTuples?: boolean | "log"; + strictRequired?: boolean | "log"; + allowMatchingProperties?: boolean; + allowUnionTypes?: boolean; + validateFormats?: boolean; + $data?: boolean; + allErrors?: boolean; + verbose?: boolean; + discriminator?: boolean; + unicodeRegExp?: boolean; + timestamp?: "string" | "date"; + parseDate?: boolean; + allowDate?: boolean; + $comment?: true | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown); + formats?: { + [Name in string]?: Format; + }; + keywords?: Vocabulary; + schemas?: AnySchema[] | { + [Key in string]?: AnySchema; + }; + logger?: Logger | false; + loadSchema?: (uri: string) => Promise; + removeAdditional?: boolean | "all" | "failing"; + useDefaults?: boolean | "empty"; + coerceTypes?: boolean | "array"; + next?: boolean; + unevaluated?: boolean; + dynamicRef?: boolean; + schemaId?: "id" | "$id"; + jtd?: boolean; + meta?: SchemaObject | boolean; + defaultMeta?: string | AnySchemaObject; + validateSchema?: boolean | "log"; + addUsedSchema?: boolean; + inlineRefs?: boolean | number; + passContext?: boolean; + loopRequired?: number; + loopEnum?: number; + ownProperties?: boolean; + multipleOfPrecision?: number; + int32range?: boolean; + messages?: boolean; + code?: CodeOptions; + uriResolver?: UriResolver; +} +export interface CodeOptions { + es5?: boolean; + esm?: boolean; + lines?: boolean; + optimize?: boolean | number; + formats?: Code; + source?: boolean; + process?: (code: string, schema?: SchemaEnv) => string; + regExp?: RegExpEngine; +} +interface InstanceCodeOptions extends CodeOptions { + regExp: RegExpEngine; + optimize: number; +} +interface DeprecatedOptions { + /** @deprecated */ + ignoreKeywordsWithRef?: boolean; + /** @deprecated */ + jsPropertySyntax?: boolean; + /** @deprecated */ + unicode?: boolean; +} +type RequiredInstanceOptions = { + [K in "strictSchema" | "strictNumbers" | "strictTypes" | "strictTuples" | "strictRequired" | "inlineRefs" | "loopRequired" | "loopEnum" | "meta" | "messages" | "schemaId" | "addUsedSchema" | "validateSchema" | "validateFormats" | "int32range" | "unicodeRegExp" | "uriResolver"]: NonNullable; +} & { + code: InstanceCodeOptions; +}; +export type InstanceOptions = Options & RequiredInstanceOptions; +export interface Logger { + log(...args: unknown[]): unknown; + warn(...args: unknown[]): unknown; + error(...args: unknown[]): unknown; +} +export default class Ajv { + opts: InstanceOptions; + errors?: ErrorObject[] | null; + logger: Logger; + readonly scope: ValueScope; + readonly schemas: { + [Key in string]?: SchemaEnv; + }; + readonly refs: { + [Ref in string]?: SchemaEnv | string; + }; + readonly formats: { + [Name in string]?: AddedFormat; + }; + readonly RULES: ValidationRules; + readonly _compilations: Set; + private readonly _loading; + private readonly _cache; + private readonly _metaOpts; + static ValidationError: typeof ValidationError; + static MissingRefError: typeof MissingRefError; + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; + validate(schema: Schema | string, data: unknown): boolean; + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; + validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T; + validate(schema: JTDSchemaType, data: unknown): data is T; + validate(schema: T, data: unknown): data is JTDDataType; + validate(schema: AsyncSchema, data: unknown | T): Promise; + validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise; + compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction; + compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction; + compile(schema: T, _meta?: boolean): ValidateFunction>; + compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction; + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction; + compileAsync(schema: SchemaObject | JSONSchemaType, _meta?: boolean): Promise>; + compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise>; + compileAsync(schema: AsyncSchema, meta?: boolean): Promise>; + compileAsync(schema: AnySchemaObject, meta?: boolean): Promise>; + addSchema(schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored + key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema?: boolean | "log"): Ajv; + addMetaSchema(schema: AnySchemaObject, key?: string, // schema key + _validateSchema?: boolean | "log"): Ajv; + validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise; + getSchema(keyRef: string): AnyValidateFunction | undefined; + removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv; + addVocabulary(definitions: Vocabulary): Ajv; + addKeyword(kwdOrDef: string | KeywordDefinition, def?: KeywordDefinition): Ajv; + getKeyword(keyword: string): AddedKeywordDefinition | boolean; + removeKeyword(keyword: string): Ajv; + addFormat(name: string, format: Format): Ajv; + errorsText(errors?: ErrorObject[] | null | undefined, // optional array of validation errors + { separator, dataVar }?: ErrorsTextOptions): string; + $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject; + private _removeAllSchemas; + _addSchema(schema: AnySchema, meta?: boolean, baseId?: string, validateSchema?: boolean | "log", addSchema?: boolean): SchemaEnv; + private _checkUnique; + private _compileSchemaEnv; + private _compileMetaSchema; +} +export interface ErrorsTextOptions { + separator?: string; + dataVar?: string; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.js new file mode 100644 index 0000000000000000000000000000000000000000..7e30c83af91b622a2740478f5624531660c4ed83 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.js @@ -0,0 +1,618 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +const validation_error_1 = require("./runtime/validation_error"); +const ref_error_1 = require("./compile/ref_error"); +const rules_1 = require("./compile/rules"); +const compile_1 = require("./compile"); +const codegen_2 = require("./compile/codegen"); +const resolve_1 = require("./compile/resolve"); +const dataType_1 = require("./compile/validate/dataType"); +const util_1 = require("./compile/util"); +const $dataRefSchema = require("./refs/data.json"); +const uri_1 = require("./runtime/uri"); +const defaultRegExp = (str, flags) => new RegExp(str, flags); +defaultRegExp.code = "new RegExp"; +const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"]; +const EXT_SCOPE_NAMES = new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error", +]); +const removedOptions = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now.", +}; +const deprecatedOptions = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.', +}; +const MAX_EXPRESSION = 200; +// eslint-disable-next-line complexity +function requiredOptions(o) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; + const s = o.strict; + const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize; + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; + const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp; + const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default; + return { + strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true, + strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true, + strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log", + strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log", + strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false, + code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp }, + loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION, + loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION, + meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true, + messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true, + inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true, + schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id", + addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true, + validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true, + validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true, + unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true, + int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true, + uriResolver: uriResolver, + }; +} +class Ajv { + constructor(opts = {}) { + this.schemas = {}; + this.refs = {}; + this.formats = {}; + this._compilations = new Set(); + this._loading = {}; + this._cache = new Map(); + opts = this.opts = { ...opts, ...requiredOptions(opts) }; + const { es5, lines } = this.opts.code; + this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines }); + this.logger = getLogger(opts.logger); + const formatOpt = opts.validateFormats; + opts.validateFormats = false; + this.RULES = (0, rules_1.getRules)(); + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED"); + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn"); + this._metaOpts = getMetaSchemaOptions.call(this); + if (opts.formats) + addInitialFormats.call(this); + this._addVocabularies(); + this._addDefaultMetaSchema(); + if (opts.keywords) + addInitialKeywords.call(this, opts.keywords); + if (typeof opts.meta == "object") + this.addMetaSchema(opts.meta); + addInitialSchemas.call(this); + opts.validateFormats = formatOpt; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data, meta, schemaId } = this.opts; + let _dataRefSchema = $dataRefSchema; + if (schemaId === "id") { + _dataRefSchema = { ...$dataRefSchema }; + _dataRefSchema.id = _dataRefSchema.$id; + delete _dataRefSchema.$id; + } + if (meta && $data) + this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false); + } + defaultMeta() { + const { meta, schemaId } = this.opts; + return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined); + } + validate(schemaKeyRef, // key, ref or schema object + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents + data // to be validated + ) { + let v; + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef); + if (!v) + throw new Error(`no schema with key or ref "${schemaKeyRef}"`); + } + else { + v = this.compile(schemaKeyRef); + } + const valid = v(data); + if (!("$async" in v)) + this.errors = v.errors; + return valid; + } + compile(schema, _meta) { + const sch = this._addSchema(schema, _meta); + return (sch.validate || this._compileSchemaEnv(sch)); + } + compileAsync(schema, meta) { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function"); + } + const { loadSchema } = this.opts; + return runCompileAsync.call(this, schema, meta); + async function runCompileAsync(_schema, _meta) { + await loadMetaSchema.call(this, _schema.$schema); + const sch = this._addSchema(_schema, _meta); + return sch.validate || _compileAsync.call(this, sch); + } + async function loadMetaSchema($ref) { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, { $ref }, true); + } + } + async function _compileAsync(sch) { + try { + return this._compileSchemaEnv(sch); + } + catch (e) { + if (!(e instanceof ref_error_1.default)) + throw e; + checkLoaded.call(this, e); + await loadMissingSchema.call(this, e.missingSchema); + return _compileAsync.call(this, sch); + } + } + function checkLoaded({ missingSchema: ref, missingRef }) { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`); + } + } + async function loadMissingSchema(ref) { + const _schema = await _loadSchema.call(this, ref); + if (!this.refs[ref]) + await loadMetaSchema.call(this, _schema.$schema); + if (!this.refs[ref]) + this.addSchema(_schema, ref, meta); + } + async function _loadSchema(ref) { + const p = this._loading[ref]; + if (p) + return p; + try { + return await (this._loading[ref] = loadSchema(ref)); + } + finally { + delete this._loading[ref]; + } + } + } + // Adds schema to the instance + addSchema(schema, // If array is passed, `key` will be ignored + key, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. + ) { + if (Array.isArray(schema)) { + for (const sch of schema) + this.addSchema(sch, undefined, _meta, _validateSchema); + return this; + } + let id; + if (typeof schema === "object") { + const { schemaId } = this.opts; + id = schema[schemaId]; + if (id !== undefined && typeof id != "string") { + throw new Error(`schema ${schemaId} must be string`); + } + } + key = (0, resolve_1.normalizeId)(key || id); + this._checkUnique(key); + this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true); + return this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(schema, key, // schema key + _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema + ) { + this.addSchema(schema, key, true, _validateSchema); + return this; + } + // Validate schema against its meta-schema + validateSchema(schema, throwOrLogError) { + if (typeof schema == "boolean") + return true; + let $schema; + $schema = schema.$schema; + if ($schema !== undefined && typeof $schema != "string") { + throw new Error("$schema must be a string"); + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta(); + if (!$schema) { + this.logger.warn("meta-schema not available"); + this.errors = null; + return true; + } + const valid = this.validate($schema, schema); + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error(message); + else + throw new Error(message); + } + return valid; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef) { + let sch; + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") + keyRef = sch; + if (sch === undefined) { + const { schemaId } = this.opts; + const root = new compile_1.SchemaEnv({ schema: {}, schemaId }); + sch = compile_1.resolveSchema.call(this, root, keyRef); + if (!sch) + return; + this.refs[keyRef] = sch; + } + return (sch.validate || this._compileSchemaEnv(sch)); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef); + this._removeAllSchemas(this.refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas); + this._removeAllSchemas(this.refs); + this._cache.clear(); + return this; + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef); + if (typeof sch == "object") + this._cache.delete(sch.schema); + delete this.schemas[schemaKeyRef]; + delete this.refs[schemaKeyRef]; + return this; + } + case "object": { + const cacheKey = schemaKeyRef; + this._cache.delete(cacheKey); + let id = schemaKeyRef[this.opts.schemaId]; + if (id) { + id = (0, resolve_1.normalizeId)(id); + delete this.schemas[id]; + delete this.refs[id]; + } + return this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(definitions) { + for (const def of definitions) + this.addKeyword(def); + return this; + } + addKeyword(kwdOrDef, def // deprecated + ) { + let keyword; + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef; + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword"); + def.keyword = keyword; + } + } + else if (typeof kwdOrDef == "object" && def === undefined) { + def = kwdOrDef; + keyword = def.keyword; + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array"); + } + } + else { + throw new Error("invalid addKeywords parameters"); + } + checkKeyword.call(this, keyword, def); + if (!def) { + (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd)); + return this; + } + keywordMetaschema.call(this, def); + const definition = { + ...def, + type: (0, dataType_1.getJSONTypes)(def.type), + schemaType: (0, dataType_1.getJSONTypes)(def.schemaType), + }; + (0, util_1.eachItem)(keyword, definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t))); + return this; + } + getKeyword(keyword) { + const rule = this.RULES.all[keyword]; + return typeof rule == "object" ? rule.definition : !!rule; + } + // Remove keyword + removeKeyword(keyword) { + // TODO return type should be Ajv + const { RULES } = this; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword); + if (i >= 0) + group.rules.splice(i, 1); + } + return this; + } + // Add format + addFormat(name, format) { + if (typeof format == "string") + format = new RegExp(format); + this.formats[name] = format; + return this; + } + errorsText(errors = this.errors, // optional array of validation errors + { separator = ", ", dataVar = "data" } = {} // optional options with properties `separator` and `dataVar` + ) { + if (!errors || errors.length === 0) + return "No errors"; + return errors + .map((e) => `${dataVar}${e.instancePath} ${e.message}`) + .reduce((text, msg) => text + separator + msg); + } + $dataMetaSchema(metaSchema, keywordsJsonPointers) { + const rules = this.RULES.all; + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1); // first segment is an empty string + let keywords = metaSchema; + for (const seg of segments) + keywords = keywords[seg]; + for (const key in rules) { + const rule = rules[key]; + if (typeof rule != "object") + continue; + const { $data } = rule.definition; + const schema = keywords[key]; + if ($data && schema) + keywords[key] = schemaOrData(schema); + } + } + return metaSchema; + } + _removeAllSchemas(schemas, regex) { + for (const keyRef in schemas) { + const sch = schemas[keyRef]; + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef]; + } + else if (sch && !sch.meta) { + this._cache.delete(sch.schema); + delete schemas[keyRef]; + } + } + } + } + _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { + let id; + const { schemaId } = this.opts; + if (typeof schema == "object") { + id = schema[schemaId]; + } + else { + if (this.opts.jtd) + throw new Error("schema must be object"); + else if (typeof schema != "boolean") + throw new Error("schema must be object or boolean"); + } + let sch = this._cache.get(schema); + if (sch !== undefined) + return sch; + baseId = (0, resolve_1.normalizeId)(id || baseId); + const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId); + sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs }); + this._cache.set(sch.schema, sch); + if (addSchema && !baseId.startsWith("#")) { + // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) + if (baseId) + this._checkUnique(baseId); + this.refs[baseId] = sch; + } + if (validateSchema) + this.validateSchema(schema, true); + return sch; + } + _checkUnique(id) { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`); + } + } + _compileSchemaEnv(sch) { + if (sch.meta) + this._compileMetaSchema(sch); + else + compile_1.compileSchema.call(this, sch); + /* istanbul ignore if */ + if (!sch.validate) + throw new Error("ajv implementation error"); + return sch.validate; + } + _compileMetaSchema(sch) { + const currentOpts = this.opts; + this.opts = this._metaOpts; + try { + compile_1.compileSchema.call(this, sch); + } + finally { + this.opts = currentOpts; + } + } +} +Ajv.ValidationError = validation_error_1.default; +Ajv.MissingRefError = ref_error_1.default; +exports.default = Ajv; +function checkOptions(checkOpts, options, msg, log = "error") { + for (const key in checkOpts) { + const opt = key; + if (opt in options) + this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`); + } +} +function getSchEnv(keyRef) { + keyRef = (0, resolve_1.normalizeId)(keyRef); // TODO tests fail without this line + return this.schemas[keyRef] || this.refs[keyRef]; +} +function addInitialSchemas() { + const optsSchemas = this.opts.schemas; + if (!optsSchemas) + return; + if (Array.isArray(optsSchemas)) + this.addSchema(optsSchemas); + else + for (const key in optsSchemas) + this.addSchema(optsSchemas[key], key); +} +function addInitialFormats() { + for (const name in this.opts.formats) { + const format = this.opts.formats[name]; + if (format) + this.addFormat(name, format); + } +} +function addInitialKeywords(defs) { + if (Array.isArray(defs)) { + this.addVocabulary(defs); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const keyword in defs) { + const def = defs[keyword]; + if (!def.keyword) + def.keyword = keyword; + this.addKeyword(def); + } +} +function getMetaSchemaOptions() { + const metaOpts = { ...this.opts }; + for (const opt of META_IGNORE_OPTIONS) + delete metaOpts[opt]; + return metaOpts; +} +const noLogs = { log() { }, warn() { }, error() { } }; +function getLogger(logger) { + if (logger === false) + return noLogs; + if (logger === undefined) + return console; + if (logger.log && logger.warn && logger.error) + return logger; + throw new Error("logger must implement log, warn and error methods"); +} +const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i; +function checkKeyword(keyword, def) { + const { RULES } = this; + (0, util_1.eachItem)(keyword, (kwd) => { + if (RULES.keywords[kwd]) + throw new Error(`Keyword ${kwd} is already defined`); + if (!KEYWORD_NAME.test(kwd)) + throw new Error(`Keyword ${kwd} has invalid name`); + }); + if (!def) + return; + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function'); + } +} +function addRule(keyword, definition, dataType) { + var _a; + const post = definition === null || definition === void 0 ? void 0 : definition.post; + if (dataType && post) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES } = this; + let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType); + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.rules.push(ruleGroup); + } + RULES.keywords[keyword] = true; + if (!definition) + return; + const rule = { + keyword, + definition: { + ...definition, + type: (0, dataType_1.getJSONTypes)(definition.type), + schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType), + }, + }; + if (definition.before) + addBeforeRule.call(this, ruleGroup, rule, definition.before); + else + ruleGroup.rules.push(rule); + RULES.all[keyword] = rule; + (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd)); +} +function addBeforeRule(ruleGroup, rule, before) { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before); + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule); + } + else { + ruleGroup.rules.push(rule); + this.logger.warn(`rule ${before} is not defined`); + } +} +function keywordMetaschema(def) { + let { metaSchema } = def; + if (metaSchema === undefined) + return; + if (def.$data && this.opts.$data) + metaSchema = schemaOrData(metaSchema); + def.validateSchema = this.compile(metaSchema, true); +} +const $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", +}; +function schemaOrData(schema) { + return { anyOf: [schema, $dataRef] }; +} +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3760c3e4669b25d852f8333a76b77b71b625f9b2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sourceRoot":"","sources":["../lib/core.ts"],"names":[],"mappings":";;;AA4BA,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAKlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAA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,CAAC,EAAE,IAAI,CAAC,CAAA;IACpC,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,MAAM,iBAAiB,CAAC,CAAA;IACnD,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAY,GAAsB;IAC1D,IAAI,EAAC,UAAU,EAAC,GAAG,GAAG,CAAA;IACtB,IAAI,UAAU,KAAK,SAAS;QAAE,OAAM;IACpC,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IACvE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACrD,CAAC;AAED,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,gFAAgF;CACvF,CAAA;AAED,SAAS,YAAY,CAAC,MAAiB;IACrC,OAAO,EAAC,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAC,CAAA;AACpC,CAAC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a079ba4b1b14da29cf210e9f85f670c6e681b85e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.d.ts @@ -0,0 +1,47 @@ +import type { AnySchemaObject, SchemaObject, JTDParser } from "./types"; +import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +import AjvCore, { CurrentOptions } from "./core"; +type JTDOptions = CurrentOptions & { + strict?: never; + allowMatchingProperties?: never; + allowUnionTypes?: never; + validateFormats?: never; + $data?: never; + verbose?: boolean; + $comment?: never; + formats?: never; + loadSchema?: never; + useDefaults?: never; + coerceTypes?: never; + next?: never; + unevaluated?: never; + dynamicRef?: never; + meta?: boolean; + defaultMeta?: never; + inlineRefs?: boolean; + loopRequired?: never; + multipleOfPrecision?: never; +}; +export declare class Ajv extends AjvCore { + constructor(opts?: JTDOptions); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; + compileSerializer(schema: SchemaObject): (data: T) => string; + compileSerializer(schema: JTDSchemaType): (data: T) => string; + compileParser(schema: SchemaObject): JTDParser; + compileParser(schema: JTDSchemaType): JTDParser; + private _compileSerializer; + private _compileParser; +} +export default Ajv; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, JTDParser, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { JTDErrorObject } from "./vocabularies/jtd"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +export { JTDSchemaType, SomeJTDSchemaType, JTDDataType }; +export { JTDOptions }; +export { default as ValidationError } from "./runtime/validation_error"; +export { default as MissingRefError } from "./compile/ref_error"; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.js new file mode 100644 index 0000000000000000000000000000000000000000..1a3baaf2e3d22043b646b0bde93e05bb0c4ba40a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0; +const core_1 = require("./core"); +const jtd_1 = require("./vocabularies/jtd"); +const jtd_schema_1 = require("./refs/jtd-schema"); +const serialize_1 = require("./compile/jtd/serialize"); +const parse_1 = require("./compile/jtd/parse"); +const META_SCHEMA_ID = "JTD-meta-schema"; +class Ajv extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + jtd: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(jtd_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) + return; + this.addMetaSchema(jtd_schema_1.default, META_SCHEMA_ID, false); + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } + compileSerializer(schema) { + const sch = this._addSchema(schema); + return sch.serialize || this._compileSerializer(sch); + } + compileParser(schema) { + const sch = this._addSchema(schema); + return (sch.parse || this._compileParser(sch)); + } + _compileSerializer(sch) { + serialize_1.default.call(this, sch, sch.schema.definitions || {}); + /* istanbul ignore if */ + if (!sch.serialize) + throw new Error("ajv implementation error"); + return sch.serialize; + } + _compileParser(sch) { + parse_1.default.call(this, sch, sch.schema.definitions || {}); + /* istanbul ignore if */ + if (!sch.parse) + throw new Error("ajv implementation error"); + return sch.parse; + } +} +exports.Ajv = Ajv; +module.exports = exports = Ajv; +module.exports.Ajv = Ajv; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +var validation_error_1 = require("./runtime/validation_error"); +Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); +var ref_error_1 = require("./compile/ref_error"); +Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); +//# sourceMappingURL=jtd.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6bf9f3b1bda083e86ba7f59a2391aaa557665066 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/jtd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd.js","sourceRoot":"","sources":["../lib/jtd.ts"],"names":[],"mappings":";;;AAEA,iCAA8C;AAC9C,4CAA8C;AAC9C,kDAA6C;AAC7C,uDAAuD;AACvD,+CAA+C;AAG/C,MAAM,cAAc,GAAG,iBAAiB,CAAA;AA4BxC,MAAa,GAAI,SAAQ,cAAO;IAC9B,YAAY,OAAmB,EAAE;QAC/B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,GAAG,EAAE,IAAI;SACV,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;IACnC,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,IAAI,CAAC,aAAa,CAAC,oBAAa,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;IAC1D,CAAC;IAED,WAAW;QACT,O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9B,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAA;AACxB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAElB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AAInD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/data.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/data.json new file mode 100644 index 0000000000000000000000000000000000000000..9ffc9f5ce05484799308bc4c78fd3a8822e9af53 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf008331f7b7d8ce6a118fe5b215eb9dac6f0823 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts @@ -0,0 +1,2 @@ +import type Ajv from "../../core"; +export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e86496282031e75f3204b290ad24ae152ce4f243 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metaSchema = require("./schema.json"); +const applicator = require("./meta/applicator.json"); +const content = require("./meta/content.json"); +const core = require("./meta/core.json"); +const format = require("./meta/format.json"); +const metadata = require("./meta/meta-data.json"); +const validation = require("./meta/validation.json"); +const META_SUPPORT_DATA = ["/properties"]; +function addMetaSchema2019($data) { + ; + [ + metaSchema, + applicator, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } +} +exports.default = addMetaSchema2019; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9b8a36d618eb3433853ee16f063490781a42c2aa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2019-09/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,+CAA8C;AAC9C,yCAAwC;AACxC,6CAA4C;AAC5C,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAfD,oCAeC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 0000000000000000000000000000000000000000..c5e91cf2ac8469eccf444cf6501dba80dccb5c63 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 0000000000000000000000000000000000000000..b8f63734343046b3d4b74bf8a59f2380dbc67fc3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 0000000000000000000000000000000000000000..f71adbff04fe9ecc6a828823ad5dfa7366f1a60f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 0000000000000000000000000000000000000000..03ccfce26efeaff5a6e223be5154f238f633c16e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 0000000000000000000000000000000000000000..0e194326fa133b077af409486ebe1e2dca83feff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..7027a1279a014a74c170a2558100d2ca37eecac0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json new file mode 100644 index 0000000000000000000000000000000000000000..54eb7157afed6957bd7074068d7ad99498c668f3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c232ab05c7f6c2418ccd411f450a1e6674b1d277 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts @@ -0,0 +1,2 @@ +import type Ajv from "../../core"; +export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d92567564fedbbb77772b660d422ea160780aa6c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metaSchema = require("./schema.json"); +const applicator = require("./meta/applicator.json"); +const unevaluated = require("./meta/unevaluated.json"); +const content = require("./meta/content.json"); +const core = require("./meta/core.json"); +const format = require("./meta/format-annotation.json"); +const metadata = require("./meta/meta-data.json"); +const validation = require("./meta/validation.json"); +const META_SUPPORT_DATA = ["/properties"]; +function addMetaSchema2020($data) { + ; + [ + metaSchema, + applicator, + unevaluated, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } +} +exports.default = addMetaSchema2020; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..eb90027ddeed38faab289da72ad839c711fda361 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2020-12/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,uDAAsD;AACtD,+CAA8C;AAC9C,yCAAwC;AACxC,wDAAuD;AACvD,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,WAAW;QACX,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAhBD,oCAgBC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json new file mode 100644 index 0000000000000000000000000000000000000000..674c913dab00c66865d82027bdf7748e157365fa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/applicator": true + }, + "$dynamicAnchor": "meta", + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "prefixItems": {"$ref": "#/$defs/schemaArray"}, + "items": {"$dynamicRef": "#meta"}, + "contains": {"$dynamicRef": "#meta"}, + "additionalProperties": {"$dynamicRef": "#meta"}, + "properties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "propertyNames": {"$dynamicRef": "#meta"}, + "if": {"$dynamicRef": "#meta"}, + "then": {"$dynamicRef": "#meta"}, + "else": {"$dynamicRef": "#meta"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$dynamicRef": "#meta"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$dynamicRef": "#meta"} + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json new file mode 100644 index 0000000000000000000000000000000000000000..2ae23ddb5cc30cce43646dc58b86f61b1dc7fc4c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentEncoding": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentSchema": {"$dynamicRef": "#meta"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json new file mode 100644 index 0000000000000000000000000000000000000000..4c8e5cb61657ff226186dd96e5dea6e15eb102e1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true + }, + "$dynamicAnchor": "meta", + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "$ref": "#/$defs/uriReferenceString", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": {"$ref": "#/$defs/uriString"}, + "$ref": {"$ref": "#/$defs/uriReferenceString"}, + "$anchor": {"$ref": "#/$defs/anchorString"}, + "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, + "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, + "$vocabulary": { + "type": "object", + "propertyNames": {"$ref": "#/$defs/uriString"}, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"} + } + }, + "$defs": { + "anchorString": { + "type": "string", + "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + "uriString": { + "type": "string", + "format": "uri" + }, + "uriReferenceString": { + "type": "string", + "format": "uri-reference" + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json new file mode 100644 index 0000000000000000000000000000000000000000..83c26e35f0042ebada16aba9b0c42bedd46bcb24 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true + }, + "$dynamicAnchor": "meta", + + "title": "Format vocabulary meta-schema for annotation results", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json new file mode 100644 index 0000000000000000000000000000000000000000..11946fb5019a3564afb38270af3d7806af39978c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/meta-data": true + }, + "$dynamicAnchor": "meta", + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json new file mode 100644 index 0000000000000000000000000000000000000000..5e4b203b2c26905ccef5ab90c627aaa19ee708bb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true + }, + "$dynamicAnchor": "meta", + + "title": "Unevaluated applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "unevaluatedItems": {"$dynamicRef": "#meta"}, + "unevaluatedProperties": {"$dynamicRef": "#meta"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..e0ae13d9d2063403c60e88282701b4b8f6ccd5f5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/validation": true + }, + "$dynamicAnchor": "meta", + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json new file mode 100644 index 0000000000000000000000000000000000000000..1c68270fdc6e4fa807c75bb32391ce8cb530a497 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/schema", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true, + "https://json-schema.org/draft/2020-12/vocab/applicator": true, + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, + "https://json-schema.org/draft/2020-12/vocab/validation": true, + "https://json-schema.org/draft/2020-12/vocab/meta-data": true, + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/unevaluated"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format-annotation"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", + "properties": { + "definitions": { + "$comment": "\"definitions\" has been replaced by \"$defs\".", + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "deprecated": true, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", + "type": "object", + "additionalProperties": { + "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] + }, + "deprecated": true, + "default": {} + }, + "$recursiveAnchor": { + "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", + "$ref": "meta/core#/$defs/anchorString", + "deprecated": true + }, + "$recursiveRef": { + "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", + "$ref": "meta/core#/$defs/uriReferenceString", + "deprecated": true + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-draft-06.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-draft-06.json new file mode 100644 index 0000000000000000000000000000000000000000..5410064ba8df9315d61a34a66245311f1d18db8e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-draft-07.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-draft-07.json new file mode 100644 index 0000000000000000000000000000000000000000..6a74851043623c67cbe2e1cd206da447aff752c3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-secure.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-secure.json new file mode 100644 index 0000000000000000000000000000000000000000..3968abd5d97e7b2cf87db34d5eb211c090b8700f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..932797a38742a7d4ea453c99dadc7e79dddeafe1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.d.ts @@ -0,0 +1,3 @@ +import { SchemaObject } from "../types"; +declare const jtdMetaSchema: SchemaObject; +export default jtdMetaSchema; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.js new file mode 100644 index 0000000000000000000000000000000000000000..1ee940afb219a10c546c549416d0fee429e38b35 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.js @@ -0,0 +1,118 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const shared = (root) => { + const sch = { + nullable: { type: "boolean" }, + metadata: { + optionalProperties: { + union: { elements: { ref: "schema" } }, + }, + additionalProperties: true, + }, + }; + if (root) + sch.definitions = { values: { ref: "schema" } }; + return sch; +}; +const emptyForm = (root) => ({ + optionalProperties: shared(root), +}); +const refForm = (root) => ({ + properties: { + ref: { type: "string" }, + }, + optionalProperties: shared(root), +}); +const typeForm = (root) => ({ + properties: { + type: { + enum: [ + "boolean", + "timestamp", + "string", + "float32", + "float64", + "int8", + "uint8", + "int16", + "uint16", + "int32", + "uint32", + ], + }, + }, + optionalProperties: shared(root), +}); +const enumForm = (root) => ({ + properties: { + enum: { elements: { type: "string" } }, + }, + optionalProperties: shared(root), +}); +const elementsForm = (root) => ({ + properties: { + elements: { ref: "schema" }, + }, + optionalProperties: shared(root), +}); +const propertiesForm = (root) => ({ + properties: { + properties: { values: { ref: "schema" } }, + }, + optionalProperties: { + optionalProperties: { values: { ref: "schema" } }, + additionalProperties: { type: "boolean" }, + ...shared(root), + }, +}); +const optionalPropertiesForm = (root) => ({ + properties: { + optionalProperties: { values: { ref: "schema" } }, + }, + optionalProperties: { + additionalProperties: { type: "boolean" }, + ...shared(root), + }, +}); +const discriminatorForm = (root) => ({ + properties: { + discriminator: { type: "string" }, + mapping: { + values: { + metadata: { + union: [propertiesForm(false), optionalPropertiesForm(false)], + }, + }, + }, + }, + optionalProperties: shared(root), +}); +const valuesForm = (root) => ({ + properties: { + values: { ref: "schema" }, + }, + optionalProperties: shared(root), +}); +const schema = (root) => ({ + metadata: { + union: [ + emptyForm, + refForm, + typeForm, + enumForm, + elementsForm, + propertiesForm, + optionalPropertiesForm, + discriminatorForm, + valuesForm, + ].map((s) => s(root)), + }, +}); +const jtdMetaSchema = { + definitions: { + schema: schema(false), + }, + ...schema(true), +}; +exports.default = jtdMetaSchema; +//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d46755b213220565836d6c6f608fd44bbe5764ac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/refs/jtd-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/refs/jtd-schema.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAe,CAAC,IAAI,EAAE,EAAE;IAClC,MAAM,GAAG,GAAiB;QACxB,QAAQ,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;QAC3B,QAAQ,EAAE;YACR,kBAAkB,EAAE;gBAClB,KAAK,EAAE,EAAC,QAAQ,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC;aACnC;YACD,oBAAoB,EAAE,IAAI;SAC3B;KACF,CAAA;IACD,IAAI,IAAI;QAAE,GAAG,CAAC,WAAW,GAAG,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC,CAAA;IACrD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,SAAS,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,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;AAEF,MAAM,aAAa,GAAiB;IAClC,WAAW,EAAE;QACX,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;KACtB;IACD,GAAG,MAAM,CAAC,IAAI,CAAC;CAChB,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..777cae20e97e53d280c4f26a84fee4eaa31cc02f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.d.ts @@ -0,0 +1,6 @@ +import * as equal from "fast-deep-equal"; +type Equal = typeof equal & { + code: string; +}; +declare const _default: Equal; +export default _default; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.js new file mode 100644 index 0000000000000000000000000000000000000000..774bba05af0aad577fa2a92dc37a0456cce1a318 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://github.com/ajv-validator/ajv/issues/889 +const equal = require("fast-deep-equal"); +equal.code = 'require("ajv/dist/runtime/equal").default'; +exports.default = equal; +//# sourceMappingURL=equal.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0e17901c3d88794e3a02b1af316cbfc44e7a961d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/equal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"equal.js","sourceRoot":"","sources":["../../lib/runtime/equal.ts"],"names":[],"mappings":";;AAAA,kDAAkD;AAClD,yCAAwC;AAGtC,KAAe,CAAC,IAAI,GAAG,2CAA2C,CAAA;AAEpE,kBAAe,KAAc,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..85f1d5670b501b9622e594e87ca69f33574052ef --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.d.ts @@ -0,0 +1,18 @@ +export declare function parseJson(s: string, pos: number): unknown; +export declare namespace parseJson { + var message: string | undefined; + var position: number; + var code: string; +} +export declare function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined; +export declare namespace parseJsonNumber { + var message: string | undefined; + var position: number; + var code: string; +} +export declare function parseJsonString(s: string, pos: number): string | undefined; +export declare namespace parseJsonString { + var message: string | undefined; + var position: number; + var code: string; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.js new file mode 100644 index 0000000000000000000000000000000000000000..eaa28381821023729c2517babf0d84cb75685470 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.js @@ -0,0 +1,185 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseJsonString = exports.parseJsonNumber = exports.parseJson = void 0; +const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/; +function parseJson(s, pos) { + let endPos; + parseJson.message = undefined; + let matches; + if (pos) + s = s.slice(pos); + try { + parseJson.position = pos + s.length; + return JSON.parse(s); + } + catch (e) { + matches = rxParseJson.exec(e.message); + if (!matches) { + parseJson.message = "unexpected end"; + return undefined; + } + endPos = +matches[1]; + const c = s[endPos]; + s = s.slice(0, endPos); + parseJson.position = pos + endPos; + try { + return JSON.parse(s); + } + catch (e1) { + parseJson.message = `unexpected token ${c}`; + return undefined; + } + } +} +exports.parseJson = parseJson; +parseJson.message = undefined; +parseJson.position = 0; +parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson'; +function parseJsonNumber(s, pos, maxDigits) { + let numStr = ""; + let c; + parseJsonNumber.message = undefined; + if (s[pos] === "-") { + numStr += "-"; + pos++; + } + if (s[pos] === "0") { + numStr += "0"; + pos++; + } + else { + if (!parseDigits(maxDigits)) { + errorMessage(); + return undefined; + } + } + if (maxDigits) { + parseJsonNumber.position = pos; + return +numStr; + } + if (s[pos] === ".") { + numStr += "."; + pos++; + if (!parseDigits()) { + errorMessage(); + return undefined; + } + } + if (((c = s[pos]), c === "e" || c === "E")) { + numStr += "e"; + pos++; + if (((c = s[pos]), c === "+" || c === "-")) { + numStr += c; + pos++; + } + if (!parseDigits()) { + errorMessage(); + return undefined; + } + } + parseJsonNumber.position = pos; + return +numStr; + function parseDigits(maxLen) { + let digit = false; + while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { + digit = true; + numStr += c; + pos++; + } + return digit; + } + function errorMessage() { + parseJsonNumber.position = pos; + parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end"; + } +} +exports.parseJsonNumber = parseJsonNumber; +parseJsonNumber.message = undefined; +parseJsonNumber.position = 0; +parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber'; +const escapedChars = { + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: "\t", + '"': '"', + "/": "/", + "\\": "\\", +}; +const CODE_A = "a".charCodeAt(0); +const CODE_0 = "0".charCodeAt(0); +function parseJsonString(s, pos) { + let str = ""; + let c; + parseJsonString.message = undefined; + // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition + while (true) { + c = s[pos++]; + if (c === '"') + break; + if (c === "\\") { + c = s[pos]; + if (c in escapedChars) { + str += escapedChars[c]; + pos++; + } + else if (c === "u") { + pos++; + let count = 4; + let code = 0; + while (count--) { + code <<= 4; + c = s[pos]; + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (c === undefined) { + errorMessage("unexpected end"); + return undefined; + } + c = c.toLowerCase(); + if (c >= "a" && c <= "f") { + code += c.charCodeAt(0) - CODE_A + 10; + } + else if (c >= "0" && c <= "9") { + code += c.charCodeAt(0) - CODE_0; + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + pos++; + } + str += String.fromCharCode(code); + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + } + else if (c === undefined) { + errorMessage("unexpected end"); + return undefined; + } + else { + if (c.charCodeAt(0) >= 0x20) { + str += c; + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + } + } + parseJsonString.position = pos; + return str; + function errorMessage(msg) { + parseJsonString.position = pos; + parseJsonString.message = msg; + } +} +exports.parseJsonString = parseJsonString; +parseJsonString.message = undefined; +parseJsonString.position = 0; +parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString'; +//# sourceMappingURL=parseJson.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7c125f87ef894e6cfaaa2a07da26cb7135c3bdb5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/parseJson.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseJson.js","sourceRoot":"","sources":["../../lib/runtime/parseJson.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,+CAA+C,CAAA;AAEnE,SAAgB,SAAS,CAAC,CAAS,EAAE,GAAW;IAC9C,IAAI,MAA0B,CAAA;IAC9B,SAAS,CAAC,OAAO,GAAG,SAAS,CAAA;IAC7B,IAAI,OAA+B,CAAA;IACn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,EAAE,CAAC,CAAA;wBACrC,OAAO,SAAS,CAAA;oBAClB,CAAC;oBACD,GAAG,EAAE,CAAA;gBACP,CAAC;gBACD,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,uEAAuE;QACzE,CAAC;aAAM,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,YAAY,CAAC,gBAAgB,CAAC,CAAA;YAC9B,OAAO,SAAS,CAAA;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;gBAC5B,GAAG,IAAI,CAAC,CAAA;YACV,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAO,SAAS,CAAA;YAClB,CAAC;QACH,CAAC;IACH,CAAC;IACD,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;IAC9B,OAAO,GAAG,CAAA;IAEV,SAAS,YAAY,CAAC,GAAW;QAC/B,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;QAC9B,eAAe,CAAC,OAAO,GAAG,GAAG,CAAA;IAC/B,CAAC;AACH,CAAC;AA7DD,0CA6DC;AAED,eAAe,CAAC,OAAO,GAAG,SAA+B,CAAA;AACzD,eAAe,CAAC,QAAQ,GAAG,CAAW,CAAA;AACtC,eAAe,CAAC,IAAI,GAAG,uDAAuD,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0579dd3c636702ae2a06a8ae56e639b14e4c8d2c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.d.ts @@ -0,0 +1,5 @@ +declare function quote(s: string): string; +declare namespace quote { + var code: string; +} +export default quote; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.js new file mode 100644 index 0000000000000000000000000000000000000000..ebf78f70d2dc092127212ff4f02aa4ea4670e25b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const rxEscapable = +// eslint-disable-next-line no-control-regex, no-misleading-character-class +/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; +const escaped = { + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + '"': '\\"', + "\\": "\\\\", +}; +function quote(s) { + rxEscapable.lastIndex = 0; + return ('"' + + (rxEscapable.test(s) + ? s.replace(rxEscapable, (a) => { + const c = escaped[a]; + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }) + : s) + + '"'); +} +exports.default = quote; +quote.code = 'require("ajv/dist/runtime/quote").default'; +//# sourceMappingURL=quote.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4d226252d13c88b416e842be71daa1b23d2ea694 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/quote.js.map @@ -0,0 +1 @@ +{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../lib/runtime/quote.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW;AACf,2EAA2E;AAC3E,iIAAiI,CAAA;AAEnI,MAAM,OAAO,GAA6B;IACxC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAA;AAED,SAAwB,KAAK,CAAC,CAAS;IACrC,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;IACzB,OAAO,CACL,GAAG;QACH,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;gBACpB,OAAO,OAAO,CAAC,KAAK,QAAQ;oBAC1B,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC,CAAC;QACN,GAAG,CACJ,CAAA;AACH,CAAC;AAdD,wBAcC;AAED,KAAK,CAAC,IAAI,GAAG,2CAA2C,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c34a98f2f9b7fb0687b395473975b1a99028ff8d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.d.ts @@ -0,0 +1,6 @@ +import * as re2 from "re2"; +type Re2 = typeof re2 & { + code: string; +}; +declare const _default: Re2; +export default _default; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.js new file mode 100644 index 0000000000000000000000000000000000000000..4b1ee2537011636a87574668f7f234e92049e3b1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const re2 = require("re2"); +re2.code = 'require("ajv/dist/runtime/re2").default'; +exports.default = re2; +//# sourceMappingURL=re2.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bb938a2c4a3a9c2b66bd7812c00c7d70c8b1655b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/re2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"re2.js","sourceRoot":"","sources":["../../lib/runtime/re2.ts"],"names":[],"mappings":";;AAAA,2BAA0B;AAGxB,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd483268861eae6bb097af89bd7a7b10bc7fd500 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.d.ts @@ -0,0 +1,5 @@ +declare function validTimestamp(str: string, allowDate: boolean): boolean; +declare namespace validTimestamp { + var code: string; +} +export default validTimestamp; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.js new file mode 100644 index 0000000000000000000000000000000000000000..5e0f06564bf0fdd752e4553ff5570fba96c1ebd2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const DT_SEPARATOR = /t|\s/i; +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; +const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i; +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +function validTimestamp(str, allowDate) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dt = str.split(DT_SEPARATOR); + return ((dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || + (allowDate && dt.length === 1 && validDate(dt[0]))); +} +exports.default = validTimestamp; +function validDate(str) { + const matches = DATE.exec(str); + if (!matches) + return false; + const y = +matches[1]; + const m = +matches[2]; + const d = +matches[3]; + return (m >= 1 && + m <= 12 && + d >= 1 && + (d <= DAYS[m] || + // leap year: https://tools.ietf.org/html/rfc3339#appendix-C + (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0)))); +} +function validTime(str) { + const matches = TIME.exec(str); + if (!matches) + return false; + const hr = +matches[1]; + const min = +matches[2]; + const sec = +matches[3]; + const tzH = +(matches[4] || 0); + const tzM = +(matches[5] || 0); + return ((hr <= 23 && min <= 59 && sec <= 59) || + // leap second + (hr - tzH === 23 && min - tzM === 59 && sec === 60)); +} +validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default'; +//# sourceMappingURL=timestamp.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6b0eee039945e7991348034eb8e80fe3da7db939 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/timestamp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../lib/runtime/timestamp.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,OAAO,CAAA;AAC5B,MAAM,IAAI,GAAG,4BAA4B,CAAA;AACzC,MAAM,IAAI,GAAG,gEAAgE,CAAA;AAC7E,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AAEhE,SAAwB,cAAc,CAAC,GAAW,EAAE,SAAkB;IACpE,iDAAiD;IACjD,MAAM,EAAE,GAAa,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAC5C,OAAO,CACL,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,SAAS,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACnD,CAAA;AACH,CAAC;AAPD,iCAOC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,OAAO,GAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,MAAM,CAAC,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7B,MAAM,CAAC,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7B,MAAM,CAAC,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7B,OAAO,CACL,CAAC,IAAI,CAAC;QACN,CAAC,IAAI,EAAE;QACP,CAAC,IAAI,CAAC;QACN,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YACX,4DAA4D;YAC5D,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAC1E,CAAA;AACH,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,OAAO,GAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,MAAM,EAAE,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC9B,MAAM,GAAG,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,GAAG,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,GAAG,GAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,MAAM,GAAG,GAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,OAAO,CACL,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;QACpC,cAAc;QACd,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,EAAE,CAAC,CACpD,CAAA;AACH,CAAC;AAED,cAAc,CAAC,IAAI,GAAG,+CAA+C,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecbee69c5dff2e808b58d5b128f664dc391332b6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.d.ts @@ -0,0 +1,5 @@ +declare function ucs2length(str: string): number; +declare namespace ucs2length { + var code: string; +} +export default ucs2length; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.js new file mode 100644 index 0000000000000000000000000000000000000000..92ea0c08a2e4de486bfc52a3807c6c258b63b725 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +function ucs2length(str) { + const len = str.length; + let length = 0; + let pos = 0; + let value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 0xd800 && value <= 0xdbff && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos); + if ((value & 0xfc00) === 0xdc00) + pos++; // low surrogate + } + } + return length; +} +exports.default = ucs2length; +ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'; +//# sourceMappingURL=ucs2length.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a5ceb6b10ea239230be96a8f6418598de6f7e9eb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/ucs2length.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ucs2length.js","sourceRoot":"","sources":["../../lib/runtime/ucs2length.ts"],"names":[],"mappings":";;AAAA,qDAAqD;AACrD,iEAAiE;AACjE,SAAwB,UAAU,CAAC,GAAW;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;IACtB,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,IAAI,KAAa,CAAA;IACjB,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC;QACjB,MAAM,EAAE,CAAA;QACR,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAA;QAC7B,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;YACpD,gDAAgD;YAChD,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,MAAM;gBAAE,GAAG,EAAE,CAAA,CAAC,gBAAgB;QACzD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAfD,6BAeC;AAED,UAAU,CAAC,IAAI,GAAG,gDAAgD,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e9e079f9e7f7bc262cd49c28fd9de88d93b6906 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.d.ts @@ -0,0 +1,6 @@ +import * as uri from "fast-uri"; +type URI = typeof uri & { + code: string; +}; +declare const _default: URI; +export default _default; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.js new file mode 100644 index 0000000000000000000000000000000000000000..bbd2f05244d65c1f0e5bfe0f2dc2a71ab2348a9c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const uri = require("fast-uri"); +uri.code = 'require("ajv/dist/runtime/uri").default'; +exports.default = uri; +//# sourceMappingURL=uri.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3f80a4c3059ef1f255a890573f92b24b8ee61f6f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/uri.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../lib/runtime/uri.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAG7B,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0ee9698f242ceaa527174e68f6808930eabb902 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.d.ts @@ -0,0 +1,7 @@ +import type { ErrorObject } from "../types"; +export default class ValidationError extends Error { + readonly errors: Partial[]; + readonly ajv: true; + readonly validation: true; + constructor(errors: Partial[]); +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.js new file mode 100644 index 0000000000000000000000000000000000000000..353502c089d058921f7cb0723541ccbfa42d45b9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class ValidationError extends Error { + constructor(errors) { + super("validation failed"); + this.errors = errors; + this.ajv = this.validation = true; + } +} +exports.default = ValidationError; +//# sourceMappingURL=validation_error.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..70206fbc1832d7d6f607d7d3f0d236d1796e2f51 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/runtime/validation_error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validation_error.js","sourceRoot":"","sources":["../../lib/runtime/validation_error.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAgB,SAAQ,KAAK;IAKhD,YAAY,MAA8B;QACxC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACnC,CAAC;CACF;AAVD,kCAUC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9141c3d2e4428c5739dc18deaea350cf047e774 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.d.ts @@ -0,0 +1,6 @@ +import type AjvCore from "../core"; +import type { AnyValidateFunction } from "../types"; +declare function standaloneCode(ajv: AjvCore, refsOrFunc?: { + [K in string]?: string; +} | AnyValidateFunction): string; +export default standaloneCode; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b44bb5db5c25b72748e6304e15ac588d3e4562a5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const scope_1 = require("../compile/codegen/scope"); +const code_1 = require("../compile/codegen/code"); +function standaloneCode(ajv, refsOrFunc) { + if (!ajv.opts.code.source) { + throw new Error("moduleCode: ajv instance must have code.source option"); + } + const { _n } = ajv.scope.opts; + return typeof refsOrFunc == "function" + ? funcExportCode(refsOrFunc.source) + : refsOrFunc !== undefined + ? multiExportsCode(refsOrFunc, getValidate) + : multiExportsCode(ajv.schemas, (sch) => sch.meta ? undefined : ajv.compile(sch.schema)); + function getValidate(id) { + const v = ajv.getSchema(id); + if (!v) + throw new Error(`moduleCode: no schema with id ${id}`); + return v; + } + function funcExportCode(source) { + const usedValues = {}; + const n = source === null || source === void 0 ? void 0 : source.validateName; + const vCode = validateCode(usedValues, source); + if (ajv.opts.code.esm) { + // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value + return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`; + } + return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`; + } + function multiExportsCode(schemas, getValidateFunc) { + var _a; + const usedValues = {}; + let code = (0, code_1._) `"use strict";`; + for (const name in schemas) { + const v = getValidateFunc(schemas[name]); + if (v) { + const vCode = validateCode(usedValues, v.source); + const exportSyntax = ajv.opts.code.esm + ? (0, code_1._) `export const ${(0, code_1.getEsmExportName)(name)}` + : (0, code_1._) `exports${(0, code_1.getProperty)(name)}`; + code = (0, code_1._) `${code}${_n}${exportSyntax} = ${(_a = v.source) === null || _a === void 0 ? void 0 : _a.validateName};${_n}${vCode}`; + } + } + return `${code}`; + } + function validateCode(usedValues, s) { + if (!s) + throw new Error('moduleCode: function does not have "source" property'); + if (usedState(s.validateName) === scope_1.UsedValueState.Completed) + return code_1.nil; + setUsedState(s.validateName, scope_1.UsedValueState.Started); + const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode); + const code = new code_1._Code(`${scopeCode}${_n}${s.validateCode}`); + return s.evaluated ? (0, code_1._) `${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code; + function refValidateCode(n) { + var _a; + const vRef = (_a = n.value) === null || _a === void 0 ? void 0 : _a.ref; + if (n.prefix === "validate" && typeof vRef == "function") { + const v = vRef; + return validateCode(usedValues, v.source); + } + else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { + const { validate, validateName } = vRef; + if (!validateName) + throw new Error("ajv internal error"); + const def = ajv.opts.code.es5 ? scope_1.varKinds.var : scope_1.varKinds.const; + const wrapper = (0, code_1._) `${def} ${n} = {validate: ${validateName}};`; + if (usedState(validateName) === scope_1.UsedValueState.Started) + return wrapper; + const vCode = validateCode(usedValues, validate === null || validate === void 0 ? void 0 : validate.source); + return (0, code_1._) `${wrapper}${_n}${vCode}`; + } + return undefined; + } + function usedState(name) { + var _a; + return (_a = usedValues[name.prefix]) === null || _a === void 0 ? void 0 : _a.get(name); + } + function setUsedState(name, state) { + const { prefix } = name; + const names = (usedValues[prefix] = usedValues[prefix] || new Map()); + names.set(name, state); + } + } +} +module.exports = exports = standaloneCode; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = standaloneCode; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8551fe910e3a8fc8314ec1c57a9a63e5a09ae685 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/standalone/index.ts"],"names":[],"mappings":";;AAGA,oDAAkG;AAClG,kDAA0F;AAE1F,SAAS,cAA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,iBAAiB,YAAY,IAAI,CAAA;gBAC7D,IAAI,SAAS,CAAC,YAAY,CAAC,KAAK,sBAAc,CAAC,OAAO;oBAAE,OAAO,OAAO,CAAA;gBACtE,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAA;gBACxD,OAAO,IAAA,QAAC,EAAA,GAAG,OAAO,GAAG,EAAE,GAAG,KAAK,EAAE,CAAA;YACnC,CAAC;YACD,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,SAAS,SAAS,CAAC,IAAoB;;YACrC,OAAO,MAAA,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,0CAAE,GAAG,CAAC,IAAI,CAAC,CAAA;QAC3C,CAAC;QAED,SAAS,YAAY,CAAC,IAAoB,EAAE,KAAqB;YAC/D,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAA;YACrB,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC,CAAA;YACpE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,cAAc,CAAA;AACzC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,cAAc,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..156ac3226faa42737930524b4109fabd25e9071c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.d.ts @@ -0,0 +1,12 @@ +import Ajv, { AnySchema, AnyValidateFunction, ErrorObject } from "../core"; +export default class AjvPack { + readonly ajv: Ajv; + errors?: ErrorObject[] | null; + constructor(ajv: Ajv); + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; + compile(schema: AnySchema, meta?: boolean): AnyValidateFunction; + getSchema(keyRef: string): AnyValidateFunction | undefined; + private getStandalone; + addSchema(...args: Parameters): AjvPack; + addKeyword(...args: Parameters): AjvPack; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.js new file mode 100644 index 0000000000000000000000000000000000000000..35e5c9925adc331db1d484d6827d8c87abfb09ac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("../core"); +const _1 = require("."); +const requireFromString = require("require-from-string"); +class AjvPack { + constructor(ajv) { + this.ajv = ajv; + } + validate(schemaKeyRef, data) { + return core_1.default.prototype.validate.call(this, schemaKeyRef, data); + } + compile(schema, meta) { + return this.getStandalone(this.ajv.compile(schema, meta)); + } + getSchema(keyRef) { + const v = this.ajv.getSchema(keyRef); + if (!v) + return undefined; + return this.getStandalone(v); + } + getStandalone(v) { + return requireFromString((0, _1.default)(this.ajv, v)); + } + addSchema(...args) { + this.ajv.addSchema.call(this.ajv, ...args); + return this; + } + addKeyword(...args) { + this.ajv.addKeyword.call(this.ajv, ...args); + return this; + } +} +exports.default = AjvPack; +//# sourceMappingURL=instance.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/standalone/instance.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6ac33b11408178b31bafae83ee7375661f38fcc5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/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AC;CACF;AA/BD,0BA+BC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..49903cd329354e745a69e18f9c452d02ead91732 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.d.ts @@ -0,0 +1,183 @@ +import { URIComponent } from "fast-uri"; +import type { CodeGen, Code, Name, ScopeValueSets, ValueScopeName } from "../compile/codegen"; +import type { SchemaEnv, SchemaCxt, SchemaObjCxt } from "../compile"; +import type { JSONType } from "../compile/rules"; +import type { KeywordCxt } from "../compile/validate"; +import type Ajv from "../core"; +interface _SchemaObject { + id?: string; + $id?: string; + $schema?: string; + [x: string]: any; +} +export interface SchemaObject extends _SchemaObject { + id?: string; + $id?: string; + $schema?: string; + $async?: false; + [x: string]: any; +} +export interface AsyncSchema extends _SchemaObject { + $async: true; +} +export type AnySchemaObject = SchemaObject | AsyncSchema; +export type Schema = SchemaObject | boolean; +export type AnySchema = Schema | AsyncSchema; +export type SchemaMap = { + [Key in string]?: AnySchema; +}; +export interface SourceCode { + validateName: ValueScopeName; + validateCode: string; + scopeValues: ScopeValueSets; + evaluated?: Code; +} +export interface DataValidationCxt { + instancePath: string; + parentData: { + [K in T]: any; + }; + parentDataProperty: T; + rootData: Record | any[]; + dynamicAnchors: { + [Ref in string]?: ValidateFunction; + }; +} +export interface ValidateFunction { + (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T; + errors?: null | ErrorObject[]; + evaluated?: Evaluated; + schema: AnySchema; + schemaEnv: SchemaEnv; + source?: SourceCode; +} +export interface JTDParser { + (json: string): T | undefined; + message?: string; + position?: number; +} +export type EvaluatedProperties = { + [K in string]?: true; +} | true; +export type EvaluatedItems = number | true; +export interface Evaluated { + props?: EvaluatedProperties; + items?: EvaluatedItems; + dynamicProps: boolean; + dynamicItems: boolean; +} +export interface AsyncValidateFunction extends ValidateFunction { + (...args: Parameters>): Promise; + $async: true; +} +export type AnyValidateFunction = ValidateFunction | AsyncValidateFunction; +export interface ErrorObject, S = unknown> { + keyword: K; + instancePath: string; + schemaPath: string; + params: P; + propertyName?: string; + message?: string; + schema?: S; + parentSchema?: AnySchemaObject; + data?: unknown; +} +export type ErrorNoParams = ErrorObject, S>; +interface _KeywordDef { + keyword: string | string[]; + type?: JSONType | JSONType[]; + schemaType?: JSONType | JSONType[]; + allowUndefined?: boolean; + $data?: boolean; + implements?: string[]; + before?: string; + post?: boolean; + metaSchema?: AnySchemaObject; + validateSchema?: AnyValidateFunction; + dependencies?: string[]; + error?: KeywordErrorDefinition; + $dataError?: KeywordErrorDefinition; +} +export interface CodeKeywordDefinition extends _KeywordDef { + code: (cxt: KeywordCxt, ruleType?: string) => void; + trackErrors?: boolean; +} +export type MacroKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaCxt) => AnySchema; +export type CompileKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaObjCxt) => DataValidateFunction; +export interface DataValidateFunction { + (...args: Parameters): boolean | Promise; + errors?: Partial[]; +} +export interface SchemaValidateFunction { + (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise; + errors?: Partial[]; +} +export interface FuncKeywordDefinition extends _KeywordDef { + validate?: SchemaValidateFunction | DataValidateFunction; + compile?: CompileKeywordFunc; + schema?: boolean; + modifying?: boolean; + async?: boolean; + valid?: boolean; + errors?: boolean | "full"; +} +export interface MacroKeywordDefinition extends FuncKeywordDefinition { + macro: MacroKeywordFunc; +} +export type KeywordDefinition = CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition; +export type AddedKeywordDefinition = KeywordDefinition & { + type: JSONType[]; + schemaType: JSONType[]; +}; +export interface KeywordErrorDefinition { + message: string | Code | ((cxt: KeywordErrorCxt) => string | Code); + params?: Code | ((cxt: KeywordErrorCxt) => Code); +} +export type Vocabulary = (KeywordDefinition | string)[]; +export interface KeywordErrorCxt { + gen: CodeGen; + keyword: string; + data: Name; + $data?: string | false; + schema: any; + parentSchema?: AnySchemaObject; + schemaCode: Code | number | boolean; + schemaValue: Code | number | boolean; + schemaType?: JSONType[]; + errsCount?: Name; + params: KeywordCxtParams; + it: SchemaCxt; +} +export type KeywordCxtParams = { + [P in string]?: Code | string | number; +}; +export type FormatValidator = (data: T) => boolean; +export type FormatCompare = (data1: T, data2: T) => number | undefined; +export type AsyncFormatValidator = (data: T) => Promise; +export interface FormatDefinition { + type?: T extends string ? "string" | undefined : "number"; + validate: FormatValidator | (T extends string ? string | RegExp : never); + async?: false | undefined; + compare?: FormatCompare; +} +export interface AsyncFormatDefinition { + type?: T extends string ? "string" | undefined : "number"; + validate: AsyncFormatValidator; + async: true; + compare?: FormatCompare; +} +export type AddedFormat = true | RegExp | FormatValidator | FormatDefinition | FormatDefinition | AsyncFormatDefinition | AsyncFormatDefinition; +export type Format = AddedFormat | string; +export interface RegExpEngine { + (pattern: string, u: string): RegExpLike; + code: string; +} +export interface RegExpLike { + test: (s: string) => boolean; +} +export interface UriResolver { + parse(uri: string): URIComponent; + resolve(base: string, path: string): string; + serialize(component: URIComponent): string; +} +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.js new file mode 100644 index 0000000000000000000000000000000000000000..aa219d8f2aa44dc7fe6633d1ecf87ab5354ab072 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1f80f85ec756e49c3c146cdf7b04e066bc170b6b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a391fef7229a2a6298642ae1e872d74270963c51 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.d.ts @@ -0,0 +1,125 @@ +type StrictNullChecksWrapper = undefined extends null ? `strictNullChecks must be true in tsconfig to use ${Name}` : Type; +type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void ? I : never; +export type SomeJSONSchema = UncheckedJSONSchemaType; +type UncheckedPartialSchema = Partial>; +export type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema>; +type JSONType = IsPartial extends true ? T | undefined : T; +interface NumberKeywords { + minimum?: number; + maximum?: number; + exclusiveMinimum?: number; + exclusiveMaximum?: number; + multipleOf?: number; + format?: string; +} +interface StringKeywords { + minLength?: number; + maxLength?: number; + pattern?: string; + format?: string; +} +type UncheckedJSONSchemaType = (// these two unions allow arbitrary unions of types +{ + anyOf: readonly UncheckedJSONSchemaType[]; +} | { + oneOf: readonly UncheckedJSONSchemaType[]; +} | ({ + type: readonly (T extends number ? JSONType<"number" | "integer", IsPartial> : T extends string ? JSONType<"string", IsPartial> : T extends boolean ? JSONType<"boolean", IsPartial> : never)[]; +} & UnionToIntersection) | ((T extends number ? { + type: JSONType<"number" | "integer", IsPartial>; +} & NumberKeywords : T extends string ? { + type: JSONType<"string", IsPartial>; +} & StringKeywords : T extends boolean ? { + type: JSONType<"boolean", IsPartial>; +} : T extends readonly [any, ...any[]] ? { + type: JSONType<"array", IsPartial>; + items: { + readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable; + } & { + length: T["length"]; + }; + minItems: T["length"]; +} & ({ + maxItems: T["length"]; +} | { + additionalItems: false; +}) : T extends readonly any[] ? { + type: JSONType<"array", IsPartial>; + items: UncheckedJSONSchemaType; + contains?: UncheckedPartialSchema; + minItems?: number; + maxItems?: number; + minContains?: number; + maxContains?: number; + uniqueItems?: true; + additionalItems?: never; +} : T extends Record ? { + type: JSONType<"object", IsPartial>; + additionalProperties?: boolean | UncheckedJSONSchemaType; + unevaluatedProperties?: boolean | UncheckedJSONSchemaType; + properties?: IsPartial extends true ? Partial> : UncheckedPropertiesSchema; + patternProperties?: Record>; + propertyNames?: Omit, "type"> & { + type?: "string"; + }; + dependencies?: { + [K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema; + }; + dependentRequired?: { + [K in keyof T]?: readonly (keyof T)[]; + }; + dependentSchemas?: { + [K in keyof T]?: UncheckedPartialSchema; + }; + minProperties?: number; + maxProperties?: number; +} & (IsPartial extends true ? { + required: readonly (keyof T)[]; +} : [UncheckedRequiredMembers] extends [never] ? { + required?: readonly UncheckedRequiredMembers[]; +} : { + required: readonly UncheckedRequiredMembers[]; +}) : T extends null ? { + type: JSONType<"null", IsPartial>; + nullable: true; +} : never) & { + allOf?: readonly UncheckedPartialSchema[]; + anyOf?: readonly UncheckedPartialSchema[]; + oneOf?: readonly UncheckedPartialSchema[]; + if?: UncheckedPartialSchema; + then?: UncheckedPartialSchema; + else?: UncheckedPartialSchema; + not?: UncheckedPartialSchema; +})) & { + [keyword: string]: any; + $id?: string; + $ref?: string; + $defs?: Record>; + definitions?: Record>; +}; +export type JSONSchemaType = StrictNullChecksWrapper<"JSONSchemaType", UncheckedJSONSchemaType>; +type Known = { + [key: string]: Known; +} | [Known, ...Known[]] | Known[] | number | string | boolean | null; +type UncheckedPropertiesSchema = { + [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | { + $ref: string; + }; +}; +export type PropertiesSchema = StrictNullChecksWrapper<"PropertiesSchema", UncheckedPropertiesSchema>; +type UncheckedRequiredMembers = { + [K in keyof T]-?: undefined extends T[K] ? never : K; +}[keyof T]; +export type RequiredMembers = StrictNullChecksWrapper<"RequiredMembers", UncheckedRequiredMembers>; +type Nullable = undefined extends T ? { + nullable: true; + const?: null; + enum?: readonly (T | null)[]; + default?: T | null; +} : { + nullable?: false; + const?: T; + enum?: readonly T[]; + default?: T; +}; +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.js new file mode 100644 index 0000000000000000000000000000000000000000..2d8f98dc53425514b26d17480dd402e69f42a9f7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=json-schema.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ae6b4d0fe5e719c9e54a7ada8f0231657438a4af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/json-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../lib/types/json-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..80ad3129abbbee59bab65d47517dd12ba7832b6a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.d.ts @@ -0,0 +1,174 @@ +/** numeric strings */ +type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; +/** string strings */ +type StringType = "string" | "timestamp"; +/** Generic JTD Schema without inference of the represented type */ +export type SomeJTDSchemaType = (// ref +{ + ref: string; +} | { + type: NumberType | StringType | "boolean"; +} | { + enum: string[]; +} | { + elements: SomeJTDSchemaType; +} | { + values: SomeJTDSchemaType; +} | { + properties: Record; + optionalProperties?: Record; + additionalProperties?: boolean; +} | { + properties?: Record; + optionalProperties: Record; + additionalProperties?: boolean; +} | { + discriminator: string; + mapping: Record; +} | {}) & { + nullable?: boolean; + metadata?: Record; + definitions?: Record; +}; +/** required keys of an object, not undefined */ +type RequiredKeys = { + [K in keyof T]-?: undefined extends T[K] ? never : K; +}[keyof T]; +/** optional or undifined-able keys of an object */ +type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] ? K : never; +}[keyof T]; +/** type is true if T is a union type */ +type IsUnion_ = false extends (T extends unknown ? ([U] extends [T] ? false : true) : never) ? false : true; +type IsUnion = IsUnion_; +/** type is true if T is identically E */ +type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false; +/** type is true if T or null is identically E or null*/ +type NullTypeEquality = TypeEquality; +/** gets only the string literals of a type or null if a type isn't a string literal */ +type EnumString = [T] extends [never] ? null : T extends string ? string extends T ? null : T : null; +/** true if type is a union of string literals */ +type IsEnum = null extends EnumString ? false : true; +/** true only if all types are array types (not tuples) */ +type IsElements = false extends IsUnion ? [T] extends [readonly unknown[]] ? undefined extends T[0.5] ? false : true : false : false; +/** true if the the type is a values type */ +type IsValues = false extends IsUnion ? TypeEquality : false; +/** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */ +type IsRecord = Union extends IsUnion ? null extends EnumString ? false : true : false; +/** true if type represents an empty record */ +type IsEmptyRecord = [T] extends [Record] ? [T] extends [never] ? false : true : false; +/** actual schema */ +export type JTDSchemaType = Record> = (// refs - where null wasn't specified, must match exactly +(null extends EnumString ? never : ({ + [K in keyof D]: [T] extends [D[K]] ? { + ref: K; + } : never; +}[keyof D] & { + nullable?: false; +}) | (null extends T ? { + [K in keyof D]: [Exclude] extends [Exclude] ? { + ref: K; + } : never; +}[keyof D] & { + nullable: true; +} : never)) | (unknown extends T ? { + nullable?: boolean; +} : never) | ((true extends NullTypeEquality ? { + type: NumberType; +} : true extends NullTypeEquality ? { + type: "boolean"; +} : true extends NullTypeEquality ? { + type: StringType; +} : true extends NullTypeEquality ? { + type: "timestamp"; +} : true extends IsEnum> ? { + enum: EnumString>[]; +} : true extends IsElements> ? T extends readonly (infer E)[] ? { + elements: JTDSchemaType; +} : never : true extends IsEmptyRecord> ? { + properties: Record; + optionalProperties?: Record; +} | { + optionalProperties: Record; +} : true extends IsValues> ? T extends Record ? { + values: JTDSchemaType; +} : never : true extends IsRecord, false> ? ([RequiredKeys>] extends [never] ? { + properties?: Record; +} : { + properties: { + [K in RequiredKeys]: JTDSchemaType; + }; +}) & ([OptionalKeys>] extends [never] ? { + optionalProperties?: Record; +} : { + optionalProperties: { + [K in OptionalKeys]: JTDSchemaType, D>; + }; +}) & { + additionalProperties?: boolean; +} : true extends IsRecord, true> ? { + [K in keyof Exclude]-?: Exclude[K] extends string ? { + discriminator: K; + mapping: { + [M in Exclude[K]]: JTDSchemaType ? T : never, K>, D>; + }; + } : never; +}[keyof Exclude] : never) & (null extends T ? { + nullable: true; +} : { + nullable?: false; +}))) & { + metadata?: Record; + definitions?: { + [K in keyof D]: JTDSchemaType; + }; +}; +type JTDDataDef> = // ref +(S extends { + ref: string; +} ? D extends { + [K in S["ref"]]: infer V; +} ? JTDDataDef : never : S extends { + type: NumberType; +} ? number : S extends { + type: "boolean"; +} ? boolean : S extends { + type: "string"; +} ? string : S extends { + type: "timestamp"; +} ? string | Date : S extends { + enum: readonly (infer E)[]; +} ? string extends E ? never : [E] extends [string] ? E : never : S extends { + elements: infer E; +} ? JTDDataDef[] : S extends { + properties: Record; + optionalProperties?: Record; + additionalProperties?: boolean; +} ? { + -readonly [K in keyof S["properties"]]-?: JTDDataDef; +} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; +} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { + properties?: Record; + optionalProperties: Record; + additionalProperties?: boolean; +} ? { + -readonly [K in keyof S["properties"]]-?: JTDDataDef; +} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; +} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { + values: infer V; +} ? Record> : S extends { + discriminator: infer M; + mapping: Record; +} ? [M] extends [string] ? { + [K in keyof S["mapping"]]: JTDDataDef & { + [KM in M]: K; + }; +}[keyof S["mapping"]] : never : unknown) | (S extends { + nullable: true; +} ? null : never); +export type JTDDataType = S extends { + definitions: Record; +} ? JTDDataDef : JTDDataDef>; +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.js new file mode 100644 index 0000000000000000000000000000000000000000..11338aa8a8f30657f58c6a0a18573e6d24e04545 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.js.map new file mode 100644 index 0000000000000000000000000000000000000000..add89bd779669a2505d9824699617337f460c059 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/types/jtd-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/types/jtd-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..607515646f79b448621e5873110668d7003a04e6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +export type AdditionalItemsError = ErrorObject<"additionalItems", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export declare function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js new file mode 100644 index 0000000000000000000000000000000000000000..608d51eb6a0b21cb29bca281e8259933c1d867b1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateAdditionalItems = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error, + code(cxt) { + const { parentSchema, it } = cxt; + const { items } = parentSchema; + if (!Array.isArray(items)) { + (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + validateAdditionalItems(cxt, items); + }, +}; +function validateAdditionalItems(cxt, items) { + const { gen, schema, data, keyword, it } = cxt; + it.items = true; + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items.length }); + cxt.pass((0, codegen_1._) `${len} <= ${items.length}`); + } + else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items.length}`); // TODO var + gen.if((0, codegen_1.not)(valid), () => validateItems(valid)); + cxt.ok(valid); + } + function validateItems(valid) { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } +} +exports.validateAdditionalItems = validateAdditionalItems; +exports.default = def; +//# sourceMappingURL=additionalItems.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0091d3142abe17b2226b8fbbb497196f890117d2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"additionalItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalItems.ts"],"names":[],"mappings":";;;AAOA,mDAAuD;AACvD,6CAA2E;AAI3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,iBAA0B;IACnC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,KAAK;IACL,IAAI,CAAC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CAAC,CAAA;QAC9C,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;IAED,SAAS,aAAa,CAAC,KAAW;QAChC,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;YACzC,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,WAAI,CAAC,GAAG,EAAC,EAAE,KAAK,CAAC,CAAA;YACpE,IAAI,CAAC,EAAE,CAAC,SAAS;gBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAnBD,0DAmBC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..74698c7a2b49a6040c40b201fc77f0f71e7d3b58 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, AddedKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type AdditionalPropertiesError = ErrorObject<"additionalProperties", { + additionalProperty: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition & AddedKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js new file mode 100644 index 0000000000000000000000000000000000000000..1d3374bb7650abeaa5037f7495cc14e141e89a39 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js @@ -0,0 +1,106 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const util_1 = require("../../compile/util"); +const error = { + message: "must NOT have additional properties", + params: ({ params }) => (0, codegen_1._) `{additionalProperty: ${params.additionalProperty}}`, +}; +const def = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, opts } = it; + it.props = true; + if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema)) + return; + const props = (0, code_1.allSchemaProperties)(parentSchema.properties); + const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties); + checkAdditionalProperties(); + cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + function checkAdditionalProperties() { + gen.forIn("key", data, (key) => { + if (!props.length && !patProps.length) + additionalPropertyCode(key); + else + gen.if(isAdditional(key), () => additionalPropertyCode(key)); + }); + } + function isAdditional(key) { + let definedProp; + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties"); + definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key); + } + else if (props.length) { + definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._) `${key} === ${p}`)); + } + else { + definedProp = codegen_1.nil; + } + if (patProps.length) { + definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._) `${(0, code_1.usePattern)(cxt, p)}.test(${key})`)); + } + return (0, codegen_1.not)(definedProp); + } + function deleteAdditional(key) { + gen.code((0, codegen_1._) `delete ${data}[${key}]`); + } + function additionalPropertyCode(key) { + if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { + deleteAdditional(key); + return; + } + if (schema === false) { + cxt.setParams({ additionalProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.name("valid"); + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false); + gen.if((0, codegen_1.not)(valid), () => { + cxt.reset(); + deleteAdditional(key); + }); + } + else { + applyAdditionalSchema(key, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + } + } + function applyAdditionalSchema(key, valid, errors) { + const subschema = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: util_1.Type.Str, + }; + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }); + } + cxt.subschema(subschema, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=additionalProperties.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map new file mode 100644 index 0000000000000000000000000000000000000000..649ddae517fc1b76fea34dbd8f1b59139b5f9c88 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"additionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalProperties.ts"],"names":[],"mappings":";;AAOA,kCAAsE;AACtE,mDAAiE;AACjE,+CAAmC;AAEnC,6CAA0E;AAQ1E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,qCAAqC;IAC9C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,wBAAwB,MAAM,CAAC,kBAAkB,GAAG;CAC5E,CAAA;A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AAG;aACvB,CAAA;YACD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;oBACvB,aAAa,EAAE,IAAI;oBACnB,YAAY,EAAE,KAAK;oBACnB,SAAS,EAAE,KAAK;iBACjB,CAAC,CAAA;YACJ,CAAC;YACD,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.js new file mode 100644 index 0000000000000000000000000000000000000000..1b1ae737611479c5f3ce00300629a91810658bbc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "allOf", + schemaType: "array", + code(cxt) { + const { gen, schema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const valid = gen.name("valid"); + schema.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid); + cxt.ok(valid); + cxt.mergeEvaluated(schCxt); + }); + }, +}; +exports.default = def; +//# sourceMappingURL=allOf.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d119d0eae7b88e817d3b6b691284aece7c9f3e9d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"allOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/allOf.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,MAAM,CAAC,OAAO,CAAC,CAAC,GAAc,EAAE,CAAS,EAAE,EAAE;YAC3C,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC;gBAAE,OAAM;YACtC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAC,EAAE,KAAK,CAAC,CAAA;YACtE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..61bca56e0cbdd5296352b3480d7489bc9e7ca6db --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; +export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.js new file mode 100644 index 0000000000000000000000000000000000000000..66cfce2cc573f7158a165643694e0c89f1794a2c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const def = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code: code_1.validateUnion, + error: { message: "must match a schema in anyOf" }, +}; +exports.default = def; +//# sourceMappingURL=anyOf.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map new file mode 100644 index 0000000000000000000000000000000000000000..537ffcbebef71475fb1aaf62159573d3eef8fd4c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/anyOf.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAIrC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5493e844f3ff728d9fe05769680144301cf0a969 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts @@ -0,0 +1,7 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type ContainsError = ErrorObject<"contains", { + minContains: number; + maxContains?: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.js new file mode 100644 index 0000000000000000000000000000000000000000..6c5473f5d9b486b774494033b97978b3c42ca0d4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.js @@ -0,0 +1,95 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { min, max } }) => max === undefined + ? (0, codegen_1.str) `must contain at least ${min} valid item(s)` + : (0, codegen_1.str) `must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._) `{minContains: ${min}}` : (0, codegen_1._) `{minContains: ${min}, maxContains: ${max}}`, +}; +const def = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + let min; + let max; + const { minContains, maxContains } = parentSchema; + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains; + max = maxContains; + } + else { + min = 1; + } + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + cxt.setParams({ min, max }); + if (max === undefined && min === 0) { + (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`); + return; + } + if (max !== undefined && min > max) { + (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`); + cxt.fail(); + return; + } + if ((0, util_1.alwaysValidSchema)(it, schema)) { + let cond = (0, codegen_1._) `${len} >= ${min}`; + if (max !== undefined) + cond = (0, codegen_1._) `${cond} && ${len} <= ${max}`; + cxt.pass(cond); + return; + } + it.items = true; + const valid = gen.name("valid"); + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())); + } + else if (min === 0) { + gen.let(valid, true); + if (max !== undefined) + gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount); + } + else { + gen.let(valid, false); + validateItemsWithCount(); + } + cxt.result(valid, () => cxt.reset()); + function validateItemsWithCount() { + const schValid = gen.name("_valid"); + const count = gen.let("count", 0); + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))); + } + function validateItems(_valid, block) { + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword: "contains", + dataProp: i, + dataPropType: util_1.Type.Num, + compositeRule: true, + }, _valid); + block(); + }); + } + function checkLimits(count) { + gen.code((0, codegen_1._) `${count}++`); + if (max === undefined) { + gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true).break()); + } + else { + gen.if((0, codegen_1._) `${count} > ${max}`, () => gen.assign(valid, false).break()); + if (min === 1) + gen.assign(valid, true); + else + gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true)); + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=contains.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.js.map new file mode 100644 index 0000000000000000000000000000000000000000..415792846919656f9d642ca586db83b4cb2a6a86 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/contains.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contains.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/contains.ts"],"names":[],"mappings":";;AAOA,mDAAkD;AAClD,6CAA2E;AAQ3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAChC,GAAG,KAAK,SAAS;QACf,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,gBAAgB;QACjD,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,qBAAqB,GAAG,gBAAgB;IAC7E,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAC/B,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,kBAAkB,GAAG,GAAG;CAC/F,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAA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,SAAS,CACX;oBACE,OAAO,EAAE,UAAU;oBACnB,QAAQ,EAAE,CAAC;oBACX,YAAY,EAAE,WAAI,CAAC,GAAG;oBACtB,aAAa,EAAE,IAAI;iBACpB,EACD,MAAM,CACP,CAAA;gBACD,KAAK,EAAE,CAAA;YACT,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,SAAS,WAAW,CAAC,KAAW;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,IAAI,CAAC,CAAA;YACvB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;YACtE,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;gBACpE,IAAI,GAAG,KAAK,CAAC;oBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;;oBACjC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;YACnE,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..05900e0c5091015a9d1c460d2cd0f72af9d57310 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts @@ -0,0 +1,21 @@ +import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaMap, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +export type PropertyDependencies = { + [K in string]?: string[]; +}; +export interface DependenciesErrorParams { + property: string; + missingProperty: string; + depsCount: number; + deps: string; +} +export type DependenciesError = ErrorObject<"dependencies", DependenciesErrorParams, { + [K in string]?: string[] | AnySchema; +}>; +export declare const error: KeywordErrorDefinition; +declare const def: CodeKeywordDefinition; +export declare function validatePropertyDeps(cxt: KeywordCxt, propertyDeps?: { + [K in string]?: string[]; +}): void; +export declare function validateSchemaDeps(cxt: KeywordCxt, schemaDeps?: SchemaMap): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.js new file mode 100644 index 0000000000000000000000000000000000000000..e81f86d1d9e25ef44ff6f096e1a9238a6f05b38e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +exports.error = { + message: ({ params: { property, depsCount, deps } }) => { + const property_ies = depsCount === 1 ? "property" : "properties"; + return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`; + }, + params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._) `{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, // TODO change to reference +}; +const def = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: exports.error, + code(cxt) { + const [propDeps, schDeps] = splitDependencies(cxt); + validatePropertyDeps(cxt, propDeps); + validateSchemaDeps(cxt, schDeps); + }, +}; +function splitDependencies({ schema }) { + const propertyDeps = {}; + const schemaDeps = {}; + for (const key in schema) { + if (key === "__proto__") + continue; + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps; + deps[key] = schema[key]; + } + return [propertyDeps, schemaDeps]; +} +function validatePropertyDeps(cxt, propertyDeps = cxt.schema) { + const { gen, data, it } = cxt; + if (Object.keys(propertyDeps).length === 0) + return; + const missing = gen.let("missing"); + for (const prop in propertyDeps) { + const deps = propertyDeps[prop]; + if (deps.length === 0) + continue; + const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties); + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", "), + }); + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + (0, code_1.checkReportMissingProp)(cxt, depProp); + } + }); + } + else { + gen.if((0, codegen_1._) `${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } +} +exports.validatePropertyDeps = validatePropertyDeps; +function validateSchemaDeps(cxt, schemaDeps = cxt.schema) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + for (const prop in schemaDeps) { + if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop])) + continue; + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => { + const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid); + cxt.mergeValidEvaluated(schCxt, valid); + }, () => gen.var(valid, true) // TODO var + ); + cxt.ok(valid); + } +} +exports.validateSchemaDeps = validateSchemaDeps; +exports.default = def; +//# sourceMappingURL=dependencies.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map new file mode 100644 index 0000000000000000000000000000000000000000..50d7ca3486bf3ddd9bcc85ea52e2b65260719699 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependencies.ts"],"names":[],"mappings":";;;AAQA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAmG;AAmBtF,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,EAAC,EAAE,EAAE;QACjD,MAAM,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAA;QAChE,OAAO,IAAA,aAAG,EAAA,aAAa,YAAY,IAAI,IAAI,kBAAkB,QAAQ,aAAa,CAAA;IACpF,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAC,EAAC,EAAE,EAAE,CACjE,IAAA,WAAC,EAAA,cAAc,QAAQ;uBACJ,eAAe;iBACrB,SAAS;YACd,IAAI,GAAG,EAAE,2BAA2B;CAC/C,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,aAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAClD,oBAAoB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QACnC,kBAAkB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;CACF,CAAA;AAED,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CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW;SACvC,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;AACH,CAAC;AAfD,gDAeC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js new file mode 100644 index 0000000000000000000000000000000000000000..66ef2e843fcb393be81058fdb7ec7c66eb7e0a89 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("./dependencies"); +const def = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentSchemas.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map new file mode 100644 index 0000000000000000000000000000000000000000..17712e6fb37bda4f10dd24162dbe00ec5cdda66c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependentSchemas.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependentSchemas.ts"],"names":[],"mappings":";;AACA,iDAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,iCAAkB,EAAC,GAAG,CAAC;CACvC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f602e33fcd63a8fab700c9da4ec152945a3ce13 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type IfKeywordError = ErrorObject<"if", { + failingKeyword: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.js new file mode 100644 index 0000000000000000000000000000000000000000..2c42a3e9c56e0801c71681c38fcf0823c4e2d251 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params }) => (0, codegen_1.str) `must match "${params.ifClause}" schema`, + params: ({ params }) => (0, codegen_1._) `{failingKeyword: ${params.ifClause}}`, +}; +const def = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error, + code(cxt) { + const { gen, parentSchema, it } = cxt; + if (parentSchema.then === undefined && parentSchema.else === undefined) { + (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored'); + } + const hasThen = hasSchema(it, "then"); + const hasElse = hasSchema(it, "else"); + if (!hasThen && !hasElse) + return; + const valid = gen.let("valid", true); + const schValid = gen.name("_valid"); + validateIf(); + cxt.reset(); + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause"); + cxt.setParams({ ifClause }); + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)); + } + else if (hasThen) { + gen.if(schValid, validateClause("then")); + } + else { + gen.if((0, codegen_1.not)(schValid), validateClause("else")); + } + cxt.pass(valid, () => cxt.error(true)); + function validateIf() { + const schCxt = cxt.subschema({ + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false, + }, schValid); + cxt.mergeEvaluated(schCxt); + } + function validateClause(keyword, ifClause) { + return () => { + const schCxt = cxt.subschema({ keyword }, schValid); + gen.assign(valid, schValid); + cxt.mergeValidEvaluated(schCxt, valid); + if (ifClause) + gen.assign(ifClause, (0, codegen_1._) `${keyword}`); + else + cxt.setParams({ ifClause: keyword }); + }; + } + }, +}; +function hasSchema(it, keyword) { + const schema = it.schema[keyword]; + return schema !== undefined && !(0, util_1.alwaysValidSchema)(it, schema); +} +exports.default = def; +//# sourceMappingURL=if.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.js.map new file mode 100644 index 0000000000000000000000000000000000000000..54efb1dcc950cbc01eb739a771dd9a30f2de5711 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/if.js.map @@ -0,0 +1 @@ +{"version":3,"file":"if.js","s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,GAAG,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAA;YACzC,CAAC,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAS,SAAS,CAAC,EAAgB,EAAE,OAAe;IAClD,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAA;AAC/D,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9cc5f5c89b90352a846405cc1c61e80364405d6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.d.ts @@ -0,0 +1,13 @@ +import type { ErrorNoParams, Vocabulary } from "../../types"; +import { AdditionalItemsError } from "./additionalItems"; +import { ItemsError } from "./items2020"; +import { ContainsError } from "./contains"; +import { DependenciesError } from "./dependencies"; +import { PropertyNamesError } from "./propertyNames"; +import { AdditionalPropertiesError } from "./additionalProperties"; +import { NotKeywordError } from "./not"; +import { AnyOfError } from "./anyOf"; +import { OneOfError } from "./oneOf"; +import { IfKeywordError } from "./if"; +export default function getApplicator(draft2020?: boolean): Vocabulary; +export type ApplicatorKeywordError = ErrorNoParams<"false schema"> | AdditionalItemsError | ItemsError | ContainsError | AdditionalPropertiesError | DependenciesError | IfKeywordError | AnyOfError | OneOfError | NotKeywordError | PropertyNamesError; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cf592f2795ef281098834ec11f21634bc3b75a13 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const additionalItems_1 = require("./additionalItems"); +const prefixItems_1 = require("./prefixItems"); +const items_1 = require("./items"); +const items2020_1 = require("./items2020"); +const contains_1 = require("./contains"); +const dependencies_1 = require("./dependencies"); +const propertyNames_1 = require("./propertyNames"); +const additionalProperties_1 = require("./additionalProperties"); +const properties_1 = require("./properties"); +const patternProperties_1 = require("./patternProperties"); +const not_1 = require("./not"); +const anyOf_1 = require("./anyOf"); +const oneOf_1 = require("./oneOf"); +const allOf_1 = require("./allOf"); +const if_1 = require("./if"); +const thenElse_1 = require("./thenElse"); +function getApplicator(draft2020 = false) { + const applicator = [ + // any + not_1.default, + anyOf_1.default, + oneOf_1.default, + allOf_1.default, + if_1.default, + thenElse_1.default, + // object + propertyNames_1.default, + additionalProperties_1.default, + dependencies_1.default, + properties_1.default, + patternProperties_1.default, + ]; + // array + if (draft2020) + applicator.push(prefixItems_1.default, items2020_1.default); + else + applicator.push(additionalItems_1.default, items_1.default); + applicator.push(contains_1.default); + return applicator; +} +exports.default = getApplicator; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ebcb8534d559773206fb842627ae92f037e0e5cc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/index.ts"],"names":[],"mappings":";;AACA,uDAAuE;AACvE,+CAAuC;AACvC,mCAA2B;AAC3B,2CAAiD;AACjD,yCAAkD;AAClD,iDAA8D;AAC9D,mDAAiE;AACjE,iEAAsF;AACtF,6CAAqC;AACrC,2DAAmD;AACnD,+BAAiD;AACjD,mCAAyC;AACzC,mCAAyC;AACzC,mCAA2B;AAC3B,6BAA8C;AAC9C,yCAAiC;AAEjC,SAAwB,aAAa,CAAC,SAAS,GAAG,KAAK;IACrD,MAAM,UAAU,GAAG;QACjB,MAAM;QACN,aAAU;QACV,eAAK;QACL,eAAK;QACL,eAAK;QACL,YAAS;QACT,kBAAQ;QACR,SAAS;QACT,uBAAa;QACb,8BAAoB;QACpB,sBAAY;QACZ,oBAAU;QACV,2BAAiB;KAClB,CAAA;IACD,QAAQ;IACR,IAAI,SAAS;QAAE,UAAU,CAAC,IAAI,CAAC,qBAAW,EAAE,mBAAS,CAAC,CAAA;;QACjD,UAAU,CAAC,IAAI,CAAC,yBAAe,EAAE,eAAK,CAAC,CAAA;IAC5C,UAAU,CAAC,IAAI,CAAC,kBAAQ,CAAC,CAAA;IACzB,OAAO,UAAU,CAAA;AACnB,CAAC;AArBD,gCAqBC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e608ca9c47f6fe542f8b40c072208d3e34e2dee --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function validateTuple(cxt: KeywordCxt, extraItems: string, schArr?: AnySchema[]): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.js new file mode 100644 index 0000000000000000000000000000000000000000..26f527bc69d233b0ae732531a73383191c2318d7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateTuple = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const def = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt) { + const { schema, it } = cxt; + if (Array.isArray(schema)) + return validateTuple(cxt, "additionalItems", schema); + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + cxt.ok((0, code_1.validateArray)(cxt)); + }, +}; +function validateTuple(cxt, extraItems, schArr = cxt.schema) { + const { gen, parentSchema, data, keyword, it } = cxt; + checkStrictTuple(parentSchema); + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items); + } + const valid = gen.name("valid"); + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + schArr.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + gen.if((0, codegen_1._) `${len} > ${i}`, () => cxt.subschema({ + keyword, + schemaProp: i, + dataProp: i, + }, valid)); + cxt.ok(valid); + }); + function checkStrictTuple(sch) { + const { opts, errSchemaPath } = it; + const l = schArr.length; + const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false); + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`; + (0, util_1.checkStrictMode)(it, msg, opts.strictTuples); + } + } +} +exports.validateTuple = validateTuple; +exports.default = def; +//# sourceMappingURL=items.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ef551187902abcdaa0019958816b2afd448e1484 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items.js.map @@ -0,0 +1 @@ +{"version":3,"file":"items.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items.ts"],"names":[],"mappings":";;;AAEA,mDAAuC;AACvC,6CAAqF;AACrF,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;IAC1C,MAAM,EAAE,aAAa;IACrB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,aAAa,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAA;QAC/E,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IAC5B,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAC3B,GAAe,EACf,UAAkB,EAClB,SAAsB,GAAG,CAAC,MAAM;IAEhC,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAClD,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC9B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAC9D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE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AAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a2565b2c2baff57afa9f8f1ac859b9775caf5422 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type ItemsError = ErrorObject<"items", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.js new file mode 100644 index 0000000000000000000000000000000000000000..f2387d7d206f67c44532ae1179e20c714db9f96a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const additionalItems_1 = require("./additionalItems"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error, + code(cxt) { + const { schema, parentSchema, it } = cxt; + const { prefixItems } = parentSchema; + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + if (prefixItems) + (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems); + else + cxt.ok((0, code_1.validateArray)(cxt)); + }, +}; +exports.default = def; +//# sourceMappingURL=items2020.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5034acda65c2594774228571328040aa611600d3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"items2020.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items2020.ts"],"names":[],"mappings":";;AAOA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAqC;AACrC,uDAAyD;AAIzD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtC,MAAM,EAAC,WAAW,EAAC,GAAG,YAAY,CAAA;QAClC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,IAAI,WAAW;YAAE,IAAA,yCAAuB,EAAC,GAAG,EAAE,WAAW,CAAC,CAAA;;YACrD,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IACjC,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d2f4888f3db5f5b82ee780b141ab0c1fba4d6340 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; +export type NotKeywordError = ErrorNoParams<"not", AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.js new file mode 100644 index 0000000000000000000000000000000000000000..89f6fddacf261c7ddb4a40094040239dba77b060 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt) { + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) { + cxt.fail(); + return; + } + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false, + }, valid); + cxt.failResult(valid, () => cxt.reset(), () => cxt.error()); + }, + error: { message: "must NOT be valid" }, +}; +exports.default = def; +//# sourceMappingURL=not.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d99e6ea87af3c521592fe82642b848d0e8f36cc0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/not.js.map @@ -0,0 +1 @@ +{"version":3,"file":"not.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/not.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAIpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YAClC,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,OAAM;QACR,CAAC;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CACX;YACE,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,KAAK;SACjB,EACD,KAAK,CACN,CAAA;QAED,GAAG,CAAC,UAAU,CACZ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CAAA;IACH,CAAC;IACD,KAAK,EAAE,EAAC,OAAO,EAAE,mBAAmB,EAAC;CACtC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e1d34f7251e2e0efe275c63e98a251d20fa8473 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type OneOfError = ErrorObject<"oneOf", { + passingSchemas: [number, number] | null; +}, AnySchema[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.js new file mode 100644 index 0000000000000000000000000000000000000000..441db2ac0b178f6297de1fbf85a4d0c1cd79a90e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: "must match exactly one schema in oneOf", + params: ({ params }) => (0, codegen_1._) `{passingSchemas: ${params.passing}}`, +}; +const def = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + if (it.opts.discriminator && parentSchema.discriminator) + return; + const schArr = schema; + const valid = gen.let("valid", false); + const passing = gen.let("passing", null); + const schValid = gen.name("_valid"); + cxt.setParams({ passing }); + // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas + gen.block(validateOneOf); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); + function validateOneOf() { + schArr.forEach((sch, i) => { + let schCxt; + if ((0, util_1.alwaysValidSchema)(it, sch)) { + gen.var(schValid, true); + } + else { + schCxt = cxt.subschema({ + keyword: "oneOf", + schemaProp: i, + compositeRule: true, + }, schValid); + } + if (i > 0) { + gen + .if((0, codegen_1._) `${schValid} && ${valid}`) + .assign(valid, false) + .assign(passing, (0, codegen_1._) `[${passing}, ${i}]`) + .else(); + } + gen.if(schValid, () => { + gen.assign(valid, true); + gen.assign(passing, i); + if (schCxt) + cxt.mergeEvaluated(schCxt, codegen_1.Name); + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=oneOf.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map new file mode 100644 index 0000000000000000000000000000000000000000..13b8bfe9f1a7bd8ac292c880114ebae6a8e3574a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/oneOf.ts"],"names":[],"mappings":";;AAOA,mDAA6C;AAC7C,6CAAoD;AASpD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,wCAAwC;IACjD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,oBAAoB,MAAM,CAAC,OAAO,GAAG;CAC7D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC3C,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,IAAI,EAAE,CAAC,IAAI,CAAC,aAAa,IAAI,YAAY,CAAC,aAAa;YAAE,OAAM;QAC/D,MAAM,MAAM,GAAgB,MAAM,CAAA;QAClC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAA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AAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;oBACvB,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;oBACtB,IAAI,MAAM;wBAAE,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;gBAC9C,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js new file mode 100644 index 0000000000000000000000000000000000000000..48501c6e33e3c492b927ecfc02fb990651ab1b3d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const util_2 = require("../../compile/util"); +const def = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, data, parentSchema, it } = cxt; + const { opts } = it; + const patterns = (0, code_1.allSchemaProperties)(schema); + const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p])); + if (patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true))) { + return; + } + const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties; + const valid = gen.name("valid"); + if (it.props !== true && !(it.props instanceof codegen_1.Name)) { + it.props = (0, util_2.evaluatedPropsToName)(gen, it.props); + } + const { props } = it; + validatePatternProperties(); + function validatePatternProperties() { + for (const pat of patterns) { + if (checkProperties) + checkMatchingProperties(pat); + if (it.allErrors) { + validateProperties(pat); + } + else { + gen.var(valid, true); // TODO var + validateProperties(pat); + gen.if(valid); + } + } + } + function checkMatchingProperties(pat) { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`); + } + } + } + function validateProperties(pat) { + gen.forIn("key", data, (key) => { + gen.if((0, codegen_1._) `${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => { + const alwaysValid = alwaysValidPatterns.includes(pat); + if (!alwaysValid) { + cxt.subschema({ + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: util_2.Type.Str, + }, valid); + } + if (it.opts.unevaluated && props !== true) { + gen.assign((0, codegen_1._) `${props}[${key}]`, true); + } + else if (!alwaysValid && !it.allErrors) { + // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) + // or if all properties were evaluated (props === true) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=patternProperties.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map new file mode 100644 index 0000000000000000000000000000000000000000..231b08164bce8a839b0851b078380c004b5c3bb5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js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AE,mBAAmB;4BAC5B,UAAU,EAAE,GAAG;4BACf,QAAQ,EAAE,GAAG;4BACb,YAAY,EAAE,WAAI,CAAC,GAAG;yBACvB,EACD,KAAK,CACN,CAAA;oBACH,CAAC;oBAED,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;wBAC1C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;oBACvC,CAAC;yBAAM,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC;wBACzC,sFAAsF;wBACtF,uDAAuD;wBACvD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;oBACvC,CAAC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js new file mode 100644 index 0000000000000000000000000000000000000000..727bc23ce0a575ca888c53fc3094e50eb3c74af7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const items_1 = require("./items"); +const def = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (cxt) => (0, items_1.validateTuple)(cxt, "items"), +}; +exports.default = def; +//# sourceMappingURL=prefixItems.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map new file mode 100644 index 0000000000000000000000000000000000000000..deef718e6e15bc6b3ca921bd0008ce925041ee15 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prefixItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/prefixItems.ts"],"names":[],"mappings":";;AACA,mCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,GAAG,EAAE,OAAO,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.js new file mode 100644 index 0000000000000000000000000000000000000000..7347358e29e2f7e6cb7c5f27d6bd381e03fb7c7b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const validate_1 = require("../../compile/validate"); +const code_1 = require("../code"); +const util_1 = require("../../compile/util"); +const additionalProperties_1 = require("./additionalProperties"); +const def = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { + additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties")); + } + const allProps = (0, code_1.allSchemaProperties)(schema); + for (const prop of allProps) { + it.definedProperties.add(prop); + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props); + } + const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); + if (properties.length === 0) + return; + const valid = gen.name("valid"); + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop); + } + else { + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties)); + applyPropertySchema(prop); + if (!it.allErrors) + gen.else().var(valid, true); + gen.endIf(); + } + cxt.it.definedProperties.add(prop); + cxt.ok(valid); + } + function hasDefault(prop) { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined; + } + function applyPropertySchema(prop) { + cxt.subschema({ + keyword: "properties", + schemaProp: prop, + dataProp: prop, + }, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.js.map new file mode 100644 index 0000000000000000000000000000000000000000..13cd34774cef2b4ecb3c0ba5f517c8955db3b1c8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/properties.ts"],"names":[],"mappings":";;AACA,qDAAiD;AACjD,kCAA2D;AAC3D,6CAA4E;AAC5E,iEAA0C;AAE1C,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,KAAK,KAAK,IAAI,YAAY,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;YAC1F,8BAAK,CAAC,IAAI,CAAC,IAAI,qBAAU,CAAC,EAAE,EAAE,8BAAK,EAAE,sBAAsB,CAAC,CAAC,CAAA;QAC/D,CAAC;QACD,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,MAAM,CAAC,CAAA;QAC5C,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC;QACD,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YAChE,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,IAAA,aA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AO,EAAE,YAAY;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,IAAI;aACf,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a806da32f0be53e9fcb9fd32a15f56e442582701 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type PropertyNamesError = ErrorObject<"propertyNames", { + propertyName: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js new file mode 100644 index 0000000000000000000000000000000000000000..f3871152de3cee3702b476e823569e324b50b237 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: "property name must be valid", + params: ({ params }) => (0, codegen_1._) `{propertyName: ${params.propertyName}}`, +}; +const def = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const valid = gen.name("valid"); + gen.forIn("key", data, (key) => { + cxt.setParams({ propertyName: key }); + cxt.subschema({ + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true, + }, valid); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(true); + if (!it.allErrors) + gen.break(); + }); + }); + cxt.ok(valid); + }, +}; +exports.default = def; +//# sourceMappingURL=propertyNames.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map new file mode 100644 index 0000000000000000000000000000000000000000..835b2bb132bb06b4563afd92ca741423a0523f0f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map @@ -0,0 +1 @@ +{"version":3,"file":"propertyNames.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/propertyNames.ts"],"names":[],"mappings":";;AAOA,mDAA4C;AAC5C,6CAAoD;AAIpD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,kBAAkB,MAAM,CAAC,YAAY,GAAG;CAChE,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE/B,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7B,GAAG,CAAC,SAAS,CAAC,EAAC,YAAY,EAAE,GAAG,EAAC,CAAC,CAAA;YAClC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,GAAG;gBACT,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,YAAY,EAAE,GAAG;gBACjB,aAAa,EAAE,IAAI;aACpB,EACD,KAAK,CACN,CAAA;YACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;gBACtB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACf,IAAI,CAAC,EAAE,CAAC,SAAS;oBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;YAChC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.js new file mode 100644 index 0000000000000000000000000000000000000000..1ae6390215cdd6091eb76c82df786e15950dbb47 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword, parentSchema, it }) { + if (parentSchema.if === undefined) + (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`); + }, +}; +exports.default = def; +//# sourceMappingURL=thenElse.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2629f4fce0a52f24887e04d880543a00ab7a472d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"thenElse.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/thenElse.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,EAAE,KAAK,SAAS;YAAE,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,2BAA2B,CAAC,CAAA;IAChG,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f914baca5caacfda6d263ff23cc9afaf3c7e9e92 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.d.ts @@ -0,0 +1,17 @@ +import type { SchemaMap } from "../types"; +import type { SchemaCxt } from "../compile"; +import type { KeywordCxt } from "../compile/validate"; +import { CodeGen, Code, Name } from "../compile/codegen"; +export declare function checkReportMissingProp(cxt: KeywordCxt, prop: string): void; +export declare function checkMissingProp({ gen, data, it: { opts } }: KeywordCxt, properties: string[], missing: Name): Code; +export declare function reportMissingProp(cxt: KeywordCxt, missing: Name): void; +export declare function hasPropFunc(gen: CodeGen): Name; +export declare function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code; +export declare function propertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; +export declare function noPropertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; +export declare function allSchemaProperties(schemaMap?: SchemaMap): string[]; +export declare function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[]; +export declare function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }: KeywordCxt, func: Code, context: Code, passSchema?: boolean): Code; +export declare function usePattern({ gen, it: { opts } }: KeywordCxt, pattern: string): Name; +export declare function validateArray(cxt: KeywordCxt): Name; +export declare function validateUnion(cxt: KeywordCxt): void; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.js new file mode 100644 index 0000000000000000000000000000000000000000..8cb899324c1ab57aab07a1cda647f609b47a30a6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.js @@ -0,0 +1,131 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0; +const codegen_1 = require("../compile/codegen"); +const util_1 = require("../compile/util"); +const names_1 = require("../compile/names"); +const util_2 = require("../compile/util"); +function checkReportMissingProp(cxt, prop) { + const { gen, data, it } = cxt; + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({ missingProperty: (0, codegen_1._) `${prop}` }, true); + cxt.error(); + }); +} +exports.checkReportMissingProp = checkReportMissingProp; +function checkMissingProp({ gen, data, it: { opts } }, properties, missing) { + return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._) `${missing} = ${prop}`))); +} +exports.checkMissingProp = checkMissingProp; +function reportMissingProp(cxt, missing) { + cxt.setParams({ missingProperty: missing }, true); + cxt.error(); +} +exports.reportMissingProp = reportMissingProp; +function hasPropFunc(gen) { + return gen.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: (0, codegen_1._) `Object.prototype.hasOwnProperty`, + }); +} +exports.hasPropFunc = hasPropFunc; +function isOwnProperty(gen, data, property) { + return (0, codegen_1._) `${hasPropFunc(gen)}.call(${data}, ${property})`; +} +exports.isOwnProperty = isOwnProperty; +function propertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} !== undefined`; + return ownProperties ? (0, codegen_1._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond; +} +exports.propertyInData = propertyInData; +function noPropertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} === undefined`; + return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond; +} +exports.noPropertyInData = noPropertyInData; +function allSchemaProperties(schemaMap) { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : []; +} +exports.allSchemaProperties = allSchemaProperties; +function schemaProperties(it, schemaMap) { + return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p])); +} +exports.schemaProperties = schemaProperties; +function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) { + const dataAndSchema = passSchema ? (0, codegen_1._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data; + const valCxt = [ + [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)], + [names_1.default.parentData, it.parentData], + [names_1.default.parentDataProperty, it.parentDataProperty], + [names_1.default.rootData, names_1.default.rootData], + ]; + if (it.opts.dynamicRef) + valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]); + const args = (0, codegen_1._) `${dataAndSchema}, ${gen.object(...valCxt)}`; + return context !== codegen_1.nil ? (0, codegen_1._) `${func}.call(${context}, ${args})` : (0, codegen_1._) `${func}(${args})`; +} +exports.callValidateCode = callValidateCode; +const newRegExp = (0, codegen_1._) `new RegExp`; +function usePattern({ gen, it: { opts } }, pattern) { + const u = opts.unicodeRegExp ? "u" : ""; + const { regExp } = opts.code; + const rx = regExp(pattern, u); + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`, + }); +} +exports.usePattern = usePattern; +function validateArray(cxt) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + if (it.allErrors) { + const validArr = gen.let("valid", true); + validateItems(() => gen.assign(validArr, false)); + return validArr; + } + gen.var(valid, true); + validateItems(() => gen.break()); + return valid; + function validateItems(notValid) { + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword, + dataProp: i, + dataPropType: util_1.Type.Num, + }, valid); + gen.if((0, codegen_1.not)(valid), notValid); + }); + } +} +exports.validateArray = validateArray; +function validateUnion(cxt) { + const { gen, schema, keyword, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch)); + if (alwaysValid && !it.opts.unevaluated) + return; + const valid = gen.let("valid", false); + const schValid = gen.name("_valid"); + gen.block(() => schema.forEach((_sch, i) => { + const schCxt = cxt.subschema({ + keyword, + schemaProp: i, + compositeRule: true, + }, schValid); + gen.assign(valid, (0, codegen_1._) `${valid} || ${schValid}`); + const merged = cxt.mergeValidEvaluated(schCxt, schValid); + // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) + // or if all properties and items were evaluated (it.props === true && it.items === true) + if (!merged) + gen.if((0, codegen_1.not)(valid)); + })); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); +} +exports.validateUnion = validateUnion; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ef06de270342a8e64232ed9762d1b13434ac9547 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"code.js","sourceRoot":"","sources":["../../lib/vocabularies/code.ts"],"names":[],"mappings":";;;AAGA,gDAAoG;AACpG,0CAAuD;AACvD,4CAAgC;AAChC,0CAAuC;AACvC,SAAgB,sBAAsB,CAAC,GAAe,EAAE,IAAY;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE;QACpE,GAAG,CAAC,SAAS,CAAC,EAAC,eAAe,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,EAAE,EAAC,EAAE,IAAI,CAAC,CAAA;QAClD,GAAG,CAAC,KAAK,EAAE,CAAA;IACb,CAAC,CAAC,CAAA;AAC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AC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACxD,+FAA+F;QAC/F,yFAAyF;QACzF,IAAI,CAAC,MAAM;YAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;IACjC,CAAC,CAAC,CACH,CAAA;IAED,GAAG,CAAC,MAAM,CACR,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CACtB,CAAA;AACH,CAAC;AAjCD,sCAiCC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.js new file mode 100644 index 0000000000000000000000000000000000000000..313598aab87eb681dad117567c6ce375839c797f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const def = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + }, +}; +exports.default = def; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4eb27eb33ac1a791672f7b88a71c381da98111b1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/id.ts"],"names":[],"mappings":";;AAEA,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,IAAI;IACb,IAAI;QACF,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f2e34ee3677c90cb3e63f650beb56b37eaa95149 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const core: Vocabulary; +export default core; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.js new file mode 100644 index 0000000000000000000000000000000000000000..87656d7436f4ff9bf4d366a4762a5e3b5845ed96 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const id_1 = require("./id"); +const ref_1 = require("./ref"); +const core = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + { keyword: "$comment" }, + "definitions", + id_1.default, + ref_1.default, +]; +exports.default = core; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5bf65f94173043ae2c2cf3d97bac619960190619 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/index.ts"],"names":[],"mappings":";;AACA,6BAA4B;AAC5B,+BAA8B;AAE9B,MAAM,IAAI,GAAe;IACvB,SAAS;IACT,KAAK;IACL,OAAO;IACP,aAAa;IACb,EAAC,OAAO,EAAE,UAAU,EAAC;IACrB,aAAa;IACb,YAAS;IACT,aAAU;CACX,CAAA;AAED,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a0967d157a6958adde1f7b4b927b39304dcc29a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +import { Code } from "../../compile/codegen"; +import { SchemaEnv } from "../../compile"; +declare const def: CodeKeywordDefinition; +export declare function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code; +export declare function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.js new file mode 100644 index 0000000000000000000000000000000000000000..bac1ae853fc0ae14da87693976bb3f205dd0df22 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.js @@ -0,0 +1,122 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.callRef = exports.getValidate = void 0; +const ref_error_1 = require("../../compile/ref_error"); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "$ref", + schemaType: "string", + code(cxt) { + const { gen, schema: $ref, it } = cxt; + const { baseId, schemaEnv: env, validateName, opts, self } = it; + const { root } = env; + if (($ref === "#" || $ref === "#/") && baseId === root.baseId) + return callRootRef(); + const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref); + if (schOrEnv === undefined) + throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref); + if (schOrEnv instanceof compile_1.SchemaEnv) + return callValidate(schOrEnv); + return inlineRefSchema(schOrEnv); + function callRootRef() { + if (env === root) + return callRef(cxt, validateName, env, env.$async); + const rootName = gen.scopeValue("root", { ref: root }); + return callRef(cxt, (0, codegen_1._) `${rootName}.validate`, root, root.$async); + } + function callValidate(sch) { + const v = getValidate(cxt, sch); + callRef(cxt, v, sch, sch.$async); + } + function inlineRefSchema(sch) { + const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch }); + const valid = gen.name("valid"); + const schCxt = cxt.subschema({ + schema: sch, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: $ref, + }, valid); + cxt.mergeEvaluated(schCxt); + cxt.ok(valid); + } + }, +}; +function getValidate(cxt, sch) { + const { gen } = cxt; + return sch.validate + ? gen.scopeValue("validate", { ref: sch.validate }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.validate`; +} +exports.getValidate = getValidate; +function callRef(cxt, v, sch, $async) { + const { gen, it } = cxt; + const { allErrors, schemaEnv: env, opts } = it; + const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil; + if ($async) + callAsyncRef(); + else + callSyncRef(); + function callAsyncRef() { + if (!env.$async) + throw new Error("async schema referenced by sync schema"); + const valid = gen.let("valid"); + gen.try(() => { + gen.code((0, codegen_1._) `await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`); + addEvaluatedFrom(v); // TODO will not work with async, it has to be returned with the result + if (!allErrors) + gen.assign(valid, true); + }, (e) => { + gen.if((0, codegen_1._) `!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e)); + addErrorsFrom(e); + if (!allErrors) + gen.assign(valid, false); + }); + cxt.ok(valid); + } + function callSyncRef() { + cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v)); + } + function addErrorsFrom(source) { + const errs = (0, codegen_1._) `${source}.errors`; + gen.assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`); // TODO tagged + gen.assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); + } + function addEvaluatedFrom(source) { + var _a; + if (!it.opts.unevaluated) + return; + const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated; + // TODO refactor + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props); + } + } + else { + const props = gen.var("props", (0, codegen_1._) `${source}.evaluated.props`); + it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name); + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items); + } + } + else { + const items = gen.var("items", (0, codegen_1._) `${source}.evaluated.items`); + it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name); + } + } + } +} +exports.callRef = callRef; +exports.default = def; +//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3125bb893700367483a12fea08d809871b4a8532 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/core/ref.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/ref.ts"],"names":[],"mappings":";;;AAEA,uDAAqD;AACrD,kCAAwC;AACxC,mDAAmE;AACnE,+CAAmC;AACnC,2CAAmD;AACnD,6CAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QAC7D,MAAM,EAAC,IAAI,EAAC,GAAG,GAAG,CAAA;QAClB,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,WAAW,EAAE,CAAA;QACnF,MAAM,QAAQ,GAAG,oBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAC1D,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,IAAI,mBAAe,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QACxF,IAAI,QAAQ,YAAY,mBAAS;YAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAA;QAChE,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAA;QAEhC,SAAS,WAA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EC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab3669a42dabd3a7b9f449055dfcb7e097fb61f2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { DiscrError, DiscrErrorObj } from "../discriminator/types"; +export type DiscriminatorError = DiscrErrorObj | DiscrErrorObj; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e113aed7015c2ab1170fd9b337ce36750269c79a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const types_1 = require("../discriminator/types"); +const compile_1 = require("../../compile"); +const ref_error_1 = require("../../compile/ref_error"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag + ? `tag "${tagName}" must be string` + : `value of tag "${tagName}" must be in oneOf`, + params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._) `{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, +}; +const def = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error, + code(cxt) { + const { gen, data, schema, parentSchema, it } = cxt; + const { oneOf } = parentSchema; + if (!it.opts.discriminator) { + throw new Error("discriminator: requires discriminator option"); + } + const tagName = schema.propertyName; + if (typeof tagName != "string") + throw new Error("discriminator: requires propertyName"); + if (schema.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!oneOf) + throw new Error("discriminator: requires oneOf keyword"); + const valid = gen.let("valid", false); + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(tagName)}`); + gen.if((0, codegen_1._) `typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName })); + cxt.ok(valid); + function validateMapping() { + const mapping = getMapping(); + gen.if(false); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(mapping[tagValue])); + } + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name("valid"); + const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid); + cxt.mergeEvaluated(schCxt, codegen_1.Name); + return _valid; + } + function getMapping() { + var _a; + const oneOfMapping = {}; + const topRequired = hasRequired(parentSchema); + let tagRequired = true; + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i]; + if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) { + const ref = sch.$ref; + sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref); + if (sch instanceof compile_1.SchemaEnv) + sch = sch.schema; + if (sch === undefined) + throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref); + } + const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName]; + if (typeof propSch != "object") { + throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`); + } + tagRequired = tagRequired && (topRequired || hasRequired(sch)); + addMappings(propSch, i); + } + if (!tagRequired) + throw new Error(`discriminator: "${tagName}" must be required`); + return oneOfMapping; + function hasRequired({ required }) { + return Array.isArray(required) && required.includes(tagName); + } + function addMappings(sch, i) { + if (sch.const) { + addMapping(sch.const, i); + } + else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i); + } + } + else { + throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`); + } + } + function addMapping(tagValue, i) { + if (typeof tagValue != "string" || tagValue in oneOfMapping) { + throw new Error(`discriminator: "${tagName}" values must be unique strings`); + } + oneOfMapping[tagValue] = i; + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f9d69db2670931bbeb2f00511cb2eb0410308a64 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/index.ts"],"names":[],"mappings":";;AAEA,mDAA0D;AAC1D,kDAAgE;AAChE,2CAAmD;AACnD,uDAAqD;AACrD,6CAAuD;AAIvD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,OAAO,EAAC,EAAC,EAAE,EAAE,CAC3C,UAAU,KAAK,kBAAU,CAAC,GAAG;QAC3B,CAAC,CAAC,QAAQ,OAAO,kBAAkB;QACnC,CAAC,CAAC,iBAAiB,OAAO,oBAAoB;IAClD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,GAAG,EAAE,OAAO,EAAC,EAAC,EAAE,EAAE,CAC/C,IAAA,WAAC,EAAA,WAAW,UAAU,UAAU,OAAO,eAAe,GAAG,GAAG;CAC/D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,QAAQ;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BAC1B,CAAC;qBAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;oBACpB,KAAK,MAAM,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;wBAChC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;oBACzB,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,+BAA+B,CAAC,CAAA;gBACvF,CAAC;YACH,CAAC;YAED,SAAS,UAAU,CAAC,QAAiB,EAAE,CAAS;gBAC9C,IAAI,OAAO,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,YAAY,EAAE,CAAC;oBAC5D,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,iCAAiC,CAAC,CAAA;gBAC9E,CAAC;gBACD,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8550f6d97d4218ee0165837b6a79f3e94432f066 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts @@ -0,0 +1,10 @@ +import type { ErrorObject } from "../../types"; +export declare enum DiscrError { + Tag = "tag", + Mapping = "mapping" +} +export type DiscrErrorObj = ErrorObject<"discriminator", { + error: E; + tag: string; + tagValue: unknown; +}, string>; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.js new file mode 100644 index 0000000000000000000000000000000000000000..edf4da5ed1b1fa767be171113574e5354342b485 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DiscrError = void 0; +var DiscrError; +(function (DiscrError) { + DiscrError["Tag"] = "tag"; + DiscrError["Mapping"] = "mapping"; +})(DiscrError || (exports.DiscrError = DiscrError = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..028633bd36fb0db4056bb06c3164421e9a6a7f26 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/discriminator/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,iCAAmB,CAAA;AACrB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d65752c63fd987d30ba3e84f61d3e826d7b85f06 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const draft2020Vocabularies: Vocabulary[]; +export default draft2020Vocabularies; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.js new file mode 100644 index 0000000000000000000000000000000000000000..23d244aed1e154bc80c292cfdc1bf509d42e3c3d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("./core"); +const validation_1 = require("./validation"); +const applicator_1 = require("./applicator"); +const dynamic_1 = require("./dynamic"); +const next_1 = require("./next"); +const unevaluated_1 = require("./unevaluated"); +const format_1 = require("./format"); +const metadata_1 = require("./metadata"); +const draft2020Vocabularies = [ + dynamic_1.default, + core_1.default, + validation_1.default, + (0, applicator_1.default)(true), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, + next_1.default, + unevaluated_1.default, +]; +exports.default = draft2020Vocabularies; +//# sourceMappingURL=draft2020.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ae1a4d8339f75f3028417bd13b011b7d9c17974b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"draft2020.js","sourceRoot":"","sources":["../../lib/vocabularies/draft2020.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,uCAAyC;AACzC,iCAAmC;AACnC,+CAAiD;AACjD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,qBAAqB,GAAiB;IAC1C,iBAAiB;IACjB,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,EAAC,IAAI,CAAC;IAC7B,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;IACjB,cAAc;IACd,qBAAqB;CACtB,CAAA;AAED,kBAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..469fb84444d053fdf97be4ca8cd7c2bd7207861d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const draft7Vocabularies: Vocabulary[]; +export default draft7Vocabularies; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.js new file mode 100644 index 0000000000000000000000000000000000000000..1e993de0ecea2f52dd26d0d9273cdccf0bc0de91 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("./core"); +const validation_1 = require("./validation"); +const applicator_1 = require("./applicator"); +const format_1 = require("./format"); +const metadata_1 = require("./metadata"); +const draft7Vocabularies = [ + core_1.default, + validation_1.default, + (0, applicator_1.default)(), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, +]; +exports.default = draft7Vocabularies; +//# sourceMappingURL=draft7.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bc7389c67ddb59014376b3c2f07466587a3dcb7d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/draft7.js.map @@ -0,0 +1 @@ +{"version":3,"file":"draft7.js","sourceRoot":"","sources":["../../lib/vocabularies/draft7.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,kBAAkB,GAAiB;IACvC,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,GAAE;IACzB,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;CAClB,CAAA;AAED,kBAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..56212139936eda0e1efe4c92f64fa1d25a81384d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function dynamicAnchor(cxt: KeywordCxt, anchor: string): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js new file mode 100644 index 0000000000000000000000000000000000000000..972dc35c4b053b850592ded106465c4e4901ce8a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicAnchor = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema), +}; +function dynamicAnchor(cxt, anchor) { + const { gen, it } = cxt; + it.schemaEnv.root.dynamicAnchors[anchor] = true; + const v = (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`; + const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt); + gen.if((0, codegen_1._) `!${v}`, () => gen.assign(v, validate)); +} +exports.dynamicAnchor = dynamicAnchor; +function _getValidate(cxt) { + const { schemaEnv, schema, self } = cxt.it; + const { root, baseId, localRefs, meta } = schemaEnv.root; + const { schemaId } = self.opts; + const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta }); + compile_1.compileSchema.call(self, sch); + return (0, ref_1.getValidate)(cxt, sch); +} +exports.default = def; +//# sourceMappingURL=dynamicAnchor.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e70afe30f047fe404fdf41a31b46322cf85a22d7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicAnchor.ts"],"names":[],"mappings":";;;AAEA,mDAA0D;AAC1D,+CAAmC;AACnC,2CAAsD;AACtD,qCAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,gBAAgB;IACzB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC9C,CAAA;AAED,SAAgB,aAAa,CAAC,GAAe,EAAE,MAAc;IAC3D,MAAM,EAAC,GAAG,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACrB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAC/C,MAAM,CAAC,GAAG,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,cAAc,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,EAAE,CAAA;IACtD,MAAM,QAAQ,GAAG,EAAE,CAAC,aAAa,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAC/E,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;AACjD,CAAC;AAND,sCAMC;AAED,SAAS,YAAY,CAAC,GAAe;IACnC,MAAM,EAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAC,EAAE,CAAA;IACxC,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,GAAG,SAAS,CAAC,IAAI,CAAA;IACtD,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC5B,MAAM,GAAG,GAAG,IAAI,mBAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,CAAA;IAC5E,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC7B,OAAO,IAAA,iBAAW,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC9B,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fa2f2b81d67fc6c511f8721a91fa9a8aa2640235 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function dynamicRef(cxt: KeywordCxt, ref: string): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js new file mode 100644 index 0000000000000000000000000000000000000000..9f010a0df422b96b35d84db149aed28c126c3687 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicRef = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +}; +function dynamicRef(cxt, ref) { + const { gen, keyword, it } = cxt; + if (ref[0] !== "#") + throw new Error(`"${keyword}" only supports hash fragment reference`); + const anchor = ref.slice(1); + if (it.allErrors) { + _dynamicRef(); + } + else { + const valid = gen.let("valid", false); + _dynamicRef(valid); + cxt.ok(valid); + } + function _dynamicRef(valid) { + // TODO the assumption here is that `recursiveRef: #` always points to the root + // of the schema object, which is not correct, because there may be $id that + // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. + // Because of that 2 tests in recursiveRef.json fail. + // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). + // (This problem is not tested in JSON-Schema-Test-Suite) + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`); + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)); + } + else { + _callRef(it.validateName, valid)(); + } + } + function _callRef(validate, valid) { + return valid + ? () => gen.block(() => { + (0, ref_1.callRef)(cxt, validate); + gen.let(valid, true); + }) + : () => (0, ref_1.callRef)(cxt, validate); + } +} +exports.dynamicRef = dynamicRef; +exports.default = def; +//# sourceMappingURL=dynamicRef.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map new file mode 100644 index 0000000000000000000000000000000000000000..69afd4de88e749c4cc5dbc6ffcc1c820d3d9edcc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicRef.ts"],"names":[],"mappings":";;;AAEA,mDAAgE;AAChE,+CAAmC;AACnC,qCAAmC;AAEnC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,SAAgB,UAAU,CAAC,GAAe,EAAE,GAAW;IACrD,MAAM,EAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC9B,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,yCAAyC,CAAC,CAAA;IACzF,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC3B,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;QACjB,WAAW,EAAE,CAAA;IACf,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,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.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c751d93f0df2b9fdb758a4f2c2b78a3df1d757a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const dynamic: Vocabulary; +export default dynamic; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f2388a7571c900d3875e48ba04337ffe453f1ae4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const dynamicRef_1 = require("./dynamicRef"); +const recursiveAnchor_1 = require("./recursiveAnchor"); +const recursiveRef_1 = require("./recursiveRef"); +const dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default]; +exports.default = dynamic; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f96ba76dd87912586d53bc13d2d2cf7aebe5af5a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/index.ts"],"names":[],"mappings":";;AACA,mDAA2C;AAC3C,6CAAqC;AACrC,uDAA+C;AAC/C,iDAAyC;AAEzC,MAAM,OAAO,GAAe,CAAC,uBAAa,EAAE,oBAAU,EAAE,yBAAe,EAAE,sBAAY,CAAC,CAAA;AAEtF,kBAAe,OAAO,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js new file mode 100644 index 0000000000000000000000000000000000000000..9fd8323535f9f06d5373ade2c7bd8107568305b0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) + (0, dynamicAnchor_1.dynamicAnchor)(cxt, ""); + else + (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored"); + }, +}; +exports.default = def; +//# sourceMappingURL=recursiveAnchor.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5d5e381b0d18243b962370caa5f70b6309d843f4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"recursiveAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveAnchor.ts"],"names":[],"mappings":";;AACA,mDAA6C;AAC7C,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,SAAS;IACrB,IAAI,CAAC,GAAG;QACN,IAAI,GAAG,CAAC,MAAM;YAAE,IAAA,6BAAa,EAAC,GAAG,EAAE,EAAE,CAAC,CAAA;;YACjC,IAAA,sBAAe,EAAC,GAAG,CAAC,EAAE,EAAE,oCAAoC,CAAC,CAAA;IACpE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js new file mode 100644 index 0000000000000000000000000000000000000000..8cd5c696906dfd0f86a90ee3bc46cbcf99159a81 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicRef_1 = require("./dynamicRef"); +const def = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema), +}; +exports.default = def; +//# sourceMappingURL=recursiveRef.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f8138044678b18360bb971f0c90a2dc93b0d24df --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"recursiveRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveRef.ts"],"names":[],"mappings":";;AACA,6CAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be67f2e82ef8e761e7f91480bd59c55e9e72385a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.d.ts @@ -0,0 +1,9 @@ +import type { TypeError } from "../compile/validate/dataType"; +import type { ApplicatorKeywordError } from "./applicator"; +import type { ValidationKeywordError } from "./validation"; +import type { FormatError } from "./format/format"; +import type { UnevaluatedPropertiesError } from "./unevaluated/unevaluatedProperties"; +import type { UnevaluatedItemsError } from "./unevaluated/unevaluatedItems"; +import type { DependentRequiredError } from "./validation/dependentRequired"; +import type { DiscriminatorError } from "./discriminator"; +export type DefinedError = TypeError | ApplicatorKeywordError | ValidationKeywordError | FormatError | UnevaluatedPropertiesError | UnevaluatedItemsError | DependentRequiredError | DiscriminatorError; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..d4d3fba00293596f6c2251c585ed1763cdcfb8cd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.js.map new file mode 100644 index 0000000000000000000000000000000000000000..56bad7362f18649eeee3ebbc0401abda445575d2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/vocabularies/errors.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..04dc98f64822264582fc4f5a2c5ac18f543e68ad --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type FormatError = ErrorObject<"format", { + format: string; +}, string | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.js new file mode 100644 index 0000000000000000000000000000000000000000..aa667c1ef13ead4b14f523464fed67cf6f2eb04e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must match format "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._) `{format: ${schemaCode}}`, +}; +const def = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error, + code(cxt, ruleType) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + const { opts, errSchemaPath, schemaEnv, self } = it; + if (!opts.validateFormats) + return; + if ($data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }); + const fDef = gen.const("fDef", (0, codegen_1._) `${fmts}[${schemaCode}]`); + const fType = gen.let("fType"); + const format = gen.let("format"); + // TODO simplify + gen.if((0, codegen_1._) `typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._) `${fDef}.type || "string"`).assign(format, (0, codegen_1._) `${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._) `"string"`).assign(format, fDef)); + cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt())); + function unknownFmt() { + if (opts.strictSchema === false) + return codegen_1.nil; + return (0, codegen_1._) `${schemaCode} && !${format}`; + } + function invalidFmt() { + const callFormat = schemaEnv.$async + ? (0, codegen_1._) `(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : (0, codegen_1._) `${format}(${data})`; + const validData = (0, codegen_1._) `(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`; + return (0, codegen_1._) `${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`; + } + } + function validateFormat() { + const formatDef = self.formats[schema]; + if (!formatDef) { + unknownFormat(); + return; + } + if (formatDef === true) + return; + const [fmtType, format, fmtRef] = getFormat(formatDef); + if (fmtType === ruleType) + cxt.pass(validCondition()); + function unknownFormat() { + if (opts.strictSchema === false) { + self.logger.warn(unknownMsg()); + return; + } + throw new Error(unknownMsg()); + function unknownMsg() { + return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`; + } + } + function getFormat(fmtDef) { + const code = fmtDef instanceof RegExp + ? (0, codegen_1.regexpCode)(fmtDef) + : opts.code.formats + ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` + : undefined; + const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code }); + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._) `${fmt}.validate`]; + } + return ["string", fmtDef, fmt]; + } + function validCondition() { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) + throw new Error("async format in sync schema"); + return (0, codegen_1._) `await ${fmtRef}(${data})`; + } + return typeof format == "function" ? (0, codegen_1._) `${fmtRef}(${data})` : (0, codegen_1._) `${fmtRef}.test(${data})`; + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b6d93c9816c7a4819b9f3c050761eeb51a56ebdf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/format.ts"],"names":[],"mappings":";;AAS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Q,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,WAAW,CAAC,CAAA;gBACvE,CAAC;gBAED,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;YAChC,CAAC;YAED,SAAS,cAAc;gBACrB,IAAI,OAAO,SAAS,IAAI,QAAQ,IAAI,CAAC,CAAC,SAAS,YAAY,MAAM,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;oBACtF,IAAI,CAAC,SAAS,CAAC,MAAM;wBAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;oBACrE,OAAO,IAAA,WAAC,EAAA,SAAS,MAAM,IAAI,IAAI,GAAG,CAAA;gBACpC,CAAC;gBACD,OAAO,OAAO,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,SAAS,IAAI,GAAG,CAAA;YACzF,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8019c9d6cab7337dc8757d3c0847e01f14ec8ab --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const format: Vocabulary; +export default format; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d19023d24525c8826c752d69833e0681be48f75f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const format_1 = require("./format"); +const format = [format_1.default]; +exports.default = format; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6315bfe1f1a5c0b996fe97017b011da329bd6c3b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/format/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/index.ts"],"names":[],"mappings":";;AACA,qCAAoC;AAEpC,MAAM,MAAM,GAAe,CAAC,gBAAa,CAAC,CAAA;AAE1C,kBAAe,MAAM,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..85e16df6a2d6a1f0cb02d4d1f5e35c14ef617255 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { _JTDTypeError } from "./error"; +import { DiscrError, DiscrErrorObj } from "../discriminator/types"; +export type JTDDiscriminatorError = _JTDTypeError<"discriminator", "object", string> | DiscrErrorObj | DiscrErrorObj; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.js new file mode 100644 index 0000000000000000000000000000000000000000..e7074d2794c19cd19ed6271243d6f7d32013be4a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const types_1 = require("../discriminator/types"); +const error = { + message: (cxt) => { + const { schema, params } = cxt; + return params.discrError + ? params.discrError === types_1.DiscrError.Tag + ? `tag "${schema}" must be string` + : `value of tag "${schema}" must be in mapping` + : (0, error_1.typeErrorMessage)(cxt, "object"); + }, + params: (cxt) => { + const { schema, params } = cxt; + return params.discrError + ? (0, codegen_1._) `{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` + : (0, error_1.typeErrorParams)(cxt, "object"); + }, +}; +const def = { + keyword: "discriminator", + schemaType: "string", + implements: ["mapping"], + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, parentSchema } = cxt; + const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); + gen.if(cond); + validateDiscriminator(); + gen.elseIf((0, codegen_1.not)(valid)); + cxt.error(); + gen.endIf(); + cxt.ok(valid); + function validateDiscriminator() { + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(schema)}`); + gen.if((0, codegen_1._) `${tag} === undefined`); + cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }); + gen.elseIf((0, codegen_1._) `typeof ${tag} == "string"`); + validateMapping(tag); + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }, { instancePath: schema }); + gen.endIf(); + } + function validateMapping(tag) { + gen.if(false); + for (const tagValue in parentSchema.mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(tagValue)); + } + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag }, { instancePath: schema, schemaPath: "mapping", parentSchema: true }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name("valid"); + cxt.subschema({ + keyword: "mapping", + schemaProp, + jtdDiscriminator: schema, + }, _valid); + return _valid; + } + }, +}; +exports.default = def; +//# sourceMappingURL=discriminator.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ca2a5ab9449a43099f29e3787dea165be515cf71 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"discriminator.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/discriminator.ts"],"names":[],"mappings":";;AAEA,mDAA+D;AAC/D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AACxE,kDAAgE;AAOhE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,kBAAU,CAAC,GAAG;gBACpC,CAAC,CAAC,QAAQ,MAAM,kBAAkB;gBAClC,CAAC,CAAC,iBAAiB,MAAM,sBAAsB;YACjD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,IAAA,WAAC,EAAA,WAAW,MAAM,CAAC,UAAU,UAAU,MAAM,eAAe,MAAM,CAAC,GAAG,GAAG;YAC3E,CAAC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,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,GAAG,EAAE,GAAG,EAAC,EAAE,EAAC,YAAY,EAAE,MAAM,EAAC,CAAC,CAAA;YAC3E,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,eAAe,CAAC,GAAS;YAChC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC5C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;gBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC7C,CAAC;YACD,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CACP,KAAK,EACL,EAAC,UAAU,EAAE,kBAAU,CAAC,OAAO,EAAE,GAAG,EAAC,EACrC,EAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAC,CAClE,CAAA;YACD,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,cAAc,CAAC,UAAkB;YACxC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,SAAS;gBAClB,UAAU;gBACV,gBAAgB,EAAE,MAAM;aACzB,EACD,MAAM,CACP,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..82c942c35af242c9eeab8f50635cda9d52cd4c42 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, SchemaObject } from "../../types"; +import { _JTDTypeError } from "./error"; +export type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.js new file mode 100644 index 0000000000000000000000000000000000000000..9b8fb548a4fe23c058bf517459dfef9a872b59b5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const def = { + keyword: "elements", + schemaType: "object", + error: (0, error_1.typeError)("array"), + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const [valid] = (0, nullable_1.checkNullable)(cxt); + gen.if((0, codegen_1.not)(valid), () => gen.if((0, codegen_1._) `Array.isArray(${data})`, () => gen.assign(valid, (0, code_1.validateArray)(cxt)), () => cxt.error())); + cxt.ok(valid); + }, +}; +exports.default = def; +//# sourceMappingURL=elements.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.js.map new file mode 100644 index 0000000000000000000000000000000000000000..38fe3a129770f8847a53cb5781e4120f529e7fdb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/elements.js.map @@ -0,0 +1 @@ +{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/elements.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AACpD,kCAAqC;AACrC,mDAA4C;AAC5C,yCAAwC;AACxC,yCAAwC;AACxC,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,OAAO,CAAC;IACzB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CACtB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,iBAAiB,IAAI,GAAG,EACzB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,EAC3C,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CACF,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ba1790d7321b7bf22ebe4fc12b3508cadfddc71 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type JTDEnumError = ErrorObject<"enum", { + allowedValues: string[]; +}, string[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.js new file mode 100644 index 0000000000000000000000000000000000000000..78b01ee3762fb487e500c060be12c73dcf3f122c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, +}; +const def = { + keyword: "enum", + schemaType: "array", + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, schemaValue, parentSchema, it } = cxt; + if (schema.length === 0) + throw new Error("enum must have non-empty array"); + if (schema.length !== new Set(schema).size) + throw new Error("enum items must be unique"); + let valid; + const isString = (0, codegen_1._) `typeof ${data} == "string"`; + if (schema.length >= it.opts.loopEnum) { + let cond; + [valid, cond] = (0, nullable_1.checkNullable)(cxt, isString); + gen.if(cond, loopEnum); + } + else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + valid = (0, codegen_1.and)(isString, (0, codegen_1.or)(...schema.map((value) => (0, codegen_1._) `${data} === ${value}`))); + if (parentSchema.nullable) + valid = (0, codegen_1.or)((0, codegen_1._) `${data} === null`, valid); + } + cxt.pass(valid); + function loopEnum() { + gen.forOf("v", schemaValue, (v) => gen.if((0, codegen_1._) `${valid} = ${data} === ${v}`, () => gen.break())); + } + }, +}; +exports.default = def; +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.js.map new file mode 100644 index 0000000000000000000000000000000000000000..06ee9e20612a24649a629cb90e4c6e438faca3bb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/enum.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/enum.ts"],"names":[],"mappings":";;AAEA,mDAAsD;AACtD,yCAAwC;AACxC,yCAAwC;AAIxC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QACxF,IAAI,KAAW,CAAA;QACf,MAAM,QAAQ,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;QAC9C,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtC,IAAI,IAAU,CACb;YAAA,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC7C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,wBAAwB;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACvE,KAAK,GAAG,IAAA,aAAG,EAAC,QAAQ,EAAE,IAAA,YAAE,EAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;YACpF,IAAI,YAAY,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,KAAK,CAAC,CAAA;QACnE,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,WAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CACxC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,IAAI,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAC1D,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d334ff54cb0ea2cebabff39ef146cb62d2ea099f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.d.ts @@ -0,0 +1,9 @@ +import type { KeywordErrorDefinition, KeywordErrorCxt, ErrorObject } from "../../types"; +import { Code } from "../../compile/codegen"; +export type _JTDTypeError = ErrorObject; +export declare function typeError(t: string): KeywordErrorDefinition; +export declare function typeErrorMessage({ parentSchema }: KeywordErrorCxt, t: string): string; +export declare function typeErrorParams({ parentSchema }: KeywordErrorCxt, t: string): Code; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.js new file mode 100644 index 0000000000000000000000000000000000000000..1a3920a7e5a02e24ceb98aa8f06fd0be15162758 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.typeErrorParams = exports.typeErrorMessage = exports.typeError = void 0; +const codegen_1 = require("../../compile/codegen"); +function typeError(t) { + return { + message: (cxt) => typeErrorMessage(cxt, t), + params: (cxt) => typeErrorParams(cxt, t), + }; +} +exports.typeError = typeError; +function typeErrorMessage({ parentSchema }, t) { + return (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable) ? `must be ${t} or null` : `must be ${t}`; +} +exports.typeErrorMessage = typeErrorMessage; +function typeErrorParams({ parentSchema }, t) { + return (0, codegen_1._) `{type: ${t}, nullable: ${!!(parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable)}}`; +} +exports.typeErrorParams = typeErrorParams; +//# sourceMappingURL=error.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..db559678755634c562b873afef0fb37a16d2458f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/error.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAQ7C,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC;KACzC,CAAA;AACH,CAAC;AALD,8BAKC;AAED,SAAgB,gBAAgB,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACzE,OAAO,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,EAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAA;AACzE,CAAC;AAFD,4CAEC;AAED,SAAgB,eAAe,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACxE,OAAO,IAAA,WAAC,EAAA,UAAU,CAAC,eAAe,CAAC,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAA,GAAG,CAAA;AAC/D,CAAC;AAFD,0CAEC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c56246b78281d9ef8e6a17a8a0d5bab317d1bfd0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.d.ts @@ -0,0 +1,10 @@ +import type { Vocabulary } from "../../types"; +import { JTDTypeError } from "./type"; +import { JTDEnumError } from "./enum"; +import { JTDElementsError } from "./elements"; +import { JTDPropertiesError } from "./properties"; +import { JTDDiscriminatorError } from "./discriminator"; +import { JTDValuesError } from "./values"; +declare const jtdVocabulary: Vocabulary; +export default jtdVocabulary; +export type JTDErrorObject = JTDTypeError | JTDEnumError | JTDElementsError | JTDPropertiesError | JTDDiscriminatorError | JTDValuesError; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.js new file mode 100644 index 0000000000000000000000000000000000000000..18f40ab7a81c87959088f152ae0dd003cc466bac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ref_1 = require("./ref"); +const type_1 = require("./type"); +const enum_1 = require("./enum"); +const elements_1 = require("./elements"); +const properties_1 = require("./properties"); +const optionalProperties_1 = require("./optionalProperties"); +const discriminator_1 = require("./discriminator"); +const values_1 = require("./values"); +const union_1 = require("./union"); +const metadata_1 = require("./metadata"); +const jtdVocabulary = [ + "definitions", + ref_1.default, + type_1.default, + enum_1.default, + elements_1.default, + properties_1.default, + optionalProperties_1.default, + discriminator_1.default, + values_1.default, + union_1.default, + metadata_1.default, + { keyword: "additionalProperties", schemaType: "boolean" }, + { keyword: "nullable", schemaType: "boolean" }, +]; +exports.default = jtdVocabulary; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..713a1875b5440ed991c10da8856e0dcc0ec71e1f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/index.ts"],"names":[],"mappings":";;AACA,+BAA8B;AAC9B,iCAAgD;AAChD,iCAAgD;AAChD,yCAAqD;AACrD,6CAA2D;AAC3D,6DAAqD;AACrD,mDAAoE;AACpE,qCAA+C;AAC/C,mCAA2B;AAC3B,yCAAiC;AAEjC,MAAM,aAAa,GAAe;IAChC,aAAa;IACb,aAAU;IACV,cAAW;IACX,cAAW;IACX,kBAAQ;IACR,oBAAU;IACV,4BAAkB;IAClB,uBAAa;IACb,gBAAM;IACN,eAAK;IACL,kBAAQ;IACR,EAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,SAAS,EAAC;IACxD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;CAC7C,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..86e15a8ede087d8d036a353d88d8f96be8ed0688 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts @@ -0,0 +1,5 @@ +import { KeywordCxt } from "../../ajv"; +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export declare function checkMetadata({ it, keyword }: KeywordCxt, metadata?: boolean): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..eeb3c91cda634c31c284dd8ef945a193ad864b05 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkMetadata = void 0; +const util_1 = require("../../compile/util"); +const def = { + keyword: "metadata", + schemaType: "object", + code(cxt) { + checkMetadata(cxt); + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const valid = gen.name("valid"); + cxt.subschema({ keyword: "metadata", jtdMetadata: true }, valid); + cxt.ok(valid); + }, +}; +function checkMetadata({ it, keyword }, metadata) { + if (it.jtdMetadata !== metadata) { + throw new Error(`JTD: "${keyword}" cannot be used in this schema location`); + } +} +exports.checkMetadata = checkMetadata; +exports.default = def; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2fea91ce5d7cd20ca9aa87672c09245c9ce6df4c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/metadata.ts"],"names":[],"mappings":";;;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,aAAa,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;QAC9D,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAAC,EAAC,EAAE,EAAE,OAAO,EAAa,EAAE,QAAkB;IACzE,IAAI,EAAE,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,0CAA0C,CAAC,CAAA;IAC7E,CAAC;AACH,CAAC;AAJD,sCAIC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..254f76023d7e2517406247c61ae4e9f37cf67734 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts @@ -0,0 +1,4 @@ +import type { KeywordCxt } from "../../compile/validate"; +import { Code, Name } from "../../compile/codegen"; +export declare function checkNullable({ gen, data, parentSchema }: KeywordCxt, cond?: Code): [Name, Code]; +export declare function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code]; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.js new file mode 100644 index 0000000000000000000000000000000000000000..8c92d2cde3da68273f89a6160bf5aed01363e628 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkNullableObject = exports.checkNullable = void 0; +const codegen_1 = require("../../compile/codegen"); +function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) { + const valid = gen.name("valid"); + if (parentSchema.nullable) { + gen.let(valid, (0, codegen_1._) `${data} === null`); + cond = (0, codegen_1.not)(valid); + } + else { + gen.let(valid, false); + } + return [valid, cond]; +} +exports.checkNullable = checkNullable; +function checkNullableObject(cxt, cond) { + const [valid, cond_] = checkNullable(cxt, cond); + return [valid, (0, codegen_1._) `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`]; +} +exports.checkNullableObject = checkNullableObject; +//# sourceMappingURL=nullable.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7d7a3f192da67e1a0f1b3f2df4c62bebaf63f9df --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/nullable.ts"],"names":[],"mappings":";;;AACA,mDAA6D;AAE7D,SAAgB,aAAa,CAC3B,EAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAa,EACrC,OAAa,aAAG;IAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC1B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;QACnC,IAAI,GAAG,IAAA,aAAG,EAAC,KAAK,CAAC,CAAA;IACnB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACvB,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAZD,sCAYC;AAED,SAAgB,mBAAmB,CAAC,GAAe,EAAE,IAAU;IAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC/C,OAAO,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,KAAK,cAAc,GAAG,CAAC,IAAI,kCAAkC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA;AAC9F,CAAC;AAHD,kDAGC"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js new file mode 100644 index 0000000000000000000000000000000000000000..fe272758f56556501c82f61e8194ab7392aa7e0e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const properties_1 = require("./properties"); +const def = { + keyword: "optionalProperties", + schemaType: "object", + error: properties_1.error, + code(cxt) { + if (cxt.parentSchema.properties) + return; + (0, properties_1.validateProperties)(cxt); + }, +}; +exports.default = def; +//# sourceMappingURL=optionalProperties.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map new file mode 100644 index 0000000000000000000000000000000000000000..21e5f0d47360ecb1547385f31f2febc6450f862a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"optionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/optionalProperties.ts"],"names":[],"mappings":";;AAEA,6CAAsD;AAEtD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,oBAAoB;IAC7B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,kBAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU;YAAE,OAAM;QACvC,IAAA,+BAAkB,EAAC,GAAG,CAAC,CAAA;IACzB,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..54e3b347cb3aabae0c8e196801b8f837294dfb18 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts @@ -0,0 +1,22 @@ +import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaObject } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +import { _JTDTypeError } from "./error"; +declare enum PropError { + Additional = "additional", + Missing = "missing" +} +type PropKeyword = "properties" | "optionalProperties"; +type PropSchema = { + [P in string]?: SchemaObject; +}; +export type JTDPropertiesError = _JTDTypeError | ErrorObject | ErrorObject; +export declare const error: KeywordErrorDefinition; +declare const def: CodeKeywordDefinition; +export declare function validateProperties(cxt: KeywordCxt): void; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.js new file mode 100644 index 0000000000000000000000000000000000000000..f4e9de4587aac1b88f944dc1aa44506a3db63cdc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.js @@ -0,0 +1,149 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateProperties = exports.error = void 0; +const code_1 = require("../code"); +const util_1 = require("../../compile/util"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +var PropError; +(function (PropError) { + PropError["Additional"] = "additional"; + PropError["Missing"] = "missing"; +})(PropError || (PropError = {})); +exports.error = { + message: (cxt) => { + const { params } = cxt; + return params.propError + ? params.propError === PropError.Additional + ? "must NOT have additional properties" + : `must have property '${params.missingProperty}'` + : (0, error_1.typeErrorMessage)(cxt, "object"); + }, + params: (cxt) => { + const { params } = cxt; + return params.propError + ? params.propError === PropError.Additional + ? (0, codegen_1._) `{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` + : (0, codegen_1._) `{error: ${params.propError}, missingProperty: ${params.missingProperty}}` + : (0, error_1.typeErrorParams)(cxt, "object"); + }, +}; +const def = { + keyword: "properties", + schemaType: "object", + error: exports.error, + code: validateProperties, +}; +// const error: KeywordErrorDefinition = { +// message: "should NOT have additional properties", +// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +// } +function validateProperties(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, parentSchema, it } = cxt; + const { additionalProperties, nullable } = parentSchema; + if (it.jtdDiscriminator && nullable) + throw new Error("JTD: nullable inside discriminator mapping"); + if (commonProperties()) { + throw new Error("JTD: properties and optionalProperties have common members"); + } + const [allProps, properties] = schemaProperties("properties"); + const [allOptProps, optProperties] = schemaProperties("optionalProperties"); + if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { + return; + } + const [valid, cond] = it.jtdDiscriminator === undefined + ? (0, nullable_1.checkNullableObject)(cxt, data) + : [gen.let("valid", false), true]; + gen.if(cond, () => gen.assign(valid, true).block(() => { + validateProps(properties, "properties", true); + validateProps(optProperties, "optionalProperties"); + if (!additionalProperties) + validateAdditional(); + })); + cxt.pass(valid); + function commonProperties() { + const props = parentSchema.properties; + const optProps = parentSchema.optionalProperties; + if (!(props && optProps)) + return false; + for (const p in props) { + if (Object.prototype.hasOwnProperty.call(optProps, p)) + return true; + } + return false; + } + function schemaProperties(keyword) { + const schema = parentSchema[keyword]; + const allPs = schema ? (0, code_1.allSchemaProperties)(schema) : []; + if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { + throw new Error(`JTD: discriminator tag used in ${keyword}`); + } + const ps = allPs.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); + return [allPs, ps]; + } + function validateProps(props, keyword, required) { + const _valid = gen.var("valid"); + for (const prop of props) { + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => applyPropertySchema(prop, keyword, _valid), () => missingProperty(prop)); + cxt.ok(_valid); + } + function missingProperty(prop) { + if (required) { + gen.assign(_valid, false); + cxt.error(false, { propError: PropError.Missing, missingProperty: prop }, { schemaPath: prop }); + } + else { + gen.assign(_valid, true); + } + } + } + function applyPropertySchema(prop, keyword, _valid) { + cxt.subschema({ + keyword, + schemaProp: prop, + dataProp: prop, + }, _valid); + } + function validateAdditional() { + gen.forIn("key", data, (key) => { + const addProp = isAdditional(key, allProps, "properties", it.jtdDiscriminator); + const addOptProp = isAdditional(key, allOptProps, "optionalProperties"); + const extra = addProp === true ? addOptProp : addOptProp === true ? addProp : (0, codegen_1.and)(addProp, addOptProp); + gen.if(extra, () => { + if (it.opts.removeAdditional) { + gen.code((0, codegen_1._) `delete ${data}[${key}]`); + } + else { + cxt.error(false, { propError: PropError.Additional, additionalProperty: key }, { instancePath: key, parentSchema: true }); + if (!it.opts.allErrors) + gen.break(); + } + }); + }); + } + function isAdditional(key, props, keyword, jtdDiscriminator) { + let additional; + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema[keyword], keyword); + additional = (0, codegen_1.not)((0, code_1.isOwnProperty)(gen, propsSchema, key)); + if (jtdDiscriminator !== undefined) { + additional = (0, codegen_1.and)(additional, (0, codegen_1._) `${key} !== ${jtdDiscriminator}`); + } + } + else if (props.length || jtdDiscriminator !== undefined) { + const ps = jtdDiscriminator === undefined ? props : [jtdDiscriminator].concat(props); + additional = (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`)); + } + else { + additional = true; + } + return additional; + } +} +exports.validateProperties = validateProperties; +exports.default = def; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.js.map new file mode 100644 index 0000000000000000000000000000000000000000..184111e0620130a1b3f88b3cde61de0191458751 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/properties.ts"],"names":[],"mappings":";;;AAOA,kCAA0E;AAC1E,6CAAoE;AACpE,mDAA6D;AAC7D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AAExE,IAAK,SAGJ;AAHD,WAAK,SAAS;IACZ,sCAAyB,CAAA;IACzB,gCAAmB,CAAA;AACrB,CAAC,EAHI,SAAS,KAAT,SAAS,QAGb;AAWY,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAC,GAAG,GAAG,CAAA;QACpB,OAAO,MAAM,CAAC,SAAS;YACrB,CAAC,CAAC,MAAM,CAAC,SA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AC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;QACxD,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,IAAI,CAAA;QACnB,CAAC;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;AACH,CAAC;AA1HD,gDA0HC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ccdf84c0beb84a087713405c455259826f4e18f2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, AnySchemaObject } from "../../types"; +declare const def: CodeKeywordDefinition; +export declare function hasRef(schema: AnySchemaObject): boolean; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.js new file mode 100644 index 0000000000000000000000000000000000000000..b7c6b02d758f7ce25c907c33b98f83960202b0b1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hasRef = void 0; +const compile_1 = require("../../compile"); +const codegen_1 = require("../../compile/codegen"); +const ref_error_1 = require("../../compile/ref_error"); +const names_1 = require("../../compile/names"); +const ref_1 = require("../core/ref"); +const metadata_1 = require("./metadata"); +const def = { + keyword: "ref", + schemaType: "string", + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema: ref, parentSchema, it } = cxt; + const { schemaEnv: { root }, } = it; + const valid = gen.name("valid"); + if (parentSchema.nullable) { + gen.var(valid, (0, codegen_1._) `${data} === null`); + gen.if((0, codegen_1.not)(valid), validateJtdRef); + } + else { + gen.var(valid, false); + validateJtdRef(); + } + cxt.ok(valid); + function validateJtdRef() { + var _a; + const refSchema = (_a = root.schema.definitions) === null || _a === void 0 ? void 0 : _a[ref]; + if (!refSchema) { + throw new ref_error_1.default(it.opts.uriResolver, "", ref, `No definition ${ref}`); + } + if (hasRef(refSchema) || !it.opts.inlineRefs) + callValidate(refSchema); + else + inlineRefSchema(refSchema); + } + function callValidate(schema) { + const sch = compile_1.compileSchema.call(it.self, new compile_1.SchemaEnv({ schema, root, schemaPath: `/definitions/${ref}` })); + const v = (0, ref_1.getValidate)(cxt, sch); + const errsCount = gen.const("_errs", names_1.default.errors); + (0, ref_1.callRef)(cxt, v, sch, sch.$async); + gen.assign(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + } + function inlineRefSchema(schema) { + const schName = gen.scopeValue("schema", it.opts.code.source === true ? { ref: schema, code: (0, codegen_1.stringify)(schema) } : { ref: schema }); + cxt.subschema({ + schema, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: `/definitions/${ref}`, + }, valid); + } + }, +}; +function hasRef(schema) { + for (const key in schema) { + let sch; + if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) + return true; + } + return false; +} +exports.hasRef = hasRef; +exports.default = def; +//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c15dbf94b234346ea9d9c8639e9e2efa75cde852 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/ref.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/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B;IAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,GAAoB,CAAA;QACxB,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAND,wBAMC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a115c7dade22ea1b99005f77bce7ec7f7789becf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.d.ts @@ -0,0 +1,10 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { _JTDTypeError } from "./error"; +export type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType>; +export type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; +export declare const intRange: { + [T in IntType]: [number, number, number]; +}; +export type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.js new file mode 100644 index 0000000000000000000000000000000000000000..17a0b510792f9429beb3a2bca7d9c77835e1baa1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.intRange = void 0; +const codegen_1 = require("../../compile/codegen"); +const timestamp_1 = require("../../runtime/timestamp"); +const util_1 = require("../../compile/util"); +const metadata_1 = require("./metadata"); +const error_1 = require("./error"); +exports.intRange = { + int8: [-128, 127, 3], + uint8: [0, 255, 3], + int16: [-32768, 32767, 5], + uint16: [0, 65535, 5], + int32: [-2147483648, 2147483647, 10], + uint32: [0, 4294967295, 10], +}; +const error = { + message: (cxt) => (0, error_1.typeErrorMessage)(cxt, cxt.schema), + params: (cxt) => (0, error_1.typeErrorParams)(cxt, cxt.schema), +}; +function timestampCode(cxt) { + const { gen, data, it } = cxt; + const { timestamp, allowDate } = it.opts; + if (timestamp === "date") + return (0, codegen_1._) `${data} instanceof Date `; + const vts = (0, util_1.useFunc)(gen, timestamp_1.default); + const allowDateArg = allowDate ? (0, codegen_1._) `, true` : codegen_1.nil; + const validString = (0, codegen_1._) `typeof ${data} == "string" && ${vts}(${data}${allowDateArg})`; + return timestamp === "string" ? validString : (0, codegen_1.or)((0, codegen_1._) `${data} instanceof Date`, validString); +} +const def = { + keyword: "type", + schemaType: "string", + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { data, schema, parentSchema, it } = cxt; + let cond; + switch (schema) { + case "boolean": + case "string": + cond = (0, codegen_1._) `typeof ${data} == ${schema}`; + break; + case "timestamp": { + cond = timestampCode(cxt); + break; + } + case "float32": + case "float64": + cond = (0, codegen_1._) `typeof ${data} == "number"`; + break; + default: { + const sch = schema; + cond = (0, codegen_1._) `typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)`; + if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { + if (sch === "uint32") + cond = (0, codegen_1._) `${cond} && ${data} >= 0`; + } + else { + const [min, max] = exports.intRange[sch]; + cond = (0, codegen_1._) `${cond} && ${data} >= ${min} && ${data} <= ${max}`; + } + } + } + cxt.pass(parentSchema.nullable ? (0, codegen_1.or)((0, codegen_1._) `${data} === null`, cond) : cond); + }, +}; +exports.default = def; +//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cf538ed032c9dc3d9730535edd43ceab80e83581 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/type.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AACtD,uDAAoD;AACpD,6CAA0C;AAC1C,yCAAwC;AACxC,mCAAwE;AAM3D,QAAA,QAAQ,GAA+C;IAClE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC;CAC5B,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAClD,CAAA;AAED,SAAS,aAAa,CAAC,GAAe;IACpC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,MAAM,EAAC,SAAS,EAAE,SAAS,EAAC,GAAG,EAAE,CAAC,IAAI,CAAA;IACtC,I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A;gBAC7B,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,4BAA4B,IAAI,UAAU,IAAI,OAAO,CAAA;gBAC3E,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;oBACjE,IAAI,GAAG,KAAK,QAAQ;wBAAE,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,CAAA;gBACzD,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAQ,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,GAAG,OAAO,IAAI,OAAO,GAAG,EAAE,CAAA;gBAC7D,CAAC;YACH,CAAC;QACH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.js new file mode 100644 index 0000000000000000000000000000000000000000..01a943994a350d85a6b57c160d5c90e7b76f29d3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const def = { + keyword: "union", + schemaType: "array", + trackErrors: true, + code: code_1.validateUnion, + error: { message: "must match a schema in union" }, +}; +exports.default = def; +//# sourceMappingURL=union.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4d6eb4119ba3dcd312f86c73e7ed247c9ca1a366 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/union.js.map @@ -0,0 +1 @@ +{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/union.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1eaa884a53dcf5c52d2d2892874f599407757c02 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, SchemaObject } from "../../types"; +import { _JTDTypeError } from "./error"; +export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.js new file mode 100644 index 0000000000000000000000000000000000000000..3c2c95f55d9aff34de651ccd2669167feb91b729 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const def = { + keyword: "values", + schemaType: "object", + error: (0, error_1.typeError)("object"), + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, it } = cxt; + const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); + if ((0, util_1.alwaysValidSchema)(it, schema)) { + gen.if((0, codegen_1.not)((0, codegen_1.or)(cond, valid)), () => cxt.error()); + } + else { + gen.if(cond); + gen.assign(valid, validateMap()); + gen.elseIf((0, codegen_1.not)(valid)); + cxt.error(); + gen.endIf(); + } + cxt.ok(valid); + function validateMap() { + const _valid = gen.name("valid"); + if (it.allErrors) { + const validMap = gen.let("valid", true); + validateValues(() => gen.assign(validMap, false)); + return validMap; + } + gen.var(_valid, true); + validateValues(() => gen.break()); + return _valid; + function validateValues(notValid) { + gen.forIn("key", data, (key) => { + cxt.subschema({ + keyword: "values", + dataProp: key, + dataPropType: util_1.Type.Str, + }, _valid); + gen.if((0, codegen_1.not)(_valid), notValid); + }); + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=values.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8a1a5c2339e71faba2bafcaf2c50e617399a829a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/jtd/values.js.map @@ -0,0 +1 @@ +{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/values.ts"],"names":[],"mappings":";;AAEA,6CAA0D;AAC1D,mDAAmD;AACnD,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,QAAQ;IACjB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;IAC1B,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,8BAAmB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACpD,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,IAAA,YAAE,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QACjD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;YACZ,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;YAChC,GAAG,CAAC,MAAM,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;YACtB,GAAG,CAAC,KAAK,EAAE,CAAA;YACX,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,WAAW;YAClB,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;gBACjB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACvC,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;gBACjD,OAAO,QAAQ,CAAA;YACjB,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACrB,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YACjC,OAAO,MAAM,CAAA;YAEb,SAAS,cAAc,CAAC,QAAoB;gBAC1C,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC7B,GAAG,CAAC,SAAS,CACX;wBACE,OAAO,EAAE,QAAQ;wBACjB,QAAQ,EAAE,GAAG;wBACb,YAAY,EAAE,WAAI,CAAC,GAAG;qBACvB,EACD,MAAM,CACP,CAAA;oBACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAA;gBAC/B,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..df9cc07ca8115cbb62e05758c7b706a967f394ca --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +export declare const metadataVocabulary: Vocabulary; +export declare const contentVocabulary: Vocabulary; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..f07bf28b5a0e6c26a13ac290c85271f12b3357ee --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.contentVocabulary = exports.metadataVocabulary = void 0; +exports.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples", +]; +exports.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema", +]; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0d61f08318729943c3f8d9f9cbc117c885fbf9cd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../lib/vocabularies/metadata.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAe;IAC5C,OAAO;IACP,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;IACV,WAAW;IACX,UAAU;CACX,CAAA;AAEY,QAAA,iBAAiB,GAAe;IAC3C,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;CAChB,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7fd5c644b22f0304c5c334352c286a9e797b3c18 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const next: Vocabulary; +export default next; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.js new file mode 100644 index 0000000000000000000000000000000000000000..c861b32433810eefc4bceb247d7c5df99ef1c78e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependentRequired_1 = require("./validation/dependentRequired"); +const dependentSchemas_1 = require("./applicator/dependentSchemas"); +const limitContains_1 = require("./validation/limitContains"); +const next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default]; +exports.default = next; +//# sourceMappingURL=next.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.js.map new file mode 100644 index 0000000000000000000000000000000000000000..474a6d4e7af7dd01b381f02485b0fc9d7e3a1138 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/next.js.map @@ -0,0 +1 @@ +{"version":3,"file":"next.js","sourceRoot":"","sources":["../../lib/vocabularies/next.ts"],"names":[],"mappings":";;AACA,sEAA8D;AAC9D,oEAA4D;AAC5D,8DAAsD;AAEtD,MAAM,IAAI,GAAe,CAAC,2BAAiB,EAAE,0BAAgB,EAAE,uBAAa,CAAC,CAAA;AAE7E,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ec67e63ea0efc23f9e0d842c1b1eae8f58aaeb1e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const unevaluated: Vocabulary; +export default unevaluated; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.js new file mode 100644 index 0000000000000000000000000000000000000000..30e316748de25fb205cac868baef8da8e262a388 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const unevaluatedProperties_1 = require("./unevaluatedProperties"); +const unevaluatedItems_1 = require("./unevaluatedItems"); +const unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default]; +exports.default = unevaluated; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a4872ea43a1e9d70ea07db9caf8765a34dd47661 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/index.ts"],"names":[],"mappings":";;AACA,mEAA2D;AAC3D,yDAAiD;AAEjD,MAAM,WAAW,GAAe,CAAC,+BAAqB,EAAE,0BAAgB,CAAC,CAAA;AAEzE,kBAAe,WAAW,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..06f023926664cefbeaa87114f2c4dffb840cb3e3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js new file mode 100644 index 0000000000000000000000000000000000000000..0a0cd3aa4fdef840586d786a76c2af32d3524115 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + const items = it.items || 0; + if (items === true) + return; + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items }); + cxt.fail((0, codegen_1._) `${len} > ${items}`); + } + else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items}`); + gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items)); + cxt.ok(valid); + } + it.items = true; + function validateItems(valid, from) { + gen.forRange("i", from, len, (i) => { + cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedItems.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b91f86e272de9b6a7548ba2ded9814674b30260e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unevaluatedItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedItems.ts"],"names":[],"mappings":";;AAOA,mDAAuD;AACvD,6CAA0D;AAI1D,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,KAAK,GAAG,EAAE,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AAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YAC1D,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ba63f62e851e0ecdbd1fc698b36eb97ec08bef4c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export type UnevaluatedPropertiesError = ErrorObject<"unevaluatedProperties", { + unevaluatedProperty: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js new file mode 100644 index 0000000000000000000000000000000000000000..ad298499f28a97e1e79da81d6de6049aebd58e87 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const names_1 = require("../../compile/names"); +const error = { + message: "must NOT have unevaluated properties", + params: ({ params }) => (0, codegen_1._) `{unevaluatedProperty: ${params.unevaluatedProperty}}`, +}; +const def = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const { gen, schema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, props } = it; + if (props instanceof codegen_1.Name) { + gen.if((0, codegen_1._) `${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)))); + } + else if (props !== true) { + gen.forIn("key", data, (key) => props === undefined + ? unevaluatedPropCode(key) + : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key))); + } + it.props = true; + cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + function unevaluatedPropCode(key) { + if (schema === false) { + cxt.setParams({ unevaluatedProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (!(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: util_1.Type.Str, + }, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + } + function unevaluatedDynamic(evaluatedProps, key) { + return (0, codegen_1._) `!${evaluatedProps} || !${evaluatedProps}[${key}]`; + } + function unevaluatedStatic(evaluatedProps, key) { + const ps = []; + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) + ps.push((0, codegen_1._) `${key} !== ${p}`); + } + return (0, codegen_1.and)(...ps); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedProperties.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f83022ebcf2263572a9c68894c37711f2d174054 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unevaluatedProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluated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M,EAAE,GAAW,EAAE,CAAA;YACrB,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;gBAC/B,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI;oBAAE,EAAE,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;YAC7D,CAAC;YACD,OAAO,IAAA,aAAG,EAAC,GAAG,EAAE,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..af91a900705512c8264d92860e19112932bc5d43 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type ConstError = ErrorObject<"const", { + allowedValue: any; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.js new file mode 100644 index 0000000000000000000000000000000000000000..9564496a658fc6a46552d174984446d8c79fc1db --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: "must be equal to constant", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValue: ${schemaCode}}`, +}; +const def = { + keyword: "const", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schemaCode, schema } = cxt; + if ($data || (schema && typeof schema == "object")) { + cxt.fail$data((0, codegen_1._) `!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`); + } + else { + cxt.fail((0, codegen_1._) `${schema} !== ${data}`); + } + }, +}; +exports.default = def; +//# sourceMappingURL=const.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.js.map new file mode 100644 index 0000000000000000000000000000000000000000..63cfe60d62ac81e59ac76a649f76677ad017b450 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/const.js.map @@ -0,0 +1 @@ +{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/const.ts"],"names":[],"mappings":";;AAEA,mDAAuC;AACvC,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,2BAA2B;IACpC,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,kBAAkB,UAAU,GAAG;CAC3D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAClD,IAAI,KAAK,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,CAAC,EAAE,CAAC;YACnD,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,IAAI,IAAI,KAAK,UAAU,GAAG,CAAC,CAAA;QACnE,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,QAAQ,IAAI,EAAE,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..00f0d370f3e2d5d3252a9716a4faee02fa338e10 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +import { DependenciesErrorParams, PropertyDependencies } from "../applicator/dependencies"; +export type DependentRequiredError = ErrorObject<"dependentRequired", DependenciesErrorParams, PropertyDependencies>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js new file mode 100644 index 0000000000000000000000000000000000000000..09e59639fcc92c28099edb23323f7f896bd68edf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("../applicator/dependencies"); +const def = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error: dependencies_1.error, + code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentRequired.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c7e88f885dfb5983a35010966ad21d5bf108d95a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependentRequired.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/dependentRequired.ts"],"names":[],"mappings":";;AACA,6DAKmC;AAQnC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,oBAAK;IACL,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,mCAAoB,EAAC,GAAG,CAAC;CACzC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6231082feff5eaa65e83381d6a2af71fb2302244 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type EnumError = ErrorObject<"enum", { + allowedValues: any[]; +}, any[] | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.js new file mode 100644 index 0000000000000000000000000000000000000000..eab6487e991d78f9e01839b4ac5655f61af171f6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, +}; +const def = { + keyword: "enum", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + if (!$data && schema.length === 0) + throw new Error("enum must have non-empty array"); + const useLoop = schema.length >= it.opts.loopEnum; + let eql; + const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default))); + let valid; + if (useLoop || $data) { + valid = gen.let("valid"); + cxt.block$data(valid, loopEnum); + } + else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const vSchema = gen.const("vSchema", schemaCode); + valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i))); + } + cxt.pass(valid); + function loopEnum() { + gen.assign(valid, false); + gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())); + } + function equalCode(vSchema, i) { + const sch = schema[i]; + return typeof sch === "object" && sch !== null + ? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])` + : (0, codegen_1._) `${data} === ${sch}`; + } + }, +}; +exports.default = def; +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.js.map new file mode 100644 index 0000000000000000000000000000000000000000..33afdcf0d8da86650b0d029520ce934dafb4ea8d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/enum.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/enum.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE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E,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9E,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YACxB,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,UAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,CACvC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,EAAE,IAAI,IAAI,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAC7E,CAAA;QACH,CAAC;QAED,SAAS,SAAS,CAAC,OAAa,EAAE,CAAS;YACzC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YACrB,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;gBAC5C,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,EAAE,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI;gBAC3C,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,GAAG,EAAE,CAAA;QAC3B,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a078be554b5e131375e582df49cc7cac4bc7bcbc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.d.ts @@ -0,0 +1,16 @@ +import type { ErrorObject, Vocabulary } from "../../types"; +import { LimitNumberError } from "./limitNumber"; +import { MultipleOfError } from "./multipleOf"; +import { PatternError } from "./pattern"; +import { RequiredError } from "./required"; +import { UniqueItemsError } from "./uniqueItems"; +import { ConstError } from "./const"; +import { EnumError } from "./enum"; +declare const validation: Vocabulary; +export default validation; +type LimitError = ErrorObject<"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", { + limit: number; +}, number | { + $data: string; +}>; +export type ValidationKeywordError = LimitError | LimitNumberError | MultipleOfError | PatternError | RequiredError | UniqueItemsError | ConstError | EnumError; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7b56b4e45359da1f1d087455b2c7133cf048815b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const limitNumber_1 = require("./limitNumber"); +const multipleOf_1 = require("./multipleOf"); +const limitLength_1 = require("./limitLength"); +const pattern_1 = require("./pattern"); +const limitProperties_1 = require("./limitProperties"); +const required_1 = require("./required"); +const limitItems_1 = require("./limitItems"); +const uniqueItems_1 = require("./uniqueItems"); +const const_1 = require("./const"); +const enum_1 = require("./enum"); +const validation = [ + // number + limitNumber_1.default, + multipleOf_1.default, + // string + limitLength_1.default, + pattern_1.default, + // object + limitProperties_1.default, + required_1.default, + // array + limitItems_1.default, + uniqueItems_1.default, + // any + { keyword: "type", schemaType: ["string", "array"] }, + { keyword: "nullable", schemaType: "boolean" }, + const_1.default, + enum_1.default, +]; +exports.default = validation; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..69436fb327cd0b14e1389d6e55f5cfb8c5a3a9f7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/index.ts"],"names":[],"mappings":";;AACA,+CAA2D;AAC3D,6CAAwD;AACxD,+CAAuC;AACvC,uCAA+C;AAC/C,uDAA+C;AAC/C,yCAAkD;AAClD,6CAAqC;AACrC,+CAA2D;AAC3D,mCAAgD;AAChD,iCAA6C;AAE7C,MAAM,UAAU,GAAe;IAC7B,SAAS;IACT,qBAAW;IACX,oBAAU;IACV,SAAS;IACT,qBAAW;IACX,iBAAO;IACP,SAAS;IACT,yBAAe;IACf,kBAAQ;IACR,QAAQ;IACR,oBAAU;IACV,qBAAW;IACX,MAAM;IACN,EAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAC;IAClD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;IAC5C,eAAY;IACZ,cAAW;CACZ,CAAA;AAED,kBAAe,UAAU,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.js new file mode 100644 index 0000000000000000000000000000000000000000..c884dae4bb298f47dad51eb74872fe0f7dd01c96 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({ keyword, parentSchema, it }) { + if (parentSchema.contains === undefined) { + (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`); + } + }, +}; +exports.default = def; +//# sourceMappingURL=limitContains.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map new file mode 100644 index 0000000000000000000000000000000000000000..084ee2cd264b9031bf57d188ddd34861bfbbd1e9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitContains.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitContains.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACxC,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,iCAAiC,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.js new file mode 100644 index 0000000000000000000000000000000000000000..e1386f887cc8a9030999fd4856e92a2962977b58 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxItems" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} items`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._) `${data}.length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitItems.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map new file mode 100644 index 0000000000000000000000000000000000000000..690c734567ec8f222703a6966b991f88700b07a5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitItems.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACtD,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,QAAQ,CAAA;IAC5D,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;IACjC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QAC/D,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACtD,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.js new file mode 100644 index 0000000000000000000000000000000000000000..6ae5f92e67f1a3ee61aec3274ad5b8ed2f6805f2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const ucs2length_1 = require("../../runtime/ucs2length"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxLength" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} characters`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode, it } = cxt; + const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; + const len = it.opts.unicode === false ? (0, codegen_1._) `${data}.length` : (0, codegen_1._) `${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`; + cxt.fail$data((0, codegen_1._) `${len} ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitLength.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f09c35e54373ead627ecb7d12672420e2e4621ba --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitLength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CAAA;IAC9C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b35096dff46baff73b068c46e65137e74693a8a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts @@ -0,0 +1,11 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum"; +type Comparison = "<=" | ">=" | "<" | ">"; +export type LimitNumberError = ErrorObject; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..a97c0eb9db77364f65e61d65cbb3e1a17894b594 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const ops = codegen_1.operators; +const KWDs = { + maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, +}; +const error = { + message: ({ keyword, schemaCode }) => (0, codegen_1.str) `must be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, +}; +const def = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + cxt.fail$data((0, codegen_1._) `${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitNumber.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map new file mode 100644 index 0000000000000000000000000000000000000000..18a3653375f90d1a7c2a99084af4f9a4253dfebb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitNumber.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitNumber.ts"],"names":[],"mappings":";;AAEA,mDAA6D;AAE7D,MAAM,GAAG,GAAG,mBAAS,CAAA;AAMrB,MAAM,IAAI,GAA4D;IACpE,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACjD,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACjD,gBAAgB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;IACzD,gBAAgB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;CAC1D,CAAA;AAQD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,WAAW,IAAI,CAAC,OAAc,CAAC,CAAC,KAAK,IAAI,UAAU,EAAE;IAC5F,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAChC,IAAA,WAAC,EAAA,gBAAgB,IAAI,CAAC,OAAc,CAAC,CAAC,KAAK,YAAY,UAAU,GAAG;CACvE,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,IAAI,CAAC,OAAc,CAAC,CAAC,IAAI,IAAI,UAAU,aAAa,IAAI,GAAG,CAAC,CAAA;IACxF,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cde2aa27001c404f3616dfc1c65b90dd00ce57ff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.js new file mode 100644 index 0000000000000000000000000000000000000000..e6fc40cc671989d969022da4f0ce3f37609c4e88 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxProperties" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._) `Object.keys(${data}).length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitProperties.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a695943a977793e3d4cb8576e571e5564004a62e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitProperties.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC3D,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QACpE,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,eAAe,IAAI,YAAY,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67685dcd36bbe21425b43fb5c14dd88e7ecdde3c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type MultipleOfError = ErrorObject<"multipleOf", { + multipleOf: number; +}, number | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.js new file mode 100644 index 0000000000000000000000000000000000000000..43cf67b77bf109a60603d57e3e0bbffc816b23b5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must be multiple of ${schemaCode}`, + params: ({ schemaCode }) => (0, codegen_1._) `{multipleOf: ${schemaCode}}`, +}; +const def = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, it } = cxt; + // const bdt = bad$DataType(schemaCode, def.schemaType, $data) + const prec = it.opts.multipleOfPrecision; + const res = gen.let("res"); + const invalid = prec + ? (0, codegen_1._) `Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : (0, codegen_1._) `${res} !== parseInt(${res})`; + cxt.fail$data((0, codegen_1._) `(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`); + }, +}; +exports.default = def; +//# sourceMappingURL=multipleOf.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9ef825b747fd3e15ede93712c1f16b5a47a1be05 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multipleOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/multipleOf.ts"],"names":[],"mappings":";;AAEA,mDAA4C;AAQ5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,EAAE;IACjE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,gBAAgB,UAAU,GAAG;CACzD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACvC,sEAAsE;QACtE,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAA;QACxC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC1B,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAA,WAAC,EAAA,uBAAuB,GAAG,OAAO,GAAG,UAAU,IAAI,EAAE;YACvD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,iBAAiB,GAAG,GAAG,CAAA;QAClC,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,UAAU,cAAc,GAAG,MAAM,IAAI,IAAI,UAAU,KAAK,OAAO,IAAI,CAAC,CAAA;IACzF,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7edbfda9304717b860dc2fae5311c309a67ae0de --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type PatternError = ErrorObject<"pattern", { + pattern: string; +}, string | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.js new file mode 100644 index 0000000000000000000000000000000000000000..f8ccdf295021293823614c88977e2e5708e8f601 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must match pattern "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._) `{pattern: ${schemaCode}}`, +}; +const def = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const { data, $data, schema, schemaCode, it } = cxt; + // TODO regexp should be wrapped in try/catchs + const u = it.opts.unicodeRegExp ? "u" : ""; + const regExp = $data ? (0, codegen_1._) `(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema); + cxt.fail$data((0, codegen_1._) `!${regExp}.test(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=pattern.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.js.map new file mode 100644 index 0000000000000000000000000000000000000000..82fa5d74c19f037de28e28e5b3471ee99d91f6d8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/pattern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/pattern.ts"],"names":[],"mappings":";;AAEA,kCAAkC;AAClC,mDAA4C;AAI5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,GAAG;IAClE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,aAAa,UAAU,GAAG;CACtD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,8CAA8C;QAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,eAAe,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACrF,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,MAAM,SAAS,IAAI,GAAG,CAAC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c9cffda1ee34b406cc23e1e7c374d0947ce52cf7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type RequiredError = ErrorObject<"required", { + missingProperty: string; +}, string[] | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.js new file mode 100644 index 0000000000000000000000000000000000000000..1d8e29263f3b5cd1fe7ce1c58a2007f86c82da1a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { missingProperty } }) => (0, codegen_1.str) `must have required property '${missingProperty}'`, + params: ({ params: { missingProperty } }) => (0, codegen_1._) `{missingProperty: ${missingProperty}}`, +}; +const def = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, schema, schemaCode, data, $data, it } = cxt; + const { opts } = it; + if (!$data && schema.length === 0) + return; + const useLoop = schema.length >= opts.loopRequired; + if (it.allErrors) + allErrorsMode(); + else + exitOnErrorMode(); + if (opts.strictRequired) { + const props = cxt.parentSchema.properties; + const { definedProperties } = cxt.it; + for (const requiredKey of schema) { + if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === undefined && !definedProperties.has(requiredKey)) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired); + } + } + } + function allErrorsMode() { + if (useLoop || $data) { + cxt.block$data(codegen_1.nil, loopAllRequired); + } + else { + for (const prop of schema) { + (0, code_1.checkReportMissingProp)(cxt, prop); + } + } + } + function exitOnErrorMode() { + const missing = gen.let("missing"); + if (useLoop || $data) { + const valid = gen.let("valid", true); + cxt.block$data(valid, () => loopUntilMissing(missing, valid)); + cxt.ok(valid); + } + else { + gen.if((0, code_1.checkMissingProp)(cxt, schema, missing)); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } + function loopAllRequired() { + gen.forOf("prop", schemaCode, (prop) => { + cxt.setParams({ missingProperty: prop }); + gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error()); + }); + } + function loopUntilMissing(missing, valid) { + cxt.setParams({ missingProperty: missing }); + gen.forOf(missing, schemaCode, () => { + gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties)); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(); + gen.break(); + }); + }, codegen_1.nil); + } + }, +}; +exports.default = def; +//# sourceMappingURL=required.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9ec186fa1db430cb146a3b7588d74453d259e238 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/required.js.map @@ -0,0 +1 @@ +{"version":3,"file":"required.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/required.ts"],"names":[],"mappings":";;AAEA,kCAMgB;AAChB,mDAAkE;AAClE,6CAAkD;AAQlD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,gCAAgC,eAAe,GAAG;IAC/F,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,qBAAqB,eAAe,GAAG;CAClF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA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AAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;gBACzE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;oBACtB,GAAG,CAAC,KAAK,EAAE,CAAA;oBACX,GAAG,CAAC,KAAK,EAAE,CAAA;gBACb,CAAC,CAAC,CAAA;YACJ,CAAC,EACD,aAAG,CACJ,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7c241b984a6b32f02aab471e5e7e378c61891b7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts @@ -0,0 +1,9 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export type UniqueItemsError = ErrorObject<"uniqueItems", { + i: number; + j: number; +}, boolean | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js new file mode 100644 index 0000000000000000000000000000000000000000..cdbecea1225ee860e40f428cc54d089cb7295a91 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dataType_1 = require("../../compile/validate/dataType"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: ({ params: { i, j } }) => (0, codegen_1.str) `must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({ params: { i, j } }) => (0, codegen_1._) `{i: ${i}, j: ${j}}`, +}; +const def = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; + if (!$data && !schema) + return; + const valid = gen.let("valid"); + const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : []; + cxt.block$data(valid, validateUniqueItems, (0, codegen_1._) `${schemaCode} === false`); + cxt.ok(valid); + function validateUniqueItems() { + const i = gen.let("i", (0, codegen_1._) `${data}.length`); + const j = gen.let("j"); + cxt.setParams({ i, j }); + gen.assign(valid, true); + gen.if((0, codegen_1._) `${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)); + } + function canOptimize() { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array"); + } + function loopN(i, j) { + const item = gen.name("item"); + const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong); + const indices = gen.const("indices", (0, codegen_1._) `{}`); + gen.for((0, codegen_1._) `;${i}--;`, () => { + gen.let(item, (0, codegen_1._) `${data}[${i}]`); + gen.if(wrongType, (0, codegen_1._) `continue`); + if (itemTypes.length > 1) + gen.if((0, codegen_1._) `typeof ${item} == "string"`, (0, codegen_1._) `${item} += "_"`); + gen + .if((0, codegen_1._) `typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, (0, codegen_1._) `${indices}[${item}]`); + cxt.error(); + gen.assign(valid, false).break(); + }) + .code((0, codegen_1._) `${indices}[${item}] = ${i}`); + }); + } + function loopN2(i, j) { + const eql = (0, util_1.useFunc)(gen, equal_1.default); + const outer = gen.name("outer"); + gen.label(outer).for((0, codegen_1._) `;${i}--;`, () => gen.for((0, codegen_1._) `${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._) `${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error(); + gen.assign(valid, false).break(outer); + }))); + } + }, +}; +exports.default = def; +//# sourceMappingURL=uniqueItems.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map new file mode 100644 index 0000000000000000000000000000000000000000..46eb7a2a06e8b158d03ab636f549dc0627331c6a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uniqueItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/uniqueItems.ts"],"names":[],"mappings":";;AAEA,8DAAwF;AACxF,mDAAkD;AAClD,6CAA0C;AAC1C,+CAAuC;AAQvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAE,CAAC,EAAC,EAAC,EAAE,EAAE,CAC5B,IAAA,aAAG,EAAA,2CAA2C,CAAC,QAAQ,CAAC,iBAAiB;IAC3E,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAE,CAAC,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,OAAO,CAAC,QAAQ,CAAC,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACpE,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;YAAE,OAAM;QAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC9B,MAAM,SAAS,GA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AAC,CAAC,GAAG,CAAC,IAAA,WAAC,EAAA,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CACrC,GAAG,CAAC,GAAG,CAAC,IAAA,WAAC,EAAA,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CACpC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;gBACnD,GAAG,CAAC,KAAK,EAAE,CAAA;gBACX,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACvC,CAAC,CAAC,CACH,CACF,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/2019.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/2019.ts new file mode 100644 index 0000000000000000000000000000000000000000..3f7194f1bce5f23075cb95ba7e0191a716768e4f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/2019.ts @@ -0,0 +1,81 @@ +import type {AnySchemaObject} from "./types" +import AjvCore, {Options} from "./core" + +import draft7Vocabularies from "./vocabularies/draft7" +import dynamicVocabulary from "./vocabularies/dynamic" +import nextVocabulary from "./vocabularies/next" +import unevaluatedVocabulary from "./vocabularies/unevaluated" +import discriminator from "./vocabularies/discriminator" +import addMetaSchema2019 from "./refs/json-schema-2019-09" + +const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema" + +export class Ajv2019 extends AjvCore { + constructor(opts: Options = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + this.addVocabulary(dynamicVocabulary) + draft7Vocabularies.forEach((v) => this.addVocabulary(v)) + this.addVocabulary(nextVocabulary) + this.addVocabulary(unevaluatedVocabulary) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + const {$data, meta} = this.opts + if (!meta) return + addMetaSchema2019.call(this, $data) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv2019 +module.exports.Ajv2019 = Ajv2019 +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv2019 + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" +export {default as ValidationError} from "./runtime/validation_error" +export {default as MissingRefError} from "./compile/ref_error" diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/2020.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/2020.ts new file mode 100644 index 0000000000000000000000000000000000000000..cfb36af9d7822ec5d2a1783806d85d16e018b6b8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/2020.ts @@ -0,0 +1,75 @@ +import type {AnySchemaObject} from "./types" +import AjvCore, {Options} from "./core" + +import draft2020Vocabularies from "./vocabularies/draft2020" +import discriminator from "./vocabularies/discriminator" +import addMetaSchema2020 from "./refs/json-schema-2020-12" + +const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema" + +export class Ajv2020 extends AjvCore { + constructor(opts: Options = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + draft2020Vocabularies.forEach((v) => this.addVocabulary(v)) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + const {$data, meta} = this.opts + if (!meta) return + addMetaSchema2020.call(this, $data) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv2020 +module.exports.Ajv2020 = Ajv2020 +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv2020 + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" +export {default as ValidationError} from "./runtime/validation_error" +export {default as MissingRefError} from "./compile/ref_error" diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/ajv.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/ajv.ts new file mode 100644 index 0000000000000000000000000000000000000000..8275b93a8ecea2cd36ebaaa5bc0255548de67428 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/ajv.ts @@ -0,0 +1,70 @@ +import type {AnySchemaObject} from "./types" +import AjvCore from "./core" +import draft7Vocabularies from "./vocabularies/draft7" +import discriminator from "./vocabularies/discriminator" +import * as draft7MetaSchema from "./refs/json-schema-draft-07.json" + +const META_SUPPORT_DATA = ["/properties"] + +const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema" + +export class Ajv extends AjvCore { + _addVocabularies(): void { + super._addVocabularies() + draft7Vocabularies.forEach((v) => this.addVocabulary(v)) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + if (!this.opts.meta) return + const metaSchema = this.opts.$data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv +module.exports.Ajv = Ajv +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + SchemaValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" +export {default as ValidationError} from "./runtime/validation_error" +export {default as MissingRefError} from "./compile/ref_error" diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/code.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/code.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d4de6149f9451273ae7e3ca547cb69baed7877c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/code.ts @@ -0,0 +1,169 @@ +// eslint-disable-next-line @typescript-eslint/no-extraneous-class +export abstract class _CodeOrName { + abstract readonly str: string + abstract readonly names: UsedNames + abstract toString(): string + abstract emptyStr(): boolean +} + +export const IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i + +export class Name extends _CodeOrName { + readonly str: string + constructor(s: string) { + super() + if (!IDENTIFIER.test(s)) throw new Error("CodeGen: name must be a valid identifier") + this.str = s + } + + toString(): string { + return this.str + } + + emptyStr(): boolean { + return false + } + + get names(): UsedNames { + return {[this.str]: 1} + } +} + +export class _Code extends _CodeOrName { + readonly _items: readonly CodeItem[] + private _str?: string + private _names?: UsedNames + + constructor(code: string | readonly CodeItem[]) { + super() + this._items = typeof code === "string" ? [code] : code + } + + toString(): string { + return this.str + } + + emptyStr(): boolean { + if (this._items.length > 1) return false + const item = this._items[0] + return item === "" || item === '""' + } + + get str(): string { + return (this._str ??= this._items.reduce((s: string, c: CodeItem) => `${s}${c}`, "")) + } + + get names(): UsedNames { + return (this._names ??= this._items.reduce((names: UsedNames, c) => { + if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1 + return names + }, {})) + } +} + +export type CodeItem = Name | string | number | boolean | null + +export type UsedNames = Record + +export type Code = _Code | Name + +export type SafeExpr = Code | number | boolean | null + +export const nil = new _Code("") + +type CodeArg = SafeExpr | string | undefined + +export function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code { + const code: CodeItem[] = [strs[0]] + let i = 0 + while (i < args.length) { + addCodeArg(code, args[i]) + code.push(strs[++i]) + } + return new _Code(code) +} + +const plus = new _Code("+") + +export function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code { + const expr: CodeItem[] = [safeStringify(strs[0])] + let i = 0 + while (i < args.length) { + expr.push(plus) + addCodeArg(expr, args[i]) + expr.push(plus, safeStringify(strs[++i])) + } + optimize(expr) + return new _Code(expr) +} + +export function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void { + if (arg instanceof _Code) code.push(...arg._items) + else if (arg instanceof Name) code.push(arg) + else code.push(interpolate(arg)) +} + +function optimize(expr: CodeItem[]): void { + let i = 1 + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]) + if (res !== undefined) { + expr.splice(i - 1, 3, res) + continue + } + expr[i++] = "+" + } + i++ + } +} + +function mergeExprItems(a: CodeItem, b: CodeItem): CodeItem | undefined { + if (b === '""') return a + if (a === '""') return b + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') return + if (typeof b != "string") return `${a.slice(0, -1)}${b}"` + if (b[0] === '"') return a.slice(0, -1) + b.slice(1) + return + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}` + return +} + +export function strConcat(c1: Code, c2: Code): Code { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}` +} + +// TODO do not allow arrays here +function interpolate(x?: string | string[] | number | boolean | null): SafeExpr | string { + return typeof x == "number" || typeof x == "boolean" || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(",") : x) +} + +export function stringify(x: unknown): Code { + return new _Code(safeStringify(x)) +} + +export function safeStringify(x: unknown): string { + return JSON.stringify(x) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029") +} + +export function getProperty(key: Code | string | number): Code { + return typeof key == "string" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]` +} + +//Does best effort to format the name properly +export function getEsmExportName(key: Code | string | number): Code { + if (typeof key == "string" && IDENTIFIER.test(key)) { + return new _Code(`${key}`) + } + throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`) +} + +export function regexpCode(rx: RegExp): Code { + return new _Code(rx.toString()) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a6d1ee58c106245ba8a1b56f929fe3a23f337b8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/index.ts @@ -0,0 +1,852 @@ +import type {ScopeValueSets, NameValue, ValueScope, ValueScopeName} from "./scope" +import {_, nil, _Code, Code, Name, UsedNames, CodeItem, addCodeArg, _CodeOrName} from "./code" +import {Scope, varKinds} from "./scope" + +export {_, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code} from "./code" +export {Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds} from "./scope" + +// type for expressions that can be safely inserted in code without quotes +export type SafeExpr = Code | number | boolean | null + +// type that is either Code of function that adds code to CodeGen instance using its methods +export type Block = Code | (() => void) + +export const operators = { + GT: new _Code(">"), + GTE: new _Code(">="), + LT: new _Code("<"), + LTE: new _Code("<="), + EQ: new _Code("==="), + NEQ: new _Code("!=="), + NOT: new _Code("!"), + OR: new _Code("||"), + AND: new _Code("&&"), + ADD: new _Code("+"), +} + +abstract class Node { + abstract readonly names: UsedNames + + optimizeNodes(): this | ChildNode | ChildNode[] | undefined { + return this + } + + optimizeNames(_names: UsedNames, _constants: Constants): this | undefined { + return this + } + + // get count(): number { + // return 1 + // } +} + +class Def extends Node { + constructor( + private readonly varKind: Name, + private readonly name: Name, + private rhs?: SafeExpr + ) { + super() + } + + render({es5, _n}: CGOptions): string { + const varKind = es5 ? varKinds.var : this.varKind + const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}` + return `${varKind} ${this.name}${rhs};` + _n + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!names[this.name.str]) return + if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants) + return this + } + + get names(): UsedNames { + return this.rhs instanceof _CodeOrName ? this.rhs.names : {} + } +} + +class Assign extends Node { + constructor( + readonly lhs: Code, + public rhs: SafeExpr, + private readonly sideEffects?: boolean + ) { + super() + } + + render({_n}: CGOptions): string { + return `${this.lhs} = ${this.rhs};` + _n + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (this.lhs instanceof Name && !names[this.lhs.str] && !this.sideEffects) return + this.rhs = optimizeExpr(this.rhs, names, constants) + return this + } + + get names(): UsedNames { + const names = this.lhs instanceof Name ? {} : {...this.lhs.names} + return addExprNames(names, this.rhs) + } +} + +class AssignOp extends Assign { + constructor( + lhs: Code, + private readonly op: Code, + rhs: SafeExpr, + sideEffects?: boolean + ) { + super(lhs, rhs, sideEffects) + } + + render({_n}: CGOptions): string { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n + } +} + +class Label extends Node { + readonly names: UsedNames = {} + constructor(readonly label: Name) { + super() + } + + render({_n}: CGOptions): string { + return `${this.label}:` + _n + } +} + +class Break extends Node { + readonly names: UsedNames = {} + constructor(readonly label?: Code) { + super() + } + + render({_n}: CGOptions): string { + const label = this.label ? ` ${this.label}` : "" + return `break${label};` + _n + } +} + +class Throw extends Node { + constructor(readonly error: Code) { + super() + } + + render({_n}: CGOptions): string { + return `throw ${this.error};` + _n + } + + get names(): UsedNames { + return this.error.names + } +} + +class AnyCode extends Node { + constructor(private code: SafeExpr) { + super() + } + + render({_n}: CGOptions): string { + return `${this.code};` + _n + } + + optimizeNodes(): this | undefined { + return `${this.code}` ? this : undefined + } + + optimizeNames(names: UsedNames, constants: Constants): this { + this.code = optimizeExpr(this.code, names, constants) + return this + } + + get names(): UsedNames { + return this.code instanceof _CodeOrName ? this.code.names : {} + } +} + +abstract class ParentNode extends Node { + constructor(readonly nodes: ChildNode[] = []) { + super() + } + + render(opts: CGOptions): string { + return this.nodes.reduce((code, n) => code + n.render(opts), "") + } + + optimizeNodes(): this | ChildNode | ChildNode[] | undefined { + const {nodes} = this + let i = nodes.length + while (i--) { + const n = nodes[i].optimizeNodes() + if (Array.isArray(n)) nodes.splice(i, 1, ...n) + else if (n) nodes[i] = n + else nodes.splice(i, 1) + } + return nodes.length > 0 ? this : undefined + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + const {nodes} = this + let i = nodes.length + while (i--) { + // iterating backwards improves 1-pass optimization + const n = nodes[i] + if (n.optimizeNames(names, constants)) continue + subtractNames(names, n.names) + nodes.splice(i, 1) + } + return nodes.length > 0 ? this : undefined + } + + get names(): UsedNames { + return this.nodes.reduce((names: UsedNames, n) => addNames(names, n.names), {}) + } + + // get count(): number { + // return this.nodes.reduce((c, n) => c + n.count, 1) + // } +} + +abstract class BlockNode extends ParentNode { + render(opts: CGOptions): string { + return "{" + opts._n + super.render(opts) + "}" + opts._n + } +} + +class Root extends ParentNode {} + +class Else extends BlockNode { + static readonly kind = "else" +} + +class If extends BlockNode { + static readonly kind = "if" + else?: If | Else + constructor( + private condition: Code | boolean, + nodes?: ChildNode[] + ) { + super(nodes) + } + + render(opts: CGOptions): string { + let code = `if(${this.condition})` + super.render(opts) + if (this.else) code += "else " + this.else.render(opts) + return code + } + + optimizeNodes(): If | ChildNode[] | undefined { + super.optimizeNodes() + const cond = this.condition + if (cond === true) return this.nodes // else is ignored here + let e = this.else + if (e) { + const ns = e.optimizeNodes() + e = this.else = Array.isArray(ns) ? new Else(ns) : (ns as Else | undefined) + } + if (e) { + if (cond === false) return e instanceof If ? e : e.nodes + if (this.nodes.length) return this + return new If(not(cond), e instanceof If ? [e] : e.nodes) + } + if (cond === false || !this.nodes.length) return undefined + return this + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + this.else = this.else?.optimizeNames(names, constants) + if (!(super.optimizeNames(names, constants) || this.else)) return + this.condition = optimizeExpr(this.condition, names, constants) + return this + } + + get names(): UsedNames { + const names = super.names + addExprNames(names, this.condition) + if (this.else) addNames(names, this.else.names) + return names + } + + // get count(): number { + // return super.count + (this.else?.count || 0) + // } +} + +abstract class For extends BlockNode { + static readonly kind = "for" +} + +class ForLoop extends For { + constructor(private iteration: Code) { + super() + } + + render(opts: CGOptions): string { + return `for(${this.iteration})` + super.render(opts) + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!super.optimizeNames(names, constants)) return + this.iteration = optimizeExpr(this.iteration, names, constants) + return this + } + + get names(): UsedNames { + return addNames(super.names, this.iteration.names) + } +} + +class ForRange extends For { + constructor( + private readonly varKind: Name, + private readonly name: Name, + private readonly from: SafeExpr, + private readonly to: SafeExpr + ) { + super() + } + + render(opts: CGOptions): string { + const varKind = opts.es5 ? varKinds.var : this.varKind + const {name, from, to} = this + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts) + } + + get names(): UsedNames { + const names = addExprNames(super.names, this.from) + return addExprNames(names, this.to) + } +} + +class ForIter extends For { + constructor( + private readonly loop: "of" | "in", + private readonly varKind: Name, + private readonly name: Name, + private iterable: Code + ) { + super() + } + + render(opts: CGOptions): string { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts) + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!super.optimizeNames(names, constants)) return + this.iterable = optimizeExpr(this.iterable, names, constants) + return this + } + + get names(): UsedNames { + return addNames(super.names, this.iterable.names) + } +} + +class Func extends BlockNode { + static readonly kind = "func" + constructor( + public name: Name, + public args: Code, + public async?: boolean + ) { + super() + } + + render(opts: CGOptions): string { + const _async = this.async ? "async " : "" + return `${_async}function ${this.name}(${this.args})` + super.render(opts) + } +} + +class Return extends ParentNode { + static readonly kind = "return" + + render(opts: CGOptions): string { + return "return " + super.render(opts) + } +} + +class Try extends BlockNode { + catch?: Catch + finally?: Finally + + render(opts: CGOptions): string { + let code = "try" + super.render(opts) + if (this.catch) code += this.catch.render(opts) + if (this.finally) code += this.finally.render(opts) + return code + } + + optimizeNodes(): this { + super.optimizeNodes() + this.catch?.optimizeNodes() as Catch | undefined + this.finally?.optimizeNodes() as Finally | undefined + return this + } + + optimizeNames(names: UsedNames, constants: Constants): this { + super.optimizeNames(names, constants) + this.catch?.optimizeNames(names, constants) + this.finally?.optimizeNames(names, constants) + return this + } + + get names(): UsedNames { + const names = super.names + if (this.catch) addNames(names, this.catch.names) + if (this.finally) addNames(names, this.finally.names) + return names + } + + // get count(): number { + // return super.count + (this.catch?.count || 0) + (this.finally?.count || 0) + // } +} + +class Catch extends BlockNode { + static readonly kind = "catch" + constructor(readonly error: Name) { + super() + } + + render(opts: CGOptions): string { + return `catch(${this.error})` + super.render(opts) + } +} + +class Finally extends BlockNode { + static readonly kind = "finally" + render(opts: CGOptions): string { + return "finally" + super.render(opts) + } +} + +type StartBlockNode = If | For | Func | Return | Try + +type LeafNode = Def | Assign | Label | Break | Throw | AnyCode + +type ChildNode = StartBlockNode | LeafNode + +type EndBlockNodeType = + | typeof If + | typeof Else + | typeof For + | typeof Func + | typeof Return + | typeof Catch + | typeof Finally + +type Constants = Record + +export interface CodeGenOptions { + es5?: boolean + lines?: boolean + ownProperties?: boolean +} + +interface CGOptions extends CodeGenOptions { + _n: "\n" | "" +} + +export class CodeGen { + readonly _scope: Scope + readonly _extScope: ValueScope + readonly _values: ScopeValueSets = {} + private readonly _nodes: ParentNode[] + private readonly _blockStarts: number[] = [] + private readonly _constants: Constants = {} + private readonly opts: CGOptions + + constructor(extScope: ValueScope, opts: CodeGenOptions = {}) { + this.opts = {...opts, _n: opts.lines ? "\n" : ""} + this._extScope = extScope + this._scope = new Scope({parent: extScope}) + this._nodes = [new Root()] + } + + toString(): string { + return this._root.render(this.opts) + } + + // returns unique name in the internal scope + name(prefix: string): Name { + return this._scope.name(prefix) + } + + // reserves unique name in the external scope + scopeName(prefix: string): ValueScopeName { + return this._extScope.name(prefix) + } + + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name { + const name = this._extScope.value(prefixOrName, value) + const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()) + vs.add(name) + return name + } + + getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { + return this._extScope.getValue(prefix, keyOrRef) + } + + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName: Name): Code { + return this._extScope.scopeRefs(scopeName, this._values) + } + + scopeCode(): Code { + return this._extScope.scopeCode(this._values) + } + + private _def( + varKind: Name, + nameOrPrefix: Name | string, + rhs?: SafeExpr, + constant?: boolean + ): Name { + const name = this._scope.toName(nameOrPrefix) + if (rhs !== undefined && constant) this._constants[name.str] = rhs + this._leafNode(new Def(varKind, name, rhs)) + return name + } + + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.const, nameOrPrefix, rhs, _constant) + } + + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.let, nameOrPrefix, rhs, _constant) + } + + // `var` declaration with optional assignment + var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.var, nameOrPrefix, rhs, _constant) + } + + // assignment code + assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen { + return this._leafNode(new Assign(lhs, rhs, sideEffects)) + } + + // `+=` code + add(lhs: Code, rhs: SafeExpr): CodeGen { + return this._leafNode(new AssignOp(lhs, operators.ADD, rhs)) + } + + // appends passed SafeExpr to code or executes Block + code(c: Block | SafeExpr): CodeGen { + if (typeof c == "function") c() + else if (c !== nil) this._leafNode(new AnyCode(c)) + return this + } + + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues: [Name | string, SafeExpr | string][]): _Code { + const code: CodeItem[] = ["{"] + for (const [key, value] of keyValues) { + if (code.length > 1) code.push(",") + code.push(key) + if (key !== value || this.opts.es5) { + code.push(":") + addCodeArg(code, value) + } + } + code.push("}") + return new _Code(code) + } + + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen { + this._blockNode(new If(condition)) + + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf() + } else if (thenBody) { + this.code(thenBody).endIf() + } else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body') + } + return this + } + + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition: Code | boolean): CodeGen { + return this._elseNode(new If(condition)) + } + + // `else` clause - only valid after `if` or `else if` clauses + else(): CodeGen { + return this._elseNode(new Else()) + } + + // end `if` statement (needed if gen.if was used only with condition) + endIf(): CodeGen { + return this._endBlockNode(If, Else) + } + + private _for(node: For, forBody?: Block): CodeGen { + this._blockNode(node) + if (forBody) this.code(forBody).endFor() + return this + } + + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration: Code, forBody?: Block): CodeGen { + return this._for(new ForLoop(iteration), forBody) + } + + // `for` statement for a range of values + forRange( + nameOrPrefix: Name | string, + from: SafeExpr, + to: SafeExpr, + forBody: (index: Name) => void, + varKind: Code = this.opts.es5 ? varKinds.var : varKinds.let + ): CodeGen { + const name = this._scope.toName(nameOrPrefix) + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)) + } + + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf( + nameOrPrefix: Name | string, + iterable: Code, + forBody: (item: Name) => void, + varKind: Code = varKinds.const + ): CodeGen { + const name = this._scope.toName(nameOrPrefix) + if (this.opts.es5) { + const arr = iterable instanceof Name ? iterable : this.var("_arr", iterable) + return this.forRange("_i", 0, _`${arr}.length`, (i) => { + this.var(name, _`${arr}[${i}]`) + forBody(name) + }) + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)) + } + + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn( + nameOrPrefix: Name | string, + obj: Code, + forBody: (item: Name) => void, + varKind: Code = this.opts.es5 ? varKinds.var : varKinds.const + ): CodeGen { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, _`Object.keys(${obj})`, forBody) + } + const name = this._scope.toName(nameOrPrefix) + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)) + } + + // end `for` loop + endFor(): CodeGen { + return this._endBlockNode(For) + } + + // `label` statement + label(label: Name): CodeGen { + return this._leafNode(new Label(label)) + } + + // `break` statement + break(label?: Code): CodeGen { + return this._leafNode(new Break(label)) + } + + // `return` statement + return(value: Block | SafeExpr): CodeGen { + const node = new Return() + this._blockNode(node) + this.code(value) + if (node.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node') + return this._endBlockNode(Return) + } + + // `try` statement + try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen { + if (!catchCode && !finallyCode) throw new Error('CodeGen: "try" without "catch" and "finally"') + const node = new Try() + this._blockNode(node) + this.code(tryBody) + if (catchCode) { + const error = this.name("e") + this._currNode = node.catch = new Catch(error) + catchCode(error) + } + if (finallyCode) { + this._currNode = node.finally = new Finally() + this.code(finallyCode) + } + return this._endBlockNode(Catch, Finally) + } + + // `throw` statement + throw(error: Code): CodeGen { + return this._leafNode(new Throw(error)) + } + + // start self-balancing block + block(body?: Block, nodeCount?: number): CodeGen { + this._blockStarts.push(this._nodes.length) + if (body) this.code(body).endBlock(nodeCount) + return this + } + + // end the current self-balancing block + endBlock(nodeCount?: number): CodeGen { + const len = this._blockStarts.pop() + if (len === undefined) throw new Error("CodeGen: not in self-balancing block") + const toClose = this._nodes.length - len + if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`) + } + this._nodes.length = len + return this + } + + // `function` heading (or definition if funcBody is passed) + func(name: Name, args: Code = nil, async?: boolean, funcBody?: Block): CodeGen { + this._blockNode(new Func(name, args, async)) + if (funcBody) this.code(funcBody).endFunc() + return this + } + + // end function definition + endFunc(): CodeGen { + return this._endBlockNode(Func) + } + + optimize(n = 1): void { + while (n-- > 0) { + this._root.optimizeNodes() + this._root.optimizeNames(this._root.names, this._constants) + } + } + + private _leafNode(node: LeafNode): CodeGen { + this._currNode.nodes.push(node) + return this + } + + private _blockNode(node: StartBlockNode): void { + this._currNode.nodes.push(node) + this._nodes.push(node) + } + + private _endBlockNode(N1: EndBlockNodeType, N2?: EndBlockNodeType): CodeGen { + const n = this._currNode + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop() + return this + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`) + } + + private _elseNode(node: If | Else): CodeGen { + const n = this._currNode + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"') + } + this._currNode = n.else = node + return this + } + + private get _root(): Root { + return this._nodes[0] as Root + } + + private get _currNode(): ParentNode { + const ns = this._nodes + return ns[ns.length - 1] + } + + private set _currNode(node: ParentNode) { + const ns = this._nodes + ns[ns.length - 1] = node + } + + // get nodeCount(): number { + // return this._root.count + // } +} + +function addNames(names: UsedNames, from: UsedNames): UsedNames { + for (const n in from) names[n] = (names[n] || 0) + (from[n] || 0) + return names +} + +function addExprNames(names: UsedNames, from: SafeExpr): UsedNames { + return from instanceof _CodeOrName ? addNames(names, from.names) : names +} + +function optimizeExpr(expr: T, names: UsedNames, constants: Constants): T +function optimizeExpr(expr: SafeExpr, names: UsedNames, constants: Constants): SafeExpr { + if (expr instanceof Name) return replaceName(expr) + if (!canOptimize(expr)) return expr + return new _Code( + expr._items.reduce((items: CodeItem[], c: SafeExpr | string) => { + if (c instanceof Name) c = replaceName(c) + if (c instanceof _Code) items.push(...c._items) + else items.push(c) + return items + }, []) + ) + + function replaceName(n: Name): SafeExpr { + const c = constants[n.str] + if (c === undefined || names[n.str] !== 1) return n + delete names[n.str] + return c + } + + function canOptimize(e: SafeExpr): e is _Code { + return ( + e instanceof _Code && + e._items.some( + (c) => c instanceof Name && names[c.str] === 1 && constants[c.str] !== undefined + ) + ) + } +} + +function subtractNames(names: UsedNames, from: UsedNames): void { + for (const n in from) names[n] = (names[n] || 0) - (from[n] || 0) +} + +export function not(x: T): T +export function not(x: Code | SafeExpr): Code | SafeExpr { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : _`!${par(x)}` +} + +const andCode = mappend(operators.AND) + +// boolean AND (&&) expression with the passed arguments +export function and(...args: Code[]): Code { + return args.reduce(andCode) +} + +const orCode = mappend(operators.OR) + +// boolean OR (||) expression with the passed arguments +export function or(...args: Code[]): Code { + return args.reduce(orCode) +} + +type MAppend = (x: Code, y: Code) => Code + +function mappend(op: Code): MAppend { + return (x, y) => (x === nil ? y : y === nil ? x : _`${par(x)} ${op} ${par(y)}`) +} + +function par(x: Code): Code { + return x instanceof Name ? x : _`(${x})` +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/scope.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/scope.ts new file mode 100644 index 0000000000000000000000000000000000000000..511992297d08f661ef4cf826eba9fbdbf0854db0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/codegen/scope.ts @@ -0,0 +1,215 @@ +import {_, nil, Code, Name} from "./code" + +interface NameGroup { + prefix: string + index: number +} + +export interface NameValue { + ref: ValueReference // this is the reference to any value that can be referred to from generated code via `globals` var in the closure + key?: unknown // any key to identify a global to avoid duplicates, if not passed ref is used + code?: Code // this is the code creating the value needed for standalone code wit_out closure - can be a primitive value, function or import (`require`) +} + +export type ValueReference = unknown // possibly make CodeGen parameterized type on this type + +class ValueError extends Error { + readonly value?: NameValue + constructor(name: ValueScopeName) { + super(`CodeGen: "code" for ${name} not defined`) + this.value = name.value + } +} + +interface ScopeOptions { + prefixes?: Set + parent?: Scope +} + +interface ValueScopeOptions extends ScopeOptions { + scope: ScopeStore + es5?: boolean + lines?: boolean +} + +export type ScopeStore = Record + +type ScopeValues = { + [Prefix in string]?: Map +} + +export type ScopeValueSets = { + [Prefix in string]?: Set +} + +export enum UsedValueState { + Started, + Completed, +} + +export type UsedScopeValues = { + [Prefix in string]?: Map +} + +export const varKinds = { + const: new Name("const"), + let: new Name("let"), + var: new Name("var"), +} + +export class Scope { + protected readonly _names: {[Prefix in string]?: NameGroup} = {} + protected readonly _prefixes?: Set + protected readonly _parent?: Scope + + constructor({prefixes, parent}: ScopeOptions = {}) { + this._prefixes = prefixes + this._parent = parent + } + + toName(nameOrPrefix: Name | string): Name { + return nameOrPrefix instanceof Name ? nameOrPrefix : this.name(nameOrPrefix) + } + + name(prefix: string): Name { + return new Name(this._newName(prefix)) + } + + protected _newName(prefix: string): string { + const ng = this._names[prefix] || this._nameGroup(prefix) + return `${prefix}${ng.index++}` + } + + private _nameGroup(prefix: string): NameGroup { + if (this._parent?._prefixes?.has(prefix) || (this._prefixes && !this._prefixes.has(prefix))) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`) + } + return (this._names[prefix] = {prefix, index: 0}) + } +} + +interface ScopePath { + property: string + itemIndex: number +} + +export class ValueScopeName extends Name { + readonly prefix: string + value?: NameValue + scopePath?: Code + + constructor(prefix: string, nameStr: string) { + super(nameStr) + this.prefix = prefix + } + + setValue(value: NameValue, {property, itemIndex}: ScopePath): void { + this.value = value + this.scopePath = _`.${new Name(property)}[${itemIndex}]` + } +} + +interface VSOptions extends ValueScopeOptions { + _n: Code +} + +const line = _`\n` + +export class ValueScope extends Scope { + protected readonly _values: ScopeValues = {} + protected readonly _scope: ScopeStore + readonly opts: VSOptions + + constructor(opts: ValueScopeOptions) { + super(opts) + this._scope = opts.scope + this.opts = {...opts, _n: opts.lines ? line : nil} + } + + get(): ScopeStore { + return this._scope + } + + name(prefix: string): ValueScopeName { + return new ValueScopeName(prefix, this._newName(prefix)) + } + + value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName { + if (value.ref === undefined) throw new Error("CodeGen: ref must be passed in value") + const name = this.toName(nameOrPrefix) as ValueScopeName + const {prefix} = name + const valueKey = value.key ?? value.ref + let vs = this._values[prefix] + if (vs) { + const _name = vs.get(valueKey) + if (_name) return _name + } else { + vs = this._values[prefix] = new Map() + } + vs.set(valueKey, name) + + const s = this._scope[prefix] || (this._scope[prefix] = []) + const itemIndex = s.length + s[itemIndex] = value.ref + name.setValue(value, {property: prefix, itemIndex}) + return name + } + + getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { + const vs = this._values[prefix] + if (!vs) return + return vs.get(keyOrRef) + } + + scopeRefs(scopeName: Name, values: ScopeValues | ScopeValueSets = this._values): Code { + return this._reduceValues(values, (name: ValueScopeName) => { + if (name.scopePath === undefined) throw new Error(`CodeGen: name "${name}" has no value`) + return _`${scopeName}${name.scopePath}` + }) + } + + scopeCode( + values: ScopeValues | ScopeValueSets = this._values, + usedValues?: UsedScopeValues, + getCode?: (n: ValueScopeName) => Code | undefined + ): Code { + return this._reduceValues( + values, + (name: ValueScopeName) => { + if (name.value === undefined) throw new Error(`CodeGen: name "${name}" has no value`) + return name.value.code + }, + usedValues, + getCode + ) + } + + private _reduceValues( + values: ScopeValues | ScopeValueSets, + valueCode: (n: ValueScopeName) => Code | undefined, + usedValues: UsedScopeValues = {}, + getCode?: (n: ValueScopeName) => Code | undefined + ): Code { + let code: Code = nil + for (const prefix in values) { + const vs = values[prefix] + if (!vs) continue + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()) + vs.forEach((name: ValueScopeName) => { + if (nameSet.has(name)) return + nameSet.set(name, UsedValueState.Started) + let c = valueCode(name) + if (c) { + const def = this.opts.es5 ? varKinds.var : varKinds.const + code = _`${code}${def} ${name} = ${c};${this.opts._n}` + } else if ((c = getCode?.(name))) { + code = _`${code}${c}${this.opts._n}` + } else { + throw new ValueError(name) + } + nameSet.set(name, UsedValueState.Completed) + }) + } + return code + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/errors.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/errors.ts new file mode 100644 index 0000000000000000000000000000000000000000..18424a0fc62917fa720aee28e97280865f8bf1f5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/errors.ts @@ -0,0 +1,184 @@ +import type {KeywordErrorCxt, KeywordErrorDefinition} from "../types" +import type {SchemaCxt} from "./index" +import {CodeGen, _, str, strConcat, Code, Name} from "./codegen" +import {SafeExpr} from "./codegen/code" +import {getErrorPath, Type} from "./util" +import N from "./names" + +export const keywordError: KeywordErrorDefinition = { + message: ({keyword}) => str`must pass "${keyword}" keyword validation`, +} + +export const keyword$DataError: KeywordErrorDefinition = { + message: ({keyword, schemaType}) => + schemaType + ? str`"${keyword}" keyword must be ${schemaType} ($data)` + : str`"${keyword}" keyword is invalid ($data)`, +} + +export interface ErrorPaths { + instancePath?: Code + schemaPath?: string + parentSchema?: boolean +} + +export function reportError( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition = keywordError, + errorPaths?: ErrorPaths, + overrideAllErrors?: boolean +): void { + const {it} = cxt + const {gen, compositeRule, allErrors} = it + const errObj = errorObjectCode(cxt, error, errorPaths) + if (overrideAllErrors ?? (compositeRule || allErrors)) { + addError(gen, errObj) + } else { + returnErrors(it, _`[${errObj}]`) + } +} + +export function reportExtraError( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition = keywordError, + errorPaths?: ErrorPaths +): void { + const {it} = cxt + const {gen, compositeRule, allErrors} = it + const errObj = errorObjectCode(cxt, error, errorPaths) + addError(gen, errObj) + if (!(compositeRule || allErrors)) { + returnErrors(it, N.vErrors) + } +} + +export function resetErrorsCount(gen: CodeGen, errsCount: Name): void { + gen.assign(N.errors, errsCount) + gen.if(_`${N.vErrors} !== null`, () => + gen.if( + errsCount, + () => gen.assign(_`${N.vErrors}.length`, errsCount), + () => gen.assign(N.vErrors, null) + ) + ) +} + +export function extendErrors({ + gen, + keyword, + schemaValue, + data, + errsCount, + it, +}: KeywordErrorCxt): void { + /* istanbul ignore if */ + if (errsCount === undefined) throw new Error("ajv implementation error") + const err = gen.name("err") + gen.forRange("i", errsCount, N.errors, (i) => { + gen.const(err, _`${N.vErrors}[${i}]`) + gen.if(_`${err}.instancePath === undefined`, () => + gen.assign(_`${err}.instancePath`, strConcat(N.instancePath, it.errorPath)) + ) + gen.assign(_`${err}.schemaPath`, str`${it.errSchemaPath}/${keyword}`) + if (it.opts.verbose) { + gen.assign(_`${err}.schema`, schemaValue) + gen.assign(_`${err}.data`, data) + } + }) +} + +function addError(gen: CodeGen, errObj: Code): void { + const err = gen.const("err", errObj) + gen.if( + _`${N.vErrors} === null`, + () => gen.assign(N.vErrors, _`[${err}]`), + _`${N.vErrors}.push(${err})` + ) + gen.code(_`${N.errors}++`) +} + +function returnErrors(it: SchemaCxt, errs: Code): void { + const {gen, validateName, schemaEnv} = it + if (schemaEnv.$async) { + gen.throw(_`new ${it.ValidationError as Name}(${errs})`) + } else { + gen.assign(_`${validateName}.errors`, errs) + gen.return(false) + } +} + +const E = { + keyword: new Name("keyword"), + schemaPath: new Name("schemaPath"), // also used in JTD errors + params: new Name("params"), + propertyName: new Name("propertyName"), + message: new Name("message"), + schema: new Name("schema"), + parentSchema: new Name("parentSchema"), +} + +function errorObjectCode( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition, + errorPaths?: ErrorPaths +): Code { + const {createErrors} = cxt.it + if (createErrors === false) return _`{}` + return errorObject(cxt, error, errorPaths) +} + +function errorObject( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition, + errorPaths: ErrorPaths = {} +): Code { + const {gen, it} = cxt + const keyValues: [Name, SafeExpr | string][] = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths), + ] + extraErrorProps(cxt, error, keyValues) + return gen.object(...keyValues) +} + +function errorInstancePath({errorPath}: SchemaCxt, {instancePath}: ErrorPaths): [Name, Code] { + const instPath = instancePath + ? str`${errorPath}${getErrorPath(instancePath, Type.Str)}` + : errorPath + return [N.instancePath, strConcat(N.instancePath, instPath)] +} + +function errorSchemaPath( + {keyword, it: {errSchemaPath}}: KeywordErrorCxt, + {schemaPath, parentSchema}: ErrorPaths +): [Name, string | Code] { + let schPath = parentSchema ? errSchemaPath : str`${errSchemaPath}/${keyword}` + if (schemaPath) { + schPath = str`${schPath}${getErrorPath(schemaPath, Type.Str)}` + } + return [E.schemaPath, schPath] +} + +function extraErrorProps( + cxt: KeywordErrorCxt, + {params, message}: KeywordErrorDefinition, + keyValues: [Name, SafeExpr | string][] +): void { + const {keyword, data, schemaValue, it} = cxt + const {opts, propertyName, topSchemaRef, schemaPath} = it + keyValues.push( + [E.keyword, keyword], + [E.params, typeof params == "function" ? params(cxt) : params || _`{}`] + ) + if (opts.messages) { + keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]) + } + if (opts.verbose) { + keyValues.push( + [E.schema, schemaValue], + [E.parentSchema, _`${topSchemaRef}${schemaPath}`], + [N.data, data] + ) + } + if (propertyName) keyValues.push([E.propertyName, propertyName]) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..bfc39345526afe62f8c1d52eabf5b25b7959537f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/index.ts @@ -0,0 +1,324 @@ +import type { + AnySchema, + AnySchemaObject, + AnyValidateFunction, + AsyncValidateFunction, + EvaluatedProperties, + EvaluatedItems, +} from "../types" +import type Ajv from "../core" +import type {InstanceOptions} from "../core" +import {CodeGen, _, nil, stringify, Name, Code, ValueScopeName} from "./codegen" +import ValidationError from "../runtime/validation_error" +import N from "./names" +import {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from "./resolve" +import {schemaHasRulesButRef, unescapeFragment} from "./util" +import {validateFunctionCode} from "./validate" +import {URIComponent} from "fast-uri" +import {JSONType} from "./rules" + +export type SchemaRefs = { + [Ref in string]?: SchemaEnv | AnySchema +} + +export interface SchemaCxt { + readonly gen: CodeGen + readonly allErrors?: boolean // validation mode - whether to collect all errors or break on error + readonly data: Name // Name with reference to the current part of data instance + readonly parentData: Name // should be used in keywords modifying data + readonly parentDataProperty: Code | number // should be used in keywords modifying data + readonly dataNames: Name[] + readonly dataPathArr: (Code | number)[] + readonly dataLevel: number // the level of the currently validated data, + // it can be used to access both the property names and the data on all levels from the top. + dataTypes: JSONType[] // data types applied to the current part of data instance + definedProperties: Set // set of properties to keep track of for required checks + readonly topSchemaRef: Code + readonly validateName: Name + evaluated?: Name + readonly ValidationError?: Name + readonly schema: AnySchema // current schema object - equal to parentSchema passed via KeywordCxt + readonly schemaEnv: SchemaEnv + readonly rootId: string + baseId: string // the current schema base URI that should be used as the base for resolving URIs in references (\$ref) + readonly schemaPath: Code // the run-time expression that evaluates to the property name of the current schema + readonly errSchemaPath: string // this is actual string, should not be changed to Code + readonly errorPath: Code + readonly propertyName?: Name + readonly compositeRule?: boolean // true indicates that the current schema is inside the compound keyword, + // where failing some rule doesn't mean validation failure (`anyOf`, `oneOf`, `not`, `if`). + // This flag is used to determine whether you can return validation result immediately after any error in case the option `allErrors` is not `true. + // You only need to use it if you have many steps in your keywords and potentially can define multiple errors. + props?: EvaluatedProperties | Name // properties evaluated by this schema - used by parent schema or assigned to validation function + items?: EvaluatedItems | Name // last item evaluated by this schema - used by parent schema or assigned to validation function + jtdDiscriminator?: string + jtdMetadata?: boolean + readonly createErrors?: boolean + readonly opts: InstanceOptions // Ajv instance option. + readonly self: Ajv // current Ajv instance +} + +export interface SchemaObjCxt extends SchemaCxt { + readonly schema: AnySchemaObject +} +interface SchemaEnvArgs { + readonly schema: AnySchema + readonly schemaId?: "$id" | "id" + readonly root?: SchemaEnv + readonly baseId?: string + readonly schemaPath?: string + readonly localRefs?: LocalRefs + readonly meta?: boolean +} + +export class SchemaEnv implements SchemaEnvArgs { + readonly schema: AnySchema + readonly schemaId?: "$id" | "id" + readonly root: SchemaEnv + baseId: string // TODO possibly, it should be readonly + schemaPath?: string + localRefs?: LocalRefs + readonly meta?: boolean + readonly $async?: boolean // true if the current schema is asynchronous. + readonly refs: SchemaRefs = {} + readonly dynamicAnchors: {[Ref in string]?: true} = {} + validate?: AnyValidateFunction + validateName?: ValueScopeName + serialize?: (data: unknown) => string + serializeName?: ValueScopeName + parse?: (data: string) => unknown + parseName?: ValueScopeName + + constructor(env: SchemaEnvArgs) { + let schema: AnySchemaObject | undefined + if (typeof env.schema == "object") schema = env.schema + this.schema = env.schema + this.schemaId = env.schemaId + this.root = env.root || this + this.baseId = env.baseId ?? normalizeId(schema?.[env.schemaId || "$id"]) + this.schemaPath = env.schemaPath + this.localRefs = env.localRefs + this.meta = env.meta + this.$async = schema?.$async + this.refs = {} + } +} + +// let codeSize = 0 +// let nodeCount = 0 + +// Compiles schema in SchemaEnv +export function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv { + // TODO refactor - remove compilations + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const rootId = getFullPath(this.opts.uriResolver, sch.root.baseId) // TODO if getFullPath removed 1 tests fails + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + let _ValidationError + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: ValidationError, + code: _`require("ajv/dist/runtime/validation_error").default`, + }) + } + + const validateName = gen.scopeName("validate") + sch.validateName = validateName + + const schemaCxt: SchemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: N.data, + parentData: N.parentData, + parentDataProperty: N.parentDataProperty, + dataNames: [N.data], + dataPathArr: [nil], // TODO can its length be used as dataLevel if nil is removed? + dataLevel: 0, + dataTypes: [], + definedProperties: new Set(), + topSchemaRef: gen.scopeValue( + "schema", + this.opts.code.source === true + ? {ref: sch.schema, code: stringify(sch.schema)} + : {ref: sch.schema} + ), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: _`""`, + opts: this.opts, + self: this, + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + validateFunctionCode(schemaCxt) + gen.optimize(this.opts.code.optimize) + // gen.optimize(1) + const validateCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${validateCode}` + // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) + if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch) + // console.log("\n\n\n *** \n", sourceCode) + const makeValidate = new Function(`${N.self}`, `${N.scope}`, sourceCode) + const validate: AnyValidateFunction = makeValidate(this, this.scope.get()) + this.scope.value(validateName, {ref: validate}) + + validate.errors = null + validate.schema = sch.schema + validate.schemaEnv = sch + if (sch.$async) (validate as AsyncValidateFunction).$async = true + if (this.opts.code.source === true) { + validate.source = {validateName, validateCode, scopeValues: gen._values} + } + if (this.opts.unevaluated) { + const {props, items} = schemaCxt + validate.evaluated = { + props: props instanceof Name ? undefined : props, + items: items instanceof Name ? undefined : items, + dynamicProps: props instanceof Name, + dynamicItems: items instanceof Name, + } + if (validate.source) validate.source.evaluated = stringify(validate.evaluated) + } + sch.validate = validate + return sch + } catch (e) { + delete sch.validate + delete sch.validateName + if (sourceCode) this.logger.error("Error compiling schema, function code:", sourceCode) + // console.log("\n\n\n *** \n", sourceCode, this.opts) + throw e + } finally { + this._compilations.delete(sch) + } +} + +export function resolveRef( + this: Ajv, + root: SchemaEnv, + baseId: string, + ref: string +): AnySchema | SchemaEnv | undefined { + ref = resolveUrl(this.opts.uriResolver, baseId, ref) + const schOrFunc = root.refs[ref] + if (schOrFunc) return schOrFunc + + let _sch = resolve.call(this, root, ref) + if (_sch === undefined) { + const schema = root.localRefs?.[ref] // TODO maybe localRefs should hold SchemaEnv + const {schemaId} = this.opts + if (schema) _sch = new SchemaEnv({schema, schemaId, root, baseId}) + } + + if (_sch === undefined) return + return (root.refs[ref] = inlineOrCompile.call(this, _sch)) +} + +function inlineOrCompile(this: Ajv, sch: SchemaEnv): AnySchema | SchemaEnv { + if (inlineRef(sch.schema, this.opts.inlineRefs)) return sch.schema + return sch.validate ? sch : compileSchema.call(this, sch) +} + +// Index of schema compilation in the currently compiled list +export function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) return sch + } +} + +function sameSchemaEnv(s1: SchemaEnv, s2: SchemaEnv): boolean { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId +} + +// resolve and compile the references ($ref) +// TODO returns AnySchemaObject (if the schema can be inlined) or validation function +function resolve( + this: Ajv, + root: SchemaEnv, // information about the root schema for the current schema + ref: string // reference to resolve +): SchemaEnv | undefined { + let sch + while (typeof (sch = this.refs[ref]) == "string") ref = sch + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref) +} + +// Resolve schema, its root and baseId +export function resolveSchema( + this: Ajv, + root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it + ref: string // reference to resolve +): SchemaEnv | undefined { + const p = this.opts.uriResolver.parse(ref) + const refPath = _getFullPath(this.opts.uriResolver, p) + let baseId = getFullPath(this.opts.uriResolver, root.baseId, undefined) + // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root) + } + + const id = normalizeId(refPath) + const schOrRef = this.refs[id] || this.schemas[id] + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef) + if (typeof sch?.schema !== "object") return + return getJsonPointer.call(this, p, sch) + } + + if (typeof schOrRef?.schema !== "object") return + if (!schOrRef.validate) compileSchema.call(this, schOrRef) + if (id === normalizeId(ref)) { + const {schema} = schOrRef + const {schemaId} = this.opts + const schId = schema[schemaId] + if (schId) baseId = resolveUrl(this.opts.uriResolver, baseId, schId) + return new SchemaEnv({schema, schemaId, root, baseId}) + } + return getJsonPointer.call(this, p, schOrRef) +} + +const PREVENT_SCOPE_CHANGE = new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions", +]) + +function getJsonPointer( + this: Ajv, + parsedRef: URIComponent, + {baseId, schema, root}: SchemaEnv +): SchemaEnv | undefined { + if (parsedRef.fragment?.[0] !== "/") return + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema === "boolean") return + const partSchema = schema[unescapeFragment(part)] + if (partSchema === undefined) return + schema = partSchema + // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? + const schId = typeof schema === "object" && schema[this.opts.schemaId] + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = resolveUrl(this.opts.uriResolver, baseId, schId) + } + } + let env: SchemaEnv | undefined + if (typeof schema != "boolean" && schema.$ref && !schemaHasRulesButRef(schema, this.RULES)) { + const $ref = resolveUrl(this.opts.uriResolver, baseId, schema.$ref) + env = resolveSchema.call(this, root, $ref) + } + // even though resolution failed we need to return SchemaEnv to throw exception + // so that compileAsync loads missing schema. + const {schemaId} = this.opts + env = env || new SchemaEnv({schema, schemaId, root, baseId}) + if (env.schema !== env.root.schema) return env + return undefined +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/parse.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/parse.ts new file mode 100644 index 0000000000000000000000000000000000000000..a0141c770c7029ce1d41db61bcd9a19fbd0c08d5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/parse.ts @@ -0,0 +1,411 @@ +import type Ajv from "../../core" +import type {SchemaObject} from "../../types" +import {jtdForms, JTDForm, SchemaObjectMap} from "./types" +import {SchemaEnv, getCompilingSchema} from ".." +import {_, str, and, or, nil, not, CodeGen, Code, Name, SafeExpr} from "../codegen" +import MissingRefError from "../ref_error" +import N from "../names" +import {hasPropFunc} from "../../vocabularies/code" +import {hasRef} from "../../vocabularies/jtd/ref" +import {intRange, IntType} from "../../vocabularies/jtd/type" +import {parseJson, parseJsonNumber, parseJsonString} from "../../runtime/parseJson" +import {useFunc} from "../util" +import validTimestamp from "../../runtime/timestamp" + +type GenParse = (cxt: ParseCxt) => void + +const genParse: {[F in JTDForm]: GenParse} = { + elements: parseElements, + values: parseValues, + discriminator: parseDiscriminator, + properties: parseProperties, + optionalProperties: parseProperties, + enum: parseEnum, + type: parseType, + ref: parseRef, +} + +interface ParseCxt { + readonly gen: CodeGen + readonly self: Ajv // current Ajv instance + readonly schemaEnv: SchemaEnv + readonly definitions: SchemaObjectMap + schema: SchemaObject + data: Code + parseName: Name + char: Name +} + +export default function compileParser( + this: Ajv, + sch: SchemaEnv, + definitions: SchemaObjectMap +): SchemaEnv { + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + const parseName = gen.scopeName("parse") + const cxt: ParseCxt = { + self: this, + gen, + schema: sch.schema as SchemaObject, + schemaEnv: sch, + definitions, + data: N.data, + parseName, + char: gen.name("c"), + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + sch.parseName = parseName + parserFunction(cxt) + gen.optimize(this.opts.code.optimize) + const parseFuncCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${parseFuncCode}` + const makeParse = new Function(`${N.scope}`, sourceCode) + const parse: (json: string) => unknown = makeParse(this.scope.get()) + this.scope.value(parseName, {ref: parse}) + sch.parse = parse + } catch (e) { + if (sourceCode) this.logger.error("Error compiling parser, function code:", sourceCode) + delete sch.parse + delete sch.parseName + throw e + } finally { + this._compilations.delete(sch) + } + return sch +} + +const undef = _`undefined` + +function parserFunction(cxt: ParseCxt): void { + const {gen, parseName, char} = cxt + gen.func(parseName, _`${N.json}, ${N.jsonPos}, ${N.jsonPart}`, false, () => { + gen.let(N.data) + gen.let(char) + gen.assign(_`${parseName}.message`, undef) + gen.assign(_`${parseName}.position`, undef) + gen.assign(N.jsonPos, _`${N.jsonPos} || 0`) + gen.const(N.jsonLen, _`${N.json}.length`) + parseCode(cxt) + skipWhitespace(cxt) + gen.if(N.jsonPart, () => { + gen.assign(_`${parseName}.position`, N.jsonPos) + gen.return(N.data) + }) + gen.if(_`${N.jsonPos} === ${N.jsonLen}`, () => gen.return(N.data)) + jsonSyntaxError(cxt) + }) +} + +function parseCode(cxt: ParseCxt): void { + let form: JTDForm | undefined + for (const key of jtdForms) { + if (key in cxt.schema) { + form = key + break + } + } + if (form) parseNullable(cxt, genParse[form]) + else parseEmpty(cxt) +} + +const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)) + +function parseNullable(cxt: ParseCxt, parseForm: GenParse): void { + const {gen, schema, data} = cxt + if (!schema.nullable) return parseForm(cxt) + tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)) +} + +function parseElements(cxt: ParseCxt): void { + const {gen, schema, data} = cxt + parseToken(cxt, "[") + const ix = gen.let("i", 0) + gen.assign(data, _`[]`) + parseItems(cxt, "]", () => { + const el = gen.let("el") + parseCode({...cxt, schema: schema.elements, data: el}) + gen.assign(_`${data}[${ix}++]`, el) + }) +} + +function parseValues(cxt: ParseCxt): void { + const {gen, schema, data} = cxt + parseToken(cxt, "{") + gen.assign(data, _`{}`) + parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)) +} + +function parseItems(cxt: ParseCxt, endToken: string, block: () => void): void { + tryParseItems(cxt, endToken, block) + parseToken(cxt, endToken) +} + +function tryParseItems(cxt: ParseCxt, endToken: string, block: () => void): void { + const {gen} = cxt + gen.for(_`;${N.jsonPos}<${N.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { + block() + tryParseToken(cxt, ",", () => gen.break(), hasItem) + }) + + function hasItem(): void { + tryParseToken(cxt, endToken, () => {}, jsonSyntaxError) + } +} + +function parseKeyValue(cxt: ParseCxt, schema: SchemaObject): void { + const {gen} = cxt + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + parsePropertyValue(cxt, key, schema) +} + +function parseDiscriminator(cxt: ParseCxt): void { + const {gen, data, schema} = cxt + const {discriminator, mapping} = schema + parseToken(cxt, "{") + gen.assign(data, _`{}`) + const startPos = gen.const("pos", N.jsonPos) + const value = gen.let("value") + const tag = gen.let("tag") + tryParseItems(cxt, "}", () => { + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + gen.if( + _`${key} === ${discriminator}`, + () => { + parseString({...cxt, data: tag}) + gen.assign(_`${data}[${key}]`, tag) + gen.break() + }, + () => parseEmpty({...cxt, data: value}) // can be discarded/skipped + ) + }) + gen.assign(N.jsonPos, startPos) + gen.if(_`${tag} === undefined`) + parsingError(cxt, str`discriminator tag not found`) + for (const tagValue in mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + parseSchemaProperties({...cxt, schema: mapping[tagValue]}, discriminator) + } + gen.else() + parsingError(cxt, str`discriminator value not in schema`) + gen.endIf() +} + +function parseProperties(cxt: ParseCxt): void { + const {gen, data} = cxt + parseToken(cxt, "{") + gen.assign(data, _`{}`) + parseSchemaProperties(cxt) +} + +function parseSchemaProperties(cxt: ParseCxt, discriminator?: string): void { + const {gen, schema, data} = cxt + const {properties, optionalProperties, additionalProperties} = schema + parseItems(cxt, "}", () => { + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + gen.if(false) + parseDefinedProperty(cxt, key, properties) + parseDefinedProperty(cxt, key, optionalProperties) + if (discriminator) { + gen.elseIf(_`${key} === ${discriminator}`) + const tag = gen.let("tag") + parseString({...cxt, data: tag}) // can be discarded, it is already assigned + } + gen.else() + if (additionalProperties) { + parseEmpty({...cxt, data: _`${data}[${key}]`}) + } else { + parsingError(cxt, str`property ${key} not allowed`) + } + gen.endIf() + }) + if (properties) { + const hasProp = hasPropFunc(gen) + const allProps: Code = and( + ...Object.keys(properties).map((p): Code => _`${hasProp}.call(${data}, ${p})`) + ) + gen.if(not(allProps), () => parsingError(cxt, str`missing required properties`)) + } +} + +function parseDefinedProperty(cxt: ParseCxt, key: Name, schemas: SchemaObjectMap = {}): void { + const {gen} = cxt + for (const prop in schemas) { + gen.elseIf(_`${key} === ${prop}`) + parsePropertyValue(cxt, key, schemas[prop] as SchemaObject) + } +} + +function parsePropertyValue(cxt: ParseCxt, key: Name, schema: SchemaObject): void { + parseCode({...cxt, schema, data: _`${cxt.data}[${key}]`}) +} + +function parseType(cxt: ParseCxt): void { + const {gen, schema, data, self} = cxt + switch (schema.type) { + case "boolean": + parseBoolean(cxt) + break + case "string": + parseString(cxt) + break + case "timestamp": { + parseString(cxt) + const vts = useFunc(gen, validTimestamp) + const {allowDate, parseDate} = self.opts + const notValid = allowDate ? _`!${vts}(${data}, true)` : _`!${vts}(${data})` + const fail: Code = parseDate + ? or(notValid, _`(${data} = new Date(${data}), false)`, _`isNaN(${data}.valueOf())`) + : notValid + gen.if(fail, () => parsingError(cxt, str`invalid timestamp`)) + break + } + case "float32": + case "float64": + parseNumber(cxt) + break + default: { + const t = schema.type as IntType + if (!self.opts.int32range && (t === "int32" || t === "uint32")) { + parseNumber(cxt, 16) // 2 ** 53 - max safe integer + if (t === "uint32") { + gen.if(_`${data} < 0`, () => parsingError(cxt, str`integer out of range`)) + } + } else { + const [min, max, maxDigits] = intRange[t] + parseNumber(cxt, maxDigits) + gen.if(_`${data} < ${min} || ${data} > ${max}`, () => + parsingError(cxt, str`integer out of range`) + ) + } + } + } +} + +function parseString(cxt: ParseCxt): void { + parseToken(cxt, '"') + parseWith(cxt, parseJsonString) +} + +function parseEnum(cxt: ParseCxt): void { + const {gen, data, schema} = cxt + const enumSch = schema.enum + parseToken(cxt, '"') + // TODO loopEnum + gen.if(false) + for (const value of enumSch) { + const valueStr = JSON.stringify(value).slice(1) // remove starting quote + gen.elseIf(_`${jsonSlice(valueStr.length)} === ${valueStr}`) + gen.assign(data, str`${value}`) + gen.add(N.jsonPos, valueStr.length) + } + gen.else() + jsonSyntaxError(cxt) + gen.endIf() +} + +function parseNumber(cxt: ParseCxt, maxDigits?: number): void { + const {gen} = cxt + skipWhitespace(cxt) + gen.if( + _`"-0123456789".indexOf(${jsonSlice(1)}) < 0`, + () => jsonSyntaxError(cxt), + () => parseWith(cxt, parseJsonNumber, maxDigits) + ) +} + +function parseBooleanToken(bool: boolean, fail: GenParse): GenParse { + return (cxt) => { + const {gen, data} = cxt + tryParseToken( + cxt, + `${bool}`, + () => fail(cxt), + () => gen.assign(data, bool) + ) + } +} + +function parseRef(cxt: ParseCxt): void { + const {gen, self, definitions, schema, schemaEnv} = cxt + const {ref} = schema + const refSchema = definitions[ref] + if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) + if (!hasRef(refSchema)) return parseCode({...cxt, schema: refSchema}) + const {root} = schemaEnv + const sch = compileParser.call(self, new SchemaEnv({schema: refSchema, root}), definitions) + partialParse(cxt, getParser(gen, sch), true) +} + +function getParser(gen: CodeGen, sch: SchemaEnv): Code { + return sch.parse + ? gen.scopeValue("parse", {ref: sch.parse}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.parse` +} + +function parseEmpty(cxt: ParseCxt): void { + parseWith(cxt, parseJson) +} + +function parseWith(cxt: ParseCxt, parseFunc: {code: string}, args?: SafeExpr): void { + partialParse(cxt, useFunc(cxt.gen, parseFunc), args) +} + +function partialParse(cxt: ParseCxt, parseFunc: Name, args?: SafeExpr): void { + const {gen, data} = cxt + gen.assign(data, _`${parseFunc}(${N.json}, ${N.jsonPos}${args ? _`, ${args}` : nil})`) + gen.assign(N.jsonPos, _`${parseFunc}.position`) + gen.if(_`${data} === undefined`, () => parsingError(cxt, _`${parseFunc}.message`)) +} + +function parseToken(cxt: ParseCxt, tok: string): void { + tryParseToken(cxt, tok, jsonSyntaxError) +} + +function tryParseToken(cxt: ParseCxt, tok: string, fail: GenParse, success?: GenParse): void { + const {gen} = cxt + const n = tok.length + skipWhitespace(cxt) + gen.if( + _`${jsonSlice(n)} === ${tok}`, + () => { + gen.add(N.jsonPos, n) + success?.(cxt) + }, + () => fail(cxt) + ) +} + +function skipWhitespace({gen, char: c}: ParseCxt): void { + gen.code( + _`while((${c}=${N.json}[${N.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${N.jsonPos}++;` + ) +} + +function jsonSlice(len: number | Name): Code { + return len === 1 + ? _`${N.json}[${N.jsonPos}]` + : _`${N.json}.slice(${N.jsonPos}, ${N.jsonPos}+${len})` +} + +function jsonSyntaxError(cxt: ParseCxt): void { + parsingError(cxt, _`"unexpected token " + ${N.json}[${N.jsonPos}]`) +} + +function parsingError({gen, parseName}: ParseCxt, msg: Code): void { + gen.assign(_`${parseName}.message`, msg) + gen.assign(_`${parseName}.position`, N.jsonPos) + gen.return(undef) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/serialize.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/serialize.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d228826d4344cfb4e64f20f494ff9102b736d33 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/serialize.ts @@ -0,0 +1,266 @@ +import type Ajv from "../../core" +import type {SchemaObject} from "../../types" +import {jtdForms, JTDForm, SchemaObjectMap} from "./types" +import {SchemaEnv, getCompilingSchema} from ".." +import {_, str, and, getProperty, CodeGen, Code, Name} from "../codegen" +import MissingRefError from "../ref_error" +import N from "../names" +import {isOwnProperty} from "../../vocabularies/code" +import {hasRef} from "../../vocabularies/jtd/ref" +import {useFunc} from "../util" +import quote from "../../runtime/quote" + +const genSerialize: {[F in JTDForm]: (cxt: SerializeCxt) => void} = { + elements: serializeElements, + values: serializeValues, + discriminator: serializeDiscriminator, + properties: serializeProperties, + optionalProperties: serializeProperties, + enum: serializeString, + type: serializeType, + ref: serializeRef, +} + +interface SerializeCxt { + readonly gen: CodeGen + readonly self: Ajv // current Ajv instance + readonly schemaEnv: SchemaEnv + readonly definitions: SchemaObjectMap + schema: SchemaObject + data: Code +} + +export default function compileSerializer( + this: Ajv, + sch: SchemaEnv, + definitions: SchemaObjectMap +): SchemaEnv { + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + const serializeName = gen.scopeName("serialize") + const cxt: SerializeCxt = { + self: this, + gen, + schema: sch.schema as SchemaObject, + schemaEnv: sch, + definitions, + data: N.data, + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + sch.serializeName = serializeName + gen.func(serializeName, N.data, false, () => { + gen.let(N.json, str``) + serializeCode(cxt) + gen.return(N.json) + }) + gen.optimize(this.opts.code.optimize) + const serializeFuncCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${serializeFuncCode}` + const makeSerialize = new Function(`${N.scope}`, sourceCode) + const serialize: (data: unknown) => string = makeSerialize(this.scope.get()) + this.scope.value(serializeName, {ref: serialize}) + sch.serialize = serialize + } catch (e) { + if (sourceCode) this.logger.error("Error compiling serializer, function code:", sourceCode) + delete sch.serialize + delete sch.serializeName + throw e + } finally { + this._compilations.delete(sch) + } + return sch +} + +function serializeCode(cxt: SerializeCxt): void { + let form: JTDForm | undefined + for (const key of jtdForms) { + if (key in cxt.schema) { + form = key + break + } + } + serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty) +} + +function serializeNullable(cxt: SerializeCxt, serializeForm: (_cxt: SerializeCxt) => void): void { + const {gen, schema, data} = cxt + if (!schema.nullable) return serializeForm(cxt) + gen.if( + _`${data} === undefined || ${data} === null`, + () => gen.add(N.json, _`"null"`), + () => serializeForm(cxt) + ) +} + +function serializeElements(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + gen.add(N.json, str`[`) + const first = gen.let("first", true) + gen.forOf("el", data, (el) => { + addComma(cxt, first) + serializeCode({...cxt, schema: schema.elements, data: el}) + }) + gen.add(N.json, str`]`) +} + +function serializeValues(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + gen.add(N.json, str`{`) + const first = gen.let("first", true) + gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)) + gen.add(N.json, str`}`) +} + +function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first?: Name): void { + const {gen, data} = cxt + addComma(cxt, first) + serializeString({...cxt, data: key}) + gen.add(N.json, str`:`) + const value = gen.const("value", _`${data}${getProperty(key)}`) + serializeCode({...cxt, schema, data: value}) +} + +function serializeDiscriminator(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + const {discriminator} = schema + gen.add(N.json, str`{${JSON.stringify(discriminator)}:`) + const tag = gen.const("tag", _`${data}${getProperty(discriminator)}`) + serializeString({...cxt, data: tag}) + gen.if(false) + for (const tagValue in schema.mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + const sch = schema.mapping[tagValue] + serializeSchemaProperties({...cxt, schema: sch}, discriminator) + } + gen.endIf() + gen.add(N.json, str`}`) +} + +function serializeProperties(cxt: SerializeCxt): void { + const {gen} = cxt + gen.add(N.json, str`{`) + serializeSchemaProperties(cxt) + gen.add(N.json, str`}`) +} + +function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): void { + const {gen, schema, data} = cxt + const {properties, optionalProperties} = schema + const props = keys(properties) + const optProps = keys(optionalProperties) + const allProps = allProperties(props.concat(optProps)) + let first = !discriminator + let firstProp: Name | undefined + + for (const key of props) { + if (first) first = false + else gen.add(N.json, str`,`) + serializeProperty(key, properties[key], keyValue(key)) + } + if (first) firstProp = gen.let("first", true) + for (const key of optProps) { + const value = keyValue(key) + gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () => { + addComma(cxt, firstProp) + serializeProperty(key, optionalProperties[key], value) + }) + } + if (schema.additionalProperties) { + gen.forIn("key", data, (key) => + gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, firstProp)) + ) + } + + function keys(ps?: SchemaObjectMap): string[] { + return ps ? Object.keys(ps) : [] + } + + function allProperties(ps: string[]): string[] { + if (discriminator) ps.push(discriminator) + if (new Set(ps).size !== ps.length) { + throw new Error("JTD: properties/optionalProperties/disciminator overlap") + } + return ps + } + + function keyValue(key: string): Name { + return gen.const("value", _`${data}${getProperty(key)}`) + } + + function serializeProperty(key: string, propSchema: SchemaObject, value: Name): void { + gen.add(N.json, str`${JSON.stringify(key)}:`) + serializeCode({...cxt, schema: propSchema, data: value}) + } + + function isAdditional(key: Name, ps: string[]): Code | true { + return ps.length ? and(...ps.map((p) => _`${key} !== ${p}`)) : true + } +} + +function serializeType(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + switch (schema.type) { + case "boolean": + gen.add(N.json, _`${data} ? "true" : "false"`) + break + case "string": + serializeString(cxt) + break + case "timestamp": + gen.if( + _`${data} instanceof Date`, + () => gen.add(N.json, _`'"' + ${data}.toISOString() + '"'`), + () => serializeString(cxt) + ) + break + default: + serializeNumber(cxt) + } +} + +function serializeString({gen, data}: SerializeCxt): void { + gen.add(N.json, _`${useFunc(gen, quote)}(${data})`) +} + +function serializeNumber({gen, data}: SerializeCxt): void { + gen.add(N.json, _`"" + ${data}`) +} + +function serializeRef(cxt: SerializeCxt): void { + const {gen, self, data, definitions, schema, schemaEnv} = cxt + const {ref} = schema + const refSchema = definitions[ref] + if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) + if (!hasRef(refSchema)) return serializeCode({...cxt, schema: refSchema}) + const {root} = schemaEnv + const sch = compileSerializer.call(self, new SchemaEnv({schema: refSchema, root}), definitions) + gen.add(N.json, _`${getSerialize(gen, sch)}(${data})`) +} + +function getSerialize(gen: CodeGen, sch: SchemaEnv): Code { + return sch.serialize + ? gen.scopeValue("serialize", {ref: sch.serialize}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.serialize` +} + +function serializeEmpty({gen, data}: SerializeCxt): void { + gen.add(N.json, _`JSON.stringify(${data})`) +} + +function addComma({gen}: SerializeCxt, first?: Name): void { + if (first) { + gen.if( + first, + () => gen.assign(first, false), + () => gen.add(N.json, str`,`) + ) + } else { + gen.add(N.json, str`,`) + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/types.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..1258050fdf426a085097c3858c513b95447ded94 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/jtd/types.ts @@ -0,0 +1,16 @@ +import type {SchemaObject} from "../../types" + +export type SchemaObjectMap = {[Ref in string]?: SchemaObject} + +export const jtdForms = [ + "elements", + "values", + "discriminator", + "properties", + "optionalProperties", + "enum", + "type", + "ref", +] as const + +export type JTDForm = (typeof jtdForms)[number] diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/names.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/names.ts new file mode 100644 index 0000000000000000000000000000000000000000..b4b242e175f08c9705f80e0daaec11ab6662e06a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/names.ts @@ -0,0 +1,27 @@ +import {Name} from "./codegen" + +const names = { + // validation function arguments + data: new Name("data"), // data passed to validation function + // args passed from referencing schema + valCxt: new Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below + instancePath: new Name("instancePath"), + parentData: new Name("parentData"), + parentDataProperty: new Name("parentDataProperty"), + rootData: new Name("rootData"), // root data - same as the data passed to the first/top validation function + dynamicAnchors: new Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef + // function scoped variables + vErrors: new Name("vErrors"), // null or array of validation errors + errors: new Name("errors"), // counter of validation errors + this: new Name("this"), + // "globals" + self: new Name("self"), + scope: new Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new Name("json"), + jsonPos: new Name("jsonPos"), + jsonLen: new Name("jsonLen"), + jsonPart: new Name("jsonPart"), +} + +export default names diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/ref_error.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/ref_error.ts new file mode 100644 index 0000000000000000000000000000000000000000..386bf04995827ca2e6653fee7d4095049a753955 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/ref_error.ts @@ -0,0 +1,13 @@ +import {resolveUrl, normalizeId, getFullPath} from "./resolve" +import type {UriResolver} from "../types" + +export default class MissingRefError extends Error { + readonly missingRef: string + readonly missingSchema: string + + constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`) + this.missingRef = resolveUrl(resolver, baseId, ref) + this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef)) + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/resolve.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/resolve.ts new file mode 100644 index 0000000000000000000000000000000000000000..b8c4aca394a7a3f46f7977c2e66a7ab570213e80 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/resolve.ts @@ -0,0 +1,149 @@ +import type {AnySchema, AnySchemaObject, UriResolver} from "../types" +import type Ajv from "../ajv" +import type {URIComponent} from "fast-uri" +import {eachItem} from "./util" +import * as equal from "fast-deep-equal" +import * as traverse from "json-schema-traverse" + +// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution +export type LocalRefs = {[Ref in string]?: AnySchemaObject} + +// TODO refactor to use keyword definitions +const SIMPLE_INLINED = new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const", +]) + +export function inlineRef(schema: AnySchema, limit: boolean | number = true): boolean { + if (typeof schema == "boolean") return true + if (limit === true) return !hasRef(schema) + if (!limit) return false + return countKeys(schema) <= limit +} + +const REF_KEYWORDS = new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor", +]) + +function hasRef(schema: AnySchemaObject): boolean { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) return true + const sch = schema[key] + if (Array.isArray(sch) && sch.some(hasRef)) return true + if (typeof sch == "object" && hasRef(sch)) return true + } + return false +} + +function countKeys(schema: AnySchemaObject): number { + let count = 0 + for (const key in schema) { + if (key === "$ref") return Infinity + count++ + if (SIMPLE_INLINED.has(key)) continue + if (typeof schema[key] == "object") { + eachItem(schema[key], (sch) => (count += countKeys(sch))) + } + if (count === Infinity) return Infinity + } + return count +} + +export function getFullPath(resolver: UriResolver, id = "", normalize?: boolean): string { + if (normalize !== false) id = normalizeId(id) + const p = resolver.parse(id) + return _getFullPath(resolver, p) +} + +export function _getFullPath(resolver: UriResolver, p: URIComponent): string { + const serialized = resolver.serialize(p) + return serialized.split("#")[0] + "#" +} + +const TRAILING_SLASH_HASH = /#\/?$/ +export function normalizeId(id: string | undefined): string { + return id ? id.replace(TRAILING_SLASH_HASH, "") : "" +} + +export function resolveUrl(resolver: UriResolver, baseId: string, id: string): string { + id = normalizeId(id) + return resolver.resolve(baseId, id) +} + +const ANCHOR = /^[a-z_][-a-z0-9._]*$/i + +export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs { + if (typeof schema == "boolean") return {} + const {schemaId, uriResolver} = this.opts + const schId = normalizeId(schema[schemaId] || baseId) + const baseIds: {[JsonPtr in string]?: string} = {"": schId} + const pathPrefix = getFullPath(uriResolver, schId, false) + const localRefs: LocalRefs = {} + const schemaRefs: Set = new Set() + + traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) return + const fullPath = pathPrefix + jsonPtr + let innerBaseId = baseIds[parentJsonPtr] + if (typeof sch[schemaId] == "string") innerBaseId = addRef.call(this, sch[schemaId]) + addAnchor.call(this, sch.$anchor) + addAnchor.call(this, sch.$dynamicAnchor) + baseIds[jsonPtr] = innerBaseId + + function addRef(this: Ajv, ref: string): string { + // eslint-disable-next-line @typescript-eslint/unbound-method + const _resolve = this.opts.uriResolver.resolve + ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref) + if (schemaRefs.has(ref)) throw ambiguos(ref) + schemaRefs.add(ref) + let schOrRef = this.refs[ref] + if (typeof schOrRef == "string") schOrRef = this.refs[schOrRef] + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref) + } else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref) + localRefs[ref] = sch + } else { + this.refs[ref] = fullPath + } + } + return ref + } + + function addAnchor(this: Ajv, anchor: unknown): void { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) throw new Error(`invalid anchor "${anchor}"`) + addRef.call(this, `#${anchor}`) + } + } + }) + + return localRefs + + function checkAmbiguosRef(sch1: AnySchema, sch2: AnySchema | undefined, ref: string): void { + if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref) + } + + function ambiguos(ref: string): Error { + return new Error(`reference "${ref}" resolves to more than one schema`) + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/rules.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/rules.ts new file mode 100644 index 0000000000000000000000000000000000000000..7dbf7ab9e08317ff4e893317d07962bb6df43327 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/rules.ts @@ -0,0 +1,50 @@ +import type {AddedKeywordDefinition} from "../types" + +const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"] as const + +export type JSONType = (typeof _jsonTypes)[number] + +const jsonTypes: Set = new Set(_jsonTypes) + +export function isJSONType(x: unknown): x is JSONType { + return typeof x == "string" && jsonTypes.has(x) +} + +type ValidationTypes = { + [K in JSONType]: boolean | RuleGroup | undefined +} + +export interface ValidationRules { + rules: RuleGroup[] + post: RuleGroup + all: {[Key in string]?: boolean | Rule} // rules that have to be validated + keywords: {[Key in string]?: boolean} // all known keywords (superset of "all") + types: ValidationTypes +} + +export interface RuleGroup { + type?: JSONType + rules: Rule[] +} + +// This interface wraps KeywordDefinition because definition can have multiple keywords +export interface Rule { + keyword: string + definition: AddedKeywordDefinition +} + +export function getRules(): ValidationRules { + const groups: Record<"number" | "string" | "array" | "object", RuleGroup> = { + number: {type: "number", rules: []}, + string: {type: "string", rules: []}, + array: {type: "array", rules: []}, + object: {type: "object", rules: []}, + } + return { + types: {...groups, integer: true, boolean: true, null: true}, + rules: [{rules: []}, groups.number, groups.string, groups.array, groups.object], + post: {rules: []}, + all: {}, + keywords: {}, + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/util.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/util.ts new file mode 100644 index 0000000000000000000000000000000000000000..cefae51c2bfcc01fed2b40bcbe3425c9d1c53d18 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/util.ts @@ -0,0 +1,213 @@ +import type {AnySchema, EvaluatedProperties, EvaluatedItems} from "../types" +import type {SchemaCxt, SchemaObjCxt} from "." +import {_, getProperty, Code, Name, CodeGen} from "./codegen" +import {_Code} from "./codegen/code" +import type {Rule, ValidationRules} from "./rules" + +// TODO refactor to use Set +export function toHash(arr: T[]): {[K in T]?: true} { + const hash: {[K in T]?: true} = {} + for (const item of arr) hash[item] = true + return hash +} + +export function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void { + if (typeof schema == "boolean") return schema + if (Object.keys(schema).length === 0) return true + checkUnknownRules(it, schema) + return !schemaHasRules(schema, it.self.RULES.all) +} + +export function checkUnknownRules(it: SchemaCxt, schema: AnySchema = it.schema): void { + const {opts, self} = it + if (!opts.strictSchema) return + if (typeof schema === "boolean") return + const rules = self.RULES.keywords + for (const key in schema) { + if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`) + } +} + +export function schemaHasRules( + schema: AnySchema, + rules: {[Key in string]?: boolean | Rule} +): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (rules[key]) return true + return false +} + +export function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (key !== "$ref" && RULES.all[key]) return true + return false +} + +export function schemaRefOrVal( + {topSchemaRef, schemaPath}: SchemaObjCxt, + schema: unknown, + keyword: string, + $data?: string | false +): Code | number | boolean { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") return schema + if (typeof schema == "string") return _`${schema}` + } + return _`${topSchemaRef}${schemaPath}${getProperty(keyword)}` +} + +export function unescapeFragment(str: string): string { + return unescapeJsonPointer(decodeURIComponent(str)) +} + +export function escapeFragment(str: string | number): string { + return encodeURIComponent(escapeJsonPointer(str)) +} + +export function escapeJsonPointer(str: string | number): string { + if (typeof str == "number") return `${str}` + return str.replace(/~/g, "~0").replace(/\//g, "~1") +} + +export function unescapeJsonPointer(str: string): string { + return str.replace(/~1/g, "/").replace(/~0/g, "~") +} + +export function eachItem(xs: T | T[], f: (x: T) => void): void { + if (Array.isArray(xs)) { + for (const x of xs) f(x) + } else { + f(xs) + } +} + +type SomeEvaluated = EvaluatedProperties | EvaluatedItems + +type MergeEvaluatedFunc = ( + gen: CodeGen, + from: Name | T, + to: Name | Exclude | undefined, + toName?: typeof Name +) => Name | T + +interface MakeMergeFuncArgs { + mergeNames: (gen: CodeGen, from: Name, to: Name) => void + mergeToName: (gen: CodeGen, from: T, to: Name) => void + mergeValues: (from: T, to: Exclude) => T + resultToName: (gen: CodeGen, res?: T) => Name +} + +function makeMergeEvaluated({ + mergeNames, + mergeToName, + mergeValues, + resultToName, +}: MakeMergeFuncArgs): MergeEvaluatedFunc { + return (gen, from, to, toName) => { + const res = + to === undefined + ? from + : to instanceof Name + ? (from instanceof Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) + : from instanceof Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to) + return toName === Name && !(res instanceof Name) ? resultToName(gen, res) : res + } +} + +interface MergeEvaluated { + props: MergeEvaluatedFunc + items: MergeEvaluatedFunc +} + +export const mergeEvaluated: MergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if(_`${to} !== true && ${from} !== undefined`, () => { + gen.if( + _`${from} === true`, + () => gen.assign(to, true), + () => gen.assign(to, _`${to} || {}`).code(_`Object.assign(${to}, ${from})`) + ) + }), + mergeToName: (gen, from, to) => + gen.if(_`${to} !== true`, () => { + if (from === true) { + gen.assign(to, true) + } else { + gen.assign(to, _`${to} || {}`) + setEvaluated(gen, to, from) + } + }), + mergeValues: (from, to) => (from === true ? true : {...from, ...to}), + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if(_`${to} !== true && ${from} !== undefined`, () => + gen.assign(to, _`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`) + ), + mergeToName: (gen, from, to) => + gen.if(_`${to} !== true`, () => + gen.assign(to, from === true ? true : _`${to} > ${from} ? ${to} : ${from}`) + ), + mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), + resultToName: (gen, items) => gen.var("items", items), + }), +} + +export function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name { + if (ps === true) return gen.var("props", true) + const props = gen.var("props", _`{}`) + if (ps !== undefined) setEvaluated(gen, props, ps) + return props +} + +export function setEvaluated(gen: CodeGen, props: Name, ps: {[K in string]?: true}): void { + Object.keys(ps).forEach((p) => gen.assign(_`${props}${getProperty(p)}`, true)) +} + +const snippets: {[S in string]?: _Code} = {} + +export function useFunc(gen: CodeGen, f: {code: string}): Name { + return gen.scopeValue("func", { + ref: f, + code: snippets[f.code] || (snippets[f.code] = new _Code(f.code)), + }) +} + +export enum Type { + Num, + Str, +} + +export function getErrorPath( + dataProp: Name | string | number, + dataPropType?: Type, + jsPropertySyntax?: boolean +): Code | string { + // let path + if (dataProp instanceof Name) { + const isNumber = dataPropType === Type.Num + return jsPropertySyntax + ? isNumber + ? _`"[" + ${dataProp} + "]"` + : _`"['" + ${dataProp} + "']"` + : isNumber + ? _`"/" + ${dataProp}` + : _`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")` // TODO maybe use global escapePointer + } + return jsPropertySyntax ? getProperty(dataProp).toString() : "/" + escapeJsonPointer(dataProp) +} + +export function checkStrictMode( + it: SchemaCxt, + msg: string, + mode: boolean | "log" = it.opts.strictSchema +): void { + if (!mode) return + msg = `strict mode: ${msg}` + if (mode === true) throw new Error(msg) + it.self.logger.warn(msg) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/applicability.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/applicability.ts new file mode 100644 index 0000000000000000000000000000000000000000..478b704ac571d7b34deb19ef84aa0e2dd08973e3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/applicability.ts @@ -0,0 +1,22 @@ +import type {AnySchemaObject} from "../../types" +import type {SchemaObjCxt} from ".." +import type {JSONType, RuleGroup, Rule} from "../rules" + +export function schemaHasRulesForType( + {schema, self}: SchemaObjCxt, + type: JSONType +): boolean | undefined { + const group = self.RULES.types[type] + return group && group !== true && shouldUseGroup(schema, group) +} + +export function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean { + return group.rules.some((rule) => shouldUseRule(schema, rule)) +} + +export function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined { + return ( + schema[rule.keyword] !== undefined || + rule.definition.implements?.some((kwd) => schema[kwd] !== undefined) + ) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/boolSchema.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/boolSchema.ts new file mode 100644 index 0000000000000000000000000000000000000000..156355016d62249d16c6dc19a89c28b5ff6972c7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/boolSchema.ts @@ -0,0 +1,47 @@ +import type {KeywordErrorDefinition, KeywordErrorCxt} from "../../types" +import type {SchemaCxt} from ".." +import {reportError} from "../errors" +import {_, Name} from "../codegen" +import N from "../names" + +const boolError: KeywordErrorDefinition = { + message: "boolean schema is false", +} + +export function topBoolOrEmptySchema(it: SchemaCxt): void { + const {gen, schema, validateName} = it + if (schema === false) { + falseSchemaError(it, false) + } else if (typeof schema == "object" && schema.$async === true) { + gen.return(N.data) + } else { + gen.assign(_`${validateName}.errors`, null) + gen.return(true) + } +} + +export function boolOrEmptySchema(it: SchemaCxt, valid: Name): void { + const {gen, schema} = it + if (schema === false) { + gen.var(valid, false) // TODO var + falseSchemaError(it) + } else { + gen.var(valid, true) // TODO var + } +} + +function falseSchemaError(it: SchemaCxt, overrideAllErrors?: boolean): void { + const {gen, data} = it + // TODO maybe some other interface should be used for non-keyword validation errors... + const cxt: KeywordErrorCxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + } + reportError(cxt, boolError, undefined, overrideAllErrors) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/dataType.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/dataType.ts new file mode 100644 index 0000000000000000000000000000000000000000..d8142b3e1f55194a06de0ab489ee01e00136df25 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/dataType.ts @@ -0,0 +1,230 @@ +import type { + KeywordErrorDefinition, + KeywordErrorCxt, + ErrorObject, + AnySchemaObject, +} from "../../types" +import type {SchemaObjCxt} from ".." +import {isJSONType, JSONType} from "../rules" +import {schemaHasRulesForType} from "./applicability" +import {reportError} from "../errors" +import {_, nil, and, not, operators, Code, Name} from "../codegen" +import {toHash, schemaRefOrVal} from "../util" + +export enum DataType { + Correct, + Wrong, +} + +export function getSchemaTypes(schema: AnySchemaObject): JSONType[] { + const types = getJSONTypes(schema.type) + const hasNull = types.includes("null") + if (hasNull) { + if (schema.nullable === false) throw new Error("type: null contradicts nullable: false") + } else { + if (!types.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"') + } + if (schema.nullable === true) types.push("null") + } + return types +} + +// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents +export function getJSONTypes(ts: unknown | unknown[]): JSONType[] { + const types: unknown[] = Array.isArray(ts) ? ts : ts ? [ts] : [] + if (types.every(isJSONType)) return types + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")) +} + +export function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean { + const {gen, data, opts} = it + const coerceTo = coerceToTypes(types, opts.coerceTypes) + const checkTypes = + types.length > 0 && + !(coerceTo.length === 0 && types.length === 1 && schemaHasRulesForType(it, types[0])) + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong) + gen.if(wrongType, () => { + if (coerceTo.length) coerceData(it, types, coerceTo) + else reportTypeError(it) + }) + } + return checkTypes +} + +const COERCIBLE: Set = new Set(["string", "number", "integer", "boolean", "null"]) +function coerceToTypes(types: JSONType[], coerceTypes?: boolean | "array"): JSONType[] { + return coerceTypes + ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) + : [] +} + +function coerceData(it: SchemaObjCxt, types: JSONType[], coerceTo: JSONType[]): void { + const {gen, data, opts} = it + const dataType = gen.let("dataType", _`typeof ${data}`) + const coerced = gen.let("coerced", _`undefined`) + if (opts.coerceTypes === "array") { + gen.if(_`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => + gen + .assign(data, _`${data}[0]`) + .assign(dataType, _`typeof ${data}`) + .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)) + ) + } + gen.if(_`${coerced} !== undefined`) + for (const t of coerceTo) { + if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { + coerceSpecificType(t) + } + } + gen.else() + reportTypeError(it) + gen.endIf() + + gen.if(_`${coerced} !== undefined`, () => { + gen.assign(data, coerced) + assignParentData(it, coerced) + }) + + function coerceSpecificType(t: string): void { + switch (t) { + case "string": + gen + .elseIf(_`${dataType} == "number" || ${dataType} == "boolean"`) + .assign(coerced, _`"" + ${data}`) + .elseIf(_`${data} === null`) + .assign(coerced, _`""`) + return + case "number": + gen + .elseIf( + _`${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})` + ) + .assign(coerced, _`+${data}`) + return + case "integer": + gen + .elseIf( + _`${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))` + ) + .assign(coerced, _`+${data}`) + return + case "boolean": + gen + .elseIf(_`${data} === "false" || ${data} === 0 || ${data} === null`) + .assign(coerced, false) + .elseIf(_`${data} === "true" || ${data} === 1`) + .assign(coerced, true) + return + case "null": + gen.elseIf(_`${data} === "" || ${data} === 0 || ${data} === false`) + gen.assign(coerced, null) + return + + case "array": + gen + .elseIf( + _`${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null` + ) + .assign(coerced, _`[${data}]`) + } + } +} + +function assignParentData({gen, parentData, parentDataProperty}: SchemaObjCxt, expr: Name): void { + // TODO use gen.property + gen.if(_`${parentData} !== undefined`, () => + gen.assign(_`${parentData}[${parentDataProperty}]`, expr) + ) +} + +export function checkDataType( + dataType: JSONType, + data: Name, + strictNums?: boolean | "log", + correct = DataType.Correct +): Code { + const EQ = correct === DataType.Correct ? operators.EQ : operators.NEQ + let cond: Code + switch (dataType) { + case "null": + return _`${data} ${EQ} null` + case "array": + cond = _`Array.isArray(${data})` + break + case "object": + cond = _`${data} && typeof ${data} == "object" && !Array.isArray(${data})` + break + case "integer": + cond = numCond(_`!(${data} % 1) && !isNaN(${data})`) + break + case "number": + cond = numCond() + break + default: + return _`typeof ${data} ${EQ} ${dataType}` + } + return correct === DataType.Correct ? cond : not(cond) + + function numCond(_cond: Code = nil): Code { + return and(_`typeof ${data} == "number"`, _cond, strictNums ? _`isFinite(${data})` : nil) + } +} + +export function checkDataTypes( + dataTypes: JSONType[], + data: Name, + strictNums?: boolean | "log", + correct?: DataType +): Code { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct) + } + let cond: Code + const types = toHash(dataTypes) + if (types.array && types.object) { + const notObj = _`typeof ${data} != "object"` + cond = types.null ? notObj : _`!${data} || ${notObj}` + delete types.null + delete types.array + delete types.object + } else { + cond = nil + } + if (types.number) delete types.integer + for (const t in types) cond = and(cond, checkDataType(t as JSONType, data, strictNums, correct)) + return cond +} + +export type TypeError = ErrorObject<"type", {type: string}> + +const typeError: KeywordErrorDefinition = { + message: ({schema}) => `must be ${schema}`, + params: ({schema, schemaValue}) => + typeof schema == "string" ? _`{type: ${schema}}` : _`{type: ${schemaValue}}`, +} + +export function reportTypeError(it: SchemaObjCxt): void { + const cxt = getTypeErrorContext(it) + reportError(cxt, typeError) +} + +function getTypeErrorContext(it: SchemaObjCxt): KeywordErrorCxt { + const {gen, data, schema} = it + const schemaCode = schemaRefOrVal(it, schema, "type") + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/defaults.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/defaults.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ad3d4df8291bdfd7aec74833bec4b0b4c91f36f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/defaults.ts @@ -0,0 +1,32 @@ +import type {SchemaObjCxt} from ".." +import {_, getProperty, stringify} from "../codegen" +import {checkStrictMode} from "../util" + +export function assignDefaults(it: SchemaObjCxt, ty?: string): void { + const {properties, items} = it.schema + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default) + } + } else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i: number) => assignDefault(it, i, sch.default)) + } +} + +function assignDefault(it: SchemaObjCxt, prop: string | number, defaultValue: unknown): void { + const {gen, compositeRule, data, opts} = it + if (defaultValue === undefined) return + const childData = _`${data}${getProperty(prop)}` + if (compositeRule) { + checkStrictMode(it, `default is ignored for: ${childData}`) + return + } + + let condition = _`${childData} === undefined` + if (opts.useDefaults === "empty") { + condition = _`${condition} || ${childData} === null || ${childData} === ""` + } + // `${childData} === undefined` + + // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") + gen.if(condition, _`${childData} = ${stringify(defaultValue)}`) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..15ecabd85169e3f19b56b7547982643383068552 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/index.ts @@ -0,0 +1,582 @@ +import type { + AddedKeywordDefinition, + AnySchema, + AnySchemaObject, + KeywordErrorCxt, + KeywordCxtParams, +} from "../../types" +import type {SchemaCxt, SchemaObjCxt} from ".." +import type {InstanceOptions} from "../../core" +import {boolOrEmptySchema, topBoolOrEmptySchema} from "./boolSchema" +import {coerceAndCheckDataType, getSchemaTypes} from "./dataType" +import {shouldUseGroup, shouldUseRule} from "./applicability" +import {checkDataType, checkDataTypes, reportTypeError, DataType} from "./dataType" +import {assignDefaults} from "./defaults" +import {funcKeywordCode, macroKeywordCode, validateKeywordUsage, validSchemaType} from "./keyword" +import {getSubschema, extendSubschemaData, SubschemaArgs, extendSubschemaMode} from "./subschema" +import {_, nil, str, or, not, getProperty, Block, Code, Name, CodeGen} from "../codegen" +import N from "../names" +import {resolveUrl} from "../resolve" +import { + schemaRefOrVal, + schemaHasRulesButRef, + checkUnknownRules, + checkStrictMode, + unescapeJsonPointer, + mergeEvaluated, +} from "../util" +import type {JSONType, Rule, RuleGroup} from "../rules" +import { + ErrorPaths, + reportError, + reportExtraError, + resetErrorsCount, + keyword$DataError, +} from "../errors" + +// schema compilation - generates validation function, subschemaCode (below) is used for subschemas +export function validateFunctionCode(it: SchemaCxt): void { + if (isSchemaObj(it)) { + checkKeywords(it) + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it) + return + } + } + validateFunction(it, () => topBoolOrEmptySchema(it)) +} + +function validateFunction( + {gen, validateName, schema, schemaEnv, opts}: SchemaCxt, + body: Block +): void { + if (opts.code.es5) { + gen.func(validateName, _`${N.data}, ${N.valCxt}`, schemaEnv.$async, () => { + gen.code(_`"use strict"; ${funcSourceUrl(schema, opts)}`) + destructureValCxtES5(gen, opts) + gen.code(body) + }) + } else { + gen.func(validateName, _`${N.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => + gen.code(funcSourceUrl(schema, opts)).code(body) + ) + } +} + +function destructureValCxt(opts: InstanceOptions): Code { + return _`{${N.instancePath}="", ${N.parentData}, ${N.parentDataProperty}, ${N.rootData}=${ + N.data + }${opts.dynamicRef ? _`, ${N.dynamicAnchors}={}` : nil}}={}` +} + +function destructureValCxtES5(gen: CodeGen, opts: InstanceOptions): void { + gen.if( + N.valCxt, + () => { + gen.var(N.instancePath, _`${N.valCxt}.${N.instancePath}`) + gen.var(N.parentData, _`${N.valCxt}.${N.parentData}`) + gen.var(N.parentDataProperty, _`${N.valCxt}.${N.parentDataProperty}`) + gen.var(N.rootData, _`${N.valCxt}.${N.rootData}`) + if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`${N.valCxt}.${N.dynamicAnchors}`) + }, + () => { + gen.var(N.instancePath, _`""`) + gen.var(N.parentData, _`undefined`) + gen.var(N.parentDataProperty, _`undefined`) + gen.var(N.rootData, N.data) + if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`{}`) + } + ) +} + +function topSchemaObjCode(it: SchemaObjCxt): void { + const {schema, opts, gen} = it + validateFunction(it, () => { + if (opts.$comment && schema.$comment) commentKeyword(it) + checkNoDefault(it) + gen.let(N.vErrors, null) + gen.let(N.errors, 0) + if (opts.unevaluated) resetEvaluated(it) + typeAndKeywords(it) + returnResults(it) + }) + return +} + +function resetEvaluated(it: SchemaObjCxt): void { + // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated + const {gen, validateName} = it + it.evaluated = gen.const("evaluated", _`${validateName}.evaluated`) + gen.if(_`${it.evaluated}.dynamicProps`, () => gen.assign(_`${it.evaluated}.props`, _`undefined`)) + gen.if(_`${it.evaluated}.dynamicItems`, () => gen.assign(_`${it.evaluated}.items`, _`undefined`)) +} + +function funcSourceUrl(schema: AnySchema, opts: InstanceOptions): Code { + const schId = typeof schema == "object" && schema[opts.schemaId] + return schId && (opts.code.source || opts.code.process) ? _`/*# sourceURL=${schId} */` : nil +} + +// schema compilation - this function is used recursively to generate code for sub-schemas +function subschemaCode(it: SchemaCxt, valid: Name): void { + if (isSchemaObj(it)) { + checkKeywords(it) + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid) + return + } + } + boolOrEmptySchema(it, valid) +} + +function schemaCxtHasRules({schema, self}: SchemaCxt): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (self.RULES.all[key]) return true + return false +} + +function isSchemaObj(it: SchemaCxt): it is SchemaObjCxt { + return typeof it.schema != "boolean" +} + +function subSchemaObjCode(it: SchemaObjCxt, valid: Name): void { + const {schema, gen, opts} = it + if (opts.$comment && schema.$comment) commentKeyword(it) + updateContext(it) + checkAsyncSchema(it) + const errsCount = gen.const("_errs", N.errors) + typeAndKeywords(it, errsCount) + // TODO var + gen.var(valid, _`${errsCount} === ${N.errors}`) +} + +function checkKeywords(it: SchemaObjCxt): void { + checkUnknownRules(it) + checkRefsAndKeywords(it) +} + +function typeAndKeywords(it: SchemaObjCxt, errsCount?: Name): void { + if (it.opts.jtd) return schemaKeywords(it, [], false, errsCount) + const types = getSchemaTypes(it.schema) + const checkedTypes = coerceAndCheckDataType(it, types) + schemaKeywords(it, types, !checkedTypes, errsCount) +} + +function checkRefsAndKeywords(it: SchemaObjCxt): void { + const {schema, errSchemaPath, opts, self} = it + if (schema.$ref && opts.ignoreKeywordsWithRef && schemaHasRulesButRef(schema, self.RULES)) { + self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`) + } +} + +function checkNoDefault(it: SchemaObjCxt): void { + const {schema, opts} = it + if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { + checkStrictMode(it, "default is ignored in the schema root") + } +} + +function updateContext(it: SchemaObjCxt): void { + const schId = it.schema[it.opts.schemaId] + if (schId) it.baseId = resolveUrl(it.opts.uriResolver, it.baseId, schId) +} + +function checkAsyncSchema(it: SchemaObjCxt): void { + if (it.schema.$async && !it.schemaEnv.$async) throw new Error("async schema in sync schema") +} + +function commentKeyword({gen, schemaEnv, schema, errSchemaPath, opts}: SchemaObjCxt): void { + const msg = schema.$comment + if (opts.$comment === true) { + gen.code(_`${N.self}.logger.log(${msg})`) + } else if (typeof opts.$comment == "function") { + const schemaPath = str`${errSchemaPath}/$comment` + const rootName = gen.scopeValue("root", {ref: schemaEnv.root}) + gen.code(_`${N.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`) + } +} + +function returnResults(it: SchemaCxt): void { + const {gen, schemaEnv, validateName, ValidationError, opts} = it + if (schemaEnv.$async) { + // TODO assign unevaluated + gen.if( + _`${N.errors} === 0`, + () => gen.return(N.data), + () => gen.throw(_`new ${ValidationError as Name}(${N.vErrors})`) + ) + } else { + gen.assign(_`${validateName}.errors`, N.vErrors) + if (opts.unevaluated) assignEvaluated(it) + gen.return(_`${N.errors} === 0`) + } +} + +function assignEvaluated({gen, evaluated, props, items}: SchemaCxt): void { + if (props instanceof Name) gen.assign(_`${evaluated}.props`, props) + if (items instanceof Name) gen.assign(_`${evaluated}.items`, items) +} + +function schemaKeywords( + it: SchemaObjCxt, + types: JSONType[], + typeErrors: boolean, + errsCount?: Name +): void { + const {gen, schema, data, allErrors, opts, self} = it + const {RULES} = self + if (schema.$ref && (opts.ignoreKeywordsWithRef || !schemaHasRulesButRef(schema, RULES))) { + gen.block(() => keywordCode(it, "$ref", (RULES.all.$ref as Rule).definition)) // TODO typecast + return + } + if (!opts.jtd) checkStrictTypes(it, types) + gen.block(() => { + for (const group of RULES.rules) groupKeywords(group) + groupKeywords(RULES.post) + }) + + function groupKeywords(group: RuleGroup): void { + if (!shouldUseGroup(schema, group)) return + if (group.type) { + gen.if(checkDataType(group.type, data, opts.strictNumbers)) + iterateKeywords(it, group) + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else() + reportTypeError(it) + } + gen.endIf() + } else { + iterateKeywords(it, group) + } + // TODO make it "ok" call? + if (!allErrors) gen.if(_`${N.errors} === ${errsCount || 0}`) + } +} + +function iterateKeywords(it: SchemaObjCxt, group: RuleGroup): void { + const { + gen, + schema, + opts: {useDefaults}, + } = it + if (useDefaults) assignDefaults(it, group.type) + gen.block(() => { + for (const rule of group.rules) { + if (shouldUseRule(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type) + } + } + }) +} + +function checkStrictTypes(it: SchemaObjCxt, types: JSONType[]): void { + if (it.schemaEnv.meta || !it.opts.strictTypes) return + checkContextTypes(it, types) + if (!it.opts.allowUnionTypes) checkMultipleTypes(it, types) + checkKeywordTypes(it, it.dataTypes) +} + +function checkContextTypes(it: SchemaObjCxt, types: JSONType[]): void { + if (!types.length) return + if (!it.dataTypes.length) { + it.dataTypes = types + return + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`) + } + }) + narrowSchemaTypes(it, types) +} + +function checkMultipleTypes(it: SchemaObjCxt, ts: JSONType[]): void { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword") + } +} + +function checkKeywordTypes(it: SchemaObjCxt, ts: JSONType[]): void { + const rules = it.self.RULES.all + for (const keyword in rules) { + const rule = rules[keyword] + if (typeof rule == "object" && shouldUseRule(it.schema, rule)) { + const {type} = rule.definition + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`) + } + } + } +} + +function hasApplicableType(schTs: JSONType[], kwdT: JSONType): boolean { + return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")) +} + +function includesType(ts: JSONType[], t: JSONType): boolean { + return ts.includes(t) || (t === "integer" && ts.includes("number")) +} + +function narrowSchemaTypes(it: SchemaObjCxt, withTypes: JSONType[]): void { + const ts: JSONType[] = [] + for (const t of it.dataTypes) { + if (includesType(withTypes, t)) ts.push(t) + else if (withTypes.includes("integer") && t === "number") ts.push("integer") + } + it.dataTypes = ts +} + +function strictTypesError(it: SchemaObjCxt, msg: string): void { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath + msg += ` at "${schemaPath}" (strictTypes)` + checkStrictMode(it, msg, it.opts.strictTypes) +} + +export class KeywordCxt implements KeywordErrorCxt { + readonly gen: CodeGen + readonly allErrors?: boolean + readonly keyword: string + readonly data: Name // Name referencing the current level of the data instance + readonly $data?: string | false + schema: any // keyword value in the schema + readonly schemaValue: Code | number | boolean // Code reference to keyword schema value or primitive value + readonly schemaCode: Code | number | boolean // Code reference to resolved schema value (different if schema is $data) + readonly schemaType: JSONType[] // allowed type(s) of keyword value in the schema + readonly parentSchema: AnySchemaObject + readonly errsCount?: Name // Name reference to the number of validation errors collected before this keyword, + // requires option trackErrors in keyword definition + params: KeywordCxtParams // object to pass parameters to error messages from keyword code + readonly it: SchemaObjCxt // schema compilation context (schema is guaranteed to be an object, not boolean) + readonly def: AddedKeywordDefinition + + constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string) { + validateKeywordUsage(it, def, keyword) + this.gen = it.gen + this.allErrors = it.allErrors + this.keyword = keyword + this.data = it.data + this.schema = it.schema[keyword] + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data + this.schemaValue = schemaRefOrVal(it, this.schema, keyword, this.$data) + this.schemaType = def.schemaType + this.parentSchema = it.schema + this.params = {} + this.it = it + this.def = def + + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)) + } else { + this.schemaCode = this.schemaValue + if (!validSchemaType(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`) + } + } + + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", N.errors) + } + } + + result(condition: Code, successAction?: () => void, failAction?: () => void): void { + this.failResult(not(condition), successAction, failAction) + } + + failResult(condition: Code, successAction?: () => void, failAction?: () => void): void { + this.gen.if(condition) + if (failAction) failAction() + else this.error() + if (successAction) { + this.gen.else() + successAction() + if (this.allErrors) this.gen.endIf() + } else { + if (this.allErrors) this.gen.endIf() + else this.gen.else() + } + } + + pass(condition: Code, failAction?: () => void): void { + this.failResult(not(condition), undefined, failAction) + } + + fail(condition?: Code): void { + if (condition === undefined) { + this.error() + if (!this.allErrors) this.gen.if(false) // this branch will be removed by gen.optimize + return + } + this.gen.if(condition) + this.error() + if (this.allErrors) this.gen.endIf() + else this.gen.else() + } + + fail$data(condition: Code): void { + if (!this.$data) return this.fail(condition) + const {schemaCode} = this + this.fail(_`${schemaCode} !== undefined && (${or(this.invalid$data(), condition)})`) + } + + error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void { + if (errorParams) { + this.setParams(errorParams) + this._error(append, errorPaths) + this.setParams({}) + return + } + this._error(append, errorPaths) + } + + private _error(append?: boolean, errorPaths?: ErrorPaths): void { + ;(append ? reportExtraError : reportError)(this, this.def.error, errorPaths) + } + + $dataError(): void { + reportError(this, this.def.$dataError || keyword$DataError) + } + + reset(): void { + if (this.errsCount === undefined) throw new Error('add "trackErrors" to keyword definition') + resetErrorsCount(this.gen, this.errsCount) + } + + ok(cond: Code | boolean): void { + if (!this.allErrors) this.gen.if(cond) + } + + setParams(obj: KeywordCxtParams, assign?: true): void { + if (assign) Object.assign(this.params, obj) + else this.params = obj + } + + block$data(valid: Name, codeBlock: () => void, $dataValid: Code = nil): void { + this.gen.block(() => { + this.check$data(valid, $dataValid) + codeBlock() + }) + } + + check$data(valid: Name = nil, $dataValid: Code = nil): void { + if (!this.$data) return + const {gen, schemaCode, schemaType, def} = this + gen.if(or(_`${schemaCode} === undefined`, $dataValid)) + if (valid !== nil) gen.assign(valid, true) + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()) + this.$dataError() + if (valid !== nil) gen.assign(valid, false) + } + gen.else() + } + + invalid$data(): Code { + const {gen, schemaCode, schemaType, def, it} = this + return or(wrong$DataType(), invalid$DataSchema()) + + function wrong$DataType(): Code { + if (schemaType.length) { + /* istanbul ignore if */ + if (!(schemaCode instanceof Name)) throw new Error("ajv implementation error") + const st = Array.isArray(schemaType) ? schemaType : [schemaType] + return _`${checkDataTypes(st, schemaCode, it.opts.strictNumbers, DataType.Wrong)}` + } + return nil + } + + function invalid$DataSchema(): Code { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", {ref: def.validateSchema}) // TODO value.code for standalone + return _`!${validateSchemaRef}(${schemaCode})` + } + return nil + } + } + + subschema(appl: SubschemaArgs, valid: Name): SchemaCxt { + const subschema = getSubschema(this.it, appl) + extendSubschemaData(subschema, this.it, appl) + extendSubschemaMode(subschema, appl) + const nextContext = {...this.it, ...subschema, items: undefined, props: undefined} + subschemaCode(nextContext, valid) + return nextContext + } + + mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void { + const {it, gen} = this + if (!it.opts.unevaluated) return + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = mergeEvaluated.props(gen, schemaCxt.props, it.props, toName) + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = mergeEvaluated.items(gen, schemaCxt.items, it.items, toName) + } + } + + mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void { + const {it, gen} = this + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, Name)) + return true + } + } +} + +function keywordCode( + it: SchemaObjCxt, + keyword: string, + def: AddedKeywordDefinition, + ruleType?: JSONType +): void { + const cxt = new KeywordCxt(it, def, keyword) + if ("code" in def) { + def.code(cxt, ruleType) + } else if (cxt.$data && def.validate) { + funcKeywordCode(cxt, def) + } else if ("macro" in def) { + macroKeywordCode(cxt, def) + } else if (def.compile || def.validate) { + funcKeywordCode(cxt, def) + } +} + +const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/ +const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/ +export function getData( + $data: string, + {dataLevel, dataNames, dataPathArr}: SchemaCxt +): Code | number { + let jsonPointer + let data: Code + if ($data === "") return N.rootData + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) throw new Error(`Invalid JSON-pointer: ${$data}`) + jsonPointer = $data + data = N.rootData + } else { + const matches = RELATIVE_JSON_POINTER.exec($data) + if (!matches) throw new Error(`Invalid JSON-pointer: ${$data}`) + const up: number = +matches[1] + jsonPointer = matches[2] + if (jsonPointer === "#") { + if (up >= dataLevel) throw new Error(errorMsg("property/index", up)) + return dataPathArr[dataLevel - up] + } + if (up > dataLevel) throw new Error(errorMsg("data", up)) + data = dataNames[dataLevel - up] + if (!jsonPointer) return data + } + + let expr = data + const segments = jsonPointer.split("/") + for (const segment of segments) { + if (segment) { + data = _`${data}${getProperty(unescapeJsonPointer(segment))}` + expr = _`${expr} && ${data}` + } + } + return expr + + function errorMsg(pointerType: string, up: number): string { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}` + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/keyword.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/keyword.ts new file mode 100644 index 0000000000000000000000000000000000000000..f854aa71083ca28c01f8064fdca177a847e6f308 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/keyword.ts @@ -0,0 +1,171 @@ +import type {KeywordCxt} from "." +import type { + AnySchema, + SchemaValidateFunction, + AnyValidateFunction, + AddedKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, +} from "../../types" +import type {SchemaObjCxt} from ".." +import {_, nil, not, stringify, Code, Name, CodeGen} from "../codegen" +import N from "../names" +import type {JSONType} from "../rules" +import {callValidateCode} from "../../vocabularies/code" +import {extendErrors} from "../errors" + +type KeywordCompilationResult = AnySchema | SchemaValidateFunction | AnyValidateFunction + +export function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void { + const {gen, keyword, schema, parentSchema, it} = cxt + const macroSchema = def.macro.call(it.self, schema, parentSchema, it) + const schemaRef = useKeyword(gen, keyword, macroSchema) + if (it.opts.validateSchema !== false) it.self.validateSchema(macroSchema, true) + + const valid = gen.name("valid") + cxt.subschema( + { + schema: macroSchema, + schemaPath: nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, + valid + ) + cxt.pass(valid, () => cxt.error(true)) +} + +export function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void { + const {gen, keyword, schema, parentSchema, $data, it} = cxt + checkAsyncKeyword(it, def) + const validate = + !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate + const validateRef = useKeyword(gen, keyword, validate) + const valid = gen.let("valid") + cxt.block$data(valid, validateKeyword) + cxt.ok(def.valid ?? valid) + + function validateKeyword(): void { + if (def.errors === false) { + assignValid() + if (def.modifying) modifyData(cxt) + reportErrs(() => cxt.error()) + } else { + const ruleErrs = def.async ? validateAsync() : validateSync() + if (def.modifying) modifyData(cxt) + reportErrs(() => addErrs(cxt, ruleErrs)) + } + } + + function validateAsync(): Name { + const ruleErrs = gen.let("ruleErrs", null) + gen.try( + () => assignValid(_`await `), + (e) => + gen.assign(valid, false).if( + _`${e} instanceof ${it.ValidationError as Name}`, + () => gen.assign(ruleErrs, _`${e}.errors`), + () => gen.throw(e) + ) + ) + return ruleErrs + } + + function validateSync(): Code { + const validateErrs = _`${validateRef}.errors` + gen.assign(validateErrs, null) + assignValid(nil) + return validateErrs + } + + function assignValid(_await: Code = def.async ? _`await ` : nil): void { + const passCxt = it.opts.passContext ? N.this : N.self + const passSchema = !(("compile" in def && !$data) || def.schema === false) + gen.assign( + valid, + _`${_await}${callValidateCode(cxt, validateRef, passCxt, passSchema)}`, + def.modifying + ) + } + + function reportErrs(errors: () => void): void { + gen.if(not(def.valid ?? valid), errors) + } +} + +function modifyData(cxt: KeywordCxt): void { + const {gen, data, it} = cxt + gen.if(it.parentData, () => gen.assign(data, _`${it.parentData}[${it.parentDataProperty}]`)) +} + +function addErrs(cxt: KeywordCxt, errs: Code): void { + const {gen} = cxt + gen.if( + _`Array.isArray(${errs})`, + () => { + gen + .assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) + .assign(N.errors, _`${N.vErrors}.length`) + extendErrors(cxt) + }, + () => cxt.error() + ) +} + +function checkAsyncKeyword({schemaEnv}: SchemaObjCxt, def: FuncKeywordDefinition): void { + if (def.async && !schemaEnv.$async) throw new Error("async keyword in sync schema") +} + +function useKeyword(gen: CodeGen, keyword: string, result?: KeywordCompilationResult): Name { + if (result === undefined) throw new Error(`keyword "${keyword}" failed to compile`) + return gen.scopeValue( + "keyword", + typeof result == "function" ? {ref: result} : {ref: result, code: stringify(result)} + ) +} + +export function validSchemaType( + schema: unknown, + schemaType: JSONType[], + allowUndefined = false +): boolean { + // TODO add tests + return ( + !schemaType.length || + schemaType.some((st) => + st === "array" + ? Array.isArray(schema) + : st === "object" + ? schema && typeof schema == "object" && !Array.isArray(schema) + : typeof schema == st || (allowUndefined && typeof schema == "undefined") + ) + ) +} + +export function validateKeywordUsage( + {schema, opts, self, errSchemaPath}: SchemaObjCxt, + def: AddedKeywordDefinition, + keyword: string +): void { + /* istanbul ignore if */ + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error") + } + + const deps = def.dependencies + if (deps?.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`) + } + + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]) + if (!valid) { + const msg = + `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self.errorsText(def.validateSchema.errors) + if (opts.validateSchema === "log") self.logger.error(msg) + else throw new Error(msg) + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/subschema.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/subschema.ts new file mode 100644 index 0000000000000000000000000000000000000000..9072ed7743decf23950a40033cb2c2f6ec1845e4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/compile/validate/subschema.ts @@ -0,0 +1,135 @@ +import type {AnySchema} from "../../types" +import type {SchemaObjCxt} from ".." +import {_, str, getProperty, Code, Name} from "../codegen" +import {escapeFragment, getErrorPath, Type} from "../util" +import type {JSONType} from "../rules" + +export interface SubschemaContext { + // TODO use Optional? align with SchemCxt property types + schema: AnySchema + schemaPath: Code + errSchemaPath: string + topSchemaRef?: Code + errorPath?: Code + dataLevel?: number + dataTypes?: JSONType[] + data?: Name + parentData?: Name + parentDataProperty?: Code | number + dataNames?: Name[] + dataPathArr?: (Code | number)[] + propertyName?: Name + jtdDiscriminator?: string + jtdMetadata?: boolean + compositeRule?: true + createErrors?: boolean + allErrors?: boolean +} + +export type SubschemaArgs = Partial<{ + keyword: string + schemaProp: string | number + schema: AnySchema + schemaPath: Code + errSchemaPath: string + topSchemaRef: Code + data: Name | Code + dataProp: Code | string | number + dataTypes: JSONType[] + definedProperties: Set + propertyName: Name + dataPropType: Type + jtdDiscriminator: string + jtdMetadata: boolean + compositeRule: true + createErrors: boolean + allErrors: boolean +}> + +export function getSubschema( + it: SchemaObjCxt, + {keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef}: SubschemaArgs +): SubschemaContext { + if (keyword !== undefined && schema !== undefined) { + throw new Error('both "keyword" and "schema" passed, only one allowed') + } + + if (keyword !== undefined) { + const sch = it.schema[keyword] + return schemaProp === undefined + ? { + schema: sch, + schemaPath: _`${it.schemaPath}${getProperty(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: _`${it.schemaPath}${getProperty(keyword)}${getProperty(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${escapeFragment(schemaProp)}`, + } + } + + if (schema !== undefined) { + if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"') + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath, + } + } + + throw new Error('either "keyword" or "schema" must be passed') +} + +export function extendSubschemaData( + subschema: SubschemaContext, + it: SchemaObjCxt, + {dataProp, dataPropType: dpType, data, dataTypes, propertyName}: SubschemaArgs +): void { + if (data !== undefined && dataProp !== undefined) { + throw new Error('both "data" and "dataProp" passed, only one allowed') + } + + const {gen} = it + + if (dataProp !== undefined) { + const {errorPath, dataPathArr, opts} = it + const nextData = gen.let("data", _`${it.data}${getProperty(dataProp)}`, true) + dataContextProps(nextData) + subschema.errorPath = str`${errorPath}${getErrorPath(dataProp, dpType, opts.jsPropertySyntax)}` + subschema.parentDataProperty = _`${dataProp}` + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty] + } + + if (data !== undefined) { + const nextData = data instanceof Name ? data : gen.let("data", data, true) // replaceable if used once? + dataContextProps(nextData) + if (propertyName !== undefined) subschema.propertyName = propertyName + // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr + } + + if (dataTypes) subschema.dataTypes = dataTypes + + function dataContextProps(_nextData: Name): void { + subschema.data = _nextData + subschema.dataLevel = it.dataLevel + 1 + subschema.dataTypes = [] + it.definedProperties = new Set() + subschema.parentData = it.data + subschema.dataNames = [...it.dataNames, _nextData] + } +} + +export function extendSubschemaMode( + subschema: SubschemaContext, + {jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors}: SubschemaArgs +): void { + if (compositeRule !== undefined) subschema.compositeRule = compositeRule + if (createErrors !== undefined) subschema.createErrors = createErrors + if (allErrors !== undefined) subschema.allErrors = allErrors + subschema.jtdDiscriminator = jtdDiscriminator // not inherited + subschema.jtdMetadata = jtdMetadata // not inherited +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/core.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/core.ts new file mode 100644 index 0000000000000000000000000000000000000000..e41ca3e2aa9170a8e3bf9285578d9899cb4ab2e5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/core.ts @@ -0,0 +1,891 @@ +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + AnyValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {SchemaCxt, SchemaObjCxt} from "./compile" +export interface Plugin { + (ajv: Ajv, options?: Opts): Ajv + [prop: string]: any +} + +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" + +import type { + Schema, + AnySchema, + AnySchemaObject, + SchemaObject, + AsyncSchema, + Vocabulary, + KeywordDefinition, + AddedKeywordDefinition, + AnyValidateFunction, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + Format, + AddedFormat, + RegExpEngine, + UriResolver, +} from "./types" +import type {JSONSchemaType} from "./types/json-schema" +import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +import ValidationError from "./runtime/validation_error" +import MissingRefError from "./compile/ref_error" +import {getRules, ValidationRules, Rule, RuleGroup, JSONType} from "./compile/rules" +import {SchemaEnv, compileSchema, resolveSchema} from "./compile" +import {Code, ValueScope} from "./compile/codegen" +import {normalizeId, getSchemaRefs} from "./compile/resolve" +import {getJSONTypes} from "./compile/validate/dataType" +import {eachItem} from "./compile/util" +import * as $dataRefSchema from "./refs/data.json" + +import DefaultUriResolver from "./runtime/uri" + +const defaultRegExp: RegExpEngine = (str, flags) => new RegExp(str, flags) +defaultRegExp.code = "new RegExp" + +const META_IGNORE_OPTIONS: (keyof Options)[] = ["removeAdditional", "useDefaults", "coerceTypes"] +const EXT_SCOPE_NAMES = new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error", +]) + +export type Options = CurrentOptions & DeprecatedOptions + +export interface CurrentOptions { + // strict mode options (NEW) + strict?: boolean | "log" + strictSchema?: boolean | "log" + strictNumbers?: boolean | "log" + strictTypes?: boolean | "log" + strictTuples?: boolean | "log" + strictRequired?: boolean | "log" + allowMatchingProperties?: boolean // disables a strict mode restriction + allowUnionTypes?: boolean + validateFormats?: boolean + // validation and reporting options: + $data?: boolean + allErrors?: boolean + verbose?: boolean + discriminator?: boolean + unicodeRegExp?: boolean + timestamp?: "string" | "date" // JTD only + parseDate?: boolean // JTD only + allowDate?: boolean // JTD only + $comment?: + | true + | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown) + formats?: {[Name in string]?: Format} + keywords?: Vocabulary + schemas?: AnySchema[] | {[Key in string]?: AnySchema} + logger?: Logger | false + loadSchema?: (uri: string) => Promise + // options to modify validated data: + removeAdditional?: boolean | "all" | "failing" + useDefaults?: boolean | "empty" + coerceTypes?: boolean | "array" + // advanced options: + next?: boolean // NEW + unevaluated?: boolean // NEW + dynamicRef?: boolean // NEW + schemaId?: "id" | "$id" + jtd?: boolean // NEW + meta?: SchemaObject | boolean + defaultMeta?: string | AnySchemaObject + validateSchema?: boolean | "log" + addUsedSchema?: boolean + inlineRefs?: boolean | number + passContext?: boolean + loopRequired?: number + loopEnum?: number // NEW + ownProperties?: boolean + multipleOfPrecision?: number + int32range?: boolean // JTD only + messages?: boolean + code?: CodeOptions // NEW + uriResolver?: UriResolver +} + +export interface CodeOptions { + es5?: boolean + esm?: boolean + lines?: boolean + optimize?: boolean | number + formats?: Code // code to require (or construct) map of available formats - for standalone code + source?: boolean + process?: (code: string, schema?: SchemaEnv) => string + regExp?: RegExpEngine +} + +interface InstanceCodeOptions extends CodeOptions { + regExp: RegExpEngine + optimize: number +} + +interface DeprecatedOptions { + /** @deprecated */ + ignoreKeywordsWithRef?: boolean + /** @deprecated */ + jsPropertySyntax?: boolean // added instead of jsonPointers + /** @deprecated */ + unicode?: boolean +} + +interface RemovedOptions { + format?: boolean + errorDataPath?: "object" | "property" + nullable?: boolean // "nullable" keyword is supported by default + jsonPointers?: boolean + extendRefs?: true | "ignore" | "fail" + missingRefs?: true | "ignore" | "fail" + processCode?: (code: string, schema?: SchemaEnv) => string + sourceCode?: boolean + strictDefaults?: boolean + strictKeywords?: boolean + uniqueItems?: boolean + unknownFormats?: true | string[] | "ignore" + cache?: any + serialize?: (schema: AnySchema) => unknown + ajvErrors?: boolean +} + +type OptionsInfo = { + [K in keyof T]-?: string | undefined +} + +const removedOptions: OptionsInfo = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now.", +} + +const deprecatedOptions: OptionsInfo = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.', +} + +type RequiredInstanceOptions = { + [K in + | "strictSchema" + | "strictNumbers" + | "strictTypes" + | "strictTuples" + | "strictRequired" + | "inlineRefs" + | "loopRequired" + | "loopEnum" + | "meta" + | "messages" + | "schemaId" + | "addUsedSchema" + | "validateSchema" + | "validateFormats" + | "int32range" + | "unicodeRegExp" + | "uriResolver"]: NonNullable +} & {code: InstanceCodeOptions} + +export type InstanceOptions = Options & RequiredInstanceOptions + +const MAX_EXPRESSION = 200 + +// eslint-disable-next-line complexity +function requiredOptions(o: Options): RequiredInstanceOptions { + const s = o.strict + const _optz = o.code?.optimize + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0 + const regExp = o.code?.regExp ?? defaultRegExp + const uriResolver = o.uriResolver ?? DefaultUriResolver + return { + strictSchema: o.strictSchema ?? s ?? true, + strictNumbers: o.strictNumbers ?? s ?? true, + strictTypes: o.strictTypes ?? s ?? "log", + strictTuples: o.strictTuples ?? s ?? "log", + strictRequired: o.strictRequired ?? s ?? false, + code: o.code ? {...o.code, optimize, regExp} : {optimize, regExp}, + loopRequired: o.loopRequired ?? MAX_EXPRESSION, + loopEnum: o.loopEnum ?? MAX_EXPRESSION, + meta: o.meta ?? true, + messages: o.messages ?? true, + inlineRefs: o.inlineRefs ?? true, + schemaId: o.schemaId ?? "$id", + addUsedSchema: o.addUsedSchema ?? true, + validateSchema: o.validateSchema ?? true, + validateFormats: o.validateFormats ?? true, + unicodeRegExp: o.unicodeRegExp ?? true, + int32range: o.int32range ?? true, + uriResolver: uriResolver, + } +} + +export interface Logger { + log(...args: unknown[]): unknown + warn(...args: unknown[]): unknown + error(...args: unknown[]): unknown +} + +export default class Ajv { + opts: InstanceOptions + errors?: ErrorObject[] | null // errors from the last validation + logger: Logger + // shared external scope values for compiled functions + readonly scope: ValueScope + readonly schemas: {[Key in string]?: SchemaEnv} = {} + readonly refs: {[Ref in string]?: SchemaEnv | string} = {} + readonly formats: {[Name in string]?: AddedFormat} = {} + readonly RULES: ValidationRules + readonly _compilations: Set = new Set() + private readonly _loading: {[Ref in string]?: Promise} = {} + private readonly _cache: Map = new Map() + private readonly _metaOpts: InstanceOptions + + static ValidationError = ValidationError + static MissingRefError = MissingRefError + + constructor(opts: Options = {}) { + opts = this.opts = {...opts, ...requiredOptions(opts)} + const {es5, lines} = this.opts.code + + this.scope = new ValueScope({scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines}) + this.logger = getLogger(opts.logger) + const formatOpt = opts.validateFormats + opts.validateFormats = false + + this.RULES = getRules() + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED") + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn") + this._metaOpts = getMetaSchemaOptions.call(this) + + if (opts.formats) addInitialFormats.call(this) + this._addVocabularies() + this._addDefaultMetaSchema() + if (opts.keywords) addInitialKeywords.call(this, opts.keywords) + if (typeof opts.meta == "object") this.addMetaSchema(opts.meta) + addInitialSchemas.call(this) + opts.validateFormats = formatOpt + } + + _addVocabularies(): void { + this.addKeyword("$async") + } + + _addDefaultMetaSchema(): void { + const {$data, meta, schemaId} = this.opts + let _dataRefSchema: SchemaObject = $dataRefSchema + if (schemaId === "id") { + _dataRefSchema = {...$dataRefSchema} + _dataRefSchema.id = _dataRefSchema.$id + delete _dataRefSchema.$id + } + if (meta && $data) this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false) + } + + defaultMeta(): string | AnySchemaObject | undefined { + const {meta, schemaId} = this.opts + return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined) + } + + // Validate data using schema + // AnySchema will be compiled and cached using schema itself as a key for Map + validate(schema: Schema | string, data: unknown): boolean + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise + validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + validate(schema: JTDSchemaType, data: unknown): data is T + // This overload is only intended for typescript inference, the first + // argument prevents manual type annotation from matching this overload + // eslint-disable-next-line @typescript-eslint/no-unused-vars + validate( + schema: T, + data: unknown + ): data is JTDDataType + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents + validate(schema: AsyncSchema, data: unknown | T): Promise + validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise + validate( + schemaKeyRef: AnySchema | string, // key, ref or schema object + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents + data: unknown | T // to be validated + ): boolean | Promise { + let v: AnyValidateFunction | undefined + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef) + if (!v) throw new Error(`no schema with key or ref "${schemaKeyRef}"`) + } else { + v = this.compile(schemaKeyRef) + } + + const valid = v(data) + if (!("$async" in v)) this.errors = v.errors + return valid + } + + // Create validation function for passed schema + // _meta: true if schema is a meta-schema. Used internally to compile meta schemas of user-defined keywords. + compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction + // This overload is only intended for typescript inference, the first + // argument prevents manual type annotation from matching this overload + // eslint-disable-next-line @typescript-eslint/no-unused-vars + compile( + schema: T, + _meta?: boolean + ): ValidateFunction> + compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction { + const sch = this._addSchema(schema, _meta) + return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction + } + + // Creates validating function for passed schema with asynchronous loading of missing schemas. + // `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. + // TODO allow passing schema URI + // meta - optional true to compile meta-schema + compileAsync( + schema: SchemaObject | JSONSchemaType, + _meta?: boolean + ): Promise> + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise> + compileAsync(schema: AsyncSchema, meta?: boolean): Promise> + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileAsync( + schema: AnySchemaObject, + meta?: boolean + ): Promise> + compileAsync( + schema: AnySchemaObject, + meta?: boolean + ): Promise> { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function") + } + const {loadSchema} = this.opts + return runCompileAsync.call(this, schema, meta) + + async function runCompileAsync( + this: Ajv, + _schema: AnySchemaObject, + _meta?: boolean + ): Promise { + await loadMetaSchema.call(this, _schema.$schema) + const sch = this._addSchema(_schema, _meta) + return sch.validate || _compileAsync.call(this, sch) + } + + async function loadMetaSchema(this: Ajv, $ref?: string): Promise { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, {$ref}, true) + } + } + + async function _compileAsync(this: Ajv, sch: SchemaEnv): Promise { + try { + return this._compileSchemaEnv(sch) + } catch (e) { + if (!(e instanceof MissingRefError)) throw e + checkLoaded.call(this, e) + await loadMissingSchema.call(this, e.missingSchema) + return _compileAsync.call(this, sch) + } + } + + function checkLoaded(this: Ajv, {missingSchema: ref, missingRef}: MissingRefError): void { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`) + } + } + + async function loadMissingSchema(this: Ajv, ref: string): Promise { + const _schema = await _loadSchema.call(this, ref) + if (!this.refs[ref]) await loadMetaSchema.call(this, _schema.$schema) + if (!this.refs[ref]) this.addSchema(_schema, ref, meta) + } + + async function _loadSchema(this: Ajv, ref: string): Promise { + const p = this._loading[ref] + if (p) return p + try { + return await (this._loading[ref] = loadSchema(ref)) + } finally { + delete this._loading[ref] + } + } + } + + // Adds schema to the instance + addSchema( + schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored + key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. + ): Ajv { + if (Array.isArray(schema)) { + for (const sch of schema) this.addSchema(sch, undefined, _meta, _validateSchema) + return this + } + let id: string | undefined + if (typeof schema === "object") { + const {schemaId} = this.opts + id = schema[schemaId] + if (id !== undefined && typeof id != "string") { + throw new Error(`schema ${schemaId} must be string`) + } + } + key = normalizeId(key || id) + this._checkUnique(key) + this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true) + return this + } + + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema( + schema: AnySchemaObject, + key?: string, // schema key + _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema + ): Ajv { + this.addSchema(schema, key, true, _validateSchema) + return this + } + + // Validate schema against its meta-schema + validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise { + if (typeof schema == "boolean") return true + let $schema: string | AnySchemaObject | undefined + $schema = schema.$schema + if ($schema !== undefined && typeof $schema != "string") { + throw new Error("$schema must be a string") + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta() + if (!$schema) { + this.logger.warn("meta-schema not available") + this.errors = null + return true + } + const valid = this.validate($schema, schema) + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText() + if (this.opts.validateSchema === "log") this.logger.error(message) + else throw new Error(message) + } + return valid + } + + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef: string): AnyValidateFunction | undefined { + let sch + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") keyRef = sch + if (sch === undefined) { + const {schemaId} = this.opts + const root = new SchemaEnv({schema: {}, schemaId}) + sch = resolveSchema.call(this, root, keyRef) + if (!sch) return + this.refs[keyRef] = sch + } + return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction | undefined + } + + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef) + this._removeAllSchemas(this.refs, schemaKeyRef) + return this + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas) + this._removeAllSchemas(this.refs) + this._cache.clear() + return this + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef) + if (typeof sch == "object") this._cache.delete(sch.schema) + delete this.schemas[schemaKeyRef] + delete this.refs[schemaKeyRef] + return this + } + case "object": { + const cacheKey = schemaKeyRef + this._cache.delete(cacheKey) + let id = schemaKeyRef[this.opts.schemaId] + if (id) { + id = normalizeId(id) + delete this.schemas[id] + delete this.refs[id] + } + return this + } + default: + throw new Error("ajv.removeSchema: invalid parameter") + } + } + + // add "vocabulary" - a collection of keywords + addVocabulary(definitions: Vocabulary): Ajv { + for (const def of definitions) this.addKeyword(def) + return this + } + + addKeyword( + kwdOrDef: string | KeywordDefinition, + def?: KeywordDefinition // deprecated + ): Ajv { + let keyword: string | string[] + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword") + def.keyword = keyword + } + } else if (typeof kwdOrDef == "object" && def === undefined) { + def = kwdOrDef + keyword = def.keyword + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array") + } + } else { + throw new Error("invalid addKeywords parameters") + } + + checkKeyword.call(this, keyword, def) + if (!def) { + eachItem(keyword, (kwd) => addRule.call(this, kwd)) + return this + } + keywordMetaschema.call(this, def) + const definition: AddedKeywordDefinition = { + ...def, + type: getJSONTypes(def.type), + schemaType: getJSONTypes(def.schemaType), + } + eachItem( + keyword, + definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)) + ) + return this + } + + getKeyword(keyword: string): AddedKeywordDefinition | boolean { + const rule = this.RULES.all[keyword] + return typeof rule == "object" ? rule.definition : !!rule + } + + // Remove keyword + removeKeyword(keyword: string): Ajv { + // TODO return type should be Ajv + const {RULES} = this + delete RULES.keywords[keyword] + delete RULES.all[keyword] + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword) + if (i >= 0) group.rules.splice(i, 1) + } + return this + } + + // Add format + addFormat(name: string, format: Format): Ajv { + if (typeof format == "string") format = new RegExp(format) + this.formats[name] = format + return this + } + + errorsText( + errors: ErrorObject[] | null | undefined = this.errors, // optional array of validation errors + {separator = ", ", dataVar = "data"}: ErrorsTextOptions = {} // optional options with properties `separator` and `dataVar` + ): string { + if (!errors || errors.length === 0) return "No errors" + return errors + .map((e) => `${dataVar}${e.instancePath} ${e.message}`) + .reduce((text, msg) => text + separator + msg) + } + + $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject { + const rules = this.RULES.all + metaSchema = JSON.parse(JSON.stringify(metaSchema)) + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1) // first segment is an empty string + let keywords = metaSchema + for (const seg of segments) keywords = keywords[seg] as AnySchemaObject + + for (const key in rules) { + const rule = rules[key] + if (typeof rule != "object") continue + const {$data} = rule.definition + const schema = keywords[key] as AnySchemaObject | undefined + if ($data && schema) keywords[key] = schemaOrData(schema) + } + } + + return metaSchema + } + + private _removeAllSchemas(schemas: {[Ref in string]?: SchemaEnv | string}, regex?: RegExp): void { + for (const keyRef in schemas) { + const sch = schemas[keyRef] + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef] + } else if (sch && !sch.meta) { + this._cache.delete(sch.schema) + delete schemas[keyRef] + } + } + } + } + + _addSchema( + schema: AnySchema, + meta?: boolean, + baseId?: string, + validateSchema = this.opts.validateSchema, + addSchema = this.opts.addUsedSchema + ): SchemaEnv { + let id: string | undefined + const {schemaId} = this.opts + if (typeof schema == "object") { + id = schema[schemaId] + } else { + if (this.opts.jtd) throw new Error("schema must be object") + else if (typeof schema != "boolean") throw new Error("schema must be object or boolean") + } + let sch = this._cache.get(schema) + if (sch !== undefined) return sch + + baseId = normalizeId(id || baseId) + const localRefs = getSchemaRefs.call(this, schema, baseId) + sch = new SchemaEnv({schema, schemaId, meta, baseId, localRefs}) + this._cache.set(sch.schema, sch) + if (addSchema && !baseId.startsWith("#")) { + // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) + if (baseId) this._checkUnique(baseId) + this.refs[baseId] = sch + } + if (validateSchema) this.validateSchema(schema, true) + return sch + } + + private _checkUnique(id: string): void { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`) + } + } + + private _compileSchemaEnv(sch: SchemaEnv): AnyValidateFunction { + if (sch.meta) this._compileMetaSchema(sch) + else compileSchema.call(this, sch) + + /* istanbul ignore if */ + if (!sch.validate) throw new Error("ajv implementation error") + return sch.validate + } + + private _compileMetaSchema(sch: SchemaEnv): void { + const currentOpts = this.opts + this.opts = this._metaOpts + try { + compileSchema.call(this, sch) + } finally { + this.opts = currentOpts + } + } +} + +export interface ErrorsTextOptions { + separator?: string + dataVar?: string +} + +function checkOptions( + this: Ajv, + checkOpts: OptionsInfo, + options: Options & RemovedOptions, + msg: string, + log: "warn" | "error" = "error" +): void { + for (const key in checkOpts) { + const opt = key as keyof typeof checkOpts + if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`) + } +} + +function getSchEnv(this: Ajv, keyRef: string): SchemaEnv | string | undefined { + keyRef = normalizeId(keyRef) // TODO tests fail without this line + return this.schemas[keyRef] || this.refs[keyRef] +} + +function addInitialSchemas(this: Ajv): void { + const optsSchemas = this.opts.schemas + if (!optsSchemas) return + if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas) + else for (const key in optsSchemas) this.addSchema(optsSchemas[key] as AnySchema, key) +} + +function addInitialFormats(this: Ajv): void { + for (const name in this.opts.formats) { + const format = this.opts.formats[name] + if (format) this.addFormat(name, format) + } +} + +function addInitialKeywords( + this: Ajv, + defs: Vocabulary | {[K in string]?: KeywordDefinition} +): void { + if (Array.isArray(defs)) { + this.addVocabulary(defs) + return + } + this.logger.warn("keywords option as map is deprecated, pass array") + for (const keyword in defs) { + const def = defs[keyword] as KeywordDefinition + if (!def.keyword) def.keyword = keyword + this.addKeyword(def) + } +} + +function getMetaSchemaOptions(this: Ajv): InstanceOptions { + const metaOpts = {...this.opts} + for (const opt of META_IGNORE_OPTIONS) delete metaOpts[opt] + return metaOpts +} + +const noLogs = {log() {}, warn() {}, error() {}} + +function getLogger(logger?: Partial | false): Logger { + if (logger === false) return noLogs + if (logger === undefined) return console + if (logger.log && logger.warn && logger.error) return logger as Logger + throw new Error("logger must implement log, warn and error methods") +} + +const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i + +function checkKeyword(this: Ajv, keyword: string | string[], def?: KeywordDefinition): void { + const {RULES} = this + eachItem(keyword, (kwd) => { + if (RULES.keywords[kwd]) throw new Error(`Keyword ${kwd} is already defined`) + if (!KEYWORD_NAME.test(kwd)) throw new Error(`Keyword ${kwd} has invalid name`) + }) + if (!def) return + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function') + } +} + +function addRule( + this: Ajv, + keyword: string, + definition?: AddedKeywordDefinition, + dataType?: JSONType +): void { + const post = definition?.post + if (dataType && post) throw new Error('keyword with "post" flag cannot have "type"') + const {RULES} = this + let ruleGroup = post ? RULES.post : RULES.rules.find(({type: t}) => t === dataType) + if (!ruleGroup) { + ruleGroup = {type: dataType, rules: []} + RULES.rules.push(ruleGroup) + } + RULES.keywords[keyword] = true + if (!definition) return + + const rule: Rule = { + keyword, + definition: { + ...definition, + type: getJSONTypes(definition.type), + schemaType: getJSONTypes(definition.schemaType), + }, + } + if (definition.before) addBeforeRule.call(this, ruleGroup, rule, definition.before) + else ruleGroup.rules.push(rule) + RULES.all[keyword] = rule + definition.implements?.forEach((kwd) => this.addKeyword(kwd)) +} + +function addBeforeRule(this: Ajv, ruleGroup: RuleGroup, rule: Rule, before: string): void { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before) + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule) + } else { + ruleGroup.rules.push(rule) + this.logger.warn(`rule ${before} is not defined`) + } +} + +function keywordMetaschema(this: Ajv, def: KeywordDefinition): void { + let {metaSchema} = def + if (metaSchema === undefined) return + if (def.$data && this.opts.$data) metaSchema = schemaOrData(metaSchema) + def.validateSchema = this.compile(metaSchema, true) +} + +const $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", +} + +function schemaOrData(schema: AnySchema): AnySchemaObject { + return {anyOf: [schema, $dataRef]} +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/jtd.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/jtd.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7e7bce3ba39a6339b9377cee40429daba39af72 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/jtd.ts @@ -0,0 +1,132 @@ +import type {AnySchemaObject, SchemaObject, JTDParser} from "./types" +import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +import AjvCore, {CurrentOptions} from "./core" +import jtdVocabulary from "./vocabularies/jtd" +import jtdMetaSchema from "./refs/jtd-schema" +import compileSerializer from "./compile/jtd/serialize" +import compileParser from "./compile/jtd/parse" +import {SchemaEnv} from "./compile" + +const META_SCHEMA_ID = "JTD-meta-schema" + +type JTDOptions = CurrentOptions & { + // strict mode options not supported with JTD: + strict?: never + allowMatchingProperties?: never + allowUnionTypes?: never + validateFormats?: never + // validation and reporting options not supported with JTD: + $data?: never + verbose?: boolean + $comment?: never + formats?: never + loadSchema?: never + // options to modify validated data: + useDefaults?: never + coerceTypes?: never + // advanced options: + next?: never + unevaluated?: never + dynamicRef?: never + meta?: boolean + defaultMeta?: never + inlineRefs?: boolean + loopRequired?: never + multipleOfPrecision?: never +} + +export class Ajv extends AjvCore { + constructor(opts: JTDOptions = {}) { + super({ + ...opts, + jtd: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + this.addVocabulary(jtdVocabulary) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + if (!this.opts.meta) return + this.addMetaSchema(jtdMetaSchema, META_SCHEMA_ID, false) + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } + + compileSerializer(schema: SchemaObject): (data: T) => string + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileSerializer(schema: JTDSchemaType): (data: T) => string + compileSerializer(schema: SchemaObject): (data: T) => string { + const sch = this._addSchema(schema) + return sch.serialize || this._compileSerializer(sch) + } + + compileParser(schema: SchemaObject): JTDParser + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileParser(schema: JTDSchemaType): JTDParser + compileParser(schema: SchemaObject): JTDParser { + const sch = this._addSchema(schema) + return (sch.parse || this._compileParser(sch)) as JTDParser + } + + private _compileSerializer(sch: SchemaEnv): (data: T) => string { + compileSerializer.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) + /* istanbul ignore if */ + if (!sch.serialize) throw new Error("ajv implementation error") + return sch.serialize + } + + private _compileParser(sch: SchemaEnv): JTDParser { + compileParser.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) + /* istanbul ignore if */ + if (!sch.parse) throw new Error("ajv implementation error") + return sch.parse + } +} + +module.exports = exports = Ajv +module.exports.Ajv = Ajv +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, + JTDParser, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {JTDErrorObject} from "./vocabularies/jtd" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" + +export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} +export {JTDOptions} +export {default as ValidationError} from "./runtime/validation_error" +export {default as MissingRefError} from "./compile/ref_error" diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/data.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/data.json new file mode 100644 index 0000000000000000000000000000000000000000..9ffc9f5ce05484799308bc4c78fd3a8822e9af53 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6ea7195f019ef1b91c45517db08f42daa2f0673 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts @@ -0,0 +1,28 @@ +import type Ajv from "../../core" +import type {AnySchemaObject} from "../../types" +import * as metaSchema from "./schema.json" +import * as applicator from "./meta/applicator.json" +import * as content from "./meta/content.json" +import * as core from "./meta/core.json" +import * as format from "./meta/format.json" +import * as metadata from "./meta/meta-data.json" +import * as validation from "./meta/validation.json" + +const META_SUPPORT_DATA = ["/properties"] + +export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv { + ;[ + metaSchema, + applicator, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) + return this + + function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 0000000000000000000000000000000000000000..c5e91cf2ac8469eccf444cf6501dba80dccb5c63 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 0000000000000000000000000000000000000000..b8f63734343046b3d4b74bf8a59f2380dbc67fc3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 0000000000000000000000000000000000000000..f71adbff04fe9ecc6a828823ad5dfa7366f1a60f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 0000000000000000000000000000000000000000..03ccfce26efeaff5a6e223be5154f238f633c16e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 0000000000000000000000000000000000000000..0e194326fa133b077af409486ebe1e2dca83feff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..7027a1279a014a74c170a2558100d2ca37eecac0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json new file mode 100644 index 0000000000000000000000000000000000000000..54eb7157afed6957bd7074068d7ad99498c668f3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e850d08b5cdc8ec9f41ff69581c11844c9c60af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts @@ -0,0 +1,30 @@ +import type Ajv from "../../core" +import type {AnySchemaObject} from "../../types" +import * as metaSchema from "./schema.json" +import * as applicator from "./meta/applicator.json" +import * as unevaluated from "./meta/unevaluated.json" +import * as content from "./meta/content.json" +import * as core from "./meta/core.json" +import * as format from "./meta/format-annotation.json" +import * as metadata from "./meta/meta-data.json" +import * as validation from "./meta/validation.json" + +const META_SUPPORT_DATA = ["/properties"] + +export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv { + ;[ + metaSchema, + applicator, + unevaluated, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) + return this + + function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json new file mode 100644 index 0000000000000000000000000000000000000000..674c913dab00c66865d82027bdf7748e157365fa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/applicator": true + }, + "$dynamicAnchor": "meta", + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "prefixItems": {"$ref": "#/$defs/schemaArray"}, + "items": {"$dynamicRef": "#meta"}, + "contains": {"$dynamicRef": "#meta"}, + "additionalProperties": {"$dynamicRef": "#meta"}, + "properties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "propertyNames": {"$dynamicRef": "#meta"}, + "if": {"$dynamicRef": "#meta"}, + "then": {"$dynamicRef": "#meta"}, + "else": {"$dynamicRef": "#meta"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$dynamicRef": "#meta"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$dynamicRef": "#meta"} + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json new file mode 100644 index 0000000000000000000000000000000000000000..2ae23ddb5cc30cce43646dc58b86f61b1dc7fc4c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentEncoding": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentSchema": {"$dynamicRef": "#meta"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json new file mode 100644 index 0000000000000000000000000000000000000000..4c8e5cb61657ff226186dd96e5dea6e15eb102e1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true + }, + "$dynamicAnchor": "meta", + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "$ref": "#/$defs/uriReferenceString", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": {"$ref": "#/$defs/uriString"}, + "$ref": {"$ref": "#/$defs/uriReferenceString"}, + "$anchor": {"$ref": "#/$defs/anchorString"}, + "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, + "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, + "$vocabulary": { + "type": "object", + "propertyNames": {"$ref": "#/$defs/uriString"}, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"} + } + }, + "$defs": { + "anchorString": { + "type": "string", + "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + "uriString": { + "type": "string", + "format": "uri" + }, + "uriReferenceString": { + "type": "string", + "format": "uri-reference" + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json new file mode 100644 index 0000000000000000000000000000000000000000..83c26e35f0042ebada16aba9b0c42bedd46bcb24 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true + }, + "$dynamicAnchor": "meta", + + "title": "Format vocabulary meta-schema for annotation results", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json new file mode 100644 index 0000000000000000000000000000000000000000..11946fb5019a3564afb38270af3d7806af39978c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/meta-data": true + }, + "$dynamicAnchor": "meta", + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json new file mode 100644 index 0000000000000000000000000000000000000000..5e4b203b2c26905ccef5ab90c627aaa19ee708bb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true + }, + "$dynamicAnchor": "meta", + + "title": "Unevaluated applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "unevaluatedItems": {"$dynamicRef": "#meta"}, + "unevaluatedProperties": {"$dynamicRef": "#meta"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..e0ae13d9d2063403c60e88282701b4b8f6ccd5f5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/validation": true + }, + "$dynamicAnchor": "meta", + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json new file mode 100644 index 0000000000000000000000000000000000000000..1c68270fdc6e4fa807c75bb32391ce8cb530a497 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/schema", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true, + "https://json-schema.org/draft/2020-12/vocab/applicator": true, + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, + "https://json-schema.org/draft/2020-12/vocab/validation": true, + "https://json-schema.org/draft/2020-12/vocab/meta-data": true, + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/unevaluated"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format-annotation"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", + "properties": { + "definitions": { + "$comment": "\"definitions\" has been replaced by \"$defs\".", + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "deprecated": true, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", + "type": "object", + "additionalProperties": { + "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] + }, + "deprecated": true, + "default": {} + }, + "$recursiveAnchor": { + "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", + "$ref": "meta/core#/$defs/anchorString", + "deprecated": true + }, + "$recursiveRef": { + "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", + "$ref": "meta/core#/$defs/uriReferenceString", + "deprecated": true + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-draft-06.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-draft-06.json new file mode 100644 index 0000000000000000000000000000000000000000..5410064ba8df9315d61a34a66245311f1d18db8e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-draft-07.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-draft-07.json new file mode 100644 index 0000000000000000000000000000000000000000..6a74851043623c67cbe2e1cd206da447aff752c3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-secure.json b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-secure.json new file mode 100644 index 0000000000000000000000000000000000000000..3968abd5d97e7b2cf87db34d5eb211c090b8700f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/jtd-schema.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/jtd-schema.ts new file mode 100644 index 0000000000000000000000000000000000000000..c0198128985137b24b13e40e6f41431f37b86647 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/refs/jtd-schema.ts @@ -0,0 +1,130 @@ +import {SchemaObject} from "../types" + +type MetaSchema = (root: boolean) => SchemaObject + +const shared: MetaSchema = (root) => { + const sch: SchemaObject = { + nullable: {type: "boolean"}, + metadata: { + optionalProperties: { + union: {elements: {ref: "schema"}}, + }, + additionalProperties: true, + }, + } + if (root) sch.definitions = {values: {ref: "schema"}} + return sch +} + +const emptyForm: MetaSchema = (root) => ({ + optionalProperties: shared(root), +}) + +const refForm: MetaSchema = (root) => ({ + properties: { + ref: {type: "string"}, + }, + optionalProperties: shared(root), +}) + +const typeForm: MetaSchema = (root) => ({ + properties: { + type: { + enum: [ + "boolean", + "timestamp", + "string", + "float32", + "float64", + "int8", + "uint8", + "int16", + "uint16", + "int32", + "uint32", + ], + }, + }, + optionalProperties: shared(root), +}) + +const enumForm: MetaSchema = (root) => ({ + properties: { + enum: {elements: {type: "string"}}, + }, + optionalProperties: shared(root), +}) + +const elementsForm: MetaSchema = (root) => ({ + properties: { + elements: {ref: "schema"}, + }, + optionalProperties: shared(root), +}) + +const propertiesForm: MetaSchema = (root) => ({ + properties: { + properties: {values: {ref: "schema"}}, + }, + optionalProperties: { + optionalProperties: {values: {ref: "schema"}}, + additionalProperties: {type: "boolean"}, + ...shared(root), + }, +}) + +const optionalPropertiesForm: MetaSchema = (root) => ({ + properties: { + optionalProperties: {values: {ref: "schema"}}, + }, + optionalProperties: { + additionalProperties: {type: "boolean"}, + ...shared(root), + }, +}) + +const discriminatorForm: MetaSchema = (root) => ({ + properties: { + discriminator: {type: "string"}, + mapping: { + values: { + metadata: { + union: [propertiesForm(false), optionalPropertiesForm(false)], + }, + }, + }, + }, + optionalProperties: shared(root), +}) + +const valuesForm: MetaSchema = (root) => ({ + properties: { + values: {ref: "schema"}, + }, + optionalProperties: shared(root), +}) + +const schema: MetaSchema = (root) => ({ + metadata: { + union: [ + emptyForm, + refForm, + typeForm, + enumForm, + elementsForm, + propertiesForm, + optionalPropertiesForm, + discriminatorForm, + valuesForm, + ].map((s) => s(root)), + }, +}) + +const jtdMetaSchema: SchemaObject = { + definitions: { + schema: schema(false), + }, + ...schema(true), +} + +export default jtdMetaSchema diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/equal.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/equal.ts new file mode 100644 index 0000000000000000000000000000000000000000..3cb00631a2363720e822255d0911a54439512c3c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/equal.ts @@ -0,0 +1,7 @@ +// https://github.com/ajv-validator/ajv/issues/889 +import * as equal from "fast-deep-equal" + +type Equal = typeof equal & {code: string} +;(equal as Equal).code = 'require("ajv/dist/runtime/equal").default' + +export default equal as Equal diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/parseJson.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/parseJson.ts new file mode 100644 index 0000000000000000000000000000000000000000..472e5e50786f2cff1092ac1353508ac0fcebce9e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/parseJson.ts @@ -0,0 +1,177 @@ +const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/ + +export function parseJson(s: string, pos: number): unknown { + let endPos: number | undefined + parseJson.message = undefined + let matches: RegExpExecArray | null + if (pos) s = s.slice(pos) + try { + parseJson.position = pos + s.length + return JSON.parse(s) + } catch (e) { + matches = rxParseJson.exec((e as Error).message) + if (!matches) { + parseJson.message = "unexpected end" + return undefined + } + endPos = +matches[1] + const c = s[endPos] + s = s.slice(0, endPos) + parseJson.position = pos + endPos + try { + return JSON.parse(s) + } catch (e1) { + parseJson.message = `unexpected token ${c}` + return undefined + } + } +} + +parseJson.message = undefined as string | undefined +parseJson.position = 0 as number +parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson' + +export function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined { + let numStr = "" + let c: string + parseJsonNumber.message = undefined + if (s[pos] === "-") { + numStr += "-" + pos++ + } + if (s[pos] === "0") { + numStr += "0" + pos++ + } else { + if (!parseDigits(maxDigits)) { + errorMessage() + return undefined + } + } + if (maxDigits) { + parseJsonNumber.position = pos + return +numStr + } + if (s[pos] === ".") { + numStr += "." + pos++ + if (!parseDigits()) { + errorMessage() + return undefined + } + } + if (((c = s[pos]), c === "e" || c === "E")) { + numStr += "e" + pos++ + if (((c = s[pos]), c === "+" || c === "-")) { + numStr += c + pos++ + } + if (!parseDigits()) { + errorMessage() + return undefined + } + } + parseJsonNumber.position = pos + return +numStr + + function parseDigits(maxLen?: number): boolean { + let digit = false + while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { + digit = true + numStr += c + pos++ + } + return digit + } + + function errorMessage(): void { + parseJsonNumber.position = pos + parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end" + } +} + +parseJsonNumber.message = undefined as string | undefined +parseJsonNumber.position = 0 as number +parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber' + +const escapedChars: {[X in string]?: string} = { + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: "\t", + '"': '"', + "/": "/", + "\\": "\\", +} + +const CODE_A: number = "a".charCodeAt(0) +const CODE_0: number = "0".charCodeAt(0) + +export function parseJsonString(s: string, pos: number): string | undefined { + let str = "" + let c: string | undefined + parseJsonString.message = undefined + // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition + while (true) { + c = s[pos++] + if (c === '"') break + if (c === "\\") { + c = s[pos] + if (c in escapedChars) { + str += escapedChars[c] + pos++ + } else if (c === "u") { + pos++ + let count = 4 + let code = 0 + while (count--) { + code <<= 4 + c = s[pos] + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (c === undefined) { + errorMessage("unexpected end") + return undefined + } + c = c.toLowerCase() + if (c >= "a" && c <= "f") { + code += c.charCodeAt(0) - CODE_A + 10 + } else if (c >= "0" && c <= "9") { + code += c.charCodeAt(0) - CODE_0 + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + pos++ + } + str += String.fromCharCode(code) + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + } else if (c === undefined) { + errorMessage("unexpected end") + return undefined + } else { + if (c.charCodeAt(0) >= 0x20) { + str += c + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + } + } + parseJsonString.position = pos + return str + + function errorMessage(msg: string): void { + parseJsonString.position = pos + parseJsonString.message = msg + } +} + +parseJsonString.message = undefined as string | undefined +parseJsonString.position = 0 as number +parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString' diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/quote.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/quote.ts new file mode 100644 index 0000000000000000000000000000000000000000..1160e6a23807cf7fc0f4d036ddc45bd962562275 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/quote.ts @@ -0,0 +1,31 @@ +const rxEscapable = + // eslint-disable-next-line no-control-regex, no-misleading-character-class + /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g + +const escaped: {[K in string]?: string} = { + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + '"': '\\"', + "\\": "\\\\", +} + +export default function quote(s: string): string { + rxEscapable.lastIndex = 0 + return ( + '"' + + (rxEscapable.test(s) + ? s.replace(rxEscapable, (a) => { + const c = escaped[a] + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) + }) + : s) + + '"' + ) +} + +quote.code = 'require("ajv/dist/runtime/quote").default' diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/re2.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/re2.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c769bc7aefc5aa1924e2be877d39bc59670ab3f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/re2.ts @@ -0,0 +1,6 @@ +import * as re2 from "re2" + +type Re2 = typeof re2 & {code: string} +;(re2 as Re2).code = 'require("ajv/dist/runtime/re2").default' + +export default re2 as Re2 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/timestamp.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/timestamp.ts new file mode 100644 index 0000000000000000000000000000000000000000..1625f9a40f4443fde14743a6a8ecb6c1dc8fb819 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/timestamp.ts @@ -0,0 +1,46 @@ +const DT_SEPARATOR = /t|\s/i +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ +const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + +export default function validTimestamp(str: string, allowDate: boolean): boolean { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dt: string[] = str.split(DT_SEPARATOR) + return ( + (dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || + (allowDate && dt.length === 1 && validDate(dt[0])) + ) +} + +function validDate(str: string): boolean { + const matches: string[] | null = DATE.exec(str) + if (!matches) return false + const y: number = +matches[1] + const m: number = +matches[2] + const d: number = +matches[3] + return ( + m >= 1 && + m <= 12 && + d >= 1 && + (d <= DAYS[m] || + // leap year: https://tools.ietf.org/html/rfc3339#appendix-C + (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0))) + ) +} + +function validTime(str: string): boolean { + const matches: string[] | null = TIME.exec(str) + if (!matches) return false + const hr: number = +matches[1] + const min: number = +matches[2] + const sec: number = +matches[3] + const tzH: number = +(matches[4] || 0) + const tzM: number = +(matches[5] || 0) + return ( + (hr <= 23 && min <= 59 && sec <= 59) || + // leap second + (hr - tzH === 23 && min - tzM === 59 && sec === 60) + ) +} + +validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default' diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/ucs2length.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/ucs2length.ts new file mode 100644 index 0000000000000000000000000000000000000000..47d8292b83fde4619bdbf28b89e6720824a97164 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/ucs2length.ts @@ -0,0 +1,20 @@ +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +export default function ucs2length(str: string): number { + const len = str.length + let length = 0 + let pos = 0 + let value: number + while (pos < len) { + length++ + value = str.charCodeAt(pos++) + if (value >= 0xd800 && value <= 0xdbff && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos) + if ((value & 0xfc00) === 0xdc00) pos++ // low surrogate + } + } + return length +} + +ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default' diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/uri.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/uri.ts new file mode 100644 index 0000000000000000000000000000000000000000..5450549cd5a3968f163460d3c0fb1aeb7ffc2b2c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/uri.ts @@ -0,0 +1,6 @@ +import * as uri from "fast-uri" + +type URI = typeof uri & {code: string} +;(uri as URI).code = 'require("ajv/dist/runtime/uri").default' + +export default uri as URI diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/validation_error.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/validation_error.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d19a46a2245c667f479d7ee51d1d9558cd9ae90 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/runtime/validation_error.ts @@ -0,0 +1,13 @@ +import type {ErrorObject} from "../types" + +export default class ValidationError extends Error { + readonly errors: Partial[] + readonly ajv: true + readonly validation: true + + constructor(errors: Partial[]) { + super("validation failed") + this.errors = errors + this.ajv = this.validation = true + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/standalone/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/standalone/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6129ce9e5ebab51fe4f53ffa86dbacd12878ed9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/standalone/index.ts @@ -0,0 +1,100 @@ +import type AjvCore from "../core" +import type {AnyValidateFunction, SourceCode} from "../types" +import type {SchemaEnv} from "../compile" +import {UsedScopeValues, UsedValueState, ValueScopeName, varKinds} from "../compile/codegen/scope" +import {_, nil, _Code, Code, getProperty, getEsmExportName} from "../compile/codegen/code" + +function standaloneCode( + ajv: AjvCore, + refsOrFunc?: {[K in string]?: string} | AnyValidateFunction +): string { + if (!ajv.opts.code.source) { + throw new Error("moduleCode: ajv instance must have code.source option") + } + const {_n} = ajv.scope.opts + return typeof refsOrFunc == "function" + ? funcExportCode(refsOrFunc.source) + : refsOrFunc !== undefined + ? multiExportsCode(refsOrFunc, getValidate) + : multiExportsCode(ajv.schemas, (sch) => + sch.meta ? undefined : ajv.compile(sch.schema) + ) + + function getValidate(id: string): AnyValidateFunction { + const v = ajv.getSchema(id) + if (!v) throw new Error(`moduleCode: no schema with id ${id}`) + return v + } + + function funcExportCode(source?: SourceCode): string { + const usedValues: UsedScopeValues = {} + const n = source?.validateName + const vCode = validateCode(usedValues, source) + if (ajv.opts.code.esm) { + // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value + return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}` + } + return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}` + } + + function multiExportsCode( + schemas: {[K in string]?: T}, + getValidateFunc: (schOrId: T) => AnyValidateFunction | undefined + ): string { + const usedValues: UsedScopeValues = {} + let code = _`"use strict";` + for (const name in schemas) { + const v = getValidateFunc(schemas[name] as T) + if (v) { + const vCode = validateCode(usedValues, v.source) + const exportSyntax = ajv.opts.code.esm + ? _`export const ${getEsmExportName(name)}` + : _`exports${getProperty(name)}` + code = _`${code}${_n}${exportSyntax} = ${v.source?.validateName};${_n}${vCode}` + } + } + return `${code}` + } + + function validateCode(usedValues: UsedScopeValues, s?: SourceCode): Code { + if (!s) throw new Error('moduleCode: function does not have "source" property') + if (usedState(s.validateName) === UsedValueState.Completed) return nil + setUsedState(s.validateName, UsedValueState.Started) + + const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode) + const code = new _Code(`${scopeCode}${_n}${s.validateCode}`) + return s.evaluated ? _`${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code + + function refValidateCode(n: ValueScopeName): Code | undefined { + const vRef = n.value?.ref + if (n.prefix === "validate" && typeof vRef == "function") { + const v = vRef as AnyValidateFunction + return validateCode(usedValues, v.source) + } else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { + const {validate, validateName} = vRef as SchemaEnv + if (!validateName) throw new Error("ajv internal error") + const def = ajv.opts.code.es5 ? varKinds.var : varKinds.const + const wrapper = _`${def} ${n} = {validate: ${validateName}};` + if (usedState(validateName) === UsedValueState.Started) return wrapper + const vCode = validateCode(usedValues, validate?.source) + return _`${wrapper}${_n}${vCode}` + } + return undefined + } + + function usedState(name: ValueScopeName): UsedValueState | undefined { + return usedValues[name.prefix]?.get(name) + } + + function setUsedState(name: ValueScopeName, state: UsedValueState): void { + const {prefix} = name + const names = (usedValues[prefix] = usedValues[prefix] || new Map()) + names.set(name, state) + } + } +} + +module.exports = exports = standaloneCode +Object.defineProperty(exports, "__esModule", {value: true}) + +export default standaloneCode diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/standalone/instance.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/standalone/instance.ts new file mode 100644 index 0000000000000000000000000000000000000000..c4b2c30b58f0ebc89b4c8e1010e5976216c0042f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/standalone/instance.ts @@ -0,0 +1,36 @@ +import Ajv, {AnySchema, AnyValidateFunction, ErrorObject} from "../core" +import standaloneCode from "." +import * as requireFromString from "require-from-string" + +export default class AjvPack { + errors?: ErrorObject[] | null // errors from the last validation + constructor(readonly ajv: Ajv) {} + + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise { + return Ajv.prototype.validate.call(this, schemaKeyRef, data) + } + + compile(schema: AnySchema, meta?: boolean): AnyValidateFunction { + return this.getStandalone(this.ajv.compile(schema, meta)) + } + + getSchema(keyRef: string): AnyValidateFunction | undefined { + const v = this.ajv.getSchema(keyRef) + if (!v) return undefined + return this.getStandalone(v) + } + + private getStandalone(v: AnyValidateFunction): AnyValidateFunction { + return requireFromString(standaloneCode(this.ajv, v)) as AnyValidateFunction + } + + addSchema(...args: Parameters): AjvPack { + this.ajv.addSchema.call(this.ajv, ...args) + return this + } + + addKeyword(...args: Parameters): AjvPack { + this.ajv.addKeyword.call(this.ajv, ...args) + return this + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..39bc51b0b99d79b09e3e5f0e2d0d48e7bf37c069 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/index.ts @@ -0,0 +1,244 @@ +import {URIComponent} from "fast-uri" +import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen" +import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile" +import type {JSONType} from "../compile/rules" +import type {KeywordCxt} from "../compile/validate" +import type Ajv from "../core" + +interface _SchemaObject { + id?: string + $id?: string + $schema?: string + [x: string]: any // TODO +} + +export interface SchemaObject extends _SchemaObject { + id?: string + $id?: string + $schema?: string + $async?: false + [x: string]: any // TODO +} + +export interface AsyncSchema extends _SchemaObject { + $async: true +} + +export type AnySchemaObject = SchemaObject | AsyncSchema + +export type Schema = SchemaObject | boolean + +export type AnySchema = Schema | AsyncSchema + +export type SchemaMap = {[Key in string]?: AnySchema} + +export interface SourceCode { + validateName: ValueScopeName + validateCode: string + scopeValues: ScopeValueSets + evaluated?: Code +} + +export interface DataValidationCxt { + instancePath: string + parentData: {[K in T]: any} // object or array + parentDataProperty: T // string or number + rootData: Record | any[] + dynamicAnchors: {[Ref in string]?: ValidateFunction} +} + +export interface ValidateFunction { + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents + (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T + errors?: null | ErrorObject[] + evaluated?: Evaluated + schema: AnySchema + schemaEnv: SchemaEnv + source?: SourceCode +} + +export interface JTDParser { + (json: string): T | undefined + message?: string + position?: number +} + +export type EvaluatedProperties = {[K in string]?: true} | true + +export type EvaluatedItems = number | true + +export interface Evaluated { + // determined at compile time if staticProps/Items is true + props?: EvaluatedProperties + items?: EvaluatedItems + // whether props/items determined at compile time + dynamicProps: boolean + dynamicItems: boolean +} + +export interface AsyncValidateFunction extends ValidateFunction { + (...args: Parameters>): Promise + $async: true +} + +export type AnyValidateFunction = ValidateFunction | AsyncValidateFunction + +export interface ErrorObject, S = unknown> { + keyword: K + instancePath: string + schemaPath: string + params: P + // Added to validation errors of "propertyNames" keyword schema + propertyName?: string + // Excluded if option `messages` set to false. + message?: string + // These are added with the `verbose` option. + schema?: S + parentSchema?: AnySchemaObject + data?: unknown +} + +export type ErrorNoParams = ErrorObject, S> + +interface _KeywordDef { + keyword: string | string[] + type?: JSONType | JSONType[] // data types that keyword applies to + schemaType?: JSONType | JSONType[] // allowed type(s) of keyword value in the schema + allowUndefined?: boolean // used for keywords that can be invoked by other keywords, not being present in the schema + $data?: boolean // keyword supports [$data reference](../../docs/guide/combining-schemas.md#data-reference) + implements?: string[] // other schema keywords that this keyword implements + before?: string // keyword should be executed before this keyword (should be applicable to the same type) + post?: boolean // keyword should be executed after other keywords without post flag + metaSchema?: AnySchemaObject // meta-schema for keyword schema value - it is better to use schemaType where applicable + validateSchema?: AnyValidateFunction // compiled keyword metaSchema - should not be passed + dependencies?: string[] // keywords that must be present in the same schema + error?: KeywordErrorDefinition + $dataError?: KeywordErrorDefinition +} + +export interface CodeKeywordDefinition extends _KeywordDef { + code: (cxt: KeywordCxt, ruleType?: string) => void + trackErrors?: boolean +} + +export type MacroKeywordFunc = ( + schema: any, + parentSchema: AnySchemaObject, + it: SchemaCxt +) => AnySchema + +export type CompileKeywordFunc = ( + schema: any, + parentSchema: AnySchemaObject, + it: SchemaObjCxt +) => DataValidateFunction + +export interface DataValidateFunction { + (...args: Parameters): boolean | Promise + errors?: Partial[] +} + +export interface SchemaValidateFunction { + ( + schema: any, + data: any, + parentSchema?: AnySchemaObject, + dataCxt?: DataValidationCxt + ): boolean | Promise + errors?: Partial[] +} + +export interface FuncKeywordDefinition extends _KeywordDef { + validate?: SchemaValidateFunction | DataValidateFunction + compile?: CompileKeywordFunc + // schema: false makes validate not to expect schema (DataValidateFunction) + schema?: boolean // requires "validate" + modifying?: boolean + async?: boolean + valid?: boolean + errors?: boolean | "full" +} + +export interface MacroKeywordDefinition extends FuncKeywordDefinition { + macro: MacroKeywordFunc +} + +export type KeywordDefinition = + | CodeKeywordDefinition + | FuncKeywordDefinition + | MacroKeywordDefinition + +export type AddedKeywordDefinition = KeywordDefinition & { + type: JSONType[] + schemaType: JSONType[] +} + +export interface KeywordErrorDefinition { + message: string | Code | ((cxt: KeywordErrorCxt) => string | Code) + params?: Code | ((cxt: KeywordErrorCxt) => Code) +} + +export type Vocabulary = (KeywordDefinition | string)[] + +export interface KeywordErrorCxt { + gen: CodeGen + keyword: string + data: Name + $data?: string | false + schema: any // TODO + parentSchema?: AnySchemaObject + schemaCode: Code | number | boolean + schemaValue: Code | number | boolean + schemaType?: JSONType[] + errsCount?: Name + params: KeywordCxtParams + it: SchemaCxt +} + +export type KeywordCxtParams = {[P in string]?: Code | string | number} + +export type FormatValidator = (data: T) => boolean + +export type FormatCompare = (data1: T, data2: T) => number | undefined + +export type AsyncFormatValidator = (data: T) => Promise + +export interface FormatDefinition { + type?: T extends string ? "string" | undefined : "number" + validate: FormatValidator | (T extends string ? string | RegExp : never) + async?: false | undefined + compare?: FormatCompare +} + +export interface AsyncFormatDefinition { + type?: T extends string ? "string" | undefined : "number" + validate: AsyncFormatValidator + async: true + compare?: FormatCompare +} + +export type AddedFormat = + | true + | RegExp + | FormatValidator + | FormatDefinition + | FormatDefinition + | AsyncFormatDefinition + | AsyncFormatDefinition + +export type Format = AddedFormat | string + +export interface RegExpEngine { + (pattern: string, u: string): RegExpLike + code: string +} + +export interface RegExpLike { + test: (s: string) => boolean +} + +export interface UriResolver { + parse(uri: string): URIComponent + resolve(base: string, path: string): string + serialize(component: URIComponent): string +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/json-schema.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/json-schema.ts new file mode 100644 index 0000000000000000000000000000000000000000..065c972e54a179b74e9dee48fdea8a1c2d45c8a1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/json-schema.ts @@ -0,0 +1,187 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +type StrictNullChecksWrapper = undefined extends null + ? `strictNullChecks must be true in tsconfig to use ${Name}` + : Type + +type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void + ? I + : never + +export type SomeJSONSchema = UncheckedJSONSchemaType + +type UncheckedPartialSchema = Partial> + +export type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema> + +type JSONType = IsPartial extends true + ? T | undefined + : T + +interface NumberKeywords { + minimum?: number + maximum?: number + exclusiveMinimum?: number + exclusiveMaximum?: number + multipleOf?: number + format?: string +} + +interface StringKeywords { + minLength?: number + maxLength?: number + pattern?: string + format?: string +} + +type UncheckedJSONSchemaType = ( + | // these two unions allow arbitrary unions of types + { + anyOf: readonly UncheckedJSONSchemaType[] + } + | { + oneOf: readonly UncheckedJSONSchemaType[] + } + // this union allows for { type: (primitive)[] } style schemas + | ({ + type: readonly (T extends number + ? JSONType<"number" | "integer", IsPartial> + : T extends string + ? JSONType<"string", IsPartial> + : T extends boolean + ? JSONType<"boolean", IsPartial> + : never)[] + } & UnionToIntersection< + T extends number + ? NumberKeywords + : T extends string + ? StringKeywords + : T extends boolean + ? // eslint-disable-next-line @typescript-eslint/ban-types + {} + : never + >) + // this covers "normal" types; it's last so typescript looks to it first for errors + | ((T extends number + ? { + type: JSONType<"number" | "integer", IsPartial> + } & NumberKeywords + : T extends string + ? { + type: JSONType<"string", IsPartial> + } & StringKeywords + : T extends boolean + ? { + type: JSONType<"boolean", IsPartial> + } + : T extends readonly [any, ...any[]] + ? { + // JSON AnySchema for tuple + type: JSONType<"array", IsPartial> + items: { + readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable + } & {length: T["length"]} + minItems: T["length"] + } & ({maxItems: T["length"]} | {additionalItems: false}) + : T extends readonly any[] + ? { + type: JSONType<"array", IsPartial> + items: UncheckedJSONSchemaType + contains?: UncheckedPartialSchema + minItems?: number + maxItems?: number + minContains?: number + maxContains?: number + uniqueItems?: true + additionalItems?: never + } + : T extends Record + ? { + // JSON AnySchema for records and dictionaries + // "required" is not optional because it is often forgotten + // "properties" are optional for more concise dictionary schemas + // "patternProperties" and can be only used with interfaces that have string index + type: JSONType<"object", IsPartial> + additionalProperties?: boolean | UncheckedJSONSchemaType + unevaluatedProperties?: boolean | UncheckedJSONSchemaType + properties?: IsPartial extends true + ? Partial> + : UncheckedPropertiesSchema + patternProperties?: Record> + propertyNames?: Omit, "type"> & {type?: "string"} + dependencies?: {[K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema} + dependentRequired?: {[K in keyof T]?: readonly (keyof T)[]} + dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema} + minProperties?: number + maxProperties?: number + } & (IsPartial extends true // "required" is not necessary if it's a non-partial type with no required keys // are listed it only asserts that optional cannot be listed. // "required" type does not guarantee that all required properties + ? {required: readonly (keyof T)[]} + : [UncheckedRequiredMembers] extends [never] + ? {required?: readonly UncheckedRequiredMembers[]} + : {required: readonly UncheckedRequiredMembers[]}) + : T extends null + ? { + type: JSONType<"null", IsPartial> + nullable: true + } + : never) & { + allOf?: readonly UncheckedPartialSchema[] + anyOf?: readonly UncheckedPartialSchema[] + oneOf?: readonly UncheckedPartialSchema[] + if?: UncheckedPartialSchema + then?: UncheckedPartialSchema + else?: UncheckedPartialSchema + not?: UncheckedPartialSchema + }) +) & { + [keyword: string]: any + $id?: string + $ref?: string + $defs?: Record> + definitions?: Record> +} + +export type JSONSchemaType = StrictNullChecksWrapper< + "JSONSchemaType", + UncheckedJSONSchemaType +> + +type Known = + | {[key: string]: Known} + | [Known, ...Known[]] + | Known[] + | number + | string + | boolean + | null + +type UncheckedPropertiesSchema = { + [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | {$ref: string} +} + +export type PropertiesSchema = StrictNullChecksWrapper< + "PropertiesSchema", + UncheckedPropertiesSchema +> + +type UncheckedRequiredMembers = { + [K in keyof T]-?: undefined extends T[K] ? never : K +}[keyof T] + +export type RequiredMembers = StrictNullChecksWrapper< + "RequiredMembers", + UncheckedRequiredMembers +> + +type Nullable = undefined extends T + ? { + nullable: true + const?: null // any non-null value would fail `const: null`, `null` would fail any other value in const + enum?: readonly (T | null)[] // `null` must be explicitly included in "enum" for `null` to pass + default?: T | null + } + : { + nullable?: false + const?: T + enum?: readonly T[] + default?: T + } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/jtd-schema.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/jtd-schema.ts new file mode 100644 index 0000000000000000000000000000000000000000..61b2bde81d5f5d407971855d0a2c8125aeb53463 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/types/jtd-schema.ts @@ -0,0 +1,273 @@ +/** numeric strings */ +type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" + +/** string strings */ +type StringType = "string" | "timestamp" + +/** Generic JTD Schema without inference of the represented type */ +export type SomeJTDSchemaType = ( + | // ref + {ref: string} + // primitives + | {type: NumberType | StringType | "boolean"} + // enum + | {enum: string[]} + // elements + | {elements: SomeJTDSchemaType} + // values + | {values: SomeJTDSchemaType} + // properties + | { + properties: Record + optionalProperties?: Record + additionalProperties?: boolean + } + | { + properties?: Record + optionalProperties: Record + additionalProperties?: boolean + } + // discriminator + | {discriminator: string; mapping: Record} + // empty + // NOTE see the end of + // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492 + // eslint-disable-next-line @typescript-eslint/ban-types + | {} +) & { + nullable?: boolean + metadata?: Record + definitions?: Record +} + +/** required keys of an object, not undefined */ +type RequiredKeys = { + [K in keyof T]-?: undefined extends T[K] ? never : K +}[keyof T] + +/** optional or undifined-able keys of an object */ +type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] ? K : never +}[keyof T] + +/** type is true if T is a union type */ +type IsUnion_ = false extends ( + T extends unknown ? ([U] extends [T] ? false : true) : never +) + ? false + : true +type IsUnion = IsUnion_ + +/** type is true if T is identically E */ +type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false + +/** type is true if T or null is identically E or null*/ +type NullTypeEquality = TypeEquality + +/** gets only the string literals of a type or null if a type isn't a string literal */ +type EnumString = [T] extends [never] + ? null + : T extends string + ? string extends T + ? null + : T + : null + +/** true if type is a union of string literals */ +type IsEnum = null extends EnumString ? false : true + +/** true only if all types are array types (not tuples) */ +// NOTE relies on the fact that tuples don't have an index at 0.5, but arrays +// have an index at every number +type IsElements = false extends IsUnion + ? [T] extends [readonly unknown[]] + ? undefined extends T[0.5] + ? false + : true + : false + : false + +/** true if the the type is a values type */ +type IsValues = false extends IsUnion ? TypeEquality : false + +/** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */ +type IsRecord = Union extends IsUnion + ? null extends EnumString + ? false + : true + : false + +/** true if type represents an empty record */ +type IsEmptyRecord = [T] extends [Record] + ? [T] extends [never] + ? false + : true + : false + +/** actual schema */ +export type JTDSchemaType = Record> = ( + | // refs - where null wasn't specified, must match exactly + (null extends EnumString + ? never + : + | ({[K in keyof D]: [T] extends [D[K]] ? {ref: K} : never}[keyof D] & {nullable?: false}) + // nulled refs - if ref is nullable and nullable is specified, then it can + // match either null or non-null definitions + | (null extends T + ? { + [K in keyof D]: [Exclude] extends [Exclude] + ? {ref: K} + : never + }[keyof D] & {nullable: true} + : never)) + // empty - empty schemas also treat nullable differently in that it's now fully ignored + | (unknown extends T ? {nullable?: boolean} : never) + // all other types // numbers - only accepts the type number + | ((true extends NullTypeEquality + ? {type: NumberType} + : // booleans - accepts the type boolean + true extends NullTypeEquality + ? {type: "boolean"} + : // strings - only accepts the type string + true extends NullTypeEquality + ? {type: StringType} + : // strings - only accepts the type Date + true extends NullTypeEquality + ? {type: "timestamp"} + : // enums - only accepts union of string literals + // TODO we can't actually check that everything in the union was specified + true extends IsEnum> + ? {enum: EnumString>[]} + : // arrays - only accepts arrays, could be array of unions to be resolved later + true extends IsElements> + ? T extends readonly (infer E)[] + ? { + elements: JTDSchemaType + } + : never + : // empty properties + true extends IsEmptyRecord> + ? + | {properties: Record; optionalProperties?: Record} + | {optionalProperties: Record} + : // values + true extends IsValues> + ? T extends Record + ? { + values: JTDSchemaType + } + : never + : // properties + true extends IsRecord, false> + ? ([RequiredKeys>] extends [never] + ? { + properties?: Record + } + : { + properties: {[K in RequiredKeys]: JTDSchemaType} + }) & + ([OptionalKeys>] extends [never] + ? { + optionalProperties?: Record + } + : { + optionalProperties: { + [K in OptionalKeys]: JTDSchemaType, D> + } + }) & { + additionalProperties?: boolean + } + : // discriminator + true extends IsRecord, true> + ? { + [K in keyof Exclude]-?: Exclude[K] extends string + ? { + discriminator: K + mapping: { + // TODO currently allows descriminator to be present in schema + [M in Exclude[K]]: JTDSchemaType< + Omit ? T : never, K>, + D + > + } + } + : never + }[keyof Exclude] + : never) & + (null extends T + ? { + nullable: true + } + : {nullable?: false})) +) & { + // extra properties + metadata?: Record + // TODO these should only be allowed at the top level + definitions?: {[K in keyof D]: JTDSchemaType} +} + +type JTDDataDef> = + | // ref + (S extends {ref: string} + ? D extends {[K in S["ref"]]: infer V} + ? JTDDataDef + : never + : // type + S extends {type: NumberType} + ? number + : S extends {type: "boolean"} + ? boolean + : S extends {type: "string"} + ? string + : S extends {type: "timestamp"} + ? string | Date + : // enum + S extends {enum: readonly (infer E)[]} + ? string extends E + ? never + : [E] extends [string] + ? E + : never + : // elements + S extends {elements: infer E} + ? JTDDataDef[] + : // properties + S extends { + properties: Record + optionalProperties?: Record + additionalProperties?: boolean + } + ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< + S["optionalProperties"][K], + D + > + } & ([S["additionalProperties"]] extends [true] ? Record : unknown) + : S extends { + properties?: Record + optionalProperties: Record + additionalProperties?: boolean + } + ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< + S["optionalProperties"][K], + D + > + } & ([S["additionalProperties"]] extends [true] ? Record : unknown) + : // values + S extends {values: infer V} + ? Record> + : // discriminator + S extends {discriminator: infer M; mapping: Record} + ? [M] extends [string] + ? { + [K in keyof S["mapping"]]: JTDDataDef & {[KM in M]: K} + }[keyof S["mapping"]] + : never + : // empty + unknown) + | (S extends {nullable: true} ? null : never) + +export type JTDDataType = S extends {definitions: Record} + ? JTDDataDef + : JTDDataDef> diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts new file mode 100644 index 0000000000000000000000000000000000000000..755e5b3daf551d68ffbe3bd45884ee650094a46d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts @@ -0,0 +1,56 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" + +export type AdditionalItemsError = ErrorObject<"additionalItems", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "additionalItems" as const, + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error, + code(cxt: KeywordCxt) { + const {parentSchema, it} = cxt + const {items} = parentSchema + if (!Array.isArray(items)) { + checkStrictMode(it, '"additionalItems" is ignored when "items" is not an array of schemas') + return + } + validateAdditionalItems(cxt, items) + }, +} + +export function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void { + const {gen, schema, data, keyword, it} = cxt + it.items = true + const len = gen.const("len", _`${data}.length`) + if (schema === false) { + cxt.setParams({len: items.length}) + cxt.pass(_`${len} <= ${items.length}`) + } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", _`${len} <= ${items.length}`) // TODO var + gen.if(not(valid), () => validateItems(valid)) + cxt.ok(valid) + } + + function validateItems(valid: Name): void { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({keyword, dataProp: i, dataPropType: Type.Num}, valid) + if (!it.allErrors) gen.if(not(valid), () => gen.break()) + }) + } +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts new file mode 100644 index 0000000000000000000000000000000000000000..bfb511ce5100f4902f0f9c17ce7d7886e95fcabc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts @@ -0,0 +1,118 @@ +import type { + CodeKeywordDefinition, + AddedKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import {allSchemaProperties, usePattern, isOwnProperty} from "../code" +import {_, nil, or, not, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import type {SubschemaArgs} from "../../compile/validate/subschema" +import {alwaysValidSchema, schemaRefOrVal, Type} from "../../compile/util" + +export type AdditionalPropertiesError = ErrorObject< + "additionalProperties", + {additionalProperty: string}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: "must NOT have additional properties", + params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +} + +const def: CodeKeywordDefinition & AddedKeywordDefinition = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const {gen, schema, parentSchema, data, errsCount, it} = cxt + /* istanbul ignore if */ + if (!errsCount) throw new Error("ajv implementation error") + const {allErrors, opts} = it + it.props = true + if (opts.removeAdditional !== "all" && alwaysValidSchema(it, schema)) return + const props = allSchemaProperties(parentSchema.properties) + const patProps = allSchemaProperties(parentSchema.patternProperties) + checkAdditionalProperties() + cxt.ok(_`${errsCount} === ${N.errors}`) + + function checkAdditionalProperties(): void { + gen.forIn("key", data, (key: Name) => { + if (!props.length && !patProps.length) additionalPropertyCode(key) + else gen.if(isAdditional(key), () => additionalPropertyCode(key)) + }) + } + + function isAdditional(key: Name): Code { + let definedProp: Code + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = schemaRefOrVal(it, parentSchema.properties, "properties") + definedProp = isOwnProperty(gen, propsSchema as Code, key) + } else if (props.length) { + definedProp = or(...props.map((p) => _`${key} === ${p}`)) + } else { + definedProp = nil + } + if (patProps.length) { + definedProp = or(definedProp, ...patProps.map((p) => _`${usePattern(cxt, p)}.test(${key})`)) + } + return not(definedProp) + } + + function deleteAdditional(key: Name): void { + gen.code(_`delete ${data}[${key}]`) + } + + function additionalPropertyCode(key: Name): void { + if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { + deleteAdditional(key) + return + } + + if (schema === false) { + cxt.setParams({additionalProperty: key}) + cxt.error() + if (!allErrors) gen.break() + return + } + + if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.name("valid") + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false) + gen.if(not(valid), () => { + cxt.reset() + deleteAdditional(key) + }) + } else { + applyAdditionalSchema(key, valid) + if (!allErrors) gen.if(not(valid), () => gen.break()) + } + } + } + + function applyAdditionalSchema(key: Name, valid: Name, errors?: false): void { + const subschema: SubschemaArgs = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: Type.Str, + } + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }) + } + cxt.subschema(subschema, valid) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/allOf.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/allOf.ts new file mode 100644 index 0000000000000000000000000000000000000000..cdfa86ff431396a7cf68b937cb9baa69d4e79f29 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/allOf.ts @@ -0,0 +1,22 @@ +import type {CodeKeywordDefinition, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "allOf", + schemaType: "array", + code(cxt: KeywordCxt) { + const {gen, schema, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const valid = gen.name("valid") + schema.forEach((sch: AnySchema, i: number) => { + if (alwaysValidSchema(it, sch)) return + const schCxt = cxt.subschema({keyword: "allOf", schemaProp: i}, valid) + cxt.ok(valid) + cxt.mergeEvaluated(schCxt) + }) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd331b5ae98a72f1a6d79aacdf2d4babd16bde35 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts @@ -0,0 +1,14 @@ +import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" +import {validateUnion} from "../code" + +export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]> + +const def: CodeKeywordDefinition = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code: validateUnion, + error: {message: "must match a schema in anyOf"}, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/contains.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/contains.ts new file mode 100644 index 0000000000000000000000000000000000000000..d88675c6c2a21db9fa9e0ce497646fda1bf5d5a6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/contains.ts @@ -0,0 +1,109 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" + +export type ContainsError = ErrorObject< + "contains", + {minContains: number; maxContains?: number}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: ({params: {min, max}}) => + max === undefined + ? str`must contain at least ${min} valid item(s)` + : str`must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({params: {min, max}}) => + max === undefined ? _`{minContains: ${min}}` : _`{minContains: ${min}, maxContains: ${max}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, data, it} = cxt + let min: number + let max: number | undefined + const {minContains, maxContains} = parentSchema + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains + max = maxContains + } else { + min = 1 + } + const len = gen.const("len", _`${data}.length`) + cxt.setParams({min, max}) + if (max === undefined && min === 0) { + checkStrictMode(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`) + return + } + if (max !== undefined && min > max) { + checkStrictMode(it, `"minContains" > "maxContains" is always invalid`) + cxt.fail() + return + } + if (alwaysValidSchema(it, schema)) { + let cond = _`${len} >= ${min}` + if (max !== undefined) cond = _`${cond} && ${len} <= ${max}` + cxt.pass(cond) + return + } + + it.items = true + const valid = gen.name("valid") + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())) + } else if (min === 0) { + gen.let(valid, true) + if (max !== undefined) gen.if(_`${data}.length > 0`, validateItemsWithCount) + } else { + gen.let(valid, false) + validateItemsWithCount() + } + cxt.result(valid, () => cxt.reset()) + + function validateItemsWithCount(): void { + const schValid = gen.name("_valid") + const count = gen.let("count", 0) + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))) + } + + function validateItems(_valid: Name, block: () => void): void { + gen.forRange("i", 0, len, (i) => { + cxt.subschema( + { + keyword: "contains", + dataProp: i, + dataPropType: Type.Num, + compositeRule: true, + }, + _valid + ) + block() + }) + } + + function checkLimits(count: Name): void { + gen.code(_`${count}++`) + if (max === undefined) { + gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true).break()) + } else { + gen.if(_`${count} > ${max}`, () => gen.assign(valid, false).break()) + if (min === 1) gen.assign(valid, true) + else gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true)) + } + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6761128698689ce1d4699c33a3b128516157eeb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts @@ -0,0 +1,112 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + SchemaMap, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {checkReportMissingProp, checkMissingProp, reportMissingProp, propertyInData} from "../code" + +export type PropertyDependencies = {[K in string]?: string[]} + +export interface DependenciesErrorParams { + property: string + missingProperty: string + depsCount: number + deps: string // TODO change to string[] +} + +type SchemaDependencies = SchemaMap + +export type DependenciesError = ErrorObject< + "dependencies", + DependenciesErrorParams, + {[K in string]?: string[] | AnySchema} +> + +export const error: KeywordErrorDefinition = { + message: ({params: {property, depsCount, deps}}) => { + const property_ies = depsCount === 1 ? "property" : "properties" + return str`must have ${property_ies} ${deps} when property ${property} is present` + }, + params: ({params: {property, depsCount, deps, missingProperty}}) => + _`{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, // TODO change to reference +} + +const def: CodeKeywordDefinition = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + const [propDeps, schDeps] = splitDependencies(cxt) + validatePropertyDeps(cxt, propDeps) + validateSchemaDeps(cxt, schDeps) + }, +} + +function splitDependencies({schema}: KeywordCxt): [PropertyDependencies, SchemaDependencies] { + const propertyDeps: PropertyDependencies = {} + const schemaDeps: SchemaDependencies = {} + for (const key in schema) { + if (key === "__proto__") continue + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps + deps[key] = schema[key] + } + return [propertyDeps, schemaDeps] +} + +export function validatePropertyDeps( + cxt: KeywordCxt, + propertyDeps: {[K in string]?: string[]} = cxt.schema +): void { + const {gen, data, it} = cxt + if (Object.keys(propertyDeps).length === 0) return + const missing = gen.let("missing") + for (const prop in propertyDeps) { + const deps = propertyDeps[prop] as string[] + if (deps.length === 0) continue + const hasProperty = propertyInData(gen, data, prop, it.opts.ownProperties) + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", "), + }) + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + checkReportMissingProp(cxt, depProp) + } + }) + } else { + gen.if(_`${hasProperty} && (${checkMissingProp(cxt, deps, missing)})`) + reportMissingProp(cxt, missing) + gen.else() + } + } +} + +export function validateSchemaDeps(cxt: KeywordCxt, schemaDeps: SchemaMap = cxt.schema): void { + const {gen, data, keyword, it} = cxt + const valid = gen.name("valid") + for (const prop in schemaDeps) { + if (alwaysValidSchema(it, schemaDeps[prop] as AnySchema)) continue + gen.if( + propertyInData(gen, data, prop, it.opts.ownProperties), + () => { + const schCxt = cxt.subschema({keyword, schemaProp: prop}, valid) + cxt.mergeValidEvaluated(schCxt, valid) + }, + () => gen.var(valid, true) // TODO var + ) + cxt.ok(valid) + } +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbd3ae45c38f2e0a4c958a83694eaf5844440e7e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts @@ -0,0 +1,11 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateSchemaDeps} from "./dependencies" + +const def: CodeKeywordDefinition = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => validateSchemaDeps(cxt), +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/if.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/if.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a40d5e3ad2ca0ee8bffb0bc10c361580a15378f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/if.ts @@ -0,0 +1,80 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {SchemaObjCxt} from "../../compile" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode} from "../../compile/util" + +export type IfKeywordError = ErrorObject<"if", {failingKeyword: string}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params}) => str`must match "${params.ifClause}" schema`, + params: ({params}) => _`{failingKeyword: ${params.ifClause}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, parentSchema, it} = cxt + if (parentSchema.then === undefined && parentSchema.else === undefined) { + checkStrictMode(it, '"if" without "then" and "else" is ignored') + } + const hasThen = hasSchema(it, "then") + const hasElse = hasSchema(it, "else") + if (!hasThen && !hasElse) return + + const valid = gen.let("valid", true) + const schValid = gen.name("_valid") + validateIf() + cxt.reset() + + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause") + cxt.setParams({ifClause}) + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)) + } else if (hasThen) { + gen.if(schValid, validateClause("then")) + } else { + gen.if(not(schValid), validateClause("else")) + } + + cxt.pass(valid, () => cxt.error(true)) + + function validateIf(): void { + const schCxt = cxt.subschema( + { + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false, + }, + schValid + ) + cxt.mergeEvaluated(schCxt) + } + + function validateClause(keyword: string, ifClause?: Name): () => void { + return () => { + const schCxt = cxt.subschema({keyword}, schValid) + gen.assign(valid, schValid) + cxt.mergeValidEvaluated(schCxt, valid) + if (ifClause) gen.assign(ifClause, _`${keyword}`) + else cxt.setParams({ifClause: keyword}) + } + } + }, +} + +function hasSchema(it: SchemaObjCxt, keyword: string): boolean { + const schema = it.schema[keyword] + return schema !== undefined && !alwaysValidSchema(it, schema) +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc527169967c8e3ae32b13ee19c9ad20dc5794cc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/index.ts @@ -0,0 +1,53 @@ +import type {ErrorNoParams, Vocabulary} from "../../types" +import additionalItems, {AdditionalItemsError} from "./additionalItems" +import prefixItems from "./prefixItems" +import items from "./items" +import items2020, {ItemsError} from "./items2020" +import contains, {ContainsError} from "./contains" +import dependencies, {DependenciesError} from "./dependencies" +import propertyNames, {PropertyNamesError} from "./propertyNames" +import additionalProperties, {AdditionalPropertiesError} from "./additionalProperties" +import properties from "./properties" +import patternProperties from "./patternProperties" +import notKeyword, {NotKeywordError} from "./not" +import anyOf, {AnyOfError} from "./anyOf" +import oneOf, {OneOfError} from "./oneOf" +import allOf from "./allOf" +import ifKeyword, {IfKeywordError} from "./if" +import thenElse from "./thenElse" + +export default function getApplicator(draft2020 = false): Vocabulary { + const applicator = [ + // any + notKeyword, + anyOf, + oneOf, + allOf, + ifKeyword, + thenElse, + // object + propertyNames, + additionalProperties, + dependencies, + properties, + patternProperties, + ] + // array + if (draft2020) applicator.push(prefixItems, items2020) + else applicator.push(additionalItems, items) + applicator.push(contains) + return applicator +} + +export type ApplicatorKeywordError = + | ErrorNoParams<"false schema"> + | AdditionalItemsError + | ItemsError + | ContainsError + | AdditionalPropertiesError + | DependenciesError + | IfKeywordError + | AnyOfError + | OneOfError + | NotKeywordError + | PropertyNamesError diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/items.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/items.ts new file mode 100644 index 0000000000000000000000000000000000000000..033cb3977342222bc90a44251bc9366b151cff9f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/items.ts @@ -0,0 +1,59 @@ +import type {CodeKeywordDefinition, AnySchema, AnySchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_} from "../../compile/codegen" +import {alwaysValidSchema, mergeEvaluated, checkStrictMode} from "../../compile/util" +import {validateArray} from "../code" + +const def: CodeKeywordDefinition = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt: KeywordCxt) { + const {schema, it} = cxt + if (Array.isArray(schema)) return validateTuple(cxt, "additionalItems", schema) + it.items = true + if (alwaysValidSchema(it, schema)) return + cxt.ok(validateArray(cxt)) + }, +} + +export function validateTuple( + cxt: KeywordCxt, + extraItems: string, + schArr: AnySchema[] = cxt.schema +): void { + const {gen, parentSchema, data, keyword, it} = cxt + checkStrictTuple(parentSchema) + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = mergeEvaluated.items(gen, schArr.length, it.items) + } + const valid = gen.name("valid") + const len = gen.const("len", _`${data}.length`) + schArr.forEach((sch: AnySchema, i: number) => { + if (alwaysValidSchema(it, sch)) return + gen.if(_`${len} > ${i}`, () => + cxt.subschema( + { + keyword, + schemaProp: i, + dataProp: i, + }, + valid + ) + ) + cxt.ok(valid) + }) + + function checkStrictTuple(sch: AnySchemaObject): void { + const {opts, errSchemaPath} = it + const l = schArr.length + const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false) + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"` + checkStrictMode(it, msg, opts.strictTuples) + } + } +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/items2020.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/items2020.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a99b08d59adc2ce8fc6c785a5ccc34c0960c1f9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/items2020.ts @@ -0,0 +1,36 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {validateArray} from "../code" +import {validateAdditionalItems} from "./additionalItems" + +export type ItemsError = ErrorObject<"items", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error, + code(cxt: KeywordCxt) { + const {schema, parentSchema, it} = cxt + const {prefixItems} = parentSchema + it.items = true + if (alwaysValidSchema(it, schema)) return + if (prefixItems) validateAdditionalItems(cxt, prefixItems) + else cxt.ok(validateArray(cxt)) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/not.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/not.ts new file mode 100644 index 0000000000000000000000000000000000000000..8691db0bf229b778f88a373110311dff1c69c1dc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/not.ts @@ -0,0 +1,38 @@ +import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" + +export type NotKeywordError = ErrorNoParams<"not", AnySchema> + +const def: CodeKeywordDefinition = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt: KeywordCxt) { + const {gen, schema, it} = cxt + if (alwaysValidSchema(it, schema)) { + cxt.fail() + return + } + + const valid = gen.name("valid") + cxt.subschema( + { + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false, + }, + valid + ) + + cxt.failResult( + valid, + () => cxt.reset(), + () => cxt.error() + ) + }, + error: {message: "must NOT be valid"}, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts new file mode 100644 index 0000000000000000000000000000000000000000..c25353ffd648c45dce2433c14cb27841763d5435 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts @@ -0,0 +1,82 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, Name} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {SchemaCxt} from "../../compile" + +export type OneOfError = ErrorObject< + "oneOf", + {passingSchemas: [number, number] | null}, + AnySchema[] +> + +const error: KeywordErrorDefinition = { + message: "must match exactly one schema in oneOf", + params: ({params}) => _`{passingSchemas: ${params.passing}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + if (it.opts.discriminator && parentSchema.discriminator) return + const schArr: AnySchema[] = schema + const valid = gen.let("valid", false) + const passing = gen.let("passing", null) + const schValid = gen.name("_valid") + cxt.setParams({passing}) + // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas + + gen.block(validateOneOf) + + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ) + + function validateOneOf(): void { + schArr.forEach((sch: AnySchema, i: number) => { + let schCxt: SchemaCxt | undefined + if (alwaysValidSchema(it, sch)) { + gen.var(schValid, true) + } else { + schCxt = cxt.subschema( + { + keyword: "oneOf", + schemaProp: i, + compositeRule: true, + }, + schValid + ) + } + + if (i > 0) { + gen + .if(_`${schValid} && ${valid}`) + .assign(valid, false) + .assign(passing, _`[${passing}, ${i}]`) + .else() + } + + gen.if(schValid, () => { + gen.assign(valid, true) + gen.assign(passing, i) + if (schCxt) cxt.mergeEvaluated(schCxt, Name) + }) + }) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea624e230dddb3d71320eb5255a2b89bae5f20b0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts @@ -0,0 +1,91 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {allSchemaProperties, usePattern} from "../code" +import {_, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode} from "../../compile/util" +import {evaluatedPropsToName, Type} from "../../compile/util" +import {AnySchema} from "../../types" + +const def: CodeKeywordDefinition = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt: KeywordCxt) { + const {gen, schema, data, parentSchema, it} = cxt + const {opts} = it + const patterns = allSchemaProperties(schema) + const alwaysValidPatterns = patterns.filter((p) => + alwaysValidSchema(it, schema[p] as AnySchema) + ) + + if ( + patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true)) + ) { + return + } + + const checkProperties = + opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties + const valid = gen.name("valid") + if (it.props !== true && !(it.props instanceof Name)) { + it.props = evaluatedPropsToName(gen, it.props) + } + const {props} = it + validatePatternProperties() + + function validatePatternProperties(): void { + for (const pat of patterns) { + if (checkProperties) checkMatchingProperties(pat) + if (it.allErrors) { + validateProperties(pat) + } else { + gen.var(valid, true) // TODO var + validateProperties(pat) + gen.if(valid) + } + } + } + + function checkMatchingProperties(pat: string): void { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + checkStrictMode( + it, + `property ${prop} matches pattern ${pat} (use allowMatchingProperties)` + ) + } + } + } + + function validateProperties(pat: string): void { + gen.forIn("key", data, (key) => { + gen.if(_`${usePattern(cxt, pat)}.test(${key})`, () => { + const alwaysValid = alwaysValidPatterns.includes(pat) + if (!alwaysValid) { + cxt.subschema( + { + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: Type.Str, + }, + valid + ) + } + + if (it.opts.unevaluated && props !== true) { + gen.assign(_`${props}[${key}]`, true) + } else if (!alwaysValid && !it.allErrors) { + // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) + // or if all properties were evaluated (props === true) + gen.if(not(valid), () => gen.break()) + } + }) + }) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts new file mode 100644 index 0000000000000000000000000000000000000000..008fb2db1d8dd898fa79226d118530af2628c2c8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts @@ -0,0 +1,12 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateTuple} from "./items" + +const def: CodeKeywordDefinition = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (cxt) => validateTuple(cxt, "items"), +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/properties.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/properties.ts new file mode 100644 index 0000000000000000000000000000000000000000..a55b19ce5b77d180ce94cb063946a08d22824bd1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/properties.ts @@ -0,0 +1,57 @@ +import type {CodeKeywordDefinition} from "../../types" +import {KeywordCxt} from "../../compile/validate" +import {propertyInData, allSchemaProperties} from "../code" +import {alwaysValidSchema, toHash, mergeEvaluated} from "../../compile/util" +import apDef from "./additionalProperties" + +const def: CodeKeywordDefinition = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, data, it} = cxt + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { + apDef.code(new KeywordCxt(it, apDef, "additionalProperties")) + } + const allProps = allSchemaProperties(schema) + for (const prop of allProps) { + it.definedProperties.add(prop) + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = mergeEvaluated.props(gen, toHash(allProps), it.props) + } + const properties = allProps.filter((p) => !alwaysValidSchema(it, schema[p])) + if (properties.length === 0) return + const valid = gen.name("valid") + + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop) + } else { + gen.if(propertyInData(gen, data, prop, it.opts.ownProperties)) + applyPropertySchema(prop) + if (!it.allErrors) gen.else().var(valid, true) + gen.endIf() + } + cxt.it.definedProperties.add(prop) + cxt.ok(valid) + } + + function hasDefault(prop: string): boolean | undefined { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined + } + + function applyPropertySchema(prop: string): void { + cxt.subschema( + { + keyword: "properties", + schemaProp: prop, + dataProp: prop, + }, + valid + ) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c54d605258600f3e98d4eeb17e87256be6b9f3f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts @@ -0,0 +1,50 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, not} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" + +export type PropertyNamesError = ErrorObject<"propertyNames", {propertyName: string}, AnySchema> + +const error: KeywordErrorDefinition = { + message: "property name must be valid", + params: ({params}) => _`{propertyName: ${params.propertyName}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error, + code(cxt: KeywordCxt) { + const {gen, schema, data, it} = cxt + if (alwaysValidSchema(it, schema)) return + const valid = gen.name("valid") + + gen.forIn("key", data, (key) => { + cxt.setParams({propertyName: key}) + cxt.subschema( + { + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true, + }, + valid + ) + gen.if(not(valid), () => { + cxt.error(true) + if (!it.allErrors) gen.break() + }) + }) + + cxt.ok(valid) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts new file mode 100644 index 0000000000000000000000000000000000000000..5055182e89141a257630516d96a52ec2917f72b6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts @@ -0,0 +1,13 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({keyword, parentSchema, it}: KeywordCxt) { + if (parentSchema.if === undefined) checkStrictMode(it, `"${keyword}" without "if" is ignored`) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/code.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/code.ts new file mode 100644 index 0000000000000000000000000000000000000000..92cdd5b04ef30e0ed6f3c9025752f0acf59370eb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/code.ts @@ -0,0 +1,168 @@ +import type {AnySchema, SchemaMap} from "../types" +import type {SchemaCxt} from "../compile" +import type {KeywordCxt} from "../compile/validate" +import {CodeGen, _, and, or, not, nil, strConcat, getProperty, Code, Name} from "../compile/codegen" +import {alwaysValidSchema, Type} from "../compile/util" +import N from "../compile/names" +import {useFunc} from "../compile/util" +export function checkReportMissingProp(cxt: KeywordCxt, prop: string): void { + const {gen, data, it} = cxt + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({missingProperty: _`${prop}`}, true) + cxt.error() + }) +} + +export function checkMissingProp( + {gen, data, it: {opts}}: KeywordCxt, + properties: string[], + missing: Name +): Code { + return or( + ...properties.map((prop) => + and(noPropertyInData(gen, data, prop, opts.ownProperties), _`${missing} = ${prop}`) + ) + ) +} + +export function reportMissingProp(cxt: KeywordCxt, missing: Name): void { + cxt.setParams({missingProperty: missing}, true) + cxt.error() +} + +export function hasPropFunc(gen: CodeGen): Name { + return gen.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: _`Object.prototype.hasOwnProperty`, + }) +} + +export function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code { + return _`${hasPropFunc(gen)}.call(${data}, ${property})` +} + +export function propertyInData( + gen: CodeGen, + data: Name, + property: Name | string, + ownProperties?: boolean +): Code { + const cond = _`${data}${getProperty(property)} !== undefined` + return ownProperties ? _`${cond} && ${isOwnProperty(gen, data, property)}` : cond +} + +export function noPropertyInData( + gen: CodeGen, + data: Name, + property: Name | string, + ownProperties?: boolean +): Code { + const cond = _`${data}${getProperty(property)} === undefined` + return ownProperties ? or(cond, not(isOwnProperty(gen, data, property))) : cond +} + +export function allSchemaProperties(schemaMap?: SchemaMap): string[] { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [] +} + +export function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[] { + return allSchemaProperties(schemaMap).filter( + (p) => !alwaysValidSchema(it, schemaMap[p] as AnySchema) + ) +} + +export function callValidateCode( + {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt, + func: Code, + context: Code, + passSchema?: boolean +): Code { + const dataAndSchema = passSchema ? _`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data + const valCxt: [Name, Code | number][] = [ + [N.instancePath, strConcat(N.instancePath, errorPath)], + [N.parentData, it.parentData], + [N.parentDataProperty, it.parentDataProperty], + [N.rootData, N.rootData], + ] + if (it.opts.dynamicRef) valCxt.push([N.dynamicAnchors, N.dynamicAnchors]) + const args = _`${dataAndSchema}, ${gen.object(...valCxt)}` + return context !== nil ? _`${func}.call(${context}, ${args})` : _`${func}(${args})` +} + +const newRegExp = _`new RegExp` + +export function usePattern({gen, it: {opts}}: KeywordCxt, pattern: string): Name { + const u = opts.unicodeRegExp ? "u" : "" + const {regExp} = opts.code + const rx = regExp(pattern, u) + + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: _`${regExp.code === "new RegExp" ? newRegExp : useFunc(gen, regExp)}(${pattern}, ${u})`, + }) +} + +export function validateArray(cxt: KeywordCxt): Name { + const {gen, data, keyword, it} = cxt + const valid = gen.name("valid") + if (it.allErrors) { + const validArr = gen.let("valid", true) + validateItems(() => gen.assign(validArr, false)) + return validArr + } + gen.var(valid, true) + validateItems(() => gen.break()) + return valid + + function validateItems(notValid: () => void): void { + const len = gen.const("len", _`${data}.length`) + gen.forRange("i", 0, len, (i) => { + cxt.subschema( + { + keyword, + dataProp: i, + dataPropType: Type.Num, + }, + valid + ) + gen.if(not(valid), notValid) + }) + } +} + +export function validateUnion(cxt: KeywordCxt): void { + const {gen, schema, keyword, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const alwaysValid = schema.some((sch: AnySchema) => alwaysValidSchema(it, sch)) + if (alwaysValid && !it.opts.unevaluated) return + + const valid = gen.let("valid", false) + const schValid = gen.name("_valid") + + gen.block(() => + schema.forEach((_sch: AnySchema, i: number) => { + const schCxt = cxt.subschema( + { + keyword, + schemaProp: i, + compositeRule: true, + }, + schValid + ) + gen.assign(valid, _`${valid} || ${schValid}`) + const merged = cxt.mergeValidEvaluated(schCxt, schValid) + // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) + // or if all properties and items were evaluated (it.props === true && it.items === true) + if (!merged) gen.if(not(valid)) + }) + ) + + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/id.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/id.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa36c4bb20f45046bb46fc998ca39fa2d9589811 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/id.ts @@ -0,0 +1,10 @@ +import type {CodeKeywordDefinition} from "../../types" + +const def: CodeKeywordDefinition = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID') + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..e63e2895d08710745fe5785bbdb1aaf155e05407 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/index.ts @@ -0,0 +1,16 @@ +import type {Vocabulary} from "../../types" +import idKeyword from "./id" +import refKeyword from "./ref" + +const core: Vocabulary = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + {keyword: "$comment"}, + "definitions", + idKeyword, + refKeyword, +] + +export default core diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/ref.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/ref.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d59fbcb2a99564106fdcafe244f693bc88e3ea2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/core/ref.ts @@ -0,0 +1,129 @@ +import type {CodeKeywordDefinition, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import MissingRefError from "../../compile/ref_error" +import {callValidateCode} from "../code" +import {_, nil, stringify, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import {SchemaEnv, resolveRef} from "../../compile" +import {mergeEvaluated} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "$ref", + schemaType: "string", + code(cxt: KeywordCxt): void { + const {gen, schema: $ref, it} = cxt + const {baseId, schemaEnv: env, validateName, opts, self} = it + const {root} = env + if (($ref === "#" || $ref === "#/") && baseId === root.baseId) return callRootRef() + const schOrEnv = resolveRef.call(self, root, baseId, $ref) + if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref) + if (schOrEnv instanceof SchemaEnv) return callValidate(schOrEnv) + return inlineRefSchema(schOrEnv) + + function callRootRef(): void { + if (env === root) return callRef(cxt, validateName, env, env.$async) + const rootName = gen.scopeValue("root", {ref: root}) + return callRef(cxt, _`${rootName}.validate`, root, root.$async) + } + + function callValidate(sch: SchemaEnv): void { + const v = getValidate(cxt, sch) + callRef(cxt, v, sch, sch.$async) + } + + function inlineRefSchema(sch: AnySchema): void { + const schName = gen.scopeValue( + "schema", + opts.code.source === true ? {ref: sch, code: stringify(sch)} : {ref: sch} + ) + const valid = gen.name("valid") + const schCxt = cxt.subschema( + { + schema: sch, + dataTypes: [], + schemaPath: nil, + topSchemaRef: schName, + errSchemaPath: $ref, + }, + valid + ) + cxt.mergeEvaluated(schCxt) + cxt.ok(valid) + } + }, +} + +export function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code { + const {gen} = cxt + return sch.validate + ? gen.scopeValue("validate", {ref: sch.validate}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.validate` +} + +export function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void { + const {gen, it} = cxt + const {allErrors, schemaEnv: env, opts} = it + const passCxt = opts.passContext ? N.this : nil + if ($async) callAsyncRef() + else callSyncRef() + + function callAsyncRef(): void { + if (!env.$async) throw new Error("async schema referenced by sync schema") + const valid = gen.let("valid") + gen.try( + () => { + gen.code(_`await ${callValidateCode(cxt, v, passCxt)}`) + addEvaluatedFrom(v) // TODO will not work with async, it has to be returned with the result + if (!allErrors) gen.assign(valid, true) + }, + (e) => { + gen.if(_`!(${e} instanceof ${it.ValidationError as Name})`, () => gen.throw(e)) + addErrorsFrom(e) + if (!allErrors) gen.assign(valid, false) + } + ) + cxt.ok(valid) + } + + function callSyncRef(): void { + cxt.result( + callValidateCode(cxt, v, passCxt), + () => addEvaluatedFrom(v), + () => addErrorsFrom(v) + ) + } + + function addErrorsFrom(source: Code): void { + const errs = _`${source}.errors` + gen.assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) // TODO tagged + gen.assign(N.errors, _`${N.vErrors}.length`) + } + + function addEvaluatedFrom(source: Code): void { + if (!it.opts.unevaluated) return + const schEvaluated = sch?.validate?.evaluated + // TODO refactor + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = mergeEvaluated.props(gen, schEvaluated.props, it.props) + } + } else { + const props = gen.var("props", _`${source}.evaluated.props`) + it.props = mergeEvaluated.props(gen, props, it.props, Name) + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = mergeEvaluated.items(gen, schEvaluated.items, it.items) + } + } else { + const items = gen.var("items", _`${source}.evaluated.items`) + it.items = mergeEvaluated.items(gen, items, it.items, Name) + } + } + } +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/discriminator/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/discriminator/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..19ae6049f3464d2dd7518de70a9f10842aa88d66 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/discriminator/index.ts @@ -0,0 +1,113 @@ +import type {CodeKeywordDefinition, AnySchemaObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Name} from "../../compile/codegen" +import {DiscrError, DiscrErrorObj} from "../discriminator/types" +import {resolveRef, SchemaEnv} from "../../compile" +import MissingRefError from "../../compile/ref_error" +import {schemaHasRulesButRef} from "../../compile/util" + +export type DiscriminatorError = DiscrErrorObj | DiscrErrorObj + +const error: KeywordErrorDefinition = { + message: ({params: {discrError, tagName}}) => + discrError === DiscrError.Tag + ? `tag "${tagName}" must be string` + : `value of tag "${tagName}" must be in oneOf`, + params: ({params: {discrError, tag, tagName}}) => + _`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + const {gen, data, schema, parentSchema, it} = cxt + const {oneOf} = parentSchema + if (!it.opts.discriminator) { + throw new Error("discriminator: requires discriminator option") + } + const tagName = schema.propertyName + if (typeof tagName != "string") throw new Error("discriminator: requires propertyName") + if (schema.mapping) throw new Error("discriminator: mapping is not supported") + if (!oneOf) throw new Error("discriminator: requires oneOf keyword") + const valid = gen.let("valid", false) + const tag = gen.const("tag", _`${data}${getProperty(tagName)}`) + gen.if( + _`typeof ${tag} == "string"`, + () => validateMapping(), + () => cxt.error(false, {discrError: DiscrError.Tag, tag, tagName}) + ) + cxt.ok(valid) + + function validateMapping(): void { + const mapping = getMapping() + gen.if(false) + for (const tagValue in mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + gen.assign(valid, applyTagSchema(mapping[tagValue])) + } + gen.else() + cxt.error(false, {discrError: DiscrError.Mapping, tag, tagName}) + gen.endIf() + } + + function applyTagSchema(schemaProp?: number): Name { + const _valid = gen.name("valid") + const schCxt = cxt.subschema({keyword: "oneOf", schemaProp}, _valid) + cxt.mergeEvaluated(schCxt, Name) + return _valid + } + + function getMapping(): {[T in string]?: number} { + const oneOfMapping: {[T in string]?: number} = {} + const topRequired = hasRequired(parentSchema) + let tagRequired = true + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i] + if (sch?.$ref && !schemaHasRulesButRef(sch, it.self.RULES)) { + const ref = sch.$ref + sch = resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref) + if (sch instanceof SchemaEnv) sch = sch.schema + if (sch === undefined) throw new MissingRefError(it.opts.uriResolver, it.baseId, ref) + } + const propSch = sch?.properties?.[tagName] + if (typeof propSch != "object") { + throw new Error( + `discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"` + ) + } + tagRequired = tagRequired && (topRequired || hasRequired(sch)) + addMappings(propSch, i) + } + if (!tagRequired) throw new Error(`discriminator: "${tagName}" must be required`) + return oneOfMapping + + function hasRequired({required}: AnySchemaObject): boolean { + return Array.isArray(required) && required.includes(tagName) + } + + function addMappings(sch: AnySchemaObject, i: number): void { + if (sch.const) { + addMapping(sch.const, i) + } else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i) + } + } else { + throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`) + } + } + + function addMapping(tagValue: unknown, i: number): void { + if (typeof tagValue != "string" || tagValue in oneOfMapping) { + throw new Error(`discriminator: "${tagName}" values must be unique strings`) + } + oneOfMapping[tagValue] = i + } + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/discriminator/types.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/discriminator/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..bee5a278508e4926b85cf397fb601a7a3c2a78cb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/discriminator/types.ts @@ -0,0 +1,12 @@ +import type {ErrorObject} from "../../types" + +export enum DiscrError { + Tag = "tag", + Mapping = "mapping", +} + +export type DiscrErrorObj = ErrorObject< + "discriminator", + {error: E; tag: string; tagValue: unknown}, + string +> diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/draft2020.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/draft2020.ts new file mode 100644 index 0000000000000000000000000000000000000000..47fbf0ee6d75112abf222611ca514973833c8b53 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/draft2020.ts @@ -0,0 +1,23 @@ +import type {Vocabulary} from "../types" +import coreVocabulary from "./core" +import validationVocabulary from "./validation" +import getApplicatorVocabulary from "./applicator" +import dynamicVocabulary from "./dynamic" +import nextVocabulary from "./next" +import unevaluatedVocabulary from "./unevaluated" +import formatVocabulary from "./format" +import {metadataVocabulary, contentVocabulary} from "./metadata" + +const draft2020Vocabularies: Vocabulary[] = [ + dynamicVocabulary, + coreVocabulary, + validationVocabulary, + getApplicatorVocabulary(true), + formatVocabulary, + metadataVocabulary, + contentVocabulary, + nextVocabulary, + unevaluatedVocabulary, +] + +export default draft2020Vocabularies diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/draft7.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/draft7.ts new file mode 100644 index 0000000000000000000000000000000000000000..226a644aa428d808c22dfd6808392fada925ae5e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/draft7.ts @@ -0,0 +1,17 @@ +import type {Vocabulary} from "../types" +import coreVocabulary from "./core" +import validationVocabulary from "./validation" +import getApplicatorVocabulary from "./applicator" +import formatVocabulary from "./format" +import {metadataVocabulary, contentVocabulary} from "./metadata" + +const draft7Vocabularies: Vocabulary[] = [ + coreVocabulary, + validationVocabulary, + getApplicatorVocabulary(), + formatVocabulary, + metadataVocabulary, + contentVocabulary, +] + +export default draft7Vocabularies diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts new file mode 100644 index 0000000000000000000000000000000000000000..ca1adb912af0347a3bb8e18ca50cf51405f2ba1f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts @@ -0,0 +1,31 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Code} from "../../compile/codegen" +import N from "../../compile/names" +import {SchemaEnv, compileSchema} from "../../compile" +import {getValidate} from "../core/ref" + +const def: CodeKeywordDefinition = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema), +} + +export function dynamicAnchor(cxt: KeywordCxt, anchor: string): void { + const {gen, it} = cxt + it.schemaEnv.root.dynamicAnchors[anchor] = true + const v = _`${N.dynamicAnchors}${getProperty(anchor)}` + const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt) + gen.if(_`!${v}`, () => gen.assign(v, validate)) +} + +function _getValidate(cxt: KeywordCxt): Code { + const {schemaEnv, schema, self} = cxt.it + const {root, baseId, localRefs, meta} = schemaEnv.root + const {schemaId} = self.opts + const sch = new SchemaEnv({schema, schemaId, root, baseId, localRefs, meta}) + compileSchema.call(self, sch) + return getValidate(cxt, sch) +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a573f33024b4fc5045f17f0c251a3d6c75a22a7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts @@ -0,0 +1,51 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import {callRef} from "../core/ref" + +const def: CodeKeywordDefinition = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +} + +export function dynamicRef(cxt: KeywordCxt, ref: string): void { + const {gen, keyword, it} = cxt + if (ref[0] !== "#") throw new Error(`"${keyword}" only supports hash fragment reference`) + const anchor = ref.slice(1) + if (it.allErrors) { + _dynamicRef() + } else { + const valid = gen.let("valid", false) + _dynamicRef(valid) + cxt.ok(valid) + } + + function _dynamicRef(valid?: Name): void { + // TODO the assumption here is that `recursiveRef: #` always points to the root + // of the schema object, which is not correct, because there may be $id that + // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. + // Because of that 2 tests in recursiveRef.json fail. + // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). + // (This problem is not tested in JSON-Schema-Test-Suite) + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", _`${N.dynamicAnchors}${getProperty(anchor)}`) + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)) + } else { + _callRef(it.validateName, valid)() + } + } + + function _callRef(validate: Code, valid?: Name): () => void { + return valid + ? () => + gen.block(() => { + callRef(cxt, validate) + gen.let(valid, true) + }) + : () => callRef(cxt, validate) + } +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d521db6638b890151a7a901991f91793553dab0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/index.ts @@ -0,0 +1,9 @@ +import type {Vocabulary} from "../../types" +import dynamicAnchor from "./dynamicAnchor" +import dynamicRef from "./dynamicRef" +import recursiveAnchor from "./recursiveAnchor" +import recursiveRef from "./recursiveRef" + +const dynamic: Vocabulary = [dynamicAnchor, dynamicRef, recursiveAnchor, recursiveRef] + +export default dynamic diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts new file mode 100644 index 0000000000000000000000000000000000000000..25f3db96bf07a2c60fc3eb860ea93ee6337e0137 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts @@ -0,0 +1,14 @@ +import type {CodeKeywordDefinition} from "../../types" +import {dynamicAnchor} from "./dynamicAnchor" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) dynamicAnchor(cxt, "") + else checkStrictMode(cxt.it, "$recursiveAnchor: false is ignored") + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts new file mode 100644 index 0000000000000000000000000000000000000000..c84af0f05785affe11983f39f605a53502358c67 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts @@ -0,0 +1,10 @@ +import type {CodeKeywordDefinition} from "../../types" +import {dynamicRef} from "./dynamicRef" + +const def: CodeKeywordDefinition = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/errors.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/errors.ts new file mode 100644 index 0000000000000000000000000000000000000000..c9ca3f02f040298cd2b2faff35740eaae6ea098e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/errors.ts @@ -0,0 +1,18 @@ +import type {TypeError} from "../compile/validate/dataType" +import type {ApplicatorKeywordError} from "./applicator" +import type {ValidationKeywordError} from "./validation" +import type {FormatError} from "./format/format" +import type {UnevaluatedPropertiesError} from "./unevaluated/unevaluatedProperties" +import type {UnevaluatedItemsError} from "./unevaluated/unevaluatedItems" +import type {DependentRequiredError} from "./validation/dependentRequired" +import type {DiscriminatorError} from "./discriminator" + +export type DefinedError = + | TypeError + | ApplicatorKeywordError + | ValidationKeywordError + | FormatError + | UnevaluatedPropertiesError + | UnevaluatedItemsError + | DependentRequiredError + | DiscriminatorError diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/format/format.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/format/format.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b1c13e764375dbb4dff021426a377f8103ab54f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/format/format.ts @@ -0,0 +1,120 @@ +import type { + AddedFormat, + FormatValidator, + AsyncFormatValidator, + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, nil, or, Code, getProperty, regexpCode} from "../../compile/codegen" + +type FormatValidate = + | FormatValidator + | FormatValidator + | AsyncFormatValidator + | AsyncFormatValidator + | RegExp + | string + | true + +export type FormatError = ErrorObject<"format", {format: string}, string | {$data: string}> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must match format "${schemaCode}"`, + params: ({schemaCode}) => _`{format: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error, + code(cxt: KeywordCxt, ruleType?: string) { + const {gen, data, $data, schema, schemaCode, it} = cxt + const {opts, errSchemaPath, schemaEnv, self} = it + if (!opts.validateFormats) return + + if ($data) validate$DataFormat() + else validateFormat() + + function validate$DataFormat(): void { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }) + const fDef = gen.const("fDef", _`${fmts}[${schemaCode}]`) + const fType = gen.let("fType") + const format = gen.let("format") + // TODO simplify + gen.if( + _`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, + () => gen.assign(fType, _`${fDef}.type || "string"`).assign(format, _`${fDef}.validate`), + () => gen.assign(fType, _`"string"`).assign(format, fDef) + ) + cxt.fail$data(or(unknownFmt(), invalidFmt())) + + function unknownFmt(): Code { + if (opts.strictSchema === false) return nil + return _`${schemaCode} && !${format}` + } + + function invalidFmt(): Code { + const callFormat = schemaEnv.$async + ? _`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : _`${format}(${data})` + const validData = _`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))` + return _`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}` + } + } + + function validateFormat(): void { + const formatDef: AddedFormat | undefined = self.formats[schema] + if (!formatDef) { + unknownFormat() + return + } + if (formatDef === true) return + const [fmtType, format, fmtRef] = getFormat(formatDef) + if (fmtType === ruleType) cxt.pass(validCondition()) + + function unknownFormat(): void { + if (opts.strictSchema === false) { + self.logger.warn(unknownMsg()) + return + } + throw new Error(unknownMsg()) + + function unknownMsg(): string { + return `unknown format "${schema as string}" ignored in schema at path "${errSchemaPath}"` + } + } + + function getFormat(fmtDef: AddedFormat): [string, FormatValidate, Code] { + const code = + fmtDef instanceof RegExp + ? regexpCode(fmtDef) + : opts.code.formats + ? _`${opts.code.formats}${getProperty(schema)}` + : undefined + const fmt = gen.scopeValue("formats", {key: schema, ref: fmtDef, code}) + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, _`${fmt}.validate`] + } + + return ["string", fmtDef, fmt] + } + + function validCondition(): Code { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) throw new Error("async format in sync schema") + return _`await ${fmtRef}(${data})` + } + return typeof format == "function" ? _`${fmtRef}(${data})` : _`${fmtRef}.test(${data})` + } + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/format/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/format/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..bca2f5b3d817051e07bd768888ed7142e63c4c97 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/format/index.ts @@ -0,0 +1,6 @@ +import type {Vocabulary} from "../../types" +import formatKeyword from "./format" + +const format: Vocabulary = [formatKeyword] + +export default format diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts new file mode 100644 index 0000000000000000000000000000000000000000..f487c97f84332592ca90b09d5c046a87afd57f9b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts @@ -0,0 +1,89 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, not, getProperty, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" +import {DiscrError, DiscrErrorObj} from "../discriminator/types" + +export type JTDDiscriminatorError = + | _JTDTypeError<"discriminator", "object", string> + | DiscrErrorObj + | DiscrErrorObj + +const error: KeywordErrorDefinition = { + message: (cxt) => { + const {schema, params} = cxt + return params.discrError + ? params.discrError === DiscrError.Tag + ? `tag "${schema}" must be string` + : `value of tag "${schema}" must be in mapping` + : typeErrorMessage(cxt, "object") + }, + params: (cxt) => { + const {schema, params} = cxt + return params.discrError + ? _`{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` + : typeErrorParams(cxt, "object") + }, +} + +const def: CodeKeywordDefinition = { + keyword: "discriminator", + schemaType: "string", + implements: ["mapping"], + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, parentSchema} = cxt + const [valid, cond] = checkNullableObject(cxt, data) + + gen.if(cond) + validateDiscriminator() + gen.elseIf(not(valid)) + cxt.error() + gen.endIf() + cxt.ok(valid) + + function validateDiscriminator(): void { + const tag = gen.const("tag", _`${data}${getProperty(schema)}`) + gen.if(_`${tag} === undefined`) + cxt.error(false, {discrError: DiscrError.Tag, tag}) + gen.elseIf(_`typeof ${tag} == "string"`) + validateMapping(tag) + gen.else() + cxt.error(false, {discrError: DiscrError.Tag, tag}, {instancePath: schema}) + gen.endIf() + } + + function validateMapping(tag: Name): void { + gen.if(false) + for (const tagValue in parentSchema.mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + gen.assign(valid, applyTagSchema(tagValue)) + } + gen.else() + cxt.error( + false, + {discrError: DiscrError.Mapping, tag}, + {instancePath: schema, schemaPath: "mapping", parentSchema: true} + ) + gen.endIf() + } + + function applyTagSchema(schemaProp: string): Name { + const _valid = gen.name("valid") + cxt.subschema( + { + keyword: "mapping", + schemaProp, + jtdDiscriminator: schema, + }, + _valid + ) + return _valid + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/elements.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/elements.ts new file mode 100644 index 0000000000000000000000000000000000000000..983af7c0276ed83cf92e5071a2a8a63ef2d522e4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/elements.ts @@ -0,0 +1,32 @@ +import type {CodeKeywordDefinition, SchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" +import {validateArray} from "../code" +import {_, not} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullable} from "./nullable" +import {typeError, _JTDTypeError} from "./error" + +export type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject> + +const def: CodeKeywordDefinition = { + keyword: "elements", + schemaType: "object", + error: typeError("array"), + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const [valid] = checkNullable(cxt) + gen.if(not(valid), () => + gen.if( + _`Array.isArray(${data})`, + () => gen.assign(valid, validateArray(cxt)), + () => cxt.error() + ) + ) + cxt.ok(valid) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/enum.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/enum.ts new file mode 100644 index 0000000000000000000000000000000000000000..75464ff8e13f581679d2b33662f34ac79a23e912 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/enum.ts @@ -0,0 +1,45 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition, ErrorObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, or, and, Code} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullable} from "./nullable" + +export type JTDEnumError = ErrorObject<"enum", {allowedValues: string[]}, string[]> + +const error: KeywordErrorDefinition = { + message: "must be equal to one of the allowed values", + params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "enum", + schemaType: "array", + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, schemaValue, parentSchema, it} = cxt + if (schema.length === 0) throw new Error("enum must have non-empty array") + if (schema.length !== new Set(schema).size) throw new Error("enum items must be unique") + let valid: Code + const isString = _`typeof ${data} == "string"` + if (schema.length >= it.opts.loopEnum) { + let cond: Code + ;[valid, cond] = checkNullable(cxt, isString) + gen.if(cond, loopEnum) + } else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + valid = and(isString, or(...schema.map((value: string) => _`${data} === ${value}`))) + if (parentSchema.nullable) valid = or(_`${data} === null`, valid) + } + cxt.pass(valid) + + function loopEnum(): void { + gen.forOf("v", schemaValue as Code, (v) => + gen.if(_`${valid} = ${data} === ${v}`, () => gen.break()) + ) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/error.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/error.ts new file mode 100644 index 0000000000000000000000000000000000000000..5069322588ebc486795ec075e49777888bbd8cdf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/error.ts @@ -0,0 +1,23 @@ +import type {KeywordErrorDefinition, KeywordErrorCxt, ErrorObject} from "../../types" +import {_, Code} from "../../compile/codegen" + +export type _JTDTypeError = ErrorObject< + K, + {type: T; nullable: boolean}, + S +> + +export function typeError(t: string): KeywordErrorDefinition { + return { + message: (cxt) => typeErrorMessage(cxt, t), + params: (cxt) => typeErrorParams(cxt, t), + } +} + +export function typeErrorMessage({parentSchema}: KeywordErrorCxt, t: string): string { + return parentSchema?.nullable ? `must be ${t} or null` : `must be ${t}` +} + +export function typeErrorParams({parentSchema}: KeywordErrorCxt, t: string): Code { + return _`{type: ${t}, nullable: ${!!parentSchema?.nullable}}` +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7baebc30788d80498e59328809b6b6a312d3315 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/index.ts @@ -0,0 +1,37 @@ +import type {Vocabulary} from "../../types" +import refKeyword from "./ref" +import typeKeyword, {JTDTypeError} from "./type" +import enumKeyword, {JTDEnumError} from "./enum" +import elements, {JTDElementsError} from "./elements" +import properties, {JTDPropertiesError} from "./properties" +import optionalProperties from "./optionalProperties" +import discriminator, {JTDDiscriminatorError} from "./discriminator" +import values, {JTDValuesError} from "./values" +import union from "./union" +import metadata from "./metadata" + +const jtdVocabulary: Vocabulary = [ + "definitions", + refKeyword, + typeKeyword, + enumKeyword, + elements, + properties, + optionalProperties, + discriminator, + values, + union, + metadata, + {keyword: "additionalProperties", schemaType: "boolean"}, + {keyword: "nullable", schemaType: "boolean"}, +] + +export default jtdVocabulary + +export type JTDErrorObject = + | JTDTypeError + | JTDEnumError + | JTDElementsError + | JTDPropertiesError + | JTDDiscriminatorError + | JTDValuesError diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/metadata.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/metadata.ts new file mode 100644 index 0000000000000000000000000000000000000000..19eeb8c7d5b8f6ed1ab794cc0368f67d4be8bb8a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/metadata.ts @@ -0,0 +1,24 @@ +import {KeywordCxt} from "../../ajv" +import type {CodeKeywordDefinition} from "../../types" +import {alwaysValidSchema} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "metadata", + schemaType: "object", + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const valid = gen.name("valid") + cxt.subschema({keyword: "metadata", jtdMetadata: true}, valid) + cxt.ok(valid) + }, +} + +export function checkMetadata({it, keyword}: KeywordCxt, metadata?: boolean): void { + if (it.jtdMetadata !== metadata) { + throw new Error(`JTD: "${keyword}" cannot be used in this schema location`) + } +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/nullable.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/nullable.ts new file mode 100644 index 0000000000000000000000000000000000000000..c74b05da72dbd4694ac215d5e5616e9050db283c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/nullable.ts @@ -0,0 +1,21 @@ +import type {KeywordCxt} from "../../compile/validate" +import {_, not, nil, Code, Name} from "../../compile/codegen" + +export function checkNullable( + {gen, data, parentSchema}: KeywordCxt, + cond: Code = nil +): [Name, Code] { + const valid = gen.name("valid") + if (parentSchema.nullable) { + gen.let(valid, _`${data} === null`) + cond = not(valid) + } else { + gen.let(valid, false) + } + return [valid, cond] +} + +export function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code] { + const [valid, cond_] = checkNullable(cxt, cond) + return [valid, _`${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`] +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e91c8d91874407585b29641f22457822079fd66 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts @@ -0,0 +1,15 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {validateProperties, error} from "./properties" + +const def: CodeKeywordDefinition = { + keyword: "optionalProperties", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + if (cxt.parentSchema.properties) return + validateProperties(cxt) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/properties.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/properties.ts new file mode 100644 index 0000000000000000000000000000000000000000..9dd24c5cd62d46a913d644636fc9eacbb7f8a4fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/properties.ts @@ -0,0 +1,184 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + SchemaObject, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {propertyInData, allSchemaProperties, isOwnProperty} from "../code" +import {alwaysValidSchema, schemaRefOrVal} from "../../compile/util" +import {_, and, not, Code, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" + +enum PropError { + Additional = "additional", + Missing = "missing", +} + +type PropKeyword = "properties" | "optionalProperties" + +type PropSchema = {[P in string]?: SchemaObject} + +export type JTDPropertiesError = + | _JTDTypeError + | ErrorObject + | ErrorObject + +export const error: KeywordErrorDefinition = { + message: (cxt) => { + const {params} = cxt + return params.propError + ? params.propError === PropError.Additional + ? "must NOT have additional properties" + : `must have property '${params.missingProperty}'` + : typeErrorMessage(cxt, "object") + }, + params: (cxt) => { + const {params} = cxt + return params.propError + ? params.propError === PropError.Additional + ? _`{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` + : _`{error: ${params.propError}, missingProperty: ${params.missingProperty}}` + : typeErrorParams(cxt, "object") + }, +} + +const def: CodeKeywordDefinition = { + keyword: "properties", + schemaType: "object", + error, + code: validateProperties, +} + +// const error: KeywordErrorDefinition = { +// message: "should NOT have additional properties", +// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +// } + +export function validateProperties(cxt: KeywordCxt): void { + checkMetadata(cxt) + const {gen, data, parentSchema, it} = cxt + const {additionalProperties, nullable} = parentSchema + if (it.jtdDiscriminator && nullable) throw new Error("JTD: nullable inside discriminator mapping") + if (commonProperties()) { + throw new Error("JTD: properties and optionalProperties have common members") + } + const [allProps, properties] = schemaProperties("properties") + const [allOptProps, optProperties] = schemaProperties("optionalProperties") + if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { + return + } + + const [valid, cond] = + it.jtdDiscriminator === undefined + ? checkNullableObject(cxt, data) + : [gen.let("valid", false), true] + gen.if(cond, () => + gen.assign(valid, true).block(() => { + validateProps(properties, "properties", true) + validateProps(optProperties, "optionalProperties") + if (!additionalProperties) validateAdditional() + }) + ) + cxt.pass(valid) + + function commonProperties(): boolean { + const props = parentSchema.properties as Record | undefined + const optProps = parentSchema.optionalProperties as Record | undefined + if (!(props && optProps)) return false + for (const p in props) { + if (Object.prototype.hasOwnProperty.call(optProps, p)) return true + } + return false + } + + function schemaProperties(keyword: string): [string[], string[]] { + const schema = parentSchema[keyword] + const allPs = schema ? allSchemaProperties(schema) : [] + if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { + throw new Error(`JTD: discriminator tag used in ${keyword}`) + } + const ps = allPs.filter((p) => !alwaysValidSchema(it, schema[p])) + return [allPs, ps] + } + + function validateProps(props: string[], keyword: string, required?: boolean): void { + const _valid = gen.var("valid") + for (const prop of props) { + gen.if( + propertyInData(gen, data, prop, it.opts.ownProperties), + () => applyPropertySchema(prop, keyword, _valid), + () => missingProperty(prop) + ) + cxt.ok(_valid) + } + + function missingProperty(prop: string): void { + if (required) { + gen.assign(_valid, false) + cxt.error(false, {propError: PropError.Missing, missingProperty: prop}, {schemaPath: prop}) + } else { + gen.assign(_valid, true) + } + } + } + + function applyPropertySchema(prop: string, keyword: string, _valid: Name): void { + cxt.subschema( + { + keyword, + schemaProp: prop, + dataProp: prop, + }, + _valid + ) + } + + function validateAdditional(): void { + gen.forIn("key", data, (key: Name) => { + const addProp = isAdditional(key, allProps, "properties", it.jtdDiscriminator) + const addOptProp = isAdditional(key, allOptProps, "optionalProperties") + const extra = + addProp === true ? addOptProp : addOptProp === true ? addProp : and(addProp, addOptProp) + gen.if(extra, () => { + if (it.opts.removeAdditional) { + gen.code(_`delete ${data}[${key}]`) + } else { + cxt.error( + false, + {propError: PropError.Additional, additionalProperty: key}, + {instancePath: key, parentSchema: true} + ) + if (!it.opts.allErrors) gen.break() + } + }) + }) + } + + function isAdditional( + key: Name, + props: string[], + keyword: string, + jtdDiscriminator?: string + ): Code | true { + let additional: Code | boolean + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = schemaRefOrVal(it, parentSchema[keyword], keyword) + additional = not(isOwnProperty(gen, propsSchema as Code, key)) + if (jtdDiscriminator !== undefined) { + additional = and(additional, _`${key} !== ${jtdDiscriminator}`) + } + } else if (props.length || jtdDiscriminator !== undefined) { + const ps = jtdDiscriminator === undefined ? props : [jtdDiscriminator].concat(props) + additional = and(...ps.map((p) => _`${key} !== ${p}`)) + } else { + additional = true + } + return additional + } +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/ref.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/ref.ts new file mode 100644 index 0000000000000000000000000000000000000000..97646ee1b68885bf004ce2e629421abac07a991d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/ref.ts @@ -0,0 +1,76 @@ +import type {CodeKeywordDefinition, AnySchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {compileSchema, SchemaEnv} from "../../compile" +import {_, not, nil, stringify} from "../../compile/codegen" +import MissingRefError from "../../compile/ref_error" +import N from "../../compile/names" +import {getValidate, callRef} from "../core/ref" +import {checkMetadata} from "./metadata" + +const def: CodeKeywordDefinition = { + keyword: "ref", + schemaType: "string", + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema: ref, parentSchema, it} = cxt + const { + schemaEnv: {root}, + } = it + const valid = gen.name("valid") + if (parentSchema.nullable) { + gen.var(valid, _`${data} === null`) + gen.if(not(valid), validateJtdRef) + } else { + gen.var(valid, false) + validateJtdRef() + } + cxt.ok(valid) + + function validateJtdRef(): void { + const refSchema = (root.schema as AnySchemaObject).definitions?.[ref] + if (!refSchema) { + throw new MissingRefError(it.opts.uriResolver, "", ref, `No definition ${ref}`) + } + if (hasRef(refSchema) || !it.opts.inlineRefs) callValidate(refSchema) + else inlineRefSchema(refSchema) + } + + function callValidate(schema: AnySchemaObject): void { + const sch = compileSchema.call( + it.self, + new SchemaEnv({schema, root, schemaPath: `/definitions/${ref}`}) + ) + const v = getValidate(cxt, sch) + const errsCount = gen.const("_errs", N.errors) + callRef(cxt, v, sch, sch.$async) + gen.assign(valid, _`${errsCount} === ${N.errors}`) + } + + function inlineRefSchema(schema: AnySchemaObject): void { + const schName = gen.scopeValue( + "schema", + it.opts.code.source === true ? {ref: schema, code: stringify(schema)} : {ref: schema} + ) + cxt.subschema( + { + schema, + dataTypes: [], + schemaPath: nil, + topSchemaRef: schName, + errSchemaPath: `/definitions/${ref}`, + }, + valid + ) + } + }, +} + +export function hasRef(schema: AnySchemaObject): boolean { + for (const key in schema) { + let sch: AnySchemaObject + if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) return true + } + return false +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/type.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/type.ts new file mode 100644 index 0000000000000000000000000000000000000000..17274300b70b11b72977a965a4410f21a8f0f19c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/type.ts @@ -0,0 +1,75 @@ +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 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/union.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/union.ts new file mode 100644 index 0000000000000000000000000000000000000000..588f07ab4a96bb88512579ce0cc683eaa5925eb2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/union.ts @@ -0,0 +1,12 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateUnion} from "../code" + +const def: CodeKeywordDefinition = { + keyword: "union", + schemaType: "array", + trackErrors: true, + code: validateUnion, + error: {message: "must match a schema in union"}, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/values.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/values.ts new file mode 100644 index 0000000000000000000000000000000000000000..e64945077647a81d99a6460ae6e86b5394c250c4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/jtd/values.ts @@ -0,0 +1,58 @@ +import type {CodeKeywordDefinition, SchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema, Type} from "../../compile/util" +import {not, or, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeError, _JTDTypeError} from "./error" + +export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject> + +const def: CodeKeywordDefinition = { + keyword: "values", + schemaType: "object", + error: typeError("object"), + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, it} = cxt + const [valid, cond] = checkNullableObject(cxt, data) + if (alwaysValidSchema(it, schema)) { + gen.if(not(or(cond, valid)), () => cxt.error()) + } else { + gen.if(cond) + gen.assign(valid, validateMap()) + gen.elseIf(not(valid)) + cxt.error() + gen.endIf() + } + cxt.ok(valid) + + function validateMap(): Name | boolean { + const _valid = gen.name("valid") + if (it.allErrors) { + const validMap = gen.let("valid", true) + validateValues(() => gen.assign(validMap, false)) + return validMap + } + gen.var(_valid, true) + validateValues(() => gen.break()) + return _valid + + function validateValues(notValid: () => void): void { + gen.forIn("key", data, (key) => { + cxt.subschema( + { + keyword: "values", + dataProp: key, + dataPropType: Type.Str, + }, + _valid + ) + gen.if(not(_valid), notValid) + }) + } + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/metadata.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/metadata.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9d5af85fe921f9cd553e61da6a09234213f0e5b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/metadata.ts @@ -0,0 +1,17 @@ +import type {Vocabulary} from "../types" + +export const metadataVocabulary: Vocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples", +] + +export const contentVocabulary: Vocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema", +] diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/next.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/next.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e987ad21241259ff0453a45534d0822fa3b7e58 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/next.ts @@ -0,0 +1,8 @@ +import type {Vocabulary} from "../types" +import dependentRequired from "./validation/dependentRequired" +import dependentSchemas from "./applicator/dependentSchemas" +import limitContains from "./validation/limitContains" + +const next: Vocabulary = [dependentRequired, dependentSchemas, limitContains] + +export default next diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7f0815dbb00cfccd96f8910bea06182f9e19993 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/index.ts @@ -0,0 +1,7 @@ +import type {Vocabulary} from "../../types" +import unevaluatedProperties from "./unevaluatedProperties" +import unevaluatedItems from "./unevaluatedItems" + +const unevaluated: Vocabulary = [unevaluatedProperties, unevaluatedItems] + +export default unevaluated diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts new file mode 100644 index 0000000000000000000000000000000000000000..50bf0e7c17873ad2f435a92105745d4aa8ed9d26 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts @@ -0,0 +1,47 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, Type} from "../../compile/util" + +export type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt: KeywordCxt) { + const {gen, schema, data, it} = cxt + const items = it.items || 0 + if (items === true) return + const len = gen.const("len", _`${data}.length`) + if (schema === false) { + cxt.setParams({len: items}) + cxt.fail(_`${len} > ${items}`) + } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", _`${len} <= ${items}`) + gen.if(not(valid), () => validateItems(valid, items)) + cxt.ok(valid) + } + it.items = true + + function validateItems(valid: Name, from: Name | number): void { + gen.forRange("i", from, len, (i) => { + cxt.subschema({keyword: "unevaluatedItems", dataProp: i, dataPropType: Type.Num}, valid) + if (!it.allErrors) gen.if(not(valid), () => gen.break()) + }) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e6868fa326dab80317a39e135a4b4deb1d0f2f4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts @@ -0,0 +1,85 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import {_, not, and, Name, Code} from "../../compile/codegen" +import {alwaysValidSchema, Type} from "../../compile/util" +import N from "../../compile/names" + +export type UnevaluatedPropertiesError = ErrorObject< + "unevaluatedProperties", + {unevaluatedProperty: string}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: "must NOT have unevaluated properties", + params: ({params}) => _`{unevaluatedProperty: ${params.unevaluatedProperty}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const {gen, schema, data, errsCount, it} = cxt + /* istanbul ignore if */ + if (!errsCount) throw new Error("ajv implementation error") + const {allErrors, props} = it + if (props instanceof Name) { + gen.if(_`${props} !== true`, () => + gen.forIn("key", data, (key: Name) => + gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)) + ) + ) + } else if (props !== true) { + gen.forIn("key", data, (key: Name) => + props === undefined + ? unevaluatedPropCode(key) + : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)) + ) + } + it.props = true + cxt.ok(_`${errsCount} === ${N.errors}`) + + function unevaluatedPropCode(key: Name): void { + if (schema === false) { + cxt.setParams({unevaluatedProperty: key}) + cxt.error() + if (!allErrors) gen.break() + return + } + + if (!alwaysValidSchema(it, schema)) { + const valid = gen.name("valid") + cxt.subschema( + { + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: Type.Str, + }, + valid + ) + if (!allErrors) gen.if(not(valid), () => gen.break()) + } + } + + function unevaluatedDynamic(evaluatedProps: Name, key: Name): Code { + return _`!${evaluatedProps} || !${evaluatedProps}[${key}]` + } + + function unevaluatedStatic(evaluatedProps: {[K in string]?: true}, key: Name): Code { + const ps: Code[] = [] + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) ps.push(_`${key} !== ${p}`) + } + return and(...ps) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/const.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/const.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3b94a5dcd3d0ad993a83088694b9375089f735d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/const.ts @@ -0,0 +1,28 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type ConstError = ErrorObject<"const", {allowedValue: any}> + +const error: KeywordErrorDefinition = { + message: "must be equal to constant", + params: ({schemaCode}) => _`{allowedValue: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "const", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schemaCode, schema} = cxt + if ($data || (schema && typeof schema == "object")) { + cxt.fail$data(_`!${useFunc(gen, equal)}(${data}, ${schemaCode})`) + } else { + cxt.fail(_`${schema} !== ${data}`) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c616cfa9ac79fabdd5e4d2ff19840adec61f813 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts @@ -0,0 +1,23 @@ +import type {CodeKeywordDefinition, ErrorObject} from "../../types" +import { + validatePropertyDeps, + error, + DependenciesErrorParams, + PropertyDependencies, +} from "../applicator/dependencies" + +export type DependentRequiredError = ErrorObject< + "dependentRequired", + DependenciesErrorParams, + PropertyDependencies +> + +const def: CodeKeywordDefinition = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error, + code: (cxt) => validatePropertyDeps(cxt), +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/enum.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/enum.ts new file mode 100644 index 0000000000000000000000000000000000000000..76377fb02e6a9e8843ba08b2e858a19a067b787b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/enum.ts @@ -0,0 +1,54 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, or, Name, Code} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type EnumError = ErrorObject<"enum", {allowedValues: any[]}, any[] | {$data: string}> + +const error: KeywordErrorDefinition = { + message: "must be equal to one of the allowed values", + params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "enum", + schemaType: "array", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schema, schemaCode, it} = cxt + if (!$data && schema.length === 0) throw new Error("enum must have non-empty array") + const useLoop = schema.length >= it.opts.loopEnum + let eql: Name | undefined + const getEql = (): Name => (eql ??= useFunc(gen, equal)) + + let valid: Code + if (useLoop || $data) { + valid = gen.let("valid") + cxt.block$data(valid, loopEnum) + } else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const vSchema = gen.const("vSchema", schemaCode) + valid = or(...schema.map((_x: unknown, i: number) => equalCode(vSchema, i))) + } + cxt.pass(valid) + + function loopEnum(): void { + gen.assign(valid, false) + gen.forOf("v", schemaCode as Code, (v) => + gen.if(_`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()) + ) + } + + function equalCode(vSchema: Name, i: number): Code { + const sch = schema[i] + return typeof sch === "object" && sch !== null + ? _`${getEql()}(${data}, ${vSchema}[${i}])` + : _`${data} === ${sch}` + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/index.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..3531b19628b7dfb2526a81cd38d6c93ee1a54dbe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/index.ts @@ -0,0 +1,49 @@ +import type {ErrorObject, Vocabulary} from "../../types" +import limitNumber, {LimitNumberError} from "./limitNumber" +import multipleOf, {MultipleOfError} from "./multipleOf" +import limitLength from "./limitLength" +import pattern, {PatternError} from "./pattern" +import limitProperties from "./limitProperties" +import required, {RequiredError} from "./required" +import limitItems from "./limitItems" +import uniqueItems, {UniqueItemsError} from "./uniqueItems" +import constKeyword, {ConstError} from "./const" +import enumKeyword, {EnumError} from "./enum" + +const validation: Vocabulary = [ + // number + limitNumber, + multipleOf, + // string + limitLength, + pattern, + // object + limitProperties, + required, + // array + limitItems, + uniqueItems, + // any + {keyword: "type", schemaType: ["string", "array"]}, + {keyword: "nullable", schemaType: "boolean"}, + constKeyword, + enumKeyword, +] + +export default validation + +type LimitError = ErrorObject< + "maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", + {limit: number}, + number | {$data: string} +> + +export type ValidationKeywordError = + | LimitError + | LimitNumberError + | MultipleOfError + | PatternError + | RequiredError + | UniqueItemsError + | ConstError + | EnumError diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitContains.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitContains.ts new file mode 100644 index 0000000000000000000000000000000000000000..8bb43c1a4a66f1d8781181cbd07f06edb76aea02 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitContains.ts @@ -0,0 +1,16 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({keyword, parentSchema, it}: KeywordCxt) { + if (parentSchema.contains === undefined) { + checkStrictMode(it, `"${keyword}" without "contains" is ignored`) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitItems.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitItems.ts new file mode 100644 index 0000000000000000000000000000000000000000..566de8588b3be2fcccdeff56f26338be0dc6fcb4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitItems.ts @@ -0,0 +1,26 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxItems" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} items` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + const op = keyword === "maxItems" ? operators.GT : operators.LT + cxt.fail$data(_`${data}.length ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitLength.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitLength.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4f947259549ad3d0e9fe992e5a92a83696e1177 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitLength.ts @@ -0,0 +1,30 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import ucs2length from "../../runtime/ucs2length" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxLength" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} characters` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode, it} = cxt + const op = keyword === "maxLength" ? operators.GT : operators.LT + const len = + it.opts.unicode === false ? _`${data}.length` : _`${useFunc(cxt.gen, ucs2length)}(${data})` + cxt.fail$data(_`${len} ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts new file mode 100644 index 0000000000000000000000000000000000000000..5499202efbfec965a9acd8c71e145e79110923d9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts @@ -0,0 +1,42 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators, Code} from "../../compile/codegen" + +const ops = operators + +type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum" + +type Comparison = "<=" | ">=" | "<" | ">" + +const KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = { + maximum: {okStr: "<=", ok: ops.LTE, fail: ops.GT}, + minimum: {okStr: ">=", ok: ops.GTE, fail: ops.LT}, + exclusiveMaximum: {okStr: "<", ok: ops.LT, fail: ops.GTE}, + exclusiveMinimum: {okStr: ">", ok: ops.GT, fail: ops.LTE}, +} + +export type LimitNumberError = ErrorObject< + Kwd, + {limit: number; comparison: Comparison}, + number | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({keyword, schemaCode}) => str`must be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`, + params: ({keyword, schemaCode}) => + _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + cxt.fail$data(_`${data} ${KWDs[keyword as Kwd].fail} ${schemaCode} || isNaN(${data})`) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts new file mode 100644 index 0000000000000000000000000000000000000000..07fffa8b39a03798262a94da5c55ac6e3e7ce200 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts @@ -0,0 +1,26 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxProperties" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} properties` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + const op = keyword === "maxProperties" ? operators.GT : operators.LT + cxt.fail$data(_`Object.keys(${data}).length ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts new file mode 100644 index 0000000000000000000000000000000000000000..1fd79abbd91c41d872ec775441f48b69550e8655 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts @@ -0,0 +1,34 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" + +export type MultipleOfError = ErrorObject< + "multipleOf", + {multipleOf: number}, + number | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must be multiple of ${schemaCode}`, + params: ({schemaCode}) => _`{multipleOf: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, schemaCode, it} = cxt + // const bdt = bad$DataType(schemaCode, def.schemaType, $data) + const prec = it.opts.multipleOfPrecision + const res = gen.let("res") + const invalid = prec + ? _`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : _`${res} !== parseInt(${res})` + cxt.fail$data(_`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/pattern.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/pattern.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b27b7d3c0dfafad85d8612a19ab1e46e899ec2c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/pattern.ts @@ -0,0 +1,28 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {usePattern} from "../code" +import {_, str} from "../../compile/codegen" + +export type PatternError = ErrorObject<"pattern", {pattern: string}, string | {$data: string}> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must match pattern "${schemaCode}"`, + params: ({schemaCode}) => _`{pattern: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt: KeywordCxt) { + const {data, $data, schema, schemaCode, it} = cxt + // TODO regexp should be wrapped in try/catchs + const u = it.opts.unicodeRegExp ? "u" : "" + const regExp = $data ? _`(new RegExp(${schemaCode}, ${u}))` : usePattern(cxt, schema) + cxt.fail$data(_`!${regExp}.test(${data})`) + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/required.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/required.ts new file mode 100644 index 0000000000000000000000000000000000000000..fea7367ed7b8f0cfeee2a73a1cecaca7f8c0c115 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/required.ts @@ -0,0 +1,98 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import { + checkReportMissingProp, + checkMissingProp, + reportMissingProp, + propertyInData, + noPropertyInData, +} from "../code" +import {_, str, nil, not, Name, Code} from "../../compile/codegen" +import {checkStrictMode} from "../../compile/util" + +export type RequiredError = ErrorObject< + "required", + {missingProperty: string}, + string[] | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({params: {missingProperty}}) => str`must have required property '${missingProperty}'`, + params: ({params: {missingProperty}}) => _`{missingProperty: ${missingProperty}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, schemaCode, data, $data, it} = cxt + const {opts} = it + if (!$data && schema.length === 0) return + const useLoop = schema.length >= opts.loopRequired + if (it.allErrors) allErrorsMode() + else exitOnErrorMode() + + if (opts.strictRequired) { + const props = cxt.parentSchema.properties + const {definedProperties} = cxt.it + for (const requiredKey of schema) { + if (props?.[requiredKey] === undefined && !definedProperties.has(requiredKey)) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)` + checkStrictMode(it, msg, it.opts.strictRequired) + } + } + } + + function allErrorsMode(): void { + if (useLoop || $data) { + cxt.block$data(nil, loopAllRequired) + } else { + for (const prop of schema) { + checkReportMissingProp(cxt, prop) + } + } + } + + function exitOnErrorMode(): void { + const missing = gen.let("missing") + if (useLoop || $data) { + const valid = gen.let("valid", true) + cxt.block$data(valid, () => loopUntilMissing(missing, valid)) + cxt.ok(valid) + } else { + gen.if(checkMissingProp(cxt, schema, missing)) + reportMissingProp(cxt, missing) + gen.else() + } + } + + function loopAllRequired(): void { + gen.forOf("prop", schemaCode as Code, (prop) => { + cxt.setParams({missingProperty: prop}) + gen.if(noPropertyInData(gen, data, prop, opts.ownProperties), () => cxt.error()) + }) + } + + function loopUntilMissing(missing: Name, valid: Name): void { + cxt.setParams({missingProperty: missing}) + gen.forOf( + missing, + schemaCode as Code, + () => { + gen.assign(valid, propertyInData(gen, data, missing, opts.ownProperties)) + gen.if(not(valid), () => { + cxt.error() + gen.break() + }) + }, + nil + ) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts new file mode 100644 index 0000000000000000000000000000000000000000..765c4d04fc2472b774838d06fe13c15a98b58a9b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts @@ -0,0 +1,79 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkDataTypes, getSchemaTypes, DataType} from "../../compile/validate/dataType" +import {_, str, Name} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type UniqueItemsError = ErrorObject< + "uniqueItems", + {i: number; j: number}, + boolean | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({params: {i, j}}) => + str`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({params: {i, j}}) => _`{i: ${i}, j: ${j}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schema, parentSchema, schemaCode, it} = cxt + if (!$data && !schema) return + const valid = gen.let("valid") + const itemTypes = parentSchema.items ? getSchemaTypes(parentSchema.items) : [] + cxt.block$data(valid, validateUniqueItems, _`${schemaCode} === false`) + cxt.ok(valid) + + function validateUniqueItems(): void { + const i = gen.let("i", _`${data}.length`) + const j = gen.let("j") + cxt.setParams({i, j}) + gen.assign(valid, true) + gen.if(_`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)) + } + + function canOptimize(): boolean { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array") + } + + function loopN(i: Name, j: Name): void { + const item = gen.name("item") + const wrongType = checkDataTypes(itemTypes, item, it.opts.strictNumbers, DataType.Wrong) + const indices = gen.const("indices", _`{}`) + gen.for(_`;${i}--;`, () => { + gen.let(item, _`${data}[${i}]`) + gen.if(wrongType, _`continue`) + if (itemTypes.length > 1) gen.if(_`typeof ${item} == "string"`, _`${item} += "_"`) + gen + .if(_`typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, _`${indices}[${item}]`) + cxt.error() + gen.assign(valid, false).break() + }) + .code(_`${indices}[${item}] = ${i}`) + }) + } + + function loopN2(i: Name, j: Name): void { + const eql = useFunc(gen, equal) + const outer = gen.name("outer") + gen.label(outer).for(_`;${i}--;`, () => + gen.for(_`${j} = ${i}; ${j}--;`, () => + gen.if(_`${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error() + gen.assign(valid, false).break(outer) + }) + ) + ) + } + }, +} + +export default def diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7cbd2e7a400b4549c0a29dd6ea7692abddafdf6e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.js @@ -0,0 +1,86 @@ +var has = Object.prototype.hasOwnProperty; + +function find(iter, tar, key) { + for (key of iter.keys()) { + if (dequal(key, tar)) return key; + } +} + +function dequal(foo, bar) { + var ctor, len, tmp; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (ctor === Set) { + if (foo.size !== bar.size) { + return false; + } + for (len of foo) { + tmp = len; + if (tmp && typeof tmp === 'object') { + tmp = find(bar, tmp); + if (!tmp) return false; + } + if (!bar.has(tmp)) return false; + } + return true; + } + + if (ctor === Map) { + if (foo.size !== bar.size) { + return false; + } + for (len of foo) { + tmp = len[0]; + if (tmp && typeof tmp === 'object') { + tmp = find(bar, tmp); + if (!tmp) return false; + } + if (!dequal(len[1], bar.get(tmp))) { + return false; + } + } + return true; + } + + if (ctor === ArrayBuffer) { + foo = new Uint8Array(foo); + bar = new Uint8Array(bar); + } else if (ctor === DataView) { + if ((len=foo.byteLength) === bar.byteLength) { + while (len-- && foo.getInt8(len) === bar.getInt8(len)); + } + return len === -1; + } + + if (ArrayBuffer.isView(foo)) { + if ((len=foo.byteLength) === bar.byteLength) { + while (len-- && foo[len] === bar[len]); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} + +exports.dequal = dequal; \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.min.js b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.min.js new file mode 100644 index 0000000000000000000000000000000000000000..0149a23c202d909f8225726c26a1d3809c55f643 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.dequal={})}(this,(function(e){var t=Object.prototype.hasOwnProperty;function r(e,t,r){for(r of e.keys())if(n(r,t))return r}function n(e,f){var i,o,u;if(e===f)return!0;if(e&&f&&(i=e.constructor)===f.constructor){if(i===Date)return e.getTime()===f.getTime();if(i===RegExp)return e.toString()===f.toString();if(i===Array){if((o=e.length)===f.length)for(;o--&&n(e[o],f[o]););return-1===o}if(i===Set){if(e.size!==f.size)return!1;for(o of e){if((u=o)&&"object"==typeof u&&!(u=r(f,u)))return!1;if(!f.has(u))return!1}return!0}if(i===Map){if(e.size!==f.size)return!1;for(o of e){if((u=o[0])&&"object"==typeof u&&!(u=r(f,u)))return!1;if(!n(o[1],f.get(u)))return!1}return!0}if(i===ArrayBuffer)e=new Uint8Array(e),f=new Uint8Array(f);else if(i===DataView){if((o=e.byteLength)===f.byteLength)for(;o--&&e.getInt8(o)===f.getInt8(o););return-1===o}if(ArrayBuffer.isView(e)){if((o=e.byteLength)===f.byteLength)for(;o--&&e[o]===f[o];);return-1===o}if(!i||"object"==typeof e){for(i in o=0,e){if(t.call(e,i)&&++o&&!t.call(f,i))return!1;if(!(i in f)||!n(e[i],f[i]))return!1}return Object.keys(f).length===o}}return e!=e&&f!=f}e.dequal=n})); \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d0b1e2db3aa5dfcf6127417effd9a90b105a10c4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/dist/index.mjs @@ -0,0 +1,84 @@ +var has = Object.prototype.hasOwnProperty; + +function find(iter, tar, key) { + for (key of iter.keys()) { + if (dequal(key, tar)) return key; + } +} + +export function dequal(foo, bar) { + var ctor, len, tmp; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (ctor === Set) { + if (foo.size !== bar.size) { + return false; + } + for (len of foo) { + tmp = len; + if (tmp && typeof tmp === 'object') { + tmp = find(bar, tmp); + if (!tmp) return false; + } + if (!bar.has(tmp)) return false; + } + return true; + } + + if (ctor === Map) { + if (foo.size !== bar.size) { + return false; + } + for (len of foo) { + tmp = len[0]; + if (tmp && typeof tmp === 'object') { + tmp = find(bar, tmp); + if (!tmp) return false; + } + if (!dequal(len[1], bar.get(tmp))) { + return false; + } + } + return true; + } + + if (ctor === ArrayBuffer) { + foo = new Uint8Array(foo); + bar = new Uint8Array(bar); + } else if (ctor === DataView) { + if ((len=foo.byteLength) === bar.byteLength) { + while (len-- && foo.getInt8(len) === bar.getInt8(len)); + } + return len === -1; + } + + if (ArrayBuffer.isView(foo)) { + if ((len=foo.byteLength) === bar.byteLength) { + while (len-- && foo[len] === bar[len]); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9aea5d506ad986388394ac50b80d3575762f01d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.d.ts @@ -0,0 +1 @@ +export function dequal(foo: any, bar: any): boolean; \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ac3eb6b870691e6b0183e5b2839c9d84ac170e32 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.js @@ -0,0 +1,31 @@ +var has = Object.prototype.hasOwnProperty; + +function dequal(foo, bar) { + var ctor, len; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} + +exports.dequal = dequal; \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.min.js b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.min.js new file mode 100644 index 0000000000000000000000000000000000000000..2eaa55fd0607361068ee1daa48374d81bcd26647 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.dequal={})}(this,(function(e){var t=Object.prototype.hasOwnProperty;e.dequal=function e(r,n){var o,i;if(r===n)return!0;if(r&&n&&(o=r.constructor)===n.constructor){if(o===Date)return r.getTime()===n.getTime();if(o===RegExp)return r.toString()===n.toString();if(o===Array){if((i=r.length)===n.length)for(;i--&&e(r[i],n[i]););return-1===i}if(!o||"object"==typeof r){for(o in i=0,r){if(t.call(r,o)&&++i&&!t.call(n,o))return!1;if(!(o in n)||!e(r[o],n[o]))return!1}return Object.keys(n).length===i}}return r!=r&&n!=n}})); \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5820d674f81da6a2ccb6e9cf2ec53ad2a11f0518 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/dequal/lite/index.mjs @@ -0,0 +1,29 @@ +var has = Object.prototype.hasOwnProperty; + +export function dequal(foo, bar) { + var ctor, len; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7eb9c79694cccf3232d3830d9d67a6e200c0662 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/index.d.ts @@ -0,0 +1,2 @@ +declare const equal: (a: any, b: any) => boolean; +export = equal; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d980be2575b7f06e7443bb3ec7023d63d2940c89 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/index.js @@ -0,0 +1,72 @@ +'use strict'; + +// do not edit .js files directly - edit src/index.jst + + + var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; + + +module.exports = function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + + if ((a instanceof Map) && (b instanceof Map)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + for (i of a.entries()) + if (!equal(i[1], b.get(i[0]))) return false; + return true; + } + + if ((a instanceof Set) && (b instanceof Set)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + return true; + } + + if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (a[i] !== b[i]) return false; + return true; + } + + + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + var key = keys[i]; + + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + // true if both NaN, false otherwise + return a!==a && b!==b; +}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/react.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/react.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7eb9c79694cccf3232d3830d9d67a6e200c0662 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/react.d.ts @@ -0,0 +1,2 @@ +declare const equal: (a: any, b: any) => boolean; +export = equal; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/react.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/react.js new file mode 100644 index 0000000000000000000000000000000000000000..98e2f9b71aa8bbf11b7f801814298276f9032541 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-deep-equal/es6/react.js @@ -0,0 +1,79 @@ +'use strict'; + +// do not edit .js files directly - edit src/index.jst + + + var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; + + +module.exports = function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + + if ((a instanceof Map) && (b instanceof Map)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + for (i of a.entries()) + if (!equal(i[1], b.get(i[0]))) return false; + return true; + } + + if ((a instanceof Set) && (b instanceof Set)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + return true; + } + + if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (a[i] !== b[i]) return false; + return true; + } + + + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + var key = keys[i]; + + if (key === '_owner' && a.$$typeof) { + // React-specific: avoid traversing React elements' _owner. + // _owner contains circular references + // and is not needed when comparing the actual elements (and not their owners) + continue; + } + + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + // true if both NaN, false otherwise + return a!==a && b!==b; +}; diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..35d66ca7ac75f125b9c9c5b3dee0987fdfca4a45 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/stale.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/stale.yml new file mode 100644 index 0000000000000000000000000000000000000000..d51ce639022226bc44471aa18bb218b50876cd52 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/stale.yml @@ -0,0 +1,21 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 15 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - "discussion" + - "feature request" + - "bug" + - "help wanted" + - "plugin suggestion" + - "good first issue" +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/workflows/benchmark.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/workflows/benchmark.yml new file mode 100644 index 0000000000000000000000000000000000000000..6f3bf29446ca2ae269e3e07233650ecc1f97a459 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/workflows/benchmark.yml @@ -0,0 +1,85 @@ +name: Benchmark PR + +on: + pull_request_target: + types: [labeled] + +jobs: + benchmark: + if: ${{ github.event.label.name == 'benchmark' }} + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + PR-BENCH: ${{ steps.benchmark-pr.outputs.BENCH_RESULT }} + MASTER-BENCH: ${{ steps.benchmark-master.outputs.BENCH_RESULT }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + ref: ${{github.event.pull_request.head.sha}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install + run: | + npm install --ignore-scripts + + - name: Run benchmark + id: benchmark-pr + run: | + npm run --silent bench > ./bench-result + content=$(cat ./bench-result) + content="${content//'%'/'%25'}" + content="${content//$'\n'/'%0A'}" + content="${content//$'\r'/'%0D'}" + echo "::set-output name=BENCH_RESULT::$content" + + # master benchmark + - uses: actions/checkout@v4 + with: + ref: 'master' + + - name: Install + run: | + npm install --ignore-scripts + + - name: Run benchmark + id: benchmark-master + run: | + npm run --silent bench > ./bench-result + content=$(cat ./bench-result) + content="${content//'%'/'%25'}" + content="${content//$'\n'/'%0A'}" + content="${content//$'\r'/'%0D'}" + echo "::set-output name=BENCH_RESULT::$content" + + output-benchmark: + if: "always()" + needs: [benchmark] + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Comment PR + uses: thollander/actions-comment-pull-request@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + message: | + **PR**: + ``` + ${{ needs.benchmark.outputs.PR-BENCH }} + ``` + **MASTER**: + ``` + ${{ needs.benchmark.outputs.MASTER-BENCH }} + ``` + + - uses: actions-ecosystem/action-remove-labels@v1 + with: + labels: | + benchmark + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..3aa613009753c4be21cc8f212f1495d70427f133 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + push: + branches: + - main + - master + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +jobs: + test: + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 + with: + license-check: true + lint: true diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js new file mode 100644 index 0000000000000000000000000000000000000000..a896e986b1ce4597ab79aa7c00ed44c2329553a4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js @@ -0,0 +1,116 @@ +'use strict' + +const { spawn } = require('child_process') + +const cliSelect = require('cli-select') +const simpleGit = require('simple-git') + +const git = simpleGit(process.cwd()) + +const COMMAND = 'npm run bench' +const DEFAULT_BRANCH = 'master' +const PERCENT_THRESHOLD = 5 +const greyColor = '\x1b[30m' +const redColor = '\x1b[31m' +const greenColor = '\x1b[32m' +const resetColor = '\x1b[0m' + +async function selectBranchName (message, branches) { + console.log(message) + const result = await cliSelect({ + type: 'list', + name: 'branch', + values: branches + }) + console.log(result.value) + return result.value +} + +async function executeCommandOnBranch (command, branch) { + console.log(`${greyColor}Checking out "${branch}"${resetColor}`) + await git.checkout(branch) + + console.log(`${greyColor}Execute "${command}"${resetColor}`) + const childProcess = spawn(command, { stdio: 'pipe', shell: true }) + + let result = '' + childProcess.stdout.on('data', (data) => { + process.stdout.write(data.toString()) + result += data.toString() + }) + + await new Promise(resolve => childProcess.on('close', resolve)) + + console.log() + + return parseBenchmarksStdout(result) +} + +function parseBenchmarksStdout (text) { + const results = [] + + const lines = text.split('\n') + for (const line of lines) { + const match = /^(.+?)(\.*) x (.+) ops\/sec .*$/.exec(line) + if (match !== null) { + results.push({ + name: match[1], + alignedName: match[1] + match[2], + result: parseInt(match[3].split(',').join('')) + }) + } + } + + return results +} + +function compareResults (featureBranch, mainBranch) { + for (const { name, alignedName, result: mainBranchResult } of mainBranch) { + const featureBranchBenchmark = featureBranch.find(result => result.name === name) + if (featureBranchBenchmark) { + const featureBranchResult = featureBranchBenchmark.result + const percent = (featureBranchResult - mainBranchResult) * 100 / mainBranchResult + const roundedPercent = Math.round(percent * 100) / 100 + + const percentString = roundedPercent > 0 ? `+${roundedPercent}%` : `${roundedPercent}%` + const message = alignedName + percentString.padStart(7, '.') + + if (roundedPercent > PERCENT_THRESHOLD) { + console.log(`${greenColor}${message}${resetColor}`) + } else if (roundedPercent < -PERCENT_THRESHOLD) { + console.log(`${redColor}${message}${resetColor}`) + } else { + console.log(message) + } + } + } +} + +(async function () { + const branches = await git.branch() + const currentBranch = branches.branches[branches.current] + + let featureBranch = null + let mainBranch = null + + if (process.argv[2] === '--ci') { + featureBranch = currentBranch.name + mainBranch = DEFAULT_BRANCH + } else { + featureBranch = await selectBranchName('Select the branch you want to compare (feature branch):', branches.all) + mainBranch = await selectBranchName('Select the branch you want to compare with (main branch):', branches.all) + } + + try { + const featureBranchResult = await executeCommandOnBranch(COMMAND, featureBranch) + const mainBranchResult = await executeCommandOnBranch(COMMAND, mainBranch) + compareResults(featureBranchResult, mainBranchResult) + } catch (error) { + console.error('Switch to origin branch due to an error', error.message) + } + + await git.checkout(currentBranch.commit) + await git.checkout(currentBranch.name) + + console.log(`${greyColor}Back to ${currentBranch.name} ${currentBranch.commit}${resetColor}`) +})() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js new file mode 100644 index 0000000000000000000000000000000000000000..658e3a147fc378ea4b4caf514846efc6ff9fcd58 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js @@ -0,0 +1,280 @@ +'use strict' + +const benchmark = require('benchmark') +const suite = new benchmark.Suite() + +const STR_LEN = 1e4 +const LARGE_ARRAY_SIZE = 2e4 +const MULTI_ARRAY_LENGTH = 1e3 + +const schema = { + title: 'Example Schema', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: ['string', 'null'] + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + } + } +} +const schemaCJS = { + title: 'Example Schema', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: ['string', 'null'] + }, + age: { + description: 'Age in years', + type: 'number', + minimum: 0 + } + } +} + +const schemaAJVJTD = { + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string', + nullable: true + }, + age: { + type: 'uint8' + } + } +} + +const arraySchema = { + title: 'array schema', + type: 'array', + items: schema +} + +const arraySchemaCJS = { + title: 'array schema', + type: 'array', + items: schemaCJS +} + +const arraySchemaAJVJTD = { + elements: schemaAJVJTD +} + +const dateFormatSchema = { + description: 'Date of birth', + type: 'string', + format: 'date' +} + +const dateFormatSchemaCJS = { + description: 'Date of birth', + type: 'string', + format: 'date' +} + +const obj = { + firstName: 'Matteo', + lastName: 'Collina', + age: 32 +} + +const date = new Date() + +const multiArray = new Array(MULTI_ARRAY_LENGTH) +const largeArray = new Array(LARGE_ARRAY_SIZE) + +const CJS = require('compile-json-stringify') +const CJSStringify = CJS(schemaCJS) +const CJSStringifyArray = CJS(arraySchemaCJS) +const CJSStringifyDate = CJS(dateFormatSchemaCJS) +const CJSStringifyString = CJS({ type: 'string' }) + +const FJS = require('..') +const stringify = FJS(schema) +const stringifyArrayDefault = FJS(arraySchema) +const stringifyArrayJSONStringify = FJS(arraySchema, { + largeArrayMechanism: 'json-stringify' +}) +const stringifyDate = FJS(dateFormatSchema) +const stringifyString = FJS({ type: 'string' }) +let str = '' + +const Ajv = require('ajv/dist/jtd') +const ajv = new Ajv() +const ajvSerialize = ajv.compileSerializer(schemaAJVJTD) +const ajvSerializeArray = ajv.compileSerializer(arraySchemaAJVJTD) +const ajvSerializeString = ajv.compileSerializer({ type: 'string' }) + +const getRandomString = (length) => { + if (!Number.isInteger(length)) { + throw new Error('Expected integer length') + } + + const validCharacters = 'abcdefghijklmnopqrstuvwxyz' + const nValidCharacters = 26 + + let result = '' + for (let i = 0; i < length; ++i) { + result += validCharacters[Math.floor(Math.random() * nValidCharacters)] + } + + return result[0].toUpperCase() + result.slice(1) +} + +for (let i = 0; i < STR_LEN; i++) { + largeArray[i] = { + firstName: getRandomString(8), + lastName: getRandomString(6), + age: Math.ceil(Math.random() * 99) + } + + str += i + if (i % 100 === 0) { + str += '"' + } +} + +for (let i = STR_LEN; i < LARGE_ARRAY_SIZE; ++i) { + largeArray[i] = { + firstName: getRandomString(10), + lastName: getRandomString(4), + age: Math.ceil(Math.random() * 99) + } +} + +Number(str) + +for (let i = 0; i < MULTI_ARRAY_LENGTH; i++) { + multiArray[i] = obj +} + +suite.add('FJS creation', function () { + FJS(schema) +}) +suite.add('CJS creation', function () { + CJS(schemaCJS) +}) +suite.add('AJV Serialize creation', function () { + ajv.compileSerializer(schemaAJVJTD) +}) + +suite.add('JSON.stringify array', function () { + JSON.stringify(multiArray) +}) + +suite.add('fast-json-stringify array default', function () { + stringifyArrayDefault(multiArray) +}) + +suite.add('fast-json-stringify array json-stringify', function () { + stringifyArrayJSONStringify(multiArray) +}) + +suite.add('compile-json-stringify array', function () { + CJSStringifyArray(multiArray) +}) + +suite.add('AJV Serialize array', function () { + ajvSerializeArray(multiArray) +}) + +suite.add('JSON.stringify large array', function () { + JSON.stringify(largeArray) +}) + +suite.add('fast-json-stringify large array default', function () { + stringifyArrayDefault(largeArray) +}) + +suite.add('fast-json-stringify large array json-stringify', function () { + stringifyArrayJSONStringify(largeArray) +}) + +suite.add('compile-json-stringify large array', function () { + CJSStringifyArray(largeArray) +}) + +suite.add('AJV Serialize large array', function () { + ajvSerializeArray(largeArray) +}) + +suite.add('JSON.stringify long string', function () { + JSON.stringify(str) +}) + +suite.add('fast-json-stringify long string', function () { + stringifyString(str) +}) + +suite.add('compile-json-stringify long string', function () { + CJSStringifyString(str) +}) + +suite.add('AJV Serialize long string', function () { + ajvSerializeString(str) +}) + +suite.add('JSON.stringify short string', function () { + JSON.stringify('hello world') +}) + +suite.add('fast-json-stringify short string', function () { + stringifyString('hello world') +}) + +suite.add('compile-json-stringify short string', function () { + CJSStringifyString('hello world') +}) + +suite.add('AJV Serialize short string', function () { + ajvSerializeString('hello world') +}) + +suite.add('JSON.stringify obj', function () { + JSON.stringify(obj) +}) + +suite.add('fast-json-stringify obj', function () { + stringify(obj) +}) + +suite.add('compile-json-stringify obj', function () { + CJSStringify(obj) +}) + +suite.add('AJV Serialize obj', function () { + ajvSerialize(obj) +}) + +suite.add('JSON stringify date', function () { + JSON.stringify(date) +}) + +suite.add('fast-json-stringify date format', function () { + stringifyDate(date) +}) + +suite.add('compile-json-stringify date format', function () { + CJSStringifyDate(date) +}) + +suite.on('cycle', cycle) + +suite.run() + +function cycle (e) { + console.log(e.target.toString()) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-thread.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-thread.js new file mode 100644 index 0000000000000000000000000000000000000000..7e3ba73e09f64abeaebc86c5b333e7b1fc80b604 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench-thread.js @@ -0,0 +1,21 @@ +'use strict' + +const { workerData: benchmark, parentPort } = require('worker_threads') + +const Benchmark = require('benchmark') +Benchmark.options.minSamples = 100 + +const suite = Benchmark.Suite() + +const FJS = require('..') +const stringify = FJS(benchmark.schema) + +suite + .add(benchmark.name, () => { + stringify(benchmark.input) + }) + .on('cycle', (event) => { + parentPort.postMessage(String(event.target)) + }) + .on('complete', () => {}) + .run() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench.js new file mode 100644 index 0000000000000000000000000000000000000000..acb87b94d3bf58df628dd811e5be62433f89b978 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/benchmark/bench.js @@ -0,0 +1,391 @@ +'use strict' + +const path = require('path') +const { Worker } = require('worker_threads') + +const BENCH_THREAD_PATH = path.join(__dirname, 'bench-thread.js') + +const LONG_STRING_LENGTH = 1e4 +const SHORT_ARRAY_SIZE = 1e3 + +const shortArrayOfNumbers = new Array(SHORT_ARRAY_SIZE) +const shortArrayOfIntegers = new Array(SHORT_ARRAY_SIZE) +const shortArrayOfShortStrings = new Array(SHORT_ARRAY_SIZE) +const shortArrayOfLongStrings = new Array(SHORT_ARRAY_SIZE) +const shortArrayOfMultiObject = new Array(SHORT_ARRAY_SIZE) + +function getRandomInt (max) { + return Math.floor(Math.random() * max) +} + +let longSimpleString = '' +for (let i = 0; i < LONG_STRING_LENGTH; i++) { + longSimpleString += i +} + +let longString = '' +for (let i = 0; i < LONG_STRING_LENGTH; i++) { + longString += i + if (i % 100 === 0) { + longString += '"' + } +} + +for (let i = 0; i < SHORT_ARRAY_SIZE; i++) { + shortArrayOfNumbers[i] = getRandomInt(1000) + shortArrayOfIntegers[i] = getRandomInt(1000) + shortArrayOfShortStrings[i] = 'hello world' + shortArrayOfLongStrings[i] = longString + shortArrayOfMultiObject[i] = { s: 'hello world', n: 42, b: true } +} + +const benchmarks = [ + { + name: 'short string', + schema: { + type: 'string' + }, + input: 'hello world' + }, + { + name: 'unsafe short string', + schema: { + type: 'string', + format: 'unsafe' + }, + input: 'hello world' + }, + { + name: 'short string with double quote', + schema: { + type: 'string' + }, + input: 'hello " world' + }, + { + name: 'long string without double quotes', + schema: { + type: 'string' + }, + input: longSimpleString + }, + { + name: 'unsafe long string without double quotes', + schema: { + type: 'string', + format: 'unsafe' + }, + input: longSimpleString + }, + { + name: 'long string', + schema: { + type: 'string' + }, + input: longString + }, + { + name: 'unsafe long string', + schema: { + type: 'string', + format: 'unsafe' + }, + input: longString + }, + { + name: 'number', + schema: { + type: 'number' + }, + input: 42 + }, + { + name: 'integer', + schema: { + type: 'integer' + }, + input: 42 + }, + { + name: 'formatted date-time', + schema: { + type: 'string', + format: 'date-time' + }, + input: new Date() + }, + { + name: 'formatted date', + schema: { + type: 'string', + format: 'date' + }, + input: new Date() + }, + { + name: 'formatted time', + schema: { + type: 'string', + format: 'time' + }, + input: new Date() + }, + { + name: 'short array of numbers', + schema: { + type: 'array', + items: { type: 'number' } + }, + input: shortArrayOfNumbers + }, + { + name: 'short array of integers', + schema: { + type: 'array', + items: { type: 'integer' } + }, + input: shortArrayOfIntegers + }, + { + name: 'short array of short strings', + schema: { + type: 'array', + items: { type: 'string' } + }, + input: shortArrayOfShortStrings + }, + { + name: 'short array of long strings', + schema: { + type: 'array', + items: { type: 'string' } + }, + input: shortArrayOfShortStrings + }, + { + name: 'short array of objects with properties of different types', + schema: { + type: 'array', + items: { + type: 'object', + properties: { + s: { type: 'string' }, + n: { type: 'number' }, + b: { type: 'boolean' } + } + } + }, + input: shortArrayOfMultiObject + }, + { + name: 'object with number property', + schema: { + type: 'object', + properties: { + a: { type: 'number' } + } + }, + input: { a: 42 } + }, + { + name: 'object with integer property', + schema: { + type: 'object', + properties: { + a: { type: 'integer' } + } + }, + input: { a: 42 } + }, + { + name: 'object with short string property', + schema: { + type: 'object', + properties: { + a: { type: 'string' } + } + }, + input: { a: 'hello world' } + }, + { + name: 'object with long string property', + schema: { + type: 'object', + properties: { + a: { type: 'string' } + } + }, + input: { a: longString } + }, + { + name: 'object with properties of different types', + schema: { + type: 'object', + properties: { + s1: { type: 'string' }, + n1: { type: 'number' }, + b1: { type: 'boolean' }, + s2: { type: 'string' }, + n2: { type: 'number' }, + b2: { type: 'boolean' }, + s3: { type: 'string' }, + n3: { type: 'number' }, + b3: { type: 'boolean' }, + s4: { type: 'string' }, + n4: { type: 'number' }, + b4: { type: 'boolean' }, + s5: { type: 'string' }, + n5: { type: 'number' }, + b5: { type: 'boolean' } + } + }, + input: { + s1: 'hello world', + n1: 42, + b1: true, + s2: 'hello world', + n2: 42, + b2: true, + s3: 'hello world', + n3: 42, + b3: true, + s4: 'hello world', + n4: 42, + b4: true, + s5: 'hello world', + n5: 42, + b5: true + } + }, + { + name: 'simple object', + schema: { + title: 'Example Schema', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: ['string', 'null'] + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + } + } + }, + input: { firstName: 'Max', lastName: 'Power', age: 22 } + }, + { + name: 'simple object with required fields', + schema: { + title: 'Example Schema', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: ['string', 'null'] + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + } + }, + required: ['firstName', 'lastName', 'age'] + }, + input: { firstName: 'Max', lastName: 'Power', age: 22 } + }, + { + name: 'object with const string property', + schema: { + type: 'object', + properties: { + a: { const: 'const string' } + } + }, + input: { a: 'const string' } + }, + { + name: 'object with const number property', + schema: { + type: 'object', + properties: { + a: { const: 1 } + } + }, + input: { a: 1 } + }, + { + name: 'object with const bool property', + schema: { + type: 'object', + properties: { + a: { const: true } + } + }, + input: { a: true } + }, + { + name: 'object with const object property', + schema: { + type: 'object', + properties: { + foo: { const: { bar: 'baz' } } + } + }, + input: { + foo: { bar: 'baz' } + } + }, + { + name: 'object with const null property', + schema: { + type: 'object', + properties: { + foo: { const: null } + } + }, + input: { + foo: null + } + } +] + +async function runBenchmark (benchmark) { + const worker = new Worker(BENCH_THREAD_PATH, { workerData: benchmark }) + + return new Promise((resolve, reject) => { + let result = null + worker.on('error', reject) + worker.on('message', (benchResult) => { + result = benchResult + }) + worker.on('exit', (code) => { + if (code === 0) { + resolve(result) + } else { + reject(new Error(`Worker stopped with exit code ${code}`)) + } + }) + }) +} + +async function runBenchmarks () { + let maxNameLength = 0 + for (const benchmark of benchmarks) { + maxNameLength = Math.max(benchmark.name.length, maxNameLength) + } + + for (const benchmark of benchmarks) { + benchmark.name = benchmark.name.padEnd(maxNameLength, '.') + const resultMessage = await runBenchmark(benchmark) + console.log(resultMessage) + } +} + +runBenchmarks() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/build/build-schema-validator.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/build/build-schema-validator.js new file mode 100644 index 0000000000000000000000000000000000000000..0c188cc4c6309865133d5b7065ebe7989f89c6af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/build/build-schema-validator.js @@ -0,0 +1,26 @@ +'use strict' + +const Ajv = require('ajv') +const standaloneCode = require('ajv/dist/standalone').default +const ajvFormats = require('ajv-formats') +const fs = require('fs') +const path = require('path') + +const ajv = new Ajv({ + addUsedSchema: false, + allowUnionTypes: true, + code: { + source: true, + lines: true, + optimize: 3 + } +}) +ajvFormats(ajv) + +const schema = require('ajv/lib/refs/json-schema-draft-07.json') +const validate = ajv.compile(schema) +const validationCode = standaloneCode(ajv, validate) + +const moduleCode = `/* CODE GENERATED BY '${path.basename(__filename)}' DO NOT EDIT! */\n${validationCode}` + +fs.writeFileSync(path.join(__dirname, '../lib/schema-validator.js'), moduleCode) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/examples/example.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/examples/example.js new file mode 100644 index 0000000000000000000000000000000000000000..4f372dc640689d0d05f2b4e6d565ba676508407b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/examples/example.js @@ -0,0 +1,81 @@ +'use strict' + +const fastJson = require('..') +const stringify = fastJson({ + title: 'Example Schema', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years', + type: 'integer' + }, + now: { + type: 'string' + }, + birthdate: { + type: ['string'], + format: 'date-time' + }, + reg: { + type: 'string' + }, + obj: { + type: 'object', + properties: { + bool: { + type: 'boolean' + } + } + }, + arr: { + type: 'array', + items: { + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + } + }, + required: ['now'], + patternProperties: { + '.*foo$': { + type: 'string' + }, + test: { + type: 'number' + }, + date: { + type: 'string', + format: 'date-time' + } + }, + additionalProperties: { + type: 'string' + } +}) + +console.log(stringify({ + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + now: new Date(), + reg: /"([^"]|\\")*"/, + foo: 'hello', + numfoo: 42, + test: 42, + strtest: '23', + arr: [{ str: 'stark' }, { str: 'lannister' }], + obj: { bool: true }, + notmatch: 'valar morghulis', + notmatchobj: { a: true }, + notmatchnum: 42 +})) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/examples/server.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/examples/server.js new file mode 100644 index 0000000000000000000000000000000000000000..706653b85dcfadea25d2bb2b09a0d1b7e2eaec0e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/examples/server.js @@ -0,0 +1,42 @@ +'use strict' + +const http = require('http') + +const stringify = require('fast-json-stringify')({ + type: 'object', + properties: { + hello: { + type: 'string' + }, + data: { + type: 'number' + }, + nested: { + type: 'object', + properties: { + more: { + type: 'string' + } + } + } + } +}) + +const server = http.createServer(handle) + +function handle (req, res) { + const data = { + hello: 'world', + data: 42, + nested: { + more: 'data' + } + } + if (req.url === '/JSON') { + res.end(JSON.stringify(data)) + } else { + res.end(stringify(data)) + } +} + +server.listen(3000) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/location.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/location.js new file mode 100644 index 0000000000000000000000000000000000000000..0d9acb2dfcda9518af2ac967c76cb89c7d91514f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/location.js @@ -0,0 +1,24 @@ +'use strict' + +class Location { + constructor (schema, schemaId, jsonPointer = '#') { + this.schema = schema + this.schemaId = schemaId + this.jsonPointer = jsonPointer + } + + getPropertyLocation (propertyName) { + const propertyLocation = new Location( + this.schema[propertyName], + this.schemaId, + this.jsonPointer + '/' + propertyName + ) + return propertyLocation + } + + getSchemaRef () { + return this.schemaId + this.jsonPointer + } +} + +module.exports = Location diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/merge-schemas.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/merge-schemas.js new file mode 100644 index 0000000000000000000000000000000000000000..bb27a8bfb3a85725c50cd29f2f06898d0cf62692 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/merge-schemas.js @@ -0,0 +1,9 @@ +'use strict' + +const { mergeSchemas: _mergeSchemas } = require('@fastify/merge-json-schemas') + +function mergeSchemas (schemas) { + return _mergeSchemas(schemas, { onConflict: 'skip' }) +} + +module.exports = mergeSchemas diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/schema-validator.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/schema-validator.js new file mode 100644 index 0000000000000000000000000000000000000000..1491d7941c68c2b5d38cc7f1214a34fc0a9db10a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/schema-validator.js @@ -0,0 +1,1134 @@ +/* CODE GENERATED BY 'build-schema-validator.js' DO NOT EDIT! */ +"use strict"; +module.exports = validate10; +module.exports.default = validate10; +const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}; +const schema12 = {"type":"integer","minimum":0}; +const schema18 = {"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}; +const schema20 = {"enum":["array","boolean","integer","null","number","object","string"]}; +const formats0 = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +const formats2 = require("ajv-formats/dist/formats").fullFormats.uri; +const formats6 = require("ajv-formats/dist/formats").fullFormats.regex; +const schema13 = {"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]}; + +function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){ +let vErrors = null; +let errors = 0; +const _errs1 = errors; +if(!(((typeof data == "number") && (!(data % 1) && !isNaN(data))) && (isFinite(data)))){ +validate11.errors = [{instancePath,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer"}]; +return false; +} +if(errors === _errs1){ +if((typeof data == "number") && (isFinite(data))){ +if(data < 0 || isNaN(data)){ +validate11.errors = [{instancePath,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}]; +return false; +} +} +} +validate11.errors = vErrors; +return errors === 0; +} + +const schema15 = {"type":"array","minItems":1,"items":{"$ref":"#"}}; +const root1 = {validate: validate10}; + +function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){ +let vErrors = null; +let errors = 0; +if(errors === 0){ +if(Array.isArray(data)){ +if(data.length < 1){ +validate13.errors = [{instancePath,schemaPath:"#/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}]; +return false; +} +else { +var valid0 = true; +const len0 = data.length; +for(let i0=0; i0", limit: 0},message:"must be > 0"}]; +return false; +} +} +else { +validate10.errors = [{instancePath:instancePath+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type: "number"},message:"must be number"}]; +return false; +} +} +var valid0 = _errs17 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.maximum !== undefined){ +let data9 = data.maximum; +const _errs19 = errors; +if(!((typeof data9 == "number") && (isFinite(data9)))){ +validate10.errors = [{instancePath:instancePath+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type: "number"},message:"must be number"}]; +return false; +} +var valid0 = _errs19 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.exclusiveMaximum !== undefined){ +let data10 = data.exclusiveMaximum; +const _errs21 = errors; +if(!((typeof data10 == "number") && (isFinite(data10)))){ +validate10.errors = [{instancePath:instancePath+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type: "number"},message:"must be number"}]; +return false; +} +var valid0 = _errs21 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.minimum !== undefined){ +let data11 = data.minimum; +const _errs23 = errors; +if(!((typeof data11 == "number") && (isFinite(data11)))){ +validate10.errors = [{instancePath:instancePath+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type: "number"},message:"must be number"}]; +return false; +} +var valid0 = _errs23 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.exclusiveMinimum !== undefined){ +let data12 = data.exclusiveMinimum; +const _errs25 = errors; +if(!((typeof data12 == "number") && (isFinite(data12)))){ +validate10.errors = [{instancePath:instancePath+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type: "number"},message:"must be number"}]; +return false; +} +var valid0 = _errs25 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.maxLength !== undefined){ +let data13 = data.maxLength; +const _errs27 = errors; +const _errs28 = errors; +if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){ +validate10.errors = [{instancePath:instancePath+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer"}]; +return false; +} +if(errors === _errs28){ +if((typeof data13 == "number") && (isFinite(data13))){ +if(data13 < 0 || isNaN(data13)){ +validate10.errors = [{instancePath:instancePath+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}]; +return false; +} +} +} +var valid0 = _errs27 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.minLength !== undefined){ +const _errs30 = errors; +if(!(validate11(data.minLength, {instancePath:instancePath+"/minLength",parentData:data,parentDataProperty:"minLength",rootData}))){ +vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors); +errors = vErrors.length; +} +var valid0 = _errs30 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.pattern !== undefined){ +let data15 = data.pattern; +const _errs31 = errors; +if(errors === _errs31){ +if(errors === _errs31){ +if(typeof data15 === "string"){ +if(!(formats6(data15))){ +validate10.errors = [{instancePath:instancePath+"/pattern",schemaPath:"#/properties/pattern/format",keyword:"format",params:{format: "regex"},message:"must match format \""+"regex"+"\""}]; +return false; +} +} +else { +validate10.errors = [{instancePath:instancePath+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type: "string"},message:"must be string"}]; +return false; +} +} +} +var valid0 = _errs31 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.additionalItems !== undefined){ +const _errs33 = errors; +if(!(validate10(data.additionalItems, {instancePath:instancePath+"/additionalItems",parentData:data,parentDataProperty:"additionalItems",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs33 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.items !== undefined){ +let data17 = data.items; +const _errs34 = errors; +const _errs35 = errors; +let valid2 = false; +const _errs36 = errors; +if(!(validate10(data17, {instancePath:instancePath+"/items",parentData:data,parentDataProperty:"items",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var _valid0 = _errs36 === errors; +valid2 = valid2 || _valid0; +if(!valid2){ +const _errs37 = errors; +if(!(validate13(data17, {instancePath:instancePath+"/items",parentData:data,parentDataProperty:"items",rootData}))){ +vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors); +errors = vErrors.length; +} +var _valid0 = _errs37 === errors; +valid2 = valid2 || _valid0; +} +if(!valid2){ +const err0 = {instancePath:instancePath+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"}; +if(vErrors === null){ +vErrors = [err0]; +} +else { +vErrors.push(err0); +} +errors++; +validate10.errors = vErrors; +return false; +} +else { +errors = _errs35; +if(vErrors !== null){ +if(_errs35){ +vErrors.length = _errs35; +} +else { +vErrors = null; +} +} +} +var valid0 = _errs34 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.maxItems !== undefined){ +let data18 = data.maxItems; +const _errs38 = errors; +const _errs39 = errors; +if(!(((typeof data18 == "number") && (!(data18 % 1) && !isNaN(data18))) && (isFinite(data18)))){ +validate10.errors = [{instancePath:instancePath+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer"}]; +return false; +} +if(errors === _errs39){ +if((typeof data18 == "number") && (isFinite(data18))){ +if(data18 < 0 || isNaN(data18)){ +validate10.errors = [{instancePath:instancePath+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}]; +return false; +} +} +} +var valid0 = _errs38 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.minItems !== undefined){ +const _errs41 = errors; +if(!(validate11(data.minItems, {instancePath:instancePath+"/minItems",parentData:data,parentDataProperty:"minItems",rootData}))){ +vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors); +errors = vErrors.length; +} +var valid0 = _errs41 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.uniqueItems !== undefined){ +const _errs42 = errors; +if(typeof data.uniqueItems !== "boolean"){ +validate10.errors = [{instancePath:instancePath+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}]; +return false; +} +var valid0 = _errs42 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.contains !== undefined){ +const _errs44 = errors; +if(!(validate10(data.contains, {instancePath:instancePath+"/contains",parentData:data,parentDataProperty:"contains",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs44 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.maxProperties !== undefined){ +let data22 = data.maxProperties; +const _errs45 = errors; +const _errs46 = errors; +if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){ +validate10.errors = [{instancePath:instancePath+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer"}]; +return false; +} +if(errors === _errs46){ +if((typeof data22 == "number") && (isFinite(data22))){ +if(data22 < 0 || isNaN(data22)){ +validate10.errors = [{instancePath:instancePath+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}]; +return false; +} +} +} +var valid0 = _errs45 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.minProperties !== undefined){ +const _errs48 = errors; +if(!(validate11(data.minProperties, {instancePath:instancePath+"/minProperties",parentData:data,parentDataProperty:"minProperties",rootData}))){ +vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors); +errors = vErrors.length; +} +var valid0 = _errs48 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.required !== undefined){ +let data24 = data.required; +const _errs49 = errors; +const _errs50 = errors; +if(errors === _errs50){ +if(Array.isArray(data24)){ +var valid6 = true; +const len0 = data24.length; +for(let i0=0; i0 1){ +const indices0 = {}; +for(;i1--;){ +let item0 = data24[i1]; +if(typeof item0 !== "string"){ +continue; +} +if(typeof indices0[item0] == "number"){ +j0 = indices0[item0]; +validate10.errors = [{instancePath:instancePath+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}]; +return false; +break; +} +indices0[item0] = i1; +} +} +} +} +else { +validate10.errors = [{instancePath:instancePath+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type: "array"},message:"must be array"}]; +return false; +} +} +var valid0 = _errs49 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.additionalProperties !== undefined){ +const _errs54 = errors; +if(!(validate10(data.additionalProperties, {instancePath:instancePath+"/additionalProperties",parentData:data,parentDataProperty:"additionalProperties",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs54 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.definitions !== undefined){ +let data27 = data.definitions; +const _errs55 = errors; +if(errors === _errs55){ +if(data27 && typeof data27 == "object" && !Array.isArray(data27)){ +for(const key0 in data27){ +const _errs58 = errors; +if(!(validate10(data27[key0], {instancePath:instancePath+"/definitions/" + key0.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data27,parentDataProperty:key0,rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid8 = _errs58 === errors; +if(!valid8){ +break; +} +} +} +else { +validate10.errors = [{instancePath:instancePath+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type: "object"},message:"must be object"}]; +return false; +} +} +var valid0 = _errs55 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.properties !== undefined){ +let data29 = data.properties; +const _errs59 = errors; +if(errors === _errs59){ +if(data29 && typeof data29 == "object" && !Array.isArray(data29)){ +for(const key1 in data29){ +const _errs62 = errors; +if(!(validate10(data29[key1], {instancePath:instancePath+"/properties/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data29,parentDataProperty:key1,rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid9 = _errs62 === errors; +if(!valid9){ +break; +} +} +} +else { +validate10.errors = [{instancePath:instancePath+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type: "object"},message:"must be object"}]; +return false; +} +} +var valid0 = _errs59 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.patternProperties !== undefined){ +let data31 = data.patternProperties; +const _errs63 = errors; +if(errors === _errs63){ +if(data31 && typeof data31 == "object" && !Array.isArray(data31)){ +for(const key2 in data31){ +const _errs65 = errors; +if(errors === _errs65){ +if(typeof key2 === "string"){ +if(!(formats6(key2))){ +const err1 = {instancePath:instancePath+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames/format",keyword:"format",params:{format: "regex"},message:"must match format \""+"regex"+"\"",propertyName:key2}; +if(vErrors === null){ +vErrors = [err1]; +} +else { +vErrors.push(err1); +} +errors++; +} +} +} +var valid10 = _errs65 === errors; +if(!valid10){ +const err2 = {instancePath:instancePath+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName: key2},message:"property name must be valid"}; +if(vErrors === null){ +vErrors = [err2]; +} +else { +vErrors.push(err2); +} +errors++; +validate10.errors = vErrors; +return false; +break; +} +} +if(valid10){ +for(const key3 in data31){ +const _errs67 = errors; +if(!(validate10(data31[key3], {instancePath:instancePath+"/patternProperties/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data31,parentDataProperty:key3,rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid11 = _errs67 === errors; +if(!valid11){ +break; +} +} +} +} +else { +validate10.errors = [{instancePath:instancePath+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type: "object"},message:"must be object"}]; +return false; +} +} +var valid0 = _errs63 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.dependencies !== undefined){ +let data33 = data.dependencies; +const _errs68 = errors; +if(errors === _errs68){ +if(data33 && typeof data33 == "object" && !Array.isArray(data33)){ +for(const key4 in data33){ +let data34 = data33[key4]; +const _errs71 = errors; +const _errs72 = errors; +let valid13 = false; +const _errs73 = errors; +if(!(validate10(data34, {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data33,parentDataProperty:key4,rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var _valid1 = _errs73 === errors; +valid13 = valid13 || _valid1; +if(!valid13){ +const _errs74 = errors; +const _errs75 = errors; +if(errors === _errs75){ +if(Array.isArray(data34)){ +var valid15 = true; +const len1 = data34.length; +for(let i2=0; i2 1){ +const indices1 = {}; +for(;i3--;){ +let item1 = data34[i3]; +if(typeof item1 !== "string"){ +continue; +} +if(typeof indices1[item1] == "number"){ +j1 = indices1[item1]; +const err4 = {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"}; +if(vErrors === null){ +vErrors = [err4]; +} +else { +vErrors.push(err4); +} +errors++; +break; +} +indices1[item1] = i3; +} +} +} +} +else { +const err5 = {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type: "array"},message:"must be array"}; +if(vErrors === null){ +vErrors = [err5]; +} +else { +vErrors.push(err5); +} +errors++; +} +} +var _valid1 = _errs74 === errors; +valid13 = valid13 || _valid1; +} +if(!valid13){ +const err6 = {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"}; +if(vErrors === null){ +vErrors = [err6]; +} +else { +vErrors.push(err6); +} +errors++; +validate10.errors = vErrors; +return false; +} +else { +errors = _errs72; +if(vErrors !== null){ +if(_errs72){ +vErrors.length = _errs72; +} +else { +vErrors = null; +} +} +} +var valid12 = _errs71 === errors; +if(!valid12){ +break; +} +} +} +else { +validate10.errors = [{instancePath:instancePath+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type: "object"},message:"must be object"}]; +return false; +} +} +var valid0 = _errs68 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.propertyNames !== undefined){ +const _errs79 = errors; +if(!(validate10(data.propertyNames, {instancePath:instancePath+"/propertyNames",parentData:data,parentDataProperty:"propertyNames",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs79 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.enum !== undefined){ +let data37 = data.enum; +const _errs80 = errors; +if(errors === _errs80){ +if(Array.isArray(data37)){ +if(data37.length < 1){ +validate10.errors = [{instancePath:instancePath+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}]; +return false; +} +else { +let i4 = data37.length; +let j2; +if(i4 > 1){ +outer0: +for(;i4--;){ +for(j2 = i4; j2--;){ +if(func0(data37[i4], data37[j2])){ +validate10.errors = [{instancePath:instancePath+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i: i4, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i4+" are identical)"}]; +return false; +break outer0; +} +} +} +} +} +} +else { +validate10.errors = [{instancePath:instancePath+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type: "array"},message:"must be array"}]; +return false; +} +} +var valid0 = _errs80 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.type !== undefined){ +let data38 = data.type; +const _errs82 = errors; +const _errs83 = errors; +let valid18 = false; +const _errs84 = errors; +if(!(((((((data38 === "array") || (data38 === "boolean")) || (data38 === "integer")) || (data38 === "null")) || (data38 === "number")) || (data38 === "object")) || (data38 === "string"))){ +const err7 = {instancePath:instancePath+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues: schema20.enum},message:"must be equal to one of the allowed values"}; +if(vErrors === null){ +vErrors = [err7]; +} +else { +vErrors.push(err7); +} +errors++; +} +var _valid2 = _errs84 === errors; +valid18 = valid18 || _valid2; +if(!valid18){ +const _errs86 = errors; +if(errors === _errs86){ +if(Array.isArray(data38)){ +if(data38.length < 1){ +const err8 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}; +if(vErrors === null){ +vErrors = [err8]; +} +else { +vErrors.push(err8); +} +errors++; +} +else { +var valid20 = true; +const len2 = data38.length; +for(let i5=0; i5 1){ +outer1: +for(;i6--;){ +for(j3 = i6; j3--;){ +if(func0(data38[i6], data38[j3])){ +const err10 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i: i6, j: j3},message:"must NOT have duplicate items (items ## "+j3+" and "+i6+" are identical)"}; +if(vErrors === null){ +vErrors = [err10]; +} +else { +vErrors.push(err10); +} +errors++; +break outer1; +} +} +} +} +} +} +} +else { +const err11 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type: "array"},message:"must be array"}; +if(vErrors === null){ +vErrors = [err11]; +} +else { +vErrors.push(err11); +} +errors++; +} +} +var _valid2 = _errs86 === errors; +valid18 = valid18 || _valid2; +} +if(!valid18){ +const err12 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"}; +if(vErrors === null){ +vErrors = [err12]; +} +else { +vErrors.push(err12); +} +errors++; +validate10.errors = vErrors; +return false; +} +else { +errors = _errs83; +if(vErrors !== null){ +if(_errs83){ +vErrors.length = _errs83; +} +else { +vErrors = null; +} +} +} +var valid0 = _errs82 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.format !== undefined){ +const _errs90 = errors; +if(typeof data.format !== "string"){ +validate10.errors = [{instancePath:instancePath+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type: "string"},message:"must be string"}]; +return false; +} +var valid0 = _errs90 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.contentMediaType !== undefined){ +const _errs92 = errors; +if(typeof data.contentMediaType !== "string"){ +validate10.errors = [{instancePath:instancePath+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type: "string"},message:"must be string"}]; +return false; +} +var valid0 = _errs92 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.contentEncoding !== undefined){ +const _errs94 = errors; +if(typeof data.contentEncoding !== "string"){ +validate10.errors = [{instancePath:instancePath+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type: "string"},message:"must be string"}]; +return false; +} +var valid0 = _errs94 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.if !== undefined){ +const _errs96 = errors; +if(!(validate10(data.if, {instancePath:instancePath+"/if",parentData:data,parentDataProperty:"if",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs96 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.then !== undefined){ +const _errs97 = errors; +if(!(validate10(data.then, {instancePath:instancePath+"/then",parentData:data,parentDataProperty:"then",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs97 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.else !== undefined){ +const _errs98 = errors; +if(!(validate10(data.else, {instancePath:instancePath+"/else",parentData:data,parentDataProperty:"else",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs98 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.allOf !== undefined){ +const _errs99 = errors; +if(!(validate13(data.allOf, {instancePath:instancePath+"/allOf",parentData:data,parentDataProperty:"allOf",rootData}))){ +vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors); +errors = vErrors.length; +} +var valid0 = _errs99 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.anyOf !== undefined){ +const _errs100 = errors; +if(!(validate13(data.anyOf, {instancePath:instancePath+"/anyOf",parentData:data,parentDataProperty:"anyOf",rootData}))){ +vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors); +errors = vErrors.length; +} +var valid0 = _errs100 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.oneOf !== undefined){ +const _errs101 = errors; +if(!(validate13(data.oneOf, {instancePath:instancePath+"/oneOf",parentData:data,parentDataProperty:"oneOf",rootData}))){ +vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors); +errors = vErrors.length; +} +var valid0 = _errs101 === errors; +} +else { +var valid0 = true; +} +if(valid0){ +if(data.not !== undefined){ +const _errs102 = errors; +if(!(validate10(data.not, {instancePath:instancePath+"/not",parentData:data,parentDataProperty:"not",rootData}))){ +vErrors = vErrors === null ? validate10.errors : vErrors.concat(validate10.errors); +errors = vErrors.length; +} +var valid0 = _errs102 === errors; +} +else { +var valid0 = true; +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +} +validate10.errors = vErrors; +return errors === 0; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/serializer.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/serializer.js new file mode 100644 index 0000000000000000000000000000000000000000..df81960e0d6fe9cec42ad223640a57f28a1d95e2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/serializer.js @@ -0,0 +1,139 @@ +'use strict' + +// eslint-disable-next-line +const STR_ESCAPE = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/ + +module.exports = class Serializer { + constructor (options) { + switch (options && options.rounding) { + case 'floor': + this.parseInteger = Math.floor + break + case 'ceil': + this.parseInteger = Math.ceil + break + case 'round': + this.parseInteger = Math.round + break + case 'trunc': + default: + this.parseInteger = Math.trunc + break + } + this._options = options + } + + asInteger (i) { + if (Number.isInteger(i)) { + return '' + i + } else if (typeof i === 'bigint') { + return i.toString() + } + /* eslint no-undef: "off" */ + const integer = this.parseInteger(i) + // check if number is Infinity or NaN + // eslint-disable-next-line no-self-compare + if (integer === Infinity || integer === -Infinity || integer !== integer) { + throw new Error(`The value "${i}" cannot be converted to an integer.`) + } + return '' + integer + } + + asNumber (i) { + // fast cast to number + const num = Number(i) + // check if number is NaN + // eslint-disable-next-line no-self-compare + if (num !== num) { + throw new Error(`The value "${i}" cannot be converted to a number.`) + } else if (num === Infinity || num === -Infinity) { + return 'null' + } else { + return '' + num + } + } + + asBoolean (bool) { + return bool && 'true' || 'false' // eslint-disable-line + } + + asDateTime (date) { + if (date === null) return '""' + if (date instanceof Date) { + return '"' + date.toISOString() + '"' + } + if (typeof date === 'string') { + return '"' + date + '"' + } + throw new Error(`The value "${date}" cannot be converted to a date-time.`) + } + + asDate (date) { + if (date === null) return '""' + if (date instanceof Date) { + return '"' + new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0, 10) + '"' + } + if (typeof date === 'string') { + return '"' + date + '"' + } + throw new Error(`The value "${date}" cannot be converted to a date.`) + } + + asTime (date) { + if (date === null) return '""' + if (date instanceof Date) { + return '"' + new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(11, 19) + '"' + } + if (typeof date === 'string') { + return '"' + date + '"' + } + throw new Error(`The value "${date}" cannot be converted to a time.`) + } + + asString (str) { + const len = str.length + if (len < 42) { + // magically escape strings for json + // relying on their charCodeAt + // everything below 32 needs JSON.stringify() + // every string that contain surrogate needs JSON.stringify() + // 34 and 92 happens all the time, so we + // have a fast case for them + let result = '' + let last = -1 + let point = 255 + for (let i = 0; i < len; i++) { + point = str.charCodeAt(i) + if ( + point === 0x22 || // '"' + point === 0x5c // '\' + ) { + last === -1 && (last = 0) + result += str.slice(last, i) + '\\' + last = i + } else if (point < 32 || (point >= 0xD800 && point <= 0xDFFF)) { + // The current character is non-printable characters or a surrogate. + return JSON.stringify(str) + } + } + return (last === -1 && ('"' + str + '"')) || ('"' + result + str.slice(last) + '"') + } else if (len < 5000 && STR_ESCAPE.test(str) === false) { + // Only use the regular expression for shorter input. The overhead is otherwise too much. + return '"' + str + '"' + } else { + return JSON.stringify(str) + } + } + + asUnsafeString (str) { + return '"' + str + '"' + } + + getState () { + return this._options + } + + static restoreFromState (state) { + return new Serializer(state) + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/standalone.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/standalone.js new file mode 100644 index 0000000000000000000000000000000000000000..0ba3ac3f583a07343a81915fbc520ac318cafdf6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/standalone.js @@ -0,0 +1,34 @@ +'use strict' + +function buildStandaloneCode (contextFunc, context, serializer, validator) { + let ajvDependencyCode = '' + if (context.validatorSchemasIds.size > 0) { + ajvDependencyCode += 'const Validator = require(\'fast-json-stringify/lib/validator\')\n' + ajvDependencyCode += `const validatorState = ${JSON.stringify(validator.getState())}\n` + ajvDependencyCode += 'const validator = Validator.restoreFromState(validatorState)\n' + } else { + ajvDependencyCode += 'const validator = null\n' + } + + // Don't need to keep external schemas once compiled + // validatorState will hold external schemas if it needs them + const { schema, ...serializerState } = serializer.getState() + + return ` + 'use strict' + + const Serializer = require('fast-json-stringify/lib/serializer') + const serializerState = ${JSON.stringify(serializerState)} + const serializer = Serializer.restoreFromState(serializerState) + + ${ajvDependencyCode} + + module.exports = ${contextFunc.toString()}(validator, serializer)` +} + +module.exports = buildStandaloneCode + +module.exports.dependencies = { + Serializer: require('./serializer'), + Validator: require('./validator') +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/validator.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/validator.js new file mode 100644 index 0000000000000000000000000000000000000000..bb261d52f41b4013b0aca70a98001eea44bff7e5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/lib/validator.js @@ -0,0 +1,94 @@ +'use strict' + +const Ajv = require('ajv') +const fastUri = require('fast-uri') +const ajvFormats = require('ajv-formats') +const clone = require('rfdc')({ proto: true }) + +class Validator { + constructor (ajvOptions) { + this.ajv = new Ajv({ + ...ajvOptions, + strictSchema: false, + validateSchema: false, + allowUnionTypes: true, + uriResolver: fastUri + }) + + ajvFormats(this.ajv) + + this.ajv.addKeyword({ + keyword: 'fjs_type', + type: 'object', + errors: false, + validate: (_type, date) => { + return date instanceof Date + } + }) + + this._ajvSchemas = {} + this._ajvOptions = ajvOptions || {} + } + + addSchema (schema, schemaName) { + let schemaKey = schema.$id || schemaName + if (schema.$id !== undefined && schema.$id[0] === '#') { + schemaKey = schemaName + schema.$id // relative URI + } + + if ( + this.ajv.refs[schemaKey] === undefined && + this.ajv.schemas[schemaKey] === undefined + ) { + const ajvSchema = clone(schema) + this.convertSchemaToAjvFormat(ajvSchema) + this.ajv.addSchema(ajvSchema, schemaKey) + this._ajvSchemas[schemaKey] = schema + } + } + + validate (schemaRef, data) { + return this.ajv.validate(schemaRef, data) + } + + // Ajv does not support js date format. In order to properly validate objects containing a date, + // it needs to replace all occurrences of the string date format with a custom keyword fjs_type. + // (see https://github.com/fastify/fast-json-stringify/pull/441) + convertSchemaToAjvFormat (schema) { + if (schema === null) return + + if (schema.type === 'string') { + schema.fjs_type = 'string' + schema.type = ['string', 'object'] + } else if ( + Array.isArray(schema.type) && + schema.type.includes('string') && + !schema.type.includes('object') + ) { + schema.fjs_type = 'string' + schema.type.push('object') + } + for (const property in schema) { + if (typeof schema[property] === 'object') { + this.convertSchemaToAjvFormat(schema[property]) + } + } + } + + getState () { + return { + ajvOptions: this._ajvOptions, + ajvSchemas: this._ajvSchemas + } + } + + static restoreFromState (state) { + const validator = new Validator(state.ajvOptions) + for (const [id, ajvSchema] of Object.entries(state.ajvSchemas)) { + validator.ajv.addSchema(ajvSchema, id) + } + return validator + } +} + +module.exports = Validator diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/debug-mode.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/debug-mode.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3e998a737213fd380aadce7fdfbf9c78d531bf5b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/debug-mode.test.js @@ -0,0 +1,121 @@ +'use strict' + +const { test } = require('node:test') +const fjs = require('..') + +const Ajv = require('ajv').default +const Validator = require('../lib/validator') +const Serializer = require('../lib/serializer') + +function build (opts) { + return fjs({ + title: 'default string', + type: 'object', + properties: { + firstName: { + type: 'string' + } + }, + required: ['firstName'] + }, opts) +} + +test('activate debug mode', t => { + t.plan(5) + const debugMode = build({ debugMode: true }) + + t.assert.ok(typeof debugMode === 'object') + t.assert.ok(debugMode.ajv instanceof Ajv) + t.assert.ok(debugMode.validator instanceof Validator) + t.assert.ok(debugMode.serializer instanceof Serializer) + t.assert.ok(typeof debugMode.code === 'string') +}) + +test('activate debug mode truthy', t => { + t.plan(5) + + const debugMode = build({ debugMode: 'yes' }) + + t.assert.ok(typeof debugMode === 'object') + t.assert.ok(typeof debugMode.code === 'string') + t.assert.ok(debugMode.ajv instanceof Ajv) + t.assert.ok(debugMode.validator instanceof Validator) + t.assert.ok(debugMode.serializer instanceof Serializer) +}) + +test('to string auto-consistent', t => { + t.plan(6) + const debugMode = build({ debugMode: 1 }) + + t.assert.ok(typeof debugMode === 'object') + t.assert.ok(typeof debugMode.code === 'string') + t.assert.ok(debugMode.ajv instanceof Ajv) + t.assert.ok(debugMode.serializer instanceof Serializer) + t.assert.ok(debugMode.validator instanceof Validator) + + const compiled = fjs.restore(debugMode) + const tobe = JSON.stringify({ firstName: 'Foo' }) + t.assert.equal(compiled({ firstName: 'Foo', surname: 'bar' }), tobe, 'surname evicted') +}) + +test('to string auto-consistent with ajv', t => { + t.plan(6) + + const debugMode = fjs({ + title: 'object with multiple types field', + type: 'object', + properties: { + str: { + anyOf: [{ + type: 'string' + }, { + type: 'boolean' + }] + } + } + }, { debugMode: 1 }) + + t.assert.ok(typeof debugMode === 'object') + t.assert.ok(typeof debugMode.code === 'string') + t.assert.ok(debugMode.ajv instanceof Ajv) + t.assert.ok(debugMode.validator instanceof Validator) + t.assert.ok(debugMode.serializer instanceof Serializer) + + const compiled = fjs.restore(debugMode) + const tobe = JSON.stringify({ str: 'Foo' }) + t.assert.equal(compiled({ str: 'Foo', void: 'me' }), tobe) +}) + +test('to string auto-consistent with ajv-formats', t => { + t.plan(3) + + const debugMode = fjs({ + title: 'object with multiple types field and format keyword', + type: 'object', + properties: { + str: { + anyOf: [{ + type: 'string', + format: 'email' + }, { + type: 'boolean' + }] + } + } + }, { debugMode: 1 }) + + t.assert.ok(typeof debugMode === 'object') + + const compiled = fjs.restore(debugMode) + const tobe = JSON.stringify({ str: 'foo@bar.com' }) + t.assert.equal(compiled({ str: 'foo@bar.com' }), tobe) + t.assert.throws(() => compiled({ str: 'foo' })) +}) + +test('debug should restore the same serializer instance', t => { + t.plan(1) + + const debugMode = fjs({ type: 'integer' }, { debugMode: 1, rounding: 'ceil' }) + const compiled = fjs.restore(debugMode) + t.assert.equal(compiled(3.95), 4) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/defaults.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/defaults.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f0430a980cdbd1eb24f1d594066795604a186a3f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/defaults.test.js @@ -0,0 +1,376 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +function buildTest (schema, toStringify, expected) { + test(`render a ${schema.title} with default as JSON`, (t) => { + t.plan(1) + + const stringify = build(schema) + + const output = stringify(toStringify) + + t.assert.equal(output, JSON.stringify(expected)) + }) +} + +buildTest({ + title: 'default string', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string', + default: 'Collina' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + magic: { + type: 'number' + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + magic: 42, + age: 32 +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + magic: 42 +}) + +buildTest({ + title: 'default string with value', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string', + default: 'Collina' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + magic: { + type: 'number' + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + lastName: 'collina', + magic: 42, + age: 32 +}, { + firstName: 'Matteo', + lastName: 'collina', + age: 32, + magic: 42 +}) + +buildTest({ + title: 'default number', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + magic: { + type: 'number', + default: 42 + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32 +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + magic: 42 +}) + +buildTest({ + title: 'default number with value', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + magic: { + type: 'number', + default: 42 + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + magic: 66 +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + magic: 66 +}) + +buildTest({ + title: 'default object', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + otherProps: { + type: 'object', + default: { foo: 'bar' } + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32 +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + otherProps: { foo: 'bar' } +}) + +buildTest({ + title: 'default object with value', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + otherProps: { + type: 'object', + additionalProperties: true, + default: { foo: 'bar' } + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + otherProps: { hello: 'world' } +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + otherProps: { hello: 'world' } +}) + +buildTest({ + title: 'default array', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + otherProps: { + type: 'array', + items: { type: 'string' }, + default: ['FOO'] + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32 +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + otherProps: ['FOO'] +}) + +buildTest({ + title: 'default array with value', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years', + type: 'integer', + minimum: 0 + }, + otherProps: { + type: 'array', + items: { type: 'string' }, + default: ['FOO'] + } + }, + required: ['firstName', 'lastName'] +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + otherProps: ['BAR'] +}, { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + otherProps: ['BAR'] +}) + +buildTest({ + title: 'default deeper value', + type: 'object', + properties: { + level1: { + type: 'object', + properties: { + level2: { + type: 'object', + properties: { + level3: { + type: 'object', + properties: { + level4: { + type: 'object', + default: { foo: 'bar' } + } + } + } + } + } + } + } + } +}, { + level1: { level2: { level3: { } } } +}, { + level1: { level2: { level3: { level4: { foo: 'bar' } } } } +}) + +buildTest({ + title: 'default deeper value with value', + type: 'object', + properties: { + level1: { + type: 'object', + properties: { + level2: { + type: 'object', + properties: { + level3: { + type: 'object', + properties: { + level4: { + type: 'object', + default: { foo: 'bar' } + } + } + } + } + } + } + } + } +}, { + level1: { level2: { level3: { level4: { } } } } +}, { + level1: { level2: { level3: { level4: { } } } } +}) + +buildTest({ + type: 'object', + properties: { + name: { + type: 'string', + default: 'foo' + }, + dev: { + type: 'boolean', + default: false + } + }, + required: [ + 'name', 'dev' + ] +}, {}, { name: 'foo', dev: false }) + +buildTest({ + type: 'object', + properties: { + name: { + type: 'string', + default: 'foo' + }, + dev: { + type: 'boolean' + }, + job: { + type: 'string', + default: 'awesome' + } + }, + required: [ + 'name', 'dev' + ] +}, { dev: true }, { name: 'foo', dev: true, job: 'awesome' }) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/enum.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/enum.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9e7022421f36140d9b1b267f3b8929ed631145ab --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/enum.test.js @@ -0,0 +1,37 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('use enum without type', (t) => { + t.plan(1) + const stringify = build({ + title: 'Example Schema', + type: 'object', + properties: { + order: { + type: 'string', + enum: ['asc', 'desc'] + } + } + }) + + const obj = { order: 'asc' } + t.assert.equal('{"order":"asc"}', stringify(obj)) +}) + +test('use enum without type', (t) => { + t.plan(1) + const stringify = build({ + title: 'Example Schema', + type: 'object', + properties: { + order: { + enum: ['asc', 'desc'] + } + } + }) + + const obj = { order: 'asc' } + t.assert.equal('{"order":"asc"}', stringify(obj)) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/fix-604.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/fix-604.test.js new file mode 100644 index 0000000000000000000000000000000000000000..239075af509512c6ae96bcc46c3f6ea0b24d3447 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/fix-604.test.js @@ -0,0 +1,25 @@ +'use strict' + +const { test } = require('node:test') +const fjs = require('..') + +test('fix-604', t => { + const schema = { + type: 'object', + properties: { + fullName: { type: 'string' }, + phone: { type: 'number' } + } + } + + const input = { + fullName: 'Jone', + phone: 'phone' + } + + const render = fjs(schema) + + t.assert.throws(() => { + render(input) + }, { message: 'The value "phone" cannot be converted to a number.' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/fixtures/.keep b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/fixtures/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/if-then-else.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/if-then-else.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dfe25e9badc37dfa5d9be6dfebc21cc7c7b64262 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/if-then-else.test.js @@ -0,0 +1,468 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +process.env.TZ = 'UTC' + +const schema = { + type: 'object', + properties: { + }, + if: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] } + } + }, + then: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] }, + foo: { type: 'string' }, + bar: { type: 'number' }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' } + } + } + } + } + }, + else: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['greeting'] }, + hi: { type: 'string' }, + hello: { type: 'number' }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' } + } + } + } + } + } +} + +const nestedIfSchema = { + type: 'object', + properties: { }, + if: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar', 'greeting'] } + } + }, + then: { + if: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] } + } + }, + then: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] }, + foo: { type: 'string' }, + bar: { type: 'number' }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' } + } + } + } + } + }, + else: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['greeting'] }, + hi: { type: 'string' }, + hello: { type: 'number' } + } + } + }, + else: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['alphabet'] }, + a: { type: 'string' }, + b: { type: 'number' } + } + } +} + +const nestedElseSchema = { + type: 'object', + properties: { }, + if: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] } + } + }, + then: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] }, + foo: { type: 'string' }, + bar: { type: 'number' }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' } + } + } + } + } + }, + else: { + if: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['greeting'] } + } + }, + then: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['greeting'] }, + hi: { type: 'string' }, + hello: { type: 'number' } + } + }, + else: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['alphabet'] }, + a: { type: 'string' }, + b: { type: 'number' } + } + } + } +} + +const nestedDeepElseSchema = { + type: 'object', + additionalProperties: schema +} + +const noElseSchema = { + type: 'object', + properties: { + }, + if: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] } + } + }, + then: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] }, + foo: { type: 'string' }, + bar: { type: 'number' }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' } + } + } + } + } + } +} +const fooBarInput = { + kind: 'foobar', + foo: 'FOO', + list: [{ + name: 'name', + value: 'foo' + }], + bar: 42, + hi: 'HI', + hello: 45, + a: 'A', + b: 35 +} +const greetingInput = { + kind: 'greeting', + foo: 'FOO', + bar: 42, + hi: 'HI', + hello: 45, + a: 'A', + b: 35 +} +const alphabetInput = { + kind: 'alphabet', + foo: 'FOO', + bar: 42, + hi: 'HI', + hello: 45, + a: 'A', + b: 35 +} +const deepFoobarInput = { + foobar: fooBarInput +} +const foobarOutput = JSON.stringify({ + kind: 'foobar', + foo: 'FOO', + bar: 42, + list: [{ + name: 'name', + value: 'foo' + }] +}) +const greetingOutput = JSON.stringify({ + kind: 'greeting', + hi: 'HI', + hello: 45 +}) +const alphabetOutput = JSON.stringify({ + kind: 'alphabet', + a: 'A', + b: 35 +}) +const deepFoobarOutput = JSON.stringify({ + foobar: JSON.parse(foobarOutput) +}) +const noElseGreetingOutput = JSON.stringify({}) + +test('if-then-else', async t => { + const tests = [ + { + name: 'foobar', + schema, + input: fooBarInput, + expected: foobarOutput + }, + { + name: 'greeting', + schema, + input: greetingInput, + expected: greetingOutput + }, + { + name: 'if nested - then then', + schema: nestedIfSchema, + input: fooBarInput, + expected: foobarOutput + }, + { + name: 'if nested - then else', + schema: nestedIfSchema, + input: greetingInput, + expected: greetingOutput + }, + { + name: 'if nested - else', + schema: nestedIfSchema, + input: alphabetInput, + expected: alphabetOutput + }, + { + name: 'else nested - then', + schema: nestedElseSchema, + input: fooBarInput, + expected: foobarOutput + }, + { + name: 'else nested - else then', + schema: nestedElseSchema, + input: greetingInput, + expected: greetingOutput + }, + { + name: 'else nested - else else', + schema: nestedElseSchema, + input: alphabetInput, + expected: alphabetOutput + }, + { + name: 'deep then - else', + schema: nestedDeepElseSchema, + input: deepFoobarInput, + expected: deepFoobarOutput + }, + { + name: 'no else', + schema: noElseSchema, + input: greetingInput, + expected: noElseGreetingOutput + } + ] + + for (const { name, schema, input, expected } of tests) { + await t.test(name + ' - normal', async t => { + t.plan(1) + + const stringify = build(JSON.parse(JSON.stringify(schema)), { ajv: { strictTypes: false } }) + const serialized = stringify(input) + t.assert.equal(serialized, expected) + }) + } +}) + +test('nested if/then', t => { + t.plan(2) + + const schema = { + type: 'object', + properties: { a: { type: 'string' } }, + if: { + type: 'object', + properties: { foo: { type: 'string' } } + }, + then: { + properties: { bar: { type: 'string' } }, + if: { + type: 'object', + properties: { foo1: { type: 'string' } } + }, + then: { + properties: { bar1: { type: 'string' } } + } + } + } + + const stringify = build(schema) + + t.assert.equal( + stringify({ a: 'A', foo: 'foo', bar: 'bar' }), + JSON.stringify({ a: 'A', bar: 'bar' }) + ) + + t.assert.equal( + stringify({ a: 'A', foo: 'foo', bar: 'bar', foo1: 'foo1', bar1: 'bar1' }), + JSON.stringify({ a: 'A', bar: 'bar', bar1: 'bar1' }) + ) +}) + +test('if/else with string format', (t) => { + t.plan(2) + + const schema = { + if: { type: 'string' }, + then: { type: 'string', format: 'date' }, + else: { const: 'Invalid' } + } + + const stringify = build(schema) + + const date = new Date(1674263005800) + + t.assert.equal(stringify(date), '"2023-01-21"') + t.assert.equal(stringify('Invalid'), '"Invalid"') +}) + +test('if/else with const integers', (t) => { + t.plan(2) + + const schema = { + type: 'number', + if: { type: 'number', minimum: 42 }, + then: { const: 66 }, + else: { const: 33 } + } + + const stringify = build(schema) + + t.assert.equal(stringify(100.32), '66') + t.assert.equal(stringify(10.12), '33') +}) + +test('if/else with array', (t) => { + t.plan(2) + + const schema = { + type: 'array', + if: { type: 'array', maxItems: 1 }, + then: { items: { type: 'string' } }, + else: { items: { type: 'number' } } + } + + const stringify = build(schema) + + t.assert.equal(stringify(['1']), JSON.stringify(['1'])) + t.assert.equal(stringify(['1', '2']), JSON.stringify([1, 2])) +}) + +test('external recursive if/then/else', (t) => { + t.plan(1) + + const externalSchema = { + type: 'object', + properties: { + base: { type: 'string' }, + self: { $ref: 'externalSchema#' } + }, + if: { + type: 'object', + properties: { + foo: { type: 'string', const: '41' } + } + }, + then: { + type: 'object', + properties: { + bar: { type: 'string', const: '42' } + } + }, + else: { + type: 'object', + properties: { + baz: { type: 'string', const: '43' } + } + } + } + + const schema = { + type: 'object', + properties: { + a: { $ref: 'externalSchema#/properties/self' }, + b: { $ref: 'externalSchema#/properties/self' } + } + } + + const data = { + a: { + base: 'a', + foo: '41', + bar: '42', + baz: '43', + ignore: 'ignored' + }, + b: { + base: 'b', + foo: 'not-41', + bar: '42', + baz: '43', + ignore: 'ignored' + } + } + const stringify = build(schema, { schema: { externalSchema } }) + t.assert.equal(stringify(data), '{"a":{"base":"a","bar":"42"},"b":{"base":"b","baz":"43"}}') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/inferType.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/inferType.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e2a8d25494e72d7972973c9f7f40fa4411c2d25a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/inferType.test.js @@ -0,0 +1,92 @@ +'use strict' + +const { test } = require('node:test') +const validator = require('is-my-json-valid') +const build = require('..') + +function buildTest (schema, toStringify) { + test(`render a ${schema.title} as JSON`, (t) => { + t.plan(3) + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify(toStringify) + + t.assert.deepStrictEqual(JSON.parse(output), toStringify) + t.assert.equal(output, JSON.stringify(toStringify)) + t.assert.ok(validate(JSON.parse(output)), 'valid schema') + }) +} + +buildTest({ + title: 'infer type object by keyword', + // 'type': 'object', + properties: { + name: { + type: 'string' + } + } +}, { + name: 'foo' +}) + +buildTest({ + title: 'infer type of nested object by keyword', + // 'type': 'object', + properties: { + more: { + description: 'more properties', + // 'type': 'object', + properties: { + something: { + type: 'string' + } + } + } + } +}, { + more: { + something: 'else' + } +}) + +buildTest({ + title: 'infer type array by keyword', + type: 'object', + properties: { + ids: { + // 'type': 'array', + items: { + type: 'string' + } + } + } +}, { + ids: ['test'] +}) + +buildTest({ + title: 'infer type string by keyword', + type: 'object', + properties: { + name: { + // 'type': 'string', + maxLength: 3 + } + } +}, { + name: 'foo' +}) + +buildTest({ + title: 'infer type number by keyword', + type: 'object', + properties: { + age: { + // 'type': 'number', + maximum: 18 + } + } +}, { + age: 18 +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/infinity.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/infinity.test.js new file mode 100644 index 0000000000000000000000000000000000000000..28799e65a9dd1c0319c520e103f2c5bad271ab34 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/infinity.test.js @@ -0,0 +1,55 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('Finite numbers', t => { + const values = [-5, 0, -0, 1.33, 99, 100.0, + Math.E, Number.EPSILON, + Number.MAX_SAFE_INTEGER, Number.MAX_VALUE, + Number.MIN_SAFE_INTEGER, Number.MIN_VALUE] + + t.plan(values.length) + + const schema = { + type: 'number' + } + + const stringify = build(schema) + + values.forEach(v => t.assert.equal(stringify(v), JSON.stringify(v))) +}) + +test('Infinite integers', t => { + const values = [Infinity, -Infinity] + + t.plan(values.length) + + const schema = { + type: 'integer' + } + + const stringify = build(schema) + + values.forEach(v => { + try { + stringify(v) + } catch (err) { + t.assert.equal(err.message, `The value "${v}" cannot be converted to an integer.`) + } + }) +}) + +test('Infinite numbers', t => { + const values = [Infinity, -Infinity] + + t.plan(values.length) + + const schema = { + type: 'number' + } + + const stringify = build(schema) + + values.forEach(v => t.assert.equal(stringify(v), JSON.stringify(v))) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/integer.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/integer.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d76261f43d18e05ea74cc9a55ef0ac2e5b96a484 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/integer.test.js @@ -0,0 +1,194 @@ +'use strict' + +const { test } = require('node:test') + +const validator = require('is-my-json-valid') +const build = require('..') +const ROUNDING_TYPES = ['ceil', 'floor', 'round'] + +test('render an integer as JSON', (t) => { + t.plan(2) + + const schema = { + title: 'integer', + type: 'integer' + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify(1615) + + t.assert.equal(output, '1615') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('render a float as an integer', (t) => { + t.plan(2) + try { + build({ + title: 'float as integer', + type: 'integer' + }, { rounding: 'foobar' }) + } catch (error) { + t.assert.ok(error) + t.assert.equal(error.message, 'Unsupported integer rounding method foobar') + } +}) + +test('throws on NaN', (t) => { + t.plan(1) + + const schema = { + title: 'integer', + type: 'integer' + } + + const stringify = build(schema) + t.assert.throws(() => stringify(NaN), new Error('The value "NaN" cannot be converted to an integer.')) +}) + +test('render a float as an integer', (t) => { + const cases = [ + { input: Math.PI, output: '3' }, + { input: 5.0, output: '5' }, + { input: null, output: '0' }, + { input: 0, output: '0' }, + { input: 0.0, output: '0' }, + { input: 42, output: '42' }, + { input: 1.99999, output: '1' }, + { input: -45.05, output: '-45' }, + { input: 3333333333333333, output: '3333333333333333' }, + { input: Math.PI, output: '3', rounding: 'trunc' }, + { input: 5.0, output: '5', rounding: 'trunc' }, + { input: null, output: '0', rounding: 'trunc' }, + { input: 0, output: '0', rounding: 'trunc' }, + { input: 0.0, output: '0', rounding: 'trunc' }, + { input: 42, output: '42', rounding: 'trunc' }, + { input: 1.99999, output: '1', rounding: 'trunc' }, + { input: -45.05, output: '-45', rounding: 'trunc' }, + { input: 0.95, output: '1', rounding: 'ceil' }, + { input: 0.2, output: '1', rounding: 'ceil' }, + { input: 45.95, output: '45', rounding: 'floor' }, + { input: -45.05, output: '-46', rounding: 'floor' }, + { input: 45.44, output: '45', rounding: 'round' }, + { input: 45.95, output: '46', rounding: 'round' } + ] + + t.plan(cases.length * 2) + cases.forEach(checkInteger) + + function checkInteger ({ input, output, rounding }) { + const schema = { + title: 'float as integer', + type: 'integer' + } + + const validate = validator(schema) + const stringify = build(schema, { rounding }) + const str = stringify(input) + + t.assert.equal(str, output) + t.assert.ok(validate(JSON.parse(str)), 'valid schema') + } +}) + +test('render an object with an integer as JSON', (t) => { + t.plan(2) + + const schema = { + title: 'object with integer', + type: 'object', + properties: { + id: { + type: 'integer' + } + } + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify({ + id: 1615 + }) + + t.assert.equal(output, '{"id":1615}') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('render an array with an integer as JSON', (t) => { + t.plan(2) + + const schema = { + title: 'array with integer', + type: 'array', + items: { + type: 'integer' + } + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify([1615]) + + t.assert.equal(output, '[1615]') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('render an object with an additionalProperty of type integer as JSON', (t) => { + t.plan(2) + + const schema = { + title: 'object with integer', + type: 'object', + additionalProperties: { + type: 'integer' + } + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify({ + num: 1615 + }) + + t.assert.equal(output, '{"num":1615}') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('should round integer object parameter', t => { + t.plan(2) + + const schema = { type: 'object', properties: { magic: { type: 'integer' } } } + const validate = validator(schema) + const stringify = build(schema, { rounding: 'ceil' }) + const output = stringify({ magic: 4.2 }) + + t.assert.equal(output, '{"magic":5}') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('should not stringify a property if it does not exist', t => { + t.plan(2) + + const schema = { title: 'Example Schema', type: 'object', properties: { age: { type: 'integer' } } } + const validate = validator(schema) + const stringify = build(schema) + const output = stringify({}) + + t.assert.equal(output, '{}') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +ROUNDING_TYPES.forEach((rounding) => { + test(`should not stringify a property if it does not exist (rounding: ${rounding})`, t => { + t.plan(2) + + const schema = { type: 'object', properties: { magic: { type: 'integer' } } } + const validate = validator(schema) + const stringify = build(schema, { rounding }) + const output = stringify({}) + + t.assert.equal(output, '{}') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/invalidSchema.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/invalidSchema.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4402484b361a112cc47236c17e49ed7870be65ba --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/invalidSchema.test.js @@ -0,0 +1,18 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +// Covers issue #139 +test('Should throw on invalid schema', t => { + t.plan(1) + t.assert.throws(() => { + build({}, { + schema: { + invalid: { + type: 'Dinosaur' + } + } + }) + }, { message: /^"invalid" schema is invalid:.*/ }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/issue-479.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/issue-479.test.js new file mode 100644 index 0000000000000000000000000000000000000000..10b33e07112a08981fa1da7f6929d6a694f62230 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/issue-479.test.js @@ -0,0 +1,57 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('should validate anyOf after allOf merge', (t) => { + t.plan(1) + + const schema = { + $id: 'schema', + type: 'object', + allOf: [ + { + $id: 'base', + type: 'object', + properties: { + name: { + type: 'string' + } + }, + required: [ + 'name' + ] + }, + { + $id: 'inner_schema', + type: 'object', + properties: { + union: { + $id: '#id', + anyOf: [ + { + + $id: 'guid', + type: 'string' + }, + { + + $id: 'email', + type: 'string' + } + ] + } + }, + required: [ + 'union' + ] + } + ] + } + + const stringify = build(schema) + + t.assert.equal( + stringify({ name: 'foo', union: 'a8f1cc50-5530-5c62-9109-5ba9589a6ae1' }), + '{"name":"foo","union":"a8f1cc50-5530-5c62-9109-5ba9589a6ae1"}') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8e4f954ae6ef27418cbb830f44b9e6bf80eb6890 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md @@ -0,0 +1,10 @@ +# JSON-Schema-Test-Suite + +You can find all test cases [here](https://github.com/json-schema-org/JSON-Schema-Test-Suite). +It contains a set of JSON objects that implementors of JSON Schema validation libraries can use to test their validators. + +# How to add another test case? + +1. Navigate to [JSON-Schema-Test-Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite/tree/master/tests) +2. Choose a draft `draft4`, `draft6` or `draft7` +3. Copy & paste the `test-case.json` to the project and add a test like in the `draft4.test.js` \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f71afe455f53d5cf42f63f6f556fe3f400af6dc6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js @@ -0,0 +1,12 @@ +'use strict' + +const { test } = require('node:test') +const { counTests, runTests } = require('./util') + +const requiredTestSuite = require('./draft4/required.json') + +test('required', async (t) => { + const skippedTests = ['ignores arrays', 'ignores strings', 'ignores other non-objects'] + t.plan(counTests(requiredTestSuite, skippedTests)) + await runTests(t, requiredTestSuite, skippedTests) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json new file mode 100644 index 0000000000000000000000000000000000000000..1e2a4f0bddfe3435eb3f2ae8ca1537b70fcf8508 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json @@ -0,0 +1,54 @@ +[ + { + "description": "required validation", + "schema": { + "properties": { + "foo": {}, + "bar": {} + }, + "required": ["foo"] + }, + "tests": [ + { + "description": "present required property is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "non-present required property is invalid", + "data": {"bar": 1}, + "valid": false + }, + { + "description": "ignores arrays", + "data": [], + "valid": true + }, + { + "description": "ignores strings", + "data": "", + "valid": true + }, + { + "description": "ignores other non-objects", + "data": 12, + "valid": true + } + ] + }, + { + "description": "required default validation", + "schema": { + "properties": { + "foo": {} + } + }, + "tests": [ + { + "description": "not required by default", + "data": {}, + "valid": true + } + ] + } +] diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js new file mode 100644 index 0000000000000000000000000000000000000000..072b7cfc438ec5e855c7ee153b30bc9fefdc7ce6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js @@ -0,0 +1,12 @@ +'use strict' + +const { test } = require('node:test') +const { counTests, runTests } = require('./util') + +const requiredTestSuite = require('./draft6/required.json') + +test('required', async (t) => { + const skippedTests = ['ignores arrays', 'ignores strings', 'ignores other non-objects'] + t.plan(counTests(requiredTestSuite, skippedTests)) + await runTests(t, requiredTestSuite, skippedTests) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json new file mode 100644 index 0000000000000000000000000000000000000000..bd96907b9f703429e0cb66e2addaea7fc928e2ea --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json @@ -0,0 +1,70 @@ +[ + { + "description": "required validation", + "schema": { + "properties": { + "foo": {}, + "bar": {} + }, + "required": ["foo"] + }, + "tests": [ + { + "description": "present required property is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "non-present required property is invalid", + "data": {"bar": 1}, + "valid": false + }, + { + "description": "ignores arrays", + "data": [], + "valid": true + }, + { + "description": "ignores strings", + "data": "", + "valid": true + }, + { + "description": "ignores other non-objects", + "data": 12, + "valid": true + } + ] + }, + { + "description": "required default validation", + "schema": { + "properties": { + "foo": {} + } + }, + "tests": [ + { + "description": "not required by default", + "data": {}, + "valid": true + } + ] + }, + { + "description": "required with empty array", + "schema": { + "properties": { + "foo": {} + }, + "required": [] + }, + "tests": [ + { + "description": "property not required", + "data": {}, + "valid": true + } + ] + } +] diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9c6422a7c6bf83649eb548953d1094d2791885bd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js @@ -0,0 +1,12 @@ +'use strict' + +const { test } = require('node:test') +const { counTests, runTests } = require('./util') + +const requiredTestSuite = require('./draft7/required.json') + +test('required', async (t) => { + const skippedTests = ['ignores arrays', 'ignores strings', 'ignores other non-objects'] + t.plan(counTests(requiredTestSuite, skippedTests)) + await runTests(t, requiredTestSuite, skippedTests) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json new file mode 100644 index 0000000000000000000000000000000000000000..bd96907b9f703429e0cb66e2addaea7fc928e2ea --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json @@ -0,0 +1,70 @@ +[ + { + "description": "required validation", + "schema": { + "properties": { + "foo": {}, + "bar": {} + }, + "required": ["foo"] + }, + "tests": [ + { + "description": "present required property is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "non-present required property is invalid", + "data": {"bar": 1}, + "valid": false + }, + { + "description": "ignores arrays", + "data": [], + "valid": true + }, + { + "description": "ignores strings", + "data": "", + "valid": true + }, + { + "description": "ignores other non-objects", + "data": 12, + "valid": true + } + ] + }, + { + "description": "required default validation", + "schema": { + "properties": { + "foo": {} + } + }, + "tests": [ + { + "description": "not required by default", + "data": {}, + "valid": true + } + ] + }, + { + "description": "required with empty array", + "schema": { + "properties": { + "foo": {} + }, + "required": [] + }, + "tests": [ + { + "description": "property not required", + "data": {}, + "valid": true + } + ] + } +] diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js new file mode 100644 index 0000000000000000000000000000000000000000..c4cd4ec8109f8569058e5772e28917607f2f0235 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js @@ -0,0 +1,31 @@ +'use strict' + +const build = require('../..') + +async function runTests (t, testsuite, skippedTests) { + for (const scenario of testsuite) { + const stringify = build(scenario.schema) + for (const test of scenario.tests) { + if (skippedTests.indexOf(test.description) !== -1) { + console.log(`skip ${test.description}`) + continue + } + + await t.test(test.description, (t) => { + t.plan(1) + try { + const output = stringify(test.data) + t.assert.equal(output, JSON.stringify(test.data), 'compare payloads') + } catch (err) { + t.assert.ok(test.valid === false, 'payload should be valid: ' + err.message) + } + }) + } + } +} + +function counTests (ts, skippedTests) { + return ts.reduce((a, b) => a + b.tests.length, 0) - skippedTests.length +} + +module.exports = { runTests, counTests } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/missing-values.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/missing-values.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5ddf4771cb3dc3d5ac85136a3550f7fedca83f77 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/missing-values.test.js @@ -0,0 +1,88 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('missing values', (t) => { + t.plan(3) + + const stringify = build({ + title: 'object with missing values', + type: 'object', + properties: { + str: { + type: 'string' + }, + num: { + type: 'number' + }, + val: { + type: 'string' + } + } + }) + + t.assert.equal('{"val":"value"}', stringify({ val: 'value' })) + t.assert.equal('{"str":"string","val":"value"}', stringify({ str: 'string', val: 'value' })) + t.assert.equal('{"str":"string","num":42,"val":"value"}', stringify({ str: 'string', num: 42, val: 'value' })) +}) + +test('handle null when value should be string', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + str: { + type: 'string' + } + } + }) + + t.assert.equal('{"str":""}', stringify({ str: null })) +}) + +test('handle null when value should be integer', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + int: { + type: 'integer' + } + } + }) + + t.assert.equal('{"int":0}', stringify({ int: null })) +}) + +test('handle null when value should be number', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + num: { + type: 'number' + } + } + }) + + t.assert.equal('{"num":0}', stringify({ num: null })) +}) + +test('handle null when value should be boolean', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + bool: { + type: 'boolean' + } + } + }) + + t.assert.equal('{"bool":false}', stringify({ bool: null })) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/multi-type-serializer.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/multi-type-serializer.test.js new file mode 100644 index 0000000000000000000000000000000000000000..146b42f2b46d26fb73e236f0e6709cc406c843c0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/multi-type-serializer.test.js @@ -0,0 +1,19 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('should throw a TypeError with the path to the key of the invalid value', (t) => { + t.plan(1) + const schema = { + type: 'object', + properties: { + num: { + type: ['number'] + } + } + } + + const stringify = build(schema) + t.assert.throws(() => stringify({ num: { bla: 123 } }), new TypeError('The value of \'#/properties/num\' does not match schema definition.')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/nestedObjects.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/nestedObjects.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f683cba298598d42605df3061c2cca5507d2a9e7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/nestedObjects.test.js @@ -0,0 +1,63 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('nested objects with same properties', (t) => { + t.plan(1) + + const schema = { + title: 'nested objects with same properties', + type: 'object', + properties: { + stringProperty: { + type: 'string' + }, + objectProperty: { + type: 'object', + additionalProperties: true + } + } + } + const stringify = build(schema) + + const value = stringify({ + stringProperty: 'string1', + objectProperty: { + stringProperty: 'string2', + numberProperty: 42 + } + }) + t.assert.equal(value, '{"stringProperty":"string1","objectProperty":{"stringProperty":"string2","numberProperty":42}}') +}) + +test('names collision', (t) => { + t.plan(1) + + const schema = { + title: 'nested objects with same properties', + type: 'object', + properties: { + test: { + type: 'object', + properties: { + a: { type: 'string' } + } + }, + tes: { + type: 'object', + properties: { + b: { type: 'string' }, + t: { type: 'object' } + } + } + } + } + const stringify = build(schema) + const data = { + test: { a: 'a' }, + tes: { b: 'b', t: {} } + } + + t.assert.equal(stringify(data), JSON.stringify(data)) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/nullable.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/nullable.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a6d7eed92e5c0ef25af4ca8cf8850e99a18baba4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/nullable.test.js @@ -0,0 +1,543 @@ +'use strict' + +const { test } = require('node:test') + +const build = require('..') + +const nullable = true + +const complexObject = { + type: 'object', + properties: { + nullableString: { type: 'string', nullable }, + nullableNumber: { type: 'number', nullable }, + nullableInteger: { type: 'integer', nullable }, + nullableBoolean: { type: 'boolean', nullable }, + nullableNull: { type: 'null', nullable }, + nullableArray: { + type: 'array', + nullable: true, + items: {} + }, + nullableObject: { type: 'object', nullable: true }, + objectWithNullableProps: { + type: 'object', + nullable: false, + additionalProperties: true, + properties: { + nullableString: { type: 'string', nullable }, + nullableNumber: { type: 'number', nullable }, + nullableInteger: { type: 'integer', nullable }, + nullableBoolean: { type: 'boolean', nullable }, + nullableNull: { type: 'null', nullable }, + nullableArray: { + type: 'array', + nullable: true, + items: {} + } + } + }, + arrayWithNullableItems: { + type: 'array', + nullable: true, + items: { type: ['integer', 'string'], nullable: true } + } + } +} + +const complexData = { + nullableString: null, + nullableNumber: null, + nullableInteger: null, + nullableBoolean: null, + nullableNull: null, + nullableArray: null, + nullableObject: null, + objectWithNullableProps: { + additionalProp: null, + nullableString: null, + nullableNumber: null, + nullableInteger: null, + nullableBoolean: null, + nullableNull: null, + nullableArray: null + }, + arrayWithNullableItems: [1, 2, null] +} + +const complexExpectedResult = { + nullableString: null, + nullableNumber: null, + nullableInteger: null, + nullableBoolean: null, + nullableNull: null, + nullableArray: null, + nullableObject: null, + objectWithNullableProps: { + additionalProp: null, + nullableString: null, + nullableNumber: null, + nullableInteger: null, + nullableBoolean: null, + nullableNull: null, + nullableArray: null + }, + arrayWithNullableItems: [1, 2, null] +} + +const testSet = { + nullableString: [{ type: 'string', nullable }, null, null], + nullableNumber: [{ type: 'number', nullable }, null, null], + nullableInteger: [{ type: 'integer', nullable }, null, null], + nullableBoolean: [{ type: 'boolean', nullable }, null, null], + nullableNull: [{ type: 'null', nullable }, null, null], + nullableArray: [{ + type: 'array', + nullable: true, + items: {} + }, null, null], + nullableObject: [{ type: 'object', nullable: true }, null, null], + complexObject: [complexObject, complexData, complexExpectedResult, { ajv: { allowUnionTypes: true } }] +} + +Object.keys(testSet).forEach(key => { + test(`handle nullable:true in ${key} correctly`, (t) => { + t.plan(1) + + const [ + schema, + data, + expected, + extraOptions + ] = testSet[key] + + const stringifier = build(schema, extraOptions) + const result = stringifier(data) + t.assert.deepStrictEqual(JSON.parse(result), expected) + }) +}) + +test('handle nullable number correctly', (t) => { + t.plan(2) + + const schema = { + type: 'number', + nullable: true + } + const stringify = build(schema) + + const data = null + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.equal(JSON.parse(result), data) +}) + +test('handle nullable integer correctly', (t) => { + t.plan(2) + + const schema = { + type: 'integer', + nullable: true + } + const stringify = build(schema) + + const data = null + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.equal(JSON.parse(result), data) +}) + +test('handle nullable boolean correctly', (t) => { + t.plan(2) + + const schema = { + type: 'boolean', + nullable: true + } + const stringify = build(schema) + + const data = null + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.equal(JSON.parse(result), data) +}) + +test('handle nullable string correctly', (t) => { + t.plan(2) + + const schema = { + type: 'string', + nullable: true + } + const stringify = build(schema) + + const data = null + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.equal(JSON.parse(result), data) +}) + +test('handle nullable date-time correctly', (t) => { + t.plan(2) + + const schema = { + type: 'string', + format: 'date-time', + nullable: true + } + const stringify = build(schema) + + const data = null + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.equal(JSON.parse(result), data) +}) + +test('handle nullable date correctly', (t) => { + t.plan(2) + + const schema = { + type: 'string', + format: 'date', + nullable: true + } + const stringify = build(schema) + + const data = null + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.equal(JSON.parse(result), data) +}) + +test('handle nullable time correctly', (t) => { + t.plan(2) + + const schema = { + type: 'string', + format: 'time', + nullable: true + } + const stringify = build(schema) + + const data = null + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.equal(JSON.parse(result), data) +}) + +test('large array of nullable strings with default mechanism', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + ids: { + type: 'array', + items: { + type: 'string', + nullable: true + } + } + } + } + + const options = { + largeArraySize: 2e4, + largeArrayMechanism: 'default' + } + + const stringify = build(schema, options) + + const data = { ids: new Array(2e4).fill(null) } + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.deepStrictEqual(JSON.parse(result), data) +}) + +test('large array of nullable date-time strings with default mechanism', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + ids: { + type: 'array', + items: { + type: 'string', + format: 'date-time', + nullable: true + } + } + } + } + + const options = { + largeArraySize: 2e4, + largeArrayMechanism: 'default' + } + + const stringify = build(schema, options) + + const data = { ids: new Array(2e4).fill(null) } + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.deepStrictEqual(JSON.parse(result), data) +}) + +test('large array of nullable date-time strings with default mechanism', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + ids: { + type: 'array', + items: { + type: 'string', + format: 'date', + nullable: true + } + } + } + } + + const options = { + largeArraySize: 2e4, + largeArrayMechanism: 'default' + } + + const stringify = build(schema, options) + + const data = { ids: new Array(2e4).fill(null) } + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.deepStrictEqual(JSON.parse(result), data) +}) + +test('large array of nullable date-time strings with default mechanism', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + ids: { + type: 'array', + items: { + type: 'string', + format: 'time', + nullable: true + } + } + } + } + + const options = { + largeArraySize: 2e4, + largeArrayMechanism: 'default' + } + + const stringify = build(schema, options) + + const data = { ids: new Array(2e4).fill(null) } + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.deepStrictEqual(JSON.parse(result), data) +}) + +test('large array of nullable numbers with default mechanism', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + ids: { + type: 'array', + items: { + type: 'number', + nullable: true + } + } + } + } + + const options = { + largeArraySize: 2e4, + largeArrayMechanism: 'default' + } + + const stringify = build(schema, options) + + const data = { ids: new Array(2e4).fill(null) } + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.deepStrictEqual(JSON.parse(result), data) +}) + +test('large array of nullable integers with default mechanism', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + ids: { + type: 'array', + items: { + type: 'integer', + nullable: true + } + } + } + } + + const options = { + largeArraySize: 2e4, + largeArrayMechanism: 'default' + } + + const stringify = build(schema, options) + + const data = { ids: new Array(2e4).fill(null) } + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.deepStrictEqual(JSON.parse(result), data) +}) + +test('large array of nullable booleans with default mechanism', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + ids: { + type: 'array', + items: { + type: 'boolean', + nullable: true + } + } + } + } + + const options = { + largeArraySize: 2e4, + largeArrayMechanism: 'default' + } + + const stringify = build(schema, options) + + const data = { ids: new Array(2e4).fill(null) } + const result = stringify(data) + + t.assert.equal(result, JSON.stringify(data)) + t.assert.deepStrictEqual(JSON.parse(result), data) +}) + +test('nullable type in the schema', (t) => { + t.plan(2) + + const schema = { + type: ['object', 'null'], + properties: { + foo: { + type: 'string' + } + } + } + + const stringify = build(schema) + + const data = { foo: 'bar' } + + t.assert.equal(stringify(data), JSON.stringify(data)) + t.assert.equal(stringify(null), JSON.stringify(null)) +}) + +test('throw an error if the value doesn\'t match the type', (t) => { + t.plan(2) + + const schema = { + type: 'object', + additionalProperties: false, + required: ['data'], + properties: { + data: { + type: 'array', + minItems: 1, + items: { + oneOf: [ + { + type: 'string' + }, + { + type: 'number' + } + ] + } + } + } + } + + const stringify = build(schema) + + const validData = { data: [1, 'testing'] } + t.assert.equal(stringify(validData), JSON.stringify(validData)) + + const invalidData = { data: [false, 'testing'] } + t.assert.throws(() => stringify(invalidData)) +}) + +test('nullable value in oneOf', (t) => { + t.plan(1) + + const schema = { + type: 'object', + properties: { + data: { + oneOf: [ + { + type: 'array', + items: { + type: 'object', + properties: { + id: { type: 'integer', minimum: 1 } + }, + additionalProperties: false, + required: ['id'] + } + }, + { + type: 'array', + items: { + type: 'object', + properties: { + job: { type: 'string', nullable: true } + }, + additionalProperties: false, + required: ['job'] + } + } + ] + } + }, + required: ['data'], + additionalProperties: false + } + + const stringify = build(schema) + + const data = { data: [{ job: null }] } + t.assert.equal(stringify(data), JSON.stringify(data)) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/oneof.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/oneof.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f3b29f4be5b84ffa29b0421aaba408defb2101d1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/oneof.test.js @@ -0,0 +1,490 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('object with multiple types field', (t) => { + t.plan(2) + + const schema = { + title: 'object with multiple types field', + type: 'object', + properties: { + str: { + oneOf: [{ + type: 'string' + }, { + type: 'boolean' + }] + } + } + } + const stringify = build(schema) + + t.assert.equal(stringify({ str: 'string' }), '{"str":"string"}') + t.assert.equal(stringify({ str: true }), '{"str":true}') +}) + +test('object with field of type object or null', (t) => { + t.plan(2) + + const schema = { + title: 'object with field of type object or null', + type: 'object', + properties: { + prop: { + oneOf: [{ + type: 'object', + properties: { + str: { + type: 'string' + } + } + }, { + type: 'null' + }] + } + } + } + const stringify = build(schema) + + t.assert.equal(stringify({ prop: null }), '{"prop":null}') + + t.assert.equal(stringify({ + prop: { + str: 'string', remove: 'this' + } + }), '{"prop":{"str":"string"}}') +}) + +test('object with field of type object or array', (t) => { + t.plan(2) + + const schema = { + title: 'object with field of type object or array', + type: 'object', + properties: { + prop: { + oneOf: [{ + type: 'object', + properties: {}, + additionalProperties: true + }, { + type: 'array', + items: { + type: 'string' + } + }] + } + } + } + const stringify = build(schema) + + t.assert.equal(stringify({ + prop: { str: 'string' } + }), '{"prop":{"str":"string"}}') + + t.assert.equal(stringify({ + prop: ['string'] + }), '{"prop":["string"]}') +}) + +test('object with field of type string and coercion disable ', (t) => { + t.plan(1) + + const schema = { + title: 'object with field of type string', + type: 'object', + properties: { + str: { + oneOf: [{ + type: 'string' + }] + } + } + } + const stringify = build(schema) + t.assert.throws(() => stringify({ str: 1 })) +}) + +test('object with field of type string and coercion enable ', (t) => { + t.plan(1) + + const schema = { + title: 'object with field of type string', + type: 'object', + properties: { + str: { + oneOf: [{ + type: 'string' + }] + } + } + } + + const options = { + ajv: { + coerceTypes: true + } + } + const stringify = build(schema, options) + + const value = stringify({ + str: 1 + }) + t.assert.equal(value, '{"str":"1"}') +}) + +test('object with field with type union of multiple objects', (t) => { + t.plan(2) + + const schema = { + title: 'object with oneOf property value containing objects', + type: 'object', + properties: { + oneOfSchema: { + oneOf: [ + { + type: 'object', + properties: { + baz: { type: 'number' } + }, + required: ['baz'] + }, + { + type: 'object', + properties: { + bar: { type: 'string' } + }, + required: ['bar'] + } + ] + } + }, + required: ['oneOfSchema'] + } + + const stringify = build(schema) + + t.assert.equal(stringify({ oneOfSchema: { baz: 5 } }), '{"oneOfSchema":{"baz":5}}') + + t.assert.equal(stringify({ oneOfSchema: { bar: 'foo' } }), '{"oneOfSchema":{"bar":"foo"}}') +}) + +test('null value in schema', (t) => { + t.plan(0) + + const schema = { + title: 'schema with null child', + type: 'string', + nullable: true, + enum: [null] + } + + build(schema) +}) + +test('oneOf and $ref together', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + cs: { + oneOf: [ + { + $ref: '#/definitions/Option' + }, + { + type: 'boolean' + } + ] + } + }, + definitions: { + Option: { + type: 'string' + } + } + } + + const stringify = build(schema) + + t.assert.equal(stringify({ cs: 'franco' }), '{"cs":"franco"}') + + t.assert.equal(stringify({ cs: true }), '{"cs":true}') +}) + +test('oneOf and $ref: 2 levels are fine', (t) => { + t.plan(1) + + const schema = { + type: 'object', + properties: { + cs: { + oneOf: [ + { + $ref: '#/definitions/Option' + }, + { + type: 'boolean' + } + ] + } + }, + definitions: { + Option: { + oneOf: [ + { + type: 'number' + }, + { + type: 'boolean' + } + ] + } + } + } + + const stringify = build(schema) + const value = stringify({ + cs: 3 + }) + t.assert.equal(value, '{"cs":3}') +}) + +test('oneOf and $ref: multiple levels should throw at build.', (t) => { + t.plan(3) + + const schema = { + type: 'object', + properties: { + cs: { + oneOf: [ + { + $ref: '#/definitions/Option' + }, + { + type: 'boolean' + } + ] + } + }, + definitions: { + Option: { + oneOf: [ + { + $ref: '#/definitions/Option2' + }, + { + type: 'string' + } + ] + }, + Option2: { + type: 'number' + } + } + } + + const stringify = build(schema) + + t.assert.equal(stringify({ cs: 3 }), '{"cs":3}') + t.assert.equal(stringify({ cs: true }), '{"cs":true}') + t.assert.equal(stringify({ cs: 'pippo' }), '{"cs":"pippo"}') +}) + +test('oneOf and $ref - multiple external $ref', (t) => { + t.plan(2) + + const externalSchema = { + external: { + definitions: { + def: { + type: 'object', + properties: { + prop: { oneOf: [{ $ref: 'external2#/definitions/other' }] } + } + } + } + }, + external2: { + definitions: { + internal: { + type: 'string' + }, + other: { + type: 'object', + properties: { + prop2: { $ref: '#/definitions/internal' } + } + } + } + } + } + + const schema = { + title: 'object with $ref', + type: 'object', + properties: { + obj: { + $ref: 'external#/definitions/def' + } + } + } + + const object = { + obj: { + prop: { + prop2: 'test' + } + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"prop":{"prop2":"test"}}}') +}) + +test('oneOf with enum with more than 100 entries', (t) => { + t.plan(1) + + const schema = { + title: 'type array that may have one of declared items', + type: 'array', + items: { + oneOf: [ + { + type: 'string', + enum: ['EUR', 'USD', ...(new Set([...new Array(200)].map(() => Math.random().toString(36).substr(2, 3)))).values()] + }, + { type: 'null' } + ] + } + } + const stringify = build(schema) + + const value = stringify(['EUR', 'USD', null]) + t.assert.equal(value, '["EUR","USD",null]') +}) + +test('oneOf object with field of type string with format or null', (t) => { + t.plan(1) + + const toStringify = new Date() + + const withOneOfSchema = { + type: 'object', + properties: { + prop: { + oneOf: [{ + type: 'string', + format: 'date-time' + }, { + type: 'null' + }] + } + } + } + + const withOneOfStringify = build(withOneOfSchema) + + t.assert.equal(withOneOfStringify({ + prop: toStringify + }), `{"prop":"${toStringify.toISOString()}"}`) +}) + +test('one array item match oneOf types', (t) => { + t.plan(3) + + const schema = { + type: 'object', + additionalProperties: false, + required: ['data'], + properties: { + data: { + type: 'array', + minItems: 1, + items: { + oneOf: [ + { + type: 'string' + }, + { + type: 'number' + } + ] + } + } + } + } + + const stringify = build(schema) + + t.assert.equal(stringify({ data: ['foo'] }), '{"data":["foo"]}') + t.assert.equal(stringify({ data: [1] }), '{"data":[1]}') + t.assert.throws(() => stringify({ data: [false, 'foo'] })) +}) + +test('some array items match oneOf types', (t) => { + t.plan(2) + + const schema = { + type: 'object', + additionalProperties: false, + required: ['data'], + properties: { + data: { + type: 'array', + minItems: 1, + items: { + oneOf: [ + { + type: 'string' + }, + { + type: 'number' + } + ] + } + } + } + } + + const stringify = build(schema) + + t.assert.equal(stringify({ data: ['foo', 5] }), '{"data":["foo",5]}') + t.assert.throws(() => stringify({ data: [false, 'foo', true, 5] })) +}) + +test('all array items does not match oneOf types', (t) => { + t.plan(1) + + const schema = { + type: 'object', + additionalProperties: false, + required: ['data'], + properties: { + data: { + type: 'array', + minItems: 1, + items: { + oneOf: [ + { + type: 'string' + }, + { + type: 'number' + } + ] + } + } + } + } + + const stringify = build(schema) + + t.assert.throws(() => stringify({ data: [null, false, true, undefined, [], {}] })) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/patternProperties.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/patternProperties.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d80a7f1b5614085fc0a9572558c6419e799edbaa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/patternProperties.test.js @@ -0,0 +1,168 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('patternProperties', (t) => { + t.plan(1) + const stringify = build({ + title: 'patternProperties', + type: 'object', + properties: { + str: { + type: 'string' + } + }, + patternProperties: { + foo: { + type: 'string' + } + } + }) + + const obj = { str: 'test', foo: 42, ofoo: true, foof: 'string', objfoo: { a: true }, notMe: false } + t.assert.equal(stringify(obj), '{"str":"test","foo":"42","ofoo":"true","foof":"string","objfoo":"[object Object]"}') +}) + +test('patternProperties should not change properties', (t) => { + t.plan(1) + const stringify = build({ + title: 'patternProperties should not change properties', + type: 'object', + properties: { + foo: { + type: 'string' + } + }, + patternProperties: { + foo: { + type: 'number' + } + } + }) + + const obj = { foo: '42', ofoo: 42 } + t.assert.equal(stringify(obj), '{"foo":"42","ofoo":42}') +}) + +test('patternProperties - string coerce', (t) => { + t.plan(1) + const stringify = build({ + title: 'check string coerce', + type: 'object', + properties: {}, + patternProperties: { + foo: { + type: 'string' + } + } + }) + + const obj = { foo: true, ofoo: 42, arrfoo: ['array', 'test'], objfoo: { a: 'world' } } + t.assert.equal(stringify(obj), '{"foo":"true","ofoo":"42","arrfoo":"array,test","objfoo":"[object Object]"}') +}) + +test('patternProperties - number coerce', (t) => { + t.plan(2) + const stringify = build({ + title: 'check number coerce', + type: 'object', + properties: {}, + patternProperties: { + foo: { + type: 'number' + } + } + }) + + const coercibleValues = { foo: true, ofoo: '42' } + t.assert.equal(stringify(coercibleValues), '{"foo":1,"ofoo":42}') + + const incoercibleValues = { xfoo: 'string', arrfoo: [1, 2], objfoo: { num: 42 } } + try { + stringify(incoercibleValues) + t.fail('should throw an error') + } catch (err) { + t.assert.ok(err) + } +}) + +test('patternProperties - boolean coerce', (t) => { + t.plan(1) + const stringify = build({ + title: 'check boolean coerce', + type: 'object', + properties: {}, + patternProperties: { + foo: { + type: 'boolean' + } + } + }) + + const obj = { foo: 'true', ofoo: 0, arrfoo: [1, 2], objfoo: { a: true } } + t.assert.equal(stringify(obj), '{"foo":true,"ofoo":false,"arrfoo":true,"objfoo":true}') +}) + +test('patternProperties - object coerce', (t) => { + t.plan(1) + const stringify = build({ + title: 'check object coerce', + type: 'object', + properties: {}, + patternProperties: { + foo: { + type: 'object', + properties: { + answer: { + type: 'number' + } + } + } + } + }) + + const obj = { objfoo: { answer: 42 } } + t.assert.equal(stringify(obj), '{"objfoo":{"answer":42}}') +}) + +test('patternProperties - array coerce', (t) => { + t.plan(2) + const stringify = build({ + title: 'check array coerce', + type: 'object', + properties: {}, + patternProperties: { + foo: { + type: 'array', + items: { + type: 'string' + } + } + } + }) + + const coercibleValues = { arrfoo: [1, 2] } + t.assert.equal(stringify(coercibleValues), '{"arrfoo":["1","2"]}') + + const incoercibleValues = { foo: 'true', ofoo: 0, objfoo: { tyrion: 'lannister' } } + t.assert.throws(() => stringify(incoercibleValues)) +}) + +test('patternProperties - fail on invalid regex, handled by ajv', (t) => { + t.plan(1) + + t.assert.throws(() => build({ + title: 'check array coerce', + type: 'object', + properties: {}, + patternProperties: { + 'foo/\\': { + type: 'array', + items: { + type: 'string' + } + } + } + }), new Error('schema is invalid: data/patternProperties must match format "regex"')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/recursion.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/recursion.test.js new file mode 100644 index 0000000000000000000000000000000000000000..78be6261c9f6076f243e57cc330a2d58a5786768 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/recursion.test.js @@ -0,0 +1,245 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('can stringify recursive directory tree (issue #181)', (t) => { + t.plan(1) + + const schema = { + definitions: { + directory: { + type: 'object', + properties: { + name: { type: 'string' }, + subDirectories: { + type: 'array', + items: { $ref: '#/definitions/directory' }, + default: [] + } + } + } + }, + type: 'array', + items: { $ref: '#/definitions/directory' } + } + const stringify = build(schema) + + t.assert.equal(stringify([ + { name: 'directory 1', subDirectories: [] }, + { + name: 'directory 2', + subDirectories: [ + { name: 'directory 2.1', subDirectories: [] }, + { name: 'directory 2.2', subDirectories: [] } + ] + } + ]), '[{"name":"directory 1","subDirectories":[]},{"name":"directory 2","subDirectories":[{"name":"directory 2.1","subDirectories":[]},{"name":"directory 2.2","subDirectories":[]}]}]') +}) + +test('can stringify when recursion in external schema', t => { + t.plan(1) + + const referenceSchema = { + $id: 'person', + type: 'object', + properties: { + name: { type: 'string' }, + children: { + type: 'array', + items: { $ref: '#' } + } + } + } + + const schema = { + $id: 'mainSchema', + type: 'object', + properties: { + people: { + $ref: 'person' + } + } + } + const stringify = build(schema, { + schema: { + [referenceSchema.$id]: referenceSchema + } + }) + + const value = stringify({ people: { name: 'Elizabeth', children: [{ name: 'Charles' }] } }) + t.assert.equal(value, '{"people":{"name":"Elizabeth","children":[{"name":"Charles"}]}}') +}) + +test('use proper serialize function', t => { + t.plan(1) + + const personSchema = { + $id: 'person', + type: 'object', + properties: { + name: { type: 'string' }, + children: { + type: 'array', + items: { $ref: '#' } + } + } + } + + const directorySchema = { + $id: 'directory', + type: 'object', + properties: { + name: { type: 'string' }, + subDirectories: { + type: 'array', + items: { $ref: '#' }, + default: [] + } + } + } + + const schema = { + $id: 'mainSchema', + type: 'object', + properties: { + people: { $ref: 'person' }, + directory: { $ref: 'directory' } + } + } + const stringify = build(schema, { + schema: { + [personSchema.$id]: personSchema, + [directorySchema.$id]: directorySchema + } + }) + + const value = stringify({ + people: { + name: 'Elizabeth', + children: [{ + name: 'Charles', + children: [{ name: 'William', children: [{ name: 'George' }, { name: 'Charlotte' }] }, { name: 'Harry' }] + }] + }, + directory: { + name: 'directory 1', + subDirectories: [ + { name: 'directory 1.1', subDirectories: [] }, + { + name: 'directory 1.2', + subDirectories: [{ name: 'directory 1.2.1' }, { name: 'directory 1.2.2' }] + } + ] + } + }) + t.assert.equal(value, '{"people":{"name":"Elizabeth","children":[{"name":"Charles","children":[{"name":"William","children":[{"name":"George"},{"name":"Charlotte"}]},{"name":"Harry"}]}]},"directory":{"name":"directory 1","subDirectories":[{"name":"directory 1.1","subDirectories":[]},{"name":"directory 1.2","subDirectories":[{"name":"directory 1.2.1","subDirectories":[]},{"name":"directory 1.2.2","subDirectories":[]}]}]}}') +}) + +test('can stringify recursive references in object types (issue #365)', t => { + t.plan(1) + + const schema = { + type: 'object', + definitions: { + parentCategory: { + type: 'object', + properties: { + parent: { + $ref: '#/definitions/parentCategory' + } + } + } + }, + properties: { + category: { + type: 'object', + properties: { + parent: { + $ref: '#/definitions/parentCategory' + } + } + } + } + } + + const stringify = build(schema) + const data = { + category: { + parent: { + parent: { + parent: { + parent: {} + } + } + } + } + } + const value = stringify(data) + t.assert.equal(value, '{"category":{"parent":{"parent":{"parent":{"parent":{}}}}}}') +}) + +test('can stringify recursive inline $id references (issue #410)', t => { + t.plan(1) + const schema = { + $id: 'Node', + type: 'object', + properties: { + id: { + type: 'string' + }, + nodes: { + type: 'array', + items: { + $ref: 'Node' + } + } + }, + required: [ + 'id', + 'nodes' + ] + } + + const stringify = build(schema) + const data = { + id: '0', + nodes: [ + { + id: '1', + nodes: [{ + id: '2', + nodes: [ + { id: '3', nodes: [] }, + { id: '4', nodes: [] }, + { id: '5', nodes: [] } + ] + }] + }, + { + id: '6', + nodes: [{ + id: '7', + nodes: [ + { id: '8', nodes: [] }, + { id: '9', nodes: [] }, + { id: '10', nodes: [] } + ] + }] + }, + { + id: '11', + nodes: [{ + id: '12', + nodes: [ + { id: '13', nodes: [] }, + { id: '14', nodes: [] }, + { id: '15', nodes: [] } + ] + }] + } + ] + } + const value = stringify(data) + t.assert.equal(value, '{"id":"0","nodes":[{"id":"1","nodes":[{"id":"2","nodes":[{"id":"3","nodes":[]},{"id":"4","nodes":[]},{"id":"5","nodes":[]}]}]},{"id":"6","nodes":[{"id":"7","nodes":[{"id":"8","nodes":[]},{"id":"9","nodes":[]},{"id":"10","nodes":[]}]}]},{"id":"11","nodes":[{"id":"12","nodes":[{"id":"13","nodes":[]},{"id":"14","nodes":[]},{"id":"15","nodes":[]}]}]}]}') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/ref.json b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/ref.json new file mode 100644 index 0000000000000000000000000000000000000000..43ce78f64cf104cf5f805803aa3dc5dd4bd33bb7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/ref.json @@ -0,0 +1,12 @@ +{ + "definitions": { + "def": { + "type": "object", + "properties": { + "str": { + "type": "string" + } + } + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/ref.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/ref.test.js new file mode 100644 index 0000000000000000000000000000000000000000..eae4703ac92561e52fe17d7a6aa7710bcf73ff78 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/ref.test.js @@ -0,0 +1,2046 @@ +'use strict' + +const clone = require('rfdc')({ proto: true }) + +const { test } = require('node:test') +const build = require('..') + +test('ref internal - properties', (t) => { + t.plan(2) + + const schema = { + title: 'object with $ref', + definitions: { + def: { + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + }, + type: 'object', + properties: { + obj: { + $ref: '#/definitions/def' + } + } + } + + const object = { + obj: { + str: 'test' + } + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"str":"test"}}') +}) + +test('ref internal - items', (t) => { + t.plan(2) + + const schema = { + title: 'array with $ref', + definitions: { + def: { + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + }, + type: 'array', + items: { $ref: '#/definitions/def' } + } + + const array = [{ + str: 'test' + }] + + const stringify = build(schema) + const output = stringify(array) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '[{"str":"test"}]') +}) + +test('ref external - properties', (t) => { + t.plan(2) + + const externalSchema = { + first: require('./ref.json'), + second: { + definitions: { + num: { + type: 'object', + properties: { + int: { + type: 'integer' + } + } + } + } + }, + third: { + type: 'string' + } + } + + const schema = { + title: 'object with $ref', + type: 'object', + properties: { + obj: { + $ref: 'first#/definitions/def' + }, + num: { + $ref: 'second#/definitions/num' + }, + strPlain: { + $ref: 'third' + }, + strHash: { + $ref: 'third#' + } + } + } + + const object = { + obj: { + str: 'test' + }, + num: { + int: 42 + }, + strPlain: 'test', + strHash: 'test' + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"str":"test"},"num":{"int":42},"strPlain":"test","strHash":"test"}') +}) + +test('ref internal - patternProperties', (t) => { + t.plan(2) + + const schema = { + title: 'object with $ref', + definitions: { + def: { + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + }, + type: 'object', + properties: {}, + patternProperties: { + obj: { + $ref: '#/definitions/def' + } + } + } + + const object = { + obj: { + str: 'test' + } + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"str":"test"}}') +}) + +test('ref internal - additionalProperties', (t) => { + t.plan(2) + + const schema = { + title: 'object with $ref', + definitions: { + def: { + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + }, + type: 'object', + properties: {}, + additionalProperties: { + $ref: '#/definitions/def' + } + } + + const object = { + obj: { + str: 'test' + } + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"str":"test"}}') +}) + +test('ref internal - pattern-additional Properties', (t) => { + t.plan(2) + + const schema = { + title: 'object with $ref', + definitions: { + def: { + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + }, + type: 'object', + properties: {}, + patternProperties: { + reg: { + $ref: '#/definitions/def' + } + }, + additionalProperties: { + $ref: '#/definitions/def' + } + } + + const object = { + reg: { + str: 'test' + }, + obj: { + str: 'test' + } + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"reg":{"str":"test"},"obj":{"str":"test"}}') +}) + +test('ref external - pattern-additional Properties', (t) => { + t.plan(2) + + const externalSchema = { + first: require('./ref.json'), + second: { + definitions: { + num: { + type: 'object', + properties: { + int: { + type: 'integer' + } + } + } + } + } + } + + const schema = { + title: 'object with $ref', + type: 'object', + properties: {}, + patternProperties: { + reg: { + $ref: 'first#/definitions/def' + } + }, + additionalProperties: { + $ref: 'second#/definitions/num' + } + } + + const object = { + reg: { + str: 'test' + }, + obj: { + int: 42 + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"reg":{"str":"test"},"obj":{"int":42}}') +}) + +test('ref internal - deepObject schema', (t) => { + t.plan(2) + + const schema = { + title: 'object with $ref', + definitions: { + def: { + type: 'object', + properties: { + coming: { + type: 'object', + properties: { + where: { + type: 'string' + } + } + } + } + } + }, + type: 'object', + properties: { + winter: { + type: 'object', + properties: { + is: { + $ref: '#/definitions/def' + } + } + } + } + } + + const object = { + winter: { + is: { + coming: { + where: 'to town' + } + } + } + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"winter":{"is":{"coming":{"where":"to town"}}}}') +}) + +test('ref internal - plain name fragment', (t) => { + t.plan(2) + + const schema = { + title: 'object with $ref', + definitions: { + def: { + $id: '#uri', + type: 'object', + properties: { + str: { + type: 'string' + } + }, + required: ['str'] + } + }, + type: 'object', + properties: { + obj: { + $ref: '#uri' + } + } + } + + const object = { + obj: { + str: 'test' + } + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"str":"test"}}') +}) + +test('ref external - plain name fragment', (t) => { + t.plan(2) + + const externalSchema = { + first: { + $id: '#first-schema', + type: 'object', + properties: { + str: { + type: 'string' + } + } + }, + second: { + definitions: { + second: { + $id: '#second-schema', + type: 'object', + properties: { + int: { + type: 'integer' + } + } + } + } + } + } + + const schema = { + title: 'object with $ref to external plain name fragment', + type: 'object', + properties: { + first: { + $ref: 'first#first-schema' + }, + second: { + $ref: 'second#second-schema' + } + } + } + + const object = { + first: { + str: 'test' + }, + second: { + int: 42 + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"first":{"str":"test"},"second":{"int":42}}') +}) + +test('external reference to $id', (t) => { + t.plan(2) + + const externalSchema = { + first: { + $id: 'external-reference', + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + } + + const schema = { + type: 'object', + properties: { + first: { + $ref: 'external-reference' + } + } + } + + const object = { first: { str: 'test' } } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"first":{"str":"test"}}') +}) + +test('external reference to key#id', (t) => { + t.plan(2) + + const externalSchema = { + first: { + $id: '#external-reference', + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + } + + const schema = { + type: 'object', + properties: { + first: { + $ref: 'first#external-reference' + } + } + } + + const object = { first: { str: 'test' } } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"first":{"str":"test"}}') +}) + +test('external and inner reference', (t) => { + t.plan(2) + + const externalSchema = { + first: { + $id: 'reference', + $ref: '#reference', + definitions: { + inner: { + $id: '#reference', + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + } + } + } + + const schema = { + type: 'object', + properties: { + first: { + $ref: 'reference' + } + } + } + + const object = { first: { str: 'test' } } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"first":{"str":"test"}}') +}) + +test('external reference to key', (t) => { + t.plan(2) + + const externalSchema = { + first: { + $id: 'external-reference', + type: 'object', + properties: { + str: { + type: 'string' + } + } + } + } + + const schema = { + type: 'object', + properties: { + first: { + $ref: 'external-reference' + } + } + } + + const object = { first: { str: 'test' } } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"first":{"str":"test"}}') +}) + +test('ref external - plain name fragment', (t) => { + t.plan(2) + + const externalSchema = { + first: { + $id: 'first-schema', + type: 'object', + properties: { + str: { + type: 'string' + } + } + }, + second: { + definitions: { + second: { + $id: 'second-schema', + type: 'object', + properties: { + int: { + type: 'integer' + } + } + } + } + } + } + + const schema = { + title: 'object with $ref to external plain name fragment', + type: 'object', + properties: { + first: { + $ref: 'first-schema' + }, + second: { + $ref: 'second-schema' + } + } + } + + const object = { + first: { + str: 'test' + }, + second: { + int: 42 + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"first":{"str":"test"},"second":{"int":42}}') +}) + +test('ref external - duplicate plain name fragment', (t) => { + t.plan(2) + + const externalSchema = { + external: { + $id: '#duplicateSchema', + type: 'object', + properties: { + prop: { + type: 'boolean' + } + } + }, + other: { + $id: '#otherSchema', + type: 'object', + properties: { + prop: { + type: 'integer' + } + } + } + } + + const schema = { + title: 'object with $ref to plain name fragment', + type: 'object', + definitions: { + duplicate: { + $id: '#duplicateSchema', + type: 'object', + properties: { + prop: { + type: 'string' + } + } + } + }, + properties: { + local: { + $ref: '#duplicateSchema' + }, + external: { + $ref: 'external#duplicateSchema' + }, + other: { + $ref: 'other#otherSchema' + } + } + } + + const object = { + local: { + prop: 'test' + }, + external: { + prop: true + }, + other: { + prop: 42 + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"local":{"prop":"test"},"external":{"prop":true},"other":{"prop":42}}') +}) + +test('ref external - explicit external plain name fragment must not fallback to other external schemas', (t) => { + t.plan(1) + + const externalSchema = { + first: { + $id: '#target', + type: 'object', + properties: { + prop: { + type: 'string' + } + } + }, + second: { + $id: '#wrong', + type: 'object', + properties: { + prop: { + type: 'integer' + } + } + } + } + + const schema = { + title: 'object with $ref to plain name fragment', + type: 'object', + definitions: { + third: { + $id: '#wrong', + type: 'object', + properties: { + prop: { + type: 'boolean' + } + } + } + }, + properties: { + target: { + $ref: 'first#wrong' + } + } + } + + const object = { + target: { + prop: 'test' + } + } + + t.assert.throws(() => { + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + JSON.parse(output) + }, { + message: 'Cannot find reference "first#wrong"' + }) +}) + +test('ref internal - multiple $ref format', (t) => { + t.plan(2) + + const schema = { + type: 'object', + definitions: { + one: { + type: 'string', + definitions: { + two: { + $id: '#twos', + type: 'string' + } + } + } + }, + properties: { + zero: { + $id: '#three', + type: 'string' + }, + a: { $ref: '#/definitions/one' }, + b: { $ref: '#three' }, + c: { $ref: '#/properties/zero' }, + d: { $ref: '#twos' }, + e: { $ref: '#/definitions/one/definitions/two' } + } + } + + const object = { + zero: 'test', + a: 'test', + b: 'test', + c: 'test', + d: 'test', + e: 'test' + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"zero":"test","a":"test","b":"test","c":"test","d":"test","e":"test"}') +}) + +test('ref external - external schema with internal ref (object property)', (t) => { + t.plan(2) + + const externalSchema = { + external: { + definitions: { + internal: { type: 'string' }, + def: { + type: 'object', + properties: { + prop: { $ref: '#/definitions/internal' } + } + } + } + } + } + + const schema = { + title: 'object with $ref', + type: 'object', + properties: { + obj: { + $ref: 'external#/definitions/def' + } + } + } + + const object = { + obj: { + prop: 'test' + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"prop":"test"}}') +}) + +test('ref external - external schema with internal ref (array items)', (t) => { + t.plan(2) + + const externalSchema = { + external: { + definitions: { + internal: { type: 'string' }, + def: { + type: 'object', + properties: { + prop: { $ref: '#/definitions/internal' } + } + } + } + } + } + + const schema = { + title: 'object with $ref', + type: 'object', + properties: { + arr: { + type: 'array', + items: { + $ref: 'external#/definitions/def' + } + } + } + } + + const object = { + arr: [{ + prop: 'test' + }] + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"arr":[{"prop":"test"}]}') +}) + +test('ref external - external schema with internal ref (root)', (t) => { + t.plan(2) + + const externalSchema = { + external: { + definitions: { + internal: { type: 'string' }, + def: { + type: 'object', + properties: { + prop: { $ref: '#/definitions/internal' } + } + } + } + } + } + + const schema = { + title: 'object with $ref', + $ref: 'external#/definitions/def' + } + + const object = { + prop: 'test' + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"prop":"test"}') +}) + +test('ref external - external schema with internal ref (pattern properties)', (t) => { + t.plan(2) + + const externalSchema = { + external: { + definitions: { + internal: { type: 'string' }, + def: { + type: 'object', + patternProperties: { + '^p': { $ref: '#/definitions/internal' } + } + } + } + } + } + + const schema = { + title: 'object with $ref', + type: 'object', + patternProperties: { + '^o': { + $ref: 'external#/definitions/def' + } + } + } + + const object = { + obj: { + prop: 'test' + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":{"prop":"test"}}') +}) + +test('ref in root internal', (t) => { + t.plan(2) + + const schema = { + title: 'object with $ref in root schema', + $ref: '#/definitions/num', + definitions: { + num: { + type: 'object', + properties: { + int: { + $ref: '#/definitions/int' + } + } + }, + int: { + type: 'integer' + } + } + } + + const object = { int: 42 } + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"int":42}') +}) + +test('ref in root external', (t) => { + t.plan(2) + + const externalSchema = { + numbers: { + $id: 'numbers', + definitions: { + num: { + type: 'object', + properties: { + int: { + type: 'integer' + } + } + } + } + } + } + + const schema = { + title: 'object with $ref in root schema', + type: 'object', + $ref: 'numbers#/definitions/num' + } + + const object = { int: 42 } + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"int":42}') +}) + +test('ref in root external multiple times', (t) => { + t.plan(2) + + const externalSchema = { + numbers: { + $id: 'numbers', + $ref: 'subnumbers#/definitions/num' + }, + subnumbers: { + $id: 'subnumbers', + definitions: { + num: { + type: 'object', + properties: { + int: { + type: 'integer' + } + } + } + } + } + } + + const schema = { + title: 'object with $ref in root schema', + type: 'object', + $ref: 'numbers' + } + + const object = { int: 42 } + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"int":42}') +}) + +test('ref external to relative definition', (t) => { + t.plan(2) + + const externalSchema = { + 'relative:to:local': { + $id: 'relative:to:local', + type: 'object', + properties: { + foo: { $ref: '#/definitions/foo' } + }, + definitions: { + foo: { type: 'string' } + } + } + } + + const schema = { + type: 'object', + required: ['fooParent'], + properties: { + fooParent: { $ref: 'relative:to:local' } + } + } + + const object = { fooParent: { foo: 'bar' } } + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"fooParent":{"foo":"bar"}}') +}) + +test('ref to nested ref definition', (t) => { + t.plan(2) + + const externalSchema = { + 'a:b:c1': { + $id: 'a:b:c1', + type: 'object', + definitions: { + foo: { $ref: 'a:b:c2#/definitions/foo' } + } + }, + 'a:b:c2': { + $id: 'a:b:c2', + type: 'object', + definitions: { + foo: { type: 'string' } + } + } + } + + const schema = { + type: 'object', + required: ['foo'], + properties: { + foo: { $ref: 'a:b:c1#/definitions/foo' } + } + } + + const object = { foo: 'foo' } + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"foo":"foo"}') +}) + +test('Bad key', async t => { + await t.test('Find match', t => { + t.plan(1) + try { + build({ + definitions: { + projectId: { + type: 'object', + properties: { + id: { type: 'integer' } + } + } + }, + type: 'object', + properties: { + data: { + $ref: '#/definitions/porjectId' + } + } + }) + t.fail('Should throw') + } catch (err) { + t.assert.equal(err.message, 'Cannot find reference "#/definitions/porjectId"') + } + }) + + await t.test('No match', t => { + t.plan(1) + + t.assert.throws(() => { + build({ + definitions: { + projectId: { + type: 'object', + properties: { + id: { type: 'integer' } + } + } + }, + type: 'object', + properties: { + data: { + $ref: '#/definitions/foobar' + } + } + }) + }, { message: 'Cannot find reference "#/definitions/foobar"' }) + }) + + await t.test('Find match (external schema)', t => { + t.plan(1) + t.assert.throws(() => { + build({ + type: 'object', + properties: { + data: { + $ref: 'external#/definitions/porjectId' + } + } + }, { + schema: { + external: { + definitions: { + projectId: { + type: 'object', + properties: { + id: { type: 'integer' } + } + } + } + } + } + }) + t.fail('Should throw') + }, { message: 'Cannot find reference "external#/definitions/porjectId"' }) + }) + + await t.test('No match (external schema)', t => { + t.plan(1) + t.assert.throws(() => { + build({ + type: 'object', + properties: { + data: { + $ref: 'external#/definitions/foobar' + } + } + }, { + schema: { + external: { + definitions: { + projectId: { + type: 'object', + properties: { + id: { type: 'integer' } + } + } + } + } + } + }) + }, { message: 'Cannot find reference "external#/definitions/foobar"' }) + }) + + await t.test('Find match (external definitions typo)', t => { + t.plan(1) + t.assert.throws(() => { + build({ + type: 'object', + properties: { + data: { + $ref: 'external#/deifnitions/projectId' + } + } + }, { + schema: { + external: { + definitions: { + projectId: { + type: 'object', + properties: { + id: { type: 'integer' } + } + } + } + } + } + }) + }, { message: 'Cannot find reference "external#/deifnitions/projectId"' }) + }) + + await t.test('Find match (definitions typo)', t => { + t.plan(1) + t.assert.throws(() => { + build({ + definitions: { + projectId: { + type: 'object', + properties: { + id: { type: 'integer' } + } + } + }, + type: 'object', + properties: { + data: { + $ref: '#/deifnitions/projectId' + } + } + }) + }, { message: 'Cannot find reference "#/deifnitions/projectId"' }) + }) + + await t.test('Find match (external schema typo)', t => { + t.plan(1) + t.assert.throws(() => { + build({ + type: 'object', + properties: { + data: { + $ref: 'extrenal#/definitions/projectId' + } + } + }, { + schema: { + external: { + definitions: { + projectId: { + type: 'object', + properties: { + id: { type: 'integer' } + } + } + } + } + } + }) + }, { message: 'Cannot resolve ref "extrenal#/definitions/projectId". Schema with id "extrenal" is not found.' }) + }) +}) + +test('Regression 2.5.2', t => { + t.plan(1) + + const externalSchema = { + '/models/Bar': { + $id: '/models/Bar', + $schema: 'http://json-schema.org/schema#', + definitions: { + entity: { + type: 'object', + properties: { field: { type: 'string' } } + } + } + }, + '/models/Foo': { + $id: '/models/Foo', + $schema: 'http://json-schema.org/schema#', + definitions: { + entity: { + type: 'object', + properties: { + field: { type: 'string' }, + sub: { + oneOf: [ + { $ref: '/models/Bar#/definitions/entity' }, + { type: 'null' } + ] + } + } + } + } + } + } + + const schema = { + type: 'array', + items: { + $ref: '/models/Foo#/definitions/entity' + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify([{ field: 'parent', sub: { field: 'joined' } }]) + + t.assert.equal(output, '[{"field":"parent","sub":{"field":"joined"}}]') +}) + +test('Reference through multiple definitions', (t) => { + t.plan(2) + + const schema = { + $ref: '#/definitions/A', + definitions: { + A: { + type: 'object', + additionalProperties: false, + properties: { a: { anyOf: [{ $ref: '#/definitions/B' }] } }, + required: ['a'] + }, + B: { + type: 'object', + properties: { b: { anyOf: [{ $ref: '#/definitions/C' }] } }, + required: ['b'], + additionalProperties: false + }, + C: { + type: 'object', + properties: { c: { type: 'string', const: 'd' } }, + required: ['c'], + additionalProperties: false + } + } + } + + const object = { a: { b: { c: 'd' } } } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, JSON.stringify(object)) +}) + +test('issue #350', (t) => { + t.plan(2) + + const schema = { + title: 'Example Schema', + type: 'object', + properties: { + firstName: { $ref: '#foo' }, + lastName: { $ref: '#foo' }, + nested: { + type: 'object', + properties: { + firstName: { $ref: '#foo' }, + lastName: { $ref: '#foo' } + } + } + }, + definitions: { + foo: { + $id: '#foo', + type: 'string' + } + } + } + + const object = { + firstName: 'Matteo', + lastName: 'Collina', + nested: { + firstName: 'Matteo', + lastName: 'Collina' + } + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, JSON.stringify(object)) +}) + +test('deep union type', (t) => { + t.plan(1) + + const stringify = build({ + schema: { + type: 'array', + items: { + oneOf: [ + { + $ref: 'components#/schemas/IDirectory' + }, + { + $ref: 'components#/schemas/IImageFile' + }, + { + $ref: 'components#/schemas/ITextFile' + }, + { + $ref: 'components#/schemas/IZipFile' + } + ] + }, + nullable: false + }, + components: { + schemas: { + IDirectory: { + $id: 'IDirectory', + $recursiveAnchor: true, + type: 'object', + properties: { + children: { + type: 'array', + items: { + oneOf: [ + { + $recursiveRef: '#' + }, + { + $ref: 'components#/schemas/IImageFile' + }, + { + $ref: 'components#/schemas/ITextFile' + }, + { + $ref: 'components#/schemas/IZipFile' + } + ] + }, + nullable: false + }, + type: { + type: 'string', + nullable: false + }, + id: { + type: 'string', + nullable: false + }, + name: { + type: 'string', + nullable: false + } + }, + nullable: false, + required: [ + 'children', + 'type', + 'id', + 'name' + ] + }, + IImageFile: { + $id: 'IImageFile', + type: 'object', + properties: { + width: { + type: 'number', + nullable: false + }, + height: { + type: 'number', + nullable: false + }, + url: { + type: 'string', + nullable: false + }, + extension: { + type: 'string', + nullable: false + }, + size: { + type: 'number', + nullable: false + }, + type: { + type: 'string', + nullable: false + }, + id: { + type: 'string', + nullable: false + }, + name: { + type: 'string', + nullable: false + } + }, + nullable: false, + required: [ + 'width', + 'height', + 'url', + 'extension', + 'size', + 'type', + 'id', + 'name' + ] + }, + ITextFile: { + $id: 'ITextFile', + type: 'object', + properties: { + content: { + type: 'string', + nullable: false + }, + extension: { + type: 'string', + nullable: false + }, + size: { + type: 'number', + nullable: false + }, + type: { + type: 'string', + nullable: false + }, + id: { + type: 'string', + nullable: false + }, + name: { + type: 'string', + nullable: false + } + }, + nullable: false, + required: [ + 'content', + 'extension', + 'size', + 'type', + 'id', + 'name' + ] + }, + IZipFile: { + $id: 'IZipFile', + type: 'object', + properties: { + files: { + type: 'number', + nullable: false + }, + extension: { + type: 'string', + nullable: false + }, + size: { + type: 'number', + nullable: false + }, + type: { + type: 'string', + nullable: false + }, + id: { + type: 'string', + nullable: false + }, + name: { + type: 'string', + nullable: false + } + }, + nullable: false, + required: [ + 'files', + 'extension', + 'size', + 'type', + 'id', + 'name' + ] + } + } + } + }) + + const obj = [ + { + type: 'directory', + id: '7b1068a4-dd6e-474a-8d85-09a2d77639cb', + name: 'ixcWGOKI', + children: [ + { + type: 'directory', + id: '5883e17c-b207-46d4-ad2d-be72249711ce', + name: 'vecQwFGS', + children: [] + }, + { + type: 'file', + id: '670b6556-a610-4a48-8a16-9c2da97a0d18', + name: 'eStFddzX', + extension: 'jpg', + size: 7, + width: 300, + height: 1200, + url: 'https://github.com/samchon/typescript-json' + }, + { + type: 'file', + id: '85dc796d-9593-4833-b1a1-addc8ebf74ea', + name: 'kTdUfwRJ', + extension: 'ts', + size: 86, + content: 'console.log("Hello world");' + }, + { + type: 'file', + id: '8933c86a-7a1e-4d4a-b0a6-17d6896fdf89', + name: 'NBPkefUG', + extension: 'zip', + size: 22, + files: 20 + } + ] + } + ] + t.assert.equal(JSON.stringify(obj), stringify(obj)) +}) + +test('ref with same id in properties', async (t) => { + t.plan(2) + + const externalSchema = { + ObjectId: { + $id: 'ObjectId', + type: 'string' + }, + File: { + $id: 'File', + type: 'object', + properties: { + _id: { $ref: 'ObjectId' }, + name: { type: 'string' }, + owner: { $ref: 'ObjectId' } + } + } + } + + await t.test('anyOf', (t) => { + t.plan(1) + + const schema = { + $id: 'Article', + type: 'object', + properties: { + _id: { $ref: 'ObjectId' }, + image: { + anyOf: [ + { $ref: 'File' }, + { type: 'null' } + ] + } + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify({ _id: 'foo', image: { _id: 'bar', name: 'hello', owner: 'baz' } }) + + t.assert.equal(output, '{"_id":"foo","image":{"_id":"bar","name":"hello","owner":"baz"}}') + }) + + await t.test('oneOf', (t) => { + t.plan(1) + + const schema = { + $id: 'Article', + type: 'object', + properties: { + _id: { $ref: 'ObjectId' }, + image: { + oneOf: [ + { $ref: 'File' }, + { type: 'null' } + ] + } + } + } + + const stringify = build(schema, { schema: externalSchema }) + const output = stringify({ _id: 'foo', image: { _id: 'bar', name: 'hello', owner: 'baz' } }) + + t.assert.equal(output, '{"_id":"foo","image":{"_id":"bar","name":"hello","owner":"baz"}}') + }) +}) + +test('Should not modify external schemas', (t) => { + t.plan(2) + + const externalSchema = { + uuid: { + format: 'uuid', + $id: 'UUID', + type: 'string' + }, + Entity: { + $id: 'Entity', + type: 'object', + properties: { + id: { $ref: 'UUID' }, + id2: { $ref: 'UUID' } + } + } + } + + const options = { schema: externalSchema } + const optionsClone = clone(options) + + const stringify = build({ $ref: 'Entity' }, options) + + const data = { id: 'a4e4c954-9f5f-443a-aa65-74d95732249a' } + const output = stringify(data) + + t.assert.equal(output, JSON.stringify(data)) + t.assert.deepStrictEqual(options, optionsClone) +}) + +test('input schema is not mutated', (t) => { + t.plan(3) + + const schema = { + title: 'object with $ref', + type: 'object', + definitions: { + def: { type: 'string' } + }, + properties: { + obj: { + $ref: '#/definitions/def' + } + } + } + + const clonedSchema = JSON.parse(JSON.stringify(schema)) + + const object = { + obj: 'test' + } + + const stringify = build(schema) + const output = stringify(object) + + t.assert.doesNotThrow(() => JSON.parse(output)) + t.assert.equal(output, '{"obj":"test"}') + t.assert.deepStrictEqual(schema, clonedSchema) +}) + +test('anyOf inside allOf', (t) => { + t.plan(1) + + const schema = { + anyOf: [ + { + type: 'object', + allOf: [ + { + properties: { + a: { + anyOf: [ + { const: 'A1' }, + { const: 'A2' } + ] + } + } + }, + { + properties: { + b: { const: 'B' } + } + } + ] + } + ] + } + + const object = { a: 'A1', b: 'B' } + const stringify = build(schema) + const output = stringify(object) + + t.assert.equal(output, JSON.stringify(object)) +}) + +test('should resolve absolute $refs', (t) => { + t.plan(1) + + const externalSchema = { + FooSchema: { + $id: 'FooSchema', + type: 'object', + properties: { + type: { + anyOf: [ + { type: 'string', const: 'bar' }, + { type: 'string', const: 'baz' } + ] + } + } + } + } + + const schema = { $ref: 'FooSchema' } + + const object = { type: 'bar' } + const stringify = build(schema, { schema: externalSchema }) + const output = stringify(object) + + t.assert.equal(output, JSON.stringify(object)) +}) + +test('nested schema should overwrite anchor scope', (t) => { + t.plan(2) + + const externalSchema = { + root: { + $id: 'root', + definitions: { + subschema: { + $id: 'subschema', + definitions: { + anchorSchema: { + $id: '#anchor', + type: 'string' + } + } + } + } + } + } + + const data = 'test' + const stringify = build({ $ref: 'subschema#anchor' }, { schema: externalSchema }) + const output = stringify(data) + + t.assert.equal(output, JSON.stringify(data)) + t.assert.throws(() => build({ $ref: 'root#anchor' }, { schema: externalSchema })) +}) + +test('object property reference with default value', (t) => { + t.plan(1) + + const schema = { + definitions: { + prop: { + type: 'string', + default: 'foo' + } + }, + type: 'object', + properties: { + prop: { + $ref: '#/definitions/prop' + } + } + } + + const stringify = build(schema) + const output = stringify({}) + + t.assert.equal(output, '{"prop":"foo"}') +}) + +test('should throw an Error if two non-identical schemas with same id are provided', (t) => { + t.plan(1) + + const schema = { + $id: 'schema', + type: 'object', + allOf: [ + { + $id: 'base', + type: 'object', + properties: { + name: { + type: 'string' + } + }, + required: [ + 'name' + ] + }, + { + $id: 'inner_schema', + type: 'object', + properties: { + union: { + $id: '#id', + anyOf: [ + { + + $id: 'guid', + type: 'string' + }, + { + + $id: 'email', + type: 'string' + } + ] + } + }, + required: [ + 'union' + ] + }, + { + $id: 'inner_schema', + type: 'object', + properties: { + union: { + $id: '#id', + anyOf: [ + { + + $id: 'guid', + type: 'string' + }, + { + + $id: 'mail', + type: 'string' + } + ] + } + }, + required: [ + 'union' + ] + } + ] + } + + try { + build(schema) + } catch (err) { + t.assert.equal(err.message, 'There is already another schema with id "inner_schema".') + } +}) + +test('ref internal - throw if schema has definition twice with different shape', (t) => { + t.plan(1) + + const schema = { + $id: 'test', + title: 'object with $ref', + definitions: { + def: { + $id: '#uri', + type: 'object', + properties: { + str: { + type: 'string' + } + }, + required: ['str'] + }, + def2: { + $id: '#uri', + type: 'object', + properties: { + num: { + type: 'number' + } + }, + required: ['num'] + } + }, + type: 'object', + properties: { + obj: { + $ref: '#uri' + } + } + } + + try { + build(schema) + } catch (err) { + t.assert.equal(err.message, 'There is already another anchor "#uri" in schema "test".') + } +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/regex.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/regex.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e08f8672e3c6286edce0fbfd61ad1350bdbe4422 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/regex.test.js @@ -0,0 +1,32 @@ +'use strict' + +const { test } = require('node:test') +const validator = require('is-my-json-valid') +const build = require('..') + +test('object with RexExp', (t) => { + t.plan(3) + + const schema = { + title: 'object with RegExp', + type: 'object', + properties: { + reg: { + type: 'string' + } + } + } + + const obj = { + reg: /"([^"]|\\")*"/ + } + + const stringify = build(schema) + const validate = validator(schema) + const output = stringify(obj) + + t.assert.doesNotThrow(() => JSON.parse(output)) + + t.assert.equal(obj.reg.source, new RegExp(JSON.parse(output).reg).source) + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/required.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/required.test.js new file mode 100644 index 0000000000000000000000000000000000000000..96d74705e37cb891e324cd6396e2adf26c920886 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/required.test.js @@ -0,0 +1,204 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('object with required field', (t) => { + t.plan(2) + + const schema = { + title: 'object with required field', + type: 'object', + properties: { + str: { + type: 'string' + }, + num: { + type: 'integer' + } + }, + required: ['str'] + } + const stringify = build(schema) + + t.assert.doesNotThrow(() => { + stringify({ + str: 'string' + }) + }) + + t.assert.throws(() => { + stringify({ + num: 42 + }) + }, { message: '"str" is required!' }) +}) + +test('object with required field not in properties schema', (t) => { + t.plan(2) + + const schema = { + title: 'object with required field', + type: 'object', + properties: { + num: { + type: 'integer' + } + }, + required: ['str'] + } + const stringify = build(schema) + + t.assert.throws(() => { + stringify({}) + }, { message: '"str" is required!' }) + + t.assert.throws(() => { + stringify({ + num: 42 + }) + }, { message: '"str" is required!' }) +}) + +test('object with required field not in properties schema with additional properties true', (t) => { + t.plan(2) + + const schema = { + title: 'object with required field', + type: 'object', + properties: { + num: { + type: 'integer' + } + }, + additionalProperties: true, + required: ['str'] + } + const stringify = build(schema) + + t.assert.throws(() => { + stringify({}) + }, { message: '"str" is required!' }) + + t.assert.throws(() => { + stringify({ + num: 42 + }) + }, { message: '"str" is required!' }) +}) + +test('object with multiple required field not in properties schema', (t) => { + t.plan(3) + + const schema = { + title: 'object with required field', + type: 'object', + properties: { + num: { + type: 'integer' + } + }, + additionalProperties: true, + required: ['num', 'key1', 'key2'] + } + const stringify = build(schema) + + t.assert.throws(() => { + stringify({}) + }, { message: '"key1" is required!' }) + + t.assert.throws(() => { + stringify({ + key1: 42, + key2: 42 + }) + }, { message: '"num" is required!' }) + + t.assert.throws(() => { + stringify({ + num: 42, + key1: 'some' + }) + }, { message: '"key2" is required!' }) +}) + +test('object with required bool', (t) => { + t.plan(2) + + const schema = { + title: 'object with required field', + type: 'object', + properties: { + num: { + type: 'integer' + } + }, + additionalProperties: true, + required: ['bool'] + } + const stringify = build(schema) + + t.assert.throws(() => { + stringify({}) + }, { message: '"bool" is required!' }) + + t.assert.doesNotThrow(() => { + stringify({ + bool: false + }) + }) +}) + +test('required nullable', (t) => { + t.plan(1) + + const schema = { + title: 'object with required field', + type: 'object', + properties: { + num: { + type: ['integer'] + } + }, + additionalProperties: true, + required: ['null'] + } + const stringify = build(schema) + + t.assert.doesNotThrow(() => { + stringify({ + null: null + }) + }) +}) + +test('required numbers', (t) => { + t.plan(2) + + const schema = { + title: 'object with required field', + type: 'object', + properties: { + str: { + type: 'string' + }, + num: { + type: 'integer' + } + }, + required: ['num'] + } + const stringify = build(schema) + + t.assert.doesNotThrow(() => { + stringify({ + num: 42 + }) + }) + + t.assert.throws(() => { + stringify({ + num: 'aaa' + }) + }, { message: 'The value "aaa" cannot be converted to an integer.' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/requiresAjv.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/requiresAjv.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c62289abc6b9d3b1d90e01f0e448c219d3473312 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/requiresAjv.test.js @@ -0,0 +1,50 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('nested ref requires ajv', async t => { + t.test('nested ref requires ajv', async t => { + const schemaA = { + $id: 'urn:schema:a', + definitions: { + foo: { anyOf: [{ type: 'string' }, { type: 'null' }] } + } + } + + const schemaB = { + $id: 'urn:schema:b', + type: 'object', + properties: { + results: { + type: 'object', + properties: { + items: { + type: 'object', + properties: { + bar: { + type: 'array', + items: { $ref: 'urn:schema:a#/definitions/foo' } + } + } + } + } + } + } + } + + const stringify = build(schemaB, { + schema: { + [schemaA.$id]: schemaA + } + }) + const result = stringify({ + results: { + items: { + bar: ['baz'] + } + } + }) + t.assert.equal(result, '{"results":{"items":{"bar":["baz"]}}}') + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize.test.js new file mode 100644 index 0000000000000000000000000000000000000000..18bd90e72b2e5d1bd6ddcf0a0a0bddc1d689f9be --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize.test.js @@ -0,0 +1,141 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +const stringify = build({ + title: 'Example Schema', + type: 'object', + properties: { + firstName: { + type: 'string' + }, + lastName: { + type: 'string' + }, + age: { + description: 'Age in years"', + type: 'integer' + }, + [(() => "phra'&& process.exit(1) ||'phra")()]: {}, + now: { + type: 'string' + }, + reg: { + type: 'string', + default: 'a\'&& process.exit(1) ||\'' + }, + obj: { + type: 'object', + properties: { + bool: { + type: 'boolean' + } + } + }, + '"\'w00t': { + type: 'string', + default: '"\'w00t' + }, + arr: { + type: 'array', + items: { + type: 'object', + properties: { + 'phra\' && process.exit(1)//': { + type: 'number' + }, + str: { + type: 'string' + } + } + } + } + }, + required: ['now'], + patternProperties: { + '.*foo$': { + type: 'string' + }, + test: { + type: 'number' + }, + 'phra\'/ && process.exit(1) && /\'': { + type: 'number' + }, + '"\'w00t.*////': { + type: 'number' + } + }, + additionalProperties: { + type: 'string' + } +}) + +const obj = { + firstName: 'Matteo', + lastName: 'Collina', + age: 32, + now: new Date(), + foo: 'hello"', + bar: "world'", + 'fuzz"': 42, + "me'": 42, + numfoo: 42, + test: 42, + strtest: '23', + arr: [{ 'phra\' && process.exit(1)//': 42 }], + obj: { bool: true }, + notmatch: 'valar morghulis', + notmatchobj: { a: true }, + notmatchnum: 42 +} + +test('sanitize', t => { + const json = stringify(obj) + t.assert.doesNotThrow(() => JSON.parse(json)) + + const stringify2 = build({ + title: 'Example Schema', + type: 'object', + patternProperties: { + '"\'w00t.*////': { + type: 'number' + } + } + }) + + t.assert.deepStrictEqual(JSON.parse(stringify2({ + '"\'phra////': 42, + asd: 42 + })), { + }) + + const stringify3 = build({ + title: 'Example Schema', + type: 'object', + properties: { + "\"phra\\'&&(console.log(42))//||'phra": {} + } + }) + + // this verifies the escaping + JSON.parse(stringify3({ + '"phra\'&&(console.log(42))//||\'phra': 42 + })) + + const stringify4 = build({ + title: 'Example Schema', + type: 'object', + properties: { + '"\\\\\\\\\'w00t': { + type: 'string', + default: '"\'w00t' + } + } + }) + + t.assert.deepStrictEqual(JSON.parse(stringify4({})), { + '"\\\\\\\\\'w00t': '"\'w00t' + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize2.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize2.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9c7382d3878cd616185072724afabb31c30f3774 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize2.test.js @@ -0,0 +1,18 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('sanitize 2', t => { + const payload = '(throw "pwoned")' + + const stringify = build({ + properties: { + [`*///\\\\\\']);${payload};{/*`]: { + type: 'number' + } + } + }) + + t.assert.doesNotThrow(() => stringify({})) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize3.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize3.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ac3bab5ade0768b323ad04a91e5c86db4a6a39ba --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize3.test.js @@ -0,0 +1,17 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('sanitize 3', t => { + t.assert.throws(() => { + build({ + $defs: { + type: 'foooo"bar' + }, + patternProperties: { + x: { $ref: '#/$defs' } + } + }) + }, { message: 'foooo"bar unsupported' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize4.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize4.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c1486dfec4f90c3e736203c90831a3ef90de5316 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize4.test.js @@ -0,0 +1,16 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('sanitize 4', t => { + const payload = '(throw "pwoned")' + + const stringify = build({ + required: [`"];${payload}//`] + }) + + t.assert.throws(() => { + stringify({}) + }, { message: '""];(throw "pwoned")//" is required!' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize5.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize5.test.js new file mode 100644 index 0000000000000000000000000000000000000000..039a355c00648d7733b9b8bc2178299e91f32587 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize5.test.js @@ -0,0 +1,16 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('sanitize 5', t => { + const payload = '(throw "pwoned")' + + t.assert.throws(() => { + build({ + patternProperties: { + '*': { type: `*/${payload}){//` } + } + }) + }, { message: 'schema is invalid: data/patternProperties must match format "regex"' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize6.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize6.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e8dfb4c813d3a0a74d7fc82bb60dfdd55490e2a4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize6.test.js @@ -0,0 +1,22 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('sanitize 6', t => { + const payload = '(throw "pwoned")' + + const stringify = build({ + type: 'object', + properties: { + '/*': { type: 'object' }, + x: { + type: 'object', + properties: { + a: { type: 'string', default: `*/}${payload};{//` } + } + } + } + }) + t.assert.doesNotThrow(() => { stringify({}) }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize7.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize7.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d678bfd7725148dff0ca132e3af01b24309a282f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/sanitize7.test.js @@ -0,0 +1,68 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('required property containing single quote, contains property', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + '\'': { type: 'string' } + }, + required: [ + '\'' + ] + }) + + t.assert.throws(() => stringify({}), new Error('"\'" is required!')) +}) + +test('required property containing double quote, contains property', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + '"': { type: 'string' } + }, + required: [ + '"' + ] + }) + + t.assert.throws(() => stringify({}), new Error('""" is required!')) +}) + +test('required property containing single quote, does not contain property', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + a: { type: 'string' } + }, + required: [ + '\'' + ] + }) + + t.assert.throws(() => stringify({}), new Error('"\'" is required!')) +}) + +test('required property containing double quote, does not contain property', (t) => { + t.plan(1) + + const stringify = build({ + type: 'object', + properties: { + a: { type: 'string' } + }, + required: [ + '"' + ] + }) + + t.assert.throws(() => stringify({}), new Error('""" is required!')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/side-effect.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/side-effect.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f1a1f30d50100ef3af58990a62629e82686a6dcc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/side-effect.test.js @@ -0,0 +1,196 @@ +'use strict' + +const { test } = require('node:test') +const clone = require('rfdc/default') +const build = require('..') + +test('oneOf with $ref should not change the input schema', t => { + t.plan(2) + + const referenceSchema = { + $id: 'externalId', + type: 'object', + properties: { + name: { type: 'string' } + } + } + + const schema = { + $id: 'mainSchema', + type: 'object', + properties: { + people: { + oneOf: [{ $ref: 'externalId' }] + } + } + } + const clonedSchema = clone(schema) + const stringify = build(schema, { + schema: { + [referenceSchema.$id]: referenceSchema + } + }) + + const value = stringify({ people: { name: 'hello', foo: 'bar' } }) + t.assert.equal(value, '{"people":{"name":"hello"}}') + t.assert.deepStrictEqual(schema, clonedSchema) +}) + +test('oneOf and anyOf with $ref should not change the input schema', t => { + t.plan(3) + + const referenceSchema = { + $id: 'externalSchema', + type: 'object', + properties: { + name: { type: 'string' } + } + } + + const schema = { + $id: 'rootSchema', + type: 'object', + properties: { + people: { + oneOf: [{ $ref: 'externalSchema' }] + }, + love: { + anyOf: [ + { $ref: '#/definitions/foo' }, + { type: 'boolean' } + ] + } + }, + definitions: { + foo: { type: 'string' } + } + } + const clonedSchema = clone(schema) + const stringify = build(schema, { + schema: { + [referenceSchema.$id]: referenceSchema + } + }) + + const valueAny1 = stringify({ people: { name: 'hello', foo: 'bar' }, love: 'music' }) + const valueAny2 = stringify({ people: { name: 'hello', foo: 'bar' }, love: true }) + + t.assert.equal(valueAny1, '{"people":{"name":"hello"},"love":"music"}') + t.assert.equal(valueAny2, '{"people":{"name":"hello"},"love":true}') + t.assert.deepStrictEqual(schema, clonedSchema) +}) + +test('multiple $ref tree', t => { + t.plan(2) + + const referenceDeepSchema = { + $id: 'deepId', + type: 'number' + } + + const referenceSchema = { + $id: 'externalId', + type: 'object', + properties: { + name: { $ref: '#/definitions/foo' }, + age: { $ref: 'deepId' } + }, + definitions: { + foo: { type: 'string' } + } + } + + const schema = { + $id: 'mainSchema', + type: 'object', + properties: { + people: { + oneOf: [{ $ref: 'externalId' }] + } + } + } + const clonedSchema = clone(schema) + const stringify = build(schema, { + schema: { + [referenceDeepSchema.$id]: referenceDeepSchema, + [referenceSchema.$id]: referenceSchema + } + }) + + const value = stringify({ people: { name: 'hello', foo: 'bar', age: 42 } }) + t.assert.equal(value, '{"people":{"name":"hello","age":42}}') + t.assert.deepStrictEqual(schema, clonedSchema) +}) + +test('must not mutate items $ref', t => { + t.plan(2) + + const referenceSchema = { + $id: 'ShowSchema', + $schema: 'http://json-schema.org/draft-07/schema#', + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + + const schema = { + $id: 'ListSchema', + $schema: 'http://json-schema.org/draft-07/schema#', + type: 'array', + items: { + $ref: 'ShowSchema#' + } + } + const clonedSchema = clone(schema) + const stringify = build(schema, { + schema: { + [referenceSchema.$id]: referenceSchema + } + }) + + const value = stringify([{ name: 'foo' }]) + t.assert.equal(value, '[{"name":"foo"}]') + t.assert.deepStrictEqual(schema, clonedSchema) +}) + +test('must not mutate items referred by $ref', t => { + t.plan(2) + + const firstSchema = { + $id: 'example1', + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + + const reusedSchema = { + $id: 'example2', + type: 'object', + properties: { + name: { + oneOf: [ + { + $ref: 'example1' + } + ] + } + } + } + + const clonedSchema = clone(firstSchema) + const stringify = build(reusedSchema, { + schema: { + [firstSchema.$id]: firstSchema + } + }) + + const value = stringify({ name: { name: 'foo' } }) + t.assert.equal(value, '{"name":{"name":"foo"}}') + t.assert.deepStrictEqual(firstSchema, clonedSchema) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/standalone-mode.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/standalone-mode.test.js new file mode 100644 index 0000000000000000000000000000000000000000..528d05faca0c3b34a5635d15bd56e77f2137312e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/standalone-mode.test.js @@ -0,0 +1,219 @@ +'use strict' + +const { test, after } = require('node:test') +const fjs = require('..') +const fs = require('fs') +const path = require('path') + +function build (opts, schema) { + return fjs(schema || { + title: 'default string', + type: 'object', + properties: { + firstName: { + type: 'string' + } + }, + required: ['firstName'] + }, opts) +} + +const tmpDir = 'test/fixtures' + +test('activate standalone mode', async (t) => { + t.plan(3) + + after(async () => { + await fs.promises.rm(destination, { force: true }) + }) + + const code = build({ mode: 'standalone' }) + t.assert.ok(typeof code === 'string') + t.assert.equal(code.indexOf('ajv'), -1) + + const destination = path.resolve(tmpDir, 'standalone.js') + + await fs.promises.writeFile(destination, code) + const standalone = require(destination) + t.assert.equal(standalone({ firstName: 'Foo', surname: 'bar' }), JSON.stringify({ firstName: 'Foo' }), 'surname evicted') +}) + +test('test ajv schema', async (t) => { + t.plan(3) + + after(async () => { + await fs.promises.rm(destination, { force: true }) + }) + + const code = build({ mode: 'standalone' }, { + type: 'object', + properties: { + }, + if: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] } + } + }, + then: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['foobar'] }, + foo: { type: 'string' }, + bar: { type: 'number' }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' } + } + } + } + } + }, + else: { + type: 'object', + properties: { + kind: { type: 'string', enum: ['greeting'] }, + hi: { type: 'string' }, + hello: { type: 'number' }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + name: { type: 'string' }, + value: { type: 'string' } + } + } + } + } + } + }) + t.assert.ok(typeof code === 'string') + t.assert.equal(code.indexOf('ajv') > 0, true) + + const destination = path.resolve(tmpDir, 'standalone2.js') + + await fs.promises.writeFile(destination, code) + const standalone = require(destination) + t.assert.equal(standalone({ + kind: 'foobar', + foo: 'FOO', + list: [{ + name: 'name', + value: 'foo' + }], + bar: 42, + hi: 'HI', + hello: 45, + a: 'A', + b: 35 + }), JSON.stringify({ + kind: 'foobar', + foo: 'FOO', + bar: 42, + list: [{ + name: 'name', + value: 'foo' + }] + })) +}) + +test('no need to keep external schemas once compiled', async (t) => { + t.plan(1) + + after(async () => { + await fs.promises.rm(destination, { force: true }) + }) + + const externalSchema = { + first: { + definitions: { + id1: { + type: 'object', + properties: { + id1: { + type: 'integer' + } + } + } + } + } + } + const code = fjs({ + $ref: 'first#/definitions/id1' + }, { + mode: 'standalone', + schema: externalSchema + }) + + const destination = path.resolve(tmpDir, 'standalone3.js') + + await fs.promises.writeFile(destination, code) + const standalone = require(destination) + + t.assert.equal(standalone({ id1: 5 }), JSON.stringify({ id1: 5 }), 'serialization works with external schemas') +}) + +test('no need to keep external schemas once compiled - with oneOf validator', async (t) => { + t.plan(2) + + after(async () => { + await fs.promises.rm(destination, { force: true }) + }) + + const externalSchema = { + ext: { + definitions: { + oBaz: { + type: 'object', + properties: { + baz: { type: 'number' } + }, + required: ['baz'] + }, + oBar: { + type: 'object', + properties: { + bar: { type: 'string' } + }, + required: ['bar'] + }, + other: { + type: 'string', + const: 'other' + } + } + } + } + + const schema = { + title: 'object with oneOf property value containing refs to external schema', + type: 'object', + properties: { + oneOfSchema: { + oneOf: [ + { $ref: 'ext#/definitions/oBaz' }, + { $ref: 'ext#/definitions/oBar' } + ] + } + }, + required: ['oneOfSchema'] + } + + const code = fjs(schema, { + mode: 'standalone', + schema: externalSchema + }) + + const destination = path.resolve(tmpDir, 'standalone-oneOf-ref.js') + + await fs.promises.writeFile(destination, code) + const stringify = require(destination) + + t.assert.equal(stringify({ oneOfSchema: { baz: 5 } }), '{"oneOfSchema":{"baz":5}}') + t.assert.equal(stringify({ oneOfSchema: { bar: 'foo' } }), '{"oneOfSchema":{"bar":"foo"}}') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/string.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/string.test.js new file mode 100644 index 0000000000000000000000000000000000000000..518513da3d77091ea5564134b118302a3ba1ed74 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/string.test.js @@ -0,0 +1,84 @@ +'use strict' + +const { test } = require('node:test') + +const build = require('..') + +test('serialize short string', (t) => { + t.plan(2) + + const schema = { + type: 'string' + } + + const input = 'abcd' + const stringify = build(schema) + const output = stringify(input) + + t.assert.equal(output, '"abcd"') + t.assert.equal(JSON.parse(output), input) +}) + +test('serialize short string', (t) => { + t.plan(2) + + const schema = { + type: 'string' + } + + const input = '\x00' + const stringify = build(schema) + const output = stringify(input) + + t.assert.equal(output, '"\\u0000"') + t.assert.equal(JSON.parse(output), input) +}) + +test('serialize long string', (t) => { + t.plan(2) + + const schema = { + type: 'string' + } + + const input = new Array(2e4).fill('\x00').join('') + const stringify = build(schema) + const output = stringify(input) + + t.assert.equal(output, `"${new Array(2e4).fill('\\u0000').join('')}"`) + t.assert.equal(JSON.parse(output), input) +}) + +test('unsafe string', (t) => { + t.plan(2) + + const schema = { + type: 'string', + format: 'unsafe' + } + + const input = 'abcd' + const stringify = build(schema) + const output = stringify(input) + + t.assert.equal(output, `"${input}"`) + t.assert.equal(JSON.parse(output), input) +}) + +test('unsafe unescaped string', (t) => { + t.plan(2) + + const schema = { + type: 'string', + format: 'unsafe' + } + + const input = 'abcd "abcd"' + const stringify = build(schema) + const output = stringify(input) + + t.assert.equal(output, `"${input}"`) + t.assert.throws(function () { + JSON.parse(output) + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/surrogate.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/surrogate.test.js new file mode 100644 index 0000000000000000000000000000000000000000..37943bd75e0f4cfb0bf5d4b7e7177110f983a118 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/surrogate.test.js @@ -0,0 +1,67 @@ +'use strict' + +const { test } = require('node:test') +const validator = require('is-my-json-valid') +const build = require('..') + +test('render a string with surrogate pairs as JSON:test 1', (t) => { + t.plan(2) + + const schema = { + title: 'surrogate', + type: 'string' + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify('𝌆') + + t.assert.equal(output, '"𝌆"') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('render a string with surrogate pairs as JSON: test 2', (t) => { + t.plan(2) + + const schema = { + title: 'long', + type: 'string' + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify('\uD834\uDF06') + + t.assert.equal(output, '"𝌆"') + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('render a string with Unpaired surrogate code as JSON', (t) => { + t.plan(2) + + const schema = { + title: 'surrogate', + type: 'string' + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify('\uDF06\uD834') + t.assert.equal(output, JSON.stringify('\uDF06\uD834')) + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) + +test('render a string with lone surrogate code as JSON', (t) => { + t.plan(2) + + const schema = { + title: 'surrogate', + type: 'string' + } + + const validate = validator(schema) + const stringify = build(schema) + const output = stringify('\uDEAD') + t.assert.equal(output, JSON.stringify('\uDEAD')) + t.assert.ok(validate(JSON.parse(output)), 'valid schema') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/toJSON.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/toJSON.test.js new file mode 100644 index 0000000000000000000000000000000000000000..61010b1b313f27bbd81203134197d18a364d7986 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/toJSON.test.js @@ -0,0 +1,203 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('use toJSON method on object types', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple object', + type: 'object', + properties: { + productName: { + type: 'string' + } + } + }) + const object = { + product: { name: 'cola' }, + toJSON: function () { + return { productName: this.product.name } + } + } + + t.assert.equal('{"productName":"cola"}', stringify(object)) +}) + +test('use toJSON method on nested object types', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple array', + type: 'array', + items: { + type: 'object', + properties: { + productName: { + type: 'string' + } + } + } + }) + const array = [ + { + product: { name: 'cola' }, + toJSON: function () { + return { productName: this.product.name } + } + }, + { + product: { name: 'sprite' }, + toJSON: function () { + return { productName: this.product.name } + } + } + ] + + t.assert.equal('[{"productName":"cola"},{"productName":"sprite"}]', stringify(array)) +}) + +test('not use toJSON if does not exist', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple object', + type: 'object', + properties: { + product: { + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + } + }) + const object = { + product: { name: 'cola' } + } + + t.assert.equal('{"product":{"name":"cola"}}', stringify(object)) +}) + +test('not fail on null object declared nullable', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple object', + type: 'object', + nullable: true, + properties: { + product: { + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + } + }) + t.assert.equal('null', stringify(null)) +}) + +test('not fail on null sub-object declared nullable', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple object', + type: 'object', + properties: { + product: { + nullable: true, + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + } + }) + const object = { + product: null + } + t.assert.equal('{"product":null}', stringify(object)) +}) + +test('on non nullable null sub-object it should coerce to {}', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple object', + type: 'object', + properties: { + product: { + nullable: false, + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + } + }) + const object = { + product: null + } + + const result = stringify(object) + t.assert.equal(result, JSON.stringify({ product: {} })) +}) + +test('on non nullable null object it should coerce to {}', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple object', + nullable: false, + type: 'object', + properties: { + product: { + nullable: false, + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + } + }) + + const result = stringify(null) + t.assert.equal(result, '{}') +}) + +test('on non-nullable null object it should skip rendering, skipping required fields checks', (t) => { + t.plan(1) + + const stringify = build({ + title: 'simple object', + nullable: false, + type: 'object', + properties: { + product: { + nullable: false, + type: 'object', + properties: { + name: { + type: 'string' + } + } + } + }, + required: ['product'] + }) + + const result = stringify(null) + t.assert.equal(result, '{}') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/typebox.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/typebox.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9bf8f28d6f3520b3cc25f9e40ee5c637226dec25 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/typebox.test.js @@ -0,0 +1,36 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('nested object in pattern properties for typebox', (t) => { + const { Type } = require('@sinclair/typebox') + + t.plan(1) + + const nestedSchema = Type.Object({ + nestedKey1: Type.String() + }) + + const RootSchema = Type.Object({ + key1: Type.Record(Type.String(), nestedSchema), + key2: Type.Record(Type.String(), nestedSchema) + }) + + const schema = RootSchema + const stringify = build(schema) + + const value = stringify({ + key1: { + nestedKey: { + nestedKey1: 'value1' + } + }, + key2: { + nestedKey: { + nestedKey1: 'value2' + } + } + }) + t.assert.equal(value, '{"key1":{"nestedKey":{"nestedKey1":"value1"}},"key2":{"nestedKey":{"nestedKey1":"value2"}}}') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/typesArray.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/typesArray.test.js new file mode 100644 index 0000000000000000000000000000000000000000..341cc03269edbbe014d74ab390294efbbdbfefe1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/typesArray.test.js @@ -0,0 +1,550 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('possibly nullable integer primitive alternative', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with multi-type nullable primitive', + type: 'object', + properties: { + data: { + type: ['integer'] + } + } + } + + const stringify = build(schema, { ajv: { allowUnionTypes: true } }) + + const value = stringify({ + data: 4 + }) + t.assert.equal(value, '{"data":4}') +}) + +test('possibly nullable number primitive alternative', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with multi-type nullable primitive', + type: 'object', + properties: { + data: { + type: ['number'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: 4 + }) + t.assert.equal(value, '{"data":4}') +}) + +test('possibly nullable integer primitive alternative with null value', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with multi-type nullable primitive', + type: 'object', + properties: { + data: { + type: ['integer'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: null + }) + t.assert.equal(value, '{"data":0}') +}) + +test('possibly nullable number primitive alternative with null value', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with multi-type nullable primitive', + type: 'object', + properties: { + data: { + type: ['number'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: null + }) + t.assert.equal(value, '{"data":0}') +}) + +test('possibly nullable number primitive alternative with null value', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with multi-type nullable primitive', + type: 'object', + properties: { + data: { + type: ['boolean'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: null + }) + t.assert.equal(value, '{"data":false}') +}) + +test('nullable integer primitive', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with nullable primitive', + type: 'object', + properties: { + data: { + type: ['integer', 'null'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: 4 + }) + t.assert.equal(value, '{"data":4}') +}) + +test('nullable number primitive', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with nullable primitive', + type: 'object', + properties: { + data: { + type: ['number', 'null'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: 4 + }) + t.assert.equal(value, '{"data":4}') +}) + +test('nullable primitive with null value', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with nullable primitive', + type: 'object', + properties: { + data: { + type: ['integer', 'null'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: null + }) + t.assert.equal(value, '{"data":null}') +}) + +test('nullable number primitive with null value', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with nullable primitive', + type: 'object', + properties: { + data: { + type: ['number', 'null'] + } + } + } + + const stringify = build(schema) + + const value = stringify({ + data: null + }) + t.assert.equal(value, '{"data":null}') +}) + +test('possibly null object with multi-type property', (t) => { + t.plan(3) + + const schema = { + title: 'simple object with multi-type property', + type: 'object', + properties: { + objectOrNull: { + type: ['object', 'null'], + properties: { + stringOrNumber: { + type: ['string', 'number'] + } + } + } + } + } + const stringify = build(schema) + + t.assert.equal(stringify({ + objectOrNull: { + stringOrNumber: 'string' + } + }), '{"objectOrNull":{"stringOrNumber":"string"}}') + + t.assert.equal(stringify({ + objectOrNull: { + stringOrNumber: 42 + } + }), '{"objectOrNull":{"stringOrNumber":42}}') + + t.assert.equal(stringify({ + objectOrNull: null + }), '{"objectOrNull":null}') +}) + +test('object with possibly null array of multiple types', (t) => { + t.plan(5) + + const schema = { + title: 'object with array of multiple types', + type: 'object', + properties: { + arrayOfStringsAndNumbers: { + type: ['array', 'null'], + items: { + type: ['string', 'number', 'null'] + } + } + } + } + const stringify = build(schema) + + try { + const value = stringify({ + arrayOfStringsAndNumbers: null + }) + t.assert.equal(value, '{"arrayOfStringsAndNumbers":null}') + } catch (e) { + console.log(e) + t.fail() + } + + try { + const value = stringify({ + arrayOfStringsAndNumbers: ['string1', 'string2'] + }) + t.assert.equal(value, '{"arrayOfStringsAndNumbers":["string1","string2"]}') + } catch (e) { + console.log(e) + t.fail() + } + + t.assert.equal(stringify({ + arrayOfStringsAndNumbers: [42, 7] + }), '{"arrayOfStringsAndNumbers":[42,7]}') + + t.assert.equal(stringify({ + arrayOfStringsAndNumbers: ['string1', 42, 7, 'string2'] + }), '{"arrayOfStringsAndNumbers":["string1",42,7,"string2"]}') + + t.assert.equal(stringify({ + arrayOfStringsAndNumbers: ['string1', null, 42, 7, 'string2', null] + }), '{"arrayOfStringsAndNumbers":["string1",null,42,7,"string2",null]}') +}) + +test('object with tuple of multiple types', (t) => { + t.plan(2) + + const schema = { + title: 'object with array of multiple types', + type: 'object', + properties: { + fixedTupleOfStringsAndNumbers: { + type: 'array', + items: [ + { + type: 'string' + }, + { + type: 'number' + }, + { + type: ['string', 'number'] + } + ] + } + } + } + const stringify = build(schema) + + try { + const value = stringify({ + fixedTupleOfStringsAndNumbers: ['string1', 42, 7] + }) + t.assert.equal(value, '{"fixedTupleOfStringsAndNumbers":["string1",42,7]}') + } catch (e) { + console.log(e) + t.fail() + } + + try { + const value = stringify({ + fixedTupleOfStringsAndNumbers: ['string1', 42, 'string2'] + }) + t.assert.equal(value, '{"fixedTupleOfStringsAndNumbers":["string1",42,"string2"]}') + } catch (e) { + console.log(e) + t.fail() + } +}) + +test('object with anyOf and multiple types', (t) => { + t.plan(3) + + const schema = { + title: 'object with anyOf and multiple types', + type: 'object', + properties: { + objectOrBoolean: { + anyOf: [ + { + type: 'object', + properties: { + stringOrNumber: { + type: ['string', 'number'] + } + } + }, + { + type: 'boolean' + } + ] + } + } + } + const stringify = build(schema, { ajv: { allowUnionTypes: true } }) + + try { + const value = stringify({ + objectOrBoolean: { stringOrNumber: 'string' } + }) + t.assert.equal(value, '{"objectOrBoolean":{"stringOrNumber":"string"}}') + } catch (e) { + console.log(e) + t.fail() + } + + t.assert.equal(stringify({ + objectOrBoolean: { stringOrNumber: 42 } + }), '{"objectOrBoolean":{"stringOrNumber":42}}') + + t.assert.equal(stringify({ + objectOrBoolean: true + }), '{"objectOrBoolean":true}') +}) + +test('string type array can handle dates', (t) => { + t.plan(1) + const schema = { + type: 'object', + properties: { + date: { type: ['string'] }, + dateObject: { type: ['string'], format: 'date-time' } + } + } + const stringify = build(schema) + const value = stringify({ + date: new Date('2018-04-20T07:52:31.017Z'), + dateObject: new Date('2018-04-21T07:52:31.017Z') + }) + t.assert.equal(value, '{"date":"2018-04-20T07:52:31.017Z","dateObject":"2018-04-21T07:52:31.017Z"}') +}) + +test('object that is simultaneously a string and a json', (t) => { + t.plan(2) + const schema = { + type: 'object', + properties: { + simultaneously: { + type: ['string', 'object'], + properties: { + foo: { type: 'string' } + } + } + } + } + + const likeObjectId = { + toString () { return 'hello' } + } + + const stringify = build(schema) + const valueStr = stringify({ simultaneously: likeObjectId }) + t.assert.equal(valueStr, '{"simultaneously":"hello"}') + + const valueObj = stringify({ simultaneously: { foo: likeObjectId } }) + t.assert.equal(valueObj, '{"simultaneously":{"foo":"hello"}}') +}) + +test('object that is simultaneously a string and a json switched', (t) => { + t.plan(2) + const schema = { + type: 'object', + properties: { + simultaneously: { + type: ['object', 'string'], + properties: { + foo: { type: 'string' } + } + } + } + } + + const likeObjectId = { + toString () { return 'hello' } + } + + const stringify = build(schema) + const valueStr = stringify({ simultaneously: likeObjectId }) + t.assert.equal(valueStr, '{"simultaneously":{}}') + + const valueObj = stringify({ simultaneously: { foo: likeObjectId } }) + t.assert.equal(valueObj, '{"simultaneously":{"foo":"hello"}}') +}) + +test('class instance that is simultaneously a string and a json', (t) => { + t.plan(2) + + const schema = { + type: 'object', + properties: { + simultaneously: { + type: ['string', 'object'], + properties: { + foo: { type: 'string' } + } + } + } + } + + class Test { + toString () { return 'hello' } + } + + const likeObjectId = new Test() + + const stringify = build(schema) + const valueStr = stringify({ simultaneously: likeObjectId }) + t.assert.equal(valueStr, '{"simultaneously":"hello"}') + + const valueObj = stringify({ simultaneously: { foo: likeObjectId } }) + t.assert.equal(valueObj, '{"simultaneously":{"foo":"hello"}}') +}) + +test('should not throw an error when type is array and object is null, it should instead coerce to []', (t) => { + t.plan(1) + const schema = { + type: 'object', + properties: { + arr: { + type: 'array', + items: { + type: 'number' + } + } + } + } + + const stringify = build(schema) + const result = stringify({ arr: null }) + t.assert.equal(result, JSON.stringify({ arr: [] })) +}) + +test('should throw an error when type is array and object is not an array', (t) => { + t.plan(1) + const schema = { + type: 'object', + properties: { + arr: { + type: 'array', + items: { + type: 'number' + } + } + } + } + + const stringify = build(schema) + t.assert.throws(() => stringify({ arr: { foo: 'hello' } }), new TypeError('The value of \'#/properties/arr\' does not match schema definition.')) +}) + +test('should throw an error when type is array and object is not an array with external schema', (t) => { + t.plan(1) + const schema = { + type: 'object', + properties: { + arr: { + $ref: 'arrayOfNumbers#/definitions/arr' + } + } + } + + const externalSchema = { + arrayOfNumbers: { + definitions: { + arr: { + type: 'array', + items: { + type: 'number' + } + } + } + } + } + + const stringify = build(schema, { schema: externalSchema }) + t.assert.throws(() => stringify({ arr: { foo: 'hello' } }), new TypeError('The value of \'arrayOfNumbers#/definitions/arr\' does not match schema definition.')) +}) + +test('throw an error if none of types matches', (t) => { + t.plan(1) + + const schema = { + title: 'simple object with multi-type nullable primitive', + type: 'object', + properties: { + data: { + type: ['number', 'boolean'] + } + } + } + + const stringify = build(schema) + t.assert.throws(() => stringify({ data: 'string' }), 'The value "string" does not match schema definition.') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/unknownFormats.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/unknownFormats.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b38363ddf93c3989f7e177292e42bab3530dd11a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/unknownFormats.test.js @@ -0,0 +1,27 @@ +'use strict' + +const { test } = require('node:test') +const build = require('..') + +test('object with custom format field', (t) => { + t.plan(1) + + const schema = { + title: 'object with custom format field', + type: 'object', + properties: { + str: { + type: 'string', + format: 'test-format' + } + } + } + + const stringify = build(schema) + + t.assert.doesNotThrow(() => { + stringify({ + str: 'string' + }) + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/webpack.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/webpack.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6a27c1669799814160fabae912e56e00c87d8a18 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/test/webpack.test.js @@ -0,0 +1,50 @@ +'use strict' + +const { test } = require('node:test') +const webpack = require('webpack') +const path = require('path') + +test('the library should work with webpack', async (t) => { + t.plan(1) + const targetdir = path.resolve(__dirname, '..', '.cache') + const targetname = path.join(targetdir, 'webpacktest.js') + const wopts = { + entry: path.resolve(__dirname, '..', 'index.js'), + mode: 'production', + target: 'node', + output: { + path: targetdir, + filename: 'webpacktest.js', + library: { + name: 'fastJsonStringify', + type: 'umd' + } + } + } + await new Promise((resolve, reject) => { + webpack(wopts, (err, stats) => { + if (err) { reject(err) } else { resolve(stats) }; + }) + }) + const build = require(targetname) + const stringify = build({ + title: 'webpack should not rename code to be executed', + type: 'object', + properties: { + foo: { + type: 'string' + }, + bar: { + type: 'boolean' + } + }, + patternProperties: { + foo: { + type: 'number' + } + } + }) + + const obj = { foo: '42', bar: true } + t.assert.equal(stringify(obj), '{"foo":"42","bar":true}') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/types/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8472129547b9328b290b88ed171d1ca3bb25b1a3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/types/index.d.ts @@ -0,0 +1,231 @@ +import Ajv, { Options as AjvOptions } from 'ajv' + +type Build = typeof build + +declare namespace build { + interface BaseSchema { + /** + * Schema id + */ + $id?: string + /** + * Schema title + */ + title?: string; + /** + * Schema description + */ + description?: string; + /** + * A comment to be added to the schema + */ + $comment?: string; + /** + * Default value to be assigned when no value is given in the document + */ + default?: any; + /** + * A list of example values that match this schema + */ + examples?: any[]; + /** + * Additional schema definition to reference from within the schema + */ + definitions?: Record + /** + * A set of schemas of which at least one must match + */ + anyOf?: Partial[]; + /** + * A set of schemas which must all match + */ + allOf?: Partial[]; + /** + * A conditional schema to check, controls schemas defined in `then` and `else` + */ + if?: Partial; + /** + * A schema to apply if the conditional schema from `if` passes + */ + then?: Partial; + /** + * A schema to apply if the conditional schema from `if` fails + */ + else?: Partial; + /** + * Open API 3.0 spec states that any value that can be null must be declared `nullable` + * @default false + */ + nullable?: boolean; + } + + export interface RefSchema { + /** + * A json-pointer to a schema to use as a reference + */ + $ref: string; + } + + export interface AnySchema extends BaseSchema { + } + + export interface StringSchema extends BaseSchema { + type: 'string'; + format?: string; + } + + export interface IntegerSchema extends BaseSchema { + type: 'integer'; + } + + export interface NumberSchema extends BaseSchema { + type: 'number'; + } + + export interface NullSchema extends BaseSchema { + type: 'null'; + } + + export interface BooleanSchema extends BaseSchema { + type: 'boolean'; + } + + export interface ArraySchema extends BaseSchema { + type: 'array'; + /** + * The schema for the items in the array + */ + items: Schema | {} + } + + export interface TupleSchema extends BaseSchema { + type: 'array'; + /** + * The schemas for the items in the tuple + */ + items: Schema[]; + } + + type ObjectProperties = Record> & { + anyOf?: ObjectProperties[]; + allOf?: ObjectProperties[]; + if?: ObjectProperties; + then?: ObjectProperties; + else?: ObjectProperties; + } + + export interface ObjectSchema extends BaseSchema { + type: 'object'; + /** + * Describe the properties of the object + */ + properties?: ObjectProperties; + /** + * The required properties of the object + */ + required?: string[]; + /** + * Describe properties that have keys following a given pattern + */ + patternProperties?: ObjectProperties; + /** + * Specifies whether additional properties on the object are allowed, and optionally what schema they should + * adhere to + * @default false + */ + additionalProperties?: Schema | boolean; + } + + export type Schema = + | RefSchema + | StringSchema + | IntegerSchema + | NumberSchema + | NullSchema + | BooleanSchema + | ArraySchema + | TupleSchema + | ObjectSchema + + export interface Options { + /** + * Optionally add an external definition to reference from your schema + */ + schema?: Record + /** + * Configure Ajv, which is used to evaluate conditional schemas and combined (anyOf) schemas + */ + ajv?: AjvOptions + /** + * Optionally configure how the integer will be rounded + * + * @default 'trunc' + */ + rounding?: 'ceil' | 'floor' | 'round' | 'trunc' + /** + * @deprecated + * Enable debug mode. Please use `mode: "debug"` instead + */ + debugMode?: boolean + /** + * Running mode of fast-json-stringify + */ + mode?: 'debug' | 'standalone' + + /** + * Large arrays are defined as arrays containing, by default, `20000` + * elements or more. That value can be adjusted via the option parameter + * `largeArraySize`. + * + * @default 20000 + */ + largeArraySize?: number | string | BigInt + + /** + * Specify the function on how large Arrays should be stringified. + * + * @default 'default' + */ + largeArrayMechanism?: 'default' | 'json-stringify' + } + + export const validLargeArrayMechanisms: string[] + export function restore (value: (doc: TDoc) => string): ReturnType + + export const build: Build + export { build as default } +} + +interface DebugOption extends build.Options { + mode: 'debug' +} + +interface DeprecateDebugOption extends build.Options { + debugMode: true +} + +interface StandaloneOption extends build.Options { + mode: 'standalone' +} + +type StringCoercible = string | Date | RegExp +type IntegerCoercible = number | BigInt + +/** + * Build a stringify function using a schema of the documents that should be stringified + * @param schema The schema used to stringify values + * @param options The options to use (optional) + */ +declare function build (schema: build.AnySchema, options: DebugOption): { code: string, ajv: Ajv } +declare function build (schema: build.AnySchema, options: DeprecateDebugOption): { code: string, ajv: Ajv } +declare function build (schema: build.AnySchema, options: StandaloneOption): string +declare function build (schema: build.AnySchema, options?: build.Options): (doc: TDoc) => any +declare function build (schema: build.StringSchema, options?: build.Options): (doc: TDoc) => string +declare function build (schema: build.IntegerSchema | build.NumberSchema, options?: build.Options): (doc: TDoc) => string +declare function build (schema: build.NullSchema, options?: build.Options): (doc: TDoc) => 'null' +declare function build (schema: build.BooleanSchema, options?: build.Options): (doc: TDoc) => string +declare function build (schema: build.ArraySchema | build.TupleSchema, options?: build.Options): (doc: TDoc) => string +declare function build (schema: build.ObjectSchema, options?: build.Options): (doc: TDoc) => string +declare function build (schema: build.Schema, options?: build.Options): (doc: TDoc) => string + +export = build diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/types/index.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/types/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..50da42014300cc58ab9ebbd8ebb834868f9f9797 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-json-stringify/types/index.test-d.ts @@ -0,0 +1,259 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Test using this disabled, see https://github.com/fastify/fast-json-stringify/pull/683 +import Ajv from 'ajv' +import build, { restore, Schema, validLargeArrayMechanisms } from '..' +import { expectError, expectType } from 'tsd' + +// Number schemas +build({ + type: 'number' +})(25) +build({ + type: 'integer' +})(-5) +build({ + type: 'integer' +})(5n) + +build({ + type: 'number' +}, { rounding: 'ceil' }) +build({ + type: 'number' +}, { rounding: 'floor' }) +build({ + type: 'number' +}, { rounding: 'round' }) +build({ + type: 'number' +}, { rounding: 'trunc' }) +expectError(build({ + type: 'number' +}, { rounding: 'invalid' })) + +// String schema +build({ + type: 'string' +})('foobar') + +// Boolean schema +build({ + type: 'boolean' +})(true) + +// Null schema +build({ + type: 'null' +})(null) + +// Array schemas +build({ + type: 'array', + items: { type: 'number' } +})([25]) +build({ + type: 'array', + items: [{ type: 'string' }, { type: 'integer' }] +})(['hello', 42]) + +// Object schemas +build({ + type: 'object' +})({}) +build({ + type: 'object', + properties: { + foo: { type: 'string' }, + bar: { type: 'integer' } + }, + required: ['foo'], + patternProperties: { + 'baz*': { type: 'null' } + }, + additionalProperties: { + type: 'boolean' + } +})({ foo: 'bar' }) +build({ + type: 'object', + properties: { + foo: { type: 'string' }, + bar: { type: 'integer' } + }, + required: ['foo'], + patternProperties: { + 'baz*': { type: 'null' } + }, + additionalProperties: { + type: 'boolean' + } +}, { rounding: 'floor' })({ foo: 'bar' }) + +// Reference schemas +build({ + title: 'Example Schema', + definitions: { + num: { + type: 'object', + properties: { + int: { + type: 'integer' + } + } + }, + str: { + type: 'string' + }, + def: { + type: 'null' + } + }, + type: 'object', + properties: { + nickname: { + $ref: '#/definitions/str' + } + }, + patternProperties: { + num: { + $ref: '#/definitions/num' + } + }, + additionalProperties: { + $ref: '#/definitions/def' + } +})({ nickname: '', num: { int: 5 }, other: null }) + +// Conditional/Combined schemas +build({ + title: 'Conditional/Combined Schema', + type: 'object', + properties: { + something: { + anyOf: [ + { type: 'string' }, + { type: 'boolean' } + ] + } + }, + if: { + properties: { + something: { type: 'string' } + } + }, + then: { + properties: { + somethingElse: { type: 'number' } + } + }, + else: { + properties: { + somethingElse: { type: 'null' } + } + } +})({ something: 'a string', somethingElse: 42 }) + +// String schema with format + +build({ + type: 'string', + format: 'date-time' +})(new Date()) + +/* +This overload doesn't work yet - +TypeScript chooses the generic for the schema +before it chooses the overload for the options +parameter. +let str: string, ajv: Ajv +str = build({ + type: 'number' +}, { debugMode: true }).code +ajv = build({ + type: 'number' +}, { debugMode: true }).ajv +str = build({ + type: 'number' +}, { mode: 'debug' }).code +ajv = build({ + type: 'number' +}, { mode: 'debug' }).ajv +str = build({ + type: 'number' +}, { mode: 'standalone' }) +*/ + +const debugCompiled = build({ + title: 'default string', + type: 'object', + properties: { + firstName: { + type: 'string' + } + } +}, { mode: 'debug' }) +expectType>(build.restore(debugCompiled)) +expectType>(restore(debugCompiled)) + +expectType(build.validLargeArrayMechanisms) +expectType(validLargeArrayMechanisms) + +/** + * Schema inference + */ + +// With inference +interface InferenceSchema { + id: string; + a?: number; +} + +const stringify3 = build({ + type: 'object', + properties: { a: { type: 'string' } }, +}) +stringify3({ id: '123' }) +stringify3({ a: 123, id: '123' }) +expectError(stringify3({ anotherOne: 'bar' })) +expectError(stringify3({ a: 'bar' })) + +// Without inference +const stringify4 = build({ + type: 'object', + properties: { a: { type: 'string' } }, +}) +stringify4({ id: '123' }) +stringify4({ a: 123, id: '123' }) +stringify4({ anotherOne: 'bar' }) +stringify4({ a: 'bar' }) + +// Without inference - string type +const stringify5 = build({ + type: 'string', +}) +stringify5('foo') +expectError(stringify5({ id: '123' })) + +// Without inference - null type +const stringify6 = build({ + type: 'null', +}) +stringify6(null) +expectError(stringify6('a string')) + +// Without inference - boolean type +const stringify7 = build({ + type: 'boolean', +}) +stringify7(true) +expectError(stringify7('a string')) + +// largeArrayMechanism + +build({}, { largeArrayMechanism: 'json-stringify' }) +build({}, { largeArrayMechanism: 'default' }) +expectError(build({} as Schema, { largeArrayMechanism: 'invalid' })) + +build({}, { largeArraySize: 2000 }) +build({}, { largeArraySize: '2e4' }) +build({}, { largeArraySize: 2n }) +expectError(build({} as Schema, { largeArraySize: ['asdf'] })) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/.stale.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/.stale.yml new file mode 100644 index 0000000000000000000000000000000000000000..2ee12691a4fc015ba9eea94b53f14c037dc8f164 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/.stale.yml @@ -0,0 +1,21 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 15 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - "discussion" + - "feature request" + - "bug" + - "help wanted" + - "plugin suggestion" + - "good first issue" +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..35d66ca7ac75f125b9c9c5b3dee0987fdfca4a45 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/tests_checker.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/tests_checker.yml new file mode 100644 index 0000000000000000000000000000000000000000..769469b2ab26d4ee6ed08df8d5747abff384b43f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/tests_checker.yml @@ -0,0 +1,8 @@ +comment: | + Hello! Thank you for contributing! + It appears that you have changed the code, but the tests that verify your change are missing. Could you please add them? +fileExtensions: + - '.ts' + - '.js' + +testDir: 'test' \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..88717877a8c8b093278386f9ebf99f3f6736a427 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/workflows/ci.yml @@ -0,0 +1,101 @@ +name: CI + +on: + push: + branches: + - main + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +permissions: + contents: read + +jobs: + test-regression-check-node10: + name: Test compatibility with Node.js 10 + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: actions/setup-node@v4 + with: + node-version: '10' + cache: 'npm' + cache-dependency-path: package.json + check-latest: true + + - name: Install + run: | + npm install --ignore-scripts + + - name: Copy project as fast-uri to node_node_modules + run: | + rm -rf ./node_modules/fast-uri/lib && + rm -rf ./node_modules/fast-uri/index.js && + cp -r ./lib ./node_modules/fast-uri/lib && + cp ./index.js ./node_modules/fast-uri/index.js + + - name: Run tests + run: | + npm run test:unit + env: + NODE_OPTIONS: no-network-family-autoselection + + test-browser: + name: Test browser compatibility + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] + browser: ['chromium', 'firefox', 'webkit'] + exclude: + - os: ubuntu-latest + browser: webkit + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + cache-dependency-path: package.json + check-latest: true + + - name: Install dependencies + run: | + npm install --ignore-scripts + + - if: ${{ matrix.os == 'windows-latest' }} + run: npx playwright install winldd + + - name: Run browser tests + run: | + npm run test:browser:${{ matrix.browser }} + + test: + needs: + - test-regression-check-node10 + permissions: + contents: write + pull-requests: write + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 + with: + license-check: true + lint: true + node-versions: '["16", "18", "20", "22", "24"]' diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/workflows/package-manager-ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/workflows/package-manager-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..c38d0600f8e4a1127e7313e449d089d42a065a94 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/.github/workflows/package-manager-ci.yml @@ -0,0 +1,24 @@ +name: package-manager-ci + +on: + push: + branches: + - main + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +permissions: + contents: read + +jobs: + test: + permissions: + contents: read + uses: fastify/workflows/.github/workflows/plugins-ci-package-manager.yml@v5 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/benchmark.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/benchmark.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2e49fc678343e81a563a4f31779a06dd585f8283 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/benchmark.mjs @@ -0,0 +1,159 @@ +import { Bench } from 'tinybench' +import { fastUri } from '../index.js' +import { parse as uriJsParse, serialize as uriJsSerialize, resolve as uriJsResolve, equal as uriJsEqual } from 'uri-js' + +const base = 'uri://a/b/c/d;p?q' + +const domain = 'https://example.com/foo#bar$fiz' +const ipv4 = '//10.10.10.10' +const ipv6 = '//[2001:db8::7]' +const urn = 'urn:foo:a123,456' +const urnuuid = 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + +const urnuuidComponent = { + scheme: 'urn', + nid: 'uuid', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' +} + +const { + parse: fastUriParse, + serialize: fastUriSerialize, + resolve: fastUriResolve, + equal: fastUriEqual, +} = fastUri + +// Initialization as there is a lot to parse at first +// eg: regexes +fastUriParse(domain) +uriJsParse(domain) + +const benchFastUri = new Bench({ name: 'fast-uri benchmark' }) +const benchUriJs = new Bench({ name: 'uri-js benchmark' }) +const benchWHATWG = new Bench({ name: 'WHATWG URL benchmark' }) + +benchFastUri.add('fast-uri: parse domain', function () { + fastUriParse(domain) +}) +benchUriJs.add('urijs: parse domain', function () { + uriJsParse(domain) +}) +benchWHATWG.add('WHATWG URL: parse domain', function () { + // eslint-disable-next-line + new URL(domain) +}) +benchFastUri.add('fast-uri: parse IPv4', function () { + fastUriParse(ipv4) +}) +benchUriJs.add('urijs: parse IPv4', function () { + uriJsParse(ipv4) +}) +benchFastUri.add('fast-uri: parse IPv6', function () { + fastUriParse(ipv6) +}) +benchUriJs.add('urijs: parse IPv6', function () { + uriJsParse(ipv6) +}) +benchFastUri.add('fast-uri: parse URN', function () { + fastUriParse(urn) +}) +benchUriJs.add('urijs: parse URN', function () { + uriJsParse(urn) +}) +benchWHATWG.add('WHATWG URL: parse URN', function () { + // eslint-disable-next-line + new URL(urn) +}) +benchFastUri.add('fast-uri: parse URN uuid', function () { + fastUriParse(urnuuid) +}) +benchUriJs.add('urijs: parse URN uuid', function () { + uriJsParse(urnuuid) +}) +benchFastUri.add('fast-uri: serialize URN uuid', function () { + fastUriSerialize(urnuuidComponent) +}) +benchUriJs.add('uri-js: serialize URN uuid', function () { + uriJsSerialize(urnuuidComponent) +}) +benchFastUri.add('fast-uri: serialize uri', function () { + fastUriSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + }) +}) +benchUriJs.add('urijs: serialize uri', function () { + uriJsSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + }) +}) +benchFastUri.add('fast-uri: serialize long uri with dots', function () { + fastUriSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: './a/./b/c/../.././d/../e/f/.././/', + query: 'query', + fragment: 'fragment' + }) +}) +benchUriJs.add('urijs: serialize long uri with dots', function () { + uriJsSerialize({ + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: './a/./b/c/../.././d/../e/f/.././/', + query: 'query', + fragment: 'fragment' + }) +}) +benchFastUri.add('fast-uri: serialize IPv6', function () { + fastUriSerialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }) +}) +benchUriJs.add('urijs: serialize IPv6', function () { + uriJsSerialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }) +}) +benchFastUri.add('fast-uri: serialize ws', function () { + fastUriSerialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }) +}) +benchUriJs.add('urijs: serialize ws', function () { + uriJsSerialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }) +}) +benchFastUri.add('fast-uri: resolve', function () { + fastUriResolve(base, '../../../g') +}) +benchUriJs.add('urijs: resolve', function () { + uriJsResolve(base, '../../../g') +}) + +benchFastUri.add('fast-uri: equal', function () { + fastUriEqual('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d') +}) +benchUriJs.add('urijs: equal', function () { + uriJsEqual('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d') +}) + +await benchFastUri.run() +console.log(benchFastUri.name) +console.table(benchFastUri.table()) + +await benchUriJs.run() +console.log(benchUriJs.name) +console.table(benchUriJs.table()) + +await benchWHATWG.run() +console.log(benchWHATWG.name) +console.table(benchWHATWG.table()) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/equal.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/equal.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3dea7ec8762a87635475adbea09ee54751285e13 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/equal.mjs @@ -0,0 +1,51 @@ +import { Bench } from 'tinybench' +import { fastUri } from '../index.js' + +const { + equal: fastUriEqual, + parse: fastUriParse, +} = fastUri + +const stringA = 'example://a/b/c/%7Bfoo%7D' +const stringB = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d' + +const componentA = fastUriParse(stringA) +const componentB = fastUriParse(stringB) + +const benchFastUri = new Bench({ name: 'fast-uri equal' }) + +benchFastUri.add('equal string with string', function () { + fastUriEqual(stringA, stringA) +}) + +benchFastUri.add('equal component with component', function () { + fastUriEqual(componentA, componentA) +}) + +benchFastUri.add('equal component with string', function () { + fastUriEqual(componentA, stringA) +}) + +benchFastUri.add('equal string with component', function () { + fastUriEqual(stringA, componentA) +}) + +benchFastUri.add('not equal string with string', function () { + fastUriEqual(stringA, stringB) +}) + +benchFastUri.add('not equal component with component', function () { + fastUriEqual(componentA, componentB) +}) + +benchFastUri.add('not equal component with string', function () { + fastUriEqual(componentA, stringB) +}) + +benchFastUri.add('not equal string with component', function () { + fastUriEqual(stringA, componentB) +}) + +await benchFastUri.run() +console.log(benchFastUri.name) +console.table(benchFastUri.table()) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/non-simple-domain.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/non-simple-domain.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4c041da4cd3f3fd5182ccc9f11c6ec08f42003d6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/non-simple-domain.mjs @@ -0,0 +1,22 @@ +import { Bench } from 'tinybench' +import { nonSimpleDomain } from '../lib/utils.js' + +const benchNonSimpleDomain = new Bench({ name: 'nonSimpleDomain' }) + +const exampleCom = 'example.com' +const exaumlmpleCom = 'exämple.com' +const longDomain = 'abc'.repeat(100) + '.com' + +console.assert(nonSimpleDomain(exampleCom) === false, 'example.com should be a simple domain') +console.assert(nonSimpleDomain(exaumlmpleCom) === true, 'exämple.com should not be a simple domain') +console.assert(nonSimpleDomain(longDomain) === false, `${longDomain} should be a simple domain?`) + +benchNonSimpleDomain.add('nonSimpleDomain', function () { + nonSimpleDomain(exampleCom) + nonSimpleDomain(exaumlmpleCom) + nonSimpleDomain(longDomain) +}) + +await benchNonSimpleDomain.run() +console.log(benchNonSimpleDomain.name) +console.table(benchNonSimpleDomain.table()) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c0816a57919a8dcf1769563de87543218926d29 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/package.json @@ -0,0 +1,17 @@ +{ + "name": "benchmark", + "version": "1.0.0", + "description": "", + "main": "index.js", + "private": true, + "scripts": { + "bench": "node benchmark.mjs" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "tinybench": "^5.0.0", + "uri-js": "^4.4.1" + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs new file mode 100644 index 0000000000000000000000000000000000000000..94875dade99a069e0cbc60267b412a8d53dd2bf9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs @@ -0,0 +1,24 @@ +import { Bench } from 'tinybench' +import { stringArrayToHexStripped } from '../lib/utils.js' + +const benchStringArrayToHexStripped = new Bench({ name: 'stringArrayToHexStripped' }) + +const case1 = ['0', '0', '0', '0'] +const case2 = ['0', '0', '0', '1'] +const case3 = ['0', '0', '1', '0'] +const case4 = ['0', '1', '0', '0'] +const case5 = ['1', '0', '0', '0'] +const case6 = ['1', '0', '0', '1'] + +benchStringArrayToHexStripped.add('stringArrayToHexStripped', function () { + stringArrayToHexStripped(case1) + stringArrayToHexStripped(case2) + stringArrayToHexStripped(case3) + stringArrayToHexStripped(case4) + stringArrayToHexStripped(case5) + stringArrayToHexStripped(case6) +}) + +await benchStringArrayToHexStripped.run() +console.log(benchStringArrayToHexStripped.name) +console.table(benchStringArrayToHexStripped.table()) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/ws-is-secure.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/ws-is-secure.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b579a7662170f8dfefb595f162620d5c5bf31f03 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/benchmark/ws-is-secure.mjs @@ -0,0 +1,65 @@ +import { Bench } from 'tinybench' +import { wsIsSecure } from '../lib/schemes.js' + +const benchWsIsSecure = new Bench({ name: 'wsIsSecure' }) + +const wsComponentAttributeSecureTrue = { + scheme: 'ws', + secure: true, +} + +const wsComponentAttributeSecureFalse = { + scheme: 'ws', + secure: false, +} + +const wssComponent = { + scheme: 'wss', +} + +const wssComponentMixedCase = { + scheme: 'Wss', +} + +const wssComponentUpperCase = { + scheme: 'WSS', +} + +const httpComponent = { + scheme: 'http', +} + +console.assert(wsIsSecure(wsComponentAttributeSecureTrue) === true, 'wsComponentAttributeSecureTrue should be secure') +console.assert(wsIsSecure(wsComponentAttributeSecureFalse) === false, 'wsComponentAttributeSecureFalse should not be secure') +console.assert(wsIsSecure(wssComponent) === true, 'wssComponent should be secure') +console.assert(wsIsSecure(wssComponentMixedCase) === true, 'wssComponentMixedCase should be secure') +console.assert(wsIsSecure(wssComponentUpperCase) === true, 'wssComponentUpperCase should be secure') +console.assert(wsIsSecure(httpComponent) === false, 'httpComponent should not be secure') + +benchWsIsSecure.add(JSON.stringify(wsComponentAttributeSecureFalse), function () { + wsIsSecure(wsComponentAttributeSecureFalse) +}) + +benchWsIsSecure.add(JSON.stringify(wsComponentAttributeSecureTrue), function () { + wsIsSecure(wsComponentAttributeSecureTrue) +}) + +benchWsIsSecure.add(JSON.stringify(wssComponent), function () { + wsIsSecure(wssComponent) +}) + +benchWsIsSecure.add(JSON.stringify(wssComponentMixedCase), function () { + wsIsSecure(wssComponentMixedCase) +}) + +benchWsIsSecure.add(JSON.stringify(wssComponentUpperCase), function () { + wsIsSecure(wssComponentUpperCase) +}) + +benchWsIsSecure.add(JSON.stringify(httpComponent), function () { + wsIsSecure(httpComponent) +}) + +await benchWsIsSecure.run() +console.log(benchWsIsSecure.name) +console.table(benchWsIsSecure.table()) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/lib/schemes.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/lib/schemes.js new file mode 100644 index 0000000000000000000000000000000000000000..554e379911e39ce4df7babc647b588419312649b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/lib/schemes.js @@ -0,0 +1,267 @@ +'use strict' + +const { isUUID } = require('./utils') +const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu + +const supportedSchemeNames = /** @type {const} */ (['http', 'https', 'ws', + 'wss', 'urn', 'urn:uuid']) + +/** @typedef {supportedSchemeNames[number]} SchemeName */ + +/** + * @param {string} name + * @returns {name is SchemeName} + */ +function isValidSchemeName (name) { + return supportedSchemeNames.indexOf(/** @type {*} */ (name)) !== -1 +} + +/** + * @callback SchemeFn + * @param {import('../types/index').URIComponent} component + * @param {import('../types/index').Options} options + * @returns {import('../types/index').URIComponent} + */ + +/** + * @typedef {Object} SchemeHandler + * @property {SchemeName} scheme - The scheme name. + * @property {boolean} [domainHost] - Indicates if the scheme supports domain hosts. + * @property {SchemeFn} parse - Function to parse the URI component for this scheme. + * @property {SchemeFn} serialize - Function to serialize the URI component for this scheme. + * @property {boolean} [skipNormalize] - Indicates if normalization should be skipped for this scheme. + * @property {boolean} [absolutePath] - Indicates if the scheme uses absolute paths. + * @property {boolean} [unicodeSupport] - Indicates if the scheme supports Unicode. + */ + +/** + * @param {import('../types/index').URIComponent} wsComponent + * @returns {boolean} + */ +function wsIsSecure (wsComponent) { + if (wsComponent.secure === true) { + return true + } else if (wsComponent.secure === false) { + return false + } else if (wsComponent.scheme) { + return ( + wsComponent.scheme.length === 3 && + (wsComponent.scheme[0] === 'w' || wsComponent.scheme[0] === 'W') && + (wsComponent.scheme[1] === 's' || wsComponent.scheme[1] === 'S') && + (wsComponent.scheme[2] === 's' || wsComponent.scheme[2] === 'S') + ) + } else { + return false + } +} + +/** @type {SchemeFn} */ +function httpParse (component) { + if (!component.host) { + component.error = component.error || 'HTTP URIs must have a host.' + } + + return component +} + +/** @type {SchemeFn} */ +function httpSerialize (component) { + const secure = String(component.scheme).toLowerCase() === 'https' + + // normalize the default port + if (component.port === (secure ? 443 : 80) || component.port === '') { + component.port = undefined + } + + // normalize the empty path + if (!component.path) { + component.path = '/' + } + + // NOTE: We do not parse query strings for HTTP URIs + // as WWW Form Url Encoded query strings are part of the HTML4+ spec, + // and not the HTTP spec. + + return component +} + +/** @type {SchemeFn} */ +function wsParse (wsComponent) { +// indicate if the secure flag is set + wsComponent.secure = wsIsSecure(wsComponent) + + // construct resouce name + wsComponent.resourceName = (wsComponent.path || '/') + (wsComponent.query ? '?' + wsComponent.query : '') + wsComponent.path = undefined + wsComponent.query = undefined + + return wsComponent +} + +/** @type {SchemeFn} */ +function wsSerialize (wsComponent) { +// normalize the default port + if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === '') { + wsComponent.port = undefined + } + + // ensure scheme matches secure flag + if (typeof wsComponent.secure === 'boolean') { + wsComponent.scheme = (wsComponent.secure ? 'wss' : 'ws') + wsComponent.secure = undefined + } + + // reconstruct path from resource name + if (wsComponent.resourceName) { + const [path, query] = wsComponent.resourceName.split('?') + wsComponent.path = (path && path !== '/' ? path : undefined) + wsComponent.query = query + wsComponent.resourceName = undefined + } + + // forbid fragment component + wsComponent.fragment = undefined + + return wsComponent +} + +/** @type {SchemeFn} */ +function urnParse (urnComponent, options) { + if (!urnComponent.path) { + urnComponent.error = 'URN can not be parsed' + return urnComponent + } + const matches = urnComponent.path.match(URN_REG) + if (matches) { + const scheme = options.scheme || urnComponent.scheme || 'urn' + urnComponent.nid = matches[1].toLowerCase() + urnComponent.nss = matches[2] + const urnScheme = `${scheme}:${options.nid || urnComponent.nid}` + const schemeHandler = getSchemeHandler(urnScheme) + urnComponent.path = undefined + + if (schemeHandler) { + urnComponent = schemeHandler.parse(urnComponent, options) + } + } else { + urnComponent.error = urnComponent.error || 'URN can not be parsed.' + } + + return urnComponent +} + +/** @type {SchemeFn} */ +function urnSerialize (urnComponent, options) { + if (urnComponent.nid === undefined) { + throw new Error('URN without nid cannot be serialized') + } + const scheme = options.scheme || urnComponent.scheme || 'urn' + const nid = urnComponent.nid.toLowerCase() + const urnScheme = `${scheme}:${options.nid || nid}` + const schemeHandler = getSchemeHandler(urnScheme) + + if (schemeHandler) { + urnComponent = schemeHandler.serialize(urnComponent, options) + } + + const uriComponent = urnComponent + const nss = urnComponent.nss + uriComponent.path = `${nid || options.nid}:${nss}` + + options.skipEscape = true + return uriComponent +} + +/** @type {SchemeFn} */ +function urnuuidParse (urnComponent, options) { + const uuidComponent = urnComponent + uuidComponent.uuid = uuidComponent.nss + uuidComponent.nss = undefined + + if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) { + uuidComponent.error = uuidComponent.error || 'UUID is not valid.' + } + + return uuidComponent +} + +/** @type {SchemeFn} */ +function urnuuidSerialize (uuidComponent) { + const urnComponent = uuidComponent + // normalize UUID + urnComponent.nss = (uuidComponent.uuid || '').toLowerCase() + return urnComponent +} + +const http = /** @type {SchemeHandler} */ ({ + scheme: 'http', + domainHost: true, + parse: httpParse, + serialize: httpSerialize +}) + +const https = /** @type {SchemeHandler} */ ({ + scheme: 'https', + domainHost: http.domainHost, + parse: httpParse, + serialize: httpSerialize +}) + +const ws = /** @type {SchemeHandler} */ ({ + scheme: 'ws', + domainHost: true, + parse: wsParse, + serialize: wsSerialize +}) + +const wss = /** @type {SchemeHandler} */ ({ + scheme: 'wss', + domainHost: ws.domainHost, + parse: ws.parse, + serialize: ws.serialize +}) + +const urn = /** @type {SchemeHandler} */ ({ + scheme: 'urn', + parse: urnParse, + serialize: urnSerialize, + skipNormalize: true +}) + +const urnuuid = /** @type {SchemeHandler} */ ({ + scheme: 'urn:uuid', + parse: urnuuidParse, + serialize: urnuuidSerialize, + skipNormalize: true +}) + +const SCHEMES = /** @type {Record} */ ({ + http, + https, + ws, + wss, + urn, + 'urn:uuid': urnuuid +}) + +Object.setPrototypeOf(SCHEMES, null) + +/** + * @param {string|undefined} scheme + * @returns {SchemeHandler|undefined} + */ +function getSchemeHandler (scheme) { + return ( + scheme && ( + SCHEMES[/** @type {SchemeName} */ (scheme)] || + SCHEMES[/** @type {SchemeName} */(scheme.toLowerCase())]) + ) || + undefined +} + +module.exports = { + wsIsSecure, + SCHEMES, + isValidSchemeName, + getSchemeHandler, +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/lib/utils.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/lib/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..1cd927b9e6e37648e150b17c816660d2d573b8ea --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/lib/utils.js @@ -0,0 +1,336 @@ +'use strict' + +/** @type {(value: string) => boolean} */ +const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu) + +/** @type {(value: string) => boolean} */ +const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u) + +/** + * @param {Array} input + * @returns {string} + */ +function stringArrayToHexStripped (input) { + let acc = '' + let code = 0 + let i = 0 + + for (i = 0; i < input.length; i++) { + code = input[i].charCodeAt(0) + if (code === 48) { + continue + } + if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) { + return '' + } + acc += input[i] + break + } + + for (i += 1; i < input.length; i++) { + code = input[i].charCodeAt(0) + if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) { + return '' + } + acc += input[i] + } + return acc +} + +/** + * @typedef {Object} GetIPV6Result + * @property {boolean} error - Indicates if there was an error parsing the IPv6 address. + * @property {string} address - The parsed IPv6 address. + * @property {string} [zone] - The zone identifier, if present. + */ + +/** + * @param {string} value + * @returns {boolean} + */ +const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u) + +/** + * @param {Array} buffer + * @returns {boolean} + */ +function consumeIsZone (buffer) { + buffer.length = 0 + return true +} + +/** + * @param {Array} buffer + * @param {Array} address + * @param {GetIPV6Result} output + * @returns {boolean} + */ +function consumeHextets (buffer, address, output) { + if (buffer.length) { + const hex = stringArrayToHexStripped(buffer) + if (hex !== '') { + address.push(hex) + } else { + output.error = true + return false + } + buffer.length = 0 + } + return true +} + +/** + * @param {string} input + * @returns {GetIPV6Result} + */ +function getIPV6 (input) { + let tokenCount = 0 + const output = { error: false, address: '', zone: '' } + /** @type {Array} */ + const address = [] + /** @type {Array} */ + const buffer = [] + let endipv6Encountered = false + let endIpv6 = false + + let consume = consumeHextets + + for (let i = 0; i < input.length; i++) { + const cursor = input[i] + if (cursor === '[' || cursor === ']') { continue } + if (cursor === ':') { + if (endipv6Encountered === true) { + endIpv6 = true + } + if (!consume(buffer, address, output)) { break } + if (++tokenCount > 7) { + // not valid + output.error = true + break + } + if (i > 0 && input[i - 1] === ':') { + endipv6Encountered = true + } + address.push(':') + continue + } else if (cursor === '%') { + if (!consume(buffer, address, output)) { break } + // switch to zone detection + consume = consumeIsZone + } else { + buffer.push(cursor) + continue + } + } + if (buffer.length) { + if (consume === consumeIsZone) { + output.zone = buffer.join('') + } else if (endIpv6) { + address.push(buffer.join('')) + } else { + address.push(stringArrayToHexStripped(buffer)) + } + } + output.address = address.join('') + return output +} + +/** + * @typedef {Object} NormalizeIPv6Result + * @property {string} host - The normalized host. + * @property {string} [escapedHost] - The escaped host. + * @property {boolean} isIPV6 - Indicates if the host is an IPv6 address. + */ + +/** + * @param {string} host + * @returns {NormalizeIPv6Result} + */ +function normalizeIPv6 (host) { + if (findToken(host, ':') < 2) { return { host, isIPV6: false } } + const ipv6 = getIPV6(host) + + if (!ipv6.error) { + let newHost = ipv6.address + let escapedHost = ipv6.address + if (ipv6.zone) { + newHost += '%' + ipv6.zone + escapedHost += '%25' + ipv6.zone + } + return { host: newHost, isIPV6: true, escapedHost } + } else { + return { host, isIPV6: false } + } +} + +/** + * @param {string} str + * @param {string} token + * @returns {number} + */ +function findToken (str, token) { + let ind = 0 + for (let i = 0; i < str.length; i++) { + if (str[i] === token) ind++ + } + return ind +} + +/** + * @param {string} path + * @returns {string} + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4 + */ +function removeDotSegments (path) { + let input = path + const output = [] + let nextSlash = -1 + let len = 0 + + // eslint-disable-next-line no-cond-assign + while (len = input.length) { + if (len === 1) { + if (input === '.') { + break + } else if (input === '/') { + output.push('/') + break + } else { + output.push(input) + break + } + } else if (len === 2) { + if (input[0] === '.') { + if (input[1] === '.') { + break + } else if (input[1] === '/') { + input = input.slice(2) + continue + } + } else if (input[0] === '/') { + if (input[1] === '.' || input[1] === '/') { + output.push('/') + break + } + } + } else if (len === 3) { + if (input === '/..') { + if (output.length !== 0) { + output.pop() + } + output.push('/') + break + } + } + if (input[0] === '.') { + if (input[1] === '.') { + if (input[2] === '/') { + input = input.slice(3) + continue + } + } else if (input[1] === '/') { + input = input.slice(2) + continue + } + } else if (input[0] === '/') { + if (input[1] === '.') { + if (input[2] === '/') { + input = input.slice(2) + continue + } else if (input[2] === '.') { + if (input[3] === '/') { + input = input.slice(3) + if (output.length !== 0) { + output.pop() + } + continue + } + } + } + } + + // Rule 2E: Move normal path segment to output + if ((nextSlash = input.indexOf('/', 1)) === -1) { + output.push(input) + break + } else { + output.push(input.slice(0, nextSlash)) + input = input.slice(nextSlash) + } + } + + return output.join('') +} + +/** + * @param {import('../types/index').URIComponent} component + * @param {boolean} esc + * @returns {import('../types/index').URIComponent} + */ +function normalizeComponentEncoding (component, esc) { + const func = esc !== true ? escape : unescape + if (component.scheme !== undefined) { + component.scheme = func(component.scheme) + } + if (component.userinfo !== undefined) { + component.userinfo = func(component.userinfo) + } + if (component.host !== undefined) { + component.host = func(component.host) + } + if (component.path !== undefined) { + component.path = func(component.path) + } + if (component.query !== undefined) { + component.query = func(component.query) + } + if (component.fragment !== undefined) { + component.fragment = func(component.fragment) + } + return component +} + +/** + * @param {import('../types/index').URIComponent} component + * @returns {string|undefined} + */ +function recomposeAuthority (component) { + const uriTokens = [] + + if (component.userinfo !== undefined) { + uriTokens.push(component.userinfo) + uriTokens.push('@') + } + + if (component.host !== undefined) { + let host = unescape(component.host) + if (!isIPv4(host)) { + const ipV6res = normalizeIPv6(host) + if (ipV6res.isIPV6 === true) { + host = `[${ipV6res.escapedHost}]` + } else { + host = component.host + } + } + uriTokens.push(host) + } + + if (typeof component.port === 'number' || typeof component.port === 'string') { + uriTokens.push(':') + uriTokens.push(String(component.port)) + } + + return uriTokens.length ? uriTokens.join('') : undefined +}; + +module.exports = { + nonSimpleDomain, + recomposeAuthority, + normalizeComponentEncoding, + removeDotSegments, + isIPv4, + isUUID, + normalizeIPv6, + stringArrayToHexStripped +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/ajv.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/ajv.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e6a44fe8bba623bf841a7c5193a5f0e99f71f059 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/ajv.test.js @@ -0,0 +1,43 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +const AJV = require('ajv') + +const ajv = new AJV({ + uriResolver: fastURI // comment this line to see it works with uri-js +}) + +test('ajv', t => { + t.plan(1) + const schema = { + $ref: '#/definitions/Record%3Cstring%2CPerson%3E', + definitions: { + Person: { + type: 'object', + properties: { + firstName: { + type: 'string' + } + } + }, + 'Record': { + type: 'object', + additionalProperties: { + $ref: '#/definitions/Person' + } + } + } + } + + const data = { + joe: { + firstName: 'Joe' + } + + } + + const validate = ajv.compile(schema) + t.ok(validate(data)) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/equal.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/equal.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e5e9dfcfb7465da6b34dd08813547235b26c35cd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/equal.test.js @@ -0,0 +1,108 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +const fn = fastURI.equal +const runTest = (t, suite) => { + suite.forEach(s => { + const operator = s.result ? '==' : '!=' + t.equal(fn(s.pair[0], s.pair[1]), s.result, `${s.pair[0]} ${operator} ${s.pair[1]}`) + t.equal(fn(s.pair[1], s.pair[0]), s.result, `${s.pair[1]} ${operator} ${s.pair[0]}`) + }) +} + +test('URI Equals', (t) => { + const suite = [ + { pair: ['example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'], result: true }, // test from RFC 3986 + { pair: ['http://example.org/~user', 'http://example.org/%7euser'], result: true } // test from RFC 3987 + ] + runTest(t, suite) + t.end() +}) + +// test('IRI Equals', (t) => { +// // example from RFC 3987 +// t.equal(URI.equal('example://a/b/c/%7Bfoo%7D/ros\xE9', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9', IRI_OPTION), true) +// t.end() +// }) + +test('HTTP Equals', (t) => { + const suite = [ + // test from RFC 2616 + { pair: ['http://abc.com:80/~smith/home.html', 'http://abc.com/~smith/home.html'], result: true }, + { pair: [{ scheme: 'http', host: 'abc.com', port: 80, path: '/~smith/home.html' }, 'http://abc.com/~smith/home.html'], result: true }, + { pair: ['http://ABC.com/%7Esmith/home.html', 'http://abc.com/~smith/home.html'], result: true }, + { pair: ['http://ABC.com:/%7esmith/home.html', 'http://abc.com/~smith/home.html'], result: true }, + { pair: ['HTTP://ABC.COM', 'http://abc.com/'], result: true }, + // test from RFC 3986 + { pair: ['http://example.com:/', 'http://example.com:80/'], result: true } + ] + runTest(t, suite) + t.end() +}) + +test('HTTPS Equals', (t) => { + const suite = [ + { pair: ['https://example.com', 'https://example.com:443/'], result: true }, + { pair: ['https://example.com:/', 'https://example.com:443/'], result: true } + ] + runTest(t, suite) + t.end() +}) + +test('URN Equals', (t) => { + const suite = [ + // test from RFC 2141 + { pair: ['urn:foo:a123,456', 'urn:foo:a123,456'], result: true }, + { pair: ['urn:foo:a123,456', 'URN:foo:a123,456'], result: true }, + { pair: ['urn:foo:a123,456', 'urn:FOO:a123,456'], result: true } + ] + + // Disabling for now as the whole equal logic might need + // to be refactored + // t.equal(URI.equal('urn:foo:a123,456', 'urn:foo:A123,456'), false) + // t.equal(URI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true) + + runTest(t, suite) + + t.throws(() => { + fn('urn:', 'urn:FOO:a123,456') + }, 'URN without nid cannot be serialized') + + t.end() +}) + +test('UUID Equals', (t) => { + const suite = [ + { pair: ['URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6', 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'], result: true } + ] + + runTest(t, suite) + t.end() +}) + +// test('Mailto Equals', (t) => { +// // tests from RFC 6068 +// t.equal(URI.equal('mailto:addr1@an.example,addr2@an.example', 'mailto:?to=addr1@an.example,addr2@an.example'), true) +// t.equal(URI.equal('mailto:?to=addr1@an.example,addr2@an.example', 'mailto:addr1@an.example?to=addr2@an.example'), true) +// t.end() +// }) + +test('WS Equal', (t) => { + const suite = [ + { pair: ['WS://ABC.COM:80/chat#one', 'ws://abc.com/chat'], result: true } + ] + + runTest(t, suite) + t.end() +}) + +test('WSS Equal', (t) => { + const suite = [ + { pair: ['WSS://ABC.COM:443/chat#one', 'wss://abc.com/chat'], result: true } + ] + + runTest(t, suite) + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/fixtures/uri-js-parse.json b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/fixtures/uri-js-parse.json new file mode 100644 index 0000000000000000000000000000000000000000..6b848134ea8e6254f003f7c79eb0a926e0c87752 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/fixtures/uri-js-parse.json @@ -0,0 +1,501 @@ +[ + [ + "//www.g.com/error\n/bleh/bleh", + { + "host": "www.g.com", + "path": "/error%0A/bleh/bleh", + "reference": "relative" + } + ], + [ + "https://fastify.org", + { + "scheme": "https", + "host": "fastify.org", + "path": "", + "reference": "absolute" + } + ], + [ + "/definitions/Record%3Cstring%2CPerson%3E", + { + "path": "/definitions/Record%3Cstring%2CPerson%3E", + "reference": "relative" + } + ], + [ + "//10.10.10.10", + { + "host": "10.10.10.10", + "path": "", + "reference": "relative" + } + ], + [ + "//10.10.000.10", + { + "host": "10.10.0.10", + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:db8::7%en0]", + { + "host": "2001:db8::7%en0", + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:dbZ::1]:80", + { + "host": "[2001:dbz::1]", + "port": 80, + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:db8::1]:80", + { + "host": "2001:db8::1", + "port": 80, + "path": "", + "reference": "relative" + } + ], + [ + "//[2001:db8::001]:80", + { + "host": "2001:db8::1", + "port": 80, + "path": "", + "reference": "relative" + } + ], + [ + "uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body", + { + "scheme": "uri", + "userinfo": "user:pass", + "host": "example.com", + "port": 123, + "path": "/one/two.three", + "query": "q1=a1&q2=a2", + "fragment": "body", + "reference": "uri" + } + ], + [ + "http://user:pass@example.com:123/one/space in.url?q1=a1&q2=a2#body", + { + "scheme": "http", + "userinfo": "user:pass", + "host": "example.com", + "port": 123, + "path": "/one/space%20in.url", + "query": "q1=a1&q2=a2", + "fragment": "body", + "reference": "uri" + } + ], + [ + "http://User:Pass@example.com:123/one/space in.url?q1=a1&q2=a2#body", + { + "scheme": "http", + "userinfo": "User:Pass", + "host": "example.com", + "port": 123, + "path": "/one/space%20in.url", + "query": "q1=a1&q2=a2", + "fragment": "body", + "reference": "uri" + } + ], + [ + "http://A%3AB@example.com:123/one/space", + { + "scheme": "http", + "userinfo": "A%3AB", + "host": "example.com", + "port": 123, + "path": "/one/space", + "reference": "absolute" + } + ], + [ + "//[::ffff:129.144.52.38]", + { + "host": "::ffff:129.144.52.38", + "path": "", + "reference": "relative" + } + ], + [ + "uri://10.10.10.10.example.com/en/process", + { + "scheme": "uri", + "host": "10.10.10.10.example.com", + "path": "/en/process", + "reference": "absolute" + } + ], + [ + "//[2606:2800:220:1:248:1893:25c8:1946]/test", + { + "host": "2606:2800:220:1:248:1893:25c8:1946", + "path": "/test", + "reference": "relative" + } + ], + [ + "ws://example.com/chat", + { + "scheme": "ws", + "host": "example.com", + "reference": "absolute", + "secure": false, + "resourceName": "/chat" + } + ], + [ + "ws://example.com/foo?bar=baz", + { + "scheme": "ws", + "host": "example.com", + "reference": "absolute", + "secure": false, + "resourceName": "/foo?bar=baz" + } + ], + [ + "wss://example.com/?bar=baz", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/?bar=baz" + } + ], + [ + "wss://example.com/chat", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/chat" + } + ], + [ + "wss://example.com/foo?bar=baz", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/foo?bar=baz" + } + ], + [ + "wss://example.com/?bar=baz", + { + "scheme": "wss", + "host": "example.com", + "reference": "absolute", + "secure": true, + "resourceName": "/?bar=baz" + } + ], + [ + "urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6", + { + "scheme": "urn", + "reference": "absolute", + "nid": "uuid", + "uuid": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6" + } + ], + [ + "urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6", + { + "scheme": "urn", + "reference": "absolute", + "nid": "uuid", + "uuid": "notauuid-7dec-11d0-a765-00a0c91e6bf6", + "error": "UUID is not valid." + } + ], + [ + "urn:example:%D0%B0123,z456", + { + "scheme": "urn", + "reference": "absolute", + "nid": "example", + "nss": "%D0%B0123,z456" + } + ], + [ + "//[2606:2800:220:1:248:1893:25c8:1946:43209]", + { + "host": "[2606:2800:220:1:248:1893:25c8:1946:43209]", + "path": "", + "reference": "relative" + } + ], + [ + "http://foo.bar", + { + "scheme": "http", + "host": "foo.bar", + "path": "", + "reference": "absolute" + } + ], + [ + "http://", + { + "scheme": "http", + "host": "", + "path": "", + "reference": "absolute", + "error": "HTTP URIs must have a host." + } + ], + [ + "#/$defs/stringMap", + { + "path": "", + "fragment": "/$defs/stringMap", + "reference": "same-document" + } + ], + [ + "#/$defs/string%20Map", + { + "path": "", + "fragment": "/$defs/string%20Map", + "reference": "same-document" + } + ], + [ + "#/$defs/string Map", + { + "path": "", + "fragment": "/$defs/string%20Map", + "reference": "same-document" + } + ], + [ + "//?json=%7B%22foo%22%3A%22bar%22%7D", + { + "host": "", + "path": "", + "query": "json=%7B%22foo%22%3A%22bar%22%7D", + "reference": "relative" + } + ], + [ + "mailto:chris@example.com", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "chris@example.com" + ] + } + ], + [ + "mailto:infobot@example.com?subject=current-issue", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "infobot@example.com" + ], + "subject": "current-issue" + } + ], + [ + "mailto:infobot@example.com?body=send%20current-issue", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "infobot@example.com" + ], + "body": "send current-issue" + } + ], + [ + "mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "infobot@example.com" + ], + "body": "send current-issue\r\nsend index" + } + ], + [ + "mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "list@example.org" + ], + "headers": { + "In-Reply-To": "<3469A91.D10AF4C@example.com>" + } + } + ], + [ + "mailto:majordomo@example.com?body=subscribe%20bamboo-l", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "majordomo@example.com" + ], + "body": "subscribe bamboo-l" + } + ], + [ + "mailto:joe@example.com?cc=bob@example.com&body=hello", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "joe@example.com" + ], + "body": "hello", + "headers": { + "cc": "bob@example.com" + } + } + ], + [ + "mailto:gorby%25kremvax@example.com", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "gorby%kremvax@example.com" + ] + } + ], + [ + "mailto:unlikely%3Faddress@example.com?blat=foop", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "unlikely?address@example.com" + ], + "headers": { + "blat": "foop" + } + } + ], + [ + "mailto:Mike%26family@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "Mike&family@example.org" + ] + } + ], + [ + "mailto:%22not%40me%22@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "\"not@me\"@example.org" + ] + } + ], + [ + "mailto:%22oh%5C%5Cno%22@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "\"oh\\\\no\"@example.org" + ] + } + ], + [ + "mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "\"\\\\\\\"it's\\ ugly\\\\\\\"\"@example.org" + ] + } + ], + [ + "mailto:user@example.org?subject=caf%C3%A9", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "café" + } + ], + [ + "mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "=?utf-8?Q?caf=C3=A9?=" + } + ], + [ + "mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "=?iso-8859-1?Q?caf=E9?=" + } + ], + [ + "mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@example.org" + ], + "subject": "café", + "body": "café" + } + ], + [ + "mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO", + { + "scheme": "mailto", + "reference": "absolute", + "to": [ + "user@xn--99zt52a.example.org" + ], + "subject": "Test", + "body": "NATTO" + } + ] +] \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/fixtures/uri-js-serialize.json b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/fixtures/uri-js-serialize.json new file mode 100644 index 0000000000000000000000000000000000000000..87d7146797c473847daeb54a4921944d192e9478 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/fixtures/uri-js-serialize.json @@ -0,0 +1,120 @@ +[ + [ + { + "host": "10.10.10.10.example.com" + }, + "//10.10.10.10.example.com" + ], + [ + { + "host": "2001:db8::7" + }, + "//[2001:db8::7]" + ], + [ + { + "host": "::ffff:129.144.52.38" + }, + "//[::ffff:129.144.52.38]" + ], + [ + { + "host": "2606:2800:220:1:248:1893:25c8:1946" + }, + "//[2606:2800:220:1:248:1893:25c8:1946]" + ], + [ + { + "host": "10.10.10.10.example.com" + }, + "//10.10.10.10.example.com" + ], + [ + { + "host": "10.10.10.10" + }, + "//10.10.10.10" + ], + [ + { + "path": "?query" + }, + "%3Fquery" + ], + [ + { + "path": "foo:bar" + }, + "foo%3Abar" + ], + [ + { + "path": "//path" + }, + "/%2Fpath" + ], + [ + { + "scheme": "uri", + "host": "example.com", + "port": "9000" + }, + "uri://example.com:9000" + ], + [ + { + "scheme": "uri", + "userinfo": "foo:bar", + "host": "example.com", + "port": 1, + "path": "path", + "query": "query", + "fragment": "fragment" + }, + "uri://foo:bar@example.com:1/path?query#fragment" + ], + [ + { + "scheme": "", + "userinfo": "", + "host": "", + "port": 0, + "path": "", + "query": "", + "fragment": "" + }, + "//@:0?#" + ], + [ + {}, + "" + ], + [ + { + "host": "fe80::a%en1" + }, + "//[fe80::a%25en1]" + ], + [ + { + "host": "fe80::a%25en1" + }, + "//[fe80::a%25en1]" + ], + [ + { + "scheme": "wss", + "host": "example.com", + "path": "/foo", + "query": "bar" + }, + "wss://example.com/foo?bar" + ], + [ + { + "scheme": "scheme", + "path": "with:colon" + }, + "scheme:with:colon" + ] +] \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/parse.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/parse.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6a2be03b4496b96750fcaeb4af8a6d671a8a872f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/parse.test.js @@ -0,0 +1,318 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('URI parse', (t) => { + let components + + // scheme + components = fastURI.parse('uri:') + t.equal(components.error, undefined, 'scheme errors') + t.equal(components.scheme, 'uri', 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // userinfo + components = fastURI.parse('//@') + t.equal(components.error, undefined, 'userinfo errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, "@", "authority"); + t.equal(components.userinfo, '', 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // host + components = fastURI.parse('//') + t.equal(components.error, undefined, 'host errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, "", "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // port + components = fastURI.parse('//:') + t.equal(components.error, undefined, 'port errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, ":", "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, '', 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // path + components = fastURI.parse('') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // query + components = fastURI.parse('?') + t.equal(components.error, undefined, 'query errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, '', 'query') + t.equal(components.fragment, undefined, 'fragment') + + // fragment + components = fastURI.parse('#') + t.equal(components.error, undefined, 'fragment errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '', 'fragment') + + // fragment with character tabulation + components = fastURI.parse('#\t') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%09', 'fragment') + + // fragment with line feed + components = fastURI.parse('#\n') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0A', 'fragment') + + // fragment with line tabulation + components = fastURI.parse('#\v') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0B', 'fragment') + + // fragment with form feed + components = fastURI.parse('#\f') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0C', 'fragment') + + // fragment with carriage return + components = fastURI.parse('#\r') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0D', 'fragment') + + // all + components = fastURI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body') + t.equal(components.error, undefined, 'all errors') + t.equal(components.scheme, 'uri', 'scheme') + // t.equal(components.authority, "user:pass@example.com:123", "authority"); + t.equal(components.userinfo, 'user:pass', 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, 123, 'port') + t.equal(components.path, '/one/two.three', 'path') + t.equal(components.query, 'q1=a1&q2=a2', 'query') + t.equal(components.fragment, 'body', 'fragment') + + // IPv4address + components = fastURI.parse('//10.10.10.10') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv4address with unformated 0 stay as-is + components = fastURI.parse('//10.10.000.10') // not valid as per https://datatracker.ietf.org/doc/html/rfc5954#section-4.1 + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.000.10', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + components = fastURI.parse('//01.01.01.01') // not valid in URIs: https://datatracker.ietf.org/doc/html/rfc3986#section-7.4 + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '01.01.01.01', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address + components = fastURI.parse('//[2001:db8::7]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // invalid IPv6 + components = fastURI.parse('//[2001:dbZ::7]') + t.equal(components.host, '[2001:dbz::7]') + + // mixed IPv4address & IPv6address + components = fastURI.parse('//[::ffff:129.144.52.38]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '::ffff:129.144.52.38', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + components = fastURI.parse('uri://10.10.10.10.example.com/en/process') + t.equal(components.error, undefined, 'mixed errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10.example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/en/process', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16) + components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/test', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from RFC 5952 + components = fastURI.parse('//[2001:db8::1]:80') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::1', 'host') + t.equal(components.port, 80, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with zone identifier, RFC 6874 + components = fastURI.parse('//[fe80::a%25en1]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'fe80::a%en1', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22) + components = fastURI.parse('//[2001:db8::7%en0]') + t.equal(components.error, undefined, 'IPv6address interface errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7%en0', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // UUID V1 + components = fastURI.parse('urn:uuid:b571b0bc-4713-11ec-81d3-0242ac130003') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'uuid', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'b571b0bc-4713-11ec-81d3-0242ac130003', 'uuid') + + // UUID v4 + components = fastURI.parse('urn:uuid:97a32222-89b7-420e-8507-4360723e2c2a') + t.equal(components.uuid, '97a32222-89b7-420e-8507-4360723e2c2a', 'uuid') + + components = fastURI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + t.notSame(components.error, undefined, 'errors') + + components = fastURI.parse('urn:foo:a123,456') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + // t.equal(components.authority, undefined, "authority"); + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, 'a123,456', 'nss') + + components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946:43209]') + t.equal(components.host, '[2606:2800:220:1:248:1893:25c8:1946:43209]') + + components = fastURI.parse('urn:foo:|\\24fpl') + t.equal(components.error, 'URN can not be parsed.') + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/resolve.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/resolve.test.js new file mode 100644 index 0000000000000000000000000000000000000000..200754c440cd6bd38a3d25de353e3e0a7b60dec2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/resolve.test.js @@ -0,0 +1,78 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('URI Resolving', (t) => { + // normal examples from RFC 3986 + const base = 'uri://a/b/c/d;p?q' + t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h') + t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h') + t.equal(fastURI.resolve(base, 'g'), 'uri://a/b/c/g', 'g') + t.equal(fastURI.resolve(base, './g'), 'uri://a/b/c/g', './g') + t.equal(fastURI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/') + t.equal(fastURI.resolve(base, '/g'), 'uri://a/g', '/g') + t.equal(fastURI.resolve(base, '//g'), 'uri://g', '//g') + t.equal(fastURI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y') + t.equal(fastURI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y') + t.equal(fastURI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s') + t.equal(fastURI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s') + t.equal(fastURI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s') + t.equal(fastURI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x') + t.equal(fastURI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x') + t.equal(fastURI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s') + t.equal(fastURI.resolve(base, ''), 'uri://a/b/c/d;p?q', '') + t.equal(fastURI.resolve(base, '.'), 'uri://a/b/c/', '.') + t.equal(fastURI.resolve(base, './'), 'uri://a/b/c/', './') + t.equal(fastURI.resolve(base, '..'), 'uri://a/b/', '..') + t.equal(fastURI.resolve(base, '../'), 'uri://a/b/', '../') + t.equal(fastURI.resolve(base, '../g'), 'uri://a/b/g', '../g') + t.equal(fastURI.resolve(base, '../..'), 'uri://a/', '../..') + t.equal(fastURI.resolve(base, '../../'), 'uri://a/', '../../') + t.equal(fastURI.resolve(base, '../../g'), 'uri://a/g', '../../g') + + // abnormal examples from RFC 3986 + t.equal(fastURI.resolve(base, '../../../g'), 'uri://a/g', '../../../g') + t.equal(fastURI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g') + + t.equal(fastURI.resolve(base, '/./g'), 'uri://a/g', '/./g') + t.equal(fastURI.resolve(base, '/../g'), 'uri://a/g', '/../g') + t.equal(fastURI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.') + t.equal(fastURI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g') + t.equal(fastURI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..') + t.equal(fastURI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g') + + t.equal(fastURI.resolve(base, './../g'), 'uri://a/b/g', './../g') + t.equal(fastURI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.') + t.equal(fastURI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h') + t.equal(fastURI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h') + t.equal(fastURI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y') + t.equal(fastURI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y') + + t.equal(fastURI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x') + t.equal(fastURI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x') + t.equal(fastURI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x') + t.equal(fastURI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x') + + t.equal(fastURI.resolve(base, 'uri:g'), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', {}), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: undefined }), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: false }), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g') + + // examples by PAEz + // example was provided to avoid infinite loop within regex + // this is not the case anymore + // t.equal(URI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf') + // t.equal(URI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh') + t.end() +}) + +test('URN Resolving', (t) => { + // example from epoberezkin + t.equal(fastURI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.equal(fastURI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop') + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/rfc-3986.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/rfc-3986.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0a5adbeccaea3604a45e8ffdd30839bcf3935ea1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/rfc-3986.test.js @@ -0,0 +1,90 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('RFC 3986', (t) => { + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + // A. If the input buffer begins with a prefix of "../" or "./", + // then remove that prefix from the input buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + // B. if the input buffer begins with a prefix of "/./" or "/.", + // where "." is a complete path segment, then replace that + // prefix with "/" in the input buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.././foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + + // C. if the input buffer begins with a prefix of "/../" or "/..", + // where ".." is a complete path segment, then replace that + // prefix with "/" in the input buffer and remove the last + // segment and its preceding "/" (if any) from the output + // buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../foo', secure: true }), + 'http://example.com/foo', 'http://example.com/foo') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/..', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/bar/..', secure: true }), + 'http://example.com/foo/', 'http://example.com/foo/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/../bar/..', secure: true }), + 'http://example.com/', 'http://example.com/') + + // D. if the input buffer consists only of "." or "..", then remove + // that from the input buffer; otherwise, + + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.', secure: true }), + 'http://example.com/', 'http://example.com/') + t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '..', secure: true }), + 'http://example.com/', 'http://example.com/') + + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/serialize.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/serialize.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0eaa346aba23a2e3855a2330aa13c6c09317c743 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/serialize.test.js @@ -0,0 +1,151 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +test('URI Serialize', (t) => { + let components = { + scheme: undefined, + userinfo: undefined, + host: undefined, + port: undefined, + path: undefined, + query: undefined, + fragment: undefined + } + t.equal(fastURI.serialize(components), '', 'Undefined Components') + + components = { + scheme: '', + userinfo: '', + host: '', + port: 0, + path: '', + query: '', + fragment: '' + } + t.equal(fastURI.serialize(components), '//@:0?#', 'Empty Components') + + components = { + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + } + t.equal(fastURI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components') + + components = { + scheme: 'uri', + host: 'example.com', + port: '9000' + } + t.equal(fastURI.serialize(components), 'uri://example.com:9000', 'String port') + + t.equal(fastURI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path') + t.equal(fastURI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path') + t.equal(fastURI.serialize({ path: '?query' }), '%3Fquery', 'Query path') + + t.equal(fastURI.serialize({ host: '10.10.10.10' }), '//10.10.10.10', 'IPv4address') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + t.equal(fastURI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name') + + // IPv6address + t.equal(fastURI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host') + t.equal(fastURI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host') + t.equal(fastURI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host') + + // IPv6address with zone identifier, RFC 6874 + t.equal(fastURI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host') + t.equal(fastURI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host') + + t.end() +}) + +test('WS serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'ws' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + t.end() +}) + +test('WSS serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'wss' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'wss', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + + t.end() +}) + +test('URN serialize', (t) => { + // example from RFC 2141 + const components = { + scheme: 'urn', + nid: 'foo', + nss: 'a123,456' + } + t.equal(fastURI.serialize(components), 'urn:foo:a123,456') + // example from RFC 4122 + let uuidcomponents = { + scheme: 'urn', + nid: 'uuid', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(uuidcomponents), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + + uuidcomponents = { + scheme: 'urn', + nid: 'uuid', + uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(uuidcomponents), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + + uuidcomponents = { + scheme: 'urn', + nid: undefined, + uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6' + } + t.throws(() => { fastURI.serialize(uuidcomponents) }, 'URN without nid cannot be serialized') + + t.end() +}) +test('URN NID Override', (t) => { + let components = fastURI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' }) + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.path, undefined, 'path') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid') + + components = { + scheme: 'urn', + nid: 'foo', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/uri-js-compatibility.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/uri-js-compatibility.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a75869b18c8af470de4999dfb533f2305d44b450 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/uri-js-compatibility.test.js @@ -0,0 +1,33 @@ +'use strict' + +const test = require('tape') +const fastURI = require('../') + +const uriJsParseFixtures = require('./fixtures/uri-js-parse.json') +const uriJsSerializeFixtures = require('./fixtures/uri-js-serialize.json') + +test('uri-js compatibility Parse', (t) => { + uriJsParseFixtures.forEach(( + [value, expected] + ) => { + if (value === '//10.10.000.10') { + return t.skip('Skipping //10.10.000.10 as it is not a valid URI per URI spec: https://datatracker.ietf.org/doc/html/rfc5954#section-4.1') + } + if (value.slice(0, 6) === 'mailto') { + return t.skip('Skipping mailto schema test as it is not supported by fastifyURI') + } + t.same(JSON.parse(JSON.stringify(fastURI.parse(value))), expected, 'Compatibility parse: ' + value) + }) + t.end() +}) + +test('uri-js compatibility serialize', (t) => { + uriJsSerializeFixtures.forEach(([value, expected]) => { + t.same( + fastURI.serialize(value), + expected, + 'Compatibility serialize: ' + JSON.stringify(value) + ) + }) + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/uri-js.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/uri-js.test.js new file mode 100644 index 0000000000000000000000000000000000000000..109df95ea847cb4fc5e439c0f385f978b8e1072a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/uri-js.test.js @@ -0,0 +1,912 @@ +'use strict' + +const test = require('tape') +const fastURI = require('..') + +/** + * URI.js + * + * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/normalizing/resolving/serializing library for JavaScript. + * @author Gary Court + * @see http://github.com/garycourt/uri-js + */ + +/** + * Copyright 2011 Gary Court. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of Gary Court. + */ + +test('Acquire URI', (t) => { + t.ok(fastURI) + t.end() +}) + +test('URI Parsing', (t) => { + let components + + // scheme + components = fastURI.parse('uri:') + t.equal(components.error, undefined, 'scheme errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // userinfo + components = fastURI.parse('//@') + t.equal(components.error, undefined, 'userinfo errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, '', 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // host + components = fastURI.parse('//') + t.equal(components.error, undefined, 'host errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // port + components = fastURI.parse('//:') + t.equal(components.error, undefined, 'port errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '', 'host') + t.equal(components.port, '', 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // path + components = fastURI.parse('') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // query + components = fastURI.parse('?') + t.equal(components.error, undefined, 'query errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, '', 'query') + t.equal(components.fragment, undefined, 'fragment') + + // fragment + components = fastURI.parse('#') + t.equal(components.error, undefined, 'fragment errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '', 'fragment') + + // fragment with character tabulation + components = fastURI.parse('#\t') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%09', 'fragment') + + // fragment with line feed + components = fastURI.parse('#\n') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0A', 'fragment') + + // fragment with line tabulation + components = fastURI.parse('#\v') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0B', 'fragment') + + // fragment with form feed + components = fastURI.parse('#\f') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0C', 'fragment') + + // fragment with carriage return + components = fastURI.parse('#\r') + t.equal(components.error, undefined, 'path errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, '%0D', 'fragment') + + // all + components = fastURI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body') + t.equal(components.error, undefined, 'all errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, 'user:pass', 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, 123, 'port') + t.equal(components.path, '/one/two.three', 'path') + t.equal(components.query, 'q1=a1&q2=a2', 'query') + t.equal(components.fragment, 'body', 'fragment') + + // IPv4address + components = fastURI.parse('//10.10.10.10') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address + components = fastURI.parse('//[2001:db8::7]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // mixed IPv4address & IPv6address + components = fastURI.parse('//[::ffff:129.144.52.38]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '::ffff:129.144.52.38', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + components = fastURI.parse('uri://10.10.10.10.example.com/en/process') + t.equal(components.error, undefined, 'mixed errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '10.10.10.10.example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/en/process', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16) + components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '/test', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address, example from RFC 5952 + components = fastURI.parse('//[2001:db8::1]:80') + t.equal(components.error, undefined, 'IPv6address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::1', 'host') + t.equal(components.port, 80, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with zone identifier, RFC 6874 + components = fastURI.parse('//[fe80::a%25en1]') + t.equal(components.error, undefined, 'IPv4address errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'fe80::a%en1', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + // IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22) + components = fastURI.parse('//[2001:db8::7%en0]') + t.equal(components.error, undefined, 'IPv6address interface errors') + t.equal(components.scheme, undefined, 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, '2001:db8::7%en0', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, '', 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + + t.end() +}) + +test('URI Serialization', (t) => { + let components = { + scheme: undefined, + userinfo: undefined, + host: undefined, + port: undefined, + path: undefined, + query: undefined, + fragment: undefined + } + t.equal(fastURI.serialize(components), '', 'Undefined Components') + + components = { + scheme: '', + userinfo: '', + host: '', + port: 0, + path: '', + query: '', + fragment: '' + } + t.equal(fastURI.serialize(components), '//@:0?#', 'Empty Components') + + components = { + scheme: 'uri', + userinfo: 'foo:bar', + host: 'example.com', + port: 1, + path: 'path', + query: 'query', + fragment: 'fragment' + } + t.equal(fastURI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components') + + components = { + scheme: 'uri', + host: 'example.com', + port: '9000' + } + t.equal(fastURI.serialize(components), 'uri://example.com:9000', 'String port') + + t.equal(fastURI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path') + t.equal(fastURI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path') + t.equal(fastURI.serialize({ path: '?query' }), '%3Fquery', 'Query path') + + // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4) + t.equal(fastURI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name') + + // IPv6address + t.equal(fastURI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host') + t.equal(fastURI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host') + t.equal(fastURI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host') + + // IPv6address with zone identifier, RFC 6874 + t.equal(fastURI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host') + t.equal(fastURI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host') + + t.end() +}) + +test('URI Resolving', { skip: true }, (t) => { + // normal examples from RFC 3986 + const base = 'uri://a/b/c/d;p?q' + t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h') + t.equal(fastURI.resolve(base, 'g'), 'uri://a/b/c/g', 'g') + t.equal(fastURI.resolve(base, './g'), 'uri://a/b/c/g', './g') + t.equal(fastURI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/') + t.equal(fastURI.resolve(base, '/g'), 'uri://a/g', '/g') + t.equal(fastURI.resolve(base, '//g'), 'uri://g', '//g') + t.equal(fastURI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y') + t.equal(fastURI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y') + t.equal(fastURI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s') + t.equal(fastURI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s') + t.equal(fastURI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s') + t.equal(fastURI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x') + t.equal(fastURI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x') + t.equal(fastURI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s') + t.equal(fastURI.resolve(base, ''), 'uri://a/b/c/d;p?q', '') + t.equal(fastURI.resolve(base, '.'), 'uri://a/b/c/', '.') + t.equal(fastURI.resolve(base, './'), 'uri://a/b/c/', './') + t.equal(fastURI.resolve(base, '..'), 'uri://a/b/', '..') + t.equal(fastURI.resolve(base, '../'), 'uri://a/b/', '../') + t.equal(fastURI.resolve(base, '../g'), 'uri://a/b/g', '../g') + t.equal(fastURI.resolve(base, '../..'), 'uri://a/', '../..') + t.equal(fastURI.resolve(base, '../../'), 'uri://a/', '../../') + t.equal(fastURI.resolve(base, '../../g'), 'uri://a/g', '../../g') + + // abnormal examples from RFC 3986 + t.equal(fastURI.resolve(base, '../../../g'), 'uri://a/g', '../../../g') + t.equal(fastURI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g') + + t.equal(fastURI.resolve(base, '/./g'), 'uri://a/g', '/./g') + t.equal(fastURI.resolve(base, '/../g'), 'uri://a/g', '/../g') + t.equal(fastURI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.') + t.equal(fastURI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g') + t.equal(fastURI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..') + t.equal(fastURI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g') + + t.equal(fastURI.resolve(base, './../g'), 'uri://a/b/g', './../g') + t.equal(fastURI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.') + t.equal(fastURI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h') + t.equal(fastURI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h') + t.equal(fastURI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y') + t.equal(fastURI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y') + + t.equal(fastURI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x') + t.equal(fastURI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x') + t.equal(fastURI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x') + t.equal(fastURI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x') + + t.equal(fastURI.resolve(base, 'uri:g'), 'uri:g', 'uri:g') + t.equal(fastURI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g') + + // examples by PAEz + t.equal(fastURI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf') + t.equal(fastURI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh') + + t.end() +}) + +test('URI Normalizing', { skip: true }, (t) => { + // test from RFC 3987 + t.equal(fastURI.normalize('uri://www.example.org/red%09ros\xE9#red'), 'uri://www.example.org/red%09ros%C3%A9#red') + + // IPv4address + t.equal(fastURI.normalize('//192.068.001.000'), '//192.68.1.0') + + // IPv6address, example from RFC 3513 + t.equal(fastURI.normalize('http://[1080::8:800:200C:417A]/'), 'http://[1080::8:800:200c:417a]/') + + // IPv6address, examples from RFC 5952 + t.equal(fastURI.normalize('//[2001:0db8::0001]/'), '//[2001:db8::1]/') + t.equal(fastURI.normalize('//[2001:db8::1:0000:1]/'), '//[2001:db8::1:0:1]/') + t.equal(fastURI.normalize('//[2001:db8:0:0:0:0:2:1]/'), '//[2001:db8::2:1]/') + t.equal(fastURI.normalize('//[2001:db8:0:1:1:1:1:1]/'), '//[2001:db8:0:1:1:1:1:1]/') + t.equal(fastURI.normalize('//[2001:0:0:1:0:0:0:1]/'), '//[2001:0:0:1::1]/') + t.equal(fastURI.normalize('//[2001:db8:0:0:1:0:0:1]/'), '//[2001:db8::1:0:0:1]/') + t.equal(fastURI.normalize('//[2001:DB8::1]/'), '//[2001:db8::1]/') + t.equal(fastURI.normalize('//[0:0:0:0:0:ffff:192.0.2.1]/'), '//[::ffff:192.0.2.1]/') + + // Mixed IPv4 and IPv6 address + t.equal(fastURI.normalize('//[1:2:3:4:5:6:192.0.2.1]/'), '//[1:2:3:4:5:6:192.0.2.1]/') + t.equal(fastURI.normalize('//[1:2:3:4:5:6:192.068.001.000]/'), '//[1:2:3:4:5:6:192.68.1.0]/') + + t.end() +}) + +test('URI Equals', (t) => { + // test from RFC 3986 + t.equal(fastURI.equal('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'), true) + + // test from RFC 3987 + t.equal(fastURI.equal('http://example.org/~user', 'http://example.org/%7euser'), true) + + t.end() +}) + +test('Escape Component', { skip: true }, (t) => { + let chr + for (let d = 0; d <= 129; ++d) { + chr = String.fromCharCode(d) + if (!chr.match(/[$&+,;=]/)) { + t.equal(fastURI.escapeComponent(chr), encodeURIComponent(chr)) + } else { + t.equal(fastURI.escapeComponent(chr), chr) + } + } + t.equal(fastURI.escapeComponent('\u00c0'), encodeURIComponent('\u00c0')) + t.equal(fastURI.escapeComponent('\u07ff'), encodeURIComponent('\u07ff')) + t.equal(fastURI.escapeComponent('\u0800'), encodeURIComponent('\u0800')) + t.equal(fastURI.escapeComponent('\u30a2'), encodeURIComponent('\u30a2')) + t.end() +}) + +test('Unescape Component', { skip: true }, (t) => { + let chr + for (let d = 0; d <= 129; ++d) { + chr = String.fromCharCode(d) + t.equal(fastURI.unescapeComponent(encodeURIComponent(chr)), chr) + } + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u00c0')), '\u00c0') + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u07ff')), '\u07ff') + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u0800')), '\u0800') + t.equal(fastURI.unescapeComponent(encodeURIComponent('\u30a2')), '\u30a2') + t.end() +}) + +const IRI_OPTION = { iri: true, unicodeSupport: true } + +test('IRI Parsing', { skip: true }, (t) => { + const components = fastURI.parse('uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy', IRI_OPTION) + t.equal(components.error, undefined, 'all errors') + t.equal(components.scheme, 'uri', 'scheme') + t.equal(components.userinfo, 'us\xA0er:pa\uD7FFss', 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, 123, 'port') + t.equal(components.path, '/o\uF900ne/t\uFDCFwo.t\uFDF0hree', 'path') + t.equal(components.query, 'q1=a1\uF8FF\uE000&q2=a2', 'query') + t.equal(components.fragment, 'bo\uFFEFdy', 'fragment') + t.end() +}) + +test('IRI Serialization', { skip: true }, (t) => { + const components = { + scheme: 'uri', + userinfo: 'us\xA0er:pa\uD7FFss', + host: 'example.com', + port: 123, + path: '/o\uF900ne/t\uFDCFwo.t\uFDF0hree', + query: 'q1=a1\uF8FF\uE000&q2=a2', + fragment: 'bo\uFFEFdy\uE001' + } + t.equal(fastURI.serialize(components, IRI_OPTION), 'uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy%EE%80%81') + t.end() +}) + +test('IRI Normalizing', { skip: true }, (t) => { + t.equal(fastURI.normalize('uri://www.example.org/red%09ros\xE9#red', IRI_OPTION), 'uri://www.example.org/red%09ros\xE9#red') + t.end() +}) + +test('IRI Equals', { skip: true }, (t) => { + // example from RFC 3987 + t.equal(fastURI.equal('example://a/b/c/%7Bfoo%7D/ros\xE9', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9', IRI_OPTION), true) + t.end() +}) + +test('Convert IRI to URI', { skip: true }, (t) => { + // example from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://www.example.org/red%09ros\xE9#red', IRI_OPTION)), 'uri://www.example.org/red%09ros%C3%A9#red') + + // Internationalized Domain Name conversion via punycode example from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://r\xE9sum\xE9.example.org', { iri: true, domainHost: true }), { domainHost: true }), 'uri://xn--rsum-bpad.example.org') + t.end() +}) + +test('Convert URI to IRI', { skip: true }, (t) => { + // examples from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://www.example.org/D%C3%BCrst'), IRI_OPTION), 'uri://www.example.org/D\xFCrst') + t.equal(fastURI.serialize(fastURI.parse('uri://www.example.org/D%FCrst'), IRI_OPTION), 'uri://www.example.org/D%FCrst') + t.equal(fastURI.serialize(fastURI.parse('uri://xn--99zt52a.example.org/%e2%80%ae'), IRI_OPTION), 'uri://xn--99zt52a.example.org/%E2%80%AE') // or uri://\u7D0D\u8C46.example.org/%E2%80%AE + + // Internationalized Domain Name conversion via punycode example from RFC 3987 + t.equal(fastURI.serialize(fastURI.parse('uri://xn--rsum-bpad.example.org', { domainHost: true }), { iri: true, domainHost: true }), 'uri://r\xE9sum\xE9.example.org') + t.end() +}) + +if (fastURI.SCHEMES.http) { + test('HTTP Equals', (t) => { + // test from RFC 2616 + t.equal(fastURI.equal('http://abc.com:80/~smith/home.html', 'http://abc.com/~smith/home.html'), true) + t.equal(fastURI.equal('http://ABC.com/%7Esmith/home.html', 'http://abc.com/~smith/home.html'), true) + t.equal(fastURI.equal('http://ABC.com:/%7esmith/home.html', 'http://abc.com/~smith/home.html'), true) + t.equal(fastURI.equal('HTTP://ABC.COM', 'http://abc.com/'), true) + // test from RFC 3986 + t.equal(fastURI.equal('http://example.com:/', 'http://example.com:80/'), true) + t.end() + }) +} + +if (fastURI.SCHEMES.https) { + test('HTTPS Equals', (t) => { + t.equal(fastURI.equal('https://example.com', 'https://example.com:443/'), true) + t.equal(fastURI.equal('https://example.com:/', 'https://example.com:443/'), true) + t.end() + }) +} + +if (fastURI.SCHEMES.urn) { + test('URN Parsing', (t) => { + // example from RFC 2141 + const components = fastURI.parse('urn:foo:a123,456') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, 'a123,456', 'nss') + t.end() + }) + + test('URN Serialization', (t) => { + // example from RFC 2141 + const components = { + scheme: 'urn', + nid: 'foo', + nss: 'a123,456' + } + t.equal(fastURI.serialize(components), 'urn:foo:a123,456') + t.end() + }) + + test('URN Equals', { skip: true }, (t) => { + // test from RFC 2141 + t.equal(fastURI.equal('urn:foo:a123,456', 'urn:foo:a123,456'), true) + t.equal(fastURI.equal('urn:foo:a123,456', 'URN:foo:a123,456'), true) + t.equal(fastURI.equal('urn:foo:a123,456', 'urn:FOO:a123,456'), true) + t.equal(fastURI.equal('urn:foo:a123,456', 'urn:foo:A123,456'), false) + t.equal(fastURI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true) + t.end() + }) + + test('URN Resolving', (t) => { + // example from epoberezkin + t.equal(fastURI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.equal(fastURI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.equal(fastURI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop') + t.end() + }) + + test('UUID Parsing', (t) => { + // example from RFC 4122 + let components = fastURI.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.nid, 'uuid', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid') + + components = fastURI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + t.notEqual(components.error, undefined, 'errors') + t.end() + }) + + test('UUID Serialization', (t) => { + // example from RFC 4122 + let components = { + scheme: 'urn', + nid: 'uuid', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + + components = { + scheme: 'urn', + nid: 'uuid', + uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6') + t.end() + }) + + test('UUID Equals', (t) => { + t.equal(fastURI.equal('URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6', 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'), true) + t.end() + }) + + test('URN NID Override', (t) => { + let components = fastURI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' }) + t.equal(components.error, undefined, 'errors') + t.equal(components.scheme, 'urn', 'scheme') + t.equal(components.path, undefined, 'path') + t.equal(components.nid, 'foo', 'nid') + t.equal(components.nss, undefined, 'nss') + t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid') + + components = { + scheme: 'urn', + nid: 'foo', + uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6' + } + t.equal(fastURI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6') + t.end() + }) +} + +if (fastURI.SCHEMES.mailto) { + test('Mailto Parse', (t) => { + let components + + // tests from RFC 6068 + + components = fastURI.parse('mailto:chris@example.com') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'mailto', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, undefined, 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.deepEqual(components.to, ['chris@example.com'], 'to') + t.equal(components.subject, undefined, 'subject') + t.equal(components.body, undefined, 'body') + t.equal(components.headers, undefined, 'headers') + + components = fastURI.parse('mailto:infobot@example.com?subject=current-issue') + t.deepEqual(components.to, ['infobot@example.com'], 'to') + t.equal(components.subject, 'current-issue', 'subject') + + components = fastURI.parse('mailto:infobot@example.com?body=send%20current-issue') + t.deepEqual(components.to, ['infobot@example.com'], 'to') + t.equal(components.body, 'send current-issue', 'body') + + components = fastURI.parse('mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index') + t.deepEqual(components.to, ['infobot@example.com'], 'to') + t.equal(components.body, 'send current-issue\x0D\x0Asend index', 'body') + + components = fastURI.parse('mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E') + t.deepEqual(components.to, ['list@example.org'], 'to') + t.deepEqual(components.headers, { 'In-Reply-To': '<3469A91.D10AF4C@example.com>' }, 'headers') + + components = fastURI.parse('mailto:majordomo@example.com?body=subscribe%20bamboo-l') + t.deepEqual(components.to, ['majordomo@example.com'], 'to') + t.equal(components.body, 'subscribe bamboo-l', 'body') + + components = fastURI.parse('mailto:joe@example.com?cc=bob@example.com&body=hello') + t.deepEqual(components.to, ['joe@example.com'], 'to') + t.equal(components.body, 'hello', 'body') + t.deepEqual(components.headers, { cc: 'bob@example.com' }, 'headers') + + components = fastURI.parse('mailto:joe@example.com?cc=bob@example.com?body=hello') + if (fastURI.VALIDATE_SUPPORT) t.ok(components.error, 'invalid header fields') + + components = fastURI.parse('mailto:gorby%25kremvax@example.com') + t.deepEqual(components.to, ['gorby%kremvax@example.com'], 'to gorby%kremvax@example.com') + + components = fastURI.parse('mailto:unlikely%3Faddress@example.com?blat=foop') + t.deepEqual(components.to, ['unlikely?address@example.com'], 'to unlikely?address@example.com') + t.deepEqual(components.headers, { blat: 'foop' }, 'headers') + + components = fastURI.parse('mailto:Mike%26family@example.org') + t.deepEqual(components.to, ['Mike&family@example.org'], 'to Mike&family@example.org') + + components = fastURI.parse('mailto:%22not%40me%22@example.org') + t.deepEqual(components.to, ['"not@me"@example.org'], 'to ' + '"not@me"@example.org') + + components = fastURI.parse('mailto:%22oh%5C%5Cno%22@example.org') + t.deepEqual(components.to, ['"oh\\\\no"@example.org'], 'to ' + '"oh\\\\no"@example.org') + + components = fastURI.parse("mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org") + t.deepEqual(components.to, ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'], 'to ' + '"\\\\\\"it\'s\\ ugly\\\\\\""@example.org') + + components = fastURI.parse('mailto:user@example.org?subject=caf%C3%A9') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, 'caf\xE9', 'subject') + + components = fastURI.parse('mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, '=?utf-8?Q?caf=C3=A9?=', 'subject') // TODO: Verify this + + components = fastURI.parse('mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, '=?iso-8859-1?Q?caf=E9?=', 'subject') // TODO: Verify this + + components = fastURI.parse('mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9') + t.deepEqual(components.to, ['user@example.org'], 'to') + t.equal(components.subject, 'caf\xE9', 'subject') + t.equal(components.body, 'caf\xE9', 'body') + + if (fastURI.IRI_SUPPORT) { + components = fastURI.parse('mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO') + t.deepEqual(components.to, ['user@xn--99zt52a.example.org'], 'to') + t.equal(components.subject, 'Test', 'subject') + t.equal(components.body, 'NATTO', 'body') + } + + t.end() + }) + + test('Mailto Serialize', (t) => { + // tests from RFC 6068 + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['chris@example.com'] }), 'mailto:chris@example.com') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'current-issue' }), 'mailto:infobot@example.com?body=current-issue') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'send current-issue' }), 'mailto:infobot@example.com?body=send%20current-issue') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'send current-issue\x0D\x0Asend index' }), 'mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['list@example.org'], headers: { 'In-Reply-To': '<3469A91.D10AF4C@example.com>' } }), 'mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['majordomo@example.com'], body: 'subscribe bamboo-l' }), 'mailto:majordomo@example.com?body=subscribe%20bamboo-l') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['joe@example.com'], headers: { cc: 'bob@example.com', body: 'hello' } }), 'mailto:joe@example.com?cc=bob@example.com&body=hello') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['gorby%25kremvax@example.com'] }), 'mailto:gorby%25kremvax@example.com') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['unlikely%3Faddress@example.com'], headers: { blat: 'foop' } }), 'mailto:unlikely%3Faddress@example.com?blat=foop') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['Mike&family@example.org'] }), 'mailto:Mike%26family@example.org') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['"not@me"@example.org'] }), 'mailto:%22not%40me%22@example.org') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['"oh\\\\no"@example.org'] }), 'mailto:%22oh%5C%5Cno%22@example.org') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'] }), "mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org") + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: 'caf\xE9' }), 'mailto:user@example.org?subject=caf%C3%A9') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: '=?utf-8?Q?caf=C3=A9?=' }), 'mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: '=?iso-8859-1?Q?caf=E9?=' }), 'mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D') + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: 'caf\xE9', body: 'caf\xE9' }), 'mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9') + if (fastURI.IRI_SUPPORT) { + t.equal(fastURI.serialize({ scheme: 'mailto', to: ['us\xE9r@\u7d0d\u8c46.example.org'], subject: 'Test', body: 'NATTO' }), 'mailto:us%C3%A9r@xn--99zt52a.example.org?subject=Test&body=NATTO') + } + t.end() + }) + + test('Mailto Equals', (t) => { + // tests from RFC 6068 + t.equal(fastURI.equal('mailto:addr1@an.example,addr2@an.example', 'mailto:?to=addr1@an.example,addr2@an.example'), true) + t.equal(fastURI.equal('mailto:?to=addr1@an.example,addr2@an.example', 'mailto:addr1@an.example?to=addr2@an.example'), true) + t.end() + }) +} + +if (fastURI.SCHEMES.ws) { + test('WS Parse', (t) => { + let components + + // example from RFC 6455, Sec 4.1 + components = fastURI.parse('ws://example.com/chat') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'ws', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/chat', 'resourceName') + t.equal(components.secure, false, 'secure') + + components = fastURI.parse('ws://example.com/foo?bar=baz') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'ws', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/foo?bar=baz', 'resourceName') + t.equal(components.secure, false, 'secure') + + components = fastURI.parse('ws://example.com/?bar=baz') + t.equal(components.resourceName, '/?bar=baz', 'resourceName') + + t.end() + }) + + test('WS Serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'ws' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo') + t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'ws', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + t.end() + }) + + test('WS Equal', (t) => { + t.equal(fastURI.equal('WS://ABC.COM:80/chat#one', 'ws://abc.com/chat'), true) + t.end() + }) + + test('WS Normalize', (t) => { + t.equal(fastURI.normalize('ws://example.com:80/foo#hash'), 'ws://example.com/foo') + t.end() + }) +} + +if (fastURI.SCHEMES.wss) { + test('WSS Parse', (t) => { + let components + + // example from RFC 6455, Sec 4.1 + components = fastURI.parse('wss://example.com/chat') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'wss', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/chat', 'resourceName') + t.equal(components.secure, true, 'secure') + + components = fastURI.parse('wss://example.com/foo?bar=baz') + t.equal(components.error, undefined, 'error') + t.equal(components.scheme, 'wss', 'scheme') + t.equal(components.userinfo, undefined, 'userinfo') + t.equal(components.host, 'example.com', 'host') + t.equal(components.port, undefined, 'port') + t.equal(components.path, undefined, 'path') + t.equal(components.query, undefined, 'query') + t.equal(components.fragment, undefined, 'fragment') + t.equal(components.resourceName, '/foo?bar=baz', 'resourceName') + t.equal(components.secure, true, 'secure') + + components = fastURI.parse('wss://example.com/?bar=baz') + t.equal(components.resourceName, '/?bar=baz', 'resourceName') + + t.end() + }) + + test('WSS Serialize', (t) => { + t.equal(fastURI.serialize({ scheme: 'wss' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo') + t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', secure: false }), 'ws:') + t.equal(fastURI.serialize({ scheme: 'wss', secure: true }), 'wss:') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar') + t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar') + t.end() + }) + + test('WSS Equal', (t) => { + t.equal(fastURI.equal('WSS://ABC.COM:443/chat#one', 'wss://abc.com/chat'), true) + t.end() + }) + + test('WSS Normalize', (t) => { + t.equal(fastURI.normalize('wss://example.com:443/foo#hash'), 'wss://example.com/foo') + t.end() + }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/util.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/util.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bbf7ebd8048b68531dce03eb828c3f6684e174c2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/test/util.test.js @@ -0,0 +1,38 @@ +'use strict' + +const test = require('tape') +const { + stringArrayToHexStripped, + removeDotSegments +} = require('../lib/utils') + +test('stringArrayToHexStripped', (t) => { + const testCases = [ + [['0', '0', '0', '0'], ''], + [['0', '0', '0', '1'], '1'], + [['0', '0', '1', '0'], '10'], + [['0', '1', '0', '0'], '100'], + [['1', '0', '0', '0'], '1000'], + [['1', '0', '0', '1'], '1001'], + ] + + t.plan(testCases.length) + + testCases.forEach(([input, expected]) => { + t.same(stringArrayToHexStripped(input), expected) + }) +}) + +// Just fixtures, because this function already tested by resolve +test('removeDotSegments', (t) => { + const testCases = [] + // https://github.com/fastify/fast-uri/issues/139 + testCases.push(['WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a', + 'WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a']) + + t.plan(testCases.length) + + testCases.forEach(([input, expected]) => { + t.same(removeDotSegments(input), expected) + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/types/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1481ba9c3b8c99c0c1ca1893acaecf2943e46e4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/types/index.d.ts @@ -0,0 +1,60 @@ +type FastUri = typeof fastUri + +declare namespace fastUri { + export interface URIComponent { + scheme?: string; + userinfo?: string; + host?: string; + port?: number | string; + path?: string; + query?: string; + fragment?: string; + reference?: string; + nid?: string; + nss?: string; + resourceName?: string; + secure?: boolean; + uuid?: string; + error?: string; + } + export interface Options { + scheme?: string; + reference?: string; + unicodeSupport?: boolean; + domainHost?: boolean; + absolutePath?: boolean; + tolerant?: boolean; + skipEscape?: boolean; + nid?: string; + } + + /** + * @deprecated Use Options instead + */ + export type options = Options + /** + * @deprecated Use URIComponent instead + */ + export type URIComponents = URIComponent + + export function normalize (uri: string, opts?: Options): string + export function normalize (uri: URIComponent, opts?: Options): URIComponent + export function normalize (uri: any, opts?: Options): any + + export function resolve (baseURI: string, relativeURI: string, options?: Options): string + + export function resolveComponent (base: URIComponent, relative: URIComponent, options?: Options, skipNormalization?: boolean): URIComponent + + export function parse (uri: string, opts?: Options): URIComponent + + export function serialize (component: URIComponent, opts?: Options): string + + export function equal (uriA: string, uriB: string): boolean + + export function resolve (base: string, path: string): string + + export const fastUri: FastUri + export { fastUri as default } +} + +export = fastUri diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/types/index.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/types/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..02670ced86048f1dab20e69266f060ded8887396 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/fast-uri/types/index.test-d.ts @@ -0,0 +1,17 @@ +import uri, { URIComponents, URIComponent, Options, options } from '..' +import { expectDeprecated, expectType } from 'tsd' + +const parsed = uri.parse('foo') +expectType(parsed) +const parsed2 = uri.parse('foo', { + domainHost: true, + scheme: 'https', + unicodeSupport: false +}) +expectType(parsed2) + +expectType({} as URIComponents) +expectDeprecated({} as URIComponents) + +expectType({} as options) +expectDeprecated({} as options) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..38d3c79056fb0f2ffa8040d0046614a71f153ce0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/.github/dependabot.yml @@ -0,0 +1,34 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + commit-message: + # Prefix all commit messages with "chore: " + prefix: "chore" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + commit-message: + # Prefix all commit messages with "chore: " + prefix: "chore" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + groups: + # Production dependencies without breaking changes + dependencies: + dependency-type: "production" + update-types: + - "minor" + - "patch" + # Production dependencies with breaking changes + dependencies-major: + dependency-type: "production" + update-types: + - "major" + # Development dependencies + dev-dependencies: + dependency-type: "development" diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/.github/workflows/node.js.yml b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/.github/workflows/node.js.yml new file mode 100644 index 0000000000000000000000000000000000000000..4a00094ba1c8edfe30376b8519deace4673b8605 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/.github/workflows/node.js.yml @@ -0,0 +1,67 @@ +name: Node CI + +on: + push: + branches: + - main + - next + pull_request: + +permissions: + contents: read + +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + + strategy: + matrix: + node-version: + - 20 + - 22 + os: + - ubuntu-latest + - windows-latest + - macOS-latest + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 + with: + check-latest: true + node-version: ${{ matrix.node-version }} + + - name: Install + run: | + npm install --ignore-scripts + + - name: Lint + run: | + npm run test:lint + + - name: Test + run: | + npm test + + - name: Type Definitions + run: | + npm run test:typescript + + automerge: + if: > + github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' + needs: test + runs-on: ubuntu-latest + permissions: + actions: write + pull-requests: write + contents: write + steps: + - uses: fastify/github-action-merge-dependabot@e820d631adb1d8ab16c3b93e5afe713450884a4a # v3.11.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/bench-thread.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/bench-thread.js new file mode 100644 index 0000000000000000000000000000000000000000..86ed9d7cac7aa5817270fe6a196ea2f5b88a0ec3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/bench-thread.js @@ -0,0 +1,35 @@ +'use strict' + +const { workerData: benchmark, parentPort } = require('worker_threads') + +const Benchmark = require('benchmark') +// The default number of samples for Benchmark seems to be low enough that it +// can generate results with significant variance (~2%) for this benchmark +// suite. This makes it sometimes a bit confusing to actually evaluate impact of +// changes on performance. Setting the minimum of samples to 500 results in +// significantly lower variance on my local setup for this tests suite, and +// gives me higher confidence in benchmark results. +Benchmark.options.minSamples = 500 + +const suite = Benchmark.Suite() + +const FindMyWay = require('..') +const findMyWay = new FindMyWay() + +for (const { method, url, opts } of benchmark.setupURLs) { + if (opts !== undefined) { + findMyWay.on(method, url, opts, () => true) + } else { + findMyWay.on(method, url, () => true) + } +} + +suite + .add(benchmark.name, () => { + findMyWay.lookup(...benchmark.arguments) + }) + .on('cycle', (event) => { + parentPort.postMessage(String(event.target)) + }) + .on('complete', () => {}) + .run() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/bench.js new file mode 100644 index 0000000000000000000000000000000000000000..ecd936305da41df019bc0850b3ded25086df792e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/bench.js @@ -0,0 +1,156 @@ +'use strict' + +const path = require('path') +const { Worker } = require('worker_threads') + +const BENCH_THREAD_PATH = path.join(__dirname, 'bench-thread.js') + +const benchmarks = [ + { + name: 'lookup root "/" route', + setupURLs: [{ method: 'GET', url: '/' }], + arguments: [{ method: 'GET', url: '/' }] + }, + { + name: 'lookup short static route', + setupURLs: [{ method: 'GET', url: '/static' }], + arguments: [{ method: 'GET', url: '/static' }] + }, + { + name: 'lookup long static route', + setupURLs: [{ method: 'GET', url: '/static/static/static/static/static' }], + arguments: [{ method: 'GET', url: '/static/static/static/static/static' }] + }, + { + name: 'lookup long static route (common prefix)', + setupURLs: [ + { method: 'GET', url: '/static' }, + { method: 'GET', url: '/static/static' }, + { method: 'GET', url: '/static/static/static' }, + { method: 'GET', url: '/static/static/static/static' }, + { method: 'GET', url: '/static/static/static/static/static' } + ], + arguments: [{ method: 'GET', url: '/static/static/static/static/static' }] + }, + { + name: 'lookup short parametric route', + setupURLs: [{ method: 'GET', url: '/:param' }], + arguments: [{ method: 'GET', url: '/param1' }] + }, + { + name: 'lookup long parametric route', + setupURLs: [{ method: 'GET', url: '/:param' }], + arguments: [{ method: 'GET', url: '/longParamParamParamParamParamParam' }] + }, + { + name: 'lookup short parametric route (encoded unoptimized)', + setupURLs: [{ method: 'GET', url: '/:param' }], + arguments: [{ method: 'GET', url: '/param%2B' }] + }, + { + name: 'lookup short parametric route (encoded optimized)', + setupURLs: [{ method: 'GET', url: '/:param' }], + arguments: [{ method: 'GET', url: '/param%20' }] + }, + { + name: 'lookup parametric route with two short params', + setupURLs: [{ method: 'GET', url: '/:param1/:param2' }], + arguments: [{ method: 'GET', url: '/param1/param2' }] + }, + { + name: 'lookup multi-parametric route with two short params', + setupURLs: [{ method: 'GET', url: '/:param1-:param2' }], + arguments: [{ method: 'GET', url: '/param1-param2' }] + }, + { + name: 'lookup multi-parametric route with two short regex params', + setupURLs: [{ method: 'GET', url: '/:param1([a-z]*)1:param2([a-z]*)2' }], + arguments: [{ method: 'GET', url: '/param1param2' }] + }, + { + name: 'lookup long static + parametric route', + setupURLs: [{ method: 'GET', url: '/static/:param1/static/:param2/static' }], + arguments: [{ method: 'GET', url: '/static/param1/static/param2/static' }] + }, + { + name: 'lookup short wildcard route', + setupURLs: [{ method: 'GET', url: '/*' }], + arguments: [{ method: 'GET', url: '/static' }] + }, + { + name: 'lookup long wildcard route', + setupURLs: [{ method: 'GET', url: '/*' }], + arguments: [{ method: 'GET', url: '/static/static/static/static/static' }] + }, + { + name: 'lookup root route on constrained router', + setupURLs: [ + { method: 'GET', url: '/' }, + { method: 'GET', url: '/static', opts: { constraints: { version: '1.2.0' } } }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'example.com' } } }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'fastify.io' } } } + ], + arguments: [{ method: 'GET', url: '/', headers: { host: 'fastify.io' } }] + }, + { + name: 'lookup short static unconstraint route', + setupURLs: [ + { method: 'GET', url: '/static', opts: {} }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'example.com' } } }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'fastify.io' } } } + ], + arguments: [{ method: 'GET', url: '/static', headers: {} }] + }, + { + name: 'lookup short static versioned route', + setupURLs: [ + { method: 'GET', url: '/static', opts: { constraints: { version: '1.2.0' } } }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'example.com' } } }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'fastify.io' } } } + ], + arguments: [{ method: 'GET', url: '/static', headers: { 'accept-version': '1.x', host: 'fastify.io' } }] + }, + { + name: 'lookup short static constrained (version & host) route', + setupURLs: [ + { method: 'GET', url: '/static', opts: { constraints: { version: '1.2.0' } } }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'example.com' } } }, + { method: 'GET', url: '/static', opts: { constraints: { version: '2.0.0', host: 'fastify.io' } } } + ], + arguments: [{ method: 'GET', url: '/static', headers: { 'accept-version': '2.x', host: 'fastify.io' } }] + } +] + +async function runBenchmark (benchmark) { + const worker = new Worker(BENCH_THREAD_PATH, { workerData: benchmark }) + + return new Promise((resolve, reject) => { + let result = null + worker.on('error', reject) + worker.on('message', (benchResult) => { + result = benchResult + }) + worker.on('exit', (code) => { + if (code === 0) { + resolve(result) + } else { + reject(new Error(`Worker stopped with exit code ${code}`)) + } + }) + }) +} + +async function runBenchmarks () { + let maxNameLength = 0 + for (const benchmark of benchmarks) { + maxNameLength = Math.max(benchmark.name.length, maxNameLength) + } + + for (const benchmark of benchmarks) { + benchmark.name = benchmark.name.padEnd(maxNameLength, '.') + const resultMessage = await runBenchmark(benchmark) + console.log(resultMessage) + } +} + +runBenchmarks() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/compare-branches.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/compare-branches.js new file mode 100644 index 0000000000000000000000000000000000000000..1bda36b435d5637f586a7ed9014aa9bb3c404f16 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/compare-branches.js @@ -0,0 +1,113 @@ +'use strict' + +const { spawn } = require('child_process') + +const chalk = require('chalk') +const inquirer = require('inquirer') +const simpleGit = require('simple-git') + +const git = simpleGit(process.cwd()) + +const COMMAND = 'npm run bench' +const DEFAULT_BRANCH = 'main' +const PERCENT_THRESHOLD = 5 + +async function selectBranchName (message, branches) { + const result = await inquirer.prompt([{ + type: 'list', + name: 'branch', + choices: branches, + loop: false, + pageSize: 20, + message + }]) + return result.branch +} + +async function executeCommandOnBranch (command, branch) { + console.log(chalk.grey(`Checking out "${branch}"`)) + await git.checkout(branch) + + console.log(chalk.grey(`Execute "${command}"`)) + const childProcess = spawn(command, { stdio: 'pipe', shell: true }) + + let result = '' + childProcess.stdout.on('data', (data) => { + process.stdout.write(data.toString()) + result += data.toString() + }) + + await new Promise(resolve => childProcess.on('close', resolve)) + + console.log() + + return parseBenchmarksStdout(result) +} + +function parseBenchmarksStdout (text) { + const results = [] + + for (const line of text.split('\n')) { + const match = /^(.+?)(\.*) x (.+) ops\/sec .*$/.exec(line) + if (match !== null) { + results.push({ + name: match[1], + alignedName: match[1] + match[2], + result: parseInt(match[3].replaceAll(',', '')) + }) + } + } + + return results +} + +function compareResults (featureBranch, mainBranch) { + for (const { name, alignedName, result: mainBranchResult } of mainBranch) { + const featureBranchBenchmark = featureBranch.find(result => result.name === name) + if (featureBranchBenchmark) { + const featureBranchResult = featureBranchBenchmark.result + const percent = (featureBranchResult - mainBranchResult) * 100 / mainBranchResult + const roundedPercent = Math.round(percent * 100) / 100 + + const percentString = roundedPercent > 0 ? `+${roundedPercent}%` : `${roundedPercent}%` + const message = alignedName + percentString.padStart(7, '.') + + if (roundedPercent > PERCENT_THRESHOLD) { + console.log(chalk.green(message)) + } else if (roundedPercent < -PERCENT_THRESHOLD) { + console.log(chalk.red(message)) + } else { + console.log(message) + } + } + } +} + +(async function () { + const branches = await git.branch() + const currentBranch = branches.branches[branches.current] + + let featureBranch = null + let mainBranch = null + + if (process.argv[2] === '--ci') { + featureBranch = currentBranch.name + mainBranch = DEFAULT_BRANCH + } else { + featureBranch = await selectBranchName('Select the branch you want to compare (feature branch):', branches.all) + mainBranch = await selectBranchName('Select the branch you want to compare with (main branch):', branches.all) + } + + try { + const featureBranchResult = await executeCommandOnBranch(COMMAND, featureBranch) + const mainBranchResult = await executeCommandOnBranch(COMMAND, mainBranch) + compareResults(featureBranchResult, mainBranchResult) + } catch (error) { + console.error('Switch to origin branch due to an error', error.message) + } + + await git.checkout(currentBranch.commit) + await git.checkout(currentBranch.name) + + console.log(chalk.gray(`Back to ${currentBranch.name} ${currentBranch.commit}`)) +})() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/uri-decoding.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/uri-decoding.js new file mode 100644 index 0000000000000000000000000000000000000000..83ee3a36b7bfc529379dd01e9d580c078800b7fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/benchmark/uri-decoding.js @@ -0,0 +1,55 @@ +'use strict' + +const fastDecode = require('fast-decode-uri-component') + +const Benchmark = require('benchmark') +Benchmark.options.minSamples = 500 + +const suite = Benchmark.Suite() + +const uri = [ + encodeURIComponent(' /?!#@=[](),\'"'), + encodeURIComponent('algunas palabras aquí'), + encodeURIComponent('acde=bdfd'), + encodeURIComponent('много русских букв'), + encodeURIComponent('這裡有些話'), + encodeURIComponent('कुछ शब्द यहाँ'), + encodeURIComponent('✌👀🎠🎡🍺') +] + +function safeFastDecode (uri) { + if (uri.indexOf('%') < 0) return uri + try { + return fastDecode(uri) + } catch (e) { + return null // or it can be null + } +} + +function safeDecodeURIComponent (uri) { + if (uri.indexOf('%') < 0) return uri + try { + return decodeURIComponent(uri) + } catch (e) { + return null // or it can be null + } +} + +uri.forEach(function (u, i) { + suite.add(`safeDecodeURIComponent(${i}) [${u}]`, function () { + safeDecodeURIComponent(u) + }) + suite.add(`fastDecode(${i}) [${u}]`, function () { + fastDecode(u) + }) + suite.add(`safeFastDecode(${i}) [${u}]`, function () { + safeFastDecode(u) + }) +}) +suite + .on('cycle', function (event) { + console.log(String(event.target)) + }) + .on('complete', function () { + }) + .run() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/constrainer.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/constrainer.js new file mode 100644 index 0000000000000000000000000000000000000000..6cd9df65c55fa9cfdc115a39591cbcc29b1f4835 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/constrainer.js @@ -0,0 +1,170 @@ +'use strict' + +const acceptVersionStrategy = require('./strategies/accept-version') +const acceptHostStrategy = require('./strategies/accept-host') +const assert = require('node:assert') + +class Constrainer { + constructor (customStrategies) { + this.strategies = { + version: acceptVersionStrategy, + host: acceptHostStrategy + } + + this.strategiesInUse = new Set() + this.asyncStrategiesInUse = new Set() + + // validate and optimize prototypes of given custom strategies + if (customStrategies) { + for (const strategy of Object.values(customStrategies)) { + this.addConstraintStrategy(strategy) + } + } + } + + isStrategyUsed (strategyName) { + return this.strategiesInUse.has(strategyName) || + this.asyncStrategiesInUse.has(strategyName) + } + + hasConstraintStrategy (strategyName) { + const customConstraintStrategy = this.strategies[strategyName] + if (customConstraintStrategy !== undefined) { + return customConstraintStrategy.isCustom || + this.isStrategyUsed(strategyName) + } + return false + } + + addConstraintStrategy (strategy) { + assert(typeof strategy.name === 'string' && strategy.name !== '', 'strategy.name is required.') + assert(strategy.storage && typeof strategy.storage === 'function', 'strategy.storage function is required.') + assert(strategy.deriveConstraint && typeof strategy.deriveConstraint === 'function', 'strategy.deriveConstraint function is required.') + + if (this.strategies[strategy.name] && this.strategies[strategy.name].isCustom) { + throw new Error(`There already exists a custom constraint with the name ${strategy.name}.`) + } + + if (this.isStrategyUsed(strategy.name)) { + throw new Error(`There already exists a route with ${strategy.name} constraint.`) + } + + strategy.isCustom = true + strategy.isAsync = strategy.deriveConstraint.length === 3 + this.strategies[strategy.name] = strategy + + if (strategy.mustMatchWhenDerived) { + this.noteUsage({ [strategy.name]: strategy }) + } + } + + deriveConstraints (req, ctx, done) { + const constraints = this.deriveSyncConstraints(req, ctx) + + if (done === undefined) { + return constraints + } + + this.deriveAsyncConstraints(constraints, req, ctx, done) + } + + deriveSyncConstraints (req, ctx) { + return undefined + } + + // When new constraints start getting used, we need to rebuild the deriver to derive them. Do so if we see novel constraints used. + noteUsage (constraints) { + if (constraints) { + const beforeSize = this.strategiesInUse.size + for (const key in constraints) { + const strategy = this.strategies[key] + if (strategy.isAsync) { + this.asyncStrategiesInUse.add(key) + } else { + this.strategiesInUse.add(key) + } + } + if (beforeSize !== this.strategiesInUse.size) { + this._buildDeriveConstraints() + } + } + } + + newStoreForConstraint (constraint) { + if (!this.strategies[constraint]) { + throw new Error(`No strategy registered for constraint key ${constraint}`) + } + return this.strategies[constraint].storage() + } + + validateConstraints (constraints) { + for (const key in constraints) { + const value = constraints[key] + if (typeof value === 'undefined') { + throw new Error('Can\'t pass an undefined constraint value, must pass null or no key at all') + } + const strategy = this.strategies[key] + if (!strategy) { + throw new Error(`No strategy registered for constraint key ${key}`) + } + if (strategy.validate) { + strategy.validate(value) + } + } + } + + deriveAsyncConstraints (constraints, req, ctx, done) { + let asyncConstraintsCount = this.asyncStrategiesInUse.size + + if (asyncConstraintsCount === 0) { + done(null, constraints) + return + } + + constraints = constraints || {} + for (const key of this.asyncStrategiesInUse) { + const strategy = this.strategies[key] + strategy.deriveConstraint(req, ctx, (err, constraintValue) => { + if (err !== null) { + done(err) + return + } + + constraints[key] = constraintValue + + if (--asyncConstraintsCount === 0) { + done(null, constraints) + } + }) + } + } + + // Optimization: build a fast function for deriving the constraints for all the strategies at once. We inline the definitions of the version constraint and the host constraint for performance. + // If no constraining strategies are in use (no routes constrain on host, or version, or any custom strategies) then we don't need to derive constraints for each route match, so don't do anything special, and just return undefined + // This allows us to not allocate an object to hold constraint values if no constraints are defined. + _buildDeriveConstraints () { + if (this.strategiesInUse.size === 0) return + + const lines = ['return {'] + + for (const key of this.strategiesInUse) { + const strategy = this.strategies[key] + // Optimization: inline the derivation for the common built in constraints + if (!strategy.isCustom) { + if (key === 'version') { + lines.push(' version: req.headers[\'accept-version\'],') + } else { + lines.push(' host: req.headers.host || req.headers[\':authority\'],') + } + } else { + lines.push(` ${strategy.name}: this.strategies.${key}.deriveConstraint(req, ctx),`) + } + } + + lines.push('}') + + this.deriveSyncConstraints = new Function('req', 'ctx', lines.join('\n')).bind(this) // eslint-disable-line + } +} + +module.exports = Constrainer diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/handler-storage.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/handler-storage.js new file mode 100644 index 0000000000000000000000000000000000000000..d55897b10d6fbe53bddccbee848f2453c9c6b8d4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/handler-storage.js @@ -0,0 +1,174 @@ +'use strict' + +const { NullObject } = require('./null-object') +const httpMethodStrategy = require('./strategies/http-method') + +class HandlerStorage { + constructor () { + this.unconstrainedHandler = null // optimized reference to the handler that will match most of the time + this.constraints = [] + this.handlers = [] // unoptimized list of handler objects for which the fast matcher function will be compiled + this.constrainedHandlerStores = null + } + + // This is the hot path for node handler finding -- change with care! + getMatchingHandler (derivedConstraints) { + if (derivedConstraints === undefined) { + return this.unconstrainedHandler + } + return this._getHandlerMatchingConstraints(derivedConstraints) + } + + addHandler (constrainer, route) { + const params = route.params + const constraints = route.opts.constraints || {} + + const handlerObject = { + params, + constraints, + handler: route.handler, + store: route.store || null, + _createParamsObject: this._compileCreateParamsObject(params) + } + + const constraintsNames = Object.keys(constraints) + if (constraintsNames.length === 0) { + this.unconstrainedHandler = handlerObject + } + + for (const constraint of constraintsNames) { + if (!this.constraints.includes(constraint)) { + if (constraint === 'version') { + // always check the version constraint first as it is the most selective + this.constraints.unshift(constraint) + } else { + this.constraints.push(constraint) + } + } + } + + const isMergedTree = constraintsNames.includes(httpMethodStrategy.name) + if (!isMergedTree && this.handlers.length >= 31) { + throw new Error('find-my-way supports a maximum of 31 route handlers per node when there are constraints, limit reached') + } + + this.handlers.push(handlerObject) + // Sort the most constrained handlers to the front of the list of handlers so they are tested first. + this.handlers.sort((a, b) => Object.keys(a.constraints).length - Object.keys(b.constraints).length) + + if (!isMergedTree) { + this._compileGetHandlerMatchingConstraints(constrainer, constraints) + } + } + + _compileCreateParamsObject (params) { + const fnBody = [] + + fnBody.push('const fn = function _createParamsObject (paramsArray) {') + + fnBody.push('const params = new NullObject()') + for (let i = 0; i < params.length; i++) { + fnBody.push(`params['${params[i]}'] = paramsArray[${i}]`) + } + fnBody.push('return params') + fnBody.push('}') + + fnBody.push('return fn') + + return new Function('NullObject', fnBody.join('\n'))(NullObject) // eslint-disable-line + } + + _getHandlerMatchingConstraints () { + return null + } + + // Builds a store object that maps from constraint values to a bitmap of handler indexes which pass the constraint for a value + // So for a host constraint, this might look like { "fastify.io": 0b0010, "google.ca": 0b0101 }, meaning the 3rd handler is constrainted to fastify.io, and the 2nd and 4th handlers are constrained to google.ca. + // The store's implementation comes from the strategies provided to the Router. + _buildConstraintStore (store, constraint) { + for (let i = 0; i < this.handlers.length; i++) { + const handler = this.handlers[i] + const constraintValue = handler.constraints[constraint] + if (constraintValue !== undefined) { + let indexes = store.get(constraintValue) || 0 + indexes |= 1 << i // set the i-th bit for the mask because this handler is constrained by this value https://stackoverflow.com/questions/1436438/how-do-you-set-clear-and-toggle-a-single-bit-in-javascrip + store.set(constraintValue, indexes) + } + } + } + + // Builds a bitmask for a given constraint that has a bit for each handler index that is 0 when that handler *is* constrained and 1 when the handler *isnt* constrainted. This is opposite to what might be obvious, but is just for convienience when doing the bitwise operations. + _constrainedIndexBitmask (constraint) { + let mask = 0 + for (let i = 0; i < this.handlers.length; i++) { + const handler = this.handlers[i] + const constraintValue = handler.constraints[constraint] + if (constraintValue !== undefined) { + mask |= 1 << i + } + } + return ~mask + } + + // Compile a fast function to match the handlers for this node + // The function implements a general case multi-constraint matching algorithm. + // The general idea is this: we have a bunch of handlers, each with a potentially different set of constraints, and sometimes none at all. We're given a list of constraint values and we have to use the constraint-value-comparison strategies to see which handlers match the constraint values passed in. + // We do this by asking each constraint store which handler indexes match the given constraint value for each store. Trickily, the handlers that a store says match are the handlers constrained by that store, but handlers that aren't constrained at all by that store could still match just fine. So, each constraint store can only describe matches for it, and it won't have any bearing on the handlers it doesn't care about. For this reason, we have to ask each stores which handlers match and track which have been matched (or not cared about) by all of them. + // We use bitmaps to represent these lists of matches so we can use bitwise operations to implement this efficiently. Bitmaps are cheap to allocate, let us implement this masking behaviour in one CPU instruction, and are quite compact in memory. We start with a bitmap set to all 1s representing every handler that is a match candidate, and then for each constraint, see which handlers match using the store, and then mask the result by the mask of handlers that that store applies to, and bitwise AND with the candidate list. Phew. + // We consider all this compiling function complexity to be worth it, because the naive implementation that just loops over the handlers asking which stores match is quite a bit slower. + _compileGetHandlerMatchingConstraints (constrainer) { + this.constrainedHandlerStores = {} + + for (const constraint of this.constraints) { + const store = constrainer.newStoreForConstraint(constraint) + this.constrainedHandlerStores[constraint] = store + + this._buildConstraintStore(store, constraint) + } + + const lines = [] + lines.push(` + let candidates = ${(1 << this.handlers.length) - 1} + let mask, matches + `) + for (const constraint of this.constraints) { + // Setup the mask for indexes this constraint applies to. The mask bits are set to 1 for each position if the constraint applies. + lines.push(` + mask = ${this._constrainedIndexBitmask(constraint)} + value = derivedConstraints.${constraint} + `) + + // If there's no constraint value, none of the handlers constrained by this constraint can match. Remove them from the candidates. + // If there is a constraint value, get the matching indexes bitmap from the store, and mask it down to only the indexes this constraint applies to, and then bitwise and with the candidates list to leave only matching candidates left. + const strategy = constrainer.strategies[constraint] + const matchMask = strategy.mustMatchWhenDerived ? 'matches' : '(matches | mask)' + + lines.push(` + if (value === undefined) { + candidates &= mask + } else { + matches = this.constrainedHandlerStores.${constraint}.get(value) || 0 + candidates &= ${matchMask} + } + if (candidates === 0) return null; + `) + } + + // There are some constraints that can be derived and marked as "must match", where if they are derived, they only match routes that actually have a constraint on the value, like the SemVer version constraint. + // An example: a request comes in for version 1.x, and this node has a handler that matches the path, but there's no version constraint. For SemVer, the find-my-way semantics do not match this handler to that request. + // This function is used by Nodes with handlers to match when they don't have any constrained routes to exclude request that do have must match derived constraints present. + for (const constraint in constrainer.strategies) { + const strategy = constrainer.strategies[constraint] + if (strategy.mustMatchWhenDerived && !this.constraints.includes(constraint)) { + lines.push(`if (derivedConstraints.${constraint} !== undefined) return null`) + } + } + + // Return the first handler who's bit is set in the candidates https://stackoverflow.com/questions/18134985/how-to-find-index-of-first-set-bit + lines.push('return this.handlers[Math.floor(Math.log2(candidates))]') + + this._getHandlerMatchingConstraints = new Function('derivedConstraints', lines.join('\n')) // eslint-disable-line + } +} + +module.exports = HandlerStorage diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/http-methods.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/http-methods.js new file mode 100644 index 0000000000000000000000000000000000000000..c681f7a9af2fa86abbc5ef1e1e83cc5da58afc5c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/http-methods.js @@ -0,0 +1,13 @@ +'use strict' + +// defined by Node.js http module, a snapshot from Node.js 22.9.0 +const httpMethods = [ + 'ACL', 'BIND', 'CHECKOUT', 'CONNECT', 'COPY', 'DELETE', + 'GET', 'HEAD', 'LINK', 'LOCK', 'M-SEARCH', 'MERGE', + 'MKACTIVITY', 'MKCALENDAR', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS', + 'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'QUERY', + 'REBIND', 'REPORT', 'SEARCH', 'SOURCE', 'SUBSCRIBE', 'TRACE', + 'UNBIND', 'UNLINK', 'UNLOCK', 'UNSUBSCRIBE' +] + +module.exports = httpMethods diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/node.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/node.js new file mode 100644 index 0000000000000000000000000000000000000000..f1daea7e07927373c05a5ea684777f230ecd242e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/node.js @@ -0,0 +1,228 @@ +'use strict' + +const HandlerStorage = require('./handler-storage') + +const NODE_TYPES = { + STATIC: 0, + PARAMETRIC: 1, + WILDCARD: 2 +} + +class Node { + constructor () { + this.isLeafNode = false + this.routes = null + this.handlerStorage = null + } + + addRoute (route, constrainer) { + if (this.routes === null) { + this.routes = [] + } + if (this.handlerStorage === null) { + this.handlerStorage = new HandlerStorage() + } + this.isLeafNode = true + this.routes.push(route) + this.handlerStorage.addHandler(constrainer, route) + } +} + +class ParentNode extends Node { + constructor () { + super() + this.staticChildren = {} + } + + findStaticMatchingChild (path, pathIndex) { + const staticChild = this.staticChildren[path.charAt(pathIndex)] + if (staticChild === undefined || !staticChild.matchPrefix(path, pathIndex)) { + return null + } + return staticChild + } + + getStaticChild (path, pathIndex = 0) { + if (path.length === pathIndex) { + return this + } + + const staticChild = this.findStaticMatchingChild(path, pathIndex) + if (staticChild) { + return staticChild.getStaticChild(path, pathIndex + staticChild.prefix.length) + } + + return null + } + + createStaticChild (path) { + if (path.length === 0) { + return this + } + + let staticChild = this.staticChildren[path.charAt(0)] + if (staticChild) { + let i = 1 + for (; i < staticChild.prefix.length; i++) { + if (path.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) { + staticChild = staticChild.split(this, i) + break + } + } + return staticChild.createStaticChild(path.slice(i)) + } + + const label = path.charAt(0) + this.staticChildren[label] = new StaticNode(path) + return this.staticChildren[label] + } +} + +class StaticNode extends ParentNode { + constructor (prefix) { + super() + this.prefix = prefix + this.wildcardChild = null + this.parametricChildren = [] + this.kind = NODE_TYPES.STATIC + this._compilePrefixMatch() + } + + getParametricChild (regex) { + const regexpSource = regex && regex.source + + const parametricChild = this.parametricChildren.find(child => { + const childRegexSource = child.regex && child.regex.source + return childRegexSource === regexpSource + }) + + if (parametricChild) { + return parametricChild + } + + return null + } + + createParametricChild (regex, staticSuffix, nodePath) { + let parametricChild = this.getParametricChild(regex) + if (parametricChild) { + parametricChild.nodePaths.add(nodePath) + return parametricChild + } + + parametricChild = new ParametricNode(regex, staticSuffix, nodePath) + this.parametricChildren.push(parametricChild) + this.parametricChildren.sort((child1, child2) => { + if (!child1.isRegex) return 1 + if (!child2.isRegex) return -1 + + if (child1.staticSuffix === null) return 1 + if (child2.staticSuffix === null) return -1 + + if (child2.staticSuffix.endsWith(child1.staticSuffix)) return 1 + if (child1.staticSuffix.endsWith(child2.staticSuffix)) return -1 + + return 0 + }) + + return parametricChild + } + + getWildcardChild () { + return this.wildcardChild + } + + createWildcardChild () { + this.wildcardChild = this.getWildcardChild() || new WildcardNode() + return this.wildcardChild + } + + split (parentNode, length) { + const parentPrefix = this.prefix.slice(0, length) + const childPrefix = this.prefix.slice(length) + + this.prefix = childPrefix + this._compilePrefixMatch() + + const staticNode = new StaticNode(parentPrefix) + staticNode.staticChildren[childPrefix.charAt(0)] = this + parentNode.staticChildren[parentPrefix.charAt(0)] = staticNode + + return staticNode + } + + getNextNode (path, pathIndex, nodeStack, paramsCount) { + let node = this.findStaticMatchingChild(path, pathIndex) + let parametricBrotherNodeIndex = 0 + + if (node === null) { + if (this.parametricChildren.length === 0) { + return this.wildcardChild + } + + node = this.parametricChildren[0] + parametricBrotherNodeIndex = 1 + } + + if (this.wildcardChild !== null) { + nodeStack.push({ + paramsCount, + brotherPathIndex: pathIndex, + brotherNode: this.wildcardChild + }) + } + + for (let i = this.parametricChildren.length - 1; i >= parametricBrotherNodeIndex; i--) { + nodeStack.push({ + paramsCount, + brotherPathIndex: pathIndex, + brotherNode: this.parametricChildren[i] + }) + } + + return node + } + + _compilePrefixMatch () { + if (this.prefix.length === 1) { + this.matchPrefix = () => true + return + } + + const lines = [] + for (let i = 1; i < this.prefix.length; i++) { + const charCode = this.prefix.charCodeAt(i) + lines.push(`path.charCodeAt(i + ${i}) === ${charCode}`) + } + this.matchPrefix = new Function('path', 'i', `return ${lines.join(' && ')}`) // eslint-disable-line + } +} + +class ParametricNode extends ParentNode { + constructor (regex, staticSuffix, nodePath) { + super() + this.isRegex = !!regex + this.regex = regex || null + this.staticSuffix = staticSuffix || null + this.kind = NODE_TYPES.PARAMETRIC + + this.nodePaths = new Set([nodePath]) + } + + getNextNode (path, pathIndex) { + return this.findStaticMatchingChild(path, pathIndex) + } +} + +class WildcardNode extends Node { + constructor () { + super() + this.kind = NODE_TYPES.WILDCARD + } + + getNextNode () { + return null + } +} + +module.exports = { StaticNode, ParametricNode, WildcardNode, NODE_TYPES } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/null-object.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/null-object.js new file mode 100644 index 0000000000000000000000000000000000000000..0740f04dc407da71cf9e277239fd44495a27cd6c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/null-object.js @@ -0,0 +1,8 @@ +'use strict' + +const NullObject = function () {} +NullObject.prototype = Object.create(null) + +module.exports = { + NullObject +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/pretty-print.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/pretty-print.js new file mode 100644 index 0000000000000000000000000000000000000000..c5db18a8ee8230a90039b940e436c5d031ab94f2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/pretty-print.js @@ -0,0 +1,168 @@ +'use strict' + +const deepEqual = require('fast-deep-equal') + +const httpMethodStrategy = require('./strategies/http-method') +const treeDataSymbol = Symbol('treeData') + +function printObjectTree (obj, parentPrefix = '') { + let tree = '' + const keys = Object.keys(obj) + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + const value = obj[key] + const isLast = i === keys.length - 1 + + const nodePrefix = isLast ? '└── ' : '├── ' + const childPrefix = isLast ? ' ' : '│ ' + + const nodeData = value[treeDataSymbol] || '' + const prefixedNodeData = nodeData.replaceAll('\n', '\n' + parentPrefix + childPrefix) + + tree += parentPrefix + nodePrefix + key + prefixedNodeData + '\n' + tree += printObjectTree(value, parentPrefix + childPrefix) + } + return tree +} + +function parseFunctionName (fn) { + let fName = fn.name || '' + + fName = fName.replace('bound', '').trim() + fName = (fName || 'anonymous') + '()' + return fName +} + +function parseMeta (meta) { + if (Array.isArray(meta)) return meta.map(m => parseMeta(m)) + if (typeof meta === 'symbol') return meta.toString() + if (typeof meta === 'function') return parseFunctionName(meta) + return meta +} + +function getRouteMetaData (route, options) { + if (!options.includeMeta) return {} + + const metaDataObject = options.buildPrettyMeta(route) + const filteredMetaData = {} + + let includeMetaKeys = options.includeMeta + if (!Array.isArray(includeMetaKeys)) { + includeMetaKeys = Reflect.ownKeys(metaDataObject) + } + + for (const metaKey of includeMetaKeys) { + if (!Object.prototype.hasOwnProperty.call(metaDataObject, metaKey)) continue + + const serializedKey = metaKey.toString() + const metaValue = metaDataObject[metaKey] + + if (metaValue !== undefined && metaValue !== null) { + const serializedValue = JSON.stringify(parseMeta(metaValue)) + filteredMetaData[serializedKey] = serializedValue + } + } + + return filteredMetaData +} + +function serializeMetaData (metaData) { + let serializedMetaData = '' + for (const [key, value] of Object.entries(metaData)) { + serializedMetaData += `\n• (${key}) ${value}` + } + return serializedMetaData +} + +// get original merged tree node route +function normalizeRoute (route) { + const constraints = { ...route.opts.constraints } + const method = constraints[httpMethodStrategy.name] + delete constraints[httpMethodStrategy.name] + return { ...route, method, opts: { constraints } } +} + +function serializeRoute (route) { + let serializedRoute = ` (${route.method})` + + const constraints = route.opts.constraints || {} + if (Object.keys(constraints).length !== 0) { + serializedRoute += ' ' + JSON.stringify(constraints) + } + + serializedRoute += serializeMetaData(route.metaData) + return serializedRoute +} + +function mergeSimilarRoutes (routes) { + return routes.reduce((mergedRoutes, route) => { + for (const nodeRoute of mergedRoutes) { + if ( + deepEqual(route.opts.constraints, nodeRoute.opts.constraints) && + deepEqual(route.metaData, nodeRoute.metaData) + ) { + nodeRoute.method += ', ' + route.method + return mergedRoutes + } + } + mergedRoutes.push(route) + return mergedRoutes + }, []) +} + +function serializeNode (node, prefix, options) { + let routes = node.routes + + if (options.method === undefined) { + routes = routes.map(normalizeRoute) + } + + routes = routes.map(route => { + route.metaData = getRouteMetaData(route, options) + return route + }) + + if (options.method === undefined) { + routes = mergeSimilarRoutes(routes) + } + + return routes.map(serializeRoute).join(`\n${prefix}`) +} + +function buildObjectTree (node, tree, prefix, options) { + if (node.isLeafNode || options.commonPrefix !== false) { + prefix = prefix || '(empty root node)' + tree = tree[prefix] = {} + + if (node.isLeafNode) { + tree[treeDataSymbol] = serializeNode(node, prefix, options) + } + + prefix = '' + } + + if (node.staticChildren) { + for (const child of Object.values(node.staticChildren)) { + buildObjectTree(child, tree, prefix + child.prefix, options) + } + } + + if (node.parametricChildren) { + for (const child of Object.values(node.parametricChildren)) { + const childPrefix = Array.from(child.nodePaths).join('|') + buildObjectTree(child, tree, prefix + childPrefix, options) + } + } + + if (node.wildcardChild) { + buildObjectTree(node.wildcardChild, tree, '*', options) + } +} + +function prettyPrintTree (root, options) { + const objectTree = {} + buildObjectTree(root, objectTree, root.prefix, options) + return printObjectTree(objectTree) +} + +module.exports = { prettyPrintTree } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/accept-host.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/accept-host.js new file mode 100644 index 0000000000000000000000000000000000000000..c3cf95e9bedcc744f7d5abc3a062dd83653ed65b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/accept-host.js @@ -0,0 +1,36 @@ +'use strict' +const assert = require('node:assert') + +function HostStorage () { + const hosts = new Map() + const regexHosts = [] + return { + get: (host) => { + const exact = hosts.get(host) + if (exact) { + return exact + } + for (const regex of regexHosts) { + if (regex.host.test(host)) { + return regex.value + } + } + }, + set: (host, value) => { + if (host instanceof RegExp) { + regexHosts.push({ host, value }) + } else { + hosts.set(host, value) + } + } + } +} + +module.exports = { + name: 'host', + mustMatchWhenDerived: false, + storage: HostStorage, + validate (value) { + assert(typeof value === 'string' || Object.prototype.toString.call(value) === '[object RegExp]', 'Host should be a string or a RegExp') + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/accept-version.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/accept-version.js new file mode 100644 index 0000000000000000000000000000000000000000..55c8d519bbdd88589f3a9cbe083003ecd0cf6361 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/accept-version.js @@ -0,0 +1,64 @@ +'use strict' + +const assert = require('node:assert') + +function SemVerStore () { + if (!(this instanceof SemVerStore)) { + return new SemVerStore() + } + + this.store = new Map() + this.maxMajor = 0 + this.maxMinors = {} + this.maxPatches = {} +} + +SemVerStore.prototype.set = function (version, store) { + if (typeof version !== 'string') { + throw new TypeError('Version should be a string') + } + let [major, minor, patch] = version.split('.', 3) + + if (isNaN(major)) { + throw new TypeError('Major version must be a numeric value') + } + + major = Number(major) + minor = Number(minor) || 0 + patch = Number(patch) || 0 + + if (major >= this.maxMajor) { + this.maxMajor = major + this.store.set('x', store) + this.store.set('*', store) + this.store.set('x.x', store) + this.store.set('x.x.x', store) + } + + if (minor >= (this.maxMinors[major] || 0)) { + this.maxMinors[major] = minor + this.store.set(`${major}.x`, store) + this.store.set(`${major}.x.x`, store) + } + + if (patch >= (this.maxPatches[`${major}.${minor}`] || 0)) { + this.maxPatches[`${major}.${minor}`] = patch + this.store.set(`${major}.${minor}.x`, store) + } + + this.store.set(`${major}.${minor}.${patch}`, store) + return this +} + +SemVerStore.prototype.get = function (version) { + return this.store.get(version) +} + +module.exports = { + name: 'version', + mustMatchWhenDerived: true, + storage: SemVerStore, + validate (value) { + assert(typeof value === 'string', 'Version should be a string') + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/http-method.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/http-method.js new file mode 100644 index 0000000000000000000000000000000000000000..b61bde00bc24ec38b91cfdb3fe7667d3e667c23f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/strategies/http-method.js @@ -0,0 +1,15 @@ +'use strict' + +module.exports = { + name: '__fmw_internal_strategy_merged_tree_http_method__', + storage: function () { + const handlers = new Map() + return { + get: (type) => { return handlers.get(type) || null }, + set: (type, store) => { handlers.set(type, store) } + } + }, + /* c8 ignore next 1 */ + deriveConstraint: (req) => req.method, + mustMatchWhenDerived: true +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/url-sanitizer.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/url-sanitizer.js new file mode 100644 index 0000000000000000000000000000000000000000..8852f9f59c60f75c40eecfa32c5b7acf13a4884f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/lib/url-sanitizer.js @@ -0,0 +1,96 @@ +'use strict' + +// It must spot all the chars where decodeURIComponent(x) !== decodeURI(x) +// The chars are: # $ & + , / : ; = ? @ +function decodeComponentChar (highCharCode, lowCharCode) { + if (highCharCode === 50) { + if (lowCharCode === 53) return '%' + + if (lowCharCode === 51) return '#' + if (lowCharCode === 52) return '$' + if (lowCharCode === 54) return '&' + if (lowCharCode === 66) return '+' + if (lowCharCode === 98) return '+' + if (lowCharCode === 67) return ',' + if (lowCharCode === 99) return ',' + if (lowCharCode === 70) return '/' + if (lowCharCode === 102) return '/' + return null + } + if (highCharCode === 51) { + if (lowCharCode === 65) return ':' + if (lowCharCode === 97) return ':' + if (lowCharCode === 66) return ';' + if (lowCharCode === 98) return ';' + if (lowCharCode === 68) return '=' + if (lowCharCode === 100) return '=' + if (lowCharCode === 70) return '?' + if (lowCharCode === 102) return '?' + return null + } + if (highCharCode === 52 && lowCharCode === 48) { + return '@' + } + return null +} + +function safeDecodeURI (path, useSemicolonDelimiter) { + let shouldDecode = false + let shouldDecodeParam = false + + let querystring = '' + + for (let i = 1; i < path.length; i++) { + const charCode = path.charCodeAt(i) + + if (charCode === 37) { + const highCharCode = path.charCodeAt(i + 1) + const lowCharCode = path.charCodeAt(i + 2) + + if (decodeComponentChar(highCharCode, lowCharCode) === null) { + shouldDecode = true + } else { + shouldDecodeParam = true + // %25 - encoded % char. We need to encode one more time to prevent double decoding + if (highCharCode === 50 && lowCharCode === 53) { + shouldDecode = true + path = path.slice(0, i + 1) + '25' + path.slice(i + 1) + i += 2 + } + i += 2 + } + // Some systems do not follow RFC and separate the path and query + // string with a `;` character (code 59), e.g. `/foo;jsessionid=123456`. + // Thus, we need to split on `;` as well as `?` and `#` if the useSemicolonDelimiter option is enabled. + } else if (charCode === 63 || charCode === 35 || (charCode === 59 && useSemicolonDelimiter)) { + querystring = path.slice(i + 1) + path = path.slice(0, i) + break + } + } + const decodedPath = shouldDecode ? decodeURI(path) : path + return { path: decodedPath, querystring, shouldDecodeParam } +} + +function safeDecodeURIComponent (uriComponent) { + const startIndex = uriComponent.indexOf('%') + if (startIndex === -1) return uriComponent + + let decoded = '' + let lastIndex = startIndex + + for (let i = startIndex; i < uriComponent.length; i++) { + if (uriComponent.charCodeAt(i) === 37) { + const highCharCode = uriComponent.charCodeAt(i + 1) + const lowCharCode = uriComponent.charCodeAt(i + 2) + + const decodedChar = decodeComponentChar(highCharCode, lowCharCode) + decoded += uriComponent.slice(lastIndex, i) + decodedChar + + lastIndex = i + 3 + } + } + return uriComponent.slice(0, startIndex) + decoded + uriComponent.slice(lastIndex) +} + +module.exports = { safeDecodeURI, safeDecodeURIComponent } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/case-insensitive.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/case-insensitive.test.js new file mode 100644 index 0000000000000000000000000000000000000000..db73dc396838f07d298649c7e3ed4389569b8636 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/case-insensitive.test.js @@ -0,0 +1,230 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('case insensitive static routes of level 1', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/woo', (req, res, params) => { + t.assert.ok('we should be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/WOO', headers: {} }, null) +}) + +test('case insensitive static routes of level 2', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/woo', (req, res, params) => { + t.assert.ok('we should be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/FoO/WOO', headers: {} }, null) +}) + +test('case insensitive static routes of level 3', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/bar/woo', (req, res, params) => { + t.assert.ok('we should be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/Foo/bAR/WoO', headers: {} }, null) +}) + +test('parametric case insensitive', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/:param', (req, res, params) => { + t.assert.equal(params.param, 'bAR') + }) + + findMyWay.lookup({ method: 'GET', url: '/Foo/bAR', headers: {} }, null) +}) + +test('parametric case insensitive with a static part', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/my-:param', (req, res, params) => { + t.assert.equal(params.param, 'bAR') + }) + + findMyWay.lookup({ method: 'GET', url: '/Foo/MY-bAR', headers: {} }, null) +}) + +test('parametric case insensitive with capital letter', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/:Param', (req, res, params) => { + t.assert.equal(params.Param, 'bAR') + }) + + findMyWay.lookup({ method: 'GET', url: '/Foo/bAR', headers: {} }, null) +}) + +test('case insensitive with capital letter in static path with param', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/Foo/bar/:param', (req, res, params) => { + t.assert.equal(params.param, 'baZ') + }) + + findMyWay.lookup({ method: 'GET', url: '/foo/bar/baZ', headers: {} }, null) +}) + +test('case insensitive with multiple paths containing capital letter in static path with param', t => { + /* + * This is a reproduction of the issue documented at + * https://github.com/delvedor/find-my-way/issues/96. + */ + t.plan(2) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/Foo/bar/:param', (req, res, params) => { + t.assert.equal(params.param, 'baZ') + }) + + findMyWay.on('GET', '/Foo/baz/:param', (req, res, params) => { + t.assert.equal(params.param, 'baR') + }) + + findMyWay.lookup({ method: 'GET', url: '/foo/bar/baZ', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/foo/baz/baR', headers: {} }, null) +}) + +test('case insensitive with multiple mixed-case params within same slash couple', t => { + t.plan(2) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/:param1-:param2', (req, res, params) => { + t.assert.equal(params.param1, 'My') + t.assert.equal(params.param2, 'bAR') + }) + + findMyWay.lookup({ method: 'GET', url: '/FOO/My-bAR', headers: {} }, null) +}) + +test('case insensitive with multiple mixed-case params', t => { + t.plan(2) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/:param1/:param2', (req, res, params) => { + t.assert.equal(params.param1, 'My') + t.assert.equal(params.param2, 'bAR') + }) + + findMyWay.lookup({ method: 'GET', url: '/FOO/My/bAR', headers: {} }, null) +}) + +test('case insensitive with wildcard', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/*', (req, res, params) => { + t.assert.equal(params['*'], 'baR') + }) + + findMyWay.lookup({ method: 'GET', url: '/FOO/baR', headers: {} }, null) +}) + +test('parametric case insensitive with multiple routes', t => { + t.plan(6) + + const findMyWay = FindMyWay({ + caseSensitive: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('POST', '/foo/:param/Static/:userId/Save', (req, res, params) => { + t.assert.equal(params.param, 'bAR') + t.assert.equal(params.userId, 'one') + }) + findMyWay.on('POST', '/foo/:param/Static/:userId/Update', (req, res, params) => { + t.assert.equal(params.param, 'Bar') + t.assert.equal(params.userId, 'two') + }) + findMyWay.on('POST', '/foo/:param/Static/:userId/CANCEL', (req, res, params) => { + t.assert.equal(params.param, 'bAR') + t.assert.equal(params.userId, 'THREE') + }) + + findMyWay.lookup({ method: 'POST', url: '/foo/bAR/static/one/SAVE', headers: {} }, null) + findMyWay.lookup({ method: 'POST', url: '/fOO/Bar/Static/two/update', headers: {} }, null) + findMyWay.lookup({ method: 'POST', url: '/Foo/bAR/STATIC/THREE/cAnCeL', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom-versioning.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom-versioning.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2e839ebfd1318fc74af50e6a0a4090f3f72a39aa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom-versioning.test.js @@ -0,0 +1,130 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') +const noop = () => { } + +const customVersioning = { + name: 'version', + // storage factory + storage: function () { + let versions = {} + return { + get: (version) => { return versions[version] || null }, + set: (version, store) => { versions[version] = store }, + del: (version) => { delete versions[version] }, + empty: () => { versions = {} } + } + }, + deriveConstraint: (req, ctx) => { + return req.headers.accept + } +} + +test('A route could support multiple versions (find) / 1', t => { + t.plan(5) + + const findMyWay = FindMyWay({ constraints: { version: customVersioning } }) + + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=2' } }, noop) + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=3' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=2' })) + t.assert.ok(findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=3' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=4' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=5' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=6' })) +}) + +test('A route could support multiple versions (find) / 1 (add strategy outside constructor)', t => { + t.plan(5) + + const findMyWay = FindMyWay() + + findMyWay.addConstraintStrategy(customVersioning) + + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=2' } }, noop) + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=3' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=2' })) + t.assert.ok(findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=3' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=4' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=5' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: 'application/vnd.example.api+json;version=6' })) +}) + +test('Overriding default strategies uses the custom deriveConstraint function', t => { + t.plan(2) + + const findMyWay = FindMyWay({ constraints: { version: customVersioning } }) + + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=2' } }, (req, res, params) => { + t.assert.equal(req.headers.accept, 'application/vnd.example.api+json;version=2') + }) + + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=3' } }, (req, res, params) => { + t.assert.equal(req.headers.accept, 'application/vnd.example.api+json;version=3') + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { accept: 'application/vnd.example.api+json;version=2' } + }) + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { accept: 'application/vnd.example.api+json;version=3' } + }) +}) + +test('Overriding default strategies uses the custom deriveConstraint function (add strategy outside constructor)', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.addConstraintStrategy(customVersioning) + + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=2' } }, (req, res, params) => { + t.assert.equal(req.headers.accept, 'application/vnd.example.api+json;version=2') + }) + + findMyWay.on('GET', '/', { constraints: { version: 'application/vnd.example.api+json;version=3' } }, (req, res, params) => { + t.assert.equal(req.headers.accept, 'application/vnd.example.api+json;version=3') + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { accept: 'application/vnd.example.api+json;version=2' } + }) + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { accept: 'application/vnd.example.api+json;version=3' } + }) +}) + +test('Overriding custom strategies throws as error (add strategy outside constructor)', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.addConstraintStrategy(customVersioning) + + t.assert.throws(() => findMyWay.addConstraintStrategy(customVersioning), + new Error('There already exists a custom constraint with the name version.') + ) +}) + +test('Overriding default strategies after defining a route with constraint', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io', version: '1.0.0' } }, () => {}) + + t.assert.throws(() => findMyWay.addConstraintStrategy(customVersioning), + new Error('There already exists a route with version constraint.') + ) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom.async.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom.async.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4cfe2b356f279accb20bbd8c5141f65bb408a777 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom.async.test.js @@ -0,0 +1,111 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') +const rfdc = require('rfdc')({ proto: true }) + +const customHeaderConstraint = { + name: 'requestedBy', + storage: function () { + const requestedBys = {} + return { + get: (requestedBy) => { return requestedBys[requestedBy] || null }, + set: (requestedBy, store) => { requestedBys[requestedBy] = store } + } + }, + deriveConstraint: (req, ctx, done) => { + if (req.headers['user-agent'] === 'wrong') { + done(new Error('wrong user-agent')) + return + } + + done(null, req.headers['user-agent']) + } +} + +test('should derive multiple async constraints', t => { + t.plan(2) + + const customHeaderConstraint2 = rfdc(customHeaderConstraint) + customHeaderConstraint2.name = 'requestedBy2' + + const router = FindMyWay({ constraints: { requestedBy: customHeaderConstraint, requestedBy2: customHeaderConstraint2 } }) + router.on('GET', '/', { constraints: { requestedBy: 'node', requestedBy2: 'node' } }, () => 'asyncHandler') + + router.lookup( + { + method: 'GET', + url: '/', + headers: { + 'user-agent': 'node' + } + }, + null, + (err, result) => { + t.assert.equal(err, null) + t.assert.equal(result, 'asyncHandler') + } + ) +}) + +test('lookup should return an error from deriveConstraint', t => { + t.plan(2) + + const router = FindMyWay({ constraints: { requestedBy: customHeaderConstraint } }) + router.on('GET', '/', { constraints: { requestedBy: 'node' } }, () => 'asyncHandler') + + router.lookup( + { + method: 'GET', + url: '/', + headers: { + 'user-agent': 'wrong' + } + }, + null, + (err, result) => { + t.assert.deepStrictEqual(err, new Error('wrong user-agent')) + t.assert.equal(result, undefined) + } + ) +}) + +test('should derive sync and async constraints', t => { + t.plan(4) + + const router = FindMyWay({ constraints: { requestedBy: customHeaderConstraint } }) + router.on('GET', '/', { constraints: { version: '1.0.0', requestedBy: 'node' } }, () => 'asyncHandlerV1') + router.on('GET', '/', { constraints: { version: '2.0.0', requestedBy: 'node' } }, () => 'asyncHandlerV2') + + router.lookup( + { + method: 'GET', + url: '/', + headers: { + 'user-agent': 'node', + 'accept-version': '1.0.0' + } + }, + null, + (err, result) => { + t.assert.equal(err, null) + t.assert.equal(result, 'asyncHandlerV1') + } + ) + + router.lookup( + { + method: 'GET', + url: '/', + headers: { + 'user-agent': 'node', + 'accept-version': '2.0.0' + } + }, + null, + (err, result) => { + t.assert.equal(err, null) + t.assert.equal(result, 'asyncHandlerV2') + } + ) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom.test.js new file mode 100644 index 0000000000000000000000000000000000000000..91aa5548842a83da629471a2f627664f056a4141 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.custom.test.js @@ -0,0 +1,273 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') +const alpha = () => { } +const beta = () => { } +const gamma = () => { } +const delta = () => { } + +const customHeaderConstraint = { + name: 'requestedBy', + storage: function () { + let requestedBys = {} + return { + get: (requestedBy) => { return requestedBys[requestedBy] || null }, + set: (requestedBy, store) => { requestedBys[requestedBy] = store }, + del: (requestedBy) => { delete requestedBys[requestedBy] }, + empty: () => { requestedBys = {} } + } + }, + deriveConstraint: (req, ctx) => { + return req.headers['user-agent'] + } +} + +test('A route could support a custom constraint strategy', t => { + t.plan(3) + + const findMyWay = FindMyWay({ constraints: { requestedBy: customHeaderConstraint } }) + + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl' } }, alpha) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget' } }, beta) + + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'wget' }).handler, beta) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome' })) +}) + +test('A route could support a custom constraint strategy (add strategy outside constructor)', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.addConstraintStrategy(customHeaderConstraint) + + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl' } }, alpha) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget' } }, beta) + + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'wget' }).handler, beta) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome' })) +}) + +test('A route could support a custom constraint strategy while versioned', t => { + t.plan(8) + + const findMyWay = FindMyWay({ constraints: { requestedBy: customHeaderConstraint } }) + + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '1.0.0' } }, alpha) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '2.0.0' } }, beta) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget', version: '2.0.0' } }, gamma) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget', version: '3.0.0' } }, delta) + + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'wget', version: '2.x' }).handler, gamma) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'wget', version: '3.x' }).handler, delta) + + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome', version: '1.x' })) + + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '3.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'wget', version: '1.x' })) +}) + +test('A route could support a custom constraint strategy while versioned (add strategy outside constructor)', t => { + t.plan(8) + + const findMyWay = FindMyWay() + + findMyWay.addConstraintStrategy(customHeaderConstraint) + + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '1.0.0' } }, alpha) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '2.0.0' } }, beta) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget', version: '2.0.0' } }, gamma) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget', version: '3.0.0' } }, delta) + + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'wget', version: '2.x' }).handler, gamma) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'wget', version: '3.x' }).handler, delta) + + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome', version: '1.x' })) + + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '3.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'wget', version: '1.x' })) +}) + +test('A route could support a custom constraint strategy while versioned and host constrained', t => { + t.plan(9) + + const findMyWay = FindMyWay({ constraints: { requestedBy: customHeaderConstraint } }) + + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '1.0.0', host: 'fastify.io' } }, alpha) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '2.0.0', host: 'fastify.io' } }, beta) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '2.0.0', host: 'example.io' } }, delta) + + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x', host: 'fastify.io' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x', host: 'fastify.io' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x', host: 'example.io' }).handler, delta) + + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome', version: '1.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '3.x', host: 'fastify.io' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x', host: 'example.io' })) +}) + +test('A route could support a custom constraint strategy while versioned and host constrained (add strategy outside constructor)', t => { + t.plan(9) + + const findMyWay = FindMyWay() + + findMyWay.addConstraintStrategy(customHeaderConstraint) + + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '1.0.0', host: 'fastify.io' } }, alpha) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '2.0.0', host: 'fastify.io' } }, beta) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl', version: '2.0.0', host: 'example.io' } }, delta) + + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x', host: 'fastify.io' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x', host: 'fastify.io' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x', host: 'example.io' }).handler, delta) + + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'chrome', version: '1.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '3.x', host: 'fastify.io' })) + t.assert.ok(!findMyWay.find('GET', '/', { requestedBy: 'curl', version: '1.x', host: 'example.io' })) +}) + +test('Custom constraint strategies can set mustMatchWhenDerived flag to true which prevents matches to unconstrained routes when a constraint is derived and there are no other routes', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + constraints: { + requestedBy: { + ...customHeaderConstraint, + mustMatchWhenDerived: true + } + }, + defaultRoute (req, res) { + t.assert.ok('pass') + } + }) + + findMyWay.on('GET', '/', {}, () => t.assert.assert.fail()) + + findMyWay.lookup({ method: 'GET', url: '/', headers: { 'user-agent': 'node' } }, null) +}) + +test('Custom constraint strategies can set mustMatchWhenDerived flag to true which prevents matches to unconstrained routes when a constraint is derived and there are no other routes (add strategy outside constructor)', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + defaultRoute (req, res) { + t.assert.ok('pass') + } + }) + + findMyWay.addConstraintStrategy({ + ...customHeaderConstraint, + mustMatchWhenDerived: true + }) + + findMyWay.on('GET', '/', {}, () => t.assert.assert.fail()) + + findMyWay.lookup({ method: 'GET', url: '/', headers: { 'user-agent': 'node' } }, null) +}) + +test('Custom constraint strategies can set mustMatchWhenDerived flag to true which prevents matches to unconstrained routes when a constraint is derived when there are constrained routes', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + constraints: { + requestedBy: { + ...customHeaderConstraint, + mustMatchWhenDerived: true + } + }, + defaultRoute (req, res) { + t.assert.ok('pass') + } + }) + + findMyWay.on('GET', '/', {}, () => t.assert.assert.fail()) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl' } }, () => t.assert.assert.fail()) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget' } }, () => t.assert.assert.fail()) + + findMyWay.lookup({ method: 'GET', url: '/', headers: { 'user-agent': 'node' } }, null) +}) + +test('Custom constraint strategies can set mustMatchWhenDerived flag to true which prevents matches to unconstrained routes when a constraint is derived when there are constrained routes (add strategy outside constructor)', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + defaultRoute (req, res) { + t.assert.ok('pass') + } + }) + + findMyWay.addConstraintStrategy({ + ...customHeaderConstraint, + mustMatchWhenDerived: true + }) + + findMyWay.on('GET', '/', {}, () => t.assert.assert.fail()) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'curl' } }, () => t.assert.assert.fail()) + findMyWay.on('GET', '/', { constraints: { requestedBy: 'wget' } }, () => t.assert.assert.fail()) + + findMyWay.lookup({ method: 'GET', url: '/', headers: { 'user-agent': 'node' } }, null) +}) + +test('Custom constraint strategies can set mustMatchWhenDerived flag to false which allows matches to unconstrained routes when a constraint is derived', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + constraints: { + requestedBy: { + ...customHeaderConstraint, + mustMatchWhenDerived: false + } + }, + defaultRoute (req, res) { + t.assert.assert.fail() + } + }) + + findMyWay.on('GET', '/', {}, () => t.assert.ok('pass')) + + findMyWay.lookup({ method: 'GET', url: '/', headers: { 'user-agent': 'node' } }, null) +}) + +test('Custom constraint strategies can set mustMatchWhenDerived flag to false which allows matches to unconstrained routes when a constraint is derived (add strategy outside constructor)', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + defaultRoute (req, res) { + t.assert.ok('pass') + } + }) + + findMyWay.addConstraintStrategy({ + ...customHeaderConstraint, + mustMatchWhenDerived: true + }) + + findMyWay.on('GET', '/', {}, () => t.assert.ok('pass')) + + findMyWay.lookup({ method: 'GET', url: '/', headers: { 'user-agent': 'node' } }, null) +}) + +test('Has constraint strategy method test', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + t.assert.deepEqual(findMyWay.hasConstraintStrategy(customHeaderConstraint.name), false) + findMyWay.addConstraintStrategy(customHeaderConstraint) + t.assert.deepEqual(findMyWay.hasConstraintStrategy(customHeaderConstraint.name), true) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.default-versioning.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.default-versioning.test.js new file mode 100644 index 0000000000000000000000000000000000000000..08adf49096b6c1d60fc55128ca787724a9346913 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.default-versioning.test.js @@ -0,0 +1,289 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') +const noop = () => { } + +test('A route could support multiple versions (find) / 1', t => { + t.plan(7) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { version: '1.2.3' } }, noop) + findMyWay.on('GET', '/', { constraints: { version: '3.2.0' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/', { version: '1.x' })) + t.assert.ok(findMyWay.find('GET', '/', { version: '1.2.3' })) + t.assert.ok(findMyWay.find('GET', '/', { version: '3.x' })) + t.assert.ok(findMyWay.find('GET', '/', { version: '3.2.0' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: '2.3.4' })) + t.assert.ok(!findMyWay.find('GET', '/', { version: '3.2.1' })) +}) + +test('A route could support multiple versions (find) / 2', t => { + t.plan(7) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', { constraints: { version: '1.2.3' } }, noop) + findMyWay.on('GET', '/test', { constraints: { version: '3.2.0' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/test', { version: '1.x' })) + t.assert.ok(findMyWay.find('GET', '/test', { version: '1.2.3' })) + t.assert.ok(findMyWay.find('GET', '/test', { version: '3.x' })) + t.assert.ok(findMyWay.find('GET', '/test', { version: '3.2.0' })) + t.assert.ok(!findMyWay.find('GET', '/test', { version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/test', { version: '2.3.4' })) + t.assert.ok(!findMyWay.find('GET', '/test', { version: '3.2.1' })) +}) + +test('A route could support multiple versions (find) / 3', t => { + t.plan(10) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:id/hello', { constraints: { version: '1.2.3' } }, noop) + findMyWay.on('GET', '/test/:id/hello', { constraints: { version: '3.2.0' } }, noop) + findMyWay.on('GET', '/test/name/hello', { constraints: { version: '4.0.0' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/test/1234/hello', { version: '1.x' })) + t.assert.ok(findMyWay.find('GET', '/test/1234/hello', { version: '1.2.3' })) + t.assert.ok(findMyWay.find('GET', '/test/1234/hello', { version: '3.x' })) + t.assert.ok(findMyWay.find('GET', '/test/1234/hello', { version: '3.2.0' })) + t.assert.ok(findMyWay.find('GET', '/test/name/hello', { version: '4.x' })) + t.assert.ok(findMyWay.find('GET', '/test/name/hello', { version: '3.x' })) + t.assert.ok(!findMyWay.find('GET', '/test/1234/hello', { version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/test/1234/hello', { version: '2.3.4' })) + t.assert.ok(!findMyWay.find('GET', '/test/1234/hello', { version: '3.2.1' })) + t.assert.ok(!findMyWay.find('GET', '/test/1234/hello', { version: '4.x' })) +}) + +test('A route could support multiple versions (find) / 4', t => { + t.plan(8) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/*', { constraints: { version: '1.2.3' } }, noop) + findMyWay.on('GET', '/test/hello', { constraints: { version: '3.2.0' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/test/1234/hello', { version: '1.x' })) + t.assert.ok(findMyWay.find('GET', '/test/1234/hello', { version: '1.2.3' })) + t.assert.ok(findMyWay.find('GET', '/test/hello', { version: '3.x' })) + t.assert.ok(findMyWay.find('GET', '/test/hello', { version: '3.2.0' })) + t.assert.ok(!findMyWay.find('GET', '/test/1234/hello', { version: '3.2.0' })) + t.assert.ok(!findMyWay.find('GET', '/test/1234/hello', { version: '3.x' })) + t.assert.ok(!findMyWay.find('GET', '/test/1234/hello', { version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/test/hello', { version: '2.x' })) +}) + +test('A route could support multiple versions (find) / 5', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { version: '1.2.3' } }, () => false) + findMyWay.on('GET', '/', { constraints: { version: '3.2.0' } }, () => true) + + t.assert.ok(findMyWay.find('GET', '/', { version: '*' }).handler()) +}) + +test('Find with a version but without versioned routes', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', noop) + + t.assert.ok(!findMyWay.find('GET', '/', { version: '1.x' })) +}) + +test('A route could support multiple versions (lookup)', t => { + t.plan(7) + + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + const versions = ['2.x', '2.3.4', '3.2.1'] + t.assert.ok(versions.indexOf(req.headers['accept-version']) > -1) + } + }) + + findMyWay.on('GET', '/', { constraints: { version: '1.2.3' } }, (req, res) => { + const versions = ['1.x', '1.2.3'] + t.assert.ok(versions.indexOf(req.headers['accept-version']) > -1) + }) + + findMyWay.on('GET', '/', { constraints: { version: '3.2.0' } }, (req, res) => { + const versions = ['3.x', '3.2.0'] + t.assert.ok(versions.indexOf(req.headers['accept-version']) > -1) + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '1.x' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '1.2.3' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '3.x' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '3.2.0' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '2.x' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '2.3.4' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '3.2.1' } + }, null) +}) + +test('It should always choose the highest version of a route', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { version: '2.3.0' } }, (req, res) => { + t.assert.fail('We should not be here') + }) + + findMyWay.on('GET', '/', { constraints: { version: '2.4.0' } }, (req, res) => { + t.assert.ok('Yeah!') + }) + + findMyWay.on('GET', '/', { constraints: { version: '3.3.0' } }, (req, res) => { + t.assert.ok('Yeah!') + }) + + findMyWay.on('GET', '/', { constraints: { version: '3.2.0' } }, (req, res) => { + t.assert.fail('We should not be here') + }) + + findMyWay.on('GET', '/', { constraints: { version: '3.2.2' } }, (req, res) => { + t.assert.fail('We should not be here') + }) + + findMyWay.on('GET', '/', { constraints: { version: '4.4.0' } }, (req, res) => { + t.assert.fail('We should not be here') + }) + + findMyWay.on('GET', '/', { constraints: { version: '4.3.2' } }, (req, res) => { + t.assert.ok('Yeah!') + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '2.x' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '3.x' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '4.3.x' } + }, null) +}) + +test('Declare the same route with and without version', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', noop) + findMyWay.on('GET', '/', { constraints: { version: '1.2.0' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/', { version: '1.x' })) + t.assert.ok(findMyWay.find('GET', '/', {})) +}) + +test('It should throw if you declare multiple times the same route', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { version: '1.2.3' } }, noop) + + try { + findMyWay.on('GET', '/', { constraints: { version: '1.2.3' } }, noop) + t.assert.fail('It should throw') + } catch (err) { + t.assert.equal(err.message, 'Method \'GET\' already declared for route \'/\' with constraints \'{"version":"1.2.3"}\'') + } +}) + +test('Versioning won\'t work if there are no versioned routes', t => { + t.plan(2) + + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('We should not be here') + } + }) + + findMyWay.on('GET', '/', (req, res) => { + t.assert.ok('Yeah!') + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '2.x' } + }, null) + + findMyWay.lookup({ + method: 'GET', + url: '/' + }, null) +}) + +test('Unversioned routes aren\'t triggered when unknown versions are requested', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('We should be here') + } + }) + + findMyWay.on('GET', '/', (req, res) => { + t.assert.fail('unversioned route shouldnt be hit!') + }) + findMyWay.on('GET', '/', { constraints: { version: '1.0.0' } }, (req, res) => { + t.assert.fail('versioned route shouldnt be hit for wrong version!') + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { 'accept-version': '2.x' } + }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.host.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.host.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a53796f1bb50645ef193971786fe1cd45724cc15 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraint.host.test.js @@ -0,0 +1,104 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') +const alpha = () => { } +const beta = () => { } +const gamma = () => { } + +test('A route supports multiple host constraints', t => { + t.plan(4) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', {}, alpha) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, beta) + findMyWay.on('GET', '/', { constraints: { host: 'example.com' } }, gamma) + + t.assert.equal(findMyWay.find('GET', '/', {}).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { host: 'something-else.io' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'example.com' }).handler, gamma) +}) + +test('A route supports wildcard host constraints', t => { + t.plan(4) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, beta) + findMyWay.on('GET', '/', { constraints: { host: /.*\.fastify\.io/ } }, gamma) + + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'foo.fastify.io' }).handler, gamma) + t.assert.equal(findMyWay.find('GET', '/', { host: 'bar.fastify.io' }).handler, gamma) + t.assert.ok(!findMyWay.find('GET', '/', { host: 'example.com' })) +}) + +test('A route supports multiple host constraints (lookup)', t => { + t.plan(4) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', {}, (req, res) => {}) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, (req, res) => { + t.assert.equal(req.headers.host, 'fastify.io') + }) + findMyWay.on('GET', '/', { constraints: { host: 'example.com' } }, (req, res) => { + t.assert.equal(req.headers.host, 'example.com') + }) + findMyWay.on('GET', '/', { constraints: { host: /.+\.fancy\.ca/ } }, (req, res) => { + t.assert.ok(req.headers.host.endsWith('.fancy.ca')) + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { host: 'fastify.io' } + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { host: 'example.com' } + }) + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { host: 'foo.fancy.ca' } + }) + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { host: 'bar.fancy.ca' } + }) +}) + +test('A route supports up to 31 host constraints', (t) => { + t.plan(1) + + const findMyWay = FindMyWay() + + for (let i = 0; i < 31; i++) { + const host = `h${i.toString().padStart(2, '0')}` + findMyWay.on('GET', '/', { constraints: { host } }, alpha) + } + + t.assert.equal(findMyWay.find('GET', '/', { host: 'h01' }).handler, alpha) +}) + +test('A route throws when constraint limit exceeded', (t) => { + t.plan(1) + + const findMyWay = FindMyWay() + + for (let i = 0; i < 31; i++) { + const host = `h${i.toString().padStart(2, '0')}` + findMyWay.on('GET', '/', { constraints: { host } }, alpha) + } + + t.assert.throws( + () => findMyWay.on('GET', '/', { constraints: { host: 'h31' } }, beta), + new Error('find-my-way supports a maximum of 31 route handlers per node when there are constraints, limit reached') + ) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraints.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraints.test.js new file mode 100644 index 0000000000000000000000000000000000000000..67bf8d8102373c2b61327d4bc61d49af5488494a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/constraints.test.js @@ -0,0 +1,108 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') +const alpha = () => { } +const beta = () => { } +const gamma = () => { } + +test('A route could support multiple host constraints while versioned', t => { + t.plan(6) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io', version: '1.1.0' } }, beta) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io', version: '2.1.0' } }, gamma) + + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '1.x' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '1.1.x' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.x' }).handler, gamma) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.1.x' }).handler, gamma) + t.assert.ok(!findMyWay.find('GET', '/', { host: 'fastify.io', version: '3.x' })) + t.assert.ok(!findMyWay.find('GET', '/', { host: 'something-else.io', version: '1.x' })) +}) + +test('Constrained routes are matched before unconstrainted routes when the constrained route is added last', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', {}, alpha) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, beta) + + t.assert.equal(findMyWay.find('GET', '/', {}).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'example.com' }).handler, alpha) +}) + +test('Constrained routes are matched before unconstrainted routes when the constrained route is added first', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, beta) + findMyWay.on('GET', '/', {}, alpha) + + t.assert.equal(findMyWay.find('GET', '/', {}).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'example.com' }).handler, alpha) +}) + +test('Routes with multiple constraints are matched before routes with one constraint when the doubly-constrained route is added last', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, alpha) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io', version: '1.0.0' } }, beta) + + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '1.0.0' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.0.0' }), null) +}) + +test('Routes with multiple constraints are matched before routes with one constraint when the doubly-constrained route is added first', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io', version: '1.0.0' } }, beta) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, alpha) + + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io' }).handler, alpha) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '1.0.0' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.0.0' }), null) +}) + +test('Routes with multiple constraints are matched before routes with one constraint before unconstrained routes', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io', version: '1.0.0' } }, beta) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, alpha) + findMyWay.on('GET', '/', { constraints: {} }, gamma) + + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '1.0.0' }).handler, beta) + t.assert.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.0.0' }), null) + t.assert.equal(findMyWay.find('GET', '/', { host: 'example.io' }).handler, gamma) +}) + +test('Has constraint strategy method test', t => { + t.plan(6) + + const findMyWay = FindMyWay() + + t.assert.deepEqual(findMyWay.hasConstraintStrategy('version'), false) + t.assert.deepEqual(findMyWay.hasConstraintStrategy('host'), false) + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, () => {}) + + t.assert.deepEqual(findMyWay.hasConstraintStrategy('version'), false) + t.assert.deepEqual(findMyWay.hasConstraintStrategy('host'), true) + + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io', version: '1.0.0' } }, () => {}) + + t.assert.deepEqual(findMyWay.hasConstraintStrategy('version'), true) + t.assert.deepEqual(findMyWay.hasConstraintStrategy('host'), true) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/custom-querystring-parser.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/custom-querystring-parser.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e2bd620a046f945f7586cc639c7ccf3ab0ea511c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/custom-querystring-parser.test.js @@ -0,0 +1,46 @@ +'use strict' + +const { test } = require('node:test') +const querystring = require('fast-querystring') +const FindMyWay = require('../') + +test('Custom querystring parser', t => { + t.plan(2) + + const findMyWay = FindMyWay({ + querystringParser: function (str) { + t.assert.equal(str, 'foo=bar&baz=faz') + return querystring.parse(str) + } + }) + findMyWay.on('GET', '/', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/?foo=bar&baz=faz').searchParams, { foo: 'bar', baz: 'faz' }) +}) + +test('Custom querystring parser should be called also if there is nothing to parse', t => { + t.plan(2) + + const findMyWay = FindMyWay({ + querystringParser: function (str) { + t.assert.equal(str, '') + return querystring.parse(str) + } + }) + findMyWay.on('GET', '/', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/').searchParams, {}) +}) + +test('Querystring without value', t => { + t.plan(2) + + const findMyWay = FindMyWay({ + querystringParser: function (str) { + t.assert.equal(str, 'foo') + return querystring.parse(str) + } + }) + findMyWay.on('GET', '/', () => {}) + t.assert.deepEqual(findMyWay.find('GET', '/?foo').searchParams, { foo: '' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/errors.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/errors.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9a003fe37a55d69973fa1da71f52c8d046ec01bb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/errors.test.js @@ -0,0 +1,484 @@ +'use strict' + +const { test, describe } = require('node:test') +const FindMyWay = require('../') + +test('Method should be a string', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on(0, '/test', () => {}) + t.assert.fail('method shoukd be a string') + } catch (e) { + t.assert.equal(e.message, 'Method should be a string') + } +}) + +test('Method should be a string [ignoreTrailingSlash=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + try { + findMyWay.on(0, '/test', () => {}) + t.assert.fail('method shoukd be a string') + } catch (e) { + t.assert.equal(e.message, 'Method should be a string') + } +}) + +test('Method should be a string [ignoreDuplicateSlashes=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + try { + findMyWay.on(0, '/test', () => {}) + t.assert.fail('method shoukd be a string') + } catch (e) { + t.assert.equal(e.message, 'Method should be a string') + } +}) + +test('Method should be a string (array)', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on(['GET', 0], '/test', () => {}) + t.assert.fail('method shoukd be a string') + } catch (e) { + t.assert.equal(e.message, 'Method should be a string') + } +}) + +test('Method should be a string (array) [ignoreTrailingSlash=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + try { + findMyWay.on(['GET', 0], '/test', () => {}) + t.assert.fail('method shoukd be a string') + } catch (e) { + t.assert.equal(e.message, 'Method should be a string') + } +}) + +test('Method should be a string (array) [ignoreDuplicateSlashes=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + try { + findMyWay.on(['GET', 0], '/test', () => {}) + t.assert.fail('method shoukd be a string') + } catch (e) { + t.assert.equal(e.message, 'Method should be a string') + } +}) + +test('Path should be a string', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on('GET', 0, () => {}) + t.assert.fail('path should be a string') + } catch (e) { + t.assert.equal(e.message, 'Path should be a string') + } +}) + +test('Path should be a string [ignoreTrailingSlash=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + try { + findMyWay.on('GET', 0, () => {}) + t.assert.fail('path should be a string') + } catch (e) { + t.assert.equal(e.message, 'Path should be a string') + } +}) + +test('Path should be a string [ignoreDuplicateSlashes=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + try { + findMyWay.on('GET', 0, () => {}) + t.assert.fail('path should be a string') + } catch (e) { + t.assert.equal(e.message, 'Path should be a string') + } +}) + +test('The path could not be empty', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on('GET', '', () => {}) + t.assert.fail('The path could not be empty') + } catch (e) { + t.assert.equal(e.message, 'The path could not be empty') + } +}) + +test('The path could not be empty [ignoreTrailingSlash=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + try { + findMyWay.on('GET', '', () => {}) + t.assert.fail('The path could not be empty') + } catch (e) { + t.assert.equal(e.message, 'The path could not be empty') + } +}) + +test('The path could not be empty [ignoreDuplicateSlashes=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + try { + findMyWay.on('GET', '', () => {}) + t.assert.fail('The path could not be empty') + } catch (e) { + t.assert.equal(e.message, 'The path could not be empty') + } +}) + +test('The first character of a path should be `/` or `*`', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on('GET', 'a', () => {}) + t.assert.fail('The first character of a path should be `/` or `*`') + } catch (e) { + t.assert.equal(e.message, 'The first character of a path should be `/` or `*`') + } +}) + +test('The first character of a path should be `/` or `*` [ignoreTrailingSlash=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + try { + findMyWay.on('GET', 'a', () => {}) + t.assert.fail('The first character of a path should be `/` or `*`') + } catch (e) { + t.assert.equal(e.message, 'The first character of a path should be `/` or `*`') + } +}) + +test('The first character of a path should be `/` or `*` [ignoreDuplicateSlashes=true]', t => { + t.plan(1) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + try { + findMyWay.on('GET', 'a', () => {}) + t.assert.fail('The first character of a path should be `/` or `*`') + } catch (e) { + t.assert.equal(e.message, 'The first character of a path should be `/` or `*`') + } +}) + +test('Handler should be a function', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on('GET', '/test', 0) + t.assert.fail('handler should be a function') + } catch (e) { + t.assert.equal(e.message, 'Handler should be a function') + } +}) + +test('Method is not an http method.', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on('GETT', '/test', () => {}) + t.assert.fail('method is not a valid http method') + } catch (e) { + t.assert.equal(e.message, 'Method \'GETT\' is not an http method.') + } +}) + +test('Method is not an http method. (array)', t => { + t.plan(1) + const findMyWay = FindMyWay() + + try { + findMyWay.on(['POST', 'GETT'], '/test', () => {}) + t.assert.fail('method is not a valid http method') + } catch (e) { + t.assert.equal(e.message, 'Method \'GETT\' is not an http method.') + } +}) + +test('The default route must be a function', t => { + t.plan(1) + try { + FindMyWay({ + defaultRoute: '/404' + }) + t.assert.fail('default route must be a function') + } catch (e) { + t.assert.equal(e.message, 'The default route must be a function') + } +}) + +test('Method already declared', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', () => {}) + try { + findMyWay.on('GET', '/test', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } +}) + +test('Method already declared if * is used', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/*', () => {}) + try { + findMyWay.on('GET', '*', () => {}) + t.assert.fail('should throw error') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/*\' with constraints \'{}\'') + } +}) + +test('Method already declared if /* is used', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '*', () => {}) + try { + findMyWay.on('GET', '/*', () => {}) + t.assert.fail('should throw error') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/*\' with constraints \'{}\'') + } +}) + +describe('Method already declared [ignoreTrailingSlash=true]', t => { + test('without trailing slash', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + findMyWay.on('GET', '/test', () => {}) + + try { + findMyWay.on('GET', '/test', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '/test/', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + }) + + test('with trailing slash', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + findMyWay.on('GET', '/test/', () => {}) + + try { + findMyWay.on('GET', '/test', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '/test/', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + }) +}) + +describe('Method already declared [ignoreDuplicateSlashes=true]', t => { + test('without duplicate slashes', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + findMyWay.on('GET', '/test', () => {}) + + try { + findMyWay.on('GET', '/test', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '//test', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + }) + + test('with duplicate slashes', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + findMyWay.on('GET', '//test', () => {}) + + try { + findMyWay.on('GET', '/test', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '//test', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{}\'') + } + }) +}) + +test('Method already declared nested route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/test/world', () => {}) + + try { + findMyWay.on('GET', '/test/hello', () => {}) + t.assert.fail('method already delcared in nested route') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } +}) + +describe('Method already declared nested route [ignoreTrailingSlash=true]', t => { + test('without trailing slash', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/test/world', () => {}) + + try { + findMyWay.on('GET', '/test/hello', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '/test/hello/', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + }) + + test('Method already declared with constraints', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', { constraints: { host: 'fastify.io' } }, () => {}) + try { + findMyWay.on('GET', '/test', { constraints: { host: 'fastify.io' } }, () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test\' with constraints \'{"host":"fastify.io"}\'') + } + }) + + test('with trailing slash', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + findMyWay.on('GET', '/test/', () => {}) + findMyWay.on('GET', '/test/hello/', () => {}) + findMyWay.on('GET', '/test/world/', () => {}) + + try { + findMyWay.on('GET', '/test/hello', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '/test/hello/', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + }) +}) + +describe('Method already declared nested route [ignoreDuplicateSlashes=true]', t => { + test('without duplicate slashes', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/test/world', () => {}) + + try { + findMyWay.on('GET', '/test/hello', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '/test//hello', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + }) + + test('with duplicate slashes', t => { + t.plan(2) + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + findMyWay.on('GET', '/test/', () => {}) + findMyWay.on('GET', '/test//hello', () => {}) + findMyWay.on('GET', '/test//world', () => {}) + + try { + findMyWay.on('GET', '/test/hello', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + + try { + findMyWay.on('GET', '/test//hello', () => {}) + t.assert.fail('method already declared') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/test/hello\' with constraints \'{}\'') + } + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/fastify-issue-3129.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/fastify-issue-3129.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b221b73e85d32c42f866d477481162a6237bf5fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/fastify-issue-3129.test.js @@ -0,0 +1,34 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('contain param and wildcard together', t => { + t.plan(4) + + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '/:lang/item/:id', (req, res, params) => { + t.assert.deepEqual(params.lang, 'fr') + t.assert.deepEqual(params.id, '12345') + }) + + findMyWay.on('GET', '/:lang/item/*', (req, res, params) => { + t.assert.deepEqual(params.lang, 'fr') + t.assert.deepEqual(params['*'], '12345/edit') + }) + + findMyWay.lookup( + { method: 'GET', url: '/fr/item/12345', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'GET', url: '/fr/item/12345/edit', headers: {} }, + null + ) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/fastify-issue-3957.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/fastify-issue-3957.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5bc7892d899d14a27809c335926f236961ccee76 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/fastify-issue-3957.test.js @@ -0,0 +1,23 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('wildcard should not limit by maxParamLength', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.deepEqual(params['*'], '/portfolios/b5859fb9-6c76-4db8-b3d1-337c5be3fd8b/instruments/2a694406-b43f-439d-aa11-0c814805c930/positions') + }) + + findMyWay.lookup( + { method: 'GET', url: '/portfolios/b5859fb9-6c76-4db8-b3d1-337c5be3fd8b/instruments/2a694406-b43f-439d-aa11-0c814805c930/positions', headers: {} }, + null + ) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/find-route.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/find-route.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bb09918387d3d925878c72f630bd750fa439ab90 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/find-route.test.js @@ -0,0 +1,275 @@ +'use strict' + +const { test } = require('node:test') +const rfdc = require('rfdc')({ proto: true }) +const FindMyWay = require('..') + +function equalRouters (t, router1, router2) { + t.assert.deepStrictEqual(router1._opts, router2._opts) + t.assert.deepEqual(router1.routes, router2.routes) + t.assert.deepEqual(JSON.stringify(router1.trees), JSON.stringify(router2.trees)) + + t.assert.deepStrictEqual(router1.constrainer.strategies, router2.constrainer.strategies) + t.assert.deepStrictEqual( + router1.constrainer.strategiesInUse, + router2.constrainer.strategiesInUse + ) + t.assert.deepStrictEqual( + router1.constrainer.asyncStrategiesInUse, + router2.constrainer.asyncStrategiesInUse + ) +} + +test('findRoute returns null if there is no routes', (t) => { + t.plan(7) + + const findMyWay = FindMyWay() + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/example') + t.assert.equal(route, null) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler and store for a static route', (t) => { + t.plan(9) + + const findMyWay = FindMyWay() + + const handler = () => {} + const store = { hello: 'world' } + findMyWay.on('GET', '/example', handler, store) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/example') + t.assert.equal(route.handler, handler) + t.assert.equal(route.store, store) + t.assert.deepEqual(route.params, []) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns null for a static route', (t) => { + t.plan(7) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/example', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/example1') + t.assert.equal(route, null) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler and params for a parametric route', (t) => { + t.plan(8) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/:param', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/:param') + t.assert.equal(route.handler, handler) + t.assert.deepEqual(route.params, ['param']) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns null for a parametric route', (t) => { + t.plan(7) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/foo/:param', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/bar/:param') + t.assert.equal(route, null) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler and params for a parametric route with static suffix', (t) => { + t.plan(8) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/:param-static', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/:param-static') + t.assert.equal(route.handler, handler) + t.assert.deepEqual(route.params, ['param']) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns null for a parametric route with static suffix', (t) => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:param-static1', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/:param-static2') + t.assert.equal(route, null) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler and original params even if a param name different', (t) => { + t.plan(8) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/:param1', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/:param2') + t.assert.equal(route.handler, handler) + t.assert.deepEqual(route.params, ['param1']) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler and params for a multi-parametric route', (t) => { + t.plan(8) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/:param1-:param2', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/:param1-:param2') + t.assert.equal(route.handler, handler) + t.assert.deepEqual(route.params, ['param1', 'param2']) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns null for a multi-parametric route', (t) => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo/:param1-:param2/bar1', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/foo/:param1-:param2/bar2') + t.assert.equal(route, null) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler and regexp param for a regexp route', (t) => { + t.plan(8) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/:param(^\\d+$)', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/:param(^\\d+$)') + t.assert.equal(route.handler, handler) + t.assert.deepEqual(route.params, ['param']) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns null for a regexp route', (t) => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:file(^\\S+).png', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/:file(^\\D+).png') + t.assert.equal(route, null) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler and wildcard param for a wildcard route', (t) => { + t.plan(8) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on('GET', '/example/*', handler) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/example/*') + t.assert.equal(route.handler, handler) + t.assert.deepEqual(route.params, ['*']) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns null for a wildcard route', (t) => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo1/*', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const route = findMyWay.findRoute('GET', '/foo2/*') + t.assert.equal(route, null) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('findRoute returns handler for a constrained route', (t) => { + t.plan(9) + + const findMyWay = FindMyWay() + + const handler = () => {} + findMyWay.on( + 'GET', + '/example', + { constraints: { version: '1.0.0' } }, + handler + ) + + const fundMyWayClone = rfdc(findMyWay) + + { + const route = findMyWay.findRoute('GET', '/example') + t.assert.equal(route, null) + } + + { + const route = findMyWay.findRoute('GET', '/example', { version: '1.0.0' }) + t.assert.equal(route.handler, handler) + } + + { + const route = findMyWay.findRoute('GET', '/example', { version: '2.0.0' }) + t.assert.equal(route, null) + } + + equalRouters(t, findMyWay, fundMyWayClone) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/find.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/find.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8dade0b6df79b2f9cb35d0dd9b2d528fb6caf0ac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/find.test.js @@ -0,0 +1,16 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('find calls can pass no constraints', t => { + t.plan(3) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/a', () => {}) + findMyWay.on('GET', '/a/b', () => {}) + + t.assert.ok(findMyWay.find('GET', '/a')) + t.assert.ok(findMyWay.find('GET', '/a/b')) + t.assert.ok(!findMyWay.find('GET', '/a/b/c')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/for-in-loop.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/for-in-loop.test.js new file mode 100644 index 0000000000000000000000000000000000000000..93f1d481003d547e5aba366b401dcc0adeac4140 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/for-in-loop.test.js @@ -0,0 +1,13 @@ +'use strict' + +/* eslint no-extend-native: off */ + +const { test } = require('node:test') + +// Something could extend the Array prototype +Array.prototype.test = null +test('for-in-loop', t => { + t.assert.doesNotThrow(() => { + require('../') + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/full-url.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/full-url.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ba8b8c5b4d2f309d226d1713201a8c83a899c7c3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/full-url.test.js @@ -0,0 +1,30 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('full-url', t => { + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/a/:id', (req, res) => { + res.end('{"message":"hello world"}') + }) + + t.assert.deepEqual(findMyWay.find('GET', 'http://localhost/a', { host: 'localhost' }), findMyWay.find('GET', '/a', { host: 'localhost' })) + t.assert.deepEqual(findMyWay.find('GET', 'http://localhost:8080/a', { host: 'localhost' }), findMyWay.find('GET', '/a', { host: 'localhost' })) + t.assert.deepEqual(findMyWay.find('GET', 'http://123.123.123.123/a', {}), findMyWay.find('GET', '/a', {})) + t.assert.deepEqual(findMyWay.find('GET', 'https://localhost/a', { host: 'localhost' }), findMyWay.find('GET', '/a', { host: 'localhost' })) + + t.assert.deepEqual(findMyWay.find('GET', 'http://localhost/a/100', { host: 'localhost' }), findMyWay.find('GET', '/a/100', { host: 'localhost' })) + t.assert.deepEqual(findMyWay.find('GET', 'http://localhost:8080/a/100', { host: 'localhost' }), findMyWay.find('GET', '/a/100', { host: 'localhost' })) + t.assert.deepEqual(findMyWay.find('GET', 'http://123.123.123.123/a/100', {}), findMyWay.find('GET', '/a/100', {})) + t.assert.deepEqual(findMyWay.find('GET', 'https://localhost/a/100', { host: 'localhost' }), findMyWay.find('GET', '/a/100', { host: 'localhost' })) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/has-route.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/has-route.test.js new file mode 100644 index 0000000000000000000000000000000000000000..db3a97c6906c185e47ab0c9ad3db1012ef7fa0bd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/has-route.test.js @@ -0,0 +1,218 @@ +'use strict' + +const { test } = require('node:test') +const rfdc = require('rfdc')({ proto: true }) +const FindMyWay = require('..') + +function equalRouters (t, router1, router2) { + t.assert.deepStrictEqual(router1._opts, router2._opts) + t.assert.deepEqual(router1.routes, router2.routes) + t.assert.deepEqual(JSON.stringify(router1.trees), JSON.stringify(router2.trees)) + + t.assert.deepStrictEqual( + router1.constrainer.strategies, + router2.constrainer.strategies + ) + t.assert.deepStrictEqual( + router1.constrainer.strategiesInUse, + router2.constrainer.strategiesInUse + ) + t.assert.deepStrictEqual( + router1.constrainer.asyncStrategiesInUse, + router2.constrainer.asyncStrategiesInUse + ) +} + +test('hasRoute returns false if there is no routes', t => { + t.plan(7) + + const findMyWay = FindMyWay() + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/example') + t.assert.equal(hasRoute, false) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns true for a static route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/example', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/example') + t.assert.equal(hasRoute, true) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns false for a static route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/example', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/example1') + t.assert.equal(hasRoute, false) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns true for a parametric route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:param', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/:param') + t.assert.equal(hasRoute, true) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns false for a parametric route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo/:param', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/bar/:param') + t.assert.equal(hasRoute, false) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns true for a parametric route with static suffix', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:param-static', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/:param-static') + t.assert.equal(hasRoute, true) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns false for a parametric route with static suffix', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:param-static1', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/:param-static2') + t.assert.equal(hasRoute, false) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns true even if a param name different', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:param1', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/:param2') + t.assert.equal(hasRoute, true) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns true for a multi-parametric route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:param1-:param2', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/:param1-:param2') + t.assert.equal(hasRoute, true) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns false for a multi-parametric route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo/:param1-:param2/bar1', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/foo/:param1-:param2/bar2') + t.assert.equal(hasRoute, false) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns true for a regexp route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:param(^\\d+$)', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/:param(^\\d+$)') + t.assert.equal(hasRoute, true) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns false for a regexp route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/:file(^\\S+).png', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/:file(^\\D+).png') + t.assert.equal(hasRoute, false) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns true for a wildcard route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/example/*', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/example/*') + t.assert.equal(hasRoute, true) + + equalRouters(t, findMyWay, fundMyWayClone) +}) + +test('hasRoute returns false for a wildcard route', t => { + t.plan(7) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo1/*', () => {}) + + const fundMyWayClone = rfdc(findMyWay) + + const hasRoute = findMyWay.hasRoute('GET', '/foo2/*') + t.assert.equal(hasRoute, false) + + equalRouters(t, findMyWay, fundMyWayClone) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/host-storage.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/host-storage.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b14f9c0030aadebb2ebb52fe85011eb07fbb75fa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/host-storage.test.js @@ -0,0 +1,27 @@ +const acceptHostStrategy = require('../lib/strategies/accept-host') + +const { test } = require('node:test') + +test('can get hosts by exact matches', async (t) => { + const storage = acceptHostStrategy.storage() + t.assert.equal(storage.get('fastify.io'), undefined) + storage.set('fastify.io', true) + t.assert.equal(storage.get('fastify.io'), true) +}) + +test('can get hosts by regexp matches', async (t) => { + const storage = acceptHostStrategy.storage() + t.assert.equal(storage.get('fastify.io'), undefined) + storage.set(/.+fastify\.io/, true) + t.assert.equal(storage.get('foo.fastify.io'), true) + t.assert.equal(storage.get('bar.fastify.io'), true) +}) + +test('exact host matches take precendence over regexp matches', async (t) => { + const storage = acceptHostStrategy.storage() + storage.set(/.+fastify\.io/, 'wildcard') + storage.set('auth.fastify.io', 'exact') + t.assert.equal(storage.get('foo.fastify.io'), 'wildcard') + t.assert.equal(storage.get('bar.fastify.io'), 'wildcard') + t.assert.equal(storage.get('auth.fastify.io'), 'exact') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/http2/constraint.host.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/http2/constraint.host.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4cf11131fd578796cba95f75d5e5c887c7be7de1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/http2/constraint.host.test.js @@ -0,0 +1,44 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../..') + +test('A route supports host constraints under http2 protocol', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', {}, (req, res) => { + t.assert.assert.fail() + }) + findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, (req, res) => { + t.assert.equal(req.headers[':authority'], 'fastify.io') + }) + findMyWay.on('GET', '/', { constraints: { host: /.+\.de/ } }, (req, res) => { + t.assert.ok(req.headers[':authority'].endsWith('.de')) + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { + ':authority': 'fastify.io' + } + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { + ':authority': 'fastify.de' + } + }) + + findMyWay.lookup({ + method: 'GET', + url: '/', + headers: { + ':authority': 'find-my-way.de' + } + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-101.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-101.test.js new file mode 100644 index 0000000000000000000000000000000000000000..51df3c0f1fdd233c7bf450d023f3394f5247a251 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-101.test.js @@ -0,0 +1,31 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Falling back for node\'s parametric brother', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/:namespace/:type/:id', () => {}) + findMyWay.on('GET', '/:namespace/jobs/:name/run', () => {}) + + t.assert.deepEqual( + findMyWay.find('GET', '/test_namespace/test_type/test_id').params, + { namespace: 'test_namespace', type: 'test_type', id: 'test_id' } + ) + + t.assert.deepEqual( + findMyWay.find('GET', '/test_namespace/jobss/test_id').params, + { namespace: 'test_namespace', type: 'jobss', id: 'test_id' } + ) + + t.assert.deepEqual( + findMyWay.find('GET', '/test_namespace/jobs/test_id').params, + { namespace: 'test_namespace', type: 'jobs', id: 'test_id' } + ) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-104.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-104.test.js new file mode 100644 index 0000000000000000000000000000000000000000..78430e1e01815ea8c9e14f00e60ac93ab60ee4b5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-104.test.js @@ -0,0 +1,206 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Nested static parametric route, url with parameter common prefix > 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/bbbb', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/a/bbaa', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/a/babb', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('DELETE', '/a/:id', (req, res) => { + res.end('{"message":"hello world"}') + }) + + t.assert.deepEqual(findMyWay.find('DELETE', '/a/bbar').params, { id: 'bbar' }) +}) + +test('Parametric route, url with parameter common prefix > 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/aaa', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/aabb', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/abc', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/:id', (req, res) => { + res.end('{"message":"hello world"}') + }) + + t.assert.deepEqual(findMyWay.find('GET', '/aab').params, { id: 'aab' }) +}) + +test('Parametric route, url with multi parameter common prefix > 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/:id/aaa/:id2', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/:id/aabb/:id2', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/:id/abc/:id2', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/:a/:b', (req, res) => { + res.end('{"message":"hello world"}') + }) + + t.assert.deepEqual(findMyWay.find('GET', '/hello/aab').params, { a: 'hello', b: 'aab' }) +}) + +test('Mixed routes, url with parameter common prefix > 1', t => { + t.plan(11) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/test', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/testify', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/test/hello', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/test/hello/test', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/te/:a', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/test/hello/:b', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/:c', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/text/hello', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/text/:d', (req, res, params) => { + res.end('{"winter":"is here"}') + }) + + findMyWay.on('GET', '/text/:e/test', (req, res, params) => { + res.end('{"winter":"is here"}') + }) + + t.assert.deepEqual(findMyWay.find('GET', '/test').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/testify').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/test/hello').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/test/hello/test').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/te/hello').params, { a: 'hello' }) + t.assert.deepEqual(findMyWay.find('GET', '/te/').params, { a: '' }) + t.assert.deepEqual(findMyWay.find('GET', '/testy').params, { c: 'testy' }) + t.assert.deepEqual(findMyWay.find('GET', '/besty').params, { c: 'besty' }) + t.assert.deepEqual(findMyWay.find('GET', '/text/hellos/test').params, { e: 'hellos' }) + t.assert.deepEqual(findMyWay.find('GET', '/te/hello/'), null) + t.assert.deepEqual(findMyWay.find('GET', '/te/hellos/testy'), null) +}) + +test('Parent parametric brother should not rewrite child node parametric brother', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/text/hello', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/text/:e/test', (req, res, params) => { + res.end('{"winter":"is here"}') + }) + + findMyWay.on('GET', '/:c', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + t.assert.deepEqual(findMyWay.find('GET', '/text/hellos/test').params, { e: 'hellos' }) +}) + +test('Mixed parametric routes, with last defined route being static', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/test', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/test/:a', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/test/hello/:b', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/test/hello/:c/test', (req, res, params) => { + res.end('{"hello":"world"}') + }) + findMyWay.on('GET', '/test/hello/:c/:k', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + findMyWay.on('GET', '/test/world', (req, res, params) => { + res.end('{"hello":"world"}') + }) + + t.assert.deepEqual(findMyWay.find('GET', '/test/hello').params, { a: 'hello' }) + t.assert.deepEqual(findMyWay.find('GET', '/test/hello/world/test').params, { c: 'world' }) + t.assert.deepEqual(findMyWay.find('GET', '/test/hello/world/te').params, { c: 'world', k: 'te' }) + t.assert.deepEqual(findMyWay.find('GET', '/test/hello/world/testy').params, { c: 'world', k: 'testy' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-110.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-110.test.js new file mode 100644 index 0000000000000000000000000000000000000000..937585d79b7a96647152d8338d3ef0ba20bcb936 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-110.test.js @@ -0,0 +1,31 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Nested static parametric route, url with parameter common prefix > 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/api/foo/b2', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/api/foo/bar/qux', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/api/foo/:id/bar', (req, res) => { + res.end('{"message":"hello world"}') + }) + + findMyWay.on('GET', '/foo', (req, res) => { + res.end('{"message":"hello world"}') + }) + + t.assert.deepEqual(findMyWay.find('GET', '/api/foo/b-123/bar').params, { id: 'b-123' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-132.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-132.test.js new file mode 100644 index 0000000000000000000000000000000000000000..74459f716260e140b4f88c594e9402f5acd5dbd9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-132.test.js @@ -0,0 +1,80 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Wildcard mixed with dynamic and common prefix / 1', t => { + t.plan(5) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.on('GET', '/obj/params/*', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.on('GET', '/obj/:id', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.on('GET', '/obj_params/*', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj/params', headers: {} }, null) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj/params/12', headers: {} }, null) + + findMyWay.lookup({ method: 'GET', url: '/obj/params/12', headers: {} }, null) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj_params/12', headers: {} }, null) + + findMyWay.lookup({ method: 'GET', url: '/obj_params/12', headers: {} }, null) +}) + +test('Wildcard mixed with dynamic and common prefix / 2', t => { + t.plan(6) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.on('OPTIONS', '/obj/*', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.on('GET', '/obj/params/*', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.on('GET', '/obj/:id', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.on('GET', '/obj_params/*', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj_params/params', headers: {} }, null) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj/params', headers: {} }, null) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj/params/12', headers: {} }, null) + + findMyWay.lookup({ method: 'GET', url: '/obj/params/12', headers: {} }, null) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj_params/12', headers: {} }, null) + + findMyWay.lookup({ method: 'GET', url: '/obj_params/12', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-145.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-145.test.js new file mode 100644 index 0000000000000000000000000000000000000000..90778a871c2c385da1a72878202a3800b350f50e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-145.test.js @@ -0,0 +1,24 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('issue-145', (t) => { + t.plan(8) + + const findMyWay = FindMyWay({ ignoreTrailingSlash: true }) + + const fixedPath = function staticPath () {} + const varPath = function parameterPath () {} + findMyWay.on('GET', '/a/b', fixedPath) + findMyWay.on('GET', '/a/:pam/c', varPath) + + t.assert.equal(findMyWay.find('GET', '/a/b').handler, fixedPath) + t.assert.equal(findMyWay.find('GET', '/a/b/').handler, fixedPath) + t.assert.equal(findMyWay.find('GET', '/a/b/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a/b/c/').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a/foo/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a/foo/c/').handler, varPath) + t.assert.ok(!findMyWay.find('GET', '/a/c')) + t.assert.ok(!findMyWay.find('GET', '/a/c/')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-149.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-149.test.js new file mode 100644 index 0000000000000000000000000000000000000000..52ff04c98c0f4c1f3f5a889bc47f4602854e1e76 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-149.test.js @@ -0,0 +1,21 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Falling back for node\'s parametric brother', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/:id', () => {}) + findMyWay.on('GET', '/foo/:color/:id', () => {}) + findMyWay.on('GET', '/foo/red', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/foo/red/123').params, { color: 'red', id: '123' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo/blue/123').params, { color: 'blue', id: '123' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo/red').params, {}) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-151.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-151.test.js new file mode 100644 index 0000000000000000000000000000000000000000..71f0c052b392d7c6f750bd5db324567fd48562fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-151.test.js @@ -0,0 +1,54 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Wildcard route should not be blocked by Parametric with different method / 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.fail('Should not be here') + }) + + findMyWay.on('OPTIONS', '/obj/*', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.on('GET', '/obj/:id', (req, res, params) => { + t.assert.fail('Should not be GET') + }) + + findMyWay.lookup({ method: 'OPTIONS', url: '/obj/params', headers: {} }, null) +}) + +test('Wildcard route should not be blocked by Parametric with different method / 2', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('OPTIONS', '/*', { version: '1.2.3' }, (req, res, params) => { + t.assert.fail('Should not be here') + }) + + findMyWay.on('OPTIONS', '/obj/*', { version: '1.2.3' }, (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.on('GET', '/obj/:id', { version: '1.2.3' }, (req, res, params) => { + t.assert.fail('Should not be GET') + }) + + findMyWay.lookup({ + method: 'OPTIONS', + url: '/obj/params', + headers: { 'accept-version': '1.2.3' } + }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-154.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-154.test.js new file mode 100644 index 0000000000000000000000000000000000000000..60ec264b382a09eb4e202af7c37a3bfbbaf44925 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-154.test.js @@ -0,0 +1,21 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') +const noop = () => {} + +test('Should throw when not sending a string', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + t.assert.throws(() => { + findMyWay.on('GET', '/t1', { constraints: { version: 42 } }, noop) + }) + t.assert.throws(() => { + findMyWay.on('GET', '/t2', { constraints: { version: null } }, noop) + }) + t.assert.throws(() => { + findMyWay.on('GET', '/t2', { constraints: { version: true } }, noop) + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-161.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-161.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1fae773995a273df0d5e692a9d3dd9a658fd9a69 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-161.test.js @@ -0,0 +1,88 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Falling back for node\'s parametric brother without ignoreTrailingSlash', t => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/static/param1', () => {}) + findMyWay.on('GET', '/static/param2', () => {}) + findMyWay.on('GET', '/static/:paramA/next', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/static/param1').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/param2').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/paramOther/next').params, { paramA: 'paramOther' }) + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next').params, { paramA: 'param1' }) +}) + +test('Falling back for node\'s parametric brother with ignoreTrailingSlash', t => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: true, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/static/param1', () => {}) + findMyWay.on('GET', '/static/param2', () => {}) + findMyWay.on('GET', '/static/:paramA/next', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/static/param1').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/param2').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/paramOther/next').params, { paramA: 'paramOther' }) + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next').params, { paramA: 'param1' }) +}) + +test('Falling back for node\'s parametric brother without ignoreTrailingSlash', t => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: false, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/static/param1', () => {}) + findMyWay.on('GET', '/static/param2', () => {}) + findMyWay.on('GET', '/static/:paramA/next', () => {}) + + findMyWay.on('GET', '/static/param1/next/param3', () => {}) + findMyWay.on('GET', '/static/param1/next/param4', () => {}) + findMyWay.on('GET', '/static/:paramA/next/:paramB/other', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next/param3').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next/param4').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/paramOther/next/paramOther2/other').params, { paramA: 'paramOther', paramB: 'paramOther2' }) + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next/param3/other').params, { paramA: 'param1', paramB: 'param3' }) +}) + +test('Falling back for node\'s parametric brother with ignoreTrailingSlash', t => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: true, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/static/param1', () => {}) + findMyWay.on('GET', '/static/param2', () => {}) + findMyWay.on('GET', '/static/:paramA/next', () => {}) + + findMyWay.on('GET', '/static/param1/next/param3', () => {}) + findMyWay.on('GET', '/static/param1/next/param4', () => {}) + findMyWay.on('GET', '/static/:paramA/next/:paramB/other', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next/param3').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next/param4').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/static/paramOther/next/paramOther2/other').params, { paramA: 'paramOther', paramB: 'paramOther2' }) + t.assert.deepEqual(findMyWay.find('GET', '/static/param1/next/param3/other').params, { paramA: 'param1', paramB: 'param3' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-17.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-17.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f9f8119e0f6b2de9e0c01b78d1043e354fa5c8ab --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-17.test.js @@ -0,0 +1,397 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Parametric route, request.url contains dash', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:param/b', (req, res, params) => { + t.assert.equal(params.param, 'foo-bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar/b', headers: {} }, null) +}) + +test('Parametric route with fixed suffix', t => { + t.plan(6) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('Should not be defaultRoute') + }) + + findMyWay.on('GET', '/a/:param-static', () => {}) + findMyWay.on('GET', '/b/:param.static', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/a/param-static', {}).params, { param: 'param' }) + t.assert.deepEqual(findMyWay.find('GET', '/b/param.static', {}).params, { param: 'param' }) + + t.assert.deepEqual(findMyWay.find('GET', '/a/param-param-static', {}).params, { param: 'param-param' }) + t.assert.deepEqual(findMyWay.find('GET', '/b/param.param.static', {}).params, { param: 'param.param' }) + + t.assert.deepEqual(findMyWay.find('GET', '/a/param.param-static', {}).params, { param: 'param.param' }) + t.assert.deepEqual(findMyWay.find('GET', '/b/param-param.static', {}).params, { param: 'param-param' }) +}) + +test('Regex param exceeds max parameter length', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('route not matched') + } + }) + + findMyWay.on('GET', '/a/:param(^\\w{3})', (req, res, params) => { + t.assert.fail('regex match') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/fool', headers: {} }, null) +}) + +test('Parametric route with regexp and fixed suffix / 1', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('route not matched') + } + }) + + findMyWay.on('GET', '/a/:param(^\\w{3})bar', (req, res, params) => { + t.assert.fail('regex match') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/$mebar', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/a/foolol', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/a/foobaz', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/a/foolbar', headers: {} }, null) +}) + +test('Parametric route with regexp and fixed suffix / 2', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:param(^\\w{3})bar', (req, res, params) => { + t.assert.equal(params.param, 'foo') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foobar', headers: {} }, null) +}) + +test('Parametric route with regexp and fixed suffix / 3', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:param(^\\w{3}-\\w{3})foo', (req, res, params) => { + t.assert.equal(params.param, 'abc-def') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/abc-deffoo', headers: {} }, null) +}) + +test('Multi parametric route / 1', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1-:p2', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + }) + + findMyWay.on('GET', '/b/:p1.:p2', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.bar', headers: {} }, null) +}) + +test('Multi parametric route / 2', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1-:p2', (req, res, params) => { + t.assert.equal(params.p1, 'foo-bar') + t.assert.equal(params.p2, 'baz') + }) + + findMyWay.on('GET', '/b/:p1.:p2', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar-baz') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar-baz', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.bar-baz', headers: {} }, null) +}) + +test('Multi parametric route / 3', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p_1-:$p', (req, res, params) => { + t.assert.equal(params.p_1, 'foo') + t.assert.equal(params.$p, 'bar') + }) + + findMyWay.on('GET', '/b/:p_1.:$p', (req, res, params) => { + t.assert.equal(params.p_1, 'foo') + t.assert.equal(params.$p, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.bar', headers: {} }, null) +}) + +test('Multi parametric route / 4', t => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('Everything good') + } + }) + + findMyWay.on('GET', '/a/:p1-:p2', (req, res, params) => { + t.assert.fail('Should not match this route') + }) + + findMyWay.on('GET', '/b/:p1.:p2', (req, res, params) => { + t.assert.fail('Should not match this route') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo', headers: {} }, null) +}) + +test('Multi parametric route with regexp / 1', t => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/at/:hour(^\\d+)h:minute(^\\d+)m', (req, res, params) => { + t.assert.equal(params.hour, '0') + t.assert.equal(params.minute, '42') + }) + + findMyWay.lookup({ method: 'GET', url: '/at/0h42m', headers: {} }, null) +}) + +test('Multi parametric route with colon separator', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/:param(.*)::suffix', (req, res, params) => { + t.assert.equal(params.param, 'foo') + }) + + findMyWay.on('GET', '/:param1(.*)::suffix1-:param2(.*)::suffix2/static', (req, res, params) => { + t.assert.equal(params.param1, 'foo') + t.assert.equal(params.param2, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/foo:suffix', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/foo:suffix1-bar:suffix2/static', headers: {} }, null) +}) + +test('Multi parametric route with regexp / 2', t => { + t.plan(8) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:uuid(^[\\d-]{19})-:user(^\\w+)', (req, res, params) => { + t.assert.equal(params.uuid, '1111-2222-3333-4444') + t.assert.equal(params.user, 'foo') + }) + + findMyWay.on('GET', '/a/:uuid(^[\\d-]{19})-:user(^\\w+)/account', (req, res, params) => { + t.assert.equal(params.uuid, '1111-2222-3333-4445') + t.assert.equal(params.user, 'bar') + }) + + findMyWay.on('GET', '/b/:uuid(^[\\d-]{19}).:user(^\\w+)', (req, res, params) => { + t.assert.equal(params.uuid, '1111-2222-3333-4444') + t.assert.equal(params.user, 'foo') + }) + + findMyWay.on('GET', '/b/:uuid(^[\\d-]{19}).:user(^\\w+)/account', (req, res, params) => { + t.assert.equal(params.uuid, '1111-2222-3333-4445') + t.assert.equal(params.user, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/1111-2222-3333-4444-foo', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/a/1111-2222-3333-4445-bar/account', headers: {} }, null) + + findMyWay.lookup({ method: 'GET', url: '/b/1111-2222-3333-4444.foo', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/1111-2222-3333-4445.bar/account', headers: {} }, null) +}) + +test('Multi parametric route with fixed suffix', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1-:p2-baz', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + }) + + findMyWay.on('GET', '/b/:p1.:p2-baz', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar-baz', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.bar-baz', headers: {} }, null) +}) + +test('Multi parametric route with regexp and fixed suffix', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1(^\\w+)-:p2(^\\w+)-kuux', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'barbaz') + }) + + findMyWay.on('GET', '/b/:p1(^\\w+).:p2(^\\w+)-kuux', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'barbaz') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-barbaz-kuux', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.barbaz-kuux', headers: {} }, null) +}) + +test('Multi parametric route with wildcard', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1-:p2/*', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + }) + + findMyWay.on('GET', '/b/:p1.:p2/*', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar/baz', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.bar/baz', headers: {} }, null) +}) + +test('Nested multi parametric route', t => { + t.plan(6) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1-:p2/b/:p3', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + t.assert.equal(params.p3, 'baz') + }) + + findMyWay.on('GET', '/b/:p1.:p2/b/:p3', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, 'bar') + t.assert.equal(params.p3, 'baz') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar/b/baz', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.bar/b/baz', headers: {} }, null) +}) + +test('Nested multi parametric route with regexp / 1', t => { + t.plan(6) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1(^\\w{3})-:p2(^\\d+)/b/:p3', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, '42') + t.assert.equal(params.p3, 'bar') + }) + + findMyWay.on('GET', '/b/:p1(^\\w{3}).:p2(^\\d+)/b/:p3', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, '42') + t.assert.equal(params.p3, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-42/b/bar', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.42/b/bar', headers: {} }, null) +}) + +test('Nested multi parametric route with regexp / 2', t => { + t.plan(6) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1(^\\w{3})-:p2/b/:p3', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, '42') + t.assert.equal(params.p3, 'bar') + }) + + findMyWay.on('GET', '/b/:p1(^\\w{3}).:p2/b/:p3', (req, res, params) => { + t.assert.equal(params.p1, 'foo') + t.assert.equal(params.p2, '42') + t.assert.equal(params.p3, 'bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-42/b/bar', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/b/foo.42/b/bar', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-175.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-175.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c45236e6f08a00569da14cc63f9d04fb7c2fef59 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-175.test.js @@ -0,0 +1,80 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('double colon is replaced with single colon, no parameters', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('should not be default route') + }) + + function handler (req, res, params) { + t.assert.deepEqual(params, {}) + } + + findMyWay.on('GET', '/name::customVerb', handler) + + findMyWay.lookup({ method: 'GET', url: '/name:customVerb' }, null) +}) + +test('exactly one match for static route with colon', t => { + t.plan(2) + const findMyWay = FindMyWay() + + function handler () {} + findMyWay.on('GET', '/name::customVerb', handler) + + t.assert.equal(findMyWay.find('GET', '/name:customVerb').handler, handler) + t.assert.equal(findMyWay.find('GET', '/name:test'), null) +}) + +test('double colon is replaced with single colon, no parameters, same parent node name', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('should not be default route') + }) + + findMyWay.on('GET', '/name', () => { + t.assert.fail('should not be parent route') + }) + + findMyWay.on('GET', '/name::customVerb', (req, res, params) => { + t.assert.deepEqual(params, {}) + }) + + findMyWay.lookup({ method: 'GET', url: '/name:customVerb', headers: {} }, null) +}) + +test('double colon is replaced with single colon, default route, same parent node name', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.ok('should be default route') + }) + + findMyWay.on('GET', '/name', () => { + t.assert.fail('should not be parent route') + }) + + findMyWay.on('GET', '/name::customVerb', () => { + t.assert.fail('should not be child route') + }) + + findMyWay.lookup({ method: 'GET', url: '/name:wrongCustomVerb', headers: {} }, null) +}) + +test('double colon is replaced with single colon, with parameters', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('should not be default route') + }) + + findMyWay.on('GET', '/name1::customVerb1/:param1/name2::customVerb2:param2', (req, res, params) => { + t.assert.deepEqual(params, { + param1: 'value1', + param2: 'value2' + }) + }) + + findMyWay.lookup({ method: 'GET', url: '/name1:customVerb1/value1/name2:customVerb2value2', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-182.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-182.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ac4c7cbdff2f629625c50576541699fce7cfb43f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-182.test.js @@ -0,0 +1,18 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('Set method property when splitting node', t => { + t.plan(1) + const findMyWay = FindMyWay() + + function handler (req, res, params) { + t.assert.ok() + } + + findMyWay.on('GET', '/health-a/health', handler) + findMyWay.on('GET', '/health-b/health', handler) + + t.assert.ok(!findMyWay.prettyPrint().includes('undefined')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-190.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-190.test.js new file mode 100644 index 0000000000000000000000000000000000000000..610e8cc0e5bd225386116f3881ea09d9de830029 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-190.test.js @@ -0,0 +1,44 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('issue-190', (t) => { + t.plan(6) + + const findMyWay = FindMyWay() + + let staticCounter = 0 + let paramCounter = 0 + const staticPath = function staticPath () { staticCounter++ } + const paramPath = function paramPath () { paramCounter++ } + const extraPath = function extraPath () { } + findMyWay.on('GET', '/api/users/award_winners', staticPath) + findMyWay.on('GET', '/api/users/admins', staticPath) + findMyWay.on('GET', '/api/users/:id', paramPath) + findMyWay.on('GET', '/api/:resourceType/foo', extraPath) + + t.assert.equal(findMyWay.find('GET', '/api/users/admins').handler, staticPath) + t.assert.equal(findMyWay.find('GET', '/api/users/award_winners').handler, staticPath) + t.assert.equal(findMyWay.find('GET', '/api/users/a766c023-34ec-40d2-923c-e8259a28d2c5').handler, paramPath) + t.assert.equal(findMyWay.find('GET', '/api/users/b766c023-34ec-40d2-923c-e8259a28d2c5').handler, paramPath) + + findMyWay.lookup({ + method: 'GET', + url: '/api/users/admins', + headers: { } + }) + findMyWay.lookup({ + method: 'GET', + url: '/api/users/award_winners', + headers: { } + }) + findMyWay.lookup({ + method: 'GET', + url: '/api/users/a766c023-34ec-40d2-923c-e8259a28d2c5', + headers: { } + }) + + t.assert.equal(staticCounter, 2) + t.assert.equal(paramCounter, 1) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-20.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-20.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d1ab5ea4998d3a11cf29d44d784c3f69587c3f4d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-20.test.js @@ -0,0 +1,79 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Standard case', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be here') + } + }) + + findMyWay.on('GET', '/a/:param', (req, res, params) => { + t.assert.equal(params.param, 'perfectly-fine-route') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/perfectly-fine-route', headers: {} }, null) +}) + +test('Should be 404 / 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('Everything good') + } + }) + + findMyWay.on('GET', '/a/:param', (req, res, params) => { + t.assert.fail('We should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/a', headers: {} }, null) +}) + +test('Should be 404 / 2', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('Everything good') + } + }) + + findMyWay.on('GET', '/a/:param', (req, res, params) => { + t.assert.fail('We should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/a-non-existing-route', headers: {} }, null) +}) + +test('Should be 404 / 3', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('Everything good') + } + }) + + findMyWay.on('GET', '/a/:param', (req, res, params) => { + t.assert.fail('We should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/a//', headers: {} }, null) +}) + +test('Should get an empty parameter', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('We should not be here') + } + }) + + findMyWay.on('GET', '/a/:param', (req, res, params) => { + t.assert.equal(params.param, '') + }) + + findMyWay.lookup({ method: 'GET', url: '/a/', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-206.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-206.test.js new file mode 100644 index 0000000000000000000000000000000000000000..39e5f0ad692887055249576ba69b5d1eb12b167b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-206.test.js @@ -0,0 +1,121 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('Decode the URL before the routing', t => { + t.plan(8) + const findMyWay = FindMyWay() + + function space (req, res, params) {} + function percentTwenty (req, res, params) {} + function percentTwentyfive (req, res, params) {} + + findMyWay.on('GET', '/static/:pathParam', () => {}) + findMyWay.on('GET', '/[...]/a .html', space) + findMyWay.on('GET', '/[...]/a%20.html', percentTwenty) + findMyWay.on('GET', '/[...]/a%2520.html', percentTwentyfive) + + t.assert.equal(findMyWay.find('GET', '/[...]/a .html').handler, space) + t.assert.equal(findMyWay.find('GET', '/%5B...%5D/a .html').handler, space) + t.assert.equal(findMyWay.find('GET', '/[...]/a%20.html').handler, space, 'a%20 decode is a ') + t.assert.equal(findMyWay.find('GET', '/%5B...%5D/a%20.html').handler, space, 'a%20 decode is a ') + t.assert.equal(findMyWay.find('GET', '/[...]/a%2520.html').handler, percentTwenty, 'a%2520 decode is a%20') + t.assert.equal(findMyWay.find('GET', '/%5B...%5D/a%252520.html').handler, percentTwentyfive, 'a%252520.html is a%2520') + t.assert.equal(findMyWay.find('GET', '/[...]/a .html'), null, 'double space') + t.assert.equal(findMyWay.find('GET', '/static/%25E0%A4%A'), null, 'invalid encoded path param') +}) + +test('double encoding', t => { + t.plan(8) + const findMyWay = FindMyWay() + + function pathParam (req, res, params) { + t.assert.deepEqual(params, this.expect, 'path param') + t.assert.deepEqual(pathParam, this.handler, 'match handler') + } + function regexPathParam (req, res, params) { + t.assert.deepEqual(params, this.expect, 'regex param') + t.assert.deepEqual(regexPathParam, this.handler, 'match handler') + } + function wildcard (req, res, params) { + t.assert.deepEqual(params, this.expect, 'wildcard param') + t.assert.deepEqual(wildcard, this.handler, 'match handler') + } + + findMyWay.on('GET', '/:pathParam', pathParam) + findMyWay.on('GET', '/reg/:regExeParam(^.*$)', regexPathParam) + findMyWay.on('GET', '/wild/*', wildcard) + + findMyWay.lookup(get('/' + doubleEncode('reg/hash# .png')), null, + { expect: { pathParam: singleEncode('reg/hash# .png') }, handler: pathParam } + ) + findMyWay.lookup(get('/' + doubleEncode('special # $ & + , / : ; = ? @')), null, + { expect: { pathParam: singleEncode('special # $ & + , / : ; = ? @') }, handler: pathParam } + ) + findMyWay.lookup(get('/reg/' + doubleEncode('hash# .png')), null, + { expect: { regExeParam: singleEncode('hash# .png') }, handler: regexPathParam } + ) + findMyWay.lookup(get('/wild/' + doubleEncode('mail@mail.it')), null, + { expect: { '*': singleEncode('mail@mail.it') }, handler: wildcard } + ) + + function doubleEncode (str) { + return encodeURIComponent(encodeURIComponent(str)) + } + function singleEncode (str) { + return encodeURIComponent(str) + } +}) + +test('Special chars on path parameter', t => { + t.plan(10) + const findMyWay = FindMyWay() + + function pathParam (req, res, params) { + t.assert.deepEqual(params, this.expect, 'path param') + t.assert.deepEqual(pathParam, this.handler, 'match handler') + } + function regexPathParam (req, res, params) { + t.assert.deepEqual(params, this.expect, 'regex param') + t.assert.deepEqual(regexPathParam, this.handler, 'match handler') + } + function staticEncoded (req, res, params) { + t.assert.deepEqual(params, this.expect, 'static match') + t.assert.deepEqual(staticEncoded, this.handler, 'match handler') + } + + findMyWay.on('GET', '/:pathParam', pathParam) + findMyWay.on('GET', '/reg/:regExeParam(^\\d+) .png', regexPathParam) + findMyWay.on('GET', '/[...]/a%2520.html', staticEncoded) + + findMyWay.lookup(get('/%5B...%5D/a%252520.html'), null, { expect: {}, handler: staticEncoded }) + findMyWay.lookup(get('/[...].html'), null, { expect: { pathParam: '[...].html' }, handler: pathParam }) + findMyWay.lookup(get('/reg/123 .png'), null, { expect: { regExeParam: '123' }, handler: regexPathParam }) + findMyWay.lookup(get('/reg%2F123 .png'), null, { expect: { pathParam: 'reg/123 .png' }, handler: pathParam }) // en encoded / is considered a parameter + findMyWay.lookup(get('/reg/123%20.png'), null, { expect: { regExeParam: '123' }, handler: regexPathParam }) +}) + +test('Multi parametric route with encoded colon separator', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/:param(.*)::suffix', (req, res, params) => { + t.assert.equal(params.param, 'foo-bar') + }) + + findMyWay.lookup({ method: 'GET', url: '/foo-bar%3Asuffix', headers: {} }, null) +}) + +function get (url) { + return { method: 'GET', url, headers: {} } +} + +// http://localhost:3000/parameter with / in it +// http://localhost:3000/parameter%20with%20%2F%20in%20it + +// http://localhost:3000/parameter with %252F in it diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-221.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-221.test.js new file mode 100644 index 0000000000000000000000000000000000000000..13d324f6b984e67df771cb657401b0146231846b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-221.test.js @@ -0,0 +1,50 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('Should return correct param after switching from static route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/prefix-:id', () => {}) + findMyWay.on('GET', '/prefix-111', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/prefix-1111').params, { id: '1111' }) +}) + +test('Should return correct param after switching from static route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/prefix-111', () => {}) + findMyWay.on('GET', '/prefix-:id/hello', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/prefix-1111/hello').params, { id: '1111' }) +}) + +test('Should return correct param after switching from parametric route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/prefix-111', () => {}) + findMyWay.on('GET', '/prefix-:id/hello', () => {}) + findMyWay.on('GET', '/:id', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/prefix-1111-hello').params, { id: 'prefix-1111-hello' }) +}) + +test('Should return correct params after switching from parametric route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:param1/test/:param2/prefix-111', () => {}) + findMyWay.on('GET', '/test/:param1/test/:param2/prefix-:id/hello', () => {}) + findMyWay.on('GET', '/test/:param1/test/:param2/:id', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/test/value1/test/value2/prefix-1111-hello').params, { + param1: 'value1', + param2: 'value2', + id: 'prefix-1111-hello' + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-234.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-234.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1406b51149d1d99b7d6fd7c13b36f549571a4795 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-234.test.js @@ -0,0 +1,94 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('Match static url without encoding option', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + const handler = () => {} + + findMyWay.on('GET', '/🍌', handler) + + t.assert.deepEqual(findMyWay.find('GET', '/🍌').handler, handler) + t.assert.deepEqual(findMyWay.find('GET', '/%F0%9F%8D%8C').handler, handler) +}) + +test('Match parametric url with encoding option', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/🍌/:param', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/🍌/@').params, { param: '@' }) + t.assert.deepEqual(findMyWay.find('GET', '/%F0%9F%8D%8C/@').params, { param: '@' }) +}) + +test('Match encoded parametric url with encoding option', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/🍌/:param', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/🍌/%23').params, { param: '#' }) + t.assert.deepEqual(findMyWay.find('GET', '/%F0%9F%8D%8C/%23').params, { param: '#' }) +}) + +test('Decode url components', t => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:param1/:param2', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/foo%23bar/foo%23bar').params, { param1: 'foo#bar', param2: 'foo#bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/%F0%9F%8D%8C/%F0%9F%8D%8C').params, { param1: '🍌', param2: '🍌' }) + t.assert.deepEqual(findMyWay.find('GET', '/%F0%9F%8D%8C/foo%23bar').params, { param1: '🍌', param2: 'foo#bar' }) +}) + +test('Decode url components', t => { + t.plan(5) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/foo🍌bar/:param1/:param2', () => {}) + findMyWay.on('GET', '/user/:id', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/foo%F0%9F%8D%8Cbar/foo%23bar/foo%23bar').params, { param1: 'foo#bar', param2: 'foo#bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/user/maintainer+tomas').params, { id: 'maintainer+tomas' }) + t.assert.deepEqual(findMyWay.find('GET', '/user/maintainer%2Btomas').params, { id: 'maintainer+tomas' }) + t.assert.deepEqual(findMyWay.find('GET', '/user/maintainer%20tomas').params, { id: 'maintainer tomas' }) + t.assert.deepEqual(findMyWay.find('GET', '/user/maintainer%252Btomas').params, { id: 'maintainer%2Btomas' }) +}) + +test('Decode url components', t => { + t.plan(18) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:param1', () => {}) + t.assert.deepEqual(findMyWay.find('GET', '/foo%23bar').params, { param1: 'foo#bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%24bar').params, { param1: 'foo$bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%26bar').params, { param1: 'foo&bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%2bbar').params, { param1: 'foo+bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%2Bbar').params, { param1: 'foo+bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%2cbar').params, { param1: 'foo,bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%2Cbar').params, { param1: 'foo,bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%2fbar').params, { param1: 'foo/bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%2Fbar').params, { param1: 'foo/bar' }) + + t.assert.deepEqual(findMyWay.find('GET', '/foo%3abar').params, { param1: 'foo:bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%3Abar').params, { param1: 'foo:bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%3bbar').params, { param1: 'foo;bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%3Bbar').params, { param1: 'foo;bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%3dbar').params, { param1: 'foo=bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%3Dbar').params, { param1: 'foo=bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%3fbar').params, { param1: 'foo?bar' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo%3Fbar').params, { param1: 'foo?bar' }) + + t.assert.deepEqual(findMyWay.find('GET', '/foo%40bar').params, { param1: 'foo@bar' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-238.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-238.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4442323524e849e3983b6a6900be90e5c3c256ac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-238.test.js @@ -0,0 +1,119 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Multi-parametric tricky path', t => { + t.plan(6) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('Should not be defaultRoute') + }) + + findMyWay.on('GET', '/:param1-static-:param2', () => {}) + + t.assert.deepEqual( + findMyWay.find('GET', '/param1-static-param2', {}).params, + { param1: 'param1', param2: 'param2' } + ) + t.assert.deepEqual( + findMyWay.find('GET', '/param1.1-param1.2-static-param2.1-param2.2', {}).params, + { param1: 'param1.1-param1.2', param2: 'param2.1-param2.2' } + ) + t.assert.deepEqual( + findMyWay.find('GET', '/param1-1-param1-2-static-param2-1-param2-2', {}).params, + { param1: 'param1-1-param1-2', param2: 'param2-1-param2-2' } + ) + t.assert.deepEqual( + findMyWay.find('GET', '/static-static-static', {}).params, + { param1: 'static', param2: 'static' } + ) + t.assert.deepEqual( + findMyWay.find('GET', '/static-static-static-static', {}).params, + { param1: 'static', param2: 'static-static' } + ) + t.assert.deepEqual( + findMyWay.find('GET', '/static-static1-static-static', {}).params, + { param1: 'static-static1', param2: 'static' } + ) +}) + +test('Multi-parametric nodes with different static ending 1', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('Should not be defaultRoute') + }) + + const paramHandler = () => {} + const multiParamHandler = () => {} + + findMyWay.on('GET', '/v1/foo/:code', paramHandler) + findMyWay.on('GET', '/v1/foo/:code.png', multiParamHandler) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello', {}).handler, paramHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello', {}).params, { code: 'hello' }) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png', {}).handler, multiParamHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png', {}).params, { code: 'hello' }) +}) + +test('Multi-parametric nodes with different static ending 2', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('Should not be defaultRoute') + }) + + const jpgHandler = () => {} + const pngHandler = () => {} + + findMyWay.on('GET', '/v1/foo/:code.jpg', jpgHandler) + findMyWay.on('GET', '/v1/foo/:code.png', pngHandler) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.jpg', {}).handler, jpgHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.jpg', {}).params, { code: 'hello' }) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png', {}).handler, pngHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png', {}).params, { code: 'hello' }) +}) + +test('Multi-parametric nodes with different static ending 3', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('Should not be defaultRoute') + }) + + const jpgHandler = () => {} + const pngHandler = () => {} + + findMyWay.on('GET', '/v1/foo/:code.jpg/bar', jpgHandler) + findMyWay.on('GET', '/v1/foo/:code.png/bar', pngHandler) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.jpg/bar', {}).handler, jpgHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.jpg/bar', {}).params, { code: 'hello' }) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png/bar', {}).handler, pngHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png/bar', {}).params, { code: 'hello' }) +}) + +test('Multi-parametric nodes with different static ending 4', t => { + t.plan(6) + const findMyWay = FindMyWay({ + defaultRoute: () => t.assert.fail('Should not be defaultRoute') + }) + + const handler = () => {} + const jpgHandler = () => {} + const pngHandler = () => {} + + findMyWay.on('GET', '/v1/foo/:code/bar', handler) + findMyWay.on('GET', '/v1/foo/:code.jpg/bar', jpgHandler) + findMyWay.on('GET', '/v1/foo/:code.png/bar', pngHandler) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello/bar', {}).handler, handler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello/bar', {}).params, { code: 'hello' }) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.jpg/bar', {}).handler, jpgHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.jpg/bar', {}).params, { code: 'hello' }) + + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png/bar', {}).handler, pngHandler) + t.assert.deepEqual(findMyWay.find('GET', '/v1/foo/hello.png/bar', {}).params, { code: 'hello' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-240.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-240.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ada2579df0a92fb0c632a9f318419e66d2b2925c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-240.test.js @@ -0,0 +1,30 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('issue-240: .find matching', (t) => { + t.plan(14) + + const findMyWay = FindMyWay({ ignoreDuplicateSlashes: true }) + + const fixedPath = function staticPath () {} + const varPath = function parameterPath () {} + findMyWay.on('GET', '/a/b', fixedPath) + findMyWay.on('GET', '/a/:pam/c', varPath) + + t.assert.equal(findMyWay.find('GET', '/a/b').handler, fixedPath) + t.assert.equal(findMyWay.find('GET', '/a//b').handler, fixedPath) + t.assert.equal(findMyWay.find('GET', '/a/b/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a//b/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a///b/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a//b//c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a///b///c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a/foo/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a//foo/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a///foo/c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a//foo//c').handler, varPath) + t.assert.equal(findMyWay.find('GET', '/a///foo///c').handler, varPath) + t.assert.ok(!findMyWay.find('GET', '/a/c')) + t.assert.ok(!findMyWay.find('GET', '/a//c')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-241.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-241.test.js new file mode 100644 index 0000000000000000000000000000000000000000..39b007a0a92c2012e633923e78232f61a2ca81a6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-241.test.js @@ -0,0 +1,32 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('Double colon and parametric children', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/::articles', () => {}) + findMyWay.on('GET', '/:article_name', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/:articles').params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/articles_param').params, { article_name: 'articles_param' }) +}) + +test('Double colon and parametric children', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/::test::foo/:param/::articles', () => {}) + findMyWay.on('GET', '/::test::foo/:param/:article_name', () => {}) + + t.assert.deepEqual( + findMyWay.find('GET', '/:test:foo/param_value1/:articles').params, + { param: 'param_value1' } + ) + t.assert.deepEqual( + findMyWay.find('GET', '/:test:foo/param_value2/articles_param').params, + { param: 'param_value2', article_name: 'articles_param' } + ) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-247.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-247.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e5a99f03049664cdfffcd4900ccacdb686c4d863 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-247.test.js @@ -0,0 +1,51 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('If there are constraints param, router.off method support filter', t => { + t.plan(12) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/a', { constraints: { host: '1' } }, () => {}, { name: 1 }) + findMyWay.on('GET', '/a', { constraints: { host: '2', version: '1.0.0' } }, () => {}, { name: 2 }) + findMyWay.on('GET', '/a', { constraints: { host: '2', version: '2.0.0' } }, () => {}, { name: 3 }) + + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }).store, { name: 1 }) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }).store, { name: 2 }) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 }) + + findMyWay.off('GET', '/a', { host: '1' }) + + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }).store, { name: 2 }) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 }) + + findMyWay.off('GET', '/a', { host: '2', version: '1.0.0' }) + + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }), null) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 }) + + findMyWay.off('GET', '/a', { host: '2', version: '2.0.0' }) + + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }), null) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }), null) +}) + +test('If there are no constraints param, router.off method remove all matched router', t => { + t.plan(4) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/a', { constraints: { host: '1' } }, () => {}, { name: 1 }) + findMyWay.on('GET', '/a', { constraints: { host: '2' } }, () => {}, { name: 2 }) + + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }).store, { name: 1 }) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2' }).store, { name: 2 }) + + findMyWay.off('GET', '/a') + + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null) + t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2' }), null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-254.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-254.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9e6b46260dd93a6451193ea58ab04b6285464e9c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-254.test.js @@ -0,0 +1,31 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('Constraints should not be overrided when multiple router is created', t => { + t.plan(1) + + const constraint = { + name: 'secret', + storage: function () { + const secrets = {} + return { + get: (secret) => { return secrets[secret] || null }, + set: (secret, store) => { secrets[secret] = store } + } + }, + deriveConstraint: (req, ctx) => { + return req.headers['x-secret'] + }, + validate () { return true } + } + + const router1 = FindMyWay({ constraints: { secret: constraint } }) + FindMyWay() + + router1.on('GET', '/', { constraints: { secret: 'alpha' } }, () => {}) + router1.find('GET', '/', { secret: 'alpha' }) + + t.assert.ok('constraints is not overrided') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-28.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-28.test.js new file mode 100644 index 0000000000000000000000000000000000000000..98848be8c3d81a6c2389dba2c2ca75d2b17bcda1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-28.test.js @@ -0,0 +1,618 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('wildcard (more complex test)', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '/test/*', (req, res, params) => { + switch (params['*']) { + case 'hello': + t.assert.ok('correct parameter') + break + case 'hello/world': + t.assert.ok('correct parameter') + break + case '': + t.assert.ok('correct parameter') + break + default: + t.assert.fail('wrong parameter: ' + params['*']) + } + }) + + findMyWay.lookup( + { method: 'GET', url: '/test/hello', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'GET', url: '/test/hello/world', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'GET', url: '/test/', headers: {} }, + null + ) +}) + +test('Wildcard inside a node with a static route but different method', t => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '/test/hello', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.lookup( + { method: 'GET', url: '/test/hello', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test/hello', headers: {} }, + null + ) +}) + +test('Wildcard inside a node with a static route but different method (more complex case)', t => { + t.plan(5) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + if (req.url === '/test/helloo' && req.method === 'GET') { + t.assert.ok('Everything fine') + } else { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + } + }) + + findMyWay.on('GET', '/test/hello', (req, res, params) => { + t.assert.equal(req.method, 'GET') + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.lookup( + { method: 'GET', url: '/test/hello', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'GET', url: '/test/helloo', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test/', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test/helloo', headers: {} }, + null + ) +}) + +test('Wildcard edge cases', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '/test1/foo', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/test2/foo', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.equal(params['*'], 'test1/foo') + }) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test1/foo', headers: {} }, + null + ) +}) + +test('Wildcard edge cases same method', t => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('OPTIONS', '/test1/foo', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.on('OPTIONS', '/test2/foo', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.equal(params['*'], 'test/foo') + }) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test1/foo', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test/foo', headers: {} }, + null + ) +}) + +test('Wildcard and parametric edge cases', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('OPTIONS', '/test1/foo', (req, res, params) => { + t.assert.equal(req.method, 'OPTIONS') + }) + + findMyWay.on('OPTIONS', '/test2/foo', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/:test/foo', (req, res, params) => { + t.assert.equal(params.test, 'example') + }) + + findMyWay.on('OPTIONS', '/*', (req, res, params) => { + t.assert.equal(params['*'], 'test/foo/hey') + }) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test1/foo', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'OPTIONS', url: '/test/foo/hey', headers: {} }, + null + ) + + findMyWay.lookup( + { method: 'GET', url: '/example/foo', headers: {} }, + null + ) +}) + +test('Mixed wildcard and static with same method', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '/foo1/bar1/baz', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/bar2/baz', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo2/bar2/baz', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.equal(params['*'], '/foo1/bar1/kuux') + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo1/bar1/kuux', headers: {} }, + null + ) +}) + +test('Nested wildcards case - 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.equal(params['*'], 'bar1/kuux') + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo1/bar1/kuux', headers: {} }, + null + ) +}) + +test('Nested wildcards case - 2', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.equal(params['*'], 'bar1/kuux') + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo1/bar1/kuux', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.equal(params['*'], 'bar1/kuux') + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo4/param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo1/bar1/kuux', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 2', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.equal(params.param, 'bar1') + }) + + findMyWay.on('GET', '/foo4/param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo3/bar1', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 3', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo4/param', (req, res, params) => { + t.assert.equal(req.url, '/foo4/param') + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo4/param', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 4', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/param', (req, res, params) => { + t.assert.equal(req.url, '/foo1/param') + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo1/param', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 5', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.equal(params['*'], 'param/hello/test/long/routee') + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/param/hello/test/long/route', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo1/param/hello/test/long/routee', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 6', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.equal(params['*'], '/foo4/param/hello/test/long/routee') + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo4/param/hello/test/long/route', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo4/param/hello/test/long/routee', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 7', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.equal(params.param, 'hello') + }) + + findMyWay.on('GET', '/foo3/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo4/example/hello/test/long/route', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo3/hello', headers: {} }, + null + ) +}) + +test('Nested wildcards with parametric and static - 8', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo2/*', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/:param', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo3/*', (req, res, params) => { + t.assert.equal(params['*'], 'hello/world') + }) + + findMyWay.on('GET', '/foo4/param/hello/test/long/route', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo3/hello/world', headers: {} }, + null + ) +}) + +test('Wildcard node with constraints', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', { constraints: { host: 'fastify.io' } }, (req, res, params) => { + t.assert.equal(params['*'], '/foo1/foo3') + }) + + findMyWay.on('GET', '/foo1/*', { constraints: { host: 'something-else.io' } }, (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.on('GET', '/foo1/foo2', (req, res, params) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + }) + + findMyWay.lookup( + { method: 'GET', url: '/foo1/foo3', headers: { host: 'fastify.io' } }, + null + ) +}) + +test('Wildcard must be the last character in the route', (t) => { + t.plan(6) + + const expectedError = new Error('Wildcard must be the last character in the route') + + const findMyWay = FindMyWay() + + t.assert.throws(() => findMyWay.on('GET', '*1', () => {}), expectedError) + t.assert.throws(() => findMyWay.on('GET', '*/', () => {}), expectedError) + t.assert.throws(() => findMyWay.on('GET', '*?', () => {}), expectedError) + + t.assert.throws(() => findMyWay.on('GET', '/foo*123', () => {}), expectedError) + t.assert.throws(() => findMyWay.on('GET', '/foo*?', () => {}), expectedError) + t.assert.throws(() => findMyWay.on('GET', '/foo*/', () => {}), expectedError) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-280.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-280.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b05fda82b106f61255a374b87957879da23b0263 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-280.test.js @@ -0,0 +1,14 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Wildcard route match when regexp route fails', (t) => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:a(a)', () => {}) + findMyWay.on('GET', '/*', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/b', {}).params, { '*': 'b' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-285.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-285.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2fa564fdb83b94035f004f674e22729709f75e1c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-285.test.js @@ -0,0 +1,37 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Parametric regex match with similar routes', (t) => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:a(a)', () => {}) + findMyWay.on('GET', '/:param/static', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/a', {}).params, { a: 'a' }) + t.assert.deepEqual(findMyWay.find('GET', '/param/static', {}).params, { param: 'param' }) +}) + +test('Parametric regex match with similar routes', (t) => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:a(a)', () => {}) + findMyWay.on('GET', '/:b(b)/static', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/a', {}).params, { a: 'a' }) + t.assert.deepEqual(findMyWay.find('GET', '/b/static', {}).params, { b: 'b' }) +}) + +test('Parametric regex match with similar routes', (t) => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:a(a)/static', { constraints: { version: '1.0.0' } }, () => {}) + findMyWay.on('GET', '/:b(b)/static', { constraints: { version: '2.0.0' } }, () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/a/static', { version: '1.0.0' }).params, { a: 'a' }) + t.assert.deepEqual(findMyWay.find('GET', '/b/static', { version: '2.0.0' }).params, { b: 'b' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-330.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-330.test.js new file mode 100644 index 0000000000000000000000000000000000000000..13b4f605f7a237790b0c754ac5d5b1e38908859d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-330.test.js @@ -0,0 +1,231 @@ +const { test } = require('node:test') +const FindMyWay = require('..') +const proxyquire = require('proxyquire') +const HandlerStorage = require('../lib/handler-storage') +const Constrainer = require('../lib/constrainer') +const { safeDecodeURIComponent } = require('../lib/url-sanitizer') +const acceptVersionStrategy = require('../lib/strategies/accept-version') +const httpMethodStrategy = require('../lib/strategies/http-method') + +test('FULL_PATH_REGEXP and OPTIONAL_PARAM_REGEXP should be considered safe', (t) => { + t.plan(1) + + t.assert.doesNotThrow(() => require('..')) +}) + +test('should throw an error for unsafe FULL_PATH_REGEXP', (t) => { + t.plan(1) + + t.assert.throws(() => proxyquire('..', { + 'safe-regex2': () => false + }), new Error('the FULL_PATH_REGEXP is not safe, update this module')) +}) + +test('Should throw an error for unsafe OPTIONAL_PARAM_REGEXP', (t) => { + t.plan(1) + + let callCount = 0 + t.assert.throws(() => proxyquire('..', { + 'safe-regex2': () => { + return ++callCount < 2 + } + }), new Error('the OPTIONAL_PARAM_REGEXP is not safe, update this module')) +}) + +test('double colon does not define parametric node', (t) => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/::id', () => {}) + const route1 = findMyWay.findRoute('GET', '/::id') + t.assert.deepStrictEqual(route1.params, []) + + findMyWay.on('GET', '/:foo(\\d+)::bar', () => {}) + const route2 = findMyWay.findRoute('GET', '/:foo(\\d+)::bar') + t.assert.deepStrictEqual(route2.params, ['foo']) +}) + +test('case insensitive static routes', (t) => { + t.plan(3) + + const findMyWay = FindMyWay({ + caseSensitive: false + }) + + findMyWay.on('GET', '/foo', () => {}) + findMyWay.on('GET', '/foo/bar', () => {}) + findMyWay.on('GET', '/foo/bar/baz', () => {}) + + t.assert.ok(findMyWay.findRoute('GET', '/FoO')) + t.assert.ok(findMyWay.findRoute('GET', '/FOo/Bar')) + t.assert.ok(findMyWay.findRoute('GET', '/fOo/Bar/bAZ')) +}) + +test('wildcard must be the last character in the route', (t) => { + t.plan(3) + + const expectedError = new Error('Wildcard must be the last character in the route') + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '*', () => {}) + t.assert.throws(() => findMyWay.findRoute('GET', '*1'), expectedError) + t.assert.throws(() => findMyWay.findRoute('GET', '*/'), expectedError) + t.assert.throws(() => findMyWay.findRoute('GET', '*?'), expectedError) +}) + +test('does not find the route if maxParamLength is exceeded', t => { + t.plan(2) + const findMyWay = FindMyWay({ + maxParamLength: 2 + }) + + findMyWay.on('GET', '/:id(\\d+)', () => {}) + + t.assert.equal(findMyWay.find('GET', '/123'), null) + t.assert.ok(findMyWay.find('GET', '/12')) +}) + +test('Should check if a regex is safe to use', (t) => { + t.plan(1) + + const findMyWay = FindMyWay() + + // we must pass a safe regex to register the route + // findRoute will still throws the expected assertion error if we try to access it with unsafe reggex + findMyWay.on('GET', '/test/:id(\\d+)', () => {}) + + const unSafeRegex = /(x+x+)+y/ + t.assert.throws(() => findMyWay.findRoute('GET', `/test/:id(${unSafeRegex.toString()})`), { + message: "The regex '(/(x+x+)+y/)' is not safe!" + }) +}) + +test('Disable safe regex check', (t) => { + t.plan(1) + + const findMyWay = FindMyWay({ allowUnsafeRegex: true }) + + const unSafeRegex = /(x+x+)+y/ + findMyWay.on('GET', `/test2/:id(${unSafeRegex.toString()})`, () => {}) + t.assert.doesNotThrow(() => findMyWay.findRoute('GET', `/test2/:id(${unSafeRegex.toString()})`)) +}) + +test('throws error if no strategy registered for constraint key', (t) => { + t.plan(2) + + const constrainer = new Constrainer() + const error = new Error('No strategy registered for constraint key invalid-constraint') + t.assert.throws(() => constrainer.newStoreForConstraint('invalid-constraint'), error) + t.assert.throws(() => constrainer.validateConstraints({ 'invalid-constraint': 'foo' }), error) +}) + +test('throws error if pass an undefined constraint value', (t) => { + t.plan(1) + + const constrainer = new Constrainer() + const error = new Error('Can\'t pass an undefined constraint value, must pass null or no key at all') + t.assert.throws(() => constrainer.validateConstraints({ key: undefined }), error) +}) + +test('Constrainer.noteUsage', (t) => { + t.plan(3) + + const constrainer = new Constrainer() + t.assert.equal(constrainer.strategiesInUse.size, 0) + + constrainer.noteUsage() + t.assert.equal(constrainer.strategiesInUse.size, 0) + + constrainer.noteUsage({ host: 'fastify.io' }) + t.assert.equal(constrainer.strategiesInUse.size, 1) +}) + +test('Cannot derive constraints without active strategies.', (t) => { + t.plan(1) + + const constrainer = new Constrainer() + const before = constrainer.deriveSyncConstraints + constrainer._buildDeriveConstraints() + t.assert.deepEqual(constrainer.deriveSyncConstraints, before) +}) + +test('getMatchingHandler should return null if not compiled', (t) => { + t.plan(1) + + const handlerStorage = new HandlerStorage() + t.assert.equal(handlerStorage.getMatchingHandler({ foo: 'bar' }), null) +}) + +test('safeDecodeURIComponent should replace %3x to null for every x that is not a valid lowchar', (t) => { + t.plan(1) + + t.assert.equal(safeDecodeURIComponent('Hello%3xWorld'), 'HellonullWorld') +}) + +test('SemVerStore version should be a string', (t) => { + t.plan(1) + + const Storage = acceptVersionStrategy.storage + + t.assert.throws(() => new Storage().set(1), new TypeError('Version should be a string')) +}) + +test('SemVerStore.maxMajor should increase automatically', (t) => { + t.plan(3) + + const Storage = acceptVersionStrategy.storage + const storage = new Storage() + + t.assert.equal(storage.maxMajor, 0) + + storage.set('2') + t.assert.equal(storage.maxMajor, 2) + + storage.set('1') + t.assert.equal(storage.maxMajor, 2) +}) + +test('SemVerStore.maxPatches should increase automatically', (t) => { + t.plan(3) + + const Storage = acceptVersionStrategy.storage + const storage = new Storage() + + storage.set('2.0.0') + t.assert.deepEqual(storage.maxPatches, { '2.0': 0 }) + + storage.set('2.0.2') + t.assert.deepEqual(storage.maxPatches, { '2.0': 2 }) + + storage.set('2.0.1') + t.assert.deepEqual(storage.maxPatches, { '2.0': 2 }) +}) + +test('Major version must be a numeric value', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + t.assert.throws(() => findMyWay.on('GET', '/test', { constraints: { version: 'x' } }, () => {}), + new TypeError('Major version must be a numeric value')) +}) + +test('httpMethodStrategy storage handles set and get operations correctly', (t) => { + t.plan(2) + + const storage = httpMethodStrategy.storage() + + t.assert.equal(storage.get('foo'), null) + + storage.set('foo', { bar: 'baz' }) + t.assert.deepStrictEqual(storage.get('foo'), { bar: 'baz' }) +}) + +test('if buildPrettyMeta argument is undefined, will return an object', (t) => { + t.plan(1) + + const findMyWay = FindMyWay() + t.assert.deepEqual(findMyWay.buildPrettyMeta(), {}) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-44.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-44.test.js new file mode 100644 index 0000000000000000000000000000000000000000..80e4f0aa817e541173ebb7aafed263532d8adf85 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-44.test.js @@ -0,0 +1,149 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Parametric and static with shared prefix / 1', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/woo', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.on('GET', '/:param', (req, res, params) => { + t.assert.equal(params.param, 'winter') + }) + + findMyWay.lookup({ method: 'GET', url: '/winter', headers: {} }, null) +}) + +test('Parametric and static with shared prefix / 2', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/woo', (req, res, params) => { + t.assert.ok('we should be here') + }) + + findMyWay.on('GET', '/:param', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/woo', headers: {} }, null) +}) + +test('Parametric and static with shared prefix (nested)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('We should be here') + } + }) + + findMyWay.on('GET', '/woo', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.on('GET', '/:param', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/winter/coming', headers: {} }, null) +}) + +test('Parametric and static with shared prefix and different suffix', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('We should not be here') + } + }) + + findMyWay.on('GET', '/example/shared/nested/test', (req, res, params) => { + t.assert.fail('We should not be here') + }) + + findMyWay.on('GET', '/example/:param/nested/other', (req, res, params) => { + t.assert.ok('We should be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/example/shared/nested/other', headers: {} }, null) +}) + +test('Parametric and static with shared prefix (with wildcard)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/woo', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.on('GET', '/:param', (req, res, params) => { + t.assert.equal(params.param, 'winter') + }) + + findMyWay.on('GET', '/*', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/winter', headers: {} }, null) +}) + +test('Parametric and static with shared prefix (nested with wildcard)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/woo', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.on('GET', '/:param', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.on('GET', '/*', (req, res, params) => { + t.assert.equal(params['*'], 'winter/coming') + }) + + findMyWay.lookup({ method: 'GET', url: '/winter/coming', headers: {} }, null) +}) + +test('Parametric and static with shared prefix (nested with split)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here') + } + }) + + findMyWay.on('GET', '/woo', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.on('GET', '/:param', (req, res, params) => { + t.assert.equal(params.param, 'winter') + }) + + findMyWay.on('GET', '/wo', (req, res, params) => { + t.assert.fail('we should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/winter', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-46.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-46.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ba99726b12103032e59e071c9e027671e86bd67e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-46.test.js @@ -0,0 +1,75 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('If the prefixLen is higher than the pathLen we should not save the wildcard child', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.get('/static/*', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/static/').params, { '*': '' }) + t.assert.deepEqual(findMyWay.find('GET', '/static/hello').params, { '*': 'hello' }) + t.assert.deepEqual(findMyWay.find('GET', '/static'), null) +}) + +test('If the prefixLen is higher than the pathLen we should not save the wildcard child (mixed routes)', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.get('/static/*', () => {}) + findMyWay.get('/simple', () => {}) + findMyWay.get('/simple/:bar', () => {}) + findMyWay.get('/hello', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/static/').params, { '*': '' }) + t.assert.deepEqual(findMyWay.find('GET', '/static/hello').params, { '*': 'hello' }) + t.assert.deepEqual(findMyWay.find('GET', '/static'), null) +}) + +test('If the prefixLen is higher than the pathLen we should not save the wildcard child (with a root wildcard)', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.get('*', () => {}) + findMyWay.get('/static/*', () => {}) + findMyWay.get('/simple', () => {}) + findMyWay.get('/simple/:bar', () => {}) + findMyWay.get('/hello', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/static/').params, { '*': '' }) + t.assert.deepEqual(findMyWay.find('GET', '/static/hello').params, { '*': 'hello' }) + t.assert.deepEqual(findMyWay.find('GET', '/static').params, { '*': '/static' }) +}) + +test('If the prefixLen is higher than the pathLen we should not save the wildcard child (404)', t => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.get('/static/*', () => {}) + findMyWay.get('/simple', () => {}) + findMyWay.get('/simple/:bar', () => {}) + findMyWay.get('/hello', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/stati'), null) + t.assert.deepEqual(findMyWay.find('GET', '/staticc'), null) + t.assert.deepEqual(findMyWay.find('GET', '/stati/hello'), null) + t.assert.deepEqual(findMyWay.find('GET', '/staticc/hello'), null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-49.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-49.test.js new file mode 100644 index 0000000000000000000000000000000000000000..cf5430d712419f49fc782e47cfd6521f7bc2d278 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-49.test.js @@ -0,0 +1,108 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') +const noop = () => {} + +test('Defining static route after parametric - 1', t => { + t.plan(3) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/static', noop) + findMyWay.on('GET', '/:param', noop) + + t.assert.ok(findMyWay.find('GET', '/static')) + t.assert.ok(findMyWay.find('GET', '/para')) + t.assert.ok(findMyWay.find('GET', '/s')) +}) + +test('Defining static route after parametric - 2', t => { + t.plan(3) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:param', noop) + findMyWay.on('GET', '/static', noop) + + t.assert.ok(findMyWay.find('GET', '/static')) + t.assert.ok(findMyWay.find('GET', '/para')) + t.assert.ok(findMyWay.find('GET', '/s')) +}) + +test('Defining static route after parametric - 3', t => { + t.plan(4) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:param', noop) + findMyWay.on('GET', '/static', noop) + findMyWay.on('GET', '/other', noop) + + t.assert.ok(findMyWay.find('GET', '/static')) + t.assert.ok(findMyWay.find('GET', '/para')) + t.assert.ok(findMyWay.find('GET', '/s')) + t.assert.ok(findMyWay.find('GET', '/o')) +}) + +test('Defining static route after parametric - 4', t => { + t.plan(4) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/static', noop) + findMyWay.on('GET', '/other', noop) + findMyWay.on('GET', '/:param', noop) + + t.assert.ok(findMyWay.find('GET', '/static')) + t.assert.ok(findMyWay.find('GET', '/para')) + t.assert.ok(findMyWay.find('GET', '/s')) + t.assert.ok(findMyWay.find('GET', '/o')) +}) + +test('Defining static route after parametric - 5', t => { + t.plan(4) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/static', noop) + findMyWay.on('GET', '/:param', noop) + findMyWay.on('GET', '/other', noop) + + t.assert.ok(findMyWay.find('GET', '/static')) + t.assert.ok(findMyWay.find('GET', '/para')) + t.assert.ok(findMyWay.find('GET', '/s')) + t.assert.ok(findMyWay.find('GET', '/o')) +}) + +test('Should produce the same tree - 1', t => { + t.plan(1) + const findMyWay1 = FindMyWay() + const findMyWay2 = FindMyWay() + + findMyWay1.on('GET', '/static', noop) + findMyWay1.on('GET', '/:param', noop) + + findMyWay2.on('GET', '/:param', noop) + findMyWay2.on('GET', '/static', noop) + + t.assert.equal(findMyWay1.tree, findMyWay2.tree) +}) + +test('Should produce the same tree - 2', t => { + t.plan(3) + const findMyWay1 = FindMyWay() + const findMyWay2 = FindMyWay() + const findMyWay3 = FindMyWay() + + findMyWay1.on('GET', '/:param', noop) + findMyWay1.on('GET', '/static', noop) + findMyWay1.on('GET', '/other', noop) + + findMyWay2.on('GET', '/static', noop) + findMyWay2.on('GET', '/:param', noop) + findMyWay2.on('GET', '/other', noop) + + findMyWay3.on('GET', '/static', noop) + findMyWay3.on('GET', '/other', noop) + findMyWay3.on('GET', '/:param', noop) + + t.assert.equal(findMyWay1.tree, findMyWay2.tree) + t.assert.equal(findMyWay2.tree, findMyWay3.tree) + t.assert.equal(findMyWay1.tree, findMyWay3.tree) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-59.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-59.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7a3a6d4e1239115215d80dd9fa916e503f44eb25 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-59.test.js @@ -0,0 +1,131 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') +const noop = () => {} + +test('single-character prefix', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/b/', noop) + findMyWay.on('GET', '/b/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('multi-character prefix', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bu/', noop) + findMyWay.on('GET', '/bu/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('static / 1', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/', noop) + findMyWay.on('GET', '/bb/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('static / 2', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/ff/', noop) + findMyWay.on('GET', '/bb/ff/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) + t.assert.equal(findMyWay.find('GET', '/ff/bulk'), null) +}) + +test('static / 3', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/ff/', noop) + findMyWay.on('GET', '/bb/ff/bulk', noop) + findMyWay.on('GET', '/bb/ff/gg/bulk', noop) + findMyWay.on('GET', '/bb/ff/bulk/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('with parameter / 1', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:foo/', noop) + findMyWay.on('GET', '/:foo/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('with parameter / 2', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/', noop) + findMyWay.on('GET', '/bb/:foo', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('with parameter / 3', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/ff/', noop) + findMyWay.on('GET', '/bb/ff/:foo', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('with parameter / 4', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/:foo/', noop) + findMyWay.on('GET', '/bb/:foo/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('with parameter / 5', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/:foo/aa/', noop) + findMyWay.on('GET', '/bb/:foo/aa/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) + t.assert.equal(findMyWay.find('GET', '/bb/foo/bulk'), null) +}) + +test('with parameter / 6', t => { + t.plan(3) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/static/:parametric/static/:parametric', noop) + findMyWay.on('GET', '/static/:parametric/static/:parametric/bulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) + t.assert.equal(findMyWay.find('GET', '/static/foo/bulk'), null) + t.assert.notEqual(findMyWay.find('GET', '/static/foo/static/bulk'), null) +}) + +test('wildcard / 1', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/bb/', noop) + findMyWay.on('GET', '/bb/*', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-62.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-62.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7e5bde7a3637dae3da241ad301ca5a643b649029 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-62.test.js @@ -0,0 +1,28 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +const noop = function () {} + +test('issue-62', (t) => { + t.plan(2) + + const findMyWay = FindMyWay({ allowUnsafeRegex: true }) + + findMyWay.on('GET', '/foo/:id(([a-f0-9]{3},?)+)', noop) + + t.assert.ok(!findMyWay.find('GET', '/foo/qwerty')) + t.assert.ok(findMyWay.find('GET', '/foo/bac,1ea')) +}) + +test('issue-62 - escape chars', (t) => { + const findMyWay = FindMyWay() + + t.plan(2) + + findMyWay.get('/foo/:param(\\([a-f0-9]{3}\\))', noop) + + t.assert.ok(!findMyWay.find('GET', '/foo/abc')) + t.assert.ok(findMyWay.find('GET', '/foo/(abc)', {})) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-63.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-63.test.js new file mode 100644 index 0000000000000000000000000000000000000000..55bee94880fc3a52fdb8e8ee4cd3b12d0c1bc19f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-63.test.js @@ -0,0 +1,23 @@ +'use strict' + +const { test } = require('node:test') +const factory = require('../') + +const noop = function () {} + +test('issue-63', (t) => { + t.plan(2) + + const fmw = factory() + + t.assert.throws(function () { + fmw.on('GET', '/foo/:id(a', noop) + }) + + try { + fmw.on('GET', '/foo/:id(a', noop) + t.assert.fail('should fail') + } catch (err) { + t.assert.equal(err.message, 'Invalid regexp expression in "/foo/:id(a"') + } +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-67.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-67.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ac9cf59a4961e808be56b77d8cbef7116ebdba6c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-67.test.js @@ -0,0 +1,50 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') +const noop = () => {} + +test('static routes', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/b/', noop) + findMyWay.on('GET', '/b/bulk', noop) + findMyWay.on('GET', '/b/ulk', noop) + + t.assert.equal(findMyWay.find('GET', '/bulk'), null) +}) + +test('parametric routes', t => { + t.plan(5) + const findMyWay = FindMyWay() + + function foo () { } + + findMyWay.on('GET', '/foo/:fooParam', foo) + findMyWay.on('GET', '/foo/bar/:barParam', noop) + findMyWay.on('GET', '/foo/search', noop) + findMyWay.on('GET', '/foo/submit', noop) + + t.assert.equal(findMyWay.find('GET', '/foo/awesome-parameter').handler, foo) + t.assert.equal(findMyWay.find('GET', '/foo/b-first-character').handler, foo) + t.assert.equal(findMyWay.find('GET', '/foo/s-first-character').handler, foo) + t.assert.equal(findMyWay.find('GET', '/foo/se-prefix').handler, foo) + t.assert.equal(findMyWay.find('GET', '/foo/sx-prefix').handler, foo) +}) + +test('parametric with common prefix', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', noop) + findMyWay.on('GET', '/:test', (req, res, params) => { + t.assert.deepEqual( + { test: 'text' }, + params + ) + }) + findMyWay.on('GET', '/text/hello', noop) + + findMyWay.lookup({ url: '/text', method: 'GET', headers: {} }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-93.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-93.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6e57d81d1fb63bed820a77c10658526af9fa74c2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/issue-93.test.js @@ -0,0 +1,19 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') +const noop = () => {} + +test('Should keep semver store when split node', t => { + t.plan(4) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/t1', { constraints: { version: '1.0.0' } }, noop) + findMyWay.on('GET', '/t2', { constraints: { version: '2.1.0' } }, noop) + + t.assert.ok(findMyWay.find('GET', '/t1', { version: '1.0.0' })) + t.assert.ok(findMyWay.find('GET', '/t2', { version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/t1', { version: '2.x' })) + t.assert.ok(!findMyWay.find('GET', '/t2', { version: '1.0.0' })) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/lookup-async.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/lookup-async.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e1ba2c5e4744981b3024fb2c28edf11a128b4961 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/lookup-async.test.js @@ -0,0 +1,29 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('should return result in the done callback', t => { + t.plan(2) + + const router = FindMyWay() + router.on('GET', '/', () => 'asyncHandlerResult') + + router.lookup({ method: 'GET', url: '/' }, null, (err, result) => { + t.assert.equal(err, null) + t.assert.equal(result, 'asyncHandlerResult') + }) +}) + +test('should return an error in the done callback', t => { + t.plan(2) + + const router = FindMyWay() + const error = new Error('ASYNC_HANDLER_ERROR') + router.on('GET', '/', () => { throw error }) + + router.lookup({ method: 'GET', url: '/' }, null, (err, result) => { + t.assert.equal(err, error) + t.assert.equal(result, undefined) + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/lookup.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/lookup.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f7bfa0206918d1081b485f6141636fa8d93a5a62 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/lookup.test.js @@ -0,0 +1,58 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('lookup calls route handler with no context', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/example', function handle (req, res, params) { + // without context, this will be the result object returned from router.find + t.assert.equal(this.handler, handle) + }) + + findMyWay.lookup({ method: 'GET', url: '/example', headers: {} }, null) +}) + +test('lookup calls route handler with context as scope', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + const ctx = { foo: 'bar' } + + findMyWay.on('GET', '/example', function handle (req, res, params) { + t.assert.equal(this, ctx) + }) + + findMyWay.lookup({ method: 'GET', url: '/example', headers: {} }, null, ctx) +}) + +test('lookup calls default route handler with no context', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + defaultRoute (req, res) { + // without context, the default route's scope is the router itself + t.assert.equal(this, findMyWay) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/example', headers: {} }, null) +}) + +test('lookup calls default route handler with context as scope', t => { + t.plan(1) + + const ctx = { foo: 'bar' } + + const findMyWay = FindMyWay({ + defaultRoute (req, res) { + t.assert.equal(this, ctx) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/example', headers: {} }, null, ctx) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/matching-order.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/matching-order.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1f7cb952eaad58c9c76096a1165e67df087bb0d1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/matching-order.test.js @@ -0,0 +1,17 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('Matching order', t => { + t.plan(3) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/foo/bar/static', { constraints: { host: 'test' } }, () => {}) + findMyWay.on('GET', '/foo/bar/*', () => {}) + findMyWay.on('GET', '/foo/:param/static', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/foo/bar/static', { host: 'test' }).params, {}) + t.assert.deepEqual(findMyWay.find('GET', '/foo/bar/static').params, { '*': 'static' }) + t.assert.deepEqual(findMyWay.find('GET', '/foo/value/static').params, { param: 'value' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/max-param-length.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/max-param-length.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9e397d1ef94de1fa92e0a1b1f03d89ad5f24ab89 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/max-param-length.test.js @@ -0,0 +1,44 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('maxParamLength default value is 500', t => { + t.plan(1) + + const findMyWay = FindMyWay() + t.assert.equal(findMyWay.maxParamLength, 100) +}) + +test('maxParamLength should set the maximum length for a parametric route', t => { + t.plan(1) + + const findMyWay = FindMyWay({ maxParamLength: 10 }) + findMyWay.on('GET', '/test/:param', () => {}) + t.assert.deepEqual(findMyWay.find('GET', '/test/123456789abcd'), null) +}) + +test('maxParamLength should set the maximum length for a parametric (regex) route', t => { + t.plan(1) + + const findMyWay = FindMyWay({ maxParamLength: 10 }) + findMyWay.on('GET', '/test/:param(^\\d+$)', () => {}) + + t.assert.deepEqual(findMyWay.find('GET', '/test/123456789abcd'), null) +}) + +test('maxParamLength should set the maximum length for a parametric (multi) route', t => { + t.plan(1) + + const findMyWay = FindMyWay({ maxParamLength: 10 }) + findMyWay.on('GET', '/test/:param-bar', () => {}) + t.assert.deepEqual(findMyWay.find('GET', '/test/123456789abcd'), null) +}) + +test('maxParamLength should set the maximum length for a parametric (regex with suffix) route', t => { + t.plan(1) + + const findMyWay = FindMyWay({ maxParamLength: 10 }) + findMyWay.on('GET', '/test/:param(^\\w{3})bar', () => {}) + t.assert.deepEqual(findMyWay.find('GET', '/test/123456789abcd'), null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/methods.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/methods.test.js new file mode 100644 index 0000000000000000000000000000000000000000..58f5af1654c9670db3b8c622ccedb9bcbc85aaa0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/methods.test.js @@ -0,0 +1,830 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('the router is an object with methods', t => { + t.plan(4) + + const findMyWay = FindMyWay() + + t.assert.equal(typeof findMyWay.on, 'function') + t.assert.equal(typeof findMyWay.off, 'function') + t.assert.equal(typeof findMyWay.lookup, 'function') + t.assert.equal(typeof findMyWay.find, 'function') +}) + +test('on throws for invalid method', t => { + t.plan(1) + const findMyWay = FindMyWay() + + t.assert.throws(() => { + findMyWay.on('INVALID', '/a/b') + }) +}) + +test('on throws for invalid path', t => { + t.plan(3) + const findMyWay = FindMyWay() + + // Non string + t.assert.throws(() => { + findMyWay.on('GET', 1) + }) + + // Empty + t.assert.throws(() => { + findMyWay.on('GET', '') + }) + + // Doesn't start with / or * + t.assert.throws(() => { + findMyWay.on('GET', 'invalid') + }) +}) + +test('register a route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', () => { + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) +}) + +test('register a route with multiple methods', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on(['GET', 'POST'], '/test', () => { + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'POST', url: '/test', headers: {} }, null) +}) + +test('does not register /test/*/ when ignoreTrailingSlash is true', t => { + t.plan(1) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: true + }) + + findMyWay.on('GET', '/test/*', () => {}) + t.assert.equal( + findMyWay.routes.filter((r) => r.path.includes('/test')).length, + 1 + ) +}) + +test('off throws for invalid method', t => { + t.plan(1) + const findMyWay = FindMyWay() + + t.assert.throws(() => { + findMyWay.off('INVALID', '/a/b') + }) +}) + +test('off throws for invalid path', t => { + t.plan(3) + const findMyWay = FindMyWay() + + // Non string + t.assert.throws(() => { + findMyWay.off('GET', 1) + }) + + // Empty + t.assert.throws(() => { + findMyWay.off('GET', '') + }) + + // Doesn't start with / or * + t.assert.throws(() => { + findMyWay.off('GET', 'invalid') + }) +}) + +test('off with nested wildcards with parametric and static', t => { + t.plan(3) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('we should not be here, the url is: ' + req.url) + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.equal(params['*'], '/foo2/first/second') + }) + findMyWay.on('GET', '/foo1/*', () => {}) + findMyWay.on('GET', '/foo2/*', () => {}) + findMyWay.on('GET', '/foo3/:param', () => {}) + findMyWay.on('GET', '/foo3/*', () => {}) + findMyWay.on('GET', '/foo4/param/hello/test/long/route', () => {}) + + const route1 = findMyWay.find('GET', '/foo3/first/second') + t.assert.equal(route1.params['*'], 'first/second') + + findMyWay.off('GET', '/foo3/*') + + const route2 = findMyWay.find('GET', '/foo3/first/second') + t.assert.equal(route2.params['*'], '/foo3/first/second') + + findMyWay.off('GET', '/foo2/*') + findMyWay.lookup( + { method: 'GET', url: '/foo2/first/second', headers: {} }, + null + ) +}) + +test('off removes all routes when ignoreTrailingSlash is true', t => { + t.plan(6) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: true + }) + + findMyWay.on('GET', '/test1/', () => {}) + t.assert.equal(findMyWay.routes.length, 1) + + findMyWay.on('GET', '/test2', () => {}) + t.assert.equal(findMyWay.routes.length, 2) + + findMyWay.off('GET', '/test1') + t.assert.equal(findMyWay.routes.length, 1) + t.assert.equal( + findMyWay.routes.filter((r) => r.path === '/test2').length, + 1 + ) + t.assert.equal( + findMyWay.routes.filter((r) => r.path === '/test2/').length, + 0 + ) + + findMyWay.off('GET', '/test2/') + t.assert.equal(findMyWay.routes.length, 0) +}) + +test('off removes all routes when ignoreDuplicateSlashes is true', t => { + t.plan(6) + const findMyWay = FindMyWay({ + ignoreDuplicateSlashes: true + }) + + findMyWay.on('GET', '//test1', () => {}) + t.assert.equal(findMyWay.routes.length, 1) + + findMyWay.on('GET', '/test2', () => {}) + t.assert.equal(findMyWay.routes.length, 2) + + findMyWay.off('GET', '/test1') + t.assert.equal(findMyWay.routes.length, 1) + t.assert.equal( + findMyWay.routes.filter((r) => r.path === '/test2').length, + 1 + ) + t.assert.equal( + findMyWay.routes.filter((r) => r.path === '//test2').length, + 0 + ) + + findMyWay.off('GET', '//test2') + t.assert.equal(findMyWay.routes.length, 0) +}) + +test('deregister a route without children', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/a', () => {}) + findMyWay.on('GET', '/a/b', () => {}) + findMyWay.off('GET', '/a/b') + + t.assert.ok(findMyWay.find('GET', '/a')) + t.assert.ok(!findMyWay.find('GET', '/a/b')) +}) + +test('deregister a route with children', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/a', () => {}) + findMyWay.on('GET', '/a/b', () => {}) + findMyWay.off('GET', '/a') + + t.assert.ok(!findMyWay.find('GET', '/a')) + t.assert.ok(findMyWay.find('GET', '/a/b')) +}) + +test('deregister a route by method', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on(['GET', 'POST'], '/a', () => {}) + findMyWay.off('GET', '/a') + + t.assert.ok(!findMyWay.find('GET', '/a')) + t.assert.ok(findMyWay.find('POST', '/a')) +}) + +test('deregister a route with multiple methods', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on(['GET', 'POST'], '/a', () => {}) + findMyWay.off(['GET', 'POST'], '/a') + + t.assert.ok(!findMyWay.find('GET', '/a')) + t.assert.ok(!findMyWay.find('POST', '/a')) +}) + +test('reset a router', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on(['GET', 'POST'], '/a', () => {}) + findMyWay.reset() + + t.assert.ok(!findMyWay.find('GET', '/a')) + t.assert.ok(!findMyWay.find('POST', '/a')) +}) + +test('default route', t => { + t.plan(1) + + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.ok('inside the default route') + } + }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) +}) + +test('parametric route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:id', (req, res, params) => { + t.assert.equal(params.id, 'hello') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) +}) + +test('multiple parametric route', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:id', (req, res, params) => { + t.assert.equal(params.id, 'hello') + }) + + findMyWay.on('GET', '/other-test/:id', (req, res, params) => { + t.assert.equal(params.id, 'world') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/other-test/world', headers: {} }, null) +}) + +test('multiple parametric route with the same prefix', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:id', (req, res, params) => { + t.assert.equal(params.id, 'hello') + }) + + findMyWay.on('GET', '/test/:id/world', (req, res, params) => { + t.assert.equal(params.id, 'world') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/world/world', headers: {} }, null) +}) + +test('nested parametric route', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:hello/test/:world', (req, res, params) => { + t.assert.equal(params.hello, 'hello') + t.assert.equal(params.world, 'world') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello/test/world', headers: {} }, null) +}) + +test('nested parametric route with same prefix', t => { + t.plan(3) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', (req, res, params) => { + t.assert.ok('inside route') + }) + + findMyWay.on('GET', '/test/:hello/test/:world', (req, res, params) => { + t.assert.equal(params.hello, 'hello') + t.assert.equal(params.world, 'world') + }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello/test/world', headers: {} }, null) +}) + +test('long route', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/abc/def/ghi/lmn/opq/rst/uvz', (req, res, params) => { + t.assert.ok('inside long path') + }) + + findMyWay.lookup({ method: 'GET', url: '/abc/def/ghi/lmn/opq/rst/uvz', headers: {} }, null) +}) + +test('long parametric route', t => { + t.plan(3) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/abc/:def/ghi/:lmn/opq/:rst/uvz', (req, res, params) => { + t.assert.equal(params.def, 'def') + t.assert.equal(params.lmn, 'lmn') + t.assert.equal(params.rst, 'rst') + }) + + findMyWay.lookup({ method: 'GET', url: '/abc/def/ghi/lmn/opq/rst/uvz', headers: {} }, null) +}) + +test('long parametric route with common prefix', t => { + t.plan(9) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', (req, res, params) => { + throw new Error('I shoul not be here') + }) + + findMyWay.on('GET', '/abc', (req, res, params) => { + throw new Error('I shoul not be here') + }) + + findMyWay.on('GET', '/abc/:def', (req, res, params) => { + t.assert.equal(params.def, 'def') + }) + + findMyWay.on('GET', '/abc/:def/ghi/:lmn', (req, res, params) => { + t.assert.equal(params.def, 'def') + t.assert.equal(params.lmn, 'lmn') + }) + + findMyWay.on('GET', '/abc/:def/ghi/:lmn/opq/:rst', (req, res, params) => { + t.assert.equal(params.def, 'def') + t.assert.equal(params.lmn, 'lmn') + t.assert.equal(params.rst, 'rst') + }) + + findMyWay.on('GET', '/abc/:def/ghi/:lmn/opq/:rst/uvz', (req, res, params) => { + t.assert.equal(params.def, 'def') + t.assert.equal(params.lmn, 'lmn') + t.assert.equal(params.rst, 'rst') + }) + + findMyWay.lookup({ method: 'GET', url: '/abc/def', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/abc/def/ghi/lmn', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/abc/def/ghi/lmn/opq/rst', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/abc/def/ghi/lmn/opq/rst/uvz', headers: {} }, null) +}) + +test('common prefix', t => { + t.plan(4) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/f', (req, res, params) => { + t.assert.ok('inside route') + }) + + findMyWay.on('GET', '/ff', (req, res, params) => { + t.assert.ok('inside route') + }) + + findMyWay.on('GET', '/ffa', (req, res, params) => { + t.assert.ok('inside route') + }) + + findMyWay.on('GET', '/ffb', (req, res, params) => { + t.assert.ok('inside route') + }) + + findMyWay.lookup({ method: 'GET', url: '/f', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/ff', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/ffa', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/ffb', headers: {} }, null) +}) + +test('wildcard', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/*', (req, res, params) => { + t.assert.equal(params['*'], 'hello') + }) + + findMyWay.lookup( + { method: 'GET', url: '/test/hello', headers: {} }, + null + ) +}) + +test('catch all wildcard', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.equal(params['*'], '/test/hello') + }) + + findMyWay.lookup( + { method: 'GET', url: '/test/hello', headers: {} }, + null + ) +}) + +test('find should return the route', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test', fn) + + t.assert.deepEqual( + findMyWay.find('GET', '/test'), + { handler: fn, params: {}, store: null, searchParams: {} } + ) +}) + +test('find should return the route with params', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test/:id', fn) + + t.assert.deepEqual( + findMyWay.find('GET', '/test/hello'), + { handler: fn, params: { id: 'hello' }, store: null, searchParams: {} } + ) +}) + +test('find should return a null handler if the route does not exist', t => { + t.plan(1) + const findMyWay = FindMyWay() + + t.assert.deepEqual( + findMyWay.find('GET', '/test'), + null + ) +}) + +test('should decode the uri - parametric', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test/:id', fn) + + t.assert.deepEqual( + findMyWay.find('GET', '/test/he%2Fllo'), + { handler: fn, params: { id: 'he/llo' }, store: null, searchParams: {} } + ) +}) + +test('should decode the uri - wildcard', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test/*', fn) + + t.assert.deepEqual( + findMyWay.find('GET', '/test/he%2Fllo'), + { handler: fn, params: { '*': 'he/llo' }, store: null, searchParams: {} } + ) +}) + +test('safe decodeURIComponent', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test/:id', fn) + + t.assert.deepEqual( + findMyWay.find('GET', '/test/hel%"Flo'), + null + ) +}) + +test('safe decodeURIComponent - nested route', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test/hello/world/:id/blah', fn) + + t.assert.deepEqual( + findMyWay.find('GET', '/test/hello/world/hel%"Flo/blah'), + null + ) +}) + +test('safe decodeURIComponent - wildcard', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test/*', fn) + + t.assert.deepEqual( + findMyWay.find('GET', '/test/hel%"Flo'), + null + ) +}) + +test('static routes should be inserted before parametric / 1', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/hello', () => { + t.assert.ok('inside correct handler') + }) + + findMyWay.on('GET', '/test/:id', () => { + t.assert.fail('wrong handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) +}) + +test('static routes should be inserted before parametric / 2', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:id', () => { + t.assert.fail('wrong handler') + }) + + findMyWay.on('GET', '/test/hello', () => { + t.assert.ok('inside correct handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) +}) + +test('static routes should be inserted before parametric / 3', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:id', () => { + t.assert.fail('wrong handler') + }) + + findMyWay.on('GET', '/test', () => { + t.assert.ok('inside correct handler') + }) + + findMyWay.on('GET', '/test/:id', () => { + t.assert.fail('wrong handler') + }) + + findMyWay.on('GET', '/test/hello', () => { + t.assert.ok('inside correct handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) +}) + +test('static routes should be inserted before parametric / 4', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/:id', () => { + t.assert.ok('inside correct handler') + }) + + findMyWay.on('GET', '/test', () => { + t.assert.fail('wrong handler') + }) + + findMyWay.on('GET', '/test/:id', () => { + t.assert.ok('inside correct handler') + }) + + findMyWay.on('GET', '/test/hello', () => { + t.assert.fail('wrong handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/id', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/id', headers: {} }, null) +}) + +test('Static parametric with shared part of the path', t => { + t.plan(2) + + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.equal(req.url, '/example/shared/nested/oopss') + } + }) + + findMyWay.on('GET', '/example/shared/nested/test', (req, res, params) => { + t.assert.fail('We should not be here') + }) + + findMyWay.on('GET', '/example/:param/nested/oops', (req, res, params) => { + t.assert.equal(params.param, 'other') + }) + + findMyWay.lookup({ method: 'GET', url: '/example/shared/nested/oopss', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/example/other/nested/oops', headers: {} }, null) +}) + +test('parametric route with different method', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test/:id', (req, res, params) => { + t.assert.equal(params.id, 'hello') + }) + + findMyWay.on('POST', '/test/:other', (req, res, params) => { + t.assert.equal(params.other, 'world') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'POST', url: '/test/world', headers: {} }, null) +}) + +test('params does not keep the object reference', (t, done) => { + t.plan(2) + const findMyWay = FindMyWay() + let first = true + + findMyWay.on('GET', '/test/:id', (req, res, params) => { + if (first) { + setTimeout(() => { + t.assert.equal(params.id, 'hello') + }, 10) + } else { + setTimeout(() => { + t.assert.equal(params.id, 'world') + done() + }, 10) + } + first = false + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/world', headers: {} }, null) +}) + +test('Unsupported method (static)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('Everything ok') + } + }) + + findMyWay.on('GET', '/', (req, res, params) => { + t.assert.fail('We should not be here') + }) + + findMyWay.lookup({ method: 'TROLL', url: '/', headers: {} }, null) +}) + +test('Unsupported method (wildcard)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('Everything ok') + } + }) + + findMyWay.on('GET', '*', (req, res, params) => { + t.assert.fail('We should not be here') + }) + + findMyWay.lookup({ method: 'TROLL', url: '/hello/world', headers: {} }, null) +}) + +test('Unsupported method (static find)', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/', () => {}) + + t.assert.deepEqual(findMyWay.find('TROLL', '/'), null) +}) + +test('Unsupported method (wildcard find)', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '*', () => {}) + + t.assert.deepEqual(findMyWay.find('TROLL', '/hello/world'), null) +}) + +test('register all known HTTP methods', t => { + t.plan(6) + const findMyWay = FindMyWay() + + const httpMethods = require('../lib/http-methods') + const handlers = {} + for (const i in httpMethods) { + const m = httpMethods[i] + handlers[m] = function myHandler () {} + findMyWay.on(m, '/test', handlers[m]) + } + + t.assert.ok(findMyWay.find('COPY', '/test')) + t.assert.equal(findMyWay.find('COPY', '/test').handler, handlers.COPY) + + t.assert.ok(findMyWay.find('SUBSCRIBE', '/test')) + t.assert.equal(findMyWay.find('SUBSCRIBE', '/test').handler, handlers.SUBSCRIBE) + + t.assert.ok(findMyWay.find('M-SEARCH', '/test')) + t.assert.equal(findMyWay.find('M-SEARCH', '/test').handler, handlers['M-SEARCH']) +}) + +test('off removes all routes without checking constraints if no constraints are specified', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', {}, (req, res) => {}) + findMyWay.on('GET', '/test', { constraints: { host: 'example.com' } }, (req, res) => {}) + + findMyWay.off('GET', '/test') + + t.assert.equal(findMyWay.routes.length, 0) +}) + +test('off removes only constrainted routes if constraints are specified', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', {}, (req, res) => {}) + findMyWay.on('GET', '/test', { constraints: { host: 'example.com' } }, (req, res) => {}) + + findMyWay.off('GET', '/test', { host: 'example.com' }) + + t.assert.equal(findMyWay.routes.length, 1) + t.assert.ok(!findMyWay.routes[0].opts.constraints) +}) + +test('off removes no routes if provided constraints does not match any registered route', t => { + t.plan(1) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', {}, (req, res) => {}) + findMyWay.on('GET', '/test', { constraints: { version: '2.x' } }, (req, res) => {}) + findMyWay.on('GET', '/test', { constraints: { version: '3.x' } }, (req, res) => {}) + + findMyWay.off('GET', '/test', { version: '1.x' }) + + t.assert.equal(findMyWay.routes.length, 3) +}) + +test('off validates that constraints is an object or undefined', t => { + t.plan(6) + + const findMyWay = FindMyWay() + + t.assert.throws(() => findMyWay.off('GET', '/', 2)) + t.assert.throws(() => findMyWay.off('GET', '/', 'should throw')) + t.assert.throws(() => findMyWay.off('GET', '/', [])) + t.assert.doesNotThrow(() => findMyWay.off('GET', '/', undefined)) + t.assert.doesNotThrow(() => findMyWay.off('GET', '/', {})) + t.assert.doesNotThrow(() => findMyWay.off('GET', '/')) +}) + +test('off removes only unconstrainted route if an empty object is given as constraints', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.get('/', {}, () => {}) + findMyWay.get('/', { constraints: { host: 'fastify.io' } }, () => {}) + + findMyWay.off('GET', '/', {}) + + t.assert.equal(findMyWay.routes.length, 1) + t.assert.equal(findMyWay.routes[0].opts.constraints.host, 'fastify.io') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/null-object.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/null-object.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6f225b16397da37d148d4c75a2887b84dbbe4e50 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/null-object.test.js @@ -0,0 +1,36 @@ +'use strict' + +const { test } = require('node:test') +const { NullObject } = require('../lib/null-object') + +test('NullObject', t => { + t.plan(2) + const nullObject = new NullObject() + t.assert.ok(nullObject instanceof NullObject) + t.assert.ok(typeof nullObject === 'object') +}) + +test('has no methods from generic Object class', t => { + function getAllPropertyNames (obj) { + const props = [] + + do { + Object.getOwnPropertyNames(obj).forEach(function (prop) { + if (props.indexOf(prop) === -1) { + props.push(prop) + } + }) + } while (obj = Object.getPrototypeOf(obj)) // eslint-disable-line + + return props + } + const propertyNames = getAllPropertyNames({}) + t.plan(propertyNames.length + 1) + + const nullObject = new NullObject() + + for (const propertyName of propertyNames) { + t.assert.ok(!(propertyName in nullObject), propertyName) + } + t.assert.equal(getAllPropertyNames(nullObject).length, 0) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/on-bad-url.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/on-bad-url.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3bc211e45783bcdc34eb199ef6c7ec8c9552c041 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/on-bad-url.test.js @@ -0,0 +1,72 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('If onBadUrl is defined, then a bad url should be handled differently (find)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + }, + onBadUrl: (path, req, res) => { + t.assert.equal(path, '/%world', { todo: 'this is not executed' }) + } + }) + + findMyWay.on('GET', '/hello/:id', (req, res) => { + t.assert.fail('Should not be here') + }) + + const handle = findMyWay.find('GET', '/hello/%world') + t.assert.notDeepStrictEqual(handle, null) +}) + +test('If onBadUrl is defined, then a bad url should be handled differently (lookup)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + }, + onBadUrl: (path, req, res) => { + t.assert.equal(path, '/hello/%world') + } + }) + + findMyWay.on('GET', '/hello/:id', (req, res) => { + t.assert.fail('Should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/hello/%world', headers: {} }, null) +}) + +test('If onBadUrl is not defined, then we should call the defaultRoute (find)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/hello/:id', (req, res) => { + t.assert.fail('Should not be here') + }) + + const handle = findMyWay.find('GET', '/hello/%world') + t.assert.equal(handle, null) +}) + +test('If onBadUrl is not defined, then we should call the defaultRoute (lookup)', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.ok('Everything fine') + } + }) + + findMyWay.on('GET', '/hello/:id', (req, res) => { + t.assert.fail('Should not be here') + }) + + findMyWay.lookup({ method: 'GET', url: '/hello/%world', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/optional-params.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/optional-params.test.js new file mode 100644 index 0000000000000000000000000000000000000000..844181d5536453627e1e75b25056d8f3d0ec5a6b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/optional-params.test.js @@ -0,0 +1,216 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('Test route with optional parameter', (t) => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:param/b/:optional?', (req, res, params) => { + if (params.optional) { + t.assert.equal(params.optional, 'foo') + } else { + t.assert.equal(params.optional, undefined) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar/b', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar/b/foo', headers: {} }, null) +}) + +test('Test for duplicate route with optional param', (t) => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/foo/:bar?', (req, res, params) => {}) + + try { + findMyWay.on('GET', '/foo', (req, res, params) => {}) + t.assert.fail('method is already declared for route with optional param') + } catch (e) { + t.assert.equal(e.message, 'Method \'GET\' already declared for route \'/foo\' with constraints \'{}\'') + } +}) + +test('Test for param with ? not at the end', (t) => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + try { + findMyWay.on('GET', '/foo/:bar?/baz', (req, res, params) => {}) + t.assert.fail('Optional Param in the middle of the path is not allowed') + } catch (e) { + t.assert.equal(e.message, 'Optional Parameter needs to be the last parameter of the path') + } +}) + +test('Multi parametric route with optional param', (t) => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:p1-:p2?', (req, res, params) => { + if (params.p1 && params.p2) { + t.assert.equal(params.p1, 'foo-bar') + t.assert.equal(params.p2, 'baz') + } + }) + + findMyWay.lookup({ method: 'GET', url: '/a/foo-bar-baz', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/a', headers: {} }, null) +}) + +test('Optional Parameter with ignoreTrailingSlash = true', (t) => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: true, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/test/hello/:optional?', (req, res, params) => { + if (params.optional) { + t.assert.equal(params.optional, 'foo') + } else { + t.assert.equal(params.optional, undefined) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello/', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello/foo', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello/foo/', headers: {} }, null) +}) + +test('Optional Parameter with ignoreTrailingSlash = false', (t) => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: false, + defaultRoute: (req, res) => { + t.assert.equal(req.url, '/test/hello/foo/') + } + }) + + findMyWay.on('GET', '/test/hello/:optional?', (req, res, params) => { + if (req.url === '/test/hello/') { + t.assert.deepEqual(params, { optional: '' }) + } else if (req.url === '/test/hello') { + t.assert.deepEqual(params, {}) + } else if (req.url === '/test/hello/foo') { + t.assert.deepEqual(params, { optional: 'foo' }) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/test/hello/', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello/foo', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello/foo/', headers: {} }, null) +}) + +test('Optional Parameter with ignoreDuplicateSlashes = true', (t) => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreDuplicateSlashes: true, + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/test/hello/:optional?', (req, res, params) => { + if (params.optional) { + t.assert.equal(params.optional, 'foo') + } else { + t.assert.equal(params.optional, undefined) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/test//hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello/foo', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test//hello//foo', headers: {} }, null) +}) + +test('Optional Parameter with ignoreDuplicateSlashes = false', (t) => { + t.plan(4) + const findMyWay = FindMyWay({ + ignoreDuplicateSlashes: false, + defaultRoute: (req, res) => { + if (req.url === '/test//hello') { + t.assert.deepEqual(req.params, undefined) + } else if (req.url === '/test//hello/foo') { + t.assert.deepEqual(req.params, undefined) + } + } + }) + + findMyWay.on('GET', '/test/hello/:optional?', (req, res, params) => { + if (req.url === '/test/hello/') { + t.assert.deepEqual(params, { optional: '' }) + } else if (req.url === '/test/hello') { + t.assert.deepEqual(params, {}) + } else if (req.url === '/test/hello/foo') { + t.assert.deepEqual(params, { optional: 'foo' }) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/test//hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/hello/foo', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test//hello/foo', headers: {} }, null) +}) + +test('deregister a route with optional param', (t) => { + t.plan(4) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/a/:param/b/:optional?', (req, res, params) => {}) + + t.assert.ok(findMyWay.find('GET', '/a/:param/b')) + t.assert.ok(findMyWay.find('GET', '/a/:param/b/:optional')) + + findMyWay.off('GET', '/a/:param/b/:optional?') + + t.assert.ok(!findMyWay.find('GET', '/a/:param/b')) + t.assert.ok(!findMyWay.find('GET', '/a/:param/b/:optional')) +}) + +test('optional parameter on root', (t) => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + t.assert.fail('Should not be defaultRoute') + } + }) + + findMyWay.on('GET', '/:optional?', (req, res, params) => { + if (params.optional) { + t.assert.equal(params.optional, 'foo') + } else { + t.assert.equal(params.optional, undefined) + } + }) + + findMyWay.lookup({ method: 'GET', url: '/', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/foo', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/params-collisions.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/params-collisions.test.js new file mode 100644 index 0000000000000000000000000000000000000000..03fac6bc78db983329c1423236f2c45d03646bf9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/params-collisions.test.js @@ -0,0 +1,126 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('..') + +test('should setup parametric and regexp node', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + const paramHandler = () => {} + const regexpHandler = () => {} + + findMyWay.on('GET', '/foo/:bar', paramHandler) + findMyWay.on('GET', '/foo/:bar(123)', regexpHandler) + + t.assert.equal(findMyWay.find('GET', '/foo/value').handler, paramHandler) + t.assert.equal(findMyWay.find('GET', '/foo/123').handler, regexpHandler) +}) + +test('should setup parametric and multi-parametric node', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + const paramHandler = () => {} + const regexpHandler = () => {} + + findMyWay.on('GET', '/foo/:bar', paramHandler) + findMyWay.on('GET', '/foo/:bar.png', regexpHandler) + + t.assert.equal(findMyWay.find('GET', '/foo/value').handler, paramHandler) + t.assert.equal(findMyWay.find('GET', '/foo/value.png').handler, regexpHandler) +}) + +test('should throw when set upping two parametric nodes', t => { + t.plan(1) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo/:bar', () => {}) + + t.assert.throws(() => findMyWay.on('GET', '/foo/:baz', () => {})) +}) + +test('should throw when set upping two regexp nodes', t => { + t.plan(1) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo/:bar(123)', () => {}) + + t.assert.throws(() => findMyWay.on('GET', '/foo/:bar(456)', () => {})) +}) + +test('should set up two parametric nodes with static ending', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + const paramHandler1 = () => {} + const paramHandler2 = () => {} + + findMyWay.on('GET', '/foo/:bar.png', paramHandler1) + findMyWay.on('GET', '/foo/:bar.jpeg', paramHandler2) + + t.assert.equal(findMyWay.find('GET', '/foo/value.png').handler, paramHandler1) + t.assert.equal(findMyWay.find('GET', '/foo/value.jpeg').handler, paramHandler2) +}) + +test('should set up two regexp nodes with static ending', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + const paramHandler1 = () => {} + const paramHandler2 = () => {} + + findMyWay.on('GET', '/foo/:bar(123).png', paramHandler1) + findMyWay.on('GET', '/foo/:bar(456).jpeg', paramHandler2) + + t.assert.equal(findMyWay.find('GET', '/foo/123.png').handler, paramHandler1) + t.assert.equal(findMyWay.find('GET', '/foo/456.jpeg').handler, paramHandler2) +}) + +test('node with longer static suffix should have higher priority', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + const paramHandler1 = () => {} + const paramHandler2 = () => {} + + findMyWay.on('GET', '/foo/:bar.png', paramHandler1) + findMyWay.on('GET', '/foo/:bar.png.png', paramHandler2) + + t.assert.equal(findMyWay.find('GET', '/foo/value.png').handler, paramHandler1) + t.assert.equal(findMyWay.find('GET', '/foo/value.png.png').handler, paramHandler2) +}) + +test('node with longer static suffix should have higher priority', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + const paramHandler1 = () => {} + const paramHandler2 = () => {} + + findMyWay.on('GET', '/foo/:bar.png.png', paramHandler2) + findMyWay.on('GET', '/foo/:bar.png', paramHandler1) + + t.assert.equal(findMyWay.find('GET', '/foo/value.png').handler, paramHandler1) + t.assert.equal(findMyWay.find('GET', '/foo/value.png.png').handler, paramHandler2) +}) + +test('should set up regexp node and node with static ending', t => { + t.plan(2) + + const regexHandler = () => {} + const multiParamHandler = () => {} + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/foo/:bar(123)', regexHandler) + findMyWay.on('GET', '/foo/:bar(123).jpeg', multiParamHandler) + + t.assert.equal(findMyWay.find('GET', '/foo/123.jpeg').handler, multiParamHandler) + t.assert.equal(findMyWay.find('GET', '/foo/123').handler, regexHandler) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/path-params-match.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/path-params-match.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3978017d76304daf466cbd91e6d0b83165308a8a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/path-params-match.test.js @@ -0,0 +1,53 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('path params match', (t) => { + t.plan(24) + + const findMyWay = FindMyWay({ ignoreTrailingSlash: true, ignoreDuplicateSlashes: true }) + + const b1Path = function b1StaticPath () {} + const b2Path = function b2StaticPath () {} + const cPath = function cStaticPath () {} + const paramPath = function parameterPath () {} + + findMyWay.on('GET', '/ab1', b1Path) + findMyWay.on('GET', '/ab2', b2Path) + findMyWay.on('GET', '/ac', cPath) + findMyWay.on('GET', '/:pam', paramPath) + + t.assert.equal(findMyWay.find('GET', '/ab1').handler, b1Path) + t.assert.equal(findMyWay.find('GET', '/ab1/').handler, b1Path) + t.assert.equal(findMyWay.find('GET', '//ab1').handler, b1Path) + t.assert.equal(findMyWay.find('GET', '//ab1//').handler, b1Path) + t.assert.equal(findMyWay.find('GET', '/ab2').handler, b2Path) + t.assert.equal(findMyWay.find('GET', '/ab2/').handler, b2Path) + t.assert.equal(findMyWay.find('GET', '//ab2').handler, b2Path) + t.assert.equal(findMyWay.find('GET', '//ab2//').handler, b2Path) + t.assert.equal(findMyWay.find('GET', '/ac').handler, cPath) + t.assert.equal(findMyWay.find('GET', '/ac/').handler, cPath) + t.assert.equal(findMyWay.find('GET', '//ac').handler, cPath) + t.assert.equal(findMyWay.find('GET', '//ac//').handler, cPath) + t.assert.equal(findMyWay.find('GET', '/foo').handler, paramPath) + t.assert.equal(findMyWay.find('GET', '/foo/').handler, paramPath) + t.assert.equal(findMyWay.find('GET', '//foo').handler, paramPath) + t.assert.equal(findMyWay.find('GET', '//foo//').handler, paramPath) + + const noTrailingSlashRet = findMyWay.find('GET', '/abcdef') + t.assert.equal(noTrailingSlashRet.handler, paramPath) + t.assert.deepEqual(noTrailingSlashRet.params, { pam: 'abcdef' }) + + const trailingSlashRet = findMyWay.find('GET', '/abcdef/') + t.assert.equal(trailingSlashRet.handler, paramPath) + t.assert.deepEqual(trailingSlashRet.params, { pam: 'abcdef' }) + + const noDuplicateSlashRet = findMyWay.find('GET', '/abcdef') + t.assert.equal(noDuplicateSlashRet.handler, paramPath) + t.assert.deepEqual(noDuplicateSlashRet.params, { pam: 'abcdef' }) + + const duplicateSlashRet = findMyWay.find('GET', '//abcdef') + t.assert.equal(duplicateSlashRet.handler, paramPath) + t.assert.deepEqual(duplicateSlashRet.params, { pam: 'abcdef' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/pretty-print-tree.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/pretty-print-tree.test.js new file mode 100644 index 0000000000000000000000000000000000000000..39f49fd7be0bc8a877a97fccb219cd44869eb609 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/pretty-print-tree.test.js @@ -0,0 +1,596 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('pretty print - empty tree', t => { + t.plan(2) + + const findMyWay = FindMyWay() + const tree = findMyWay.prettyPrint({ method: 'GET' }) + + const expected = '(empty tree)' + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - static routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/hello/world', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET' }) + const expected = `\ +└── / + ├── test (GET) + │ └── /hello (GET) + └── hello/world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('GET', '/hello/:world', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET' }) + const expected = `\ +└── / + ├── test (GET) + │ └── / + │ └── :hello (GET) + └── hello/ + └── :world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/static', () => {}) + findMyWay.on('GET', '/static/:param/suffix1', () => {}) + findMyWay.on('GET', '/static/:param(123)/suffix2', () => {}) + findMyWay.on('GET', '/static/:param(123).end/suffix3', () => {}) + findMyWay.on('GET', '/static/:param1(123).:param2(456)/suffix4', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET' }) + const expected = `\ +└── / + └── static (GET) + └── / + ├── :param(123).end + │ └── /suffix3 (GET) + ├── :param(123) + │ └── /suffix2 (GET) + ├── :param1(123).:param2(456) + │ └── /suffix4 (GET) + └── :param + └── /suffix1 (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/static', () => {}) + findMyWay.on('GET', '/static/:param/suffix1', () => {}) + findMyWay.on('GET', '/static/:param(123)/suffix2', () => {}) + findMyWay.on('GET', '/static/:param(123).end/suffix3', () => {}) + findMyWay.on('GET', '/static/:param1(123).:param2(456)/suffix4', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET', commonPrefix: false }) + const expected = `\ +└── /static (GET) + ├── /:param(123).end/suffix3 (GET) + ├── /:param(123)/suffix2 (GET) + ├── /:param1(123).:param2(456)/suffix4 (GET) + └── /:param/suffix1 (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - mixed parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('POST', '/test/:hello', () => {}) + findMyWay.on('GET', '/test/:hello/world', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET' }) + const expected = `\ +└── / + └── test (GET) + └── / + └── :hello (GET) + └── /world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - wildcard routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/*', () => {}) + findMyWay.on('GET', '/hello/*', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET' }) + const expected = `\ +└── / + ├── test (GET) + │ └── / + │ └── * (GET) + └── hello/ + └── * (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes with same parent and followed by a static route which has the same prefix with the former routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello/:id', () => {}) + findMyWay.on('POST', '/test/hello/:id', () => {}) + findMyWay.on('GET', '/test/helloworld', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET' }) + const expected = `\ +└── / + └── test (GET) + └── /hello + ├── / + │ └── :id (GET) + └── world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - constrained parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET' }) + const expected = `\ +└── / + └── test (GET) + test (GET) {"host":"auth.fastify.io"} + └── / + └── :hello (GET) + :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - multiple parameters are drawn appropriately', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + // routes with a nested parameter (i.e. no handler for the /:param) were breaking the display + findMyWay.on('GET', '/test/:hello/there/:ladies', () => {}) + findMyWay.on('GET', '/test/:hello/there/:ladies/and/:gents', () => {}) + findMyWay.on('GET', '/test/are/:you/:ready/to/:rock', () => {}) + + const tree = findMyWay.prettyPrint({ method: 'GET', commonPrefix: false }) + const expected = `\ +└── /test (GET) + ├── /are/:you/:ready/to/:rock (GET) + └── /:hello/there/:ladies (GET) + └── /and/:gents (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print commonPrefix - use routes array to draw flattened routes', t => { + t.plan(4) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/testing', () => {}) + findMyWay.on('GET', '/testing/:param', () => {}) + findMyWay.on('GET', '/update', () => {}) + + const radixTree = findMyWay.prettyPrint({ method: 'GET', commonPrefix: true }) + const arrayTree = findMyWay.prettyPrint({ method: 'GET', commonPrefix: false }) + + const radixExpected = `\ +└── / + ├── test (GET) + │ ├── /hello (GET) + │ └── ing (GET) + │ └── / + │ └── :param (GET) + └── update (GET) +` + + const arrayExpected = `\ +├── /test (GET) +│ ├── /hello (GET) +│ └── ing (GET) +│ └── /:param (GET) +└── /update (GET) +` + + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixExpected) + + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) +}) + +test('pretty print commonPrefix - handle wildcard root', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '*', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/testing', () => {}) + findMyWay.on('GET', '/testing/:param', () => {}) + findMyWay.on('PUT', '/update', () => {}) + + const arrayTree = findMyWay.prettyPrint({ method: 'GET', commonPrefix: false }) + const arrayExpected = `\ +├── /test/hello (GET) +├── /testing (GET) +│ └── /:param (GET) +└── * (GET) +` + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) +}) + +test('pretty print commonPrefix - handle wildcard root', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '*', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/testing', () => {}) + findMyWay.on('GET', '/testing/:param', () => {}) + findMyWay.on('PUT', '/update', () => {}) + + const radixTree = findMyWay.prettyPrint({ method: 'GET' }) + const radixExpected = `\ +└── (empty root node) + ├── / + │ └── test + │ ├── /hello (GET) + │ └── ing (GET) + │ └── / + │ └── :param (GET) + └── * (GET) +` + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixExpected) +}) + +test('pretty print commonPrefix - handle constrained routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('PUT', '/test/:hello', () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const arrayTree = findMyWay.prettyPrint({ method: 'GET', commonPrefix: false }) + const arrayExpected = `\ +└── /test (GET) + /test (GET) {"host":"auth.fastify.io"} + └── /:hello (GET) + /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) +}) + +test('pretty print includeMeta - commonPrefix: true', t => { + t.plan(6) + + const findMyWay = FindMyWay() + const namedFunction = () => {} + const store = { + onRequest: [() => {}, namedFunction], + onTimeout: [() => {}], + genericMeta: 'meta', + mixedMeta: ['mixed items', { an: 'object' }], + objectMeta: { one: '1', two: 2 }, + functionMeta: namedFunction + } + + store[Symbol('symbolKey')] = Symbol('symbolValue') + + findMyWay.on('GET', '/test', () => {}, store) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}, store) + findMyWay.on('GET', '/testing/:hello', () => {}, store) + findMyWay.on('PUT', '/tested/:hello', () => {}, store) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const radixTree = findMyWay.prettyPrint({ + method: 'GET', + commonPrefix: true, + includeMeta: true + }) + const radixTreeExpected = `\ +└── / + └── test (GET) + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + test (GET) {"host":"auth.fastify.io"} + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + ├── ing/ + │ └── :hello (GET) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (onTimeout) ["anonymous()"] + │ • (genericMeta) "meta" + │ • (mixedMeta) ["mixed items",{"an":"object"}] + │ • (objectMeta) {"one":"1","two":2} + │ • (functionMeta) "namedFunction()" + │ • (Symbol(symbolKey)) "Symbol(symbolValue)" + └── / + └── :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + const radixTreeSpecific = findMyWay.prettyPrint({ + method: 'GET', + commonPrefix: true, + includeMeta: ['onTimeout', 'objectMeta', 'nonExistent'] + }) + const radixTreeSpecificExpected = `\ +└── / + └── test (GET) + • (onTimeout) ["anonymous()"] + • (objectMeta) {"one":"1","two":2} + test (GET) {"host":"auth.fastify.io"} + • (onTimeout) ["anonymous()"] + • (objectMeta) {"one":"1","two":2} + ├── ing/ + │ └── :hello (GET) + │ • (onTimeout) ["anonymous()"] + │ • (objectMeta) {"one":"1","two":2} + └── / + └── :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + const radixTreeNoMeta = findMyWay.prettyPrint({ + method: 'GET', + commonPrefix: true, + includeMeta: false + }) + const radixTreeNoMetaExpected = `\ +└── / + └── test (GET) + test (GET) {"host":"auth.fastify.io"} + ├── ing/ + │ └── :hello (GET) + └── / + └── :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixTreeExpected) + + t.assert.equal(typeof radixTreeSpecific, 'string') + t.assert.equal(radixTreeSpecific, radixTreeSpecificExpected) + + t.assert.equal(typeof radixTreeNoMeta, 'string') + t.assert.equal(radixTreeNoMeta, radixTreeNoMetaExpected) +}) + +test('pretty print includeMeta - commonPrefix: false', t => { + t.plan(6) + + const findMyWay = FindMyWay() + const namedFunction = () => {} + const store = { + onRequest: [() => {}, namedFunction], + onTimeout: [() => {}], + genericMeta: 'meta', + mixedMeta: ['mixed items', { an: 'object' }], + objectMeta: { one: '1', two: 2 }, + functionMeta: namedFunction + } + + store[Symbol('symbolKey')] = Symbol('symbolValue') + + findMyWay.on('GET', '/test', () => {}, store) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}, store) + findMyWay.on('GET', '/testing/:hello', () => {}, store) + findMyWay.on('PUT', '/tested/:hello', () => {}, store) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const arrayTree = findMyWay.prettyPrint({ + method: 'GET', + commonPrefix: false, + includeMeta: true + }) + const arrayExpected = `\ +└── /test (GET) + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + /test (GET) {"host":"auth.fastify.io"} + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + ├── ing/:hello (GET) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (onTimeout) ["anonymous()"] + │ • (genericMeta) "meta" + │ • (mixedMeta) ["mixed items",{"an":"object"}] + │ • (objectMeta) {"one":"1","two":2} + │ • (functionMeta) "namedFunction()" + │ • (Symbol(symbolKey)) "Symbol(symbolValue)" + └── /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + const arraySpecific = findMyWay.prettyPrint({ + method: 'GET', + commonPrefix: false, + includeMeta: ['onRequest', 'mixedMeta', 'nonExistent'] + }) + const arraySpecificExpected = `\ +└── /test (GET) + • (onRequest) ["anonymous()","namedFunction()"] + • (mixedMeta) ["mixed items",{"an":"object"}] + /test (GET) {"host":"auth.fastify.io"} + • (onRequest) ["anonymous()","namedFunction()"] + • (mixedMeta) ["mixed items",{"an":"object"}] + ├── ing/:hello (GET) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (mixedMeta) ["mixed items",{"an":"object"}] + └── /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + const arrayNoMeta = findMyWay.prettyPrint({ + method: 'GET', + commonPrefix: false, + includeMeta: false + }) + const arrayNoMetaExpected = `\ +└── /test (GET) + /test (GET) {"host":"auth.fastify.io"} + ├── ing/:hello (GET) + └── /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) + + t.assert.equal(typeof arraySpecific, 'string') + t.assert.equal(arraySpecific, arraySpecificExpected) + + t.assert.equal(typeof arrayNoMeta, 'string') + t.assert.equal(arrayNoMeta, arrayNoMetaExpected) +}) + +test('pretty print includeMeta - buildPrettyMeta function', t => { + t.plan(4) + + const findMyWay = FindMyWay({ + buildPrettyMeta: route => { + return { metaKey: route.method === 'GET' ? route.path : 'not a GET route' } + } + }) + const namedFunction = () => {} + const store = { + onRequest: [() => {}, namedFunction], + onTimeout: [() => {}], + genericMeta: 'meta', + mixedMeta: ['mixed items', { an: 'object' }], + objectMeta: { one: '1', two: 2 }, + functionMeta: namedFunction + } + + store[Symbol('symbolKey')] = Symbol('symbolValue') + + findMyWay.on('GET', '/test', () => {}, store) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}, store) + findMyWay.on('GET', '/test/:hello', () => {}, store) + findMyWay.on('PUT', '/test/:hello', () => {}, store) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const arrayTree = findMyWay.prettyPrint({ + method: 'GET', + commonPrefix: false, + includeMeta: true + }) + const arrayExpected = `\ +└── /test (GET) + • (metaKey) "/test" + /test (GET) {"host":"auth.fastify.io"} + • (metaKey) "/test" + └── /:hello (GET) + • (metaKey) "/test/:hello" + /:hello (GET) {"version":"1.1.2"} + • (metaKey) "/test/:hello" + /:hello (GET) {"version":"2.0.0"} + • (metaKey) "/test/:hello" +` + const radixTree = findMyWay.prettyPrint({ + method: 'GET', + includeMeta: true + }) + const radixExpected = `\ +└── / + └── test (GET) + • (metaKey) "/test" + test (GET) {"host":"auth.fastify.io"} + • (metaKey) "/test" + └── / + └── :hello (GET) + • (metaKey) "/test/:hello" + :hello (GET) {"version":"1.1.2"} + • (metaKey) "/test/:hello" + :hello (GET) {"version":"2.0.0"} + • (metaKey) "/test/:hello" +` + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) + + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixExpected) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/pretty-print.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/pretty-print.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d02e8d43e0d8876955f022025dadaab8ab37a5c5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/pretty-print.test.js @@ -0,0 +1,680 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('pretty print - empty tree', t => { + t.plan(2) + + const findMyWay = FindMyWay() + const tree = findMyWay.prettyPrint() + + const expected = '(empty tree)' + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - static routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/hello/world', () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + ├── test (GET) + │ └── /hello (GET) + └── hello/world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('GET', '/hello/:world', () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + ├── test (GET) + │ └── / + │ └── :hello (GET) + └── hello/ + └── :world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/static', () => {}) + findMyWay.on('GET', '/static/:param/suffix1', () => {}) + findMyWay.on('GET', '/static/:param(123)/suffix2', () => {}) + findMyWay.on('GET', '/static/:param(123).end/suffix3', () => {}) + findMyWay.on('GET', '/static/:param1(123).:param2(456)/suffix4', () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + └── static (GET) + └── / + ├── :param(123).end + │ └── /suffix3 (GET) + ├── :param(123) + │ └── /suffix2 (GET) + ├── :param1(123).:param2(456) + │ └── /suffix4 (GET) + └── :param + └── /suffix1 (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/static', () => {}) + findMyWay.on('GET', '/static/:param/suffix1', () => {}) + findMyWay.on('GET', '/static/:param(123)/suffix2', () => {}) + findMyWay.on('GET', '/static/:param(123).end/suffix3', () => {}) + findMyWay.on('GET', '/static/:param1(123).:param2(456)/suffix4', () => {}) + + const tree = findMyWay.prettyPrint({ commonPrefix: false }) + const expected = `\ +└── /static (GET) + ├── /:param(123).end/suffix3 (GET) + ├── /:param(123)/suffix2 (GET) + ├── /:param1(123).:param2(456)/suffix4 (GET) + └── /:param/suffix1 (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - mixed parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('POST', '/test/:hello', () => {}) + findMyWay.on('GET', '/test/:hello/world', () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + └── test (GET) + └── / + └── :hello (GET, POST) + └── /world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - wildcard routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/*', () => {}) + findMyWay.on('GET', '/hello/*', () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + ├── test (GET) + │ └── / + │ └── * (GET) + └── hello/ + └── * (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - parametric routes with same parent and followed by a static route which has the same prefix with the former routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello/:id', () => {}) + findMyWay.on('POST', '/test/hello/:id', () => {}) + findMyWay.on('GET', '/test/helloworld', () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + └── test (GET) + └── /hello + ├── / + │ └── :id (GET, POST) + └── world (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - constrained parametric routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + └── test (GET) + test (GET) {"host":"auth.fastify.io"} + └── / + └── :hello (GET) + :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - multiple parameters are drawn appropriately', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + // routes with a nested parameter (i.e. no handler for the /:param) were breaking the display + findMyWay.on('GET', '/test/:hello/there/:ladies', () => {}) + findMyWay.on('GET', '/test/:hello/there/:ladies/and/:gents', () => {}) + findMyWay.on('GET', '/test/are/:you/:ready/to/:rock', () => {}) + + const tree = findMyWay.prettyPrint({ commonPrefix: false }) + const expected = `\ +└── /test (GET) + ├── /are/:you/:ready/to/:rock (GET) + └── /:hello/there/:ladies (GET) + └── /and/:gents (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print - multiple parameters are drawn appropriately', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', () => {}) + // routes with a nested parameter (i.e. no handler for the /:param) were breaking the display + findMyWay.on('GET', '/test/:hello/there/:ladies', () => {}) + findMyWay.on('GET', '/test/:hello/there/:ladies/and/:gents', () => {}) + findMyWay.on('GET', '/test/are/:you/:ready/to/:rock', () => {}) + + const tree = findMyWay.prettyPrint({ commonPrefix: false }) + const expected = `\ +└── /test (GET) + ├── /are/:you/:ready/to/:rock (GET) + └── /:hello/there/:ladies (GET) + └── /and/:gents (GET) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) + +test('pretty print commonPrefix - use routes array to draw flattened routes', t => { + t.plan(4) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/testing', () => {}) + findMyWay.on('GET', '/testing/:param', () => {}) + findMyWay.on('PUT', '/update', () => {}) + + const radixTree = findMyWay.prettyPrint({ commonPrefix: true }) + const arrayTree = findMyWay.prettyPrint({ commonPrefix: false }) + + const radixExpected = `\ +└── / + ├── test (GET) + │ ├── /hello (GET) + │ └── ing (GET) + │ └── / + │ └── :param (GET) + └── update (PUT) +` + + const arrayExpected = `\ +├── /test (GET) +│ ├── /hello (GET) +│ └── ing (GET) +│ └── /:param (GET) +└── /update (PUT) +` + + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixExpected) + + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) +}) + +test('pretty print commonPrefix - handle wildcard root', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('OPTIONS', '*', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/testing', () => {}) + findMyWay.on('GET', '/testing/:param', () => {}) + findMyWay.on('PUT', '/update', () => {}) + + const arrayTree = findMyWay.prettyPrint({ commonPrefix: false }) + const arrayExpected = `\ +├── /test/hello (GET) +├── /testing (GET) +│ └── /:param (GET) +├── /update (PUT) +└── * (OPTIONS) +` + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) +}) + +test('pretty print commonPrefix - handle wildcard root', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '*', () => {}) + findMyWay.on('GET', '/test/hello', () => {}) + findMyWay.on('GET', '/testing', () => {}) + findMyWay.on('GET', '/testing/:param', () => {}) + findMyWay.on('PUT', '/update', () => {}) + + const radixTree = findMyWay.prettyPrint() + const radixExpected = `\ +└── (empty root node) + ├── / + │ ├── test + │ │ ├── /hello (GET) + │ │ └── ing (GET) + │ │ └── / + │ │ └── :param (GET) + │ └── update (PUT) + └── * (GET) +` + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixExpected) +}) + +test('pretty print commonPrefix - handle constrained routes', t => { + t.plan(2) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('PUT', '/test/:hello', () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const arrayTree = findMyWay.prettyPrint({ commonPrefix: false }) + const arrayExpected = `\ +└── /test (GET) + /test (GET) {"host":"auth.fastify.io"} + └── /:hello (GET, PUT) + /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) +}) + +test('pretty print commonPrefix - handle method constraint', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.addConstraintStrategy({ + name: 'method', + storage: function () { + const handlers = {} + return { + get: (type) => { return handlers[type] || null }, + set: (type, store) => { handlers[type] = store } + } + }, + deriveConstraint: (req) => req.headers['x-method'], + mustMatchWhenDerived: true + }) + + findMyWay.on('GET', '/test', () => {}) + findMyWay.on('GET', '/test', { constraints: { method: 'foo' } }, () => {}) + findMyWay.on('GET', '/test/:hello', () => {}) + findMyWay.on('PUT', '/test/:hello', () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { method: 'bar' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { method: 'baz' } }, () => {}) + + const arrayTree = findMyWay.prettyPrint({ + commonPrefix: false, + methodConstraintName: 'methodOverride' + }) + + const arrayExpected = `\ +└── /test (GET) + /test (GET) {"method":"foo"} + └── /:hello (GET, PUT) + /:hello (GET) {"method":"bar"} + /:hello (GET) {"method":"baz"} +` + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) +}) + +test('pretty print includeMeta - commonPrefix: true', t => { + t.plan(6) + + const findMyWay = FindMyWay() + const namedFunction = () => {} + const store = { + onRequest: [() => {}, namedFunction], + onTimeout: [() => {}], + genericMeta: 'meta', + mixedMeta: ['mixed items', { an: 'object' }], + objectMeta: { one: '1', two: 2 }, + functionMeta: namedFunction + } + + store[Symbol('symbolKey')] = Symbol('symbolValue') + + findMyWay.on('GET', '/test', () => {}, store) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}, store) + findMyWay.on('GET', '/testing/:hello', () => {}, store) + findMyWay.on('PUT', '/tested/:hello', () => {}, store) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const radixTree = findMyWay.prettyPrint({ commonPrefix: true, includeMeta: true }) + const radixTreeExpected = `\ +└── / + └── test (GET) + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + test (GET) {"host":"auth.fastify.io"} + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + ├── ing/ + │ └── :hello (GET) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (onTimeout) ["anonymous()"] + │ • (genericMeta) "meta" + │ • (mixedMeta) ["mixed items",{"an":"object"}] + │ • (objectMeta) {"one":"1","two":2} + │ • (functionMeta) "namedFunction()" + │ • (Symbol(symbolKey)) "Symbol(symbolValue)" + ├── ed/ + │ └── :hello (PUT) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (onTimeout) ["anonymous()"] + │ • (genericMeta) "meta" + │ • (mixedMeta) ["mixed items",{"an":"object"}] + │ • (objectMeta) {"one":"1","two":2} + │ • (functionMeta) "namedFunction()" + │ • (Symbol(symbolKey)) "Symbol(symbolValue)" + └── / + └── :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + const radixTreeSpecific = findMyWay.prettyPrint({ commonPrefix: true, includeMeta: ['onTimeout', 'objectMeta', 'nonExistent'] }) + const radixTreeSpecificExpected = `\ +└── / + └── test (GET) + • (onTimeout) ["anonymous()"] + • (objectMeta) {"one":"1","two":2} + test (GET) {"host":"auth.fastify.io"} + • (onTimeout) ["anonymous()"] + • (objectMeta) {"one":"1","two":2} + ├── ing/ + │ └── :hello (GET) + │ • (onTimeout) ["anonymous()"] + │ • (objectMeta) {"one":"1","two":2} + ├── ed/ + │ └── :hello (PUT) + │ • (onTimeout) ["anonymous()"] + │ • (objectMeta) {"one":"1","two":2} + └── / + └── :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + const radixTreeNoMeta = findMyWay.prettyPrint({ commonPrefix: true, includeMeta: false }) + const radixTreeNoMetaExpected = `\ +└── / + └── test (GET) + test (GET) {"host":"auth.fastify.io"} + ├── ing/ + │ └── :hello (GET) + ├── ed/ + │ └── :hello (PUT) + └── / + └── :hello (GET) {"version":"1.1.2"} + :hello (GET) {"version":"2.0.0"} +` + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixTreeExpected) + + t.assert.equal(typeof radixTreeSpecific, 'string') + t.assert.equal(radixTreeSpecific, radixTreeSpecificExpected) + + t.assert.equal(typeof radixTreeNoMeta, 'string') + t.assert.equal(radixTreeNoMeta, radixTreeNoMetaExpected) +}) + +test('pretty print includeMeta - commonPrefix: false', t => { + t.plan(6) + + const findMyWay = FindMyWay() + const namedFunction = () => {} + const store = { + onRequest: [() => {}, namedFunction], + onTimeout: [() => {}], + onError: null, + onRegister: undefined, + genericMeta: 'meta', + mixedMeta: ['mixed items', { an: 'object' }], + objectMeta: { one: '1', two: 2 }, + functionMeta: namedFunction + } + + store[Symbol('symbolKey')] = Symbol('symbolValue') + + findMyWay.on('GET', '/test', () => {}, store) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}, store) + findMyWay.on('GET', '/testing/:hello', () => {}, store) + findMyWay.on('PUT', '/tested/:hello', () => {}, store) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const arrayTree = findMyWay.prettyPrint({ commonPrefix: false, includeMeta: true }) + const arrayExpected = `\ +└── /test (GET) + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + /test (GET) {"host":"auth.fastify.io"} + • (onRequest) ["anonymous()","namedFunction()"] + • (onTimeout) ["anonymous()"] + • (genericMeta) "meta" + • (mixedMeta) ["mixed items",{"an":"object"}] + • (objectMeta) {"one":"1","two":2} + • (functionMeta) "namedFunction()" + • (Symbol(symbolKey)) "Symbol(symbolValue)" + ├── ing/:hello (GET) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (onTimeout) ["anonymous()"] + │ • (genericMeta) "meta" + │ • (mixedMeta) ["mixed items",{"an":"object"}] + │ • (objectMeta) {"one":"1","two":2} + │ • (functionMeta) "namedFunction()" + │ • (Symbol(symbolKey)) "Symbol(symbolValue)" + ├── ed/:hello (PUT) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (onTimeout) ["anonymous()"] + │ • (genericMeta) "meta" + │ • (mixedMeta) ["mixed items",{"an":"object"}] + │ • (objectMeta) {"one":"1","two":2} + │ • (functionMeta) "namedFunction()" + │ • (Symbol(symbolKey)) "Symbol(symbolValue)" + └── /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + const arraySpecific = findMyWay.prettyPrint({ commonPrefix: false, includeMeta: ['onRequest', 'mixedMeta', 'nonExistent'] }) + const arraySpecificExpected = `\ +└── /test (GET) + • (onRequest) ["anonymous()","namedFunction()"] + • (mixedMeta) ["mixed items",{"an":"object"}] + /test (GET) {"host":"auth.fastify.io"} + • (onRequest) ["anonymous()","namedFunction()"] + • (mixedMeta) ["mixed items",{"an":"object"}] + ├── ing/:hello (GET) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (mixedMeta) ["mixed items",{"an":"object"}] + ├── ed/:hello (PUT) + │ • (onRequest) ["anonymous()","namedFunction()"] + │ • (mixedMeta) ["mixed items",{"an":"object"}] + └── /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + const arrayNoMeta = findMyWay.prettyPrint({ commonPrefix: false, includeMeta: false }) + const arrayNoMetaExpected = `\ +└── /test (GET) + /test (GET) {"host":"auth.fastify.io"} + ├── ing/:hello (GET) + ├── ed/:hello (PUT) + └── /:hello (GET) {"version":"1.1.2"} + /:hello (GET) {"version":"2.0.0"} +` + + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) + + t.assert.equal(typeof arraySpecific, 'string') + t.assert.equal(arraySpecific, arraySpecificExpected) + + t.assert.equal(typeof arrayNoMeta, 'string') + t.assert.equal(arrayNoMeta, arrayNoMetaExpected) +}) + +test('pretty print includeMeta - buildPrettyMeta function', t => { + t.plan(4) + + const findMyWay = FindMyWay({ + buildPrettyMeta: route => { + return { metaKey: route.method === 'PUT' ? 'Hide PUT route path' : route.path } + } + }) + const namedFunction = () => {} + const store = { + onRequest: [() => {}, namedFunction], + onTimeout: [() => {}], + genericMeta: 'meta', + mixedMeta: ['mixed items', { an: 'object' }], + objectMeta: { one: '1', two: 2 }, + functionMeta: namedFunction + } + + store[Symbol('symbolKey')] = Symbol('symbolValue') + + findMyWay.on('GET', '/test', () => {}, store) + findMyWay.on('GET', '/test', { constraints: { host: 'auth.fastify.io' } }, () => {}, store) + findMyWay.on('GET', '/test/:hello', () => {}, store) + findMyWay.on('PUT', '/test/:hello', () => {}, store) + findMyWay.on('POST', '/test/:hello', () => {}, store) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '1.1.2' } }, () => {}) + findMyWay.on('GET', '/test/:hello', { constraints: { version: '2.0.0' } }, () => {}) + + const arrayTree = findMyWay.prettyPrint({ commonPrefix: false, includeMeta: true }) + const arrayExpected = `\ +└── /test (GET) + • (metaKey) "/test" + /test (GET) {"host":"auth.fastify.io"} + • (metaKey) "/test" + └── /:hello (GET, POST) + • (metaKey) "/test/:hello" + /:hello (PUT) + • (metaKey) "Hide PUT route path" + /:hello (GET) {"version":"1.1.2"} + • (metaKey) "/test/:hello" + /:hello (GET) {"version":"2.0.0"} + • (metaKey) "/test/:hello" +` + const radixTree = findMyWay.prettyPrint({ includeMeta: true }) + const radixExpected = `\ +└── / + └── test (GET) + • (metaKey) "/test" + test (GET) {"host":"auth.fastify.io"} + • (metaKey) "/test" + └── / + └── :hello (GET, POST) + • (metaKey) "/test/:hello" + :hello (PUT) + • (metaKey) "Hide PUT route path" + :hello (GET) {"version":"1.1.2"} + • (metaKey) "/test/:hello" + :hello (GET) {"version":"2.0.0"} + • (metaKey) "/test/:hello" +` + t.assert.equal(typeof arrayTree, 'string') + t.assert.equal(arrayTree, arrayExpected) + + t.assert.equal(typeof radixTree, 'string') + t.assert.equal(radixTree, radixExpected) +}) + +test('pretty print - print all methods', t => { + t.plan(2) + + const findMyWay = FindMyWay() + findMyWay.all('/test', () => {}) + + const tree = findMyWay.prettyPrint() + const expected = `\ +└── / + └── test (ACL, BIND, CHECKOUT, CONNECT, COPY, DELETE, GET, HEAD, LINK, LOCK, \ +M-SEARCH, MERGE, MKACTIVITY, MKCALENDAR, MKCOL, MOVE, NOTIFY, OPTIONS, PATCH, \ +POST, PROPFIND, PROPPATCH, PURGE, PUT, QUERY, REBIND, REPORT, SEARCH, SOURCE, \ +SUBSCRIBE, TRACE, UNBIND, UNLINK, UNLOCK, UNSUBSCRIBE) +` + t.assert.equal(typeof tree, 'string') + t.assert.equal(tree, expected) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/querystring.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/querystring.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5b89521d9d12e9cc39c3cad4b7e620bb1547d90e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/querystring.test.js @@ -0,0 +1,54 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('should sanitize the url - query', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', (req, res, params, store, query) => { + t.assert.deepEqual(query, { hello: 'world' }) + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test?hello=world', headers: {} }, null) +}) + +test('should sanitize the url - hash', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', (req, res, params, store, query) => { + t.assert.deepEqual(query, { hello: '' }) + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test#hello', headers: {} }, null) +}) + +test('handles path and query separated by ; with useSemicolonDelimiter enabled', t => { + t.plan(2) + const findMyWay = FindMyWay({ + useSemicolonDelimiter: true + }) + + findMyWay.on('GET', '/test', (req, res, params, store, query) => { + t.assert.deepEqual(query, { jsessionid: '123456' }) + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test;jsessionid=123456', headers: {} }, null) +}) + +test('handles path and query separated by ? using ; in the path', t => { + t.plan(2) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test;jsessionid=123456', (req, res, params, store, query) => { + t.assert.deepEqual(query, { foo: 'bar' }) + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test;jsessionid=123456?foo=bar', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/regex.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/regex.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f73b97bd9f98e7d9c1652545abcc01dfff15e06f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/regex.test.js @@ -0,0 +1,269 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('route with matching regex', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.fail('route not matched') + } + }) + + findMyWay.on('GET', '/test/:id(^\\d+$)', () => { + t.assert.ok('regex match') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/12', headers: {} }, null) +}) + +test('route without matching regex', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.ok('route not matched') + } + }) + + findMyWay.on('GET', '/test/:id(^\\d+$)', () => { + t.assert.fail('regex match') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/test', headers: {} }, null) +}) + +test('route with an extension regex 2', t => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req) => { + t.assert.fail(`route not matched: ${req.url}`) + } + }) + findMyWay.on('GET', '/test/S/:file(^\\S+).png', () => { + t.assert.ok('regex match') + }) + findMyWay.on('GET', '/test/D/:file(^\\D+).png', () => { + t.assert.ok('regex match') + }) + findMyWay.lookup({ method: 'GET', url: '/test/S/foo.png', headers: {} }, null) + findMyWay.lookup({ method: 'GET', url: '/test/D/foo.png', headers: {} }, null) +}) + +test('nested route with matching regex', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.fail('route not matched') + } + }) + + findMyWay.on('GET', '/test/:id(^\\d+$)/hello', () => { + t.assert.ok('regex match') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/12/hello', headers: {} }, null) +}) + +test('mixed nested route with matching regex', t => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.fail('route not matched') + } + }) + + findMyWay.on('GET', '/test/:id(^\\d+$)/hello/:world', (req, res, params) => { + t.assert.equal(params.id, '12') + t.assert.equal(params.world, 'world') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/12/hello/world', headers: {} }, null) +}) + +test('mixed nested route with double matching regex', t => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.fail('route not matched') + } + }) + + findMyWay.on('GET', '/test/:id(^\\d+$)/hello/:world(^\\d+$)', (req, res, params) => { + t.assert.equal(params.id, '12') + t.assert.equal(params.world, '15') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/12/hello/15', headers: {} }, null) +}) + +test('mixed nested route without double matching regex', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.ok('route not matched') + } + }) + + findMyWay.on('GET', '/test/:id(^\\d+$)/hello/:world(^\\d+$)', (req, res, params) => { + t.assert.fail('route mathed') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/12/hello/test', headers: {} }, null) +}) + +test('route with an extension regex', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.fail('route not matched') + } + }) + + findMyWay.on('GET', '/test/:file(^\\d+).png', () => { + t.assert.ok('regex match') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/12.png', headers: {} }, null) +}) + +test('route with an extension regex - no match', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.ok('route not matched') + } + }) + + findMyWay.on('GET', '/test/:file(^\\d+).png', () => { + t.assert.fail('regex match') + }) + + findMyWay.lookup({ method: 'GET', url: '/test/aa.png', headers: {} }, null) +}) + +test('safe decodeURIComponent', t => { + t.plan(1) + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.ok('route not matched') + } + }) + + findMyWay.on('GET', '/test/:id(^\\d+$)', () => { + t.assert.fail('we should not be here') + }) + + t.assert.deepEqual( + findMyWay.find('GET', '/test/hel%"Flo', {}), + null + ) +}) + +test('Should check if a regex is safe to use', t => { + t.plan(13) + + const noop = () => {} + + // https://github.com/substack/safe-regex/blob/master/test/regex.js + const good = [ + /\bOakland\b/, + /\b(Oakland|San Francisco)\b/i, + /^\d+1337\d+$/i, + /^\d+(1337|404)\d+$/i, + /^\d+(1337|404)*\d+$/i, + RegExp(Array(26).join('a?') + Array(26).join('a')) + ] + + const bad = [ + /^(a?){25}(a){25}$/, + RegExp(Array(27).join('a?') + Array(27).join('a')), + /(x+x+)+y/, + /foo|(x+x+)+y/, + /(a+){10}y/, + /(a+){2}y/, + /(.*){1,32000}[bc]/ + ] + + const findMyWay = FindMyWay() + + good.forEach(regex => { + try { + findMyWay.on('GET', `/test/:id(${regex.toString()})`, noop) + t.assert.ok('ok') + findMyWay.off('GET', `/test/:id(${regex.toString()})`) + } catch (err) { + t.assert.fail(err) + } + }) + + bad.forEach(regex => { + try { + findMyWay.on('GET', `/test/:id(${regex.toString()})`, noop) + t.assert.fail('should throw') + } catch (err) { + t.assert.ok(err) + } + }) +}) + +test('Disable safe regex check', t => { + t.plan(13) + + const noop = () => {} + + // https://github.com/substack/safe-regex/blob/master/test/regex.js + const good = [ + /\bOakland\b/, + /\b(Oakland|San Francisco)\b/i, + /^\d+1337\d+$/i, + /^\d+(1337|404)\d+$/i, + /^\d+(1337|404)*\d+$/i, + RegExp(Array(26).join('a?') + Array(26).join('a')) + ] + + const bad = [ + /^(a?){25}(a){25}$/, + RegExp(Array(27).join('a?') + Array(27).join('a')), + /(x+x+)+y/, + /foo|(x+x+)+y/, + /(a+){10}y/, + /(a+){2}y/, + /(.*){1,32000}[bc]/ + ] + + const findMyWay = FindMyWay({ allowUnsafeRegex: true }) + + good.forEach(regex => { + try { + findMyWay.on('GET', `/test/:id(${regex.toString()})`, noop) + t.assert.ok('ok') + findMyWay.off('GET', `/test/:id(${regex.toString()})`) + } catch (err) { + t.assert.fail(err) + } + }) + + bad.forEach(regex => { + try { + findMyWay.on('GET', `/test/:id(${regex.toString()})`, noop) + t.assert.ok('ok') + findMyWay.off('GET', `/test/:id(${regex.toString()})`) + } catch (err) { + t.assert.fail(err) + } + }) +}) + +test('prevent back-tracking', { timeout: 20 }, (t) => { + t.plan(0) + + const findMyWay = FindMyWay({ + defaultRoute: () => { + t.assert.fail('route not matched') + } + }) + + findMyWay.on('GET', '/:foo-:bar-', (req, res, params) => {}) + findMyWay.find('GET', '/' + '-'.repeat(16000) + 'a', { host: 'fastify.io' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/routes-registered.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/routes-registered.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd5eef2ec4e374efd15f0573d6f696babb8086ce --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/routes-registered.test.js @@ -0,0 +1,45 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +function initializeRoutes (router, handler, quantity) { + for (const x of Array(quantity).keys()) { + router.on('GET', '/test-route-' + x, handler) + } + return router +} + +test('verify routes registered', t => { + const assertPerTest = 5 + const quantity = 5 + // 1 (check length) + quantity of routes * quantity of tests per route + t.plan(1 + (quantity * assertPerTest)) + + let findMyWay = FindMyWay() + const defaultHandler = (req, res, params) => res.end(JSON.stringify({ hello: 'world' })) + + findMyWay = initializeRoutes(findMyWay, defaultHandler, quantity) + t.assert.equal(findMyWay.routes.length, quantity) + findMyWay.routes.forEach((route, idx) => { + t.assert.equal(route.method, 'GET') + t.assert.equal(route.path, '/test-route-' + idx) + t.assert.deepStrictEqual(route.opts, {}) + t.assert.equal(route.handler, defaultHandler) + t.assert.equal(route.store, undefined) + }) +}) + +test('verify routes registered and deregister', t => { + // 1 (check length) + quantity of routes * quantity of tests per route + t.plan(2) + + let findMyWay = FindMyWay() + const quantity = 2 + const defaultHandler = (req, res, params) => res.end(JSON.stringify({ hello: 'world' })) + + findMyWay = initializeRoutes(findMyWay, defaultHandler, quantity) + t.assert.equal(findMyWay.routes.length, quantity) + findMyWay.off('GET', '/test-route-0') + t.assert.equal(findMyWay.routes.length, quantity - 1) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/server.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/server.test.js new file mode 100644 index 0000000000000000000000000000000000000000..55087ac7b6824deeb85c3f0b5d925482f9c0fbb7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/server.test.js @@ -0,0 +1,368 @@ +'use strict' + +const { test } = require('node:test') +const http = require('http') +const FindMyWay = require('../') + +test('basic router with http server', (t, done) => { + t.plan(6) + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end(JSON.stringify({ hello: 'world' })) + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const res = await fetch(`http://localhost:${server.address().port}/test`) + + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.json(), { hello: 'world' }) + done() + }) +}) + +test('router with params with http server', (t, done) => { + t.plan(6) + const findMyWay = FindMyWay() + findMyWay.on('GET', '/test/:id', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.equal(params.id, 'hello') + res.end(JSON.stringify({ hello: 'world' })) + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const res = await fetch(`http://localhost:${server.address().port}/test/hello`) + + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.json(), { hello: 'world' }) + done() + }) +}) + +test('default route', (t, done) => { + t.plan(2) + const findMyWay = FindMyWay({ + defaultRoute: (req, res) => { + res.statusCode = 404 + res.end() + } + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const res = await fetch(`http://localhost:${server.address().port}`) + t.assert.equal(res.status, 404) + done() + }) +}) + +test('automatic default route', (t, done) => { + t.plan(2) + const findMyWay = FindMyWay() + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const res = await fetch(`http://localhost:${server.address().port}`) + t.assert.equal(res.status, 404) + done() + }) +}) + +test('maps two routes when trailing slash should be trimmed', (t, done) => { + t.plan(21) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: true + }) + + findMyWay.on('GET', '/test/', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('test') + }) + + findMyWay.on('GET', '/othertest', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('othertest') + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const baseURL = 'http://localhost:' + server.address().port + + let res = await fetch(`${baseURL}/test/`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}/test`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}/othertest`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'othertest') + + res = await fetch(`${baseURL}/othertest/`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'othertest') + + done() + }) +}) + +test('does not trim trailing slash when ignoreTrailingSlash is false', (t, done) => { + t.plan(7) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: false + }) + + findMyWay.on('GET', '/test/', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('test') + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const baseURL = 'http://localhost:' + server.address().port + + let res = await fetch(`${baseURL}/test/`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}/test`) + t.assert.equal(res.status, 404) + + done() + }) +}) + +test('does not map // when ignoreTrailingSlash is true', (t, done) => { + t.plan(7) + const findMyWay = FindMyWay({ + ignoreTrailingSlash: false + }) + + findMyWay.on('GET', '/', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('test') + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const baseURL = 'http://localhost:' + server.address().port + + let res = await fetch(`${baseURL}/`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}//`) + t.assert.equal(res.status, 404) + + done() + }) +}) + +test('maps two routes when duplicate slashes should be trimmed', (t, done) => { + t.plan(21) + const findMyWay = FindMyWay({ + ignoreDuplicateSlashes: true + }) + + findMyWay.on('GET', '//test', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('test') + }) + + findMyWay.on('GET', '/othertest', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('othertest') + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const baseURL = 'http://localhost:' + server.address().port + + let res = await fetch(`${baseURL}//test`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}/test`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}/othertest`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'othertest') + + res = await fetch(`${baseURL}//othertest`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'othertest') + + done() + }) +}) + +test('does not trim duplicate slashes when ignoreDuplicateSlashes is false', (t, done) => { + t.plan(7) + const findMyWay = FindMyWay({ + ignoreDuplicateSlashes: false + }) + + findMyWay.on('GET', '//test', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('test') + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const baseURL = 'http://localhost:' + server.address().port + + let res = await fetch(`${baseURL}//test`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}/test`) + t.assert.equal(res.status, 404) + + done() + }) +}) + +test('does map // when ignoreDuplicateSlashes is true', (t, done) => { + t.plan(11) + const findMyWay = FindMyWay({ + ignoreDuplicateSlashes: true + }) + + findMyWay.on('GET', '/', (req, res, params) => { + t.assert.ok(req) + t.assert.ok(res) + t.assert.ok(params) + res.end('test') + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + const baseURL = 'http://localhost:' + server.address().port + + let res = await fetch(`${baseURL}/`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + res = await fetch(`${baseURL}//`) + t.assert.equal(res.status, 200) + t.assert.deepEqual(await res.text(), 'test') + + done() + }) +}) + +test('versioned routes', (t, done) => { + t.plan(3) + + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', { constraints: { version: '1.2.3' } }, (req, res, params) => { + res.end('ok') + }) + + const server = http.createServer((req, res) => { + findMyWay.lookup(req, res) + }) + + server.listen(0, async err => { + t.assert.ifError(err) + server.unref() + + let res = await fetch(`http://localhost:${server.address().port}/test`, { + headers: { 'Accept-Version': '1.2.3' } + }) + + t.assert.equal(res.status, 200) + + res = await fetch(`http://localhost:${server.address().port}/test`, { + headers: { 'Accept-Version': '2.x' } + }) + + t.assert.equal(res.status, 404) + + done() + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/shorthands.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/shorthands.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f2998a20162f93a15527d06f117072275cfc53c9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/shorthands.test.js @@ -0,0 +1,44 @@ +'use strict' + +const httpMethods = require('../lib/http-methods') +const { describe, test } = require('node:test') +const FindMyWay = require('../') + +describe('should support shorthand', t => { + for (const i in httpMethods) { + const m = httpMethods[i] + const methodName = m.toLowerCase() + + test('`.' + methodName + '`', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay[methodName]('/test', () => { + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: m, url: '/test', headers: {} }, null) + }) + } +}) + +test('should support `.all` shorthand', t => { + t.plan(11) + const findMyWay = FindMyWay() + + findMyWay.all('/test', () => { + t.assert.ok('inside the handler') + }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'DELETE', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'HEAD', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'PATCH', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'POST', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'PUT', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'OPTIONS', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'TRACE', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'CONNECT', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'COPY', url: '/test', headers: {} }, null) + findMyWay.lookup({ method: 'SUBSCRIBE', url: '/test', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/store.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/store.test.js new file mode 100644 index 0000000000000000000000000000000000000000..51ca8c5412f972e82b6cd156aa664f24cee470ce --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/store.test.js @@ -0,0 +1,49 @@ +'use strict' + +const { test } = require('node:test') +const FindMyWay = require('../') + +test('handler should have the store object', t => { + t.plan(1) + const findMyWay = FindMyWay() + + findMyWay.on('GET', '/test', (req, res, params, store) => { + t.assert.equal(store.hello, 'world') + }, { hello: 'world' }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) +}) + +test('find a store object', t => { + t.plan(1) + const findMyWay = FindMyWay() + const fn = () => {} + + findMyWay.on('GET', '/test', fn, { hello: 'world' }) + + t.assert.deepEqual(findMyWay.find('GET', '/test'), { + handler: fn, + params: {}, + store: { hello: 'world' }, + searchParams: {} + }) +}) + +test('update the store', t => { + t.plan(2) + const findMyWay = FindMyWay() + let bool = false + + findMyWay.on('GET', '/test', (req, res, params, store) => { + if (!bool) { + t.assert.equal(store.hello, 'world') + store.hello = 'hello' + bool = true + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) + } else { + t.assert.equal(store.hello, 'hello') + } + }, { hello: 'world' }) + + findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/types/router.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/types/router.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee7bfeb6312f7212775d99391b8f76d472f475d3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/find-my-way/test/types/router.test-d.ts @@ -0,0 +1,182 @@ +import { expectType } from 'tsd' +import Router from '../../' +import { Http2ServerRequest, Http2ServerResponse } from 'http2' +import { IncomingMessage, ServerResponse } from 'http' + +let http1Req!: IncomingMessage; +let http1Res!: ServerResponse; +let http2Req!: Http2ServerRequest; +let http2Res!: Http2ServerResponse; +let ctx!: { req: IncomingMessage; res: ServerResponse }; +let done!: (err: Error | null, result: any) => void; + +// HTTP1 +{ + let handler!: Router.Handler + const router = Router({ + ignoreTrailingSlash: true, + ignoreDuplicateSlashes: true, + allowUnsafeRegex: false, + caseSensitive: false, + maxParamLength: 42, + querystringParser: (queryString) => {}, + defaultRoute (http1Req, http1Res) {}, + onBadUrl (path, http1Req, http1Res) {}, + constraints: { + foo: { + name: 'foo', + mustMatchWhenDerived: true, + storage () { + return { + get (version) { return handler }, + set (version, handler) {} + } + }, + deriveConstraint(req) { return '1.0.0' }, + validate(value) { if (typeof value === "string") { throw new Error("invalid")} } + } + } + }) + expectType>(router) + + expectType(router.on('GET', '/', () => {})) + expectType(router.on(['GET', 'POST'], '/', () => {})) + expectType(router.on('GET', '/', { constraints: { version: '1.0.0' }}, () => {})) + expectType(router.on('GET', '/', () => {}, {})) + expectType(router.on('GET', '/', {constraints: { version: '1.0.0' }}, () => {}, {})) + + expectType(router.get('/', () => {})) + expectType(router.get('/', { constraints: { version: '1.0.0' }}, () => {})) + expectType(router.get('/', () => {}, {})) + expectType(router.get('/', { constraints: { version: '1.0.0' }}, () => {}, {})) + + expectType(router.off('GET', '/')) + expectType(router.off(['GET', 'POST'], '/')) + + expectType(router.lookup(http1Req, http1Res)) + expectType(router.lookup(http1Req, http1Res, done)); + expectType(router.lookup(http1Req, http1Res, ctx, done)); + expectType | null>(router.find('GET', '/')) + expectType | null>(router.find('GET', '/', {})) + expectType | null>(router.find('GET', '/', {version: '1.0.0'})) + + expectType | null>(router.findRoute('GET', '/')); + expectType | null>(router.findRoute('GET', '/', {})); + expectType | null>(router.findRoute('GET', '/', {version: '1.0.0'})); + + expectType(router.reset()) + expectType(router.prettyPrint()) + expectType(router.prettyPrint({ method: 'GET' })) + expectType(router.prettyPrint({ commonPrefix: false })) + expectType(router.prettyPrint({ commonPrefix: true })) + expectType(router.prettyPrint({ includeMeta: true })) + expectType(router.prettyPrint({ includeMeta: ['test', Symbol('test')] })) +} + +// HTTP2 +{ + const constraints: { [key: string]: Router.ConstraintStrategy } = { + foo: { + name: 'foo', + mustMatchWhenDerived: true, + storage () { + return { + get (version) { return handler }, + set (version, handler) {} + } + }, + deriveConstraint(req) { return '1.0.0' }, + validate(value) { if (typeof value === "string") { throw new Error("invalid")} } + } + } + + let handler!: Router.Handler + const router = Router({ + ignoreTrailingSlash: true, + ignoreDuplicateSlashes: true, + allowUnsafeRegex: false, + caseSensitive: false, + maxParamLength: 42, + querystringParser: (queryString) => {}, + defaultRoute (http1Req, http1Res) {}, + onBadUrl (path, http1Req, http1Res) {}, + constraints + }) + expectType>(router) + + expectType(router.on('GET', '/', () => {})) + expectType(router.on(['GET', 'POST'], '/', () => {})) + expectType(router.on('GET', '/', { constraints: { version: '1.0.0' }}, () => {})) + expectType(router.on('GET', '/', () => {}, {})) + expectType(router.on('GET', '/', { constraints: { version: '1.0.0' }}, () => {}, {})) + + expectType(router.addConstraintStrategy(constraints.foo)) + + expectType(router.get('/', () => {})) + expectType(router.get('/', { constraints: { version: '1.0.0' }}, () => {})) + expectType(router.get('/', () => {}, {})) + expectType(router.get('/', { constraints: { version: '1.0.0' }}, () => {}, {})) + + expectType(router.off('GET', '/')) + expectType(router.off(['GET', 'POST'], '/')) + + expectType(router.lookup(http2Req, http2Res)) + expectType(router.lookup(http2Req, http2Res, done)); + expectType(router.lookup(http2Req, http2Res, ctx, done)); + expectType | null>(router.find('GET', '/', {})) + expectType | null>(router.find('GET', '/', {version: '1.0.0', host: 'fastify.io'})) + + expectType(router.reset()) + expectType(router.prettyPrint()) + +} + +// Custom Constraint +{ + let handler!: Router.Handler + + interface AcceptAndContentType { accept?: string, contentType?: string } + + const customConstraintWithObject: Router.ConstraintStrategy = { + name: "customConstraintWithObject", + deriveConstraint(req: Router.Req, ctx: Context | undefined): AcceptAndContentType { + return { + accept: req.headers.accept, + contentType: req.headers["content-type"] + } + }, + validate(value: unknown): void {}, + storage () { + return { + get (version) { return handler }, + set (version, handler) {} + } + } + } + + const storageWithObject = customConstraintWithObject.storage() + const acceptAndContentType: AcceptAndContentType = { accept: 'application/json', contentType: 'application/xml' } + + expectType(customConstraintWithObject.deriveConstraint(http1Req, http1Res)) + expectType | null>(storageWithObject.get(acceptAndContentType)); + expectType(storageWithObject.set(acceptAndContentType, () => {})); + + const customConstraintWithDefault: Router.ConstraintStrategy = { + name: "customConstraintWithObject", + deriveConstraint(req: Router.Req, ctx: Context | undefined): string { + return req.headers.accept ?? '' + }, + storage () { + return { + get (version) { return handler }, + set (version, handler) {} + } + } + } + + const storageWithDefault = customConstraintWithDefault.storage() + + expectType(customConstraintWithDefault.deriveConstraint(http1Req, http1Res)) + expectType | null>(storageWithDefault.get('')); + expectType(storageWithDefault.set('', () => {})); +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecc0a62e044751ab65e55ad71a7ccfe7ec63908f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.d.ts @@ -0,0 +1,2 @@ +export declare const allSignals: NodeJS.Signals[]; +//# sourceMappingURL=all-signals.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..cd1c161e1a60f6c933a328a486e7c745a1d440f8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"all-signals.d.ts","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,EAShB,MAAM,CAAC,OAAO,EAAE,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.js new file mode 100644 index 0000000000000000000000000000000000000000..1692af01e2878914e6174a6cd8dfe4f2f1c713d1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.js @@ -0,0 +1,58 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.allSignals = void 0; +const node_constants_1 = __importDefault(require("node:constants")); +exports.allSignals = +// this is the full list of signals that Node will let us do anything with +Object.keys(node_constants_1.default).filter(k => k.startsWith('SIG') && + // https://github.com/tapjs/signal-exit/issues/21 + k !== 'SIGPROF' && + // no sense trying to listen for SIGKILL, it's impossible + k !== 'SIGKILL'); +// These are some obscure signals that are reported by kill -l +// on macOS, Linux, or Windows, but which don't have any mapping +// in Node.js. No sense trying if they're just going to throw +// every time on every platform. +// +// 'SIGEMT', +// 'SIGLOST', +// 'SIGPOLL', +// 'SIGRTMAX', +// 'SIGRTMAX-1', +// 'SIGRTMAX-10', +// 'SIGRTMAX-11', +// 'SIGRTMAX-12', +// 'SIGRTMAX-13', +// 'SIGRTMAX-14', +// 'SIGRTMAX-15', +// 'SIGRTMAX-2', +// 'SIGRTMAX-3', +// 'SIGRTMAX-4', +// 'SIGRTMAX-5', +// 'SIGRTMAX-6', +// 'SIGRTMAX-7', +// 'SIGRTMAX-8', +// 'SIGRTMAX-9', +// 'SIGRTMIN', +// 'SIGRTMIN+1', +// 'SIGRTMIN+10', +// 'SIGRTMIN+11', +// 'SIGRTMIN+12', +// 'SIGRTMIN+13', +// 'SIGRTMIN+14', +// 'SIGRTMIN+15', +// 'SIGRTMIN+16', +// 'SIGRTMIN+2', +// 'SIGRTMIN+3', +// 'SIGRTMIN+4', +// 'SIGRTMIN+5', +// 'SIGRTMIN+6', +// 'SIGRTMIN+7', +// 'SIGRTMIN+8', +// 'SIGRTMIN+9', +// 'SIGSTKFLT', +// 'SIGUNUSED', +//# sourceMappingURL=all-signals.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.js.map new file mode 100644 index 0000000000000000000000000000000000000000..51c056d7079582e9c5fe6a4253fd01b6da3ecad3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/all-signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"all-signals.js","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAsC;AACzB,QAAA,UAAU;AACrB,0EAA0E;AAC1E,MAAM,CAAC,IAAI,CAAC,wBAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACnB,iDAAiD;IACjD,CAAC,KAAK,SAAS;IACf,yDAAyD;IACzD,CAAC,KAAK,SAAS,CACE,CAAA;AAEvB,8DAA8D;AAC9D,gEAAgE;AAChE,6DAA6D;AAC7D,gCAAgC;AAChC,EAAE;AACF,YAAY;AACZ,aAAa;AACb,aAAa;AACb,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,eAAe","sourcesContent":["import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL',\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d15b38e51e71b05d60a37b3f208989a2f850abf6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.d.ts @@ -0,0 +1,58 @@ +import { ChildProcessByStdio, SpawnOptions, ChildProcess } from 'child_process'; +/** + * The signature for the cleanup method. + * + * Arguments indicate the exit status of the child process. + * + * If a Promise is returned, then the process is not terminated + * until it resolves, and the resolution value is treated as the + * exit status (if a number) or signal exit (if a signal string). + * + * If `undefined` is returned, then no change is made, and the parent + * exits in the same way that the child exited. + * + * If boolean `false` is returned, then the parent's exit is canceled. + * + * If a number is returned, then the parent process exits with the number + * as its exitCode. + * + * If a signal string is returned, then the parent process is killed with + * the same signal that caused the child to exit. + */ +export type Cleanup = (code: number | null, signal: null | NodeJS.Signals, processInfo: { + watchdogPid?: ChildProcess['pid']; +}) => void | undefined | number | NodeJS.Signals | false | Promise; +export type FgArgs = [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup] | [ + program: [cmd: string, ...args: string[]], + opts?: SpawnOptions, + cleanup?: Cleanup +] | [program: string, cleanup?: Cleanup] | [program: string, opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, args?: string[], cleanup?: Cleanup] | [ + program: string, + args?: string[], + opts?: SpawnOptions, + cleanup?: Cleanup +]; +/** + * Normalizes the arguments passed to `foregroundChild`. + * + * Exposed for testing. + * + * @internal + */ +export declare const normalizeFgArgs: (fgArgs: FgArgs) => [program: string, args: string[], spawnOpts: SpawnOptions, cleanup: Cleanup]; +/** + * Spawn the specified program as a "foreground" process, or at least as + * close as is possible given node's lack of exec-without-fork. + * + * Cleanup method may be used to modify or ignore the result of the child's + * exit code or signal. If cleanup returns undefined (or a Promise that + * resolves to undefined), then the parent will exit in the same way that + * the child did. + * + * Return boolean `false` to prevent the parent's exit entirely. + */ +export declare function foregroundChild(cmd: string | [cmd: string, ...args: string[]], cleanup?: Cleanup): ChildProcessByStdio; +export declare function foregroundChild(program: string, args?: string[], cleanup?: Cleanup): ChildProcessByStdio; +export declare function foregroundChild(program: string, spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcessByStdio; +export declare function foregroundChild(program: string, args?: string[], spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcessByStdio; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b26fecdd4cec719f4a067a894dcbf7d38f72e579 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAInB,YAAY,EACZ,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,EAC7B,WAAW,EAAE;IACX,WAAW,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;CAClC,KAEC,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,CAAC,OAAO,GACd,KAAK,GACL,OAAO,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,CAAA;AAE/D,MAAM,MAAM,MAAM,GACd,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACvE;IACE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC;IACzC,IAAI,CAAC,EAAE,YAAY;IACnB,OAAO,CAAC,EAAE,OAAO;CAClB,GACD,CAAC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E,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6db65c65dca62d2e3072b3fe5b1ec07ceaf64cf7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.js @@ -0,0 +1,123 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeFgArgs = void 0; +exports.foregroundChild = foregroundChild; +const child_process_1 = require("child_process"); +const cross_spawn_1 = __importDefault(require("cross-spawn")); +const signal_exit_1 = require("signal-exit"); +const proxy_signals_js_1 = require("./proxy-signals.js"); +const watchdog_js_1 = require("./watchdog.js"); +/* c8 ignore start */ +const spawn = process?.platform === 'win32' ? cross_spawn_1.default : child_process_1.spawn; +/** + * Normalizes the arguments passed to `foregroundChild`. + * + * Exposed for testing. + * + * @internal + */ +const normalizeFgArgs = (fgArgs) => { + let [program, args = [], spawnOpts = {}, cleanup = () => { }] = fgArgs; + if (typeof args === 'function') { + cleanup = args; + spawnOpts = {}; + args = []; + } + else if (!!args && typeof args === 'object' && !Array.isArray(args)) { + if (typeof spawnOpts === 'function') + cleanup = spawnOpts; + spawnOpts = args; + args = []; + } + else if (typeof spawnOpts === 'function') { + cleanup = spawnOpts; + spawnOpts = {}; + } + if (Array.isArray(program)) { + const [pp, ...pa] = program; + program = pp; + args = pa; + } + return [program, args, { ...spawnOpts }, cleanup]; +}; +exports.normalizeFgArgs = normalizeFgArgs; +function foregroundChild(...fgArgs) { + const [program, args, spawnOpts, cleanup] = (0, exports.normalizeFgArgs)(fgArgs); + spawnOpts.stdio = [0, 1, 2]; + if (process.send) { + spawnOpts.stdio.push('ipc'); + } + const child = spawn(program, args, spawnOpts); + const childHangup = () => { + try { + child.kill('SIGHUP'); + /* c8 ignore start */ + } + catch (_) { + // SIGHUP is weird on windows + child.kill('SIGTERM'); + } + /* c8 ignore stop */ + }; + const removeOnExit = (0, signal_exit_1.onExit)(childHangup); + (0, proxy_signals_js_1.proxySignals)(child); + const dog = (0, watchdog_js_1.watchdog)(child); + let done = false; + child.on('close', async (code, signal) => { + /* c8 ignore start */ + if (done) + return; + /* c8 ignore stop */ + done = true; + const result = cleanup(code, signal, { + watchdogPid: dog.pid, + }); + const res = isPromise(result) ? await result : result; + removeOnExit(); + if (res === false) + return; + else if (typeof res === 'string') { + signal = res; + code = null; + } + else if (typeof res === 'number') { + code = res; + signal = null; + } + if (signal) { + // If there is nothing else keeping the event loop alive, + // then there's a race between a graceful exit and getting + // the signal to this process. Put this timeout here to + // make sure we're still alive to get the signal, and thus + // exit with the intended signal code. + /* istanbul ignore next */ + setTimeout(() => { }, 2000); + try { + process.kill(process.pid, signal); + /* c8 ignore start */ + } + catch (_) { + process.kill(process.pid, 'SIGTERM'); + } + /* c8 ignore stop */ + } + else { + process.exit(code || 0); + } + }); + if (process.send) { + process.removeAllListeners('message'); + child.on('message', (message, sendHandle) => { + process.send?.(message, sendHandle); + }); + process.on('message', (message, sendHandle) => { + child.send(message, sendHandle); + }); + } + return child; +} +const isPromise = (o) => !!o && typeof o === 'object' && typeof o.then === 'function'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..56037c846660b1710f148995a4d591b309984748 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sour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AAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n ChildProcess,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n processInfo: {\n watchdogPid?: ChildProcess['pid']\n },\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n ...fgArgs: FgArgs\n): ChildProcessByStdio {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts) as ChildProcessByStdio<\n null,\n null,\n null\n >\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal, {\n watchdogPid: dog.pid,\n })\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..edf17bdbf3b04f3bd62f35c6b5ac653dceb767d0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts @@ -0,0 +1,6 @@ +import { type ChildProcess } from 'child_process'; +/** + * Starts forwarding signals to `child` through `parent`. + */ +export declare const proxySignals: (child: ChildProcess) => () => void; +//# sourceMappingURL=proxy-signals.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7c19279e44b5f4169c7627fd37531cc5ec330a75 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.d.ts","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD;;GAEG;AACH,eAAO,MAAM,YAAY,UAAW,YAAY,eA4B/C,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.js new file mode 100644 index 0000000000000000000000000000000000000000..3913e7b45bce2dcdfba034878a05b3481aa3c7af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.proxySignals = void 0; +const all_signals_js_1 = require("./all-signals.js"); +/** + * Starts forwarding signals to `child` through `parent`. + */ +const proxySignals = (child) => { + const listeners = new Map(); + for (const sig of all_signals_js_1.allSignals) { + const listener = () => { + // some signals can only be received, not sent + try { + child.kill(sig); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }; + try { + // if it's a signal this system doesn't recognize, skip it + process.on(sig, listener); + listeners.set(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + } + const unproxy = () => { + for (const [sig, listener] of listeners) { + process.removeListener(sig, listener); + } + }; + child.on('exit', unproxy); + return unproxy; +}; +exports.proxySignals = proxySignals; +//# sourceMappingURL=proxy-signals.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map new file mode 100644 index 0000000000000000000000000000000000000000..199582275685bb1ab7f5a89f5e662229ad8cf995 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.js","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":";;;AACA,qDAA6C;AAE7C;;GAEG;AACI,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAE,EAAE;IAClD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAA;IAE3B,KAAK,MAAM,GAAG,IAAI,2BAAU,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,8CAA8C;YAC9C,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACf,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;YACd,oBAAoB;QACtB,CAAC,CAAA;QACD,IAAI,CAAC;YACH,0DAA0D;YAC1D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YACzB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC5B,qBAAqB;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;QACd,oBAAoB;IACtB,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC;YACxC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QACvC,CAAC;IACH,CAAC,CAAA;IACD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzB,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AA5BY,QAAA,YAAY,gBA4BxB","sourcesContent":["import { type ChildProcess } from 'child_process'\nimport { allSignals } from './all-signals.js'\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nexport const proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n const unproxy = () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n child.on('exit', unproxy)\n return unproxy\n}\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f10c9def05ecb1d4f3c9f83c8129647f9852acd6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.d.ts @@ -0,0 +1,10 @@ +import { ChildProcess } from 'child_process'; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +export declare const watchdog: (child: ChildProcess) => ChildProcess; +//# sourceMappingURL=watchdog.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d9ec2432aa9d4b9b8ffabdf18e7b718a9d78102b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAA;AAyBnD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,UAAW,YAAY,iBAc3C,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.js new file mode 100644 index 0000000000000000000000000000000000000000..514e234c2a0edfb42109464891567fb7980ee6d0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.js @@ -0,0 +1,50 @@ +"use strict"; +// this spawns a child process that listens for SIGHUP when the +// parent process exits, and after 200ms, sends a SIGKILL to the +// child, in case it did not terminate. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.watchdog = void 0; +const child_process_1 = require("child_process"); +const watchdogCode = String.raw ` +const pid = parseInt(process.argv[1], 10) +process.title = 'node (foreground-child watchdog pid=' + pid + ')' +if (!isNaN(pid)) { + let barked = false + // keepalive + const interval = setInterval(() => {}, 60000) + const bark = () => { + clearInterval(interval) + if (barked) return + barked = true + process.removeListener('SIGHUP', bark) + setTimeout(() => { + try { + process.kill(pid, 'SIGKILL') + setTimeout(() => process.exit(), 200) + } catch (_) {} + }, 500) + }) + process.on('SIGHUP', bark) +} +`; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +const watchdog = (child) => { + let dogExited = false; + const dog = (0, child_process_1.spawn)(process.execPath, ['-e', watchdogCode, String(child.pid)], { + stdio: 'ignore', + }); + dog.on('exit', () => (dogExited = true)); + child.on('exit', () => { + if (!dogExited) + dog.kill('SIGKILL'); + }); + return dog; +}; +exports.watchdog = watchdog; +//# sourceMappingURL=watchdog.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d486c97aa83dcb449f681a77a8ae72918fb19058 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/commonjs/watchdog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,uCAAuC;;;AAEvC,iDAAmD;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAA;AAED;;;;;;GAMG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC9C,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,MAAM,GAAG,GAAG,IAAA,qBAAK,EACf,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvC;QACE,KAAK,EAAE,QAAQ;KAChB,CACF,CAAA;IACD,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAdY,QAAA,QAAQ,YAcpB","sourcesContent":["// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\n/**\n * Pass in a ChildProcess, and this will spawn a watchdog process that\n * will make sure it exits if the parent does, thus preventing any\n * dangling detached zombie processes.\n *\n * If the child ends before the parent, then the watchdog will terminate.\n */\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n },\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGKILL')\n })\n return dog\n}\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecc0a62e044751ab65e55ad71a7ccfe7ec63908f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.d.ts @@ -0,0 +1,2 @@ +export declare const allSignals: NodeJS.Signals[]; +//# sourceMappingURL=all-signals.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..cd1c161e1a60f6c933a328a486e7c745a1d440f8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"all-signals.d.ts","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,EAShB,MAAM,CAAC,OAAO,EAAE,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.js new file mode 100644 index 0000000000000000000000000000000000000000..7e8d54d5cbb2aeab5cc2eef1c552df0de91c6389 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.js @@ -0,0 +1,52 @@ +import constants from 'node:constants'; +export const allSignals = +// this is the full list of signals that Node will let us do anything with +Object.keys(constants).filter(k => k.startsWith('SIG') && + // https://github.com/tapjs/signal-exit/issues/21 + k !== 'SIGPROF' && + // no sense trying to listen for SIGKILL, it's impossible + k !== 'SIGKILL'); +// These are some obscure signals that are reported by kill -l +// on macOS, Linux, or Windows, but which don't have any mapping +// in Node.js. No sense trying if they're just going to throw +// every time on every platform. +// +// 'SIGEMT', +// 'SIGLOST', +// 'SIGPOLL', +// 'SIGRTMAX', +// 'SIGRTMAX-1', +// 'SIGRTMAX-10', +// 'SIGRTMAX-11', +// 'SIGRTMAX-12', +// 'SIGRTMAX-13', +// 'SIGRTMAX-14', +// 'SIGRTMAX-15', +// 'SIGRTMAX-2', +// 'SIGRTMAX-3', +// 'SIGRTMAX-4', +// 'SIGRTMAX-5', +// 'SIGRTMAX-6', +// 'SIGRTMAX-7', +// 'SIGRTMAX-8', +// 'SIGRTMAX-9', +// 'SIGRTMIN', +// 'SIGRTMIN+1', +// 'SIGRTMIN+10', +// 'SIGRTMIN+11', +// 'SIGRTMIN+12', +// 'SIGRTMIN+13', +// 'SIGRTMIN+14', +// 'SIGRTMIN+15', +// 'SIGRTMIN+16', +// 'SIGRTMIN+2', +// 'SIGRTMIN+3', +// 'SIGRTMIN+4', +// 'SIGRTMIN+5', +// 'SIGRTMIN+6', +// 'SIGRTMIN+7', +// 'SIGRTMIN+8', +// 'SIGRTMIN+9', +// 'SIGSTKFLT', +// 'SIGUNUSED', +//# sourceMappingURL=all-signals.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1c63c6b9a7052ed6a2ae5e5c8a9394f707f672c1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/all-signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"all-signals.js","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,MAAM,CAAC,MAAM,UAAU;AACrB,0EAA0E;AAC1E,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACnB,iDAAiD;IACjD,CAAC,KAAK,SAAS;IACf,yDAAyD;IACzD,CAAC,KAAK,SAAS,CACE,CAAA;AAEvB,8DAA8D;AAC9D,gEAAgE;AAChE,6DAA6D;AAC7D,gCAAgC;AAChC,EAAE;AACF,YAAY;AACZ,aAAa;AACb,aAAa;AACb,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,eAAe","sourcesContent":["import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL',\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d15b38e51e71b05d60a37b3f208989a2f850abf6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.d.ts @@ -0,0 +1,58 @@ +import { ChildProcessByStdio, SpawnOptions, ChildProcess } from 'child_process'; +/** + * The signature for the cleanup method. + * + * Arguments indicate the exit status of the child process. + * + * If a Promise is returned, then the process is not terminated + * until it resolves, and the resolution value is treated as the + * exit status (if a number) or signal exit (if a signal string). + * + * If `undefined` is returned, then no change is made, and the parent + * exits in the same way that the child exited. + * + * If boolean `false` is returned, then the parent's exit is canceled. + * + * If a number is returned, then the parent process exits with the number + * as its exitCode. + * + * If a signal string is returned, then the parent process is killed with + * the same signal that caused the child to exit. + */ +export type Cleanup = (code: number | null, signal: null | NodeJS.Signals, processInfo: { + watchdogPid?: ChildProcess['pid']; +}) => void | undefined | number | NodeJS.Signals | false | Promise; +export type FgArgs = [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup] | [ + program: [cmd: string, ...args: string[]], + opts?: SpawnOptions, + cleanup?: Cleanup +] | [program: string, cleanup?: Cleanup] | [program: string, opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, args?: string[], cleanup?: Cleanup] | [ + program: string, + args?: string[], + opts?: SpawnOptions, + cleanup?: Cleanup +]; +/** + * Normalizes the arguments passed to `foregroundChild`. + * + * Exposed for testing. + * + * @internal + */ +export declare const normalizeFgArgs: (fgArgs: FgArgs) => [program: string, args: string[], spawnOpts: SpawnOptions, cleanup: Cleanup]; +/** + * Spawn the specified program as a "foreground" process, or at least as + * close as is possible given node's lack of exec-without-fork. + * + * Cleanup method may be used to modify or ignore the result of the child's + * exit code or signal. If cleanup returns undefined (or a Promise that + * resolves to undefined), then the parent will exit in the same way that + * the child did. + * + * Return boolean `false` to prevent the parent's exit entirely. + */ +export declare function foregroundChild(cmd: string | [cmd: string, ...args: string[]], cleanup?: Cleanup): ChildProcessByStdio; +export declare function foregroundChild(program: string, args?: string[], cleanup?: Cleanup): ChildProcessByStdio; +export declare function foregroundChild(program: string, spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcessByStdio; +export declare function foregroundChild(program: string, args?: string[], spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcessByStdio; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b26fecdd4cec719f4a067a894dcbf7d38f72e579 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB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AM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,OAAO,CAqBjB,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,EAC9C,OAAO,CAAC,EAAE,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACxC,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACxC,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACxC,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6266b5848cceda255c5803c49d7bea5113139f87 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.js @@ -0,0 +1,115 @@ +import { spawn as nodeSpawn, } from 'child_process'; +import crossSpawn from 'cross-spawn'; +import { onExit } from 'signal-exit'; +import { proxySignals } from './proxy-signals.js'; +import { watchdog } from './watchdog.js'; +/* c8 ignore start */ +const spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn; +/** + * Normalizes the arguments passed to `foregroundChild`. + * + * Exposed for testing. + * + * @internal + */ +export const normalizeFgArgs = (fgArgs) => { + let [program, args = [], spawnOpts = {}, cleanup = () => { }] = fgArgs; + if (typeof args === 'function') { + cleanup = args; + spawnOpts = {}; + args = []; + } + else if (!!args && typeof args === 'object' && !Array.isArray(args)) { + if (typeof spawnOpts === 'function') + cleanup = spawnOpts; + spawnOpts = args; + args = []; + } + else if (typeof spawnOpts === 'function') { + cleanup = spawnOpts; + spawnOpts = {}; + } + if (Array.isArray(program)) { + const [pp, ...pa] = program; + program = pp; + args = pa; + } + return [program, args, { ...spawnOpts }, cleanup]; +}; +export function foregroundChild(...fgArgs) { + const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs); + spawnOpts.stdio = [0, 1, 2]; + if (process.send) { + spawnOpts.stdio.push('ipc'); + } + const child = spawn(program, args, spawnOpts); + const childHangup = () => { + try { + child.kill('SIGHUP'); + /* c8 ignore start */ + } + catch (_) { + // SIGHUP is weird on windows + child.kill('SIGTERM'); + } + /* c8 ignore stop */ + }; + const removeOnExit = onExit(childHangup); + proxySignals(child); + const dog = watchdog(child); + let done = false; + child.on('close', async (code, signal) => { + /* c8 ignore start */ + if (done) + return; + /* c8 ignore stop */ + done = true; + const result = cleanup(code, signal, { + watchdogPid: dog.pid, + }); + const res = isPromise(result) ? await result : result; + removeOnExit(); + if (res === false) + return; + else if (typeof res === 'string') { + signal = res; + code = null; + } + else if (typeof res === 'number') { + code = res; + signal = null; + } + if (signal) { + // If there is nothing else keeping the event loop alive, + // then there's a race between a graceful exit and getting + // the signal to this process. Put this timeout here to + // make sure we're still alive to get the signal, and thus + // exit with the intended signal code. + /* istanbul ignore next */ + setTimeout(() => { }, 2000); + try { + process.kill(process.pid, signal); + /* c8 ignore start */ + } + catch (_) { + process.kill(process.pid, 'SIGTERM'); + } + /* c8 ignore stop */ + } + else { + process.exit(code || 0); + } + }); + if (process.send) { + process.removeAllListeners('message'); + child.on('message', (message, sendHandle) => { + process.send?.(message, sendHandle); + }); + process.on('message', (message, sendHandle) => { + child.send(message, sendHandle); + }); + } + return child; +} +const isPromise = (o) => !!o && typeof o === 'object' && typeof o.then === 'function'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7d9d1bd0e6c3464810b397cefc88de721a0bc9f6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,SAAS,GAGnB,MAAM,eAAe,CAAA;AACtB,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAA;AAsDpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;Q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CAAC,CAAA;YAC1B,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBACjC,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YACtC,CAAC;YACD,oBAAoB;QACtB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n ChildProcess,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n processInfo: {\n watchdogPid?: ChildProcess['pid']\n },\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio\nexport function foregroundChild(\n ...fgArgs: FgArgs\n): ChildProcessByStdio {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts) as ChildProcessByStdio<\n null,\n null,\n null\n >\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal, {\n watchdogPid: dog.pid,\n })\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..edf17bdbf3b04f3bd62f35c6b5ac653dceb767d0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.d.ts @@ -0,0 +1,6 @@ +import { type ChildProcess } from 'child_process'; +/** + * Starts forwarding signals to `child` through `parent`. + */ +export declare const proxySignals: (child: ChildProcess) => () => void; +//# sourceMappingURL=proxy-signals.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7c19279e44b5f4169c7627fd37531cc5ec330a75 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.d.ts","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD;;GAEG;AACH,eAAO,MAAM,YAAY,UAAW,YAAY,eA4B/C,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.js new file mode 100644 index 0000000000000000000000000000000000000000..8e1efe3e301d66236a6b5e6c795a9f43872a669f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.js @@ -0,0 +1,34 @@ +import { allSignals } from './all-signals.js'; +/** + * Starts forwarding signals to `child` through `parent`. + */ +export const proxySignals = (child) => { + const listeners = new Map(); + for (const sig of allSignals) { + const listener = () => { + // some signals can only be received, not sent + try { + child.kill(sig); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }; + try { + // if it's a signal this system doesn't recognize, skip it + process.on(sig, listener); + listeners.set(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + } + const unproxy = () => { + for (const [sig, listener] of listeners) { + process.removeListener(sig, listener); + } + }; + child.on('exit', unproxy); + return unproxy; +}; +//# sourceMappingURL=proxy-signals.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.js.map new file mode 100644 index 0000000000000000000000000000000000000000..978750fcc5a57cf4a81449ea6f60e0ed3a958144 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/proxy-signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.js","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAE,EAAE;IAClD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAA;IAE3B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,8CAA8C;YAC9C,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACf,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;YACd,oBAAoB;QACtB,CAAC,CAAA;QACD,IAAI,CAAC;YACH,0DAA0D;YAC1D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YACzB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC5B,qBAAqB;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;QACd,oBAAoB;IACtB,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC;YACxC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QACvC,CAAC;IACH,CAAC,CAAA;IACD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzB,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import { type ChildProcess } from 'child_process'\nimport { allSignals } from './all-signals.js'\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nexport const proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n const unproxy = () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n child.on('exit', unproxy)\n return unproxy\n}\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f10c9def05ecb1d4f3c9f83c8129647f9852acd6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.d.ts @@ -0,0 +1,10 @@ +import { ChildProcess } from 'child_process'; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +export declare const watchdog: (child: ChildProcess) => ChildProcess; +//# sourceMappingURL=watchdog.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d9ec2432aa9d4b9b8ffabdf18e7b718a9d78102b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAA;AAyBnD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,UAAW,YAAY,iBAc3C,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.js b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.js new file mode 100644 index 0000000000000000000000000000000000000000..7aa184ede4f5a0e95243adcf24e037bf86a58f78 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.js @@ -0,0 +1,46 @@ +// this spawns a child process that listens for SIGHUP when the +// parent process exits, and after 200ms, sends a SIGKILL to the +// child, in case it did not terminate. +import { spawn } from 'child_process'; +const watchdogCode = String.raw ` +const pid = parseInt(process.argv[1], 10) +process.title = 'node (foreground-child watchdog pid=' + pid + ')' +if (!isNaN(pid)) { + let barked = false + // keepalive + const interval = setInterval(() => {}, 60000) + const bark = () => { + clearInterval(interval) + if (barked) return + barked = true + process.removeListener('SIGHUP', bark) + setTimeout(() => { + try { + process.kill(pid, 'SIGKILL') + setTimeout(() => process.exit(), 200) + } catch (_) {} + }, 500) + }) + process.on('SIGHUP', bark) +} +`; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +export const watchdog = (child) => { + let dogExited = false; + const dog = spawn(process.execPath, ['-e', watchdogCode, String(child.pid)], { + stdio: 'ignore', + }); + dog.on('exit', () => (dogExited = true)); + child.on('exit', () => { + if (!dogExited) + dog.kill('SIGKILL'); + }); + return dog; +}; +//# sourceMappingURL=watchdog.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6f4e39fbd5c61b6b0f3be3f1bfdf901e617df8b4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/foreground-child/dist/esm/watchdog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,uCAAuC;AAEvC,OAAO,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC9C,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,MAAM,GAAG,GAAG,KAAK,CACf,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvC;QACE,KAAK,EAAE,QAAQ;KAChB,CACF,CAAA;IACD,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\n/**\n * Pass in a ChildProcess, and this will spawn a watchdog process that\n * will make sure it exits if the parent does, thus preventing any\n * dangling detached zombie processes.\n *\n * If the child ends before the parent, then the watchdog will terminate.\n */\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n },\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGKILL')\n })\n return dog\n}\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ipaddr.js/lib/ipaddr.js b/novas/novacore-zephyr/claude-code-router/node_modules/ipaddr.js/lib/ipaddr.js new file mode 100644 index 0000000000000000000000000000000000000000..da1ba92f7a72427cbc86c5cb910c01cbfea41716 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ipaddr.js/lib/ipaddr.js @@ -0,0 +1,1056 @@ +(function (root) { + 'use strict'; + // A list of regular expressions that match arbitrary IPv4 addresses, + // for which a number of weird notations exist. + // Note that an address like 0010.0xa5.1.1 is considered legal. + const ipv4Part = '(0?\\d+|0x[a-f0-9]+)'; + const ipv4Regexes = { + fourOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, 'i'), + threeOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, 'i'), + twoOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}$`, 'i'), + longValue: new RegExp(`^${ipv4Part}$`, 'i') + }; + + // Regular Expression for checking Octal numbers + const octalRegex = new RegExp(`^0[0-7]+$`, 'i'); + const hexRegex = new RegExp(`^0x[a-f0-9]+$`, 'i'); + + const zoneIndex = '%[0-9a-z]{1,}'; + + // IPv6-matching regular expressions. + // For IPv6, the task is simpler: it is enough to match the colon-delimited + // hexadecimal IPv6 and a transitional variant with dotted-decimal IPv4 at + // the end. + const ipv6Part = '(?:[0-9a-f]+::?)+'; + const ipv6Regexes = { + zoneIndex: new RegExp(zoneIndex, 'i'), + 'native': new RegExp(`^(::)?(${ipv6Part})?([0-9a-f]+)?(::)?(${zoneIndex})?$`, 'i'), + deprecatedTransitional: new RegExp(`^(?:::)(${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?)$`, 'i'), + transitional: new RegExp(`^((?:${ipv6Part})|(?:::)(?:${ipv6Part})?)${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?$`, 'i') + }; + + // Expand :: in an IPv6 address or address part consisting of `parts` groups. + function expandIPv6 (string, parts) { + // More than one '::' means invalid adddress + if (string.indexOf('::') !== string.lastIndexOf('::')) { + return null; + } + + let colonCount = 0; + let lastColon = -1; + let zoneId = (string.match(ipv6Regexes.zoneIndex) || [])[0]; + let replacement, replacementCount; + + // Remove zone index and save it for later + if (zoneId) { + zoneId = zoneId.substring(1); + string = string.replace(/%.+$/, ''); + } + + // How many parts do we already have? + while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) { + colonCount++; + } + + // 0::0 is two parts more than :: + if (string.substr(0, 2) === '::') { + colonCount--; + } + + if (string.substr(-2, 2) === '::') { + colonCount--; + } + + // The following loop would hang if colonCount > parts + if (colonCount > parts) { + return null; + } + + // replacement = ':' + '0:' * (parts - colonCount) + replacementCount = parts - colonCount; + replacement = ':'; + while (replacementCount--) { + replacement += '0:'; + } + + // Insert the missing zeroes + string = string.replace('::', replacement); + + // Trim any garbage which may be hanging around if :: was at the edge in + // the source strin + if (string[0] === ':') { + string = string.slice(1); + } + + if (string[string.length - 1] === ':') { + string = string.slice(0, -1); + } + + parts = (function () { + const ref = string.split(':'); + const results = []; + + for (let i = 0; i < ref.length; i++) { + results.push(parseInt(ref[i], 16)); + } + + return results; + })(); + + return { + parts: parts, + zoneId: zoneId + }; + } + + // A generic CIDR (Classless Inter-Domain Routing) RFC1518 range matcher. + function matchCIDR (first, second, partSize, cidrBits) { + if (first.length !== second.length) { + throw new Error('ipaddr: cannot match CIDR for objects with different lengths'); + } + + let part = 0; + let shift; + + while (cidrBits > 0) { + shift = partSize - cidrBits; + if (shift < 0) { + shift = 0; + } + + if (first[part] >> shift !== second[part] >> shift) { + return false; + } + + cidrBits -= partSize; + part += 1; + } + + return true; + } + + function parseIntAuto (string) { + // Hexadedimal base 16 (0x#) + if (hexRegex.test(string)) { + return parseInt(string, 16); + } + // While octal representation is discouraged by ECMAScript 3 + // and forbidden by ECMAScript 5, we silently allow it to + // work only if the rest of the string has numbers less than 8. + if (string[0] === '0' && !isNaN(parseInt(string[1], 10))) { + if (octalRegex.test(string)) { + return parseInt(string, 8); + } + throw new Error(`ipaddr: cannot parse ${string} as octal`); + } + // Always include the base 10 radix! + return parseInt(string, 10); + } + + function padPart (part, length) { + while (part.length < length) { + part = `0${part}`; + } + + return part; + } + + const ipaddr = {}; + + // An IPv4 address (RFC791). + ipaddr.IPv4 = (function () { + // Constructs a new IPv4 address from an array of four octets + // in network order (MSB first) + // Verifies the input. + function IPv4 (octets) { + if (octets.length !== 4) { + throw new Error('ipaddr: ipv4 octet count should be 4'); + } + + let i, octet; + + for (i = 0; i < octets.length; i++) { + octet = octets[i]; + if (!((0 <= octet && octet <= 255))) { + throw new Error('ipaddr: ipv4 octet should fit in 8 bits'); + } + } + + this.octets = octets; + } + + // Special IPv4 address ranges. + // See also https://en.wikipedia.org/wiki/Reserved_IP_addresses + IPv4.prototype.SpecialRanges = { + unspecified: [[new IPv4([0, 0, 0, 0]), 8]], + broadcast: [[new IPv4([255, 255, 255, 255]), 32]], + // RFC3171 + multicast: [[new IPv4([224, 0, 0, 0]), 4]], + // RFC3927 + linkLocal: [[new IPv4([169, 254, 0, 0]), 16]], + // RFC5735 + loopback: [[new IPv4([127, 0, 0, 0]), 8]], + // RFC6598 + carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]], + // RFC1918 + 'private': [ + [new IPv4([10, 0, 0, 0]), 8], + [new IPv4([172, 16, 0, 0]), 12], + [new IPv4([192, 168, 0, 0]), 16] + ], + // Reserved and testing-only ranges; RFCs 5735, 5737, 2544, 1700 + reserved: [ + [new IPv4([192, 0, 0, 0]), 24], + [new IPv4([192, 0, 2, 0]), 24], + [new IPv4([192, 88, 99, 0]), 24], + [new IPv4([198, 18, 0, 0]), 15], + [new IPv4([198, 51, 100, 0]), 24], + [new IPv4([203, 0, 113, 0]), 24], + [new IPv4([240, 0, 0, 0]), 4] + ], + // RFC7534, RFC7535 + as112: [ + [new IPv4([192, 175, 48, 0]), 24], + [new IPv4([192, 31, 196, 0]), 24], + ], + // RFC7450 + amt: [ + [new IPv4([192, 52, 193, 0]), 24], + ], + }; + + // The 'kind' method exists on both IPv4 and IPv6 classes. + IPv4.prototype.kind = function () { + return 'ipv4'; + }; + + // Checks if this address matches other one within given CIDR range. + IPv4.prototype.match = function (other, cidrRange) { + let ref; + if (cidrRange === undefined) { + ref = other; + other = ref[0]; + cidrRange = ref[1]; + } + + if (other.kind() !== 'ipv4') { + throw new Error('ipaddr: cannot match ipv4 address with non-ipv4 one'); + } + + return matchCIDR(this.octets, other.octets, 8, cidrRange); + }; + + // returns a number of leading ones in IPv4 address, making sure that + // the rest is a solid sequence of 0's (valid netmask) + // returns either the CIDR length or null if mask is not valid + IPv4.prototype.prefixLengthFromSubnetMask = function () { + let cidr = 0; + // non-zero encountered stop scanning for zeroes + let stop = false; + // number of zeroes in octet + const zerotable = { + 0: 8, + 128: 7, + 192: 6, + 224: 5, + 240: 4, + 248: 3, + 252: 2, + 254: 1, + 255: 0 + }; + let i, octet, zeros; + + for (i = 3; i >= 0; i -= 1) { + octet = this.octets[i]; + if (octet in zerotable) { + zeros = zerotable[octet]; + if (stop && zeros !== 0) { + return null; + } + + if (zeros !== 8) { + stop = true; + } + + cidr += zeros; + } else { + return null; + } + } + + return 32 - cidr; + }; + + // Checks if the address corresponds to one of the special ranges. + IPv4.prototype.range = function () { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + // Returns an array of byte-sized values in network order (MSB first) + IPv4.prototype.toByteArray = function () { + return this.octets.slice(0); + }; + + // Converts this IPv4 address to an IPv4-mapped IPv6 address. + IPv4.prototype.toIPv4MappedAddress = function () { + return ipaddr.IPv6.parse(`::ffff:${this.toString()}`); + }; + + // Symmetrical method strictly for aligning with the IPv6 methods. + IPv4.prototype.toNormalizedString = function () { + return this.toString(); + }; + + // Returns the address in convenient, decimal-dotted format. + IPv4.prototype.toString = function () { + return this.octets.join('.'); + }; + + return IPv4; + })(); + + // A utility function to return broadcast address given the IPv4 interface and prefix length in CIDR notation + ipaddr.IPv4.broadcastAddressFromCIDR = function (string) { + + try { + const cidr = this.parseCIDR(string); + const ipInterfaceOctets = cidr[0].toByteArray(); + const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + const octets = []; + let i = 0; + while (i < 4) { + // Broadcast address is bitwise OR between ip interface and inverted mask + octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255); + i++; + } + + return new this(octets); + } catch (e) { + throw new Error('ipaddr: the address does not have IPv4 CIDR format'); + } + }; + + // Checks if a given string is formatted like IPv4 address. + ipaddr.IPv4.isIPv4 = function (string) { + return this.parser(string) !== null; + }; + + // Checks if a given string is a valid IPv4 address. + ipaddr.IPv4.isValid = function (string) { + try { + new this(this.parser(string)); + return true; + } catch (e) { + return false; + } + }; + + // Checks if a given string is a valid IPv4 address in CIDR notation. + ipaddr.IPv4.isValidCIDR = function (string) { + try { + this.parseCIDR(string); + return true; + } catch (e) { + return false; + } + }; + + // Checks if a given string is a full four-part IPv4 Address. + ipaddr.IPv4.isValidFourPartDecimal = function (string) { + if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) { + return true; + } else { + return false; + } + }; + + // A utility function to return network address given the IPv4 interface and prefix length in CIDR notation + ipaddr.IPv4.networkAddressFromCIDR = function (string) { + let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets; + + try { + cidr = this.parseCIDR(string); + ipInterfaceOctets = cidr[0].toByteArray(); + subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + octets = []; + i = 0; + while (i < 4) { + // Network address is bitwise AND between ip interface and mask + octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10)); + i++; + } + + return new this(octets); + } catch (e) { + throw new Error('ipaddr: the address does not have IPv4 CIDR format'); + } + }; + + // Tries to parse and validate a string with IPv4 address. + // Throws an error if it fails. + ipaddr.IPv4.parse = function (string) { + const parts = this.parser(string); + + if (parts === null) { + throw new Error('ipaddr: string is not formatted like an IPv4 Address'); + } + + return new this(parts); + }; + + // Parses the string as an IPv4 Address with CIDR Notation. + ipaddr.IPv4.parseCIDR = function (string) { + let match; + + if ((match = string.match(/^(.+)\/(\d+)$/))) { + const maskLength = parseInt(match[2]); + if (maskLength >= 0 && maskLength <= 32) { + const parsed = [this.parse(match[1]), maskLength]; + Object.defineProperty(parsed, 'toString', { + value: function () { + return this.join('/'); + } + }); + return parsed; + } + } + + throw new Error('ipaddr: string is not formatted like an IPv4 CIDR range'); + }; + + // Classful variants (like a.b, where a is an octet, and b is a 24-bit + // value representing last three octets; this corresponds to a class C + // address) are omitted due to classless nature of modern Internet. + ipaddr.IPv4.parser = function (string) { + let match, part, value; + + // parseInt recognizes all that octal & hexadecimal weirdness for us + if ((match = string.match(ipv4Regexes.fourOctet))) { + return (function () { + const ref = match.slice(1, 6); + const results = []; + + for (let i = 0; i < ref.length; i++) { + part = ref[i]; + results.push(parseIntAuto(part)); + } + + return results; + })(); + } else if ((match = string.match(ipv4Regexes.longValue))) { + value = parseIntAuto(match[1]); + if (value > 0xffffffff || value < 0) { + throw new Error('ipaddr: address outside defined range'); + } + + return ((function () { + const results = []; + let shift; + + for (shift = 0; shift <= 24; shift += 8) { + results.push((value >> shift) & 0xff); + } + + return results; + })()).reverse(); + } else if ((match = string.match(ipv4Regexes.twoOctet))) { + return (function () { + const ref = match.slice(1, 4); + const results = []; + + value = parseIntAuto(ref[1]); + if (value > 0xffffff || value < 0) { + throw new Error('ipaddr: address outside defined range'); + } + + results.push(parseIntAuto(ref[0])); + results.push((value >> 16) & 0xff); + results.push((value >> 8) & 0xff); + results.push( value & 0xff); + + return results; + })(); + } else if ((match = string.match(ipv4Regexes.threeOctet))) { + return (function () { + const ref = match.slice(1, 5); + const results = []; + + value = parseIntAuto(ref[2]); + if (value > 0xffff || value < 0) { + throw new Error('ipaddr: address outside defined range'); + } + + results.push(parseIntAuto(ref[0])); + results.push(parseIntAuto(ref[1])); + results.push((value >> 8) & 0xff); + results.push( value & 0xff); + + return results; + })(); + } else { + return null; + } + }; + + // A utility function to return subnet mask in IPv4 format given the prefix length + ipaddr.IPv4.subnetMaskFromPrefixLength = function (prefix) { + prefix = parseInt(prefix); + if (prefix < 0 || prefix > 32) { + throw new Error('ipaddr: invalid IPv4 prefix length'); + } + + const octets = [0, 0, 0, 0]; + let j = 0; + const filledOctetCount = Math.floor(prefix / 8); + + while (j < filledOctetCount) { + octets[j] = 255; + j++; + } + + if (filledOctetCount < 4) { + octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8); + } + + return new this(octets); + }; + + // An IPv6 address (RFC2460) + ipaddr.IPv6 = (function () { + // Constructs an IPv6 address from an array of eight 16 - bit parts + // or sixteen 8 - bit parts in network order(MSB first). + // Throws an error if the input is invalid. + function IPv6 (parts, zoneId) { + let i, part; + + if (parts.length === 16) { + this.parts = []; + for (i = 0; i <= 14; i += 2) { + this.parts.push((parts[i] << 8) | parts[i + 1]); + } + } else if (parts.length === 8) { + this.parts = parts; + } else { + throw new Error('ipaddr: ipv6 part count should be 8 or 16'); + } + + for (i = 0; i < this.parts.length; i++) { + part = this.parts[i]; + if (!((0 <= part && part <= 0xffff))) { + throw new Error('ipaddr: ipv6 part should fit in 16 bits'); + } + } + + if (zoneId) { + this.zoneId = zoneId; + } + } + + // Special IPv6 ranges + IPv6.prototype.SpecialRanges = { + // RFC4291, here and after + unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128], + linkLocal: [new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10], + multicast: [new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8], + loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128], + uniqueLocal: [new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7], + ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96], + // RFC6666 + discard: [new IPv6([0x100, 0, 0, 0, 0, 0, 0, 0]), 64], + // RFC6145 + rfc6145: [new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96], + // RFC6052 + rfc6052: [new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96], + // RFC3056 + '6to4': [new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16], + // RFC6052, RFC6146 + teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32], + // RFC5180 + benchmarking: [new IPv6([0x2001, 0x2, 0, 0, 0, 0, 0, 0]), 48], + // RFC7450 + amt: [new IPv6([0x2001, 0x3, 0, 0, 0, 0, 0, 0]), 32], + as112v6: [ + [new IPv6([0x2001, 0x4, 0x112, 0, 0, 0, 0, 0]), 48], + [new IPv6([0x2620, 0x4f, 0x8000, 0, 0, 0, 0, 0]), 48], + ], + deprecated: [new IPv6([0x2001, 0x10, 0, 0, 0, 0, 0, 0]), 28], + orchid2: [new IPv6([0x2001, 0x20, 0, 0, 0, 0, 0, 0]), 28], + droneRemoteIdProtocolEntityTags: [new IPv6([0x2001, 0x30, 0, 0, 0, 0, 0, 0]), 28], + reserved: [ + // RFC3849 + [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 23], + // RFC2928 + [new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32], + ], + }; + + // Checks if this address is an IPv4-mapped IPv6 address. + IPv6.prototype.isIPv4MappedAddress = function () { + return this.range() === 'ipv4Mapped'; + }; + + // The 'kind' method exists on both IPv4 and IPv6 classes. + IPv6.prototype.kind = function () { + return 'ipv6'; + }; + + // Checks if this address matches other one within given CIDR range. + IPv6.prototype.match = function (other, cidrRange) { + let ref; + + if (cidrRange === undefined) { + ref = other; + other = ref[0]; + cidrRange = ref[1]; + } + + if (other.kind() !== 'ipv6') { + throw new Error('ipaddr: cannot match ipv6 address with non-ipv6 one'); + } + + return matchCIDR(this.parts, other.parts, 16, cidrRange); + }; + + // returns a number of leading ones in IPv6 address, making sure that + // the rest is a solid sequence of 0's (valid netmask) + // returns either the CIDR length or null if mask is not valid + IPv6.prototype.prefixLengthFromSubnetMask = function () { + let cidr = 0; + // non-zero encountered stop scanning for zeroes + let stop = false; + // number of zeroes in octet + const zerotable = { + 0: 16, + 32768: 15, + 49152: 14, + 57344: 13, + 61440: 12, + 63488: 11, + 64512: 10, + 65024: 9, + 65280: 8, + 65408: 7, + 65472: 6, + 65504: 5, + 65520: 4, + 65528: 3, + 65532: 2, + 65534: 1, + 65535: 0 + }; + let part, zeros; + + for (let i = 7; i >= 0; i -= 1) { + part = this.parts[i]; + if (part in zerotable) { + zeros = zerotable[part]; + if (stop && zeros !== 0) { + return null; + } + + if (zeros !== 16) { + stop = true; + } + + cidr += zeros; + } else { + return null; + } + } + + return 128 - cidr; + }; + + + // Checks if the address corresponds to one of the special ranges. + IPv6.prototype.range = function () { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + // Returns an array of byte-sized values in network order (MSB first) + IPv6.prototype.toByteArray = function () { + let part; + const bytes = []; + const ref = this.parts; + for (let i = 0; i < ref.length; i++) { + part = ref[i]; + bytes.push(part >> 8); + bytes.push(part & 0xff); + } + + return bytes; + }; + + // Returns the address in expanded format with all zeroes included, like + // 2001:0db8:0008:0066:0000:0000:0000:0001 + IPv6.prototype.toFixedLengthString = function () { + const addr = ((function () { + const results = []; + for (let i = 0; i < this.parts.length; i++) { + results.push(padPart(this.parts[i].toString(16), 4)); + } + + return results; + }).call(this)).join(':'); + + let suffix = ''; + + if (this.zoneId) { + suffix = `%${this.zoneId}`; + } + + return addr + suffix; + }; + + // Converts this address to IPv4 address if it is an IPv4-mapped IPv6 address. + // Throws an error otherwise. + IPv6.prototype.toIPv4Address = function () { + if (!this.isIPv4MappedAddress()) { + throw new Error('ipaddr: trying to convert a generic ipv6 address to ipv4'); + } + + const ref = this.parts.slice(-2); + const high = ref[0]; + const low = ref[1]; + + return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]); + }; + + // Returns the address in expanded format with all zeroes included, like + // 2001:db8:8:66:0:0:0:1 + // + // Deprecated: use toFixedLengthString() instead. + IPv6.prototype.toNormalizedString = function () { + const addr = ((function () { + const results = []; + + for (let i = 0; i < this.parts.length; i++) { + results.push(this.parts[i].toString(16)); + } + + return results; + }).call(this)).join(':'); + + let suffix = ''; + + if (this.zoneId) { + suffix = `%${this.zoneId}`; + } + + return addr + suffix; + }; + + // Returns the address in compact, human-readable format like + // 2001:db8:8:66::1 + // in line with RFC 5952 (see https://tools.ietf.org/html/rfc5952#section-4) + IPv6.prototype.toRFC5952String = function () { + const regex = /((^|:)(0(:|$)){2,})/g; + const string = this.toNormalizedString(); + let bestMatchIndex = 0; + let bestMatchLength = -1; + let match; + + while ((match = regex.exec(string))) { + if (match[0].length > bestMatchLength) { + bestMatchIndex = match.index; + bestMatchLength = match[0].length; + } + } + + if (bestMatchLength < 0) { + return string; + } + + return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}`; + }; + + // Returns the address in compact, human-readable format like + // 2001:db8:8:66::1 + // Calls toRFC5952String under the hood. + IPv6.prototype.toString = function () { + return this.toRFC5952String(); + }; + + return IPv6; + + })(); + + // A utility function to return broadcast address given the IPv6 interface and prefix length in CIDR notation + ipaddr.IPv6.broadcastAddressFromCIDR = function (string) { + try { + const cidr = this.parseCIDR(string); + const ipInterfaceOctets = cidr[0].toByteArray(); + const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + const octets = []; + let i = 0; + while (i < 16) { + // Broadcast address is bitwise OR between ip interface and inverted mask + octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255); + i++; + } + + return new this(octets); + } catch (e) { + throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`); + } + }; + + // Checks if a given string is formatted like IPv6 address. + ipaddr.IPv6.isIPv6 = function (string) { + return this.parser(string) !== null; + }; + + // Checks to see if string is a valid IPv6 Address + ipaddr.IPv6.isValid = function (string) { + + // Since IPv6.isValid is always called first, this shortcut + // provides a substantial performance gain. + if (typeof string === 'string' && string.indexOf(':') === -1) { + return false; + } + + try { + const addr = this.parser(string); + new this(addr.parts, addr.zoneId); + return true; + } catch (e) { + return false; + } + }; + + // Checks if a given string is a valid IPv6 address in CIDR notation. + ipaddr.IPv6.isValidCIDR = function (string) { + + // See note in IPv6.isValid + if (typeof string === 'string' && string.indexOf(':') === -1) { + return false; + } + + try { + this.parseCIDR(string); + return true; + } catch (e) { + return false; + } + }; + + // A utility function to return network address given the IPv6 interface and prefix length in CIDR notation + ipaddr.IPv6.networkAddressFromCIDR = function (string) { + let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets; + + try { + cidr = this.parseCIDR(string); + ipInterfaceOctets = cidr[0].toByteArray(); + subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + octets = []; + i = 0; + while (i < 16) { + // Network address is bitwise AND between ip interface and mask + octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10)); + i++; + } + + return new this(octets); + } catch (e) { + throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`); + } + }; + + // Tries to parse and validate a string with IPv6 address. + // Throws an error if it fails. + ipaddr.IPv6.parse = function (string) { + const addr = this.parser(string); + + if (addr.parts === null) { + throw new Error('ipaddr: string is not formatted like an IPv6 Address'); + } + + return new this(addr.parts, addr.zoneId); + }; + + ipaddr.IPv6.parseCIDR = function (string) { + let maskLength, match, parsed; + + if ((match = string.match(/^(.+)\/(\d+)$/))) { + maskLength = parseInt(match[2]); + if (maskLength >= 0 && maskLength <= 128) { + parsed = [this.parse(match[1]), maskLength]; + Object.defineProperty(parsed, 'toString', { + value: function () { + return this.join('/'); + } + }); + return parsed; + } + } + + throw new Error('ipaddr: string is not formatted like an IPv6 CIDR range'); + }; + + // Parse an IPv6 address. + ipaddr.IPv6.parser = function (string) { + let addr, i, match, octet, octets, zoneId; + + if ((match = string.match(ipv6Regexes.deprecatedTransitional))) { + return this.parser(`::ffff:${match[1]}`); + } + if (ipv6Regexes.native.test(string)) { + return expandIPv6(string, 8); + } + if ((match = string.match(ipv6Regexes.transitional))) { + zoneId = match[6] || ''; + addr = match[1] + if (!match[1].endsWith('::')) { + addr = addr.slice(0, -1) + } + addr = expandIPv6(addr + zoneId, 6); + if (addr.parts) { + octets = [ + parseInt(match[2]), + parseInt(match[3]), + parseInt(match[4]), + parseInt(match[5]) + ]; + for (i = 0; i < octets.length; i++) { + octet = octets[i]; + if (!((0 <= octet && octet <= 255))) { + return null; + } + } + + addr.parts.push(octets[0] << 8 | octets[1]); + addr.parts.push(octets[2] << 8 | octets[3]); + return { + parts: addr.parts, + zoneId: addr.zoneId + }; + } + } + + return null; + }; + + // A utility function to return subnet mask in IPv6 format given the prefix length + ipaddr.IPv6.subnetMaskFromPrefixLength = function (prefix) { + prefix = parseInt(prefix); + if (prefix < 0 || prefix > 128) { + throw new Error('ipaddr: invalid IPv6 prefix length'); + } + + const octets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + let j = 0; + const filledOctetCount = Math.floor(prefix / 8); + + while (j < filledOctetCount) { + octets[j] = 255; + j++; + } + + if (filledOctetCount < 16) { + octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8); + } + + return new this(octets); + }; + + // Try to parse an array in network order (MSB first) for IPv4 and IPv6 + ipaddr.fromByteArray = function (bytes) { + const length = bytes.length; + + if (length === 4) { + return new ipaddr.IPv4(bytes); + } else if (length === 16) { + return new ipaddr.IPv6(bytes); + } else { + throw new Error('ipaddr: the binary input is neither an IPv6 nor IPv4 address'); + } + }; + + // Checks if the address is valid IP address + ipaddr.isValid = function (string) { + return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string); + }; + + // Checks if the address is valid IP address in CIDR notation + ipaddr.isValidCIDR = function (string) { + return ipaddr.IPv6.isValidCIDR(string) || ipaddr.IPv4.isValidCIDR(string); + }; + + + // Attempts to parse an IP Address, first through IPv6 then IPv4. + // Throws an error if it could not be parsed. + ipaddr.parse = function (string) { + if (ipaddr.IPv6.isValid(string)) { + return ipaddr.IPv6.parse(string); + } else if (ipaddr.IPv4.isValid(string)) { + return ipaddr.IPv4.parse(string); + } else { + throw new Error('ipaddr: the address has neither IPv6 nor IPv4 format'); + } + }; + + // Attempt to parse CIDR notation, first through IPv6 then IPv4. + // Throws an error if it could not be parsed. + ipaddr.parseCIDR = function (string) { + try { + return ipaddr.IPv6.parseCIDR(string); + } catch (e) { + try { + return ipaddr.IPv4.parseCIDR(string); + } catch (e2) { + throw new Error('ipaddr: the address has neither IPv6 nor IPv4 CIDR format'); + } + } + }; + + // Parse an address and return plain IPv4 address if it is an IPv4-mapped address + ipaddr.process = function (string) { + const addr = this.parse(string); + + if (addr.kind() === 'ipv6' && addr.isIPv4MappedAddress()) { + return addr.toIPv4Address(); + } else { + return addr; + } + }; + + // An utility function to ease named range matching. See examples below. + // rangeList can contain both IPv4 and IPv6 subnet entries and will not throw errors + // on matching IPv4 addresses to IPv6 ranges or vice versa. + ipaddr.subnetMatch = function (address, rangeList, defaultName) { + let i, rangeName, rangeSubnets, subnet; + + if (defaultName === undefined || defaultName === null) { + defaultName = 'unicast'; + } + + for (rangeName in rangeList) { + if (Object.prototype.hasOwnProperty.call(rangeList, rangeName)) { + rangeSubnets = rangeList[rangeName]; + // ECMA5 Array.isArray isn't available everywhere + if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) { + rangeSubnets = [rangeSubnets]; + } + + for (i = 0; i < rangeSubnets.length; i++) { + subnet = rangeSubnets[i]; + if (address.kind() === subnet[0].kind() && address.match.apply(address, subnet)) { + return rangeName; + } + } + } + } + + return defaultName; + }; + + // Export for both the CommonJS and browser-like environment + if (typeof module !== 'undefined' && module.exports) { + module.exports = ipaddr; + + } else { + root.ipaddr = ipaddr; + } + +}(this)); diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/ipaddr.js/lib/ipaddr.js.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/ipaddr.js/lib/ipaddr.js.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..62afab336eca6d82eb789658bb6fda7c3ae18d93 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/ipaddr.js/lib/ipaddr.js.d.ts @@ -0,0 +1,71 @@ +declare module "ipaddr.js" { + type IPvXRangeDefaults = 'unicast' | 'unspecified' | 'multicast' | 'linkLocal' | 'loopback' | 'reserved' | 'benchmarking' | 'amt'; + type IPv4Range = IPvXRangeDefaults | 'broadcast' | 'carrierGradeNat' | 'private' | 'as112'; + type IPv6Range = IPvXRangeDefaults | 'uniqueLocal' | 'ipv4Mapped' | 'rfc6145' | 'rfc6052' | '6to4' | 'teredo' | 'as112v6' | 'orchid2' | 'droneRemoteIdProtocolEntityTags'; + + interface RangeList { + [name: string]: [T, number] | [T, number][]; + } + + // Common methods/properties for IPv4 and IPv6 classes. + class IP { + prefixLengthFromSubnetMask(): number | null; + toByteArray(): number[]; + toNormalizedString(): string; + toString(): string; + } + + namespace Address { + export function fromByteArray(bytes: number[]): IPv4 | IPv6; + export function isValid(addr: string): boolean; + export function isValidCIDR(addr: string): boolean; + export function parse(addr: string): IPv4 | IPv6; + export function parseCIDR(mask: string): [IPv4 | IPv6, number]; + export function process(addr: string): IPv4 | IPv6; + export function subnetMatch(addr: IPv4 | IPv6, rangeList: RangeList, defaultName?: string): string; + + export class IPv4 extends IP { + static broadcastAddressFromCIDR(addr: string): IPv4; + static isIPv4(addr: string): boolean; + static isValid(addr: string): boolean; + static isValidCIDR(addr: string): boolean; + static isValidFourPartDecimal(addr: string): boolean; + static networkAddressFromCIDR(addr: string): IPv4; + static parse(addr: string): IPv4; + static parseCIDR(addr: string): [IPv4, number]; + static subnetMaskFromPrefixLength(prefix: number): IPv4; + constructor(octets: number[]); + octets: number[] + + kind(): 'ipv4'; + match(what: IPv4 | IPv6 | [IPv4 | IPv6, number], bits?: number): boolean; + range(): IPv4Range; + subnetMatch(rangeList: RangeList, defaultName?: string): string; + toIPv4MappedAddress(): IPv6; + } + + export class IPv6 extends IP { + static broadcastAddressFromCIDR(addr: string): IPv6; + static isIPv6(addr: string): boolean; + static isValid(addr: string): boolean; + static isValidCIDR(addr: string): boolean; + static networkAddressFromCIDR(addr: string): IPv6; + static parse(addr: string): IPv6; + static parseCIDR(addr: string): [IPv6, number]; + static subnetMaskFromPrefixLength(prefix: number): IPv6; + constructor(parts: number[]); + parts: number[] + zoneId?: string + + isIPv4MappedAddress(): boolean; + kind(): 'ipv6'; + match(what: IPv4 | IPv6 | [IPv4 | IPv6, number], bits?: number): boolean; + range(): IPv6Range; + subnetMatch(rangeList: RangeList, defaultName?: string): string; + toIPv4Address(): IPv4; + toRFC5952String(): string; + } + } + + export = Address; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed913d54fa30cce60d366bc94792f8ad8745d71e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.d.ts @@ -0,0 +1,323 @@ +import { inspect, InspectOptions, ParseArgsConfig } from 'node:util'; +export type ParseArgsOptions = Exclude; +export type ParseArgsOption = ParseArgsOptions[string]; +export type ParseArgsDefault = Exclude; +export type ConfigType = 'number' | 'string' | 'boolean'; +export declare const isConfigType: (t: unknown) => t is ConfigType; +export type ConfigValuePrimitive = string | boolean | number; +export type ConfigValueArray = string[] | boolean[] | number[]; +export type ConfigValue = ConfigValuePrimitive | ConfigValueArray; +/** + * Given a Jack object, get the typeof its ConfigSet + */ +export type Unwrap = J extends Jack ? C : never; +/** + * Defines the type of value that is valid, given a config definition's + * {@link ConfigType} and boolean multiple setting + */ +export type ValidValue = [ + T, + M +] extends ['number', true] ? number[] : [T, M] extends ['string', true] ? string[] : [T, M] extends ['boolean', true] ? boolean[] : [T, M] extends ['number', false] ? number : [T, M] extends ['string', false] ? string : [T, M] extends ['boolean', false] ? boolean : [T, M] extends ['string', boolean] ? string | string[] : [T, M] extends ['boolean', boolean] ? boolean | boolean[] : [T, M] extends ['number', boolean] ? number | number[] : [T, M] extends [ConfigType, false] ? ConfigValuePrimitive : [T, M] extends [ConfigType, true] ? ConfigValueArray : ConfigValue; +export type ReadonlyArrays = readonly number[] | readonly string[]; +/** + * Defines the type of validOptions that are valid, given a config definition's + * {@link ConfigType} + */ +export type ValidOptions = T extends 'boolean' ? undefined : T extends 'string' ? readonly string[] : T extends 'number' ? readonly number[] : ReadonlyArrays; +/** + * A config field definition, in its full representation. + * This is what is passed in to addFields so `type` is required. + */ +export type ConfigOption = undefined | ValidOptions> = { + type: T; + short?: string; + default?: ValidValue & (O extends ReadonlyArrays ? M extends false ? O[number] : O[number][] : unknown); + description?: string; + hint?: T extends 'boolean' ? undefined : string; + validate?: ((v: unknown) => v is ValidValue) | ((v: unknown) => boolean); + validOptions?: O; + delim?: M extends false ? undefined : string; + multiple?: M; +}; +/** + * Determine whether an unknown object is a {@link ConfigOption} based only + * on its `type` and `multiple` property + */ +export declare const isConfigOptionOfType: (o: any, type: T, multi: M) => o is ConfigOption; +/** + * Determine whether an unknown object is a {@link ConfigOption} based on + * it having all valid properties + */ +export declare const isConfigOption: (o: any, type: T, multi: M) => o is ConfigOption; +/** + * The meta information for a config option definition, when the + * type and multiple values can be inferred by the method being used + */ +export type ConfigOptionMeta = ConfigOption> = Pick, 'type'> & Omit; +/** + * A set of {@link ConfigOption} objects, referenced by their longOption + * string values. + */ +export type ConfigSet = { + [longOption: string]: ConfigOption; +}; +/** + * A set of {@link ConfigOptionMeta} fields, referenced by their longOption + * string values. + */ +export type ConfigMetaSet = { + [longOption: string]: ConfigOptionMeta; +}; +/** + * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet} + */ +export type ConfigSetFromMetaSet> = S & { + [longOption in keyof S]: ConfigOption; +}; +/** + * The 'values' field returned by {@link Jack#parse}. If a value has + * a default field it will be required on the object otherwise it is optional. + */ +export type OptionsResults = { + [K in keyof T]: (T[K]['validOptions'] extends ReadonlyArrays ? T[K] extends ConfigOption<'string' | 'number', false> ? T[K]['validOptions'][number] : T[K] extends ConfigOption<'string' | 'number', true> ? T[K]['validOptions'][number][] : never : T[K] extends ConfigOption<'string', false> ? string : T[K] extends ConfigOption<'string', true> ? string[] : T[K] extends ConfigOption<'number', false> ? number : T[K] extends ConfigOption<'number', true> ? number[] : T[K] extends ConfigOption<'boolean', false> ? boolean : T[K] extends ConfigOption<'boolean', true> ? boolean[] : never) | (T[K]['default'] extends ConfigValue ? never : undefined); +}; +/** + * The object retured by {@link Jack#parse} + */ +export type Parsed = { + values: OptionsResults; + positionals: string[]; +}; +/** + * A row used when generating the {@link Jack#usage} string + */ +export interface Row { + left?: string; + text: string; + skipLine?: boolean; + type?: string; +} +/** + * A heading for a section in the usage, created by the jack.heading() + * method. + * + * First heading is always level 1, subsequent headings default to 2. + * + * The level of the nearest heading level sets the indentation of the + * description that follows. + */ +export interface Heading extends Row { + type: 'heading'; + text: string; + left?: ''; + skipLine?: boolean; + level: number; + pre?: boolean; +} +/** + * An arbitrary blob of text describing some stuff, set by the + * jack.description() method. + * + * Indentation determined by level of the nearest header. + */ +export interface Description extends Row { + type: 'description'; + text: string; + left?: ''; + skipLine?: boolean; + pre?: boolean; +} +/** + * A heading or description row used when generating the {@link Jack#usage} + * string + */ +export type TextRow = Heading | Description; +/** + * Either a {@link TextRow} or a reference to a {@link ConfigOption} + */ +export type UsageField = TextRow | { + type: 'config'; + name: string; + value: ConfigOption; +}; +/** + * Options provided to the {@link Jack} constructor + */ +export interface JackOptions { + /** + * Whether to allow positional arguments + * + * @default true + */ + allowPositionals?: boolean; + /** + * Prefix to use when reading/writing the environment variables + * + * If not specified, environment behavior will not be available. + */ + envPrefix?: string; + /** + * Environment object to read/write. Defaults `process.env`. + * No effect if `envPrefix` is not set. + */ + env?: Record; + /** + * A short usage string. If not provided, will be generated from the + * options provided, but that can of course be rather verbose if + * there are a lot of options. + */ + usage?: string; + /** + * Stop parsing flags and opts at the first positional argument. + * This is to support cases like `cmd [flags] [options]`, where + * each subcommand may have different options. This effectively treats + * any positional as a `--` argument. Only relevant if `allowPositionals` + * is true. + * + * To do subcommands, set this option, look at the first positional, and + * parse the remaining positionals as appropriate. + * + * @default false + */ + stopAtPositional?: boolean; + /** + * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function, + * will be called with each positional argument encountered. If the function + * returns true, then parsing will stop at that point. + */ + stopAtPositionalTest?: (arg: string) => boolean; +} +/** + * Class returned by the {@link jack} function and all configuration + * definition methods. This is what gets chained together. + */ +export declare class Jack { + #private; + constructor(options?: JackOptions); + /** + * Resulting definitions, suitable to be passed to Node's `util.parseArgs`, + * but also including `description` and `short` fields, if set. + */ + get definitions(): C; + /** map of `{ : }` strings for each short name defined */ + get shorts(): Record; + /** + * options passed to the {@link Jack} constructor + */ + get jackOptions(): JackOptions; + /** + * the data used to generate {@link Jack#usage} and + * {@link Jack#usageMarkdown} content. + */ + get usageFields(): UsageField[]; + /** + * Set the default value (which will still be overridden by env or cli) + * as if from a parsed config file. The optional `source` param, if + * provided, will be included in error messages if a value is invalid or + * unknown. + */ + setConfigValues(values: Partial>, source?: string): this; + /** + * Parse a string of arguments, and return the resulting + * `{ values, positionals }` object. + * + * If an {@link JackOptions#envPrefix} is set, then it will read default + * values from the environment, and write the resulting values back + * to the environment as well. + * + * Environment values always take precedence over any other value, except + * an explicit CLI setting. + */ + parse(args?: string[]): Parsed; + loadEnvDefaults(): void; + applyDefaults(p: Parsed): void; + /** + * Only parse the command line arguments passed in. + * Does not strip off the `node script.js` bits, so it must be just the + * arguments you wish to have parsed. + * Does not read from or write to the environment, or set defaults. + */ + parseRaw(args: string[]): Parsed; + /** + * Validate that any arbitrary object is a valid configuration `values` + * object. Useful when loading config files or other sources. + */ + validate(o: unknown): asserts o is Parsed['values']; + writeEnv(p: Parsed): void; + /** + * Add a heading to the usage output banner + */ + heading(text: string, level?: 1 | 2 | 3 | 4 | 5 | 6, { pre }?: { + pre?: boolean; + }): Jack; + /** + * Add a long-form description to the usage output at this position. + */ + description(text: string, { pre }?: { + pre?: boolean; + }): Jack; + /** + * Add one or more number fields. + */ + num>(fields: F): Jack>; + /** + * Add one or more multiple number fields. + */ + numList>(fields: F): Jack>; + /** + * Add one or more string option fields. + */ + opt>(fields: F): Jack>; + /** + * Add one or more multiple string option fields. + */ + optList>(fields: F): Jack>; + /** + * Add one or more flag fields. + */ + flag>(fields: F): Jack>; + /** + * Add one or more multiple flag fields. + */ + flagList>(fields: F): Jack>; + /** + * Generic field definition method. Similar to flag/flagList/number/etc, + * but you must specify the `type` (and optionally `multiple` and `delim`) + * fields on each one, or Jack won't know how to define them. + */ + addFields(fields: F): Jack; + /** + * Return the usage banner for the given configuration + */ + usage(): string; + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown(): string; + /** + * Return the configuration options as a plain object + */ + toJSON(): { + [k: string]: { + hint?: string | undefined; + default?: ConfigValue | undefined; + validOptions?: readonly number[] | readonly string[] | undefined; + validate?: ((v: unknown) => boolean) | ((v: unknown) => v is ValidValue) | undefined; + description?: string | undefined; + short?: string | undefined; + delim?: string | undefined; + multiple?: boolean | undefined; + type: ConfigType; + }; + }; + /** + * Custom printer for `util.inspect` + */ + [inspect.custom](_: number, options: InspectOptions): string; +} +/** + * Main entry point. Create and return a {@link Jack} object. + */ +export declare const jack: (options?: JackOptions) => Jack<{}>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b83201746f5cc88193aa7ceffb3cc4fda79beacb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EAEd,eAAe,EAChB,MAAM,WAAW,CAAA;AAOlB,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,eAAe,CAAC,SAAS,CAAC,EAC1B,SAAS,CACV,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACtD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;AAEtE,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAExD,eAAO,MAAM,YAAY,MAAO,OAAO,KAAG,CAAC,IAAI,UAEQ,CAAA;AAEvD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAC5D,MAAM,MAAM,gBAAgB,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAA;AAC9D,MAAM,MAAM,WAAW,G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BAAoB,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAIrD;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAwEtD;;OAEG;IACH,KAAK,IAAI,MAAM;IAiGf;;OAEG;IACH,aAAa,IAAI,MAAM;IAgIvB;;OAEG;IACH,MAAM;;;;;4BA1qCG,OAAO,KAAK,OAAO,SADnB,OAAO,KAAK,CAAC,IAAI,UAAU,qBAAM;;;;;;;;IAgsC1C;;OAEG;IACH,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;CAGpD;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,aAAa,WAAW,aAA2B,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..543412746cc8feaaeef830911925518bbd53cadc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.js @@ -0,0 +1,947 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jack = exports.Jack = exports.isConfigOption = exports.isConfigOptionOfType = exports.isConfigType = void 0; +const node_util_1 = require("node:util"); +// it's a tiny API, just cast it inline, it's fine +//@ts-ignore +const cliui_1 = __importDefault(require("@isaacs/cliui")); +const node_path_1 = require("node:path"); +const isConfigType = (t) => typeof t === 'string' && + (t === 'string' || t === 'number' || t === 'boolean'); +exports.isConfigType = isConfigType; +const isValidValue = (v, type, multi) => { + if (multi) { + if (!Array.isArray(v)) + return false; + return !v.some((v) => !isValidValue(v, type, false)); + } + if (Array.isArray(v)) + return false; + return typeof v === type; +}; +const isValidOption = (v, vo) => !!vo && + (Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v)); +/** + * Determine whether an unknown object is a {@link ConfigOption} based only + * on its `type` and `multiple` property + */ +const isConfigOptionOfType = (o, type, multi) => !!o && + typeof o === 'object' && + (0, exports.isConfigType)(o.type) && + o.type === type && + !!o.multiple === multi; +exports.isConfigOptionOfType = isConfigOptionOfType; +/** + * Determine whether an unknown object is a {@link ConfigOption} based on + * it having all valid properties + */ +const isConfigOption = (o, type, multi) => (0, exports.isConfigOptionOfType)(o, type, multi) && + undefOrType(o.short, 'string') && + undefOrType(o.description, 'string') && + undefOrType(o.hint, 'string') && + undefOrType(o.validate, 'function') && + (o.type === 'boolean' ? + o.validOptions === undefined + : undefOrTypeArray(o.validOptions, o.type)) && + (o.default === undefined || isValidValue(o.default, type, multi)); +exports.isConfigOption = isConfigOption; +const isHeading = (r) => r.type === 'heading'; +const isDescription = (r) => r.type === 'description'; +const width = Math.min(process?.stdout?.columns ?? 80, 80); +// indentation spaces from heading level +const indent = (n) => (n - 1) * 2; +const toEnvKey = (pref, key) => [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')] + .join(' ') + .trim() + .toUpperCase() + .replace(/ /g, '_'); +const toEnvVal = (value, delim = '\n') => { + const str = typeof value === 'string' ? value + : typeof value === 'boolean' ? + value ? '1' + : '0' + : typeof value === 'number' ? String(value) + : Array.isArray(value) ? + value.map((v) => toEnvVal(v)).join(delim) + : /* c8 ignore start */ undefined; + if (typeof str !== 'string') { + throw new Error(`could not serialize value to environment: ${JSON.stringify(value)}`, { cause: { code: 'JACKSPEAK' } }); + } + /* c8 ignore stop */ + return str; +}; +const fromEnvVal = (env, type, multiple, delim = '\n') => (multiple ? + env ? env.split(delim).map(v => fromEnvVal(v, type, false)) + : [] + : type === 'string' ? env + : type === 'boolean' ? env === '1' + : +env.trim()); +const undefOrType = (v, t) => v === undefined || typeof v === t; +const undefOrTypeArray = (v, t) => v === undefined || (Array.isArray(v) && v.every(x => typeof x === t)); +// print the value type, for error message reporting +const valueType = (v) => typeof v === 'string' ? 'string' + : typeof v === 'boolean' ? 'boolean' + : typeof v === 'number' ? 'number' + : Array.isArray(v) ? + `${joinTypes([...new Set(v.map(v => valueType(v)))])}[]` + : `${v.type}${v.multiple ? '[]' : ''}`; +const joinTypes = (types) => types.length === 1 && typeof types[0] === 'string' ? + types[0] + : `(${types.join('|')})`; +const validateFieldMeta = (field, fieldMeta) => { + if (fieldMeta) { + if (field.type !== undefined && field.type !== fieldMeta.type) { + throw new TypeError(`invalid type`, { + cause: { + found: field.type, + wanted: [fieldMeta.type, undefined], + }, + }); + } + if (field.multiple !== undefined && + !!field.multiple !== fieldMeta.multiple) { + throw new TypeError(`invalid multiple`, { + cause: { + found: field.multiple, + wanted: [fieldMeta.multiple, undefined], + }, + }); + } + return fieldMeta; + } + if (!(0, exports.isConfigType)(field.type)) { + throw new TypeError(`invalid type`, { + cause: { + found: field.type, + wanted: ['string', 'number', 'boolean'], + }, + }); + } + return { + type: field.type, + multiple: !!field.multiple, + }; +}; +const validateField = (o, type, multiple) => { + const validateValidOptions = (def, validOptions) => { + if (!undefOrTypeArray(validOptions, type)) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: valueType({ type, multiple: true }), + }, + }); + } + if (def !== undefined && validOptions !== undefined) { + const valid = Array.isArray(def) ? + def.every(v => validOptions.includes(v)) + : validOptions.includes(def); + if (!valid) { + throw new TypeError('invalid default value not in validOptions', { + cause: { + found: def, + wanted: validOptions, + }, + }); + } + } + }; + if (o.default !== undefined && + !isValidValue(o.default, type, multiple)) { + throw new TypeError('invalid default value', { + cause: { + found: o.default, + wanted: valueType({ type, multiple }), + }, + }); + } + if ((0, exports.isConfigOptionOfType)(o, 'number', false) || + (0, exports.isConfigOptionOfType)(o, 'number', true)) { + validateValidOptions(o.default, o.validOptions); + } + else if ((0, exports.isConfigOptionOfType)(o, 'string', false) || + (0, exports.isConfigOptionOfType)(o, 'string', true)) { + validateValidOptions(o.default, o.validOptions); + } + else if ((0, exports.isConfigOptionOfType)(o, 'boolean', false) || + (0, exports.isConfigOptionOfType)(o, 'boolean', true)) { + if (o.hint !== undefined) { + throw new TypeError('cannot provide hint for flag'); + } + if (o.validOptions !== undefined) { + throw new TypeError('cannot provide validOptions for flag'); + } + } + return o; +}; +const toParseArgsOptionsConfig = (options) => { + return Object.entries(options).reduce((acc, [longOption, o]) => { + const p = { + type: 'string', + multiple: !!o.multiple, + ...(typeof o.short === 'string' ? { short: o.short } : undefined), + }; + const setNoBool = () => { + if (!longOption.startsWith('no-') && !options[`no-${longOption}`]) { + acc[`no-${longOption}`] = { + type: 'boolean', + multiple: !!o.multiple, + }; + } + }; + const setDefault = (def, fn) => { + if (def !== undefined) { + p.default = fn(def); + } + }; + if ((0, exports.isConfigOption)(o, 'number', false)) { + setDefault(o.default, String); + } + else if ((0, exports.isConfigOption)(o, 'number', true)) { + setDefault(o.default, d => d.map(v => String(v))); + } + else if ((0, exports.isConfigOption)(o, 'string', false) || + (0, exports.isConfigOption)(o, 'string', true)) { + setDefault(o.default, v => v); + } + else if ((0, exports.isConfigOption)(o, 'boolean', false) || + (0, exports.isConfigOption)(o, 'boolean', true)) { + p.type = 'boolean'; + setDefault(o.default, v => v); + setNoBool(); + } + acc[longOption] = p; + return acc; + }, {}); +}; +/** + * Class returned by the {@link jack} function and all configuration + * definition methods. This is what gets chained together. + */ +class Jack { + #configSet; + #shorts; + #options; + #fields = []; + #env; + #envPrefix; + #allowPositionals; + #usage; + #usageMarkdown; + constructor(options = {}) { + this.#options = options; + this.#allowPositionals = options.allowPositionals !== false; + this.#env = + this.#options.env === undefined ? process.env : this.#options.env; + this.#envPrefix = options.envPrefix; + // We need to fib a little, because it's always the same object, but it + // starts out as having an empty config set. Then each method that adds + // fields returns `this as Jack` + this.#configSet = Object.create(null); + this.#shorts = Object.create(null); + } + /** + * Resulting definitions, suitable to be passed to Node's `util.parseArgs`, + * but also including `description` and `short` fields, if set. + */ + get definitions() { + return this.#configSet; + } + /** map of `{ : }` strings for each short name defined */ + get shorts() { + return this.#shorts; + } + /** + * options passed to the {@link Jack} constructor + */ + get jackOptions() { + return this.#options; + } + /** + * the data used to generate {@link Jack#usage} and + * {@link Jack#usageMarkdown} content. + */ + get usageFields() { + return this.#fields; + } + /** + * Set the default value (which will still be overridden by env or cli) + * as if from a parsed config file. The optional `source` param, if + * provided, will be included in error messages if a value is invalid or + * unknown. + */ + setConfigValues(values, source = '') { + try { + this.validate(values); + } + catch (er) { + if (source && er instanceof Error) { + /* c8 ignore next */ + const cause = typeof er.cause === 'object' ? er.cause : {}; + er.cause = { ...cause, path: source }; + Error.captureStackTrace(er, this.setConfigValues); + } + throw er; + } + for (const [field, value] of Object.entries(values)) { + const my = this.#configSet[field]; + // already validated, just for TS's benefit + /* c8 ignore start */ + if (!my) { + throw new Error('unexpected field in config set: ' + field, { + cause: { + code: 'JACKSPEAK', + found: field, + }, + }); + } + /* c8 ignore stop */ + my.default = value; + } + return this; + } + /** + * Parse a string of arguments, and return the resulting + * `{ values, positionals }` object. + * + * If an {@link JackOptions#envPrefix} is set, then it will read default + * values from the environment, and write the resulting values back + * to the environment as well. + * + * Environment values always take precedence over any other value, except + * an explicit CLI setting. + */ + parse(args = process.argv) { + this.loadEnvDefaults(); + const p = this.parseRaw(args); + this.applyDefaults(p); + this.writeEnv(p); + return p; + } + loadEnvDefaults() { + if (this.#envPrefix) { + for (const [field, my] of Object.entries(this.#configSet)) { + const ek = toEnvKey(this.#envPrefix, field); + const env = this.#env[ek]; + if (env !== undefined) { + my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim); + } + } + } + } + applyDefaults(p) { + for (const [field, c] of Object.entries(this.#configSet)) { + if (c.default !== undefined && !(field in p.values)) { + //@ts-ignore + p.values[field] = c.default; + } + } + } + /** + * Only parse the command line arguments passed in. + * Does not strip off the `node script.js` bits, so it must be just the + * arguments you wish to have parsed. + * Does not read from or write to the environment, or set defaults. + */ + parseRaw(args) { + if (args === process.argv) { + args = args.slice(process._eval !== undefined ? 1 : 2); + } + const result = (0, node_util_1.parseArgs)({ + args, + options: toParseArgsOptionsConfig(this.#configSet), + // always strict, but using our own logic + strict: false, + allowPositionals: this.#allowPositionals, + tokens: true, + }); + const p = { + values: {}, + positionals: [], + }; + for (const token of result.tokens) { + if (token.kind === 'positional') { + p.positionals.push(token.value); + if (this.#options.stopAtPositional || + this.#options.stopAtPositionalTest?.(token.value)) { + p.positionals.push(...args.slice(token.index + 1)); + break; + } + } + else if (token.kind === 'option') { + let value = undefined; + if (token.name.startsWith('no-')) { + const my = this.#configSet[token.name]; + const pname = token.name.substring('no-'.length); + const pos = this.#configSet[pname]; + if (pos && + pos.type === 'boolean' && + (!my || + (my.type === 'boolean' && !!my.multiple === !!pos.multiple))) { + value = false; + token.name = pname; + } + } + const my = this.#configSet[token.name]; + if (!my) { + throw new Error(`Unknown option '${token.rawName}'. ` + + `To specify a positional argument starting with a '-', ` + + `place it at the end of the command after '--', as in ` + + `'-- ${token.rawName}'`, { + cause: { + code: 'JACKSPEAK', + found: token.rawName + (token.value ? `=${token.value}` : ''), + }, + }); + } + if (value === undefined) { + if (token.value === undefined) { + if (my.type !== 'boolean') { + throw new Error(`No value provided for ${token.rawName}, expected ${my.type}`, { + cause: { + code: 'JACKSPEAK', + name: token.rawName, + wanted: valueType(my), + }, + }); + } + value = true; + } + else { + if (my.type === 'boolean') { + throw new Error(`Flag ${token.rawName} does not take a value, received '${token.value}'`, { cause: { code: 'JACKSPEAK', found: token } }); + } + if (my.type === 'string') { + value = token.value; + } + else { + value = +token.value; + if (value !== value) { + throw new Error(`Invalid value '${token.value}' provided for ` + + `'${token.rawName}' option, expected number`, { + cause: { + code: 'JACKSPEAK', + name: token.rawName, + found: token.value, + wanted: 'number', + }, + }); + } + } + } + } + if (my.multiple) { + const pv = p.values; + const tn = pv[token.name] ?? []; + pv[token.name] = tn; + tn.push(value); + } + else { + const pv = p.values; + pv[token.name] = value; + } + } + } + for (const [field, value] of Object.entries(p.values)) { + const valid = this.#configSet[field]?.validate; + const validOptions = this.#configSet[field]?.validOptions; + const cause = validOptions && !isValidOption(value, validOptions) ? + { name: field, found: value, validOptions } + : valid && !valid(value) ? { name: field, found: value } + : undefined; + if (cause) { + throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`, { cause: { ...cause, code: 'JACKSPEAK' } }); + } + } + return p; + } + /** + * do not set fields as 'no-foo' if 'foo' exists and both are bools + * just set foo. + */ + #noNoFields(f, val, s = f) { + if (!f.startsWith('no-') || typeof val !== 'boolean') + return; + const yes = f.substring('no-'.length); + // recurse so we get the core config key we care about. + this.#noNoFields(yes, val, s); + if (this.#configSet[yes]?.type === 'boolean') { + throw new Error(`do not set '${s}', instead set '${yes}' as desired.`, { cause: { code: 'JACKSPEAK', found: s, wanted: yes } }); + } + } + /** + * Validate that any arbitrary object is a valid configuration `values` + * object. Useful when loading config files or other sources. + */ + validate(o) { + if (!o || typeof o !== 'object') { + throw new Error('Invalid config: not an object', { + cause: { code: 'JACKSPEAK', found: o }, + }); + } + const opts = o; + for (const field in o) { + const value = opts[field]; + /* c8 ignore next - for TS */ + if (value === undefined) + continue; + this.#noNoFields(field, value); + const config = this.#configSet[field]; + if (!config) { + throw new Error(`Unknown config option: ${field}`, { + cause: { code: 'JACKSPEAK', found: field }, + }); + } + if (!isValidValue(value, config.type, !!config.multiple)) { + throw new Error(`Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`, { + cause: { + code: 'JACKSPEAK', + name: field, + found: value, + wanted: valueType(config), + }, + }); + } + const cause = config.validOptions && !isValidOption(value, config.validOptions) ? + { name: field, found: value, validOptions: config.validOptions } + : config.validate && !config.validate(value) ? + { name: field, found: value } + : undefined; + if (cause) { + throw new Error(`Invalid config value for ${field}: ${value}`, { + cause: { ...cause, code: 'JACKSPEAK' }, + }); + } + } + } + writeEnv(p) { + if (!this.#env || !this.#envPrefix) + return; + for (const [field, value] of Object.entries(p.values)) { + const my = this.#configSet[field]; + this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim); + } + } + /** + * Add a heading to the usage output banner + */ + heading(text, level, { pre = false } = {}) { + if (level === undefined) { + level = this.#fields.some(r => isHeading(r)) ? 2 : 1; + } + this.#fields.push({ type: 'heading', text, level, pre }); + return this; + } + /** + * Add a long-form description to the usage output at this position. + */ + description(text, { pre } = {}) { + this.#fields.push({ type: 'description', text, pre }); + return this; + } + /** + * Add one or more number fields. + */ + num(fields) { + return this.#addFieldsWith(fields, 'number', false); + } + /** + * Add one or more multiple number fields. + */ + numList(fields) { + return this.#addFieldsWith(fields, 'number', true); + } + /** + * Add one or more string option fields. + */ + opt(fields) { + return this.#addFieldsWith(fields, 'string', false); + } + /** + * Add one or more multiple string option fields. + */ + optList(fields) { + return this.#addFieldsWith(fields, 'string', true); + } + /** + * Add one or more flag fields. + */ + flag(fields) { + return this.#addFieldsWith(fields, 'boolean', false); + } + /** + * Add one or more multiple flag fields. + */ + flagList(fields) { + return this.#addFieldsWith(fields, 'boolean', true); + } + /** + * Generic field definition method. Similar to flag/flagList/number/etc, + * but you must specify the `type` (and optionally `multiple` and `delim`) + * fields on each one, or Jack won't know how to define them. + */ + addFields(fields) { + return this.#addFields(this, fields); + } + #addFieldsWith(fields, type, multiple) { + return this.#addFields(this, fields, { + type, + multiple, + }); + } + #addFields(next, fields, opt) { + Object.assign(next.#configSet, Object.fromEntries(Object.entries(fields).map(([name, field]) => { + this.#validateName(name, field); + const { type, multiple } = validateFieldMeta(field, opt); + const value = { ...field, type, multiple }; + validateField(value, type, multiple); + next.#fields.push({ type: 'config', name, value }); + return [name, value]; + }))); + return next; + } + #validateName(name, field) { + if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) { + throw new TypeError(`Invalid option name: ${name}, ` + + `must be '-' delimited ASCII alphanumeric`); + } + if (this.#configSet[name]) { + throw new TypeError(`Cannot redefine option ${field}`); + } + if (this.#shorts[name]) { + throw new TypeError(`Cannot redefine option ${name}, already ` + + `in use for ${this.#shorts[name]}`); + } + if (field.short) { + if (!/^[a-zA-Z0-9]$/.test(field.short)) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + 'must be 1 ASCII alphanumeric character'); + } + if (this.#shorts[field.short]) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + `already in use for ${this.#shorts[field.short]}`); + } + this.#shorts[field.short] = name; + this.#shorts[name] = name; + } + } + /** + * Return the usage banner for the given configuration + */ + usage() { + if (this.#usage) + return this.#usage; + let headingLevel = 1; + //@ts-ignore + const ui = (0, cliui_1.default)({ width }); + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + ui.div({ + padding: [0, 0, 0, 0], + text: normalize(first.text), + }); + } + ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' }); + if (this.#options.usage) { + ui.div({ + text: this.#options.usage, + padding: [0, 0, 0, 2], + }); + } + else { + const cmd = (0, node_path_1.basename)(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + ui.div({ + text: usage, + padding: [0, 0, 0, 2], + }); + } + ui.div({ padding: [0, 0, 0, 0], text: '' }); + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + const print = normalize(maybeDesc.text, maybeDesc.pre); + start++; + ui.div({ padding: [0, 0, 0, 0], text: print }); + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + const { rows, maxWidth } = this.#usageRows(start); + // every heading/description after the first gets indented by 2 + // extra spaces. + for (const row of rows) { + if (row.left) { + // If the row is too long, don't wrap it + // Bump the right-hand side down a line to make room + const configIndent = indent(Math.max(headingLevel, 2)); + if (row.left.length > maxWidth - 3) { + ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); + ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); + } + else { + ui.div({ + text: row.left, + padding: [0, 1, 0, configIndent], + width: maxWidth, + }, { padding: [0, 0, 0, 0], text: row.text }); + } + if (row.skipLine) { + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + } + else { + if (isHeading(row)) { + const { level } = row; + headingLevel = level; + // only h1 and h2 have bottom padding + // h3-h6 do not + const b = level <= 2 ? 1 : 0; + ui.div({ ...row, padding: [0, 0, b, indent(level)] }); + } + else { + ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); + } + } + } + return (this.#usage = ui.toString()); + } + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown() { + if (this.#usageMarkdown) + return this.#usageMarkdown; + const out = []; + let headingLevel = 1; + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + out.push(`# ${normalizeOneLine(first.text)}`); + } + out.push('Usage:'); + if (this.#options.usage) { + out.push(normalizeMarkdown(this.#options.usage, true)); + } + else { + const cmd = (0, node_path_1.basename)(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + out.push(normalizeMarkdown(usage, true)); + } + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre)); + start++; + } + const { rows } = this.#usageRows(start); + // heading level in markdown is number of # ahead of text + for (const row of rows) { + if (row.left) { + out.push('#'.repeat(headingLevel + 1) + + ' ' + + normalizeOneLine(row.left, true)); + if (row.text) + out.push(normalizeMarkdown(row.text)); + } + else if (isHeading(row)) { + const { level } = row; + headingLevel = level; + out.push(`${'#'.repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`); + } + else { + out.push(normalizeMarkdown(row.text, !!row.pre)); + } + } + return (this.#usageMarkdown = out.join('\n\n') + '\n'); + } + #usageRows(start) { + // turn each config type into a row, and figure out the width of the + // left hand indentation for the option descriptions. + let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3))); + let maxWidth = 8; + let prev = undefined; + const rows = []; + for (const field of this.#fields.slice(start)) { + if (field.type !== 'config') { + if (prev?.type === 'config') + prev.skipLine = true; + prev = undefined; + field.text = normalize(field.text, !!field.pre); + rows.push(field); + continue; + } + const { value } = field; + const desc = value.description || ''; + const mult = value.multiple ? 'Can be set multiple times' : ''; + const opts = value.validOptions?.length ? + `Valid options:${value.validOptions.map(v => ` ${JSON.stringify(v)}`)}` + : ''; + const dmDelim = desc.includes('\n') ? '\n\n' : '\n'; + const extra = [opts, mult].join(dmDelim).trim(); + const text = (normalize(desc) + dmDelim + extra).trim(); + const hint = value.hint || + (value.type === 'number' ? 'n' + : value.type === 'string' ? field.name + : undefined); + const short = !value.short ? '' + : value.type === 'boolean' ? `-${value.short} ` + : `-${value.short}<${hint}> `; + const left = value.type === 'boolean' ? + `${short}--${field.name}` + : `${short}--${field.name}=<${hint}>`; + const row = { text, left, type: 'config' }; + if (text.length > width - maxMax) { + row.skipLine = true; + } + if (prev && left.length > maxMax) + prev.skipLine = true; + prev = row; + const len = left.length + 4; + if (len > maxWidth && len < maxMax) { + maxWidth = len; + } + rows.push(row); + } + return { rows, maxWidth }; + } + /** + * Return the configuration options as a plain object + */ + toJSON() { + return Object.fromEntries(Object.entries(this.#configSet).map(([field, def]) => [ + field, + { + type: def.type, + ...(def.multiple ? { multiple: true } : {}), + ...(def.delim ? { delim: def.delim } : {}), + ...(def.short ? { short: def.short } : {}), + ...(def.description ? + { description: normalize(def.description) } + : {}), + ...(def.validate ? { validate: def.validate } : {}), + ...(def.validOptions ? { validOptions: def.validOptions } : {}), + ...(def.default !== undefined ? { default: def.default } : {}), + ...(def.hint ? { hint: def.hint } : {}), + }, + ])); + } + /** + * Custom printer for `util.inspect` + */ + [node_util_1.inspect.custom](_, options) { + return `Jack ${(0, node_util_1.inspect)(this.toJSON(), options)}`; + } +} +exports.Jack = Jack; +/** + * Main entry point. Create and return a {@link Jack} object. + */ +const jack = (options = {}) => new Jack(options); +exports.jack = jack; +// Unwrap and un-indent, so we can wrap description +// strings however makes them look nice in the code. +const normalize = (s, pre = false) => { + if (pre) + // prepend a ZWSP to each line so cliui doesn't strip it. + return s + .split('\n') + .map(l => `\u200b${l}`) + .join('\n'); + return s + .split(/^\s*```\s*$/gm) + .map((s, i) => { + if (i % 2 === 1) { + if (!s.trim()) { + return `\`\`\`\n\`\`\`\n`; + } + // outdent the ``` blocks, but preserve whitespace otherwise. + const split = s.split('\n'); + // throw out the \n at the start and end + split.pop(); + split.shift(); + const si = split.reduce((shortest, l) => { + /* c8 ignore next */ + const ind = l.match(/^\s*/)?.[0] ?? ''; + if (ind.length) + return Math.min(ind.length, shortest); + else + return shortest; + }, Infinity); + /* c8 ignore next */ + const i = isFinite(si) ? si : 0; + return ('\n```\n' + + split.map(s => `\u200b${s.substring(i)}`).join('\n') + + '\n```\n'); + } + return (s + // remove single line breaks, except for lists + .replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\n${$2}`) + // normalize mid-line whitespace + .replace(/([^\n])[ \t]+([^\n])/g, '$1 $2') + // two line breaks are enough + .replace(/\n{3,}/g, '\n\n') + // remove any spaces at the start of a line + .replace(/\n[ \t]+/g, '\n') + .trim()); + }) + .join('\n'); +}; +// normalize for markdown printing, remove leading spaces on lines +const normalizeMarkdown = (s, pre = false) => { + const n = normalize(s, pre).replace(/\\/g, '\\\\'); + return pre ? + `\`\`\`\n${n.replace(/\u200b/g, '')}\n\`\`\`` + : n.replace(/\n +/g, '\n').trim(); +}; +const normalizeOneLine = (s, pre = false) => { + const n = normalize(s, pre) + .replace(/[\s\u200b]+/g, ' ') + .trim(); + return pre ? `\`${n}\`` : n; +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bc346f38df4472d53d6f1525b73df412b889ce46 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAKkB;AAElB,kDAAkD;AAClD,YAAY;AACZ,0DAAiC;AACjC,yCAAoC;AAW7B,MAAM,YAAY,GAAG,CAAC,CAAU,EAAmB,EAAE,CAC1D,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,SAAS,CAAC,CAAA;AAF1C,QAAA,YAAY,gBAE8B;AAgCvD,MAAM,YAAY,GAAG,CACnB,CAAU,EACV,IAAO,EACP,KAAQ,EACe,EAAE;IACzB,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC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,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAClD,OAAO,GAAG,CAAC,CAAC;QACR,WAAW,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU;QAC/C,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,IAAI,EAAE,CAAA;IACT,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["import {\n inspect,\n InspectOptions,\n parseArgs,\n ParseArgsConfig,\n} from 'node:util'\n\n// it's a tiny API, just cast it inline, it's fine\n//@ts-ignore\nimport cliui from '@isaacs/cliui'\nimport { basename } from 'node:path'\n\nexport type ParseArgsOptions = Exclude<\n ParseArgsConfig['options'],\n undefined\n>\nexport type ParseArgsOption = ParseArgsOptions[string]\nexport type ParseArgsDefault = Exclude\n\nexport type ConfigType = 'number' | 'string' | 'boolean'\n\nexport const isConfigType = (t: unknown): t is ConfigType =>\n typeof t === 'string' &&\n (t === 'string' || t === 'number' || t === 'boolean')\n\nexport type ConfigValuePrimitive = string | boolean | number\nexport type ConfigValueArray = string[] | boolean[] | number[]\nexport type ConfigValue = ConfigValuePrimitive | ConfigValueArray\n\n/**\n * Given a Jack object, get the typeof its ConfigSet\n */\nexport type Unwrap = J extends Jack ? C : never\n\n/**\n * Defines the type of value that is valid, given a config definition's\n * {@link ConfigType} and boolean multiple setting\n */\nexport type ValidValue<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n> =\n [T, M] extends ['number', true] ? number[]\n : [T, M] extends ['string', true] ? string[]\n : [T, M] extends ['boolean', true] ? boolean[]\n : [T, M] extends ['number', false] ? number\n : [T, M] extends ['string', false] ? string\n : [T, M] extends ['boolean', false] ? boolean\n : [T, M] extends ['string', boolean] ? string | string[]\n : [T, M] extends ['boolean', boolean] ? boolean | boolean[]\n : [T, M] extends ['number', boolean] ? number | number[]\n : [T, M] extends [ConfigType, false] ? ConfigValuePrimitive\n : [T, M] extends [ConfigType, true] ? ConfigValueArray\n : ConfigValue\n\nconst isValidValue = (\n v: unknown,\n type: T,\n multi: M,\n): v is ValidValue => {\n if (multi) {\n if (!Array.isArray(v)) return false\n return !v.some((v: unknown) => !isValidValue(v, type, false))\n }\n if (Array.isArray(v)) return false\n return typeof v === type\n}\n\nexport type ReadonlyArrays = readonly number[] | readonly string[]\n\n/**\n * Defines the type of validOptions that are valid, given a config definition's\n * {@link ConfigType}\n */\nexport type ValidOptions =\n T extends 'boolean' ? undefined\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : ReadonlyArrays\n\nconst isValidOption = (\n v: unknown,\n vo: readonly unknown[],\n): vo is Exclude, undefined> =>\n !!vo &&\n (Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v))\n\n/**\n * A config field definition, in its full representation.\n * This is what is passed in to addFields so `type` is required.\n */\nexport type ConfigOption<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n O extends undefined | ValidOptions = undefined | ValidOptions,\n> = {\n type: T\n short?: string\n default?: ValidValue &\n (O extends ReadonlyArrays ?\n M extends false ?\n O[number]\n : O[number][]\n : unknown)\n description?: string\n hint?: T extends 'boolean' ? undefined : string\n validate?:\n | ((v: unknown) => v is ValidValue)\n | ((v: unknown) => boolean)\n validOptions?: O\n delim?: M extends false ? undefined : string\n multiple?: M\n}\n\n/**\n * Determine whether an unknown object is a {@link ConfigOption} based only\n * on its `type` and `multiple` property\n */\nexport const isConfigOptionOfType = <\n T extends ConfigType,\n M extends boolean,\n>(\n o: any,\n type: T,\n multi: M,\n): o is ConfigOption =>\n !!o &&\n typeof o === 'object' &&\n isConfigType(o.type) &&\n o.type === type &&\n !!o.multiple === multi\n\n/**\n * Determine whether an unknown object is a {@link ConfigOption} based on\n * it having all valid properties\n */\nexport const isConfigOption = (\n o: any,\n type: T,\n multi: M,\n): o is ConfigOption =>\n isConfigOptionOfType(o, type, multi) &&\n undefOrType(o.short, 'string') &&\n undefOrType(o.description, 'string') &&\n undefOrType(o.hint, 'string') &&\n undefOrType(o.validate, 'function') &&\n (o.type === 'boolean' ?\n o.validOptions === undefined\n : undefOrTypeArray(o.validOptions, o.type)) &&\n (o.default === undefined || isValidValue(o.default, type, multi))\n\n/**\n * The meta information for a config option definition, when the\n * type and multiple values can be inferred by the method being used\n */\nexport type ConfigOptionMeta<\n T extends ConfigType,\n M extends boolean,\n O extends ConfigOption = ConfigOption,\n> = Pick, 'type'> & Omit\n\n/**\n * A set of {@link ConfigOption} objects, referenced by their longOption\n * string values.\n */\nexport type ConfigSet = {\n [longOption: string]: ConfigOption\n}\n\n/**\n * A set of {@link ConfigOptionMeta} fields, referenced by their longOption\n * string values.\n */\nexport type ConfigMetaSet = {\n [longOption: string]: ConfigOptionMeta\n}\n\n/**\n * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet}\n */\nexport type ConfigSetFromMetaSet<\n T extends ConfigType,\n M extends boolean,\n S extends ConfigMetaSet,\n> = S & { [longOption in keyof S]: ConfigOption }\n\n/**\n * The 'values' field returned by {@link Jack#parse}. If a value has\n * a default field it will be required on the object otherwise it is optional.\n */\nexport type OptionsResults = {\n [K in keyof T]:\n | (T[K]['validOptions'] extends ReadonlyArrays ?\n T[K] extends ConfigOption<'string' | 'number', false> ?\n T[K]['validOptions'][number]\n : T[K] extends ConfigOption<'string' | 'number', true> ?\n T[K]['validOptions'][number][]\n : never\n : T[K] extends ConfigOption<'string', false> ? string\n : T[K] extends ConfigOption<'string', true> ? string[]\n : T[K] extends ConfigOption<'number', false> ? number\n : T[K] extends ConfigOption<'number', true> ? number[]\n : T[K] extends ConfigOption<'boolean', false> ? boolean\n : T[K] extends ConfigOption<'boolean', true> ? boolean[]\n : never)\n | (T[K]['default'] extends ConfigValue ? never : undefined)\n}\n\n/**\n * The object retured by {@link Jack#parse}\n */\nexport type Parsed = {\n values: OptionsResults\n positionals: string[]\n}\n\n/**\n * A row used when generating the {@link Jack#usage} string\n */\nexport interface Row {\n left?: string\n text: string\n skipLine?: boolean\n type?: string\n}\n\n/**\n * A heading for a section in the usage, created by the jack.heading()\n * method.\n *\n * First heading is always level 1, subsequent headings default to 2.\n *\n * The level of the nearest heading level sets the indentation of the\n * description that follows.\n */\nexport interface Heading extends Row {\n type: 'heading'\n text: string\n left?: ''\n skipLine?: boolean\n level: number\n pre?: boolean\n}\n\nconst isHeading = (r: { type?: string }): r is Heading =>\n r.type === 'heading'\n\n/**\n * An arbitrary blob of text describing some stuff, set by the\n * jack.description() method.\n *\n * Indentation determined by level of the nearest header.\n */\nexport interface Description extends Row {\n type: 'description'\n text: string\n left?: ''\n skipLine?: boolean\n pre?: boolean\n}\n\nconst isDescription = (r: { type?: string }): r is Description =>\n r.type === 'description'\n\n/**\n * A heading or description row used when generating the {@link Jack#usage}\n * string\n */\nexport type TextRow = Heading | Description\n\n/**\n * Either a {@link TextRow} or a reference to a {@link ConfigOption}\n */\nexport type UsageField =\n | TextRow\n | {\n type: 'config'\n name: string\n value: ConfigOption\n }\n\nconst width = Math.min(process?.stdout?.columns ?? 80, 80)\n\n// indentation spaces from heading level\nconst indent = (n: number) => (n - 1) * 2\n\nconst toEnvKey = (pref: string, key: string): string =>\n [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')]\n .join(' ')\n .trim()\n .toUpperCase()\n .replace(/ /g, '_')\n\nconst toEnvVal = (value: ConfigValue, delim: string = '\\n'): string => {\n const str =\n typeof value === 'string' ? value\n : typeof value === 'boolean' ?\n value ? '1'\n : '0'\n : typeof value === 'number' ? String(value)\n : Array.isArray(value) ?\n value.map((v: ConfigValue) => toEnvVal(v)).join(delim)\n : /* c8 ignore start */ undefined\n if (typeof str !== 'string') {\n throw new Error(\n `could not serialize value to environment: ${JSON.stringify(value)}`,\n { cause: { code: 'JACKSPEAK' } },\n )\n }\n /* c8 ignore stop */\n return str\n}\n\nconst fromEnvVal = (\n env: string,\n type: T,\n multiple: M,\n delim: string = '\\n',\n): ValidValue =>\n (multiple ?\n env ? env.split(delim).map(v => fromEnvVal(v, type, false))\n : []\n : type === 'string' ? env\n : type === 'boolean' ? env === '1'\n : +env.trim()) as ValidValue\n\nconst undefOrType = (v: unknown, t: string): boolean =>\n v === undefined || typeof v === t\n\nconst undefOrTypeArray = (v: unknown, t: string): boolean =>\n v === undefined || (Array.isArray(v) && v.every(x => typeof x === t))\n\n// print the value type, for error message reporting\nconst valueType = (\n v: ConfigValue | { type: ConfigType; multiple?: boolean },\n): string =>\n typeof v === 'string' ? 'string'\n : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' ? 'number'\n : Array.isArray(v) ?\n `${joinTypes([...new Set(v.map(v => valueType(v)))])}[]`\n : `${v.type}${v.multiple ? '[]' : ''}`\n\nconst joinTypes = (types: string[]): string =>\n types.length === 1 && typeof types[0] === 'string' ?\n types[0]\n : `(${types.join('|')})`\n\nconst validateFieldMeta = (\n field: ConfigOptionMeta,\n fieldMeta?: { type: T; multiple: M },\n): { type: ConfigType; multiple: boolean } => {\n if (fieldMeta) {\n if (field.type !== undefined && field.type !== fieldMeta.type) {\n throw new TypeError(`invalid type`, {\n cause: {\n found: field.type,\n wanted: [fieldMeta.type, undefined],\n },\n })\n }\n if (\n field.multiple !== undefined &&\n !!field.multiple !== fieldMeta.multiple\n ) {\n throw new TypeError(`invalid multiple`, {\n cause: {\n found: field.multiple,\n wanted: [fieldMeta.multiple, undefined],\n },\n })\n }\n return fieldMeta\n }\n\n if (!isConfigType(field.type)) {\n throw new TypeError(`invalid type`, {\n cause: {\n found: field.type,\n wanted: ['string', 'number', 'boolean'],\n },\n })\n }\n\n return {\n type: field.type,\n multiple: !!field.multiple,\n }\n}\n\nconst validateField = (\n o: ConfigOption,\n type: ConfigType,\n multiple: boolean,\n): ConfigOption => {\n const validateValidOptions = <\n T extends ConfigValue | undefined,\n V extends T extends Array ? U : T,\n >(\n def: T | undefined,\n validOptions: readonly V[] | undefined,\n ) => {\n if (!undefOrTypeArray(validOptions, type)) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: valueType({ type, multiple: true }),\n },\n })\n }\n if (def !== undefined && validOptions !== undefined) {\n const valid =\n Array.isArray(def) ?\n def.every(v => validOptions.includes(v as V))\n : validOptions.includes(def as V)\n if (!valid) {\n throw new TypeError('invalid default value not in validOptions', {\n cause: {\n found: def,\n wanted: validOptions,\n },\n })\n }\n }\n }\n\n if (\n o.default !== undefined &&\n !isValidValue(o.default, type, multiple)\n ) {\n throw new TypeError('invalid default value', {\n cause: {\n found: o.default,\n wanted: valueType({ type, multiple }),\n },\n })\n }\n\n if (\n isConfigOptionOfType(o, 'number', false) ||\n isConfigOptionOfType(o, 'number', true)\n ) {\n validateValidOptions(o.default, o.validOptions)\n } else if (\n isConfigOptionOfType(o, 'string', false) ||\n isConfigOptionOfType(o, 'string', true)\n ) {\n validateValidOptions(o.default, o.validOptions)\n } else if (\n isConfigOptionOfType(o, 'boolean', false) ||\n isConfigOptionOfType(o, 'boolean', true)\n ) {\n if (o.hint !== undefined) {\n throw new TypeError('cannot provide hint for flag')\n }\n if (o.validOptions !== undefined) {\n throw new TypeError('cannot provide validOptions for flag')\n }\n }\n\n return o\n}\n\nconst toParseArgsOptionsConfig = (\n options: ConfigSet,\n): ParseArgsOptions => {\n return Object.entries(options).reduce((acc, [longOption, o]) => {\n const p: ParseArgsOption = {\n type: 'string',\n multiple: !!o.multiple,\n ...(typeof o.short === 'string' ? { short: o.short } : undefined),\n }\n const setNoBool = () => {\n if (!longOption.startsWith('no-') && !options[`no-${longOption}`]) {\n acc[`no-${longOption}`] = {\n type: 'boolean',\n multiple: !!o.multiple,\n }\n }\n }\n const setDefault = (\n def: T | undefined,\n fn: (d: T) => ParseArgsDefault,\n ) => {\n if (def !== undefined) {\n p.default = fn(def)\n }\n }\n if (isConfigOption(o, 'number', false)) {\n setDefault(o.default, String)\n } else if (isConfigOption(o, 'number', true)) {\n setDefault(o.default, d => d.map(v => String(v)))\n } else if (\n isConfigOption(o, 'string', false) ||\n isConfigOption(o, 'string', true)\n ) {\n setDefault(o.default, v => v)\n } else if (\n isConfigOption(o, 'boolean', false) ||\n isConfigOption(o, 'boolean', true)\n ) {\n p.type = 'boolean'\n setDefault(o.default, v => v)\n setNoBool()\n }\n acc[longOption] = p\n return acc\n }, {} as ParseArgsOptions)\n}\n\n/**\n * Options provided to the {@link Jack} constructor\n */\nexport interface JackOptions {\n /**\n * Whether to allow positional arguments\n *\n * @default true\n */\n allowPositionals?: boolean\n\n /**\n * Prefix to use when reading/writing the environment variables\n *\n * If not specified, environment behavior will not be available.\n */\n envPrefix?: string\n\n /**\n * Environment object to read/write. Defaults `process.env`.\n * No effect if `envPrefix` is not set.\n */\n env?: Record\n\n /**\n * A short usage string. If not provided, will be generated from the\n * options provided, but that can of course be rather verbose if\n * there are a lot of options.\n */\n usage?: string\n\n /**\n * Stop parsing flags and opts at the first positional argument.\n * This is to support cases like `cmd [flags] [options]`, where\n * each subcommand may have different options. This effectively treats\n * any positional as a `--` argument. Only relevant if `allowPositionals`\n * is true.\n *\n * To do subcommands, set this option, look at the first positional, and\n * parse the remaining positionals as appropriate.\n *\n * @default false\n */\n stopAtPositional?: boolean\n\n /**\n * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function,\n * will be called with each positional argument encountered. If the function\n * returns true, then parsing will stop at that point.\n */\n stopAtPositionalTest?: (arg: string) => boolean\n}\n\n/**\n * Class returned by the {@link jack} function and all configuration\n * definition methods. This is what gets chained together.\n */\nexport class Jack {\n #configSet: C\n #shorts: Record\n #options: JackOptions\n #fields: UsageField[] = []\n #env: Record\n #envPrefix?: string\n #allowPositionals: boolean\n #usage?: string\n #usageMarkdown?: string\n\n constructor(options: JackOptions = {}) {\n this.#options = options\n this.#allowPositionals = options.allowPositionals !== false\n this.#env =\n this.#options.env === undefined ? process.env : this.#options.env\n this.#envPrefix = options.envPrefix\n // We need to fib a little, because it's always the same object, but it\n // starts out as having an empty config set. Then each method that adds\n // fields returns `this as Jack`\n this.#configSet = Object.create(null) as C\n this.#shorts = Object.create(null)\n }\n\n /**\n * Resulting definitions, suitable to be passed to Node's `util.parseArgs`,\n * but also including `description` and `short` fields, if set.\n */\n get definitions(): C {\n return this.#configSet\n }\n\n /** map of `{ : }` strings for each short name defined */\n get shorts() {\n return this.#shorts\n }\n\n /**\n * options passed to the {@link Jack} constructor\n */\n get jackOptions() {\n return this.#options\n }\n\n /**\n * the data used to generate {@link Jack#usage} and\n * {@link Jack#usageMarkdown} content.\n */\n get usageFields() {\n return this.#fields\n }\n\n /**\n * Set the default value (which will still be overridden by env or cli)\n * as if from a parsed config file. The optional `source` param, if\n * provided, will be included in error messages if a value is invalid or\n * unknown.\n */\n setConfigValues(values: Partial>, source = '') {\n try {\n this.validate(values)\n } catch (er) {\n if (source && er instanceof Error) {\n /* c8 ignore next */\n const cause = typeof er.cause === 'object' ? er.cause : {}\n er.cause = { ...cause, path: source }\n Error.captureStackTrace(er, this.setConfigValues)\n }\n throw er\n }\n for (const [field, value] of Object.entries(values)) {\n const my = this.#configSet[field]\n // already validated, just for TS's benefit\n /* c8 ignore start */\n if (!my) {\n throw new Error('unexpected field in config set: ' + field, {\n cause: {\n code: 'JACKSPEAK',\n found: field,\n },\n })\n }\n /* c8 ignore stop */\n my.default = value as ConfigValue\n }\n return this\n }\n\n /**\n * Parse a string of arguments, and return the resulting\n * `{ values, positionals }` object.\n *\n * If an {@link JackOptions#envPrefix} is set, then it will read default\n * values from the environment, and write the resulting values back\n * to the environment as well.\n *\n * Environment values always take precedence over any other value, except\n * an explicit CLI setting.\n */\n parse(args: string[] = process.argv): Parsed {\n this.loadEnvDefaults()\n const p = this.parseRaw(args)\n this.applyDefaults(p)\n this.writeEnv(p)\n return p\n }\n\n loadEnvDefaults() {\n if (this.#envPrefix) {\n for (const [field, my] of Object.entries(this.#configSet)) {\n const ek = toEnvKey(this.#envPrefix, field)\n const env = this.#env[ek]\n if (env !== undefined) {\n my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim)\n }\n }\n }\n }\n\n applyDefaults(p: Parsed) {\n for (const [field, c] of Object.entries(this.#configSet)) {\n if (c.default !== undefined && !(field in p.values)) {\n //@ts-ignore\n p.values[field] = c.default\n }\n }\n }\n\n /**\n * Only parse the command line arguments passed in.\n * Does not strip off the `node script.js` bits, so it must be just the\n * arguments you wish to have parsed.\n * Does not read from or write to the environment, or set defaults.\n */\n parseRaw(args: string[]): Parsed {\n if (args === process.argv) {\n args = args.slice(\n (process as { _eval?: string })._eval !== undefined ? 1 : 2,\n )\n }\n\n const result = parseArgs({\n args,\n options: toParseArgsOptionsConfig(this.#configSet),\n // always strict, but using our own logic\n strict: false,\n allowPositionals: this.#allowPositionals,\n tokens: true,\n })\n\n const p: Parsed = {\n values: {} as OptionsResults,\n positionals: [],\n }\n for (const token of result.tokens) {\n if (token.kind === 'positional') {\n p.positionals.push(token.value)\n if (\n this.#options.stopAtPositional ||\n this.#options.stopAtPositionalTest?.(token.value)\n ) {\n p.positionals.push(...args.slice(token.index + 1))\n break\n }\n } else if (token.kind === 'option') {\n let value: ConfigValue | undefined = undefined\n if (token.name.startsWith('no-')) {\n const my = this.#configSet[token.name]\n const pname = token.name.substring('no-'.length)\n const pos = this.#configSet[pname]\n if (\n pos &&\n pos.type === 'boolean' &&\n (!my ||\n (my.type === 'boolean' && !!my.multiple === !!pos.multiple))\n ) {\n value = false\n token.name = pname\n }\n }\n const my = this.#configSet[token.name]\n if (!my) {\n throw new Error(\n `Unknown option '${token.rawName}'. ` +\n `To specify a positional argument starting with a '-', ` +\n `place it at the end of the command after '--', as in ` +\n `'-- ${token.rawName}'`,\n {\n cause: {\n code: 'JACKSPEAK',\n found:\n token.rawName + (token.value ? `=${token.value}` : ''),\n },\n },\n )\n }\n if (value === undefined) {\n if (token.value === undefined) {\n if (my.type !== 'boolean') {\n throw new Error(\n `No value provided for ${token.rawName}, expected ${my.type}`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: token.rawName,\n wanted: valueType(my),\n },\n },\n )\n }\n value = true\n } else {\n if (my.type === 'boolean') {\n throw new Error(\n `Flag ${token.rawName} does not take a value, received '${token.value}'`,\n { cause: { code: 'JACKSPEAK', found: token } },\n )\n }\n if (my.type === 'string') {\n value = token.value\n } else {\n value = +token.value\n if (value !== value) {\n throw new Error(\n `Invalid value '${token.value}' provided for ` +\n `'${token.rawName}' option, expected number`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: token.rawName,\n found: token.value,\n wanted: 'number',\n },\n },\n )\n }\n }\n }\n }\n if (my.multiple) {\n const pv = p.values as Record\n const tn = pv[token.name] ?? []\n pv[token.name] = tn\n tn.push(value)\n } else {\n const pv = p.values as Record\n pv[token.name] = value\n }\n }\n }\n\n for (const [field, value] of Object.entries(p.values)) {\n const valid = this.#configSet[field]?.validate\n const validOptions = this.#configSet[field]?.validOptions\n const cause =\n validOptions && !isValidOption(value, validOptions) ?\n { name: field, found: value, validOptions }\n : valid && !valid(value) ? { name: field, found: value }\n : undefined\n if (cause) {\n throw new Error(\n `Invalid value provided for --${field}: ${JSON.stringify(value)}`,\n { cause: { ...cause, code: 'JACKSPEAK' } },\n )\n }\n }\n\n return p\n }\n\n /**\n * do not set fields as 'no-foo' if 'foo' exists and both are bools\n * just set foo.\n */\n #noNoFields(f: string, val: unknown, s: string = f) {\n if (!f.startsWith('no-') || typeof val !== 'boolean') return\n const yes = f.substring('no-'.length)\n // recurse so we get the core config key we care about.\n this.#noNoFields(yes, val, s)\n if (this.#configSet[yes]?.type === 'boolean') {\n throw new Error(\n `do not set '${s}', instead set '${yes}' as desired.`,\n { cause: { code: 'JACKSPEAK', found: s, wanted: yes } },\n )\n }\n }\n\n /**\n * Validate that any arbitrary object is a valid configuration `values`\n * object. Useful when loading config files or other sources.\n */\n validate(o: unknown): asserts o is Parsed['values'] {\n if (!o || typeof o !== 'object') {\n throw new Error('Invalid config: not an object', {\n cause: { code: 'JACKSPEAK', found: o },\n })\n }\n const opts = o as Record\n for (const field in o) {\n const value = opts[field]\n /* c8 ignore next - for TS */\n if (value === undefined) continue\n this.#noNoFields(field, value)\n const config = this.#configSet[field]\n if (!config) {\n throw new Error(`Unknown config option: ${field}`, {\n cause: { code: 'JACKSPEAK', found: field },\n })\n }\n if (!isValidValue(value, config.type, !!config.multiple)) {\n throw new Error(\n `Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: field,\n found: value,\n wanted: valueType(config),\n },\n },\n )\n }\n const cause =\n config.validOptions && !isValidOption(value, config.validOptions) ?\n { name: field, found: value, validOptions: config.validOptions }\n : config.validate && !config.validate(value) ?\n { name: field, found: value }\n : undefined\n if (cause) {\n throw new Error(`Invalid config value for ${field}: ${value}`, {\n cause: { ...cause, code: 'JACKSPEAK' },\n })\n }\n }\n }\n\n writeEnv(p: Parsed) {\n if (!this.#env || !this.#envPrefix) return\n for (const [field, value] of Object.entries(p.values)) {\n const my = this.#configSet[field]\n this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(\n value as ConfigValue,\n my?.delim,\n )\n }\n }\n\n /**\n * Add a heading to the usage output banner\n */\n heading(\n text: string,\n level?: 1 | 2 | 3 | 4 | 5 | 6,\n { pre = false }: { pre?: boolean } = {},\n ): Jack {\n if (level === undefined) {\n level = this.#fields.some(r => isHeading(r)) ? 2 : 1\n }\n this.#fields.push({ type: 'heading', text, level, pre })\n return this\n }\n\n /**\n * Add a long-form description to the usage output at this position.\n */\n description(text: string, { pre }: { pre?: boolean } = {}): Jack {\n this.#fields.push({ type: 'description', text, pre })\n return this\n }\n\n /**\n * Add one or more number fields.\n */\n num>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'number', false)\n }\n\n /**\n * Add one or more multiple number fields.\n */\n numList>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'number', true)\n }\n\n /**\n * Add one or more string option fields.\n */\n opt>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'string', false)\n }\n\n /**\n * Add one or more multiple string option fields.\n */\n optList>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'string', true)\n }\n\n /**\n * Add one or more flag fields.\n */\n flag>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'boolean', false)\n }\n\n /**\n * Add one or more multiple flag fields.\n */\n flagList>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'boolean', true)\n }\n\n /**\n * Generic field definition method. Similar to flag/flagList/number/etc,\n * but you must specify the `type` (and optionally `multiple` and `delim`)\n * fields on each one, or Jack won't know how to define them.\n */\n addFields(fields: F): Jack {\n return this.#addFields(this as unknown as Jack, fields)\n }\n\n #addFieldsWith<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n O extends ConfigSetFromMetaSet,\n >(fields: F, type: ConfigType, multiple: boolean): Jack {\n return this.#addFields(this as unknown as Jack, fields, {\n type,\n multiple,\n })\n }\n\n #addFields<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n O extends Jack,\n >(next: O, fields: F, opt?: { type: T; multiple: M }): O {\n Object.assign(\n next.#configSet,\n Object.fromEntries(\n Object.entries(fields).map(([name, field]) => {\n this.#validateName(name, field)\n const { type, multiple } = validateFieldMeta(field, opt)\n const value = { ...field, type, multiple }\n validateField(value, type, multiple)\n next.#fields.push({ type: 'config', name, value })\n return [name, value]\n }),\n ),\n )\n return next\n }\n\n #validateName(name: string, field: { short?: string }) {\n if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {\n throw new TypeError(\n `Invalid option name: ${name}, ` +\n `must be '-' delimited ASCII alphanumeric`,\n )\n }\n if (this.#configSet[name]) {\n throw new TypeError(`Cannot redefine option ${field}`)\n }\n if (this.#shorts[name]) {\n throw new TypeError(\n `Cannot redefine option ${name}, already ` +\n `in use for ${this.#shorts[name]}`,\n )\n }\n if (field.short) {\n if (!/^[a-zA-Z0-9]$/.test(field.short)) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n 'must be 1 ASCII alphanumeric character',\n )\n }\n if (this.#shorts[field.short]) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n `already in use for ${this.#shorts[field.short]}`,\n )\n }\n this.#shorts[field.short] = name\n this.#shorts[name] = name\n }\n }\n\n /**\n * Return the usage banner for the given configuration\n */\n usage(): string {\n if (this.#usage) return this.#usage\n\n let headingLevel = 1\n //@ts-ignore\n const ui = cliui({ width })\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n ui.div({\n padding: [0, 0, 0, 0],\n text: normalize(first.text),\n })\n }\n ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' })\n if (this.#options.usage) {\n ui.div({\n text: this.#options.usage,\n padding: [0, 0, 0, 2],\n })\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n ui.div({\n text: usage,\n padding: [0, 0, 0, 2],\n })\n }\n\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n const print = normalize(maybeDesc.text, maybeDesc.pre)\n start++\n ui.div({ padding: [0, 0, 0, 0], text: print })\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n\n const { rows, maxWidth } = this.#usageRows(start)\n\n // every heading/description after the first gets indented by 2\n // extra spaces.\n for (const row of rows) {\n if (row.left) {\n // If the row is too long, don't wrap it\n // Bump the right-hand side down a line to make room\n const configIndent = indent(Math.max(headingLevel, 2))\n if (row.left.length > maxWidth - 3) {\n ui.div({ text: row.left, padding: [0, 0, 0, configIndent] })\n ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] })\n } else {\n ui.div(\n {\n text: row.left,\n padding: [0, 1, 0, configIndent],\n width: maxWidth,\n },\n { padding: [0, 0, 0, 0], text: row.text },\n )\n }\n if (row.skipLine) {\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n } else {\n if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n // only h1 and h2 have bottom padding\n // h3-h6 do not\n const b = level <= 2 ? 1 : 0\n ui.div({ ...row, padding: [0, 0, b, indent(level)] })\n } else {\n ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] })\n }\n }\n }\n\n return (this.#usage = ui.toString())\n }\n\n /**\n * Return the usage banner markdown for the given configuration\n */\n usageMarkdown(): string {\n if (this.#usageMarkdown) return this.#usageMarkdown\n\n const out: string[] = []\n\n let headingLevel = 1\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n out.push(`# ${normalizeOneLine(first.text)}`)\n }\n out.push('Usage:')\n if (this.#options.usage) {\n out.push(normalizeMarkdown(this.#options.usage, true))\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n out.push(normalizeMarkdown(usage, true))\n }\n\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre))\n start++\n }\n\n const { rows } = this.#usageRows(start)\n\n // heading level in markdown is number of # ahead of text\n for (const row of rows) {\n if (row.left) {\n out.push(\n '#'.repeat(headingLevel + 1) +\n ' ' +\n normalizeOneLine(row.left, true),\n )\n if (row.text) out.push(normalizeMarkdown(row.text))\n } else if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n out.push(\n `${'#'.repeat(headingLevel)} ${normalizeOneLine(\n row.text,\n row.pre,\n )}`,\n )\n } else {\n out.push(normalizeMarkdown(row.text, !!(row as Description).pre))\n }\n }\n\n return (this.#usageMarkdown = out.join('\\n\\n') + '\\n')\n }\n\n #usageRows(start: number) {\n // turn each config type into a row, and figure out the width of the\n // left hand indentation for the option descriptions.\n let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)))\n let maxWidth = 8\n let prev: Row | TextRow | undefined = undefined\n const rows: (Row | TextRow)[] = []\n for (const field of this.#fields.slice(start)) {\n if (field.type !== 'config') {\n if (prev?.type === 'config') prev.skipLine = true\n prev = undefined\n field.text = normalize(field.text, !!field.pre)\n rows.push(field)\n continue\n }\n const { value } = field\n const desc = value.description || ''\n const mult = value.multiple ? 'Can be set multiple times' : ''\n const opts =\n value.validOptions?.length ?\n `Valid options:${value.validOptions.map(\n v => ` ${JSON.stringify(v)}`,\n )}`\n : ''\n const dmDelim = desc.includes('\\n') ? '\\n\\n' : '\\n'\n const extra = [opts, mult].join(dmDelim).trim()\n const text = (normalize(desc) + dmDelim + extra).trim()\n const hint =\n value.hint ||\n (value.type === 'number' ? 'n'\n : value.type === 'string' ? field.name\n : undefined)\n const short =\n !value.short ? ''\n : value.type === 'boolean' ? `-${value.short} `\n : `-${value.short}<${hint}> `\n const left =\n value.type === 'boolean' ?\n `${short}--${field.name}`\n : `${short}--${field.name}=<${hint}>`\n const row: Row = { text, left, type: 'config' }\n if (text.length > width - maxMax) {\n row.skipLine = true\n }\n if (prev && left.length > maxMax) prev.skipLine = true\n prev = row\n const len = left.length + 4\n if (len > maxWidth && len < maxMax) {\n maxWidth = len\n }\n\n rows.push(row)\n }\n\n return { rows, maxWidth }\n }\n\n /**\n * Return the configuration options as a plain object\n */\n toJSON() {\n return Object.fromEntries(\n Object.entries(this.#configSet).map(([field, def]) => [\n field,\n {\n type: def.type,\n ...(def.multiple ? { multiple: true } : {}),\n ...(def.delim ? { delim: def.delim } : {}),\n ...(def.short ? { short: def.short } : {}),\n ...(def.description ?\n { description: normalize(def.description) }\n : {}),\n ...(def.validate ? { validate: def.validate } : {}),\n ...(def.validOptions ? { validOptions: def.validOptions } : {}),\n ...(def.default !== undefined ? { default: def.default } : {}),\n ...(def.hint ? { hint: def.hint } : {}),\n },\n ]),\n )\n }\n\n /**\n * Custom printer for `util.inspect`\n */\n [inspect.custom](_: number, options: InspectOptions) {\n return `Jack ${inspect(this.toJSON(), options)}`\n }\n}\n\n/**\n * Main entry point. Create and return a {@link Jack} object.\n */\nexport const jack = (options: JackOptions = {}) => new Jack(options)\n\n// Unwrap and un-indent, so we can wrap description\n// strings however makes them look nice in the code.\nconst normalize = (s: string, pre = false) => {\n if (pre)\n // prepend a ZWSP to each line so cliui doesn't strip it.\n return s\n .split('\\n')\n .map(l => `\\u200b${l}`)\n .join('\\n')\n return s\n .split(/^\\s*```\\s*$/gm)\n .map((s, i) => {\n if (i % 2 === 1) {\n if (!s.trim()) {\n return `\\`\\`\\`\\n\\`\\`\\`\\n`\n }\n // outdent the ``` blocks, but preserve whitespace otherwise.\n const split = s.split('\\n')\n // throw out the \\n at the start and end\n split.pop()\n split.shift()\n const si = split.reduce((shortest, l) => {\n /* c8 ignore next */\n const ind = l.match(/^\\s*/)?.[0] ?? ''\n if (ind.length) return Math.min(ind.length, shortest)\n else return shortest\n }, Infinity)\n /* c8 ignore next */\n const i = isFinite(si) ? si : 0\n return (\n '\\n```\\n' +\n split.map(s => `\\u200b${s.substring(i)}`).join('\\n') +\n '\\n```\\n'\n )\n }\n return (\n s\n // remove single line breaks, except for lists\n .replace(/([^\\n])\\n[ \\t]*([^\\n])/g, (_, $1, $2) =>\n !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\\n${$2}`,\n )\n // normalize mid-line whitespace\n .replace(/([^\\n])[ \\t]+([^\\n])/g, '$1 $2')\n // two line breaks are enough\n .replace(/\\n{3,}/g, '\\n\\n')\n // remove any spaces at the start of a line\n .replace(/\\n[ \\t]+/g, '\\n')\n .trim()\n )\n })\n .join('\\n')\n}\n\n// normalize for markdown printing, remove leading spaces on lines\nconst normalizeMarkdown = (s: string, pre: boolean = false): string => {\n const n = normalize(s, pre).replace(/\\\\/g, '\\\\\\\\')\n return pre ?\n `\\`\\`\\`\\n${n.replace(/\\u200b/g, '')}\\n\\`\\`\\``\n : n.replace(/\\n +/g, '\\n').trim()\n}\n\nconst normalizeOneLine = (s: string, pre: boolean = false) => {\n const n = normalize(s, pre)\n .replace(/[\\s\\u200b]+/g, ' ')\n .trim()\n return pre ? `\\`${n}\\`` : n\n}\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed913d54fa30cce60d366bc94792f8ad8745d71e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.d.ts @@ -0,0 +1,323 @@ +import { inspect, InspectOptions, ParseArgsConfig } from 'node:util'; +export type ParseArgsOptions = Exclude; +export type ParseArgsOption = ParseArgsOptions[string]; +export type ParseArgsDefault = Exclude; +export type ConfigType = 'number' | 'string' | 'boolean'; +export declare const isConfigType: (t: unknown) => t is ConfigType; +export type ConfigValuePrimitive = string | boolean | number; +export type ConfigValueArray = string[] | boolean[] | number[]; +export type ConfigValue = ConfigValuePrimitive | ConfigValueArray; +/** + * Given a Jack object, get the typeof its ConfigSet + */ +export type Unwrap = J extends Jack ? C : never; +/** + * Defines the type of value that is valid, given a config definition's + * {@link ConfigType} and boolean multiple setting + */ +export type ValidValue = [ + T, + M +] extends ['number', true] ? number[] : [T, M] extends ['string', true] ? string[] : [T, M] extends ['boolean', true] ? boolean[] : [T, M] extends ['number', false] ? number : [T, M] extends ['string', false] ? string : [T, M] extends ['boolean', false] ? boolean : [T, M] extends ['string', boolean] ? string | string[] : [T, M] extends ['boolean', boolean] ? boolean | boolean[] : [T, M] extends ['number', boolean] ? number | number[] : [T, M] extends [ConfigType, false] ? ConfigValuePrimitive : [T, M] extends [ConfigType, true] ? ConfigValueArray : ConfigValue; +export type ReadonlyArrays = readonly number[] | readonly string[]; +/** + * Defines the type of validOptions that are valid, given a config definition's + * {@link ConfigType} + */ +export type ValidOptions = T extends 'boolean' ? undefined : T extends 'string' ? readonly string[] : T extends 'number' ? readonly number[] : ReadonlyArrays; +/** + * A config field definition, in its full representation. + * This is what is passed in to addFields so `type` is required. + */ +export type ConfigOption = undefined | ValidOptions> = { + type: T; + short?: string; + default?: ValidValue & (O extends ReadonlyArrays ? M extends false ? O[number] : O[number][] : unknown); + description?: string; + hint?: T extends 'boolean' ? undefined : string; + validate?: ((v: unknown) => v is ValidValue) | ((v: unknown) => boolean); + validOptions?: O; + delim?: M extends false ? undefined : string; + multiple?: M; +}; +/** + * Determine whether an unknown object is a {@link ConfigOption} based only + * on its `type` and `multiple` property + */ +export declare const isConfigOptionOfType: (o: any, type: T, multi: M) => o is ConfigOption; +/** + * Determine whether an unknown object is a {@link ConfigOption} based on + * it having all valid properties + */ +export declare const isConfigOption: (o: any, type: T, multi: M) => o is ConfigOption; +/** + * The meta information for a config option definition, when the + * type and multiple values can be inferred by the method being used + */ +export type ConfigOptionMeta = ConfigOption> = Pick, 'type'> & Omit; +/** + * A set of {@link ConfigOption} objects, referenced by their longOption + * string values. + */ +export type ConfigSet = { + [longOption: string]: ConfigOption; +}; +/** + * A set of {@link ConfigOptionMeta} fields, referenced by their longOption + * string values. + */ +export type ConfigMetaSet = { + [longOption: string]: ConfigOptionMeta; +}; +/** + * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet} + */ +export type ConfigSetFromMetaSet> = S & { + [longOption in keyof S]: ConfigOption; +}; +/** + * The 'values' field returned by {@link Jack#parse}. If a value has + * a default field it will be required on the object otherwise it is optional. + */ +export type OptionsResults = { + [K in keyof T]: (T[K]['validOptions'] extends ReadonlyArrays ? T[K] extends ConfigOption<'string' | 'number', false> ? T[K]['validOptions'][number] : T[K] extends ConfigOption<'string' | 'number', true> ? T[K]['validOptions'][number][] : never : T[K] extends ConfigOption<'string', false> ? string : T[K] extends ConfigOption<'string', true> ? string[] : T[K] extends ConfigOption<'number', false> ? number : T[K] extends ConfigOption<'number', true> ? number[] : T[K] extends ConfigOption<'boolean', false> ? boolean : T[K] extends ConfigOption<'boolean', true> ? boolean[] : never) | (T[K]['default'] extends ConfigValue ? never : undefined); +}; +/** + * The object retured by {@link Jack#parse} + */ +export type Parsed = { + values: OptionsResults; + positionals: string[]; +}; +/** + * A row used when generating the {@link Jack#usage} string + */ +export interface Row { + left?: string; + text: string; + skipLine?: boolean; + type?: string; +} +/** + * A heading for a section in the usage, created by the jack.heading() + * method. + * + * First heading is always level 1, subsequent headings default to 2. + * + * The level of the nearest heading level sets the indentation of the + * description that follows. + */ +export interface Heading extends Row { + type: 'heading'; + text: string; + left?: ''; + skipLine?: boolean; + level: number; + pre?: boolean; +} +/** + * An arbitrary blob of text describing some stuff, set by the + * jack.description() method. + * + * Indentation determined by level of the nearest header. + */ +export interface Description extends Row { + type: 'description'; + text: string; + left?: ''; + skipLine?: boolean; + pre?: boolean; +} +/** + * A heading or description row used when generating the {@link Jack#usage} + * string + */ +export type TextRow = Heading | Description; +/** + * Either a {@link TextRow} or a reference to a {@link ConfigOption} + */ +export type UsageField = TextRow | { + type: 'config'; + name: string; + value: ConfigOption; +}; +/** + * Options provided to the {@link Jack} constructor + */ +export interface JackOptions { + /** + * Whether to allow positional arguments + * + * @default true + */ + allowPositionals?: boolean; + /** + * Prefix to use when reading/writing the environment variables + * + * If not specified, environment behavior will not be available. + */ + envPrefix?: string; + /** + * Environment object to read/write. Defaults `process.env`. + * No effect if `envPrefix` is not set. + */ + env?: Record; + /** + * A short usage string. If not provided, will be generated from the + * options provided, but that can of course be rather verbose if + * there are a lot of options. + */ + usage?: string; + /** + * Stop parsing flags and opts at the first positional argument. + * This is to support cases like `cmd [flags] [options]`, where + * each subcommand may have different options. This effectively treats + * any positional as a `--` argument. Only relevant if `allowPositionals` + * is true. + * + * To do subcommands, set this option, look at the first positional, and + * parse the remaining positionals as appropriate. + * + * @default false + */ + stopAtPositional?: boolean; + /** + * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function, + * will be called with each positional argument encountered. If the function + * returns true, then parsing will stop at that point. + */ + stopAtPositionalTest?: (arg: string) => boolean; +} +/** + * Class returned by the {@link jack} function and all configuration + * definition methods. This is what gets chained together. + */ +export declare class Jack { + #private; + constructor(options?: JackOptions); + /** + * Resulting definitions, suitable to be passed to Node's `util.parseArgs`, + * but also including `description` and `short` fields, if set. + */ + get definitions(): C; + /** map of `{ : }` strings for each short name defined */ + get shorts(): Record; + /** + * options passed to the {@link Jack} constructor + */ + get jackOptions(): JackOptions; + /** + * the data used to generate {@link Jack#usage} and + * {@link Jack#usageMarkdown} content. + */ + get usageFields(): UsageField[]; + /** + * Set the default value (which will still be overridden by env or cli) + * as if from a parsed config file. The optional `source` param, if + * provided, will be included in error messages if a value is invalid or + * unknown. + */ + setConfigValues(values: Partial>, source?: string): this; + /** + * Parse a string of arguments, and return the resulting + * `{ values, positionals }` object. + * + * If an {@link JackOptions#envPrefix} is set, then it will read default + * values from the environment, and write the resulting values back + * to the environment as well. + * + * Environment values always take precedence over any other value, except + * an explicit CLI setting. + */ + parse(args?: string[]): Parsed; + loadEnvDefaults(): void; + applyDefaults(p: Parsed): void; + /** + * Only parse the command line arguments passed in. + * Does not strip off the `node script.js` bits, so it must be just the + * arguments you wish to have parsed. + * Does not read from or write to the environment, or set defaults. + */ + parseRaw(args: string[]): Parsed; + /** + * Validate that any arbitrary object is a valid configuration `values` + * object. Useful when loading config files or other sources. + */ + validate(o: unknown): asserts o is Parsed['values']; + writeEnv(p: Parsed): void; + /** + * Add a heading to the usage output banner + */ + heading(text: string, level?: 1 | 2 | 3 | 4 | 5 | 6, { pre }?: { + pre?: boolean; + }): Jack; + /** + * Add a long-form description to the usage output at this position. + */ + description(text: string, { pre }?: { + pre?: boolean; + }): Jack; + /** + * Add one or more number fields. + */ + num>(fields: F): Jack>; + /** + * Add one or more multiple number fields. + */ + numList>(fields: F): Jack>; + /** + * Add one or more string option fields. + */ + opt>(fields: F): Jack>; + /** + * Add one or more multiple string option fields. + */ + optList>(fields: F): Jack>; + /** + * Add one or more flag fields. + */ + flag>(fields: F): Jack>; + /** + * Add one or more multiple flag fields. + */ + flagList>(fields: F): Jack>; + /** + * Generic field definition method. Similar to flag/flagList/number/etc, + * but you must specify the `type` (and optionally `multiple` and `delim`) + * fields on each one, or Jack won't know how to define them. + */ + addFields(fields: F): Jack; + /** + * Return the usage banner for the given configuration + */ + usage(): string; + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown(): string; + /** + * Return the configuration options as a plain object + */ + toJSON(): { + [k: string]: { + hint?: string | undefined; + default?: ConfigValue | undefined; + validOptions?: readonly number[] | readonly string[] | undefined; + validate?: ((v: unknown) => boolean) | ((v: unknown) => v is ValidValue) | undefined; + description?: string | undefined; + short?: string | undefined; + delim?: string | undefined; + multiple?: boolean | undefined; + type: ConfigType; + }; + }; + /** + * Custom printer for `util.inspect` + */ + [inspect.custom](_: number, options: InspectOptions): string; +} +/** + * Main entry point. Create and return a {@link Jack} object. + */ +export declare const jack: (options?: JackOptions) => Jack<{}>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b83201746f5cc88193aa7ceffb3cc4fda79beacb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EAEd,eAAe,EAChB,MAAM,WAAW,CAAA;AAOlB,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,eAAe,CAAC,SAAS,CAAC,EAC1B,SAAS,CACV,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACtD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAA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AAC;IAIpD;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,EAC5C,MAAM,EAAE,CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAItD;;OAEG;IACH,QAAQ,CAAC,CAAC,SAAS,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,EAC/C,MAAM,EAAE,CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAIrD;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAwEtD;;OAEG;IACH,KAAK,IAAI,MAAM;IAiGf;;OAEG;IACH,aAAa,IAAI,MAAM;IAgIvB;;OAEG;IACH,MAAM;;;;;4BA1qCG,OAAO,KAAK,OAAO,SADnB,OAAO,KAAK,CAAC,IAAI,UAAU,qBAAM;;;;;;;;IAgsC1C;;OAEG;IACH,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;CAGpD;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,aAAa,WAAW,aAA2B,CAAA"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b959f5126423c0701982c782cf15ef118341ba53 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.js @@ -0,0 +1,936 @@ +import { inspect, parseArgs, } from 'node:util'; +// it's a tiny API, just cast it inline, it's fine +//@ts-ignore +import cliui from '@isaacs/cliui'; +import { basename } from 'node:path'; +export const isConfigType = (t) => typeof t === 'string' && + (t === 'string' || t === 'number' || t === 'boolean'); +const isValidValue = (v, type, multi) => { + if (multi) { + if (!Array.isArray(v)) + return false; + return !v.some((v) => !isValidValue(v, type, false)); + } + if (Array.isArray(v)) + return false; + return typeof v === type; +}; +const isValidOption = (v, vo) => !!vo && + (Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v)); +/** + * Determine whether an unknown object is a {@link ConfigOption} based only + * on its `type` and `multiple` property + */ +export const isConfigOptionOfType = (o, type, multi) => !!o && + typeof o === 'object' && + isConfigType(o.type) && + o.type === type && + !!o.multiple === multi; +/** + * Determine whether an unknown object is a {@link ConfigOption} based on + * it having all valid properties + */ +export const isConfigOption = (o, type, multi) => isConfigOptionOfType(o, type, multi) && + undefOrType(o.short, 'string') && + undefOrType(o.description, 'string') && + undefOrType(o.hint, 'string') && + undefOrType(o.validate, 'function') && + (o.type === 'boolean' ? + o.validOptions === undefined + : undefOrTypeArray(o.validOptions, o.type)) && + (o.default === undefined || isValidValue(o.default, type, multi)); +const isHeading = (r) => r.type === 'heading'; +const isDescription = (r) => r.type === 'description'; +const width = Math.min(process?.stdout?.columns ?? 80, 80); +// indentation spaces from heading level +const indent = (n) => (n - 1) * 2; +const toEnvKey = (pref, key) => [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')] + .join(' ') + .trim() + .toUpperCase() + .replace(/ /g, '_'); +const toEnvVal = (value, delim = '\n') => { + const str = typeof value === 'string' ? value + : typeof value === 'boolean' ? + value ? '1' + : '0' + : typeof value === 'number' ? String(value) + : Array.isArray(value) ? + value.map((v) => toEnvVal(v)).join(delim) + : /* c8 ignore start */ undefined; + if (typeof str !== 'string') { + throw new Error(`could not serialize value to environment: ${JSON.stringify(value)}`, { cause: { code: 'JACKSPEAK' } }); + } + /* c8 ignore stop */ + return str; +}; +const fromEnvVal = (env, type, multiple, delim = '\n') => (multiple ? + env ? env.split(delim).map(v => fromEnvVal(v, type, false)) + : [] + : type === 'string' ? env + : type === 'boolean' ? env === '1' + : +env.trim()); +const undefOrType = (v, t) => v === undefined || typeof v === t; +const undefOrTypeArray = (v, t) => v === undefined || (Array.isArray(v) && v.every(x => typeof x === t)); +// print the value type, for error message reporting +const valueType = (v) => typeof v === 'string' ? 'string' + : typeof v === 'boolean' ? 'boolean' + : typeof v === 'number' ? 'number' + : Array.isArray(v) ? + `${joinTypes([...new Set(v.map(v => valueType(v)))])}[]` + : `${v.type}${v.multiple ? '[]' : ''}`; +const joinTypes = (types) => types.length === 1 && typeof types[0] === 'string' ? + types[0] + : `(${types.join('|')})`; +const validateFieldMeta = (field, fieldMeta) => { + if (fieldMeta) { + if (field.type !== undefined && field.type !== fieldMeta.type) { + throw new TypeError(`invalid type`, { + cause: { + found: field.type, + wanted: [fieldMeta.type, undefined], + }, + }); + } + if (field.multiple !== undefined && + !!field.multiple !== fieldMeta.multiple) { + throw new TypeError(`invalid multiple`, { + cause: { + found: field.multiple, + wanted: [fieldMeta.multiple, undefined], + }, + }); + } + return fieldMeta; + } + if (!isConfigType(field.type)) { + throw new TypeError(`invalid type`, { + cause: { + found: field.type, + wanted: ['string', 'number', 'boolean'], + }, + }); + } + return { + type: field.type, + multiple: !!field.multiple, + }; +}; +const validateField = (o, type, multiple) => { + const validateValidOptions = (def, validOptions) => { + if (!undefOrTypeArray(validOptions, type)) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: valueType({ type, multiple: true }), + }, + }); + } + if (def !== undefined && validOptions !== undefined) { + const valid = Array.isArray(def) ? + def.every(v => validOptions.includes(v)) + : validOptions.includes(def); + if (!valid) { + throw new TypeError('invalid default value not in validOptions', { + cause: { + found: def, + wanted: validOptions, + }, + }); + } + } + }; + if (o.default !== undefined && + !isValidValue(o.default, type, multiple)) { + throw new TypeError('invalid default value', { + cause: { + found: o.default, + wanted: valueType({ type, multiple }), + }, + }); + } + if (isConfigOptionOfType(o, 'number', false) || + isConfigOptionOfType(o, 'number', true)) { + validateValidOptions(o.default, o.validOptions); + } + else if (isConfigOptionOfType(o, 'string', false) || + isConfigOptionOfType(o, 'string', true)) { + validateValidOptions(o.default, o.validOptions); + } + else if (isConfigOptionOfType(o, 'boolean', false) || + isConfigOptionOfType(o, 'boolean', true)) { + if (o.hint !== undefined) { + throw new TypeError('cannot provide hint for flag'); + } + if (o.validOptions !== undefined) { + throw new TypeError('cannot provide validOptions for flag'); + } + } + return o; +}; +const toParseArgsOptionsConfig = (options) => { + return Object.entries(options).reduce((acc, [longOption, o]) => { + const p = { + type: 'string', + multiple: !!o.multiple, + ...(typeof o.short === 'string' ? { short: o.short } : undefined), + }; + const setNoBool = () => { + if (!longOption.startsWith('no-') && !options[`no-${longOption}`]) { + acc[`no-${longOption}`] = { + type: 'boolean', + multiple: !!o.multiple, + }; + } + }; + const setDefault = (def, fn) => { + if (def !== undefined) { + p.default = fn(def); + } + }; + if (isConfigOption(o, 'number', false)) { + setDefault(o.default, String); + } + else if (isConfigOption(o, 'number', true)) { + setDefault(o.default, d => d.map(v => String(v))); + } + else if (isConfigOption(o, 'string', false) || + isConfigOption(o, 'string', true)) { + setDefault(o.default, v => v); + } + else if (isConfigOption(o, 'boolean', false) || + isConfigOption(o, 'boolean', true)) { + p.type = 'boolean'; + setDefault(o.default, v => v); + setNoBool(); + } + acc[longOption] = p; + return acc; + }, {}); +}; +/** + * Class returned by the {@link jack} function and all configuration + * definition methods. This is what gets chained together. + */ +export class Jack { + #configSet; + #shorts; + #options; + #fields = []; + #env; + #envPrefix; + #allowPositionals; + #usage; + #usageMarkdown; + constructor(options = {}) { + this.#options = options; + this.#allowPositionals = options.allowPositionals !== false; + this.#env = + this.#options.env === undefined ? process.env : this.#options.env; + this.#envPrefix = options.envPrefix; + // We need to fib a little, because it's always the same object, but it + // starts out as having an empty config set. Then each method that adds + // fields returns `this as Jack` + this.#configSet = Object.create(null); + this.#shorts = Object.create(null); + } + /** + * Resulting definitions, suitable to be passed to Node's `util.parseArgs`, + * but also including `description` and `short` fields, if set. + */ + get definitions() { + return this.#configSet; + } + /** map of `{ : }` strings for each short name defined */ + get shorts() { + return this.#shorts; + } + /** + * options passed to the {@link Jack} constructor + */ + get jackOptions() { + return this.#options; + } + /** + * the data used to generate {@link Jack#usage} and + * {@link Jack#usageMarkdown} content. + */ + get usageFields() { + return this.#fields; + } + /** + * Set the default value (which will still be overridden by env or cli) + * as if from a parsed config file. The optional `source` param, if + * provided, will be included in error messages if a value is invalid or + * unknown. + */ + setConfigValues(values, source = '') { + try { + this.validate(values); + } + catch (er) { + if (source && er instanceof Error) { + /* c8 ignore next */ + const cause = typeof er.cause === 'object' ? er.cause : {}; + er.cause = { ...cause, path: source }; + Error.captureStackTrace(er, this.setConfigValues); + } + throw er; + } + for (const [field, value] of Object.entries(values)) { + const my = this.#configSet[field]; + // already validated, just for TS's benefit + /* c8 ignore start */ + if (!my) { + throw new Error('unexpected field in config set: ' + field, { + cause: { + code: 'JACKSPEAK', + found: field, + }, + }); + } + /* c8 ignore stop */ + my.default = value; + } + return this; + } + /** + * Parse a string of arguments, and return the resulting + * `{ values, positionals }` object. + * + * If an {@link JackOptions#envPrefix} is set, then it will read default + * values from the environment, and write the resulting values back + * to the environment as well. + * + * Environment values always take precedence over any other value, except + * an explicit CLI setting. + */ + parse(args = process.argv) { + this.loadEnvDefaults(); + const p = this.parseRaw(args); + this.applyDefaults(p); + this.writeEnv(p); + return p; + } + loadEnvDefaults() { + if (this.#envPrefix) { + for (const [field, my] of Object.entries(this.#configSet)) { + const ek = toEnvKey(this.#envPrefix, field); + const env = this.#env[ek]; + if (env !== undefined) { + my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim); + } + } + } + } + applyDefaults(p) { + for (const [field, c] of Object.entries(this.#configSet)) { + if (c.default !== undefined && !(field in p.values)) { + //@ts-ignore + p.values[field] = c.default; + } + } + } + /** + * Only parse the command line arguments passed in. + * Does not strip off the `node script.js` bits, so it must be just the + * arguments you wish to have parsed. + * Does not read from or write to the environment, or set defaults. + */ + parseRaw(args) { + if (args === process.argv) { + args = args.slice(process._eval !== undefined ? 1 : 2); + } + const result = parseArgs({ + args, + options: toParseArgsOptionsConfig(this.#configSet), + // always strict, but using our own logic + strict: false, + allowPositionals: this.#allowPositionals, + tokens: true, + }); + const p = { + values: {}, + positionals: [], + }; + for (const token of result.tokens) { + if (token.kind === 'positional') { + p.positionals.push(token.value); + if (this.#options.stopAtPositional || + this.#options.stopAtPositionalTest?.(token.value)) { + p.positionals.push(...args.slice(token.index + 1)); + break; + } + } + else if (token.kind === 'option') { + let value = undefined; + if (token.name.startsWith('no-')) { + const my = this.#configSet[token.name]; + const pname = token.name.substring('no-'.length); + const pos = this.#configSet[pname]; + if (pos && + pos.type === 'boolean' && + (!my || + (my.type === 'boolean' && !!my.multiple === !!pos.multiple))) { + value = false; + token.name = pname; + } + } + const my = this.#configSet[token.name]; + if (!my) { + throw new Error(`Unknown option '${token.rawName}'. ` + + `To specify a positional argument starting with a '-', ` + + `place it at the end of the command after '--', as in ` + + `'-- ${token.rawName}'`, { + cause: { + code: 'JACKSPEAK', + found: token.rawName + (token.value ? `=${token.value}` : ''), + }, + }); + } + if (value === undefined) { + if (token.value === undefined) { + if (my.type !== 'boolean') { + throw new Error(`No value provided for ${token.rawName}, expected ${my.type}`, { + cause: { + code: 'JACKSPEAK', + name: token.rawName, + wanted: valueType(my), + }, + }); + } + value = true; + } + else { + if (my.type === 'boolean') { + throw new Error(`Flag ${token.rawName} does not take a value, received '${token.value}'`, { cause: { code: 'JACKSPEAK', found: token } }); + } + if (my.type === 'string') { + value = token.value; + } + else { + value = +token.value; + if (value !== value) { + throw new Error(`Invalid value '${token.value}' provided for ` + + `'${token.rawName}' option, expected number`, { + cause: { + code: 'JACKSPEAK', + name: token.rawName, + found: token.value, + wanted: 'number', + }, + }); + } + } + } + } + if (my.multiple) { + const pv = p.values; + const tn = pv[token.name] ?? []; + pv[token.name] = tn; + tn.push(value); + } + else { + const pv = p.values; + pv[token.name] = value; + } + } + } + for (const [field, value] of Object.entries(p.values)) { + const valid = this.#configSet[field]?.validate; + const validOptions = this.#configSet[field]?.validOptions; + const cause = validOptions && !isValidOption(value, validOptions) ? + { name: field, found: value, validOptions } + : valid && !valid(value) ? { name: field, found: value } + : undefined; + if (cause) { + throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`, { cause: { ...cause, code: 'JACKSPEAK' } }); + } + } + return p; + } + /** + * do not set fields as 'no-foo' if 'foo' exists and both are bools + * just set foo. + */ + #noNoFields(f, val, s = f) { + if (!f.startsWith('no-') || typeof val !== 'boolean') + return; + const yes = f.substring('no-'.length); + // recurse so we get the core config key we care about. + this.#noNoFields(yes, val, s); + if (this.#configSet[yes]?.type === 'boolean') { + throw new Error(`do not set '${s}', instead set '${yes}' as desired.`, { cause: { code: 'JACKSPEAK', found: s, wanted: yes } }); + } + } + /** + * Validate that any arbitrary object is a valid configuration `values` + * object. Useful when loading config files or other sources. + */ + validate(o) { + if (!o || typeof o !== 'object') { + throw new Error('Invalid config: not an object', { + cause: { code: 'JACKSPEAK', found: o }, + }); + } + const opts = o; + for (const field in o) { + const value = opts[field]; + /* c8 ignore next - for TS */ + if (value === undefined) + continue; + this.#noNoFields(field, value); + const config = this.#configSet[field]; + if (!config) { + throw new Error(`Unknown config option: ${field}`, { + cause: { code: 'JACKSPEAK', found: field }, + }); + } + if (!isValidValue(value, config.type, !!config.multiple)) { + throw new Error(`Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`, { + cause: { + code: 'JACKSPEAK', + name: field, + found: value, + wanted: valueType(config), + }, + }); + } + const cause = config.validOptions && !isValidOption(value, config.validOptions) ? + { name: field, found: value, validOptions: config.validOptions } + : config.validate && !config.validate(value) ? + { name: field, found: value } + : undefined; + if (cause) { + throw new Error(`Invalid config value for ${field}: ${value}`, { + cause: { ...cause, code: 'JACKSPEAK' }, + }); + } + } + } + writeEnv(p) { + if (!this.#env || !this.#envPrefix) + return; + for (const [field, value] of Object.entries(p.values)) { + const my = this.#configSet[field]; + this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim); + } + } + /** + * Add a heading to the usage output banner + */ + heading(text, level, { pre = false } = {}) { + if (level === undefined) { + level = this.#fields.some(r => isHeading(r)) ? 2 : 1; + } + this.#fields.push({ type: 'heading', text, level, pre }); + return this; + } + /** + * Add a long-form description to the usage output at this position. + */ + description(text, { pre } = {}) { + this.#fields.push({ type: 'description', text, pre }); + return this; + } + /** + * Add one or more number fields. + */ + num(fields) { + return this.#addFieldsWith(fields, 'number', false); + } + /** + * Add one or more multiple number fields. + */ + numList(fields) { + return this.#addFieldsWith(fields, 'number', true); + } + /** + * Add one or more string option fields. + */ + opt(fields) { + return this.#addFieldsWith(fields, 'string', false); + } + /** + * Add one or more multiple string option fields. + */ + optList(fields) { + return this.#addFieldsWith(fields, 'string', true); + } + /** + * Add one or more flag fields. + */ + flag(fields) { + return this.#addFieldsWith(fields, 'boolean', false); + } + /** + * Add one or more multiple flag fields. + */ + flagList(fields) { + return this.#addFieldsWith(fields, 'boolean', true); + } + /** + * Generic field definition method. Similar to flag/flagList/number/etc, + * but you must specify the `type` (and optionally `multiple` and `delim`) + * fields on each one, or Jack won't know how to define them. + */ + addFields(fields) { + return this.#addFields(this, fields); + } + #addFieldsWith(fields, type, multiple) { + return this.#addFields(this, fields, { + type, + multiple, + }); + } + #addFields(next, fields, opt) { + Object.assign(next.#configSet, Object.fromEntries(Object.entries(fields).map(([name, field]) => { + this.#validateName(name, field); + const { type, multiple } = validateFieldMeta(field, opt); + const value = { ...field, type, multiple }; + validateField(value, type, multiple); + next.#fields.push({ type: 'config', name, value }); + return [name, value]; + }))); + return next; + } + #validateName(name, field) { + if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) { + throw new TypeError(`Invalid option name: ${name}, ` + + `must be '-' delimited ASCII alphanumeric`); + } + if (this.#configSet[name]) { + throw new TypeError(`Cannot redefine option ${field}`); + } + if (this.#shorts[name]) { + throw new TypeError(`Cannot redefine option ${name}, already ` + + `in use for ${this.#shorts[name]}`); + } + if (field.short) { + if (!/^[a-zA-Z0-9]$/.test(field.short)) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + 'must be 1 ASCII alphanumeric character'); + } + if (this.#shorts[field.short]) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + `already in use for ${this.#shorts[field.short]}`); + } + this.#shorts[field.short] = name; + this.#shorts[name] = name; + } + } + /** + * Return the usage banner for the given configuration + */ + usage() { + if (this.#usage) + return this.#usage; + let headingLevel = 1; + //@ts-ignore + const ui = cliui({ width }); + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + ui.div({ + padding: [0, 0, 0, 0], + text: normalize(first.text), + }); + } + ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' }); + if (this.#options.usage) { + ui.div({ + text: this.#options.usage, + padding: [0, 0, 0, 2], + }); + } + else { + const cmd = basename(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + ui.div({ + text: usage, + padding: [0, 0, 0, 2], + }); + } + ui.div({ padding: [0, 0, 0, 0], text: '' }); + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + const print = normalize(maybeDesc.text, maybeDesc.pre); + start++; + ui.div({ padding: [0, 0, 0, 0], text: print }); + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + const { rows, maxWidth } = this.#usageRows(start); + // every heading/description after the first gets indented by 2 + // extra spaces. + for (const row of rows) { + if (row.left) { + // If the row is too long, don't wrap it + // Bump the right-hand side down a line to make room + const configIndent = indent(Math.max(headingLevel, 2)); + if (row.left.length > maxWidth - 3) { + ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); + ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); + } + else { + ui.div({ + text: row.left, + padding: [0, 1, 0, configIndent], + width: maxWidth, + }, { padding: [0, 0, 0, 0], text: row.text }); + } + if (row.skipLine) { + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + } + else { + if (isHeading(row)) { + const { level } = row; + headingLevel = level; + // only h1 and h2 have bottom padding + // h3-h6 do not + const b = level <= 2 ? 1 : 0; + ui.div({ ...row, padding: [0, 0, b, indent(level)] }); + } + else { + ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); + } + } + } + return (this.#usage = ui.toString()); + } + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown() { + if (this.#usageMarkdown) + return this.#usageMarkdown; + const out = []; + let headingLevel = 1; + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + out.push(`# ${normalizeOneLine(first.text)}`); + } + out.push('Usage:'); + if (this.#options.usage) { + out.push(normalizeMarkdown(this.#options.usage, true)); + } + else { + const cmd = basename(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + out.push(normalizeMarkdown(usage, true)); + } + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre)); + start++; + } + const { rows } = this.#usageRows(start); + // heading level in markdown is number of # ahead of text + for (const row of rows) { + if (row.left) { + out.push('#'.repeat(headingLevel + 1) + + ' ' + + normalizeOneLine(row.left, true)); + if (row.text) + out.push(normalizeMarkdown(row.text)); + } + else if (isHeading(row)) { + const { level } = row; + headingLevel = level; + out.push(`${'#'.repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`); + } + else { + out.push(normalizeMarkdown(row.text, !!row.pre)); + } + } + return (this.#usageMarkdown = out.join('\n\n') + '\n'); + } + #usageRows(start) { + // turn each config type into a row, and figure out the width of the + // left hand indentation for the option descriptions. + let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3))); + let maxWidth = 8; + let prev = undefined; + const rows = []; + for (const field of this.#fields.slice(start)) { + if (field.type !== 'config') { + if (prev?.type === 'config') + prev.skipLine = true; + prev = undefined; + field.text = normalize(field.text, !!field.pre); + rows.push(field); + continue; + } + const { value } = field; + const desc = value.description || ''; + const mult = value.multiple ? 'Can be set multiple times' : ''; + const opts = value.validOptions?.length ? + `Valid options:${value.validOptions.map(v => ` ${JSON.stringify(v)}`)}` + : ''; + const dmDelim = desc.includes('\n') ? '\n\n' : '\n'; + const extra = [opts, mult].join(dmDelim).trim(); + const text = (normalize(desc) + dmDelim + extra).trim(); + const hint = value.hint || + (value.type === 'number' ? 'n' + : value.type === 'string' ? field.name + : undefined); + const short = !value.short ? '' + : value.type === 'boolean' ? `-${value.short} ` + : `-${value.short}<${hint}> `; + const left = value.type === 'boolean' ? + `${short}--${field.name}` + : `${short}--${field.name}=<${hint}>`; + const row = { text, left, type: 'config' }; + if (text.length > width - maxMax) { + row.skipLine = true; + } + if (prev && left.length > maxMax) + prev.skipLine = true; + prev = row; + const len = left.length + 4; + if (len > maxWidth && len < maxMax) { + maxWidth = len; + } + rows.push(row); + } + return { rows, maxWidth }; + } + /** + * Return the configuration options as a plain object + */ + toJSON() { + return Object.fromEntries(Object.entries(this.#configSet).map(([field, def]) => [ + field, + { + type: def.type, + ...(def.multiple ? { multiple: true } : {}), + ...(def.delim ? { delim: def.delim } : {}), + ...(def.short ? { short: def.short } : {}), + ...(def.description ? + { description: normalize(def.description) } + : {}), + ...(def.validate ? { validate: def.validate } : {}), + ...(def.validOptions ? { validOptions: def.validOptions } : {}), + ...(def.default !== undefined ? { default: def.default } : {}), + ...(def.hint ? { hint: def.hint } : {}), + }, + ])); + } + /** + * Custom printer for `util.inspect` + */ + [inspect.custom](_, options) { + return `Jack ${inspect(this.toJSON(), options)}`; + } +} +/** + * Main entry point. Create and return a {@link Jack} object. + */ +export const jack = (options = {}) => new Jack(options); +// Unwrap and un-indent, so we can wrap description +// strings however makes them look nice in the code. +const normalize = (s, pre = false) => { + if (pre) + // prepend a ZWSP to each line so cliui doesn't strip it. + return s + .split('\n') + .map(l => `\u200b${l}`) + .join('\n'); + return s + .split(/^\s*```\s*$/gm) + .map((s, i) => { + if (i % 2 === 1) { + if (!s.trim()) { + return `\`\`\`\n\`\`\`\n`; + } + // outdent the ``` blocks, but preserve whitespace otherwise. + const split = s.split('\n'); + // throw out the \n at the start and end + split.pop(); + split.shift(); + const si = split.reduce((shortest, l) => { + /* c8 ignore next */ + const ind = l.match(/^\s*/)?.[0] ?? ''; + if (ind.length) + return Math.min(ind.length, shortest); + else + return shortest; + }, Infinity); + /* c8 ignore next */ + const i = isFinite(si) ? si : 0; + return ('\n```\n' + + split.map(s => `\u200b${s.substring(i)}`).join('\n') + + '\n```\n'); + } + return (s + // remove single line breaks, except for lists + .replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\n${$2}`) + // normalize mid-line whitespace + .replace(/([^\n])[ \t]+([^\n])/g, '$1 $2') + // two line breaks are enough + .replace(/\n{3,}/g, '\n\n') + // remove any spaces at the start of a line + .replace(/\n[ \t]+/g, '\n') + .trim()); + }) + .join('\n'); +}; +// normalize for markdown printing, remove leading spaces on lines +const normalizeMarkdown = (s, pre = false) => { + const n = normalize(s, pre).replace(/\\/g, '\\\\'); + return pre ? + `\`\`\`\n${n.replace(/\u200b/g, '')}\n\`\`\`` + : n.replace(/\n +/g, '\n').trim(); +}; +const normalizeOneLine = (s, pre = false) => { + const n = normalize(s, pre) + .replace(/[\s\u200b]+/g, ' ') + .trim(); + return pre ? `\`${n}\`` : n; +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a8808d5e25b6eb8cea072082893d9cfde2955e38 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,SAAS,GAEV,MAAM,WAAW,CAAA;AAElB,kDAAkD;AAClD,YAAY;AACZ,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAWpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAU,EAAmB,EAAE,CAC1D,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,SAAS,CAAC,CAAA;AAgCvD,MAAM,YAAY,GAAG,CACnB,CAAU,EACV,IAAO,EACP,KAAQ,EACe,EAAE;IACzB,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC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,CAAC,CAAC,IAAI,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,IAAI,EAAE,CAAA;IACT,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["import {\n inspect,\n InspectOptions,\n parseArgs,\n ParseArgsConfig,\n} from 'node:util'\n\n// it's a tiny API, just cast it inline, it's fine\n//@ts-ignore\nimport cliui from '@isaacs/cliui'\nimport { basename } from 'node:path'\n\nexport type ParseArgsOptions = Exclude<\n ParseArgsConfig['options'],\n undefined\n>\nexport type ParseArgsOption = ParseArgsOptions[string]\nexport type ParseArgsDefault = Exclude\n\nexport type ConfigType = 'number' | 'string' | 'boolean'\n\nexport const isConfigType = (t: unknown): t is ConfigType =>\n typeof t === 'string' &&\n (t === 'string' || t === 'number' || t === 'boolean')\n\nexport type ConfigValuePrimitive = string | boolean | number\nexport type ConfigValueArray = string[] | boolean[] | number[]\nexport type ConfigValue = ConfigValuePrimitive | ConfigValueArray\n\n/**\n * Given a Jack object, get the typeof its ConfigSet\n */\nexport type Unwrap = J extends Jack ? C : never\n\n/**\n * Defines the type of value that is valid, given a config definition's\n * {@link ConfigType} and boolean multiple setting\n */\nexport type ValidValue<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n> =\n [T, M] extends ['number', true] ? number[]\n : [T, M] extends ['string', true] ? string[]\n : [T, M] extends ['boolean', true] ? boolean[]\n : [T, M] extends ['number', false] ? number\n : [T, M] extends ['string', false] ? string\n : [T, M] extends ['boolean', false] ? boolean\n : [T, M] extends ['string', boolean] ? string | string[]\n : [T, M] extends ['boolean', boolean] ? boolean | boolean[]\n : [T, M] extends ['number', boolean] ? number | number[]\n : [T, M] extends [ConfigType, false] ? ConfigValuePrimitive\n : [T, M] extends [ConfigType, true] ? ConfigValueArray\n : ConfigValue\n\nconst isValidValue = (\n v: unknown,\n type: T,\n multi: M,\n): v is ValidValue => {\n if (multi) {\n if (!Array.isArray(v)) return false\n return !v.some((v: unknown) => !isValidValue(v, type, false))\n }\n if (Array.isArray(v)) return false\n return typeof v === type\n}\n\nexport type ReadonlyArrays = readonly number[] | readonly string[]\n\n/**\n * Defines the type of validOptions that are valid, given a config definition's\n * {@link ConfigType}\n */\nexport type ValidOptions =\n T extends 'boolean' ? undefined\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : ReadonlyArrays\n\nconst isValidOption = (\n v: unknown,\n vo: readonly unknown[],\n): vo is Exclude, undefined> =>\n !!vo &&\n (Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v))\n\n/**\n * A config field definition, in its full representation.\n * This is what is passed in to addFields so `type` is required.\n */\nexport type ConfigOption<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n O extends undefined | ValidOptions = undefined | ValidOptions,\n> = {\n type: T\n short?: string\n default?: ValidValue &\n (O extends ReadonlyArrays ?\n M extends false ?\n O[number]\n : O[number][]\n : unknown)\n description?: string\n hint?: T extends 'boolean' ? undefined : string\n validate?:\n | ((v: unknown) => v is ValidValue)\n | ((v: unknown) => boolean)\n validOptions?: O\n delim?: M extends false ? undefined : string\n multiple?: M\n}\n\n/**\n * Determine whether an unknown object is a {@link ConfigOption} based only\n * on its `type` and `multiple` property\n */\nexport const isConfigOptionOfType = <\n T extends ConfigType,\n M extends boolean,\n>(\n o: any,\n type: T,\n multi: M,\n): o is ConfigOption =>\n !!o &&\n typeof o === 'object' &&\n isConfigType(o.type) &&\n o.type === type &&\n !!o.multiple === multi\n\n/**\n * Determine whether an unknown object is a {@link ConfigOption} based on\n * it having all valid properties\n */\nexport const isConfigOption = (\n o: any,\n type: T,\n multi: M,\n): o is ConfigOption =>\n isConfigOptionOfType(o, type, multi) &&\n undefOrType(o.short, 'string') &&\n undefOrType(o.description, 'string') &&\n undefOrType(o.hint, 'string') &&\n undefOrType(o.validate, 'function') &&\n (o.type === 'boolean' ?\n o.validOptions === undefined\n : undefOrTypeArray(o.validOptions, o.type)) &&\n (o.default === undefined || isValidValue(o.default, type, multi))\n\n/**\n * The meta information for a config option definition, when the\n * type and multiple values can be inferred by the method being used\n */\nexport type ConfigOptionMeta<\n T extends ConfigType,\n M extends boolean,\n O extends ConfigOption = ConfigOption,\n> = Pick, 'type'> & Omit\n\n/**\n * A set of {@link ConfigOption} objects, referenced by their longOption\n * string values.\n */\nexport type ConfigSet = {\n [longOption: string]: ConfigOption\n}\n\n/**\n * A set of {@link ConfigOptionMeta} fields, referenced by their longOption\n * string values.\n */\nexport type ConfigMetaSet = {\n [longOption: string]: ConfigOptionMeta\n}\n\n/**\n * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet}\n */\nexport type ConfigSetFromMetaSet<\n T extends ConfigType,\n M extends boolean,\n S extends ConfigMetaSet,\n> = S & { [longOption in keyof S]: ConfigOption }\n\n/**\n * The 'values' field returned by {@link Jack#parse}. If a value has\n * a default field it will be required on the object otherwise it is optional.\n */\nexport type OptionsResults = {\n [K in keyof T]:\n | (T[K]['validOptions'] extends ReadonlyArrays ?\n T[K] extends ConfigOption<'string' | 'number', false> ?\n T[K]['validOptions'][number]\n : T[K] extends ConfigOption<'string' | 'number', true> ?\n T[K]['validOptions'][number][]\n : never\n : T[K] extends ConfigOption<'string', false> ? string\n : T[K] extends ConfigOption<'string', true> ? string[]\n : T[K] extends ConfigOption<'number', false> ? number\n : T[K] extends ConfigOption<'number', true> ? number[]\n : T[K] extends ConfigOption<'boolean', false> ? boolean\n : T[K] extends ConfigOption<'boolean', true> ? boolean[]\n : never)\n | (T[K]['default'] extends ConfigValue ? never : undefined)\n}\n\n/**\n * The object retured by {@link Jack#parse}\n */\nexport type Parsed = {\n values: OptionsResults\n positionals: string[]\n}\n\n/**\n * A row used when generating the {@link Jack#usage} string\n */\nexport interface Row {\n left?: string\n text: string\n skipLine?: boolean\n type?: string\n}\n\n/**\n * A heading for a section in the usage, created by the jack.heading()\n * method.\n *\n * First heading is always level 1, subsequent headings default to 2.\n *\n * The level of the nearest heading level sets the indentation of the\n * description that follows.\n */\nexport interface Heading extends Row {\n type: 'heading'\n text: string\n left?: ''\n skipLine?: boolean\n level: number\n pre?: boolean\n}\n\nconst isHeading = (r: { type?: string }): r is Heading =>\n r.type === 'heading'\n\n/**\n * An arbitrary blob of text describing some stuff, set by the\n * jack.description() method.\n *\n * Indentation determined by level of the nearest header.\n */\nexport interface Description extends Row {\n type: 'description'\n text: string\n left?: ''\n skipLine?: boolean\n pre?: boolean\n}\n\nconst isDescription = (r: { type?: string }): r is Description =>\n r.type === 'description'\n\n/**\n * A heading or description row used when generating the {@link Jack#usage}\n * string\n */\nexport type TextRow = Heading | Description\n\n/**\n * Either a {@link TextRow} or a reference to a {@link ConfigOption}\n */\nexport type UsageField =\n | TextRow\n | {\n type: 'config'\n name: string\n value: ConfigOption\n }\n\nconst width = Math.min(process?.stdout?.columns ?? 80, 80)\n\n// indentation spaces from heading level\nconst indent = (n: number) => (n - 1) * 2\n\nconst toEnvKey = (pref: string, key: string): string =>\n [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')]\n .join(' ')\n .trim()\n .toUpperCase()\n .replace(/ /g, '_')\n\nconst toEnvVal = (value: ConfigValue, delim: string = '\\n'): string => {\n const str =\n typeof value === 'string' ? value\n : typeof value === 'boolean' ?\n value ? '1'\n : '0'\n : typeof value === 'number' ? String(value)\n : Array.isArray(value) ?\n value.map((v: ConfigValue) => toEnvVal(v)).join(delim)\n : /* c8 ignore start */ undefined\n if (typeof str !== 'string') {\n throw new Error(\n `could not serialize value to environment: ${JSON.stringify(value)}`,\n { cause: { code: 'JACKSPEAK' } },\n )\n }\n /* c8 ignore stop */\n return str\n}\n\nconst fromEnvVal = (\n env: string,\n type: T,\n multiple: M,\n delim: string = '\\n',\n): ValidValue =>\n (multiple ?\n env ? env.split(delim).map(v => fromEnvVal(v, type, false))\n : []\n : type === 'string' ? env\n : type === 'boolean' ? env === '1'\n : +env.trim()) as ValidValue\n\nconst undefOrType = (v: unknown, t: string): boolean =>\n v === undefined || typeof v === t\n\nconst undefOrTypeArray = (v: unknown, t: string): boolean =>\n v === undefined || (Array.isArray(v) && v.every(x => typeof x === t))\n\n// print the value type, for error message reporting\nconst valueType = (\n v: ConfigValue | { type: ConfigType; multiple?: boolean },\n): string =>\n typeof v === 'string' ? 'string'\n : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' ? 'number'\n : Array.isArray(v) ?\n `${joinTypes([...new Set(v.map(v => valueType(v)))])}[]`\n : `${v.type}${v.multiple ? '[]' : ''}`\n\nconst joinTypes = (types: string[]): string =>\n types.length === 1 && typeof types[0] === 'string' ?\n types[0]\n : `(${types.join('|')})`\n\nconst validateFieldMeta = (\n field: ConfigOptionMeta,\n fieldMeta?: { type: T; multiple: M },\n): { type: ConfigType; multiple: boolean } => {\n if (fieldMeta) {\n if (field.type !== undefined && field.type !== fieldMeta.type) {\n throw new TypeError(`invalid type`, {\n cause: {\n found: field.type,\n wanted: [fieldMeta.type, undefined],\n },\n })\n }\n if (\n field.multiple !== undefined &&\n !!field.multiple !== fieldMeta.multiple\n ) {\n throw new TypeError(`invalid multiple`, {\n cause: {\n found: field.multiple,\n wanted: [fieldMeta.multiple, undefined],\n },\n })\n }\n return fieldMeta\n }\n\n if (!isConfigType(field.type)) {\n throw new TypeError(`invalid type`, {\n cause: {\n found: field.type,\n wanted: ['string', 'number', 'boolean'],\n },\n })\n }\n\n return {\n type: field.type,\n multiple: !!field.multiple,\n }\n}\n\nconst validateField = (\n o: ConfigOption,\n type: ConfigType,\n multiple: boolean,\n): ConfigOption => {\n const validateValidOptions = <\n T extends ConfigValue | undefined,\n V extends T extends Array ? U : T,\n >(\n def: T | undefined,\n validOptions: readonly V[] | undefined,\n ) => {\n if (!undefOrTypeArray(validOptions, type)) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: valueType({ type, multiple: true }),\n },\n })\n }\n if (def !== undefined && validOptions !== undefined) {\n const valid =\n Array.isArray(def) ?\n def.every(v => validOptions.includes(v as V))\n : validOptions.includes(def as V)\n if (!valid) {\n throw new TypeError('invalid default value not in validOptions', {\n cause: {\n found: def,\n wanted: validOptions,\n },\n })\n }\n }\n }\n\n if (\n o.default !== undefined &&\n !isValidValue(o.default, type, multiple)\n ) {\n throw new TypeError('invalid default value', {\n cause: {\n found: o.default,\n wanted: valueType({ type, multiple }),\n },\n })\n }\n\n if (\n isConfigOptionOfType(o, 'number', false) ||\n isConfigOptionOfType(o, 'number', true)\n ) {\n validateValidOptions(o.default, o.validOptions)\n } else if (\n isConfigOptionOfType(o, 'string', false) ||\n isConfigOptionOfType(o, 'string', true)\n ) {\n validateValidOptions(o.default, o.validOptions)\n } else if (\n isConfigOptionOfType(o, 'boolean', false) ||\n isConfigOptionOfType(o, 'boolean', true)\n ) {\n if (o.hint !== undefined) {\n throw new TypeError('cannot provide hint for flag')\n }\n if (o.validOptions !== undefined) {\n throw new TypeError('cannot provide validOptions for flag')\n }\n }\n\n return o\n}\n\nconst toParseArgsOptionsConfig = (\n options: ConfigSet,\n): ParseArgsOptions => {\n return Object.entries(options).reduce((acc, [longOption, o]) => {\n const p: ParseArgsOption = {\n type: 'string',\n multiple: !!o.multiple,\n ...(typeof o.short === 'string' ? { short: o.short } : undefined),\n }\n const setNoBool = () => {\n if (!longOption.startsWith('no-') && !options[`no-${longOption}`]) {\n acc[`no-${longOption}`] = {\n type: 'boolean',\n multiple: !!o.multiple,\n }\n }\n }\n const setDefault = (\n def: T | undefined,\n fn: (d: T) => ParseArgsDefault,\n ) => {\n if (def !== undefined) {\n p.default = fn(def)\n }\n }\n if (isConfigOption(o, 'number', false)) {\n setDefault(o.default, String)\n } else if (isConfigOption(o, 'number', true)) {\n setDefault(o.default, d => d.map(v => String(v)))\n } else if (\n isConfigOption(o, 'string', false) ||\n isConfigOption(o, 'string', true)\n ) {\n setDefault(o.default, v => v)\n } else if (\n isConfigOption(o, 'boolean', false) ||\n isConfigOption(o, 'boolean', true)\n ) {\n p.type = 'boolean'\n setDefault(o.default, v => v)\n setNoBool()\n }\n acc[longOption] = p\n return acc\n }, {} as ParseArgsOptions)\n}\n\n/**\n * Options provided to the {@link Jack} constructor\n */\nexport interface JackOptions {\n /**\n * Whether to allow positional arguments\n *\n * @default true\n */\n allowPositionals?: boolean\n\n /**\n * Prefix to use when reading/writing the environment variables\n *\n * If not specified, environment behavior will not be available.\n */\n envPrefix?: string\n\n /**\n * Environment object to read/write. Defaults `process.env`.\n * No effect if `envPrefix` is not set.\n */\n env?: Record\n\n /**\n * A short usage string. If not provided, will be generated from the\n * options provided, but that can of course be rather verbose if\n * there are a lot of options.\n */\n usage?: string\n\n /**\n * Stop parsing flags and opts at the first positional argument.\n * This is to support cases like `cmd [flags] [options]`, where\n * each subcommand may have different options. This effectively treats\n * any positional as a `--` argument. Only relevant if `allowPositionals`\n * is true.\n *\n * To do subcommands, set this option, look at the first positional, and\n * parse the remaining positionals as appropriate.\n *\n * @default false\n */\n stopAtPositional?: boolean\n\n /**\n * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function,\n * will be called with each positional argument encountered. If the function\n * returns true, then parsing will stop at that point.\n */\n stopAtPositionalTest?: (arg: string) => boolean\n}\n\n/**\n * Class returned by the {@link jack} function and all configuration\n * definition methods. This is what gets chained together.\n */\nexport class Jack {\n #configSet: C\n #shorts: Record\n #options: JackOptions\n #fields: UsageField[] = []\n #env: Record\n #envPrefix?: string\n #allowPositionals: boolean\n #usage?: string\n #usageMarkdown?: string\n\n constructor(options: JackOptions = {}) {\n this.#options = options\n this.#allowPositionals = options.allowPositionals !== false\n this.#env =\n this.#options.env === undefined ? process.env : this.#options.env\n this.#envPrefix = options.envPrefix\n // We need to fib a little, because it's always the same object, but it\n // starts out as having an empty config set. Then each method that adds\n // fields returns `this as Jack`\n this.#configSet = Object.create(null) as C\n this.#shorts = Object.create(null)\n }\n\n /**\n * Resulting definitions, suitable to be passed to Node's `util.parseArgs`,\n * but also including `description` and `short` fields, if set.\n */\n get definitions(): C {\n return this.#configSet\n }\n\n /** map of `{ : }` strings for each short name defined */\n get shorts() {\n return this.#shorts\n }\n\n /**\n * options passed to the {@link Jack} constructor\n */\n get jackOptions() {\n return this.#options\n }\n\n /**\n * the data used to generate {@link Jack#usage} and\n * {@link Jack#usageMarkdown} content.\n */\n get usageFields() {\n return this.#fields\n }\n\n /**\n * Set the default value (which will still be overridden by env or cli)\n * as if from a parsed config file. The optional `source` param, if\n * provided, will be included in error messages if a value is invalid or\n * unknown.\n */\n setConfigValues(values: Partial>, source = '') {\n try {\n this.validate(values)\n } catch (er) {\n if (source && er instanceof Error) {\n /* c8 ignore next */\n const cause = typeof er.cause === 'object' ? er.cause : {}\n er.cause = { ...cause, path: source }\n Error.captureStackTrace(er, this.setConfigValues)\n }\n throw er\n }\n for (const [field, value] of Object.entries(values)) {\n const my = this.#configSet[field]\n // already validated, just for TS's benefit\n /* c8 ignore start */\n if (!my) {\n throw new Error('unexpected field in config set: ' + field, {\n cause: {\n code: 'JACKSPEAK',\n found: field,\n },\n })\n }\n /* c8 ignore stop */\n my.default = value as ConfigValue\n }\n return this\n }\n\n /**\n * Parse a string of arguments, and return the resulting\n * `{ values, positionals }` object.\n *\n * If an {@link JackOptions#envPrefix} is set, then it will read default\n * values from the environment, and write the resulting values back\n * to the environment as well.\n *\n * Environment values always take precedence over any other value, except\n * an explicit CLI setting.\n */\n parse(args: string[] = process.argv): Parsed {\n this.loadEnvDefaults()\n const p = this.parseRaw(args)\n this.applyDefaults(p)\n this.writeEnv(p)\n return p\n }\n\n loadEnvDefaults() {\n if (this.#envPrefix) {\n for (const [field, my] of Object.entries(this.#configSet)) {\n const ek = toEnvKey(this.#envPrefix, field)\n const env = this.#env[ek]\n if (env !== undefined) {\n my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim)\n }\n }\n }\n }\n\n applyDefaults(p: Parsed) {\n for (const [field, c] of Object.entries(this.#configSet)) {\n if (c.default !== undefined && !(field in p.values)) {\n //@ts-ignore\n p.values[field] = c.default\n }\n }\n }\n\n /**\n * Only parse the command line arguments passed in.\n * Does not strip off the `node script.js` bits, so it must be just the\n * arguments you wish to have parsed.\n * Does not read from or write to the environment, or set defaults.\n */\n parseRaw(args: string[]): Parsed {\n if (args === process.argv) {\n args = args.slice(\n (process as { _eval?: string })._eval !== undefined ? 1 : 2,\n )\n }\n\n const result = parseArgs({\n args,\n options: toParseArgsOptionsConfig(this.#configSet),\n // always strict, but using our own logic\n strict: false,\n allowPositionals: this.#allowPositionals,\n tokens: true,\n })\n\n const p: Parsed = {\n values: {} as OptionsResults,\n positionals: [],\n }\n for (const token of result.tokens) {\n if (token.kind === 'positional') {\n p.positionals.push(token.value)\n if (\n this.#options.stopAtPositional ||\n this.#options.stopAtPositionalTest?.(token.value)\n ) {\n p.positionals.push(...args.slice(token.index + 1))\n break\n }\n } else if (token.kind === 'option') {\n let value: ConfigValue | undefined = undefined\n if (token.name.startsWith('no-')) {\n const my = this.#configSet[token.name]\n const pname = token.name.substring('no-'.length)\n const pos = this.#configSet[pname]\n if (\n pos &&\n pos.type === 'boolean' &&\n (!my ||\n (my.type === 'boolean' && !!my.multiple === !!pos.multiple))\n ) {\n value = false\n token.name = pname\n }\n }\n const my = this.#configSet[token.name]\n if (!my) {\n throw new Error(\n `Unknown option '${token.rawName}'. ` +\n `To specify a positional argument starting with a '-', ` +\n `place it at the end of the command after '--', as in ` +\n `'-- ${token.rawName}'`,\n {\n cause: {\n code: 'JACKSPEAK',\n found:\n token.rawName + (token.value ? `=${token.value}` : ''),\n },\n },\n )\n }\n if (value === undefined) {\n if (token.value === undefined) {\n if (my.type !== 'boolean') {\n throw new Error(\n `No value provided for ${token.rawName}, expected ${my.type}`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: token.rawName,\n wanted: valueType(my),\n },\n },\n )\n }\n value = true\n } else {\n if (my.type === 'boolean') {\n throw new Error(\n `Flag ${token.rawName} does not take a value, received '${token.value}'`,\n { cause: { code: 'JACKSPEAK', found: token } },\n )\n }\n if (my.type === 'string') {\n value = token.value\n } else {\n value = +token.value\n if (value !== value) {\n throw new Error(\n `Invalid value '${token.value}' provided for ` +\n `'${token.rawName}' option, expected number`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: token.rawName,\n found: token.value,\n wanted: 'number',\n },\n },\n )\n }\n }\n }\n }\n if (my.multiple) {\n const pv = p.values as Record\n const tn = pv[token.name] ?? []\n pv[token.name] = tn\n tn.push(value)\n } else {\n const pv = p.values as Record\n pv[token.name] = value\n }\n }\n }\n\n for (const [field, value] of Object.entries(p.values)) {\n const valid = this.#configSet[field]?.validate\n const validOptions = this.#configSet[field]?.validOptions\n const cause =\n validOptions && !isValidOption(value, validOptions) ?\n { name: field, found: value, validOptions }\n : valid && !valid(value) ? { name: field, found: value }\n : undefined\n if (cause) {\n throw new Error(\n `Invalid value provided for --${field}: ${JSON.stringify(value)}`,\n { cause: { ...cause, code: 'JACKSPEAK' } },\n )\n }\n }\n\n return p\n }\n\n /**\n * do not set fields as 'no-foo' if 'foo' exists and both are bools\n * just set foo.\n */\n #noNoFields(f: string, val: unknown, s: string = f) {\n if (!f.startsWith('no-') || typeof val !== 'boolean') return\n const yes = f.substring('no-'.length)\n // recurse so we get the core config key we care about.\n this.#noNoFields(yes, val, s)\n if (this.#configSet[yes]?.type === 'boolean') {\n throw new Error(\n `do not set '${s}', instead set '${yes}' as desired.`,\n { cause: { code: 'JACKSPEAK', found: s, wanted: yes } },\n )\n }\n }\n\n /**\n * Validate that any arbitrary object is a valid configuration `values`\n * object. Useful when loading config files or other sources.\n */\n validate(o: unknown): asserts o is Parsed['values'] {\n if (!o || typeof o !== 'object') {\n throw new Error('Invalid config: not an object', {\n cause: { code: 'JACKSPEAK', found: o },\n })\n }\n const opts = o as Record\n for (const field in o) {\n const value = opts[field]\n /* c8 ignore next - for TS */\n if (value === undefined) continue\n this.#noNoFields(field, value)\n const config = this.#configSet[field]\n if (!config) {\n throw new Error(`Unknown config option: ${field}`, {\n cause: { code: 'JACKSPEAK', found: field },\n })\n }\n if (!isValidValue(value, config.type, !!config.multiple)) {\n throw new Error(\n `Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`,\n {\n cause: {\n code: 'JACKSPEAK',\n name: field,\n found: value,\n wanted: valueType(config),\n },\n },\n )\n }\n const cause =\n config.validOptions && !isValidOption(value, config.validOptions) ?\n { name: field, found: value, validOptions: config.validOptions }\n : config.validate && !config.validate(value) ?\n { name: field, found: value }\n : undefined\n if (cause) {\n throw new Error(`Invalid config value for ${field}: ${value}`, {\n cause: { ...cause, code: 'JACKSPEAK' },\n })\n }\n }\n }\n\n writeEnv(p: Parsed) {\n if (!this.#env || !this.#envPrefix) return\n for (const [field, value] of Object.entries(p.values)) {\n const my = this.#configSet[field]\n this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(\n value as ConfigValue,\n my?.delim,\n )\n }\n }\n\n /**\n * Add a heading to the usage output banner\n */\n heading(\n text: string,\n level?: 1 | 2 | 3 | 4 | 5 | 6,\n { pre = false }: { pre?: boolean } = {},\n ): Jack {\n if (level === undefined) {\n level = this.#fields.some(r => isHeading(r)) ? 2 : 1\n }\n this.#fields.push({ type: 'heading', text, level, pre })\n return this\n }\n\n /**\n * Add a long-form description to the usage output at this position.\n */\n description(text: string, { pre }: { pre?: boolean } = {}): Jack {\n this.#fields.push({ type: 'description', text, pre })\n return this\n }\n\n /**\n * Add one or more number fields.\n */\n num>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'number', false)\n }\n\n /**\n * Add one or more multiple number fields.\n */\n numList>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'number', true)\n }\n\n /**\n * Add one or more string option fields.\n */\n opt>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'string', false)\n }\n\n /**\n * Add one or more multiple string option fields.\n */\n optList>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'string', true)\n }\n\n /**\n * Add one or more flag fields.\n */\n flag>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'boolean', false)\n }\n\n /**\n * Add one or more multiple flag fields.\n */\n flagList>(\n fields: F,\n ): Jack> {\n return this.#addFieldsWith(fields, 'boolean', true)\n }\n\n /**\n * Generic field definition method. Similar to flag/flagList/number/etc,\n * but you must specify the `type` (and optionally `multiple` and `delim`)\n * fields on each one, or Jack won't know how to define them.\n */\n addFields(fields: F): Jack {\n return this.#addFields(this as unknown as Jack, fields)\n }\n\n #addFieldsWith<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n O extends ConfigSetFromMetaSet,\n >(fields: F, type: ConfigType, multiple: boolean): Jack {\n return this.#addFields(this as unknown as Jack, fields, {\n type,\n multiple,\n })\n }\n\n #addFields<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n O extends Jack,\n >(next: O, fields: F, opt?: { type: T; multiple: M }): O {\n Object.assign(\n next.#configSet,\n Object.fromEntries(\n Object.entries(fields).map(([name, field]) => {\n this.#validateName(name, field)\n const { type, multiple } = validateFieldMeta(field, opt)\n const value = { ...field, type, multiple }\n validateField(value, type, multiple)\n next.#fields.push({ type: 'config', name, value })\n return [name, value]\n }),\n ),\n )\n return next\n }\n\n #validateName(name: string, field: { short?: string }) {\n if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {\n throw new TypeError(\n `Invalid option name: ${name}, ` +\n `must be '-' delimited ASCII alphanumeric`,\n )\n }\n if (this.#configSet[name]) {\n throw new TypeError(`Cannot redefine option ${field}`)\n }\n if (this.#shorts[name]) {\n throw new TypeError(\n `Cannot redefine option ${name}, already ` +\n `in use for ${this.#shorts[name]}`,\n )\n }\n if (field.short) {\n if (!/^[a-zA-Z0-9]$/.test(field.short)) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n 'must be 1 ASCII alphanumeric character',\n )\n }\n if (this.#shorts[field.short]) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n `already in use for ${this.#shorts[field.short]}`,\n )\n }\n this.#shorts[field.short] = name\n this.#shorts[name] = name\n }\n }\n\n /**\n * Return the usage banner for the given configuration\n */\n usage(): string {\n if (this.#usage) return this.#usage\n\n let headingLevel = 1\n //@ts-ignore\n const ui = cliui({ width })\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n ui.div({\n padding: [0, 0, 0, 0],\n text: normalize(first.text),\n })\n }\n ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' })\n if (this.#options.usage) {\n ui.div({\n text: this.#options.usage,\n padding: [0, 0, 0, 2],\n })\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n ui.div({\n text: usage,\n padding: [0, 0, 0, 2],\n })\n }\n\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n const print = normalize(maybeDesc.text, maybeDesc.pre)\n start++\n ui.div({ padding: [0, 0, 0, 0], text: print })\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n\n const { rows, maxWidth } = this.#usageRows(start)\n\n // every heading/description after the first gets indented by 2\n // extra spaces.\n for (const row of rows) {\n if (row.left) {\n // If the row is too long, don't wrap it\n // Bump the right-hand side down a line to make room\n const configIndent = indent(Math.max(headingLevel, 2))\n if (row.left.length > maxWidth - 3) {\n ui.div({ text: row.left, padding: [0, 0, 0, configIndent] })\n ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] })\n } else {\n ui.div(\n {\n text: row.left,\n padding: [0, 1, 0, configIndent],\n width: maxWidth,\n },\n { padding: [0, 0, 0, 0], text: row.text },\n )\n }\n if (row.skipLine) {\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n } else {\n if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n // only h1 and h2 have bottom padding\n // h3-h6 do not\n const b = level <= 2 ? 1 : 0\n ui.div({ ...row, padding: [0, 0, b, indent(level)] })\n } else {\n ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] })\n }\n }\n }\n\n return (this.#usage = ui.toString())\n }\n\n /**\n * Return the usage banner markdown for the given configuration\n */\n usageMarkdown(): string {\n if (this.#usageMarkdown) return this.#usageMarkdown\n\n const out: string[] = []\n\n let headingLevel = 1\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n out.push(`# ${normalizeOneLine(first.text)}`)\n }\n out.push('Usage:')\n if (this.#options.usage) {\n out.push(normalizeMarkdown(this.#options.usage, true))\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n out.push(normalizeMarkdown(usage, true))\n }\n\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre))\n start++\n }\n\n const { rows } = this.#usageRows(start)\n\n // heading level in markdown is number of # ahead of text\n for (const row of rows) {\n if (row.left) {\n out.push(\n '#'.repeat(headingLevel + 1) +\n ' ' +\n normalizeOneLine(row.left, true),\n )\n if (row.text) out.push(normalizeMarkdown(row.text))\n } else if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n out.push(\n `${'#'.repeat(headingLevel)} ${normalizeOneLine(\n row.text,\n row.pre,\n )}`,\n )\n } else {\n out.push(normalizeMarkdown(row.text, !!(row as Description).pre))\n }\n }\n\n return (this.#usageMarkdown = out.join('\\n\\n') + '\\n')\n }\n\n #usageRows(start: number) {\n // turn each config type into a row, and figure out the width of the\n // left hand indentation for the option descriptions.\n let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)))\n let maxWidth = 8\n let prev: Row | TextRow | undefined = undefined\n const rows: (Row | TextRow)[] = []\n for (const field of this.#fields.slice(start)) {\n if (field.type !== 'config') {\n if (prev?.type === 'config') prev.skipLine = true\n prev = undefined\n field.text = normalize(field.text, !!field.pre)\n rows.push(field)\n continue\n }\n const { value } = field\n const desc = value.description || ''\n const mult = value.multiple ? 'Can be set multiple times' : ''\n const opts =\n value.validOptions?.length ?\n `Valid options:${value.validOptions.map(\n v => ` ${JSON.stringify(v)}`,\n )}`\n : ''\n const dmDelim = desc.includes('\\n') ? '\\n\\n' : '\\n'\n const extra = [opts, mult].join(dmDelim).trim()\n const text = (normalize(desc) + dmDelim + extra).trim()\n const hint =\n value.hint ||\n (value.type === 'number' ? 'n'\n : value.type === 'string' ? field.name\n : undefined)\n const short =\n !value.short ? ''\n : value.type === 'boolean' ? `-${value.short} `\n : `-${value.short}<${hint}> `\n const left =\n value.type === 'boolean' ?\n `${short}--${field.name}`\n : `${short}--${field.name}=<${hint}>`\n const row: Row = { text, left, type: 'config' }\n if (text.length > width - maxMax) {\n row.skipLine = true\n }\n if (prev && left.length > maxMax) prev.skipLine = true\n prev = row\n const len = left.length + 4\n if (len > maxWidth && len < maxMax) {\n maxWidth = len\n }\n\n rows.push(row)\n }\n\n return { rows, maxWidth }\n }\n\n /**\n * Return the configuration options as a plain object\n */\n toJSON() {\n return Object.fromEntries(\n Object.entries(this.#configSet).map(([field, def]) => [\n field,\n {\n type: def.type,\n ...(def.multiple ? { multiple: true } : {}),\n ...(def.delim ? { delim: def.delim } : {}),\n ...(def.short ? { short: def.short } : {}),\n ...(def.description ?\n { description: normalize(def.description) }\n : {}),\n ...(def.validate ? { validate: def.validate } : {}),\n ...(def.validOptions ? { validOptions: def.validOptions } : {}),\n ...(def.default !== undefined ? { default: def.default } : {}),\n ...(def.hint ? { hint: def.hint } : {}),\n },\n ]),\n )\n }\n\n /**\n * Custom printer for `util.inspect`\n */\n [inspect.custom](_: number, options: InspectOptions) {\n return `Jack ${inspect(this.toJSON(), options)}`\n }\n}\n\n/**\n * Main entry point. Create and return a {@link Jack} object.\n */\nexport const jack = (options: JackOptions = {}) => new Jack(options)\n\n// Unwrap and un-indent, so we can wrap description\n// strings however makes them look nice in the code.\nconst normalize = (s: string, pre = false) => {\n if (pre)\n // prepend a ZWSP to each line so cliui doesn't strip it.\n return s\n .split('\\n')\n .map(l => `\\u200b${l}`)\n .join('\\n')\n return s\n .split(/^\\s*```\\s*$/gm)\n .map((s, i) => {\n if (i % 2 === 1) {\n if (!s.trim()) {\n return `\\`\\`\\`\\n\\`\\`\\`\\n`\n }\n // outdent the ``` blocks, but preserve whitespace otherwise.\n const split = s.split('\\n')\n // throw out the \\n at the start and end\n split.pop()\n split.shift()\n const si = split.reduce((shortest, l) => {\n /* c8 ignore next */\n const ind = l.match(/^\\s*/)?.[0] ?? ''\n if (ind.length) return Math.min(ind.length, shortest)\n else return shortest\n }, Infinity)\n /* c8 ignore next */\n const i = isFinite(si) ? si : 0\n return (\n '\\n```\\n' +\n split.map(s => `\\u200b${s.substring(i)}`).join('\\n') +\n '\\n```\\n'\n )\n }\n return (\n s\n // remove single line breaks, except for lists\n .replace(/([^\\n])\\n[ \\t]*([^\\n])/g, (_, $1, $2) =>\n !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\\n${$2}`,\n )\n // normalize mid-line whitespace\n .replace(/([^\\n])[ \\t]+([^\\n])/g, '$1 $2')\n // two line breaks are enough\n .replace(/\\n{3,}/g, '\\n\\n')\n // remove any spaces at the start of a line\n .replace(/\\n[ \\t]+/g, '\\n')\n .trim()\n )\n })\n .join('\\n')\n}\n\n// normalize for markdown printing, remove leading spaces on lines\nconst normalizeMarkdown = (s: string, pre: boolean = false): string => {\n const n = normalize(s, pre).replace(/\\\\/g, '\\\\\\\\')\n return pre ?\n `\\`\\`\\`\\n${n.replace(/\\u200b/g, '')}\\n\\`\\`\\``\n : n.replace(/\\n +/g, '\\n').trim()\n}\n\nconst normalizeOneLine = (s: string, pre: boolean = false) => {\n const n = normalize(s, pre)\n .replace(/[\\s\\u200b]+/g, ' ')\n .trim()\n return pre ? `\\`${n}\\`` : n\n}\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/jackspeak/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..dfa7fa6cba823110c8476a4b4ebcc07cfda12535 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..e6de39c02301cb654ab9ba1f69a0f09462853ddc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: + - main + - master + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +jobs: + test: + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 + with: + license-check: true + lint: true + node-versions: '["18", "20", "22"]' diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/anchor.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/anchor.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2af6994c7cfc4414a148f4a01cbcb74c22af969f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/anchor.test.js @@ -0,0 +1,56 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should get a sub schema by sub schema anchor', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const subSchemaAnchor = '#subSchemaId' + const schema = { + $id: schemaId, + definitions: { + subSchema: { + $id: subSchemaAnchor, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + refResolver.addSchema(schema) + + const resolvedSchema = refResolver.getSchema(schemaId, subSchemaAnchor) + assert.equal(resolvedSchema, schema.definitions.subSchema) +}) + +test('should fail to find a schema using an anchor instead of schema id', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const subSchemaAnchor = '#subSchemaId' + const schema = { + $id: schemaId, + definitions: { + subSchema: { + $id: subSchemaAnchor, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + refResolver.addSchema(schema) + + try { + refResolver.getSchema(subSchemaAnchor) + } catch (err) { + assert.equal( + err.message, 'Cannot resolve ref "#subSchemaId#". Schema with id "#subSchemaId" is not found.' + ) + } +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/collisions.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/collisions.test.js new file mode 100644 index 0000000000000000000000000000000000000000..db2e77ad8183cde1fa744dfcc3f6941d95e99de7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/collisions.test.js @@ -0,0 +1,199 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should not throw if there is a same schema with a same id', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + refResolver.addSchema(schema) + refResolver.addSchema(schema) + + const resolvedSchema = refResolver.getSchema(schemaId) + assert.deepStrictEqual(resolvedSchema, schema) +}) + +test('should throw if there is a same schema with a same id (allowEqualDuplicates === false)', () => { + const refResolver = new RefResolver({ + allowEqualDuplicates: false + }) + + const schemaId = 'schemaId' + const schema = { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + refResolver.addSchema(schema) + + try { + refResolver.addSchema(schema) + assert.fail('should throw') + } catch (err) { + assert.equal(err.message, `There is already another schema with id "${schemaId}".`) + } +}) + +test('should throw if there is another schema with a same id', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + + const schema1 = { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + const schema2 = { + $id: schemaId, + type: 'object', + properties: { + bar: { type: 'string' } + } + } + + refResolver.addSchema(schema1) + + try { + refResolver.addSchema(schema2) + assert.fail('should throw') + } catch (err) { + assert.equal(err.message, `There is already another schema with id "${schemaId}".`) + } + + const resolvedSchema = refResolver.getSchema(schemaId) + assert.deepStrictEqual(resolvedSchema, schema1) +}) + +test('should not throw if there is a same sub schema with a same id', () => { + const refResolver = new RefResolver() + + const subSchemaId = 'subSchemaId' + + const schema1 = { + $id: 'schemaId1', + definitions: { + subSchema: { + $id: subSchemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + + const schema2 = { + $id: 'schemaId2', + definitions: { + subSchema: { + $id: subSchemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + const resolvedSchema = refResolver.getSchema(subSchemaId) + assert.deepStrictEqual(resolvedSchema, schema1.definitions.subSchema) + assert.deepStrictEqual(resolvedSchema, schema2.definitions.subSchema) +}) + +test('should throw if there is another different sub schema with a same id', () => { + const refResolver = new RefResolver() + + const subSchemaId = 'subSchemaId' + + const schema1 = { + $id: 'schemaId1', + definitions: { + subSchema: { + $id: subSchemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + + const schema2 = { + $id: 'schemaId2', + definitions: { + subSchema: { + $id: subSchemaId, + type: 'object', + properties: { + bar: { type: 'string' } + } + } + } + } + + refResolver.addSchema(schema1) + + try { + refResolver.addSchema(schema2) + assert.fail('should throw') + } catch (err) { + assert.equal(err.message, `There is already another schema with id "${subSchemaId}".`) + } + + const resolvedSchema = refResolver.getSchema(subSchemaId) + assert.deepStrictEqual(resolvedSchema, schema1.definitions.subSchema) + assert.notDeepStrictEqual(resolvedSchema, schema2.definitions.subSchema) +}) + +test('should throw if there is the same anchor in the same schema', () => { + const refResolver = new RefResolver() + + const subSchemaAnchor = '#subSchemaId' + + const schema = { + $id: 'schemaId1', + definitions: { + subSchema1: { + $id: subSchemaAnchor, + type: 'object', + properties: { + foo: { type: 'string' } + } + }, + subSchema2: { + $id: subSchemaAnchor, + type: 'object', + properties: { + bar: { type: 'string' } + } + } + } + } + + try { + refResolver.addSchema(schema) + assert.fail('should throw') + } catch (err) { + assert.equal(err.message, 'There is already another anchor "#subSchemaId" in schema "schemaId1".') + } +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/deref-schema.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/deref-schema.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2c0e26e3a0af05764089dcad5520019ceceb3428 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/deref-schema.test.js @@ -0,0 +1,287 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should throw id schema not found', () => { + const refResolver = new RefResolver() + + try { + refResolver.derefSchema('schemaId1') + } catch (err) { + assert.strictEqual(err.message, 'Schema with id "schemaId1" is not found.') + } +}) + +test('should throw id source schema has a key with a same key as ref schema, but diff value', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schemaId2 = 'schemaId2' + + const schema1 = { + $id: schemaId1, + $ref: schemaId2, + properties: { + foo: { type: 'string' } + } + } + + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + foo: { type: 'number' } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + try { + refResolver.derefSchema('schemaId1') + assert.fail('should throw error') + } catch (err) { + assert.strictEqual( + err.message, + 'Cannot resolve ref "schemaId2". Property "properties" already exists in schema "schemaId1".' + ) + } +}) + +test('should not throw id source schema has a key with a same key and value as ref schema', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schemaId2 = 'schemaId2' + + const schema1 = { + $id: schemaId1, + $ref: schemaId2, + properties: { + foo: { type: 'string' } + } + } + + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + refResolver.derefSchema(schemaId1) + + const derefSchema = refResolver.getDerefSchema(schemaId1) + assert.deepStrictEqual(derefSchema, { + $id: schemaId1, + type: 'object', + properties: { + foo: { type: 'string' } + } + }) +}) + +test('should get deref schema from the cache', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schemaId2 = 'schemaId2' + + const schema1 = { + $id: schemaId1, + $ref: schemaId2, + properties: { + foo: { type: 'string' } + } + } + + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + refResolver.derefSchema(schemaId1) + schema1.properties = {} + refResolver.derefSchema(schemaId1) + + const derefSchema = refResolver.getDerefSchema(schemaId1) + assert.deepStrictEqual(derefSchema, { + $id: schemaId1, + type: 'object', + properties: { + foo: { type: 'string' } + } + }) +}) + +test('should insert ref symbol', () => { + const refResolver = new RefResolver({ + insertRefSymbol: true + }) + + const schemaId1 = 'schemaId1' + const schemaId2 = 'schemaId2' + + const schema1 = { + $id: schemaId1, + $ref: schemaId2 + } + + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + refResolver.derefSchema(schemaId1) + + const derefSchema = refResolver.getDerefSchema(schemaId1) + assert.deepStrictEqual(derefSchema, { + $id: schemaId1, + type: 'object', + properties: { + foo: { type: 'string' } + }, + [Symbol.for('json-schema-ref')]: schemaId2 + }) +}) + +test('should clone schema without refs', () => { + const refResolver = new RefResolver({ + cloneSchemaWithoutRefs: true + }) + + const schemaId = 'schemaId2' + + const schema = { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + refResolver.addSchema(schema) + refResolver.derefSchema(schemaId) + + schema.properties = null + + const derefSchema = refResolver.getDerefSchema(schemaId) + assert.deepStrictEqual(derefSchema, { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + }) +}) + +test('should throw if target ref schema is not found', () => { + const inputSchema = { + $id: 'http://example.com/root.json', + definitions: { + A: { $id: '#foo' }, + B: { + $id: 'other.json', + definitions: { + X: { $id: '#bar', type: 'string' }, + Y: { $id: 't/inner.json' } + } + }, + C: { + $id: 'urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f', + type: 'object' + } + } + } + + const addresSchema = { + $id: 'relativeAddress', // Note: prefer always absolute URI like: http://mysite.com + type: 'object', + properties: { + zip: { $ref: 'urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f' }, + city2: { $ref: '#foo' } + } + } + + const refResolver = new RefResolver() + refResolver.addSchema(inputSchema) + refResolver.addSchema(addresSchema) + + try { + refResolver.derefSchema('relativeAddress') + } catch (error) { + assert.strictEqual( + error.message, + 'Cannot resolve ref "#foo". Ref "#foo" is not found in schema "relativeAddress".' + ) + } +}) + +test('should deref schema without root $id', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId1' + const schema = { + type: 'object', + definitions: { + id1: { + type: 'object', + properties: { + id1: { + type: 'integer' + } + } + } + }, + allOf: [ + { + $ref: '#/definitions/id1' + } + ] + } + + refResolver.addSchema(schema, schemaId) + const derefSchema = refResolver.getDerefSchema(schemaId) + + assert.deepStrictEqual(derefSchema, { + type: 'object', + definitions: { + id1: { + type: 'object', + properties: { + id1: { + type: 'integer' + } + } + } + }, + allOf: [ + { + type: 'object', + properties: { + id1: { + type: 'integer' + } + } + } + ] + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-deref-schema.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-deref-schema.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d7253d6e8c925ebff4597b637fdd5133f7892773 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-deref-schema.test.js @@ -0,0 +1,363 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should resolve reference', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schema1 = { + $id: schemaId1, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + const schemaId2 = 'schemaId2' + const schema2 = { + $id: schemaId2, + $ref: schemaId1 + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + const derefSchema1 = refResolver.getDerefSchema(schemaId1) + assert.deepStrictEqual(derefSchema1, schema1) + + const derefSchema2 = refResolver.getDerefSchema(schemaId2) + assert.deepStrictEqual(derefSchema2, { + $id: schemaId2, + type: 'object', + properties: { + foo: { type: 'string' } + } + }) +}) + +test('should get deref schema by anchor', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schemaId2 = 'schemaId2' + + const schema1 = { + $id: schemaId1, + definitions: { + $id: '#subschema', + type: 'object', + properties: { + foo: { type: 'string' }, + bar: { $ref: schemaId2 } + } + } + } + + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + baz: { type: 'string' } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + const derefSubSchema = refResolver.getDerefSchema(schemaId1, '#subschema') + assert.deepStrictEqual(derefSubSchema, { + $id: '#subschema', + type: 'object', + properties: { + foo: { type: 'string' }, + bar: { + type: 'object', + properties: { + baz: { type: 'string' } + } + } + } + }) +}) + +test('should merge main and ref schemas', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schema1 = { + $id: schemaId1, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + const schemaId2 = 'schemaId2' + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + foo: { $ref: schemaId1 + '#/properties/foo' }, + bar: { type: 'string' } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + const derefSchema1 = refResolver.getDerefSchema(schemaId1) + assert.deepStrictEqual(derefSchema1, schema1) + + const derefSchema2 = refResolver.getDerefSchema(schemaId2) + assert.deepStrictEqual(derefSchema2, { + $id: schemaId2, + type: 'object', + properties: { + foo: { type: 'string' }, + bar: { type: 'string' } + } + }) +}) + +test('should merge multiple nested schemas', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schema1 = { + $id: schemaId1, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + const schemaId2 = 'schemaId2' + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + foo: { $ref: schemaId1 + '#/properties/foo' }, + bar: { type: 'string' } + } + } + + const schemaId3 = 'schemaId3' + const schema3 = { + $id: schemaId3, + type: 'object', + properties: { + foo: { $ref: schemaId2 + '#/properties/foo' }, + bar: { $ref: schemaId2 + '#/properties/bar' }, + baz: { type: 'string' } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + refResolver.addSchema(schema3) + + const derefSchema3 = refResolver.getDerefSchema(schemaId3) + assert.deepStrictEqual(derefSchema3, { + $id: schemaId3, + type: 'object', + properties: { + foo: { type: 'string' }, + bar: { type: 'string' }, + baz: { type: 'string' } + } + }) +}) + +test('should resolve schema with circular reference', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: schemaId, + type: 'object', + properties: { + foo: { $ref: '#' } + } + } + + refResolver.addSchema(schema) + + const derefSchema = refResolver.getDerefSchema(schemaId) + const expectedSchema = { + $id: schemaId, + type: 'object', + properties: { + foo: { + type: 'object', + properties: {} + } + } + } + expectedSchema.properties.foo.properties.foo = expectedSchema.properties.foo + assert.deepStrictEqual(derefSchema, expectedSchema) +}) + +test('should resolve schema with cross circular reference', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schemaId2 = 'schemaId2' + + const schema1 = { + $id: schemaId1, + type: 'object', + properties: { + foo: { $ref: schemaId2 } + } + } + + const schema2 = { + $id: schemaId2, + type: 'object', + properties: { + bar: { $ref: schemaId1 } + } + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + const derefSchema1 = refResolver.getDerefSchema(schemaId1) + const derefSchema2 = refResolver.getDerefSchema(schemaId2) + + const expectedSchema1 = { + $id: schemaId1, + type: 'object', + properties: { + foo: { + type: 'object', + properties: { + bar: { + type: 'object', + properties: {} + } + } + } + } + } + expectedSchema1.properties.foo.properties.bar.properties.foo = expectedSchema1.properties.foo + + const expectedSchema2 = { + $id: schemaId2, + type: 'object', + properties: { + bar: { + type: 'object', + properties: { + foo: { + type: 'object', + properties: {} + } + } + } + } + } + expectedSchema2.properties.bar.properties.foo.properties.bar = expectedSchema2.properties.bar + + assert.deepStrictEqual(derefSchema1, expectedSchema1) + assert.deepStrictEqual(derefSchema2, expectedSchema2) +}) + +test('should resolve nested multiple times refs', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schema1 = { + $id: schemaId1, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + const schemaId2 = 'schemaId2' + const schema2 = { + $id: schemaId2, + $ref: schemaId1, + required: ['foo'] + } + + const schemaId3 = 'schemaId3' + const schema3 = { + $id: schemaId3, + $ref: schemaId2, + additionalProperties: false + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + refResolver.addSchema(schema3) + + // Don't switch the order of these two lines. + const derefSchema3 = refResolver.getDerefSchema(schemaId3) + const derefSchema2 = refResolver.getDerefSchema(schemaId2) + + assert.deepStrictEqual(derefSchema2, { + $id: schemaId2, + type: 'object', + properties: { + foo: { type: 'string' } + }, + required: ['foo'] + }) + assert.deepStrictEqual(derefSchema3, { + $id: schemaId3, + type: 'object', + properties: { + foo: { type: 'string' } + }, + required: ['foo'], + additionalProperties: false + }) +}) + +test('should resolve infinite ref chain', () => { + const refResolver = new RefResolver() + + const schemaId1 = 'schemaId1' + const schemaId2 = 'schemaId2' + const schemaId3 = 'schemaId3' + + const schema1 = { + $id: schemaId1, + $ref: schemaId2 + } + + const schema2 = { + $id: schemaId2, + $ref: schemaId3 + } + + const schema3 = { + $id: schemaId3, + $ref: schemaId1 + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + refResolver.addSchema(schema3) + + const derefSchema1 = refResolver.getDerefSchema(schemaId1) + const derefSchema2 = refResolver.getDerefSchema(schemaId2) + const derefSchema3 = refResolver.getDerefSchema(schemaId3) + + assert.deepStrictEqual(derefSchema1, { + $id: schemaId1 + }) + + assert.deepStrictEqual(derefSchema2, { + $id: schemaId2 + }) + + assert.deepStrictEqual(derefSchema3, { + $id: schemaId3 + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema-dependencies.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema-dependencies.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e0a4c0f9328c6c790bfeb6d39082244f0032129d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema-dependencies.test.js @@ -0,0 +1,158 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should return all nested schema dependencies', () => { + const refResolver = new RefResolver() + + const schema1Id = 'schemaId1' + const schema1 = { + $id: schema1Id, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + const schema2Id = 'schemaId2' + const schema2 = { + $id: schema2Id, + $ref: schema1Id + } + + const schema3Id = 'schemaId3' + const schema3 = { + $id: schema3Id, + $ref: schema2Id + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + refResolver.addSchema(schema3) + + const schema1Deps = refResolver.getSchemaDependencies(schema1Id) + assert.deepStrictEqual(schema1Deps, {}) + + const schema2Deps = refResolver.getSchemaDependencies(schema2Id) + assert.deepStrictEqual(schema2Deps, { [schema1Id]: schema1 }) + + const schema3Deps = refResolver.getSchemaDependencies(schema3Id) + assert.deepStrictEqual(schema3Deps, { + [schema1Id]: schema1, + [schema2Id]: schema2 + }) +}) + +test('should resolve a dependency to a subschema', () => { + const refResolver = new RefResolver() + + const schema1Id = 'schemaId1' + const subSchema1Id = 'subSchemaId1' + const schema1 = { + $id: schema1Id, + definitions: { + subSchema: { + $id: subSchema1Id, + type: 'object', + properties: { + bar: { type: 'string' } + } + } + } + } + + const schema2Id = 'schemaId2' + const schema2 = { + $id: schema2Id, + $ref: subSchema1Id + '#/definitions/subSchema' + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + const schema1Deps = refResolver.getSchemaDependencies(schema1Id) + assert.deepStrictEqual(schema1Deps, {}) + + const schema2Deps = refResolver.getSchemaDependencies(schema2Id) + assert.deepStrictEqual(schema2Deps, { [subSchema1Id]: schema1.definitions.subSchema }) +}) + +test('should resolve a dependency with a json path', () => { + const refResolver = new RefResolver() + + const schema1Id = 'schemaId1' + const subSchema1Id = 'subSchemaId1' + const schema1 = { + $id: schema1Id, + definitions: { + subSchema: { + $id: subSchema1Id, + type: 'object', + properties: { + bar: { type: 'string' } + } + } + } + } + + const schema2Id = 'schemaId2' + const schema2 = { + $id: schema2Id, + $ref: schema1Id + '#/definitions/subSchema' + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + + const schema1Deps = refResolver.getSchemaDependencies(schema1Id) + assert.deepStrictEqual(schema1Deps, {}) + + const schema2Deps = refResolver.getSchemaDependencies(schema2Id) + assert.deepStrictEqual(schema2Deps, { [schema1Id]: schema1 }) +}) + +test('should include dependency schema only once', () => { + const refResolver = new RefResolver() + + const schema1Id = 'schemaId1' + const schema1 = { + $id: schema1Id, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + const schema2Id = 'schemaId2' + const schema2 = { + $id: schema2Id, + $ref: schema1Id + } + + const schema3Id = 'schemaId3' + const schema3 = { + $id: schema3Id, + allOf: [ + { $ref: schema1Id }, + { $ref: schema2Id } + ] + } + + refResolver.addSchema(schema1) + refResolver.addSchema(schema2) + refResolver.addSchema(schema3) + + const schema1Deps = refResolver.getSchemaDependencies(schema1Id) + assert.deepStrictEqual(schema1Deps, {}) + + const schema2Deps = refResolver.getSchemaDependencies(schema2Id) + assert.deepStrictEqual(schema2Deps, { [schema1Id]: schema1 }) + + const schema3Deps = refResolver.getSchemaDependencies(schema3Id) + assert.deepStrictEqual(schema3Deps, { + [schema1Id]: schema1, + [schema2Id]: schema2 + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema-refs.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema-refs.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1873a4a5daec5ac525bef459027f250027529a2f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema-refs.test.js @@ -0,0 +1,87 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should return schema refs', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: 'schemaId', + type: 'object', + properties: { + foo: { $ref: 'schemaId2#/definitions/foo' }, + bar: { $ref: 'schemaId3#/definitions/bar' }, + baz: { + type: 'object', + properties: { + qux: { $ref: 'schemaId4#/definitions/qux' } + } + } + } + } + + refResolver.addSchema(schema) + + const schemaRefs = refResolver.getSchemaRefs(schemaId) + assert.deepStrictEqual(schemaRefs, [ + { schemaId: 'schemaId2', jsonPointer: '#/definitions/foo' }, + { schemaId: 'schemaId3', jsonPointer: '#/definitions/bar' }, + { schemaId: 'schemaId4', jsonPointer: '#/definitions/qux' } + ]) +}) + +test('should return nested schema refs', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const subSchemaId = 'subSchemaId' + + const schema = { + $id: 'schemaId', + $ref: 'schemaId2#/definitions/subschema', + definitions: { + subschema: { + $id: subSchemaId, + type: 'object', + properties: { + foo: { $ref: 'schemaId2#/definitions/foo' }, + bar: { $ref: 'schemaId3#/definitions/bar' }, + baz: { + type: 'object', + properties: { + qux: { $ref: 'schemaId4#/definitions/qux' } + } + } + } + } + } + } + + refResolver.addSchema(schema) + + const schemaRefs = refResolver.getSchemaRefs(schemaId) + assert.deepStrictEqual(schemaRefs, [ + { schemaId: 'schemaId2', jsonPointer: '#/definitions/subschema' } + ]) + + const subSchemaRefs = refResolver.getSchemaRefs(subSchemaId) + assert.deepStrictEqual(subSchemaRefs, [ + { schemaId: 'schemaId2', jsonPointer: '#/definitions/foo' }, + { schemaId: 'schemaId3', jsonPointer: '#/definitions/bar' }, + { schemaId: 'schemaId4', jsonPointer: '#/definitions/qux' } + ]) +}) + +test('should throw is schema does not exist', () => { + const refResolver = new RefResolver() + + try { + refResolver.getSchemaRefs('schemaId') + assert.fail('should throw error') + } catch (error) { + assert.equal(error.message, 'Schema with id "schemaId" is not found.') + } +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a7849e902d341e83ced11745569a86fafef5fee8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/get-schema.test.js @@ -0,0 +1,222 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should get schema by schema id', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + refResolver.addSchema(schema) + + const resolvedSchema = refResolver.getSchema(schemaId) + assert.equal(resolvedSchema, schema) +}) + +test('should return null if schema was not found', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + refResolver.addSchema(schema) + + const resolvedSchema = refResolver.getSchema(schemaId, '#/definitions/missingSchema') + assert.equal(resolvedSchema, null) +}) + +test('should get a sub schema by sub schema id', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const subSchemaId = 'subSchemaId' + const schema = { + $id: schemaId, + definitions: { + subSchema: { + $id: subSchemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + refResolver.addSchema(schema) + + const resolvedSchema = refResolver.getSchema(subSchemaId) + assert.equal(resolvedSchema, schema.definitions.subSchema) +}) + +test('should get a sub schema by schema json pointer', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const subSchemaId = 'subSchemaId' + const schema = { + $id: schemaId, + definitions: { + subSchema: { + $id: subSchemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + refResolver.addSchema(schema) + + const jsonPointer = '#/definitions/subSchema' + const resolvedSchema = refResolver.getSchema(schemaId, jsonPointer) + assert.equal(resolvedSchema, schema.definitions.subSchema) +}) + +test('should get a sub schema by sub schema json pointer', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const subSchemaId = 'subSchemaId' + const schema = { + $id: schemaId, + definitions: { + subSchema: { + $id: subSchemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + } + } + refResolver.addSchema(schema) + + const jsonPointer = '#/properties/foo' + const resolvedSchema = refResolver.getSchema(subSchemaId, jsonPointer) + assert.equal(resolvedSchema, schema.definitions.subSchema.properties.foo) +}) + +test('should handle null schema correctly', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: schemaId, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + refResolver.addSchema(schema) + + const resolvedSchema = refResolver.getSchema(schemaId) + assert.equal(resolvedSchema, schema) +}) + +test('should add a schema without root $id', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + type: 'object', + properties: { + foo: { type: 'string' } + } + } + refResolver.addSchema(schema, schemaId) + + const resolvedSchema = refResolver.getSchema(schemaId) + assert.equal(resolvedSchema, schema) +}) + +test('root $id has higher priority than a schemaId argument', () => { + const refResolver = new RefResolver() + + const schemaIdProperty = 'schemaId1' + const schemaIdArgument = 'schemaId2' + + const schema = { + $id: schemaIdProperty, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + refResolver.addSchema(schema, schemaIdArgument) + + const resolvedSchema = refResolver.getSchema(schemaIdProperty) + assert.equal(resolvedSchema, schema) + + try { + refResolver.getSchema(schemaIdArgument) + assert.fail('should have thrown an error') + } catch (err) { + assert.equal( + err.message, + `Cannot resolve ref "${schemaIdArgument}#". Schema with id "${schemaIdArgument}" is not found.` + ) + } +}) + +test('should not use a root $id if it is an anchor', () => { + const refResolver = new RefResolver() + + const schemaIdProperty = '#schemaId1' + const schemaIdArgument = 'schemaId2' + + const schema = { + $id: schemaIdProperty, + type: 'object', + properties: { + foo: { type: 'string' } + } + } + refResolver.addSchema(schema, schemaIdArgument) + + try { + refResolver.getSchema(schemaIdProperty) + assert.fail('should have thrown an error') + } catch (err) { + assert.equal( + err.message, + `Cannot resolve ref "${schemaIdProperty}#". Schema with id "${schemaIdProperty}" is not found.` + ) + } + + const resolvedSchema2 = refResolver.getSchema(schemaIdArgument) + assert.equal(resolvedSchema2, schema) + + const resolvedSchema3 = refResolver.getSchema(schemaIdArgument, schemaIdProperty) + assert.equal(resolvedSchema3, schema) +}) + +test('should return null if sub schema by json pointer is not found', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: 'schemaId', + type: 'object', + properties: { + foo: { type: 'string' } + } + } + + refResolver.addSchema(schema) + + const schemaRefs = refResolver.getSchema(schemaId, '#/missingSchema') + assert.equal(schemaRefs, null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/has-schema.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/has-schema.test.js new file mode 100644 index 0000000000000000000000000000000000000000..490df2982a75529d590d53ae92cfa626a857a0af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/test/has-schema.test.js @@ -0,0 +1,28 @@ +'use strict' + +const assert = require('node:assert/strict') +const { test } = require('node:test') +const { RefResolver } = require('../index.js') + +test('should return true if schema exists', () => { + const refResolver = new RefResolver() + + const schemaId = 'schemaId' + const schema = { + $id: 'schemaId', + type: 'object', + properties: { + foo: { type: 'string' } + } + } + refResolver.addSchema(schema) + + const hasSchema = refResolver.hasSchema(schemaId) + assert.strictEqual(hasSchema, true) +}) + +test('should return false if schema does not exist', () => { + const refResolver = new RefResolver() + const hasSchema = refResolver.hasSchema('schemaId') + assert.strictEqual(hasSchema, false) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/types/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a802c397452ef1602e3aa4cba43126bfb2de05f7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/types/index.d.ts @@ -0,0 +1,67 @@ +/** + * RefResolver class is used to resolve JSON references. + * @class + * @constructor + */ +declare class RefResolver { + /** + * @param {object} opts - Options for the resolver. + * @param {boolean} opts.allowEqualDuplicates - Whether to allow schemas with equal ids to be added to the resolver. + */ + constructor (opts?: { allowEqualDuplicates?: boolean }) + + /** + * Adds the given schema to the resolver. + * @param {any} schema - The schema to be added. + * @param {string} schemaId - The default schema id of the schema to be added. + */ + addSchema (schema: any, schemaId?: string): void + + /** + * Returns the schema by the given schema id and jsonPointer. + * If jsonPointer is not provided, returns the root schema. + * @param {string} schemaId - The schema id of the schema to be returned. + * @param {string} jsonPointer - The jsonPointer of the schema to be returned. + * @returns {any | null} The schema by the given schema id and jsonPointer. + */ + getSchema (schemaId: string, jsonPointer?: string): any | null + + /** + * Returns true if the schema by the given schema id is added to the resolver. + * @param {string} schemaId - The schema id of the schema to be checked. + * @returns {boolean} True if the schema by the given schema id is added to the resolver. + */ + hasSchema (schemaId: string): boolean + + /** + * Returns the schema references of the schema by the given schema id. + * @param {string} schemaId - The schema id of the schema whose references are to be returned. + * @returns {Array<{ schemaId: string; jsonPointer: string }>} The schema references of the schema by the given schema id. + */ + getSchemaRefs (schemaId: string): { schemaId: string; jsonPointer: string }[] + + /** + * Returns all the schema dependencies of the schema by the given schema id. + * @param {string} schemaId - The schema id of the schema whose dependencies are to be returned. + * @returns {object} The schema dependencies of the schema by the given schema id. + */ + getSchemaDependencies (schemaId: string): { [key: string]: any } + + /** + * Dereferences the schema by the given schema id. + * @param {string} schemaId - The schema id of the schema to be dereferenced. + */ + derefSchema (schemaId: string): void + + /** + * Returns the dereferenced schema by the given schema id and jsonPointer. + * If jsonPointer is not provided, returns the dereferenced root schema. + * If the schema is not dereferenced yet, dereferences it first. + * @param {string} schemaId - The schema id of the schema to be returned. + * @param {string} jsonPointer - The jsonPointer of the schema to be returned. + * @returns {any | null} The dereferenced schema by the given schema id and jsonPointer. + */ + getDerefSchema (schemaId: string, jsonPointer?: string): any | null +} + +export { RefResolver } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/types/index.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/types/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9de4ed46c2c141fc4538c909d3cba0b44e5afc29 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-ref-resolver/types/index.test-d.ts @@ -0,0 +1,23 @@ +import { RefResolver } from '..' +import { expectType } from 'tsd' + +const resolver = new RefResolver({ + allowEqualDuplicates: true +}) + +expectType(resolver.addSchema({})) +expectType(resolver.addSchema({}, 'schemaId')) + +expectType(resolver.getSchema('schemaId')) +expectType(resolver.getSchema('schemaId', 'jsonPointer')) + +expectType(resolver.hasSchema('schemaId')) + +expectType<{ schemaId: string; jsonPointer: string }[]>(resolver.getSchemaRefs('schemaId')) + +expectType<{ [key: string]: any }>(resolver.getSchemaDependencies('schemaId')) + +expectType(resolver.derefSchema('schemaId')) + +expectType(resolver.getDerefSchema('schemaId')) +expectType(resolver.getDerefSchema('schemaId', 'jsonPointer')) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/FUNDING.yml b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..44f80f417e337a906a3b9add76031c86d2b711a1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: epoberezkin +tidelift: "npm/json-schema-traverse" diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/workflows/build.yml b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/workflows/build.yml new file mode 100644 index 0000000000000000000000000000000000000000..f8ef5ba80e38fcda634d962658df3168dbc07aee --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: build + +on: + push: + branches: [master] + pull_request: + branches: ["*"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/workflows/publish.yml b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/workflows/publish.yml new file mode 100644 index 0000000000000000000000000000000000000000..924825b12dccc025c5b642798312759aef3e3c0a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +name: publish + +on: + release: + types: [published] + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - run: npm install + - run: npm test + - name: Publish beta version to npm + if: "github.event.release.prerelease" + run: npm publish --tag beta + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish to npm + if: "!github.event.release.prerelease" + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/.eslintrc.yml b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/.eslintrc.yml new file mode 100644 index 0000000000000000000000000000000000000000..3344da7eb323ba9a85c74de6ff6f70738d8bd040 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/.eslintrc.yml @@ -0,0 +1,6 @@ +parserOptions: + ecmaVersion: 6 +globals: + beforeEach: false + describe: false + it: false diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/fixtures/schema.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/fixtures/schema.js new file mode 100644 index 0000000000000000000000000000000000000000..c51430cdc3d34f28f8010c3c7c472f3cfbf84bd0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/fixtures/schema.js @@ -0,0 +1,125 @@ +'use strict'; + +var schema = { + additionalItems: subschema('additionalItems'), + items: subschema('items'), + contains: subschema('contains'), + additionalProperties: subschema('additionalProperties'), + propertyNames: subschema('propertyNames'), + not: subschema('not'), + allOf: [ + subschema('allOf_0'), + subschema('allOf_1'), + { + items: [ + subschema('items_0'), + subschema('items_1'), + ] + } + ], + anyOf: [ + subschema('anyOf_0'), + subschema('anyOf_1'), + ], + oneOf: [ + subschema('oneOf_0'), + subschema('oneOf_1'), + ], + definitions: { + foo: subschema('definitions_foo'), + bar: subschema('definitions_bar'), + }, + properties: { + foo: subschema('properties_foo'), + bar: subschema('properties_bar'), + }, + patternProperties: { + foo: subschema('patternProperties_foo'), + bar: subschema('patternProperties_bar'), + }, + dependencies: { + foo: subschema('dependencies_foo'), + bar: subschema('dependencies_bar'), + }, + required: ['foo', 'bar'] +}; + + +function subschema(keyword) { + var sch = { + properties: {}, + additionalProperties: false, + additionalItems: false, + anyOf: [ + {format: 'email'}, + {format: 'hostname'} + ] + }; + sch.properties['foo_' + keyword] = {title: 'foo'}; + sch.properties['bar_' + keyword] = {title: 'bar'}; + return sch; +} + + +module.exports = { + schema: schema, + + // schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex + expectedCalls: [[schema, '', schema, undefined, undefined, undefined, undefined]] + .concat(expectedCalls('additionalItems')) + .concat(expectedCalls('items')) + .concat(expectedCalls('contains')) + .concat(expectedCalls('additionalProperties')) + .concat(expectedCalls('propertyNames')) + .concat(expectedCalls('not')) + .concat(expectedCallsChild('allOf', 0)) + .concat(expectedCallsChild('allOf', 1)) + .concat([ + [schema.allOf[2], '/allOf/2', schema, '', 'allOf', schema, 2], + [schema.allOf[2].items[0], '/allOf/2/items/0', schema, '/allOf/2', 'items', schema.allOf[2], 0], + [schema.allOf[2].items[0].properties.foo_items_0, '/allOf/2/items/0/properties/foo_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'foo_items_0'], + [schema.allOf[2].items[0].properties.bar_items_0, '/allOf/2/items/0/properties/bar_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'bar_items_0'], + [schema.allOf[2].items[0].anyOf[0], '/allOf/2/items/0/anyOf/0', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 0], + [schema.allOf[2].items[0].anyOf[1], '/allOf/2/items/0/anyOf/1', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 1], + + [schema.allOf[2].items[1], '/allOf/2/items/1', schema, '/allOf/2', 'items', schema.allOf[2], 1], + [schema.allOf[2].items[1].properties.foo_items_1, '/allOf/2/items/1/properties/foo_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'foo_items_1'], + [schema.allOf[2].items[1].properties.bar_items_1, '/allOf/2/items/1/properties/bar_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'bar_items_1'], + [schema.allOf[2].items[1].anyOf[0], '/allOf/2/items/1/anyOf/0', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 0], + [schema.allOf[2].items[1].anyOf[1], '/allOf/2/items/1/anyOf/1', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 1] + ]) + .concat(expectedCallsChild('anyOf', 0)) + .concat(expectedCallsChild('anyOf', 1)) + .concat(expectedCallsChild('oneOf', 0)) + .concat(expectedCallsChild('oneOf', 1)) + .concat(expectedCallsChild('definitions', 'foo')) + .concat(expectedCallsChild('definitions', 'bar')) + .concat(expectedCallsChild('properties', 'foo')) + .concat(expectedCallsChild('properties', 'bar')) + .concat(expectedCallsChild('patternProperties', 'foo')) + .concat(expectedCallsChild('patternProperties', 'bar')) + .concat(expectedCallsChild('dependencies', 'foo')) + .concat(expectedCallsChild('dependencies', 'bar')) +}; + + +function expectedCalls(keyword) { + return [ + [schema[keyword], `/${keyword}`, schema, '', keyword, schema, undefined], + [schema[keyword].properties[`foo_${keyword}`], `/${keyword}/properties/foo_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `foo_${keyword}`], + [schema[keyword].properties[`bar_${keyword}`], `/${keyword}/properties/bar_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `bar_${keyword}`], + [schema[keyword].anyOf[0], `/${keyword}/anyOf/0`, schema, `/${keyword}`, 'anyOf', schema[keyword], 0], + [schema[keyword].anyOf[1], `/${keyword}/anyOf/1`, schema, `/${keyword}`, 'anyOf', schema[keyword], 1] + ]; +} + + +function expectedCallsChild(keyword, i) { + return [ + [schema[keyword][i], `/${keyword}/${i}`, schema, '', keyword, schema, i], + [schema[keyword][i].properties[`foo_${keyword}_${i}`], `/${keyword}/${i}/properties/foo_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `foo_${keyword}_${i}`], + [schema[keyword][i].properties[`bar_${keyword}_${i}`], `/${keyword}/${i}/properties/bar_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `bar_${keyword}_${i}`], + [schema[keyword][i].anyOf[0], `/${keyword}/${i}/anyOf/0`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 0], + [schema[keyword][i].anyOf[1], `/${keyword}/${i}/anyOf/1`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 1] + ]; +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/index.spec.js b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/index.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..c76b64fc8496ca677ca2d9c0cb620a565530f3fa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/json-schema-traverse/spec/index.spec.js @@ -0,0 +1,171 @@ +'use strict'; + +var traverse = require('../index'); +var assert = require('assert'); + +describe('json-schema-traverse', function() { + var calls; + + beforeEach(function() { + calls = []; + }); + + it('should traverse all keywords containing schemas recursively', function() { + var schema = require('./fixtures/schema').schema; + var expectedCalls = require('./fixtures/schema').expectedCalls; + + traverse(schema, {cb: callback}); + assert.deepStrictEqual(calls, expectedCalls); + }); + + describe('Legacy v0.3.1 API', function() { + it('should traverse all keywords containing schemas recursively', function() { + var schema = require('./fixtures/schema').schema; + var expectedCalls = require('./fixtures/schema').expectedCalls; + + traverse(schema, callback); + assert.deepStrictEqual(calls, expectedCalls); + }); + + it('should work when an options object is provided', function() { + // schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex + var schema = require('./fixtures/schema').schema; + var expectedCalls = require('./fixtures/schema').expectedCalls; + + traverse(schema, {}, callback); + assert.deepStrictEqual(calls, expectedCalls); + }); + }); + + + describe('allKeys option', function() { + var schema = { + someObject: { + minimum: 1, + maximum: 2 + } + }; + + it('should traverse objects with allKeys: true option', function() { + // schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex + var expectedCalls = [ + [schema, '', schema, undefined, undefined, undefined, undefined], + [schema.someObject, '/someObject', schema, '', 'someObject', schema, undefined] + ]; + + traverse(schema, {allKeys: true, cb: callback}); + assert.deepStrictEqual(calls, expectedCalls); + }); + + + it('should NOT traverse objects with allKeys: false option', function() { + // schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex + var expectedCalls = [ + [schema, '', schema, undefined, undefined, undefined, undefined] + ]; + + traverse(schema, {allKeys: false, cb: callback}); + assert.deepStrictEqual(calls, expectedCalls); + }); + + + it('should NOT traverse objects without allKeys option', function() { + // schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex + var expectedCalls = [ + [schema, '', schema, undefined, undefined, undefined, undefined] + ]; + + traverse(schema, {cb: callback}); + assert.deepStrictEqual(calls, expectedCalls); + }); + + + it('should NOT travers objects in standard keywords which value is not a schema', function() { + var schema2 = { + const: {foo: 'bar'}, + enum: ['a', 'b'], + required: ['foo'], + another: { + + }, + patternProperties: {}, // will not traverse - no properties + dependencies: true, // will not traverse - invalid + properties: { + smaller: { + type: 'number' + }, + larger: { + type: 'number', + minimum: {$data: '1/smaller'} + } + } + }; + + // schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex + var expectedCalls = [ + [schema2, '', schema2, undefined, undefined, undefined, undefined], + [schema2.another, '/another', schema2, '', 'another', schema2, undefined], + [schema2.properties.smaller, '/properties/smaller', schema2, '', 'properties', schema2, 'smaller'], + [schema2.properties.larger, '/properties/larger', schema2, '', 'properties', schema2, 'larger'], + ]; + + traverse(schema2, {allKeys: true, cb: callback}); + assert.deepStrictEqual(calls, expectedCalls); + }); + }); + + describe('pre and post', function() { + var schema = { + type: 'object', + properties: { + name: {type: 'string'}, + age: {type: 'number'} + } + }; + + it('should traverse schema in pre-order', function() { + traverse(schema, {cb: {pre}}); + var expectedCalls = [ + ['pre', schema, '', schema, undefined, undefined, undefined, undefined], + ['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'], + ['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'], + ]; + assert.deepStrictEqual(calls, expectedCalls); + }); + + it('should traverse schema in post-order', function() { + traverse(schema, {cb: {post}}); + var expectedCalls = [ + ['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'], + ['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'], + ['post', schema, '', schema, undefined, undefined, undefined, undefined], + ]; + assert.deepStrictEqual(calls, expectedCalls); + }); + + it('should traverse schema in pre- and post-order at the same time', function() { + traverse(schema, {cb: {pre, post}}); + var expectedCalls = [ + ['pre', schema, '', schema, undefined, undefined, undefined, undefined], + ['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'], + ['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'], + ['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'], + ['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'], + ['post', schema, '', schema, undefined, undefined, undefined, undefined], + ]; + assert.deepStrictEqual(calls, expectedCalls); + }); + }); + + function callback() { + calls.push(Array.prototype.slice.call(arguments)); + } + + function pre() { + calls.push(['pre'].concat(Array.prototype.slice.call(arguments))); + } + + function post() { + calls.push(['post'].concat(Array.prototype.slice.call(arguments))); + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..031e61a8f90a3ff8c0b8bd656bd4c52c8be1a2ac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.d.ts @@ -0,0 +1,549 @@ +/// +/// +/// +/// +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is NodeJS.WriteStream | NodeJS.ReadStream | Minipass | (NodeJS.ReadStream & { + fd: number; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.WriteStream & { + fd: number; +}) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is NodeJS.WriteStream | NodeJS.ReadStream | Minipass | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.d.ts.map b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..cac7e00a773090d5258ac8958ef3fc3d5339a078 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CA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MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;IAkCjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO;IA0BpB;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF"} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..068c095b697932d3bebf12d60a852e3603d1494c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.js @@ -0,0 +1,1028 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Minipass = exports.isWritable = exports.isReadable = exports.isStream = void 0; +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +const node_events_1 = require("node:events"); +const node_stream_1 = __importDefault(require("node:stream")); +const node_string_decoder_1 = require("node:string_decoder"); +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof node_stream_1.default || + (0, exports.isReadable)(s) || + (0, exports.isWritable)(s)); +exports.isStream = isStream; +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== node_stream_1.default.Writable.prototype.pipe; +exports.isReadable = isReadable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +exports.isWritable = isWritable; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = er => dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +class Minipass extends node_events_1.EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new node_string_decoder_1.StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return exports.isStream; + } +} +exports.Minipass = Minipass; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.js.map b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9f3ef4b786cb4046eb8a929a3652bdc572d674d1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,6CAA0C;AAC1C,8DAAgC;AAChC,6DAAmD;AASnD;;;GAGG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,qBAAM;QACnB,IAAA,kBAAU,EAAC,CAAC,CAAC;QACb,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,CAAA;AARL,QAAA,QAAQ,YAQH;AAElB;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,qBAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAA;AANrD,QAAA,UAAU,cAM2C;AAElE;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CA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AAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;QACjB,OAAO,gBAAQ,CAAA;IACjB,CAAC;CACF;AAn/BD,4BAm/BC","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = er => dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/esm/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b5fa4513c90838699f7138207183d99ef000f926 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/esm/index.js @@ -0,0 +1,1018 @@ +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +import { EventEmitter } from 'node:events'; +import Stream from 'node:stream'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof Stream || + isReadable(s) || + isWritable(s)); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== Stream.Writable.prototype.pipe; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = er => dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export class Minipass extends EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return isStream; + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/esm/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/.claude/settings.local.json b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.claude/settings.local.json new file mode 100644 index 0000000000000000000000000000000000000000..1dfaf6e43dcf758a5ce63f3c00650963059aebba --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.claude/settings.local.json @@ -0,0 +1,9 @@ +{ + "permissions": { + "allow": [ + "Bash(npx tsc:*)", + "Bash(npm run test-types:*)" + ], + "deny": [] + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..35d66ca7ac75f125b9c9c5b3dee0987fdfca4a45 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/bench.yml b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/bench.yml new file mode 100644 index 0000000000000000000000000000000000000000..bc83ff55493931293edb85c51b2ca934516970dd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/bench.yml @@ -0,0 +1,61 @@ +name: Benchmarks +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +permissions: + contents: read + +jobs: + benchmark_current: + name: benchmark current + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ github.base_ref }} + persist-credentials: false + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install Modules + run: npm i --ignore-scripts + - name: Run Benchmark + run: npm run bench | tee current.txt + - name: Upload Current Results + uses: actions/upload-artifact@v4 + with: + name: current + path: current.txt + + benchmark_branch: + name: benchmark branch + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install Modules + run: npm i --ignore-scripts + - name: Run Benchmark + run: npm run bench | tee branch.txt + - name: Upload Branch Results + uses: actions/upload-artifact@v4 + with: + name: branch + path: branch.txt diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..31659191fb0fc79e3b52a5e4e69166f4f9bf3698 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +name: CI + +on: + push: + branches: + - main + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + dependency-review: + name: Dependency Review + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Dependency review + uses: actions/dependency-review-action@v4 + + test: + name: ${{ matrix.node-version }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: + fail-fast: false + matrix: + os: [macOS-latest, windows-latest, ubuntu-latest] + node-version: [18, 20, 22] + exclude: + - os: windows-latest + node-version: 22 + + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: Run tests + run: npm run test-ci + + - name: Run smoke test + if: > + matrix.os != 'windows-latest' && + matrix.node-version > 14 + run: npm run test:smoke + + automerge: + name: Automerge Dependabot PRs + if: > + github.event_name == 'pull_request' && + github.event.pull_request.user.login == 'dependabot[bot]' + needs: test + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest + steps: + - uses: fastify/github-action-merge-dependabot@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + exclude: 'sonic-boom,pino-std-serializers,quick-format-unescaped,fast-redact' diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/lock-threads.yml b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/lock-threads.yml new file mode 100644 index 0000000000000000000000000000000000000000..78d510fd507c028c3d9999c2eea5ea193b8a10e6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/lock-threads.yml @@ -0,0 +1,30 @@ +name: 'Lock Threads' + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +concurrency: + group: lock + +jobs: + action: + runs-on: ubuntu-latest + steps: + - uses: jsumners/lock-threads@b27edac0ac998d42b2815e122b6c24b32b568321 + with: + log-output: true + issue-inactive-days: '30' + issue-comment: > + This issue has been automatically locked since there + has not been any recent activity after it was closed. + Please open a new issue for related bugs. + pr-comment: > + This pull request has been automatically locked since there + has not been any recent activity after it was closed. + Please open a new issue for related bugs. diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/target-main.yml b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/target-main.yml new file mode 100644 index 0000000000000000000000000000000000000000..4bbe543da89a51d42cfd624729b998c44e8457fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/.github/workflows/target-main.yml @@ -0,0 +1,23 @@ +name: PR Target Check + +on: + pull_request_target: + types: [opened] + +permissions: + pull-requests: write + +jobs: + comment: + if: ${{ github.base_ref != "master" }} + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '⚠️ This pull request does not target the master branch.' + }) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/basic.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/basic.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..a1e27d4d336155cec5200f6417279339846f86ae --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/basic.bench.js @@ -0,0 +1,95 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const bole = require('bole')('bench') +const winston = require('winston') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const loglevel = require('./utils/wrap-log-level')(dest) +const plogNodeStream = pino(dest) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', minLength: 4096 })) +delete require.cache[require.resolve('../')] +const plogDest = require('../')(pino.destination('/dev/null')) + +process.env.DEBUG = 'dlog' +const debug = require('debug') +const dlog = debug('dlog') +dlog.log = function (s) { dest.write(s) } + +const max = 10 +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}) + +require('bole').output({ + level: 'info', + stream: dest +}).setFastTime(true) + +const chill = winston.createLogger({ + transports: [ + new winston.transports.Stream({ + stream: fs.createWriteStream('/dev/null') + }) + ] +}) + +const run = bench([ + function benchBunyan (cb) { + for (var i = 0; i < max; i++) { + blog.info('hello world') + } + setImmediate(cb) + }, + function benchWinston (cb) { + for (var i = 0; i < max; i++) { + chill.log('info', 'hello world') + } + setImmediate(cb) + }, + function benchBole (cb) { + for (var i = 0; i < max; i++) { + bole.info('hello world') + } + setImmediate(cb) + }, + function benchDebug (cb) { + for (var i = 0; i < max; i++) { + dlog('hello world') + } + setImmediate(cb) + }, + function benchLogLevel (cb) { + for (var i = 0; i < max; i++) { + loglevel.info('hello world') + } + setImmediate(cb) + }, + function benchPino (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello world') + } + setImmediate(cb) + }, + function benchPinoMinLength (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info('hello world') + } + setImmediate(cb) + }, + function benchPinoNodeStream (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info('hello world') + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child-child.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child-child.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..05da99720b8d8059e129eda25dbc1d69d27c5c62 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child-child.bench.js @@ -0,0 +1,52 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plogNodeStream = pino(dest).child({ a: 'property' }).child({ sub: 'child' }) +delete require.cache[require.resolve('../')] +const plogDest = require('../')(pino.destination('/dev/null')).child({ a: 'property' }).child({ sub: 'child' }) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 })) + .child({ a: 'property' }) + .child({ sub: 'child' }) + +const max = 10 +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}).child({ a: 'property' }).child({ sub: 'child' }) + +const run = bench([ + function benchBunyanChildChild (cb) { + for (var i = 0; i < max; i++) { + blog.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildChild (cb) { + for (var i = 0; i < max; i++) { + plogDest.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoMinLengthChildChild (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoNodeStreamChildChild (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info({ hello: 'world' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child-creation.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child-creation.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..fe6825edfe66b26dc06b30e71f8a6cb5cd650b16 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child-creation.bench.js @@ -0,0 +1,73 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const bole = require('bole')('bench') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plogNodeStream = pino(dest) +const plogDest = pino(pino.destination(('/dev/null'))) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 })) + +const max = 10 +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}) + +require('bole').output({ + level: 'info', + stream: dest +}).setFastTime(true) + +const run = bench([ + function benchBunyanCreation (cb) { + const child = blog.child({ a: 'property' }) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchBoleCreation (cb) { + const child = bole('child') + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoCreation (cb) { + const child = plogDest.child({ a: 'property' }) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoMinLengthCreation (cb) { + const child = plogMinLength.child({ a: 'property' }) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoNodeStreamCreation (cb) { + const child = plogNodeStream.child({ a: 'property' }) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoCreationWithOption (cb) { + const child = plogDest.child({ a: 'property' }, { redact: [] }) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..efe2d66ee3e8d5bdca8e6906cd243f66232889fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/child.bench.js @@ -0,0 +1,62 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const bole = require('bole')('bench')('child') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plogNodeStream = pino(dest).child({ a: 'property' }) +delete require.cache[require.resolve('../')] +const plogDest = require('../')(pino.destination('/dev/null')).child({ a: 'property' }) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 })) + +const max = 10 +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}).child({ a: 'property' }) + +require('bole').output({ + level: 'info', + stream: dest +}).setFastTime(true) + +const run = bench([ + function benchBunyanChild (cb) { + for (var i = 0; i < max; i++) { + blog.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchBoleChild (cb) { + for (var i = 0; i < max; i++) { + bole.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChild (cb) { + for (var i = 0; i < max; i++) { + plogDest.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoMinLengthChild (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoNodeStreamChild (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info({ hello: 'world' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/deep-object.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/deep-object.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..44f6c34ff0cae2afbb745523a845d78029efe6f3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/deep-object.bench.js @@ -0,0 +1,88 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const bole = require('bole')('bench') +const winston = require('winston') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plogNodeStream = pino(dest) +delete require.cache[require.resolve('../')] +const plogDest = require('../')(pino.destination('/dev/null')) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 })) +delete require.cache[require.resolve('../')] + +const loglevel = require('./utils/wrap-log-level')(dest) + +const deep = Object.assign({}, require('../package.json'), { level: 'info' }) + +const max = 10 +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}) + +require('bole').output({ + level: 'info', + stream: dest +}).setFastTime(true) + +const chill = winston.createLogger({ + transports: [ + new winston.transports.Stream({ + stream: fs.createWriteStream('/dev/null') + }) + ] +}) + +const run = bench([ + function benchBunyanDeepObj (cb) { + for (var i = 0; i < max; i++) { + blog.info(deep) + } + setImmediate(cb) + }, + function benchWinstonDeepObj (cb) { + for (var i = 0; i < max; i++) { + chill.log(deep) + } + setImmediate(cb) + }, + function benchBoleDeepObj (cb) { + for (var i = 0; i < max; i++) { + bole.info(deep) + } + setImmediate(cb) + }, + function benchLogLevelDeepObj (cb) { + for (var i = 0; i < max; i++) { + loglevel.info(deep) + } + setImmediate(cb) + }, + function benchPinoDeepObj (cb) { + for (var i = 0; i < max; i++) { + plogDest.info(deep) + } + setImmediate(cb) + }, + function benchPinoMinLengthDeepObj (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info(deep) + } + setImmediate(cb) + }, + function benchPinoNodeStreamDeepObj (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info(deep) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/formatters.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/formatters.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..e6cc861896b43614656efcd3fd02be13d54b23e6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/formatters.bench.js @@ -0,0 +1,50 @@ +'use strict' + +const formatters = { + level (label, number) { + return { + log: { + level: label + } + } + }, + bindings (bindings) { + return { + process: { + pid: bindings.pid + }, + host: { + name: bindings.hostname + } + } + }, + log (obj) { + return { foo: 'bar', ...obj } + } +} + +const bench = require('fastbench') +const pino = require('../') +delete require.cache[require.resolve('../')] +const pinoNoFormatters = require('../')(pino.destination('/dev/null')) +delete require.cache[require.resolve('../')] +const pinoFormatters = require('../')({ formatters }, pino.destination('/dev/null')) + +const max = 10 + +const run = bench([ + function benchPinoNoFormatters (cb) { + for (var i = 0; i < max; i++) { + pinoNoFormatters.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoFormatters (cb) { + for (var i = 0; i < max; i++) { + pinoFormatters.info({ hello: 'world' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/custom-levels.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/custom-levels.js new file mode 100644 index 0000000000000000000000000000000000000000..afb1cf1aea1d7e35912c75075b97afcde8a27d2f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/custom-levels.js @@ -0,0 +1,67 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../../') + +const base = pino(pino.destination('/dev/null')) +const baseCl = pino({ + customLevels: { foo: 31 } +}, pino.destination('/dev/null')) +const child = base.child({}) +const childCl = base.child({ + customLevels: { foo: 31 } +}) +const childOfBaseCl = baseCl.child({}) + +const max = 100 + +const run = bench([ + function benchPinoNoCustomLevel (cb) { + for (var i = 0; i < max; i++) { + base.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoCustomLevel (cb) { + for (var i = 0; i < max; i++) { + baseCl.foo({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchChildNoCustomLevel (cb) { + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildCustomLevel (cb) { + for (var i = 0; i < max; i++) { + childCl.foo({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildInheritedCustomLevel (cb) { + for (var i = 0; i < max; i++) { + childOfBaseCl.foo({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildCreation (cb) { + const child = base.child({}) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildCreationCustomLevel (cb) { + const child = base.child({ + customLevels: { foo: 31 } + }) + for (var i = 0; i < max; i++) { + child.foo({ hello: 'world' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..55efc85c79f74354b79e93b06d9b95418ca99324 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js @@ -0,0 +1,76 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../../') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plog = pino(dest) +delete require.cache[require.resolve('../../')] +const plogDest = require('../../')(pino.destination('/dev/null')) +delete require.cache[require.resolve('../../')] +const plogAsync = require('../../')(pino.destination({ dest: '/dev/null', sync: false })) +const deep = require('../../package.json') +deep.deep = JSON.parse(JSON.stringify(deep)) +deep.deep.deep = JSON.parse(JSON.stringify(deep)) +const longStr = JSON.stringify(deep) + +const max = 10 + +const run = bench([ + function benchPinoLongString (cb) { + for (var i = 0; i < max; i++) { + plog.info(longStr) + } + setImmediate(cb) + }, + function benchPinoDestLongString (cb) { + for (var i = 0; i < max; i++) { + plogDest.info(longStr) + } + setImmediate(cb) + }, + function benchPinoAsyncLongString (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info(longStr) + } + setImmediate(cb) + }, + function benchPinoDeepObj (cb) { + for (var i = 0; i < max; i++) { + plog.info(deep) + } + setImmediate(cb) + }, + function benchPinoDestDeepObj (cb) { + for (var i = 0; i < max; i++) { + plogDest.info(deep) + } + setImmediate(cb) + }, + function benchPinoAsyncDeepObj (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info(deep) + } + setImmediate(cb) + }, + function benchPinoInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + plog.info('hello %j', deep) + } + setImmediate(cb) + }, + function benchPinoDestInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %j', deep) + } + setImmediate(cb) + }, + function benchPinoAsyncInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info('hello %j', deep) + } + setImmediate(cb) + } +], 1000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/just-pino.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/just-pino.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..04bbe23ad89e1bf80e3ed6fc8a872c262cf42f64 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/just-pino.bench.js @@ -0,0 +1,182 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../../') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plog = pino(dest) +delete require.cache[require.resolve('../../')] +const plogDest = require('../../')(pino.destination('/dev/null')) +delete require.cache[require.resolve('../../')] +const plogAsync = require('../../')(pino.destination({ dest: '/dev/null', sync: false })) +const plogChild = plog.child({ a: 'property' }) +const plogDestChild = plogDest.child({ a: 'property' }) +const plogAsyncChild = plogAsync.child({ a: 'property' }) +const plogChildChild = plog.child({ a: 'property' }).child({ sub: 'child' }) +const plogDestChildChild = plogDest.child({ a: 'property' }).child({ sub: 'child' }) +const plogAsyncChildChild = plogAsync.child({ a: 'property' }).child({ sub: 'child' }) + +const max = 10 + +const run = bench([ + function benchPino (cb) { + for (var i = 0; i < max; i++) { + plog.info('hello world') + } + setImmediate(cb) + }, + function benchPinoDest (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello world') + } + setImmediate(cb) + }, + function benchPinoExtreme (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info('hello world') + } + setImmediate(cb) + }, + function benchPinoObj (cb) { + for (var i = 0; i < max; i++) { + plog.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoDestObj (cb) { + for (var i = 0; i < max; i++) { + plogDest.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoAsyncObj (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChild (cb) { + for (var i = 0; i < max; i++) { + plogChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoDestChild (cb) { + for (var i = 0; i < max; i++) { + plogDestChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoAsyncChild (cb) { + for (var i = 0; i < max; i++) { + plogAsyncChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildChild (cb) { + for (var i = 0; i < max; i++) { + plogChildChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoDestChildChild (cb) { + for (var i = 0; i < max; i++) { + plogDestChildChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoAsyncChildChild (cb) { + for (var i = 0; i < max; i++) { + plogAsyncChildChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildCreation (cb) { + const child = plog.child({ a: 'property' }) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoDestChildCreation (cb) { + const child = plogDest.child({ a: 'property' }) + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoMulti (cb) { + for (var i = 0; i < max; i++) { + plog.info('hello', 'world') + } + setImmediate(cb) + }, + function benchPinoDestMulti (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello', 'world') + } + setImmediate(cb) + }, + function benchPinoAsyncMulti (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info('hello', 'world') + } + setImmediate(cb) + }, + function benchPinoInterpolate (cb) { + for (var i = 0; i < max; i++) { + plog.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchPinoDestInterpolate (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchPinoDestInterpolate (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchPinoInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + plog.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchPinoDestInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchPinoAsyncInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchPinoInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + plog.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchPinoDestInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchPinoAsyncInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..fc8e9d5410f60c4fc7419f8e47d1463cc8c60042 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js @@ -0,0 +1,75 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../../') + +const base = pino(pino.destination('/dev/null')) +const child = base.child({}) +const childChild = child.child({}) +const childChildChild = childChild.child({}) +const childChildChildChild = childChildChild.child({}) +const child2 = base.child({}) +const baseSerializers = pino(pino.destination('/dev/null')) +const baseSerializersChild = baseSerializers.child({}) +const baseSerializersChildSerializers = baseSerializers.child({}) + +const max = 100 + +const run = bench([ + function benchPinoBase (cb) { + for (var i = 0; i < max; i++) { + base.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChild (cb) { + for (var i = 0; i < max; i++) { + child.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildChild (cb) { + for (var i = 0; i < max; i++) { + childChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildChildChild (cb) { + for (var i = 0; i < max; i++) { + childChildChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChildChildChildChild (cb) { + for (var i = 0; i < max; i++) { + childChildChildChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoChild2 (cb) { + for (var i = 0; i < max; i++) { + child2.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoBaseSerializers (cb) { + for (var i = 0; i < max; i++) { + baseSerializers.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoBaseSerializersChild (cb) { + for (var i = 0; i < max; i++) { + baseSerializersChild.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoBaseSerializersChildSerializers (cb) { + for (var i = 0; i < max; i++) { + baseSerializersChildSerializers.info({ hello: 'world' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/redact.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/redact.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..852dd754694c6c71651e4a6bae77d8efbc26dd7c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/internal/redact.bench.js @@ -0,0 +1,86 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../../') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plog = pino(dest) +delete require.cache[require.resolve('../../')] +const plogAsync = require('../../')(pino.destination({ dest: '/dev/null', sync: false })) +delete require.cache[require.resolve('../../')] +const plogUnsafe = require('../../')({ safe: false }, dest) +delete require.cache[require.resolve('../../')] +const plogUnsafeAsync = require('../../')( + { safe: false }, + pino.destination({ dest: '/dev/null', sync: false }) +) +const plogRedact = pino({ redact: ['a.b.c'] }, dest) +delete require.cache[require.resolve('../../')] +const plogAsyncRedact = require('../../')( + { redact: ['a.b.c'] }, + pino.destination({ dest: '/dev/null', sync: false }) +) +delete require.cache[require.resolve('../../')] +const plogUnsafeRedact = require('../../')({ redact: ['a.b.c'], safe: false }, dest) +delete require.cache[require.resolve('../../')] +const plogUnsafeAsyncRedact = require('../../')( + { redact: ['a.b.c'], safe: false }, + pino.destination({ dest: '/dev/null', sync: false }) +) + +const max = 10 + +// note that "redact me." is the same amount of bytes as the censor: "[Redacted]" + +const run = bench([ + function benchPinoNoRedact (cb) { + for (var i = 0; i < max; i++) { + plog.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + }, + function benchPinoRedact (cb) { + for (var i = 0; i < max; i++) { + plogRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + }, + function benchPinoUnsafeNoRedact (cb) { + for (var i = 0; i < max; i++) { + plogUnsafe.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + }, + function benchPinoUnsafeRedact (cb) { + for (var i = 0; i < max; i++) { + plogUnsafeRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + }, + function benchPinoAsyncNoRedact (cb) { + for (var i = 0; i < max; i++) { + plogAsync.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + }, + function benchPinoAsyncRedact (cb) { + for (var i = 0; i < max; i++) { + plogAsyncRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + }, + function benchPinoUnsafeAsyncNoRedact (cb) { + for (var i = 0; i < max; i++) { + plogUnsafeAsync.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + }, + function benchPinoUnsafeAsyncRedact (cb) { + for (var i = 0; i < max; i++) { + plogUnsafeAsyncRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/long-string.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/long-string.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..7f37a322b20dddf0736973a99c79f70951c1ba75 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/long-string.bench.js @@ -0,0 +1,81 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const bole = require('bole')('bench') +const winston = require('winston') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plogNodeStream = pino(dest) +delete require.cache[require.resolve('../')] +const plogDest = require('../')(pino.destination('/dev/null')) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 })) + +const crypto = require('crypto') + +const longStr = crypto.randomBytes(2000).toString() + +const max = 10 +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}) + +require('bole').output({ + level: 'info', + stream: dest +}).setFastTime(true) + +const chill = winston.createLogger({ + transports: [ + new winston.transports.Stream({ + stream: fs.createWriteStream('/dev/null') + }) + ] +}) + +const run = bench([ + function benchBunyan (cb) { + for (var i = 0; i < max; i++) { + blog.info(longStr) + } + setImmediate(cb) + }, + function benchWinston (cb) { + for (var i = 0; i < max; i++) { + chill.info(longStr) + } + setImmediate(cb) + }, + function benchBole (cb) { + for (var i = 0; i < max; i++) { + bole.info(longStr) + } + setImmediate(cb) + }, + function benchPino (cb) { + for (var i = 0; i < max; i++) { + plogDest.info(longStr) + } + setImmediate(cb) + }, + function benchPinoMinLength (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info(longStr) + } + setImmediate(cb) + }, + function benchPinoNodeStream (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info(longStr) + } + setImmediate(cb) + } +], 1000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/multi-arg.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/multi-arg.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..8cbc4dc6113190228405040a1d362686c5574dec --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/multi-arg.bench.js @@ -0,0 +1,193 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const bole = require('bole')('bench') +const winston = require('winston') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const plogNodeStream = pino(dest) +delete require.cache[require.resolve('../')] +const plogDest = require('../')(pino.destination('/dev/null')) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 })) +delete require.cache[require.resolve('../')] + +const deep = require('../package.json') +deep.deep = Object.assign({}, JSON.parse(JSON.stringify(deep))) +deep.deep.deep = Object.assign({}, JSON.parse(JSON.stringify(deep))) +deep.deep.deep.deep = Object.assign({}, JSON.parse(JSON.stringify(deep))) + +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}) + +require('bole').output({ + level: 'info', + stream: dest +}).setFastTime(true) + +const chill = winston.createLogger({ + transports: [ + new winston.transports.Stream({ + stream: fs.createWriteStream('/dev/null') + }) + ] +}) + +const max = 10 + +const run = bench([ + function benchBunyanInterpolate (cb) { + for (var i = 0; i < max; i++) { + blog.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchWinstonInterpolate (cb) { + for (var i = 0; i < max; i++) { + chill.log('info', 'hello %s', 'world') + } + setImmediate(cb) + }, + function benchBoleInterpolate (cb) { + for (var i = 0; i < max; i++) { + bole.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchPinoInterpolate (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchPinoMinLengthInterpolate (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchPinoNodeStreamInterpolate (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info('hello %s', 'world') + } + setImmediate(cb) + }, + function benchBunyanInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + blog.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + + function benchWinstonInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + chill.log('info', 'hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchBoleInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + bole.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchPinoInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchPinoMinLengthInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchPinoNodeStreamInterpolateAll (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info('hello %s %j %d', 'world', { obj: true }, 4) + } + setImmediate(cb) + }, + function benchBunyanInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + blog.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchWinstonInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + chill.log('info', 'hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchBoleInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + bole.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchPinoInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchPinoMinLengthInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchPinoNodeStreamInterpolateExtra (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) + } + setImmediate(cb) + }, + function benchBunyanInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + blog.info('hello %j', deep) + } + setImmediate(cb) + }, + function benchWinstonInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + chill.log('info', 'hello %j', deep) + } + setImmediate(cb) + }, + function benchBoleInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + bole.info('hello %j', deep) + } + setImmediate(cb) + }, + function benchPinoInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + plogDest.info('hello %j', deep) + } + setImmediate(cb) + }, + function benchPinoMinLengthInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info('hello %j', deep) + } + setImmediate(cb) + }, + function benchPinoNodeStreamInterpolateDeep (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info('hello %j', deep) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/multistream.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/multistream.js new file mode 100644 index 0000000000000000000000000000000000000000..18b9661c6731880c3e37a5bc626fd3c04c98a6fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/multistream.js @@ -0,0 +1,98 @@ +'use strict' + +const bench = require('fastbench') +const bunyan = require('bunyan') +const pino = require('../') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') + +const tenStreams = [ + { stream: dest }, + { stream: dest }, + { stream: dest }, + { stream: dest }, + { stream: dest }, + { level: 'debug', stream: dest }, + { level: 'debug', stream: dest }, + { level: 'trace', stream: dest }, + { level: 'warn', stream: dest }, + { level: 'fatal', stream: dest } +] +const pinomsTen = pino({ level: 'debug' }, pino.multistream(tenStreams)) + +const fourStreams = [ + { stream: dest }, + { stream: dest }, + { level: 'debug', stream: dest }, + { level: 'trace', stream: dest } +] +const pinomsFour = pino({ level: 'debug' }, pino.multistream(fourStreams)) + +const pinomsOne = pino({ level: 'info' }, pino.multistream(dest)) +const blogOne = bunyan.createLogger({ + name: 'myapp', + streams: [{ stream: dest }] +}) + +const blogTen = bunyan.createLogger({ + name: 'myapp', + streams: tenStreams +}) +const blogFour = bunyan.createLogger({ + name: 'myapp', + streams: fourStreams +}) + +const max = 10 +const run = bench([ + function benchBunyanTen (cb) { + for (let i = 0; i < max; i++) { + blogTen.info('hello world') + blogTen.debug('hello world') + blogTen.trace('hello world') + blogTen.warn('hello world') + blogTen.fatal('hello world') + } + setImmediate(cb) + }, + function benchPinoMSTen (cb) { + for (let i = 0; i < max; i++) { + pinomsTen.info('hello world') + pinomsTen.debug('hello world') + pinomsTen.trace('hello world') + pinomsTen.warn('hello world') + pinomsTen.fatal('hello world') + } + setImmediate(cb) + }, + function benchBunyanFour (cb) { + for (let i = 0; i < max; i++) { + blogFour.info('hello world') + blogFour.debug('hello world') + blogFour.trace('hello world') + } + setImmediate(cb) + }, + function benchPinoMSFour (cb) { + for (let i = 0; i < max; i++) { + pinomsFour.info('hello world') + pinomsFour.debug('hello world') + pinomsFour.trace('hello world') + } + setImmediate(cb) + }, + function benchBunyanOne (cb) { + for (let i = 0; i < max; i++) { + blogOne.info('hello world') + } + setImmediate(cb) + }, + function benchPinoMSOne (cb) { + for (let i = 0; i < max; i++) { + pinomsOne.info('hello world') + } + setImmediate(cb) + } +], 10000) + +run() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/object.bench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/object.bench.js new file mode 100644 index 0000000000000000000000000000000000000000..6207dec22c0608b60515b7c00fc9b06992273072 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/object.bench.js @@ -0,0 +1,82 @@ +'use strict' + +const bench = require('fastbench') +const pino = require('../') +const bunyan = require('bunyan') +const bole = require('bole')('bench') +const winston = require('winston') +const fs = require('node:fs') +const dest = fs.createWriteStream('/dev/null') +const loglevel = require('./utils/wrap-log-level')(dest) +const plogNodeStream = pino(dest) +delete require.cache[require.resolve('../')] +const plogDest = require('../')(pino.destination('/dev/null')) +delete require.cache[require.resolve('../')] +const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 })) +const blog = bunyan.createLogger({ + name: 'myapp', + streams: [{ + level: 'trace', + stream: dest + }] +}) +require('bole').output({ + level: 'info', + stream: dest +}).setFastTime(true) +const chill = winston.createLogger({ + transports: [ + new winston.transports.Stream({ + stream: fs.createWriteStream('/dev/null') + }) + ] +}) + +const max = 10 + +const run = bench([ + function benchBunyanObj (cb) { + for (var i = 0; i < max; i++) { + blog.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchWinstonObj (cb) { + for (var i = 0; i < max; i++) { + chill.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchBoleObj (cb) { + for (var i = 0; i < max; i++) { + bole.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchLogLevelObject (cb) { + for (var i = 0; i < max; i++) { + loglevel.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoObj (cb) { + for (var i = 0; i < max; i++) { + plogDest.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoMinLengthObj (cb) { + for (var i = 0; i < max; i++) { + plogMinLength.info({ hello: 'world' }) + } + setImmediate(cb) + }, + function benchPinoNodeStreamObj (cb) { + for (var i = 0; i < max; i++) { + plogNodeStream.info({ hello: 'world' }) + } + setImmediate(cb) + } +], 10000) + +run(run) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js new file mode 100644 index 0000000000000000000000000000000000000000..edf8a031e82b99fc55bf292c9c459d6aa0475990 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js @@ -0,0 +1,36 @@ +'use strict' +const { join } = require('node:path') +const { execSync } = require('node:child_process') + +const run = (type) => { + process.stderr.write(`benchmarking ${type}\n`) + return execSync(`node ${join(__dirname, 'runbench')} ${type} -q`) +} + +console.log(` +# Benchmarks + +\`pino.info('hello world')\`: + +\`\`\` +${run('basic')} +\`\`\` + +\`pino.info({'hello': 'world'})\`: + +\`\`\` +${run('object')} +\`\`\` + +\`pino.info(aBigDeeplyNestedObject)\`: + +\`\`\` +${run('deep-object')} +\`\`\` + +\`pino.info('hello %s %j %d', 'world', {obj: true}, 4, {another: 'obj'})\`: + +For a fair comparison, [LogLevel](http://npm.im/loglevel) was extended +to include a timestamp and [bole](http://npm.im/bole) had +\`fastTime\` mode switched on. +`) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/runbench.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/runbench.js new file mode 100644 index 0000000000000000000000000000000000000000..7bb5585a470270dcddefbb60935d4267487d7d12 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/runbench.js @@ -0,0 +1,138 @@ +'use strict' + +const { type, platform, arch, release, cpus } = require('node:os') +const { resolve, join } = require('node:path') +const spawn = require('node:child_process').spawn +const pump = require('pump') +const split = require('split2') +const through = require('through2') +const steed = require('steed') + +function usage () { + console.log(` + Pino Benchmarks + + To run a benchmark, specify which to run: + + ・all ⁃ run all benchmarks (takes a while) + ・basic ⁃ log a simple string + ・object ⁃ logging a basic object + ・deep-object ⁃ logging a large object + ・multi-arg ⁃ multiple log method arguments + ・child ⁃ child from a parent + ・child-child ⁃ child from a child + ・child-creation ⁃ child constructor + ・formatters ⁃ difference between with or without formatters + + Example: + + node runbench basic + `) +} + +if (!process.argv[2]) { + usage() + process.exit() +} + +const quiet = process.argv[3] === '-q' + +const selectedBenchmark = process.argv[2].toLowerCase() +const benchmarkDir = resolve(__dirname, '..') +const benchmarks = { + basic: 'basic.bench.js', + object: 'object.bench.js', + 'deep-object': 'deep-object.bench.js', + 'multi-arg': 'multi-arg.bench.js', + 'long-string': 'long-string.bench.js', + child: 'child.bench.js', + 'child-child': 'child-child.bench.js', + 'child-creation': 'child-creation.bench.js', + formatters: 'formatters.bench.js' +} + +function runBenchmark (name, done) { + const benchmarkResults = {} + benchmarkResults[name] = {} + + const processor = through(function (line, enc, cb) { + const [label, time] = ('' + line).split(': ') + const [target, iterations] = label.split('*') + const logger = target.replace('bench', '') + + if (!benchmarkResults[name][logger]) benchmarkResults[name][logger] = [] + + benchmarkResults[name][logger].push({ + time: time.replace('ms', ''), + iterations: iterations.replace(':', '') + }) + + cb() + }) + + if (quiet === false) console.log(`Running ${name.toUpperCase()} benchmark\n`) + + const benchmark = spawn( + process.argv[0], + [join(benchmarkDir, benchmarks[name])] + ) + + if (quiet === false) { + benchmark.stdout.pipe(process.stdout) + } + + pump(benchmark.stdout, split(), processor) + + benchmark.on('exit', () => { + console.log() + if (done && typeof done === 'function') done(null, benchmarkResults) + }) +} + +function sum (arr) { + let result = 0 + for (var i = 0; i < arr.length; i += 1) { + result += Number.parseFloat(arr[i].time) + } + return result +} + +function displayResults (results) { + if (quiet === false) console.log('==========') + const benchNames = Object.keys(results) + for (var i = 0; i < benchNames.length; i += 1) { + console.log(`${benchNames[i].toUpperCase()} benchmark averages`) + const benchmark = results[benchNames[i]] + const loggers = Object.keys(benchmark) + for (var j = 0; j < loggers.length; j += 1) { + const logger = benchmark[loggers[j]] + const average = sum(logger) / logger.length + console.log(`${loggers[j]} average: ${average.toFixed(3)}ms`) + } + } + if (quiet === false) { + console.log('==========') + console.log( + `System: ${type()}/${platform()} ${arch()} ${release()}`, + `~ ${cpus()[0].model} (cores/threads: ${cpus().length})` + ) + } +} + +function toBench (done) { + runBenchmark(this.name, done) +} + +const benchQueue = [] +if (selectedBenchmark !== 'all') { + benchQueue.push(toBench.bind({ name: selectedBenchmark })) +} else { + const keys = Object.keys(benchmarks) + for (var i = 0; i < keys.length; i += 1) { + benchQueue.push(toBench.bind({ name: keys[i] })) + } +} +steed.series(benchQueue, function (err, results) { + if (err) return console.error(err.message) + results.forEach(displayResults) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/wrap-log-level.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/wrap-log-level.js new file mode 100644 index 0000000000000000000000000000000000000000..77d069157f57032634671088ef4f9c43f8dbdfde --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/benchmarks/utils/wrap-log-level.js @@ -0,0 +1,55 @@ +'use strict' + +const { readFileSync } = require('node:fs') +const vm = require('vm') +const { join } = require('node:path') +const code = readFileSync( + join(__dirname, '..', '..', 'node_modules', 'loglevel', 'lib', 'loglevel.js') +) +const { Console } = require('console') + +function build (dest) { + const sandbox = { + module: {}, + console: new Console(dest, dest) + } + const context = vm.createContext(sandbox) + + const script = new vm.Script(code) + script.runInContext(context) + + const loglevel = sandbox.log + + const originalFactory = loglevel.methodFactory + loglevel.methodFactory = function (methodName, logLevel, loggerName) { + const rawMethod = originalFactory(methodName, logLevel, loggerName) + + return function () { + const time = new Date() + let array + if (typeof arguments[0] === 'string') { + arguments[0] = '[' + time.toISOString() + '] ' + arguments[0] + rawMethod.apply(null, arguments) + } else { + array = new Array(arguments.length + 1) + array[0] = '[' + time.toISOString() + ']' + for (var i = 0; i < arguments.length; i++) { + array[i + 1] = arguments[i] + } + rawMethod.apply(null, array) + } + } + } + + loglevel.setLevel(loglevel.levels.INFO) + return loglevel +} + +module.exports = build + +if (require.main === module) { + const loglevel = build(process.stdout) + loglevel.info('hello') + loglevel.info({ hello: 'world' }) + loglevel.info('hello %j', { hello: 'world' }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/build/sync-version.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/build/sync-version.js new file mode 100644 index 0000000000000000000000000000000000000000..1164cc4cbd9b4a76c8591cc1ded5c71eab49723a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/build/sync-version.js @@ -0,0 +1,10 @@ +const fs = require('node:fs') +const path = require('node:path') +const { version } = require('../package.json') + +const metaContent = `'use strict' + +module.exports = { version: '${version}' } +` + +fs.writeFileSync(path.resolve('./lib/meta.js'), metaContent, { encoding: 'utf-8' }) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/api.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/api.md new file mode 100644 index 0000000000000000000000000000000000000000..3ce9d8342118a5217fce892e847d7c1af641666e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/api.md @@ -0,0 +1,1509 @@ +# API + +* [pino() => logger](#export) + * [options](#options) + * [destination](#destination) + * [destination\[Symbol.for('pino.metadata')\]](#metadata) +* [Logger Instance](#logger) + * [logger.trace()](#trace) + * [logger.debug()](#debug) + * [logger.info()](#info) + * [logger.warn()](#warn) + * [logger.error()](#error) + * [logger.fatal()](#fatal) + * [logger.silent()](#silent) + * [logger.child()](#child) + * [logger.bindings()](#logger-bindings) + * [logger.setBindings()](#logger-set-bindings) + * [logger.flush()](#flush) + * [logger.level](#logger-level) + * [logger.isLevelEnabled()](#islevelenabled) + * [logger.levels](#levels) + * [logger\[Symbol.for('pino.serializers')\]](#serializers) + * [Event: 'level-change'](#level-change) + * [logger.version](#version) + * [logger.msgPrefix](#msgPrefix) +* [Statics](#statics) + * [pino.destination()](#pino-destination) + * [pino.transport()](#pino-transport) + * [pino.multistream()](#pino-multistream) + * [pino.stdSerializers](#pino-stdserializers) + * [pino.stdTimeFunctions](#pino-stdtimefunctions) + * [pino.symbols](#pino-symbols) + * [pino.version](#pino-version) +* [Interfaces](#interfaces) + * [MultiStreamRes](#multistreamres) + * [StreamEntry](#streamentry) + * [DestinationStream](#destinationstream) +* [Types](#types) + * [Level](#level-1) + + +## `pino([options], [destination]) => logger` + +The exported `pino` function takes two optional arguments, +[`options`](#options) and [`destination`](#destination), and +returns a [logger instance](#logger). + + +### `options` (Object) + +#### `name` (String) + +Default: `undefined` + +The name of the logger. When set adds a `name` field to every JSON line logged. + +#### `level` (String) + +Default: `'info'` + +The minimum level to log: Pino will not log messages with a lower level. Setting this option reduces the load, as typically, debug and trace logs are only valid for development, and not needed in production. + +One of `'fatal'`, `'error'`, `'warn'`, `'info'`, `'debug'`, `'trace'` or `'silent'`. + +Additional levels can be added to the instance via the `customLevels` option. + +* See [`customLevels` option](#opt-customlevels) + + + +#### `levelComparison` ("ASC", "DESC", Function) + +Default: `ASC` + +Use this option to customize levels order. +In order to be able to define custom levels ordering pass a function which will accept `current` and `expected` values and return `boolean` which shows should `current` level to be shown or not. + +```js +const logger = pino({ + levelComparison: 'DESC', + customLevels: { + foo: 20, // `foo` is more valuable than `bar` + bar: 10 + }, +}) + +// OR + +const logger = pino({ + levelComparison: function(current, expected) { + return current >= expected; + } +}) +``` + +#### `customLevels` (Object) + +Default: `undefined` + +Use this option to define additional logging levels. +The keys of the object correspond to the namespace of the log level, +and the values should be the numerical value of the level. + +```js +const logger = pino({ + customLevels: { + foo: 35 + } +}) +logger.foo('hi') +``` + + +#### `useOnlyCustomLevels` (Boolean) + +Default: `false` + +Use this option to only use defined `customLevels` and omit Pino's levels. +Logger's default `level` must be changed to a value in `customLevels` to use `useOnlyCustomLevels` +Warning: this option may not be supported by downstream transports. + +```js +const logger = pino({ + customLevels: { + foo: 35 + }, + useOnlyCustomLevels: true, + level: 'foo' +}) +logger.foo('hi') +logger.info('hello') // Will throw an error saying info is not found in logger object +``` +#### `depthLimit` (Number) + +Default: `5` + +Option to limit stringification at a specific nesting depth when logging circular objects. + +#### `edgeLimit` (Number) + +Default: `100` + +Option to limit stringification of properties/elements when logging a specific object/array with circular references. + + +#### `mixin` (Function): + +Default: `undefined` + +If provided, the `mixin` function is called each time one of the active +logging methods is called. The first parameter is the value `mergeObject` or an empty object. The second parameter is the log level number. +The third parameter is the logger or child logger itself, which can be used to +retrieve logger-specific context from within the `mixin` function. +The function must synchronously return an object. The properties of the returned object will be added to the +logged JSON. + +```js +let n = 0 +const logger = pino({ + mixin () { + return { line: ++n } + } +}) +logger.info('hello') +// {"level":30,"time":1573664685466,"pid":78742,"hostname":"x","line":1,"msg":"hello"} +logger.info('world') +// {"level":30,"time":1573664685469,"pid":78742,"hostname":"x","line":2,"msg":"world"} +``` + +The result of `mixin()` is supposed to be a _new_ object. For performance reason, the object returned by `mixin()` will be mutated by pino. +In the following example, passing `mergingObject` argument to the first `info` call will mutate the global `mixin` object by default: +(* See [`mixinMergeStrategy` option](#opt-mixin-merge-strategy)): +```js +const mixin = { + appName: 'My app' +} + +const logger = pino({ + mixin() { + return mixin; + } +}) + +logger.info({ + description: 'Ok' +}, 'Message 1') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","appName":"My app","description":"Ok","msg":"Message 1"} +logger.info('Message 2') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","appName":"My app","description":"Ok","msg":"Message 2"} +// Note: the second log contains "description":"Ok" text, even if it was not provided. +``` + +The `mixin` method can be used to add the level label to each log message such as in the following example: +```js +const logger = pino({ + mixin(_context, level) { + return { 'level-label': logger.levels.labels[level] } + } +}) + +logger.info({ + description: 'Ok' +}, 'Message 1') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","description":"Ok","level-label":"info","msg":"Message 1"} +logger.error('Message 2') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","level-label":"error","msg":"Message 2"} +``` + +If the `mixin` feature is being used merely to add static metadata to each log message, +then a [child logger ⇗](/docs/child-loggers.md) should be used instead. Unless your application +needs to concatenate values for a specific key multiple times, in which case `mixin` can be +used to avoid the [duplicate keys caveat](/docs/child-loggers.md#duplicate-keys-caveat): + +```js +const logger = pino({ + mixin (obj, num, logger) { + return { + tags: logger.tags + } + } +}) +logger.tags = {} + +logger.addTag = function (key, value) { + logger.tags[key] = value +} + +function createChild (parent, ...context) { + const newChild = logger.child(...context) + newChild.tags = { ...logger.tags } + newChild.addTag = function (key, value) { + newChild.tags[key] = value + } + return newChild +} + +logger.addTag('foo', 1) +const child = createChild(logger, {}) +child.addTag('bar', 2) +logger.info('this will only have `foo: 1`') +child.info('this will have both `foo: 1` and `bar: 2`') +logger.info('this will still only have `foo: 1`') +``` + +As of pino 7.x, when the `mixin` is used with the [`nestedKey` option](#opt-nestedkey), +the object returned from the `mixin` method will also be nested. Prior versions would mix +this object into the root. + +```js +const logger = pino({ + nestedKey: 'payload', + mixin() { + return { requestId: requestId.currentId() } + } +}) + +logger.info({ + description: 'Ok' +}, 'Message 1') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","payload":{"requestId":"dfe9a9014b","description":"Ok"},"msg":"Message 1"} +``` + + +#### `mixinMergeStrategy` (Function): + +Default: `undefined` + +If provided, the `mixinMergeStrategy` function is called each time one of the active +logging methods is called. The first parameter is the value `mergeObject` or an empty object, +the second parameter is the value resulting from `mixin()` (* See [`mixin` option](#opt-mixin) or an empty object. +The function must synchronously return an object. + +```js +// Default strategy, `mergeObject` has priority +const logger = pino({ + mixin() { + return { tag: 'docker' } + }, + // mixinMergeStrategy(mergeObject, mixinObject) { + // return Object.assign(mixinMeta, mergeObject) + // } +}) + +logger.info({ + tag: 'local' +}, 'Message') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","tag":"local","msg":"Message"} +``` + +```js +// Custom mutable strategy, `mixin` has priority +const logger = pino({ + mixin() { + return { tag: 'k8s' } + }, + mixinMergeStrategy(mergeObject, mixinObject) { + return Object.assign(mergeObject, mixinObject) + } +}) + +logger.info({ + tag: 'local' +}, 'Message') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","tag":"k8s","msg":"Message"} +``` + +```js +// Custom immutable strategy, `mixin` has priority +const logger = pino({ + mixin() { + return { tag: 'k8s' } + }, + mixinMergeStrategy(mergeObject, mixinObject) { + return Object.assign({}, mergeObject, mixinObject) + } +}) + +logger.info({ + tag: 'local' +}, 'Message') +// {"level":30,"time":1591195061437,"pid":16012,"hostname":"x","tag":"k8s","msg":"Message"} +``` + + +#### `redact` (Array | Object): + +Default: `undefined` + +As an array, the `redact` option specifies paths that should +have their values redacted from any log output. + +Each path must be a string using a syntax that corresponds to JavaScript dot and bracket notation. + +If an object is supplied, three options can be specified: + * `paths` (array): Required. An array of paths. See [redaction - Path Syntax ⇗](/docs/redaction.md#paths) for specifics. + * `censor` (String|Function|Undefined): Optional. When supplied as a String the `censor` option will overwrite keys that are to be redacted. When set to `undefined` the key will be removed entirely from the object. + The `censor` option may also be a mapping function. The (synchronous) mapping function has the signature `(value, path) => redactedValue` and is called with the unredacted `value` and `path` to the key being redacted, as an array. For example given a redaction path of `a.b.c` the `path` argument would be `['a', 'b', 'c']`. The value returned from the mapping function becomes the applied censor value. Default: `'[Redacted]'` + value synchronously. + Default: `'[Redacted]'` + * `remove` (Boolean): Optional. Instead of censoring the value, remove both the key and the value. Default: `false` + +**WARNING**: Never allow user input to define redacted paths. + +* See the [redaction ⇗](/docs/redaction.md) documentation. +* See [fast-redact#caveat ⇗](https://github.com/davidmarkclements/fast-redact#caveat) + + +#### `hooks` (Object) + +An object mapping to hook functions. Hook functions allow for customizing +internal logger operations. Hook functions ***must*** be synchronous functions. + + +##### `logMethod` + +Allows for manipulating the parameters passed to logger methods. The signature +for this hook is `logMethod (args, method, level) {}`, where `args` is an array +of the arguments that were passed to the log method and `method` is the log +method itself, `level` is the log level itself. This hook ***must*** invoke the +`method` function by using apply, like so: `method.apply(this, newArgumentsArray)`. + +For example, Pino expects a binding object to be the first parameter with an +optional string message as the second parameter. Using this hook the parameters +can be flipped: + +```js +const hooks = { + logMethod (inputArgs, method, level) { + if (inputArgs.length >= 2) { + const arg1 = inputArgs.shift() + const arg2 = inputArgs.shift() + return method.apply(this, [arg2, arg1, ...inputArgs]) + } + return method.apply(this, inputArgs) + } +} +``` + + + +##### `streamWrite` + +Allows for manipulating the _stringified_ JSON log data just before writing to various transports. + +The method receives the stringified JSON and must return valid stringified JSON. + +For example: +```js +const hooks = { + streamWrite (s) { + return s.replaceAll('sensitive-api-key', 'XXX') + } +} +``` + + +#### `formatters` (Object) + +An object containing functions for formatting the shape of the log lines. +These functions should return a JSONifiable object and +should never throw. These functions allow for full customization of +the resulting log lines. For example, they can be used to change +the level key name or to enrich the default metadata. + +##### `level` + +Changes the shape of the log level. The default shape is `{ level: number }`. +The function takes two arguments, the label of the level (e.g. `'info'`) +and the numeric value (e.g. `30`). + +ps: The log level cannot be customized when using multiple transports + +```js +const formatters = { + level (label, number) { + return { level: number } + } +} +``` + +##### `bindings` + +Changes the shape of the bindings. The default shape is `{ pid, hostname }`. +The function takes a single argument, the bindings object, which can be configured +using the [`base` option](#opt-base). Called once when creating logger. + +```js +const formatters = { + bindings (bindings) { + return { pid: bindings.pid, hostname: bindings.hostname } + } +} +``` + +##### `log` + +Changes the shape of the log object. This function will be called every time +one of the log methods (such as `.info`) is called. All arguments passed to the +log method, except the message, will be passed to this function. By default, it does +not change the shape of the log object. + +```js +const formatters = { + log (object) { + return object + } +} +``` + + +#### `serializers` (Object) + +Default: `{err: pino.stdSerializers.err}` + +An object containing functions for custom serialization of objects. +These functions should return an JSONifiable object and they +should never throw. When logging an object, each top-level property +matching the exact key of a serializer will be serialized using the defined serializer. + +The serializers are applied when a property in the logged object matches a property +in the serializers. The only exception is the `err` serializer as it is also applied in case +the object is an instance of `Error`, e.g. `logger.info(new Error('kaboom'))`. +See `errorKey` option to change `err` namespace. + +* See [pino.stdSerializers](#pino-stdserializers) + +#### `msgPrefix` (String) + +Default: `undefined` + +The `msgPrefix` property allows you to specify a prefix for every message of the logger and its children. + +```js +const logger = pino({ + msgPrefix: '[HTTP] ' +}) +logger.info('got new request!') +// > [HTTP] got new request! + +const child = logger.child({}) +child.info('User authenticated!') +// > [HTTP] User authenticated! +``` + + +#### `base` (Object) + +Default: `{pid: process.pid, hostname: os.hostname()}` + +Key-value object added as child logger to each log line. + +Set to `undefined` to avoid adding `pid`, `hostname` properties to each log. + +#### `enabled` (Boolean) + +Default: `true` + +Set to `false` to disable logging. + +#### `crlf` (Boolean) + +Default: `false` + +Set to `true` to logs newline delimited JSON with `\r\n` instead of `\n`. + + +#### `timestamp` (Boolean | Function) + +Default: `true` + +Enables or disables the inclusion of a timestamp in the +log message. If a function is supplied, it must synchronously return a partial JSON string +representation of the time, e.g. `,"time":1493426328206` (which is the default). + +If set to `false`, no timestamp will be included in the output. + +See [stdTimeFunctions](#pino-stdtimefunctions) for a set of available functions +for passing in as a value for this option. + +Example: +```js +timestamp: () => `,"time":"${new Date(Date.now()).toISOString()}"` +// which is equivalent to: +// timestamp: stdTimeFunctions.isoTime +``` + +**Caution**: attempting to format time in-process will significantly impact logging performance. + + +#### `messageKey` (String) + +Default: `'msg'` + +The string key for the 'message' in the JSON object. + + +#### `errorKey` (String) + +Default: `'err'` + +The string key for the 'error' in the JSON object. + + +#### `nestedKey` (String) + +Default: `null` + +If there's a chance that objects being logged have properties that conflict with those from pino itself (`level`, `timestamp`, `pid`, etc) +and duplicate keys in your log records are undesirable, pino can be configured with a `nestedKey` option that causes any `object`s that are logged +to be placed under a key whose name is the value of `nestedKey`. + +This way, when searching something like Kibana for values, one can consistently search under the configured `nestedKey` value instead of the root log record keys. + +For example, +```js +const logger = require('pino')({ + nestedKey: 'payload' +}) + +const thing = { level: 'hi', time: 'never', foo: 'bar'} // has pino-conflicting properties! +logger.info(thing) + +// logs the following: +// {"level":30,"time":1578357790020,"pid":91736,"hostname":"x","payload":{"level":"hi","time":"never","foo":"bar"}} +``` +In this way, logged objects' properties don't conflict with pino's standard logging properties, +and searching for logged objects can start from a consistent path. + +#### `browser` (Object) + +Browser only, may have `asObject` and `write` keys. This option is separately +documented in the [Browser API ⇗](/docs/browser.md) documentation. + +* See [Browser API ⇗](/docs/browser.md) + +#### `transport` (Object) + +The `transport` option is a shorthand for the [pino.transport()](#pino-transport) function. +It supports the same input options: +```js +require('pino')({ + transport: { + target: '/absolute/path/to/my-transport.mjs' + } +}) + +// or multiple transports +require('pino')({ + transport: { + targets: [ + { target: '/absolute/path/to/my-transport.mjs', level: 'error' }, + { target: 'some-file-transport', options: { destination: '/dev/null' } + ] + } +}) +``` + +If the transport option is supplied to `pino`, a [`destination`](#destination) parameter may not also be passed as a separate argument to `pino`: + +```js +pino({ transport: {}}, '/path/to/somewhere') // THIS WILL NOT WORK, DO NOT DO THIS +pino({ transport: {}}, process.stderr) // THIS WILL NOT WORK, DO NOT DO THIS +``` + +when using the `transport` option. In this case, an `Error` will be thrown. + +* See [pino.transport()](#pino-transport) + +#### `onChild` (Function) + +The `onChild` function is a synchronous callback that will be called on each creation of a new child, passing the child instance as its first argument. +Any error thrown inside the callback will be uncaught and should be handled inside the callback. +```js +const parent = require('pino')({ onChild: (instance) => { + // Execute call back code for each newly created child. +}}) +// `onChild` will now be executed with the new child. +parent.child(bindings) +``` + + + +### `destination` (Number | String | Object | DestinationStream | SonicBoomOpts | WritableStream) + +Default: `pino.destination(1)` (STDOUT) + +The `destination` parameter can be a file descriptor, a file path, or an +object with `dest` property pointing to a fd or path. +An ordinary Node.js `stream` file descriptor can be passed as the +destination (such as the result +of `fs.createWriteStream`) but for peak log writing performance, it is strongly +recommended to use `pino.destination` to create the destination stream. +Note that the `destination` parameter can be the result of `pino.transport()`. + +```js +// pino.destination(1) by default +const stdoutLogger = require('pino')() + +// destination param may be in first position when no options: +const fileLogger = require('pino')( pino.destination('/log/path')) + +// use the stderr file handle to log to stderr: +const opts = {name: 'my-logger'} +const stderrLogger = require('pino')(opts, pino.destination(2)) + +// automatic wrapping in pino.destination +const fileLogger = require('pino')('/log/path') + +// Asynchronous logging +const fileLogger = pino(pino.destination({ dest: '/log/path', sync: false })) +``` + +However, there are some special instances where `pino.destination` is not used as the default: + ++ When something, e.g a process manager, has monkey-patched `process.stdout.write`. + +In these cases `process.stdout` is used instead. + +Note: If the parameter is a string integer, e.g. `'1'`, it will be coerced to +a number and used as a file descriptor. If this is not desired, provide a full +path, e.g. `/tmp/1`. + +* See [`pino.destination`](#pino-destination) + + +#### `destination[Symbol.for('pino.metadata')]` + +Default: `false` + +Using the global symbol `Symbol.for('pino.metadata')` as a key on the `destination` parameter and +setting the key to `true`, indicates that the following properties should be +set on the `destination` object after each log line is written: + +* the last logging level as `destination.lastLevel` +* the last logging message as `destination.lastMsg` +* the last logging object as `destination.lastObj` +* the last time as `destination.lastTime`, which will be the partial string returned + by the time function. +* the last logger instance as `destination.lastLogger` (to support child + loggers) + +The following is a succinct usage example: + +```js +const dest = pino.destination('/dev/null') +dest[Symbol.for('pino.metadata')] = true +const logger = pino(dest) +logger.info({a: 1}, 'hi') +const { lastMsg, lastLevel, lastObj, lastTime} = dest +console.log( + 'Logged message "%s" at level %d with object %o at time %s', + lastMsg, lastLevel, lastObj, lastTime +) // Logged message "hi" at level 30 with object { a: 1 } at time 1531590545089 +``` + + +## Logger Instance + +The logger instance is the object returned by the main exported +[`pino`](#export) function. + +The primary purpose of the logger instance is to provide logging methods. + +The default logging methods are `trace`, `debug`, `info`, `warn`, `error`, and `fatal`. + +Each logging method has the following signature: +`([mergingObject], [message], [...interpolationValues])`. + +The parameters are explained below using the `logger.info` method but the same applies to all logging methods. + +### Logging Method Parameters + + +#### `mergingObject` (Object) + +An object can optionally be supplied as the first parameter. Each enumerable key and value +of the `mergingObject` is copied into the JSON log line. + +```js +logger.info({MIX: {IN: true}}) +// {"level":30,"time":1531254555820,"pid":55956,"hostname":"x","MIX":{"IN":true}} +``` + +If the object is of type Error, it is wrapped in an object containing a property err (`{ err: mergingObject }`). +This allows for a unified error handling flow. + +Options `serializers` and `errorKey` could be used at instantiation time to change the namespace +from `err` to another string as preferred. + + +#### `message` (String) + +A `message` string can optionally be supplied as the first parameter, or +as the second parameter after supplying a `mergingObject`. + +By default, the contents of the `message` parameter will be merged into the +JSON log line under the `msg` key: + +```js +logger.info('hello world') +// {"level":30,"time":1531257112193,"msg":"hello world","pid":55956,"hostname":"x"} +``` + +The `message` parameter takes precedence over the `mergingObject`. +That is, if a `mergingObject` contains a `msg` property, and a `message` parameter +is supplied in addition, the `msg` property in the output log will be the value of +the `message` parameter not the value of the `msg` property on the `mergingObject`. +See [Avoid Message Conflict](/docs/help.md#avoid-message-conflict) for information +on how to overcome this limitation. + +If no `message` parameter is provided, and the `mergingObject` is of type `Error` or it has a property named `err`, the +`message` parameter is set to the `message` value of the error. See option `errorKey` if you want to change the namespace. + +The `messageKey` option can be used at instantiation time to change the namespace +from `msg` to another string as preferred. + +The `message` string may contain a printf style string with support for +the following placeholders: + +* `%s` – string placeholder +* `%d` – digit placeholder +* `%O`, `%o`, and `%j` – object placeholder + +Values supplied as additional arguments to the logger method will +then be interpolated accordingly. + +* See [`messageKey` pino option](#opt-messagekey) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +#### `...interpolationValues` (Any) + +All arguments supplied after `message` are serialized and interpolated according +to any supplied printf-style placeholders (`%s`, `%d`, `%o`|`%O`|`%j`) to form +the final output `msg` value for the JSON log line. + +```js +logger.info('%o hello %s', {worldly: 1}, 'world') +// {"level":30,"time":1531257826880,"msg":"{\"worldly\":1} hello world","pid":55956,"hostname":"x"} +``` + +Since pino v6, we do not automatically concatenate and cast to string +consecutive parameters: + +```js +logger.info('hello', 'world') +// {"level":30,"time":1531257618044,"msg":"hello","pid":55956,"hostname":"x"} +// world is missing +``` + +However, it's possible to inject a hook to modify this behavior: + +```js +const pinoOptions = { + hooks: { logMethod } +} + +function logMethod (args, method) { + if (args.length === 2) { + args[0] = `${args[0]} %j` + } + method.apply(this, args) +} + +const logger = pino(pinoOptions) +``` + +* See [`message` log method parameter](#message) +* See [`logMethod` hook](#logmethod) + + +#### Errors + +Errors can be supplied as either the first parameter or if already using `mergingObject` then as the `err` property on the `mergingObject`. + +Options `serializers` and `errorKey` could be used at instantiation time to change the namespace +from `err` to another string as preferred. + +> ## Note +> This section describes the default configuration. The error serializer can be +> mapped to a different key using the [`serializers`](#opt-serializers) option. +```js +logger.info(new Error("test")) +// {"level":30,"time":1531257618044,"msg":"test","stack":"...","type":"Error","pid":55956,"hostname":"x"} + +logger.info({ err: new Error("test"), otherkey: 123 }, "some text") +// {"level":30,"time":1531257618044,"err":{"msg": "test", "stack":"...","type":"Error"},"msg":"some text","pid":55956,"hostname":"x","otherkey":123} +``` + + +### `logger.trace([mergingObject], [message], [...interpolationValues])` + +Write a `'trace'` level log, if the configured [`level`](#level) allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.debug([mergingObject], [message], [...interpolationValues])` + +Write a `'debug'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.info([mergingObject], [message], [...interpolationValues])` + +Write an `'info'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.warn([mergingObject], [message], [...interpolationValues])` + +Write a `'warn'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.error([mergingObject], [message], [...interpolationValues])` + +Write a `'error'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.fatal([mergingObject], [message], [...interpolationValues])` + +Write a `'fatal'` level log, if the configured `level` allows for it. + +Since `'fatal'` level messages are intended to be logged just before the process exiting the `fatal` +method will always sync flush the destination. +Therefore it's important not to misuse `fatal` since +it will cause performance overhead if used for any +other purpose than writing final log messages before +the process crashes or exits. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.silent()` + +Noop function. + + +### `logger.child(bindings, [options]) => logger` + +The `logger.child` method allows for the creation of stateful loggers, +where key-value pairs can be pinned to a logger causing them to be output +on every log line. + +Child loggers use the same output stream as the parent and inherit +the current log level of the parent at the time they are spawned. + +The log level of a child is mutable. It can be set independently +of the parent either by setting the [`level`](#level) accessor after creating +the child logger or using the [`options.level`](#optionslevel-string) key. + + +#### `bindings` (Object) + +An object of key-value pairs to include in every log line output +via the returned child logger. + +```js +const child = logger.child({ MIX: {IN: 'always'} }) +child.info('hello') +// {"level":30,"time":1531258616689,"msg":"hello","pid":64849,"hostname":"x","MIX":{"IN":"always"}} +child.info('child!') +// {"level":30,"time":1531258617401,"msg":"child!","pid":64849,"hostname":"x","MIX":{"IN":"always"}} +``` + +The `bindings` object may contain any key except for reserved configuration keys `level` and `serializers`. + +##### `bindings.serializers` (Object) - DEPRECATED + +Use `options.serializers` instead. + +#### `options` (Object) + +Options for child logger. These options will override the parent logger options. + +##### `options.level` (String) + +The `level` property overrides the log level of the child logger. +By default, the parent log level is inherited. +After the creation of the child logger, it is also accessible using the [`logger.level`](#logger-level) key. + +```js +const logger = pino() +logger.debug('nope') // will not log, since default level is info +const child = logger.child({foo: 'bar'}, {level: 'debug'}) +child.debug('debug!') // will log as the `level` property set the level to debug +``` + + +##### `options.msgPrefix` (String) + +Default: `undefined` + +The `msgPrefix` property allows you to specify a prefix for every message of the child logger. +By default, the parent prefix is inherited. +If the parent already has a prefix, the prefix of the parent and then the child will be displayed. + +```js +const logger = pino({ + msgPrefix: '[HTTP] ' +}) +logger.info('got new request!') +// > [HTTP] got new request! + +const child = logger.child({avengers: 'assemble'}, {msgPrefix: '[Proxy] '}) +child.info('message proxied!') +// > [HTTP] [Proxy] message proxied! +``` + +##### `options.redact` (Array | Object) + +Setting `options.redact` to an array or object will override the parent `redact` options. To remove `redact` options inherited from the parent logger set this value as an empty array (`[]`). + +```js +const logger = require('pino')({ redact: ['hello'] }) +logger.info({ hello: 'world' }) +// {"level":30,"time":1625794363403,"pid":67930,"hostname":"x","hello":"[Redacted]"} +const child = logger.child({ foo: 'bar' }, { redact: ['foo'] }) +logger.info({ hello: 'world' }) +// {"level":30,"time":1625794553558,"pid":67930,"hostname":"x","hello":"world", "foo": "[Redacted]" } +``` + +* See [`redact` option](#opt-redact) + +##### `options.serializers` (Object) + +Child loggers inherit the [serializers](#opt-serializers) from the parent logger. + +Setting the `serializers` key of the `options` object will override +any configured parent serializers. + +```js +const logger = require('pino')() +logger.info({test: 'will appear'}) +// {"level":30,"time":1531259759482,"pid":67930,"hostname":"x","test":"will appear"} +const child = logger.child({}, {serializers: {test: () => `child-only serializer`}}) +child.info({test: 'will be overwritten'}) +// {"level":30,"time":1531259784008,"pid":67930,"hostname":"x","test":"child-only serializer"} +``` + +* See [`serializers` option](#opt-serializers) +* See [pino.stdSerializers](#pino-stdSerializers) + + +### `logger.bindings()` + +Returns an object containing all the current bindings, cloned from the ones passed in via `logger.child()`. +```js +const child = logger.child({ foo: 'bar' }) +console.log(child.bindings()) +// { foo: 'bar' } +const anotherChild = child.child({ MIX: { IN: 'always' } }) +console.log(anotherChild.bindings()) +// { foo: 'bar', MIX: { IN: 'always' } } +``` + + +### `logger.setBindings(bindings)` + +Adds to the bindings of this logger instance. + +**Note:** Does not overwrite bindings. Can potentially result in duplicate keys in +log lines. + +* See [`bindings` parameter in `logger.child`](#logger-child-bindings) + + +### `logger.flush([cb])` + +Flushes the content of the buffer when using `pino.destination({ +sync: false })`. + +This is an asynchronous, best used as fire and forget, operation. + +The use case is primarily for asynchronous logging, which may buffer +log lines while others are being written. The `logger.flush` method can be +used to flush the logs +on a long interval, say ten seconds. Such a strategy can provide an +optimum balance between extremely efficient logging at high demand periods +and safer logging at low demand periods. + +If there is a need to wait for the logs to be flushed, a callback should be used. + +* See [`destination` parameter](#destination) +* See [Asynchronous Logging ⇗](/docs/asynchronous.md) + + +### `logger.level` (String) [Getter/Setter] + +Set this property to the desired logging level. + +The core levels and their values are as follows: + +| | | | | | | | | +|:-----------|-------|-------|------|------|-------|-------|---------:| +| **Level:** | trace | debug | info | warn | error | fatal | silent | +| **Value:** | 10 | 20 | 30 | 40 | 50 | 60 | Infinity | + +The logging level is a *minimum* level based on the associated value of that level. + +For instance if `logger.level` is `info` *(30)* then `info` *(30)*, `warn` *(40)*, `error` *(50)*, and `fatal` *(60)* log methods will be enabled but the `trace` *(10)* and `debug` *(20)* methods, being less than 30, will not. + +The `silent` logging level is a specialized level that will disable all logging, +the `silent` log method is a noop function. + + +### `logger.isLevelEnabled(level)` + +A utility method for determining if a given log level will write to the destination. + +#### `level` (String) + +The given level to check against: + +```js +if (logger.isLevelEnabled('debug')) logger.debug('conditional log') +``` + +#### `levelLabel` (String) + +Defines the method name of the new level. + +* See [`logger.level`](#level) + +#### `levelValue` (Number) + +Defines the associated minimum threshold value for the level, and +therefore where it sits in order of priority among other levels. + +* See [`logger.level`](#level) + + +### `logger.levelVal` (Number) + +Supplies the integer value for the current logging level. + +```js +if (logger.levelVal === 30) { + console.log('logger level is `info`') +} +``` + + +### `logger.levels` (Object) + +Levels are mapped to values to determine the minimum threshold that a +logging method should be enabled at (see [`logger.level`](#level)). + +The `logger.levels` property holds the mappings between levels and values, +and vice versa. + +```sh +$ node -p "require('pino')().levels" +``` + +```js +{ labels: + { '10': 'trace', + '20': 'debug', + '30': 'info', + '40': 'warn', + '50': 'error', + '60': 'fatal' }, + values: + { fatal: 60, error: 50, warn: 40, info: 30, debug: 20, trace: 10 } } +``` + +* See [`logger.level`](#level) + + +### logger\[Symbol.for('pino.serializers')\] + +Returns the serializers as applied to the current logger instance. If a child logger did not +register its own serializer upon instantiation the serializers of the parent will be returned. + + +### Event: 'level-change' + +The logger instance is also an [`EventEmitter ⇗`](https://nodejs.org/dist/latest/docs/api/events.html#events_class_eventemitter) + +A listener function can be attached to a logger via the `level-change` event + +The listener is passed five arguments: + +* `levelLabel` – the new level string, e.g `trace` +* `levelValue` – the new level number, e.g `10` +* `previousLevelLabel` – the prior level string, e.g `info` +* `previousLevelValue` – the prior level number, e.g `30` +* `logger` – the logger instance from which the event originated + +```js +const logger = require('pino')() +logger.on('level-change', (lvl, val, prevLvl, prevVal) => { + console.log('%s (%d) was changed to %s (%d)', prevLvl, prevVal, lvl, val) +}) +logger.level = 'trace' // trigger event +``` + +Please note that due to a [known bug](https://github.com/pinojs/pino/issues/1006), every `logger.child()` call will +fire a `level-change` event. These events can be ignored by writing an event handler like: + +```js +const logger = require('pino')() +logger.on('level-change', function (lvl, val, prevLvl, prevVal, instance) { + if (logger !== instance) { + return + } + console.log('%s (%d) was changed to %s (%d)', prevLvl, prevVal, lvl, val) +}) +logger.child({}); // trigger an event by creating a child instance, notice no console.log +logger.level = 'trace' // trigger event using actual value change, notice console.log +``` + + +### `logger.version` (String) + +Exposes the Pino package version. Also available on the exported `pino` function. + +* See [`pino.version`](#pino-version) + + +### `logger.msgPrefix` (String|Undefined) + +Exposes the cumulative `msgPrefix` of the logger. + +* See [`options.msgPrefix`](#options-msgPrefix) + +## Statics + + +### `pino.destination([opts]) => SonicBoom` + +Create a Pino Destination instance: a stream-like object with +significantly more throughput than a standard Node.js stream. + +```js +const pino = require('pino') +const logger = pino(pino.destination('./my-file')) +const logger2 = pino(pino.destination()) +const logger3 = pino(pino.destination({ + dest: './my-file', + minLength: 4096, // Buffer before writing + sync: false // Asynchronous logging, the default +})) +const logger4 = pino(pino.destination({ + dest: './my-file2', + sync: true // Synchronous logging +})) +``` + +The `pino.destination` method may be passed a file path or a numerical file descriptor. +By default, `pino.destination` will use `process.stdout.fd` (1) as the file descriptor. + +`pino.destination` is implemented on [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom). + +A `pino.destination` instance can also be used to reopen closed files +(for example, for some log rotation scenarios), see [Reopening log files](/docs/help.md#reopening). + +* See [`destination` parameter](#destination) +* See [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom) +* See [Reopening log files](/docs/help.md#reopening) +* See [Asynchronous Logging ⇗](/docs/asynchronous.md) + + +### `pino.transport(options) => ThreadStream` + +Create a stream that routes logs to a worker thread that +wraps around a [Pino Transport](/docs/transports.md). + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'some-transport', + options: { some: 'options for', the: 'transport' } +}) +pino(transport) +``` + +Multiple transports may also be defined, and specific levels can be logged to each transport: + +```js +const pino = require('pino') +const transport = pino.transport({ + targets: [{ + level: 'info', + target: 'pino-pretty' // must be installed separately + }, { + level: 'trace', + target: 'pino/file', + options: { destination: '/path/to/store/logs' } + }] +}) +pino(transport) +``` + +A pipeline could also be created to transform log lines _before_ sending them: + +```js +const pino = require('pino') +const transport = pino.transport({ + pipeline: [{ + target: 'pino-syslog' // must be installed separately + }, { + target: 'pino-socket' // must be installed separately + }] +}) +pino(transport) +``` + +Multiple transports can now be defined to include pipelines: + +```js +const pino = require('pino') +const transport = pino.transport({ + targets: [{ + level: 'info', + target: 'pino-pretty' // must be installed separately + }, { + level: 'trace', + target: 'pino/file', + options: { destination: '/path/to/store/logs' } + }, { + pipeline: [{ + target: 'pino-syslog' // must be installed separately + }, { + target: 'pino-socket' // must be installed separately + }] + } + ] +}) +pino(transport) +``` + +If `WeakRef`, `WeakMap`, and `FinalizationRegistry` are available in the current runtime (v14.5.0+), then the thread +will be automatically terminated in case the stream or logger goes out of scope. +The `transport()` function adds a listener to `process.on('beforeExit')` and `process.on('exit')` to ensure the worker +is flushed and all data synced before the process exits. + +Note that calling `process.exit()` on the main thread will stop the event loop on the main thread from turning. As a result, +using `console.log` and `process.stdout` after the main thread called `process.exit()` will not produce any output. + +If you are embedding/integrating pino within your framework, you will need to make pino aware of the script that is calling it, +like so: + +```js +const pino = require('pino') +const getCaller = require('get-caller-file') + +module.exports = function build () { + const logger = pino({ + transport: { + caller: getCaller(), + target: 'transport', + options: { destination: './destination' } + } + }) + return logger +} +``` + +Note that _any `'error'`_ event emitted by the transport must be considered a fatal error and the process must be terminated. +Error events are not recoverable. + +For more on transports, how they work, and how to create them see the [`Transports documentation`](/docs/transports.md). + +* See [`Transports`](/docs/transports.md) +* See [`thread-stream` ⇗](https://github.com/mcollina/thread-stream) + +#### Options + +* `target`: The transport to pass logs through. This may be an installed module name or an absolute path. +* `options`: An options object which is serialized (see [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)), passed to the worker thread, parsed and then passed to the exported transport function. +* `worker`: [Worker thread](https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options) configuration options. Additionally, the `worker` option supports `worker.autoEnd`. If this is set to `false` logs will not be flushed on process exit. It is then up to the developer to call `transport.end()` to flush logs. +* `targets`: May be specified instead of `target`. Must be an array of transport configurations and/or pipelines. Transport configurations include the aforementioned `options` and `target` options plus a `level` option which will send only logs above a specified level to a transport. +* `pipeline`: May be specified instead of `target`. Must be an array of transport configurations. Transport configurations include the aforementioned `options` and `target` options. All intermediate steps in the pipeline _must_ be `Transform` streams and not `Writable`. +* `dedupe`: See [pino.multistream options](#pino-multistream) + + + +### `pino.multistream(streamsArray, opts) => MultiStreamRes` + +Create a stream composed by multiple destination streams and returns an +object implementing the [MultiStreamRes](#multistreamres) interface. + +```js +var fs = require('node:fs') +var pino = require('pino') +var pretty = require('pino-pretty') +var streams = [ + {stream: fs.createWriteStream('/tmp/info.stream.out')}, + {stream: pretty() }, + {level: 'debug', stream: fs.createWriteStream('/tmp/debug.stream.out')}, + {level: 'fatal', stream: fs.createWriteStream('/tmp/fatal.stream.out')} +] + +var log = pino({ + level: 'debug' // this MUST be set at the lowest level of the + // destinations +}, pino.multistream(streams)) + +log.debug('this will be written to /tmp/debug.stream.out') +log.info('this will be written to /tmp/debug.stream.out and /tmp/info.stream.out') +log.fatal('this will be written to /tmp/debug.stream.out, /tmp/info.stream.out and /tmp/fatal.stream.out') +``` + +In order for `multistream` to work, the log level __must__ be set to the lowest level used in the streams array. Default is `info`. + +#### Options + +* `levels`: Pass custom log level definitions to the instance as an object. + ++ `dedupe`: Set this to `true` to send logs only to the stream with the higher level. Default: `false` + + `dedupe` flag can be useful for example when using `pino.multistream` to redirect `error` logs to `process.stderr` and others to `process.stdout`: + + ```js + var pino = require('pino') + var multistream = pino.multistream + var streams = [ + {level: 'debug', stream: process.stdout}, + {level: 'error', stream: process.stderr}, + ] + + var opts = { + levels: { + silent: Infinity, + fatal: 60, + error: 50, + warn: 50, + info: 30, + debug: 20, + trace: 10 + }, + dedupe: true, + } + + var log = pino({ + level: 'debug' // this MUST be set at the lowest level of the + // destinations + }, multistream(streams, opts)) + + log.debug('this will be written ONLY to process.stdout') + log.info('this will be written ONLY to process.stdout') + log.error('this will be written ONLY to process.stderr') + log.fatal('this will be written ONLY to process.stderr') + ``` + + +### `pino.stdSerializers` (Object) + +The `pino.stdSerializers` object provides functions for serializing objects common to many projects. The standard serializers are directly imported from [pino-std-serializers](https://github.com/pinojs/pino-std-serializers). + +* See [pino-std-serializers ⇗](https://github.com/pinojs/pino-std-serializers) + + +### `pino.stdTimeFunctions` (Object) + +The [`timestamp`](#opt-timestamp) option can accept a function that determines the +`timestamp` value in a log line. + +The `pino.stdTimeFunctions` object provides a very small set of common functions for generating the +`timestamp` property. These consist of the following + +* `pino.stdTimeFunctions.epochTime`: Milliseconds since Unix epoch (Default) +* `pino.stdTimeFunctions.unixTime`: Seconds since Unix epoch +* `pino.stdTimeFunctions.nullTime`: Clears timestamp property (Used when `timestamp: false`) +* `pino.stdTimeFunctions.isoTime`: ISO 8601-formatted time in UTC + +* See [`timestamp` option](#opt-timestamp) + + +### `pino.symbols` (Object) + +For integration purposes with ecosystem and third-party libraries `pino.symbols` +exposes the symbols used to hold non-public state and methods on the logger instance. + +Access to the symbols allows logger state to be adjusted, and methods to be overridden or +proxied for performant integration where necessary. + +The `pino.symbols` object is intended for library implementers and shouldn't be utilized +for general use. + + +### `pino.version` (String) + +Exposes the Pino package version. Also available on the logger instance. + +* See [`logger.version`](#version) + +## Interfaces + + +### `MultiStreamRes` + Properties: + + * `write(data)` + - `data` Object | string + - Returns: void + + Write `data` onto the streams held by the current instance. + * `add(dest)` + - `dest` [StreamEntry](#streamentry) | [DestinationStream](#destinationstream) + - Returns: [MultiStreamRes](#multistreamres) + + Add `dest` stream to the array of streams of the current instance. + * `flushSync()` + - Returns: `undefined` + + Call `flushSync` on each stream held by the current instance. + + * `lastId` + - number + + The ID assigned to the last stream assigned to the current instance. + * `minLevel` + - number + + The minimum level amongst all the streams held by the current instance. + + * `remove(id)` + - `id` [number] + + Removes a stream from the array of streams of the current instance using its assigned ID. + * `streams` + - Returns: [StreamEntry[]](#streamentry) + + The array of streams currently held by the current instance. + * `clone(level)` + - `level` [Level](#level-1) + - Returns: [MultiStreamRes](#multistreamres) + + Returns a cloned object of the current instance but with the provided `level`. + +### `StreamEntry` + Properties: + + * `stream` + - DestinationStream + * `level` + - Optional: [Level](#level-1) + +### `DestinationStream` + Properties: + + * `write(msg)` + - `msg` string + +## Types +### `Level` + + * Values: `"fatal"` | `"error"` | `"warn"` | `"info"` | `"debug"` | `"trace"` diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/asynchronous.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/asynchronous.md new file mode 100644 index 0000000000000000000000000000000000000000..ec8af84e80f36345abbda4d6cd249103f88b03c0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/asynchronous.md @@ -0,0 +1,40 @@ +# Asynchronous Logging + +Asynchronous logging enables the minimum overhead of Pino. +Asynchronous logging works by buffering log messages and writing them in larger chunks. + +```js +const pino = require('pino') +const logger = pino(pino.destination({ + dest: './my-file', // omit for stdout + minLength: 4096, // Buffer before writing + sync: false // Asynchronous logging +})) +``` + +It's always possible to turn on synchronous logging by passing `sync: true`. +In this mode of operation, log messages are directly written to the +output stream as the messages are generated with a _blocking_ operation. + +* See [`pino.destination`](/docs/api.md#pino-destination) +* `pino.destination` is implemented on [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom). + +### AWS Lambda + +Asynchronous logging is disabled by default on AWS Lambda or any other environment +that modifies `process.stdout`. If forcefully turned on, we recommend calling `dest.flushSync()` at the end +of each function execution to avoid losing data. + +## Caveats + +Asynchronous logging has a couple of important caveats: + +* As opposed to the synchronous mode, there is not a one-to-one relationship between + calls to logging methods (e.g. `logger.info`) and writes to a log file +* There is a possibility of the most recently buffered log messages being lost + in case of a system failure, e.g. a power cut. + +See also: + +* [`pino.destination` API](/docs/api.md#pino-destination) +* [`destination` parameter](/docs/api.md#destination) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/benchmarks.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/benchmarks.md new file mode 100644 index 0000000000000000000000000000000000000000..6b6e7698a578c9194398b90eab780249aff3beed --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/benchmarks.md @@ -0,0 +1,55 @@ + +# Benchmarks + +`pino.info('hello world')`: + +``` + +BASIC benchmark averages +Bunyan average: 377.434ms +Winston average: 270.249ms +Bole average: 172.690ms +Debug average: 220.527ms +LogLevel average: 222.802ms +Pino average: 114.801ms +PinoMinLength average: 70.968ms +PinoNodeStream average: 159.192ms + +``` + +`pino.info({'hello': 'world'})`: + +``` + +OBJECT benchmark averages +BunyanObj average: 410.379ms +WinstonObj average: 273.120ms +BoleObj average: 185.069ms +LogLevelObject average: 433.425ms +PinoObj average: 119.315ms +PinoMinLengthObj average: 76.968ms +PinoNodeStreamObj average: 164.268ms + +``` + +`pino.info(aBigDeeplyNestedObject)`: + +``` + +DEEP-OBJECT benchmark averages +BunyanDeepObj average: 1.839ms +WinstonDeepObj average: 5.604ms +BoleDeepObj average: 3.422ms +LogLevelDeepObj average: 11.716ms +PinoDeepObj average: 2.256ms +PinoMinLengthDeepObj average: 2.240ms +PinoNodeStreamDeepObj average: 2.595ms + +``` + +`pino.info('hello %s %j %d', 'world', {obj: true}, 4, {another: 'obj'})`: + +For a fair comparison, [LogLevel](http://npm.im/loglevel) was extended +to include a timestamp and [bole](http://npm.im/bole) had +`fastTime` mode switched on. + diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/browser.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/browser.md new file mode 100644 index 0000000000000000000000000000000000000000..360c993753b425ea3dd50101b8b92b5da2129c9d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/browser.md @@ -0,0 +1,242 @@ +# Browser API + +Pino is compatible with [`browserify`](https://npm.im/browserify) for browser-side usage: + +This can be useful with isomorphic/universal JavaScript code. + +By default, in the browser, +`pino` uses corresponding [Log4j](https://en.wikipedia.org/wiki/Log4j) `console` methods (`console.error`, `console.warn`, `console.info`, `console.debug`, `console.trace`) and uses `console.error` for any `fatal` level logs. + +## Options + +Pino can be passed a `browser` object in the options object, +which can have the following properties: + +### `asObject` (Boolean) + +```js +const pino = require('pino')({browser: {asObject: true}}) +``` + +The `asObject` option will create a pino-like log object instead of +passing all arguments to a console method, for instance: + +```js +pino.info('hi') // creates and logs {msg: 'hi', level: 30, time: } +``` + +When `write` is set, `asObject` will always be `true`. + +### `asObjectBindingsOnly` (Boolean) + +```js +const pino = require('pino')({browser: {asObjectBindingsOnly: true}}) +``` + +The `asObjectBindingsOnly` option is similar to `asObject` but will keep the message +and arguments unformatted. This allows to defer formatting the message to the +actual call to `console` methods, where browsers then have richer formatting in +their devtools than when pino will format the message to a string first. + +```js +pino.info('hello %s', 'world') // creates and logs {level: 30, time: }, 'hello %s', 'world' +``` + +### `formatters` (Object) + +An object containing functions for formatting the shape of the log lines. When provided, it enables the logger to produce a pino-like log object with customized formatting. Currently, it supports formatting for the `level` object only. + +##### `level` + +Changes the shape of the log level. The default shape is `{ level: number }`. +The function takes two arguments, the label of the level (e.g. `'info'`) +and the numeric value (e.g. `30`). + +```js +const formatters = { + level (label, number) { + return { level: number } + } +} +``` + + +### `write` (Function | Object) + +Instead of passing log messages to `console.log` they can be passed to +a supplied function. + +If `write` is set to a single function, all logging objects are passed +to this function. + +```js +const pino = require('pino')({ + browser: { + write: (o) => { + // do something with o + } + } +}) +``` + +If `write` is an object, it can have methods that correspond to the +levels. When a message is logged at a given level, the corresponding +method is called. If a method isn't present, the logging falls back +to using the `console`. + + +```js +const pino = require('pino')({ + browser: { + write: { + info: function (o) { + //process info log object + }, + error: function (o) { + //process error log object + } + } + } +}) +``` + +### `serialize`: (Boolean | Array) + +The serializers provided to `pino` are ignored by default in the browser, including +the standard serializers provided with Pino. Since the default destination for log +messages is the console, values such as `Error` objects are enhanced for inspection, +which they otherwise wouldn't be if the Error serializer was enabled. + +We can turn all serializers on, + +```js +const pino = require('pino')({ + browser: { + serialize: true + } +}) +``` + +Or we can selectively enable them via an array: + +```js +const pino = require('pino')({ + serializers: { + custom: myCustomSerializer, + another: anotherSerializer + }, + browser: { + serialize: ['custom'] + } +}) +// following will apply myCustomSerializer to the custom property, +// but will not apply anotherSerializer to another key +pino.info({custom: 'a', another: 'b'}) +``` + +When `serialize` is `true` the standard error serializer is also enabled (see https://github.com/pinojs/pino/blob/master/docs/api.md#stdSerializers). +This is a global serializer, which will apply to any `Error` objects passed to the logger methods. + +If `serialize` is an array the standard error serializer is also automatically enabled, it can +be explicitly disabled by including a string in the serialize array: `!stdSerializers.err`, like so: + +```js +const pino = require('pino')({ + serializers: { + custom: myCustomSerializer, + another: anotherSerializer + }, + browser: { + serialize: ['!stdSerializers.err', 'custom'] //will not serialize Errors, will serialize `custom` keys + } +}) +``` + +The `serialize` array also applies to any child logger serializers (see https://github.com/pinojs/pino/blob/master/docs/api.md#discussion-2 +for how to set child-bound serializers). + +Unlike server pino the serializers apply to every object passed to the logger method, +if the `asObject` option is `true`, this results in the serializers applying to the +first object (as in server pino). + +For more info on serializers see https://github.com/pinojs/pino/blob/master/docs/api.md#mergingobject. + +### `transmit` (Object) + +An object with `send` and `level` properties. + +The `transmit.level` property specifies the minimum level (inclusive) of when the `send` function +should be called, if not supplied the `send` function be called based on the main logging `level` +(set via `options.level`, defaulting to `info`). + +The `transmit` object must have a `send` function which will be called after +writing the log message. The `send` function is passed the level of the log +message and a `logEvent` object. + +The `logEvent` object is a data structure representing a log message, it represents +the arguments passed to a logger statement, the level +at which they were logged, and the hierarchy of child bindings. + +The `logEvent` format is structured like so: + +```js +{ + ts = Number, + messages = Array, + bindings = Array, + level: { label = String, value = Number} +} +``` + +The `ts` property is a Unix epoch timestamp in milliseconds, the time is taken from the moment the +logger method is called. + +The `messages` array is all arguments passed to logger method, (for instance `logger.info('a', 'b', 'c')` +would result in `messages` array `['a', 'b', 'c']`). + +The `bindings` array represents each child logger (if any), and the relevant bindings. +For instance, given `logger.child({a: 1}).child({b: 2}).info({c: 3})`, the bindings array +would hold `[{a: 1}, {b: 2}]` and the `messages` array would be `[{c: 3}]`. The `bindings` +are ordered according to their position in the child logger hierarchy, with the lowest index +being the top of the hierarchy. + +By default, serializers are not applied to log output in the browser, but they will *always* be +applied to `messages` and `bindings` in the `logEvent` object. This allows us to ensure a consistent +format for all values between server and client. + +The `level` holds the label (for instance `info`), and the corresponding numerical value +(for instance `30`). This could be important in cases where client-side level values and +labels differ from server-side. + +The point of the `send` function is to remotely record log messages: + +```js +const pino = require('pino')({ + browser: { + transmit: { + level: 'warn', + send: function (level, logEvent) { + if (level === 'warn') { + // maybe send the logEvent to a separate endpoint + // or maybe analyze the messages further before sending + } + // we could also use the `logEvent.level.value` property to determine + // numerical value + if (logEvent.level.value >= 50) { // covers error and fatal + + // send the logEvent somewhere + } + } + } + } +}) +``` + +### `disabled` (Boolean) + +```js +const pino = require('pino')({browser: {disabled: true}}) +``` + +The `disabled` option will disable logging in browser if set +to `true`, by default it is set to `false`. diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/bundling.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/bundling.md new file mode 100644 index 0000000000000000000000000000000000000000..c2aee8f0eb567c637064590a4206415118febbd2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/bundling.md @@ -0,0 +1,40 @@ +# Bundling + +Due to its internal architecture based on Worker Threads, it is not possible to bundle Pino *without* generating additional files. + +In particular, a bundler must ensure that the following files are also bundled separately: + +* `lib/worker.js` from the `thread-stream` dependency +* `file.js` +* `lib/worker.js` +* Any transport used by the user (like `pino-pretty`) + +Once the files above have been generated, the bundler must also add information about the files above by injecting a code that sets `__bundlerPathsOverrides` in the `globalThis` object. + +The variable is an object whose keys are an identifier for the files and the values are the paths of files relative to the currently bundle files. + +Example: + +```javascript +// Inject this using your bundle plugin +globalThis.__bundlerPathsOverrides = { + 'thread-stream-worker': pinoWebpackAbsolutePath('./thread-stream-worker.js') + 'pino/file': pinoWebpackAbsolutePath('./pino-file.js'), + 'pino-worker': pinoWebpackAbsolutePath('./pino-worker.js'), + 'pino-pretty': pinoWebpackAbsolutePath('./pino-pretty.js'), +}; +``` + +Note that `pino/file`, `pino-worker` and `thread-stream-worker` are required identifiers. Other identifiers are possible based on the user configuration. + +## Webpack Plugin + +If you are a Webpack user, you can achieve this with [pino-webpack-plugin](https://github.com/pinojs/pino-webpack-plugin) without manual configuration of `__bundlerPathsOverrides`; however, you still need to configure it manually if you are using other bundlers. + +## Esbuild Plugin + +[esbuild-plugin-pino](https://github.com/davipon/esbuild-plugin-pino) is the esbuild plugin to generate extra pino files for bundling. + +## Bun Plugin + +[bun-plugin-pino](https://github.com/vktrl/bun-plugin-pino) is the Bun plugin to generate extra pino files for bundling. \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/child-loggers.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/child-loggers.md new file mode 100644 index 0000000000000000000000000000000000000000..13b6ebc2db044b5d57132248f8d643f953326318 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/child-loggers.md @@ -0,0 +1,95 @@ +# Child loggers + +Let's assume we want to have `"module":"foo"` added to every log within a +module `foo.js`. + +To accomplish this, simply use a child logger: + +```js +'use strict' +// imports a pino logger instance of `require('pino')()` +const parentLogger = require('./lib/logger') +const log = parentLogger.child({module: 'foo'}) + +function doSomething () { + log.info('doSomething invoked') +} + +module.exports = { + doSomething +} +``` + +## Cost of child logging + +Child logger creation is fast: + +``` +benchBunyanCreation*10000: 564.514ms +benchBoleCreation*10000: 283.276ms +benchPinoCreation*10000: 258.745ms +benchPinoExtremeCreation*10000: 150.506ms +``` + +Logging through a child logger has little performance penalty: + +``` +benchBunyanChild*10000: 556.275ms +benchBoleChild*10000: 288.124ms +benchPinoChild*10000: 231.695ms +benchPinoExtremeChild*10000: 122.117ms +``` + +Logging via the child logger of a child logger also has negligible overhead: + +``` +benchBunyanChildChild*10000: 559.082ms +benchPinoChildChild*10000: 229.264ms +benchPinoExtremeChildChild*10000: 127.753ms +``` + +## Duplicate keys caveat + +Naming conflicts can arise between child loggers and +children of child loggers. + +This isn't as bad as it sounds, even if the same keys between +parent and child loggers are used, Pino resolves the conflict in the sanest way. + +For example, consider the following: + +```js +const pino = require('pino') +pino(pino.destination('./my-log')) + .child({a: 'property'}) + .child({a: 'prop'}) + .info('howdy') +``` + +```sh +$ cat my-log +{"pid":95469,"hostname":"MacBook-Pro-3.home","level":30,"msg":"howdy","time":1459534114473,"a":"property","a":"prop"} +``` + +Notice how there are two keys named `a` in the JSON output. The sub-child's properties +appear after the parent child properties. + +At some point, the logs will most likely be processed (for instance with a [transport](transports.md)), +and this generally involves parsing. `JSON.parse` will return an object where the conflicting +namespace holds the final value assigned to it: + +```sh +$ cat my-log | node -e "process.stdin.once('data', (line) => console.log(JSON.stringify(JSON.parse(line))))" +{"pid":95469,"hostname":"MacBook-Pro-3.home","level":30,"msg":"howdy","time":"2016-04-01T18:08:34.473Z","a":"prop"} +``` + +Ultimately the conflict is resolved by taking the last value, which aligns with Bunyan's child logging +behavior. + +There may be cases where this edge case becomes problematic if a JSON parser with alternative behavior +is used to process the logs. It's recommended to be conscious of namespace conflicts with child loggers, +in light of an expected log processing approach. + +One of Pino's performance tricks is to avoid building objects and stringifying +them, so we're building strings instead. This is why duplicate keys between +parents and children will end up in the log output. diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/ecosystem.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/ecosystem.md new file mode 100644 index 0000000000000000000000000000000000000000..5356dc0a28dc99afd57088aec669ce55ad7a92e1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/ecosystem.md @@ -0,0 +1,84 @@ +# Pino Ecosystem + +This is a list of ecosystem modules that integrate with `pino`. + +Modules listed under [Core](#core) are maintained by the Pino team. Modules +listed under [Community](#community) are maintained by independent community +members. + +Please send a PR to add new modules! + + +## Core + +### Frameworks ++ [`express-pino-logger`](https://github.com/pinojs/express-pino-logger): use +Pino to log requests within [express](https://expressjs.com/). ++ [`koa-pino-logger`](https://github.com/pinojs/koa-pino-logger): use Pino to +log requests within [Koa](https://koajs.com/). ++ [`restify-pino-logger`](https://github.com/pinojs/restify-pino-logger): use +Pino to log requests within [restify](http://restify.com/). ++ [`rill-pino-logger`](https://github.com/pinojs/rill-pino-logger): use Pino as +the logger for the [Rill framework](https://rill.site/). + +### Utilities ++ [`pino-arborsculpture`](https://github.com/pinojs/pino-arborsculpture): change +log levels at runtime. ++ [`pino-caller`](https://github.com/pinojs/pino-caller): add callsite to the log line. ++ [`pino-clf`](https://github.com/pinojs/pino-clf): reformat Pino logs into +Common Log Format. ++ [`pino-debug`](https://github.com/pinojs/pino-debug): use Pino to interpret +[`debug`](https://npm.im/debug) logs. ++ [`pino-elasticsearch`](https://github.com/pinojs/pino-elasticsearch): send +Pino logs to an Elasticsearch instance. ++ [`pino-eventhub`](https://github.com/pinojs/pino-eventhub): send Pino logs +to an [Event Hub](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-what-is-event-hubs). ++ [`pino-filter`](https://github.com/pinojs/pino-filter): filter Pino logs in +the same fashion as the [`debug`](https://npm.im/debug) module. ++ [`pino-gelf`](https://github.com/pinojs/pino-gelf): reformat Pino logs into +GELF format for Graylog. ++ [`pino-hapi`](https://github.com/pinojs/hapi-pino): use Pino as the logger +for [Hapi](https://hapijs.com/). ++ [`pino-http`](https://github.com/pinojs/pino-http): easily use Pino to log +requests with the core `http` module. ++ [`pino-http-print`](https://github.com/pinojs/pino-http-print): reformat Pino +logs into traditional [HTTPD](https://httpd.apache.org/) style request logs. ++ [`pino-mongodb`](https://github.com/pinojs/pino-mongodb): store Pino logs +in a MongoDB database. ++ [`pino-multi-stream`](https://github.com/pinojs/pino-multi-stream): send +logs to multiple destination streams (slow!). ++ [`pino-noir`](https://github.com/pinojs/pino-noir): redact sensitive information +in logs. ++ [`pino-pretty`](https://github.com/pinojs/pino-pretty): basic prettifier to +make log lines human-readable. ++ [`pino-socket`](https://github.com/pinojs/pino-socket): send logs to TCP or UDP +destinations. ++ [`pino-std-serializers`](https://github.com/pinojs/pino-std-serializers): the +core object serializers used within Pino. ++ [`pino-syslog`](https://github.com/pinojs/pino-syslog): reformat Pino logs +to standard syslog format. ++ [`pino-tee`](https://github.com/pinojs/pino-tee): pipe Pino logs into files +based upon log levels. ++ [`pino-test`](https://github.com/pinojs/pino-test): a set of utilities for +verifying logs generated by the Pino logger. ++ [`pino-toke`](https://github.com/pinojs/pino-toke): reformat Pino logs +according to a given format string. + + + +## Community + ++ [`@google-cloud/pino-logging-gcp-config`](https://www.npmjs.com/package/@google-cloud/pino-logging-gcp-config): Config helper and formatter to output [Google Cloud Platform Structured Logging](https://cloud.google.com/logging/docs/structured-logging) ++ [`@newrelic/pino-enricher`](https://github.com/newrelic/newrelic-node-log-extensions/blob/main/packages/pino-log-enricher): a log customization to add New Relic context to use [Logs In Context](https://docs.newrelic.com/docs/logs/logs-context/logs-in-context/) ++ [`cloud-pine`](https://github.com/metcoder95/cloud-pine): transport that provides abstraction and compatibility with [`@google-cloud/logging`](https://www.npmjs.com/package/@google-cloud/logging). ++ [`cls-proxify`](https://github.com/keenondrums/cls-proxify): integration of pino and [CLS](https://github.com/jeff-lewis/cls-hooked). Useful for creating dynamically configured child loggers (e.g. with added trace ID) for each request. ++ [`crawlee-pino`](https://github.com/imyelo/crawlee-pino): use Pino to log within Crawlee ++ [`pino-colada`](https://github.com/lrlna/pino-colada): cute ndjson formatter for pino. ++ [`pino-dev`](https://github.com/dnjstrom/pino-dev): simple prettifier for pino with built-in support for common ecosystem packages. ++ [`pino-fluentd`](https://github.com/davidedantonio/pino-fluentd): send Pino logs to Elasticsearch, +MongoDB, and many [others](https://www.fluentd.org/dataoutputs) via Fluentd. ++ [`pino-lambda`](https://github.com/FormidableLabs/pino-lambda): log transport for cloudwatch support inside aws-lambda ++ [`pino-pretty-min`](https://github.com/unjello/pino-pretty-min): a minimal +prettifier inspired by the [logrus](https://github.com/sirupsen/logrus) logger. ++ [`pino-rotating-file`](https://github.com/homeaway/pino-rotating-file): a hapi-pino log transport for splitting logs into separate, automatically rotating files. ++ [`pino-tiny`](https://github.com/holmok/pino-tiny): a tiny (and extensible?) little log formatter for pino. diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/help.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/help.md new file mode 100644 index 0000000000000000000000000000000000000000..623d0a2a4712fa2b5d24e473790d5b699ee89eef --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/help.md @@ -0,0 +1,345 @@ +# Help + +* [Log rotation](#rotate) +* [Reopening log files](#reopening) +* [Saving to multiple files](#multiple) +* [Log filtering](#filter-logs) +* [Transports and systemd](#transport-systemd) +* [Log to different streams](#multi-stream) +* [Duplicate keys](#dupe-keys) +* [Log levels as labels instead of numbers](#level-string) +* [Pino with `debug`](#debug) +* [Unicode and Windows terminal](#windows) +* [Mapping Pino Log Levels to Google Cloud Logging (Stackdriver) Severity Levels](#stackdriver) +* [Using Grafana Loki to evaluate pino logs in a kubernetes cluster](#grafana-loki) +* [Avoid Message Conflict](#avoid-message-conflict) +* [Best performance for logging to `stdout`](#best-performance-for-stdout) +* [Testing](#testing) + + +## Log rotation + +Use a separate tool for log rotation: +We recommend [logrotate](https://github.com/logrotate/logrotate). +Consider we output our logs to `/var/log/myapp.log` like so: + +``` +$ node server.js > /var/log/myapp.log +``` + +We would rotate our log files with logrotate, by adding the following to `/etc/logrotate.d/myapp`: + +``` +/var/log/myapp.log { + su root + daily + rotate 7 + delaycompress + compress + notifempty + missingok + copytruncate +} +``` + +The `copytruncate` configuration has a very slight possibility of lost log lines due +to a gap between copying and truncating - the truncate may occur after additional lines +have been written. To perform log rotation without `copytruncate`, see the [Reopening log files](#reopening) +help. + + +## Reopening log files + +In cases where a log rotation tool doesn't offer copy-truncate capabilities, +or where using them is deemed inappropriate, `pino.destination` +can reopen file paths after a file has been moved away. + +One way to use this is to set up a `SIGUSR2` or `SIGHUP` signal handler that +reopens the log file destination, making sure to write the process PID out +somewhere so the log rotation tool knows where to send the signal. + +```js +// write the process pid to a well known location for later +const fs = require('node:fs') +fs.writeFileSync('/var/run/myapp.pid', process.pid) + +const dest = pino.destination('/log/file') +const logger = require('pino')(dest) +process.on('SIGHUP', () => dest.reopen()) +``` + +The log rotation tool can then be configured to send this signal to the process +after a log rotation event has occurred. + +Given a similar scenario as in the [Log rotation](#rotate) section a basic +`logrotate` config that aligns with this strategy would look similar to the following: + +``` +/var/log/myapp.log { + su root + daily + rotate 7 + delaycompress + compress + notifempty + missingok + postrotate + kill -HUP `cat /var/run/myapp.pid` + endscript +} +``` + + +## Saving to multiple files + +See [`pino.multistream`](/docs/api.md#pino-multistream). + + +## Log Filtering +The Pino philosophy advocates common, preexisting, system utilities. + +Some recommendations in line with this philosophy are: + +1. Use [`grep`](https://linux.die.net/man/1/grep): + ```sh + $ # View all "INFO" level logs + $ node app.js | grep '"level":30' + ``` +1. Use [`jq`](https://stedolan.github.io/jq/): + ```sh + $ # View all "ERROR" level logs + $ node app.js | jq 'select(.level == 50)' + ``` + + +## Transports and systemd +`systemd` makes it complicated to use pipes in services. One method for overcoming +this challenge is to use a subshell: + +``` +ExecStart=/bin/sh -c '/path/to/node app.js | pino-transport' +``` + + +## Log to different streams + +Pino's default log destination is the singular destination of `stdout`. While +not recommended for performance reasons, multiple destinations can be targeted +by using [`pino.multistream`](/docs/api.md#pino-multistream). + +In this example, we use `stderr` for `error` level logs and `stdout` as default +for all other levels (e.g. `debug`, `info`, and `warn`). + +```js +const pino = require('pino') +var streams = [ + {level: 'debug', stream: process.stdout}, + {level: 'error', stream: process.stderr}, + {level: 'fatal', stream: process.stderr} +] + +const logger = pino({ + name: 'my-app', + level: 'debug', // must be the lowest level of all streams +}, pino.multistream(streams)) +``` + + +## How Pino handles duplicate keys + +Duplicate keys are possibly when a child logger logs an object with a key that +collides with a key in the child loggers bindings. + +See the [child logger duplicate keys caveat](/docs/child-loggers.md#duplicate-keys-caveat) +for information on this is handled. + + +## Log levels as labels instead of numbers +Pino log lines are meant to be parsable. Thus, Pino's default mode of operation +is to print the level value instead of the string name. +However, you can use the [`formatters`](/docs/api.md#formatters-object) option +with a [`level`](/docs/api.md#level) function to print the string name instead of the level value : + +```js +const pino = require('pino') + +const log = pino({ + formatters: { + level: (label) => { + return { + level: label + } + } + } +}) + +log.info('message') + +// {"level":"info","time":1661632832200,"pid":18188,"hostname":"foo","msg":"message"} +``` + +Although it works, we recommend using one of these options instead if you are able: + +1. If the only change desired is the name then a transport can be used. One such +transport is [`pino-text-level-transport`](https://npm.im/pino-text-level-transport). +1. Use a prettifier like [`pino-pretty`](https://npm.im/pino-pretty) to make +the logs human friendly. + + +## Pino with `debug` + +The popular [`debug`](https://npm.im/debug) is used in many modules across the ecosystem. + +The [`pino-debug`](https://github.com/pinojs/pino-debug) module +can capture calls to `debug` loggers and run them +through `pino` instead. This results in a 10x (20x in asynchronous mode) +performance improvement - even though `pino-debug` is logging additional +data and wrapping it in JSON. + +To quickly enable this install [`pino-debug`](https://github.com/pinojs/pino-debug) +and preload it with the `-r` flag, enabling any `debug` logs with the +`DEBUG` environment variable: + +```sh +$ npm i pino-debug +$ DEBUG=* node -r pino-debug app.js +``` + +[`pino-debug`](https://github.com/pinojs/pino-debug) also offers fine-grain control to map specific `debug` +namespaces to `pino` log levels. See [`pino-debug`](https://github.com/pinojs/pino-debug) +for more. + + +## Unicode and Windows terminal + +Pino uses [sonic-boom](https://github.com/mcollina/sonic-boom) to speed +up logging. Internally, it uses [`fs.write`](https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_write_fd_string_position_encoding_callback) to write log lines directly to a file +descriptor. On Windows, Unicode output is not handled properly in the +terminal (both `cmd.exe` and PowerShell), and as such the output could +be visualized incorrectly if the log lines include utf8 characters. It +is possible to configure the terminal to visualize those characters +correctly with the use of [`chcp`](https://ss64.com/nt/chcp.html) by +executing in the terminal `chcp 65001`. This is a known limitation of +Node.js. + + +## Mapping Pino Log Levels to Google Cloud Logging (Stackdriver) Severity Levels + +Google Cloud Logging uses `severity` levels instead of log levels. As a result, all logs may show as INFO +level logs while completely ignoring the level set in the pino log. Google Cloud Logging also prefers that +log data is present inside a `message` key instead of the default `msg` key that Pino uses. Use a technique +similar to the one below to retain log levels in Google Cloud Logging + +```js +const pino = require('pino') + +// https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity +const PinoLevelToSeverityLookup = { + trace: 'DEBUG', + debug: 'DEBUG', + info: 'INFO', + warn: 'WARNING', + error: 'ERROR', + fatal: 'CRITICAL', +}; + +const defaultPinoConf = { + messageKey: 'message', + formatters: { + level(label, number) { + return { + severity: PinoLevelToSeverityLookup[label] || PinoLevelToSeverityLookup['info'], + level: number, + } + } + }, +} + +module.exports = function createLogger(options) { + return pino(Object.assign({}, options, defaultPinoConf)) +} +``` + +A library that configures Pino for +[Google Cloud Structured Logging](https://cloud.google.com/logging/docs/structured-logging) +is available at: +[@google-cloud/pino-logging-gcp-config](https://www.npmjs.com/package/@google-cloud/pino-logging-gcp-config) + +This library has the following features: + ++ Converts Pino log levels to Google Cloud Logging log levels, as above ++ Uses `message` instead of `msg` for the message key, as above ++ Adds a millisecond-granularity timestamp in the + [structure](https://cloud.google.com/logging/docs/agent/logging/configuration#timestamp-processing) + recognised by Google Cloud Logging eg: \ + `"timestamp":{"seconds":1445470140,"nanos":123000000}` ++ Adds a sequential + [`insertId`](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.insert_id) + to ensure log messages with identical timestamps are ordered correctly. ++ Logs including an `Error` object have the + [`stack_trace`](https://cloud.google.com/error-reporting/docs/formatting-error-messages#log-error) + property set so that the error is forwarded to Google Cloud Error Reporting. ++ Includes a + [`ServiceContext`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext) + object in the logs for Google Cloud Error Reporting, auto detected from the + environment if not specified ++ Maps the OpenTelemetry properties `span_id`, `trace_id`, and `trace_flags` + to the equivalent Google Cloud Logging fields. + + +## Using Grafana Loki to evaluate pino logs in a kubernetes cluster + +To get pino logs into Grafana Loki there are two options: + +1. **Push:** Use [pino-loki](https://github.com/Julien-R44/pino-loki) to send logs directly to Loki. +1. **Pull:** Configure Grafana Promtail to read and properly parse the logs before sending them to Loki. + Similar to Google Cloud logging, this involves remapping the log levels. See this [article](https://medium.com/@janpaepke/structured-logging-in-the-grafana-monitoring-stack-8aff0a5af2f5) for details. + + +## Avoid Message Conflict + +As described in the [`message` documentation](/docs/api.md#message), when a log +is written like `log.info({ msg: 'a message' }, 'another message')` then the +final output JSON will have `"msg":"another message"` and the `'a message'` +string will be lost. To overcome this, the [`logMethod` hook](/docs/api.md#logmethod) +can be used: + +```js +'use strict' + +const log = require('pino')({ + level: 'debug', + hooks: { + logMethod (inputArgs, method) { + if (inputArgs.length === 2 && inputArgs[0].msg) { + inputArgs[0].originalMsg = inputArgs[0].msg + } + return method.apply(this, inputArgs) + } + } +}) + +log.info('no original message') +log.info({ msg: 'mapped to originalMsg' }, 'a message') + +// {"level":30,"time":1596313323106,"pid":63739,"hostname":"foo","msg":"no original message"} +// {"level":30,"time":1596313323107,"pid":63739,"hostname":"foo","msg":"a message","originalMsg":"mapped to originalMsg"} +``` + + +## Best performance for logging to `stdout` + +The best performance for logging directly to stdout is _usually_ achieved by using the +default configuration: + +```js +const log = require('pino')(); +``` + +You should only have to configure custom transports or other settings +if you have broader logging requirements. + + +## Testing + +See [`pino-test`](https://github.com/pinojs/pino-test). diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/lts.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/lts.md new file mode 100644 index 0000000000000000000000000000000000000000..2c880cb1778cbd44613550218c17bf61bbeab836 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/lts.md @@ -0,0 +1,64 @@ +## Long Term Support + +Pino's Long Term Support (LTS) is provided according to the schedule laid +out in this document: + +1. Major releases, "X" release of [semantic versioning][semver] X.Y.Z release + versions, are supported for a minimum period of six months from their release + date. The release date of any specific version can be found at + [https://github.com/pinojs/pino/releases](https://github.com/pinojs/pino/releases). + +1. Major releases will receive security updates for an additional six months + from the release of the next major release. After this period + we will still review and release security fixes as long as they are + provided by the community and they do not violate other constraints, + e.g. minimum supported Node.js version. + +1. Major releases will be tested and verified against all Node.js + release lines that are supported by the + [Node.js LTS policy](https://github.com/nodejs/Release) within the + LTS period of that given Pino release line. This implies that only + the latest Node.js release of a given line is supported. + +A "month" is defined as 30 consecutive days. + +> ## Security Releases and Semver +> +> As a consequence of providing long-term support for major releases, there +> are occasions where we need to release breaking changes as a _minor_ +> version release. Such changes will _always_ be noted in the +> [release notes](https://github.com/pinojs/pino/releases). +> +> To avoid automatically receiving breaking security updates it is possible to use +> the tilde (`~`) range qualifier. For example, to get patches for the 6.1 +> release, and avoid automatically updating to the 6.1 release, specify +> the dependency as `"pino": "~6.1.x"`. This will leave your application vulnerable, +> so please use with caution. + +[semver]: https://semver.org/ + + + +### Schedule + +| Version | Release Date | End Of LTS Date | Node.js | +| :------ | :----------- | :-------------- | :------------------- | +| 9.x | 2024-04-26 | TBD | 18, 20, 22 | +| 8.x | 2022-06-01 | 2024-10-26 | 14, 16, 18, 20 | +| 7.x | 2021-10-14 | 2023-06-01 | 12, 14, 16 | +| 6.x | 2020-03-07 | 2022-04-14 | 10, 12, 14, 16 | + + + +### CI tested operating systems + +Pino uses GitHub Actions for CI testing, please refer to +[GitHub's documentation regarding workflow runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources) +for further details on what the latest virtual environment is in relation to +the YAML workflow labels below: + +| OS | YAML Workflow Label | Node.js | +|---------|------------------------|--------------| +| Linux | `ubuntu-latest` | 18, 20, 22 | +| Windows | `windows-latest` | 18, 20, 22 | +| MacOS | `macos-latest` | 18, 20, 22 | diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/pretty.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/pretty.md new file mode 100644 index 0000000000000000000000000000000000000000..a1a7a927360576d83fcaa7c81c5ebffc26451d33 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/pretty.md @@ -0,0 +1,35 @@ +# Pretty Printing + +By default, Pino log lines are newline delimited JSON (NDJSON). This is perfect +for production usage and long-term storage. It's not so great for development +environments. Thus, Pino logs can be prettified by using a Pino prettifier +module like [`pino-pretty`][pp]: + +1. Install a prettifier module as a separate dependency, e.g. `npm install pino-pretty`. +2. Instantiate the logger with the `transport.target` option set to `'pino-pretty'`: + ```js + const pino = require('pino') + const logger = pino({ + transport: { + target: 'pino-pretty' + }, + }) + + logger.info('hi') + ``` +3. The transport option can also have an options object containing `pino-pretty` options: + ```js + const pino = require('pino') + const logger = pino({ + transport: { + target: 'pino-pretty', + options: { + colorize: true + } + } + }) + + logger.info('hi') + ``` + + [pp]: https://github.com/pinojs/pino-pretty diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/redaction.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/redaction.md new file mode 100644 index 0000000000000000000000000000000000000000..9b7e4ff09df3a92fe40edfea38882a909aecce6e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/redaction.md @@ -0,0 +1,135 @@ +# Redaction + +> Redaction is not supported in the browser [#670](https://github.com/pinojs/pino/issues/670) + +To redact sensitive information, supply paths to keys that hold sensitive data +using the `redact` option. Note that paths that contain hyphens need to use +brackets to access the hyphenated property: + +```js +const logger = require('.')({ + redact: ['key', 'path.to.key', 'stuff.thats[*].secret', 'path["with-hyphen"]'] +}) + +logger.info({ + key: 'will be redacted', + path: { + to: {key: 'sensitive', another: 'thing'} + }, + stuff: { + thats: [ + {secret: 'will be redacted', logme: 'will be logged'}, + {secret: 'as will this', logme: 'as will this'} + ] + } +}) +``` + +This will output: + +```JSON +{"level":30,"time":1527777350011,"pid":3186,"hostname":"Davids-MacBook-Pro-3.local","key":"[Redacted]","path":{"to":{"key":"[Redacted]","another":"thing"}},"stuff":{"thats":[{"secret":"[Redacted]","logme":"will be logged"},{"secret":"[Redacted]","logme":"as will this"}]}} +``` + +The `redact` option can take an array (as shown in the above example) or +an object. This allows control over *how* information is redacted. + +For instance, setting the censor: + +```js +const logger = require('.')({ + redact: { + paths: ['key', 'path.to.key', 'stuff.thats[*].secret'], + censor: '**GDPR COMPLIANT**' + } +}) + +logger.info({ + key: 'will be redacted', + path: { + to: {key: 'sensitive', another: 'thing'} + }, + stuff: { + thats: [ + {secret: 'will be redacted', logme: 'will be logged'}, + {secret: 'as will this', logme: 'as will this'} + ] + } +}) +``` + +This will output: + +```JSON +{"level":30,"time":1527778563934,"pid":3847,"hostname":"Davids-MacBook-Pro-3.local","key":"**GDPR COMPLIANT**","path":{"to":{"key":"**GDPR COMPLIANT**","another":"thing"}},"stuff":{"thats":[{"secret":"**GDPR COMPLIANT**","logme":"will be logged"},{"secret":"**GDPR COMPLIANT**","logme":"as will this"}]}} +``` + +The `redact.remove` option also allows for the key and value to be removed from output: + +```js +const logger = require('.')({ + redact: { + paths: ['key', 'path.to.key', 'stuff.thats[*].secret'], + remove: true + } +}) + +logger.info({ + key: 'will be redacted', + path: { + to: {key: 'sensitive', another: 'thing'} + }, + stuff: { + thats: [ + {secret: 'will be redacted', logme: 'will be logged'}, + {secret: 'as will this', logme: 'as will this'} + ] + } +}) +``` + +This will output + +```JSON +{"level":30,"time":1527782356751,"pid":5758,"hostname":"Davids-MacBook-Pro-3.local","path":{"to":{"another":"thing"}},"stuff":{"thats":[{"logme":"will be logged"},{"logme":"as will this"}]}} +``` + +See [pino options in API](/docs/api.md#redact-array-object) for `redact` API details. + + +## Path Syntax + +The syntax for paths supplied to the `redact` option conform to the syntax in path lookups +in standard ECMAScript, with two additions: + +* paths may start with bracket notation +* paths may contain the asterisk `*` to denote a wildcard +* paths are **case sensitive** + +By way of example, the following are all valid paths: + +* `a.b.c` +* `a["b-c"].d` +* `["a-b"].c` +* `a.b.*` +* `a[*].b` + +## Overhead + +Pino's redaction functionality is built on top of [`fast-redact`](https://github.com/davidmarkclements/fast-redact) +which adds about 2% overhead to `JSON.stringify` when using paths without wildcards. + +When used with pino logger with a single redacted path, any overhead is within noise - +a way to deterministically measure its effect has not been found. This is because it is not a bottleneck. + +However, wildcard redaction does carry a non-trivial cost relative to explicitly declaring the keys +(50% in a case where four keys are redacted across two objects). See +the [`fast-redact` benchmarks](https://github.com/davidmarkclements/fast-redact#benchmarks) for details. + +## Safety + +The `redact` option is intended as an initialization time configuration option. +Path strings must not originate from user input. +The `fast-redact` module uses a VM context to syntax check the paths, user input +should never be combined with such an approach. See the [`fast-redact` Caveat](https://github.com/davidmarkclements/fast-redact#caveat) +and the [`fast-redact` Approach](https://github.com/davidmarkclements/fast-redact#approach) for in-depth information. diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/transports.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/transports.md new file mode 100644 index 0000000000000000000000000000000000000000..89a21f1fd0c5da532377c2ad96100843bfb65700 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/transports.md @@ -0,0 +1,1263 @@ +# Transports + +Pino transports can be used for both transmitting and transforming log output. + +The way Pino generates logs: + +1. Reduces the impact of logging on an application to the absolute minimum. +2. Gives greater flexibility in how logs are processed and stored. + +It is recommended that any log transformation or transmission is performed either +in a separate thread or a separate process. + +Before Pino v7 transports would ideally operate in a separate process - these are +now referred to as [Legacy Transports](#legacy-transports). + +From Pino v7 and upwards transports can also operate inside a [Worker Thread][worker-thread] +and can be used or configured via the options object passed to `pino` on initialization. +In this case the transports would always operate asynchronously (unless `options.sync` is set to `true` in transport options), and logs would be +flushed as quickly as possible (there is nothing to do). + +[worker-thread]: https://nodejs.org/dist/latest-v14.x/docs/api/worker_threads.html + +## v7+ Transports + +A transport is a module that exports a default function that returns a writable stream: + +```js +import { createWriteStream } from 'node:fs' + +export default (options) => { + return createWriteStream(options.destination) +} +``` + +Let's imagine the above defines our "transport" as the file `my-transport.mjs` +(ESM files are supported even if the project is written in CJS). + +We would set up our transport by creating a transport stream with `pino.transport` +and passing it to the `pino` function: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: '/absolute/path/to/my-transport.mjs' +}) +pino(transport) +``` + +The transport code will be executed in a separate worker thread. The main thread +will write logs to the worker thread, which will write them to the stream returned +from the function exported from the transport file/module. + +The exported function can also be async. If we use an async function we can throw early +if the transform could not be opened. As an example: + +```js +import fs from 'node:fs' +import { once } from 'events' +export default async (options) => { + const stream = fs.createWriteStream(options.destination) + await once(stream, 'open') + return stream +} +``` + +While initializing the stream we're able to use `await` to perform asynchronous operations. In this +case, waiting for the write streams `open` event. + +Let's imagine the above was published to npm with the module name `some-file-transport`. + +The `options.destination` value can be set when creating the transport stream with `pino.transport` like so: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'some-file-transport', + options: { destination: '/dev/null' } +}) +pino(transport) +``` + +Note here we've specified a module by package rather than by relative path. The options object we provide +is serialized and injected into the transport worker thread, then passed to the module's exported function. +This means that the options object can only contain types that are supported by the +[Structured Clone Algorithm][sca] which is used to (de)serialize objects between threads. + +What if we wanted to use both transports, but send only error logs to `my-transport.mjs` while +sending all logs to `some-file-transport`? We can use the `pino.transport` function's `level` option: + +```js +const pino = require('pino') +const transport = pino.transport({ + targets: [ + { target: '/absolute/path/to/my-transport.mjs', level: 'error' }, + { target: 'some-file-transport', options: { destination: '/dev/null' }} + ] +}) +pino(transport) +``` + +If we're using custom levels, they should be passed in when using more than one transport. +```js +const pino = require('pino') +const transport = pino.transport({ + targets: [ + { target: '/absolute/path/to/my-transport.mjs', level: 'error' }, + { target: 'some-file-transport', options: { destination: '/dev/null' } + ], + levels: { foo: 35 } +}) +pino(transport) +``` + +It is also possible to use the `dedupe` option to send logs only to the stream with the higher level. +```js +const pino = require('pino') +const transport = pino.transport({ + targets: [ + { target: '/absolute/path/to/my-transport.mjs', level: 'error' }, + { target: 'some-file-transport', options: { destination: '/dev/null' } + ], + dedupe: true +}) +pino(transport) +``` + +To make pino log synchronously, pass `sync: true` to transport options. +```js +const pino = require('pino') +const transport = pino.transport({ + targets: [ + { target: '/absolute/path/to/my-transport.mjs', level: 'error' }, + ], + dedupe: true, + sync: true, +}); +pino(transport); +``` + +For more details on `pino.transport` see the [API docs for `pino.transport`][pino-transport]. + +[pino-transport]: /docs/api.md#pino-transport +[sca]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm + + +### Writing a Transport + +The module [pino-abstract-transport](https://github.com/pinojs/pino-abstract-transport) provides +a simple utility to parse each line. Its usage is highly recommended. + +You can see an example using an async iterator with ESM: + +```js +import build from 'pino-abstract-transport' +import SonicBoom from 'sonic-boom' +import { once } from 'events' + +export default async function (opts) { + // SonicBoom is necessary to avoid loops with the main thread. + // It is the same of pino.destination(). + const destination = new SonicBoom({ dest: opts.destination || 1, sync: false }) + await once(destination, 'ready') + + return build(async function (source) { + for await (let obj of source) { + const toDrain = !destination.write(obj.msg.toUpperCase() + '\n') + // This block will handle backpressure + if (toDrain) { + await once(destination, 'drain') + } + } + }, { + async close (err) { + destination.end() + await once(destination, 'close') + } + }) +} +``` + +or using Node.js streams and CommonJS: + +```js +'use strict' + +const build = require('pino-abstract-transport') +const SonicBoom = require('sonic-boom') + +module.exports = function (opts) { + const destination = new SonicBoom({ dest: opts.destination || 1, sync: false }) + return build(function (source) { + source.pipe(destination) + }, { + close (err, cb) { + destination.end() + destination.on('close', cb.bind(null, err)) + } + }) +} +``` + +(It is possible to use the async iterators with CommonJS and streams with ESM.) + +To consume async iterators in batches, consider using the [hwp](https://github.com/mcollina/hwp) library. + +The `close()` function is needed to make sure that the stream is closed and flushed when its +callback is called or the returned promise resolves. Otherwise, log lines will be lost. + +### Writing to a custom transport & stdout + +In case you want to both use a custom transport, and output the log entries with default processing to STDOUT, you can use 'pino/file' transport configured with `destination: 1`: + +```js + const transports = [ + { + target: 'pino/file', + options: { destination: 1 } // this writes to STDOUT + }, + { + target: 'my-custom-transport', + options: { someParameter: true } + } + ] + + const logger = pino(pino.transport({ targets: transports })) +``` + +### Creating a transport pipeline + +As an example, the following transport returns a `Transform` stream: + +```js +import build from 'pino-abstract-transport' +import { pipeline, Transform } from 'node:stream' +export default async function (options) { + return build(function (source) { + const myTransportStream = new Transform({ + // Make sure autoDestroy is set, + // this is needed in Node v12 or when using the + // readable-stream module. + autoDestroy: true, + + objectMode: true, + transform (chunk, enc, cb) { + + // modifies the payload somehow + chunk.service = 'pino' + + // stringify the payload again + this.push(`${JSON.stringify(chunk)}\n`) + cb() + } + }) + pipeline(source, myTransportStream, () => {}) + return myTransportStream + }, { + // This is needed to be able to pipeline transports. + enablePipelining: true + }) +} +``` + +Then you can pipeline them with: + +```js +import pino from 'pino' + +const logger = pino({ + transport: { + pipeline: [{ + target: './my-transform.js' + }, { + // Use target: 'pino/file' with STDOUT descriptor 1 to write + // logs without any change. + target: 'pino/file', + options: { destination: 1 } + }] + } +}) + +logger.info('hello world') +``` + +__NOTE: there is no "default" destination for a pipeline but +a terminating target, i.e. a `Writable` stream.__ + +### TypeScript compatibility + +Pino provides basic support for transports written in TypeScript. + +Ideally, they should be transpiled to ensure maximum compatibility, but sometimes +you might want to use tools such as TS-Node, to execute your TypeScript +code without having to go through an explicit transpilation step. + +You can use your TypeScript code without explicit transpilation, but there are +some known caveats: +- For "pure" TypeScript code, ES imports are still not supported (ES imports are + supported once the code is transpiled). +- Only TS-Node is supported for now, there's no TSM support. +- Running transports TypeScript code on TS-Node seems to be problematic on + Windows systems, there's no official support for that yet. + +### Notable transports + +#### `pino/file` + +The `pino/file` transport routes logs to a file (or file descriptor). + +The `options.destination` property may be set to specify the desired file destination. + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino/file', + options: { destination: '/path/to/file' } +}) +pino(transport) +``` + +By default, the `pino/file` transport assumes the directory of the destination file exists. If it does not exist, the transport will throw an error when it attempts to open the file for writing. The `mkdir` option may be set to `true` to configure the transport to create the directory, if it does not exist, before opening the file for writing. + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino/file', + options: { destination: '/path/to/file', mkdir: true } +}) +pino(transport) +``` + +By default, the `pino/file` transport appends to the destination file if it exists. The `append` option may be set to `false` to configure the transport to truncate the file upon opening it for writing. + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino/file', + options: { destination: '/path/to/file', append: false } +}) +pino(transport) +``` + +The `options.destination` property may also be a number to represent a file descriptor. Typically this would be `1` to write to STDOUT or `2` to write to STDERR. If `options.destination` is not set, it defaults to `1` which means logs will be written to STDOUT. If `options.destination` is a string integer, e.g. `'1'`, it will be coerced to a number and used as a file descriptor. If this is not desired, provide a full path, e.g. `/tmp/1`. + +The difference between using the `pino/file` transport builtin and using `pino.destination` is that `pino.destination` runs in the main thread, whereas `pino/file` sets up `pino.destination` in a worker thread. + +#### `pino-pretty` + +The [`pino-pretty`][pino-pretty] transport prettifies logs. + +By default the `pino-pretty` builtin logs to STDOUT. + +The `options.destination` property may be set to log pretty logs to a file descriptor or file. The following would send the prettified logs to STDERR: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino-pretty', + options: { destination: 1 } // use 2 for stderr +}) +pino(transport) +``` + +### Asynchronous startup + +The new transports boot asynchronously and calling `process.exit()` before the transport +starts will cause logs to not be delivered. + +```js +const pino = require('pino') +const transport = pino.transport({ + targets: [ + { target: '/absolute/path/to/my-transport.mjs', level: 'error' }, + { target: 'some-file-transport', options: { destination: '/dev/null' } } + ] +}) +const logger = pino(transport) + +logger.info('hello') + +// If logs are printed before the transport is ready when process.exit(0) is called, +// they will be lost. +transport.on('ready', function () { + process.exit(0) +}) +``` + +## Legacy Transports + +A legacy Pino "transport" is a supplementary tool that consumes Pino logs. + +Consider the following example for creating a transport: + +```js +const { pipeline, Writable } = require('node:stream') +const split = require('split2') + +const myTransportStream = new Writable({ + write (chunk, enc, cb) { + // apply a transform and send to STDOUT + console.log(chunk.toString().toUpperCase()) + cb() + } +}) + +pipeline(process.stdin, split(JSON.parse), myTransportStream) +``` + +The above defines our "transport" as the file `my-transport-process.js`. + +Logs can now be consumed using shell piping: + +```sh +node my-app-which-logs-stuff-to-stdout.js | node my-transport-process.js +``` + +Ideally, a transport should consume logs in a separate process to the application, +Using transports in the same process causes unnecessary load and slows down +Node's single-threaded event loop. + +## Known Transports + +PRs to this document are welcome for any new transports! + +### Pino v7+ Compatible + ++ [@axiomhq/pino](#@axiomhq/pino) ++ [@logtail/pino](#@logtail/pino) ++ [@macfja/pino-fingers-crossed](#macfja-pino-fingers-crossed) ++ [@openobserve/pino-openobserve](#pino-openobserve) ++ [pino-airbrake-transport](#pino-airbrake-transport) ++ [pino-axiom](#pino-axiom) ++ [pino-datadog-transport](#pino-datadog-transport) ++ [pino-discord-webhook](#pino-discord-webhook) ++ [pino-elasticsearch](#pino-elasticsearch) ++ [pino-hana](#pino-hana) ++ [pino-logfmt](#pino-logfmt) ++ [pino-loki](#pino-loki) ++ [pino-opentelemetry-transport](#pino-opentelemetry-transport) ++ [pino-pretty](#pino-pretty) ++ [pino-roll](#pino-roll) ++ [pino-seq-transport](#pino-seq-transport) ++ [pino-sentry-transport](#pino-sentry-transport) ++ [pino-slack-webhook](#pino-slack-webhook) ++ [pino-telegram-webhook](#pino-telegram-webhook) ++ [pino-yc-transport](#pino-yc-transport) + +### Legacy + ++ [pino-applicationinsights](#pino-applicationinsights) ++ [pino-azuretable](#pino-azuretable) ++ [pino-cloudwatch](#pino-cloudwatch) ++ [pino-couch](#pino-couch) ++ [pino-datadog](#pino-datadog) ++ [pino-gelf](#pino-gelf) ++ [pino-http-send](#pino-http-send) ++ [pino-kafka](#pino-kafka) ++ [pino-logdna](#pino-logdna) ++ [pino-logflare](#pino-logflare) ++ [pino-loki](#pino-loki) ++ [pino-mq](#pino-mq) ++ [pino-mysql](#pino-mysql) ++ [pino-papertrail](#pino-papertrail) ++ [pino-pg](#pino-pg) ++ [pino-redis](#pino-redis) ++ [pino-sentry](#pino-sentry) ++ [pino-seq](#pino-seq) ++ [pino-socket](#pino-socket) ++ [pino-stackdriver](#pino-stackdriver) ++ [pino-syslog](#pino-syslog) ++ [pino-websocket](#pino-websocket) + + + +### @axiomhq/pino + +[@axiomhq/pino](https://www.npmjs.com/package/@axiomhq/pino) is the official [Axiom](https://axiom.co/) transport for Pino, using [axiom-js](https://github.com/axiomhq/axiom-js). + +```javascript +import pino from 'pino'; + +const logger = pino( + { level: 'info' }, + pino.transport({ + target: '@axiomhq/pino', + options: { + dataset: process.env.AXIOM_DATASET, + token: process.env.AXIOM_TOKEN, + }, + }), +); +``` + +then you can use the logger as usual: + +```js +logger.info('Hello from pino!'); +``` + +For further examples, head over to the [examples](https://github.com/axiomhq/axiom-js/tree/main/examples/pino) directory. + + +### @logtail/pino + +The [@logtail/pino](https://www.npmjs.com/package/@logtail/pino) NPM package is a transport that forwards logs to [Logtail](https://logtail.com) by [Better Stack](https://betterstack.com). + +[Quick start guide ⇗](https://betterstack.com/docs/logs/javascript/pino) + + +### @macfja/pino-fingers-crossed + +[@macfja/pino-fingers-crossed](https://github.com/MacFJA/js-pino-fingers-crossed) is a Pino v7+ transport that holds logs until a log level is reached, allowing to only have logs when it matters. + +```js +const pino = require('pino'); +const { default: fingersCrossed, enable } = require('@macfja/pino-fingers-crossed') + +const logger = pino(fingersCrossed()); + +logger.info('Will appear immedialty') +logger.error('Will appear immedialty') + +logger.setBindings({ [enable]: 50 }) +logger.info('Will NOT appear immedialty') +logger.info('Will NOT appear immedialty') +logger.error('Will appear immedialty as well as the 2 previous messages') // error log are level 50 +logger.info('Will NOT appear') +logger.info({ [enable]: false }, 'Will appear immedialty') +logger.info('Will NOT appear') +``` + +### @openobserve/pino-openobserve + +[@openobserve/pino-openobserve](https://github.com/openobserve/pino-openobserve) is a +Pino v7+ transport that will send logs to an +[OpenObserve](https://openobserve.ai) instance. + +``` +const pino = require('pino'); +const OpenobserveTransport = require('@openobserve/pino-openobserve'); + +const logger = pino({ + level: 'info', + transport: { + target: OpenobserveTransport, + options: { + url: 'https://your-openobserve-server.com', + organization: 'your-organization', + streamName: 'your-stream', + auth: { + username: 'your-username', + password: 'your-password', + }, + }, + }, +}); +``` + +For full documentation check the [README](https://github.com/openobserve/pino-openobserve). + + +### pino-airbrake-transport + +[pino-airbrake-transport][pino-airbrake-transport] is a Pino v7+ compatible transport to forward log events to [Airbrake][Airbrake] +from a dedicated worker: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino-airbrake-transport', + options: { + airbrake: { + projectId: 1, + projectKey: "REPLACE_ME", + environment: "production", + // additional options for airbrake + performanceStats: false, + }, + }, + level: "error", // minimum log level that should be sent to airbrake +}) +pino(transport) +``` + +[pino-airbrake-transport]: https://github.com/enricodeleo/pino-airbrake-transport +[Airbrake]: https://airbrake.io/ + + +### pino-applicationinsights +The [pino-applicationinsights](https://www.npmjs.com/package/pino-applicationinsights) module is a transport that will forward logs to [Azure Application Insights](https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview). + +Given an application `foo` that logs via pino, you would use `pino-applicationinsights` like so: + +``` sh +$ node foo | pino-applicationinsights --key blablabla +``` + +For full documentation of command line switches read [README](https://github.com/ovhemert/pino-applicationinsights#readme) + + +### pino-axiom + +[pino-axiom](https://www.npmjs.com/package/pino-axiom) is a transport that will forward logs to [Axiom](https://axiom.co). + +```javascript +const pino = require('pino') +const transport = pino.transport({ + target: 'pino-axiom', + options: { + orgId: 'YOUR-ORG-ID', + token: 'YOUR-TOKEN', + dataset: 'YOUR-DATASET', + }, +}) +pino(transport) +``` + + +### pino-azuretable +The [pino-azuretable](https://www.npmjs.com/package/pino-azuretable) module is a transport that will forward logs to the [Azure Table Storage](https://azure.microsoft.com/en-us/services/storage/tables/). + +Given an application `foo` that logs via pino, you would use `pino-azuretable` like so: + +``` sh +$ node foo | pino-azuretable --account storageaccount --key blablabla +``` + +For full documentation of command line switches read [README](https://github.com/ovhemert/pino-azuretable#readme) + + +### pino-cloudwatch + +[pino-cloudwatch][pino-cloudwatch] is a transport that buffers and forwards logs to [Amazon CloudWatch][]. + +```sh +$ node app.js | pino-cloudwatch --group my-log-group +``` + +[pino-cloudwatch]: https://github.com/dbhowell/pino-cloudwatch +[Amazon CloudWatch]: https://aws.amazon.com/cloudwatch/ + + +### pino-couch + +[pino-couch][pino-couch] uploads each log line as a [CouchDB][CouchDB] document. + +```sh +$ node app.js | pino-couch -U https://couch-server -d mylogs +``` + +[pino-couch]: https://github.com/IBM/pino-couch +[CouchDB]: https://couchdb.apache.org + + +### pino-datadog +The [pino-datadog](https://www.npmjs.com/package/pino-datadog) module is a transport that will forward logs to [DataDog](https://www.datadoghq.com/) through its API. + +Given an application `foo` that logs via pino, you would use `pino-datadog` like so: + +``` sh +$ node foo | pino-datadog --key blablabla +``` + +For full documentation of command line switches read [README](https://github.com/ovhemert/pino-datadog#readme) + + +### pino-datadog-transport + +[pino-datadog-transport][pino-datadog-transport] is a Pino v7+ compatible transport to forward log events to [Datadog][Datadog] +from a dedicated worker: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino-datadog-transport', + options: { + ddClientConf: { + authMethods: { + apiKeyAuth: + } + }, + }, + level: "error", // minimum log level that should be sent to datadog +}) +pino(transport) +``` + +[pino-datadog-transport]: https://github.com/theogravity/datadog-transports +[Datadog]: https://www.datadoghq.com/ + +#### Logstash + +The [pino-socket][pino-socket] module can also be used to upload logs to +[Logstash][logstash] via: + +``` +$ node app.js | pino-socket -a 127.0.0.1 -p 5000 -m tcp +``` + +Assuming logstash is running on the same host and configured as +follows: + +``` +input { + tcp { + port => 5000 + } +} + +filter { + json { + source => "message" + } +} + +output { + elasticsearch { + hosts => "127.0.0.1:9200" + } +} +``` + +See to learn +how to setup [Kibana][kibana]. + +For Docker users, see +https://github.com/deviantony/docker-elk to setup an ELK stack. + + +### pino-discord-webhook + +[pino-discord-webhook](https://github.com/fabulousgk/pino-discord-webhook) is a Pino v7+ compatible transport to forward log events to a [Discord](http://discord.com) webhook from a dedicated worker. + +```js +import pino from 'pino' + +const logger = pino({ + transport: { + target: 'pino-discord-webhook', + options: { + webhookUrl: 'https://discord.com/api/webhooks/xxxx/xxxx', + } + } +}) +``` + + +### pino-elasticsearch + +[pino-elasticsearch][pino-elasticsearch] uploads the log lines in bulk +to [Elasticsearch][elasticsearch], to be displayed in [Kibana][kibana]. + +It is extremely simple to use and setup + +```sh +$ node app.js | pino-elasticsearch +``` + +Assuming Elasticsearch is running on localhost. + +To connect to an external Elasticsearch instance (recommended for production): + +* Check that `network.host` is defined in the `elasticsearch.yml` configuration file. See [Elasticsearch Network Settings documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#common-network-settings) for more details. +* Launch: + +```sh +$ node app.js | pino-elasticsearch --node http://192.168.1.42:9200 +``` + +Assuming Elasticsearch is running on `192.168.1.42`. + +To connect to AWS Elasticsearch: + +```sh +$ node app.js | pino-elasticsearch --node https://es-url.us-east-1.es.amazonaws.com --es-version 6 +``` + +Then [create an index pattern](https://www.elastic.co/guide/en/kibana/current/setup.html) on `'pino'` (the default index key for `pino-elasticsearch`) on the Kibana instance. + +[pino-elasticsearch]: https://github.com/pinojs/pino-elasticsearch +[elasticsearch]: https://www.elastic.co/products/elasticsearch +[kibana]: https://www.elastic.co/products/kibana + + +### pino-gelf + +Pino GELF ([pino-gelf]) is a transport for the Pino logger. Pino GELF receives Pino logs from stdin and transforms them into [GELF format][gelf] before sending them to a remote [Graylog server][graylog] via UDP. + +```sh +$ node your-app.js | pino-gelf log +``` + +[pino-gelf]: https://github.com/pinojs/pino-gelf +[gelf]: https://docs.graylog.org/en/2.1/pages/gelf.html +[graylog]: https://www.graylog.org/ + + +### pino-hana +[pino-hana](https://github.com/HiImGiovi/pino-hana) is a Pino v7+ transport that save pino logs to a SAP HANA database. +```js +const pino = require('pino') +const logger = pino({ + transport: { + target: 'pino-hana', + options: { + connectionOptions: { + host: , + port: , + user: , + password: , + }, + schema: , + table: , + }, + }, +}) + +logger.info('hi') // this log will be saved into SAP HANA +``` +For more detailed information about its usage please check the official [documentation](https://github.com/HiImGiovi/pino-hana#readme). + + +### pino-http-send + +[pino-http-send](https://npmjs.com/package/pino-http-send) is a configurable and low overhead +transport that will batch logs and send to a specified URL. + +```console +$ node app.js | pino-http-send -u http://localhost:8080/logs +``` + + +### pino-kafka + +[pino-kafka](https://github.com/ayZagen/pino-kafka) transport to send logs to [Apache Kafka](https://kafka.apache.org/). + +```sh +$ node index.js | pino-kafka -b 10.10.10.5:9200 -d mytopic +``` + + +### pino-logdna + +[pino-logdna](https://github.com/logdna/pino-logdna) transport to send logs to [LogDNA](https://logdna.com). + +```sh +$ node index.js | pino-logdna --key YOUR_INGESTION_KEY +``` + +Tags and other metadata can be included using the available command line options. See the [pino-logdna README](https://github.com/logdna/pino-logdna#options) for a full list. + + +### pino-logflare + +[pino-logflare](https://github.com/Logflare/pino-logflare) transport to send logs to a [Logflare](https://logflare.app) `source`. + +```sh +$ node index.js | pino-logflare --key YOUR_KEY --source YOUR_SOURCE +``` + + +### pino-logfmt + +[pino-logfmt](https://github.com/botflux/pino-logfmt) is a Pino v7+ transport that formats logs into [logfmt](https://brandur.org/logfmt). This transport can output the formatted logs to stdout or file. + +```js +import pino from 'pino' + +const logger = pino({ + transport: { + target: 'pino-logfmt' + } +}) +``` + + +### pino-loki +pino-loki is a transport that will forwards logs into [Grafana Loki](https://grafana.com/oss/loki/). +Can be used in CLI version in a separate process or in a dedicated worker: + +CLI : +```console +node app.js | pino-loki --hostname localhost:3100 --labels='{ "application": "my-application"}' --user my-username --password my-password +``` + +Worker : +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino-loki', + options: { host: 'localhost:3100' } +}) +pino(transport) +``` + +For full documentation and configuration, see the [README](https://github.com/Julien-R44/pino-loki). + + +### pino-mq + +The `pino-mq` transport will take all messages received on `process.stdin` and send them over a message bus using JSON serialization. + +This is useful for: + +* moving backpressure from application to broker +* transforming messages pressure to another component + +``` +node app.js | pino-mq -u "amqp://guest:guest@localhost/" -q "pino-logs" +``` + +Alternatively, a configuration file can be used: + +``` +node app.js | pino-mq -c pino-mq.json +``` + +A base configuration file can be initialized with: + +``` +pino-mq -g +``` + +For full documentation of command line switches and configuration see [the `pino-mq` README](https://github.com/itavy/pino-mq#readme) + + +### pino-mysql + +[pino-mysql][pino-mysql] loads pino logs into [MySQL][MySQL] and [MariaDB][MariaDB]. + +```sh +$ node app.js | pino-mysql -c db-configuration.json +``` + +`pino-mysql` can extract and save log fields into corresponding database fields +and/or save the entire log stream as a [JSON Data Type][JSONDT]. + +For full documentation and command line switches read the [README][pino-mysql]. + +[pino-mysql]: https://www.npmjs.com/package/pino-mysql +[MySQL]: https://www.mysql.com/ +[MariaDB]: https://mariadb.org/ +[JSONDT]: https://dev.mysql.com/doc/refman/8.0/en/json.html + + +### pino-opentelemetry-transport + +[pino-opentelemetry-transport](https://www.npmjs.com/package/pino-opentelemetry-transport) is a transport that will forward logs to an [OpenTelemetry log collector](https://opentelemetry.io/docs/collector/) using [OpenTelemetry JS instrumentation](https://opentelemetry.io/docs/instrumentation/js/). + +```javascript +const pino = require('pino') + +const transport = pino.transport({ + target: 'pino-opentelemetry-transport', + options: { + resourceAttributes: { + 'service.name': 'test-service', + 'service.version': '1.0.0' + } + } +}) + +pino(transport) +``` + +Documentation on running a minimal example is available in the [README](https://github.com/Vunovati/pino-opentelemetry-transport#minimalistic-example). + + +### pino-papertrail +pino-papertrail is a transport that will forward logs to the [papertrail](https://papertrailapp.com) log service through an UDPv4 socket. + +Given an application `foo` that logs via pino, and a papertrail destination that collects logs on port UDP `12345` on address `bar.papertrailapp.com`, you would use `pino-papertrail` +like so: + +``` +node yourapp.js | pino-papertrail --host bar.papertrailapp.com --port 12345 --appname foo +``` + + +for full documentation of command line switches read [README](https://github.com/ovhemert/pino-papertrail#readme) + + +### pino-pg +[pino-pg](https://www.npmjs.com/package/pino-pg) stores logs into PostgreSQL. +Full documentation in the [README](https://github.com/Xstoudi/pino-pg). + + +### pino-redis + +[pino-redis][pino-redis] loads pino logs into [Redis][Redis]. + +```sh +$ node app.js | pino-redis -U redis://username:password@localhost:6379 +``` + +[pino-redis]: https://github.com/buianhthang/pino-redis +[Redis]: https://redis.io/ + + +### pino-roll + +`pino-roll` is a Pino transport that automatically rolls your log files based on size or time frequency. + +```js +import { join } from 'path'; +import pino from 'pino'; + +const transport = pino.transport({ + target: 'pino-roll', + options: { file: join('logs', 'log'), frequency: 'daily', mkdir: true } +}); + +const logger = pino(transport); +``` + +then you can use the logger as usual: + +```js +logger.info('Hello from pino-roll!'); +``` +For full documentation check the [README](https://github.com/mcollina/pino-roll?tab=readme-ov-file#pino-roll). + + +### pino-sentry + +[pino-sentry][pino-sentry] loads pino logs into [Sentry][Sentry]. + +```sh +$ node app.js | pino-sentry --dsn=https://******@sentry.io/12345 +``` + +For full documentation of command line switches see the [pino-sentry README](https://github.com/aandrewww/pino-sentry/blob/master/README.md). + +[pino-sentry]: https://www.npmjs.com/package/pino-sentry +[Sentry]: https://sentry.io/ + + +### pino-sentry-transport + +[pino-sentry-transport][pino-sentry-transport] is a Pino v7+ compatible transport to forward log events to [Sentry][Sentry] +from a dedicated worker: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: 'pino-sentry-transport', + options: { + sentry: { + dsn: 'https://******@sentry.io/12345', + } + } +}) +pino(transport) +``` + +[pino-sentry-transport]: https://github.com/tomer-yechiel/pino-sentry-transport +[Sentry]: https://sentry.io/ + + +### pino-seq + +[pino-seq][pino-seq] supports both out-of-process and in-process log forwarding to [Seq][Seq]. + +```sh +$ node app.js | pino-seq --serverUrl http://localhost:5341 --apiKey 1234567890 --property applicationName=MyNodeApp +``` + +[pino-seq]: https://www.npmjs.com/package/pino-seq +[Seq]: https://datalust.co/seq + + +### pino-seq-transport + +[pino-seq-transport][pino-seq-transport] is a Pino v7+ compatible transport to forward log events to [Seq][Seq] +from a dedicated worker: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: '@autotelic/pino-seq-transport', + options: { serverUrl: 'http://localhost:5341' } +}) +pino(transport) +``` + +[pino-seq-transport]: https://github.com/autotelic/pino-seq-transport +[Seq]: https://datalust.co/seq + + +### pino-slack-webhook + +[pino-slack-webhook][pino-slack-webhook] is a Pino v7+ compatible transport to forward log events to [Slack][Slack] +from a dedicated worker: + +```js +const pino = require('pino') +const transport = pino.transport({ + target: '@youngkiu/pino-slack-webhook', + options: { + webhookUrl: 'https://hooks.slack.com/services/xxx/xxx/xxx', + channel: '#pino-log', + username: 'webhookbot', + icon_emoji: ':ghost:' + } +}) +pino(transport) +``` + +[pino-slack-webhook]: https://github.com/youngkiu/pino-slack-webhook +[Slack]: https://slack.com/ + +[pino-pretty]: https://github.com/pinojs/pino-pretty + +For full documentation of command line switches read the [README](https://github.com/abeai/pino-websocket#readme). + + +### pino-socket + +[pino-socket][pino-socket] is a transport that will forward logs to an IPv4 +UDP or TCP socket. + +As an example, use `socat` to fake a listener: + +```sh +$ socat -v udp4-recvfrom:6000,fork exec:'/bin/cat' +``` + +Then run an application that uses `pino` for logging: + +```sh +$ node app.js | pino-socket -p 6000 +``` + +Logs from the application should be observed on both consoles. + +[pino-socket]: https://www.npmjs.com/package/pino-socket + + +### pino-stackdriver +The [pino-stackdriver](https://www.npmjs.com/package/pino-stackdriver) module is a transport that will forward logs to the [Google Stackdriver](https://cloud.google.com/logging/) log service through its API. + +Given an application `foo` that logs via pino, a stackdriver log project `bar`, and credentials in the file `/credentials.json`, you would use `pino-stackdriver` +like so: + +``` sh +$ node foo | pino-stackdriver --project bar --credentials /credentials.json +``` + +For full documentation of command line switches read [README](https://github.com/ovhemert/pino-stackdriver#readme) + + +### pino-syslog + +[pino-syslog][pino-syslog] is a transforming transport that converts +`pino` NDJSON logs to [RFC3164][rfc3164] compatible log messages. The `pino-syslog` module does not +forward the logs anywhere, it merely re-writes the messages to `stdout`. But +when used in combination with `pino-socket` the log messages can be relayed to a syslog server: + +```sh +$ node app.js | pino-syslog | pino-socket -a syslog.example.com +``` + +Example output for the "hello world" log: + +``` +<134>Apr 1 16:44:58 MacBook-Pro-3 none[94473]: {"pid":94473,"hostname":"MacBook-Pro-3","level":30,"msg":"hello world","time":1459529098958} +``` + +[pino-syslog]: https://www.npmjs.com/package/pino-syslog +[rfc3164]: https://tools.ietf.org/html/rfc3164 +[logstash]: https://www.elastic.co/products/logstash + + +### pino-telegram-webhook + +[pino-telegram-webhook](https://github.com/Jhon-Mosk/pino-telegram-webhook) is a Pino v7+ transport for sending messages to [Telegram](https://telegram.org/). + +```js +const pino = require('pino'); + +const logger = pino({ + transport: { + target: 'pino-telegram-webhook', + level: 'error', + options: { + chatId: -1234567890, + botToken: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11", + extra: { + parse_mode: "HTML", + }, + }, + }, +}) + +logger.error('test log!'); +``` + +The `extra` parameter is optional. Parameters that the method [`sendMessage`](https://core.telegram.org/bots/api#sendmessage) supports can be passed to it. + + +### pino-websocket + +[pino-websocket](https://www.npmjs.com/package/@abeai/pino-websocket) is a transport that will forward each log line to a websocket server. + +```sh +$ node app.js | pino-websocket -a my-websocket-server.example.com -p 3004 +``` + +For full documentation of command line switches read the [README](https://github.com/abeai/pino-websocket#readme). + + +### pino-yc-transport + +[pino-yc-transport](https://github.com/Jhon-Mosk/pino-yc-transport) is a Pino v7+ transport for writing to [Yandex Cloud Logging](https://yandex.cloud/ru/services/logging) from serveless functions or containers. + +```js +const pino = require("pino"); + +const config = { + level: "debug", + transport: { + target: "pino-yc-transport", + }, +}; + +const logger = pino(config); + +logger.debug("some message") +logger.debug({ foo: "bar" }); +logger.debug("some message %o, %s", { foo: "bar" }, "baz"); +logger.info("info"); +logger.warn("warn"); +logger.error("error"); +logger.error(new Error("error")); +logger.fatal("fatal"); +``` + + +## Communication between Pino and Transports +Here we discuss some technical details of how Pino communicates with its [worker threads](https://nodejs.org/api/worker_threads.html). + +Pino uses [`thread-stream`](https://github.com/pinojs/thread-stream) to create a stream for transports. +When we create a stream with `thread-stream`, `thread-stream` spawns a [worker](https://github.com/pinojs/thread-stream/blob/f19ac8dbd602837d2851e17fbc7dfc5bbc51083f/index.js#L50-L60) (an independent JavaScript execution thread). + +### Error messages +How are error messages propagated from a transport worker to Pino? + +Let's assume we have a transport with an error listener: +```js +// index.js +const transport = pino.transport({ + target: './transport.js' +}) + +transport.on('error', err => { + console.error('error caught', err) +}) + +const log = pino(transport) +``` + +When our worker emits an error event, the worker has listeners for it: [error](https://github.com/pinojs/thread-stream/blob/f19ac8dbd602837d2851e17fbc7dfc5bbc51083f/lib/worker.js#L59-L70) and [unhandledRejection](https://github.com/pinojs/thread-stream/blob/f19ac8dbd602837d2851e17fbc7dfc5bbc51083f/lib/worker.js#L135-L141). These listeners send the error message to the main thread where Pino is present. + +When Pino receives the error message, it further [emits](https://github.com/pinojs/thread-stream/blob/f19ac8dbd602837d2851e17fbc7dfc5bbc51083f/index.js#L349) the error message. Finally, the error message arrives at our `index.js` and is caught by our error listener. diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/web.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/web.md new file mode 100644 index 0000000000000000000000000000000000000000..45de8ad9cb327994b2549b2d8f63cc7fae70f67b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docs/web.md @@ -0,0 +1,309 @@ +# Web Frameworks + +Since HTTP logging is a primary use case, Pino has first-class support for the Node.js +web framework ecosystem. + +- [Web Frameworks](#web-frameworks) + - [Pino with Fastify](#pino-with-fastify) + - [Pino with Express](#pino-with-express) + - [Pino with Hapi](#pino-with-hapi) + - [Pino with Restify](#pino-with-restify) + - [Pino with Koa](#pino-with-koa) + - [Pino with Node core `http`](#pino-with-node-core-http) + - [Pino with Nest](#pino-with-nest) + - [Pino with H3](#pino-with-h3) + - [Pino with Hono](#pino-with-hono) + + +## Pino with Fastify + +The Fastify web framework comes bundled with Pino by default, simply set Fastify's +`logger` option to `true` and use `request.log` or `reply.log` for log messages that correspond +to each request: + +```js +const fastify = require('fastify')({ + logger: true +}) + +fastify.get('/', async (request, reply) => { + request.log.info('something') + return { hello: 'world' } +}) + +fastify.listen({ port: 3000 }, (err) => { + if (err) { + fastify.log.error(err) + process.exit(1) + } +}) +``` + +The `logger` option can also be set to an object, which will be passed through directly +as the [`pino` options object](/docs/api.md#options-object). + +See the [fastify documentation](https://www.fastify.io/docs/latest/Reference/Logging/) for more information. + + +## Pino with Express + +```sh +npm install pino-http +``` + +```js +const app = require('express')() +const pino = require('pino-http')() + +app.use(pino) + +app.get('/', function (req, res) { + req.log.info('something') + res.send('hello world') +}) + +app.listen(3000) +``` + +See the [pino-http README](https://npm.im/pino-http) for more info. + + +## Pino with Hapi + +```sh +npm install hapi-pino +``` + +```js +'use strict' + +const Hapi = require('@hapi/hapi') +const Pino = require('hapi-pino'); + +async function start () { + // Create a server with a host and port + const server = Hapi.server({ + host: 'localhost', + port: 3000 + }) + + // Add the route + server.route({ + method: 'GET', + path: '/', + handler: async function (request, h) { + // request.log is HAPI's standard way of logging + request.log(['a', 'b'], 'Request into hello world') + + // a pino instance can also be used, which will be faster + request.logger.info('In handler %s', request.path) + + return 'hello world' + } + }) + + await server.register(Pino) + + // also as a decorated API + server.logger.info('another way for accessing it') + + // and through Hapi standard logging system + server.log(['subsystem'], 'third way for accessing it') + + await server.start() + + return server +} + +start().catch((err) => { + console.log(err) + process.exit(1) +}) +``` + +See the [hapi-pino README](https://npm.im/hapi-pino) for more info. + + +## Pino with Restify + +```sh +npm install restify-pino-logger +``` + +```js +const server = require('restify').createServer({name: 'server'}) +const pino = require('restify-pino-logger')() + +server.use(pino) + +server.get('/', function (req, res) { + req.log.info('something') + res.send('hello world') +}) + +server.listen(3000) +``` + +See the [restify-pino-logger README](https://npm.im/restify-pino-logger) for more info. + + +## Pino with Koa + +```sh +npm install koa-pino-logger +``` + +```js +const Koa = require('koa') +const app = new Koa() +const pino = require('koa-pino-logger')() + +app.use(pino) + +app.use((ctx) => { + ctx.log.info('something else') + ctx.body = 'hello world' +}) + +app.listen(3000) +``` + +See the [koa-pino-logger README](https://github.com/pinojs/koa-pino-logger) for more info. + + +## Pino with Node core `http` + +```sh +npm install pino-http +``` + +```js +const http = require('http') +const server = http.createServer(handle) +const logger = require('pino-http')() + +function handle (req, res) { + logger(req, res) + req.log.info('something else') + res.end('hello world') +} + +server.listen(3000) +``` + +See the [pino-http README](https://npm.im/pino-http) for more info. + + + +## Pino with Nest + +```sh +npm install nestjs-pino +``` + +```ts +import { NestFactory } from '@nestjs/core' +import { Controller, Get, Module } from '@nestjs/common' +import { LoggerModule, Logger } from 'nestjs-pino' + +@Controller() +export class AppController { + constructor(private readonly logger: Logger) {} + + @Get() + getHello() { + this.logger.log('something') + return `Hello world` + } +} + +@Module({ + controllers: [AppController], + imports: [LoggerModule.forRoot()] +}) +class MyModule {} + +async function bootstrap() { + const app = await NestFactory.create(MyModule) + await app.listen(3000) +} +bootstrap() +``` + +See the [nestjs-pino README](https://npm.im/nestjs-pino) for more info. + + + +## Pino with H3 + +```sh +npm install pino-http h3 +``` + +Save as `server.mjs`: + +```js +import { createApp, createRouter, eventHandler, fromNodeMiddleware } from "h3"; +import pino from 'pino-http' + +export const app = createApp(); + +const router = createRouter(); +app.use(router); +app.use(fromNodeMiddleware(pino())) + +app.use(eventHandler((event) => { + event.node.req.log.info('something') + return 'hello world' +})) + +router.get( + "/", + eventHandler((event) => { + return { path: event.path, message: "Hello World!" }; + }), +); +``` + +Execute `npx --yes listhen -w --open ./server.mjs`. + +See the [pino-http README](https://npm.im/pino-http) for more info. + + + +## Pino with Hono + +```sh +npm install pino pino-http hono +``` + +```js +import { serve } from '@hono/node-server'; +import { Hono } from 'hono'; +import { requestId } from 'hono/request-id'; +import { pinoHttp } from 'pino-http'; + +const app = new Hono(); +app.use(requestId()); +app.use(async (c, next) => { + // pass hono's request-id to pino-http + c.env.incoming.id = c.var.requestId; + + // map express style middleware to hono + await new Promise((resolve) => pinoHttp()(c.env.incoming, c.env.outgoing, () => resolve())); + + c.set('logger', c.env.incoming.log); + + await next(); +}); + +app.get('/', (c) => { + c.var.logger.info('something'); + + return c.text('Hello Node.js!'); +}); + +serve(app); +``` + +See the [pino-http README](https://npm.im/pino-http) for more info. diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/docsify/sidebar.md b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docsify/sidebar.md new file mode 100644 index 0000000000000000000000000000000000000000..01e97a538dd53169a2ee984962cce3f43229074e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/docsify/sidebar.md @@ -0,0 +1,26 @@ +* [Readme](/) +* [API](/docs/api.md) +* [Browser API](/docs/browser.md) +* [Redaction](/docs/redaction.md) +* [Child Loggers](/docs/child-loggers.md) +* [Transports](/docs/transports.md) +* [Web Frameworks](/docs/web.md) +* [Pretty Printing](/docs/pretty.md) +* [Asynchronous Logging](/docs/asynchronous.md) +* [Ecosystem](/docs/ecosystem.md) +* [Benchmarks](/docs/benchmarks.md) +* [Long Term Support](/docs/lts.md) +* [Help](/docs/help.md) + * [Log rotation](/docs/help.md#rotate) + * [Reopening log files](/docs/help.md#reopening) + * [Saving to multiple files](/docs/help.md#multiple) + * [Log filtering](/docs/help.md#filter-logs) + * [Transports and systemd](/docs/help.md#transport-systemd) + * [Duplicate keys](/docs/help.md#dupe-keys) + * [Log levels as labels instead of numbers](/docs/help.md#level-string) + * [Pino with `debug`](/docs/help.md#debug) + * [Unicode and Windows terminal](/docs/help.md#windows) + * [Mapping Pino Log Levels to Google Cloud Logging (Stackdriver) Severity Levels](/docs/help.md#stackdriver) + * [Avoid Message Conflict](/docs/help.md#avoid-message-conflict) + * [Best performance for logging to `stdout`](/docs/help.md#best-performance-for-stdout) + * [Testing](/docs/help.md#testing) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/examples/basic.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/examples/basic.js new file mode 100644 index 0000000000000000000000000000000000000000..bab079a9320776cf3a1798eadbd146e6b30b8e6e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/examples/basic.js @@ -0,0 +1,43 @@ +'use strict' + +// Pino's primary usage writes ndjson to `stdout`: +const pino = require('..')() + +// However, if "human readable" output is desired, +// `pino-pretty` can be provided as the destination +// stream by uncommenting the following line in place +// of the previous declaration: +// const pino = require('..')(require('pino-pretty')()) + +pino.info('hello world') +pino.error('this is at error level') +pino.info('the answer is %d', 42) +pino.info({ obj: 42 }, 'hello world') +pino.info({ obj: 42, b: 2 }, 'hello world') +pino.info({ nested: { obj: 42 } }, 'nested') +setImmediate(() => { + pino.info('after setImmediate') +}) +pino.error(new Error('an error')) + +const child = pino.child({ a: 'property' }) +child.info('hello child!') + +const childsChild = child.child({ another: 'property' }) +childsChild.info('hello baby..') + +pino.debug('this should be mute') + +pino.level = 'trace' + +pino.debug('this is a debug statement') + +pino.child({ another: 'property' }).debug('this is a debug statement via child') +pino.trace('this is a trace statement') + +pino.debug('this is a "debug" statement with "') + +pino.info(new Error('kaboom')) +pino.info(null) + +pino.info(new Error('kaboom'), 'with', 'a', 'message') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/examples/transport.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/examples/transport.js new file mode 100644 index 0000000000000000000000000000000000000000..7ffab98154e8a548b6b200292d844c1ec348b181 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/examples/transport.js @@ -0,0 +1,68 @@ +'use strict' + +const pino = require('..') +const { tmpdir } = require('node:os') +const { join } = require('node:path') + +const file = join(tmpdir(), `pino-${process.pid}-example`) + +const transport = pino.transport({ + targets: [{ + level: 'warn', + target: 'pino/file', + options: { + destination: file + } + /* + }, { + level: 'info', + target: 'pino-elasticsearch', + options: { + node: 'http://localhost:9200' + } + */ + }, { + level: 'info', + target: 'pino-pretty' + }] +}) + +const logger = pino(transport) + +logger.info({ + file +}, 'logging destination') + +logger.info('hello world') +logger.error('this is at error level') +logger.info('the answer is %d', 42) +logger.info({ obj: 42 }, 'hello world') +logger.info({ obj: 42, b: 2 }, 'hello world') +logger.info({ nested: { obj: 42 } }, 'nested') +logger.warn('WARNING!') +setImmediate(() => { + logger.info('after setImmediate') +}) +logger.error(new Error('an error')) + +const child = logger.child({ a: 'property' }) +child.info('hello child!') + +const childsChild = child.child({ another: 'property' }) +childsChild.info('hello baby..') + +logger.debug('this should be mute') + +logger.level = 'trace' + +logger.debug('this is a debug statement') + +logger.child({ another: 'property' }).debug('this is a debug statement via child') +logger.trace('this is a trace statement') + +logger.debug('this is a "debug" statement with "') + +logger.info(new Error('kaboom')) +logger.info(null) + +logger.info(new Error('kaboom'), 'with', 'a', 'message') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/caller.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/caller.js new file mode 100644 index 0000000000000000000000000000000000000000..f39e08781cebd0d4c2808f8f5497ed08e3521b98 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/caller.js @@ -0,0 +1,30 @@ +'use strict' + +function noOpPrepareStackTrace (_, stack) { + return stack +} + +module.exports = function getCallers () { + const originalPrepare = Error.prepareStackTrace + Error.prepareStackTrace = noOpPrepareStackTrace + const stack = new Error().stack + Error.prepareStackTrace = originalPrepare + + if (!Array.isArray(stack)) { + return undefined + } + + const entries = stack.slice(2) + + const fileNames = [] + + for (const entry of entries) { + if (!entry) { + continue + } + + fileNames.push(entry.getFileName()) + } + + return fileNames +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/constants.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..f91f73157aafc69ce94e2e4256d6cdb083d5e1e0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/constants.js @@ -0,0 +1,28 @@ +/** + * Represents default log level values + * + * @enum {number} + */ +const DEFAULT_LEVELS = { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60 +} + +/** + * Represents sort order direction: `ascending` or `descending` + * + * @enum {string} + */ +const SORTING_ORDER = { + ASC: 'ASC', + DESC: 'DESC' +} + +module.exports = { + DEFAULT_LEVELS, + SORTING_ORDER +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/deprecations.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/deprecations.js new file mode 100644 index 0000000000000000000000000000000000000000..806c5362e70e6629272cbbf12ed23d9bf9b6a093 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/deprecations.js @@ -0,0 +1,8 @@ +'use strict' + +const warning = require('process-warning')() +module.exports = warning + +// const warnName = 'PinoWarning' + +// warning.create(warnName, 'PINODEP010', 'A new deprecation') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/levels.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/levels.js new file mode 100644 index 0000000000000000000000000000000000000000..67e6a99dbe9663a215cedabeeec93bf57f5662fb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/levels.js @@ -0,0 +1,241 @@ +'use strict' +/* eslint no-prototype-builtins: 0 */ +const { + lsCacheSym, + levelValSym, + useOnlyCustomLevelsSym, + streamSym, + formattersSym, + hooksSym, + levelCompSym +} = require('./symbols') +const { noop, genLog } = require('./tools') +const { DEFAULT_LEVELS, SORTING_ORDER } = require('./constants') + +const levelMethods = { + fatal: (hook) => { + const logFatal = genLog(DEFAULT_LEVELS.fatal, hook) + return function (...args) { + const stream = this[streamSym] + logFatal.call(this, ...args) + if (typeof stream.flushSync === 'function') { + try { + stream.flushSync() + } catch (e) { + // https://github.com/pinojs/pino/pull/740#discussion_r346788313 + } + } + } + }, + error: (hook) => genLog(DEFAULT_LEVELS.error, hook), + warn: (hook) => genLog(DEFAULT_LEVELS.warn, hook), + info: (hook) => genLog(DEFAULT_LEVELS.info, hook), + debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook), + trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook) +} + +const nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => { + o[DEFAULT_LEVELS[k]] = k + return o +}, {}) + +const initialLsCache = Object.keys(nums).reduce((o, k) => { + o[k] = '{"level":' + Number(k) + return o +}, {}) + +function genLsCache (instance) { + const formatter = instance[formattersSym].level + const { labels } = instance.levels + const cache = {} + for (const label in labels) { + const level = formatter(labels[label], Number(label)) + cache[label] = JSON.stringify(level).slice(0, -1) + } + instance[lsCacheSym] = cache + return instance +} + +function isStandardLevel (level, useOnlyCustomLevels) { + if (useOnlyCustomLevels) { + return false + } + + switch (level) { + case 'fatal': + case 'error': + case 'warn': + case 'info': + case 'debug': + case 'trace': + return true + default: + return false + } +} + +function setLevel (level) { + const { labels, values } = this.levels + if (typeof level === 'number') { + if (labels[level] === undefined) throw Error('unknown level value' + level) + level = labels[level] + } + if (values[level] === undefined) throw Error('unknown level ' + level) + const preLevelVal = this[levelValSym] + const levelVal = this[levelValSym] = values[level] + const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym] + const levelComparison = this[levelCompSym] + const hook = this[hooksSym].logMethod + + for (const key in values) { + if (levelComparison(values[key], levelVal) === false) { + this[key] = noop + continue + } + this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook) + } + + this.emit( + 'level-change', + level, + levelVal, + labels[preLevelVal], + preLevelVal, + this + ) +} + +function getLevel (level) { + const { levels, levelVal } = this + // protection against potential loss of Pino scope from serializers (edge case with circular refs - https://github.com/pinojs/pino/issues/833) + return (levels && levels.labels) ? levels.labels[levelVal] : '' +} + +function isLevelEnabled (logLevel) { + const { values } = this.levels + const logLevelVal = values[logLevel] + return logLevelVal !== undefined && this[levelCompSym](logLevelVal, this[levelValSym]) +} + +/** + * Determine if the given `current` level is enabled by comparing it + * against the current threshold (`expected`). + * + * @param {SORTING_ORDER} direction comparison direction "ASC" or "DESC" + * @param {number} current current log level number representation + * @param {number} expected threshold value to compare with + * @returns {boolean} + */ +function compareLevel (direction, current, expected) { + if (direction === SORTING_ORDER.DESC) { + return current <= expected + } + + return current >= expected +} + +/** + * Create a level comparison function based on `levelComparison` + * it could a default function which compares levels either in "ascending" or "descending" order or custom comparison function + * + * @param {SORTING_ORDER | Function} levelComparison sort levels order direction or custom comparison function + * @returns Function + */ +function genLevelComparison (levelComparison) { + if (typeof levelComparison === 'string') { + return compareLevel.bind(null, levelComparison) + } + + return levelComparison +} + +function mappings (customLevels = null, useOnlyCustomLevels = false) { + const customNums = customLevels + /* eslint-disable */ + ? Object.keys(customLevels).reduce((o, k) => { + o[customLevels[k]] = k + return o + }, {}) + : null + /* eslint-enable */ + + const labels = Object.assign( + Object.create(Object.prototype, { Infinity: { value: 'silent' } }), + useOnlyCustomLevels ? null : nums, + customNums + ) + const values = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : DEFAULT_LEVELS, + customLevels + ) + return { labels, values } +} + +function assertDefaultLevelFound (defaultLevel, customLevels, useOnlyCustomLevels) { + if (typeof defaultLevel === 'number') { + const values = [].concat( + Object.keys(customLevels || {}).map(key => customLevels[key]), + useOnlyCustomLevels ? [] : Object.keys(nums).map(level => +level), + Infinity + ) + if (!values.includes(defaultLevel)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`) + } + return + } + + const labels = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : DEFAULT_LEVELS, + customLevels + ) + if (!(defaultLevel in labels)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`) + } +} + +function assertNoLevelCollisions (levels, customLevels) { + const { labels, values } = levels + for (const k in customLevels) { + if (k in values) { + throw Error('levels cannot be overridden') + } + if (customLevels[k] in labels) { + throw Error('pre-existing level values cannot be used for new levels') + } + } +} + +/** + * Validates whether `levelComparison` is correct + * + * @throws Error + * @param {SORTING_ORDER | Function} levelComparison - value to validate + * @returns + */ +function assertLevelComparison (levelComparison) { + if (typeof levelComparison === 'function') { + return + } + + if (typeof levelComparison === 'string' && Object.values(SORTING_ORDER).includes(levelComparison)) { + return + } + + throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type') +} + +module.exports = { + initialLsCache, + genLsCache, + levelMethods, + getLevel, + setLevel, + isLevelEnabled, + mappings, + assertNoLevelCollisions, + assertDefaultLevelFound, + genLevelComparison, + assertLevelComparison +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/meta.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/meta.js new file mode 100644 index 0000000000000000000000000000000000000000..672484be6a90497d2aea5e7894523b3b6d792c93 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/meta.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = { version: '9.9.0' } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/multistream.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/multistream.js new file mode 100644 index 0000000000000000000000000000000000000000..42cdbfb8487ad9f1497c12ae0422575e221a977f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/multistream.js @@ -0,0 +1,203 @@ +'use strict' + +const metadata = Symbol.for('pino.metadata') +const { DEFAULT_LEVELS } = require('./constants') + +const DEFAULT_INFO_LEVEL = DEFAULT_LEVELS.info + +function multistream (streamsArray, opts) { + streamsArray = streamsArray || [] + opts = opts || { dedupe: false } + + const streamLevels = Object.create(DEFAULT_LEVELS) + streamLevels.silent = Infinity + if (opts.levels && typeof opts.levels === 'object') { + Object.keys(opts.levels).forEach(i => { + streamLevels[i] = opts.levels[i] + }) + } + + const res = { + write, + add, + remove, + emit, + flushSync, + end, + minLevel: 0, + lastId: 0, + streams: [], + clone, + [metadata]: true, + streamLevels + } + + if (Array.isArray(streamsArray)) { + streamsArray.forEach(add, res) + } else { + add.call(res, streamsArray) + } + + // clean this object up + // or it will stay allocated forever + // as it is closed on the following closures + streamsArray = null + + return res + + // we can exit early because the streams are ordered by level + function write (data) { + let dest + const level = this.lastLevel + const { streams } = this + // for handling situation when several streams has the same level + let recordedLevel = 0 + let stream + + // if dedupe set to true we send logs to the stream with the highest level + // therefore, we have to change sorting order + for (let i = initLoopVar(streams.length, opts.dedupe); checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) { + dest = streams[i] + if (dest.level <= level) { + if (recordedLevel !== 0 && recordedLevel !== dest.level) { + break + } + stream = dest.stream + if (stream[metadata]) { + const { lastTime, lastMsg, lastObj, lastLogger } = this + stream.lastLevel = level + stream.lastTime = lastTime + stream.lastMsg = lastMsg + stream.lastObj = lastObj + stream.lastLogger = lastLogger + } + stream.write(data) + if (opts.dedupe) { + recordedLevel = dest.level + } + } else if (!opts.dedupe) { + break + } + } + } + + function emit (...args) { + for (const { stream } of this.streams) { + if (typeof stream.emit === 'function') { + stream.emit(...args) + } + } + } + + function flushSync () { + for (const { stream } of this.streams) { + if (typeof stream.flushSync === 'function') { + stream.flushSync() + } + } + } + + function add (dest) { + if (!dest) { + return res + } + + // Check that dest implements either StreamEntry or DestinationStream + const isStream = typeof dest.write === 'function' || dest.stream + const stream_ = dest.write ? dest : dest.stream + // This is necessary to provide a meaningful error message, otherwise it throws somewhere inside write() + if (!isStream) { + throw Error('stream object needs to implement either StreamEntry or DestinationStream interface') + } + + const { streams, streamLevels } = this + + let level + if (typeof dest.levelVal === 'number') { + level = dest.levelVal + } else if (typeof dest.level === 'string') { + level = streamLevels[dest.level] + } else if (typeof dest.level === 'number') { + level = dest.level + } else { + level = DEFAULT_INFO_LEVEL + } + + const dest_ = { + stream: stream_, + level, + levelVal: undefined, + id: ++res.lastId + } + + streams.unshift(dest_) + streams.sort(compareByLevel) + + this.minLevel = streams[0].level + + return res + } + + function remove (id) { + const { streams } = this + const index = streams.findIndex(s => s.id === id) + + if (index >= 0) { + streams.splice(index, 1) + streams.sort(compareByLevel) + this.minLevel = streams.length > 0 ? streams[0].level : -1 + } + + return res + } + + function end () { + for (const { stream } of this.streams) { + if (typeof stream.flushSync === 'function') { + stream.flushSync() + } + stream.end() + } + } + + function clone (level) { + const streams = new Array(this.streams.length) + + for (let i = 0; i < streams.length; i++) { + streams[i] = { + level, + stream: this.streams[i].stream + } + } + + return { + write, + add, + remove, + minLevel: level, + streams, + clone, + emit, + flushSync, + [metadata]: true + } + } +} + +function compareByLevel (a, b) { + return a.level - b.level +} + +function initLoopVar (length, dedupe) { + return dedupe ? length - 1 : 0 +} + +function adjustLoopVar (i, dedupe) { + return dedupe ? i - 1 : i + 1 +} + +function checkLoopVar (i, length, dedupe) { + return dedupe ? i >= 0 : i < length +} + +module.exports = multistream diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/proto.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/proto.js new file mode 100644 index 0000000000000000000000000000000000000000..8652c5477237efe44bba27bbcbab7276bf53c5de --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/proto.js @@ -0,0 +1,235 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const { EventEmitter } = require('node:events') +const { + lsCacheSym, + levelValSym, + setLevelSym, + getLevelSym, + chindingsSym, + parsedChindingsSym, + mixinSym, + asJsonSym, + writeSym, + mixinMergeStrategySym, + timeSym, + timeSliceIndexSym, + streamSym, + serializersSym, + formattersSym, + errorKeySym, + messageKeySym, + useOnlyCustomLevelsSym, + needsMetadataGsym, + redactFmtSym, + stringifySym, + formatOptsSym, + stringifiersSym, + msgPrefixSym, + hooksSym +} = require('./symbols') +const { + getLevel, + setLevel, + isLevelEnabled, + mappings, + initialLsCache, + genLsCache, + assertNoLevelCollisions +} = require('./levels') +const { + asChindings, + asJson, + buildFormatters, + stringify +} = require('./tools') +const { + version +} = require('./meta') +const redaction = require('./redaction') + +// note: use of class is satirical +// https://github.com/pinojs/pino/pull/433#pullrequestreview-127703127 +const constructor = class Pino {} +const prototype = { + constructor, + child, + bindings, + setBindings, + flush, + isLevelEnabled, + version, + get level () { return this[getLevelSym]() }, + set level (lvl) { this[setLevelSym](lvl) }, + get levelVal () { return this[levelValSym] }, + set levelVal (n) { throw Error('levelVal is read-only') }, + get msgPrefix () { return this[msgPrefixSym] }, + [lsCacheSym]: initialLsCache, + [writeSym]: write, + [asJsonSym]: asJson, + [getLevelSym]: getLevel, + [setLevelSym]: setLevel +} + +Object.setPrototypeOf(prototype, EventEmitter.prototype) + +// exporting and consuming the prototype object using factory pattern fixes scoping issues with getters when serializing +module.exports = function () { + return Object.create(prototype) +} + +const resetChildingsFormatter = bindings => bindings +function child (bindings, options) { + if (!bindings) { + throw Error('missing bindings for child Pino') + } + options = options || {} // default options to empty object + const serializers = this[serializersSym] + const formatters = this[formattersSym] + const instance = Object.create(this) + + if (options.hasOwnProperty('serializers') === true) { + instance[serializersSym] = Object.create(null) + + for (const k in serializers) { + instance[serializersSym][k] = serializers[k] + } + const parentSymbols = Object.getOwnPropertySymbols(serializers) + /* eslint no-var: off */ + for (var i = 0; i < parentSymbols.length; i++) { + const ks = parentSymbols[i] + instance[serializersSym][ks] = serializers[ks] + } + + for (const bk in options.serializers) { + instance[serializersSym][bk] = options.serializers[bk] + } + const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers) + for (var bi = 0; bi < bindingsSymbols.length; bi++) { + const bks = bindingsSymbols[bi] + instance[serializersSym][bks] = options.serializers[bks] + } + } else instance[serializersSym] = serializers + if (options.hasOwnProperty('formatters')) { + const { level, bindings: chindings, log } = options.formatters + instance[formattersSym] = buildFormatters( + level || formatters.level, + chindings || resetChildingsFormatter, + log || formatters.log + ) + } else { + instance[formattersSym] = buildFormatters( + formatters.level, + resetChildingsFormatter, + formatters.log + ) + } + if (options.hasOwnProperty('customLevels') === true) { + assertNoLevelCollisions(this.levels, options.customLevels) + instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]) + genLsCache(instance) + } + + // redact must place before asChindings and only replace if exist + if ((typeof options.redact === 'object' && options.redact !== null) || Array.isArray(options.redact)) { + instance.redact = options.redact // replace redact directly + const stringifiers = redaction(instance.redact, stringify) + const formatOpts = { stringify: stringifiers[redactFmtSym] } + instance[stringifySym] = stringify + instance[stringifiersSym] = stringifiers + instance[formatOptsSym] = formatOpts + } + + if (typeof options.msgPrefix === 'string') { + instance[msgPrefixSym] = (this[msgPrefixSym] || '') + options.msgPrefix + } + + instance[chindingsSym] = asChindings(instance, bindings) + const childLevel = options.level || this.level + instance[setLevelSym](childLevel) + this.onChild(instance) + return instance +} + +function bindings () { + const chindings = this[chindingsSym] + const chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac" + const bindingsFromJson = JSON.parse(chindingsJson) + delete bindingsFromJson.pid + delete bindingsFromJson.hostname + return bindingsFromJson +} + +function setBindings (newBindings) { + const chindings = asChindings(this, newBindings) + this[chindingsSym] = chindings + delete this[parsedChindingsSym] +} + +/** + * Default strategy for creating `mergeObject` from arguments and the result from `mixin()`. + * Fields from `mergeObject` have higher priority in this strategy. + * + * @param {Object} mergeObject The object a user has supplied to the logging function. + * @param {Object} mixinObject The result of the `mixin` method. + * @return {Object} + */ +function defaultMixinMergeStrategy (mergeObject, mixinObject) { + return Object.assign(mixinObject, mergeObject) +} + +function write (_obj, msg, num) { + const t = this[timeSym]() + const mixin = this[mixinSym] + const errorKey = this[errorKeySym] + const messageKey = this[messageKeySym] + const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy + let obj + const streamWriteHook = this[hooksSym].streamWrite + + if (_obj === undefined || _obj === null) { + obj = {} + } else if (_obj instanceof Error) { + obj = { [errorKey]: _obj } + if (msg === undefined) { + msg = _obj.message + } + } else { + obj = _obj + if (msg === undefined && _obj[messageKey] === undefined && _obj[errorKey]) { + msg = _obj[errorKey].message + } + } + + if (mixin) { + obj = mixinMergeStrategy(obj, mixin(obj, num, this)) + } + + const s = this[asJsonSym](obj, msg, num, t) + + const stream = this[streamSym] + if (stream[needsMetadataGsym] === true) { + stream.lastLevel = num + stream.lastObj = obj + stream.lastMsg = msg + stream.lastTime = t.slice(this[timeSliceIndexSym]) + stream.lastLogger = this // for child loggers + } + stream.write(streamWriteHook ? streamWriteHook(s) : s) +} + +function noop () {} + +function flush (cb) { + if (cb != null && typeof cb !== 'function') { + throw Error('callback must be a function') + } + + const stream = this[streamSym] + + if (typeof stream.flush === 'function') { + stream.flush(cb || noop) + } else if (cb) cb() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/redaction.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/redaction.js new file mode 100644 index 0000000000000000000000000000000000000000..c5d7d897e6232756a1d0b397da723a246eff02af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/redaction.js @@ -0,0 +1,118 @@ +'use strict' + +const fastRedact = require('fast-redact') +const { redactFmtSym, wildcardFirstSym } = require('./symbols') +const { rx, validator } = fastRedact + +const validate = validator({ + ERR_PATHS_MUST_BE_STRINGS: () => 'pino – redacted paths must be strings', + ERR_INVALID_PATH: (s) => `pino – redact paths array contains an invalid path (${s})` +}) + +const CENSOR = '[Redacted]' +const strict = false // TODO should this be configurable? + +function redaction (opts, serialize) { + const { paths, censor } = handle(opts) + + const shape = paths.reduce((o, str) => { + rx.lastIndex = 0 + const first = rx.exec(str) + const next = rx.exec(str) + + // ns is the top-level path segment, brackets + quoting removed. + let ns = first[1] !== undefined + ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, '$1') + : first[0] + + if (ns === '*') { + ns = wildcardFirstSym + } + + // top level key: + if (next === null) { + o[ns] = null + return o + } + + // path with at least two segments: + // if ns is already redacted at the top level, ignore lower level redactions + if (o[ns] === null) { + return o + } + + const { index } = next + const nextPath = `${str.substr(index, str.length - 1)}` + + o[ns] = o[ns] || [] + + // shape is a mix of paths beginning with literal values and wildcard + // paths [ "a.b.c", "*.b.z" ] should reduce to a shape of + // { "a": [ "b.c", "b.z" ], *: [ "b.z" ] } + // note: "b.z" is in both "a" and * arrays because "a" matches the wildcard. + // (* entry has wildcardFirstSym as key) + if (ns !== wildcardFirstSym && o[ns].length === 0) { + // first time ns's get all '*' redactions so far + o[ns].push(...(o[wildcardFirstSym] || [])) + } + + if (ns === wildcardFirstSym) { + // new * path gets added to all previously registered literal ns's. + Object.keys(o).forEach(function (k) { + if (o[k]) { + o[k].push(nextPath) + } + }) + } + + o[ns].push(nextPath) + return o + }, {}) + + // the redactor assigned to the format symbol key + // provides top level redaction for instances where + // an object is interpolated into the msg string + const result = { + [redactFmtSym]: fastRedact({ paths, censor, serialize, strict }) + } + + const topCensor = (...args) => { + return typeof censor === 'function' ? serialize(censor(...args)) : serialize(censor) + } + + return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => { + // top level key: + if (shape[k] === null) { + o[k] = (value) => topCensor(value, [k]) + } else { + const wrappedCensor = typeof censor === 'function' + ? (value, path) => { + return censor(value, [k, ...path]) + } + : censor + o[k] = fastRedact({ + paths: shape[k], + censor: wrappedCensor, + serialize, + strict + }) + } + return o + }, result) +} + +function handle (opts) { + if (Array.isArray(opts)) { + opts = { paths: opts, censor: CENSOR } + validate(opts) + return opts + } + let { paths, censor = CENSOR, remove } = opts + if (Array.isArray(paths) === false) { throw Error('pino – redact must contain an array of strings') } + if (remove === true) censor = undefined + validate({ paths, censor }) + + return { paths, censor } +} + +module.exports = redaction diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/symbols.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/symbols.js new file mode 100644 index 0000000000000000000000000000000000000000..69f1a9d2569f8bfee0a79de42e21db50b11edd16 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/symbols.js @@ -0,0 +1,74 @@ +'use strict' + +const setLevelSym = Symbol('pino.setLevel') +const getLevelSym = Symbol('pino.getLevel') +const levelValSym = Symbol('pino.levelVal') +const levelCompSym = Symbol('pino.levelComp') +const useLevelLabelsSym = Symbol('pino.useLevelLabels') +const useOnlyCustomLevelsSym = Symbol('pino.useOnlyCustomLevels') +const mixinSym = Symbol('pino.mixin') + +const lsCacheSym = Symbol('pino.lsCache') +const chindingsSym = Symbol('pino.chindings') + +const asJsonSym = Symbol('pino.asJson') +const writeSym = Symbol('pino.write') +const redactFmtSym = Symbol('pino.redactFmt') + +const timeSym = Symbol('pino.time') +const timeSliceIndexSym = Symbol('pino.timeSliceIndex') +const streamSym = Symbol('pino.stream') +const stringifySym = Symbol('pino.stringify') +const stringifySafeSym = Symbol('pino.stringifySafe') +const stringifiersSym = Symbol('pino.stringifiers') +const endSym = Symbol('pino.end') +const formatOptsSym = Symbol('pino.formatOpts') +const messageKeySym = Symbol('pino.messageKey') +const errorKeySym = Symbol('pino.errorKey') +const nestedKeySym = Symbol('pino.nestedKey') +const nestedKeyStrSym = Symbol('pino.nestedKeyStr') +const mixinMergeStrategySym = Symbol('pino.mixinMergeStrategy') +const msgPrefixSym = Symbol('pino.msgPrefix') + +const wildcardFirstSym = Symbol('pino.wildcardFirst') + +// public symbols, no need to use the same pino +// version for these +const serializersSym = Symbol.for('pino.serializers') +const formattersSym = Symbol.for('pino.formatters') +const hooksSym = Symbol.for('pino.hooks') +const needsMetadataGsym = Symbol.for('pino.metadata') + +module.exports = { + setLevelSym, + getLevelSym, + levelValSym, + levelCompSym, + useLevelLabelsSym, + mixinSym, + lsCacheSym, + chindingsSym, + asJsonSym, + writeSym, + serializersSym, + redactFmtSym, + timeSym, + timeSliceIndexSym, + streamSym, + stringifySym, + stringifySafeSym, + stringifiersSym, + endSym, + formatOptsSym, + messageKeySym, + errorKeySym, + nestedKeySym, + wildcardFirstSym, + needsMetadataGsym, + useOnlyCustomLevelsSym, + formattersSym, + hooksSym, + nestedKeyStrSym, + mixinMergeStrategySym, + msgPrefixSym +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/time.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/time.js new file mode 100644 index 0000000000000000000000000000000000000000..420a028f18a6f50224a15c95deb797cefa1ecc49 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/time.js @@ -0,0 +1,11 @@ +'use strict' + +const nullTime = () => '' + +const epochTime = () => `,"time":${Date.now()}` + +const unixTime = () => `,"time":${Math.round(Date.now() / 1000.0)}` + +const isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"` // using Date.now() for testability + +module.exports = { nullTime, epochTime, unixTime, isoTime } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/tools.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/tools.js new file mode 100644 index 0000000000000000000000000000000000000000..b8b79d5e12a90a05dea6dcfa720665d56672af02 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/tools.js @@ -0,0 +1,390 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const format = require('quick-format-unescaped') +const { mapHttpRequest, mapHttpResponse } = require('pino-std-serializers') +const SonicBoom = require('sonic-boom') +const onExit = require('on-exit-leak-free') +const { + lsCacheSym, + chindingsSym, + writeSym, + serializersSym, + formatOptsSym, + endSym, + stringifiersSym, + stringifySym, + stringifySafeSym, + wildcardFirstSym, + nestedKeySym, + formattersSym, + messageKeySym, + errorKeySym, + nestedKeyStrSym, + msgPrefixSym +} = require('./symbols') +const { isMainThread } = require('worker_threads') +const transport = require('./transport') + +function noop () { +} + +function genLog (level, hook) { + if (!hook) return LOG + + return function hookWrappedLog (...args) { + hook.call(this, args, LOG, level) + } + + function LOG (o, ...n) { + if (typeof o === 'object') { + let msg = o + if (o !== null) { + if (o.method && o.headers && o.socket) { + o = mapHttpRequest(o) + } else if (typeof o.setHeader === 'function') { + o = mapHttpResponse(o) + } + } + let formatParams + if (msg === null && n.length === 0) { + formatParams = [null] + } else { + msg = n.shift() + formatParams = n + } + // We do not use a coercive check for `msg` as it is + // measurably slower than the explicit checks. + if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { + msg = this[msgPrefixSym] + msg + } + this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level) + } else { + let msg = o === undefined ? n.shift() : o + + // We do not use a coercive check for `msg` as it is + // measurably slower than the explicit checks. + if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { + msg = this[msgPrefixSym] + msg + } + this[writeSym](null, format(msg, n, this[formatOptsSym]), level) + } + } +} + +// magically escape strings for json +// relying on their charCodeAt +// everything below 32 needs JSON.stringify() +// 34 and 92 happens all the time, so we +// have a fast case for them +function asString (str) { + let result = '' + let last = 0 + let found = false + let point = 255 + const l = str.length + if (l > 100) { + return JSON.stringify(str) + } + for (var i = 0; i < l && point >= 32; i++) { + point = str.charCodeAt(i) + if (point === 34 || point === 92) { + result += str.slice(last, i) + '\\' + last = i + found = true + } + } + if (!found) { + result = str + } else { + result += str.slice(last) + } + return point < 32 ? JSON.stringify(str) : '"' + result + '"' +} + +function asJson (obj, msg, num, time) { + const stringify = this[stringifySym] + const stringifySafe = this[stringifySafeSym] + const stringifiers = this[stringifiersSym] + const end = this[endSym] + const chindings = this[chindingsSym] + const serializers = this[serializersSym] + const formatters = this[formattersSym] + const messageKey = this[messageKeySym] + const errorKey = this[errorKeySym] + let data = this[lsCacheSym][num] + time + + // we need the child bindings added to the output first so instance logged + // objects can take precedence when JSON.parse-ing the resulting log line + data = data + chindings + + let value + if (formatters.log) { + obj = formatters.log(obj) + } + const wildcardStringifier = stringifiers[wildcardFirstSym] + let propStr = '' + for (const key in obj) { + value = obj[key] + if (Object.prototype.hasOwnProperty.call(obj, key) && value !== undefined) { + if (serializers[key]) { + value = serializers[key](value) + } else if (key === errorKey && serializers.err) { + value = serializers.err(value) + } + + const stringifier = stringifiers[key] || wildcardStringifier + + switch (typeof value) { + case 'undefined': + case 'function': + continue + case 'number': + /* eslint no-fallthrough: "off" */ + if (Number.isFinite(value) === false) { + value = null + } + // this case explicitly falls through to the next one + case 'boolean': + if (stringifier) value = stringifier(value) + break + case 'string': + value = (stringifier || asString)(value) + break + default: + value = (stringifier || stringify)(value, stringifySafe) + } + if (value === undefined) continue + const strKey = asString(key) + propStr += ',' + strKey + ':' + value + } + } + + let msgStr = '' + if (msg !== undefined) { + value = serializers[messageKey] ? serializers[messageKey](msg) : msg + const stringifier = stringifiers[messageKey] || wildcardStringifier + + switch (typeof value) { + case 'function': + break + case 'number': + /* eslint no-fallthrough: "off" */ + if (Number.isFinite(value) === false) { + value = null + } + // this case explicitly falls through to the next one + case 'boolean': + if (stringifier) value = stringifier(value) + msgStr = ',"' + messageKey + '":' + value + break + case 'string': + value = (stringifier || asString)(value) + msgStr = ',"' + messageKey + '":' + value + break + default: + value = (stringifier || stringify)(value, stringifySafe) + msgStr = ',"' + messageKey + '":' + value + } + } + + if (this[nestedKeySym] && propStr) { + // place all the obj properties under the specified key + // the nested key is already formatted from the constructor + return data + this[nestedKeyStrSym] + propStr.slice(1) + '}' + msgStr + end + } else { + return data + propStr + msgStr + end + } +} + +function asChindings (instance, bindings) { + let value + let data = instance[chindingsSym] + const stringify = instance[stringifySym] + const stringifySafe = instance[stringifySafeSym] + const stringifiers = instance[stringifiersSym] + const wildcardStringifier = stringifiers[wildcardFirstSym] + const serializers = instance[serializersSym] + const formatter = instance[formattersSym].bindings + bindings = formatter(bindings) + + for (const key in bindings) { + value = bindings[key] + const valid = key !== 'level' && + key !== 'serializers' && + key !== 'formatters' && + key !== 'customLevels' && + bindings.hasOwnProperty(key) && + value !== undefined + if (valid === true) { + value = serializers[key] ? serializers[key](value) : value + value = (stringifiers[key] || wildcardStringifier || stringify)(value, stringifySafe) + if (value === undefined) continue + data += ',"' + key + '":' + value + } + } + return data +} + +function hasBeenTampered (stream) { + return stream.write !== stream.constructor.prototype.write +} + +function buildSafeSonicBoom (opts) { + const stream = new SonicBoom(opts) + stream.on('error', filterBrokenPipe) + // If we are sync: false, we must flush on exit + if (!opts.sync && isMainThread) { + onExit.register(stream, autoEnd) + + stream.on('close', function () { + onExit.unregister(stream) + }) + } + return stream + + function filterBrokenPipe (err) { + // Impossible to replicate across all operating systems + /* istanbul ignore next */ + if (err.code === 'EPIPE') { + // If we get EPIPE, we should stop logging here + // however we have no control to the consumer of + // SonicBoom, so we just overwrite the write method + stream.write = noop + stream.end = noop + stream.flushSync = noop + stream.destroy = noop + return + } + stream.removeListener('error', filterBrokenPipe) + stream.emit('error', err) + } +} + +function autoEnd (stream, eventName) { + // This check is needed only on some platforms + /* istanbul ignore next */ + if (stream.destroyed) { + return + } + + if (eventName === 'beforeExit') { + // We still have an event loop, let's use it + stream.flush() + stream.on('drain', function () { + stream.end() + }) + } else { + // For some reason istanbul is not detecting this, but it's there + /* istanbul ignore next */ + // We do not have an event loop, so flush synchronously + stream.flushSync() + } +} + +function createArgsNormalizer (defaultOptions) { + return function normalizeArgs (instance, caller, opts = {}, stream) { + // support stream as a string + if (typeof opts === 'string') { + stream = buildSafeSonicBoom({ dest: opts }) + opts = {} + } else if (typeof stream === 'string') { + if (opts && opts.transport) { + throw Error('only one of option.transport or stream can be specified') + } + stream = buildSafeSonicBoom({ dest: stream }) + } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) { + stream = opts + opts = {} + } else if (opts.transport) { + if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) { + throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)') + } + if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') { + throw Error('option.transport.targets do not allow custom level formatters') + } + + let customLevels + if (opts.customLevels) { + customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels) + } + stream = transport({ caller, ...opts.transport, levels: customLevels }) + } + opts = Object.assign({}, defaultOptions, opts) + opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers) + opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters) + + if (opts.prettyPrint) { + throw new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)') + } + + const { enabled, onChild } = opts + if (enabled === false) opts.level = 'silent' + if (!onChild) opts.onChild = noop + if (!stream) { + if (!hasBeenTampered(process.stdout)) { + // If process.stdout.fd is undefined, it means that we are running + // in a worker thread. Let's assume we are logging to file descriptor 1. + stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 }) + } else { + stream = process.stdout + } + } + return { opts, stream } + } +} + +function stringify (obj, stringifySafeFn) { + try { + return JSON.stringify(obj) + } catch (_) { + try { + const stringify = stringifySafeFn || this[stringifySafeSym] + return stringify(obj) + } catch (_) { + return '"[unable to serialize, circular reference is too complex to analyze]"' + } + } +} + +function buildFormatters (level, bindings, log) { + return { + level, + bindings, + log + } +} + +/** + * Convert a string integer file descriptor to a proper native integer + * file descriptor. + * + * @param {string} destination The file descriptor string to attempt to convert. + * + * @returns {Number} + */ +function normalizeDestFileDescriptor (destination) { + const fd = Number(destination) + if (typeof destination === 'string' && Number.isFinite(fd)) { + return fd + } + // destination could be undefined if we are in a worker + if (destination === undefined) { + // This is stdout in UNIX systems + return 1 + } + return destination +} + +module.exports = { + noop, + buildSafeSonicBoom, + asChindings, + asJson, + genLog, + createArgsNormalizer, + stringify, + buildFormatters, + normalizeDestFileDescriptor +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/transport-stream.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/transport-stream.js new file mode 100644 index 0000000000000000000000000000000000000000..22cb37e0a8c0f2e8114c30d9e4cb9f4dd1a85d81 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/transport-stream.js @@ -0,0 +1,56 @@ +'use strict' + +const { realImport, realRequire } = require('real-require') + +module.exports = loadTransportStreamBuilder + +/** + * Loads & returns a function to build transport streams + * @param {string} target + * @returns {Promise>} + * @throws {Error} In case the target module does not export a function + */ +async function loadTransportStreamBuilder (target) { + let fn + try { + const toLoad = target.startsWith('file://') ? target : 'file://' + target + + if (toLoad.endsWith('.ts') || toLoad.endsWith('.cts')) { + // TODO: add support for the TSM modules loader ( https://github.com/lukeed/tsm ). + if (process[Symbol.for('ts-node.register.instance')]) { + realRequire('ts-node/register') + } else if (process.env && process.env.TS_NODE_DEV) { + realRequire('ts-node-dev') + } + // TODO: Support ES imports once tsc, tap & ts-node provide better compatibility guarantees. + fn = realRequire(decodeURIComponent(target)) + } else { + fn = (await realImport(toLoad)) + } + } catch (error) { + // See this PR for details: https://github.com/pinojs/thread-stream/pull/34 + if ((error.code === 'ENOTDIR' || error.code === 'ERR_MODULE_NOT_FOUND')) { + fn = realRequire(target) + } else if (error.code === undefined || error.code === 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING') { + // When bundled with pkg, an undefined error is thrown when called with realImport + // When bundled with pkg and using node v20, an ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING error is thrown when called with realImport + // More info at: https://github.com/pinojs/thread-stream/issues/143 + try { + fn = realRequire(decodeURIComponent(target)) + } catch { + throw error + } + } else { + throw error + } + } + + // Depending on how the default export is performed, and on how the code is + // transpiled, we may find cases of two nested "default" objects. + // See https://github.com/pinojs/pino/issues/1243#issuecomment-982774762 + if (typeof fn === 'object') fn = fn.default + if (typeof fn === 'object') fn = fn.default + if (typeof fn !== 'function') throw Error('exported worker is not a function') + + return fn +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/transport.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/transport.js new file mode 100644 index 0000000000000000000000000000000000000000..8b5b48aba0d0cfb71ea8438bc846c2c15838738e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/transport.js @@ -0,0 +1,167 @@ +'use strict' + +const { createRequire } = require('module') +const getCallers = require('./caller') +const { join, isAbsolute, sep } = require('node:path') +const sleep = require('atomic-sleep') +const onExit = require('on-exit-leak-free') +const ThreadStream = require('thread-stream') + +function setupOnExit (stream) { + // This is leak free, it does not leave event handlers + onExit.register(stream, autoEnd) + onExit.registerBeforeExit(stream, flush) + + stream.on('close', function () { + onExit.unregister(stream) + }) +} + +function buildStream (filename, workerData, workerOpts, sync) { + const stream = new ThreadStream({ + filename, + workerData, + workerOpts, + sync + }) + + stream.on('ready', onReady) + stream.on('close', function () { + process.removeListener('exit', onExit) + }) + + process.on('exit', onExit) + + function onReady () { + process.removeListener('exit', onExit) + stream.unref() + + if (workerOpts.autoEnd !== false) { + setupOnExit(stream) + } + } + + function onExit () { + /* istanbul ignore next */ + if (stream.closed) { + return + } + stream.flushSync() + // Apparently there is a very sporadic race condition + // that in certain OS would prevent the messages to be flushed + // because the thread might not have been created still. + // Unfortunately we need to sleep(100) in this case. + sleep(100) + stream.end() + } + + return stream +} + +function autoEnd (stream) { + stream.ref() + stream.flushSync() + stream.end() + stream.once('close', function () { + stream.unref() + }) +} + +function flush (stream) { + stream.flushSync() +} + +function transport (fullOptions) { + const { pipeline, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions + + const options = { + ...fullOptions.options + } + + // Backwards compatibility + const callers = typeof caller === 'string' ? [caller] : caller + + // This will be eventually modified by bundlers + const bundlerOverrides = '__bundlerPathsOverrides' in globalThis ? globalThis.__bundlerPathsOverrides : {} + + let target = fullOptions.target + + if (target && targets) { + throw new Error('only one of target or targets can be specified') + } + + if (targets) { + target = bundlerOverrides['pino-worker'] || join(__dirname, 'worker.js') + options.targets = targets.filter(dest => dest.target).map((dest) => { + return { + ...dest, + target: fixTarget(dest.target) + } + }) + options.pipelines = targets.filter(dest => dest.pipeline).map((dest) => { + return dest.pipeline.map((t) => { + return { + ...t, + level: dest.level, // duplicate the pipeline `level` property defined in the upper level + target: fixTarget(t.target) + } + }) + }) + } else if (pipeline) { + target = bundlerOverrides['pino-worker'] || join(__dirname, 'worker.js') + options.pipelines = [pipeline.map((dest) => { + return { + ...dest, + target: fixTarget(dest.target) + } + })] + } + + if (levels) { + options.levels = levels + } + + if (dedupe) { + options.dedupe = dedupe + } + + options.pinoWillSendConfig = true + + return buildStream(fixTarget(target), options, worker, sync) + + function fixTarget (origin) { + origin = bundlerOverrides[origin] || origin + + if (isAbsolute(origin) || origin.indexOf('file://') === 0) { + return origin + } + + if (origin === 'pino/file') { + return join(__dirname, '..', 'file.js') + } + + let fixTarget + + for (const filePath of callers) { + try { + const context = filePath === 'node:repl' + ? process.cwd() + sep + : filePath + + fixTarget = createRequire(context).resolve(origin) + break + } catch (err) { + // Silent catch + continue + } + } + + if (!fixTarget) { + throw new Error(`unable to determine transport target for "${origin}"`) + } + + return fixTarget + } +} + +module.exports = transport diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/worker.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/worker.js new file mode 100644 index 0000000000000000000000000000000000000000..0bc035a00e4546fb6b5a927ca7f84021edcbb4b6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/lib/worker.js @@ -0,0 +1,194 @@ +'use strict' + +const EE = require('node:events') +const { pipeline, PassThrough } = require('node:stream') +const pino = require('../pino.js') +const build = require('pino-abstract-transport') +const loadTransportStreamBuilder = require('./transport-stream') + +// This file is not checked by the code coverage tool, +// as it is not reliable. + +/* istanbul ignore file */ + +/* + * > Multiple targets & pipelines + * + * + * ┌─────────────────────────────────────────────────┐ ┌─────┐ + * │ │ │ p │ + * │ │ │ i │ + * │ target │ │ n │ + * │ │ ────────────────────────────────┼────┤ o │ + * │ targets │ target │ │ . │ + * │ ────────────► │ ────────────────────────────────┼────┤ m │ source + * │ │ target │ │ u │ │ + * │ │ ────────────────────────────────┼────┤ l │ │write + * │ │ │ │ t │ ▼ + * │ │ pipeline ┌───────────────┐ │ │ i │ ┌────────┐ + * │ │ ──────────► │ PassThrough ├───┼────┤ s ├──────┤ │ + * │ │ └───────────────┘ │ │ t │ write│ Thread │ + * │ │ │ │ r │◄─────┤ Stream │ + * │ │ pipeline ┌───────────────┐ │ │ e │ │ │ + * │ │ ──────────► │ PassThrough ├───┼────┤ a │ └────────┘ + * │ └───────────────┘ │ │ m │ + * │ │ │ │ + * └─────────────────────────────────────────────────┘ └─────┘ + * + * + * + * > One single pipeline or target + * + * + * source + * │ + * ┌────────────────────────────────────────────────┐ │write + * │ │ ▼ + * │ │ ┌────────┐ + * │ targets │ target │ │ │ + * │ ────────────► │ ──────────────────────────────┤ │ │ + * │ │ │ │ │ + * │ ├──────┤ │ + * │ │ │ │ + * │ │ │ │ + * │ OR │ │ │ + * │ │ │ │ + * │ │ │ │ + * │ ┌──────────────┐ │ │ │ + * │ targets │ pipeline │ │ │ │ Thread │ + * │ ────────────► │ ────────────►│ PassThrough ├─┤ │ Stream │ + * │ │ │ │ │ │ │ + * │ └──────────────┘ │ │ │ + * │ │ │ │ + * │ OR │ write│ │ + * │ │◄─────┤ │ + * │ │ │ │ + * │ ┌──────────────┐ │ │ │ + * │ pipeline │ │ │ │ │ + * │ ──────────────►│ PassThrough ├────────────────┤ │ │ + * │ │ │ │ │ │ + * │ └──────────────┘ │ └────────┘ + * │ │ + * │ │ + * └────────────────────────────────────────────────┘ + */ + +module.exports = async function ({ targets, pipelines, levels, dedupe }) { + const targetStreams = [] + + // Process targets + if (targets && targets.length) { + targets = await Promise.all(targets.map(async (t) => { + const fn = await loadTransportStreamBuilder(t.target) + const stream = await fn(t.options) + return { + level: t.level, + stream + } + })) + + targetStreams.push(...targets) + } + + // Process pipelines + if (pipelines && pipelines.length) { + pipelines = await Promise.all( + pipelines.map(async (p) => { + let level + const pipeDests = await Promise.all( + p.map(async (t) => { + // level assigned to pipeline is duplicated over all its targets, just store it + level = t.level + const fn = await loadTransportStreamBuilder(t.target) + const stream = await fn(t.options) + return stream + } + )) + + return { + level, + stream: createPipeline(pipeDests) + } + }) + ) + targetStreams.push(...pipelines) + } + + // Skip building the multistream step if either one single pipeline or target is defined and + // return directly the stream instance back to TreadStream. + // This is equivalent to define either: + // + // pino.transport({ target: ... }) + // + // OR + // + // pino.transport({ pipeline: ... }) + if (targetStreams.length === 1) { + return targetStreams[0].stream + } else { + return build(process, { + parse: 'lines', + metadata: true, + close (err, cb) { + let expected = 0 + for (const transport of targetStreams) { + expected++ + transport.stream.on('close', closeCb) + transport.stream.end() + } + + function closeCb () { + if (--expected === 0) { + cb(err) + } + } + } + }) + } + + // TODO: Why split2 was not used for pipelines? + function process (stream) { + const multi = pino.multistream(targetStreams, { levels, dedupe }) + // TODO manage backpressure + stream.on('data', function (chunk) { + const { lastTime, lastMsg, lastObj, lastLevel } = this + multi.lastLevel = lastLevel + multi.lastTime = lastTime + multi.lastMsg = lastMsg + multi.lastObj = lastObj + + // TODO handle backpressure + multi.write(chunk + '\n') + }) + } + + /** + * Creates a pipeline using the provided streams and return an instance of `PassThrough` stream + * as a source for the pipeline. + * + * @param {(TransformStream|WritableStream)[]} streams An array of streams. + * All intermediate streams in the array *MUST* be `Transform` streams and only the last one `Writable`. + * @returns A `PassThrough` stream instance representing the source stream of the pipeline + */ + function createPipeline (streams) { + const ee = new EE() + const stream = new PassThrough({ + autoDestroy: true, + destroy (_, cb) { + ee.on('error', cb) + ee.on('closed', cb) + } + }) + + pipeline(stream, ...streams, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + ee.emit('error', err) + return + } + + ee.emit('closed') + }) + + return stream + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/basic.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/basic.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bdc3822299fa3b52929474f59b7d5c8648b4fc9e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/basic.test.js @@ -0,0 +1,876 @@ +'use strict' +const os = require('node:os') +const { readFileSync } = require('node:fs') +const { test } = require('tap') +const { sink, check, once, watchFileCreated, file } = require('./helper') +const pino = require('../') +const { version } = require('../package.json') +const { pid } = process +const hostname = os.hostname() + +test('pino version is exposed on export', async ({ equal }) => { + equal(pino.version, version) +}) + +test('pino version is exposed on instance', async ({ equal }) => { + const instance = pino() + equal(instance.version, version) +}) + +test('child instance exposes pino version', async ({ equal }) => { + const child = pino().child({ foo: 'bar' }) + equal(child.version, version) +}) + +test('bindings are exposed on every instance', async ({ same }) => { + const instance = pino() + same(instance.bindings(), {}) +}) + +test('bindings contain the name and the child bindings', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }).child({ foo: 'bar' }).child({ a: 2 }) + same(instance.bindings(), { name: 'basicTest', foo: 'bar', a: 2 }) +}) + +test('set bindings on instance', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }) + instance.setBindings({ foo: 'bar' }) + same(instance.bindings(), { name: 'basicTest', foo: 'bar' }) +}) + +test('newly set bindings overwrite old bindings', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info', base: { foo: 'bar' } }) + instance.setBindings({ foo: 'baz' }) + same(instance.bindings(), { name: 'basicTest', foo: 'baz' }) +}) + +test('set bindings on child instance', async ({ same }) => { + const child = pino({ name: 'basicTest', level: 'info' }).child({}) + child.setBindings({ foo: 'bar' }) + same(child.bindings(), { name: 'basicTest', foo: 'bar' }) +}) + +test('child should have bindings set by parent', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }) + instance.setBindings({ foo: 'bar' }) + const child = instance.child({}) + same(child.bindings(), { name: 'basicTest', foo: 'bar' }) +}) + +test('child should not share bindings of parent set after child creation', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }) + const child = instance.child({}) + instance.setBindings({ foo: 'bar' }) + same(instance.bindings(), { name: 'basicTest', foo: 'bar' }) + same(child.bindings(), { name: 'basicTest' }) +}) + +function levelTest (name, level) { + test(`${name} logs as ${level}`, async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + instance[name]('hello world') + check(equal, await once(stream, 'data'), level, 'hello world') + }) + + test(`passing objects at level ${name}`, async ({ equal, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + const obj = { hello: 'world' } + instance[name](obj) + + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + equal(result.pid, pid) + equal(result.hostname, hostname) + equal(result.level, level) + equal(result.hello, 'world') + same(Object.keys(obj), ['hello']) + }) + + test(`passing an object and a string at level ${name}`, async ({ equal, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + const obj = { hello: 'world' } + instance[name](obj, 'a string') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg: 'a string', + hello: 'world' + }) + same(Object.keys(obj), ['hello']) + }) + + test(`passing a undefined and a string at level ${name}`, async ({ equal, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + instance[name](undefined, 'a string') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg: 'a string' + }) + }) + + test(`overriding object key by string at level ${name}`, async ({ equal, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + instance[name]({ hello: 'world', msg: 'object' }, 'string') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg: 'string', + hello: 'world' + }) + }) + + test(`formatting logs as ${name}`, async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + instance[name]('hello %d', 42) + const result = await once(stream, 'data') + check(equal, result, level, 'hello 42') + }) + + test(`formatting a symbol at level ${name}`, async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + + const sym = Symbol('foo') + instance[name]('hello %s', sym) + + const result = await once(stream, 'data') + + check(equal, result, level, 'hello Symbol(foo)') + }) + + test(`passing error with a serializer at level ${name}`, async ({ equal, same }) => { + const stream = sink() + const err = new Error('myerror') + const instance = pino({ + serializers: { + err: pino.stdSerializers.err + } + }, stream) + instance.level = name + instance[name]({ err }) + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + err: { + type: 'Error', + message: err.message, + stack: err.stack + }, + msg: err.message + }) + }) + + test(`child logger for level ${name}`, async ({ equal, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + const child = instance.child({ hello: 'world' }) + child[name]('hello world') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg: 'hello world', + hello: 'world' + }) + }) +} + +levelTest('fatal', 60) +levelTest('error', 50) +levelTest('warn', 40) +levelTest('info', 30) +levelTest('debug', 20) +levelTest('trace', 10) + +test('serializers can return undefined to strip field', async ({ equal }) => { + const stream = sink() + const instance = pino({ + serializers: { + test () { return undefined } + } + }, stream) + + instance.info({ test: 'sensitive info' }) + const result = await once(stream, 'data') + equal('test' in result, false) +}) + +test('streams receive a message event with PINO_CONFIG', ({ match, end }) => { + const stream = sink() + stream.once('message', (message) => { + match(message, { + code: 'PINO_CONFIG', + config: { + errorKey: 'err', + levels: { + labels: { + 10: 'trace', + 20: 'debug', + 30: 'info', + 40: 'warn', + 50: 'error', + 60: 'fatal' + }, + values: { + debug: 20, + error: 50, + fatal: 60, + info: 30, + trace: 10, + warn: 40 + } + }, + messageKey: 'msg' + } + }) + end() + }) + pino(stream) +}) + +test('does not explode with a circular ref', async ({ doesNotThrow }) => { + const stream = sink() + const instance = pino(stream) + const b = {} + const a = { + hello: b + } + b.a = a // circular ref + doesNotThrow(() => instance.info(a)) +}) + +test('set the name', async ({ equal, same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('this is fatal') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 60, + name: 'hello', + msg: 'this is fatal' + }) +}) + +test('set the messageKey', async ({ equal, same }) => { + const stream = sink() + const message = 'hello world' + const messageKey = 'fooMessage' + const instance = pino({ + messageKey + }, stream) + instance.info(message) + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 30, + fooMessage: message + }) +}) + +test('set the nestedKey', async ({ equal, same }) => { + const stream = sink() + const object = { hello: 'world' } + const nestedKey = 'stuff' + const instance = pino({ + nestedKey + }, stream) + instance.info(object) + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 30, + stuff: object + }) +}) + +test('set undefined properties', async ({ equal, same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({ hello: 'world', property: undefined }) + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 30, + hello: 'world' + }) +}) + +test('prototype properties are not logged', async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + instance.info(Object.create({ hello: 'world' })) + const { hello } = await once(stream, 'data') + equal(hello, undefined) +}) + +test('set the base', async ({ equal, same }) => { + const stream = sink() + const instance = pino({ + base: { + a: 'b' + } + }, stream) + + instance.fatal('this is fatal') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + a: 'b', + level: 60, + msg: 'this is fatal' + }) +}) + +test('set the base to null', async ({ equal, same }) => { + const stream = sink() + const instance = pino({ + base: null + }, stream) + instance.fatal('this is fatal') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + level: 60, + msg: 'this is fatal' + }) +}) + +test('set the base to null and use a formatter', async ({ equal, same }) => { + const stream = sink() + const instance = pino({ + base: null, + formatters: { + log (input) { + return Object.assign({}, input, { additionalMessage: 'using pino' }) + } + } + }, stream) + instance.fatal('this is fatal too') + const result = await once(stream, 'data') + equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + level: 60, + msg: 'this is fatal too', + additionalMessage: 'using pino' + }) +}) + +test('throw if creating child without bindings', async ({ equal, fail }) => { + const stream = sink() + const instance = pino(stream) + try { + instance.child() + fail('it should throw') + } catch (err) { + equal(err.message, 'missing bindings for child Pino') + } +}) + +test('correctly escapes msg strings with stray double quote at end', async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + + instance.fatal('this contains "') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + name: 'hello', + msg: 'this contains "' + }) +}) + +test('correctly escape msg strings with unclosed double quote', async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('" this contains') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + name: 'hello', + msg: '" this contains' + }) +}) + +test('correctly escape quote in a key', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + const obj = { 'some"obj': 'world' } + instance.info(obj, 'a string') + const result = await once(stream, 'data') + delete result.time + same(result, { + level: 30, + pid, + hostname, + msg: 'a string', + 'some"obj': 'world' + }) + same(Object.keys(obj), ['some"obj']) +}) + +// https://github.com/pinojs/pino/issues/139 +test('object and format string', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({}, 'foo %s', 'bar') + + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'foo bar' + }) +}) + +test('object and format string property', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({ answer: 42 }, 'foo %s', 'bar') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'foo bar', + answer: 42 + }) +}) + +test('correctly strip undefined when returned from toJSON', async ({ equal }) => { + const stream = sink() + const instance = pino({ + test: 'this' + }, stream) + instance.fatal({ test: { toJSON () { return undefined } } }) + const result = await once(stream, 'data') + equal('test' in result, false) +}) + +test('correctly supports stderr', async ({ same }) => { + // stderr inherits from Stream, rather than Writable + const dest = { + writable: true, + write (result) { + result = JSON.parse(result) + delete result.time + same(result, { + pid, + hostname, + level: 60, + msg: 'a message' + }) + } + } + const instance = pino(dest) + instance.fatal('a message') +}) + +test('normalize number to string', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info(1) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: '1' + }) +}) + +test('normalize number to string with an object', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({ answer: 42 }, 1) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: '1', + answer: 42 + }) +}) + +test('handles objects with null prototype', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + const o = Object.create(null) + o.test = 'test' + instance.info(o) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 30, + test: 'test' + }) +}) + +test('pino.destination', async ({ same }) => { + const tmp = file() + const instance = pino(pino.destination(tmp)) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('auto pino.destination with a string', async ({ same }) => { + const tmp = file() + const instance = pino(tmp) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('auto pino.destination with a string as second argument', async ({ same }) => { + const tmp = file() + const instance = pino(null, tmp) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('does not override opts with a string as second argument', async ({ same }) => { + const tmp = file() + const instance = pino({ + timestamp: () => ',"time":"none"' + }, tmp) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + same(result, { + pid, + hostname, + level: 30, + time: 'none', + msg: 'hello' + }) +}) + +// https://github.com/pinojs/pino/issues/222 +test('children with same names render in correct order', async ({ equal }) => { + const stream = sink() + const root = pino(stream) + root.child({ a: 1 }).child({ a: 2 }).info({ a: 3 }) + const { a } = await once(stream, 'data') + equal(a, 3, 'last logged object takes precedence') +}) + +test('use `safe-stable-stringify` to avoid circular dependencies', async ({ same }) => { + const stream = sink() + const root = pino(stream) + // circular depth + const obj = {} + obj.a = obj + root.info(obj) + const { a } = await once(stream, 'data') + same(a, { a: '[Circular]' }) +}) + +test('correctly log non circular objects', async ({ same }) => { + const stream = sink() + const root = pino(stream) + const obj = {} + let parent = obj + for (let i = 0; i < 10; i++) { + parent.node = {} + parent = parent.node + } + root.info(obj) + const { node } = await once(stream, 'data') + same(node, { node: { node: { node: { node: { node: { node: { node: { node: { node: {} } } } } } } } } }) +}) + +test('safe-stable-stringify must be used when interpolating', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { a: { b: {} } } + o.a.b.c = o.a.b + instance.info('test %j', o) + + const { msg } = await once(stream, 'data') + t.equal(msg, 'test {"a":{"b":{"c":"[Circular]"}}}') +}) + +test('throws when setting useOnlyCustomLevels without customLevels', async ({ throws }) => { + throws(() => { + pino({ + useOnlyCustomLevels: true + }) + }, 'customLevels is required if useOnlyCustomLevels is set true') +}) + +test('correctly log Infinity', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: Infinity } + instance.info(o) + + const { num } = await once(stream, 'data') + t.equal(num, null) +}) + +test('correctly log -Infinity', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: -Infinity } + instance.info(o) + + const { num } = await once(stream, 'data') + t.equal(num, null) +}) + +test('correctly log NaN', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: NaN } + instance.info(o) + + const { num } = await once(stream, 'data') + t.equal(num, null) +}) + +test('offers a .default() method to please typescript', async ({ equal }) => { + equal(pino.default, pino) + + const stream = sink() + const instance = pino.default(stream) + instance.info('hello world') + check(equal, await once(stream, 'data'), 30, 'hello world') +}) + +test('correctly skip function', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: NaN } + instance.info(o, () => {}) + + const { msg } = await once(stream, 'data') + t.equal(msg, undefined) +}) + +test('correctly skip Infinity', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: NaN } + instance.info(o, Infinity) + + const { msg } = await once(stream, 'data') + t.equal(msg, null) +}) + +test('correctly log number', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: NaN } + instance.info(o, 42) + + const { msg } = await once(stream, 'data') + t.equal(msg, 42) +}) + +test('nestedKey should not be used for non-objects', async ({ strictSame }) => { + const stream = sink() + const message = 'hello' + const nestedKey = 'stuff' + const instance = pino({ + nestedKey + }, stream) + instance.info(message) + const result = await once(stream, 'data') + delete result.time + strictSame(result, { + pid, + hostname, + level: 30, + msg: message + }) +}) + +test('throws if prettyPrint is passed in as an option', async (t) => { + t.throws(() => { + pino({ + prettyPrint: true + }) + }, new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)')) +}) + +test('Should invoke `onChild` with the newly created child', async ({ equal }) => { + let innerChild + const child = pino({ + onChild: (instance) => { + innerChild = instance + } + }).child({ foo: 'bar' }) + equal(child, innerChild) +}) + +test('logger message should have the prefix message that defined in the logger creation', async ({ equal }) => { + const stream = sink() + const logger = pino({ + msgPrefix: 'My name is Bond ' + }, stream) + equal(logger.msgPrefix, 'My name is Bond ') + logger.info('James Bond') + const { msg } = await once(stream, 'data') + equal(msg, 'My name is Bond James Bond') +}) + +test('child message should have the prefix message that defined in the child creation', async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + const child = instance.child({}, { msgPrefix: 'My name is Bond ' }) + child.info('James Bond') + const { msg } = await once(stream, 'data') + equal(msg, 'My name is Bond James Bond') +}) + +test('child message should have the prefix message that defined in the child creation when logging with log meta', async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + const child = instance.child({}, { msgPrefix: 'My name is Bond ' }) + child.info({ hello: 'world' }, 'James Bond') + const { msg, hello } = await once(stream, 'data') + equal(hello, 'world') + equal(msg, 'My name is Bond James Bond') +}) + +test('logged message should not have the prefix when not providing any message', async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + const child = instance.child({}, { msgPrefix: 'This should not be shown ' }) + child.info({ hello: 'world' }) + const { msg, hello } = await once(stream, 'data') + equal(hello, 'world') + equal(msg, undefined) +}) + +test('child message should append parent prefix to current prefix that defined in the child creation', async ({ equal }) => { + const stream = sink() + const instance = pino({ + msgPrefix: 'My name is Bond ' + }, stream) + const child = instance.child({}, { msgPrefix: 'James ' }) + child.info('Bond') + equal(child.msgPrefix, 'My name is Bond James ') + const { msg } = await once(stream, 'data') + equal(msg, 'My name is Bond James Bond') +}) + +test('child message should inherent parent prefix', async ({ equal }) => { + const stream = sink() + const instance = pino({ + msgPrefix: 'My name is Bond ' + }, stream) + const child = instance.child({}) + child.info('James Bond') + const { msg } = await once(stream, 'data') + equal(msg, 'My name is Bond James Bond') +}) + +test('grandchild message should inherent parent prefix', async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + const child = instance.child({}, { msgPrefix: 'My name is Bond ' }) + const grandchild = child.child({}) + grandchild.info('James Bond') + const { msg } = await once(stream, 'data') + equal(msg, 'My name is Bond James Bond') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/broken-pipe.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/broken-pipe.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4ec2594ceea55128d83cd4225cb155d7a148ed7d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/broken-pipe.test.js @@ -0,0 +1,57 @@ +'use strict' + +const t = require('tap') +const { join } = require('node:path') +const { fork } = require('node:child_process') +const { once } = require('./helper') +const pino = require('..') + +if (process.platform === 'win32') { + t.skip('skipping on windows') + process.exit(0) +} + +if (process.env.CITGM) { + // This looks like a some form of limitations of the CITGM test runner + // or the HW/SW we run it on. This file can hang on Node.js v18.x. + // The failure does not reproduce locally or on our CI. + // Skipping it is the only way to keep pino in CITGM. + // https://github.com/nodejs/citgm/pull/1002#issuecomment-1751942988 + t.skip('Skipping on Node.js core CITGM because it hangs on v18.x') + process.exit(0) +} + +function test (file) { + file = join('fixtures', 'broken-pipe', file) + t.test(file, { parallel: true }, async ({ equal }) => { + const child = fork(join(__dirname, file), { silent: true }) + child.stdout.destroy() + + child.stderr.pipe(process.stdout) + + const res = await once(child, 'close') + equal(res, 0) // process exits successfully + }) +} + +t.jobs = 42 + +test('basic.js') +test('destination.js') +test('syncfalse.js') + +t.test('let error pass through', ({ equal, plan }) => { + plan(3) + const stream = pino.destination({ sync: true }) + + // side effect of the pino constructor is that it will set an + // event handler for error + pino(stream) + + process.nextTick(() => stream.emit('error', new Error('kaboom'))) + process.nextTick(() => stream.emit('error', new Error('kaboom'))) + + stream.on('error', (err) => { + equal(err.message, 'kaboom') + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-child.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-child.test.js new file mode 100644 index 0000000000000000000000000000000000000000..679261a780eb017723b146154a176dae2a826f74 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-child.test.js @@ -0,0 +1,132 @@ +'use strict' +const test = require('tape') +const pino = require('../browser') + +test('child has parent level', ({ end, same, is }) => { + const instance = pino({ + level: 'error', + browser: {} + }) + + const child = instance.child({}) + + same(child.level, instance.level) + end() +}) + +test('child can set level at creation time', ({ end, same, is }) => { + const instance = pino({ + level: 'error', + browser: {} + }) + + const child = instance.child({}, { level: 'info' }) // first bindings, then options + + same(child.level, 'info') + end() +}) + +test('changing child level does not affect parent', ({ end, same, is }) => { + const instance = pino({ + level: 'error', + browser: {} + }) + + const child = instance.child({}) + child.level = 'info' + + same(instance.level, 'error') + end() +}) + +test('child should log, if its own level allows it', ({ end, same, is }) => { + const expected = [ + { + level: 30, + msg: 'this is info' + }, + { + level: 40, + msg: 'this is warn' + }, + { + level: 50, + msg: 'this is an error' + } + ] + const instance = pino({ + level: 'error', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + const child = instance.child({}) + child.level = 'info' + + child.debug('this is debug') + child.info('this is info') + child.warn('this is warn') + child.error('this is an error') + + same(expected.length, 0, 'not all messages were read') + end() +}) + +test('changing child log level should not affect parent log behavior', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + level: 'error', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + const child = instance.child({}) + child.level = 'info' + + instance.warn('this is warn') + instance.error('this is an error') + instance.fatal('this is fatal') + + same(expected.length, 0, 'not all messages were read') + end() +}) + +test('onChild callback should be called when new child is created', ({ end, pass, plan }) => { + plan(1) + const instance = pino({ + level: 'error', + browser: {}, + onChild: (_child) => { + pass('onChild callback was called') + end() + } + }) + + instance.child({}) +}) + +function checkLogObjects (is, same, actual, expected) { + is(actual.time <= Date.now(), true, 'time is greater than Date.now()') + + const actualCopy = Object.assign({}, actual) + const expectedCopy = Object.assign({}, expected) + delete actualCopy.time + delete expectedCopy.time + + same(actualCopy, expectedCopy) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-disabled.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-disabled.test.js new file mode 100644 index 0000000000000000000000000000000000000000..36d1b1172b120af885e204c02dc2d1e613a7bfc3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-disabled.test.js @@ -0,0 +1,87 @@ +'use strict' +const test = require('tape') +const pino = require('../browser') + +test('set browser opts disabled to true', ({ end, same }) => { + const instance = pino({ + browser: { + disabled: true, + write (actual) { + checkLogObjects(same, actual, []) + } + } + }) + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set browser opts disabled to false', ({ end, same }) => { + const expected = [ + { + level: 30, + msg: 'hello world' + }, + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + browser: { + disabled: false, + write (actual) { + checkLogObjects(same, actual, expected.shift()) + } + } + }) + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('disabled is not set in browser opts', ({ end, same }) => { + const expected = [ + { + level: 30, + msg: 'hello world' + }, + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + browser: { + write (actual) { + checkLogObjects(same, actual, expected.shift()) + } + } + }) + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +function checkLogObjects (same, actual, expected, is) { + const actualCopy = Object.assign({}, actual) + const expectedCopy = Object.assign({}, expected) + delete actualCopy.time + delete expectedCopy.time + + same(actualCopy, expectedCopy) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-early-console-freeze.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-early-console-freeze.test.js new file mode 100644 index 0000000000000000000000000000000000000000..942abfa6f20b56828e1e7d4930c7806702dad50e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-early-console-freeze.test.js @@ -0,0 +1,12 @@ +'use strict' +Object.freeze(console) +const test = require('tape') +const pino = require('../browser') + +test('silent level', ({ end, fail, pass }) => { + pino({ + level: 'silent', + browser: { } + }) + end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-is-level-enabled.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-is-level-enabled.test.js new file mode 100644 index 0000000000000000000000000000000000000000..16d8c88cc9035a292cf679e90154287d8539d1af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-is-level-enabled.test.js @@ -0,0 +1,104 @@ +'use strict' + +const { test } = require('tap') +const pino = require('../browser') + +const customLevels = { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60 +} + +test('Default levels suite', ({ test, end }) => { + test('can check if current level enabled', async ({ equal }) => { + const log = pino({ level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if current level enabled when as object', async ({ equal }) => { + const log = pino({ asObject: true, level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if level enabled after level set', async ({ equal }) => { + const log = pino() + equal(false, log.isLevelEnabled('debug')) + log.level = 'debug' + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if higher level enabled', async ({ equal }) => { + const log = pino({ level: 'debug' }) + equal(true, log.isLevelEnabled('error')) + }) + + test('can check if lower level is disabled', async ({ equal }) => { + const log = pino({ level: 'error' }) + equal(false, log.isLevelEnabled('trace')) + }) + + test('ASC: can check if child has current level enabled', async ({ equal }) => { + const log = pino().child({}, { level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if custom level is enabled', async ({ equal }) => { + const log = pino({ + customLevels: { foo: 35 }, + level: 'debug' + }) + equal(true, log.isLevelEnabled('foo')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + end() +}) + +test('Custom levels suite', ({ test, end }) => { + test('can check if current level enabled', async ({ equal }) => { + const log = pino({ level: 'debug', customLevels }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if level enabled after level set', async ({ equal }) => { + const log = pino({ customLevels }) + equal(false, log.isLevelEnabled('debug')) + log.level = 'debug' + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if higher level enabled', async ({ equal }) => { + const log = pino({ level: 'debug', customLevels }) + equal(true, log.isLevelEnabled('error')) + }) + + test('can check if lower level is disabled', async ({ equal }) => { + const log = pino({ level: 'error', customLevels }) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if child has current level enabled', async ({ equal }) => { + const log = pino().child({ customLevels }, { level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if custom level is enabled', async ({ equal }) => { + const log = pino({ + customLevels: { foo: 35, ...customLevels }, + level: 'debug' + }) + equal(true, log.isLevelEnabled('foo')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-levels.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-levels.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a992905428b2ebeee5c8480c32b8b41e16dc2bf0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-levels.test.js @@ -0,0 +1,241 @@ +'use strict' +const test = require('tape') +const pino = require('../browser') + +test('set the level by string', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set the level by string. init with silent', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + level: 'silent', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set the level by string. init with silent and transmit', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + level: 'silent', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + }, + transmit: { + send () {} + } + }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set the level via constructor', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + level: 'error', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set custom level and use it', ({ end, same, is }) => { + const expected = [ + { + level: 31, + msg: 'this is a custom level' + } + ] + const instance = pino({ + customLevels: { + success: 31 + }, + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + instance.success('this is a custom level') + + end() +}) + +test('the wrong level throws', ({ end, throws }) => { + const instance = pino() + throws(() => { + instance.level = 'kaboom' + }) + end() +}) + +test('the wrong level by number throws', ({ end, throws }) => { + const instance = pino() + throws(() => { + instance.levelVal = 55 + }) + end() +}) + +test('exposes level string mappings', ({ end, is }) => { + is(pino.levels.values.error, 50) + end() +}) + +test('exposes level number mappings', ({ end, is }) => { + is(pino.levels.labels[50], 'error') + end() +}) + +test('returns level integer', ({ end, is }) => { + const instance = pino({ level: 'error' }) + is(instance.levelVal, 50) + end() +}) + +test('silent level via constructor', ({ end, fail }) => { + const instance = pino({ + level: 'silent', + browser: { + write () { + fail('no data should be logged') + } + } + }) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) + + end() +}) + +test('silent level by string', ({ end, fail }) => { + const instance = pino({ + browser: { + write () { + fail('no data should be logged') + } + } + }) + + instance.level = 'silent' + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) + + end() +}) + +test('exposed levels', ({ end, same }) => { + same(Object.keys(pino.levels.values), [ + 'fatal', + 'error', + 'warn', + 'info', + 'debug', + 'trace' + ]) + end() +}) + +test('exposed labels', ({ end, same }) => { + same(Object.keys(pino.levels.labels), [ + '10', + '20', + '30', + '40', + '50', + '60' + ]) + end() +}) + +function checkLogObjects (is, same, actual, expected) { + is(actual.time <= Date.now(), true, 'time is greater than Date.now()') + + const actualCopy = Object.assign({}, actual) + const expectedCopy = Object.assign({}, expected) + delete actualCopy.time + delete expectedCopy.time + + same(actualCopy, expectedCopy) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-serializers.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-serializers.test.js new file mode 100644 index 0000000000000000000000000000000000000000..07cfa60e04033dc0ed582026cbfecdd380a1a99e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-serializers.test.js @@ -0,0 +1,352 @@ +'use strict' +// eslint-disable-next-line +if (typeof $1 !== 'undefined') $1 = arguments.callee.caller.arguments[0] + +const test = require('tape') +const fresh = require('import-fresh') +const pino = require('../browser') + +const parentSerializers = { + test: () => 'parent' +} + +const childSerializers = { + test: () => 'child' +} + +test('serializers override values', ({ end, is }) => { + const parent = pino({ + serializers: parentSerializers, + browser: { + serialize: true, + write (o) { + is(o.test, 'parent') + end() + } + } + }) + + parent.fatal({ test: 'test' }) +}) + +test('without the serialize option, serializers do not override values', ({ end, is }) => { + const parent = pino({ + serializers: parentSerializers, + browser: { + write (o) { + is(o.test, 'test') + end() + } + } + }) + + parent.fatal({ test: 'test' }) +}) + +if (process.title !== 'browser') { + test('if serialize option is true, standard error serializer is auto enabled', ({ end, same }) => { + const err = Error('test') + err.code = 'test' + err.type = 'Error' // get that cov + const expect = pino.stdSerializers.err(err) + + const consoleError = console.error + console.error = function (err) { + same(err, expect) + } + + const logger = fresh('../browser')({ + browser: { serialize: true } + }) + + console.error = consoleError + + logger.fatal(err) + end() + }) + + test('if serialize option is array, standard error serializer is auto enabled', ({ end, same }) => { + const err = Error('test') + err.code = 'test' + const expect = pino.stdSerializers.err(err) + + const consoleError = console.error + console.error = function (err) { + same(err, expect) + } + + const logger = fresh('../browser', require)({ + browser: { serialize: [] } + }) + + console.error = consoleError + + logger.fatal(err) + end() + }) + + test('if serialize option is array containing !stdSerializers.err, standard error serializer is disabled', ({ end, is }) => { + const err = Error('test') + err.code = 'test' + const expect = err + + const consoleError = console.error + console.error = function (err) { + is(err, expect) + } + + const logger = fresh('../browser', require)({ + browser: { serialize: ['!stdSerializers.err'] } + }) + + console.error = consoleError + + logger.fatal(err) + end() + }) + + test('in browser, serializers apply to all objects', ({ end, is }) => { + const consoleError = console.error + console.error = function (test, test2, test3, test4, test5) { + is(test.key, 'serialized') + is(test2.key2, 'serialized2') + is(test5.key3, 'serialized3') + } + + const logger = fresh('../browser', require)({ + serializers: { + key: () => 'serialized', + key2: () => 'serialized2', + key3: () => 'serialized3' + }, + browser: { serialize: true } + }) + + console.error = consoleError + + logger.fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' }) + end() + }) + + test('serialize can be an array of selected serializers', ({ end, is }) => { + const consoleError = console.error + console.error = function (test, test2, test3, test4, test5) { + is(test.key, 'test') + is(test2.key2, 'serialized2') + is(test5.key3, 'test') + } + + const logger = fresh('../browser', require)({ + serializers: { + key: () => 'serialized', + key2: () => 'serialized2', + key3: () => 'serialized3' + }, + browser: { serialize: ['key2'] } + }) + + console.error = consoleError + + logger.fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' }) + end() + }) + + test('serialize filter applies to child loggers', ({ end, is }) => { + const consoleError = console.error + console.error = function (binding, test, test2, test3, test4, test5) { + is(test.key, 'test') + is(test2.key2, 'serialized2') + is(test5.key3, 'test') + } + + const logger = fresh('../browser', require)({ + browser: { serialize: ['key2'] } + }) + + console.error = consoleError + + logger.child({ + aBinding: 'test' + }, { + serializers: { + key: () => 'serialized', + key2: () => 'serialized2', + key3: () => 'serialized3' + } + }).fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' }) + end() + }) + + test('serialize filter applies to child loggers through bindings', ({ end, is }) => { + const consoleError = console.error + console.error = function (binding, test, test2, test3, test4, test5) { + is(test.key, 'test') + is(test2.key2, 'serialized2') + is(test5.key3, 'test') + } + + const logger = fresh('../browser', require)({ + browser: { serialize: ['key2'] } + }) + + console.error = consoleError + + logger.child({ + aBinding: 'test', + serializers: { + key: () => 'serialized', + key2: () => 'serialized2', + key3: () => 'serialized3' + } + }).fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' }) + end() + }) + + test('parent serializers apply to child bindings', ({ end, is }) => { + const consoleError = console.error + console.error = function (binding) { + is(binding.key, 'serialized') + } + + const logger = fresh('../browser', require)({ + serializers: { + key: () => 'serialized' + }, + browser: { serialize: true } + }) + + console.error = consoleError + + logger.child({ key: 'test' }).fatal({ test: 'test' }) + end() + }) + + test('child serializers apply to child bindings', ({ end, is }) => { + const consoleError = console.error + console.error = function (binding) { + is(binding.key, 'serialized') + } + + const logger = fresh('../browser', require)({ + browser: { serialize: true } + }) + + console.error = consoleError + + logger.child({ + key: 'test' + }, { + serializers: { + key: () => 'serialized' + } + }).fatal({ test: 'test' }) + end() + }) +} + +test('child does not overwrite parent serializers', ({ end, is }) => { + let c = 0 + const parent = pino({ + serializers: parentSerializers, + browser: { + serialize: true, + write (o) { + c++ + if (c === 1) is(o.test, 'parent') + if (c === 2) { + is(o.test, 'child') + end() + } + } + } + }) + const child = parent.child({}, { serializers: childSerializers }) + + parent.fatal({ test: 'test' }) + child.fatal({ test: 'test' }) +}) + +test('children inherit parent serializers', ({ end, is }) => { + const parent = pino({ + serializers: parentSerializers, + browser: { + serialize: true, + write (o) { + is(o.test, 'parent') + } + } + }) + + const child = parent.child({ a: 'property' }) + child.fatal({ test: 'test' }) + end() +}) + +test('children serializers get called', ({ end, is }) => { + const parent = pino({ + browser: { + serialize: true, + write (o) { + is(o.test, 'child') + } + } + }) + + const child = parent.child({ a: 'property' }, { serializers: childSerializers }) + + child.fatal({ test: 'test' }) + end() +}) + +test('children serializers get called when inherited from parent', ({ end, is }) => { + const parent = pino({ + serializers: parentSerializers, + browser: { + serialize: true, + write: (o) => { + is(o.test, 'pass') + } + } + }) + + const child = parent.child({}, { serializers: { test: () => 'pass' } }) + + child.fatal({ test: 'fail' }) + end() +}) + +test('non overridden serializers are available in the children', ({ end, is }) => { + const pSerializers = { + onlyParent: () => 'parent', + shared: () => 'parent' + } + + const cSerializers = { + shared: () => 'child', + onlyChild: () => 'child' + } + + let c = 0 + + const parent = pino({ + serializers: pSerializers, + browser: { + serialize: true, + write (o) { + c++ + if (c === 1) is(o.shared, 'child') + if (c === 2) is(o.onlyParent, 'parent') + if (c === 3) is(o.onlyChild, 'child') + if (c === 4) is(o.onlyChild, 'test') + } + } + }) + + const child = parent.child({}, { serializers: cSerializers }) + + child.fatal({ shared: 'test' }) + child.fatal({ onlyParent: 'test' }) + child.fatal({ onlyChild: 'test' }) + parent.fatal({ onlyChild: 'test' }) + end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-timestamp.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-timestamp.test.js new file mode 100644 index 0000000000000000000000000000000000000000..994d83535ff1cf03c7a3f1b8290ed104503ffe49 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-timestamp.test.js @@ -0,0 +1,88 @@ +'use strict' +const test = require('tape') +const pino = require('../browser') + +Date.now = () => 1599400603614 + +test('null timestamp', ({ end, is }) => { + const instance = pino({ + timestamp: pino.stdTimeFunctions.nullTime, + browser: { + asObject: true, + write: function (o) { + is(o.time, undefined) + } + } + }) + instance.info('hello world') + end() +}) + +test('iso timestamp', ({ end, is }) => { + const instance = pino({ + timestamp: pino.stdTimeFunctions.isoTime, + browser: { + asObject: true, + write: function (o) { + is(o.time, '2020-09-06T13:56:43.614Z') + } + } + }) + instance.info('hello world') + end() +}) + +test('epoch timestamp', ({ end, is }) => { + const instance = pino({ + timestamp: pino.stdTimeFunctions.epochTime, + browser: { + asObject: true, + write: function (o) { + is(o.time, 1599400603614) + } + } + }) + instance.info('hello world') + end() +}) + +test('unix timestamp', ({ end, is }) => { + const instance = pino({ + timestamp: pino.stdTimeFunctions.unixTime, + browser: { + asObject: true, + write: function (o) { + is(o.time, Math.round(1599400603614 / 1000.0)) + } + } + }) + instance.info('hello world') + end() +}) + +test('epoch timestamp by default', ({ end, is }) => { + const instance = pino({ + browser: { + asObject: true, + write: function (o) { + is(o.time, 1599400603614) + } + } + }) + instance.info('hello world') + end() +}) + +test('not print timestamp if the option is false', ({ end, is }) => { + const instance = pino({ + timestamp: false, + browser: { + asObject: true, + write: function (o) { + is(o.time, undefined) + } + } + }) + instance.info('hello world') + end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-transmit.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-transmit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d5063ca8eae7b75e46c8c136d6d5d9ad5141f6ac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser-transmit.test.js @@ -0,0 +1,417 @@ +'use strict' +const test = require('tape') +const pino = require('../browser') + +function noop () {} + +test('throws if transmit object does not have send function', ({ end, throws }) => { + throws(() => { + pino({ browser: { transmit: {} } }) + }) + + throws(() => { + pino({ browser: { transmit: { send: 'not a func' } } }) + }) + + end() +}) + +test('calls send function after write', ({ end, is }) => { + let c = 0 + const logger = pino({ + browser: { + write: () => { + c++ + }, + transmit: { + send () { is(c, 1) } + } + } + }) + + logger.fatal({ test: 'test' }) + end() +}) + +test('passes send function the logged level', ({ end, is }) => { + const logger = pino({ + browser: { + write () {}, + transmit: { + send (level) { + is(level, 'fatal') + } + } + } + }) + + logger.fatal({ test: 'test' }) + end() +}) + +test('passes send function message strings in logEvent object when asObject is not set', ({ end, same, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, { messages }) { + is(messages[0], 'test') + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal('test', 'another test') + + end() +}) + +test('passes send function message objects in logEvent object when asObject is not set', ({ end, same, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, { messages }) { + same(messages[0], { test: 'test' }) + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal({ test: 'test' }, 'another test') + + end() +}) + +test('passes send function message strings in logEvent object when asObject is set', ({ end, same, is }) => { + const logger = pino({ + browser: { + asObject: true, + write: noop, + transmit: { + send (level, { messages }) { + is(messages[0], 'test') + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal('test', 'another test') + + end() +}) + +test('passes send function message objects in logEvent object when asObject is set', ({ end, same, is }) => { + const logger = pino({ + browser: { + asObject: true, + write: noop, + transmit: { + send (level, { messages }) { + same(messages[0], { test: 'test' }) + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal({ test: 'test' }, 'another test') + + end() +}) + +test('supplies a timestamp (ts) in logEvent object which is exactly the same as the `time` property in asObject mode', ({ end, is }) => { + let expected + const logger = pino({ + browser: { + asObject: true, // implicit because `write`, but just to be explicit + write (o) { + expected = o.time + }, + transmit: { + send (level, logEvent) { + is(logEvent.ts, expected) + } + } + } + }) + + logger.fatal('test') + end() +}) + +test('passes send function child bindings via logEvent object', ({ end, same, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, logEvent) { + const messages = logEvent.messages + const bindings = logEvent.bindings + same(bindings[0], { first: 'binding' }) + same(bindings[1], { second: 'binding2' }) + same(messages[0], { test: 'test' }) + is(messages[1], 'another test') + } + } + } + }) + + logger + .child({ first: 'binding' }) + .child({ second: 'binding2' }) + .fatal({ test: 'test' }, 'another test') + end() +}) + +test('passes send function level:{label, value} via logEvent object', ({ end, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, logEvent) { + const label = logEvent.level.label + const value = logEvent.level.value + + is(label, 'fatal') + is(value, 60) + } + } + } + }) + + logger.fatal({ test: 'test' }, 'another test') + end() +}) + +test('calls send function according to transmit.level', ({ end, is }) => { + let c = 0 + const logger = pino({ + browser: { + write: noop, + transmit: { + level: 'error', + send (level) { + c++ + if (c === 1) is(level, 'error') + if (c === 2) is(level, 'fatal') + } + } + } + }) + logger.warn('ignored') + logger.error('test') + logger.fatal('test') + end() +}) + +test('transmit.level defaults to logger level', ({ end, is }) => { + let c = 0 + const logger = pino({ + level: 'error', + browser: { + write: noop, + transmit: { + send (level) { + c++ + if (c === 1) is(level, 'error') + if (c === 2) is(level, 'fatal') + } + } + } + }) + logger.warn('ignored') + logger.error('test') + logger.fatal('test') + end() +}) + +test('transmit.level is effective even if lower than logger level', ({ end, is }) => { + let c = 0 + const logger = pino({ + level: 'error', + browser: { + write: noop, + transmit: { + level: 'info', + send (level) { + c++ + if (c === 1) is(level, 'warn') + if (c === 2) is(level, 'error') + if (c === 3) is(level, 'fatal') + } + } + } + }) + logger.warn('ignored') + logger.error('test') + logger.fatal('test') + end() +}) + +test('applies all serializers to messages and bindings (serialize:false - default)', ({ end, same, is }) => { + const logger = pino({ + serializers: { + first: () => 'first', + second: () => 'second', + test: () => 'serialize it' + }, + browser: { + write: noop, + transmit: { + send (level, logEvent) { + const messages = logEvent.messages + const bindings = logEvent.bindings + same(bindings[0], { first: 'first' }) + same(bindings[1], { second: 'second' }) + same(messages[0], { test: 'serialize it' }) + is(messages[1].type, 'Error') + } + } + } + }) + + logger + .child({ first: 'binding' }) + .child({ second: 'binding2' }) + .fatal({ test: 'test' }, Error()) + end() +}) + +test('applies all serializers to messages and bindings (serialize:true)', ({ end, same, is }) => { + const logger = pino({ + serializers: { + first: () => 'first', + second: () => 'second', + test: () => 'serialize it' + }, + browser: { + serialize: true, + write: noop, + transmit: { + send (level, logEvent) { + const messages = logEvent.messages + const bindings = logEvent.bindings + same(bindings[0], { first: 'first' }) + same(bindings[1], { second: 'second' }) + same(messages[0], { test: 'serialize it' }) + is(messages[1].type, 'Error') + } + } + } + }) + + logger + .child({ first: 'binding' }) + .child({ second: 'binding2' }) + .fatal({ test: 'test' }, Error()) + end() +}) + +test('extracts correct bindings and raw messages over multiple transmits', ({ end, same, is }) => { + let messages = null + let bindings = null + + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, logEvent) { + messages = logEvent.messages + bindings = logEvent.bindings + } + } + } + }) + + const child = logger.child({ child: true }) + const grandchild = child.child({ grandchild: true }) + + logger.fatal({ test: 'parent:test1' }) + logger.fatal({ test: 'parent:test2' }) + same([], bindings) + same([{ test: 'parent:test2' }], messages) + + child.fatal({ test: 'child:test1' }) + child.fatal({ test: 'child:test2' }) + same([{ child: true }], bindings) + same([{ test: 'child:test2' }], messages) + + grandchild.fatal({ test: 'grandchild:test1' }) + grandchild.fatal({ test: 'grandchild:test2' }) + same([{ child: true }, { grandchild: true }], bindings) + same([{ test: 'grandchild:test2' }], messages) + + end() +}) + +test('does not log below configured level', ({ end, is }) => { + let message = null + const logger = pino({ + level: 'info', + browser: { + write (o) { + message = o.msg + }, + transmit: { + send () { } + } + } + }) + + logger.debug('this message is silent') + is(message, null) + + end() +}) + +test('silent level prevents logging even with transmit', ({ end, fail }) => { + const logger = pino({ + level: 'silent', + browser: { + write () { + fail('no data should be logged by the write method') + }, + transmit: { + send () { + fail('no data should be logged by the send method') + } + } + } + }) + + Object.keys(pino.levels.values).forEach((level) => { + logger[level]('ignored') + }) + + end() +}) + +test('does not call send when transmit.level is set to silent', ({ end, fail, is }) => { + let c = 0 + const logger = pino({ + level: 'trace', + browser: { + write () { + c++ + }, + transmit: { + level: 'silent', + send () { + fail('no data should be logged by the transmit method') + } + } + } + }) + + const levels = Object.keys(pino.levels.values) + levels.forEach((level) => { + logger[level]('message') + }) + + is(c, levels.length, 'write must be called exactly once per level') + end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0712e48dadc54d83c8530e645661da1764f3b5ea --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/browser.test.js @@ -0,0 +1,679 @@ +'use strict' +const test = require('tape') +const fresh = require('import-fresh') +const pinoStdSerializers = require('pino-std-serializers') +const pino = require('../browser') + +levelTest('fatal') +levelTest('error') +levelTest('warn') +levelTest('info') +levelTest('debug') +levelTest('trace') + +test('silent level', ({ end, fail, pass }) => { + const instance = pino({ + level: 'silent', + browser: { write: fail } + }) + instance.info('test') + const child = instance.child({ test: 'test' }) + child.info('msg-test') + // use setTimeout because setImmediate isn't supported in most browsers + setTimeout(() => { + pass() + end() + }, 0) +}) + +test('enabled false', ({ end, fail, pass }) => { + const instance = pino({ + enabled: false, + browser: { write: fail } + }) + instance.info('test') + const child = instance.child({ test: 'test' }) + child.info('msg-test') + // use setTimeout because setImmediate isn't supported in most browsers + setTimeout(() => { + pass() + end() + }, 0) +}) + +test('throw if creating child without bindings', ({ end, throws }) => { + const instance = pino() + throws(() => instance.child()) + end() +}) + +test('stubs write, flush and ee methods on instance', ({ end, ok, is }) => { + const instance = pino() + + ok(isFunc(instance.setMaxListeners)) + ok(isFunc(instance.getMaxListeners)) + ok(isFunc(instance.emit)) + ok(isFunc(instance.addListener)) + ok(isFunc(instance.on)) + ok(isFunc(instance.prependListener)) + ok(isFunc(instance.once)) + ok(isFunc(instance.prependOnceListener)) + ok(isFunc(instance.removeListener)) + ok(isFunc(instance.removeAllListeners)) + ok(isFunc(instance.listeners)) + ok(isFunc(instance.listenerCount)) + ok(isFunc(instance.eventNames)) + ok(isFunc(instance.write)) + ok(isFunc(instance.flush)) + + is(instance.on(), undefined) + + end() +}) + +test('exposes levels object', ({ end, same }) => { + same(pino.levels, { + values: { + fatal: 60, + error: 50, + warn: 40, + info: 30, + debug: 20, + trace: 10 + }, + labels: { + 10: 'trace', + 20: 'debug', + 30: 'info', + 40: 'warn', + 50: 'error', + 60: 'fatal' + } + }) + + end() +}) + +test('exposes faux stdSerializers', ({ end, ok, same }) => { + ok(pino.stdSerializers) + // make sure faux stdSerializers match pino-std-serializers + for (const serializer in pinoStdSerializers) { + ok(pino.stdSerializers[serializer], `pino.stdSerializers.${serializer}`) + } + // confirm faux methods return empty objects + same(pino.stdSerializers.req(), {}) + same(pino.stdSerializers.mapHttpRequest(), {}) + same(pino.stdSerializers.mapHttpResponse(), {}) + same(pino.stdSerializers.res(), {}) + // confirm wrapping function is a passthrough + const noChange = { foo: 'bar', fuz: 42 } + same(pino.stdSerializers.wrapRequestSerializer(noChange), noChange) + same(pino.stdSerializers.wrapResponseSerializer(noChange), noChange) + end() +}) + +test('exposes err stdSerializer', ({ end, ok }) => { + ok(pino.stdSerializers.err) + ok(pino.stdSerializers.err(Error())) + end() +}) + +consoleMethodTest('error') +consoleMethodTest('fatal', 'error') +consoleMethodTest('warn') +consoleMethodTest('info') +consoleMethodTest('debug') +consoleMethodTest('trace') +absentConsoleMethodTest('error', 'log') +absentConsoleMethodTest('warn', 'error') +absentConsoleMethodTest('info', 'log') +absentConsoleMethodTest('debug', 'log') +absentConsoleMethodTest('trace', 'log') + +// do not run this with airtap +if (process.title !== 'browser') { + test('in absence of console, log methods become noops', ({ end, ok }) => { + const console = global.console + delete global.console + const instance = fresh('../browser')() + global.console = console + ok(fnName(instance.log).match(/noop/)) + ok(fnName(instance.fatal).match(/noop/)) + ok(fnName(instance.error).match(/noop/)) + ok(fnName(instance.warn).match(/noop/)) + ok(fnName(instance.info).match(/noop/)) + ok(fnName(instance.debug).match(/noop/)) + ok(fnName(instance.trace).match(/noop/)) + end() + }) +} + +test('opts.browser.asObject logs pino-like object to console', ({ end, ok, is }) => { + const info = console.info + console.info = function (o) { + is(o.level, 30) + is(o.msg, 'test') + ok(o.time) + console.info = info + } + const instance = require('../browser')({ + browser: { + asObject: true + } + }) + + instance.info('test') + end() +}) + +test('opts.browser.asObject uses opts.messageKey in logs', ({ end, ok, is }) => { + const messageKey = 'message' + const instance = require('../browser')({ + messageKey, + browser: { + asObject: true, + write: function (o) { + is(o.level, 30) + is(o[messageKey], 'test') + ok(o.time) + } + } + }) + + instance.info('test') + end() +}) + +test('opts.browser.asObjectBindingsOnly passes the bindings but keep the message unformatted', ({ end, ok, is, deepEqual }) => { + const messageKey = 'message' + const instance = require('../browser')({ + messageKey, + browser: { + asObjectBindingsOnly: true, + write: function (o, msg, ...args) { + is(o.level, 30) + ok(o.time) + is(msg, 'test %s') + deepEqual(args, ['foo']) + } + } + }) + + instance.info('test %s', 'foo') + end() +}) + +test('opts.browser.formatters (level) logs pino-like object to console', ({ end, ok, is }) => { + const info = console.info + console.info = function (o) { + is(o.level, 30) + is(o.label, 'info') + is(o.msg, 'test') + ok(o.time) + console.info = info + } + const instance = require('../browser')({ + browser: { + formatters: { + level (label, number) { + return { label, level: number } + } + } + } + }) + + instance.info('test') + end() +}) + +test('opts.browser.formatters (log) logs pino-like object to console', ({ end, ok, is }) => { + const info = console.info + console.info = function (o) { + is(o.level, 30) + is(o.msg, 'test') + is(o.hello, 'world') + is(o.newField, 'test') + ok(o.time, `Logged at ${o.time}`) + console.info = info + } + const instance = require('../browser')({ + browser: { + formatters: { + log (o) { + return { ...o, newField: 'test', time: `Logged at ${o.time}` } + } + } + } + }) + + instance.info({ hello: 'world' }, 'test') + end() +}) + +test('opts.browser.serialize and opts.browser.transmit only serializes log data once', ({ end, ok, is }) => { + const instance = require('../browser')({ + serializers: { + extras (data) { + return { serializedExtras: data } + } + }, + browser: { + serialize: ['extras'], + transmit: { + level: 'info', + send (level, o) { + is(o.messages[0].extras.serializedExtras, 'world') + } + } + } + }) + + instance.info({ extras: 'world' }, 'test') + end() +}) + +test('opts.browser.serialize and opts.asObject only serializes log data once', ({ end, ok, is }) => { + const instance = require('../browser')({ + serializers: { + extras (data) { + return { serializedExtras: data } + } + }, + browser: { + serialize: ['extras'], + asObject: true, + write: function (o) { + is(o.extras.serializedExtras, 'world') + } + } + }) + + instance.info({ extras: 'world' }, 'test') + end() +}) + +test('opts.browser.serialize, opts.asObject and opts.browser.transmit only serializes log data once', ({ end, ok, is }) => { + const instance = require('../browser')({ + serializers: { + extras (data) { + return { serializedExtras: data } + } + }, + browser: { + serialize: ['extras'], + asObject: true, + transmit: { + send (level, o) { + is(o.messages[0].extras.serializedExtras, 'world') + } + } + } + }) + + instance.info({ extras: 'world' }, 'test') + end() +}) + +test('opts.browser.write func log single string', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test') + ok(o.time) + } + } + }) + instance.info('test') + + end() +}) + +test('opts.browser.write func string joining', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test test2 test3') + ok(o.time) + } + } + }) + instance.info('test %s %s', 'test2', 'test3') + + end() +}) + +test('opts.browser.write func string joining when asObject is true', ({ end, ok, is }) => { + const instance = pino({ + browser: { + asObject: true, + write: function (o) { + is(o.level, 30) + is(o.msg, 'test test2 test3') + ok(o.time) + } + } + }) + instance.info('test %s %s', 'test2', 'test3') + + end() +}) + +test('opts.browser.write func string object joining', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test {"test":"test2"} {"test":"test3"}') + ok(o.time) + } + } + }) + instance.info('test %j %j', { test: 'test2' }, { test: 'test3' }) + + end() +}) + +test('opts.browser.write func string object joining when asObject is true', ({ end, ok, is }) => { + const instance = pino({ + browser: { + asObject: true, + write: function (o) { + is(o.level, 30) + is(o.msg, 'test {"test":"test2"} {"test":"test3"}') + ok(o.time) + } + } + }) + instance.info('test %j %j', { test: 'test2' }, { test: 'test3' }) + + end() +}) + +test('opts.browser.write func string interpolation', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test2 test ({"test":"test3"})') + ok(o.time) + } + } + }) + instance.info('%s test (%j)', 'test2', { test: 'test3' }) + + end() +}) + +test('opts.browser.write func number', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 1) + ok(o.time) + } + } + }) + instance.info(1) + + end() +}) + +test('opts.browser.write func log single object', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.test, 'test') + ok(o.time) + } + } + }) + instance.info({ test: 'test' }) + + end() +}) + +test('opts.browser.write obj writes to methods corresponding to level', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: { + error: function (o) { + is(o.level, 50) + is(o.test, 'test') + ok(o.time) + } + } + } + }) + instance.error({ test: 'test' }) + + end() +}) + +test('opts.browser.asObject/write supports child loggers', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write (o) { + is(o.level, 30) + is(o.test, 'test') + is(o.msg, 'msg-test') + ok(o.time) + } + } + }) + const child = instance.child({ test: 'test' }) + child.info('msg-test') + + end() +}) + +test('opts.browser.asObject/write supports child child loggers', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write (o) { + is(o.level, 30) + is(o.test, 'test') + is(o.foo, 'bar') + is(o.msg, 'msg-test') + ok(o.time) + } + } + }) + const child = instance.child({ test: 'test' }).child({ foo: 'bar' }) + child.info('msg-test') + + end() +}) + +test('opts.browser.asObject/write supports child child child loggers', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write (o) { + is(o.level, 30) + is(o.test, 'test') + is(o.foo, 'bar') + is(o.baz, 'bop') + is(o.msg, 'msg-test') + ok(o.time) + } + } + }) + const child = instance.child({ test: 'test' }).child({ foo: 'bar' }).child({ baz: 'bop' }) + child.info('msg-test') + + end() +}) + +test('opts.browser.asObject defensively mitigates naughty numbers', ({ end, pass }) => { + const instance = pino({ + browser: { asObject: true, write: () => {} } + }) + const child = instance.child({ test: 'test' }) + child._childLevel = -10 + child.info('test') + pass() // if we reached here, there was no infinite loop, so, .. pass. + + end() +}) + +test('opts.browser.write obj falls back to console where a method is not supplied', ({ end, ok, is }) => { + const info = console.info + console.info = (o) => { + is(o.level, 30) + is(o.msg, 'test') + ok(o.time) + console.info = info + } + const instance = require('../browser')({ + browser: { + write: { + error (o) { + is(o.level, 50) + is(o.test, 'test') + ok(o.time) + } + } + } + }) + instance.error({ test: 'test' }) + instance.info('test') + + end() +}) + +function levelTest (name) { + test(name + ' logs', ({ end, is }) => { + const msg = 'hello world' + sink(name, (args) => { + is(args[0], msg) + end() + }) + pino({ level: name })[name](msg) + }) + + test('passing objects at level ' + name, ({ end, is }) => { + const msg = { hello: 'world' } + sink(name, (args) => { + is(args[0], msg) + end() + }) + pino({ level: name })[name](msg) + }) + + test('passing an object and a string at level ' + name, ({ end, is }) => { + const a = { hello: 'world' } + const b = 'a string' + sink(name, (args) => { + is(args[0], a) + is(args[1], b) + end() + }) + pino({ level: name })[name](a, b) + }) + + test('formatting logs as ' + name, ({ end, is }) => { + sink(name, (args) => { + is(args[0], 'hello %d') + is(args[1], 42) + end() + }) + pino({ level: name })[name]('hello %d', 42) + }) + + test('passing error at level ' + name, ({ end, is }) => { + const err = new Error('myerror') + sink(name, (args) => { + is(args[0], err) + end() + }) + pino({ level: name })[name](err) + }) + + test('passing error with a serializer at level ' + name, ({ end, is }) => { + // in browser - should have no effect (should not crash) + const err = new Error('myerror') + sink(name, (args) => { + is(args[0].err, err) + end() + }) + const instance = pino({ + level: name, + serializers: { + err: pino.stdSerializers.err + } + }) + instance[name]({ err }) + }) + + test('child logger for level ' + name, ({ end, is }) => { + const msg = 'hello world' + const parent = { hello: 'world' } + sink(name, (args) => { + is(args[0], parent) + is(args[1], msg) + end() + }) + const instance = pino({ level: name }) + const child = instance.child(parent) + child[name](msg) + }) + + test('child-child logger for level ' + name, ({ end, is }) => { + const msg = 'hello world' + const grandParent = { hello: 'world' } + const parent = { hello: 'you' } + sink(name, (args) => { + is(args[0], grandParent) + is(args[1], parent) + is(args[2], msg) + end() + }) + const instance = pino({ level: name }) + const child = instance.child(grandParent).child(parent) + child[name](msg) + }) +} + +function consoleMethodTest (level, method) { + if (!method) method = level + test('pino().' + level + ' uses console.' + method, ({ end, is }) => { + sink(method, (args) => { + is(args[0], 'test') + end() + }) + const instance = require('../browser')({ level }) + instance[level]('test') + }) +} + +function absentConsoleMethodTest (method, fallback) { + test('in absence of console.' + method + ', console.' + fallback + ' is used', ({ end, is }) => { + const fn = console[method] + console[method] = undefined + sink(fallback, function (args) { + is(args[0], 'test') + end() + console[method] = fn + }) + const instance = require('../browser')({ level: method }) + instance[method]('test') + }) +} + +function isFunc (fn) { return typeof fn === 'function' } +function fnName (fn) { + const rx = /^\s*function\s*([^(]*)/i + const match = rx.exec(fn) + return match && match[1] +} +function sink (method, fn) { + if (method === 'fatal') method = 'error' + const orig = console[method] + console[method] = function () { + console[method] = orig + fn(Array.prototype.slice.call(arguments)) + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/complex-objects.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/complex-objects.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c0940f6bf2e4537c6f245e82da710a533867120e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/complex-objects.test.js @@ -0,0 +1,34 @@ +'use strict' + +const { test } = require('tap') +const { sink, once } = require('./helper') +const { PassThrough } = require('node:stream') +const pino = require('../') + +test('Proxy and stream objects', async ({ equal }) => { + const s = new PassThrough() + s.resume() + s.write('', () => {}) + const obj = { s, p: new Proxy({}, { get () { throw new Error('kaboom') } }) } + const stream = sink() + const instance = pino(stream) + instance.info({ obj }) + + const result = await once(stream, 'data') + + equal(result.obj, '[unable to serialize, circular reference is too complex to analyze]') +}) + +test('Proxy and stream objects', async ({ equal }) => { + const s = new PassThrough() + s.resume() + s.write('', () => {}) + const obj = { s, p: new Proxy({}, { get () { throw new Error('kaboom') } }) } + const stream = sink() + const instance = pino(stream) + instance.info(obj) + + const result = await once(stream, 'data') + + equal(result.p, '[unable to serialize, circular reference is too complex to analyze]') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/crlf.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/crlf.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8186fbec8e74a1858440615e531005b4d7e96015 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/crlf.test.js @@ -0,0 +1,32 @@ +'use strict' + +const { test } = require('tap') +const writer = require('flush-write-stream') +const pino = require('../') + +function capture () { + const ws = writer((chunk, enc, cb) => { + ws.data += chunk.toString() + cb() + }) + ws.data = '' + return ws +} + +test('pino uses LF by default', async ({ ok }) => { + const stream = capture() + const logger = pino(stream) + logger.info('foo') + logger.error('bar') + ok(/foo[^\r\n]+\n[^\r\n]+bar[^\r\n]+\n/.test(stream.data)) +}) + +test('pino can log CRLF', async ({ ok }) => { + const stream = capture() + const logger = pino({ + crlf: true + }, stream) + logger.info('foo') + logger.error('bar') + ok(/foo[^\n]+\r\n[^\n]+bar[^\n]+\r\n/.test(stream.data)) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/custom-levels.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/custom-levels.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a7298d806d92e6ef8fe1d1f354b2201eb43d19db --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/custom-levels.test.js @@ -0,0 +1,253 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +// Silence all warnings for this test +process.removeAllListeners('warning') +process.on('warning', () => {}) + +test('adds additional levels', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35, + bar: 45 + } + }, stream) + + logger.foo('test') + const { level } = await once(stream, 'data') + equal(level, 35) +}) + +test('custom levels does not override default levels', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + } + }, stream) + + logger.info('test') + const { level } = await once(stream, 'data') + equal(level, 30) +}) + +test('default levels can be redefined using custom levels', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + info: 35, + debug: 45 + }, + useOnlyCustomLevels: true + }, stream) + + equal(logger.hasOwnProperty('info'), true) + + logger.info('test') + const { level } = await once(stream, 'data') + equal(level, 35) +}) + +test('custom levels overrides default level label if use useOnlyCustomLevels', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + }, + useOnlyCustomLevels: true, + level: 'foo' + }, stream) + + equal(logger.hasOwnProperty('info'), false) +}) + +test('custom levels overrides default level value if use useOnlyCustomLevels', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + }, + useOnlyCustomLevels: true, + level: 35 + }, stream) + + equal(logger.hasOwnProperty('info'), false) +}) + +test('custom levels are inherited by children', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + } + }, stream) + + logger.child({ childMsg: 'ok' }).foo('test') + const { msg, childMsg, level } = await once(stream, 'data') + equal(level, 35) + equal(childMsg, 'ok') + equal(msg, 'test') +}) + +test('custom levels can be specified on child bindings', async ({ equal }) => { + const stream = sink() + const logger = pino(stream).child({ + childMsg: 'ok' + }, { + customLevels: { + foo: 35 + } + }) + + logger.foo('test') + const { msg, childMsg, level } = await once(stream, 'data') + equal(level, 35) + equal(childMsg, 'ok') + equal(msg, 'test') +}) + +test('customLevels property child bindings does not get logged', async ({ equal }) => { + const stream = sink() + const logger = pino(stream).child({ + childMsg: 'ok' + }, { + customLevels: { + foo: 35 + } + }) + + logger.foo('test') + const { customLevels } = await once(stream, 'data') + equal(customLevels, undefined) +}) + +test('throws when specifying pre-existing parent labels via child bindings', async ({ throws }) => { + const stream = sink() + throws(() => pino({ + customLevels: { + foo: 35 + } + }, stream).child({}, { + customLevels: { + foo: 45 + } + }), 'levels cannot be overridden') +}) + +test('throws when specifying pre-existing parent values via child bindings', async ({ throws }) => { + const stream = sink() + throws(() => pino({ + customLevels: { + foo: 35 + } + }, stream).child({}, { + customLevels: { + bar: 35 + } + }), 'pre-existing level values cannot be used for new levels') +}) + +test('throws when specifying core values via child bindings', async ({ throws }) => { + const stream = sink() + throws(() => pino(stream).child({}, { + customLevels: { + foo: 30 + } + }), 'pre-existing level values cannot be used for new levels') +}) + +test('throws when useOnlyCustomLevels is set true without customLevels', async ({ throws }) => { + const stream = sink() + throws(() => pino({ + useOnlyCustomLevels: true + }, stream), 'customLevels is required if useOnlyCustomLevels is set true') +}) + +test('custom level on one instance does not affect other instances', async ({ equal }) => { + pino({ + customLevels: { + foo: 37 + } + }) + equal(typeof pino().foo, 'undefined') +}) + +test('setting level below or at custom level will successfully log', async ({ equal }) => { + const stream = sink() + const instance = pino({ customLevels: { foo: 35 } }, stream) + instance.level = 'foo' + instance.info('nope') + instance.foo('bar') + const { msg } = await once(stream, 'data') + equal(msg, 'bar') +}) + +test('custom level below level threshold will not log', async ({ equal }) => { + const stream = sink() + const instance = pino({ customLevels: { foo: 15 } }, stream) + instance.level = 'info' + instance.info('bar') + instance.foo('nope') + const { msg } = await once(stream, 'data') + equal(msg, 'bar') +}) + +test('does not share custom level state across siblings', async ({ doesNotThrow }) => { + const stream = sink() + const logger = pino(stream) + logger.child({}, { + customLevels: { foo: 35 } + }) + doesNotThrow(() => { + logger.child({}, { + customLevels: { foo: 35 } + }) + }) +}) + +test('custom level does not affect the levels serializer', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35, + bar: 45 + }, + formatters: { + level (label, number) { + return { priority: number } + } + } + }, stream) + + logger.foo('test') + const { priority } = await once(stream, 'data') + equal(priority, 35) +}) + +test('When useOnlyCustomLevels is set to true, the level formatter should only get custom levels', async ({ equal }) => { + const stream = sink() + const logger = pino({ + customLevels: { + answer: 42 + }, + useOnlyCustomLevels: true, + level: 42, + formatters: { + level (label, number) { + equal(label, 'answer') + equal(number, 42) + return { level: number } + } + } + }, stream) + + logger.answer('test') + const { level } = await once(stream, 'data') + equal(level, 42) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/error.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/error.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e4570fa1fda487ea0861b4d2161d2b419996e60a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/error.test.js @@ -0,0 +1,398 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const os = require('node:os') +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() +const level = 50 +const name = 'error' + +test('err is serialized with additional properties set on the Error object', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('myerror'), { foo: 'bar' }) + const instance = pino(stream) + instance.level = name + instance[name](err) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + err: { + type: 'Error', + message: err.message, + stack: err.stack, + foo: err.foo + }, + msg: err.message + }) +}) + +test('type should be detected based on constructor', async ({ ok, same }) => { + class Bar extends Error {} + const stream = sink() + const err = new Bar('myerror') + const instance = pino(stream) + instance.level = name + instance[name](err) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + err: { + type: 'Bar', + message: err.message, + stack: err.stack + }, + msg: err.message + }) +}) + +test('type, message and stack should be first level properties', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('foo'), { foo: 'bar' }) + const instance = pino(stream) + instance.level = name + instance[name](err) + + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + err: { + type: 'Error', + message: err.message, + stack: err.stack, + foo: err.foo + }, + msg: err.message + }) +}) + +test('err serializer', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('myerror'), { foo: 'bar' }) + const instance = pino({ + serializers: { + err: pino.stdSerializers.err + } + }, stream) + + instance.level = name + instance[name]({ err }) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + err: { + type: 'Error', + message: err.message, + stack: err.stack, + foo: err.foo + }, + msg: err.message + }) +}) + +test('an error with statusCode property is not confused for a http response', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('StatusCodeErr'), { statusCode: 500 }) + const instance = pino(stream) + + instance.level = name + instance[name](err) + const result = await once(stream, 'data') + + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + err: { + type: 'Error', + message: err.message, + stack: err.stack, + statusCode: err.statusCode + }, + msg: err.message + }) +}) + +test('stack is omitted if it is not set on err', t => { + t.plan(2) + const err = new Error('myerror') + delete err.stack + const instance = pino(sink(function (chunk, enc, cb) { + t.ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + t.equal(chunk.hasOwnProperty('stack'), false) + cb() + })) + + instance.level = name + instance[name](err) +}) + +test('correctly ignores toString on errors', async ({ same }) => { + const err = new Error('myerror') + err.toString = () => undefined + const stream = sink() + const instance = pino({ + test: 'this' + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + err: { + type: 'Error', + message: err.message, + stack: err.stack + }, + msg: err.message + }) +}) + +test('assign mixin()', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino({ + mixin () { + return { hello: 'world' } + } + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + hello: 'world', + err: { + type: 'Error', + message: err.message, + stack: err.stack + }, + msg: err.message + }) +}) + +test('no err serializer', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino({ + serializers: {} + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + err: { + type: 'Error', + message: err.message, + stack: err.stack + }, + msg: err.message + }) +}) + +test('empty serializer', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino({ + serializers: { + err () {} + } + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + msg: err.message + }) +}) + +test('assign mixin()', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino({ + mixin () { + return { hello: 'world' } + } + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + hello: 'world', + err: { + type: 'Error', + message: err.message, + stack: err.stack + }, + msg: err.message + }) +}) + +test('no err serializer', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino({ + serializers: {} + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + err: { + type: 'Error', + message: err.message, + stack: err.stack + }, + msg: err.message + }) +}) + +test('empty serializer', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino({ + serializers: { + err () {} + } + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + msg: err.message + }) +}) + +test('correctly adds error information when nestedKey is used', async ({ same }) => { + const err = new Error('myerror') + err.toString = () => undefined + const stream = sink() + const instance = pino({ + test: 'this', + nestedKey: 'obj' + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + obj: { + err: { + type: 'Error', + stack: err.stack, + message: err.message + } + }, + msg: err.message + }) +}) + +test('correctly adds msg on error when nestedKey is used', async ({ same }) => { + const err = new Error('myerror') + err.toString = () => undefined + const stream = sink() + const instance = pino({ + test: 'this', + nestedKey: 'obj' + }, stream) + instance.fatal(err, 'msg message') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + obj: { + err: { + type: 'Error', + stack: err.stack, + message: err.message + } + }, + msg: 'msg message' + }) +}) + +test('msg should take precedence over error message on mergingObject', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino(stream) + instance.error({ msg: 'my message', err }) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 50, + err: { + type: 'Error', + stack: err.stack, + message: err.message + }, + msg: 'my message' + }) +}) + +test('considers messageKey when giving msg precedence over error', async ({ same }) => { + const err = new Error('myerror') + const stream = sink() + const instance = pino({ messageKey: 'message' }, stream) + instance.error({ message: 'my message', err }) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 50, + err: { + type: 'Error', + stack: err.stack, + message: err.message + }, + message: 'my message' + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/errorKey.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/errorKey.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9b8e80bcc9fea0c7caae1b9b290c2aea25223ce6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/errorKey.test.js @@ -0,0 +1,34 @@ +'use strict' +const { test } = require('tap') +const { sink, once } = require('./helper') +const stdSerializers = require('pino-std-serializers') +const pino = require('../') + +test('set the errorKey with error serializer', async ({ equal, same }) => { + const stream = sink() + const errorKey = 'error' + const instance = pino({ + errorKey, + serializers: { [errorKey]: stdSerializers.err } + }, stream) + instance.error(new ReferenceError('test')) + const o = await once(stream, 'data') + equal(typeof o[errorKey], 'object') + equal(o[errorKey].type, 'ReferenceError') + equal(o[errorKey].message, 'test') + equal(typeof o[errorKey].stack, 'string') +}) + +test('set the errorKey without error serializer', async ({ equal, same }) => { + const stream = sink() + const errorKey = 'error' + const instance = pino({ + errorKey + }, stream) + instance.error(new ReferenceError('test')) + const o = await once(stream, 'data') + equal(typeof o[errorKey], 'object') + equal(o[errorKey].type, 'ReferenceError') + equal(o[errorKey].message, 'test') + equal(typeof o[errorKey].stack, 'string') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/escaping.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/escaping.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de5b34efcefe2b9c4952307c974ec94daa3efa6b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/escaping.test.js @@ -0,0 +1,91 @@ +'use strict' + +const os = require('node:os') +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() + +function testEscape (ch, key) { + test('correctly escape ' + ch, async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('this contains ' + key) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + name: 'hello', + msg: 'this contains ' + key + }) + }) +} + +testEscape('\\n', '\n') +testEscape('\\/', '/') +testEscape('\\\\', '\\') +testEscape('\\r', '\r') +testEscape('\\t', '\t') +testEscape('\\b', '\b') + +const toEscape = [ + '\u0000', // NUL Null character + '\u0001', // SOH Start of Heading + '\u0002', // STX Start of Text + '\u0003', // ETX End-of-text character + '\u0004', // EOT End-of-transmission character + '\u0005', // ENQ Enquiry character + '\u0006', // ACK Acknowledge character + '\u0007', // BEL Bell character + '\u0008', // BS Backspace + '\u0009', // HT Horizontal tab + '\u000A', // LF Line feed + '\u000B', // VT Vertical tab + '\u000C', // FF Form feed + '\u000D', // CR Carriage return + '\u000E', // SO Shift Out + '\u000F', // SI Shift In + '\u0010', // DLE Data Link Escape + '\u0011', // DC1 Device Control 1 + '\u0012', // DC2 Device Control 2 + '\u0013', // DC3 Device Control 3 + '\u0014', // DC4 Device Control 4 + '\u0015', // NAK Negative-acknowledge character + '\u0016', // SYN Synchronous Idle + '\u0017', // ETB End of Transmission Block + '\u0018', // CAN Cancel character + '\u0019', // EM End of Medium + '\u001A', // SUB Substitute character + '\u001B', // ESC Escape character + '\u001C', // FS File Separator + '\u001D', // GS Group Separator + '\u001E', // RS Record Separator + '\u001F' // US Unit Separator +] + +toEscape.forEach((key) => { + testEscape(JSON.stringify(key), key) +}) + +test('correctly escape `hello \\u001F world \\n \\u0022`', async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('hello \u001F world \n \u0022') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid, + hostname, + level: 60, + name: 'hello', + msg: 'hello \u001F world \n \u0022' + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/esm.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/esm.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6523937c98c9dbfe630f498130ae45dd7c53d137 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/esm.mjs @@ -0,0 +1,12 @@ +import t from 'tap' +import pino from '../../pino.js' +import helper from '../helper.js' + +const { sink, check, once } = helper + +t.test('esm support', async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + instance.info('hello world') + check(equal, await once(stream, 'data'), 30, 'hello world') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/index.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/index.test.js new file mode 100644 index 0000000000000000000000000000000000000000..80ac1921235b8f633aad73dfe15a815b67ebd47c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/index.test.js @@ -0,0 +1,34 @@ +'use strict' + +const t = require('tap') +const semver = require('semver') + +const { isYarnPnp } = require('../helper') + +if (!semver.satisfies(process.versions.node, '^13.3.0 || ^12.10.0 || >= 14.0.0') || isYarnPnp) { + t.skip('Skip esm because not supported by Node') +} else { + // Node v8 throw a `SyntaxError: Unexpected token import` + // even if this branch is never touch in the code, + // by using `eval` we can avoid this issue. + // eslint-disable-next-line + new Function('module', 'return import(module)')('./esm.mjs').catch((err) => { + process.nextTick(() => { + throw err + }) + }) +} + +if (!semver.satisfies(process.versions.node, '>= 14.13.0 || ^12.20.0') || isYarnPnp) { + t.skip('Skip named exports because not supported by Node') +} else { + // Node v8 throw a `SyntaxError: Unexpected token import` + // even if this branch is never touch in the code, + // by using `eval` we can avoid this issue. + // eslint-disable-next-line + new Function('module', 'return import(module)')('./named-exports.mjs').catch((err) => { + process.nextTick(() => { + throw err + }) + }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/named-exports.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/named-exports.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ee9f2578a544c521472024c9b77b329b75fd2e7b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/esm/named-exports.mjs @@ -0,0 +1,27 @@ +import { hostname } from 'node:os' +import t from 'tap' +import { sink, check, once, watchFileCreated, file } from '../helper.js' +import { pino, destination } from '../../pino.js' +import { readFileSync } from 'node:fs' + +t.test('named exports support', async ({ equal }) => { + const stream = sink() + const instance = pino(stream) + instance.info('hello world') + check(equal, await once(stream, 'data'), 30, 'hello world') +}) + +t.test('destination', async ({ same }) => { + const tmp = file() + const instance = pino(destination(tmp)) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + delete result.time + same(result, { + pid: process.pid, + hostname, + level: 30, + msg: 'hello' + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/exit.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/exit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a2dcf05f8f62567e95c7153ef2508638ee765976 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/exit.test.js @@ -0,0 +1,77 @@ +'use strict' + +const { test } = require('tap') +const { join } = require('node:path') +const execa = require('execa') +const writer = require('flush-write-stream') +const { once } = require('./helper') + +// https://github.com/pinojs/pino/issues/542 +test('pino.destination log everything when calling process.exit(0)', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'destination-exit.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + + not(actual.match(/hello/), null) + not(actual.match(/world/), null) +}) + +test('pino with no args log everything when calling process.exit(0)', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'default-exit.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + + not(actual.match(/hello/), null) + not(actual.match(/world/), null) +}) + +test('sync false logs everything when calling process.exit(0)', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'syncfalse-exit.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + + not(actual.match(/hello/), null) + not(actual.match(/world/), null) +}) + +test('sync false logs everything when calling flushSync', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'syncfalse-flush-exit.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + + not(actual.match(/hello/), null) + not(actual.match(/world/), null) +}) + +test('transports exits gracefully when logging in exit', async ({ equal }) => { + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'transport-with-on-exit.js')]) + child.stdout.resume() + + const code = await once(child, 'close') + + equal(code, 0) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/basic.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/basic.js new file mode 100644 index 0000000000000000000000000000000000000000..cc33c9b873d65eb0876a9257ad3f24f14e0c22b5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/basic.js @@ -0,0 +1,9 @@ +'use strict' + +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } + +const pino = require('../../..')() + +pino.info('hello world') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/destination.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/destination.js new file mode 100644 index 0000000000000000000000000000000000000000..701f686331d197ff7f02b1d1df796ea0d2a4a2ca --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/destination.js @@ -0,0 +1,10 @@ +'use strict' + +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } + +const pino = require('../../..') +const logger = pino(pino.destination()) + +logger.info('hello world') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js new file mode 100644 index 0000000000000000000000000000000000000000..de71431fc654b0a7d8aa60c7d87bcf5d743f9a79 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js @@ -0,0 +1,12 @@ +'use strict' + +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } + +const pino = require('../../..') +const logger = pino(pino.destination({ sync: false })) + +for (var i = 0; i < 1000; i++) { + logger.info('hello world') +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/console-transport.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/console-transport.js new file mode 100644 index 0000000000000000000000000000000000000000..9974ebcb92ae07def1374b66e536d748b0cf7c70 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/console-transport.js @@ -0,0 +1,13 @@ +const { Writable } = require('node:stream') + +module.exports = (options) => { + const myTransportStream = new Writable({ + autoDestroy: true, + write (chunk, enc, cb) { + // apply a transform and send to stdout + console.log(chunk.toString().toUpperCase()) + cb() + } + }) + return myTransportStream +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/crashing-transport.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/crashing-transport.js new file mode 100644 index 0000000000000000000000000000000000000000..1f3d46ee952d3be746f094a83dd97a5faa8cbdb5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/crashing-transport.js @@ -0,0 +1,13 @@ +const { Writable } = require('node:stream') + +module.exports = () => + new Writable({ + autoDestroy: true, + write (chunk, enc, cb) { + setImmediate(() => { + /* eslint-disable no-empty */ + for (let i = 0; i < 1e3; i++) {} + process.exit(0) + }) + } + }) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/default-exit.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/default-exit.js new file mode 100644 index 0000000000000000000000000000000000000000..3fd2a0e1772d1c1fbf413b66660128c7fbf3efba --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/default-exit.js @@ -0,0 +1,8 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('./../../')) +const logger = pino() +logger.info('hello') +logger.info('world') +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/destination-exit.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/destination-exit.js new file mode 100644 index 0000000000000000000000000000000000000000..63c6d69765c8c9a2c97c2f4e6fa19b94ab355689 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/destination-exit.js @@ -0,0 +1,8 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('./../../')) +const logger = pino({}, pino.destination(1)) +logger.info('hello') +logger.info('world') +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1d45ad03866b5ca6ff4b58a8c66912ae660eca71 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/index.js @@ -0,0 +1,13 @@ +/* eslint-disable no-eval */ + +eval(` +const pino = require('../../../') + +const logger = pino( + pino.transport({ + target: 'pino/file' + }) +) + +logger.info('done!') +`) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/14-files.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/14-files.js new file mode 100644 index 0000000000000000000000000000000000000000..32a20daed77dd10eee80d6d0de225d19c86e755e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/14-files.js @@ -0,0 +1,3 @@ +const file1 = require("./file1.js") + +file1() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/2-files.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/2-files.js new file mode 100644 index 0000000000000000000000000000000000000000..8c665edabe2c72066aef16bfcf2a7c0978a438ea --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/2-files.js @@ -0,0 +1,3 @@ +const file12 = require("./file12.js") + +file12() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file1.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file1.js new file mode 100644 index 0000000000000000000000000000000000000000..4ce13fbb1b694ee195e3c9ce5ce7f0e159730e16 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file1.js @@ -0,0 +1,5 @@ +const file2 = require("./file2.js") + +module.exports = function () { + file2() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file10.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file10.js new file mode 100644 index 0000000000000000000000000000000000000000..136f0e0c9de939c8155a07a203a7394cf62e58e9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file10.js @@ -0,0 +1,5 @@ +const file11 = require("./file11.js") + +module.exports = function () { + file11() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file11.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file11.js new file mode 100644 index 0000000000000000000000000000000000000000..f8a731b80eec0ca073249768d24f3a443d4ce8a7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file11.js @@ -0,0 +1,5 @@ +const file12 = require("./file12.js") + +module.exports = function () { + file12() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file12.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file12.js new file mode 100644 index 0000000000000000000000000000000000000000..e8e330f8460e8d778bcb76fda52072a801bb3770 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file12.js @@ -0,0 +1,5 @@ +const file13 = require("./file13.js") + +module.exports = function () { + file13() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file13.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file13.js new file mode 100644 index 0000000000000000000000000000000000000000..6db9a61f753d00556c9161a63bb22f64a7c0b4bd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file13.js @@ -0,0 +1,5 @@ +const file14 = require("./file14.js") + +module.exports = function () { + file14() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file14.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file14.js new file mode 100644 index 0000000000000000000000000000000000000000..443ca7f80ae07302b7c75416e7acf661854e1d92 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file14.js @@ -0,0 +1,11 @@ +const pino = require("../../../../"); + +module.exports = function() { + const logger = pino( + pino.transport({ + target: 'pino/file' + }) + ) + + logger.info('done!') +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file2.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file2.js new file mode 100644 index 0000000000000000000000000000000000000000..46877d5bd87d5055b62ee9ac6882bf32b0d6c5a0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file2.js @@ -0,0 +1,5 @@ +const file3 = require("./file3.js") + +module.exports = function () { + file3() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file3.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file3.js new file mode 100644 index 0000000000000000000000000000000000000000..3a6ac78daa4f6d679a2d008ee78c27182137cd5c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file3.js @@ -0,0 +1,5 @@ +const file4 = require("./file4.js") + +module.exports = function () { + file4() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file4.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file4.js new file mode 100644 index 0000000000000000000000000000000000000000..b679e24df3cf3077b691bda524fe103d4c390902 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file4.js @@ -0,0 +1,5 @@ +const file5 = require("./file5.js") + +module.exports = function () { + file5() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file5.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file5.js new file mode 100644 index 0000000000000000000000000000000000000000..06cd045299447e3a919acc207b340c6137963c99 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file5.js @@ -0,0 +1,5 @@ +const file6 = require("./file6.js") + +module.exports = function () { + file6() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file6.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file6.js new file mode 100644 index 0000000000000000000000000000000000000000..3abf1dcbd3dcd09bfe03a8746945cf4e8ce2b5c0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file6.js @@ -0,0 +1,5 @@ +const file7 = require("./file7.js") + +module.exports = function () { + file7() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file7.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file7.js new file mode 100644 index 0000000000000000000000000000000000000000..4d2f488ce8eced694735b4e75907ce9568c200d9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file7.js @@ -0,0 +1,5 @@ +const file8 = require("./file8.js") + +module.exports = function () { + file8() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file8.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file8.js new file mode 100644 index 0000000000000000000000000000000000000000..e87f177a240b3d58d97c20e0e5d30bd70dd6b83f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file8.js @@ -0,0 +1,5 @@ +const file9 = require("./file9.js") + +module.exports = function () { + file9() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file9.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file9.js new file mode 100644 index 0000000000000000000000000000000000000000..0164926f7c7045ccc7da16b40e5b7df317f6483d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/eval/node_modules/file9.js @@ -0,0 +1,5 @@ +const file10 = require("./file10.js") + +module.exports = function () { + file10() +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/noop-transport.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/noop-transport.js new file mode 100644 index 0000000000000000000000000000000000000000..745504a13205f71fe88420d24fe07850bd641515 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/noop-transport.js @@ -0,0 +1,10 @@ +const { Writable } = require('node:stream') + +module.exports = () => { + return new Writable({ + autoDestroy: true, + write (chunk, enc, cb) { + cb() + } + }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/pretty/null-prototype.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/pretty/null-prototype.js new file mode 100644 index 0000000000000000000000000000000000000000..c88e686bc96bd1334d9d70cf64ff4064cd539504 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/pretty/null-prototype.js @@ -0,0 +1,8 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('./../../../')) +const log = pino({ prettyPrint: true }) +const obj = Object.create(null) +Object.assign(obj, { foo: 'bar' }) +log.info(obj, 'hello') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/stdout-hack-protection.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/stdout-hack-protection.js new file mode 100644 index 0000000000000000000000000000000000000000..525ef6246c7bf4a79ce39b42bf8084bb24080cc5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/stdout-hack-protection.js @@ -0,0 +1,11 @@ +global.process = { __proto__: process, pid: 123456 } + +const write = process.stdout.write.bind(process.stdout) +process.stdout.write = function (chunk) { + write('hack ' + chunk) +} + +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('../../'))() +pino.info('me') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-child.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-child.js new file mode 100644 index 0000000000000000000000000000000000000000..f858b3d7742d3e2db9b1e811683500b80d24a335 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-child.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('./../../')) +const asyncLogger = pino(pino.destination({ sync: false })).child({ hello: 'world' }) +asyncLogger.info('h') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-exit.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-exit.js new file mode 100644 index 0000000000000000000000000000000000000000..fb09eab7d1454dce5f07d535b4412907a78cee7c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-exit.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('./../../')) +const dest = pino.destination({ dest: 1, minLength: 4096, sync: false }) +const logger = pino({}, dest) +logger.info('hello') +logger.info('world') +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-flush-exit.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-flush-exit.js new file mode 100644 index 0000000000000000000000000000000000000000..bf9cb4f53813fb944310c57cc1ea7b35b0074d44 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse-flush-exit.js @@ -0,0 +1,10 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('./../../')) +const dest = pino.destination({ dest: 1, minLength: 4096, sync: false }) +const logger = pino({}, dest) +logger.info('hello') +logger.info('world') +dest.flushSync() +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse.js new file mode 100644 index 0000000000000000000000000000000000000000..4d367523ebb72c1bf65102eda89fad1bcd647a0f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syncfalse.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('node:os').hostname = function () { return 'abcdefghijklmnopqr' } +const pino = require(require.resolve('./../../')) +const asyncLogger = pino(pino.destination({ minLength: 4096, sync: false })) +asyncLogger.info('h') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syntax-error-esm.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syntax-error-esm.mjs new file mode 100644 index 0000000000000000000000000000000000000000..021d53bac285f6d3d2bd617c9252a03bd11bd577 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/syntax-error-esm.mjs @@ -0,0 +1,2 @@ +// This is a syntax error +import diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport-with-transform.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport-with-transform.js new file mode 100644 index 0000000000000000000000000000000000000000..89cf465ece6e1662e975f12bd77a82175eab0f20 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport-with-transform.js @@ -0,0 +1,20 @@ +'use strict' + +const fs = require('node:fs') +const { once } = require('node:events') +const { Transform } = require('node:stream') + +async function run (opts) { + if (!opts.destination) throw new Error('kaboom') + const stream = fs.createWriteStream(opts.destination) + await once(stream, 'open') + const t = new Transform({ + transform (chunk, enc, cb) { + setImmediate(cb, null, chunk.toString().toUpperCase()) + } + }) + t.pipe(stream) + return t +} + +module.exports = run diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport.js new file mode 100644 index 0000000000000000000000000000000000000000..09f12742d5ace461c8ee33b938148e86b3100f6b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport.js @@ -0,0 +1,13 @@ +'use strict' + +const fs = require('node:fs') +const { once } = require('node:events') + +async function run (opts) { + if (!opts.destination) throw new Error('kaboom') + const stream = fs.createWriteStream(opts.destination) + await once(stream, 'open') + return stream +} + +module.exports = run diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport.mjs b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4925d3bf4e980575e656952bb79ef1aa4dc24d3e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/to-file-transport.mjs @@ -0,0 +1,8 @@ +import { createWriteStream } from 'node:fs' +import { once } from 'node:events' + +export default async function run (opts) { + const stream = createWriteStream(opts.destination) + await once(stream, 'open') + return stream +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js new file mode 100644 index 0000000000000000000000000000000000000000..9837e33a6c3eff1d4dd1f254f6ed2d3684934ea0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js @@ -0,0 +1,16 @@ +'use strict' + +const pino = require('../..') +const transport = pino.transport({ + target: './to-file-transport-with-transform.js', + options: { + destination: process.argv[2] + } +}) +const logger = pino(transport) + +logger.info('Hello') + +logger.info('World') + +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-immediately.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-immediately.js new file mode 100644 index 0000000000000000000000000000000000000000..5be55e4eccbd670c043328707b1e5aa4cfb418a0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-immediately.js @@ -0,0 +1,11 @@ +'use strict' + +const pino = require('../..') +const transport = pino.transport({ + target: 'pino/file' +}) +const logger = pino(transport) + +logger.info('Hello') + +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-on-ready.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-on-ready.js new file mode 100644 index 0000000000000000000000000000000000000000..1520db54b901750896204ce941b03db6b8118081 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-exit-on-ready.js @@ -0,0 +1,12 @@ +'use strict' + +const pino = require('../..') +const transport = pino.transport({ + target: 'pino/file' +}) +const logger = pino(transport) + +transport.on('ready', function () { + logger.info('Hello') + process.exit(0) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-main.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-main.js new file mode 100644 index 0000000000000000000000000000000000000000..cb02005cd0bd9c591032552e7d49368c8dcb3c7d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-main.js @@ -0,0 +1,9 @@ +'use strict' + +const { join } = require('node:path') +const pino = require('../..') +const transport = pino.transport({ + target: join(__dirname, 'transport-worker.js') +}) +const logger = pino(transport) +logger.info('Hello') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-many-lines.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-many-lines.js new file mode 100644 index 0000000000000000000000000000000000000000..d8bb5e3af8a5691d2b92e672f562346b3badcc66 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-many-lines.js @@ -0,0 +1,29 @@ +'use strict' + +const pino = require('../..') +const transport = pino.transport({ + targets: [{ + level: 'info', + target: 'pino/file', + options: { + destination: process.argv[2] + } + }] +}) +const logger = pino(transport) + +const toWrite = 1000000 +transport.on('ready', run) + +let total = 0 + +function run () { + if (total++ === 8) { + return + } + + for (let i = 0; i < toWrite; i++) { + logger.info(`hello ${i}`) + } + transport.once('drain', run) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-string-stdout.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-string-stdout.js new file mode 100644 index 0000000000000000000000000000000000000000..64d8ac1ea598aee8f70cefe5c24bb51cf458db8a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-string-stdout.js @@ -0,0 +1,9 @@ +'use strict' + +const pino = require('../..') +const transport = pino.transport({ + target: 'pino/file', + options: { destination: '1' } +}) +const logger = pino(transport) +logger.info('Hello') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-transform.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-transform.js new file mode 100644 index 0000000000000000000000000000000000000000..4950236c647a0452698f761622ac2918e38c39c8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-transform.js @@ -0,0 +1,21 @@ +'use strict' + +const build = require('pino-abstract-transport') +const { pipeline, Transform } = require('node:stream') +module.exports = (options) => { + return build(function (source) { + const myTransportStream = new Transform({ + autoDestroy: true, + objectMode: true, + transform (chunk, enc, cb) { + chunk.service = 'pino' + this.push(JSON.stringify(chunk)) + cb() + } + }) + pipeline(source, myTransportStream, () => {}) + return myTransportStream + }, { + enablePipelining: true + }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-uses-pino-config.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-uses-pino-config.js new file mode 100644 index 0000000000000000000000000000000000000000..0c87c949143e2e6f76ece3a3b0f483956ebe6927 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-uses-pino-config.js @@ -0,0 +1,33 @@ +'use strict' + +const build = require('pino-abstract-transport') +const { pipeline, Transform } = require('node:stream') +module.exports = () => { + return build(function (source) { + const myTransportStream = new Transform({ + autoDestroy: true, + objectMode: true, + transform (chunk, enc, cb) { + const { + time, + level, + [source.messageKey]: body, + [source.errorKey]: error, + ...attributes + } = chunk + this.push(JSON.stringify({ + severityText: source.levels.labels[level], + body, + attributes, + ...(error && { error }) + })) + cb() + } + }) + pipeline(source, myTransportStream, () => {}) + return myTransportStream + }, { + enablePipelining: true, + expectPinoConfig: true + }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-with-on-exit.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-with-on-exit.js new file mode 100644 index 0000000000000000000000000000000000000000..655a17395af8633de582636f47717015b67f9b99 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-with-on-exit.js @@ -0,0 +1,12 @@ +'use strict' +const pino = require('../..') +const log = pino({ + transport: { + target: 'pino/file', + options: { destination: 1 } + } +}) +log.info('hello world!') +process.on('exit', (code) => { + log.info('Exiting peacefully') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-worker-data.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-worker-data.js new file mode 100644 index 0000000000000000000000000000000000000000..1e0e7a8dcb22dd2adb3b4ced7681dc9368634784 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-worker-data.js @@ -0,0 +1,19 @@ +'use strict' + +const { parentPort, workerData } = require('worker_threads') +const { Writable } = require('node:stream') + +module.exports = (options) => { + const myTransportStream = new Writable({ + autoDestroy: true, + write (chunk, enc, cb) { + parentPort.postMessage({ + code: 'EVENT', + name: 'workerData', + args: [workerData] + }) + cb() + } + }) + return myTransportStream +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-worker.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-worker.js new file mode 100644 index 0000000000000000000000000000000000000000..8964b263195806c674f025bb456abd4a5c5c2a16 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-worker.js @@ -0,0 +1,15 @@ +'use strict' + +const { Writable } = require('node:stream') +const fs = require('node:fs') +module.exports = (options) => { + const myTransportStream = new Writable({ + autoDestroy: true, + write (chunk, enc, cb) { + // Bypass console.log() to avoid flakiness + fs.writeSync(1, chunk.toString()) + cb() + } + }) + return myTransportStream +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-wrong-export-type.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-wrong-export-type.js new file mode 100644 index 0000000000000000000000000000000000000000..ed0affd58fe76bf7433ce2847cfab4bdb603ac9a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport-wrong-export-type.js @@ -0,0 +1,3 @@ +module.exports = { + completelyUnrelatedProperty: 'Just a very incorrect transport worker implementation' +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f255858de72751b25dfc1ad91cd85f1be60d2a01 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport/index.js @@ -0,0 +1,12 @@ +'use strict' + +const fs = require('node:fs') +const { once } = require('node:events') + +async function run (opts) { + const stream = fs.createWriteStream(opts.destination) + await once(stream, 'open') + return stream +} + +module.exports = run diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport/package.json new file mode 100644 index 0000000000000000000000000000000000000000..26beeaaeaaa4bde4c2ec0148a8e4e5793ae5712e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/transport/package.json @@ -0,0 +1,5 @@ +{ + "name": "transport", + "version": "0.0.1", + "main": "./index.js" +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa56b3df0f4b668d4a69144b3ed66bf43063ccf6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts @@ -0,0 +1,18 @@ +import * as fs from 'node:fs' +import { once } from 'node:events' +import { Transform } from 'node:stream' + +async function run (opts: { destination?: fs.PathLike }): Promise { + if (!opts.destination) throw new Error('kaboom') + const stream = fs.createWriteStream(opts.destination) + await once(stream, 'open') + const t = new Transform({ + transform (chunk, enc, cb) { + setImmediate(cb, null, chunk.toString().toUpperCase()) + } + }) + t.pipe(stream) + return t +} + +export default run diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/to-file-transport.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/to-file-transport.ts new file mode 100644 index 0000000000000000000000000000000000000000..18606062126285141c654ef3f9cfea4e609c30b9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/to-file-transport.ts @@ -0,0 +1,11 @@ +import * as fs from 'node:fs' +import { once } from 'node:events' + +async function run (opts: { destination?: fs.PathLike }): Promise { + if (!opts.destination) throw new Error('kaboom') + const stream = fs.createWriteStream(opts.destination, { encoding: 'utf8' }) + await once(stream, 'open') + return stream +} + +export default run diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transpile.cjs b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transpile.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6c2af6783e15dd769f7dc4a7cdab6d52af4bc56c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transpile.cjs @@ -0,0 +1,36 @@ +#!/usr/bin/env node + +const execa = require('execa') +const fs = require('node:fs') + +const existsSync = fs.existsSync +const stat = fs.promises.stat + +// Hardcoded parameters +const esVersions = ['es5', 'es6', 'es2017', 'esnext'] +const filesToTranspile = ['to-file-transport.ts'] + +async function transpile () { + process.chdir(__dirname) + + for (const sourceFileName of filesToTranspile) { + const sourceStat = await stat(sourceFileName) + + for (const esVersion of esVersions) { + const intermediateFileName = sourceFileName.replace(/\.ts$/, '.js') + const targetFileName = sourceFileName.replace(/\.ts$/, `.${esVersion}.cjs`) + + const shouldTranspile = !existsSync(targetFileName) || (await stat(targetFileName)).mtimeMs < sourceStat.mtimeMs + + if (shouldTranspile) { + await execa('tsc', ['--target', esVersion, '--module', 'commonjs', sourceFileName]) + await execa('mv', [intermediateFileName, targetFileName]) + } + } + } +} + +transpile().catch(err => { + process.exitCode = 1 + throw err +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3e6f2ebc34eb2ba5de777a138eb2aa0543ba929 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts @@ -0,0 +1,15 @@ +import pino from '../../..' +import { join } from 'node:path' + +const transport = pino.transport({ + target: join(__dirname, 'to-file-transport-with-transform.ts'), + options: { + destination: process.argv[2] + } +}) +const logger = pino(transport) + +logger.info('Hello') +logger.info('World') + +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts new file mode 100644 index 0000000000000000000000000000000000000000..21f2ab70374ec52e98480830c05d1d5225c87a17 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts @@ -0,0 +1,10 @@ +import pino from '../../..' + +const transport = pino.transport({ + target: 'pino/file' +}) +const logger = pino(transport) + +logger.info('Hello') + +process.exit(0) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts new file mode 100644 index 0000000000000000000000000000000000000000..a1f6a842bcc60f2be61883a1155da2540491447e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts @@ -0,0 +1,11 @@ +import pino from '../../..' + +const transport = pino.transport({ + target: 'pino/file' +}) +const logger = pino(transport) + +transport.on('ready', function () { + logger.info('Hello') + process.exit(0) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-main.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-main.ts new file mode 100644 index 0000000000000000000000000000000000000000..f31f88cdb7063bab4efacc47594eecc93b975a97 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-main.ts @@ -0,0 +1,8 @@ +import { join } from 'node:path' +import pino from '../../..' + +const transport = pino.transport({ + target: join(__dirname, 'transport-worker.ts') +}) +const logger = pino(transport) +logger.info('Hello') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c9cfa7d7a62cfecbcbb5b03ad2196d1ef75b253 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts @@ -0,0 +1,8 @@ +import pino from '../../..' + +const transport = pino.transport({ + target: 'pino/file', + options: { destination: '1' } +}) +const logger = pino(transport) +logger.info('Hello') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-worker.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-worker.ts new file mode 100644 index 0000000000000000000000000000000000000000..80612919466d54fc7e88812bbcfe4b7b199e981a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/fixtures/ts/transport-worker.ts @@ -0,0 +1,14 @@ +import { Writable } from 'node:stream' + +export default (): Writable => { + const myTransportStream = new Writable({ + autoDestroy: true, + write (chunk, _enc, cb) { + console.log(chunk.toString()) + cb() + }, + defaultEncoding: 'utf8' + }) + + return myTransportStream +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/formatters.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/formatters.test.js new file mode 100644 index 0000000000000000000000000000000000000000..77ae0efb7e4421c8077dcd80ce3a12b299e64983 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/formatters.test.js @@ -0,0 +1,355 @@ +'use strict' +/* eslint no-prototype-builtins: 0 */ + +const { hostname } = require('node:os') +const { join } = require('node:path') +const { readFile } = require('node:fs').promises +const { test } = require('tap') +const { sink, once, watchFileCreated, file } = require('./helper') +const pino = require('../') + +test('level formatter', async ({ match }) => { + const stream = sink() + const logger = pino({ + formatters: { + level (label, number) { + return { + log: { + level: label + } + } + } + } + }, stream) + + const o = once(stream, 'data') + logger.info('hello world') + match(await o, { + log: { + level: 'info' + } + }) +}) + +test('bindings formatter', async ({ match }) => { + const stream = sink() + const logger = pino({ + formatters: { + bindings (bindings) { + return { + process: { + pid: bindings.pid + }, + host: { + name: bindings.hostname + } + } + } + } + }, stream) + + const o = once(stream, 'data') + logger.info('hello world') + match(await o, { + process: { + pid: process.pid + }, + host: { + name: hostname() + } + }) +}) + +test('no bindings formatter', async ({ match, notOk }) => { + const stream = sink() + const logger = pino({ + formatters: { + bindings (bindings) { + return null + } + } + }, stream) + + const o = once(stream, 'data') + logger.info('hello world') + const log = await o + notOk(log.hasOwnProperty('pid')) + notOk(log.hasOwnProperty('hostname')) + match(log, { msg: 'hello world' }) +}) + +test('log formatter', async ({ match, equal }) => { + const stream = sink() + const logger = pino({ + formatters: { + log (obj) { + equal(obj.hasOwnProperty('msg'), false) + return { hello: 'world', ...obj } + } + } + }, stream) + + const o = once(stream, 'data') + logger.info({ foo: 'bar', nested: { object: true } }, 'hello world') + match(await o, { + hello: 'world', + foo: 'bar', + nested: { object: true } + }) +}) + +test('Formatters combined', async ({ match }) => { + const stream = sink() + const logger = pino({ + formatters: { + level (label, number) { + return { + log: { + level: label + } + } + }, + bindings (bindings) { + return { + process: { + pid: bindings.pid + }, + host: { + name: bindings.hostname + } + } + }, + log (obj) { + return { hello: 'world', ...obj } + } + } + }, stream) + + const o = once(stream, 'data') + logger.info({ foo: 'bar', nested: { object: true } }, 'hello world') + match(await o, { + log: { + level: 'info' + }, + process: { + pid: process.pid + }, + host: { + name: hostname() + }, + hello: 'world', + foo: 'bar', + nested: { object: true } + }) +}) + +test('Formatters in child logger', async ({ match }) => { + const stream = sink() + const logger = pino({ + formatters: { + level (label, number) { + return { + log: { + level: label + } + } + }, + bindings (bindings) { + return { + process: { + pid: bindings.pid + }, + host: { + name: bindings.hostname + } + } + }, + log (obj) { + return { hello: 'world', ...obj } + } + } + }, stream) + + const child = logger.child({ + foo: 'bar', + nested: { object: true } + }, { + formatters: { + bindings (bindings) { + return { ...bindings, faz: 'baz' } + } + } + }) + + const o = once(stream, 'data') + child.info('hello world') + match(await o, { + log: { + level: 'info' + }, + process: { + pid: process.pid + }, + host: { + name: hostname() + }, + hello: 'world', + foo: 'bar', + nested: { object: true }, + faz: 'baz' + }) +}) + +test('Formatters without bindings in child logger', async ({ match }) => { + const stream = sink() + const logger = pino({ + formatters: { + level (label, number) { + return { + log: { + level: label + } + } + }, + bindings (bindings) { + return { + process: { + pid: bindings.pid + }, + host: { + name: bindings.hostname + } + } + }, + log (obj) { + return { hello: 'world', ...obj } + } + } + }, stream) + + const child = logger.child({ + foo: 'bar', + nested: { object: true } + }, { + formatters: { + log (obj) { + return { other: 'stuff', ...obj } + } + } + }) + + const o = once(stream, 'data') + child.info('hello world') + match(await o, { + log: { + level: 'info' + }, + process: { + pid: process.pid + }, + host: { + name: hostname() + }, + foo: 'bar', + other: 'stuff', + nested: { object: true } + }) +}) + +test('elastic common schema format', async ({ match, type }) => { + const stream = sink() + const ecs = { + formatters: { + level (label, number) { + return { + log: { + level: label, + logger: 'pino' + } + } + }, + bindings (bindings) { + return { + process: { + pid: bindings.pid + }, + host: { + name: bindings.hostname + } + } + }, + log (obj) { + return { ecs: { version: '1.4.0' }, ...obj } + } + }, + messageKey: 'message', + timestamp: () => `,"@timestamp":"${new Date(Date.now()).toISOString()}"` + } + + const logger = pino({ ...ecs }, stream) + + const o = once(stream, 'data') + logger.info({ foo: 'bar' }, 'hello world') + const log = await o + type(log['@timestamp'], 'string') + match(log, { + log: { level: 'info', logger: 'pino' }, + process: { pid: process.pid }, + host: { name: hostname() }, + ecs: { version: '1.4.0' }, + foo: 'bar', + message: 'hello world' + }) +}) + +test('formatter with transport', async ({ match, equal }) => { + const destination = file() + const logger = pino({ + formatters: { + log (obj) { + equal(obj.hasOwnProperty('msg'), false) + return { hello: 'world', ...obj } + } + }, + transport: { + targets: [ + { + target: join(__dirname, 'fixtures', 'to-file-transport.js'), + options: { destination } + } + ] + } + }) + + logger.info({ foo: 'bar', nested: { object: true } }, 'hello world') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + match(result, { + hello: 'world', + foo: 'bar', + nested: { object: true } + }) +}) + +test('throws when custom level formatter is used with transport.targets', async ({ throws }) => { + throws(() => { + pino({ + formatters: { + level (label) { + return label + } + }, + transport: { + targets: [ + { + target: 'pino/file', + options: { destination: 'foo.log' } + } + ] + } + } + ) + }, + Error('option.transport.targets do not allow custom level formatters')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/helper.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/helper.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5798d044bce2b116a3855301246e95ad15719c47 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/helper.d.ts @@ -0,0 +1,4 @@ +import { PathLike } from 'node:fs' + +export declare function watchFileCreated(filename: PathLike): Promise +export declare function watchForWrite(filename: PathLike, testString: string): Promise diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/helper.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/helper.js new file mode 100644 index 0000000000000000000000000000000000000000..00803965f53783776c0972f6cb6a8e8a1efe6052 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/helper.js @@ -0,0 +1,128 @@ +'use strict' + +const crypto = require('crypto') +const os = require('node:os') +const writer = require('flush-write-stream') +const split = require('split2') +const { existsSync, readFileSync, statSync, unlinkSync } = require('node:fs') +const pid = process.pid +const hostname = os.hostname() +const t = require('tap') +const { join } = require('node:path') +const { tmpdir } = os + +const isWin = process.platform === 'win32' +const isYarnPnp = process.versions.pnp !== undefined + +function getPathToNull () { + return isWin ? '\\\\.\\NUL' : '/dev/null' +} + +function once (emitter, name) { + return new Promise((resolve, reject) => { + if (name !== 'error') emitter.once('error', reject) + emitter.once(name, (...args) => { + emitter.removeListener('error', reject) + resolve(...args) + }) + }) +} + +function sink (func) { + const result = split((data) => { + try { + return JSON.parse(data) + } catch (err) { + console.log(err) + console.log(data) + } + }) + if (func) result.pipe(writer.obj(func)) + return result +} + +function check (is, chunk, level, msg) { + is(new Date(chunk.time) <= new Date(), true, 'time is greater than Date.now()') + delete chunk.time + is(chunk.pid, pid) + is(chunk.hostname, hostname) + is(chunk.level, level) + is(chunk.msg, msg) +} + +function sleep (ms) { + return new Promise((resolve) => { + setTimeout(resolve, ms) + }) +} + +function watchFileCreated (filename) { + return new Promise((resolve, reject) => { + const TIMEOUT = process.env.PINO_TEST_WAIT_WATCHFILE_TIMEOUT || 10000 + const INTERVAL = 100 + const threshold = TIMEOUT / INTERVAL + let counter = 0 + const interval = setInterval(() => { + const exists = existsSync(filename) + // On some CI runs file is created but not filled + if (exists && statSync(filename).size !== 0) { + clearInterval(interval) + resolve() + } else if (counter <= threshold) { + counter++ + } else { + clearInterval(interval) + reject(new Error( + `${filename} hasn't been created within ${TIMEOUT} ms. ` + + (exists ? 'File exist, but still empty.' : 'File not yet created.') + )) + } + }, INTERVAL) + }) +} + +function watchForWrite (filename, testString) { + return new Promise((resolve, reject) => { + const TIMEOUT = process.env.PINO_TEST_WAIT_WRITE_TIMEOUT || 10000 + const INTERVAL = 100 + const threshold = TIMEOUT / INTERVAL + let counter = 0 + const interval = setInterval(() => { + if (readFileSync(filename).includes(testString)) { + clearInterval(interval) + resolve() + } else if (counter <= threshold) { + counter++ + } else { + clearInterval(interval) + reject(new Error(`'${testString}' hasn't been written to ${filename} within ${TIMEOUT} ms.`)) + } + }, INTERVAL) + }) +} + +let files = [] + +function file () { + const hash = crypto.randomBytes(12).toString('hex') + const file = join(tmpdir(), `pino-${pid}-${hash}`) + files.push(file) + return file +} + +process.on('beforeExit', () => { + if (files.length === 0) return + t.comment('unlink files') + for (const file of files) { + try { + t.comment(`unliking ${file}`) + unlinkSync(file) + } catch (e) { + console.log(e) + } + } + files = [] + t.comment('unlink completed') +}) + +module.exports = { getPathToNull, sink, check, once, sleep, watchFileCreated, watchForWrite, isWin, isYarnPnp, file } diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/hooks.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/hooks.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5ed89057f293bb6e31a7b96d38bfe5a4f184f145 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/hooks.test.js @@ -0,0 +1,118 @@ +'use strict' + +const tap = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +tap.test('log method hook', t => { + t.test('gets invoked', async t => { + t.plan(8) + + const stream = sink() + const logger = pino({ + hooks: { + logMethod (args, method, level) { + t.type(args, Array) + t.type(level, 'number') + t.equal(args.length, 3) + t.equal(level, this.levels.values.info) + t.same(args, ['a', 'b', 'c']) + + t.type(method, Function) + t.equal(method.name, 'LOG') + + method.apply(this, [args.join('-')]) + } + } + }, stream) + + const o = once(stream, 'data') + logger.info('a', 'b', 'c') + t.match(await o, { msg: 'a-b-c' }) + }) + + t.test('fatal method invokes hook', async t => { + t.plan(2) + + const stream = sink() + const logger = pino({ + hooks: { + logMethod (args, method) { + t.pass() + method.apply(this, [args.join('-')]) + } + } + }, stream) + + const o = once(stream, 'data') + logger.fatal('a') + t.match(await o, { msg: 'a' }) + }) + + t.test('children get the hook', async t => { + t.plan(4) + + const stream = sink() + const root = pino({ + hooks: { + logMethod (args, method) { + t.pass() + method.apply(this, [args.join('-')]) + } + } + }, stream) + const child = root.child({ child: 'one' }) + const grandchild = child.child({ child: 'two' }) + + let o = once(stream, 'data') + child.info('a', 'b') + t.match(await o, { msg: 'a-b' }) + + o = once(stream, 'data') + grandchild.info('c', 'd') + t.match(await o, { msg: 'c-d' }) + }) + + t.test('get log level', async t => { + t.plan(3) + + const stream = sink() + const logger = pino({ + hooks: { + logMethod (args, method, level) { + t.type(level, 'number') + t.equal(level, this.levels.values.error) + + method.apply(this, [args.join('-')]) + } + } + }, stream) + + const o = once(stream, 'data') + logger.error('a') + t.match(await o, { msg: 'a' }) + }) + + t.end() +}) + +tap.test('streamWrite hook', t => { + t.test('gets invoked', async t => { + t.plan(1) + + const stream = sink() + const logger = pino({ + hooks: { + streamWrite (s) { + return s.replaceAll('redact-me', 'XXX') + } + } + }, stream) + + const o = once(stream, 'data') + logger.info('hide redact-me in this string') + t.match(await o, { msg: 'hide XXX in this string' }) + }) + + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/http.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/http.test.js new file mode 100644 index 0000000000000000000000000000000000000000..650868ffe25a9a42879e0b8efc71913a85c0bb0b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/http.test.js @@ -0,0 +1,242 @@ +'use strict' + +const http = require('http') +const os = require('node:os') +const semver = require('semver') +const { test, skip } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() + +test('http request support', async ({ ok, same, error, teardown }) => { + let originalReq + const instance = pino(sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid, + hostname, + level: 30, + msg: 'my request', + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers, + remoteAddress: originalReq.socket.remoteAddress, + remotePort: originalReq.socket.remotePort + } + }) + })) + + const server = http.createServer((req, res) => { + originalReq = req + instance.info(req, 'my request') + res.end('hello') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http request support via serializer', async ({ ok, same, error, teardown }) => { + let originalReq + const instance = pino({ + serializers: { + req: pino.stdSerializers.req + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid, + hostname, + level: 30, + msg: 'my request', + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers, + remoteAddress: originalReq.socket.remoteAddress, + remotePort: originalReq.socket.remotePort + } + }) + })) + + const server = http.createServer(function (req, res) { + originalReq = req + instance.info({ req }, 'my request') + res.end('hello') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +// skipped because request connection is deprecated since v13, and request socket is always available +skip('http request support via serializer without request connection', async ({ ok, same, error, teardown }) => { + let originalReq + const instance = pino({ + serializers: { + req: pino.stdSerializers.req + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + const expected = { + pid, + hostname, + level: 30, + msg: 'my request', + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers + } + } + if (semver.gte(process.version, '13.0.0')) { + expected.req.remoteAddress = originalReq.socket.remoteAddress + expected.req.remotePort = originalReq.socket.remotePort + } + same(chunk, expected) + })) + + const server = http.createServer(function (req, res) { + originalReq = req + delete req.connection + instance.info({ req }, 'my request') + res.end('hello') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http response support', async ({ ok, same, error, teardown }) => { + let originalRes + const instance = pino(sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid, + hostname, + level: 30, + msg: 'my response', + res: { + statusCode: originalRes.statusCode, + headers: originalRes.getHeaders() + } + }) + })) + + const server = http.createServer(function (req, res) { + originalRes = res + res.end('hello') + instance.info(res, 'my response') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http response support via a serializer', async ({ ok, same, error, teardown }) => { + const instance = pino({ + serializers: { + res: pino.stdSerializers.res + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid, + hostname, + level: 30, + msg: 'my response', + res: { + statusCode: 200, + headers: { + 'x-single': 'y', + 'x-multi': [1, 2] + } + } + }) + })) + + const server = http.createServer(function (req, res) { + res.setHeader('x-single', 'y') + res.setHeader('x-multi', [1, 2]) + res.end('hello') + instance.info({ res }, 'my response') + }) + + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http request support via serializer in a child', async ({ ok, same, error, teardown }) => { + let originalReq + const instance = pino({ + serializers: { + req: pino.stdSerializers.req + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid, + hostname, + level: 30, + msg: 'my request', + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers, + remoteAddress: originalReq.socket.remoteAddress, + remotePort: originalReq.socket.remotePort + } + }) + })) + + const server = http.createServer(function (req, res) { + originalReq = req + const child = instance.child({ req }) + child.info('my request') + res.end('hello') + }) + + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/internals/version.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/internals/version.test.js new file mode 100644 index 0000000000000000000000000000000000000000..85288916a0c52132017986eab008d160781bfae8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/internals/version.test.js @@ -0,0 +1,15 @@ +'use strict' + +const fs = require('node:fs') +const path = require('node:path') +const t = require('tap') +const test = t.test +const pino = require('../..')() + +test('should be the same as package.json', t => { + t.plan(1) + + const json = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json')).toString('utf8')) + + t.equal(pino.version, json.version) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/is-level-enabled.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/is-level-enabled.test.js new file mode 100644 index 0000000000000000000000000000000000000000..29c2bab605856640231557dba826e7810a1b92db --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/is-level-enabled.test.js @@ -0,0 +1,185 @@ +'use strict' + +const { test } = require('tap') +const pino = require('../') + +const descLevels = { + trace: 60, + debug: 50, + info: 40, + warn: 30, + error: 20, + fatal: 10 +} + +const ascLevels = { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60 +} + +test('Default levels suite', ({ test, end }) => { + test('can check if current level enabled', async ({ equal }) => { + const log = pino({ level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if level enabled after level set', async ({ equal }) => { + const log = pino() + equal(false, log.isLevelEnabled('debug')) + log.level = 'debug' + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if higher level enabled', async ({ equal }) => { + const log = pino({ level: 'debug' }) + equal(true, log.isLevelEnabled('error')) + }) + + test('can check if lower level is disabled', async ({ equal }) => { + const log = pino({ level: 'error' }) + equal(false, log.isLevelEnabled('trace')) + }) + + test('ASC: can check if child has current level enabled', async ({ equal }) => { + const log = pino().child({}, { level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if custom level is enabled', async ({ equal }) => { + const log = pino({ + customLevels: { foo: 35 }, + level: 'debug' + }) + equal(true, log.isLevelEnabled('foo')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + end() +}) + +test('Ascending levels suite', ({ test, end }) => { + const customLevels = ascLevels + const levelComparison = 'ASC' + + test('can check if current level enabled', async ({ equal }) => { + const log = pino({ level: 'debug', levelComparison, customLevels, useOnlyCustomLevels: true }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if level enabled after level set', async ({ equal }) => { + const log = pino({ levelComparison, customLevels, useOnlyCustomLevels: true }) + equal(false, log.isLevelEnabled('debug')) + log.level = 'debug' + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if higher level enabled', async ({ equal }) => { + const log = pino({ level: 'debug', levelComparison, customLevels, useOnlyCustomLevels: true }) + equal(true, log.isLevelEnabled('error')) + }) + + test('can check if lower level is disabled', async ({ equal }) => { + const log = pino({ level: 'error', customLevels, useOnlyCustomLevels: true }) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if child has current level enabled', async ({ equal }) => { + const log = pino().child({ levelComparison, customLevels, useOnlyCustomLevels: true }, { level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if custom level is enabled', async ({ equal }) => { + const log = pino({ + levelComparison, + useOnlyCustomLevels: true, + customLevels: { foo: 35, ...customLevels }, + level: 'debug' + }) + equal(true, log.isLevelEnabled('foo')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + end() +}) + +test('Descending levels suite', ({ test, end }) => { + const customLevels = descLevels + const levelComparison = 'DESC' + + test('can check if current level enabled', async ({ equal }) => { + const log = pino({ level: 'debug', levelComparison, customLevels, useOnlyCustomLevels: true }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if level enabled after level set', async ({ equal }) => { + const log = pino({ levelComparison, customLevels, useOnlyCustomLevels: true }) + equal(false, log.isLevelEnabled('debug')) + log.level = 'debug' + equal(true, log.isLevelEnabled('debug')) + }) + + test('can check if higher level enabled', async ({ equal }) => { + const log = pino({ level: 'debug', levelComparison, customLevels, useOnlyCustomLevels: true }) + equal(true, log.isLevelEnabled('error')) + }) + + test('can check if lower level is disabled', async ({ equal }) => { + const log = pino({ level: 'error', levelComparison, customLevels, useOnlyCustomLevels: true }) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if child has current level enabled', async ({ equal }) => { + const log = pino({ levelComparison, customLevels, useOnlyCustomLevels: true }).child({}, { level: 'debug' }) + equal(true, log.isLevelEnabled('debug')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + test('can check if custom level is enabled', async ({ equal }) => { + const log = pino({ + levelComparison, + customLevels: { foo: 35, ...customLevels }, + useOnlyCustomLevels: true, + level: 'debug' + }) + equal(true, log.isLevelEnabled('foo')) + equal(true, log.isLevelEnabled('error')) + equal(false, log.isLevelEnabled('trace')) + }) + + end() +}) + +test('Custom levels comparison', async ({ test, end }) => { + test('Custom comparison returns true cause level is enabled', async ({ equal }) => { + const log = pino({ level: 'error', levelComparison: () => true }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('Custom comparison returns false cause level is disabled', async ({ equal }) => { + const log = pino({ level: 'error', levelComparison: () => false }) + equal(false, log.isLevelEnabled('debug')) + }) + + test('Custom comparison returns true cause child level is enabled', async ({ equal }) => { + const log = pino({ levelComparison: () => true }).child({ level: 'error' }) + equal(true, log.isLevelEnabled('debug')) + }) + + test('Custom comparison returns false cause child level is disabled', async ({ equal }) => { + const log = pino({ levelComparison: () => false }).child({ level: 'error' }) + equal(false, log.isLevelEnabled('debug')) + }) + + end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/jest/basic.spec.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/jest/basic.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..46f381b2e7021602eac98b3ed86fdcae573bfcd1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/jest/basic.spec.js @@ -0,0 +1,10 @@ +/* global test */ +const pino = require('../../pino') + +test('transport should work in jest', function () { + pino({ + transport: { + target: 'pino-pretty' + } + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/levels.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/levels.test.js new file mode 100644 index 0000000000000000000000000000000000000000..cdf650c35440206d49669ed499833dc92694926c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/levels.test.js @@ -0,0 +1,772 @@ +'use strict' + +const { test } = require('tap') +const { sink, once, check } = require('./helper') +const pino = require('../') + +const levelsLib = require('../lib/levels') + +// Silence all warnings for this test +process.removeAllListeners('warning') +process.on('warning', () => {}) + +test('set the level by string', async ({ equal }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const stream = sink() + const instance = pino(stream) + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + const result = await once(stream, 'data') + const current = expected.shift() + check(equal, result, current.level, current.msg) +}) + +test('the wrong level throws', async ({ throws }) => { + const instance = pino() + throws(() => { + instance.level = 'kaboom' + }) +}) + +test('set the level by number', async ({ equal }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const stream = sink() + const instance = pino(stream) + + instance.level = 50 + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + const result = await once(stream, 'data') + const current = expected.shift() + check(equal, result, current.level, current.msg) +}) + +test('exposes level string mappings', async ({ equal }) => { + equal(pino.levels.values.error, 50) +}) + +test('exposes level number mappings', async ({ equal }) => { + equal(pino.levels.labels[50], 'error') +}) + +test('returns level integer', async ({ equal }) => { + const instance = pino({ level: 'error' }) + equal(instance.levelVal, 50) +}) + +test('child returns level integer', async ({ equal }) => { + const parent = pino({ level: 'error' }) + const child = parent.child({ foo: 'bar' }) + equal(child.levelVal, 50) +}) + +test('set the level via exported pino function', async ({ equal }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const stream = sink() + const instance = pino({ level: 'error' }, stream) + + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + const result = await once(stream, 'data') + const current = expected.shift() + check(equal, result, current.level, current.msg) +}) + +test('level-change event', async ({ equal }) => { + const instance = pino() + function handle (lvl, val, prevLvl, prevVal, logger) { + equal(lvl, 'trace') + equal(val, 10) + equal(prevLvl, 'info') + equal(prevVal, 30) + equal(logger, instance) + } + instance.on('level-change', handle) + instance.level = 'trace' + instance.removeListener('level-change', handle) + instance.level = 'info' + + let count = 0 + + const l1 = () => count++ + const l2 = () => count++ + const l3 = () => count++ + instance.on('level-change', l1) + instance.on('level-change', l2) + instance.on('level-change', l3) + + instance.level = 'trace' + instance.removeListener('level-change', l3) + instance.level = 'fatal' + instance.removeListener('level-change', l1) + instance.level = 'debug' + instance.removeListener('level-change', l2) + instance.level = 'info' + + equal(count, 6) + + instance.once('level-change', (lvl, val, prevLvl, prevVal, logger) => equal(logger, instance)) + instance.level = 'info' + const child = instance.child({}) + instance.once('level-change', (lvl, val, prevLvl, prevVal, logger) => equal(logger, child)) + child.level = 'trace' +}) + +test('enable', async ({ fail }) => { + const instance = pino({ + level: 'trace', + enabled: false + }, sink((result, enc) => { + fail('no data should be logged') + })) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) +}) + +test('silent level', async ({ fail }) => { + const instance = pino({ + level: 'silent' + }, sink((result, enc) => { + fail('no data should be logged') + })) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) +}) + +test('set silent via Infinity', async ({ fail }) => { + const instance = pino({ + level: Infinity + }, sink((result, enc) => { + fail('no data should be logged') + })) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) +}) + +test('exposed levels', async ({ same }) => { + same(Object.keys(pino.levels.values), [ + 'trace', + 'debug', + 'info', + 'warn', + 'error', + 'fatal' + ]) +}) + +test('exposed labels', async ({ same }) => { + same(Object.keys(pino.levels.labels), [ + '10', + '20', + '30', + '40', + '50', + '60' + ]) +}) + +test('setting level in child', async ({ equal }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const instance = pino(sink((result, enc, cb) => { + const current = expected.shift() + check(equal, result, current.level, current.msg) + cb() + })).child({ level: 30 }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') +}) + +test('setting level by assigning a number to level', async ({ equal }) => { + const instance = pino() + equal(instance.levelVal, 30) + equal(instance.level, 'info') + instance.level = 50 + equal(instance.levelVal, 50) + equal(instance.level, 'error') +}) + +test('setting level by number to unknown value results in a throw', async ({ throws }) => { + const instance = pino() + throws(() => { instance.level = 973 }) +}) + +test('setting level by assigning a known label to level', async ({ equal }) => { + const instance = pino() + equal(instance.levelVal, 30) + equal(instance.level, 'info') + instance.level = 'error' + equal(instance.levelVal, 50) + equal(instance.level, 'error') +}) + +test('levelVal is read only', async ({ throws }) => { + const instance = pino() + throws(() => { instance.levelVal = 20 }) +}) + +test('produces labels when told to', async ({ equal }) => { + const expected = [{ + level: 'info', + msg: 'hello world' + }] + const instance = pino({ + formatters: { + level (label, number) { + return { level: label } + } + } + }, sink((result, enc, cb) => { + const current = expected.shift() + check(equal, result, current.level, current.msg) + cb() + })) + + instance.info('hello world') +}) + +test('resets levels from labels to numbers', async ({ equal }) => { + const expected = [{ + level: 30, + msg: 'hello world' + }] + pino({ useLevelLabels: true }) + const instance = pino({ useLevelLabels: false }, sink((result, enc, cb) => { + const current = expected.shift() + check(equal, result, current.level, current.msg) + cb() + })) + + instance.info('hello world') +}) + +test('changes label naming when told to', async ({ equal }) => { + const expected = [{ + priority: 30, + msg: 'hello world' + }] + const instance = pino({ + formatters: { + level (label, number) { + return { priority: number } + } + } + }, sink((result, enc, cb) => { + const current = expected.shift() + equal(result.priority, current.priority) + equal(result.msg, current.msg) + cb() + })) + + instance.info('hello world') +}) + +test('children produce labels when told to', async ({ equal }) => { + const expected = [ + { + level: 'info', + msg: 'child 1' + }, + { + level: 'info', + msg: 'child 2' + } + ] + const instance = pino({ + formatters: { + level (label, number) { + return { level: label } + } + } + }, sink((result, enc, cb) => { + const current = expected.shift() + check(equal, result, current.level, current.msg) + cb() + })) + + const child1 = instance.child({ name: 'child1' }) + const child2 = child1.child({ name: 'child2' }) + + child1.info('child 1') + child2.info('child 2') +}) + +test('produces labels for custom levels', async ({ equal }) => { + const expected = [ + { + level: 'info', + msg: 'hello world' + }, + { + level: 'foo', + msg: 'foobar' + } + ] + const opts = { + formatters: { + level (label, number) { + return { level: label } + } + }, + customLevels: { + foo: 35 + } + } + const instance = pino(opts, sink((result, enc, cb) => { + const current = expected.shift() + check(equal, result, current.level, current.msg) + cb() + })) + + instance.info('hello world') + instance.foo('foobar') +}) + +test('setting levelKey does not affect labels when told to', async ({ equal }) => { + const instance = pino( + { + formatters: { + level (label, number) { + return { priority: label } + } + } + }, + sink((result, enc, cb) => { + equal(result.priority, 'info') + cb() + }) + ) + + instance.info('hello world') +}) + +test('throws when creating a default label that does not exist in logger levels', async ({ throws }) => { + const defaultLevel = 'foo' + throws(() => { + pino({ + customLevels: { + bar: 5 + }, + level: defaultLevel + }) + }, `default level:${defaultLevel} must be included in custom levels`) +}) + +test('throws when creating a default value that does not exist in logger levels', async ({ throws }) => { + const defaultLevel = 15 + throws(() => { + pino({ + customLevels: { + bar: 5 + }, + level: defaultLevel + }) + }, `default level:${defaultLevel} must be included in custom levels`) +}) + +test('throws when creating a default value that does not exist in logger levels', async ({ equal, throws }) => { + throws(() => { + pino({ + customLevels: { + foo: 5 + }, + useOnlyCustomLevels: true + }) + }, 'default level:info must be included in custom levels') +}) + +test('passes when creating a default value that exists in logger levels', async ({ equal, throws }) => { + pino({ + level: 30 + }) +}) + +test('log null value when message is null', async ({ equal }) => { + const expected = { + msg: null, + level: 30 + } + + const stream = sink() + const instance = pino(stream) + instance.level = 'info' + instance.info(null) + + const result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) +}) + +test('formats when base param is null', async ({ equal }) => { + const expected = { + msg: 'a string', + level: 30 + } + + const stream = sink() + const instance = pino(stream) + instance.level = 'info' + instance.info(null, 'a %s', 'string') + + const result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) +}) + +test('fatal method sync-flushes the destination if sync flushing is available', async ({ pass, doesNotThrow, plan }) => { + plan(2) + const stream = sink() + stream.flushSync = () => { + pass('destination flushed') + } + const instance = pino(stream) + instance.fatal('this is fatal') + await once(stream, 'data') + doesNotThrow(() => { + stream.flushSync = undefined + instance.fatal('this is fatal') + }) +}) + +test('fatal method should call async when sync-flushing fails', ({ equal, fail, doesNotThrow, plan }) => { + plan(2) + const messages = [ + 'this is fatal 1' + ] + const stream = sink((result) => equal(result.msg, messages.shift())) + stream.flushSync = () => { throw new Error('Error') } + stream.flush = () => fail('flush should be called') + + const instance = pino(stream) + doesNotThrow(() => instance.fatal(messages[0])) +}) + +test('calling silent method on logger instance', async ({ fail }) => { + const instance = pino({ level: 'silent' }, sink((result, enc) => { + fail('no data should be logged') + })) + instance.silent('hello world') +}) + +test('calling silent method on child logger', async ({ fail }) => { + const child = pino({ level: 'silent' }, sink((result, enc) => { + fail('no data should be logged') + })).child({}) + child.silent('hello world') +}) + +test('changing level from info to silent and back to info', async ({ equal }) => { + const expected = { + level: 30, + msg: 'hello world' + } + const stream = sink() + const instance = pino({ level: 'info' }, stream) + + instance.level = 'silent' + instance.info('hello world') + let result = stream.read() + equal(result, null) + + instance.level = 'info' + instance.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) +}) + +test('changing level from info to silent and back to info in child logger', async ({ equal }) => { + const expected = { + level: 30, + msg: 'hello world' + } + const stream = sink() + const child = pino({ level: 'info' }, stream).child({}) + + child.level = 'silent' + child.info('hello world') + let result = stream.read() + equal(result, null) + + child.level = 'info' + child.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) +}) + +test('changing level respects level comparison set to', async ({ test, end }) => { + const ascLevels = { + debug: 1, + info: 2, + warn: 3 + } + + const descLevels = { + debug: 3, + info: 2, + warn: 1 + } + + const expected = { + level: 2, + msg: 'hello world' + } + + test('ASC in parent logger', async ({ equal }) => { + const customLevels = ascLevels + const levelComparison = 'ASC' + + const stream = sink() + const logger = pino({ levelComparison, customLevels, useOnlyCustomLevels: true, level: 'info' }, stream) + + logger.level = 'warn' + logger.info('hello world') + let result = stream.read() + equal(result, null) + + logger.level = 'debug' + logger.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) + }) + + test('DESC in parent logger', async ({ equal }) => { + const customLevels = descLevels + const levelComparison = 'DESC' + + const stream = sink() + const logger = pino({ levelComparison, customLevels, useOnlyCustomLevels: true, level: 'info' }, stream) + + logger.level = 'warn' + logger.info('hello world') + let result = stream.read() + equal(result, null) + + logger.level = 'debug' + logger.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) + }) + + test('custom function in parent logger', async ({ equal }) => { + const customLevels = { + info: 2, + debug: 345, + warn: 789 + } + const levelComparison = (current, expected) => { + if (expected === customLevels.warn) return false + return true + } + + const stream = sink() + const logger = pino({ levelComparison, customLevels, useOnlyCustomLevels: true, level: 'info' }, stream) + + logger.level = 'warn' + logger.info('hello world') + let result = stream.read() + equal(result, null) + + logger.level = 'debug' + logger.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) + }) + + test('ASC in child logger', async ({ equal }) => { + const customLevels = ascLevels + const levelComparison = 'ASC' + + const stream = sink() + const logger = pino({ levelComparison, customLevels, useOnlyCustomLevels: true, level: 'info' }, stream).child({ }) + + logger.level = 'warn' + logger.info('hello world') + let result = stream.read() + equal(result, null) + + logger.level = 'debug' + logger.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) + }) + + test('DESC in parent logger', async ({ equal }) => { + const customLevels = descLevels + const levelComparison = 'DESC' + + const stream = sink() + const logger = pino({ levelComparison, customLevels, useOnlyCustomLevels: true, level: 'info' }, stream).child({ }) + + logger.level = 'warn' + logger.info('hello world') + let result = stream.read() + equal(result, null) + + logger.level = 'debug' + logger.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) + }) + + test('custom function in child logger', async ({ equal }) => { + const customLevels = { + info: 2, + debug: 345, + warn: 789 + } + const levelComparison = (current, expected) => { + if (expected === customLevels.warn) return false + return true + } + + const stream = sink() + const logger = pino({ levelComparison, customLevels, useOnlyCustomLevels: true, level: 'info' }, stream).child({ }) + + logger.level = 'warn' + logger.info('hello world') + let result = stream.read() + equal(result, null) + + logger.level = 'debug' + logger.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) + }) + + end() +}) + +test('changing level respects level comparison DESC', async ({ equal }) => { + const customLevels = { + warn: 1, + info: 2, + debug: 3 + } + + const levelComparison = 'DESC' + + const expected = { + level: 2, + msg: 'hello world' + } + + const stream = sink() + const logger = pino({ levelComparison, customLevels, useOnlyCustomLevels: true, level: 'info' }, stream) + + logger.level = 'warn' + logger.info('hello world') + let result = stream.read() + equal(result, null) + + logger.level = 'debug' + logger.info('hello world') + result = await once(stream, 'data') + check(equal, result, expected.level, expected.msg) +}) + +// testing for potential loss of Pino constructor scope from serializers - an edge case with circular refs see: https://github.com/pinojs/pino/issues/833 +test('trying to get levels when `this` is no longer a Pino instance returns an empty string', async ({ equal }) => { + const notPinoInstance = { some: 'object', getLevel: levelsLib.getLevel } + const blankedLevelValue = notPinoInstance.getLevel() + equal(blankedLevelValue, '') +}) + +test('accepts capital letter for INFO level', async ({ equal }) => { + const stream = sink() + const logger = pino({ + level: 'INFO' + }, stream) + + logger.info('test') + const { level } = await once(stream, 'data') + equal(level, 30) +}) + +test('accepts capital letter for FATAL level', async ({ equal }) => { + const stream = sink() + const logger = pino({ + level: 'FATAL' + }, stream) + + logger.fatal('test') + const { level } = await once(stream, 'data') + equal(level, 60) +}) + +test('accepts capital letter for ERROR level', async ({ equal }) => { + const stream = sink() + const logger = pino({ + level: 'ERROR' + }, stream) + + logger.error('test') + const { level } = await once(stream, 'data') + equal(level, 50) +}) + +test('accepts capital letter for WARN level', async ({ equal }) => { + const stream = sink() + const logger = pino({ + level: 'WARN' + }, stream) + + logger.warn('test') + const { level } = await once(stream, 'data') + equal(level, 40) +}) + +test('accepts capital letter for DEBUG level', async ({ equal }) => { + const stream = sink() + const logger = pino({ + level: 'DEBUG' + }, stream) + + logger.debug('test') + const { level } = await once(stream, 'data') + equal(level, 20) +}) + +test('accepts capital letter for TRACE level', async ({ equal }) => { + const stream = sink() + const logger = pino({ + level: 'TRACE' + }, stream) + + logger.trace('test') + const { level } = await once(stream, 'data') + equal(level, 10) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/metadata.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/metadata.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5ecb984babfd7837cb3c448874b69e96168de2ca --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/metadata.test.js @@ -0,0 +1,106 @@ +'use strict' + +const os = require('node:os') +const { test } = require('tap') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() + +test('metadata works', async ({ ok, same, equal }) => { + const now = Date.now() + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + equal(instance, this.lastLogger) + equal(30, this.lastLevel) + equal('a msg', this.lastMsg) + ok(Number(this.lastTime) >= now) + same(this.lastObj, { hello: 'world' }) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 30, + hello: 'world', + msg: 'a msg' + }) + } + }) + + instance.info({ hello: 'world' }, 'a msg') +}) + +test('child loggers works', async ({ ok, same, equal }) => { + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + equal(child, this.lastLogger) + equal(30, this.lastLevel) + equal('a msg', this.lastMsg) + same(this.lastObj, { from: 'child' }) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 30, + hello: 'world', + from: 'child', + msg: 'a msg' + }) + } + }) + + const child = instance.child({ hello: 'world' }) + child.info({ from: 'child' }, 'a msg') +}) + +test('without object', async ({ ok, same, equal }) => { + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + equal(instance, this.lastLogger) + equal(30, this.lastLevel) + equal('a msg', this.lastMsg) + same({ }, this.lastObj) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'a msg' + }) + } + }) + + instance.info('a msg') +}) + +test('without msg', async ({ ok, same, equal }) => { + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + equal(instance, this.lastLogger) + equal(30, this.lastLevel) + equal(undefined, this.lastMsg) + same({ hello: 'world' }, this.lastObj) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level: 30, + hello: 'world' + }) + } + }) + + instance.info({ hello: 'world' }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/mixin-merge-strategy.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/mixin-merge-strategy.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3c6dfe45d380ddbbbcf4367751a555c35c829f96 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/mixin-merge-strategy.test.js @@ -0,0 +1,55 @@ +'use strict' + +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const level = 50 +const name = 'error' + +test('default merge strategy', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + base: {}, + mixin () { + return { tag: 'k8s' } + } + }, stream) + instance.level = name + instance[name]({ + tag: 'local' + }, 'test') + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + level, + msg: 'test', + tag: 'local' + }) +}) + +test('custom merge strategy with mixin priority', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + base: {}, + mixin () { + return { tag: 'k8s' } + }, + mixinMergeStrategy (mergeObject, mixinObject) { + return Object.assign(mergeObject, mixinObject) + } + }, stream) + instance.level = name + instance[name]({ + tag: 'local' + }, 'test') + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + level, + msg: 'test', + tag: 'k8s' + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/mixin.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/mixin.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b40b3cd2ac15b4964faeab8a05151470cf716b0a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/mixin.test.js @@ -0,0 +1,218 @@ +'use strict' + +const os = require('node:os') +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() +const level = 50 +const name = 'error' + +test('mixin object is included', async ({ ok, same }) => { + let n = 0 + const stream = sink() + const instance = pino({ + mixin () { + return { hello: ++n } + } + }, stream) + instance.level = name + instance[name]('test') + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg: 'test', + hello: 1 + }) +}) + +test('mixin object is new every time', async ({ plan, ok, same }) => { + plan(6) + + let n = 0 + const stream = sink() + const instance = pino({ + mixin () { + return { hello: n } + } + }, stream) + instance.level = name + + while (++n < 4) { + const msg = `test #${n}` + stream.pause() + instance[name](msg) + stream.resume() + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg, + hello: n + }) + } +}) + +test('mixin object is not called if below log level', async ({ ok }) => { + const stream = sink() + const instance = pino({ + mixin () { + ok(false, 'should not call mixin function') + } + }, stream) + instance.level = 'error' + instance.info('test') +}) + +test('mixin object + logged object', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + mixin () { + return { foo: 1, bar: 2 } + } + }, stream) + instance.level = name + instance[name]({ bar: 3, baz: 4 }) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + foo: 1, + bar: 3, + baz: 4 + }) +}) + +test('mixin not a function', async ({ throws }) => { + const stream = sink() + throws(function () { + pino({ mixin: 'not a function' }, stream) + }) +}) + +test('mixin can use context', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + mixin (context) { + ok(context !== null, 'context should be defined') + ok(context !== undefined, 'context should be defined') + same(context, { + message: '123', + stack: 'stack' + }) + return Object.assign({ + error: context.message, + stack: context.stack + }) + } + }, stream) + instance.level = name + instance[name]({ + message: '123', + stack: 'stack' + }, 'test') +}) + +test('mixin works without context', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + mixin (context) { + ok(context !== null, 'context is still defined w/o passing mergeObject') + ok(context !== undefined, 'context is still defined w/o passing mergeObject') + same(context, {}) + return { + something: true + } + } + }, stream) + instance.level = name + instance[name]('test') +}) + +test('mixin can use level number', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + mixin (context, num) { + ok(num !== null, 'level should be defined') + ok(num !== undefined, 'level should be defined') + same(num, level) + return Object.assign({ + error: context.message, + stack: context.stack + }) + } + }, stream) + instance.level = name + instance[name]({ + message: '123', + stack: 'stack' + }, 'test') +}) + +test('mixin receives logger as third parameter', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + mixin (context, num, logger) { + ok(logger !== null, 'logger should be defined') + ok(logger !== undefined, 'logger should be defined') + same(logger, instance) + return { ...context, num } + } + }, stream) + instance.level = name + instance[name]({ + message: '123' + }, 'test') +}) + +test('mixin receives child logger', async ({ ok, same }) => { + const stream = sink() + let child = null + const instance = pino({ + mixin (context, num, logger) { + ok(logger !== null, 'logger should be defined') + ok(logger !== undefined, 'logger should be defined') + same(logger.expected, child.expected) + return { ...context, num } + } + }, stream) + instance.level = name + instance.expected = false + child = instance.child({}) + child.expected = true + child[name]({ + message: '123' + }, 'test') +}) + +test('mixin receives logger even if child exists', async ({ ok, same }) => { + const stream = sink() + let child = null + const instance = pino({ + mixin (context, num, logger) { + ok(logger !== null, 'logger should be defined') + ok(logger !== undefined, 'logger should be defined') + same(logger.expected, instance.expected) + return { ...context, num } + } + }, stream) + instance.level = name + instance.expected = false + child = instance.child({}) + child.expected = true + instance[name]({ + message: '123' + }, 'test') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/multistream.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/multistream.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3d8f6263db44680028695c3b1d453bc2625365d5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/multistream.test.js @@ -0,0 +1,723 @@ +'use strict' + +const writeStream = require('flush-write-stream') +const { readFileSync } = require('node:fs') +const { join } = require('node:path') +const test = require('tap').test +const pino = require('../') +const multistream = pino.multistream +const proxyquire = require('proxyquire') +const strip = require('strip-ansi') +const { file, sink } = require('./helper') + +test('sends to multiple streams using string levels', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const streams = [ + { stream }, + { level: 'debug', stream }, + { level: 'trace', stream }, + { level: 'fatal', stream }, + { level: 'silent', stream } + ] + const log = pino({ + level: 'trace' + }, multistream(streams)) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.equal(messageCount, 9) + t.end() +}) + +test('sends to multiple streams using custom levels', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const streams = [ + { stream }, + { level: 'debug', stream }, + { level: 'trace', stream }, + { level: 'fatal', stream }, + { level: 'silent', stream } + ] + const log = pino({ + level: 'trace' + }, multistream(streams)) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.equal(messageCount, 9) + t.end() +}) + +test('sends to multiple streams using optionally predefined levels', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const opts = { + levels: { + silent: Infinity, + fatal: 60, + error: 50, + warn: 50, + info: 30, + debug: 20, + trace: 10 + } + } + const streams = [ + { stream }, + { level: 'trace', stream }, + { level: 'debug', stream }, + { level: 'info', stream }, + { level: 'warn', stream }, + { level: 'error', stream }, + { level: 'fatal', stream }, + { level: 'silent', stream } + ] + const mstream = multistream(streams, opts) + const log = pino({ + level: 'trace' + }, mstream) + log.trace('trace stream') + log.debug('debug stream') + log.info('info stream') + log.warn('warn stream') + log.error('error stream') + log.fatal('fatal stream') + log.silent('silent stream') + t.equal(messageCount, 24) + t.end() +}) + +test('sends to multiple streams using number levels', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const streams = [ + { stream }, + { level: 20, stream }, + { level: 60, stream } + ] + const log = pino({ + level: 'debug' + }, multistream(streams)) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.equal(messageCount, 6) + t.end() +}) + +test('level include higher levels', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const log = pino({}, multistream([{ level: 'info', stream }])) + log.fatal('message') + t.equal(messageCount, 1) + t.end() +}) + +test('supports multiple arguments', function (t) { + const messages = [] + const stream = writeStream(function (data, enc, cb) { + messages.push(JSON.parse(data)) + if (messages.length === 2) { + const msg1 = messages[0] + t.equal(msg1.msg, 'foo bar baz foobar') + + const msg2 = messages[1] + t.equal(msg2.msg, 'foo bar baz foobar barfoo foofoo') + + t.end() + } + cb() + }) + const log = pino({}, multistream({ stream })) + log.info('%s %s %s %s', 'foo', 'bar', 'baz', 'foobar') // apply not invoked + log.info('%s %s %s %s %s %s', 'foo', 'bar', 'baz', 'foobar', 'barfoo', 'foofoo') // apply invoked +}) + +test('supports children', function (t) { + const stream = writeStream(function (data, enc, cb) { + const input = JSON.parse(data) + t.equal(input.msg, 'child stream') + t.equal(input.child, 'one') + t.end() + cb() + }) + const streams = [ + { stream } + ] + const log = pino({}, multistream(streams)).child({ child: 'one' }) + log.info('child stream') +}) + +test('supports grandchildren', function (t) { + const messages = [] + const stream = writeStream(function (data, enc, cb) { + messages.push(JSON.parse(data)) + if (messages.length === 3) { + const msg1 = messages[0] + t.equal(msg1.msg, 'grandchild stream') + t.equal(msg1.child, 'one') + t.equal(msg1.grandchild, 'two') + + const msg2 = messages[1] + t.equal(msg2.msg, 'grandchild stream') + t.equal(msg2.child, 'one') + t.equal(msg2.grandchild, 'two') + + const msg3 = messages[2] + t.equal(msg3.msg, 'debug grandchild') + t.equal(msg3.child, 'one') + t.equal(msg3.grandchild, 'two') + + t.end() + } + cb() + }) + const streams = [ + { stream }, + { level: 'debug', stream } + ] + const log = pino({ + level: 'debug' + }, multistream(streams)).child({ child: 'one' }).child({ grandchild: 'two' }) + log.info('grandchild stream') + log.debug('debug grandchild') +}) + +test('supports custom levels', function (t) { + const stream = writeStream(function (data, enc, cb) { + t.equal(JSON.parse(data).msg, 'bar') + t.end() + }) + const log = pino({ + customLevels: { + foo: 35 + } + }, multistream([{ level: 35, stream }])) + log.foo('bar') +}) + +test('supports pretty print', function (t) { + t.plan(2) + const stream = writeStream(function (data, enc, cb) { + t.not(strip(data.toString()).match(/INFO.*: pretty print/), null) + cb() + }) + + const safeBoom = proxyquire('pino-pretty/lib/utils/build-safe-sonic-boom.js', { + 'sonic-boom': function () { + t.pass('sonic created') + stream.flushSync = () => {} + stream.flush = () => {} + return stream + } + }) + const nested = proxyquire('pino-pretty/lib/utils/index.js', { + './build-safe-sonic-boom.js': safeBoom + }) + const pretty = proxyquire('pino-pretty', { + './lib/utils/index.js': nested + }) + + const log = pino({ + level: 'debug', + name: 'helloName' + }, multistream([ + { stream: pretty() } + ])) + + log.info('pretty print') +}) + +test('emit propagates events to each stream', function (t) { + t.plan(3) + const handler = function (data) { + t.equal(data.msg, 'world') + } + const streams = [sink(), sink(), sink()] + streams.forEach(function (s) { + s.once('hello', handler) + }) + const stream = multistream(streams) + stream.emit('hello', { msg: 'world' }) +}) + +test('children support custom levels', function (t) { + const stream = writeStream(function (data, enc, cb) { + t.equal(JSON.parse(data).msg, 'bar') + t.end() + }) + const parent = pino({ + customLevels: { + foo: 35 + } + }, multistream([{ level: 35, stream }])) + const child = parent.child({ child: 'yes' }) + child.foo('bar') +}) + +test('levelVal overrides level', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const streams = [ + { stream }, + { level: 'blabla', levelVal: 15, stream }, + { level: 60, stream } + ] + const log = pino({ + level: 'debug' + }, multistream(streams)) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.equal(messageCount, 6) + t.end() +}) + +test('forwards metadata', function (t) { + t.plan(4) + const streams = [ + { + stream: { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + t.equal(log, this.lastLogger) + t.equal(30, this.lastLevel) + t.same({ hello: 'world' }, this.lastObj) + t.same('a msg', this.lastMsg) + } + } + } + ] + + const log = pino({ + level: 'debug' + }, multistream(streams)) + + log.info({ hello: 'world' }, 'a msg') + t.end() +}) + +test('forward name', function (t) { + t.plan(2) + const streams = [ + { + stream: { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + const line = JSON.parse(chunk) + t.equal(line.name, 'helloName') + t.equal(line.hello, 'world') + } + } + } + ] + + const log = pino({ + level: 'debug', + name: 'helloName' + }, multistream(streams)) + + log.info({ hello: 'world' }, 'a msg') + t.end() +}) + +test('forward name with child', function (t) { + t.plan(3) + const streams = [ + { + stream: { + write (chunk) { + const line = JSON.parse(chunk) + t.equal(line.name, 'helloName') + t.equal(line.hello, 'world') + t.equal(line.component, 'aComponent') + } + } + } + ] + + const log = pino({ + level: 'debug', + name: 'helloName' + }, multistream(streams)).child({ component: 'aComponent' }) + + log.info({ hello: 'world' }, 'a msg') + t.end() +}) + +test('clone generates a new multistream with all stream at the same level', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const streams = [ + { stream }, + { level: 'debug', stream }, + { level: 'trace', stream }, + { level: 'fatal', stream } + ] + const ms = multistream(streams) + const clone = ms.clone(30) + + t.not(clone, ms) + + clone.streams.forEach((s, i) => { + t.not(s, streams[i]) + t.equal(s.stream, streams[i].stream) + t.equal(s.level, 30) + }) + + const log = pino({ + level: 'trace' + }, clone) + + log.info('info stream') + log.debug('debug message not counted') + log.fatal('fatal stream') + t.equal(messageCount, 8) + + t.end() +}) + +test('one stream', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const log = pino({ + level: 'trace' + }, multistream({ stream, level: 'fatal' })) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.equal(messageCount, 1) + t.end() +}) + +test('dedupe', function (t) { + let messageCount = 0 + const stream1 = writeStream(function (data, enc, cb) { + messageCount -= 1 + cb() + }) + + const stream2 = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + + const streams = [ + { + stream: stream1, + level: 'info' + }, + { + stream: stream2, + level: 'fatal' + } + ] + + const log = pino({ + level: 'trace' + }, multistream(streams, { dedupe: true })) + log.info('info stream') + log.fatal('fatal stream') + log.fatal('fatal stream') + t.equal(messageCount, 1) + t.end() +}) + +test('dedupe when logs have different levels', function (t) { + let messageCount = 0 + const stream1 = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + + const stream2 = writeStream(function (data, enc, cb) { + messageCount += 2 + cb() + }) + + const streams = [ + { + stream: stream1, + level: 'info' + }, + { + stream: stream2, + level: 'error' + } + ] + + const log = pino({ + level: 'trace' + }, multistream(streams, { dedupe: true })) + + log.info('info stream') + log.warn('warn stream') + log.error('error streams') + log.fatal('fatal streams') + t.equal(messageCount, 6) + t.end() +}) + +test('dedupe when some streams has the same level', function (t) { + let messageCount = 0 + const stream1 = writeStream(function (data, enc, cb) { + messageCount -= 1 + cb() + }) + + const stream2 = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + + const stream3 = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + + const streams = [ + { + stream: stream1, + level: 'info' + }, + { + stream: stream2, + level: 'fatal' + }, + { + stream: stream3, + level: 'fatal' + } + ] + + const log = pino({ + level: 'trace' + }, multistream(streams, { dedupe: true })) + log.info('info stream') + log.fatal('fatal streams') + log.fatal('fatal streams') + t.equal(messageCount, 3) + t.end() +}) + +test('no stream', function (t) { + const log = pino({ + level: 'trace' + }, multistream()) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.end() +}) + +test('one stream', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const log = pino({ + level: 'trace' + }, multistream(stream)) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.equal(messageCount, 2) + t.end() +}) + +test('add a stream', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + + const log = pino({ + level: 'trace' + }, multistream().add(stream)) + log.info('info stream') + log.debug('debug stream') + log.fatal('fatal stream') + t.equal(messageCount, 2) + t.end() +}) + +test('remove a stream', function (t) { + let messageCount1 = 0 + let messageCount2 = 0 + let messageCount3 = 0 + + const stream1 = writeStream(function (data, enc, cb) { + messageCount1 += 1 + cb() + }) + + const stream2 = writeStream(function (data, enc, cb) { + messageCount2 += 1 + cb() + }) + + const stream3 = writeStream(function (data, enc, cb) { + messageCount3 += 1 + cb() + }) + + const multi = multistream() + const log = pino({ level: 'trace', sync: true }, multi) + + multi.add(stream1) + const id1 = multi.lastId + + multi.add(stream2) + const id2 = multi.lastId + + multi.add(stream3) + const id3 = multi.lastId + + log.info('line') + multi.remove(id1) + + log.info('line') + multi.remove(id2) + + log.info('line') + multi.remove(id3) + + log.info('line') + multi.remove(Math.floor(Math.random() * 1000)) // non-existing id + + t.equal(messageCount1, 1) + t.equal(messageCount2, 2) + t.equal(messageCount3, 3) + t.end() +}) + +test('multistream.add throws if not a stream', function (t) { + try { + pino({ + level: 'trace' + }, multistream().add({})) + } catch (_) { + t.end() + } +}) + +test('multistream throws if not a stream', function (t) { + try { + pino({ + level: 'trace' + }, multistream({})) + } catch (_) { + t.end() + } +}) + +test('multistream.write should not throw if one stream fails', function (t) { + let messageCount = 0 + const stream = writeStream(function (data, enc, cb) { + messageCount += 1 + cb() + }) + const noopStream = pino.transport({ + target: join(__dirname, 'fixtures', 'noop-transport.js') + }) + // eslint-disable-next-line + noopStream.on('error', function (err) { + // something went wrong while writing to noop stream, ignoring! + }) + const log = pino({ + level: 'trace' + }, + multistream([ + { + level: 'trace', + stream + }, + { + level: 'debug', + stream: noopStream + } + ]) + ) + log.debug('0') + noopStream.end() + // noop stream is ending, should emit an error but not throw + log.debug('1') + log.debug('2') + t.equal(messageCount, 3) + t.end() +}) + +test('flushSync', function (t) { + const tmp = file() + const destination = pino.destination({ dest: tmp, sync: false, minLength: 4096 }) + const stream = multistream([{ level: 'info', stream: destination }]) + const log = pino({ level: 'info' }, stream) + destination.on('ready', () => { + log.info('foo') + log.info('bar') + stream.flushSync() + t.equal(readFileSync(tmp, { encoding: 'utf-8' }).split('\n').length - 1, 2) + log.info('biz') + stream.flushSync() + t.equal(readFileSync(tmp, { encoding: 'utf-8' }).split('\n').length - 1, 3) + t.end() + }) +}) + +test('ends all streams', function (t) { + t.plan(7) + const stream = writeStream(function (data, enc, cb) { + t.pass('message') + cb() + }) + stream.flushSync = function () { + t.pass('flushSync') + } + // stream2 has no flushSync + const stream2 = writeStream(function (data, enc, cb) { + t.pass('message2') + cb() + }) + const streams = [ + { stream }, + { level: 'debug', stream }, + { level: 'trace', stream: stream2 }, + { level: 'fatal', stream }, + { level: 'silent', stream } + ] + const multi = multistream(streams) + const log = pino({ + level: 'trace' + }, multi) + log.info('info stream') + multi.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7c247f4a7128b9ca8fd82618772f933d4ce90d15 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/index.js @@ -0,0 +1,46 @@ +'use strict' + +const os = require('node:os') +const { join } = require('node:path') +const { readFile } = require('node:fs').promises +const { watchFileCreated, file } = require('../helper') +const { test } = require('tap') +const pino = require('../../pino') + +const { pid } = process +const hostname = os.hostname() + +/** + * This file is packaged using pkg in order to test if transport-stream.js works in that context + */ + +test('pino.transport with worker destination overridden by bundler and mjs transport', async ({ same, teardown }) => { + globalThis.__bundlerPathsOverrides = { + 'pino-worker': join(__dirname, '..', '..', 'lib/worker.js') + } + + const destination = file() + const transport = pino.transport({ + targets: [ + { + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.es2017.cjs'), + options: { destination } + } + ] + }) + + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + + globalThis.__bundlerPathsOverrides = undefined +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/pkg.config.json b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/pkg.config.json new file mode 100644 index 0000000000000000000000000000000000000000..a7d2b990cf5276d909e646d2e4ee3e8e1c5d9ce9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/pkg.config.json @@ -0,0 +1,17 @@ +{ + "pkg": { + "assets": [ + "../../lib/worker.js", + "../../lib/transport-stream.js", + "../../test/fixtures/ts/to-file-transport.es2017.cjs", + "../../node_modules/pino-abstract-transport/index.js" + ], + "targets": [ + "node14", + "node16", + "node18", + "node20" + ], + "outputPath": "test/pkg" + } +} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/pkg.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/pkg.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3cb28ad33dca0e9c74938293ea7eae0090f86dff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/pkg/pkg.test.js @@ -0,0 +1,58 @@ +'use strict' + +const { test } = require('tap') +const config = require('./pkg.config.json') +const { promisify } = require('node:util') +const { unlink } = require('node:fs/promises') +const { join } = require('node:path') +const { platform } = require('node:process') +const execFile = promisify(require('node:child_process').execFile) + +const skip = process.env.PNPM_CI || process.env.CITGM || process.arch === 'ppc64' + +/** + * The following regex is for tesintg the deprecation warning that is thrown by the `punycode` module. + * Exact text that it's matching is: + * (node:1234) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. + Please use a userland alternative instead. + + (Use `node --trace-deprecation ...` to show where the warning was created) + */ +const deprecationWarningRegex = /^\(\w+:\d+\)\s\[[\w|\d]+\]\sDeprecationWarning: The `punycode` module is deprecated\.\s+Please use a userland alternative instead\.\s+\(Use `node --trace-deprecation \.\.\.` to show where the warning was created\)\s+$/ + +test('worker test when packaged into executable using pkg', { skip }, async (t) => { + const packageName = 'index' + + // package the app into several node versions, check config for more info + const filePath = `${join(__dirname, packageName)}.js` + const configPath = join(__dirname, 'pkg.config.json') + const { stderr } = await execFile('npx', ['pkg', filePath, '--config', configPath], { shell: true }) + + // there should be no error when packaging + const expectedvalue = stderr === '' || deprecationWarningRegex.test(stderr) + t.ok(expectedvalue) + + // pkg outputs files in the following format by default: {filename}-{node version} + for (const target of config.pkg.targets) { + // execute the packaged test + let executablePath = `${join(config.pkg.outputPath, packageName)}-${target}` + + // when on windows, we need the .exe extension + if (platform === 'win32') { + executablePath = `${executablePath}.exe` + } else { + executablePath = `./${executablePath}` + } + + const { stderr } = await execFile(executablePath) + + // check if there were no errors + const expectedvalue = stderr === '' || deprecationWarningRegex.test(stderr) + t.ok(expectedvalue) + + // clean up afterwards + await unlink(executablePath) + } + + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/redact.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/redact.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8e9eff36ecc7b4699a79ef0f844cb9a8c2564034 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/redact.test.js @@ -0,0 +1,847 @@ +'use strict' + +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +test('redact option – throws if not array', async ({ throws }) => { + throws(() => { + pino({ redact: 'req.headers.cookie' }) + }) +}) + +test('redact option – throws if array does not only contain strings', async ({ throws }) => { + throws(() => { + pino({ redact: ['req.headers.cookie', {}] }) + }) +}) + +test('redact option – throws if array contains an invalid path', async ({ throws }) => { + throws(() => { + pino({ redact: ['req,headers.cookie'] }) + }) +}) + +test('redact.paths option – throws if not array', async ({ throws }) => { + throws(() => { + pino({ redact: { paths: 'req.headers.cookie' } }) + }) +}) + +test('redact.paths option – throws if array does not only contain strings', async ({ throws }) => { + throws(() => { + pino({ redact: { paths: ['req.headers.cookie', {}] } }) + }) +}) + +test('redact.paths option – throws if array contains an invalid path', async ({ throws }) => { + throws(() => { + pino({ redact: { paths: ['req,headers.cookie'] } }) + }) +}) + +test('redact option – top level key', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['key'] }, stream) + instance.info({ + key: { redact: 'me' } + }) + const { key } = await once(stream, 'data') + equal(key, '[Redacted]') +}) + +test('redact option – top level key next level key', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['key', 'key.foo'] }, stream) + instance.info({ + key: { redact: 'me' } + }) + const { key } = await once(stream, 'data') + equal(key, '[Redacted]') +}) + +test('redact option – next level key then top level key', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['key.foo', 'key'] }, stream) + instance.info({ + key: { redact: 'me' } + }) + const { key } = await once(stream, 'data') + equal(key, '[Redacted]') +}) + +test('redact option – object', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') +}) + +test('redact option – child object', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + instance.child({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }).info('message completed') + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') +}) + +test('redact option – interpolated object', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + + instance.info('test %j', { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { msg } = await once(stream, 'data') + equal(JSON.parse(msg.replace(/test /, '')).req.headers.cookie, '[Redacted]') +}) + +test('redact.paths option – object', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') +}) + +test('redact.paths option – child object', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + instance.child({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }).info('message completed') + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') +}) + +test('redact.paths option – interpolated object', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + + instance.info('test %j', { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { msg } = await once(stream, 'data') + equal(JSON.parse(msg.replace(/test /, '')).req.headers.cookie, '[Redacted]') +}) + +test('redact.censor option – sets the redact value', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], censor: 'test' } }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, 'test') +}) + +test('redact.censor option – can be a function that accepts value and path arguments', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['topLevel'], censor: (value, path) => value + ' ' + path.join('.') } }, stream) + instance.info({ + topLevel: 'test' + }) + const { topLevel } = await once(stream, 'data') + equal(topLevel, 'test topLevel') +}) + +test('redact.censor option – can be a function that accepts value and path arguments (nested path)', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], censor: (value, path) => value + ' ' + path.join('.') } }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1; req.headers.cookie') +}) + +test('redact.remove option – removes both key and value', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], remove: true } }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal('cookie' in req.headers, false) +}) + +test('redact.remove – top level key - object value', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['key'], remove: true } }, stream) + instance.info({ + key: { redact: 'me' } + }) + const o = await once(stream, 'data') + equal('key' in o, false) +}) + +test('redact.remove – top level key - number value', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['key'], remove: true } }, stream) + instance.info({ + key: 1 + }) + const o = await once(stream, 'data') + equal('key' in o, false) +}) + +test('redact.remove – top level key - boolean value', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['key'], remove: true } }, stream) + instance.info({ + key: false + }) + const o = await once(stream, 'data') + equal('key' in o, false) +}) + +test('redact.remove – top level key in child logger', async ({ equal }) => { + const stream = sink() + const opts = { redact: { paths: ['key'], remove: true } } + const instance = pino(opts, stream).child({ key: { redact: 'me' } }) + instance.info('test') + const o = await once(stream, 'data') + equal('key' in o, false) +}) + +test('redact.paths preserves original object values after the log write', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.req.headers.cookie, '[Redacted]') + equal(obj.req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') +}) + +test('redact.paths preserves original object values after the log write', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.req.headers.cookie, '[Redacted]') + equal(obj.req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') +}) + +test('redact.censor preserves original object values after the log write', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], censor: 'test' } }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.req.headers.cookie, 'test') + equal(obj.req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') +}) + +test('redact.remove preserves original object values after the log write', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], remove: true } }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + equal('cookie' in o.req.headers, false) + equal('cookie' in obj.req.headers, true) +}) + +test('redact – supports last position wildcard paths', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.*'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') + equal(req.headers.host, '[Redacted]') + equal(req.headers.connection, '[Redacted]') +}) + +test('redact – supports first position wildcard paths', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['*.headers'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers, '[Redacted]') +}) + +test('redact – supports first position wildcards before other paths', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['*.headers.cookie', 'req.id'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') + equal(req.id, '[Redacted]') +}) + +test('redact – supports first position wildcards after other paths', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.id', '*.headers.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') + equal(req.id, '[Redacted]') +}) + +test('redact – supports first position wildcards after top level keys', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['key', '*.headers.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') +}) + +test('redact – supports top level wildcard', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['*'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req, '[Redacted]') +}) + +test('redact – supports top level wildcard with a censor function', async ({ equal }) => { + const stream = sink() + const instance = pino({ + redact: { + paths: ['*'], + censor: () => '[Redacted]' + } + }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req, '[Redacted]') +}) + +test('redact – supports top level wildcard and leading wildcard', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['*', '*.req'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req, '[Redacted]') +}) + +test('redact – supports intermediate wildcard paths', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.*.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') +}) + +test('redacts numbers at the top level', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['id'] }, stream) + const obj = { + id: 7915 + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.id, '[Redacted]') +}) + +test('redacts booleans at the top level', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['maybe'] }, stream) + const obj = { + maybe: true + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.maybe, '[Redacted]') +}) + +test('redacts strings at the top level', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['s'] }, stream) + const obj = { + s: 's' + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.s, '[Redacted]') +}) + +test('does not redact primitives if not objects', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['a.b'] }, stream) + const obj = { + a: 42 + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.a, 42) +}) + +test('redacts null at the top level', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['n'] }, stream) + const obj = { + n: null + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.n, '[Redacted]') +}) + +test('supports bracket notation', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['a["b.b"]'] }, stream) + const obj = { + a: { 'b.b': 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.a['b.b'], '[Redacted]') +}) + +test('supports bracket notation with further nesting', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['a["b.b"].c'] }, stream) + const obj = { + a: { 'b.b': { c: 'd' } } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.a['b.b'].c, '[Redacted]') +}) + +test('supports bracket notation with empty string as path segment', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['a[""].c'] }, stream) + const obj = { + a: { '': { c: 'd' } } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o.a[''].c, '[Redacted]') +}) + +test('supports leading bracket notation (single quote)', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['[\'a.a\'].b'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o['a.a'].b, '[Redacted]') +}) + +test('supports leading bracket notation (double quote)', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['["a.a"].b'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o['a.a'].b, '[Redacted]') +}) + +test('supports leading bracket notation (backtick quote)', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['[`a.a`].b'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o['a.a'].b, '[Redacted]') +}) + +test('supports leading bracket notation (single-segment path)', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['[`a.a`]'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o['a.a'], '[Redacted]') +}) + +test('supports leading bracket notation (single-segment path, wildcard)', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['[*]'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + equal(o['a.a'], '[Redacted]') +}) + +test('child bindings are redacted using wildcard path', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['*.headers.cookie'] }, stream) + instance.child({ + req: { + method: 'GET', + url: '/', + headers: { + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + } + } + }).info('message completed') + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') +}) + +test('child bindings are redacted using wildcard and plain path keys', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.method', '*.headers.cookie'] }, stream) + instance.child({ + req: { + method: 'GET', + url: '/', + headers: { + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + } + } + }).info('message completed') + const { req } = await once(stream, 'data') + equal(req.headers.cookie, '[Redacted]') + equal(req.method, '[Redacted]') +}) + +test('redacts boolean at the top level', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['msg'] }, stream) + const obj = { + s: 's' + } + instance.info(obj, true) + const o = await once(stream, 'data') + equal(o.s, 's') + equal(o.msg, '[Redacted]') +}) + +test('child can customize redact', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.method', '*.headers.cookie'] }, stream) + instance.child({ + req: { + method: 'GET', + url: '/', + headers: { + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + } + } + }, { + redact: ['req.url'] + }).info('message completed') + const { req } = await once(stream, 'data') + equal(req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') + equal(req.method, 'GET') + equal(req.url, '[Redacted]') +}) + +test('child can remove parent redact by array', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: ['req.method', '*.headers.cookie'] }, stream) + instance.child({ + req: { + method: 'GET', + url: '/', + headers: { + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + } + } + }, { + redact: [] + }).info('message completed') + const { req } = await once(stream, 'data') + equal(req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') + equal(req.method, 'GET') +}) + +test('redact safe stringify', async ({ equal }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['that.secret'] } }, stream) + + instance.info({ + that: { + secret: 'please hide me', + myBigInt: 123n + }, + other: { + mySecondBigInt: 222n + } + }) + const { that, other } = await once(stream, 'data') + equal(that.secret, '[Redacted]') + equal(that.myBigInt, 123) + equal(other.mySecondBigInt, 222) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/serializers.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/serializers.test.js new file mode 100644 index 0000000000000000000000000000000000000000..35edee8b762a324adf3d0ec5300f53da986c3558 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/serializers.test.js @@ -0,0 +1,253 @@ +'use strict' +const { test } = require('tap') +const { sink, once } = require('./helper') +const stdSerializers = require('pino-std-serializers') +const pino = require('../') + +const parentSerializers = { + test: () => 'parent' +} + +const childSerializers = { + test: () => 'child' +} + +test('default err namespace error serializer', async ({ equal }) => { + const stream = sink() + const parent = pino(stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + equal(typeof o.err, 'object') + equal(o.err.type, 'ReferenceError') + equal(o.err.message, 'test') + equal(typeof o.err.stack, 'string') +}) + +test('custom serializer overrides default err namespace error serializer', async ({ equal }) => { + const stream = sink() + const parent = pino({ + serializers: { + err: (e) => ({ + t: e.constructor.name, + m: e.message, + s: e.stack + }) + } + }, stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + equal(typeof o.err, 'object') + equal(o.err.t, 'ReferenceError') + equal(o.err.m, 'test') + equal(typeof o.err.s, 'string') +}) + +test('custom serializer overrides default err namespace error serializer when nestedKey is on', async ({ equal }) => { + const stream = sink() + const parent = pino({ + nestedKey: 'obj', + serializers: { + err: (e) => { + return { + t: e.constructor.name, + m: e.message, + s: e.stack + } + } + } + }, stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + equal(typeof o.obj.err, 'object') + equal(o.obj.err.t, 'ReferenceError') + equal(o.obj.err.m, 'test') + equal(typeof o.obj.err.s, 'string') +}) + +test('null overrides default err namespace error serializer', async ({ equal }) => { + const stream = sink() + const parent = pino({ serializers: { err: null } }, stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + equal(typeof o.err, 'object') + equal(typeof o.err.type, 'undefined') + equal(typeof o.err.message, 'undefined') + equal(typeof o.err.stack, 'undefined') +}) + +test('undefined overrides default err namespace error serializer', async ({ equal }) => { + const stream = sink() + const parent = pino({ serializers: { err: undefined } }, stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + equal(typeof o.err, 'object') + equal(typeof o.err.type, 'undefined') + equal(typeof o.err.message, 'undefined') + equal(typeof o.err.stack, 'undefined') +}) + +test('serializers override values', async ({ equal }) => { + const stream = sink() + const parent = pino({ serializers: parentSerializers }, stream) + parent.child({}, { serializers: childSerializers }) + + parent.fatal({ test: 'test' }) + const o = await once(stream, 'data') + equal(o.test, 'parent') +}) + +test('child does not overwrite parent serializers', async ({ equal }) => { + const stream = sink() + const parent = pino({ serializers: parentSerializers }, stream) + const child = parent.child({}, { serializers: childSerializers }) + + parent.fatal({ test: 'test' }) + + const o = once(stream, 'data') + equal((await o).test, 'parent') + const o2 = once(stream, 'data') + child.fatal({ test: 'test' }) + equal((await o2).test, 'child') +}) + +test('Symbol.for(\'pino.serializers\')', async ({ equal, same, not }) => { + const stream = sink() + const expected = Object.assign({ + err: stdSerializers.err + }, parentSerializers) + const parent = pino({ serializers: parentSerializers }, stream) + const child = parent.child({ a: 'property' }) + + same(parent[Symbol.for('pino.serializers')], expected) + same(child[Symbol.for('pino.serializers')], expected) + equal(parent[Symbol.for('pino.serializers')], child[Symbol.for('pino.serializers')]) + + const child2 = parent.child({}, { + serializers: { + a + } + }) + + function a () { + return 'hello' + } + + not(child2[Symbol.for('pino.serializers')], parentSerializers) + equal(child2[Symbol.for('pino.serializers')].a, a) + equal(child2[Symbol.for('pino.serializers')].test, parentSerializers.test) +}) + +test('children inherit parent serializers', async ({ equal }) => { + const stream = sink() + const parent = pino({ serializers: parentSerializers }, stream) + + const child = parent.child({ a: 'property' }) + child.fatal({ test: 'test' }) + const o = await once(stream, 'data') + equal(o.test, 'parent') +}) + +test('children inherit parent Symbol serializers', async ({ equal, same, not }) => { + const stream = sink() + const symbolSerializers = { + [Symbol.for('b')]: b + } + const expected = Object.assign({ + err: stdSerializers.err + }, symbolSerializers) + const parent = pino({ serializers: symbolSerializers }, stream) + + same(parent[Symbol.for('pino.serializers')], expected) + + const child = parent.child({}, { + serializers: { + [Symbol.for('a')]: a, + a + } + }) + + function a () { + return 'hello' + } + + function b () { + return 'world' + } + + same(child[Symbol.for('pino.serializers')].a, a) + same(child[Symbol.for('pino.serializers')][Symbol.for('b')], b) + same(child[Symbol.for('pino.serializers')][Symbol.for('a')], a) +}) + +test('children serializers get called', async ({ equal }) => { + const stream = sink() + const parent = pino({ + test: 'this' + }, stream) + + const child = parent.child({ a: 'property' }, { serializers: childSerializers }) + + child.fatal({ test: 'test' }) + const o = await once(stream, 'data') + equal(o.test, 'child') +}) + +test('children serializers get called when inherited from parent', async ({ equal }) => { + const stream = sink() + const parent = pino({ + test: 'this', + serializers: parentSerializers + }, stream) + + const child = parent.child({}, { serializers: { test: function () { return 'pass' } } }) + + child.fatal({ test: 'fail' }) + const o = await once(stream, 'data') + equal(o.test, 'pass') +}) + +test('non-overridden serializers are available in the children', async ({ equal }) => { + const stream = sink() + const pSerializers = { + onlyParent: function () { return 'parent' }, + shared: function () { return 'parent' } + } + + const cSerializers = { + shared: function () { return 'child' }, + onlyChild: function () { return 'child' } + } + + const parent = pino({ serializers: pSerializers }, stream) + + const child = parent.child({}, { serializers: cSerializers }) + + const o = once(stream, 'data') + child.fatal({ shared: 'test' }) + equal((await o).shared, 'child') + const o2 = once(stream, 'data') + child.fatal({ onlyParent: 'test' }) + equal((await o2).onlyParent, 'parent') + const o3 = once(stream, 'data') + child.fatal({ onlyChild: 'test' }) + equal((await o3).onlyChild, 'child') + const o4 = once(stream, 'data') + parent.fatal({ onlyChild: 'test' }) + equal((await o4).onlyChild, 'test') +}) + +test('custom serializer for messageKey', async (t) => { + const stream = sink() + const instance = pino({ serializers: { msg: () => '422' } }, stream) + + const o = { num: NaN } + instance.info(o, 42) + + const { msg } = await once(stream, 'data') + t.equal(msg, '422') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/stdout-protection.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/stdout-protection.test.js new file mode 100644 index 0000000000000000000000000000000000000000..fb42621884c426555c12161396e549724bb17d96 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/stdout-protection.test.js @@ -0,0 +1,39 @@ +'use strict' + +const { test } = require('tap') +const { join } = require('node:path') +const { fork } = require('node:child_process') +const { once } = require('./helper') +const writer = require('flush-write-stream') +const pino = require('..') + +test('do not use SonicBoom is someone tampered with process.stdout.write', async ({ not }) => { + let actual = '' + const child = fork(join(__dirname, 'fixtures', 'stdout-hack-protection.js'), { silent: true }) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + not(actual.match(/^hack/), null) +}) + +test('do not use SonicBoom is someone has passed process.stdout to pino', async ({ equal }) => { + const logger = pino(process.stdout) + equal(logger[pino.symbols.streamSym], process.stdout) +}) + +test('do not crash if process.stdout has no fd', async ({ teardown }) => { + const fd = process.stdout.fd + delete process.stdout.fd + teardown(function () { process.stdout.fd = fd }) + pino() +}) + +test('use fd=1 if process.stdout has no fd in pino.destination() (worker case)', async ({ teardown }) => { + const fd = process.stdout.fd + delete process.stdout.fd + teardown(function () { process.stdout.fd = fd }) + pino.destination() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/syncfalse.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/syncfalse.test.js new file mode 100644 index 0000000000000000000000000000000000000000..29a4fc15cbc82defa11b369a4021b6024c075f39 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/syncfalse.test.js @@ -0,0 +1,188 @@ +'use strict' + +const os = require('node:os') +const { promises: { readFile }, createWriteStream } = require('node:fs') +const { join } = require('node:path') +const { test } = require('tap') +const { fork } = require('node:child_process') +const writer = require('flush-write-stream') +const { + once, + getPathToNull, + file, + watchFileCreated +} = require('./helper') +const { promisify } = require('node:util') + +const sleep = promisify(setTimeout) + +test('asynchronous logging', async ({ + equal, + teardown +}) => { + const now = Date.now + const hostname = os.hostname + const proc = process + global.process = { + __proto__: process, + pid: 123456 + } + Date.now = () => 1459875739796 + os.hostname = () => 'abcdefghijklmnopqr' + delete require.cache[require.resolve('../')] + const pino = require('../') + let expected = '' + let actual = '' + const normal = pino(writer((s, enc, cb) => { + expected += s + cb() + })) + + const dest = createWriteStream(getPathToNull()) + dest.write = (s) => { + actual += s + } + const asyncLogger = pino(dest) + + let i = 44 + while (i--) { + normal.info('h') + asyncLogger.info('h') + } + + const expected2 = expected.split('\n')[0] + let actual2 = '' + + const child = fork(join(__dirname, '/fixtures/syncfalse.js'), { silent: true }) + child.stdout.pipe(writer((s, enc, cb) => { + actual2 += s + cb() + })) + await once(child, 'close') + // Wait for the last write to be flushed + await sleep(100) + equal(actual, expected) + equal(actual2.trim(), expected2) + + teardown(() => { + os.hostname = hostname + Date.now = now + global.process = proc + }) +}) + +test('sync false with child', async ({ + equal, + teardown +}) => { + const now = Date.now + const hostname = os.hostname + const proc = process + global.process = { + __proto__: process, + pid: 123456 + } + Date.now = function () { + return 1459875739796 + } + os.hostname = function () { + return 'abcdefghijklmnopqr' + } + delete require.cache[require.resolve('../')] + const pino = require('../') + let expected = '' + let actual = '' + const normal = pino(writer((s, enc, cb) => { + expected += s + cb() + })).child({ hello: 'world' }) + + const dest = createWriteStream(getPathToNull()) + dest.write = function (s) { + actual += s + } + const asyncLogger = pino(dest).child({ hello: 'world' }) + + let i = 500 + while (i--) { + normal.info('h') + asyncLogger.info('h') + } + + asyncLogger.flush() + + const expected2 = expected.split('\n')[0] + let actual2 = '' + + const child = fork(join(__dirname, '/fixtures/syncfalse-child.js'), { silent: true }) + child.stdout.pipe(writer((s, enc, cb) => { + actual2 += s + cb() + })) + await once(child, 'close') + equal(actual, expected) + equal(actual2.trim(), expected2) + + teardown(() => { + os.hostname = hostname + Date.now = now + global.process = proc + }) +}) + +test('flush does nothing with sync true (default)', async ({ equal }) => { + const instance = require('..')() + equal(instance.flush(), undefined) +}) + +test('should still call flush callback even when does nothing with sync true (default)', (t) => { + t.plan(3) + const instance = require('..')() + instance.flush((...args) => { + t.ok('flush called') + t.same(args, []) + + // next tick to make flush not called more than once + process.nextTick(() => { + t.ok('flush next tick called') + }) + }) +}) + +test('should call the flush callback when flushed the data for async logger', async (t) => { + const outputPath = file() + async function getOutputLogLines () { + return (await readFile(outputPath)).toString().trim().split('\n').map(JSON.parse) + } + + const pino = require('../') + + const instance = pino({}, pino.destination({ + dest: outputPath, + + // to make sure it does not flush on its own + minLength: 4096 + })) + const flushPromise = promisify(instance.flush).bind(instance) + + instance.info('hello') + await flushPromise() + await watchFileCreated(outputPath) + + const [firstFlushData] = await getOutputLogLines() + + t.equal(firstFlushData.msg, 'hello') + + // should not flush this as no data accumulated that's bigger than min length + instance.info('world') + + // Making sure data is not flushed yet + const afterLogData = await getOutputLogLines() + t.equal(afterLogData.length, 1) + + await flushPromise() + + // Making sure data is not flushed yet + const afterSecondFlush = (await getOutputLogLines())[1] + t.equal(afterSecondFlush.msg, 'world') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/timestamp.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/timestamp.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4bf547214c8f8ec3a79456c97a4d183ca48891fb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/timestamp.test.js @@ -0,0 +1,121 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +test('pino exposes standard time functions', async ({ ok }) => { + ok(pino.stdTimeFunctions) + ok(pino.stdTimeFunctions.epochTime) + ok(pino.stdTimeFunctions.unixTime) + ok(pino.stdTimeFunctions.nullTime) + ok(pino.stdTimeFunctions.isoTime) +}) + +test('pino accepts external time functions', async ({ equal }) => { + const opts = { + timestamp: () => ',"time":"none"' + } + const stream = sink() + const instance = pino(opts, stream) + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), true) + equal(result.time, 'none') +}) + +test('pino accepts external time functions with custom label', async ({ equal }) => { + const opts = { + timestamp: () => ',"custom-time-label":"none"' + } + const stream = sink() + const instance = pino(opts, stream) + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('custom-time-label'), true) + equal(result['custom-time-label'], 'none') +}) + +test('inserts timestamp by default', async ({ ok, equal }) => { + const stream = sink() + const instance = pino(stream) + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), true) + ok(new Date(result.time) <= new Date(), 'time is greater than timestamp') + equal(result.msg, 'foobar') +}) + +test('omits timestamp when timestamp option is false', async ({ equal }) => { + const stream = sink() + const instance = pino({ timestamp: false }, stream) + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), false) + equal(result.msg, 'foobar') +}) + +test('inserts timestamp when timestamp option is true', async ({ ok, equal }) => { + const stream = sink() + const instance = pino({ timestamp: true }, stream) + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), true) + ok(new Date(result.time) <= new Date(), 'time is greater than timestamp') + equal(result.msg, 'foobar') +}) + +test('child inserts timestamp by default', async ({ ok, equal }) => { + const stream = sink() + const logger = pino(stream) + const instance = logger.child({ component: 'child' }) + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), true) + ok(new Date(result.time) <= new Date(), 'time is greater than timestamp') + equal(result.msg, 'foobar') +}) + +test('child omits timestamp with option', async ({ equal }) => { + const stream = sink() + const logger = pino({ timestamp: false }, stream) + const instance = logger.child({ component: 'child' }) + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), false) + equal(result.msg, 'foobar') +}) + +test('pino.stdTimeFunctions.unixTime returns seconds based timestamps', async ({ equal }) => { + const opts = { + timestamp: pino.stdTimeFunctions.unixTime + } + const stream = sink() + const instance = pino(opts, stream) + const now = Date.now + Date.now = () => 1531069919686 + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), true) + equal(result.time, 1531069920) + Date.now = now +}) + +test('pino.stdTimeFunctions.isoTime returns ISO 8601 timestamps', async ({ equal }) => { + const opts = { + timestamp: pino.stdTimeFunctions.isoTime + } + const stream = sink() + const instance = pino(opts, stream) + const ms = 1531069919686 + const now = Date.now + Date.now = () => ms + const iso = new Date(ms).toISOString() + instance.info('foobar') + const result = await once(stream, 'data') + equal(result.hasOwnProperty('time'), true) + equal(result.time, iso) + Date.now = now +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport-stream.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport-stream.test.js new file mode 100644 index 0000000000000000000000000000000000000000..488aceb777ed20168d616baef5403bde47e7f5e3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport-stream.test.js @@ -0,0 +1,26 @@ +'use strict' + +const { test } = require('tap') + +test('should import', async (t) => { + t.plan(2) + const mockRealRequire = (target) => { + return { + default: { + default: () => { + t.equal(target, 'pino-pretty') + return Promise.resolve() + } + } + } + } + const mockRealImport = async () => { await Promise.resolve(); throw Object.assign(new Error(), { code: 'ERR_MODULE_NOT_FOUND' }) } + + /** @type {typeof import('../lib/transport-stream.js')} */ + const loadTransportStreamBuilder = t.mock('../lib/transport-stream.js', { 'real-require': { realRequire: mockRealRequire, realImport: mockRealImport } }) + + const fn = await loadTransportStreamBuilder('pino-pretty') + + t.resolves(fn()) + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/big.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/big.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d818b978ebea611e8df95bde2959524d97e7c875 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/big.test.js @@ -0,0 +1,43 @@ +'use strict' + +const { test } = require('tap') +const { join } = require('node:path') +const { createReadStream } = require('node:fs') +const { promisify } = require('node:util') +const execa = require('execa') +const split = require('split2') +const stream = require('node:stream') +const { file } = require('../helper') + +const pipeline = promisify(stream.pipeline) +const { Writable } = stream +const sleep = promisify(setTimeout) + +const skip = process.env.CI || process.env.CITGM + +test('eight million lines', { skip }, async ({ equal, comment }) => { + const destination = file() + await execa(process.argv[0], [join(__dirname, '..', 'fixtures', 'transport-many-lines.js'), destination]) + + if (process.platform !== 'win32') { + try { + await execa('sync') // Wait for the file to be written to disk + } catch { + // Just a fallback, this should be unreachable + } + } + await sleep(1000) // It seems that sync is not enough (even in POSIX systems) + + const toWrite = 8 * 1000000 + let count = 0 + await pipeline(createReadStream(destination), split(), new Writable({ + write (chunk, enc, cb) { + if (count % (toWrite / 10) === 0) { + comment(`read ${count}`) + } + count++ + cb() + } + })) + equal(count, toWrite) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/bundlers-support.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/bundlers-support.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f651a97fb0b671099109a90a377918137f6dff58 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/bundlers-support.test.js @@ -0,0 +1,97 @@ +'use strict' + +const os = require('node:os') +const { join } = require('node:path') +const { readFile } = require('node:fs').promises +const { watchFileCreated, file } = require('../helper') +const { test } = require('tap') +const pino = require('../../pino') + +const { pid } = process +const hostname = os.hostname() + +test('pino.transport with destination overridden by bundler', async ({ same, teardown }) => { + globalThis.__bundlerPathsOverrides = { + foobar: join(__dirname, '..', 'fixtures', 'to-file-transport.js') + } + + const destination = file() + const transport = pino.transport({ + target: 'foobar', + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + + globalThis.__bundlerPathsOverrides = undefined +}) + +test('pino.transport with worker destination overridden by bundler', async ({ same, teardown }) => { + globalThis.__bundlerPathsOverrides = { + 'pino-worker': join(__dirname, '..', '..', 'lib/worker.js') + } + + const destination = file() + const transport = pino.transport({ + targets: [ + { + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination } + } + ] + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + + globalThis.__bundlerPathsOverrides = undefined +}) + +test('pino.transport with worker destination overridden by bundler and mjs transport', async ({ same, teardown }) => { + globalThis.__bundlerPathsOverrides = { + 'pino-worker': join(__dirname, '..', '..', 'lib/worker.js') + } + + const destination = file() + const transport = pino.transport({ + targets: [ + { + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.es2017.cjs'), + options: { destination } + } + ] + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + + globalThis.__bundlerPathsOverrides = undefined +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/caller.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/caller.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e54a7860a831d0e2e8e238d0b1d6d9b96f363888 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/caller.test.js @@ -0,0 +1,23 @@ +'use strict' + +const { join } = require('node:path') +const { test } = require('tap') +const execa = require('execa') + +test('when using a custom transport outside node_modules, the first file outside node_modules should be used', async function (t) { + const evalApp = join(__dirname, '../', '/fixtures/eval/index.js') + const { stdout } = await execa(process.argv[0], [evalApp]) + t.match(stdout, /done!/) +}) + +test('when using a custom transport where some files in stacktrace are in the node_modules, the first file outside node_modules should be used', async function (t) { + const evalApp = join(__dirname, '../', '/fixtures/eval/node_modules/2-files.js') + const { stdout } = await execa(process.argv[0], [evalApp]) + t.match(stdout, /done!/) +}) + +test('when using a custom transport where all files in stacktrace are in the node_modules, the first file inside node_modules should be used', async function (t) { + const evalApp = join(__dirname, '../', '/fixtures/eval/node_modules/14-files.js') + const { stdout } = await execa(process.argv[0], [evalApp]) + t.match(stdout, /done!/) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3bd55fedd693aacc0a36a7e433e46834a5f45361 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.test.js @@ -0,0 +1,643 @@ +'use strict' + +const os = require('node:os') +const { join } = require('node:path') +const { once } = require('node:events') +const { setImmediate: immediate } = require('node:timers/promises') +const { readFile, writeFile } = require('node:fs').promises +const { watchFileCreated, watchForWrite, file } = require('../helper') +const { test } = require('tap') +const pino = require('../../') +const url = require('url') +const strip = require('strip-ansi') +const execa = require('execa') +const writer = require('flush-write-stream') +const rimraf = require('rimraf') +const { tmpdir } = os + +const pid = process.pid +const hostname = os.hostname() + +test('pino.transport with file', async ({ same, teardown }) => { + const destination = file() + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with file (no options + error handling)', async ({ equal }) => { + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js') + }) + const [err] = await once(transport, 'error') + equal(err.message, 'kaboom') +}) + +test('pino.transport with file URL', async ({ same, teardown }) => { + const destination = file() + const transport = pino.transport({ + target: url.pathToFileURL(join(__dirname, '..', 'fixtures', 'to-file-transport.js')).href, + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport errors if file does not exists', ({ plan, pass }) => { + plan(1) + const instance = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'non-existent-file'), + worker: { + stdin: true, + stdout: true, + stderr: true + } + }) + instance.on('error', function () { + pass('error received') + }) +}) + +test('pino.transport errors if transport worker module does not export a function', ({ plan, equal }) => { + // TODO: add case for non-pipelined single target (needs changes in thread-stream) + plan(2) + const manyTargetsInstance = pino.transport({ + targets: [{ + level: 'info', + target: join(__dirname, '..', 'fixtures', 'transport-wrong-export-type.js') + }, { + level: 'info', + target: join(__dirname, '..', 'fixtures', 'transport-wrong-export-type.js') + }] + }) + manyTargetsInstance.on('error', function (e) { + equal(e.message, 'exported worker is not a function') + }) + + const pipelinedInstance = pino.transport({ + pipeline: [{ + target: join(__dirname, '..', 'fixtures', 'transport-wrong-export-type.js') + }] + }) + pipelinedInstance.on('error', function (e) { + equal(e.message, 'exported worker is not a function') + }) +}) + +test('pino.transport with esm', async ({ same, teardown }) => { + const destination = file() + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.mjs'), + options: { destination } + }) + const instance = pino(transport) + teardown(transport.end.bind(transport)) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with two files', async ({ same, teardown }) => { + const dest1 = file() + const dest2 = file() + const transport = pino.transport({ + targets: [{ + level: 'info', + target: 'file://' + join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: dest1 } + }, { + level: 'info', + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: dest2 } + }] + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)]) + const result1 = JSON.parse(await readFile(dest1)) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + const result2 = JSON.parse(await readFile(dest2)) + delete result2.time + same(result2, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with two files and custom levels', async ({ same, teardown }) => { + const dest1 = file() + const dest2 = file() + const transport = pino.transport({ + targets: [{ + level: 'info', + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: dest1 } + }, { + level: 'foo', + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: dest2 } + }], + levels: { trace: 10, debug: 20, info: 30, warn: 40, error: 50, fatal: 60, foo: 25 } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)]) + const result1 = JSON.parse(await readFile(dest1)) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + const result2 = JSON.parse(await readFile(dest2)) + delete result2.time + same(result2, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport without specifying default levels', async ({ same, teardown }) => { + const dest = file() + const transport = pino.transport({ + targets: [{ + level: 'foo', + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: dest } + }], + levels: { foo: 25 } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await Promise.all([watchFileCreated(dest)]) + const result1 = JSON.parse(await readFile(dest)) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with two files and dedupe', async ({ same, teardown }) => { + const dest1 = file() + const dest2 = file() + const transport = pino.transport({ + dedupe: true, + targets: [{ + level: 'info', + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: dest1 } + }, { + level: 'error', + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: dest2 } + }] + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + instance.error('world') + await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)]) + const result1 = JSON.parse(await readFile(dest1)) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + const result2 = JSON.parse(await readFile(dest2)) + delete result2.time + same(result2, { + pid, + hostname, + level: 50, + msg: 'world' + }) +}) + +test('pino.transport with an array including a pino-pretty destination', async ({ same, match, teardown }) => { + const dest1 = file() + const dest2 = file() + const transport = pino.transport({ + targets: [{ + level: 'info', + target: 'pino/file', + options: { + destination: dest1 + } + }, { + level: 'info', + target: 'pino-pretty', + options: { + destination: dest2 + } + }] + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)]) + const result1 = JSON.parse(await readFile(dest1)) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + const actual = (await readFile(dest2)).toString() + match(strip(actual), /\[.*\] INFO.*hello/) +}) + +test('no transport.end()', async ({ same, teardown }) => { + const destination = file() + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination } + }) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('autoEnd = false', async ({ equal, same, teardown }) => { + const destination = file() + const count = process.listenerCount('exit') + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination }, + worker: { autoEnd: false } + }) + teardown(transport.end.bind(transport)) + await once(transport, 'ready') + + const instance = pino(transport) + instance.info('hello') + + await watchFileCreated(destination) + + equal(count, process.listenerCount('exit')) + + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with target and targets', async ({ fail, equal }) => { + try { + pino.transport({ + target: '/a/file', + targets: [{ + target: '/a/file' + }] + }) + fail('must throw') + } catch (err) { + equal(err.message, 'only one of target or targets can be specified') + } +}) + +test('pino.transport with target pino/file', async ({ same, teardown }) => { + const destination = file() + const transport = pino.transport({ + target: 'pino/file', + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with target pino/file and mkdir option', async ({ same, teardown }) => { + const folder = join(tmpdir(), `pino-${process.pid}-mkdir-transport-file`) + const destination = join(folder, 'log.txt') + teardown(() => { + try { + rimraf.sync(folder) + } catch (err) { + // ignore + } + }) + const transport = pino.transport({ + target: 'pino/file', + options: { destination, mkdir: true } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with target pino/file and append option', async ({ same, teardown }) => { + const destination = file() + await writeFile(destination, JSON.stringify({ pid, hostname, time: Date.now(), level: 30, msg: 'hello' })) + const transport = pino.transport({ + target: 'pino/file', + options: { destination, append: false } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('goodbye') + await watchForWrite(destination, '"goodbye"') + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'goodbye' + }) +}) + +test('pino.transport should error with unknown target', async ({ fail, equal }) => { + try { + pino.transport({ + target: 'origin', + caller: 'unknown-file.js' + }) + fail('must throw') + } catch (err) { + equal(err.message, 'unable to determine transport target for "origin"') + } +}) + +test('pino.transport with target pino-pretty', async ({ match, teardown }) => { + const destination = file() + const transport = pino.transport({ + target: 'pino-pretty', + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const actual = await readFile(destination, 'utf8') + match(strip(actual), /\[.*\] INFO.*hello/) +}) + +test('sets worker data informing the transport that pino will send its config', ({ match, plan, teardown }) => { + plan(1) + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'transport-worker-data.js') + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + transport.once('workerData', (workerData) => { + match(workerData.workerData, { pinoWillSendConfig: true }) + }) + instance.info('hello') +}) + +test('sets worker data informing the transport that pino will send its config (frozen file)', ({ match, plan, teardown }) => { + plan(1) + const config = { + transport: { + target: join(__dirname, '..', 'fixtures', 'transport-worker-data.js'), + options: {} + } + } + Object.freeze(config) + Object.freeze(config.transport) + Object.freeze(config.transport.options) + const instance = pino(config) + const transport = instance[pino.symbols.streamSym] + teardown(transport.end.bind(transport)) + transport.once('workerData', (workerData) => { + match(workerData.workerData, { pinoWillSendConfig: true }) + }) + instance.info('hello') +}) + +test('stdout in worker', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, '..', 'fixtures', 'transport-main.js')]) + + for await (const chunk of child.stdout) { + actual += chunk + } + not(strip(actual).match(/Hello/), null) +}) + +test('log and exit on ready', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, '..', 'fixtures', 'transport-exit-on-ready.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + await immediate() + not(strip(actual).match(/Hello/), null) +}) + +test('log and exit before ready', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, '..', 'fixtures', 'transport-exit-immediately.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + await immediate() + not(strip(actual).match(/Hello/), null) +}) + +test('log and exit before ready with async dest', async ({ not }) => { + const destination = file() + const child = execa(process.argv[0], [join(__dirname, '..', 'fixtures', 'transport-exit-immediately-with-async-dest.js'), destination]) + + await once(child, 'exit') + + const actual = await readFile(destination, 'utf8') + not(strip(actual).match(/HELLO/), null) + not(strip(actual).match(/WORLD/), null) +}) + +test('string integer destination', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], [join(__dirname, '..', 'fixtures', 'transport-string-stdout.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + await immediate() + not(strip(actual).match(/Hello/), null) +}) + +test('pino transport options with target', async ({ teardown, same }) => { + const destination = file() + const instance = pino({ + transport: { + target: 'pino/file', + options: { destination } + } + }) + const transportStream = instance[pino.symbols.streamSym] + teardown(transportStream.end.bind(transportStream)) + instance.info('transport option test') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'transport option test' + }) +}) + +test('pino transport options with targets', async ({ teardown, same }) => { + const dest1 = file() + const dest2 = file() + const instance = pino({ + transport: { + targets: [ + { target: 'pino/file', options: { destination: dest1 } }, + { target: 'pino/file', options: { destination: dest2 } } + ] + } + }) + const transportStream = instance[pino.symbols.streamSym] + teardown(transportStream.end.bind(transportStream)) + instance.info('transport option test') + + await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)]) + const result1 = JSON.parse(await readFile(dest1)) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'transport option test' + }) + const result2 = JSON.parse(await readFile(dest2)) + delete result2.time + same(result2, { + pid, + hostname, + level: 30, + msg: 'transport option test' + }) +}) + +test('transport options with target and targets', async ({ fail, equal }) => { + try { + pino({ + transport: { + target: {}, + targets: {} + } + }) + fail('must throw') + } catch (err) { + equal(err.message, 'only one of target or targets can be specified') + } +}) + +test('transport options with target and stream', async ({ fail, equal }) => { + try { + pino({ + transport: { + target: {} + } + }, '/log/null') + fail('must throw') + } catch (err) { + equal(err.message, 'only one of option.transport or stream can be specified') + } +}) + +test('transport options with stream', async ({ fail, equal, teardown }) => { + try { + const dest1 = file() + const transportStream = pino.transport({ target: 'pino/file', options: { destination: dest1 } }) + teardown(transportStream.end.bind(transportStream)) + pino({ + transport: transportStream + }) + fail('must throw') + } catch (err) { + equal(err.message, 'option.transport do not allow stream, please pass to option directly. e.g. pino(transport)') + } +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.test.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..deca48a067fe60fe52e9bc8ea714d4c7474e2520 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.test.ts @@ -0,0 +1,236 @@ +import * as os from 'node:os' +import { join } from 'node:path' +import { once } from 'node:events' +import fs from 'node:fs' +import { watchFileCreated } from '../helper' +import { test } from 'tap' +import pino from '../../' +import * as url from 'node:url' +import { default as strip } from 'strip-ansi' +import execa from 'execa' +import writer from 'flush-write-stream' + +if (process.platform === 'win32') { + // TODO: Implement .ts files loading support for Windows + process.exit() +} + +const readFile = fs.promises.readFile +const { pid } = process +const hostname = os.hostname() + +test('pino.transport with file', async ({ same, teardown }) => { + const destination = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.ts'), + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination, { encoding: 'utf8' })) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with file (no options + error handling)', async ({ equal }) => { + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.ts') + }) + const [err] = await once(transport, 'error') + equal(err.message, 'kaboom') +}) + +test('pino.transport with file URL', async ({ same, teardown }) => { + const destination = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const transport = pino.transport({ + target: url.pathToFileURL(join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.ts')).href, + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination, { encoding: 'utf8' })) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('pino.transport with two files', async ({ same, teardown }) => { + const dest1 = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const dest2 = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const transport = pino.transport({ + targets: [{ + level: 'info', + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.ts'), + options: { destination: dest1 } + }, { + level: 'info', + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.ts'), + options: { destination: dest2 } + }] + }) + + teardown(transport.end.bind(transport)) + + const instance = pino(transport) + instance.info('hello') + + await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)]) + + const result1 = JSON.parse(await readFile(dest1, { encoding: 'utf8' })) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + const result2 = JSON.parse(await readFile(dest2, { encoding: 'utf8' })) + delete result2.time + same(result2, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('no transport.end()', async ({ same, teardown }) => { + const destination = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.ts'), + options: { destination } + }) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination, { encoding: 'utf8' })) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('autoEnd = false', async ({ equal, same, teardown }) => { + const destination = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const count = process.listenerCount('exit') + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'ts', 'to-file-transport.ts'), + options: { destination }, + worker: { autoEnd: false } + }) + teardown(transport.end.bind(transport)) + await once(transport, 'ready') + + const instance = pino(transport) + instance.info('hello') + + await watchFileCreated(destination) + + equal(count, process.listenerCount('exit')) + + const result = JSON.parse(await readFile(destination, { encoding: 'utf8' })) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('stdout in worker', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], ['-r', 'ts-node/register', join(__dirname, '..', 'fixtures', 'ts', 'transport-main.ts')]) + + child.stdout?.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + not(strip(actual).match(/Hello/), null) +}) + +test('log and exit on ready', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], ['-r', 'ts-node/register', join(__dirname, '..', 'fixtures', 'ts', 'transport-exit-on-ready.ts')]) + + child.stdout?.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + not(strip(actual).match(/Hello/), null) +}) + +test('log and exit before ready', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], ['-r', 'ts-node/register', join(__dirname, '..', 'fixtures', 'ts', 'transport-exit-immediately.ts')]) + + child.stdout?.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + not(strip(actual).match(/Hello/), null) +}) + +test('log and exit before ready with async dest', async ({ not }) => { + const destination = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const child = execa(process.argv[0], ['-r', 'ts-node/register', join(__dirname, '..', 'fixtures', 'ts', 'transport-exit-immediately-with-async-dest.ts'), destination]) + + await once(child, 'exit') + + const actual = await readFile(destination, { encoding: 'utf8' }) + + not(strip(actual).match(/HELLO/), null) + not(strip(actual).match(/WORLD/), null) +}) + +test('string integer destination', async ({ not }) => { + let actual = '' + const child = execa(process.argv[0], ['-r', 'ts-node/register', join(__dirname, '..', 'fixtures', 'ts', 'transport-string-stdout.ts')]) + + child.stdout?.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + not(strip(actual).match(/Hello/), null) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.transpiled.test.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.transpiled.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..a53b3460719965c40bfd9af7fb4da1b1f951e606 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/core.transpiled.test.ts @@ -0,0 +1,112 @@ +import * as os from 'node:os' +import { join } from 'node:path' +import fs from 'node:fs' +import { watchFileCreated } from '../helper' +import { test } from 'tap' +import pino from '../../' +import * as url from 'node:url' + +const readFile = fs.promises.readFile + +const { pid } = process +const hostname = os.hostname() + +// A subset of the test from core.test.js, we don't need all of them to check for compatibility +function runTests(esVersion: string): void { + test(`(ts -> ${esVersion}) pino.transport with file`, async ({ same, teardown }) => { + const destination = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'ts', `to-file-transport.${esVersion}.cjs`), + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination, { encoding: 'utf8' })) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + }) + + test(`(ts -> ${esVersion}) pino.transport with file URL`, async ({ same, teardown }) => { + const destination = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const transport = pino.transport({ + target: url.pathToFileURL(join(__dirname, '..', 'fixtures', 'ts', `to-file-transport.${esVersion}.cjs`)).href, + options: { destination } + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination, { encoding: 'utf8' })) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + }) + + test(`(ts -> ${esVersion}) pino.transport with two files`, async ({ same, teardown }) => { + const dest1 = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const dest2 = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const transport = pino.transport({ + targets: [{ + level: 'info', + target: join(__dirname, '..', 'fixtures', 'ts', `to-file-transport.${esVersion}.cjs`), + options: { destination: dest1 } + }, { + level: 'info', + target: join(__dirname, '..', 'fixtures', 'ts', `to-file-transport.${esVersion}.cjs`), + options: { destination: dest2 } + }] + }) + + teardown(transport.end.bind(transport)) + + const instance = pino(transport) + instance.info('hello') + + await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)]) + + const result1 = JSON.parse(await readFile(dest1, { encoding: 'utf8' })) + delete result1.time + same(result1, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + const result2 = JSON.parse(await readFile(dest2, { encoding: 'utf8' })) + delete result2.time + same(result2, { + pid, + hostname, + level: 30, + msg: 'hello' + }) + }) +} + +runTests('es5') +runTests('es6') +runTests('es2017') +runTests('esnext') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/crash.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/crash.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b5e31fe2a2bbbd266ea76c84e466015749704aa1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/crash.test.js @@ -0,0 +1,34 @@ +'use strict' + +const { join } = require('node:path') +const { once } = require('node:events') +const { setImmediate: immediate } = require('node:timers/promises') +const { test } = require('tap') +const pino = require('../../') + +test('pino.transport emits error if the worker exits with 0 unexpectably', async ({ same, teardown, equal }) => { + // This test will take 10s, because flushSync waits for 10s + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'crashing-transport.js'), + sync: true + }) + teardown(transport.end.bind(transport)) + + await once(transport, 'ready') + + let maybeError + transport.on('error', (err) => { + maybeError = err + }) + + const logger = pino(transport) + for (let i = 0; i < 100000; i++) { + logger.info('hello') + } + + await once(transport.worker, 'exit') + + await immediate() + + same(maybeError.message, 'the worker has exited') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/module-link.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/module-link.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2210b873587bb3f302e0ef363e52a09e403e729d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/module-link.test.js @@ -0,0 +1,239 @@ +'use strict' + +const os = require('node:os') +const { join } = require('node:path') +const { readFile, symlink, unlink, mkdir, writeFile } = require('node:fs').promises +const { test } = require('tap') +const { isWin, isYarnPnp, watchFileCreated, file } = require('../helper') +const { once } = require('node:events') +const execa = require('execa') +const pino = require('../../') +const rimraf = require('rimraf') + +const { pid } = process +const hostname = os.hostname() + +async function installTransportModule (target) { + if (isYarnPnp) { + return + } + try { + await uninstallTransportModule() + } catch {} + + if (!target) { + target = join(__dirname, '..', '..') + } + + await symlink( + join(__dirname, '..', 'fixtures', 'transport'), + join(target, 'node_modules', 'transport') + ) +} + +async function uninstallTransportModule () { + if (isYarnPnp) { + return + } + await unlink(join(__dirname, '..', '..', 'node_modules', 'transport')) +} + +// TODO make this test pass on Windows +test('pino.transport with package', { skip: isWin }, async ({ same, teardown }) => { + const destination = file() + + await installTransportModule() + + const transport = pino.transport({ + target: 'transport', + options: { destination } + }) + + teardown(async () => { + await uninstallTransportModule() + transport.end() + }) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +// TODO make this test pass on Windows +test('pino.transport with package as a target', { skip: isWin }, async ({ same, teardown }) => { + const destination = file() + + await installTransportModule() + + const transport = pino.transport({ + targets: [{ + target: 'transport', + options: { destination } + }] + }) + teardown(async () => { + await uninstallTransportModule() + transport.end() + }) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +// TODO make this test pass on Windows +test('pino({ transport })', { skip: isWin || isYarnPnp }, async ({ same, teardown }) => { + const folder = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + + teardown(() => { + rimraf.sync(folder) + }) + + const destination = join(folder, 'output') + + await mkdir(join(folder, 'node_modules'), { recursive: true }) + + // Link pino + await symlink( + join(__dirname, '..', '..'), + join(folder, 'node_modules', 'pino') + ) + + await installTransportModule(folder) + + const toRun = join(folder, 'index.js') + + const toRunContent = ` + const pino = require('pino') + const logger = pino({ + transport: { + target: 'transport', + options: { destination: '${destination}' } + } + }) + logger.info('hello') + ` + + await writeFile(toRun, toRunContent) + + const child = execa(process.argv[0], [toRun]) + + await once(child, 'close') + + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid: child.pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +// TODO make this test pass on Windows +test('pino({ transport }) from a wrapped dependency', { skip: isWin || isYarnPnp }, async ({ same, teardown }) => { + const folder = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + + const wrappedFolder = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + + const destination = join(folder, 'output') + + await mkdir(join(folder, 'node_modules'), { recursive: true }) + await mkdir(join(wrappedFolder, 'node_modules'), { recursive: true }) + + teardown(() => { + rimraf.sync(wrappedFolder) + rimraf.sync(folder) + }) + + // Link pino + await symlink( + join(__dirname, '..', '..'), + join(wrappedFolder, 'node_modules', 'pino') + ) + + // Link get-caller-file + await symlink( + join(__dirname, '..', '..', 'node_modules', 'get-caller-file'), + join(wrappedFolder, 'node_modules', 'get-caller-file') + ) + + // Link wrapped + await symlink( + wrappedFolder, + join(folder, 'node_modules', 'wrapped') + ) + + await installTransportModule(folder) + + const pkgjsonContent = { + name: 'pino' + } + + await writeFile(join(wrappedFolder, 'package.json'), JSON.stringify(pkgjsonContent)) + + const wrapped = join(wrappedFolder, 'index.js') + + const wrappedContent = ` + const pino = require('pino') + const getCaller = require('get-caller-file') + + module.exports = function build () { + const logger = pino({ + transport: { + caller: getCaller(), + target: 'transport', + options: { destination: '${destination}' } + } + }) + return logger + } + ` + + await writeFile(wrapped, wrappedContent) + + const toRun = join(folder, 'index.js') + + const toRunContent = ` + const logger = require('wrapped')() + logger.info('hello') + ` + + await writeFile(toRun, toRunContent) + + const child = execa(process.argv[0], [toRun]) + + await once(child, 'close') + + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid: child.pid, + hostname, + level: 30, + msg: 'hello' + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/pipeline.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/pipeline.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c682b76a4815c2773df81f1c6fb13d6ded7ac44f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/pipeline.test.js @@ -0,0 +1,135 @@ +'use strict' + +const os = require('node:os') +const { join } = require('node:path') +const { readFile } = require('node:fs').promises +const { watchFileCreated, file } = require('../helper') +const { test } = require('tap') +const pino = require('../../') +const { DEFAULT_LEVELS } = require('../../lib/constants') + +const { pid } = process +const hostname = os.hostname() + +test('pino.transport with a pipeline', async ({ same, teardown }) => { + const destination = file() + const transport = pino.transport({ + pipeline: [{ + target: join(__dirname, '..', 'fixtures', 'transport-transform.js') + }, { + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination } + }] + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: DEFAULT_LEVELS.info, + msg: 'hello', + service: 'pino' // this property was added by the transform + }) +}) + +test('pino.transport with targets containing pipelines', async ({ same, teardown }) => { + const destinationA = file() + const destinationB = file() + const transport = pino.transport({ + targets: [ + { + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: destinationA } + }, + { + pipeline: [ + { + target: join(__dirname, '..', 'fixtures', 'transport-transform.js') + }, + { + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: destinationB } + } + ] + } + ] + }) + + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello') + await watchFileCreated(destinationA) + await watchFileCreated(destinationB) + const resultA = JSON.parse(await readFile(destinationA)) + const resultB = JSON.parse(await readFile(destinationB)) + delete resultA.time + delete resultB.time + same(resultA, { + pid, + hostname, + level: DEFAULT_LEVELS.info, + msg: 'hello' + }) + same(resultB, { + pid, + hostname, + level: DEFAULT_LEVELS.info, + msg: 'hello', + service: 'pino' // this property was added by the transform + }) +}) + +test('pino.transport with targets containing pipelines with levels defined and dedupe', async ({ same, teardown }) => { + const destinationA = file() + const destinationB = file() + const transport = pino.transport({ + targets: [ + { + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: destinationA }, + level: DEFAULT_LEVELS.info + }, + { + pipeline: [ + { + target: join(__dirname, '..', 'fixtures', 'transport-transform.js') + }, + { + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: destinationB } + } + ], + level: DEFAULT_LEVELS.error + } + ], + dedupe: true + }) + + teardown(transport.end.bind(transport)) + const instance = pino(transport) + instance.info('hello info') + instance.error('hello error') + await watchFileCreated(destinationA) + await watchFileCreated(destinationB) + const resultA = JSON.parse(await readFile(destinationA)) + const resultB = JSON.parse(await readFile(destinationB)) + delete resultA.time + delete resultB.time + same(resultA, { + pid, + hostname, + level: DEFAULT_LEVELS.info, + msg: 'hello info' + }) + same(resultB, { + pid, + hostname, + level: DEFAULT_LEVELS.error, + msg: 'hello error', + service: 'pino' // this property was added by the transform + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/repl.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/repl.test.js new file mode 100644 index 0000000000000000000000000000000000000000..103beade76e8ec88969252cddff27672390d901f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/repl.test.js @@ -0,0 +1,14 @@ +'use strict' + +const { doesNotThrow, test } = require('tap') +const proxyquire = require('proxyquire') + +test('pino.transport resolves targets in REPL', async ({ same }) => { + // Arrange + const transport = proxyquire('../../lib/transport', { + './caller': () => ['node:repl'] + }) + + // Act / Assert + doesNotThrow(() => transport({ target: 'pino-pretty' })) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/syncTrue.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/syncTrue.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1d34ebce11d89b163050f0ae7695acdc38fc9984 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/syncTrue.test.js @@ -0,0 +1,55 @@ +'use strict' + +const pino = require('../..') +const { join } = require('node:path') +const { readFileSync } = require('node:fs') +const { test } = require('tap') +const { file } = require('../helper') + +test('thread-stream sync true should log synchronously', async (t) => { + const outputPath = file() + + function getOutputLogLines () { + return (readFileSync(outputPath)).toString().trim().split('\n').map(JSON.parse) + } + + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: outputPath, flush: true }, + sync: true + }) + const instance = pino(transport) + + var value = { message: 'sync' } + instance.info(value) + instance.info(value) + instance.info(value) + instance.info(value) + instance.info(value) + instance.info(value) + let interrupt = false + let flushData + let loopCounter = 0 + + // Start a synchronous loop + while (!interrupt && loopCounter < (process.env.MAX_TEST_LOOP_ITERATION || 20000)) { + try { + loopCounter++ + const data = getOutputLogLines() + flushData = data + if (data) { + interrupt = true + break + } + } catch (error) { + // File may not exist yet + // Wait till MAX_TEST_LOOP_ITERATION iterations + } + } + + if (!interrupt) { + throw new Error('Sync loop did not get interrupt') + } + + t.equal(flushData.length, 6) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/syncfalse.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/syncfalse.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c5f76925abb86b073ec6a5edcb02884a3d6803d8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/syncfalse.test.js @@ -0,0 +1,68 @@ +'use strict' + +const os = require('node:os') +const pino = require('../..') +const { join } = require('node:path') +const { test } = require('tap') +const { readFile } = require('node:fs').promises +const { watchFileCreated, file } = require('../helper') +const { promisify } = require('node:util') + +const { pid } = process +const hostname = os.hostname() + +test('thread-stream async flush', async ({ equal, same }) => { + const destination = file() + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination } + }) + const instance = pino(transport) + instance.info('hello') + + equal(instance.flush(), undefined) + + await watchFileCreated(destination) + const result = JSON.parse(await readFile(destination)) + delete result.time + same(result, { + pid, + hostname, + level: 30, + msg: 'hello' + }) +}) + +test('thread-stream async flush should call the passed callback', async (t) => { + const outputPath = file() + async function getOutputLogLines () { + return (await readFile(outputPath)).toString().trim().split('\n').map(JSON.parse) + } + const transport = pino.transport({ + target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + options: { destination: outputPath } + }) + const instance = pino(transport) + const flushPromise = promisify(instance.flush).bind(instance) + + instance.info('hello') + await flushPromise() + await watchFileCreated(outputPath) + + const [firstFlushData] = await getOutputLogLines() + + t.equal(firstFlushData.msg, 'hello') + + // should not flush this as no data accumulated that's bigger than min length + instance.info('world') + + // Making sure data is not flushed yet + const afterLogData = await getOutputLogLines() + t.equal(afterLogData.length, 1) + + await flushPromise() + + // Making sure data is not flushed yet + const afterSecondFlush = (await getOutputLogLines())[1] + t.equal(afterSecondFlush.msg, 'world') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/targets.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/targets.test.js new file mode 100644 index 0000000000000000000000000000000000000000..14faa9135a4cd3d187f5732dcd9ff5e8d7c4fd05 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/targets.test.js @@ -0,0 +1,44 @@ +'use strict' + +const { test } = require('tap') +const { join } = require('node:path') +const proxyquire = require('proxyquire') +const Writable = require('node:stream').Writable +const pino = require('../../pino') + +test('file-target mocked', async function ({ equal, same, plan, pass }) { + plan(1) + let ret + const fileTarget = proxyquire('../../file', { + './pino': { + destination (opts) { + same(opts, { dest: 1, sync: false }) + + ret = new Writable() + ret.fd = opts.dest + + process.nextTick(() => { + ret.emit('ready') + }) + + return ret + } + } + }) + + await fileTarget() +}) + +test('pino.transport with syntax error', ({ same, teardown, plan }) => { + plan(1) + const transport = pino.transport({ + targets: [{ + target: join(__dirname, '..', 'fixtures', 'syntax-error-esm.mjs') + }] + }) + teardown(transport.end.bind(transport)) + + transport.on('error', (err) => { + same(err, new SyntaxError('Unexpected end of input')) + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/uses-pino-config.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/uses-pino-config.test.js new file mode 100644 index 0000000000000000000000000000000000000000..46f2ab36f6106b807349de41c4db8ef7fc7ba99f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/transport/uses-pino-config.test.js @@ -0,0 +1,167 @@ +'use strict' + +const os = require('node:os') +const { join } = require('node:path') +const { readFile } = require('node:fs').promises +const writeStream = require('flush-write-stream') +const { watchFileCreated, file } = require('../helper') +const { test } = require('tap') +const pino = require('../../') + +const { pid } = process +const hostname = os.hostname() + +function serializeError (error) { + return { + type: error.name, + message: error.message, + stack: error.stack + } +} + +function parseLogs (buffer) { + return JSON.parse(`[${buffer.toString().replace(/}{/g, '},{')}]`) +} + +test('transport uses pino config', async ({ same, teardown, plan }) => { + plan(1) + const destination = file() + const transport = pino.transport({ + pipeline: [{ + target: join(__dirname, '..', 'fixtures', 'transport-uses-pino-config.js') + }, { + target: 'pino/file', + options: { destination } + }] + }) + teardown(transport.end.bind(transport)) + const instance = pino({ + messageKey: 'customMessageKey', + errorKey: 'customErrorKey', + customLevels: { custom: 35 } + }, transport) + + const error = new Error('bar') + instance.custom('foo') + instance.error(error) + await watchFileCreated(destination) + const result = parseLogs(await readFile(destination)) + + same(result, [{ + severityText: 'custom', + body: 'foo', + attributes: { + pid, + hostname + } + }, { + severityText: 'error', + body: 'bar', + attributes: { + pid, + hostname + }, + error: serializeError(error) + }]) +}) + +test('transport uses pino config without customizations', async ({ same, teardown, plan }) => { + plan(1) + const destination = file() + const transport = pino.transport({ + pipeline: [{ + target: join(__dirname, '..', 'fixtures', 'transport-uses-pino-config.js') + }, { + target: 'pino/file', + options: { destination } + }] + }) + teardown(transport.end.bind(transport)) + const instance = pino(transport) + + const error = new Error('qux') + instance.info('baz') + instance.error(error) + await watchFileCreated(destination) + const result = parseLogs(await readFile(destination)) + + same(result, [{ + severityText: 'info', + body: 'baz', + attributes: { + pid, + hostname + } + }, { + severityText: 'error', + body: 'qux', + attributes: { + pid, + hostname + }, + error: serializeError(error) + }]) +}) + +test('transport uses pino config with multistream', async ({ same, teardown, plan }) => { + plan(2) + const destination = file() + const messages = [] + const stream = writeStream(function (data, enc, cb) { + const message = JSON.parse(data) + delete message.time + messages.push(message) + cb() + }) + const transport = pino.transport({ + pipeline: [{ + target: join(__dirname, '..', 'fixtures', 'transport-uses-pino-config.js') + }, { + target: 'pino/file', + options: { destination } + }] + }) + teardown(transport.end.bind(transport)) + const instance = pino({ + messageKey: 'customMessageKey', + errorKey: 'customErrorKey', + customLevels: { custom: 35 } + }, pino.multistream([transport, { stream }])) + + const error = new Error('buzz') + const serializedError = serializeError(error) + instance.custom('fizz') + instance.error(error) + await watchFileCreated(destination) + const result = parseLogs(await readFile(destination)) + + same(result, [{ + severityText: 'custom', + body: 'fizz', + attributes: { + pid, + hostname + } + }, { + severityText: 'error', + body: 'buzz', + attributes: { + pid, + hostname + }, + error: serializedError + }]) + + same(messages, [{ + level: 35, + pid, + hostname, + customMessageKey: 'fizz' + }, { + level: 50, + pid, + hostname, + customErrorKey: serializedError, + customMessageKey: 'buzz' + }]) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-import.test-d.cts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-import.test-d.cts new file mode 100644 index 0000000000000000000000000000000000000000..887c23de59e2851848476542fe7346cf8a05d342 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-import.test-d.cts @@ -0,0 +1,29 @@ +import { expectType } from "tsd"; + +import pino from '../../pino'; +import P, { pino as pinoNamed } from "../../pino"; +import * as pinoStar from "../../pino"; +import pinoCjsImport = require ("../../pino"); +const pinoCjs = require("../../pino"); +const { P: pinoCjsNamed } = require('pino') + +const log = pino(); +expectType(log.info); +expectType(log.error); + +expectType(pinoNamed()); +expectType(pinoNamed()); +expectType(pinoStar.default()); +expectType(pinoStar.pino()); +// expectType(pinoCjsImport.default()); +expectType(pinoCjsImport.pino()); +expectType(pinoCjsNamed()); +expectType(pinoCjs()); + +const levelChangeEventListener: P.LevelChangeEventListener = ( + lvl: P.LevelWithSilent | string, + val: number, + prevLvl: P.LevelWithSilent | string, + prevVal: number, +) => {} +expectType(levelChangeEventListener) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-multistream.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-multistream.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6206eca9f7d7fccedf844354c821ab9d7f1628fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-multistream.test-d.ts @@ -0,0 +1,28 @@ +import { expectType } from 'tsd' + +import { createWriteStream } from 'node:fs' + +import pino, { multistream } from '../../pino' + +const streams = [ + { stream: process.stdout }, + { stream: createWriteStream('') }, + { level: 'error' as const, stream: process.stderr }, + { level: 'fatal' as const, stream: process.stderr }, +] + +expectType(pino.multistream(process.stdout)) +expectType(pino.multistream([createWriteStream('')])) +expectType>(pino.multistream({ level: 'error' as const, stream: process.stderr })) +expectType>(pino.multistream([{ level: 'fatal' as const, stream: createWriteStream('') }])) + +expectType>(pino.multistream(streams)) +expectType>(pino.multistream(streams, {})) +expectType>(pino.multistream(streams, { levels: { 'info': 30 } })) +expectType>(pino.multistream(streams, { dedupe: true })) +expectType>(pino.multistream(streams[0]).add(streams[1])) +expectType>(multistream(streams)) +expectType>(multistream(streams).clone('error')) + + +expectType(multistream(process.stdout)); diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-top-export.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-top-export.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9efd8c494a1a68fbc52333cbd17a351d1f48b5cf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-top-export.test-d.ts @@ -0,0 +1,35 @@ +import { expectType, expectAssignable } from 'tsd' +import type { SonicBoom } from "sonic-boom"; + +import { + destination, + LevelMapping, + levels, + Logger, + multistream, + MultiStreamRes, + SerializedError, + stdSerializers, + stdTimeFunctions, + symbols, + transport, + version, +} from "../../pino"; +import pino from "../../pino"; + +expectType(destination("")); +expectType(levels); +expectType(multistream(process.stdout)); +expectType(stdSerializers.err({} as any)); +expectType(stdTimeFunctions.isoTime()); +expectType(version); + +// Can't test against `unique symbol`, see https://github.com/SamVerschueren/tsd/issues/49 +expectAssignable(symbols.endSym); + +// TODO: currently returns (aliased) `any`, waiting for strong typed `thread-stream` +transport({ + target: '#pino/pretty', + options: { some: 'options for', the: 'transport' } +}); + diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-transport.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-transport.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0156dc1c46349ae16ea7172df77cf6bcce237638 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-transport.test-d.ts @@ -0,0 +1,145 @@ +import pino from '../../pino' +import { expectType } from "tsd"; + +// Single +const transport = pino.transport({ + target: '#pino/pretty', + options: { some: 'options for', the: 'transport' } +}) +pino(transport) + +expectType(pino({ + transport: { + target: 'pino-pretty' + }, +})) + +// Multiple +const transports = pino.transport({targets: [ + { + level: 'info', + target: '#pino/pretty', + options: { some: 'options for', the: 'transport' } + }, + { + level: 'trace', + target: '#pino/file', + options: { destination: './test.log' } + } +]}) +pino(transports) + +expectType(pino({ + transport: {targets: [ + { + level: 'info', + target: '#pino/pretty', + options: { some: 'options for', the: 'transport' } + }, + { + level: 'trace', + target: '#pino/file', + options: { destination: './test.log' } + } + ]}, +})) + +const transportsWithCustomLevels = pino.transport({targets: [ + { + level: 'info', + target: '#pino/pretty', + options: { some: 'options for', the: 'transport' } + }, + { + level: 'foo', + target: '#pino/file', + options: { destination: './test.log' } + } +], levels: { foo: 35 }}) +pino(transports) + +expectType(pino({ + transport: {targets: [ + { + level: 'info', + target: '#pino/pretty', + options: { some: 'options for', the: 'transport' } + }, + { + level: 'trace', + target: '#pino/file', + options: { destination: './test.log' } + } + ], levels: { foo: 35 } + }, +})) + +const transportsWithoutOptions = pino.transport({ + targets: [ + { target: '#pino/pretty' }, + { target: '#pino/file' } + ], levels: { foo: 35 } +}) +pino(transports) + +expectType(pino({ + transport: { + targets: [ + { target: '#pino/pretty' }, + { target: '#pino/file' } + ], levels: { foo: 35 } + }, +})) + +const pipelineTransport = pino.transport({ + pipeline: [{ + target: './my-transform.js' + }, { + // Use target: 'pino/file' to write to stdout + // without any change. + target: 'pino-pretty' + }] +}) +pino(pipelineTransport) + +expectType(pino({ + transport: { + pipeline: [{ + target: './my-transform.js' + }, { + // Use target: 'pino/file' to write to stdout + // without any change. + target: 'pino-pretty' + }] + } +})) + +type TransportConfig = { + id: string +} + +// Custom transport params +const customTransport = pino.transport({ + target: 'custom', + options: { id: 'abc' } +}) +pino(customTransport) + +// Worker +pino.transport({ + target: 'custom', + worker: { + argv: ['a', 'b'], + stdin: false, + stderr: true, + stdout: false, + autoEnd: true, + }, + options: { id: 'abc' } +}) + +// Dedupe +pino.transport({ + targets: [], + dedupe: true, +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-type-only.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-type-only.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..99c66d493a3f5c7a9bc9acdd36102232c984ff51 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino-type-only.test-d.ts @@ -0,0 +1,59 @@ +import { expectAssignable, expectType, expectNotAssignable } from "tsd"; + +import pino from "../../"; +import type {LevelWithSilent, Logger, LogFn, DestinationStreamWithMetadata, Level, LevelOrString, LevelWithSilentOrString, LoggerExtras, LoggerOptions } from "../../pino"; + +// NB: can also use `import * as pino`, but that form is callable as `pino()` +// under `esModuleInterop: false` or `pino.default()` under `esModuleInterop: true`. +const log = pino(); +expectAssignable(log); +expectType(log); +expectType(log.info); + +expectType>([log.level]); + +const level: Level = 'debug'; +expectAssignable(level); + +const levelWithSilent: LevelWithSilent = 'silent'; +expectAssignable(levelWithSilent); + +const levelOrString: LevelOrString = "myCustomLevel"; +expectAssignable(levelOrString); +expectNotAssignable(levelOrString); +expectNotAssignable(levelOrString); +expectAssignable(levelOrString); + +const levelWithSilentOrString: LevelWithSilentOrString = "myCustomLevel"; +expectAssignable(levelWithSilentOrString); +expectNotAssignable(levelWithSilentOrString); +expectNotAssignable(levelWithSilentOrString); +expectAssignable(levelWithSilentOrString); + +function createStream(): DestinationStreamWithMetadata { + return { write() {} }; +} + +const stream = createStream(); +// Argh. TypeScript doesn't seem to narrow unless we assign the symbol like so, and tsd seems to +// break without annotating the type explicitly +const needsMetadata: typeof pino.symbols.needsMetadataGsym = pino.symbols.needsMetadataGsym; +if (stream[needsMetadata]) { + expectType(stream.lastLevel); +} + +const loggerOptions:LoggerOptions = { + browser: { + formatters: { + log(obj) { + return obj + }, + level(label, number) { + return { label, number} + } + + } + } +} + +expectType(loggerOptions) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..710016a90a7cd836dc201296a00aa59b53c6f8a1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino.test-d.ts @@ -0,0 +1,528 @@ +import { IncomingMessage, ServerResponse } from "http"; +import { Socket } from "net"; +import { expectError, expectType } from 'tsd'; +import pino, { LoggerOptions } from "../../"; +import Logger = pino.Logger; + +const log = pino(); +const info = log.info; +const error = log.error; + +info("hello world"); +error("this is at error level"); + +// primitive types +info('simple string'); +info(true) +info(42); +info(3.14); +info(null); +info(undefined); + +// object types +info({ a: 1, b: '2' }); +info(new Error()); +info(new Date()); +info([]) +info(new Map()); +info(new Set()); + +// placeholder messages +info('Hello %s', 'world'); +info('The answer is %d', 42); +info('The object is %o', { a: 1, b: '2' }); +info('The json is %j', { a: 1, b: '2' }); +info('The object is %O', { a: 1, b: '2' }); +info('The answer is %d and the question is %s with %o', 42, 'unknown', { correct: 'order' }); +info('Missing placeholder is fine %s'); +declare const errorOrString: string | Error; +info(errorOrString) + +// placeholder messages type errors +expectError(info('Hello %s', 123)); +expectError(info('Hello %s', false)); +expectError(info('The answer is %d', 'not a number')); +expectError(info('The object is %o', 'not an object')); +expectError(info('The object is %j', 'not a JSON')); +expectError(info('The object is %O', 'not an object')); +expectError(info('The answer is %d and the question is %s with %o', 42, { incorrect: 'order' }, 'unknown')); +expectError(info('Extra message %s', 'after placeholder', 'not allowed')); + +// object types with messages +info({ obj: 42 }, "hello world"); +info({ obj: 42, b: 2 }, "hello world"); +info({ obj: { aa: "bbb" } }, "another"); +info({ a: 1, b: '2' }, 'hello world with %s', 'extra data'); + +// Extra message after placeholder +expectError(info({ a: 1, b: '2' }, 'hello world with %d', 2, 'extra' )); + +// metadata with messages type errors +expectError(info({ a: 1, b: '2' }, 'hello world with %s', 123)); + +// metadata after message +expectError(info('message', { a: 1, b: '2' })); + +// multiple strings without placeholder +expectError(info('string1', 'string2')); +expectError(info('string1', 'string2', 'string3')); + +setImmediate(info, "after setImmediate"); +error(new Error("an error")); + +const writeSym = pino.symbols.writeSym; + +const testUniqSymbol = { + [pino.symbols.needsMetadataGsym]: true, +}[pino.symbols.needsMetadataGsym]; + +const log2: pino.Logger = pino({ + name: "myapp", + safe: true, + serializers: { + req: pino.stdSerializers.req, + res: pino.stdSerializers.res, + err: pino.stdSerializers.err, + }, +}); + +pino({ + write(o) {}, +}); + +pino({ + mixin() { + return { customName: "unknown", customId: 111 }; + }, +}); + +pino({ + mixin: () => ({ customName: "unknown", customId: 111 }), +}); + +pino({ + mixin: (context: object) => ({ customName: "unknown", customId: 111 }), +}); + +pino({ + mixin: (context: object, level: number) => ({ customName: "unknown", customId: 111 }), +}); + +pino({ + redact: { paths: [], censor: "SECRET" }, +}); + +pino({ + redact: { paths: [], censor: () => "SECRET" }, +}); + +pino({ + redact: { paths: [], censor: (value) => value }, +}); + +pino({ + redact: { paths: [], censor: (value, path) => path.join() }, +}); + +pino({ + depthLimit: 1 +}); + +pino({ + edgeLimit: 1 +}); + +pino({ + browser: { + write(o) {}, + }, +}); + +pino({ + browser: { + write: { + info(o) {}, + error(o) {}, + }, + serialize: true, + asObject: true, + transmit: { + level: "fatal", + send: (level, logEvent) => { + level; + logEvent.bindings; + logEvent.level; + logEvent.ts; + logEvent.messages; + }, + }, + disabled: false + }, +}); + +pino({ + browser: { + asObjectBindingsOnly: true, + } +}); + +pino({}, undefined); + +pino({ base: null }); +if ("pino" in log) console.log(`pino version: ${log.pino}`); + +expectType(log.flush()); +log.flush((err?: Error) => undefined); +log.child({ a: "property" }).info("hello child!"); +log.level = "error"; +log.info("nope"); +const child = log.child({ foo: "bar" }); +child.info("nope again"); +child.level = "info"; +child.info("hooray"); +log.info("nope nope nope"); +log.child({ foo: "bar" }, { level: "debug" }).debug("debug!"); +child.bindings(); +const customSerializers = { + test() { + return "this is my serializer"; + }, +}; +pino().child({}, { serializers: customSerializers }).info({ test: "should not show up" }); +const child2 = log.child({ father: true }); +const childChild = child2.child({ baby: true }); +const childRedacted = pino().child({}, { redact: ["path"] }) +childRedacted.info({ + msg: "logged with redacted properties", + path: "Not shown", +}); +const childAnotherRedacted = pino().child({}, { + redact: { + paths: ["anotherPath"], + censor: "Not the log you\re looking for", + } +}) +childAnotherRedacted.info({ + msg: "another logged with redacted properties", + anotherPath: "Not shown", +}); + +log.level = "info"; +if (log.levelVal === 30) { + console.log("logger level is `info`"); +} + +const listener = (lvl: any, val: any, prevLvl: any, prevVal: any) => { + console.log(lvl, val, prevLvl, prevVal); +}; +log.on("level-change", (lvl, val, prevLvl, prevVal, logger) => { + console.log(lvl, val, prevLvl, prevVal); +}); +log.level = "trace"; +log.removeListener("level-change", listener); +log.level = "info"; + +pino.levels.values.error === 50; +pino.levels.labels[50] === "error"; + +const logstderr: pino.Logger = pino(process.stderr); +logstderr.error("on stderr instead of stdout"); + +log.useLevelLabels = true; +log.info("lol"); +log.level === "info"; +const isEnabled: boolean = log.isLevelEnabled("info"); + +const redacted = pino({ + redact: ["path"], +}); + +redacted.info({ + msg: "logged with redacted properties", + path: "Not shown", +}); + +const anotherRedacted = pino({ + redact: { + paths: ["anotherPath"], + censor: "Not the log you\re looking for", + }, +}); + +anotherRedacted.info({ + msg: "another logged with redacted properties", + anotherPath: "Not shown", +}); + +const withTimeFn = pino({ + timestamp: pino.stdTimeFunctions.isoTime, +}); + +const withNestedKey = pino({ + nestedKey: "payload", +}); + +const withHooks = pino({ + hooks: { + logMethod(args, method, level) { + expectType(this); + return method.apply(this, args); + }, + streamWrite(s) { + expectType(s); + return s.replaceAll('secret-key', 'xxx'); + }, + }, +}); + +// Properties/types imported from pino-std-serializers +const wrappedErrSerializer = pino.stdSerializers.wrapErrorSerializer((err: pino.SerializedError) => { + return { ...err, newProp: "foo" }; +}); +const wrappedReqSerializer = pino.stdSerializers.wrapRequestSerializer((req: pino.SerializedRequest) => { + return { ...req, newProp: "foo" }; +}); +const wrappedResSerializer = pino.stdSerializers.wrapResponseSerializer((res: pino.SerializedResponse) => { + return { ...res, newProp: "foo" }; +}); + +const socket = new Socket(); +const incomingMessage = new IncomingMessage(socket); +const serverResponse = new ServerResponse(incomingMessage); + +const mappedHttpRequest: { req: pino.SerializedRequest } = pino.stdSerializers.mapHttpRequest(incomingMessage); +const mappedHttpResponse: { res: pino.SerializedResponse } = pino.stdSerializers.mapHttpResponse(serverResponse); + +const serializedErr: pino.SerializedError = pino.stdSerializers.err(new Error()); +const serializedReq: pino.SerializedRequest = pino.stdSerializers.req(incomingMessage); +const serializedRes: pino.SerializedResponse = pino.stdSerializers.res(serverResponse); + +/** + * Destination static method + */ +const destinationViaDefaultArgs = pino.destination(); +const destinationViaStrFileDescriptor = pino.destination("/log/path"); +const destinationViaNumFileDescriptor = pino.destination(2); +const destinationViaStream = pino.destination(process.stdout); +const destinationViaOptionsObject = pino.destination({ dest: "/log/path", sync: false }); + +pino(destinationViaDefaultArgs); +pino({ name: "my-logger" }, destinationViaDefaultArgs); +pino(destinationViaStrFileDescriptor); +pino({ name: "my-logger" }, destinationViaStrFileDescriptor); +pino(destinationViaNumFileDescriptor); +pino({ name: "my-logger" }, destinationViaNumFileDescriptor); +pino(destinationViaStream); +pino({ name: "my-logger" }, destinationViaStream); +pino(destinationViaOptionsObject); +pino({ name: "my-logger" }, destinationViaOptionsObject); + +try { + throw new Error('Some error') +} catch (err) { + log.error(err) +} + +interface StrictShape { + activity: string; + err?: unknown; +} + +info({ + activity: "Required property", +}); + +const logLine: pino.LogDescriptor = { + level: 20, + msg: "A log message", + time: new Date().getTime(), + aCustomProperty: true, +}; + +interface CustomLogger extends pino.Logger { + customMethod(msg: string, ...args: unknown[]): void; +} + +const serializerFunc: pino.SerializerFn = () => {} +const writeFunc: pino.WriteFn = () => {} + +interface CustomBaseLogger extends pino.BaseLogger { + child(): CustomBaseLogger +} + +const customBaseLogger: CustomBaseLogger = { + level: 'info', + fatal() {}, + error() {}, + warn() {}, + info() {}, + debug() {}, + trace() {}, + silent() {}, + child() { return this }, + msgPrefix: 'prefix', +} + +// custom levels +const log3 = pino({ customLevels: { myLevel: 100 } }) +expectError(log3.log()) +log3.level = 'myLevel' +log3.myLevel('') +log3.child({}).myLevel('') + +log3.on('level-change', (lvl, val, prevLvl, prevVal, instance) => { + instance.myLevel('foo'); +}); + +const clog3 = log3.child({}, { customLevels: { childLevel: 120 } }) +// child inherit parent +clog3.myLevel('') +// child itself +clog3.childLevel('') +const cclog3 = clog3.child({}, { customLevels: { childLevel2: 130 } }) +// child inherit root +cclog3.myLevel('') +// child inherit parent +cclog3.childLevel('') +// child itself +cclog3.childLevel2('') + +const ccclog3 = clog3.child({}) +expectError(ccclog3.nonLevel('')) + +const withChildCallback = pino({ + onChild: (child: Logger) => {} +}) +withChildCallback.onChild = (child: Logger) => {} + +pino({ + crlf: true, +}); + +const customLevels = { foo: 99, bar: 42 } + +const customLevelLogger = pino({ customLevels }); + +type CustomLevelLogger = typeof customLevelLogger +type CustomLevelLoggerLevels = pino.Level | keyof typeof customLevels + +const fn = (logger: Pick) => {} + +const customLevelChildLogger = customLevelLogger.child({ name: "child" }) + +fn(customLevelChildLogger); // missing foo typing + +// unknown option +expectError( + pino({ + hello: 'world' + }) +); + +// unknown option +expectError( + pino({ + hello: 'world', + customLevels: { + 'log': 30 + } + }) +); + +function dangerous () { + throw Error('foo') +} + +try { + dangerous() +} catch (err) { + log.error(err) +} + +try { + dangerous() +} catch (err) { + log.error({ err }) +} + +const bLogger = pino({ + customLevels: { + log: 5, + }, + level: 'log', + transport: { + target: 'pino-pretty', + options: { + colorize: true, + }, + }, +}); + +expectType>(pino({ + customLevels: { + log: 5, + }, + level: 'log', + transport: { + target: 'pino-pretty', + options: { + colorize: true, + }, + }, +})) + +const parentLogger1 = pino({ + customLevels: { myLevel: 90 }, + onChild: (child) => { const a = child.myLevel; } +}, process.stdout) +parentLogger1.onChild = (child) => { child.myLevel(''); } + +const childLogger1 = parentLogger1.child({}); +childLogger1.myLevel(''); +expectError(childLogger1.doesntExist('')); + +const parentLogger2 = pino({}, process.stdin); +expectError(parentLogger2.onChild = (child) => { const b = child.doesntExist; }); + +const childLogger2 = parentLogger2.child({}); +expectError(childLogger2.doesntExist); + +expectError(pino({ + onChild: (child) => { const a = child.doesntExist; } +}, process.stdout)); + +const pinoWithoutLevelsSorting = pino({}); +const pinoWithDescSortingLevels = pino({ levelComparison: 'DESC' }); +const pinoWithAscSortingLevels = pino({ levelComparison: 'ASC' }); +const pinoWithCustomSortingLevels = pino({ levelComparison: () => false }); +// with wrong level comparison direction +expectError(pino({ levelComparison: 'SOME'}), process.stdout); +// with wrong level comparison type +expectError(pino({ levelComparison: 123}), process.stdout); +// with wrong custom level comparison return type +expectError(pino({ levelComparison: () => null }), process.stdout); +expectError(pino({ levelComparison: () => 1 }), process.stdout); +expectError(pino({ levelComparison: () => 'string' }), process.stdout); + +const customLevelsOnlyOpts = { + useOnlyCustomLevels: true, + customLevels: { + customDebug: 10, + info: 20, // to make sure the default names are also available for override + customNetwork: 30, + customError: 40, + }, + level: 'customDebug', +} satisfies LoggerOptions; + +const loggerWithCustomLevelOnly = pino(customLevelsOnlyOpts); +loggerWithCustomLevelOnly.customDebug('test3') +loggerWithCustomLevelOnly.info('test4') +loggerWithCustomLevelOnly.customError('test5') +loggerWithCustomLevelOnly.customNetwork('test6') + +expectError(loggerWithCustomLevelOnly.fatal('test')); +expectError(loggerWithCustomLevelOnly.error('test')); +expectError(loggerWithCustomLevelOnly.warn('test')); +expectError(loggerWithCustomLevelOnly.debug('test')); +expectError(loggerWithCustomLevelOnly.trace('test')); diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino.ts b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino.ts new file mode 100644 index 0000000000000000000000000000000000000000..744389a06eff5bf528e437903647ab3208b78fcb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/pino/test/types/pino.ts @@ -0,0 +1,90 @@ +import { join } from 'node:path' +import { tmpdir } from 'node:os' +import pinoPretty from 'pino-pretty' +// Test both default ("Pino") and named ("pino") imports. +import Pino, { LoggerOptions, StreamEntry, pino, multistream, transport } from '../../pino' + +const destination = join( + tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) +) + +// Single +const transport1 = transport({ + target: 'pino-pretty', + options: { some: 'options for', the: 'transport' } +}) +const logger = pino(transport1) +logger.setBindings({ some: 'bindings' }) +logger.info('test2') +logger.flush() +const loggerDefault = Pino(transport1) +loggerDefault.setBindings({ some: 'bindings' }) +loggerDefault.info('test2') +loggerDefault.flush() + +const transport2 = transport({ + target: 'pino-pretty', +}) +const logger2 = pino(transport2) +logger2.info('test2') +const logger2Default = Pino(transport2) +logger2Default.info('test2') + + +// Multiple + +const transports = transport({targets: [ + { + level: 'info', + target: 'pino-pretty', + options: { some: 'options for', the: 'transport' } + }, + { + level: 'trace', + target: 'pino/file', + options: { destination } + } +]}) +const loggerMulti = pino(transports) +loggerMulti.info('test2') + +// custom levels + +const customLevels = { + customDebug : 1, + info : 2, + customNetwork : 3, + customError : 4, +}; + +type CustomLevels = keyof typeof customLevels; + +const pinoOpts = { + useOnlyCustomLevels: true, + customLevels: customLevels, + level: 'customDebug', +} satisfies LoggerOptions; + +const multistreamOpts = { + dedupe: true, + levels: customLevels +}; + +const streams: StreamEntry[] = [ + { level : 'customDebug', stream : pinoPretty() }, + { level : 'info', stream : pinoPretty() }, + { level : 'customNetwork', stream : pinoPretty() }, + { level : 'customError', stream : pinoPretty() }, +]; + +const loggerCustomLevel = pino(pinoOpts, multistream(streams, multistreamOpts)); +loggerCustomLevel.customDebug('test3') +loggerCustomLevel.info('test4') +loggerCustomLevel.customError('test5') +loggerCustomLevel.customNetwork('test6') +const loggerCustomLevelDefault = Pino(pinoOpts, multistream(streams, multistreamOpts)); +loggerCustomLevelDefault.customDebug('test3') +loggerCustomLevelDefault.info('test4') +loggerCustomLevelDefault.customError('test5') +loggerCustomLevelDefault.customNetwork('test6') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..35d66ca7ac75f125b9c9c5b3dee0987fdfca4a45 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..496e8b90434d16c9e0ae98bbaac294ba1e9157de --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + branches: + - main + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +jobs: + test: + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 + with: + license-check: true + lint: true diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/benchmarks/warn.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/benchmarks/warn.js new file mode 100644 index 0000000000000000000000000000000000000000..1f49bf67caaa8ecf2dbfb6192c8f69d5503561e8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/benchmarks/warn.js @@ -0,0 +1,25 @@ +'use strict' + +const { Suite } = require('benchmark') +const { createWarning } = require('..') + +const err1 = createWarning({ + name: 'TestWarning', + code: 'TST_ERROR_CODE_1', + message: 'message' +}) +const err2 = createWarning({ + name: 'TestWarning', + code: 'TST_ERROR_CODE_2', + message: 'message' +}) + +new Suite() + .add('warn', function () { + err1() + err2() + }) + .on('cycle', function (event) { + console.log(String(event.target)) + }) + .run() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/examples/example.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/examples/example.js new file mode 100644 index 0000000000000000000000000000000000000000..db9d86282945dddcbd97736e61f147e1e6d4dfcf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/examples/example.js @@ -0,0 +1,11 @@ +'use strict' + +const { createWarning } = require('..') + +const CUSTDEP001 = createWarning({ + name: 'DeprecationWarning', + code: 'CUSTDEP001', + message: 'This is a deprecation warning' +}) + +CUSTDEP001() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-interpolated-string.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-interpolated-string.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4a90c1ce1933d39d433351d65a266b2a27483ffa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-interpolated-string.test.js @@ -0,0 +1,34 @@ +'use strict' + +const { test } = require('node:test') +const { createWarning } = require('..') +const { withResolvers } = require('./promise') + +test('emit with interpolated string', t => { + t.plan(4) + + const { promise, resolve } = withResolvers() + + process.on('warning', onWarning) + function onWarning (warning) { + t.assert.deepStrictEqual(warning.name, 'TestDeprecation') + t.assert.deepStrictEqual(warning.code, 'CODE') + t.assert.deepStrictEqual(warning.message, 'Hello world') + t.assert.ok(codeWarning.emitted) + } + + const codeWarning = createWarning({ + name: 'TestDeprecation', + code: 'CODE', + message: 'Hello %s' + }) + codeWarning('world') + codeWarning('world') + + setImmediate(() => { + process.removeListener('warning', onWarning) + resolve() + }) + + return promise +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-once-only.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-once-only.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4d5bc1f6a663bbb948962ed818f4cfc285625c00 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-once-only.test.js @@ -0,0 +1,33 @@ +'use strict' + +const { test } = require('node:test') +const { createWarning } = require('..') +const { withResolvers } = require('./promise') + +test('emit should emit a given code only once', t => { + t.plan(4) + + const { promise, resolve } = withResolvers() + + process.on('warning', onWarning) + function onWarning (warning) { + t.assert.deepStrictEqual(warning.name, 'TestDeprecation') + t.assert.deepStrictEqual(warning.code, 'CODE') + t.assert.deepStrictEqual(warning.message, 'Hello world') + t.assert.ok(warn.emitted) + } + + const warn = createWarning({ + name: 'TestDeprecation', + code: 'CODE', + message: 'Hello world' + }) + warn() + warn() + setImmediate(() => { + process.removeListener('warning', onWarning) + resolve() + }) + + return promise +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-reset.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-reset.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1a31a4cfb973a881c7db6bb7e995b527a776ed5a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-reset.test.js @@ -0,0 +1,40 @@ +'use strict' + +const { test } = require('node:test') +const { createWarning } = require('../') +const { withResolvers } = require('./promise') + +test('a limited warning can be re-set', t => { + t.plan(4) + + const { promise, resolve } = withResolvers() + let count = 0 + process.on('warning', onWarning) + function onWarning () { + count++ + } + + const warn = createWarning({ + name: 'TestDeprecation', + code: 'CODE', + message: 'Hello world' + }) + + warn() + t.assert.ok(warn.emitted) + + warn() + t.assert.ok(warn.emitted) + + warn.emitted = false + warn() + t.assert.ok(warn.emitted) + + setImmediate(() => { + t.assert.deepStrictEqual(count, 2) + process.removeListener('warning', onWarning) + resolve() + }) + + return promise +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-set.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-set.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6880fd2c7087550bba71a18a64da45a64c391729 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-set.test.js @@ -0,0 +1,35 @@ +'use strict' + +const { test } = require('node:test') +const { createWarning } = require('../') +const { withResolvers } = require('./promise') + +test('emit should set the emitted state', t => { + t.plan(3) + + const { promise, resolve } = withResolvers() + + process.on('warning', onWarning) + function onWarning () { + t.fail('should not be called') + } + + const warn = createWarning({ + name: 'TestDeprecation', + code: 'CODE', + message: 'Hello world' + }) + t.assert.ok(!warn.emitted) + warn.emitted = true + t.assert.ok(warn.emitted) + + warn() + t.assert.ok(warn.emitted) + + setImmediate(() => { + process.removeListener('warning', onWarning) + resolve() + }) + + return promise +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-unlimited.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-unlimited.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3bf478057828560ee3635511c6c1c9a4780e9ec1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/emit-unlimited.test.js @@ -0,0 +1,42 @@ +'use strict' + +const { test } = require('node:test') +const { createWarning } = require('..') +const { withResolvers } = require('./promise') + +test('emit should emit a given code unlimited times', t => { + t.plan(50) + + let runs = 0 + const expectedRun = [] + const times = 10 + + const { promise, resolve } = withResolvers() + + process.on('warning', onWarning) + function onWarning (warning) { + t.assert.deepStrictEqual(warning.name, 'TestDeprecation') + t.assert.deepStrictEqual(warning.code, 'CODE') + t.assert.deepStrictEqual(warning.message, 'Hello world') + t.assert.ok(warn.emitted) + t.assert.deepStrictEqual(runs++, expectedRun.shift()) + } + + const warn = createWarning({ + name: 'TestDeprecation', + code: 'CODE', + message: 'Hello world', + unlimited: true + }) + + for (let i = 0; i < times; i++) { + expectedRun.push(i) + warn() + } + setImmediate(() => { + process.removeListener('warning', onWarning) + resolve() + }) + + return promise +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/index.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/index.test.js new file mode 100644 index 0000000000000000000000000000000000000000..93f8cc49c211cf1c4274bbad4d6bf43ca0236257 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/index.test.js @@ -0,0 +1,99 @@ +'use strict' + +const { test } = require('node:test') +const { createWarning, createDeprecation } = require('..') + +process.removeAllListeners('warning') + +test('Create warning with zero parameter', t => { + t.plan(3) + + const warnItem = createWarning({ + name: 'TestWarning', + code: 'CODE', + message: 'Not available' + }) + t.assert.deepStrictEqual(warnItem.name, 'TestWarning') + t.assert.deepStrictEqual(warnItem.message, 'Not available') + t.assert.deepStrictEqual(warnItem.code, 'CODE') +}) + +test('Create error with 1 parameter', t => { + t.plan(3) + + const warnItem = createWarning({ + name: 'TestWarning', + code: 'CODE', + message: 'hey %s' + }) + t.assert.deepStrictEqual(warnItem.name, 'TestWarning') + t.assert.deepStrictEqual(warnItem.format('alice'), 'hey alice') + t.assert.deepStrictEqual(warnItem.code, 'CODE') +}) + +test('Create error with 2 parameters', t => { + t.plan(3) + + const warnItem = createWarning({ + name: 'TestWarning', + code: 'CODE', + message: 'hey %s, I like your %s' + }) + t.assert.deepStrictEqual(warnItem.name, 'TestWarning') + t.assert.deepStrictEqual(warnItem.format('alice', 'attitude'), 'hey alice, I like your attitude') + t.assert.deepStrictEqual(warnItem.code, 'CODE') +}) + +test('Create error with 3 parameters', t => { + t.plan(3) + + const warnItem = createWarning({ + name: 'TestWarning', + code: 'CODE', + message: 'hey %s, I like your %s %s' + }) + t.assert.deepStrictEqual(warnItem.name, 'TestWarning') + t.assert.deepStrictEqual(warnItem.format('alice', 'attitude', 'see you'), 'hey alice, I like your attitude see you') + t.assert.deepStrictEqual(warnItem.code, 'CODE') +}) + +test('Creates a deprecation warning', t => { + t.plan(3) + + const deprecationItem = createDeprecation({ + name: 'DeprecationWarning', + code: 'CODE', + message: 'hello %s' + }) + t.assert.deepStrictEqual(deprecationItem.name, 'DeprecationWarning') + t.assert.deepStrictEqual(deprecationItem.format('world'), 'hello world') + t.assert.deepStrictEqual(deprecationItem.code, 'CODE') +}) + +test('Should throw when error code has no name', t => { + t.plan(1) + t.assert.throws(() => createWarning(), new Error('Warning name must not be empty')) +}) + +test('Should throw when error has no code', t => { + t.plan(1) + t.assert.throws(() => createWarning({ name: 'name' }), new Error('Warning code must not be empty')) +}) + +test('Should throw when error has no message', t => { + t.plan(1) + t.assert.throws(() => createWarning({ + name: 'name', + code: 'code' + }), new Error('Warning message must not be empty')) +}) + +test('Cannot set unlimited other than boolean', t => { + t.plan(1) + t.assert.throws(() => createWarning({ + name: 'name', + code: 'code', + message: 'message', + unlimited: 'unlimited' + }), new Error('Warning opts.unlimited must be a boolean')) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/issue-88.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/issue-88.test.js new file mode 100644 index 0000000000000000000000000000000000000000..219426621b5aa5193f38f0a3bba1481a7fc3b347 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/issue-88.test.js @@ -0,0 +1,38 @@ +'use strict' + +const { test } = require('node:test') +const { createWarning } = require('..') +const { withResolvers } = require('./promise') + +test('Must not overwrite config', t => { + t.plan(1) + + function onWarning (warning) { + t.assert.deepStrictEqual(warning.code, 'CODE_1') + } + + const a = createWarning({ + name: 'TestWarning', + code: 'CODE_1', + message: 'Msg' + }) + createWarning({ + name: 'TestWarning', + code: 'CODE_2', + message: 'Msg', + unlimited: true + }) + + const { promise, resolve } = withResolvers() + + process.on('warning', onWarning) + a('CODE_1') + a('CODE_1') + + setImmediate(() => { + process.removeListener('warning', onWarning) + resolve() + }) + + return promise +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/jest.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/jest.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5935b6a9579d7f3777b1454f8b3c1b2659e7450f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/jest.test.js @@ -0,0 +1,24 @@ +/* global test, expect */ +'use strict' + +const { createWarning } = require('..') + +if (globalThis.test) { + test('works with jest', done => { + const code = createWarning({ + name: 'TestDeprecation', + code: 'CODE', + message: 'Hello world' + }) + code('world') + + // we cannot actually listen to process warning event + // because jest messes with it (that's the point of this test) + // we can only test it was emitted indirectly + // and test no exception is raised + setImmediate(() => { + expect(code.emitted).toBeTruthy() + done() + }) + }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/no-warnings.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/no-warnings.test.js new file mode 100644 index 0000000000000000000000000000000000000000..be0e9bf44821c387c23acd3dbdc8c08b21915dd4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/no-warnings.test.js @@ -0,0 +1,80 @@ +'use strict' + +const { test } = require('node:test') +const { spawnSync } = require('node:child_process') +const { resolve } = require('node:path') + +const entry = resolve(__dirname, '../examples', 'example.js') + +test('--no-warnings is set in cli', t => { + t.plan(1) + const child = spawnSync(process.execPath, [ + '--no-warnings', + entry + ]) + + const stderr = child.stderr.toString() + t.assert.deepStrictEqual(stderr, '') +}) + +test('--no-warnings is not set in cli', t => { + t.plan(1) + const child = spawnSync(process.execPath, [ + entry + ]) + + const stderr = child.stderr.toString() + t.assert.match(stderr, /\[CUSTDEP001\] DeprecationWarning: This is a deprecation warning/) +}) + +test('NODE_NO_WARNINGS is set to 1', t => { + t.plan(1) + const child = spawnSync(process.execPath, [ + entry + ], { + env: { + NODE_NO_WARNINGS: '1' + } + }) + + const stderr = child.stderr.toString() + t.assert.deepStrictEqual(stderr, '') +}) + +test('NODE_NO_WARNINGS is set to 0', t => { + t.plan(1) + const child = spawnSync(process.execPath, [ + entry + ], { + env: { + NODE_NO_WARNINGS: '0' + } + }) + + const stderr = child.stderr.toString() + t.assert.match(stderr, /\[CUSTDEP001\] DeprecationWarning: This is a deprecation warning/) +}) + +test('NODE_NO_WARNINGS is not set', t => { + t.plan(1) + const child = spawnSync(process.execPath, [ + entry + ]) + + const stderr = child.stderr.toString() + t.assert.match(stderr, /\[CUSTDEP001\] DeprecationWarning: This is a deprecation warning/) +}) + +test('NODE_Options contains --no-warnings', t => { + t.plan(1) + const child = spawnSync(process.execPath, [ + entry + ], { + env: { + NODE_OPTIONS: '--no-warnings' + } + }) + + const stderr = child.stderr.toString() + t.assert.deepStrictEqual(stderr, '') +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/promise.js b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/promise.js new file mode 100644 index 0000000000000000000000000000000000000000..c5a1ebc46e04b7ac774f1dfa520db25654b24194 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/test/promise.js @@ -0,0 +1,10 @@ +module.exports = { + withResolvers: function () { + let promiseResolve, promiseReject + const promise = new Promise((resolve, reject) => { + promiseResolve = resolve + promiseReject = reject + }) + return { promise, resolve: promiseResolve, reject: promiseReject } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/types/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0728405c6e5257cd8fde2ca6696e44d42483feb0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/types/index.d.ts @@ -0,0 +1,37 @@ +declare namespace processWarning { + export interface WarningItem { + (a?: any, b?: any, c?: any): void; + name: string; + code: string; + message: string; + emitted: boolean; + unlimited: boolean; + format(a?: any, b?: any, c?: any): string; + } + + export type WarningOptions = { + name: string; + code: string; + message: string; + unlimited?: boolean; + } + + export type DeprecationOptions = Omit + + export type ProcessWarningOptions = { + unlimited?: boolean; + } + + export type ProcessWarning = { + createWarning(params: WarningOptions): WarningItem; + createDeprecation(params: DeprecationOptions): WarningItem; + } + + export function createWarning (params: WarningOptions): WarningItem + export function createDeprecation (params: DeprecationOptions): WarningItem + + const processWarning: ProcessWarning + export { processWarning as default } +} + +export = processWarning diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/types/index.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/types/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe338e15f2cd3693e1583e7c15f4a9203e941955 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/process-warning/types/index.test-d.ts @@ -0,0 +1,36 @@ +import { expectType } from 'tsd' +import { createWarning, createDeprecation } from '..' + +const WarnInstance = createWarning({ + name: 'TypeScriptWarning', + code: 'CODE', + message: 'message' +}) + +expectType(WarnInstance.code) +expectType(WarnInstance.message) +expectType(WarnInstance.name) +expectType(WarnInstance.emitted) +expectType(WarnInstance.unlimited) + +expectType(WarnInstance()) +expectType(WarnInstance('foo')) +expectType(WarnInstance('foo', 'bar')) + +const buildWarnUnlimited = createWarning({ + name: 'TypeScriptWarning', + code: 'CODE', + message: 'message', + unlimited: true +}) +expectType(buildWarnUnlimited.unlimited) + +const DeprecationInstance = createDeprecation({ + code: 'CODE', + message: 'message' +}) +expectType(DeprecationInstance.code) + +DeprecationInstance() +DeprecationInstance('foo') +DeprecationInstance('foo', 'bar') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/reusify/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..4872c5afd204d6c4ebd8361f14a4fb99390ef2f3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/reusify/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..1e30ad806298004255f98694d61c683d9f7446a0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/.github/workflows/ci.yml @@ -0,0 +1,96 @@ +name: ci + +on: [push, pull_request] + +jobs: + legacy: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ['0.10', '0.12', 4.x, 6.x, 8.x, 10.x, 12.x, 13.x, 14.x, 15.x, 16.x] + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install + run: | + npm install --production && npm install tape + + - name: Run tests + run: | + npm run test + + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install + run: | + npm install + + - name: Run tests + run: | + npm run test:coverage + + types: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install + run: | + npm install + + - name: Run types tests + run: | + npm run test:typescript + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install + run: | + npm install + + - name: Lint + run: | + npm run lint diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/createNoCodeFunction.js b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/createNoCodeFunction.js new file mode 100644 index 0000000000000000000000000000000000000000..ce1aac7b7a6968b0377eac9c4fd9dcc4836a8bac --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/createNoCodeFunction.js @@ -0,0 +1,30 @@ +'use strict' + +var fib = require('./fib') +var max = 100000000 +var start = Date.now() + +// create a funcion with the typical error +// pattern, that delegates the heavy load +// to something else +function createNoCodeFunction () { + /* eslint no-constant-condition: "off" */ + var num = 100 + + ;(function () { + if (null) { + // do nothing + } else { + fib(num) + } + })() +} + +for (var i = 0; i < max; i++) { + createNoCodeFunction() +} + +var time = Date.now() - start +console.log('Total time', time) +console.log('Total iterations', max) +console.log('Iteration/s', max / time * 1000) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/fib.js b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/fib.js new file mode 100644 index 0000000000000000000000000000000000000000..e22cc48dec9efa13644385c395272f16a9e45462 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/fib.js @@ -0,0 +1,13 @@ +'use strict' + +function fib (num) { + var fib = [] + + fib[0] = 0 + fib[1] = 1 + for (var i = 2; i <= num; i++) { + fib[i] = fib[i - 2] + fib[i - 1] + } +} + +module.exports = fib diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/reuseNoCodeFunction.js b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/reuseNoCodeFunction.js new file mode 100644 index 0000000000000000000000000000000000000000..3358d6e50d8ffbf1ce1559213ba63ffc50c5f752 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/reusify/benchmarks/reuseNoCodeFunction.js @@ -0,0 +1,38 @@ +'use strict' + +var reusify = require('../') +var fib = require('./fib') +var instance = reusify(MyObject) +var max = 100000000 +var start = Date.now() + +function reuseNoCodeFunction () { + var obj = instance.get() + obj.num = 100 + obj.func() + obj.num = 0 + instance.release(obj) +} + +function MyObject () { + this.next = null + var that = this + this.num = 0 + this.func = function () { + /* eslint no-constant-condition: "off" */ + if (null) { + // do nothing + } else { + fib(that.num) + } + } +} + +for (var i = 0; i < max; i++) { + reuseNoCodeFunction() +} + +var time = Date.now() - start +console.log('Total time', time) +console.log('Total iterations', max) +console.log('Iteration/s', max / time * 1000) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/rfdc/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/rfdc/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..751a1010504214690b8945b93c0d77403f7ef248 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/rfdc/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [8.x, 10.x, 12.x, 14.x, 16.x, 18.x, 20.x, 22.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run ci diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/rfdc/test/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/rfdc/test/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5bdd9acaff929ec7675dc2ae142e27f4913ef983 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/rfdc/test/index.js @@ -0,0 +1,306 @@ +'use strict' + +const { test } = require('tap') +const rfdc = require('..') +const cloneDefault = require('../default') +const clone = rfdc() +const cloneProto = rfdc({ proto: true }) +const cloneCircles = rfdc({ circles: true }) +const cloneCirclesProto = rfdc({ circles: true, proto: true }) + +const rnd = (max) => Math.round(Math.random() * max) + +types(clone, 'default') +types(cloneProto, 'proto option') +types(cloneCircles, 'circles option') +types(cloneCirclesProto, 'circles and proto option') + +test('default – does not copy proto properties', async ({ is }) => { + is(clone(Object.create({ a: 1 })).a, undefined, 'value not copied') +}) +test('default – shorthand import', async ({ same }) => { + same( + clone(Object.create({ a: 1 })), + cloneDefault(Object.create({ a: 1 })), + 'import equals clone with default options' + ) +}) +test('proto option – copies enumerable proto properties', async ({ is }) => { + is(cloneProto(Object.create({ a: 1 })).a, 1, 'value copied') +}) +test('circles option - circular object', async ({ same, is, isNot }) => { + const o = { nest: { a: 1, b: 2 } } + o.circular = o + same(cloneCircles(o), o, 'same values') + isNot(cloneCircles(o), o, 'different objects') + isNot(cloneCircles(o).nest, o.nest, 'different nested objects') + const c = cloneCircles(o) + is(c.circular, c, 'circular references point to copied parent') + isNot(c.circular, o, 'circular references do not point to original parent') +}) +test('circles option – deep circular object', async ({ same, is, isNot }) => { + const o = { nest: { a: 1, b: 2 } } + o.nest.circular = o + same(cloneCircles(o), o, 'same values') + isNot(cloneCircles(o), o, 'different objects') + isNot(cloneCircles(o).nest, o.nest, 'different nested objects') + const c = cloneCircles(o) + is(c.nest.circular, c, 'circular references point to copied parent') + isNot( + c.nest.circular, + o, + 'circular references do not point to original parent' + ) +}) +test('circles option alone – does not copy proto properties', async ({ + is +}) => { + is(cloneCircles(Object.create({ a: 1 })).a, undefined, 'value not copied') +}) +test('circles and proto option – copies enumerable proto properties', async ({ + is +}) => { + is(cloneCirclesProto(Object.create({ a: 1 })).a, 1, 'value copied') +}) +test('circles and proto option - circular object', async ({ + same, + is, + isNot +}) => { + const o = { nest: { a: 1, b: 2 } } + o.circular = o + same(cloneCirclesProto(o), o, 'same values') + isNot(cloneCirclesProto(o), o, 'different objects') + isNot(cloneCirclesProto(o).nest, o.nest, 'different nested objects') + const c = cloneCirclesProto(o) + is(c.circular, c, 'circular references point to copied parent') + isNot(c.circular, o, 'circular references do not point to original parent') +}) +test('circles and proto option – deep circular object', async ({ + same, + is, + isNot +}) => { + const o = { nest: { a: 1, b: 2 } } + o.nest.circular = o + same(cloneCirclesProto(o), o, 'same values') + isNot(cloneCirclesProto(o), o, 'different objects') + isNot(cloneCirclesProto(o).nest, o.nest, 'different nested objects') + const c = cloneCirclesProto(o) + is(c.nest.circular, c, 'circular references point to copied parent') + isNot( + c.nest.circular, + o, + 'circular references do not point to original parent' + ) +}) +test('circles and proto option – deep circular array', async ({ + same, + is, + isNot +}) => { + const o = { nest: [1, 2] } + o.nest.push(o) + same(cloneCirclesProto(o), o, 'same values') + isNot(cloneCirclesProto(o), o, 'different objects') + isNot(cloneCirclesProto(o).nest, o.nest, 'different nested objects') + const c = cloneCirclesProto(o) + is(c.nest[2], c, 'circular references point to copied parent') + isNot(c.nest[2], o, 'circular references do not point to original parent') +}) +test('custom constructor handler', async ({ same, ok, isNot }) => { + class Foo { + constructor (s) { + this.s = s + } + } + const data = { foo: new Foo('foo') } + const cloned = rfdc({ constructorHandlers: [[Foo, (o) => new Foo(o.s)]] })(data) + ok(cloned.foo instanceof Foo) + same(cloned.foo.s, data.foo.s, 'same values') + isNot(cloned.foo, data.foo, 'different objects') +}) +test('custom RegExp handler', async ({ same, ok, isNot }) => { + const data = { regex: /foo/ } + const cloned = rfdc({ constructorHandlers: [[RegExp, (o) => new RegExp(o)]] })(data) + isNot(cloned.regex, data.regex, 'different objects') + ok(cloned.regex.test('foo')) +}) + +function types (clone, label) { + test(label + ' – number', async ({ is }) => { + is(clone(42), 42, 'same value') + }) + test(label + ' – string', async ({ is }) => { + is(clone('str'), 'str', 'same value') + }) + test(label + ' – boolean', async ({ is }) => { + is(clone(true), true, 'same value') + }) + test(label + ' – function', async ({ is }) => { + const fn = () => {} + is(clone(fn), fn, 'same function') + }) + test(label + ' – async function', async ({ is }) => { + const fn = async () => {} + is(clone(fn), fn, 'same function') + }) + test(label + ' – generator function', async ({ is }) => { + const fn = function * () {} + is(clone(fn), fn, 'same function') + }) + test(label + ' – date', async ({ is, isNot }) => { + const date = new Date() + is(+clone(date), +date, 'same value') + isNot(clone(date), date, 'different object') + }) + test(label + ' – null', async ({ is }) => { + is(clone(null), null, 'same value') + }) + test(label + ' – shallow object', async ({ same, isNot }) => { + const o = { a: 1, b: 2 } + same(clone(o), o, 'same values') + isNot(clone(o), o, 'different object') + }) + test(label + ' – shallow array', async ({ same, isNot }) => { + const o = [1, 2] + same(clone(o), o, 'same values') + isNot(clone(o), o, 'different arrays') + }) + test(label + ' – deep object', async ({ same, isNot }) => { + const o = { nest: { a: 1, b: 2 } } + same(clone(o), o, 'same values') + isNot(clone(o), o, 'different objects') + isNot(clone(o).nest, o.nest, 'different nested objects') + }) + test(label + ' – deep array', async ({ same, isNot }) => { + const o = [{ a: 1, b: 2 }, [3]] + same(clone(o), o, 'same values') + isNot(clone(o), o, 'different arrays') + isNot(clone(o)[0], o[0], 'different array elements') + isNot(clone(o)[1], o[1], 'different array elements') + }) + test(label + ' – nested number', async ({ is }) => { + is(clone({ a: 1 }).a, 1, 'same value') + }) + test(label + ' – nested string', async ({ is }) => { + is(clone({ s: 'str' }).s, 'str', 'same value') + }) + test(label + ' – nested boolean', async ({ is }) => { + is(clone({ b: true }).b, true, 'same value') + }) + test(label + ' – nested function', async ({ is }) => { + const fn = () => {} + is(clone({ fn }).fn, fn, 'same function') + }) + test(label + ' – nested async function', async ({ is }) => { + const fn = async () => {} + is(clone({ fn }).fn, fn, 'same function') + }) + test(label + ' – nested generator function', async ({ is }) => { + const fn = function * () {} + is(clone({ fn }).fn, fn, 'same function') + }) + test(label + ' – nested date', async ({ is, isNot }) => { + const date = new Date() + is(+clone({ d: date }).d, +date, 'same value') + isNot(clone({ d: date }).d, date, 'different object') + }) + test(label + ' – nested date in array', async ({ is, isNot }) => { + const date = new Date() + is(+clone({ d: [date] }).d[0], +date, 'same value') + isNot(clone({ d: [date] }).d[0], date, 'different object') + is(+cloneCircles({ d: [date] }).d[0], +date, 'same value') + isNot(cloneCircles({ d: [date] }).d, date, 'different object') + }) + test(label + ' – nested null', async ({ is }) => { + is(clone({ n: null }).n, null, 'same value') + }) + test(label + ' – arguments', async ({ isNot, same }) => { + function fn (...args) { + same(clone(arguments), args, 'same values') + isNot(clone(arguments), arguments, 'different object') + } + fn(1, 2, 3) + }) + test(`${label} copies buffers from object correctly`, async ({ ok, is, isNot }) => { + const input = Date.now().toString(36) + const inputBuffer = Buffer.from(input) + const clonedBuffer = clone({ a: inputBuffer }).a + ok(Buffer.isBuffer(clonedBuffer), 'cloned value is buffer') + isNot(clonedBuffer, inputBuffer, 'cloned buffer is not same as input buffer') + is(clonedBuffer.toString(), input, 'cloned buffer content is correct') + }) + test(`${label} copies buffers from arrays correctly`, async ({ ok, is, isNot }) => { + const input = Date.now().toString(36) + const inputBuffer = Buffer.from(input) + const [clonedBuffer] = clone([inputBuffer]) + ok(Buffer.isBuffer(clonedBuffer), 'cloned value is buffer') + isNot(clonedBuffer, inputBuffer, 'cloned buffer is not same as input buffer') + is(clonedBuffer.toString(), input, 'cloned buffer content is correct') + }) + test(`${label} copies TypedArrays from object correctly`, async ({ ok, is, isNot }) => { + const [input1, input2] = [rnd(10), rnd(10)] + const buffer = new ArrayBuffer(8) + const int32View = new Int32Array(buffer) + int32View[0] = input1 + int32View[1] = input2 + const cloned = clone({ a: int32View }).a + ok(cloned instanceof Int32Array, 'cloned value is instance of class') + isNot(cloned, int32View, 'cloned value is not same as input value') + is(cloned[0], input1, 'cloned value content is correct') + is(cloned[1], input2, 'cloned value content is correct') + }) + test(`${label} copies TypedArrays from array correctly`, async ({ ok, is, isNot }) => { + const [input1, input2] = [rnd(10), rnd(10)] + const buffer = new ArrayBuffer(16) + const int32View = new Int32Array(buffer) + int32View[0] = input1 + int32View[1] = input2 + const [cloned] = clone([int32View]) + ok(cloned instanceof Int32Array, 'cloned value is instance of class') + isNot(cloned, int32View, 'cloned value is not same as input value') + is(cloned[0], input1, 'cloned value content is correct') + is(cloned[1], input2, 'cloned value content is correct') + }) + test(`${label} copies complex TypedArrays`, async ({ ok, deepEqual, is, isNot }) => { + const [input1, input2, input3] = [rnd(10), rnd(10), rnd(10)] + const buffer = new ArrayBuffer(4) + const view1 = new Int8Array(buffer, 0, 2) + const view2 = new Int8Array(buffer, 2, 2) + const view3 = new Int8Array(buffer) + view1[0] = input1 + view2[0] = input2 + view3[3] = input3 + const cloned = clone({ view1, view2, view3 }) + ok(cloned.view1 instanceof Int8Array, 'cloned value is instance of class') + ok(cloned.view2 instanceof Int8Array, 'cloned value is instance of class') + ok(cloned.view3 instanceof Int8Array, 'cloned value is instance of class') + isNot(cloned.view1, view1, 'cloned value is not same as input value') + isNot(cloned.view2, view2, 'cloned value is not same as input value') + isNot(cloned.view3, view3, 'cloned value is not same as input value') + deepEqual(Array.from(cloned.view1), [input1, 0], 'cloned value content is correct') + deepEqual(Array.from(cloned.view2), [input2, input3], 'cloned value content is correct') + deepEqual(Array.from(cloned.view3), [input1, 0, input2, input3], 'cloned value content is correct') + }) + test(`${label} - maps`, async ({ same, isNot }) => { + const map = new Map([['a', 1]]) + same(Array.from(clone(map)), [['a', 1]], 'same value') + isNot(clone(map), map, 'different object') + }) + test(`${label} - sets`, async ({ same, isNot }) => { + const set = new Set([1]) + same(Array.from(clone(set)), [1]) + isNot(clone(set), set, 'different object') + }) + test(`${label} - nested maps`, async ({ same, isNot }) => { + const data = { m: new Map([['a', 1]]) } + same(Array.from(clone(data).m), [['a', 1]], 'same value') + isNot(clone(data).m, data.m, 'different object') + }) + test(`${label} - nested sets`, async ({ same, isNot }) => { + const data = { s: new Set([1]) } + same(Array.from(clone(data).s), [1], 'same value') + isNot(clone(data).s, data.s, 'different object') + }) +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..35d66ca7ac75f125b9c9c5b3dee0987fdfca4a45 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/stale.yml b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/stale.yml new file mode 100644 index 0000000000000000000000000000000000000000..d51ce639022226bc44471aa18bb218b50876cd52 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/stale.yml @@ -0,0 +1,21 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 15 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - "discussion" + - "feature request" + - "bug" + - "help wanted" + - "plugin suggestion" + - "good first issue" +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..f9fae55f7319ee6c8ddffd11ec9a5271235030db --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: + - main + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +jobs: + test: + permissions: + contents: write + pull-requests: write + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 + with: + license-check: true + lint: true diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/example/safe.js b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/example/safe.js new file mode 100644 index 0000000000000000000000000000000000000000..e92a63282dccf64c09f3fbb9f100bb4dfb272d68 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/example/safe.js @@ -0,0 +1,5 @@ +'use strict' + +const safe = require('../') +const regex = process.argv.slice(2).join(' ') +console.log(safe(regex)) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/test/regex.js b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/test/regex.js new file mode 100644 index 0000000000000000000000000000000000000000..4e2f6bfce91e1d0ae1dcd379694ece8d512787f7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/test/regex.js @@ -0,0 +1,51 @@ +'use strict' + +const safe = require('../') +const test = require('tape') + +const good = [ + /\bOakland\b/, + /\b(Oakland|San Francisco)\b/i, + /^\d+1337\d+$/i, + /^\d+(1337|404)\d+$/i, + /^\d+(1337|404)*\d+$/i, + RegExp(Array(26).join('a?') + Array(26).join('a')) +] + +test('safe regex', function (t) { + t.plan(good.length) + good.forEach(function (re) { + t.equal(safe(re), true) + }) +}) + +const bad = [ + /^(a?){25}(a){25}$/, + RegExp(Array(27).join('a?') + Array(27).join('a')), + /(x+x+)+y/, + /foo|(x+x+)+y/, + /(a+){10}y/, + /(a+){2}y/, + /(.*){1,32000}[bc]/ +] + +test('unsafe regex', function (t) { + t.plan(bad.length) + bad.forEach(function (re) { + t.equal(safe(re), false) + }) +}) + +const invalid = [ + '*Oakland*', + 'hey(yoo))', + 'abcde(?>hellow)', + '[abc' +] + +test('invalid regex', function (t) { + t.plan(invalid.length) + invalid.forEach(function (re) { + t.equal(safe(re), false) + }) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/types/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dffe71ec9c6bd05c103af4641f051cbaf23506fe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/types/index.d.ts @@ -0,0 +1,9 @@ +type SafeRegex2 = (re: string | RegExp, opts?: { limit?: number }) => boolean + +declare namespace safeRegex { + export const safeRegex: SafeRegex2 + export { safeRegex as default } +} + +declare function safeRegex (...params: Parameters): ReturnType +export = safeRegex diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/types/index.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/types/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dd166b4776979684474f5399247f315b8d9dea39 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/safe-regex2/types/index.test-d.ts @@ -0,0 +1,12 @@ +import safeRegex, { safeRegex as safeRegexNamed } from '..' +import { expectType } from 'tsd' + +expectType(safeRegex('regex')) +expectType(safeRegex(/regex/)) +expectType(safeRegex('^([a-zA-Z0-9]+\\s?)+$')) +expectType(safeRegex(/^([a-zA-Z0-9]+\s?)+$/g)) + +expectType(safeRegexNamed('regex')) +expectType(safeRegexNamed(/regex/)) +expectType(safeRegexNamed('^([a-zA-Z0-9]+\\s?)+$')) +expectType(safeRegexNamed(/^([a-zA-Z0-9]+\s?)+$/g)) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/dependabot.yml b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..35d66ca7ac75f125b9c9c5b3dee0987fdfca4a45 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 10 diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/stale.yml b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/stale.yml new file mode 100644 index 0000000000000000000000000000000000000000..d51ce639022226bc44471aa18bb218b50876cd52 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/stale.yml @@ -0,0 +1,21 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 15 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - "discussion" + - "feature request" + - "bug" + - "help wanted" + - "plugin suggestion" + - "good first issue" +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/workflows/ci.yml b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..4af73be53859d623fe0d7eb732f2e127329b776c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/.github/workflows/ci.yml @@ -0,0 +1,141 @@ +name: CI + +on: + push: + branches: + - main + - next + - 'v*' + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +jobs: + dependency-review: + name: Dependency Review + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Dependency review + uses: actions/dependency-review-action@v4 + + lint: + name: Lint Code + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: Lint code + run: npm run lint + + browsers: + name: Test Browsers + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install dependencies + run: npm i + + - name: Install Playwright + run: npx playwright install + + - name: Run tests + run: npm run test:browser + + test: + name: Test + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + matrix: + node-version: [20, 22] + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: Run tests + run: npm run test:unit + + typescript: + name: Test TypeScript + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: tsd + run: npm run test:typescript + + automerge: + name: Automerge Dependabot PRs + if: > + github.event_name == 'pull_request' && + github.event.pull_request.user.login == 'dependabot[bot]' + needs: [browsers, lint, test, typescript] + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest + steps: + - uses: fastify/github-action-merge-dependabot@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + target: major diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/ignore.js b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/ignore.js new file mode 100644 index 0000000000000000000000000000000000000000..c07a1f889db18a46dbd4e722390682ba9cdb3289 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/ignore.js @@ -0,0 +1,35 @@ +'use strict' + +const Benchmark = require('benchmark') +const sjson = require('..') + +const internals = { + text: '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' +} + +const suite = new Benchmark.Suite() + +suite + .add('JSON.parse', () => { + JSON.parse(internals.text) + }) + .add('secure-json-parse parse', () => { + sjson.parse(internals.text, { protoAction: 'ignore' }) + }) + .add('secure-json-parse safeParse', () => { + sjson.safeParse(internals.text) + }) + .add('reviver', () => { + JSON.parse(internals.text, internals.reviver) + }) + .on('cycle', (event) => { + console.log(String(event.target)) + }) + .on('complete', function () { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) + +internals.reviver = function (_key, value) { + return value +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/no__proto__.js b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/no__proto__.js new file mode 100644 index 0000000000000000000000000000000000000000..f2724fe97baa51346ff6d97153b24a805666498b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/no__proto__.js @@ -0,0 +1,40 @@ +'use strict' + +const Benchmark = require('benchmark') +const sjson = require('..') + +const internals = { + text: '{ "a": 5, "b": 6, "proto": { "x": 7 }, "c": { "d": 0, "e": "text", "\\u005f\\u005fproto": { "y": 8 }, "f": { "g": 2 } } }', + suspectRx: /"(?:_|\\u005f)(?:_|\\u005f)(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006f)(?:t|\\u0074)(?:o|\\u006f)(?:_|\\u005f)(?:_|\\u005f)"/ +} + +const suite = new Benchmark.Suite() + +suite + .add('JSON.parse', () => { + JSON.parse(internals.text) + }) + .add('secure-json-parse parse', () => { + sjson.parse(internals.text) + }) + .add('secure-json-parse safeParse', () => { + sjson.safeParse(internals.text) + }) + .add('reviver', () => { + JSON.parse(internals.text, internals.reviver) + }) + .on('cycle', (event) => { + console.log(String(event.target)) + }) + .on('complete', function () { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) + +internals.reviver = function (key, value) { + if (key.match(internals.suspectRx)) { + return undefined + } + + return value +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/package.json b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b12151bb7dd504da2961f7eb39e9447fdc1cf397 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/package.json @@ -0,0 +1,15 @@ +{ + "name": "benchmarks", + "version": "1.0.0", + "scripts": { + "valid": "node valid.js", + "ignore": "node ignore.js", + "no_proto": "node no__proto__.js", + "remove": "node remove.js", + "throw": "node throw.js", + "all": "node --version && npm run valid && npm run ignore && npm run no_proto && npm run remove && npm run throw" + }, + "dependencies": { + "benchmark": "^2.1.4" + } +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/remove.js b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/remove.js new file mode 100644 index 0000000000000000000000000000000000000000..af900db5ceff705ad6d0d6f8bda6298e2757d504 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/remove.js @@ -0,0 +1,39 @@ +'use strict' + +const Benchmark = require('benchmark') +const sjson = require('..') + +const internals = { + text: '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' +} + +const suite = new Benchmark.Suite() + +suite + .add('JSON.parse', () => { + JSON.parse(internals.text) + }) + .add('secure-json-parse parse', () => { + sjson.parse(internals.text, { protoAction: 'remove' }) + }) + .add('secure-json-parse safeParse', () => { + sjson.safeParse(internals.text) + }) + .add('reviver', () => { + JSON.parse(internals.text, internals.reviver) + }) + .on('cycle', (event) => { + console.log(String(event.target)) + }) + .on('complete', function () { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) + +internals.reviver = function (key, value) { + if (key === '__proto__') { + return undefined + } + + return value +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/throw.js b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/throw.js new file mode 100644 index 0000000000000000000000000000000000000000..14f47d1bfb57acebef0541f79b43421250f439f9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/throw.js @@ -0,0 +1,49 @@ +'use strict' + +const Benchmark = require('benchmark') +const sjson = require('..') + +const internals = { + text: '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }', + invalid: '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } } }' +} + +const suite = new Benchmark.Suite() + +suite + .add('JSON.parse valid', () => { + JSON.parse(internals.text) + }) + .add('JSON.parse error', () => { + try { + JSON.parse(internals.invalid) + } catch { } + }) + .add('secure-json-parse parse', () => { + try { + sjson.parse(internals.invalid) + } catch { } + }) + .add('secure-json-parse safeParse', () => { + sjson.safeParse(internals.invalid) + }) + .add('reviver', () => { + try { + JSON.parse(internals.invalid, internals.reviver) + } catch { } + }) + .on('cycle', (event) => { + console.log(String(event.target)) + }) + .on('complete', function () { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) + +internals.reviver = function (key, value) { + if (key === '__proto__') { + throw new Error('kaboom') + } + + return value +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/valid.js b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/valid.js new file mode 100644 index 0000000000000000000000000000000000000000..c2214875287c3dc273332d1388c8aa9fec9b720f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/benchmarks/valid.js @@ -0,0 +1,49 @@ +'use strict' + +const Benchmark = require('benchmark') +const sjson = require('..') + +const internals = { + text: '{ "a": 5, "b": 6, "c": { "d": 0, "e": "text", "f": { "g": 2 } } }', + proto: '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' +} + +const suite = new Benchmark.Suite() + +suite + .add('JSON.parse', () => { + JSON.parse(internals.text) + }) + .add('JSON.parse proto', () => { + JSON.parse(internals.proto) + }) + .add('secure-json-parse parse', () => { + sjson.parse(internals.text) + }) + .add('secure-json-parse parse proto', () => { + sjson.parse(internals.text, { constructorAction: 'ignore', protoAction: 'ignore' }) + }) + .add('secure-json-parse safeParse', () => { + sjson.safeParse(internals.text) + }) + .add('secure-json-parse safeParse proto', () => { + sjson.safeParse(internals.proto) + }) + .add('JSON.parse reviver', () => { + JSON.parse(internals.text, internals.reviver) + }) + .on('cycle', (event) => { + console.log(String(event.target)) + }) + .on('complete', function () { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) + +internals.reviver = function (key, value) { + if (key === '__proto__') { + return undefined + } + + return value +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/test/index.test.js b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/test/index.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7c8b809316e07eebcfb6b821dcef7366082695cd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/test/index.test.js @@ -0,0 +1,505 @@ +'use strict' + +const { test } = require('tape') +const j = require('..') + +test('parse', t => { + t.test('parses object string', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6}'), + JSON.parse('{"a": 5, "b": 6}') + ) + t.end() + }) + + t.test('parses null string', t => { + t.strictEqual( + j.parse('null'), + JSON.parse('null') + ) + t.end() + }) + + t.test('parses 0 string', t => { + t.strictEqual( + j.parse('0'), + JSON.parse('0') + ) + t.end() + }) + + t.test('parses string string', t => { + t.strictEqual( + j.parse('"X"'), + JSON.parse('"X"') + ) + t.end() + }) + + t.test('parses buffer', t => { + t.strictEqual( + j.parse(Buffer.from('"X"')), + JSON.parse(Buffer.from('"X"')) + ) + t.end() + }) + + t.test('parses object string (reviver)', t => { + const reviver = (_key, value) => { + return typeof value === 'number' ? value + 1 : value + } + + t.deepEqual( + j.parse('{"a": 5, "b": 6}', reviver), + JSON.parse('{"a": 5, "b": 6}', reviver) + ) + t.end() + }) + + t.test('protoAction', t => { + t.test('sanitizes object string (reviver, options)', t => { + const reviver = (_key, value) => { + return typeof value === 'number' ? value + 1 : value + } + + t.deepEqual( + j.parse('{"a": 5, "b": 6,"__proto__": { "x": 7 }}', reviver, { protoAction: 'remove' }), + { a: 6, b: 7 } + ) + t.end() + }) + + t.test('sanitizes object string (options)', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6,"__proto__": { "x": 7 }}', { protoAction: 'remove' }), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('sanitizes object string (null, options)', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6,"__proto__": { "x": 7 }}', null, { protoAction: 'remove' }), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('sanitizes object string (null, options)', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6,"__proto__": { "x": 7 }}', { protoAction: 'remove' }), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('sanitizes nested object string', t => { + t.deepEqual( + j.parse('{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }', { protoAction: 'remove' }), + { a: 5, b: 6, c: { d: 0, e: 'text', f: { g: 2 } } } + ) + t.end() + }) + + t.test('ignores proto property', t => { + t.deepEqual( + j.parse('{ "a": 5, "b": 6, "__proto__": { "x": 7 } }', { protoAction: 'ignore' }), + JSON.parse('{ "a": 5, "b": 6, "__proto__": { "x": 7 } }') + ) + t.end() + }) + + t.test('ignores proto value', t => { + t.deepEqual( + j.parse('{"a": 5, "b": "__proto__"}'), + { a: 5, b: '__proto__' } + ) + t.end() + }) + + t.test('errors on proto property', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "__proto__": { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "__proto__" : { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "__proto__" \n\r\t : { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "__proto__" \n \r \t : { "x": 7 } }'), SyntaxError) + t.end() + }) + + t.test('errors on proto property (null, null)', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "__proto__": { "x": 7 } }', null, null), SyntaxError) + t.end() + }) + + t.test('errors on proto property (explicit options)', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "__proto__": { "x": 7 } }', { protoAction: 'error' }), SyntaxError) + t.end() + }) + + t.test('errors on proto property (unicode)', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u005f_proto__": { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "_\\u005fp\\u0072oto__": { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u005f\\u005f\\u0070\\u0072\\u006f\\u0074\\u006f\\u005f\\u005f": { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u005F_proto__": { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "_\\u005Fp\\u0072oto__": { "x": 7 } }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u005F\\u005F\\u0070\\u0072\\u006F\\u0074\\u006F\\u005F\\u005F": { "x": 7 } }'), SyntaxError) + t.end() + }) + + t.test('should reset stackTraceLimit', t => { + const text = '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + Error.stackTraceLimit = 42 + t.throws(() => j.parse(text)) + t.same(Error.stackTraceLimit, 42) + t.end() + }) + + t.end() + }) + + t.test('constructorAction', t => { + t.test('sanitizes object string (reviver, options)', t => { + const reviver = (_key, value) => { + return typeof value === 'number' ? value + 1 : value + } + + t.deepEqual( + j.parse('{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }', reviver, { constructorAction: 'remove' }), + { a: 6, b: 7 } + ) + t.end() + }) + + t.test('sanitizes object string (options)', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }', { constructorAction: 'remove' }), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('sanitizes object string (null, options)', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6,"constructor":{"prototype":{"bar":"baz"}} }', null, { constructorAction: 'remove' }), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('sanitizes object string (null, options)', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6,"constructor":{"prototype":{"bar":"baz"}} }', { constructorAction: 'remove' }), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('sanitizes object string (no prototype key)', t => { + t.deepEqual( + j.parse('{"a": 5, "b": 6,"constructor":{"bar":"baz"} }', { constructorAction: 'remove' }), + { a: 5, b: 6, constructor: { bar: 'baz' } } + ) + t.end() + }) + + t.test('sanitizes nested object string', t => { + t.deepEqual( + j.parse('{ "a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "c": { "d": 0, "e": "text", "constructor":{"prototype":{"bar":"baz"}}, "f": { "g": 2 } } }', { constructorAction: 'remove' }), + { a: 5, b: 6, c: { d: 0, e: 'text', f: { g: 2 } } } + ) + t.end() + }) + + t.test('ignores proto property', t => { + t.deepEqual( + j.parse('{ "a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }', { constructorAction: 'ignore' }), + JSON.parse('{ "a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }') + ) + t.end() + }) + + t.test('ignores proto value', t => { + t.deepEqual( + j.parse('{"a": 5, "b": "constructor"}'), + { a: 5, b: 'constructor' } + ) + t.end() + }) + + t.test('errors on proto property', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "constructor": {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "constructor" : {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "constructor" \n\r\t : {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "constructor" \n \r \t : {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.end() + }) + + t.test('Should not throw if the constructor key hasn\'t a child named prototype', t => { + t.doesNotThrow(() => j.parse('{ "a": 5, "b": 6, "constructor":{"bar":"baz"} }', null, null), SyntaxError) + t.end() + }) + + t.test('errors on proto property (null, null)', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }', null, null), SyntaxError) + t.end() + }) + + t.test('errors on proto property (explicit options)', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }', { constructorAction: 'error' }), SyntaxError) + t.end() + }) + + t.test('errors on proto property (unicode)', t => { + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u0063\\u006fnstructor": {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u0063\\u006f\\u006e\\u0073\\u0074ructor": {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u0063\\u006f\\u006e\\u0073\\u0074\\u0072\\u0075\\u0063\\u0074\\u006f\\u0072": {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u0063\\u006Fnstructor": {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.throws(() => j.parse('{ "a": 5, "b": 6, "\\u0063\\u006F\\u006E\\u0073\\u0074\\u0072\\u0075\\u0063\\u0074\\u006F\\u0072": {"prototype":{"bar":"baz"}} }'), SyntaxError) + t.end() + }) + + t.end() + }) + + t.test('protoAction and constructorAction', t => { + t.test('protoAction=remove constructorAction=remove', t => { + t.deepEqual( + j.parse( + '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }', + { protoAction: 'remove', constructorAction: 'remove' } + ), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('protoAction=ignore constructorAction=remove', t => { + t.deepEqual( + j.parse( + '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }', + { protoAction: 'ignore', constructorAction: 'remove' } + ), + JSON.parse('{ "a": 5, "b": 6, "__proto__": { "x": 7 } }') + ) + t.end() + }) + + t.test('protoAction=remove constructorAction=ignore', t => { + t.deepEqual( + j.parse( + '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }', + { protoAction: 'remove', constructorAction: 'ignore' } + ), + JSON.parse('{ "a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }') + ) + t.end() + }) + + t.test('protoAction=ignore constructorAction=ignore', t => { + t.deepEqual( + j.parse( + '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }', + { protoAction: 'ignore', constructorAction: 'ignore' } + ), + JSON.parse('{ "a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }') + ) + t.end() + }) + + t.test('protoAction=error constructorAction=ignore', t => { + t.throws(() => j.parse( + '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }', + { protoAction: 'error', constructorAction: 'ignore' } + ), SyntaxError) + t.end() + }) + + t.test('protoAction=ignore constructorAction=error', t => { + t.throws(() => j.parse( + '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }', + { protoAction: 'ignore', constructorAction: 'error' } + ), SyntaxError) + t.end() + }) + + t.test('protoAction=error constructorAction=error', t => { + t.throws(() => j.parse( + '{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}}, "__proto__": { "x": 7 } }', + { protoAction: 'error', constructorAction: 'error' } + ), SyntaxError) + t.end() + }) + + t.end() + }) + + t.test('sanitizes nested object string', t => { + const text = '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + const obj = j.parse(text, { protoAction: 'remove' }) + t.deepEqual(obj, { a: 5, b: 6, c: { d: 0, e: 'text', f: { g: 2 } } }) + t.end() + }) + + t.test('errors on constructor property', t => { + const text = '{ "a": 5, "b": 6, "constructor": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + t.throws(() => j.parse(text), SyntaxError) + t.end() + }) + + t.test('errors on proto property', t => { + const text = '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + t.throws(() => j.parse(text), SyntaxError) + t.end() + }) + + t.test('errors on constructor property', t => { + const text = '{ "a": 5, "b": 6, "constructor": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + t.throws(() => j.parse(text), SyntaxError) + t.end() + }) + + t.test('does not break when hasOwnProperty is overwritten', t => { + const text = '{ "a": 5, "b": 6, "hasOwnProperty": "text", "__proto__": { "x": 7 } }' + + const obj = j.parse(text, { protoAction: 'remove' }) + t.deepEqual(obj, { a: 5, b: 6, hasOwnProperty: 'text' }) + t.end() + }) + t.end() +}) + +test('safeParse', t => { + t.test('parses buffer', t => { + t.strictEqual( + j.safeParse(Buffer.from('"X"')), + JSON.parse(Buffer.from('"X"')) + ) + t.end() + }) + + t.test('should reset stackTraceLimit', t => { + const text = '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + Error.stackTraceLimit = 42 + t.same(j.safeParse(text), null) + t.same(Error.stackTraceLimit, 42) + t.end() + }) + + t.test('sanitizes nested object string', t => { + const text = '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + t.same(j.safeParse(text), null) + t.end() + }) + + t.test('returns null on constructor property', t => { + const text = '{ "a": 5, "b": 6, "constructor": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + t.same(j.safeParse(text), null) + t.end() + }) + + t.test('returns null on proto property', t => { + const text = '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + t.same(j.safeParse(text), null) + t.end() + }) + + t.test('returns null on constructor property', t => { + const text = '{ "a": 5, "b": 6, "constructor": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }' + + t.same(j.safeParse(text), null) + t.end() + }) + + t.test('parses object string', t => { + t.deepEqual( + j.safeParse('{"a": 5, "b": 6}'), + { a: 5, b: 6 } + ) + t.end() + }) + + t.test('returns null on proto object string', t => { + t.strictEqual( + j.safeParse('{ "a": 5, "b": 6, "__proto__": { "x": 7 } }'), + null + ) + t.end() + }) + + t.test('returns undefined on invalid object string', t => { + t.strictEqual( + j.safeParse('{"a": 5, "b": 6'), + undefined + ) + t.end() + }) + + t.test('sanitizes object string (options)', t => { + t.deepEqual( + j.safeParse('{"a": 5, "b": 6, "constructor":{"prototype":{"bar":"baz"}} }'), + null + ) + t.end() + }) + + t.test('sanitizes object string (no prototype key)', t => { + t.deepEqual( + j.safeParse('{"a": 5, "b": 6,"constructor":{"bar":"baz"} }'), + { a: 5, b: 6, constructor: { bar: 'baz' } } + ) + t.end() + }) + + t.end() +}) + +test('parse string with BOM', t => { + const theJson = { hello: 'world' } + const buffer = Buffer.concat([ + Buffer.from([239, 187, 191]), // the utf8 BOM + Buffer.from(JSON.stringify(theJson)) + ]) + t.deepEqual(j.parse(buffer.toString()), theJson) + t.end() +}) + +test('parse buffer with BOM', t => { + const theJson = { hello: 'world' } + const buffer = Buffer.concat([ + Buffer.from([239, 187, 191]), // the utf8 BOM + Buffer.from(JSON.stringify(theJson)) + ]) + t.deepEqual(j.parse(buffer), theJson) + t.end() +}) + +test('safeParse string with BOM', t => { + const theJson = { hello: 'world' } + const buffer = Buffer.concat([ + Buffer.from([239, 187, 191]), // the utf8 BOM + Buffer.from(JSON.stringify(theJson)) + ]) + t.deepEqual(j.safeParse(buffer.toString()), theJson) + t.end() +}) + +test('safeParse buffer with BOM', t => { + const theJson = { hello: 'world' } + const buffer = Buffer.concat([ + Buffer.from([239, 187, 191]), // the utf8 BOM + Buffer.from(JSON.stringify(theJson)) + ]) + t.deepEqual(j.safeParse(buffer), theJson) + t.end() +}) + +test('scan handles optional options', t => { + t.doesNotThrow(() => j.scan({ a: 'b' })) + t.end() +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/types/index.d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe38cc393e1a64d00b9d8a5032aa5e8fe63c9189 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/types/index.d.ts @@ -0,0 +1,58 @@ +type Parse = typeof parse + +declare namespace parse { + export type ParseOptions = { + /** + * What to do when a `__proto__` key is found. + * - `'error'` - throw a `SyntaxError` when a `__proto__` key is found. This is the default value. + * - `'remove'` - deletes any `__proto__` keys from the result object. + * - `'ignore'` - skips all validation (same as calling `JSON.parse()` directly). + */ + protoAction?: 'error' | 'remove' | 'ignore'; + /** + * What to do when a `constructor` key is found. + * - `'error'` - throw a `SyntaxError` when a `constructor.prototype` key is found. This is the default value. + * - `'remove'` - deletes any `constructor` keys from the result object. + * - `'ignore'` - skips all validation (same as calling `JSON.parse()` directly). + */ + constructorAction?: 'error' | 'remove' | 'ignore'; + } + + export type ScanOptions = ParseOptions + + export type Reviver = (this: any, key: string, value: any) => any + + /** + * Parses a given JSON-formatted text into an object. + * + * @param text The JSON text string. + * @param reviver The `JSON.parse()` optional `reviver` argument. + * @param options Optional configuration object. + * @returns The parsed object. + */ + export const parse: Parse + + /** + * Parses a given JSON-formatted text into an object. + * + * @param text The JSON text string. + * @param reviver The `JSON.parse()` optional `reviver` argument. + * @returns The parsed object, or `undefined` if there was an error or if the JSON contained possibly insecure properties. + */ + export function safeParse (text: string | Buffer, reviver?: Reviver | null): any + + /** + * Scans a given object for prototype properties. + * + * @param obj The object being scanned. + * @param options Optional configuration object. + * @returns The object, or `null` if onError is set to `nullify` + */ + export function scan (obj: { [key: string | number]: any }, options?: ParseOptions): any + + export { parse as default } +} + +declare function parse (text: string | Buffer, options?: parse.ParseOptions): any +declare function parse (text: string | Buffer, reviver?: parse.Reviver | null, options?: parse.ParseOptions): any +export = parse diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/types/index.test-d.ts b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/types/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..338bf2f1833dac5e1e6802eb3d8c374e0777edb6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/secure-json-parse/types/index.test-d.ts @@ -0,0 +1,35 @@ +import { expectType, expectError } from 'tsd' +import sjson from '..' + +expectError(sjson.parse(null)) +expectType(sjson.parse('{"anything":0}')) + +sjson.parse('"test"', null, { protoAction: 'remove' }) +expectError(sjson.parse('"test"', null, { protoAction: 'incorrect' })) +sjson.parse('"test"', null, { constructorAction: 'ignore' }) +expectError(sjson.parse('"test"', null, { constructorAction: 'incorrect' })) +expectError(sjson.parse('"test"', { constructorAction: 'incorrect' })) +sjson.parse('test', { constructorAction: 'remove' }) +sjson.parse('test', { protoAction: 'ignore' }) +sjson.parse('test', () => {}, { protoAction: 'ignore', constructorAction: 'remove' }) + +sjson.safeParse('"test"', null) +sjson.safeParse('"test"') +expectError(sjson.safeParse(null)) + +sjson.scan({}, { protoAction: 'remove' }) +sjson.scan({}, { protoAction: 'ignore' }) +sjson.scan({}, { constructorAction: 'error' }) +sjson.scan({}, { constructorAction: 'ignore' }) +sjson.scan([], {}) + +declare const input: Buffer +sjson.parse(input) +sjson.safeParse(input) + +sjson.parse('{"anything":0}', (key, value) => { + expectType(key) +}) +sjson.safeParse('{"anything":0}', (key, value) => { + expectType(key) +}) diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/bin/semver.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/bin/semver.js new file mode 100644 index 0000000000000000000000000000000000000000..dbb1bf534ec72246c07ee57bbd8759a5e509d9e6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/bin/semver.js @@ -0,0 +1,191 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +'use strict' + +const argv = process.argv.slice(2) + +let versions = [] + +const range = [] + +let inc = null + +const version = require('../package.json').version + +let loose = false + +let includePrerelease = false + +let coerce = false + +let rtl = false + +let identifier + +let identifierBase + +const semver = require('../') +const parseOptions = require('../internal/parse-options') + +let reverse = false + +let options = {} + +const main = () => { + if (!argv.length) { + return help() + } + while (argv.length) { + let a = argv.shift() + const indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + const value = a.slice(indexOfEqualSign + 1) + a = a.slice(0, indexOfEqualSign) + argv.unshift(value) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + case 'release': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-n': + identifierBase = argv.shift() + if (identifierBase === 'false') { + identifierBase = false + } + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + options = parseOptions({ loose, includePrerelease, rtl }) + + versions = versions.map((v) => { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter((v) => { + return semver.valid(v) + }) + if (!versions.length) { + return fail() + } + if (inc && (versions.length !== 1 || range.length)) { + return failInc() + } + + for (let i = 0, l = range.length; i < l; i++) { + versions = versions.filter((v) => { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) { + return fail() + } + } + versions + .sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options)) + .map(v => semver.clean(v, options)) + .map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v) + .forEach(v => console.log(v)) +} + +const failInc = () => { + console.error('--inc can only be used on a single version with no range') + fail() +} + +const fail = () => process.exit(1) + +const help = () => console.log( +`SemVer ${version} + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, prerelease, or release. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +-n + Base number to be used for the prerelease identifier. + Can be either 0 or 1, or false to omit the number altogether. + Defaults to 0. + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them.`) + +main() diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/comparator.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/comparator.js new file mode 100644 index 0000000000000000000000000000000000000000..647c1f0976fd7838c1b8fe0ba59888f088fb3c5d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/comparator.js @@ -0,0 +1,143 @@ +'use strict' + +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + + constructor (comp, options) { + options = parseOptions(options) + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } + + toString () { + return this.value + } + + test (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + options = parseOptions(options) + + // Special cases where nothing can possibly be lower + if (options.includePrerelease && + (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { + return false + } + if (!options.includePrerelease && + (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { + return false + } + + // Same direction increasing (> or >=) + if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { + return true + } + // Same direction decreasing (< or <=) + if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { + return true + } + // same SemVer and both sides are inclusive (<= or >=) + if ( + (this.semver.version === comp.semver.version) && + this.operator.includes('=') && comp.operator.includes('=')) { + return true + } + // opposite directions less than + if (cmp(this.semver, '<', comp.semver, options) && + this.operator.startsWith('>') && comp.operator.startsWith('<')) { + return true + } + // opposite directions greater than + if (cmp(this.semver, '>', comp.semver, options) && + this.operator.startsWith('<') && comp.operator.startsWith('>')) { + return true + } + return false + } +} + +module.exports = Comparator + +const parseOptions = require('../internal/parse-options') +const { safeRe: re, t } = require('../internal/re') +const cmp = require('../functions/cmp') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const Range = require('./range') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/index.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/index.js new file mode 100644 index 0000000000000000000000000000000000000000..91c24ec4a726497e218889190d533e754a8c1143 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/index.js @@ -0,0 +1,7 @@ +'use strict' + +module.exports = { + SemVer: require('./semver.js'), + Range: require('./range.js'), + Comparator: require('./comparator.js'), +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/range.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/range.js new file mode 100644 index 0000000000000000000000000000000000000000..f80c2359c6b82f127be15e65850044fa5fe4007b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/range.js @@ -0,0 +1,556 @@ +'use strict' + +const SPACE_CHARACTERS = /\s+/g + +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + options = parseOptions(options) + + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.formatted = undefined + return this + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range.trim().replace(SPACE_CHARACTERS, ' ') + + // First, split on || + this.set = this.raw + .split('||') + // map the range to a 2d array of comparators + .map(r => this.parseRange(r.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`) + } + + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0] + this.set = this.set.filter(c => !isNullSet(c[0])) + if (this.set.length === 0) { + this.set = [first] + } else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c] + break + } + } + } + } + + this.formatted = undefined + } + + get range () { + if (this.formatted === undefined) { + this.formatted = '' + for (let i = 0; i < this.set.length; i++) { + if (i > 0) { + this.formatted += '||' + } + const comps = this.set[i] + for (let k = 0; k < comps.length; k++) { + if (k > 0) { + this.formatted += ' ' + } + this.formatted += comps[k].toString().trim() + } + } + } + return this.formatted + } + + format () { + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = + (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | + (this.options.loose && FLAG_LOOSE) + const memoKey = memoOpts + ':' + range + const cached = cache.get(memoKey) + if (cached) { + return cached + } + + const loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + debug('tilde trim', range) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + debug('caret trim', range) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + let rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) + + if (loose) { + // in loose mode, throw out any that are not valid comparators + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) + } + debug('range list', rangeList) + + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + const rangeMap = new Map() + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp] + } + rangeMap.set(comp.value, comp) + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete('') + } + + const result = [...rangeMap.values()] + cache.set(memoKey, result) + return result + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } +} + +module.exports = Range + +const LRU = require('../internal/lrucache') +const cache = new LRU() + +const parseOptions = require('../internal/parse-options') +const Comparator = require('./comparator') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace, +} = require('../internal/re') +const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants') + +const isNullSet = c => c.value === '<0.0.0-0' +const isAny = c => c.value === '' + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +// ~0.0.1 --> >=0.0.1 <0.1.0-0 +const replaceTildes = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceTilde(c, options)) + .join(' ') +} + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +// ^0.0.1 --> >=0.0.1 <0.0.2-0 +// ^0.1.0 --> >=0.1.0 <0.2.0-0 +const replaceCarets = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceCaret(c, options)) + .join(' ') +} + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp + .split(/\s+/) + .map((c) => replaceXRange(c, options)) + .join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + if (gtlt === '<') { + pr = '-0' + } + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp + .trim() + .replace(re[t.STAR], '') +} + +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp + .trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +// TODO build? +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } + + return `${from} ${to}`.trim() +} + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/semver.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/semver.js new file mode 100644 index 0000000000000000000000000000000000000000..2efba0f4b6451e0a78557f2b959b348f0ee551ca --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/classes/semver.js @@ -0,0 +1,319 @@ +'use strict' + +const debug = require('../internal/debug') +const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants') +const { safeRe: re, t } = require('../internal/re') + +const parseOptions = require('../internal/parse-options') +const { compareIdentifiers } = require('../internal/identifiers') +class SemVer { + constructor (version, options) { + options = parseOptions(options) + + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease + + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('build compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier, identifierBase) { + if (release.startsWith('pre')) { + if (!identifier && identifierBase === false) { + throw new Error('invalid increment argument: identifier is empty') + } + // Avoid an invalid semver results + if (identifier) { + const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]) + if (!match || match[1] !== identifier) { + throw new Error(`invalid identifier: ${identifier}`) + } + } + } + + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier, identifierBase) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier, identifierBase) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier, identifierBase) + this.inc('pre', identifier, identifierBase) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier, identifierBase) + } + this.inc('pre', identifier, identifierBase) + break + case 'release': + if (this.prerelease.length === 0) { + throw new Error(`version ${this.raw} is not a prerelease`) + } + this.prerelease.length = 0 + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': { + const base = Number(identifierBase) ? 1 : 0 + + if (this.prerelease.length === 0) { + this.prerelease = [base] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + if (identifier === this.prerelease.join('.') && identifierBase === false) { + throw new Error('invalid increment argument: identifier already exists') + } + this.prerelease.push(base) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + let prerelease = [identifier, base] + if (identifierBase === false) { + prerelease = [identifier] + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease + } + } else { + this.prerelease = prerelease + } + } + break + } + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.raw = this.format() + if (this.build.length) { + this.raw += `+${this.build.join('.')}` + } + return this + } +} + +module.exports = SemVer diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/clean.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/clean.js new file mode 100644 index 0000000000000000000000000000000000000000..79703d6316617ea8df49384c47b1e235357ff1a9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/clean.js @@ -0,0 +1,8 @@ +'use strict' + +const parse = require('./parse') +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/cmp.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/cmp.js new file mode 100644 index 0000000000000000000000000000000000000000..77487dcaac5f502ad1172a54a7047bcafbfbda4d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/cmp.js @@ -0,0 +1,54 @@ +'use strict' + +const eq = require('./eq') +const neq = require('./neq') +const gt = require('./gt') +const gte = require('./gte') +const lt = require('./lt') +const lte = require('./lte') + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a === b + + case '!==': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/coerce.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/coerce.js new file mode 100644 index 0000000000000000000000000000000000000000..cfe027599516f3d6c2165a1858d50d7810dc9dba --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/coerce.js @@ -0,0 +1,62 @@ +'use strict' + +const SemVer = require('../classes/semver') +const parse = require('./parse') +const { safeRe: re, t } = require('../internal/re') + +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] + let next + while ((next = coerceRtlRegex.exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + coerceRtlRegex.lastIndex = -1 + } + + if (match === null) { + return null + } + + const major = match[2] + const minor = match[3] || '0' + const patch = match[4] || '0' + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' + const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' + + return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) +} +module.exports = coerce diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare-build.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare-build.js new file mode 100644 index 0000000000000000000000000000000000000000..99157cf3d105e07072d856b72475983836e2a48a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare-build.js @@ -0,0 +1,9 @@ +'use strict' + +const SemVer = require('../classes/semver') +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare-loose.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare-loose.js new file mode 100644 index 0000000000000000000000000000000000000000..75316346a81cb3b3ba74442fb24583d6972a48ee --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare-loose.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare.js new file mode 100644 index 0000000000000000000000000000000000000000..63d8090c626cea207b5cc1fbb022dd51881bbf99 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/compare.js @@ -0,0 +1,7 @@ +'use strict' + +const SemVer = require('../classes/semver') +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/diff.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/diff.js new file mode 100644 index 0000000000000000000000000000000000000000..04e064e9196b58d64737515c01fe2deb3237554e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/diff.js @@ -0,0 +1,60 @@ +'use strict' + +const parse = require('./parse.js') + +const diff = (version1, version2) => { + const v1 = parse(version1, null, true) + const v2 = parse(version2, null, true) + const comparison = v1.compare(v2) + + if (comparison === 0) { + return null + } + + const v1Higher = comparison > 0 + const highVersion = v1Higher ? v1 : v2 + const lowVersion = v1Higher ? v2 : v1 + const highHasPre = !!highVersion.prerelease.length + const lowHasPre = !!lowVersion.prerelease.length + + if (lowHasPre && !highHasPre) { + // Going from prerelease -> no prerelease requires some special casing + + // If the low version has only a major, then it will always be a major + // Some examples: + // 1.0.0-1 -> 1.0.0 + // 1.0.0-1 -> 1.1.1 + // 1.0.0-1 -> 2.0.0 + if (!lowVersion.patch && !lowVersion.minor) { + return 'major' + } + + // If the main part has no difference + if (lowVersion.compareMain(highVersion) === 0) { + if (lowVersion.minor && !lowVersion.patch) { + return 'minor' + } + return 'patch' + } + } + + // add the `pre` prefix if we are going to a prerelease version + const prefix = highHasPre ? 'pre' : '' + + if (v1.major !== v2.major) { + return prefix + 'major' + } + + if (v1.minor !== v2.minor) { + return prefix + 'minor' + } + + if (v1.patch !== v2.patch) { + return prefix + 'patch' + } + + // high and low are preleases + return 'prerelease' +} + +module.exports = diff diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/eq.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/eq.js new file mode 100644 index 0000000000000000000000000000000000000000..5f0eead1169fe5e7d661ff2bb2b9bede6967014b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/eq.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/gt.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/gt.js new file mode 100644 index 0000000000000000000000000000000000000000..84a57ddff50a098bafaa44973830114fa150c3fa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/gt.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/gte.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/gte.js new file mode 100644 index 0000000000000000000000000000000000000000..7c52bdf2529ad82aacf17bb895d18bc228da19ec --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/gte.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/inc.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/inc.js new file mode 100644 index 0000000000000000000000000000000000000000..ff999e9d04d7fa3a725621912399df35f450c845 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/inc.js @@ -0,0 +1,21 @@ +'use strict' + +const SemVer = require('../classes/semver') + +const inc = (version, release, options, identifier, identifierBase) => { + if (typeof (options) === 'string') { + identifierBase = identifier + identifier = options + options = undefined + } + + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options + ).inc(release, identifier, identifierBase).version + } catch (er) { + return null + } +} +module.exports = inc diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/lt.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/lt.js new file mode 100644 index 0000000000000000000000000000000000000000..2fb32a0e63c9a140cc3acb351cd5ce6c3c75d501 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/lt.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/lte.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/lte.js new file mode 100644 index 0000000000000000000000000000000000000000..da9ee8f4e4404e5acf0af1045b6045534dbbfe06 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/lte.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/major.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/major.js new file mode 100644 index 0000000000000000000000000000000000000000..e6d08dc20cf20bc84e954762375ece363452c616 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/major.js @@ -0,0 +1,5 @@ +'use strict' + +const SemVer = require('../classes/semver') +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/minor.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/minor.js new file mode 100644 index 0000000000000000000000000000000000000000..9e70ffda19223a878a2dbb2851d7092e776eb1c7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/minor.js @@ -0,0 +1,5 @@ +'use strict' + +const SemVer = require('../classes/semver') +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/neq.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/neq.js new file mode 100644 index 0000000000000000000000000000000000000000..84326b773361035e89898edc52fa69bd96371003 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/neq.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/parse.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/parse.js new file mode 100644 index 0000000000000000000000000000000000000000..d544d33a7e93cb8e88a0641d3666398c3d515759 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/parse.js @@ -0,0 +1,18 @@ +'use strict' + +const SemVer = require('../classes/semver') +const parse = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version + } + try { + return new SemVer(version, options) + } catch (er) { + if (!throwErrors) { + return null + } + throw er + } +} + +module.exports = parse diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/patch.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/patch.js new file mode 100644 index 0000000000000000000000000000000000000000..7675162f1742afbe0750d1c28fb3ac9695384a74 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/patch.js @@ -0,0 +1,5 @@ +'use strict' + +const SemVer = require('../classes/semver') +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/prerelease.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/prerelease.js new file mode 100644 index 0000000000000000000000000000000000000000..b8fe1db5049a23a0c772a465e48932f3de7d5d65 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/prerelease.js @@ -0,0 +1,8 @@ +'use strict' + +const parse = require('./parse') +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} +module.exports = prerelease diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/rcompare.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/rcompare.js new file mode 100644 index 0000000000000000000000000000000000000000..8e1c222b2ffc24e93a52378ad4d158dbc0d63c27 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/rcompare.js @@ -0,0 +1,5 @@ +'use strict' + +const compare = require('./compare') +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/rsort.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/rsort.js new file mode 100644 index 0000000000000000000000000000000000000000..5d3d20096844b17956ee75c1f44e8885d7eb0396 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/rsort.js @@ -0,0 +1,5 @@ +'use strict' + +const compareBuild = require('./compare-build') +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/satisfies.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/satisfies.js new file mode 100644 index 0000000000000000000000000000000000000000..a0264a222ac82d7271d755bbb40390961871601c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/satisfies.js @@ -0,0 +1,12 @@ +'use strict' + +const Range = require('../classes/range') +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/sort.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/sort.js new file mode 100644 index 0000000000000000000000000000000000000000..edb24b1dc3324d6938191b41d7003db4489b7f90 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/sort.js @@ -0,0 +1,5 @@ +'use strict' + +const compareBuild = require('./compare-build') +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/valid.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/valid.js new file mode 100644 index 0000000000000000000000000000000000000000..0db67edcb5952a9b56dfe514b4d934da090c4e65 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/functions/valid.js @@ -0,0 +1,8 @@ +'use strict' + +const parse = require('./parse') +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/constants.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..6d1db9154331d4198faadda0a5432b6b1cc3a5e8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/constants.js @@ -0,0 +1,37 @@ +'use strict' + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' + +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +// Max safe length for a build identifier. The max length minus 6 characters for +// the shortest version with a build 0.0.0+BUILD. +const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +const RELEASE_TYPES = [ + 'major', + 'premajor', + 'minor', + 'preminor', + 'patch', + 'prepatch', + 'prerelease', +] + +module.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 0b001, + FLAG_LOOSE: 0b010, +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/debug.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/debug.js new file mode 100644 index 0000000000000000000000000000000000000000..20d1e9dceea90e730220344671d4807203f5d9d8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/debug.js @@ -0,0 +1,11 @@ +'use strict' + +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/identifiers.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/identifiers.js new file mode 100644 index 0000000000000000000000000000000000000000..a4613dee7977f09f21c34995e3335103fdb574f4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/identifiers.js @@ -0,0 +1,25 @@ +'use strict' + +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers, +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/lrucache.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/lrucache.js new file mode 100644 index 0000000000000000000000000000000000000000..b8bf5262a0505c8b4bba7003a7cd1bd898fed789 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/lrucache.js @@ -0,0 +1,42 @@ +'use strict' + +class LRUCache { + constructor () { + this.max = 1000 + this.map = new Map() + } + + get (key) { + const value = this.map.get(key) + if (value === undefined) { + return undefined + } else { + // Remove the key from the map and add it to the end + this.map.delete(key) + this.map.set(key, value) + return value + } + } + + delete (key) { + return this.map.delete(key) + } + + set (key, value) { + const deleted = this.delete(key) + + if (!deleted && value !== undefined) { + // If cache is full, delete the least recently used item + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value + this.delete(firstKey) + } + + this.map.set(key, value) + } + + return this + } +} + +module.exports = LRUCache diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/parse-options.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/parse-options.js new file mode 100644 index 0000000000000000000000000000000000000000..5295454130d421f5b9e54bae4572b3615af696bf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/parse-options.js @@ -0,0 +1,17 @@ +'use strict' + +// parse out just the options we care about +const looseOption = Object.freeze({ loose: true }) +const emptyOpts = Object.freeze({ }) +const parseOptions = options => { + if (!options) { + return emptyOpts + } + + if (typeof options !== 'object') { + return looseOption + } + + return options +} +module.exports = parseOptions diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/re.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/re.js new file mode 100644 index 0000000000000000000000000000000000000000..4758c58d424a9be78121fb0bc4a9521899952572 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/internal/re.js @@ -0,0 +1,223 @@ +'use strict' + +const { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH, +} = require('./constants') +const debug = require('./debug') +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const safeRe = exports.safeRe = [] +const src = exports.src = [] +const safeSrc = exports.safeSrc = [] +const t = exports.t = {} +let R = 0 + +const LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +const safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +const makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value + .split(`${token}*`).join(`${token}{0,${max}}`) + .split(`${token}+`).join(`${token}{1,${max}}`) + } + return value +} + +const createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value) + const index = R++ + debug(name, index, value) + t[name] = index + src[index] = value + safeSrc[index] = safe + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) + safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '\\d+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. +// Non-numberic identifiers include numberic identifiers but can be longer. +// Therefore non-numberic identifiers must go first. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER] +}|${src[t.NUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER] +}|${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCEPLAIN', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) +createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) +createToken('COERCEFULL', src[t.COERCEPLAIN] + + `(?:${src[t.PRERELEASE]})?` + + `(?:${src[t.BUILD]})?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) +createToken('COERCERTLFULL', src[t.COERCEFULL], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/gtr.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/gtr.js new file mode 100644 index 0000000000000000000000000000000000000000..0e7601f693554a1c24854ca0be67447b70b7ca16 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/gtr.js @@ -0,0 +1,6 @@ +'use strict' + +// Determine if version is greater than all the versions possible in the range. +const outside = require('./outside') +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/intersects.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/intersects.js new file mode 100644 index 0000000000000000000000000000000000000000..917be7e4293d2b0f5a7cd6327addaab0f18c7ef1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/intersects.js @@ -0,0 +1,9 @@ +'use strict' + +const Range = require('../classes/range') +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2, options) +} +module.exports = intersects diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/ltr.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/ltr.js new file mode 100644 index 0000000000000000000000000000000000000000..aa5e568ec279da4a3c292694ed066b2fde4e14b7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/ltr.js @@ -0,0 +1,6 @@ +'use strict' + +const outside = require('./outside') +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/max-satisfying.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/max-satisfying.js new file mode 100644 index 0000000000000000000000000000000000000000..01fe5ae383715768e93e2b2c5f3c006a6212fb83 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/max-satisfying.js @@ -0,0 +1,27 @@ +'use strict' + +const SemVer = require('../classes/semver') +const Range = require('../classes/range') + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} +module.exports = maxSatisfying diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/min-satisfying.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/min-satisfying.js new file mode 100644 index 0000000000000000000000000000000000000000..af89c8ef4326921204264943a9e37ef4fc151ccd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/min-satisfying.js @@ -0,0 +1,26 @@ +'use strict' + +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} +module.exports = minSatisfying diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/min-version.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/min-version.js new file mode 100644 index 0000000000000000000000000000000000000000..09a65aa36fd5178264b77a05b19bc187b289294a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/min-version.js @@ -0,0 +1,63 @@ +'use strict' + +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const gt = require('../functions/gt') + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let setMin = null + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!setMin || gt(compver, setMin)) { + setMin = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin + } + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/outside.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/outside.js new file mode 100644 index 0000000000000000000000000000000000000000..ca7442120798eaff9d2cd621562a5a4b11da3629 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/outside.js @@ -0,0 +1,82 @@ +'use strict' + +const SemVer = require('../classes/semver') +const Comparator = require('../classes/comparator') +const { ANY } = Comparator +const Range = require('../classes/range') +const satisfies = require('../functions/satisfies') +const gt = require('../functions/gt') +const lt = require('../functions/lt') +const lte = require('../functions/lte') +const gte = require('../functions/gte') + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisfies the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/simplify.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/simplify.js new file mode 100644 index 0000000000000000000000000000000000000000..262732e670d7dfdca05bb3278321dff65a8bd984 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/simplify.js @@ -0,0 +1,49 @@ +'use strict' + +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') +module.exports = (versions, range, options) => { + const set = [] + let first = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!first) { + first = version + } + } else { + if (prev) { + set.push([first, prev]) + } + prev = null + first = null + } + } + if (first) { + set.push([first, null]) + } + + const ranges = [] + for (const [min, max] of set) { + if (min === max) { + ranges.push(min) + } else if (!max && min === v[0]) { + ranges.push('*') + } else if (!max) { + ranges.push(`>=${min}`) + } else if (min === v[0]) { + ranges.push(`<=${max}`) + } else { + ranges.push(`${min} - ${max}`) + } + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/subset.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/subset.js new file mode 100644 index 0000000000000000000000000000000000000000..2c49aef1be5e87719bc7922aba4377abbfd57f9a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/subset.js @@ -0,0 +1,249 @@ +'use strict' + +const Range = require('../classes/range.js') +const Comparator = require('../classes/comparator.js') +const { ANY } = Comparator +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') + +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a null set, OR +// - Every simple range `r1, r2, ...` which is not a null set is a subset of +// some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else if in prerelease mode, return false +// - else replace c with `[>=0.0.0]` +// - If C is only the ANY comparator +// - if in prerelease mode, return true +// - else replace C with `[>=0.0.0]` +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If any C is a = range, and GT or LT are set, return false +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the GT.semver tuple, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the LT.semver tuple, return false +// - Else return true + +const subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true + } + + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) { + continue OUTER + } + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) { + return false + } + } + return true +} + +const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] +const minimumVersion = [new Comparator('>=0.0.0')] + +const simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true + } + + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease + } else { + sub = minimumVersion + } + } + + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = minimumVersion + } + } + + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') { + gt = higherGT(gt, c, options) + } else if (c.operator === '<' || c.operator === '<=') { + lt = lowerLT(lt, c, options) + } else { + eqSet.add(c.semver) + } + } + + if (eqSet.size > 1) { + return null + } + + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) { + return null + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { + return null + } + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null + } + + if (lt && !satisfies(eq, String(lt), options)) { + return null + } + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false + } + } + + return true + } + + let higher, lower + let hasDomLT, hasDomGT + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } + + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + return false + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { + return false + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false + } + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false + } + + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false + } + + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + return false + } + + return true +} + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} + +module.exports = subset diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/to-comparators.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/to-comparators.js new file mode 100644 index 0000000000000000000000000000000000000000..5be251961acbdfa429cf087f94ad3b4c1719764e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/to-comparators.js @@ -0,0 +1,10 @@ +'use strict' + +const Range = require('../classes/range') + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators diff --git a/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/valid.js b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/valid.js new file mode 100644 index 0000000000000000000000000000000000000000..cc6b0e9f68f95f8a5a26f47fa9fddb06f3625e7a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/node_modules/semver/ranges/valid.js @@ -0,0 +1,13 @@ +'use strict' + +const Range = require('../classes/range') +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange