@nestia/migrate 0.8.0-dev.20240217 → 0.8.0-dev.20240217-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ const MigrateAnalyzer_1 = require("./analyzers/MigrateAnalyzer");
9
9
  const NEST_TEMPLATE_1 = require("./bundles/NEST_TEMPLATE");
10
10
  const SDK_TEMPLATE_1 = require("./bundles/SDK_TEMPLATE");
11
11
  const MigrateApiProgrammer_1 = require("./programmers/MigrateApiProgrammer");
12
+ const MigrateApiStartProgrammer_1 = require("./programmers/MigrateApiStartProgrammer");
12
13
  const MigrateE2eProgrammer_1 = require("./programmers/MigrateE2eProgrammer");
13
14
  const MigrateNestProgrammer_1 = require("./programmers/MigrateNestProgrammer");
14
15
  class MigrateApplication {
@@ -1487,6 +1488,7 @@ class MigrateApplication {
1487
1488
  files: [
1488
1489
  ...SDK_TEMPLATE_1.SDK_TEMPLATE,
1489
1490
  ...MigrateApiProgrammer_1.MigrateApiProgrammer.write(program),
1491
+ MigrateApiStartProgrammer_1.MigrateApiStartProgrammer.write(program),
1490
1492
  ...(config.e2e ? MigrateE2eProgrammer_1.MigrateE2eProgrammer.write(program) : []),
1491
1493
  ],
1492
1494
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MigrateApplication.js","sourceRoot":"","sources":["../src/MigrateApplication.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iEAA8D;AAC9D,2DAAwD;AACxD,yDAAsD;AAEtD,6EAA0E;AAC1E,6EAA0E;AAC1E,+EAA4E;AAI5E,MAAa,kBAAkB;IAG7B,YAAmB,OAAiB;QAClC,IAAI,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAAG,eAAK,CAAC,MAAM;kCA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\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"test\": \"npx ts-node test/index.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.1\",\r\n \"@types/inquirer\": \"8.2.5\",\r\n \"commander\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"prettier\": \"^3.2.5\",\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.1.2\",\r\n \"typescript\": \"^5.3.3\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.5.8\",\r\n \"typia\": \"^5.4.9\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm install && npm run test\"\r\n }\r\n}"
28
+ "content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"npx ts-node test/start.ts\",\r\n \"test\": \"npx ts-node test/index.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.1\",\r\n \"@types/inquirer\": \"8.2.5\",\r\n \"commander\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"prettier\": \"^3.2.5\",\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.1.2\",\r\n \"typescript\": \"^5.3.3\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.5.8\",\r\n \"typia\": \"^5.4.9\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm install && npm run test\"\r\n }\r\n}"
29
29
  },
30
30
  {
31
31
  "location": "",
@@ -35,7 +35,7 @@ exports.SDK_TEMPLATE = [
35
35
  {
36
36
  "location": "",
37
37
  "file": "README.md",
38
- "content": "# SDK Library\r\nThis is a SDK library generated by [`nestia`](https://nestia.io).\r\n\r\nWith this SDK library, you can easily and safely interact with backend server.\r\n\r\nJust import and call some API functions like gif image below:\r\n\r\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\r\n\r\n> Left is server code, and right is client code utilizing the SDK\r\n\r\n\r\n\r\n\r\n# What [`Nestia`](https://nestia.io) is:\r\n![Nestia Logo](https://nestia.io/logo.png)\r\n\r\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\r\n[![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n[![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n[![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\r\n[![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\r\n\r\nNestia is a set of helper libraries for NestJS, supporting below features:\r\n\r\n - `@nestia/core`: super-fast decorators\r\n - `@nestia/sdk`:\r\n - Swagger generator evolved than ever\r\n - SDK library generator for clients\r\n - Mockup Simulator for client applications\r\n - Automatic E2E test functions generator\r\n - `@nestia/migrate`: migration from Swagger to NestJS\r\n - `nestia`: just CLI (command line interface) tool\r\n\r\n> **Note**\r\n> \r\n> - **Only one line** required, with pure TypeScript type\r\n> - Enhance performance **30x** up\r\n> - Runtime validator is **20,000x faster** than `class-validator`\r\n> - JSON serialization is **200x faster** than `class-transformer`\r\n> - Software Development Kit\r\n> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://trpc.io/)\r\n> - Mockup simulator means embedded backend simulator in SDK\r\n> - similar with [msw](https://mswjs.io/), but fully automated"
38
+ "content": "# Software Development Kit\r\nThis is a SDK library generated by [`@nestia/migrate`](https://nestia.io/docs/migrate) or [`@nestia/editor`](https://nestia.io/docs/editor).\r\n\r\nWith this SDK library, you can easily and safely interact with backend server.\r\n\r\nJust import and call some API functions like gif image below:\r\n\r\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\r\n\r\n> Left is server code, and right is client code utilizing the SDK\r\n\r\n\r\n\r\n\r\n## How to Test\r\n```bash\r\nnpm install\r\nnpm start # run only \"test/start.ts\" file\r\nnpm run test # everything under the \"test/features\" directory\r\n```\r\n\r\nIf you run `npm start` command, only [test/start.ts](test/start.ts) file would be executed.\r\n\r\nOtherwise you run `npm run test` command instead, run everything in the [test/features](test/features) directory.\r\n\r\nFor reference, the [test/features](test/features) directory and E2E test functions (for each API endpoints) would be automatically composed only when you've configured the \"E2E test function generation mode\" of the `@nestia/migrate` (or `@nestia/editor`).\r\n\r\n```bash\r\nnpm install -g @nestia/migrate\r\nnpx @nestia/migrate\r\n? Migration mode (Use arrow keys):\r\n NestJS\r\n > SDK\r\n? Swagger file location: assets/input/clickhouse.json\r\n? Output directory path: assets/output/clickhouse-sdk-manual\r\n? Mokup Simulator: true\r\n? E2E Test Functions: true\r\n```\r\n\r\n\r\n\r\n\r\n## Deploy\r\n```bash\r\nnpm install\r\nnpm run deploy\r\n```\r\n\r\nJust run `npm run deploy` command, then your SDK library would be published.\r\n\r\nBy the way, the initial package name of this template repository is `@ORGANIZATION/PROJECT-api`. I think it would better to change the word to your own organization and project name. If you're utilizing `VsCode`, you can do it through `Edit > Replace in Files` (*Ctrl + Shift + H*) feature.\r\n\r\n-----------\r\n\r\n> ## What [`Nestia`](https://nestia.io) is:\r\n> ![Nestia Logo](https://nestia.io/logo.png)\r\n> \r\n> [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\r\n> [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n> [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n> [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\r\n> [![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\r\n> \r\n> Nestia is a set of helper libraries for NestJS, supporting below features:\r\n> \r\n> - `@nestia/core`: Super-fast decorators\r\n> - `@nestia/sdk`:\r\n> - Swagger generator evolved than ever\r\n> - SDK library generator for clients\r\n> - Mockup Simulator for client applications\r\n> - Automatic E2E test functions generator\r\n> - `@nestia/migrate`: Migration from Swagger to NestJS\r\n> - `@nestia/editor`: Online TypeScript Swagger Editor\r\n> - `nestia`: Just CLI (command line interface) tool\r\n> \r\n>> **Note**\r\n>> \r\n>> - **Only one line** required, with pure TypeScript type\r\n>> - Enhance performance **30x** up\r\n>> - Runtime validator is **20,000x faster** than `class-validator`\r\n>> - JSON serialization is **200x faster** than `class-transformer`\r\n>> - Software Development Kit\r\n>> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://> trpc.io/)\r\n>> - Mockup simulator means embedded backend simulator in SDK\r\n>> - similar with [msw](https://mswjs.io/), but fully automated"
39
39
  },
40
40
  {
41
41
  "location": "src",
@@ -67,6 +67,11 @@ exports.SDK_TEMPLATE = [
67
67
  "file": "index.ts",
68
68
  "content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport { ArgumentParser } from \"./utils/ArgumentParser\";\r\nimport { TestGlobal } from \"./TestGlobal\";\r\n\r\ninterface IOptions {\r\n simulate: boolean;\r\n include?: string[];\r\n exclude?: string[];\r\n trace: boolean;\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\r\n command.option(\"--simulate <boolean>\", \"Mockup Simultator\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n command.option(\"--trace <boolean>\", \"trace detailed errors\");\r\n\r\n return action(async (options) => {\r\n if (typeof options.simulate === \"string\")\r\n options.simulate = options.simulate === \"true\";\r\n options.simulate ??= await prompt.boolean(\"simulate\")(\"Mockup Simulator\");\r\n options.trace = options.trace !== (\"false\" as any);\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nconst main = async (): Promise<void> => {\r\n // DO TEST\r\n const options: IOptions = await getOptions();\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n parameters: () => [\r\n {\r\n ...TestGlobal.connection(),\r\n simulate: options.simulate,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n extension: __filename.substring(__filename.length - 2),\r\n })(__dirname + \"/features\");\r\n\r\n // REPORT EXCEPTIONS\r\n const exceptions: Error[] = report.executions\r\n .filter((exec) => exec.error !== null)\r\n .map((exec) => exec.error!);\r\n if (exceptions.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n if (options.trace !== false) for (const exp of exceptions) console.log(exp);\r\n console.log(\"Failed\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n }\r\n\r\n // TERMINATE\r\n if (exceptions.length) process.exit(-1);\r\n else process.exit(0);\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
69
69
  },
70
+ {
71
+ "location": "test",
72
+ "file": "start.ts",
73
+ "content": "import api from \"@ORGANIZATION/PROJECT-api\";\r\nimport { IBbsArticleComment } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticleComment\";\r\nimport typia from \"typia\";\r\nimport type { Format } from \"typia/lib/tags/Format\";\r\n\r\nimport { TestGlobal } from \"./TestGlobal\";\r\n\r\nconst main = async () => {\r\n const connection: api.IConnection = {\r\n ...TestGlobal.connection(),\r\n simulate: true,\r\n };\r\n const output: IBbsArticleComment =\r\n await api.functional.bbs.articles.comments.create(\r\n connection,\r\n typia.random<string & Format<\"uuid\">>(),\r\n typia.random<IBbsArticleComment.ICreate>(),\r\n );\r\n typia.assert(output);\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
74
+ },
70
75
  {
71
76
  "location": "test",
72
77
  "file": "TestGlobal.ts",
@@ -85,7 +90,7 @@ exports.SDK_TEMPLATE = [
85
90
  {
86
91
  "location": "",
87
92
  "file": "tsconfig.json",
88
- "content": "{\r\n \"compilerOptions\": {\r\n /* Visit https://aka.ms/tsconfig to read more about this file */\r\n /* Projects */\r\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\r\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\r\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\r\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\r\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\r\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\r\n /* Language and Environment */\r\n \"target\": \"ES5\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\r\n \"lib\": [\r\n \"DOM\",\r\n \"ES2015\"\r\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\r\n // \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\r\n // \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\r\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\r\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\r\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\r\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\r\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\r\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\r\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\r\n /* Modules */\r\n \"module\": \"commonjs\", /* Specify what module code is generated. */// \"rootDir\": \"./\", /* Specify the root folder within your source files. */\r\n // \"moduleResolution\": \"node\", /* Specify how TypeScript looks up a file from a given module specifier. */\r\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\r\n // \"paths\": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */\r\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\r\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\r\n // \"types\": [], /* Specify type package names to be included without being referenced in a source file. */\r\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\r\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\r\n // \"resolveJsonModule\": true, /* Enable importing .json files. */\r\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\r\n /* JavaScript Support */\r\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\r\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\r\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\r\n /* Emit */\r\n \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\r\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\r\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */// \"outFile\": \"./\", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */\r\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */// \"removeComments\": true, /* Disable emitting comments. */\r\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\r\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\r\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\r\n \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */// \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\r\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\r\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\r\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\r\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\r\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */// \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\r\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\r\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\r\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\r\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\r\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\r\n /* Interop Constraints */\r\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\r\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\r\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */// \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\r\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. *//* Type Checking */\r\n \"strict\": true, /* Enable all strict type-checking options. */// \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\r\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\r\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\r\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\r\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\r\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\r\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\r\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\r\n // \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\r\n // \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\r\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\r\n // \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\r\n // \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\r\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\r\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\r\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\r\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\r\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\r\n /* Completeness */\r\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\r\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\r\n \"plugins\": [\r\n {\r\n \"transform\": \"typia/lib/transform\"\r\n }\r\n ]\r\n },\r\n \"include\": [\"src\"],\r\n}"
93
+ "content": "{\r\n \"compilerOptions\": {\r\n /* Visit https://aka.ms/tsconfig to read more about this file */\r\n /* Projects */\r\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\r\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\r\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\r\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\r\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\r\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\r\n /* Language and Environment */\r\n \"target\": \"ES5\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\r\n \"lib\": [\r\n \"DOM\",\r\n \"ES2015\"\r\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\r\n // \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\r\n // \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\r\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\r\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\r\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\r\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\r\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\r\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\r\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\r\n /* Modules */\r\n \"module\": \"commonjs\", /* Specify what module code is generated. */// \"rootDir\": \"./\", /* Specify the root folder within your source files. */\r\n // \"moduleResolution\": \"node\", /* Specify how TypeScript looks up a file from a given module specifier. */\r\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\r\n \"paths\": {\r\n \"@ORGANIZATION/PROJECT-api\": [\"../src\"],\r\n \"@ORGANIZATION/PROJECT-api/lib/*\": [\"../src/*\"],\r\n }, /* Specify a set of entries that re-map imports to additional lookup locations. */\r\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\r\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\r\n // \"types\": [], /* Specify type package names to be included without being referenced in a source file. */\r\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\r\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\r\n // \"resolveJsonModule\": true, /* Enable importing .json files. */\r\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\r\n /* JavaScript Support */\r\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\r\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\r\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\r\n /* Emit */\r\n \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\r\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\r\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */// \"outFile\": \"./\", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */\r\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */// \"removeComments\": true, /* Disable emitting comments. */\r\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\r\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\r\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\r\n \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */// \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\r\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\r\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\r\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\r\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\r\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */// \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\r\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\r\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\r\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\r\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\r\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\r\n /* Interop Constraints */\r\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\r\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\r\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */// \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\r\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. *//* Type Checking */\r\n \"strict\": true, /* Enable all strict type-checking options. */// \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\r\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\r\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\r\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\r\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\r\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\r\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\r\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\r\n // \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\r\n // \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\r\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\r\n // \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\r\n // \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\r\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\r\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\r\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\r\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\r\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\r\n /* Completeness */\r\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\r\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\r\n \"plugins\": [\r\n { \"transform\": \"typia/lib/transform\" },\r\n { \"transform\": \"typescript-transform-paths\" },\r\n ],\r\n },\r\n \"include\": [\"src\"],\r\n}"
89
94
  }
90
95
  ];
91
96
  //# sourceMappingURL=SDK_TEMPLATE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SDK_TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/SDK_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,mFAAmF;KAC/F;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,oxBAAoxB;KAChyB;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,eAAe;QACvB,SAAS,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,CAAA"}
1
+ {"version":3,"file":"SDK_TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/SDK_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,mFAAmF;KAC/F;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,oxBAAoxB;KAChyB;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,sRAAsR;KAClS;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,inCAAinC;KAC7nC;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,ykDAAykD;KACrlD;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,+KAA+K;KAC3L;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,2tHAA2tH;KACvuH;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,oDAAoD;KAChE;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,2DAA2D;KACvE;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,kGAAkG;KAC9G;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,kIAAkI;KAC9I;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,yDAAyD;KACrE;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,i6EAAi6E;KAC76E;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,uxBAAuxB;KACnyB;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,uMAAuM;KACnN;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,odAAod;KAChe;IACD;QACE,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,mBAAmB;QAC3B,SAAS,EAAE,gtEAAgtE;KAC5tE;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,84WAA84W;KAC15W;CACF,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { IMigrateFile } from "../structures/IMigrateFile";
2
+ import { IMigrateProgram } from "../structures/IMigrateProgram";
3
+ export declare namespace MigrateApiStartProgrammer {
4
+ const write: (program: IMigrateProgram) => IMigrateFile;
5
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MigrateApiStartProgrammer = void 0;
7
+ const typescript_1 = __importDefault(require("typescript"));
8
+ const IdentifierFactory_1 = require("typia/lib/factories/IdentifierFactory");
9
+ const StatementFactory_1 = require("typia/lib/factories/StatementFactory");
10
+ const FilePrinter_1 = require("../utils/FilePrinter");
11
+ const MigrateE2eFileProgrammer_1 = require("./MigrateE2eFileProgrammer");
12
+ const MigrateImportProgrammer_1 = require("./MigrateImportProgrammer");
13
+ var MigrateApiStartProgrammer;
14
+ (function (MigrateApiStartProgrammer) {
15
+ MigrateApiStartProgrammer.write = (program) => {
16
+ const importer = new MigrateImportProgrammer_1.MigrateImportProgrammer();
17
+ const main = writeMain(program)(program.swagger)(importer)(pick(program.controllers.map((c) => c.routes).flat()));
18
+ const statements = [
19
+ ...importer.toStatements((name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`),
20
+ FilePrinter_1.FilePrinter.newLine(),
21
+ typescript_1.default.factory.createImportDeclaration(undefined, typescript_1.default.factory.createImportClause(false, undefined, typescript_1.default.factory.createNamedImports([
22
+ typescript_1.default.factory.createImportSpecifier(false, undefined, typescript_1.default.factory.createIdentifier("TestGlobal")),
23
+ ])), typescript_1.default.factory.createStringLiteral("./TestGlobal"), undefined),
24
+ FilePrinter_1.FilePrinter.newLine(),
25
+ main,
26
+ typescript_1.default.factory.createExpressionStatement(writeStarter()),
27
+ ];
28
+ return {
29
+ location: `test`,
30
+ file: "start.ts",
31
+ content: FilePrinter_1.FilePrinter.write({ statements }),
32
+ };
33
+ };
34
+ const writeMain = (config) => (swagger) => (importer) => (route) => StatementFactory_1.StatementFactory.constant("main", typescript_1.default.factory.createArrowFunction([typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.AsyncKeyword)], undefined, [], undefined, undefined, typescript_1.default.factory.createBlock([
35
+ writeConnection(config)(swagger)(importer),
36
+ ...MigrateE2eFileProgrammer_1.MigrateE2eFunctionProgrammer.writeBody(swagger.components)(importer)(route),
37
+ ], true)));
38
+ const writeConnection = (config) => (swagger) => (importer) => {
39
+ var _a, _b;
40
+ return typescript_1.default.factory.createVariableStatement(undefined, typescript_1.default.factory.createVariableDeclarationList([
41
+ typescript_1.default.factory.createVariableDeclaration("connection", undefined, typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createQualifiedName(typescript_1.default.factory.createIdentifier(importer.external({
42
+ type: "default",
43
+ library: "@ORGANIZATION/PROJECT-api",
44
+ name: "api",
45
+ })), typescript_1.default.factory.createIdentifier("IConnection"))), typescript_1.default.factory.createObjectLiteralExpression([
46
+ typescript_1.default.factory.createSpreadAssignment(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier("TestGlobal"), "connection"), undefined, undefined)),
47
+ ...(((_b = (_a = swagger.servers[0]) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.length)
48
+ ? [
49
+ typescript_1.default.factory.createPropertyAssignment("host", typescript_1.default.factory.createStringLiteral(swagger.servers[0].url)),
50
+ ]
51
+ : []),
52
+ ...(config.simulate === true
53
+ ? [
54
+ typescript_1.default.factory.createPropertyAssignment("simulate", typescript_1.default.factory.createTrue()),
55
+ ]
56
+ : []),
57
+ ], true)),
58
+ ], typescript_1.default.NodeFlags.Const));
59
+ };
60
+ const writeStarter = () => typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("main"), undefined, undefined), "catch"), undefined, [
61
+ typescript_1.default.factory.createArrowFunction(undefined, undefined, [IdentifierFactory_1.IdentifierFactory.parameter("exp")], undefined, undefined, typescript_1.default.factory.createBlock([
62
+ typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier("console"), "log"), undefined, [typescript_1.default.factory.createIdentifier("exp")])),
63
+ typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier("process"), "exit"), undefined, [
64
+ typescript_1.default.factory.createPrefixMinus(typescript_1.default.factory.createNumericLiteral("1")),
65
+ ])),
66
+ ], true)),
67
+ ]);
68
+ })(MigrateApiStartProgrammer || (exports.MigrateApiStartProgrammer = MigrateApiStartProgrammer = {}));
69
+ const pick = (array) => {
70
+ const rand = Math.random() * array.length;
71
+ const index = Math.min(array.length - 1, Math.floor(rand));
72
+ return array[index];
73
+ };
74
+ //# sourceMappingURL=MigrateApiStartProgrammer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MigrateApiStartProgrammer.js","sourceRoot":"","sources":["../../src/programmers/MigrateApiStartProgrammer.ts"],"names":[],"mappings":";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{ MigrateImportProgrammer } from "./MigrateImportProgrammer";
5
5
  export declare namespace MigrateE2eFunctionProgrammer {
6
6
  const write: (components: ISwaggerComponents) => (importer: MigrateImportProgrammer) => (route: IMigrateRoute) => ts.FunctionDeclaration;
7
+ const writeBody: (components: ISwaggerComponents) => (importer: MigrateImportProgrammer) => (route: IMigrateRoute) => ts.Statement[];
7
8
  }
@@ -18,8 +18,8 @@ var MigrateE2eFunctionProgrammer;
18
18
  library: "@ORGANIZATION/PROJECT-api",
19
19
  name: "api",
20
20
  })), typescript_1.default.factory.createIdentifier("IConnection")))),
21
- ], undefined, typescript_1.default.factory.createBlock(writeBody(components)(importer)(route), true));
22
- const writeBody = (components) => (importer) => (route) => [
21
+ ], undefined, typescript_1.default.factory.createBlock(MigrateE2eFunctionProgrammer.writeBody(components)(importer)(route), true));
22
+ MigrateE2eFunctionProgrammer.writeBody = (components) => (importer) => (route) => [
23
23
  typescript_1.default.factory.createVariableStatement([], typescript_1.default.factory.createVariableDeclarationList([
24
24
  typescript_1.default.factory.createVariableDeclaration("output", undefined, route.success
25
25
  ? MigrateSchemaProgrammer_1.MigrateSchemaProgrammer.write(components)(importer)(route.success.schema)
@@ -1 +1 @@
1
- {"version":3,"file":"MigrateE2eFileProgrammer.js","sourceRoot":"","sources":["../../src/programmers/MigrateE2eFileProgrammer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAC5B,6EAA0E;AAK1E,uEAAoE;AAEpE,IAAiB,4BAA4B,CA4G5C;AA5GD,WAAiB,4BAA4B;IAC9B,kCAAK,GAChB,CAAC,UAA8B,EAAE,EAAE,CACnC,CAAC,QAAiC,EAAE,EAAE,CACtC,CAAC,KAAoB,EAA0B,EAAE,CAC/C,oBAAE,CAAC,OAAO,CAAC,yBAAyB,CAClC;QACE,oBAAE,CAAC,OAAO,CAAC,cAAc,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC;QACtD,oBAAE,CAAC,OAAO,CAAC,cAAc,CAAC,oBAAE,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ev.20240217-3",
4
4
  "description": "Migration program from swagger to NestJS",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -5,6 +5,7 @@ import { NEST_TEMPLATE } from "./bundles/NEST_TEMPLATE";
5
5
  import { SDK_TEMPLATE } from "./bundles/SDK_TEMPLATE";
6
6
  import { IMigrateProgram } from "./module";
7
7
  import { MigrateApiProgrammer } from "./programmers/MigrateApiProgrammer";
8
+ import { MigrateApiStartProgrammer } from "./programmers/MigrateApiStartProgrammer";
8
9
  import { MigrateE2eProgrammer } from "./programmers/MigrateE2eProgrammer";
9
10
  import { MigrateNestProgrammer } from "./programmers/MigrateNestProgrammer";
10
11
  import { IMigrateFile } from "./structures/IMigrateFile";
@@ -49,6 +50,7 @@ export class MigrateApplication {
49
50
  files: [
50
51
  ...SDK_TEMPLATE,
51
52
  ...MigrateApiProgrammer.write(program),
53
+ MigrateApiStartProgrammer.write(program),
52
54
  ...(config.e2e ? MigrateE2eProgrammer.write(program) : []),
53
55
  ],
54
56
  };
@@ -22,7 +22,7 @@ export const SDK_TEMPLATE = [
22
22
  {
23
23
  "location": "",
24
24
  "file": "package.json",
25
- "content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"test\": \"npx ts-node test/index.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.1\",\r\n \"@types/inquirer\": \"8.2.5\",\r\n \"commander\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"prettier\": \"^3.2.5\",\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.1.2\",\r\n \"typescript\": \"^5.3.3\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.5.8\",\r\n \"typia\": \"^5.4.9\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm install && npm run test\"\r\n }\r\n}"
25
+ "content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"npx ts-node test/start.ts\",\r\n \"test\": \"npx ts-node test/index.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.1\",\r\n \"@types/inquirer\": \"8.2.5\",\r\n \"commander\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"prettier\": \"^3.2.5\",\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.1.2\",\r\n \"typescript\": \"^5.3.3\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.5.8\",\r\n \"typia\": \"^5.4.9\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm install && npm run test\"\r\n }\r\n}"
26
26
  },
27
27
  {
28
28
  "location": "",
@@ -32,7 +32,7 @@ export const SDK_TEMPLATE = [
32
32
  {
33
33
  "location": "",
34
34
  "file": "README.md",
35
- "content": "# SDK Library\r\nThis is a SDK library generated by [`nestia`](https://nestia.io).\r\n\r\nWith this SDK library, you can easily and safely interact with backend server.\r\n\r\nJust import and call some API functions like gif image below:\r\n\r\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\r\n\r\n> Left is server code, and right is client code utilizing the SDK\r\n\r\n\r\n\r\n\r\n# What [`Nestia`](https://nestia.io) is:\r\n![Nestia Logo](https://nestia.io/logo.png)\r\n\r\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\r\n[![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n[![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n[![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\r\n[![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\r\n\r\nNestia is a set of helper libraries for NestJS, supporting below features:\r\n\r\n - `@nestia/core`: super-fast decorators\r\n - `@nestia/sdk`:\r\n - Swagger generator evolved than ever\r\n - SDK library generator for clients\r\n - Mockup Simulator for client applications\r\n - Automatic E2E test functions generator\r\n - `@nestia/migrate`: migration from Swagger to NestJS\r\n - `nestia`: just CLI (command line interface) tool\r\n\r\n> **Note**\r\n> \r\n> - **Only one line** required, with pure TypeScript type\r\n> - Enhance performance **30x** up\r\n> - Runtime validator is **20,000x faster** than `class-validator`\r\n> - JSON serialization is **200x faster** than `class-transformer`\r\n> - Software Development Kit\r\n> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://trpc.io/)\r\n> - Mockup simulator means embedded backend simulator in SDK\r\n> - similar with [msw](https://mswjs.io/), but fully automated"
35
+ "content": "# Software Development Kit\r\nThis is a SDK library generated by [`@nestia/migrate`](https://nestia.io/docs/migrate) or [`@nestia/editor`](https://nestia.io/docs/editor).\r\n\r\nWith this SDK library, you can easily and safely interact with backend server.\r\n\r\nJust import and call some API functions like gif image below:\r\n\r\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\r\n\r\n> Left is server code, and right is client code utilizing the SDK\r\n\r\n\r\n\r\n\r\n## How to Test\r\n```bash\r\nnpm install\r\nnpm start # run only \"test/start.ts\" file\r\nnpm run test # everything under the \"test/features\" directory\r\n```\r\n\r\nIf you run `npm start` command, only [test/start.ts](test/start.ts) file would be executed.\r\n\r\nOtherwise you run `npm run test` command instead, run everything in the [test/features](test/features) directory.\r\n\r\nFor reference, the [test/features](test/features) directory and E2E test functions (for each API endpoints) would be automatically composed only when you've configured the \"E2E test function generation mode\" of the `@nestia/migrate` (or `@nestia/editor`).\r\n\r\n```bash\r\nnpm install -g @nestia/migrate\r\nnpx @nestia/migrate\r\n? Migration mode (Use arrow keys):\r\n NestJS\r\n > SDK\r\n? Swagger file location: assets/input/clickhouse.json\r\n? Output directory path: assets/output/clickhouse-sdk-manual\r\n? Mokup Simulator: true\r\n? E2E Test Functions: true\r\n```\r\n\r\n\r\n\r\n\r\n## Deploy\r\n```bash\r\nnpm install\r\nnpm run deploy\r\n```\r\n\r\nJust run `npm run deploy` command, then your SDK library would be published.\r\n\r\nBy the way, the initial package name of this template repository is `@ORGANIZATION/PROJECT-api`. I think it would better to change the word to your own organization and project name. If you're utilizing `VsCode`, you can do it through `Edit > Replace in Files` (*Ctrl + Shift + H*) feature.\r\n\r\n-----------\r\n\r\n> ## What [`Nestia`](https://nestia.io) is:\r\n> ![Nestia Logo](https://nestia.io/logo.png)\r\n> \r\n> [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\r\n> [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n> [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\r\n> [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\r\n> [![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\r\n> \r\n> Nestia is a set of helper libraries for NestJS, supporting below features:\r\n> \r\n> - `@nestia/core`: Super-fast decorators\r\n> - `@nestia/sdk`:\r\n> - Swagger generator evolved than ever\r\n> - SDK library generator for clients\r\n> - Mockup Simulator for client applications\r\n> - Automatic E2E test functions generator\r\n> - `@nestia/migrate`: Migration from Swagger to NestJS\r\n> - `@nestia/editor`: Online TypeScript Swagger Editor\r\n> - `nestia`: Just CLI (command line interface) tool\r\n> \r\n>> **Note**\r\n>> \r\n>> - **Only one line** required, with pure TypeScript type\r\n>> - Enhance performance **30x** up\r\n>> - Runtime validator is **20,000x faster** than `class-validator`\r\n>> - JSON serialization is **200x faster** than `class-transformer`\r\n>> - Software Development Kit\r\n>> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://> trpc.io/)\r\n>> - Mockup simulator means embedded backend simulator in SDK\r\n>> - similar with [msw](https://mswjs.io/), but fully automated"
36
36
  },
37
37
  {
38
38
  "location": "src",
@@ -64,6 +64,11 @@ export const SDK_TEMPLATE = [
64
64
  "file": "index.ts",
65
65
  "content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport { ArgumentParser } from \"./utils/ArgumentParser\";\r\nimport { TestGlobal } from \"./TestGlobal\";\r\n\r\ninterface IOptions {\r\n simulate: boolean;\r\n include?: string[];\r\n exclude?: string[];\r\n trace: boolean;\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\r\n command.option(\"--simulate <boolean>\", \"Mockup Simultator\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n command.option(\"--trace <boolean>\", \"trace detailed errors\");\r\n\r\n return action(async (options) => {\r\n if (typeof options.simulate === \"string\")\r\n options.simulate = options.simulate === \"true\";\r\n options.simulate ??= await prompt.boolean(\"simulate\")(\"Mockup Simulator\");\r\n options.trace = options.trace !== (\"false\" as any);\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nconst main = async (): Promise<void> => {\r\n // DO TEST\r\n const options: IOptions = await getOptions();\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n parameters: () => [\r\n {\r\n ...TestGlobal.connection(),\r\n simulate: options.simulate,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n extension: __filename.substring(__filename.length - 2),\r\n })(__dirname + \"/features\");\r\n\r\n // REPORT EXCEPTIONS\r\n const exceptions: Error[] = report.executions\r\n .filter((exec) => exec.error !== null)\r\n .map((exec) => exec.error!);\r\n if (exceptions.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n if (options.trace !== false) for (const exp of exceptions) console.log(exp);\r\n console.log(\"Failed\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n }\r\n\r\n // TERMINATE\r\n if (exceptions.length) process.exit(-1);\r\n else process.exit(0);\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
66
66
  },
67
+ {
68
+ "location": "test",
69
+ "file": "start.ts",
70
+ "content": "import api from \"@ORGANIZATION/PROJECT-api\";\r\nimport { IBbsArticleComment } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticleComment\";\r\nimport typia from \"typia\";\r\nimport type { Format } from \"typia/lib/tags/Format\";\r\n\r\nimport { TestGlobal } from \"./TestGlobal\";\r\n\r\nconst main = async () => {\r\n const connection: api.IConnection = {\r\n ...TestGlobal.connection(),\r\n simulate: true,\r\n };\r\n const output: IBbsArticleComment =\r\n await api.functional.bbs.articles.comments.create(\r\n connection,\r\n typia.random<string & Format<\"uuid\">>(),\r\n typia.random<IBbsArticleComment.ICreate>(),\r\n );\r\n typia.assert(output);\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
71
+ },
67
72
  {
68
73
  "location": "test",
69
74
  "file": "TestGlobal.ts",
@@ -82,6 +87,6 @@ export const SDK_TEMPLATE = [
82
87
  {
83
88
  "location": "",
84
89
  "file": "tsconfig.json",
85
- "content": "{\r\n \"compilerOptions\": {\r\n /* Visit https://aka.ms/tsconfig to read more about this file */\r\n /* Projects */\r\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\r\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\r\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\r\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\r\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\r\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\r\n /* Language and Environment */\r\n \"target\": \"ES5\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\r\n \"lib\": [\r\n \"DOM\",\r\n \"ES2015\"\r\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\r\n // \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\r\n // \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\r\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\r\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\r\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\r\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\r\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\r\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\r\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\r\n /* Modules */\r\n \"module\": \"commonjs\", /* Specify what module code is generated. */// \"rootDir\": \"./\", /* Specify the root folder within your source files. */\r\n // \"moduleResolution\": \"node\", /* Specify how TypeScript looks up a file from a given module specifier. */\r\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\r\n // \"paths\": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */\r\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\r\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\r\n // \"types\": [], /* Specify type package names to be included without being referenced in a source file. */\r\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\r\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\r\n // \"resolveJsonModule\": true, /* Enable importing .json files. */\r\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\r\n /* JavaScript Support */\r\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\r\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\r\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\r\n /* Emit */\r\n \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\r\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\r\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */// \"outFile\": \"./\", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */\r\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */// \"removeComments\": true, /* Disable emitting comments. */\r\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\r\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\r\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\r\n \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */// \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\r\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\r\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\r\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\r\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\r\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */// \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\r\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\r\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\r\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\r\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\r\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\r\n /* Interop Constraints */\r\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\r\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\r\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */// \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\r\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. *//* Type Checking */\r\n \"strict\": true, /* Enable all strict type-checking options. */// \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\r\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\r\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\r\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\r\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\r\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\r\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\r\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\r\n // \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\r\n // \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\r\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\r\n // \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\r\n // \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\r\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\r\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\r\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\r\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\r\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\r\n /* Completeness */\r\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\r\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\r\n \"plugins\": [\r\n {\r\n \"transform\": \"typia/lib/transform\"\r\n }\r\n ]\r\n },\r\n \"include\": [\"src\"],\r\n}"
90
+ "content": "{\r\n \"compilerOptions\": {\r\n /* Visit https://aka.ms/tsconfig to read more about this file */\r\n /* Projects */\r\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\r\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\r\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\r\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\r\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\r\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\r\n /* Language and Environment */\r\n \"target\": \"ES5\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\r\n \"lib\": [\r\n \"DOM\",\r\n \"ES2015\"\r\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\r\n // \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\r\n // \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\r\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\r\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\r\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\r\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\r\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\r\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\r\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\r\n /* Modules */\r\n \"module\": \"commonjs\", /* Specify what module code is generated. */// \"rootDir\": \"./\", /* Specify the root folder within your source files. */\r\n // \"moduleResolution\": \"node\", /* Specify how TypeScript looks up a file from a given module specifier. */\r\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\r\n \"paths\": {\r\n \"@ORGANIZATION/PROJECT-api\": [\"../src\"],\r\n \"@ORGANIZATION/PROJECT-api/lib/*\": [\"../src/*\"],\r\n }, /* Specify a set of entries that re-map imports to additional lookup locations. */\r\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\r\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\r\n // \"types\": [], /* Specify type package names to be included without being referenced in a source file. */\r\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\r\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\r\n // \"resolveJsonModule\": true, /* Enable importing .json files. */\r\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\r\n /* JavaScript Support */\r\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\r\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\r\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\r\n /* Emit */\r\n \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\r\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\r\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */// \"outFile\": \"./\", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */\r\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */// \"removeComments\": true, /* Disable emitting comments. */\r\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\r\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\r\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\r\n \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */// \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\r\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\r\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\r\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\r\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\r\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */// \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\r\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\r\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\r\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\r\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\r\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\r\n /* Interop Constraints */\r\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\r\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\r\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */// \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\r\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. *//* Type Checking */\r\n \"strict\": true, /* Enable all strict type-checking options. */// \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\r\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\r\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\r\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\r\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\r\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\r\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\r\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\r\n // \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\r\n // \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\r\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\r\n // \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\r\n // \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\r\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\r\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\r\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\r\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\r\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\r\n /* Completeness */\r\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\r\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\r\n \"plugins\": [\r\n { \"transform\": \"typia/lib/transform\" },\r\n { \"transform\": \"typescript-transform-paths\" },\r\n ],\r\n },\r\n \"include\": [\"src\"],\r\n}"
86
91
  }
87
92
  ]
@@ -0,0 +1,194 @@
1
+ import ts from "typescript";
2
+ import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
3
+ import { StatementFactory } from "typia/lib/factories/StatementFactory";
4
+
5
+ import { IMigrateFile } from "../structures/IMigrateFile";
6
+ import { IMigrateProgram } from "../structures/IMigrateProgram";
7
+ import { IMigrateRoute } from "../structures/IMigrateRoute";
8
+ import { ISwagger } from "../structures/ISwagger";
9
+ import { FilePrinter } from "../utils/FilePrinter";
10
+ import { MigrateE2eFunctionProgrammer } from "./MigrateE2eFileProgrammer";
11
+ import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
12
+
13
+ export namespace MigrateApiStartProgrammer {
14
+ export const write = (program: IMigrateProgram): IMigrateFile => {
15
+ const importer: MigrateImportProgrammer = new MigrateImportProgrammer();
16
+ const main: ts.VariableStatement = writeMain(program)(program.swagger)(
17
+ importer,
18
+ )(pick(program.controllers.map((c) => c.routes).flat()));
19
+ const statements: ts.Statement[] = [
20
+ ...importer.toStatements(
21
+ (name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`,
22
+ ),
23
+ FilePrinter.newLine(),
24
+ ts.factory.createImportDeclaration(
25
+ undefined,
26
+ ts.factory.createImportClause(
27
+ false,
28
+ undefined,
29
+ ts.factory.createNamedImports([
30
+ ts.factory.createImportSpecifier(
31
+ false,
32
+ undefined,
33
+ ts.factory.createIdentifier("TestGlobal"),
34
+ ),
35
+ ]),
36
+ ),
37
+ ts.factory.createStringLiteral("./TestGlobal"),
38
+ undefined,
39
+ ),
40
+ FilePrinter.newLine(),
41
+ main,
42
+ ts.factory.createExpressionStatement(writeStarter()),
43
+ ];
44
+ return {
45
+ location: `test`,
46
+ file: "start.ts",
47
+ content: FilePrinter.write({ statements }),
48
+ };
49
+ };
50
+
51
+ const writeMain =
52
+ (config: IMigrateProgram.IConfig) =>
53
+ (swagger: ISwagger) =>
54
+ (importer: MigrateImportProgrammer) =>
55
+ (route: IMigrateRoute): ts.VariableStatement =>
56
+ StatementFactory.constant(
57
+ "main",
58
+ ts.factory.createArrowFunction(
59
+ [ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)],
60
+ undefined,
61
+ [],
62
+ undefined,
63
+ undefined,
64
+ ts.factory.createBlock(
65
+ [
66
+ writeConnection(config)(swagger)(importer),
67
+ ...MigrateE2eFunctionProgrammer.writeBody(swagger.components)(
68
+ importer,
69
+ )(route),
70
+ ],
71
+ true,
72
+ ),
73
+ ),
74
+ );
75
+
76
+ const writeConnection =
77
+ (config: IMigrateProgram.IConfig) =>
78
+ (swagger: ISwagger) =>
79
+ (importer: MigrateImportProgrammer): ts.VariableStatement =>
80
+ ts.factory.createVariableStatement(
81
+ undefined,
82
+ ts.factory.createVariableDeclarationList(
83
+ [
84
+ ts.factory.createVariableDeclaration(
85
+ "connection",
86
+ undefined,
87
+ ts.factory.createTypeReferenceNode(
88
+ ts.factory.createQualifiedName(
89
+ ts.factory.createIdentifier(
90
+ importer.external({
91
+ type: "default",
92
+ library: "@ORGANIZATION/PROJECT-api",
93
+ name: "api",
94
+ }),
95
+ ),
96
+ ts.factory.createIdentifier("IConnection"),
97
+ ),
98
+ ),
99
+ ts.factory.createObjectLiteralExpression(
100
+ [
101
+ ts.factory.createSpreadAssignment(
102
+ ts.factory.createCallExpression(
103
+ ts.factory.createPropertyAccessExpression(
104
+ ts.factory.createIdentifier("TestGlobal"),
105
+ "connection",
106
+ ),
107
+ undefined,
108
+ undefined,
109
+ ),
110
+ ),
111
+ ...(swagger.servers[0]?.url?.length
112
+ ? [
113
+ ts.factory.createPropertyAssignment(
114
+ "host",
115
+ ts.factory.createStringLiteral(
116
+ swagger.servers[0].url,
117
+ ),
118
+ ),
119
+ ]
120
+ : []),
121
+ ...(config.simulate === true
122
+ ? [
123
+ ts.factory.createPropertyAssignment(
124
+ "simulate",
125
+ ts.factory.createTrue(),
126
+ ),
127
+ ]
128
+ : []),
129
+ ],
130
+ true,
131
+ ),
132
+ ),
133
+ ],
134
+ ts.NodeFlags.Const,
135
+ ),
136
+ );
137
+
138
+ const writeStarter = (): ts.CallExpression =>
139
+ ts.factory.createCallExpression(
140
+ ts.factory.createPropertyAccessExpression(
141
+ ts.factory.createCallExpression(
142
+ ts.factory.createIdentifier("main"),
143
+ undefined,
144
+ undefined,
145
+ ),
146
+ "catch",
147
+ ),
148
+ undefined,
149
+ [
150
+ ts.factory.createArrowFunction(
151
+ undefined,
152
+ undefined,
153
+ [IdentifierFactory.parameter("exp")],
154
+ undefined,
155
+ undefined,
156
+ ts.factory.createBlock(
157
+ [
158
+ ts.factory.createExpressionStatement(
159
+ ts.factory.createCallExpression(
160
+ ts.factory.createPropertyAccessExpression(
161
+ ts.factory.createIdentifier("console"),
162
+ "log",
163
+ ),
164
+ undefined,
165
+ [ts.factory.createIdentifier("exp")],
166
+ ),
167
+ ),
168
+ ts.factory.createExpressionStatement(
169
+ ts.factory.createCallExpression(
170
+ ts.factory.createPropertyAccessExpression(
171
+ ts.factory.createIdentifier("process"),
172
+ "exit",
173
+ ),
174
+ undefined,
175
+ [
176
+ ts.factory.createPrefixMinus(
177
+ ts.factory.createNumericLiteral("1"),
178
+ ),
179
+ ],
180
+ ),
181
+ ),
182
+ ],
183
+ true,
184
+ ),
185
+ ),
186
+ ],
187
+ );
188
+ }
189
+
190
+ const pick = <T>(array: T[]): T => {
191
+ const rand: number = Math.random() * array.length;
192
+ const index: number = Math.min(array.length - 1, Math.floor(rand));
193
+ return array[index];
194
+ };
@@ -40,7 +40,7 @@ export namespace MigrateE2eFunctionProgrammer {
40
40
  ts.factory.createBlock(writeBody(components)(importer)(route), true),
41
41
  );
42
42
 
43
- const writeBody =
43
+ export const writeBody =
44
44
  (components: ISwaggerComponents) =>
45
45
  (importer: MigrateImportProgrammer) =>
46
46
  (route: IMigrateRoute): ts.Statement[] => [