From 3dea138e322665eb7baefeb21c953b11fdc528fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20K=C3=B6nig?= Date: Mon, 14 Oct 2024 15:47:55 +0200 Subject: [PATCH] ci: update --- .ci/runChecks.sh | 6 + .github/dependabot.yml | 27 + .github/workflows/master.yml | 32 -- .github/workflows/npm-publish.yml | 23 - .github/workflows/publish.yml | 33 ++ .github/workflows/test.yml | 31 + .vscode/settings.json | 31 + dist/cli.d.ts | 3 - dist/cli.d.ts.map | 1 - dist/cli.js | 133 ----- dist/cli.js.map | 1 - dist/config.d.ts | 83 --- dist/config.d.ts.map | 1 - dist/config.js | 9 - dist/config.js.map | 1 - dist/decorators.d.ts | 87 --- dist/decorators.d.ts.map | 1 - dist/decorators.js | 131 ----- dist/decorators.js.map | 1 - dist/index.d.ts | 4 - dist/index.d.ts.map | 1 - dist/index.js | 20 - dist/index.js.map | 1 - dist/metadata/controllerGenerator.d.ts | 14 - dist/metadata/controllerGenerator.d.ts.map | 1 - dist/metadata/controllerGenerator.js | 79 --- dist/metadata/controllerGenerator.js.map | 1 - dist/metadata/endpointGenerator.d.ts | 19 - dist/metadata/endpointGenerator.d.ts.map | 1 - dist/metadata/endpointGenerator.js | 130 ----- dist/metadata/endpointGenerator.js.map | 1 - dist/metadata/keywordKinds.d.ts | 3 - dist/metadata/keywordKinds.d.ts.map | 1 - dist/metadata/keywordKinds.js | 20 - dist/metadata/keywordKinds.js.map | 1 - dist/metadata/metadataGenerator.d.ts | 116 ---- dist/metadata/metadataGenerator.d.ts.map | 1 - dist/metadata/metadataGenerator.js | 113 ---- dist/metadata/metadataGenerator.js.map | 1 - dist/metadata/methodGenerator.d.ts | 22 - dist/metadata/methodGenerator.d.ts.map | 1 - dist/metadata/methodGenerator.js | 187 ------ dist/metadata/methodGenerator.js.map | 1 - dist/metadata/parameterGenerator.d.ts | 27 - dist/metadata/parameterGenerator.d.ts.map | 1 - dist/metadata/parameterGenerator.js | 256 --------- dist/metadata/parameterGenerator.js.map | 1 - dist/metadata/resolveType.d.ts | 16 - dist/metadata/resolveType.d.ts.map | 1 - dist/metadata/resolveType.js | 640 --------------------- dist/metadata/resolveType.js.map | 1 - dist/swagger/generator.d.ts | 27 - dist/swagger/generator.d.ts.map | 1 - dist/swagger/generator.js | 384 ------------- dist/swagger/generator.js.map | 1 - dist/swagger/swagger.d.ts | 9 - dist/swagger/swagger.d.ts.map | 1 - dist/swagger/swagger.js | 11 - dist/swagger/swagger.js.map | 1 - dist/utils/decoratorUtils.d.ts | 14 - dist/utils/decoratorUtils.d.ts.map | 1 - dist/utils/decoratorUtils.js | 75 --- dist/utils/decoratorUtils.js.map | 1 - dist/utils/jsDocUtils.d.ts | 6 - dist/utils/jsDocUtils.d.ts.map | 1 - dist/utils/jsDocUtils.js | 49 -- dist/utils/jsDocUtils.js.map | 1 - dist/utils/pathUtils.d.ts | 2 - dist/utils/pathUtils.d.ts.map | 1 - dist/utils/pathUtils.js | 12 - dist/utils/pathUtils.js.map | 1 - 71 files changed, 128 insertions(+), 2788 deletions(-) create mode 100755 .ci/runChecks.sh create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/master.yml delete mode 100644 .github/workflows/npm-publish.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml create mode 100644 .vscode/settings.json delete mode 100644 dist/cli.d.ts delete mode 100644 dist/cli.d.ts.map delete mode 100755 dist/cli.js delete mode 100644 dist/cli.js.map delete mode 100644 dist/config.d.ts delete mode 100644 dist/config.d.ts.map delete mode 100644 dist/config.js delete mode 100644 dist/config.js.map delete mode 100644 dist/decorators.d.ts delete mode 100644 dist/decorators.d.ts.map delete mode 100644 dist/decorators.js delete mode 100644 dist/decorators.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.d.ts.map delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 dist/metadata/controllerGenerator.d.ts delete mode 100644 dist/metadata/controllerGenerator.d.ts.map delete mode 100644 dist/metadata/controllerGenerator.js delete mode 100644 dist/metadata/controllerGenerator.js.map delete mode 100644 dist/metadata/endpointGenerator.d.ts delete mode 100644 dist/metadata/endpointGenerator.d.ts.map delete mode 100644 dist/metadata/endpointGenerator.js delete mode 100644 dist/metadata/endpointGenerator.js.map delete mode 100644 dist/metadata/keywordKinds.d.ts delete mode 100644 dist/metadata/keywordKinds.d.ts.map delete mode 100644 dist/metadata/keywordKinds.js delete mode 100644 dist/metadata/keywordKinds.js.map delete mode 100644 dist/metadata/metadataGenerator.d.ts delete mode 100644 dist/metadata/metadataGenerator.d.ts.map delete mode 100644 dist/metadata/metadataGenerator.js delete mode 100644 dist/metadata/metadataGenerator.js.map delete mode 100644 dist/metadata/methodGenerator.d.ts delete mode 100644 dist/metadata/methodGenerator.d.ts.map delete mode 100644 dist/metadata/methodGenerator.js delete mode 100644 dist/metadata/methodGenerator.js.map delete mode 100644 dist/metadata/parameterGenerator.d.ts delete mode 100644 dist/metadata/parameterGenerator.d.ts.map delete mode 100644 dist/metadata/parameterGenerator.js delete mode 100644 dist/metadata/parameterGenerator.js.map delete mode 100644 dist/metadata/resolveType.d.ts delete mode 100644 dist/metadata/resolveType.d.ts.map delete mode 100644 dist/metadata/resolveType.js delete mode 100644 dist/metadata/resolveType.js.map delete mode 100644 dist/swagger/generator.d.ts delete mode 100644 dist/swagger/generator.d.ts.map delete mode 100644 dist/swagger/generator.js delete mode 100644 dist/swagger/generator.js.map delete mode 100644 dist/swagger/swagger.d.ts delete mode 100644 dist/swagger/swagger.d.ts.map delete mode 100644 dist/swagger/swagger.js delete mode 100644 dist/swagger/swagger.js.map delete mode 100644 dist/utils/decoratorUtils.d.ts delete mode 100644 dist/utils/decoratorUtils.d.ts.map delete mode 100644 dist/utils/decoratorUtils.js delete mode 100644 dist/utils/decoratorUtils.js.map delete mode 100644 dist/utils/jsDocUtils.d.ts delete mode 100644 dist/utils/jsDocUtils.d.ts.map delete mode 100644 dist/utils/jsDocUtils.js delete mode 100644 dist/utils/jsDocUtils.js.map delete mode 100644 dist/utils/pathUtils.d.ts delete mode 100644 dist/utils/pathUtils.d.ts.map delete mode 100644 dist/utils/pathUtils.js delete mode 100644 dist/utils/pathUtils.js.map diff --git a/.ci/runChecks.sh b/.ci/runChecks.sh new file mode 100755 index 0000000..927a585 --- /dev/null +++ b/.ci/runChecks.sh @@ -0,0 +1,6 @@ +set -e + +npm ci +npm run build +npx license-check +npx better-npm-audit audit diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f0f3c80 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,27 @@ +version: 2 +updates: + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' + groups: + update-github-actions-dependencies: + patterns: + - '*' + reviewers: + - 'jkoenig134' + labels: + - 'dependencies' + + - package-ecosystem: 'npm' + directory: '/' + schedule: + interval: 'weekly' + groups: + update-npm-dependencies: + patterns: + - '*' + reviewers: + - 'jkoenig134' + labels: + - 'dependencies' diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index 855a5e7..0000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Master Workflow - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -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 ci - - run: npm run test:coverage - - name: Upload Code coverage report - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.codecov }} - file: ./reports/coverage/*.json - diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml deleted file mode 100644 index 3685f72..0000000 --- a/.github/workflows/npm-publish.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages - -name: Publish Workflow - -on: - release: - types: [created] - -jobs: - publish-npm: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 12 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm test - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.npm}} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ff8aed7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish + +on: + push: + branches: [master] + +jobs: + run-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: current + - run: bash .ci/runChecks.sh + + publish-npm: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: current + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build + - run: npx enhanced-publish --if-possible --use-preid-as-tag + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + needs: ['run-checks'] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5d82a70 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: Test + +on: + pull_request: + push: + branches: [master] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +jobs: + run-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: current + - run: bash .ci/runChecks.sh + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: current + - run: npm ci + - run: npm run build + - run: npm run test diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4badec9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,31 @@ +{ + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[yaml]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "files.autoSave": "off", + "html.format.wrapAttributes": "preserve-aligned", + "xmlTools.splitAttributesOnFormat": true, + "xmlTools.enforcePrettySelfClosingTagOnFormat": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "files.eol": "\n", + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/dist/cli.d.ts b/dist/cli.d.ts deleted file mode 100644 index faaadd5..0000000 --- a/dist/cli.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -export {}; -//# sourceMappingURL=cli.d.ts.map \ No newline at end of file diff --git a/dist/cli.d.ts.map b/dist/cli.d.ts.map deleted file mode 100644 index f022439..0000000 --- a/dist/cli.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/cli.js b/dist/cli.js deleted file mode 100755 index 92f9397..0000000 --- a/dist/cli.js +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/env node -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const argparse_1 = require("argparse"); -const debug = require("debug"); -const fs = require("fs-extra-promise"); -const _ = require("lodash"); -const path = require("path"); -const path_1 = require("path"); -const ts = require("typescript"); -const YAML = require("yamljs"); -const config_1 = require("./config"); -const metadataGenerator_1 = require("./metadata/metadataGenerator"); -const generator_1 = require("./swagger/generator"); -const debugLog = debug("typescript-rest-swagger"); -const workingDir = process.cwd(); -const versionDefault = getPackageJsonValue("version"); -const nameDefault = getPackageJsonValue("name"); -const descriptionDefault = getPackageJsonValue("description"); -const licenseDefault = getPackageJsonValue("license"); -const parser = new argparse_1.ArgumentParser({ - add_help: true, - description: "Typescript-REST Swagger tool", -}); -parser.add_argument("-c", "--config", { - help: "The swagger config file (swagger.json or swagger.yml or swaggerCongig.js).", -}); -parser.add_argument("-t", "--tsconfig", { - action: "storeTrue", - default: false, - help: "Load tsconfig.json file", -}); -parser.add_argument("-p", "--tsconfig_path", { - help: "The tsconfig file (tsconfig.json) path. Default to {cwd}/tsconfig.json.", -}); -const parameters = parser.parse_args(); -const config = getConfig(parameters.config); -const compilerOptions = getCompilerOptions(parameters.tsconfig, parameters.tsconfig_path); -debugLog("Starting Swagger generation tool"); -debugLog("Compiler Options: %j", compilerOptions); -const swaggerConfig = validateSwaggerConfig(config.swagger); -debugLog("Swagger Config: %j", swaggerConfig); -debugLog("Processing Services Metadata"); -const metadata = new metadataGenerator_1.MetadataGenerator(swaggerConfig.entryFile, parameters.tsconfig_path, swaggerConfig.ignore).generate(); -debugLog("Generated Metadata: %j", metadata); -new generator_1.SpecGenerator(metadata, swaggerConfig) - .generate() - .then(() => { - console.info("Generation completed."); -}) - .catch((err) => { - console.error(`Error generating swagger. ${err}`); -}); -function getPackageJsonValue(key) { - try { - const projectPackageJson = require(`${workingDir}/package.json`); - return projectPackageJson[key] || ""; - } - catch (err) { - return ""; - } -} -function getConfig(configPath = "swagger.json") { - const configFile = `${workingDir}/${configPath}`; - if (_.endsWith(configFile, ".yml") || _.endsWith(configFile, ".yaml")) { - return YAML.load(configFile); - } - else if (_.endsWith(configFile, ".js")) { - return require(path.join(configFile)); - } - else { - return fs.readJSONSync(configFile); - } -} -function validateSwaggerConfig(conf) { - if (!conf.outputDirectory) { - throw new Error("Missing outputDirectory: onfiguration most contain output directory"); - } - if (!conf.entryFile) { - throw new Error("Missing entryFile: Configuration must contain an entry point file."); - } - conf.version = conf.version || versionDefault; - conf.name = conf.name || nameDefault; - conf.description = conf.description || descriptionDefault; - conf.license = conf.license || licenseDefault; - conf.yaml = conf.yaml === false ? false : true; - conf.outputFormat = conf.outputFormat - ? config_1.Specification[conf.outputFormat] - : config_1.Specification.Swagger_2; - return conf; -} -function getCompilerOptions(loadTsconfig, tsconfigPath) { - if (!loadTsconfig && tsconfigPath) { - loadTsconfig = true; - } - if (!loadTsconfig) { - return {}; - } - const cwd = process.cwd(); - const defaultTsconfigPath = (0, path_1.join)(cwd, "tsconfig.json"); - tsconfigPath = tsconfigPath - ? getAbsolutePath(tsconfigPath, cwd) - : defaultTsconfigPath; - try { - const tsConfig = require(tsconfigPath); - if (!tsConfig) { - throw new Error("Invalid tsconfig"); - } - return tsConfig.compilerOptions - ? ts.convertCompilerOptionsFromJson(tsConfig.compilerOptions, cwd).options - : {}; - } - catch (err) { - if (err.code === "MODULE_NOT_FOUND") { - throw Error(`No tsconfig file found at '${tsconfigPath}'`); - } - else if (err.name === "SyntaxError") { - throw Error(`Invalid JSON syntax in tsconfig at '${tsconfigPath}': ${err.message}`); - } - else { - throw Error(`Unhandled error encountered loading tsconfig '${tsconfigPath}': ${err.message}`); - } - } -} -function getAbsolutePath(p, basePath) { - if ((0, path_1.isAbsolute)(p)) { - return p; - } - else { - return (0, path_1.join)(basePath, p); - } -} -//# sourceMappingURL=cli.js.map \ No newline at end of file diff --git a/dist/cli.js.map b/dist/cli.js.map deleted file mode 100644 index abbf469..0000000 --- a/dist/cli.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,YAAY,CAAC;;AAEb,uCAA0C;AAC1C,+BAA+B;AAC/B,uCAAuC;AACvC,4BAA4B;AAC5B,6BAA6B;AAC7B,+BAAwC;AACxC,iCAAiC;AACjC,+BAA+B;AAC/B,qCAAgE;AAChE,oEAAiE;AACjE,mDAAoD;AA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AG,EAAE,eAAe,CAAC,CAAC;IACvD,YAAY,GAAG,YAAY;QACzB,CAAC,CAAC,eAAe,CAAC,YAAY,EAAE,GAAG,CAAC;QACpC,CAAC,CAAC,mBAAmB,CAAC;IACxB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,QAAQ,CAAC,eAAe;YAC7B,CAAC,CAAC,EAAE,CAAC,8BAA8B,CAAC,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,OAAO;YAC1E,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC,8BAA8B,YAAY,GAAG,CAAC,CAAC;QAC7D,CAAC;aAAM,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YACtC,MAAM,KAAK,CACT,uCAAuC,YAAY,MAAM,GAAG,CAAC,OAAO,EAAE,CACvE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CACT,iDAAiD,YAAY,MAAM,GAAG,CAAC,OAAO,EAAE,CACjF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,CAAS,EAAE,QAAgB;IAClD,IAAI,IAAA,iBAAU,EAAC,CAAC,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACX,CAAC;SAAM,CAAC;QACN,OAAO,IAAA,WAAI,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/config.d.ts b/dist/config.d.ts deleted file mode 100644 index 07d1f54..0000000 --- a/dist/config.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { OpenAPIV3 } from "openapi-types"; -export interface Config { - /** - * Swagger generation configuration object - */ - swagger: SwaggerConfig; -} -export declare enum Specification { - Swagger_2 = "Swagger_2", - OpenApi_3 = "OpenApi_3" -} -export interface SwaggerConfig { - /** - * Support the output to be an yaml file - */ - yaml: boolean; - /** - * Generated SwaggerConfig.json will output here - */ - outputDirectory: string | Array; - /** - * The entry point to your API - */ - entryFile: string | Array; - /** - * Inform if the generated spec will be in swagger 2.0 format or i open api 3.0 - */ - outputFormat?: Specification; - /** - * API host, expressTemplate.g. localhost:3000 or https://myapi.com - */ - servers?: OpenAPIV3.ServerObject[]; - /** - * API version number; defaults to npm package version - */ - version?: string; - /** - * API name; defaults to npm package name - */ - name?: string; - /** - * 'API description; defaults to npm package description - */ - description?: string; - /** - * API license; defaults to npm package license - */ - license?: string; - /** - * Base API path; e.g. the 'v1' in https://myapi.com/v1 - */ - basePath?: string; - /** - * Extend generated swagger spec with this object - * Note that generated properties will always take precedence over what get specified here - */ - spec?: any; - /** - * Security Definitions Object - * A declaration of the security schemes available to be used in the - * specification. This does not enforce the security schemes on the operations - * and only serves to provide the relevant details for each scheme. - */ - securityDefinitions?: OpenAPIV3.SecurityRequirementObject[]; - /** - * Default consumes property for the entire API - */ - consumes?: Array; - /** - * Default produces property for the entire API - */ - produces?: Array; - /** - * Default collectionFormat property for query parameters of array type. - * Possible values are `csv`, `ssv`, `tsv`, `pipes`, `multi`. If not specified, Swagger defaults to `csv`. - */ - collectionFormat?: string; - /** - * Directory to ignore during TypeScript metadata scan - */ - ignore?: Array; -} -//# sourceMappingURL=config.d.ts.map \ No newline at end of file diff --git a/dist/config.d.ts.map b/dist/config.d.ts.map deleted file mode 100644 index d3b9283..0000000 --- a/dist/config.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,oBAAY,aAAa;IACvB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,eAAe,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAExC;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAElC;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,YAAY,EAAE,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;IAEX;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,SAAS,CAAC,yBAAyB,EAAE,CAAC;IAE5D;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB"} \ No newline at end of file diff --git a/dist/config.js b/dist/config.js deleted file mode 100644 index 06f8fd1..0000000 --- a/dist/config.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Specification = void 0; -var Specification; -(function (Specification) { - Specification["Swagger_2"] = "Swagger_2"; - Specification["OpenApi_3"] = "OpenApi_3"; -})(Specification || (exports.Specification = Specification = {})); -//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/dist/config.js.map b/dist/config.js.map deleted file mode 100644 index fcd6a65..0000000 --- a/dist/config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAWb,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,wCAAuB,CAAA;AACzB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"} \ No newline at end of file diff --git a/dist/decorators.d.ts b/dist/decorators.d.ts deleted file mode 100644 index e5bdeac..0000000 --- a/dist/decorators.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * A decorator to document the responses that a given service method can return. It is used to generate - * documentation for the REST service. - * ```typescript - * interface MyError { - * message: string - * } - * @ Path('people') - * class PeopleService { - * @ Response(200, 'Retrieve a list of people.') - * @ Response(401, 'The user is unauthorized.', {message: 'The user is not authorized to access this operation.'}) - * @ GET - * getPeople(@ Param('name') name: string) { - * // ... - * } - * } - * ``` - * A Default response is created in swagger documentation from the method return analisys. So any response declared - * through this decorator is an additional response created. - * @param status The response status code - * @param description A description for this response - * @param example An optional example of response to be added to method documentation. - */ -export declare function Response(name: string | number, description?: string, example?: T): any; -/** - * Used to provide an example of method return to be added into the method response section of the - * generated documentation for this method. - * ```typescript - * @ Path('people') - * class PeopleService { - * @ Example>([{ - * name: 'Joe' - * }]) - * @ GET - * getPeople(@ Param('name') name: string): Person[] { - * // ... - * } - * } - * ``` - * @param example The example returned object - */ -export declare function Example(example: T): any; -/** - * Add tags for a given method on generated swagger documentation. - * ```typescript - * @ Path('people') - * class PeopleService { - * @ Tags('adiministrative', 'department1') - * @ GET - * getPeople(@ Param('name') name: string) { - * // ... - * } - * } - * ``` - * @param values a list of tags - */ -export declare function Tags(...values: Array): any; -/** - * Document the method or class comsumes property in generated swagger docs - */ -export declare function Consumes(...values: Array): any; -/** - * Document the method or class produces property in generated swagger docs - */ -export declare function Produces(...values: Array): any; -/** - * Document the method or class produces property in generated swagger docs - */ -export declare function Hidden(): any; -/** - * Document the type of a property or parameter as `integer ($int32)` in generated swagger docs - */ -export declare function IsInt(target: any, propertyKey: string, parameterIndex?: number): void; -/** - * Document the type of a property or parameter as `integer ($int64)` in generated swagger docs - */ -export declare function IsLong(target: any, propertyKey: string, parameterIndex?: number): void; -/** - * Document the type of a property or parameter as `number ($float)` in generated swagger docs - */ -export declare function IsFloat(target: any, propertyKey: string, parameterIndex?: number): void; -/** - * Document the type of a property or parameter as `number ($double)` in generated swagger docs. - * This is the default for `number` types without a specifying decorator. - */ -export declare function IsDouble(target: any, propertyKey: string, parameterIndex?: number): void; -//# sourceMappingURL=decorators.d.ts.map \ No newline at end of file diff --git a/dist/decorators.d.ts.map b/dist/decorators.d.ts.map deleted file mode 100644 index 591098e..0000000 --- a/dist/decorators.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,CAAC,GACV,GAAG,CAIL;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,GAAG,CAI1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAIlD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAItD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAItD;AAED;;GAEG;AACH,wBAAgB,MAAM,IAAI,GAAG,CAI5B;AAED;;GAEG;AACH,wBAAgB,KAAK,CACnB,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,QAGxB;AAED;;GAEG;AACH,wBAAgB,MAAM,CACpB,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,QAGxB;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,QAGxB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,QAGxB"} \ No newline at end of file diff --git a/dist/decorators.js b/dist/decorators.js deleted file mode 100644 index 65386fa..0000000 --- a/dist/decorators.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Response = Response; -exports.Example = Example; -exports.Tags = Tags; -exports.Consumes = Consumes; -exports.Produces = Produces; -exports.Hidden = Hidden; -exports.IsInt = IsInt; -exports.IsLong = IsLong; -exports.IsFloat = IsFloat; -exports.IsDouble = IsDouble; -/** - * A decorator to document the responses that a given service method can return. It is used to generate - * documentation for the REST service. - * ```typescript - * interface MyError { - * message: string - * } - * @ Path('people') - * class PeopleService { - * @ Response(200, 'Retrieve a list of people.') - * @ Response(401, 'The user is unauthorized.', {message: 'The user is not authorized to access this operation.'}) - * @ GET - * getPeople(@ Param('name') name: string) { - * // ... - * } - * } - * ``` - * A Default response is created in swagger documentation from the method return analisys. So any response declared - * through this decorator is an additional response created. - * @param status The response status code - * @param description A description for this response - * @param example An optional example of response to be added to method documentation. - */ -function Response(name, description, example) { - return () => { - return; - }; -} -/** - * Used to provide an example of method return to be added into the method response section of the - * generated documentation for this method. - * ```typescript - * @ Path('people') - * class PeopleService { - * @ Example>([{ - * name: 'Joe' - * }]) - * @ GET - * getPeople(@ Param('name') name: string): Person[] { - * // ... - * } - * } - * ``` - * @param example The example returned object - */ -function Example(example) { - return () => { - return; - }; -} -/** - * Add tags for a given method on generated swagger documentation. - * ```typescript - * @ Path('people') - * class PeopleService { - * @ Tags('adiministrative', 'department1') - * @ GET - * getPeople(@ Param('name') name: string) { - * // ... - * } - * } - * ``` - * @param values a list of tags - */ -function Tags(...values) { - return () => { - return; - }; -} -/** - * Document the method or class comsumes property in generated swagger docs - */ -function Consumes(...values) { - return () => { - return; - }; -} -/** - * Document the method or class produces property in generated swagger docs - */ -function Produces(...values) { - return () => { - return; - }; -} -/** - * Document the method or class produces property in generated swagger docs - */ -function Hidden() { - return () => { - return; - }; -} -/** - * Document the type of a property or parameter as `integer ($int32)` in generated swagger docs - */ -function IsInt(target, propertyKey, parameterIndex) { - return; -} -/** - * Document the type of a property or parameter as `integer ($int64)` in generated swagger docs - */ -function IsLong(target, propertyKey, parameterIndex) { - return; -} -/** - * Document the type of a property or parameter as `number ($float)` in generated swagger docs - */ -function IsFloat(target, propertyKey, parameterIndex) { - return; -} -/** - * Document the type of a property or parameter as `number ($double)` in generated swagger docs. - * This is the default for `number` types without a specifying decorator. - */ -function IsDouble(target, propertyKey, parameterIndex) { - return; -} -//# sourceMappingURL=decorators.js.map \ No newline at end of file diff --git a/dist/decorators.js.map b/dist/decorators.js.map deleted file mode 100644 index 56845dc..0000000 --- a/dist/decorators.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAyBb,4BAQC;AAmBD,0BAIC;AAgBD,oBAIC;AAK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.d.ts deleted file mode 100644 index 437b465..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./metadata/metadataGenerator"; -export * from "./swagger/generator"; -export * from "./swagger/swagger"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map deleted file mode 100644 index 4a5189c..0000000 --- a/dist/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AAEpC,cAAc,mBAAmB,CAAC"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 33979e5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./metadata/metadataGenerator"), exports); -__exportStar(require("./swagger/generator"), exports); -__exportStar(require("./swagger/swagger"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 429989f..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,sDAAoC;AAEpC,oDAAkC"} \ No newline at end of file diff --git a/dist/metadata/controllerGenerator.d.ts b/dist/metadata/controllerGenerator.d.ts deleted file mode 100644 index 278a4a8..0000000 --- a/dist/metadata/controllerGenerator.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as ts from "typescript"; -import { EndpointGenerator } from "./endpointGenerator"; -import { Controller } from "./metadataGenerator"; -export declare class ControllerGenerator extends EndpointGenerator { - private readonly pathValue; - private genMethods; - constructor(node: ts.ClassDeclaration); - isValid(): boolean; - generate(): Controller; - protected getCurrentLocation(): string; - private buildMethods; - private buildMethodsForClass; -} -//# sourceMappingURL=controllerGenerator.d.ts.map \ No newline at end of file diff --git a/dist/metadata/controllerGenerator.d.ts.map b/dist/metadata/controllerGenerator.d.ts.map deleted file mode 100644 index 91e7e63..0000000 --- a/dist/metadata/controllerGenerator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"controllerGenerator.d.ts","sourceRoot":"","sources":["../../src/metadata/controllerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,qBAAa,mBAAoB,SAAQ,iBAAiB,CAAC,EAAE,CAAC,gBAAgB,CAAC;IAC7E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAC/C,OAAO,CAAC,UAAU,CAAkC;gBAExC,IAAI,EAAE,EAAE,CAAC,gBAAgB;IAO9B,OAAO;IAIP,QAAQ,IAAI,UAAU;IAsC7B,SAAS,CAAC,kBAAkB,IAAI,MAAM;IAItC,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,oBAAoB;CAyB7B"} \ No newline at end of file diff --git a/dist/metadata/controllerGenerator.js b/dist/metadata/controllerGenerator.js deleted file mode 100644 index 8659922..0000000 --- a/dist/metadata/controllerGenerator.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ControllerGenerator = void 0; -const _ = require("lodash"); -const ts = require("typescript"); -const decoratorUtils_1 = require("../utils/decoratorUtils"); -const pathUtils_1 = require("../utils/pathUtils"); -const endpointGenerator_1 = require("./endpointGenerator"); -const methodGenerator_1 = require("./methodGenerator"); -const resolveType_1 = require("./resolveType"); -class ControllerGenerator extends endpointGenerator_1.EndpointGenerator { - pathValue; - genMethods = new Set(); - constructor(node) { - super(node, "controllers"); - this.pathValue = (0, pathUtils_1.normalizePath)((0, decoratorUtils_1.getDecoratorTextValue)(node, (decorator) => decorator.text === "Path")); - } - isValid() { - return !!this.pathValue || this.pathValue === ""; - } - generate() { - if (!this.node.parent) { - throw new Error("Controller node doesn't have a valid parent source file."); - } - if (!this.node.name) { - throw new Error("Controller node doesn't have a valid name."); - } - const sourceFile = this.node.parent.getSourceFile(); - this.debugger("Generating Metadata for controller %s", this.getCurrentLocation()); - this.debugger("Controller path: %s", this.pathValue); - const controllerMetadata = { - consumes: this.getDecoratorValues("Consumes"), - location: sourceFile.fileName, - methods: this.buildMethods(), - name: this.getCurrentLocation(), - path: this.pathValue || "", - produces: this.getDecoratorValues("Produces") - ? this.getDecoratorValues("Produces") - : this.getDecoratorValues("Accept"), - responses: this.getResponses(), - security: this.getSecurity(), - tags: this.getDecoratorValues("Tags"), - }; - this.debugger("Generated Metadata for controller %s: %j", this.getCurrentLocation(), controllerMetadata); - return controllerMetadata; - } - getCurrentLocation() { - return this.node.name?.text ?? ""; - } - buildMethods() { - let result = []; - let targetClass = { - type: this.node, - typeArguments: null, - }; - while (targetClass) { - result = _.union(result, this.buildMethodsForClass(targetClass.type, targetClass.typeArguments)); - targetClass = (0, resolveType_1.getSuperClass)(targetClass.type, targetClass.typeArguments); - } - return result; - } - buildMethodsForClass(node, genericTypeMap) { - return node.members - .filter((m) => m.kind === ts.SyntaxKind.MethodDeclaration) - .filter((m) => !(0, decoratorUtils_1.isDecorator)(m, (decorator) => "Hidden" === decorator.text)) - .map((m) => new methodGenerator_1.MethodGenerator(m, this.pathValue || "", genericTypeMap)) - .filter((generator) => { - if (generator.isValid() && - !this.genMethods.has(generator.getMethodName())) { - this.genMethods.add(generator.getMethodName()); - return true; - } - return false; - }) - .map((generator) => generator.generate()); - } -} -exports.ControllerGenerator = ControllerGenerator; -//# sourceMappingURL=controllerGenerator.js.map \ No newline at end of file diff --git a/dist/metadata/controllerGenerator.js.map b/dist/metadata/controllerGenerator.js.map deleted file mode 100644 index 50dbd39..0000000 --- a/dist/metadata/controllerGenerator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"controllerGenerator.js","sourceRoot":"","sources":["../../src/metadata/controllerGenerator.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,iCAAiC;AACjC,4DAA6E;AAC7E,kDAAmD;AACnD,2DAAwD;AAExD,uDAAoD;AACpD,+CAA8C;AAE9C,MAAa,mBAAoB,SAAQ,qCAAsC;IAC5D,SAAS,CAAqB;IACvC,UAAU,GAAgB,IAAI,GAAG,EAAU,CAAC;IAEpD,YAAY,IAAyB;QACnC,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAA,yBAAa,EAC5B,IAAA,sCAAqB,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,CACtE,CAAC;IACJ,CAAC;IAEM,OAAO;QACZ,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,EAAE,CAAC;IACnD,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,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AC,CAAC;IAC9C,CAAC;CACF;AAnGD,kDAmGC"} \ No newline at end of file diff --git a/dist/metadata/endpointGenerator.d.ts b/dist/metadata/endpointGenerator.d.ts deleted file mode 100644 index bccf57d..0000000 --- a/dist/metadata/endpointGenerator.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as debug from "debug"; -import * as ts from "typescript"; -import { ResponseType } from "./metadataGenerator"; -export declare abstract class EndpointGenerator { - protected node: T; - protected debugger: debug.Debugger; - constructor(node: T, name: string); - protected getDecoratorValues(decoratorName: string, acceptMultiple?: boolean): any[]; - protected getSecurity(): { - name: any; - scopes: string[]; - }[] | undefined; - protected handleRolesArray(argument: ts.ArrayLiteralExpression): Array; - protected getExamplesValue(argument: any): any; - protected getInitializerValue(initializer: any): any; - protected getResponses(genericTypeMap?: Map): Array; - protected abstract getCurrentLocation(): string; -} -//# sourceMappingURL=endpointGenerator.d.ts.map \ No newline at end of file diff --git a/dist/metadata/endpointGenerator.d.ts.map b/dist/metadata/endpointGenerator.d.ts.map deleted file mode 100644 index 3e1e4ea..0000000 --- a/dist/metadata/endpointGenerator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"endpointGenerator.d.ts","sourceRoot":"","sources":["../../src/metadata/endpointGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,8BAAsB,iBAAiB,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI;IACvD,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAClB,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;gBAEvB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM;IAKjC,SAAS,CAAC,kBAAkB,CAC1B,aAAa,EAAE,MAAM,EACrB,cAAc,GAAE,OAAe;IAyBjC,SAAS,CAAC,WAAW;;;;IAcrB,SAAS,CAAC,gBAAgB,CACxB,QAAQ,EAAE,EAAE,CAAC,sBAAsB,GAClC,KAAK,CAAC,MAAM,CAAC;IAchB,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG;IAkBxC,SAAS,CAAC,mBAAmB,CAAC,WAAW,EAAE,GAAG;IA4B9C,SAAS,CAAC,YAAY,CACpB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,GACxC,KAAK,CAAC,YAAY,CAAC;IA2CtB,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,MAAM;CAChD"} \ No newline at end of file diff --git a/dist/metadata/endpointGenerator.js b/dist/metadata/endpointGenerator.js deleted file mode 100644 index 9ad441e..0000000 --- a/dist/metadata/endpointGenerator.js +++ /dev/null @@ -1,130 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EndpointGenerator = void 0; -const debug = require("debug"); -const _ = require("lodash"); -const ts = require("typescript"); -const decoratorUtils_1 = require("../utils/decoratorUtils"); -const resolveType_1 = require("./resolveType"); -class EndpointGenerator { - node; - debugger; - constructor(node, name) { - this.node = node; - this.debugger = debug(`typescript-rest-swagger:metadata:${name}`); - } - getDecoratorValues(decoratorName, acceptMultiple = false) { - const decorators = (0, decoratorUtils_1.getDecorators)(this.node, (decorator) => decorator.text === decoratorName); - if (!decorators || !decorators.length) { - return []; - } - if (!acceptMultiple && decorators.length > 1) { - throw new Error(`Only one ${decoratorName} decorator allowed in ${this.getCurrentLocation()}.`); - } - let result; - if (acceptMultiple) { - result = decorators.map((d) => d.arguments); - } - else { - const d = decorators[0]; - result = d.arguments; - } - this.debugger("Arguments of decorator %s: %j", decoratorName, result); - return result; - } - getSecurity() { - const securities = this.getDecoratorValues("Security", true); - if (!securities || !securities.length) { - return undefined; - } - return securities.map((security) => ({ - name: security[1] ? security[1] : "default", - scopes: security[0] - ? _.castArray(this.handleRolesArray(security[0])) - : [], - })); - } - handleRolesArray(argument) { - if (ts.isArrayLiteralExpression(argument)) { - return argument.elements - .map((value) => value.getText()) - .map((val) => val && val.startsWith("'") && val.endsWith("'") - ? val.slice(1, -1) - : val); - } - else { - return argument; - } - } - getExamplesValue(argument) { - let example = {}; - this.debugger(argument); - if (argument.properties) { - argument.properties.forEach((p) => { - example[p.name.text] = this.getInitializerValue(p.initializer); - }); - } - else { - example = this.getInitializerValue(argument); - } - this.debugger("Example extracted for %s: %j", this.getCurrentLocation(), example); - return example; - } - getInitializerValue(initializer) { - switch (initializer.kind) { - case ts.SyntaxKind.ArrayLiteralExpression: - return initializer.elements.map((e) => this.getInitializerValue(e)); - case ts.SyntaxKind.StringLiteral: - return initializer.text; - case ts.SyntaxKind.TrueKeyword: - return true; - case ts.SyntaxKind.FalseKeyword: - return false; - case ts.SyntaxKind.NumberKeyword: - case ts.SyntaxKind.FirstLiteralToken: - return parseInt(initializer.text, 10); - case ts.SyntaxKind.ObjectLiteralExpression: - const nestedObject = {}; - initializer.properties.forEach((p) => { - nestedObject[p.name.text] = this.getInitializerValue(p.initializer); - }); - return nestedObject; - default: - return undefined; - } - } - getResponses(genericTypeMap) { - const decorators = (0, decoratorUtils_1.getDecorators)(this.node, (decorator) => decorator.text === "Response"); - if (!decorators || !decorators.length) { - return []; - } - this.debugger("Generating Responses for %s", this.getCurrentLocation()); - return decorators.map((decorator) => { - let description = ""; - let status = "200"; - let examples; - if (decorator.arguments.length > 0 && decorator.arguments[0]) { - status = decorator.arguments[0]; - } - if (decorator.arguments.length > 1 && decorator.arguments[1]) { - description = decorator.arguments[1]; - } - if (decorator.arguments.length > 2 && decorator.arguments[2]) { - const argument = decorator.arguments[2]; - examples = this.getExamplesValue(argument); - } - const responses = { - description: description, - examples: examples, - schema: decorator.typeArguments && decorator.typeArguments.length > 0 - ? (0, resolveType_1.resolveType)(decorator.typeArguments[0], genericTypeMap) - : undefined, - status: status, - }; - this.debugger("Generated Responses for %s: %j", this.getCurrentLocation(), responses); - return responses; - }); - } -} -exports.EndpointGenerator = EndpointGenerator; -//# sourceMappingURL=endpointGenerator.js.map \ No newline at end of file diff --git a/dist/metadata/endpointGenerator.js.map b/dist/metadata/endpointGenerator.js.map deleted file mode 100644 index 9a61832..0000000 --- a/dist/metadata/endpointGenerator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"endpointGenerator.js","sourceRoot":"","sources":["../../src/metadata/endpointGenerator.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,+BAA+B;AAC/B,4BAA4B;AAC5B,iCAAiC;AACjC,4DAAwD;AAExD,+CAA4C;AAE5C,MAAsB,iBAAiB;IAC3B,IAAI,CAAI;IACR,QAAQ,CAAiB;IAEnC,YAAY,IAAO,EAAE,IAAY;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IAES,kBAAkB,CAC1B,aAAqB,EACrB,iBAA0B,KAAK;QAE/B,MAAM,UAAU,GAAG,IAAA,8BAAa,EAC9B,IAAI,CAAC,IAAI,EACT,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAChD,CAAC;QACF,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACtC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,IAAI,CAAC,cAAc,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CACb,YAAY,aAAa,yBAAyB,IAAI,CAAC,kBAAkB,EAAE,GAAG,CAC/E,CAAC;QACJ,CAAC;QACD,IAAI,MAAkB,CAAC;QACvB,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,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AM,GAAG,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7D,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAQ,CAAC;YAC9C,CAAC;YACD,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7D,MAAM,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAQ,CAAC;gBAC/C,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC7C,CAAC;YACD,MAAM,SAAS,GAAG;gBAChB,WAAW,EAAE,WAAW;gBACxB,QAAQ,EAAE,QAAQ;gBAClB,MAAM,EACJ,SAAS,CAAC,aAAa,IAAI,SAAS,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC;oBAC3D,CAAC,CAAC,IAAA,yBAAW,EAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC;oBACzD,CAAC,CAAC,SAAS;gBACf,MAAM,EAAE,MAAM;aACf,CAAC;YACF,IAAI,CAAC,QAAQ,CACX,gCAAgC,EAChC,IAAI,CAAC,kBAAkB,EAAE,EACzB,SAAS,CACV,CAAC;YAEF,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CAGF;AA9JD,8CA8JC"} \ No newline at end of file diff --git a/dist/metadata/keywordKinds.d.ts b/dist/metadata/keywordKinds.d.ts deleted file mode 100644 index 5945909..0000000 --- a/dist/metadata/keywordKinds.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { SyntaxKind } from "typescript"; -export declare const keywords: SyntaxKind[]; -//# sourceMappingURL=keywordKinds.d.ts.map \ No newline at end of file diff --git a/dist/metadata/keywordKinds.d.ts.map b/dist/metadata/keywordKinds.d.ts.map deleted file mode 100644 index 96d5bae..0000000 --- a/dist/metadata/keywordKinds.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keywordKinds.d.ts","sourceRoot":"","sources":["../../src/metadata/keywordKinds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,eAAO,MAAM,QAAQ,cAcpB,CAAC"} \ No newline at end of file diff --git a/dist/metadata/keywordKinds.js b/dist/metadata/keywordKinds.js deleted file mode 100644 index 00f9e54..0000000 --- a/dist/metadata/keywordKinds.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.keywords = void 0; -const typescript_1 = require("typescript"); -exports.keywords = [ - typescript_1.SyntaxKind.AnyKeyword, - typescript_1.SyntaxKind.UnknownKeyword, - typescript_1.SyntaxKind.NumberKeyword, - typescript_1.SyntaxKind.BigIntKeyword, - typescript_1.SyntaxKind.ObjectKeyword, - typescript_1.SyntaxKind.BooleanKeyword, - typescript_1.SyntaxKind.StringKeyword, - typescript_1.SyntaxKind.SymbolKeyword, - typescript_1.SyntaxKind.ThisKeyword, - typescript_1.SyntaxKind.VoidKeyword, - typescript_1.SyntaxKind.UndefinedKeyword, - typescript_1.SyntaxKind.NullKeyword, - typescript_1.SyntaxKind.NeverKeyword, -]; -//# sourceMappingURL=keywordKinds.js.map \ No newline at end of file diff --git a/dist/metadata/keywordKinds.js.map b/dist/metadata/keywordKinds.js.map deleted file mode 100644 index 8866e2a..0000000 --- a/dist/metadata/keywordKinds.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keywordKinds.js","sourceRoot":"","sources":["../../src/metadata/keywordKinds.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAE3B,QAAA,QAAQ,GAAG;IACtB,uBAAU,CAAC,UAAU;IACrB,uBAAU,CAAC,cAAc;IACzB,uBAAU,CAAC,aAAa;IACxB,uBAAU,CAAC,aAAa;IACxB,uBAAU,CAAC,aAAa;IACxB,uBAAU,CAAC,cAAc;IACzB,uBAAU,CAAC,aAAa;IACxB,uBAAU,CAAC,aAAa;IACxB,uBAAU,CAAC,WAAW;IACtB,uBAAU,CAAC,WAAW;IACtB,uBAAU,CAAC,gBAAgB;IAC3B,uBAAU,CAAC,WAAW;IACtB,uBAAU,CAAC,YAAY;CACxB,CAAC"} \ No newline at end of file diff --git a/dist/metadata/metadataGenerator.d.ts b/dist/metadata/metadataGenerator.d.ts deleted file mode 100644 index 3521cc8..0000000 --- a/dist/metadata/metadataGenerator.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Project } from "ts-morph"; -import * as ts from "typescript"; -export declare class MetadataGenerator { - private readonly ignorePaths?; - static current: MetadataGenerator; - readonly nodes: ts.Node[]; - readonly typeChecker: ts.TypeChecker; - readonly program: ts.Program; - private referenceTypes; - private circularDependencyResolvers; - private debugger; - morph: Project; - private targetFiles; - constructor(entryFile: string | Array, tsConfigFilePath: string, ignorePaths?: Array | undefined); - generate(): Metadata; - TypeChecker(): ts.TypeChecker; - addReferenceType(referenceType: ReferenceType): void; - getReferenceType(typeName: string): ReferenceType | undefined; - getReferenceTypes(): { - [typeName: string]: ReferenceType; - }; - removeReferenceType(typeName: string): void; - onFinish(callback: (referenceTypes: { - [typeName: string]: ReferenceType; - }) => void): void; - private getSourceFiles; - private buildControllers; -} -export interface Metadata { - controllers: Array; - referenceTypes: { - [typeName: string]: ReferenceType; - }; -} -export interface Controller { - location: string; - methods: Array; - name: string; - path: string; - consumes: Array; - produces: Array; - responses: Array; - tags: Array; - security?: Array; -} -export interface Method { - deprecated?: boolean; - description: string; - method: string; - name: string; - parameters: Array; - path: string; - type: Type; - tags: Array; - responses: Array; - security?: Array; - summary?: string; - consumes: Array; - produces: Array; -} -export interface Parameter { - parameterName: string; - description: string; - in: string; - name: string; - required: boolean; - type: Type; - collectionFormat?: boolean; - allowEmptyValue?: boolean; - default?: any; - maxItems?: number; - minItems?: number; -} -export interface Security { - name: string; - scopes?: Array; -} -export interface Type { - typeName: string; - simpleTypeName?: string; - typeArgument?: Type; -} -export interface EnumerateType extends Type { - enumMembers: Array; -} -export interface UnionType extends Type { - types: Array; -} -export interface ReferenceType extends Type { - description: string; - properties: Array; - originalFileName: any; -} -export interface ObjectType extends Type { - properties: Array; -} -export interface ArrayType extends Type { - elementType: Type; -} -export interface ResponseType { - description: string; - status: string; - schema?: Type; - examples?: any; -} -export interface Property { - description: string; - name: string; - type: Type; - required: boolean; -} -export interface ResponseData { - status: string; - type: Type; -} -//# sourceMappingURL=metadataGenerator.d.ts.map \ No newline at end of file diff --git a/dist/metadata/metadataGenerator.d.ts.map b/dist/metadata/metadataGenerator.d.ts.map deleted file mode 100644 index 9545835..0000000 --- a/dist/metadata/metadataGenerator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metadataGenerator.d.ts","sourceRoot":"","sources":["../../src/metadata/metadataGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAKjC,qBAAa,iBAAiB;IAkB1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAjB/B,OAAc,OAAO,EAAE,iBAAiB,CAAC;IACzC,SAAgB,KAAK,YAAwB;IAC7C,SAAgB,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC;IAC5C,SAAgB,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpC,OAAO,CAAC,cAAc,CAEf;IACP,OAAO,CAAC,2BAA2B,CAE/B;IACJ,OAAO,CAAC,QAAQ,CAA6C;IACtD,KAAK,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,WAAW,CAAW;gBAG5B,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,EACjC,gBAAgB,EAAE,MAAM,EACP,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,YAAA;IAevC,QAAQ,IAAI,QAAQ;IAyCpB,WAAW;IAIX,gBAAgB,CAAC,a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AAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,SAAU,SAAQ,IAAI;IACrC,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;CACZ"} \ No newline at end of file diff --git a/dist/metadata/metadataGenerator.js b/dist/metadata/metadataGenerator.js deleted file mode 100644 index a9ca483..0000000 --- a/dist/metadata/metadataGenerator.js +++ /dev/null @@ -1,113 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MetadataGenerator = void 0; -const debug = require("debug"); -const glob_1 = require("glob"); -const minimatch_1 = require("minimatch"); -const path_1 = require("path"); -const ts_morph_1 = require("ts-morph"); -const ts = require("typescript"); -const decoratorUtils_1 = require("../utils/decoratorUtils"); -const controllerGenerator_1 = require("./controllerGenerator"); -const _ = require("lodash"); -class MetadataGenerator { - ignorePaths; - static current; - nodes = new Array(); - typeChecker; - program; - referenceTypes = {}; - circularDependencyResolvers = new Array(); - debugger = debug("typescript-rest-swagger:metadata"); - morph; - targetFiles; - constructor(entryFile, tsConfigFilePath, ignorePaths) { - this.ignorePaths = ignorePaths; - this.targetFiles = this.getSourceFiles(entryFile); - this.debugger("Starting Metadata Generator"); - this.debugger("Entry File: %j ", entryFile); - this.debugger("Ts Config Path: %j ", tsConfigFilePath); - this.morph = new ts_morph_1.Project({ - tsConfigFilePath: tsConfigFilePath, - }); - this.morph.addSourceFilesAtPaths(entryFile); - MetadataGenerator.current = this; - this.program = this.morph.getProgram().compilerObject; - this.typeChecker = this.program.getTypeChecker(); - } - generate() { - this.program.getSourceFiles().forEach((sf) => { - if (this.ignorePaths && this.ignorePaths.length) { - for (const path of this.ignorePaths) { - if ((0, minimatch_1.match)([sf.fileName], path).length > 0) { - return; - } - } - } - if (sf.fileName.includes("node_modules")) - return; - let matchTargetFile = this.targetFiles.some((targetFile) => { - return (0, path_1.relative)(process.cwd(), sf.fileName).includes(targetFile); - }); - if (!matchTargetFile) - return; - let addNodes = (node) => { - this.nodes.push(node); - if (node.kind === ts.SyntaxKind.ModuleDeclaration || - node.kind === ts.SyntaxKind.ModuleBlock) { - ts.forEachChild(node, addNodes); - } - }; - ts.forEachChild(sf, addNodes); - }); - this.debugger("Building Metadata for controllers Generator"); - const controllers = this.buildControllers(); - this.debugger("Handling circular references"); - this.circularDependencyResolvers.forEach((c) => c(this.referenceTypes)); - return { - controllers: controllers, - referenceTypes: this.referenceTypes, - }; - } - TypeChecker() { - return this.typeChecker; - } - addReferenceType(referenceType) { - this.referenceTypes[referenceType.typeName] = referenceType; - } - getReferenceType(typeName) { - return this.referenceTypes[typeName]; - } - getReferenceTypes() { - return this.referenceTypes; - } - removeReferenceType(typeName) { - delete this.referenceTypes[typeName]; - } - onFinish(callback) { - this.circularDependencyResolvers.push(callback); - } - getSourceFiles(sourceFiles) { - this.debugger("Getting source files from expressions"); - this.debugger("Source file patterns: %j ", sourceFiles); - const sourceFilesExpressions = _.castArray(sourceFiles); - const result = new Set(); - const options = { cwd: process.cwd() }; - sourceFilesExpressions.forEach((pattern) => { - this.debugger("Searching pattern: %s with options: %j", pattern, options); - const matches = glob_1.glob.sync(pattern, options); - matches.forEach((file) => result.add(file)); - }); - return Array.from(result); - } - buildControllers() { - return this.nodes - .filter((node) => node.kind === ts.SyntaxKind.ClassDeclaration) - .filter((node) => !(0, decoratorUtils_1.isDecorator)(node, (decorator) => "Hidden" === decorator.text)) - .map((classDeclaration) => new controllerGenerator_1.ControllerGenerator(classDeclaration)) - .filter((generator) => generator.isValid()) - .map((generator) => generator.generate()); - } -} -exports.MetadataGenerator = MetadataGenerator; -//# sourceMappingURL=metadataGenerator.js.map \ No newline at end of file diff --git a/dist/metadata/metadataGenerator.js.map b/dist/metadata/metadataGenerator.js.map deleted file mode 100644 index 7ed2fa4..0000000 --- a/dist/metadata/metadataGenerator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metadataGenerator.js","sourceRoot":"","sources":["../../src/metadata/metadataGenerator.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAA4B;AAC5B,yCAAkC;AAClC,+BAAgC;AAChC,uCAAmC;AACnC,iCAAiC;AACjC,4DAAsD;AACtD,+DAA4D;AAC5D,4BAA6B;AAE7B,MAAa,iBAAiB;IAkBT;IAjBZ,MAAM,CAAC,OAAO,CAAoB;IACzB,KAAK,GAAG,IAAI,KAAK,EAAW,CAAC;IAC7B,WAAW,CAAiB;IAC5B,OAAO,CAAa;IAC5B,cAAc,GAElB,EAAE,CAAC;IACC,2BAA2B,GAAG,IAAI,KAAK,EAE5C,CAAC;IACI,QAAQ,GAAG,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,KAAK,CAAU;IACd,WAAW,CAAW;IAE9B,YACE,SAAiC,EACjC,gBAAwB,EACP,WAA2B;QAA3B,gBAAW,GAAX,WAAW,CAAgB;QAE5C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,KAAK,GAAG,IAAI,kBAAO,CAAC;YACvB,gBAAgB,E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AQ,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF;AA9HD,8CA8HC"} \ No newline at end of file diff --git a/dist/metadata/methodGenerator.d.ts b/dist/metadata/methodGenerator.d.ts deleted file mode 100644 index d4b9ba9..0000000 --- a/dist/metadata/methodGenerator.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import * as ts from "typescript"; -import { EndpointGenerator } from "./endpointGenerator"; -import { Method } from "./metadataGenerator"; -export declare class MethodGenerator extends EndpointGenerator { - private readonly controllerPath; - private readonly genericTypeMap?; - private method; - private path; - constructor(node: ts.MethodDeclaration, controllerPath: string, genericTypeMap?: Map | undefined); - isValid(): boolean; - getMethodName(): string; - generate(): Method; - protected getCurrentLocation(): string; - private buildParameters; - private processMethodDecorators; - private getMethodSuccessResponse; - private getMethodSuccessResponseData; - private getMethodSuccessExamples; - private mergeResponses; - private supportsPathMethod; -} -//# sourceMappingURL=methodGenerator.d.ts.map \ No newline at end of file diff --git a/dist/metadata/methodGenerator.d.ts.map b/dist/metadata/methodGenerator.d.ts.map deleted file mode 100644 index 6a4ea7c..0000000 --- a/dist/metadata/methodGenerator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"methodGenerator.d.ts","sourceRoot":"","sources":["../../src/metadata/methodGenerator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAQjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,MAAM,EAKP,MAAM,qBAAqB,CAAC;AAI7B,qBAAa,eAAgB,SAAQ,iBAAiB,CAAC,EAAE,CAAC,iBAAiB,CAAC;IAMxE,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IANlC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAS;gBAGnB,IAAI,EAAE,EAAE,CAAC,iBAAiB,EACT,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAA;IAMrD,OAAO;IAIP,aAAa;IAKb,QAAQ,IAAI,MAAM;IA+CzB,SAAS,CAAC,kBAAkB;IAO5B,OAAO,CAAC,eAAe;IAqDvB,OAAO,CAAC,uBAAuB;IAkD/B,OAAO,CAAC,wBAAwB;IAUhC,OAAO,CAAC,4BAA4B;IAoBpC,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,kBAAkB;CAK3B"} \ No newline at end of file diff --git a/dist/metadata/methodGenerator.js b/dist/metadata/methodGenerator.js deleted file mode 100644 index 4007572..0000000 --- a/dist/metadata/methodGenerator.js +++ /dev/null @@ -1,187 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MethodGenerator = void 0; -const pathUtil = require("path"); -const decoratorUtils_1 = require("../utils/decoratorUtils"); -const jsDocUtils_1 = require("../utils/jsDocUtils"); -const pathUtils_1 = require("../utils/pathUtils"); -const endpointGenerator_1 = require("./endpointGenerator"); -const parameterGenerator_1 = require("./parameterGenerator"); -const resolveType_1 = require("./resolveType"); -class MethodGenerator extends endpointGenerator_1.EndpointGenerator { - controllerPath; - genericTypeMap; - method; - path; - constructor(node, controllerPath, genericTypeMap) { - super(node, "methods"); - this.controllerPath = controllerPath; - this.genericTypeMap = genericTypeMap; - this.processMethodDecorators(); - } - isValid() { - return !!this.method; - } - getMethodName() { - const identifier = this.node.name; - return identifier.text; - } - generate() { - if (!this.isValid()) { - throw new Error("This isn't a valid controller method."); - } - this.debugger("Generating Metadata for method %s", this.getCurrentLocation()); - // TODO implement implicit return type - // const typeChecker = MetadataGenerator.current.typeChecker; - // const signature = - // typeChecker.getSignatureFromDeclaration(this.node); - // const returnType = typeChecker.getReturnTypeOfSignature(signature); - // const kind = ts.SyntaxKind[this.node.kind]; - const identifier = this.node.name; - const type = (0, resolveType_1.resolveType)(this.node.type, this.genericTypeMap); - const responses = this.mergeResponses(this.getResponses(this.genericTypeMap), this.getMethodSuccessResponse(type)); - const methodMetadata = { - consumes: this.getDecoratorValues("Consumes"), - deprecated: (0, jsDocUtils_1.isExistJSDocTag)(this.node, "deprecated"), - description: (0, jsDocUtils_1.getJSDocDescription)(this.node), - method: this.method, - name: identifier.text, - parameters: this.buildParameters(), - path: this.path, - produces: this.getDecoratorValues("Produces") - ? this.getDecoratorValues("Produces") - : this.getDecoratorValues("Accept"), - responses: responses, - security: this.getSecurity(), - summary: (0, jsDocUtils_1.getJSDocTag)(this.node, "summary"), - tags: this.getDecoratorValues("Tags"), - type: type, - }; - this.debugger("Generated Metadata for method %s: %j", this.getCurrentLocation(), methodMetadata); - return methodMetadata; - } - getCurrentLocation() { - const methodId = this.node.name; - const controllerId = this.node.parent - .name; - return `${controllerId.text}.${methodId.text}`; - } - buildParameters() { - this.debugger("Processing method %s parameters.", this.getCurrentLocation()); - const parameters = this.node.parameters - .map((p) => { - try { - const path = pathUtil.posix.join("/", this.controllerPath ? this.controllerPath : "", this.path); - return new parameterGenerator_1.ParameterGenerator(p, this.method, path, this.genericTypeMap).generate(); - } - catch (e) { - const methodId = this.node.name; - const controllerId = this.node.parent - .name; - const parameterId = p.name; - throw new Error(`Error generate parameter method: '${controllerId.text}.${methodId.text}' argument: ${parameterId.text} ${e} \n ${e.stack}`); - } - }) - .filter((p) => p && p.in !== "context" && p.in !== "cookie"); - const bodyParameters = parameters.filter((p) => p && p.in === "body"); - const formParameters = parameters.filter((p) => p && p.in === "formData"); - if (bodyParameters.length > 1) { - throw new Error(`Only one body parameter allowed in '${this.getCurrentLocation()}' method.`); - } - if (bodyParameters.length > 0 && formParameters.length > 0) { - throw new Error(`Choose either during @FormParam and @FileParam or body parameter in '${this.getCurrentLocation()}' method.`); - } - this.debugger("Parameters list for method %s: %j.", this.getCurrentLocation(), parameters); - return parameters; - } - processMethodDecorators() { - const httpMethodDecorators = (0, decoratorUtils_1.getDecorators)(this.node, (decorator) => this.supportsPathMethod(decorator.text)); - if (!httpMethodDecorators || !httpMethodDecorators.length) { - return; - } - if (httpMethodDecorators.length > 1) { - throw new Error(`Only one HTTP Method decorator in '${this.getCurrentLocation}' method is acceptable, Found: ${httpMethodDecorators - .map((d) => d.text) - .join(", ")}`); - } - const methodDecorator = httpMethodDecorators[0]; - this.method = methodDecorator.text.toLowerCase(); - this.debugger("Processing method %s decorators.", this.getCurrentLocation()); - const pathDecorators = (0, decoratorUtils_1.getDecorators)(this.node, (decorator) => decorator.text === "Path"); - if (pathDecorators && pathDecorators.length > 1) { - throw new Error(`Only one Path decorator in '${this.getCurrentLocation}' method is acceptable, Found: ${httpMethodDecorators - .map((d) => d.text) - .join(", ")}`); - } - if (pathDecorators) { - const pathDecorator = pathDecorators[0]; - this.path = pathDecorator - ? `/${(0, pathUtils_1.normalizePath)(pathDecorator.arguments[0])}` - : ""; - } - else { - this.path = ""; - } - this.debugger("Mapping endpoint %s %s", this.method, this.path); - } - getMethodSuccessResponse(type) { - const responseData = this.getMethodSuccessResponseData(type); - return { - description: type.typeName === "void" ? "No content" : "Ok", - examples: this.getMethodSuccessExamples(), - schema: responseData.type, - status: responseData.status, - }; - } - getMethodSuccessResponseData(type) { - switch (type.simpleTypeName) { - case "void": - return { status: "204", type: type }; - case "NewResource": - return { status: "201", type: type.typeArgument || type }; - case "RequestAccepted": - return { status: "202", type: type.typeArgument || type }; - case "MovedPermanently": - return { status: "301", type: type.typeArgument || type }; - case "MovedTemporarily": - return { status: "302", type: type.typeArgument || type }; - case "DownloadResource": - case "DownloadBinaryData": - return { status: "200", type: { typeName: "buffer" } }; - default: - return { status: "200", type: type }; - } - } - getMethodSuccessExamples() { - const exampleDecorators = (0, decoratorUtils_1.getDecorators)(this.node, (decorator) => decorator.text === "Example"); - if (!exampleDecorators || !exampleDecorators.length) { - return undefined; - } - if (exampleDecorators.length > 1) { - throw new Error(`Only one Example decorator allowed in '${this.getCurrentLocation}' method.`); - } - const d = exampleDecorators[0]; - const argument = d.arguments[0]; - return this.getExamplesValue(argument); - } - mergeResponses(responses, defaultResponse) { - if (!responses || !responses.length) { - return [defaultResponse]; - } - const index = responses.findIndex((resp) => resp.status === defaultResponse.status); - if (index >= 0) { - if (defaultResponse.examples && !responses[index].examples) { - responses[index].examples = defaultResponse.examples; - } - } - else { - responses.push(defaultResponse); - } - return responses; - } - supportsPathMethod(method) { - return ["GET", "POST", "PATCH", "DELETE", "PUT", "OPTIONS", "HEAD"].some((m) => m === method); - } -} -exports.MethodGenerator = MethodGenerator; -//# sourceMappingURL=methodGenerator.js.map \ No newline at end of file diff --git a/dist/metadata/methodGenerator.js.map b/dist/metadata/methodGenerator.js.map deleted file mode 100644 index c43cbb2..0000000 --- a/dist/metadata/methodGenerator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"methodGenerator.js","sourceRoot":"","sources":["../../src/metadata/methodGenerator.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,4DAAwD;AACxD,oDAI6B;AAC7B,kDAAmD;AACnD,2DAAwD;AAQxD,6DAA0D;AAC1D,+CAA4C;AAE5C,MAAa,eAAgB,SAAQ,qCAAuC;IAMvD;IACA;IANX,MAAM,CAAS;IACf,IAAI,CAAS;IAErB,YACE,IAA0B,EACT,cAAsB,EACtB,cAAyC;QAE1D,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAHN,mBAAc,GAAd,cAAc,CAAQ;QACtB,mBAAc,GAAd,cAAc,CAA2B;QAG1D,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,OAAO;QACZ,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEM,aAAa;QAClB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAqB,CAAC;QACnD,OAAO,UAAU,CAAC,IAAI,CAAC;IACzB,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAA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C,KAAK,CAAC,CAAC,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;YACvD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,kBAAkB,CAAC,MAAc;QACvC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,CACtE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CACpB,CAAC;IACJ,CAAC;CACF;AAhQD,0CAgQC"} \ No newline at end of file diff --git a/dist/metadata/parameterGenerator.d.ts b/dist/metadata/parameterGenerator.d.ts deleted file mode 100644 index 73ddbcb..0000000 --- a/dist/metadata/parameterGenerator.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as ts from "typescript"; -import { Parameter } from "./metadataGenerator"; -export declare class ParameterGenerator { - private readonly parameter; - private readonly method; - private readonly path; - private readonly genericTypeMap?; - constructor(parameter: ts.ParameterDeclaration, method: string, path: string, genericTypeMap?: Map | undefined); - generate(): Parameter | undefined; - private getCurrentLocation; - private getRequestParameter; - private getContextParameter; - private getCookieParameter; - private getBodyParameter; - private getHeaderParameter; - private getQueryParameter; - isRequired(parameter: ts.ParameterDeclaration): boolean; - private getPathParameter; - private getParameterDescription; - private supportsBodyParameters; - private supportParameterDecorator; - private supportPathDataType; - private supportQueryDataType; - private getValidatedType; - private getDefaultValue; -} -//# sourceMappingURL=parameterGenerator.d.ts.map \ No newline at end of file diff --git a/dist/metadata/parameterGenerator.d.ts.map b/dist/metadata/parameterGenerator.d.ts.map deleted file mode 100644 index 860ac07..0000000 --- a/dist/metadata/parameterGenerator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parameterGenerator.d.ts","sourceRoot":"","sources":["../../src/metadata/parameterGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,OAAO,EAAqB,SAAS,EAAQ,MAAM,qBAAqB,CAAC;AAOzE,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;gBAHf,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAA;IAGrD,QAAQ,IAAI,SAAS,GAAG,SAAS;IAkCxC,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,kBAAkB;IAwB1B,OAAO,CAAC,iBAAiB;IAsCzB,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAoB,GAAG,OAAO;IAWvD,OAAO,CAAC,gBAAgB;IAiCxB,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,yBAAyB;IAmBjC,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,eAAe;CAMxB"} \ No newline at end of file diff --git a/dist/metadata/parameterGenerator.js b/dist/metadata/parameterGenerator.js deleted file mode 100644 index de2a081..0000000 --- a/dist/metadata/parameterGenerator.js +++ /dev/null @@ -1,256 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ParameterGenerator = void 0; -const ts = require("typescript"); -const decoratorUtils_1 = require("../utils/decoratorUtils"); -const metadataGenerator_1 = require("./metadataGenerator"); -const resolveType_1 = require("./resolveType"); -class ParameterGenerator { - parameter; - method; - path; - genericTypeMap; - constructor(parameter, method, path, genericTypeMap) { - this.parameter = parameter; - this.method = method; - this.path = path; - this.genericTypeMap = genericTypeMap; - } - generate() { - const decoratorName = (0, decoratorUtils_1.getDecoratorName)(this.parameter, (identifier) => this.supportParameterDecorator(identifier.text)); - switch (decoratorName) { - case "Param": - return this.getRequestParameter(this.parameter); - case "CookieParam": - return this.getCookieParameter(this.parameter); - case "FormParam": - return undefined; // this.getFormParameter(this.parameter); - case "HeaderParam": - return this.getHeaderParameter(this.parameter); - case "QueryParam": - return this.getQueryParameter(this.parameter); - case "PathParam": - return this.getPathParameter(this.parameter); - case "FileParam": - return undefined; // this.getFileParameter(this.parameter); - case "FilesParam": - return undefined; // this.getFilesParameter(this.parameter); - case "Context": - case "ContextRequest": - case "ContextResponse": - case "ContextNext": - case "ContextLanguage": - case "ContextAccept": - return this.getContextParameter(this.parameter); - default: - return this.getBodyParameter(this.parameter); - } - } - getCurrentLocation() { - const methodId = this.parameter.parent - .name; - const controllerId = this.parameter.parent - .parent.name; - return `${controllerId.text}.${methodId.text}`; - } - getRequestParameter(parameter) { - const parameterName = parameter.name.text; - const type = this.getValidatedType(parameter); - if (!this.supportsBodyParameters(this.method)) { - throw new Error(`Param can't support '${this.getCurrentLocation()}' method.`); - } - return { - description: this.getParameterDescription(parameter), - in: "param", - name: (0, decoratorUtils_1.getDecoratorTextValue)(this.parameter, (ident) => ident.text === "Param") || parameterName, - parameterName: parameterName, - required: this.isRequired(parameter), - type: type, - }; - } - getContextParameter(parameter) { - const parameterName = parameter.name.text; - return { - description: this.getParameterDescription(parameter), - in: "context", - name: parameterName, - parameterName: parameterName, - required: this.isRequired(parameter), - type: { typeName: "" }, - }; - } - getCookieParameter(parameter) { - const parameterName = parameter.name.text; - // const type = this.getValidatedType(parameter); - // if (!this.supportPathDataType(type)) { - // throw new Error(`Cookie can't support '${this.getCurrentLocation()}' method.`); - // } - return { - description: this.getParameterDescription(parameter), - in: "cookie", - name: (0, decoratorUtils_1.getDecoratorTextValue)(this.parameter, (ident) => ident.text === "CookieParam") || parameterName, - parameterName: parameterName, - required: this.isRequired(parameter), - type: { typeName: "" }, - }; - } - getBodyParameter(parameter) { - const parameterName = parameter.name.text; - const type = this.getValidatedType(parameter); - if (!this.supportsBodyParameters(this.method)) { - throw new Error(`Body can't support ${this.method} method`); - } - return { - description: this.getParameterDescription(parameter), - in: "body", - name: parameterName, - parameterName: parameterName, - required: this.isRequired(parameter), - type: type, - }; - } - getHeaderParameter(parameter) { - const parameterName = parameter.name.text; - const type = this.getValidatedType(parameter); - if (!this.supportPathDataType(type)) { - throw new InvalidParameterException(`Parameter '${parameterName}' can't be passed as a header parameter in '${this.getCurrentLocation()}'.`); - } - return { - description: this.getParameterDescription(parameter), - in: "header", - name: (0, decoratorUtils_1.getDecoratorTextValue)(this.parameter, (ident) => ident.text === "HeaderParam") || parameterName, - parameterName: parameterName, - required: this.isRequired(parameter), - type: type, - }; - } - getQueryParameter(parameter) { - const parameterName = parameter.name.text; - const parameterOptions = (0, decoratorUtils_1.getDecoratorOptions)(this.parameter, (ident) => ident.text === "QueryParam") || {}; - let type = this.getValidatedType(parameter); - if (!this.supportQueryDataType(type)) { - const arrayType = (0, resolveType_1.getCommonPrimitiveAndArrayUnionType)(parameter.type); - if (arrayType && this.supportQueryDataType(arrayType)) { - type = arrayType; - } - else { - throw new InvalidParameterException(`Parameter '${parameterName}' can't be passed as a query parameter in '${this.getCurrentLocation()}'.`); - } - } - return { - // allowEmptyValue: parameterOptions.allowEmptyValue, - collectionFormat: parameterOptions.collectionFormat, - default: this.getDefaultValue(parameter.initializer), - description: this.getParameterDescription(parameter), - in: "query", - // maxItems: parameterOptions.maxItems, - // minItems: parameterOptions.minItems, - name: (0, decoratorUtils_1.getDecoratorTextValue)(this.parameter, (ident) => ident.text === "QueryParam") || parameterName, - parameterName: parameterName, - required: this.isRequired(parameter), - type: type, - }; - } - isRequired(parameter) { - let isUndefinedUnion = parameter.type?.kind === ts.SyntaxKind.UnionType && - parameter.type.types.some((t) => t.kind === ts.SyntaxKind.UndefinedKeyword); - return (!parameter.questionToken && !parameter.initializer && !isUndefinedUnion); - } - getPathParameter(parameter) { - const parameterName = parameter.name.text; - const type = this.getValidatedType(parameter); - const pathName = (0, decoratorUtils_1.getDecoratorTextValue)(this.parameter, (ident) => ident.text === "PathParam") || parameterName; - if (!this.supportPathDataType(type)) { - throw new InvalidParameterException(`Parameter '${parameterName}:${type}' can't be passed as a path parameter in '${this.getCurrentLocation()}'.`); - } - if (!this.path.includes(`{${pathName}}`) && - !this.path.includes(`:${pathName}`)) { - throw new Error(`Parameter '${parameterName}' can't match in path: '${this.path}'`); - } - return { - description: this.getParameterDescription(parameter), - in: "path", - name: pathName, - parameterName: parameterName, - required: true, - type: type, - }; - } - getParameterDescription(node) { - const symbol = metadataGenerator_1.MetadataGenerator.current.typeChecker.getSymbolAtLocation(node.name); - if (symbol) { - const comments = symbol.getDocumentationComment(metadataGenerator_1.MetadataGenerator.current.typeChecker); - if (comments.length) { - return ts.displayPartsToString(comments); - } - } - return ""; - } - supportsBodyParameters(method) { - return ["delete", "post", "put", "patch"].some((m) => m === method); - } - supportParameterDecorator(decoratorName) { - return [ - "HeaderParam", - "QueryParam", - "Param", - "FileParam", - "PathParam", - "FilesParam", - "FormParam", - "CookieParam", - "Context", - "ContextRequest", - "ContextResponse", - "ContextNext", - "ContextLanguage", - "ContextAccept", - ].some((d) => d === decoratorName); - } - supportPathDataType(parameterType) { - return [ - "string", - "integer", - "long", - "float", - "double", - "date", - "datetime", - "buffer", - "boolean", - "enum", - ].find((t) => t === parameterType.typeName); - } - supportQueryDataType(parameterType) { - // Copied from supportPathDataType and added 'array'. Not sure if all options apply to queries, but kept to avoid breaking change. - return [ - "string", - "integer", - "long", - "float", - "double", - "date", - "datetime", - "buffer", - "boolean", - "enum", - "array", - ].find((t) => t === parameterType.typeName); - } - getValidatedType(parameter) { - if (!parameter.type) { - throw new Error(`Parameter ${parameter.name} doesn't have a valid type assigned in '${this.getCurrentLocation()}'.`); - } - return (0, resolveType_1.resolveType)(parameter.type, this.genericTypeMap); - } - getDefaultValue(initializer) { - if (!initializer) { - return; - } - return (0, resolveType_1.getLiteralValue)(initializer); - } -} -exports.ParameterGenerator = ParameterGenerator; -class InvalidParameterException extends Error { -} -//# sourceMappingURL=parameterGenerator.js.map \ No newline at end of file diff --git a/dist/metadata/parameterGenerator.js.map b/dist/metadata/parameterGenerator.js.map deleted file mode 100644 index 7f747df..0000000 --- a/dist/metadata/parameterGenerator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parameterGenerator.js","sourceRoot":"","sources":["../../src/metadata/parameterGenerator.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,4DAIiC;AACjC,2DAAyE;AACzE,+CAIuB;AAEvB,MAAa,kBAAkB;IAEV;IACA;IACA;IACA;IAJnB,YACmB,SAAkC,EAClC,MAAc,EACd,IAAY,EACZ,cAAyC;QAHzC,cAAS,GAAT,SAAS,CAAyB;QAClC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QACZ,mBAAc,GAAd,cAAc,CAA2B;IACzD,CAAC;IAEG,QAAQ;QACb,MAAM,aAAa,GAAG,IAAA,iCAAgB,EAAC,IAAI,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,EAAE,CACpE,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,IAAI,CAAC,CAChD,CAAC;QAEF,QAAQ,aAAa,EAAE,CAAC;YACtB,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAClD,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACjD,KAAK,WAAW;gBACd,OAAO,SAAS,CAAA,CAAC,yCAAy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;YACR,MAAM;YACN,UAAU;YACV,QAAQ;YACR,SAAS;YACT,MAAM;SACP,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAEO,oBAAoB,CAAC,aAAmB;QAC9C,kIAAkI;QAClI,OAAO;YACL,QAAQ;YACR,SAAS;YACT,MAAM;YACN,OAAO;YACP,QAAQ;YACR,MAAM;YACN,UAAU;YACV,QAAQ;YACR,SAAS;YACT,MAAM;YACN,OAAO;SACR,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAEO,gBAAgB,CAAC,SAAkC;QACzD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,aACE,SAAS,CAAC,IACZ,2CAA2C,IAAI,CAAC,kBAAkB,EAAE,IAAI,CACzE,CAAC;QACJ,CAAC;QACD,OAAO,IAAA,yBAAW,EAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1D,CAAC;IAGO,eAAe,CAAC,WAA2B;QACjD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,OAAO,IAAA,6BAAe,EAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF;AApUD,gDAoUC;AAED,MAAM,yBAA0B,SAAQ,KAAK;CAAG"} \ No newline at end of file diff --git a/dist/metadata/resolveType.d.ts b/dist/metadata/resolveType.d.ts deleted file mode 100644 index 64f2f19..0000000 --- a/dist/metadata/resolveType.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as ts from "typescript"; -import { Type } from "./metadataGenerator"; -type UsableDeclaration = ts.InterfaceDeclaration | ts.ClassDeclaration | ts.TypeAliasDeclaration; -export declare function resolveType(typeNode?: ts.TypeNode, genericTypeMap?: Map): Type; -export declare function getSuperClass(node: ts.ClassDeclaration, typeArguments?: Map): { - type: UsableDeclaration; - typeArguments: Map; -} | undefined; -/** - * Used to identify union types of a primitive and array of the same primitive, e.g. `string | string[]` - */ -export declare function getCommonPrimitiveAndArrayUnionType(typeNode?: ts.TypeNode): Type | null; -export declare function getLiteralValue(expression: ts.Expression): any; -export declare function resolveImports(node: T): T; -export {}; -//# sourceMappingURL=resolveType.d.ts.map \ No newline at end of file diff --git a/dist/metadata/resolveType.d.ts.map b/dist/metadata/resolveType.d.ts.map deleted file mode 100644 index 71a6167..0000000 --- a/dist/metadata/resolveType.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolveType.d.ts","sourceRoot":"","sources":["../../src/metadata/resolveType.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAOL,IAAI,EAEL,MAAM,qBAAqB,CAAC;AAW7B,KAAK,iBAAiB,GAClB,EAAE,CAAC,oBAAoB,GACvB,EAAE,CAAC,gBAAgB,GACnB,EAAE,CAAC,oBAAoB,CAAC;AAC5B,wBAAgB,WAAW,CACzB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,EACtB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,GACxC,IAAI,CA6PN;AAkbD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,EAAE,CAAC,gBAAgB,EACzB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC;;;cA6BzC;AAiCD;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,IAAI,GAAG,IAAI,CAuBb;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,GAAG,CAmB9D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAY5C"} \ No newline at end of file diff --git a/dist/metadata/resolveType.js b/dist/metadata/resolveType.js deleted file mode 100644 index 0e0562c..0000000 --- a/dist/metadata/resolveType.js +++ /dev/null @@ -1,640 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resolveType = resolveType; -exports.getSuperClass = getSuperClass; -exports.getCommonPrimitiveAndArrayUnionType = getCommonPrimitiveAndArrayUnionType; -exports.getLiteralValue = getLiteralValue; -exports.resolveImports = resolveImports; -const _ = require("lodash"); -const path_1 = require("path"); -const ts = require("typescript"); -const decoratorUtils_1 = require("../utils/decoratorUtils"); -const jsDocUtils_1 = require("../utils/jsDocUtils"); -const metadataGenerator_1 = require("./metadataGenerator"); -let timer = 0; -const syntaxKindMap = {}; -syntaxKindMap[ts.SyntaxKind.NumberKeyword] = "number"; -syntaxKindMap[ts.SyntaxKind.StringKeyword] = "string"; -syntaxKindMap[ts.SyntaxKind.BooleanKeyword] = "boolean"; -syntaxKindMap[ts.SyntaxKind.VoidKeyword] = "void"; -syntaxKindMap[ts.SyntaxKind.UndefinedKeyword] = "undefined"; -function resolveType(typeNode, genericTypeMap) { - if (!typeNode) { - return { typeName: "void" }; - } - if (typeNode.kind === ts.SyntaxKind.FunctionType) { - return { typeName: "void" }; - } - const primitiveType = getPrimitiveType(typeNode); - if (primitiveType) { - return primitiveType; - } - if (typeNode.kind === ts.SyntaxKind.ArrayType) { - const arrayType = typeNode; - return { - elementType: resolveType(arrayType.elementType, genericTypeMap), - typeName: "array", - }; - } - if (typeNode.kind === ts.SyntaxKind.AnyKeyword || - typeNode.kind === ts.SyntaxKind.ObjectKeyword || - typeNode.kind === ts.SyntaxKind.UnknownKeyword) { - return { typeName: "object" }; - } - if (typeNode.kind === ts.SyntaxKind.TypeLiteral) { - return getInlineObjectType(typeNode); - } - if (typeNode.kind === ts.SyntaxKind.LiteralType) { - return resolveLiteralType(typeNode.literal); - } - if (typeNode.kind === ts.SyntaxKind.UnionType) { - return getUnionType(typeNode); - } - if (typeNode.kind === ts.SyntaxKind.ParenthesizedType) { - return getUnionType(typeNode.type); - } - if (typeNode.kind !== ts.SyntaxKind.TypeReference && - typeNode.kind !== ts.SyntaxKind.ExpressionWithTypeArguments && - typeNode.kind !== ts.SyntaxKind.ExpressionStatement) { - throw new Error(`Unknown type: ${ts.SyntaxKind[typeNode.kind]} with name ${typeNode.getText()}`); - } - const typeReference = typeNode; - const typeNameNode = "expression" in typeReference - ? typeReference.expression - : typeReference.typeName; - const typeName = resolveSimpleTypeName(typeNameNode); - const namedType = resolveSpecialTypesByName(typeName, typeNode, genericTypeMap); - if (namedType) { - return namedType; - } - const enumType = getEnumerateType(typeNameNode); - if (enumType) { - return enumType; - } - let referenceType; - const sourceFile = getSourceFile(typeNode); - const tmpFileName = _.uniqueId("__tmp_") + ".ts"; - const fullTypeName = typeNode.getText(); - const fullRefTypeName = replaceNameText(fullTypeName); - const refType = metadataGenerator_1.MetadataGenerator.current.getReferenceType(fullRefTypeName); - const symbol = metadataGenerator_1.MetadataGenerator.current.typeChecker.getSymbolAtLocation(typeNameNode); - let originalDeclarationFileName = sourceFile.fileName; - if (symbol) { - originalDeclarationFileName = - getOriginalSourceFile(symbol) ?? sourceFile.fileName; - } - // if (refType && refType?.originalFileName !== originalDeclarationFileName) { - // throw new Error(`reference type ${fullRefTypeName} with same name but different properties. Please use different names for different types.`) - // } else if (refType) { - // return refType; - // } - const newTmpSourceFile = ` - - ${sourceFile.getFullText()} - - type __Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; - - type __Result = __Simplify<${fullTypeName}>; - - type __Original = ${fullTypeName}; - - `; - const tmpSourceFile = metadataGenerator_1.MetadataGenerator.current.morph.createSourceFile((0, path_1.dirname)(sourceFile.fileName) + "/" + tmpFileName, newTmpSourceFile); - const statement = tmpSourceFile.getStatements().at(-2); - const originalStatement = tmpSourceFile.getStatements().at(-1); - const type = statement.getType(); - if (type.isUnion()) { - let unionType = { - types: (originalStatement.getType().compilerType.aliasSymbol - ?.declarations?.[0]).type.types - .map((t) => { - return resolveType(t); - }) - .filter((p) => p !== undefined), - typeName: typeName, - }; - return unionType; - } - if (!type.isObject()) { - const declaration = symbol?.declarations?.[0]; - if (!declaration) { - throw new Error("Could not resolve declaration of Object"); - } - if ("type" in declaration) { - return resolveType(declaration.type); - } - let originalType = originalStatement.getType(); - switch (true) { - case originalType.isString(): - return { typeName: "string" }; - case originalType.isNumber(): - return { typeName: "double" }; - case originalType.isBoolean(): - return { typeName: "boolean" }; - case originalType.isNull(): - case originalType.isUndefined(): - return { typeName: "void" }; - } - } - const specialTypeNameAfterReference = type.compilerType.symbol?.escapedName.toString(); - const checker = metadataGenerator_1.MetadataGenerator.current.typeChecker; - const typeNodeType = checker.getTypeAtLocation(typeNode); - if ("node" in typeNodeType) { - const specialTypeAfterReference = resolveSpecialTypesByName(specialTypeNameAfterReference, typeNodeType.node, genericTypeMap); - if (specialTypeAfterReference) { - return specialTypeAfterReference; - } - } - const typeArguments = typeReference.typeArguments; - const originalType = metadataGenerator_1.MetadataGenerator.current.typeChecker.getTypeAtLocation(typeReference); - const typeArgumentsMap = {}; - if (typeArguments?.length ?? 0 > 0) { - const typeParameter = (originalType.symbol.declarations?.[0]).typeParameters; - const typeParameterNames = typeParameter?.map((typeParam) => typeParam.name.getText()); - typeParameterNames?.forEach((param, index) => { - typeArgumentsMap[param] = - typeArguments?.[index] ?? typeParameter?.[index].default; - }); - } - const typeProperties = type.getProperties(); - const properties = typeProperties - .map((property) => { - const declaration = property.getDeclarations()[0] - .compilerNode; - if (declaration.kind) { - const name = property.getName(); - let type; - if (ts.isTypeReferenceNode(declaration.type)) { - type = resolveType(typeArgumentsMap[declaration.type.typeName.getText()] ?? - declaration.type); - } - else { - type = resolveType(declaration.type); - } - const questionMark = !!declaration.questionToken; - const undefinedUnion = declaration.type.kind === ts.SyntaxKind.UnionType && - declaration.type.types.some((t) => t.kind === ts.SyntaxKind.UndefinedKeyword); - const required = !questionMark && !undefinedUnion; - // MetadataGenerator.current.morph.removeSourceFile(tmpSourceFile); - return { - description: "", - name: name, - required: required, - type, - }; - } - return undefined; - }) - .filter((p) => p && p.type.typeName !== "void"); - referenceType = { - description: "", - properties, - typeName: replaceNameText(fullTypeName), - simpleTypeName: typeName, - originalFileName: originalDeclarationFileName, - }; - metadataGenerator_1.MetadataGenerator.current.morph.removeSourceFile(tmpSourceFile); - metadataGenerator_1.MetadataGenerator.current.addReferenceType(referenceType); - return referenceType; -} -function resolveSpecialTypesByName(typeName, typeNode, genericTypeMap) { - const typeReference = typeNode; - if (typeName === "Date") { - return getDateType(typeNode); - } - if (typeName === "Buffer") { - return { typeName: "buffer" }; - } - if (typeName === "DownloadBinaryData") { - return { typeName: "buffer" }; - } - if (typeName === "DownloadResource") { - return { typeName: "buffer" }; - } - if (typeName === "Promise") { - return resolveType(typeReference.typeArguments?.[0], genericTypeMap); - } - if (typeName === "Array") { - return { - elementType: resolveType(typeReference.typeArguments?.[0], genericTypeMap), - typeName: "array", - }; - } - if (typeName === "Record") { - return { typeName: "object" }; - } - return undefined; -} -function getPrimitiveType(typeNode) { - const primitiveType = syntaxKindMap[typeNode.kind]; - if (!primitiveType) { - return undefined; - } - if (primitiveType === "number") { - const parentNode = typeNode.parent; - if (!parentNode) { - return { typeName: "double" }; - } - const validDecorators = ["IsInt", "IsLong", "IsFloat", "IsDouble"]; - // Can't use decorators on interface/type properties, so support getting the type from jsdoc too. - const jsdocTagName = (0, jsDocUtils_1.getFirstMatchingJSDocTagName)(parentNode, (tag) => { - return validDecorators.some((t) => t === tag.tagName.text); - }); - const decoratorName = (0, decoratorUtils_1.getDecoratorName)(parentNode, (identifier) => { - return validDecorators.some((m) => m === identifier.text); - }); - switch (decoratorName || jsdocTagName) { - case "IsInt": - return { typeName: "integer" }; - case "IsLong": - return { typeName: "long" }; - case "IsFloat": - return { typeName: "float" }; - case "IsDouble": - return { typeName: "double" }; - default: - return { typeName: "double" }; - } - } - return { typeName: primitiveType }; -} -function getDateType(typeNode) { - const parentNode = typeNode.parent; - if (!parentNode) { - return { typeName: "datetime" }; - } - const decoratorName = (0, decoratorUtils_1.getDecoratorName)(parentNode, (identifier) => { - return ["IsDate", "IsDateTime"].some((m) => m === identifier.text); - }); - switch (decoratorName) { - case "IsDate": - return { typeName: "date" }; - case "IsDateTime": - return { typeName: "datetime" }; - default: - return { typeName: "datetime" }; - } -} -function getEnumerateType(typeNameNode) { - let enumDeclaration = metadataGenerator_1.MetadataGenerator.current.typeChecker.getSymbolAtLocation(typeNameNode) - ?.declarations?.[0]; - enumDeclaration = resolveImports(enumDeclaration); - if (enumDeclaration?.kind !== ts.SyntaxKind.EnumDeclaration) { - return undefined; - } - function getEnumValue(member) { - const initializer = member.initializer; - if (initializer) { - if (initializer.expression) { - return parseEnumValueByKind(initializer.expression.text, initializer.kind); - } - return parseEnumValueByKind(initializer.text, initializer.kind); - } - return; - } - return { - enumMembers: enumDeclaration.members.map((member, index) => { - return getEnumValue(member) || index; - }), - typeName: "enum", - }; -} -function parseEnumValueByKind(value, kind) { - return kind === ts.SyntaxKind.NumericLiteral ? parseFloat(value) : value; -} -function getUnionType(typeNode) { - const union = typeNode; - let baseType; - let isObject = false; - const types = union.types.filter((t) => t.kind !== ts.SyntaxKind.UndefinedKeyword); - if (types.length === 1) { - return resolveType(types[0]); - } - union.types.map((type) => { - if (!baseType) { - baseType = type; - } - const prim = getPrimitiveType(type); - if (baseType.kind !== type.kind || !prim) { - isObject = true; - } - }); - if (isObject) { - const mapedTypes = union.types.map((type) => { - return resolveType(type); - }); - return { typeName: "", types: mapedTypes }; - } - return { - enumMembers: union.types.map((type, index) => { - return type.getText() ? removeQuotes(type.getText()) : index; - }), - typeName: "enum", - }; -} -function removeQuotes(str) { - return str.replace(/^["']|["']$/g, ""); -} -function getInlineObjectType(typeNode) { - const type = { - properties: getModelTypeProperties(typeNode), - typeName: "", - }; - return type; -} -function resolveLiteralType(literalTypeNode) { - return { - enumMembers: [literalTypeNode.text], - typeName: "enum", - }; -} -function resolveSimpleTypeName(type) { - if (type.kind === ts.SyntaxKind.Identifier) { - return type.text; - } - const qualifiedType = type; - return qualifiedType.right.text; -} -function getTypeName(typeName) { - return replaceNameText(typeName.parent.getText()); -} -function replaceNameText(text = "") { - return text - .replace(/\/g, "-") - .replace(/\,/g, ".") - .replace(/\|/g, "_or_") - .replace(/\[\]/g, "Array") - .replace(/[^A-Z|a-z|0-9|_|\-|.]/g, ""); -} -function getModelTypeProperties(node, genericTypes) { - if (node.kind === ts.SyntaxKind.TypeLiteral || - node.kind === ts.SyntaxKind.InterfaceDeclaration) { - const interfaceDeclaration = node; - return interfaceDeclaration.members - .filter((member) => { - if (member.type && - member.type.kind === ts.SyntaxKind.FunctionType) { - return false; - } - return member.kind === ts.SyntaxKind.PropertySignature; - }) - .map((member) => { - const propertyDeclaration = member; - const identifier = propertyDeclaration.name; - if (!propertyDeclaration.type) { - throw new Error("No valid type found for property declaration."); - } - // Declare a variable that can be overridden if needed - let aType = propertyDeclaration.type; - // aType.kind will always be a TypeReference when the property of Interface is of type T - if (aType.kind === ts.SyntaxKind.TypeReference && - genericTypes && - genericTypes.length && - node.typeParameters) { - // The type definitions are conviently located on the object which allow us to map -> to the genericTypes - const typeParams = _.map(node.typeParameters, (typeParam) => { - return typeParam.name.text; - }); - // I am not sure in what cases - const typeIdentifier = aType.typeName; - let typeIdentifierName; - // typeIdentifier can either be a Identifier or a QualifiedName - if (typeIdentifier.text) { - typeIdentifierName = typeIdentifier.text; - } - else { - typeIdentifierName = typeIdentifier.right - .text; - } - // I could not produce a situation where this did not find it so its possible this check is irrelevant - const indexOfType = _.indexOf(typeParams, typeIdentifierName); - if (indexOfType >= 0) { - aType = genericTypes[indexOfType]; - } - } - return { - description: getNodeDescription(propertyDeclaration), - name: identifier.text, - required: !propertyDeclaration.questionToken, - type: resolveType(aType), - }; - }); - } - let classDeclaration = node; - let properties = classDeclaration.members.filter((member) => { - if (member.kind !== ts.SyntaxKind.PropertyDeclaration) { - return false; - } - const propertySignature = member; - return propertySignature && hasPublicMemberModifier(propertySignature); - }); - const classConstructor = classDeclaration.members.find((member) => member.kind === ts.SyntaxKind.Constructor); - if (classConstructor && classConstructor.parameters) { - properties = properties.concat(classConstructor.parameters.filter((parameter) => hasPublicConstructorModifier(parameter))); - } - return properties.map((declaration) => { - const identifier = declaration.name; - if (!declaration.type) { - throw new Error("No valid type found for property declaration."); - } - return { - description: getNodeDescription(declaration), - name: identifier.text, - required: !declaration.questionToken, - type: resolveType(resolveTypeParameter(declaration.type, classDeclaration, genericTypes)), - }; - }); -} -function resolveTypeParameter(type, classDeclaration, genericTypes) { - if (genericTypes && - classDeclaration.typeParameters && - classDeclaration.typeParameters.length) { - for (let i = 0; i < classDeclaration.typeParameters.length; i++) { - if (type.typeName && - classDeclaration.typeParameters[i].name.text === type.typeName.text) { - return genericTypes[i]; - } - } - } - return type; -} -// function getModelTypeAdditionalProperties(node: UsableDeclaration) { -// if (node.kind === ts.SyntaxKind.InterfaceDeclaration) { -// const interfaceDeclaration = node as ts.InterfaceDeclaration; -// return interfaceDeclaration.members -// .filter((member) => member.kind === ts.SyntaxKind.IndexSignature) -// .map((member: any) => { -// const indexSignatureDeclaration = -// member as ts.IndexSignatureDeclaration; -// const indexType = resolveType( -// indexSignatureDeclaration.parameters[0].type as ts.TypeNode -// ); -// if ( -// indexType.typeName !== "string" && -// indexType.typeName !== "double" -// ) { -// throw new Error( -// `Only string/number indexers are supported. Found ${indexType.typeName}.` -// ); -// } -// return { -// description: "", -// name: "", -// required: true, -// type: resolveType(indexSignatureDeclaration.type as ts.TypeNode), -// }; -// }); -// } -// return undefined; -// } -function getModifiers(node) { - if (ts.canHaveModifiers(node)) { - return ts.getModifiers(node) ?? []; - } - return []; -} -function hasPublicMemberModifier(node) { - return (getModifiers(node).length > 0 && - getModifiers(node).every((modifier) => { - return (modifier.kind !== ts.SyntaxKind.ProtectedKeyword && - modifier.kind !== ts.SyntaxKind.PrivateKeyword); - })); -} -function hasPublicConstructorModifier(node) { - return (getModifiers(node).length > 0 && - getModifiers(node).some((modifier) => { - return modifier.kind === ts.SyntaxKind.PublicKeyword; - })); -} -function getNodeDescription(node) { - let symbol = metadataGenerator_1.MetadataGenerator.current.typeChecker.getSymbolAtLocation(node.name); - symbol = resolveImports(symbol); - if (symbol) { - /** - * TODO: Workaround for what seems like a bug in the compiler - * Warrants more investigation and possibly a PR against typescript - */ - if (node.kind === ts.SyntaxKind.Parameter) { - // TypeScript won't parse jsdoc if the flag is 4, i.e. 'Property' - symbol.flags = 0; - } - const comments = symbol.getDocumentationComment(metadataGenerator_1.MetadataGenerator.current.typeChecker); - if (comments.length) { - return ts.displayPartsToString(comments); - } - } - return ""; -} -function getSuperClass(node, typeArguments) { - const clauses = node.heritageClauses; - if (clauses) { - const filteredClauses = clauses.filter((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword); - if (filteredClauses.length > 0) { - const clause = filteredClauses[0]; - if (clause.types && clause.types.length > 0) { - let type = metadataGenerator_1.MetadataGenerator.current.typeChecker.getSymbolAtLocation(clause.types[0].expression)?.declarations?.[0]; - type = resolveImports(type); - if (!type) { - throw new Error("Could not resolve type of extend"); - } - return { - type: type, - typeArguments: resolveTypeArguments(type, clause.types[0].typeArguments, typeArguments), - }; - } - } - } - return undefined; -} -function buildGenericTypeMap(node, typeArguments) { - const result = new Map(); - if (node.typeParameters && typeArguments) { - node.typeParameters.forEach((typeParam, index) => { - const paramName = typeParam.name.text; - result.set(paramName, typeArguments[index]); - }); - } - return result; -} -function resolveTypeArguments(node, typeArguments, parentTypeArguments) { - const result = buildGenericTypeMap(node, typeArguments); - if (parentTypeArguments) { - result.forEach((value, key) => { - const typeName = getTypeName(value); - if (parentTypeArguments.has(typeName)) { - result.set(key, parentTypeArguments.get(typeName)); - } - }); - } - return result; -} -/** - * Used to identify union types of a primitive and array of the same primitive, e.g. `string | string[]` - */ -function getCommonPrimitiveAndArrayUnionType(typeNode) { - if (typeNode && typeNode.kind === ts.SyntaxKind.UnionType) { - const union = typeNode; - const types = union.types - .map((t) => resolveType(t)) - .filter((t) => t.typeName !== "undefined"); - const arrType = types.find((t) => t.typeName === "array"); - const primitiveType = types.find((t) => t.typeName !== "array"); - if (types.length === 2 && - arrType && - arrType.elementType && - primitiveType && - arrType.elementType.typeName === primitiveType.typeName) { - return arrType; - } - } - return null; -} -function getLiteralValue(expression) { - if (expression.kind === ts.SyntaxKind.StringLiteral) { - return expression.text; - } - if (expression.kind === ts.SyntaxKind.NumericLiteral) { - return parseFloat(expression.text); - } - if (expression.kind === ts.SyntaxKind.TrueKeyword) { - return true; - } - if (expression.kind === ts.SyntaxKind.FalseKeyword) { - return false; - } - if (expression.kind === ts.SyntaxKind.ArrayLiteralExpression) { - return expression.elements.map((e) => getLiteralValue(e)); - } - return; -} -function resolveImports(node) { - const nodeAsImportSpecifier = node; - const checker = metadataGenerator_1.MetadataGenerator.current.typeChecker; - if (nodeAsImportSpecifier?.kind === ts.SyntaxKind.ImportSpecifier) { - const symbol = checker.getSymbolAtLocation(nodeAsImportSpecifier.name); - if (symbol) { - const aliasedSymbol = checker.getAliasedSymbol(symbol); - const declaration = aliasedSymbol.getDeclarations()?.[0]; - return declaration; - } - } - return node; -} -function getSourceFile(node) { - while (node.kind !== ts.SyntaxKind.SourceFile) { - node = node.parent; - } - return node; -} -function getOriginalSourceFile(symbol) { - if (symbol && - symbol?.declarations?.[0].kind === ts.SyntaxKind.ImportSpecifier) { - return metadataGenerator_1.MetadataGenerator.current.typeChecker - .getAliasedSymbol(symbol) - .getDeclarations()?.[0] - .getSourceFile().fileName; - } - return symbol?.declarations?.[0].getSourceFile().fileName; -} -//# sourceMappingURL=resolveType.js.map \ No newline at end of file diff --git a/dist/metadata/resolveType.js.map b/dist/metadata/resolveType.js.map deleted file mode 100644 index 02c8b1e..0000000 --- a/dist/metadata/resolveType.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolveType.js","sourceRoot":"","sources":["../../src/metadata/resolveType.ts"],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gB,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,IAAa;IAClC,OAAO,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAC9C,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,IAAqB,CAAC;AAC/B,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAiB;IAC9C,IACE,MAAM;QACN,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,eAAe,EAChE,CAAC;QACD,OAAO,qCAAiB,CAAC,OAAO,CAAC,WAAW;aACzC,gBAAgB,CAAC,MAAM,CAAC;aACxB,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;aACtB,aAAa,EAAE,CAAC,QAAQ,CAAC;IAC9B,CAAC;IACD,OAAO,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC;AAC5D,CAAC"} \ No newline at end of file diff --git a/dist/swagger/generator.d.ts b/dist/swagger/generator.d.ts deleted file mode 100644 index 192ef18..0000000 --- a/dist/swagger/generator.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { SwaggerConfig } from "../config"; -import { Metadata } from "../metadata/metadataGenerator"; -import { Swagger } from "./swagger"; -export declare class SpecGenerator { - private readonly metadata; - private readonly config; - private debugger; - constructor(metadata: Metadata, config: SwaggerConfig); - generate(): Promise; - getSwaggerSpec(): Swagger.Spec; - getOpenApiSpec(): Swagger.Spec; - private buildDefinitions; - private buildPaths; - private buildPathMethod; - private buildParameter; - private buildProperties; - private buildOperation; - private getMimeType; - private getOperationId; - private getSwaggerType; - private getSwaggerTypeForPrimitiveType; - private getSwaggerTypeForObjectType; - private getSwaggerTypeForArrayType; - private getSwaggerTypeForEnumType; - private getSwaggerTypeForReferenceType; -} -//# sourceMappingURL=generator.d.ts.map \ No newline at end of file diff --git a/dist/swagger/generator.d.ts.map b/dist/swagger/generator.d.ts.map deleted file mode 100644 index dbda019..0000000 --- a/dist/swagger/generator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/swagger/generator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAGL,QAAQ,EAST,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAU,OAAO,EAAqB,MAAM,WAAW,CAAC;AAE/D,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,OAAO,CAAC,QAAQ,CAAmD;gBAGhD,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,aAAa;IAG3B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAwD/B,cAAc;IA2Cd,cAAc;IAiBrB,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,UAAU;IAmClB,OAAO,CAAC,eAAe;IA6EvB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,cAAc;IA+BtB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,cAAc;IAwDtB,OAAO,CAAC,8BAA8B;IAqBtC,OAAO,CAAC,2BAA2B;IAOnC,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,yBAAyB;IAuBjC,OAAO,CAAC,8BAA8B;CAKvC"} \ No newline at end of file diff --git a/dist/swagger/generator.js b/dist/swagger/generator.js deleted file mode 100644 index 344e1a9..0000000 --- a/dist/swagger/generator.js +++ /dev/null @@ -1,384 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpecGenerator = void 0; -const debug = require("debug"); -const fs = require("fs"); -const fs_extra_promise_1 = require("fs-extra-promise"); -const _ = require("lodash"); -const pathUtil = require("path"); -const YAML = require("yamljs"); -const swagger_1 = require("./swagger"); -class SpecGenerator { - metadata; - config; - debugger = debug("typescript-rest-swagger:spec-generator"); - constructor(metadata, config) { - this.metadata = metadata; - this.config = config; - } - async generate() { - this.debugger("Generating swagger files."); - this.debugger("Swagger Config: %j", this.config); - this.debugger("Services Metadata: %j", this.metadata); - let spec = this.getSwaggerSpec(); - // if (this.config.outputFormat === Specification.OpenApi_3) { - // spec = await this.convertToOpenApiSpec(spec); - // } - return new Promise((resolve, reject) => { - const swaggerDirs = _.castArray(this.config.outputDirectory); - this.debugger("Saving specs to folders: %j", swaggerDirs); - swaggerDirs.forEach((swaggerDir) => { - (0, fs_extra_promise_1.mkdirp)(swaggerDir) - .then(() => { - this.debugger("Saving specs json file to folder: %j", swaggerDir); - fs.writeFile(`${swaggerDir}/swagger.json`, JSON.stringify(spec, null, "\t"), (err) => { - if (err) { - return reject(err); - } - if (this.config.yaml) { - this.debugger("Saving specs yaml file to folder: %j", swaggerDir); - fs.writeFile(`${swaggerDir}/swagger.yaml`, YAML.stringify(spec, 1000), (errYaml) => { - if (errYaml) { - return reject(errYaml); - } - this.debugger("Generated files saved to folder: %j", swaggerDir); - resolve(); - }); - } - else { - this.debugger("Generated files saved to folder: %j", swaggerDir); - resolve(); - } - }); - }) - .catch(reject); - }); - }); - } - getSwaggerSpec() { - let spec = { - components: { - schemas: this.buildDefinitions(), - }, - info: { - title: "", - version: "", - }, - paths: this.buildPaths(), - openapi: "3.0.1", - }; - spec.security = this.config.securityDefinitions; - spec.security = this.config.securityDefinitions - ? this.config.securityDefinitions - : []; - if (this.config.description) { - spec.info.description = this.config.description; - } - if (this.config.license) { - spec.info.license = { name: this.config.license }; - } - if (this.config.name) { - spec.info.title = this.config.name; - } - if (this.config.version) { - spec.info.version = this.config.version; - } - if (this.config.servers) { - spec.servers = this.config.servers; - } - if (this.config.spec) { - spec = require("merge").recursive(spec, this.config.spec); - } - this.debugger("Generated specs: %j", spec); - return spec; - } - getOpenApiSpec() { - return this.getSwaggerSpec(); - } - // private async convertToOpenApiSpec(spec: Swagger.Spec) { - // this.debugger('Converting specs to openapi 3.0'); - // const converter = require('swagger2openapi'); - // const options = { - // patch: true, - // warnOnly: true, - // }; - // const openapi = await converter.convertObj(spec, options); - // this.debugger('Converted to openapi 3.0: %j', openapi); - // return openapi.openapi; - // } - buildDefinitions() { - const definitions = {}; - Object.keys(this.metadata.referenceTypes).map((typeName) => { - this.debugger("Generating definition for type: %s", typeName); - const referenceType = this.metadata.referenceTypes[typeName]; - this.debugger("Metadata for referenced Type: %j", referenceType); - definitions[referenceType.typeName] = { - description: referenceType.description, - properties: this.buildProperties(referenceType.properties), - type: "object", - }; - const requiredFields = referenceType.properties - .filter((p) => p.required) - .map((p) => p.name); - if (requiredFields && requiredFields.length) { - definitions[referenceType.typeName].required = requiredFields; - } - // if (referenceType.additionalProperties) { - // definitions[referenceType.typeName].additionalProperties = this.buildAdditionalProperties(referenceType.additionalProperties); - // } - this.debugger("Generated Definition for type %s: %j", typeName, definitions[referenceType.typeName]); - }); - return definitions; - } - buildPaths() { - const paths = {}; - this.debugger("Generating paths declarations"); - this.metadata.controllers.forEach((controller) => { - this.debugger("Generating paths for controller: %s", controller.name); - controller.methods.forEach((method) => { - this.debugger("Generating paths for method: %s", method.name); - const path = pathUtil.posix.join("/", controller.path ? controller.path : "", method.path); - paths[path] = paths[path] || {}; - method.consumes = _.union(controller.consumes, method.consumes); - method.produces = _.union(controller.produces, method.produces); - method.tags = _.union(controller.tags, method.tags); - // method.security = method.security || controller.security; - method.responses = _.union(controller.responses, method.responses); - const pathObject = paths[path]; - pathObject[method.method] = this.buildPathMethod(controller.name, method); - this.debugger("Generated path for method %s: %j", method.name, pathObject[method.method]); - }); - }); - return paths; - } - buildPathMethod(controllerName, method) { - const pathMethod = this.buildOperation(controllerName, method); - pathMethod.description = method.description; - if (method.summary) { - pathMethod.summary = method.summary; - } - if (method.deprecated) { - pathMethod.deprecated = method.deprecated; - } - if (method.tags.length) { - pathMethod.tags = method.tags; - } - // if (method.security) { - // pathMethod.security = method.security.map((s) => ({ - // [s.name]: s.scopes || [], - // })); - // } - const [bodyParam, noBodyParameter] = method.parameters.reduce(([pass, fail], elem) => { - return elem.in === "body" - ? [[...pass, elem], fail] - : [pass, [...fail, elem]]; - }, [[], []]); - pathMethod.parameters = noBodyParameter - .filter((p) => p.in !== "param") - .map((p) => this.buildParameter(p)); - noBodyParameter - .filter((p) => p.in === "param") - .forEach((p) => { - pathMethod.parameters?.push(this.buildParameter({ - description: p.description, - in: "query", - name: p.name, - parameterName: p.parameterName, - required: false, - type: p.type, - })); - // pathMethod.parameters.push( - // this.buildParameter({ - // description: p.description, - // in: "formData", - // name: p.name, - // parameterName: p.parameterName, - // required: false, - // type: p.type, - // }) - // ); - }); - if (bodyParam.length > 1) { - throw new Error("Only one body parameter allowed per controller method."); - } - if (bodyParam.length > 0) { - pathMethod.requestBody = { - content: { - "application/json": { - schema: this.getSwaggerType(bodyParam[0].type), - }, - }, - description: bodyParam[0].description, - }; - } - return pathMethod; - } - buildParameter(parameter) { - const swaggerParameter = { - description: parameter.description, - in: parameter.in, - name: parameter.name, - required: parameter.required, - }; - const parameterType = this.getSwaggerType(parameter.type); - swaggerParameter.schema = parameterType; - return swaggerParameter; - } - buildProperties(properties) { - const swaggerProperties = {}; - properties.forEach((property) => { - const swaggerType = this.getSwaggerType(property.type); - if (!swaggerType) { - return; - } - if (!(0, swagger_1.isReferenceObject)(swaggerType)) { - swaggerType.description = property.description; - } - swaggerProperties[property.name] = swaggerType; - }); - return swaggerProperties; - } - buildOperation(controllerName, method) { - const operation = { - operationId: this.getOperationId(controllerName, method.name), - responses: {}, - }; - method.responses.forEach((res) => { - operation.responses[res.status] = { - description: res.description, - content: {}, - }; - if (res.schema) { - const swaggerType = this.getSwaggerType(res.schema); - const mimeType = this.getMimeType(swaggerType); - const codeObject = operation.responses[res.status]; - if (!(0, swagger_1.isReferenceObject)(codeObject)) { - if (swaggerType && codeObject.content && mimeType) { - codeObject.content[mimeType] = { - schema: swaggerType, - }; - } - // if (res.examples && mimeType) { - // codeObject.content[mimeType].examples = res.examples; - // } - } - } - }); - return operation; - } - getMimeType(swaggerType) { - if (swaggerType === undefined) { - return undefined; - } - if ((0, swagger_1.isReferenceObject)(swaggerType)) { - return "application/json"; - } - if (swaggerType.type === "array" || swaggerType.type === "object") { - return "application/json"; - } - else if (swaggerType.type === "string" && - swaggerType.format === "binary") { - return "application/octet-stream"; - } - else { - return "text/html"; - } - } - getOperationId(controllerName, methodName) { - const controllerNameWithoutSuffix = controllerName.replace(new RegExp("Controller$"), ""); - return `${controllerNameWithoutSuffix}${methodName.charAt(0).toUpperCase() + methodName.substr(1)}`; - } - getSwaggerType(type) { - if (type.typeName === "void") { - return undefined; - } - const swaggerType = this.getSwaggerTypeForPrimitiveType(type); - if (swaggerType) { - return swaggerType; - } - const arrayType = type; - if (arrayType.elementType) { - return this.getSwaggerTypeForArrayType(arrayType); - } - const enumType = type; - if (enumType.enumMembers) { - return this.getSwaggerTypeForEnumType(enumType); - } - const refType = type; - if (refType.properties && refType.description !== undefined) { - return this.getSwaggerTypeForReferenceType(type); - } - const unionType = type; - if (unionType.types && unionType.types.length > 0) { - let map = unionType.types - .map((t) => this.getSwaggerType(t)) - .filter((t) => t !== undefined); - let [enums, nonEnums] = _.partition(map, (m) => { - return m.hasOwnProperty("enum"); - }); - map = [...nonEnums]; - let groupedEnums = _.groupBy(enums, (e) => "type" in e && e.type); - _.each(groupedEnums, (enums, type) => { - let enumValues = _.flatten(enums.map((e) => "enum" in e && e.enum)); - map.push({ type: type, enum: enumValues }); - }); - if (map.length === 1) { - return map[0]; - } - return { oneOf: map }; - } - const objectType = type; - return this.getSwaggerTypeForObjectType(objectType); - } - getSwaggerTypeForPrimitiveType(type) { - const typeMap = { - binary: { type: "string", format: "binary" }, - boolean: { type: "boolean" }, - buffer: { type: "string", format: "binary" }, - // buffer: { type: 'string', format: 'base64' }, - byte: { type: "string", format: "byte" }, - date: { type: "string", format: "date" }, - datetime: { type: "string", format: "date-time" }, - double: { type: "number", format: "double" }, - file: { type: "string", format: "binary" }, - float: { type: "number", format: "float" }, - integer: { type: "integer", format: "int32" }, - long: { type: "integer", format: "int64" }, - object: { type: "object" }, - string: { type: "string" }, - }; - return typeMap[type.typeName]; - } - getSwaggerTypeForObjectType(objectType) { - return { - type: "object", - properties: this.buildProperties(objectType.properties), - }; - } - getSwaggerTypeForArrayType(arrayType) { - if (!arrayType.elementType) { - return undefined; - } - return { type: "array", items: this.getSwaggerType(arrayType.elementType) }; - } - getSwaggerTypeForEnumType(enumType) { - function getDerivedTypeFromValues(values) { - return values.reduce((derivedType, item) => { - const currentType = typeof item; - derivedType = - derivedType && derivedType !== currentType ? "string" : currentType; - return derivedType; - }, null); - } - const enumValues = enumType.enumMembers.map((member) => member); - return { - enum: enumType.enumMembers.map((member) => member), - type: getDerivedTypeFromValues(enumValues), - }; - } - getSwaggerTypeForReferenceType(referenceType) { - return { $ref: `#/components/schemas/${referenceType.typeName}` }; - } -} -exports.SpecGenerator = SpecGenerator; -//# sourceMappingURL=generator.js.map \ No newline at end of file diff --git a/dist/swagger/generator.js.map b/dist/swagger/generator.js.map deleted file mode 100644 index 4a9c34c..0000000 --- a/dist/swagger/generator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/swagger/generator.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,yBAAyB;AACzB,uDAA0C;AAC1C,4BAA4B;AAE5B,iCAAiC;AACjC,+BAA+B;AAe/B,uCAA+D;AAE/D,MAAa,aAAa;IAIL;IACA;IAJX,QAAQ,GAAG,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAEnE,YACmB,QAAkB,EAClB,MAAqB;QADrB,aAAQ,GAAR,QAAQ,CAAU;QAClB,WAAM,GAAN,MAAM,CAAe;IACrC,CAAC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;gBACtE,OAAO,WAAW,CAAC;YACrB,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;QAED,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAgB,CACZ,CAAC;QACnB,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,CAC5B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAgB,CACZ;YAClB,IAAI,EAAE,wBAAwB,CAAC,UAAU,CAAC;SAC3C,CAAC;IACJ,CAAC;IAEO,8BAA8B,CACpC,aAA4B;QAE5B,OAAO,EAAE,IAAI,EAAE,wBAAwB,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpE,CAAC;CACF;AAheD,sCAgeC"} \ No newline at end of file diff --git a/dist/swagger/swagger.d.ts b/dist/swagger/swagger.d.ts deleted file mode 100644 index 2a14e16..0000000 --- a/dist/swagger/swagger.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { OpenAPIV3 } from "openapi-types"; -export declare namespace Swagger { - interface Spec extends OpenAPIV3.Document { - } -} -export type Schema = OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; -export declare function isReferenceObject(schema: Schema): schema is OpenAPIV3.ReferenceObject; -export declare function isArrayObject(schema: Schema): schema is OpenAPIV3.ArraySchemaObject; -//# sourceMappingURL=swagger.d.ts.map \ No newline at end of file diff --git a/dist/swagger/swagger.d.ts.map b/dist/swagger/swagger.d.ts.map deleted file mode 100644 index c0fce74..0000000 --- a/dist/swagger/swagger.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"swagger.d.ts","sourceRoot":"","sources":["../../src/swagger/swagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,yBAAiB,OAAO,CAAC;IACvB,UAAiB,IAAK,SAAQ,SAAS,CAAC,QAAQ;KAAG;CACpD;AAED,MAAM,MAAM,MAAM,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,eAAe,CAAC;AAExE,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,SAAS,CAAC,eAAe,CAErC;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAEvC"} \ No newline at end of file diff --git a/dist/swagger/swagger.js b/dist/swagger/swagger.js deleted file mode 100644 index 93ae51f..0000000 --- a/dist/swagger/swagger.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isReferenceObject = isReferenceObject; -exports.isArrayObject = isArrayObject; -function isReferenceObject(schema) { - return schema && schema.$ref !== undefined; -} -function isArrayObject(schema) { - return schema && "items" in schema; -} -//# sourceMappingURL=swagger.js.map \ No newline at end of file diff --git a/dist/swagger/swagger.js.map b/dist/swagger/swagger.js.map deleted file mode 100644 index 1852e25..0000000 --- a/dist/swagger/swagger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../src/swagger/swagger.ts"],"names":[],"mappings":";;AAQA,8CAIC;AAED,sCAIC;AAVD,SAAgB,iBAAiB,CAC/B,MAAc;IAEd,OAAO,MAAM,IAAK,MAAoC,CAAC,IAAI,KAAK,SAAS,CAAC;AAC5E,CAAC;AAED,SAAgB,aAAa,CAC3B,MAAc;IAEd,OAAO,MAAM,IAAI,OAAO,IAAI,MAAM,CAAC;AACrC,CAAC"} \ No newline at end of file diff --git a/dist/utils/decoratorUtils.d.ts b/dist/utils/decoratorUtils.d.ts deleted file mode 100644 index fa522db..0000000 --- a/dist/utils/decoratorUtils.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as ts from "typescript"; -export declare function getDecorators(node: ts.Node, isMatching: (identifier: DecoratorData) => boolean): Array; -export declare function getDecoratorName(node: ts.Node, isMatching: (identifier: DecoratorData) => boolean): string | undefined; -export declare function getDecoratorTextValue(node: ts.Node, isMatching: (identifier: DecoratorData) => boolean): string | undefined; -export declare function getDecoratorOptions(node: ts.Node, isMatching: (identifier: DecoratorData) => boolean): { - [key: string]: any; -} | undefined; -export declare function isDecorator(node: ts.Node, isMatching: (identifier: DecoratorData) => boolean): boolean; -export interface DecoratorData { - text: string; - arguments: Array; - typeArguments: Array; -} -//# sourceMappingURL=decoratorUtils.d.ts.map \ No newline at end of file diff --git a/dist/utils/decoratorUtils.d.ts.map b/dist/utils/decoratorUtils.d.ts.map deleted file mode 100644 index da99f05..0000000 --- a/dist/utils/decoratorUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decoratorUtils.d.ts","sourceRoot":"","sources":["../../src/utils/decoratorUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,OAAO,GACjD,KAAK,CAAC,aAAa,CAAC,CAkCtB;AAcD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,OAAO,sBAInD;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,OAAO,sBAMnD;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,OAAO;;cAMnD;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,OAAO,WAOnD;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,aAAa,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CAC3B"} \ No newline at end of file diff --git a/dist/utils/decoratorUtils.js b/dist/utils/decoratorUtils.js deleted file mode 100644 index f999c7c..0000000 --- a/dist/utils/decoratorUtils.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getDecorators = getDecorators; -exports.getDecoratorName = getDecoratorName; -exports.getDecoratorTextValue = getDecoratorTextValue; -exports.getDecoratorOptions = getDecoratorOptions; -exports.isDecorator = isDecorator; -const ts = require("typescript"); -function getDecorators(node, isMatching) { - const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : []; - if (!decorators || !decorators.length) { - return []; - } - return decorators - .map((d) => { - const result = { - arguments: [], - typeArguments: [], - }; - let x = d.expression; - if (ts.isCallExpression(x)) { - if (x.arguments) { - result.arguments = x.arguments.map((argument) => { - if (ts.isStringLiteral(argument)) { - return argument.text; - } - else if (ts.isNumericLiteral(argument)) { - return argument.text; - } - else { - return argument; - } - }); - } - if (x.typeArguments) { - result.typeArguments = x.typeArguments; - } - x = x.expression; - } - result.text = x.text || x.name.text; - return result; - }) - .filter(isMatching); -} -function getDecorator(node, isMatching) { - const decorators = getDecorators(node, isMatching); - if (!decorators || !decorators.length) { - return undefined; - } - return decorators[0]; -} -function getDecoratorName(node, isMatching) { - const decorator = getDecorator(node, isMatching); - return decorator ? decorator.text : undefined; -} -function getDecoratorTextValue(node, isMatching) { - const decorator = getDecorator(node, isMatching); - return decorator && typeof decorator.arguments[0] === "string" - ? decorator.arguments[0] - : undefined; -} -function getDecoratorOptions(node, isMatching) { - const decorator = getDecorator(node, isMatching); - return decorator && typeof decorator.arguments[1] === "object" - ? decorator.arguments[1] - : undefined; -} -function isDecorator(node, isMatching) { - const decorators = getDecorators(node, isMatching); - if (!decorators || !decorators.length) { - return false; - } - return true; -} -//# sourceMappingURL=decoratorUtils.js.map \ No newline at end of file diff --git a/dist/utils/decoratorUtils.js.map b/dist/utils/decoratorUtils.js.map deleted file mode 100644 index a04f903..0000000 --- a/dist/utils/decoratorUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decoratorUtils.js","sourceRoot":"","sources":["../../src/utils/decoratorUtils.ts"],"names":[],"mappings":";;AAEA,sCAqCC;AAcD,4CAMC;AAED,sDAQC;AAED,kDAQC;AAED,kCASC;AA1FD,iCAAiC;AAEjC,SAAgB,aAAa,CAC3B,IAAa,EACb,UAAkD;IAElD,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,UAAU;SACd,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,MAAM,GAAQ;YAClB,SAAS,EAAE,EAAE;YACb,aAAa,EAAE,EAAE;SAClB,CAAC;QACF,IAAI,CAAC,GAAQ,CAAC,CAAC,UAAU,CAAC;QAC1B,IAAI,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;gBAChB,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;oBAC9C,IAAI,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACjC,OAAO,QAAQ,CAAC,IAAI,CAAC;oBACvB,CAAC;yBAAM,IAAI,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACzC,OAAO,QAAQ,CAAC,IAAI,CAAC;oBACvB,CAAC;yBAAM,CAA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AAS,GAAG,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACjD,OAAO,SAAS,IAAI,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC5D,CAAC,CAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAA4B;QACpD,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAgB,WAAW,CACzB,IAAa,EACb,UAAkD;IAElD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/dist/utils/jsDocUtils.d.ts b/dist/utils/jsDocUtils.d.ts deleted file mode 100644 index 5451bd1..0000000 --- a/dist/utils/jsDocUtils.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as ts from "typescript"; -export declare function getJSDocDescription(node: ts.Node): string; -export declare function getJSDocTag(node: ts.Node, tagName: string): string | undefined; -export declare function isExistJSDocTag(node: ts.Node, tagName: string): boolean; -export declare function getFirstMatchingJSDocTagName(node: ts.Node, isMatching: (t: ts.JSDocTag) => boolean): string | undefined; -//# sourceMappingURL=jsDocUtils.d.ts.map \ No newline at end of file diff --git a/dist/utils/jsDocUtils.d.ts.map b/dist/utils/jsDocUtils.d.ts.map deleted file mode 100644 index 06e566a..0000000 --- a/dist/utils/jsDocUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jsDocUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jsDocUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,UAOhD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,sBAMzD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,WAM7D;AAMD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,KAAK,OAAO,sBAQxC"} \ No newline at end of file diff --git a/dist/utils/jsDocUtils.js b/dist/utils/jsDocUtils.js deleted file mode 100644 index 5e0ddc0..0000000 --- a/dist/utils/jsDocUtils.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getJSDocDescription = getJSDocDescription; -exports.getJSDocTag = getJSDocTag; -exports.isExistJSDocTag = isExistJSDocTag; -exports.getFirstMatchingJSDocTagName = getFirstMatchingJSDocTagName; -function getJSDocDescription(node) { - const jsDocs = node.jsDoc; - if (!jsDocs || !jsDocs.length) { - return ""; - } - return jsDocs[0].comment || ""; -} -function getJSDocTag(node, tagName) { - const tags = getJSDocTags(node, tagName); - if (!tags || !tags.length) { - return undefined; - } - return tags[0].comment; -} -function isExistJSDocTag(node, tagName) { - const tags = getJSDocTags(node, tagName); - if (!tags || !tags.length) { - return false; - } - return true; -} -function getJSDocTags(node, tagName) { - return getMatchingJSDocTags(node, (t) => t.tagName.text === tagName); -} -function getFirstMatchingJSDocTagName(node, isMatching) { - const tags = getMatchingJSDocTags(node, isMatching); - if (!tags || !tags.length) { - return undefined; - } - return tags[0].tagName.text; -} -function getMatchingJSDocTags(node, isMatching) { - const jsDocs = node.jsDoc; - if (!jsDocs || !jsDocs.length) { - return undefined; - } - const jsDoc = jsDocs[0]; - if (!jsDoc.tags) { - return undefined; - } - return jsDoc.tags.filter(isMatching); -} -//# sourceMappingURL=jsDocUtils.js.map \ No newline at end of file diff --git a/dist/utils/jsDocUtils.js.map b/dist/utils/jsDocUtils.js.map deleted file mode 100644 index 3a8dbd2..0000000 --- a/dist/utils/jsDocUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jsDocUtils.js","sourceRoot":"","sources":["../../src/utils/jsDocUtils.ts"],"names":[],"mappings":";;AAEA,kDAOC;AAED,kCAMC;AAED,0CAMC;AAMD,oEAUC;AAvCD,SAAgB,mBAAmB,CAAC,IAAa;IAC/C,MAAM,MAAM,GAAI,IAAY,CAAC,KAAwB,CAAC;IACtD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAQ,MAAM,CAAC,CAAC,CAAC,CAAC,OAAkB,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED,SAAgB,WAAW,CAAC,IAAa,EAAE,OAAe;IACxD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,OAAiB,CAAC;AACnC,CAAC;AAED,SAAgB,eAAe,CAAC,IAAa,EAAE,OAAe;IAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,YAAY,CAAC,IAAa,EAAE,OAAe;IAClD,OAAO,oBAAoB,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AACvE,CAAC;AAED,SAAgB,4BAA4B,CAC1C,IAAa,EACb,UAAuC;IAEvC,MAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AAC9B,CAAC;AAED,SAAS,oBAAoB,CAC3B,IAAa,EACb,UAAuC;IAEvC,MAAM,MAAM,GAAI,IAAY,CAAC,KAAwB,CAAC;IACtD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/dist/utils/pathUtils.d.ts b/dist/utils/pathUtils.d.ts deleted file mode 100644 index 3f09de2..0000000 --- a/dist/utils/pathUtils.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function normalizePath(path?: string): string | undefined; -//# sourceMappingURL=pathUtils.d.ts.map \ No newline at end of file diff --git a/dist/utils/pathUtils.d.ts.map b/dist/utils/pathUtils.d.ts.map deleted file mode 100644 index aafdc98..0000000 --- a/dist/utils/pathUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pathUtils.d.ts","sourceRoot":"","sources":["../../src/utils/pathUtils.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,sBAU1C"} \ No newline at end of file diff --git a/dist/utils/pathUtils.js b/dist/utils/pathUtils.js deleted file mode 100644 index e2fda39..0000000 --- a/dist/utils/pathUtils.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.normalizePath = normalizePath; -function normalizePath(path) { - if (!path) { - return path; - } - let parts = path.split("/"); - parts = parts.map((part) => part.startsWith(":") ? `{${part.slice(1)}}` : part); - return parts.join("/"); -} -//# sourceMappingURL=pathUtils.js.map \ No newline at end of file diff --git a/dist/utils/pathUtils.js.map b/dist/utils/pathUtils.js.map deleted file mode 100644 index 77a5d07..0000000 --- a/dist/utils/pathUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pathUtils.js","sourceRoot":"","sources":["../../src/utils/pathUtils.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,sCAUC;AAVD,SAAgB,aAAa,CAAC,IAAa;IACzC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CACnD,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"} \ No newline at end of file