@agreed/typed
Advanced tools
Comparing version 5.1.6 to 5.1.7
@@ -21,6 +21,6 @@ #!/usr/bin/env node | ||
stopEarly: true, | ||
string: ["help", "version"] | ||
string: ["help", "version"], | ||
}); | ||
const commands = { | ||
["gen-swagger"]: gen_swagger_1.generate | ||
["gen-swagger"]: gen_swagger_1.generate, | ||
}; | ||
@@ -27,0 +27,0 @@ if (argv.help) { |
import { Definition } from "typescript-json-schema"; | ||
export declare function generate(arg: any): void; | ||
export declare function run({ path: pt, depth, title, description, version, host, disablePathNumber }: { | ||
export declare function run({ path: pt, depth, title, description, version, host, disablePathNumber, }: { | ||
path: any; | ||
@@ -26,3 +26,3 @@ depth: any; | ||
path: string[]; | ||
schemas: Array<{ | ||
schemas: { | ||
name: string; | ||
@@ -32,3 +32,3 @@ path: string[]; | ||
schema: Definition; | ||
}>; | ||
}[]; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.run = exports.generate = void 0; | ||
const doctrine = require("doctrine"); | ||
@@ -40,5 +41,5 @@ const minimist = require("minimist"); | ||
"host", | ||
"format" | ||
"format", | ||
], | ||
boolean: ["dry-run", "disable-path-number", "minify"] | ||
boolean: ["dry-run", "disable-path-number", "minify"], | ||
}); | ||
@@ -61,3 +62,3 @@ if (argv.help) { | ||
host: argv.host, | ||
disablePathNumber: argv["disable-path-number"] | ||
disablePathNumber: argv["disable-path-number"], | ||
}); | ||
@@ -68,3 +69,3 @@ write(swagger, { | ||
filename: argv.output, | ||
minify: argv.minify | ||
minify: argv.minify, | ||
}); | ||
@@ -77,3 +78,3 @@ } | ||
filename: "schema", | ||
minify: false | ||
minify: false, | ||
}) { | ||
@@ -92,10 +93,10 @@ const output = format === "yaml" | ||
// testing entry point | ||
function run({ path: pt, depth, title, description, version, host, disablePathNumber }) { | ||
function run({ path: pt, depth, title, description, version, host, disablePathNumber, }) { | ||
const agreedPath = path.resolve(process.cwd(), pt); | ||
require(agreedPath); | ||
const currentModule = require.main.children.find(m => m.filename === __filename); | ||
const agreedRoot = currentModule.children.find(m => m.filename === agreedPath); | ||
const currentModule = require.main.children.find((m) => m.filename === __filename); | ||
const agreedRoot = currentModule.children.find((m) => m.filename === agreedPath); | ||
const { mods, files } = aggregateModules(agreedRoot, depth); | ||
const metaInfos = mods.reduce((p, a) => { | ||
p = p.concat(...a.asts.map(m => m.meta)); | ||
p = p.concat(...a.asts.map((m) => m.meta)); | ||
return p; | ||
@@ -105,3 +106,3 @@ }, []); | ||
const defs = schemas | ||
.filter(s => s.schema.definitions) | ||
.filter((s) => s.schema.definitions) | ||
.reduce((p, c) => { | ||
@@ -111,3 +112,3 @@ return Object.assign(Object.assign({}, p), c.schema.definitions); | ||
const specs = schemas.reduce((prev, current) => { | ||
const exist = prev.find(p => { | ||
const exist = prev.find((p) => { | ||
return isSamePath(p.path, current.path); | ||
@@ -137,3 +138,3 @@ }); | ||
const docs = ast.comments | ||
.filter(c => { | ||
.filter((c) => { | ||
return c.type === "Block"; | ||
@@ -162,3 +163,3 @@ }) | ||
const params = annotation.typeParameters; | ||
const pathArr = params.params[1].elementTypes.map(p => { | ||
const pathArr = params.params[1].elementTypes.map((p) => { | ||
if (p.literal) { | ||
@@ -174,5 +175,5 @@ return p.literal.value; // string | ||
path: pathArr, | ||
doc | ||
doc, | ||
}, | ||
ast: current | ||
ast: current, | ||
}); | ||
@@ -186,3 +187,3 @@ } | ||
} | ||
module.children.forEach(m => { | ||
module.children.forEach((m) => { | ||
rec(m, asts, depth + 1, limit); | ||
@@ -189,0 +190,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateSchema = void 0; | ||
const ts = require("typescript"); | ||
@@ -4,0 +5,0 @@ const TJS = require("typescript-json-schema"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateSwagger = void 0; | ||
function generateSwagger(specs, title = "Agreed", description = "Generate via agreed-typed", version = "0.0.1", host = "localhost:3000", definitions, disablePathNumber) { | ||
@@ -4,0 +5,0 @@ const swagger = { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.replace = exports.convert = void 0; | ||
function convert(...apis) { | ||
@@ -4,0 +5,0 @@ return apis.map(a => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.flatten = exports.showHelp = void 0; | ||
function showHelp(exitcode, help) { | ||
@@ -4,0 +5,0 @@ process.stdout.write(help); |
{ | ||
"name": "@agreed/typed", | ||
"version": "5.1.6", | ||
"version": "5.1.7", | ||
"main": "./lib/types.js", | ||
@@ -18,3 +18,3 @@ "types": "./lib/types.d.ts", | ||
"lint": "tslint ./src/**/*.ts", | ||
"fmt": "tslint --fix", | ||
"fmt": "tslint ./src/**/*.ts --fix", | ||
"tsc": "yarn clean && tsc", | ||
@@ -28,4 +28,3 @@ "clean": "rimraf ./lib/*", | ||
"devDependencies": { | ||
"@types/jest": "25.2.1", | ||
"@types/power-assert": "1.5.3", | ||
"@types/jest": "25.2.3", | ||
"axios": "0.19.2", | ||
@@ -37,6 +36,5 @@ "body-parser": "1.19.0", | ||
"jest": "26.0.1", | ||
"power-assert": "1.6.1", | ||
"prettier": "2.0.5", | ||
"rimraf": "3.0.2", | ||
"ts-jest": "25.5.1", | ||
"ts-jest": "26.0.0", | ||
"ts-node": "8.10.1", | ||
@@ -46,3 +44,3 @@ "tslint": "6.1.2", | ||
"tslint-plugin-prettier": "2.3.0", | ||
"typescript": "3.8.3", | ||
"typescript": "3.9.3", | ||
"yarn": "1.22.4" | ||
@@ -75,7 +73,7 @@ }, | ||
"dependencies": { | ||
"@agreed/core": "^5.1.6", | ||
"@agreed/core": "^5.1.7", | ||
"@types/estree": "0.0.44", | ||
"@types/minimist": "^1.2.0", | ||
"@types/node": "^12.0.0", | ||
"@typescript-eslint/typescript-estree": "^2.0.0", | ||
"@typescript-eslint/typescript-estree": "^3.0.0", | ||
"doctrine": "^3.0.0", | ||
@@ -89,3 +87,3 @@ "json2yaml": "^1.1.0", | ||
}, | ||
"gitHead": "44f8017b8ae8524ab8832fbe7a2c0fad0da7ce0f" | ||
"gitHead": "9b9db9718599dc808dd3fc3e96ee45197868ae00" | ||
} |
@@ -8,5 +8,5 @@ import * as Agreed from "@agreed/core"; | ||
import * as path from "path"; | ||
import * as assert from "power-assert"; | ||
import * as assert from "assert"; | ||
const setupServer = agreed => { | ||
const setupServer = (agreed) => { | ||
const app = express(); | ||
@@ -17,3 +17,3 @@ app.use(bodyParser.json()); | ||
agreed.middleware({ | ||
path: path.resolve(__dirname, "./data/agreed.ts") | ||
path: path.resolve(__dirname, "./data/agreed.ts"), | ||
}) | ||
@@ -30,3 +30,3 @@ ); | ||
test("register ts agrees with get", async done => { | ||
test("register ts agrees with get", async (done) => { | ||
const port = await getPort(); | ||
@@ -51,3 +51,3 @@ const agreed = new Agreed(); | ||
test("register ts agrees with get and query", async done => { | ||
test("register ts agrees with get and query", async (done) => { | ||
const port = await getPort(); | ||
@@ -73,3 +73,3 @@ const agreed = new Agreed(); | ||
test("register ts agrees with post", async done => { | ||
test("register ts agrees with post", async (done) => { | ||
const port = await getPort(); | ||
@@ -87,8 +87,8 @@ const agreed = new Agreed(); | ||
id: 123, | ||
genderId: 2 | ||
genderId: 2, | ||
}, | ||
{ | ||
headers: { | ||
apiKey: "aaa" | ||
} | ||
apiKey: "aaa", | ||
}, | ||
} | ||
@@ -95,0 +95,0 @@ ); |
@@ -22,6 +22,6 @@ #!/usr/bin/env node | ||
stopEarly: true, | ||
string: ["help", "version"] | ||
string: ["help", "version"], | ||
}); | ||
const commands = { | ||
["gen-swagger"]: generate | ||
["gen-swagger"]: generate, | ||
}; | ||
@@ -28,0 +28,0 @@ |
@@ -11,3 +11,3 @@ import * as doctrine from "doctrine"; | ||
TSTypeAliasDeclaration, | ||
TSTypeReference | ||
TSTypeReference, | ||
} from "@typescript-eslint/typescript-estree/dist/ts-estree/ts-estree"; | ||
@@ -48,5 +48,5 @@ import { ExportNamedDeclaration, Identifier } from "estree"; | ||
"host", | ||
"format" | ||
"format", | ||
], | ||
boolean: ["dry-run", "disable-path-number", "minify"] | ||
boolean: ["dry-run", "disable-path-number", "minify"], | ||
}); | ||
@@ -73,3 +73,3 @@ | ||
host: argv.host, | ||
disablePathNumber: argv["disable-path-number"] | ||
disablePathNumber: argv["disable-path-number"], | ||
}); | ||
@@ -81,3 +81,3 @@ | ||
filename: argv.output, | ||
minify: argv.minify | ||
minify: argv.minify, | ||
}); | ||
@@ -92,3 +92,3 @@ } | ||
filename: "schema", | ||
minify: false | ||
minify: false, | ||
} | ||
@@ -120,3 +120,3 @@ ) { | ||
host, | ||
disablePathNumber | ||
disablePathNumber, | ||
}) { | ||
@@ -127,7 +127,7 @@ const agreedPath = path.resolve(process.cwd(), pt); | ||
const currentModule = require.main.children.find( | ||
m => m.filename === __filename | ||
(m) => m.filename === __filename | ||
); | ||
const agreedRoot = currentModule.children.find( | ||
m => m.filename === agreedPath | ||
(m) => m.filename === agreedPath | ||
); | ||
@@ -138,3 +138,3 @@ | ||
const metaInfos = mods.reduce((p, a) => { | ||
p = p.concat(...a.asts.map(m => m.meta)); | ||
p = p.concat(...a.asts.map((m) => m.meta)); | ||
return p; | ||
@@ -145,7 +145,7 @@ }, []); | ||
const defs = schemas | ||
.filter(s => s.schema.definitions) | ||
.filter((s) => s.schema.definitions) | ||
.reduce((p, c) => { | ||
return { | ||
...p, | ||
...c.schema.definitions | ||
...c.schema.definitions, | ||
}; | ||
@@ -155,3 +155,3 @@ }, {}); | ||
const specs = schemas.reduce((prev: ReducedSpec[], current) => { | ||
const exist = prev.find(p => { | ||
const exist = prev.find((p) => { | ||
return isSamePath(p.path, current.path); | ||
@@ -179,3 +179,3 @@ }); | ||
path: string[]; | ||
schemas: Array<{ | ||
schemas: { | ||
name: string; | ||
@@ -185,3 +185,3 @@ path: string[]; | ||
schema: Definition; | ||
}>; | ||
}[]; | ||
} | ||
@@ -204,3 +204,3 @@ | ||
const docs = ast.comments | ||
.filter(c => { | ||
.filter((c) => { | ||
return c.type === "Block"; | ||
@@ -240,3 +240,3 @@ }) | ||
const pathArr = params.params[1].elementTypes.map(p => { | ||
const pathArr = params.params[1].elementTypes.map((p) => { | ||
if (p.literal) { | ||
@@ -253,5 +253,5 @@ return p.literal.value; // string | ||
path: pathArr, | ||
doc | ||
doc, | ||
}, | ||
ast: current | ||
ast: current, | ||
}); | ||
@@ -268,3 +268,3 @@ } | ||
module.children.forEach(m => { | ||
module.children.forEach((m) => { | ||
rec(m, asts, depth + 1, limit); | ||
@@ -271,0 +271,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99813
16
2220
+ Added@typescript-eslint/types@3.10.1(transitive)
+ Added@typescript-eslint/typescript-estree@3.10.1(transitive)
+ Added@typescript-eslint/visitor-keys@3.10.1(transitive)
- Removed@typescript-eslint/typescript-estree@2.34.0(transitive)
Updated@agreed/core@^5.1.7