@coobaha/typed-fastify
Advanced tools
Comparing version
@@ -102,4 +102,8 @@ "use strict"; | ||
} | ||
function isSchemaTag(tag) { | ||
var _a, _b; | ||
return (((_a = tag.enum) === null || _a === void 0 ? void 0 : _a.length) === 1 && ((_b = tag.enum) === null || _b === void 0 ? void 0 : _b[0]) === 'BETTER-FASTIFY-SCHEMA') || tag.const === 'BETTER-FASTIFY-SCHEMA'; | ||
} | ||
exports.default = async (params) => { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
const compilerOptions = { | ||
@@ -110,3 +114,2 @@ resolveJsonModule: false, | ||
skipLibCheck: true, | ||
skipDefaultLibCheck: true, | ||
strict: true, | ||
@@ -119,2 +122,3 @@ }; | ||
aliasRef: false, | ||
skipLibCheck: true, | ||
topRef: true, | ||
@@ -165,10 +169,10 @@ ignoreErrors: true, | ||
continue; | ||
if (((_c = tag.enum) === null || _c === void 0 ? void 0 : _c.length) === 1 && ((_d = tag.enum) === null || _d === void 0 ? void 0 : _d[0]) === 'BETTER-FASTIFY-SCHEMA') { | ||
if (isSchemaTag(tag)) { | ||
delete $defs[defName]; | ||
} | ||
const paths = Object.entries((_f = (_e = def.properties.paths) === null || _e === void 0 ? void 0 : _e.properties) !== null && _f !== void 0 ? _f : {}); | ||
const paths = Object.entries((_d = (_c = def.properties.paths) === null || _c === void 0 ? void 0 : _c.properties) !== null && _d !== void 0 ? _d : {}); | ||
for (const [path, config] of paths) { | ||
if (typeof config !== 'object') | ||
continue; | ||
const schema = (_g = config === null || config === void 0 ? void 0 : config.properties) !== null && _g !== void 0 ? _g : {}; | ||
const schema = (_e = config === null || config === void 0 ? void 0 : config.properties) !== null && _e !== void 0 ? _e : {}; | ||
const key = path; | ||
@@ -180,5 +184,5 @@ if (fastify[key]) { | ||
continue; | ||
if (typeof ((_j = (_h = schema.response) === null || _h === void 0 ? void 0 : _h.properties) === null || _j === void 0 ? void 0 : _j.content) === 'boolean') | ||
if (typeof ((_g = (_f = schema.response) === null || _f === void 0 ? void 0 : _f.properties) === null || _g === void 0 ? void 0 : _g.content) === 'boolean') | ||
continue; | ||
const response = Object.entries((_l = (_k = schema.response) === null || _k === void 0 ? void 0 : _k.properties) !== null && _l !== void 0 ? _l : {}).reduce((acc, [status, response]) => { | ||
const response = Object.entries((_j = (_h = schema.response) === null || _h === void 0 ? void 0 : _h.properties) !== null && _j !== void 0 ? _j : {}).reduce((acc, [status, response]) => { | ||
var _a; | ||
@@ -185,0 +189,0 @@ if (typeof response !== 'boolean' && ((_a = response === null || response === void 0 ? void 0 : response.properties) === null || _a === void 0 ? void 0 : _a.content)) { |
{ | ||
"name": "@coobaha/typed-fastify", | ||
"description": "opinionated types for fastify", | ||
"version": "1.1.2", | ||
"version": "1.1.4", | ||
"bin": { | ||
@@ -10,34 +10,34 @@ "tfs": "bin/gen.bin.js", | ||
"dependencies": { | ||
"@types/json-schema": "^7.0.11", | ||
"@types/json-schema": "^7.0.12", | ||
"crypto-js": "^4.1.1", | ||
"glob": "^10.2.5", | ||
"glob": "^10.3.3", | ||
"json-schema-merge-allof": "^0.8.1", | ||
"json-schema-traverse": "^1.0.0", | ||
"typescript-json-schema": "^0.56.0", | ||
"typescript-json-schema": "^0.59.0", | ||
"yargs": "^17.7.2" | ||
}, | ||
"devDependencies": { | ||
"@fastify/swagger": "^8.4.0", | ||
"@fastify/swagger-ui": "^1.8.1", | ||
"@fastify/swagger": "^8.9.0", | ||
"@fastify/swagger-ui": "^1.9.3", | ||
"@types/crypto-js": "^4.1.1", | ||
"@types/glob": "^8.1.0", | ||
"@types/json-schema-merge-allof": "^0.6.1", | ||
"@types/node": "^20.2.1", | ||
"@types/prettier": "^2.7.2", | ||
"@types/lint-staged": "^13.2.0", | ||
"@types/node": "^20.5.1", | ||
"@types/split2": "^4.2.0", | ||
"@types/tap": "^15.0.8", | ||
"@types/yargs": "^17.0.24", | ||
"fastify": "^4.17.0", | ||
"fastify": "^4.21.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.2", | ||
"pino-pretty": "^10.0.0", | ||
"lint-staged": "^14.0.1", | ||
"pino-pretty": "^10.2.0", | ||
"pinst": "^3.0.0", | ||
"prettier": "^2.8.8", | ||
"prettier": "^3.0.2", | ||
"split2": "^4.2.0", | ||
"syncpack": "^9.8.6", | ||
"tap": "^16.3.4", | ||
"syncpack": "^11.2.1", | ||
"tap": "^16.3.8", | ||
"ts-node-dev": "^2.0.0", | ||
"tsd": "^0.28.1", | ||
"type-fest": "^3.10.0", | ||
"typescript": "^5.0.4" | ||
"type-fest": "^4.2.0", | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -44,0 +44,0 @@ "directories": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
92717
0.24%1144
0.35%+ Added
- Removed
Updated
Updated