@nestia/sdk 0.1.0

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.
Files changed (138) hide show
  1. package/assets/bundle/HttpError.ts +1 -0
  2. package/assets/bundle/IConnection.ts +1 -0
  3. package/assets/bundle/Primitive.ts +1 -0
  4. package/assets/config/nestia.config.ts +70 -0
  5. package/lib/INestiaConfig.d.ts +110 -0
  6. package/lib/INestiaConfig.js +3 -0
  7. package/lib/INestiaConfig.js.map +1 -0
  8. package/lib/NestiaSdkApplication.d.ts +11 -0
  9. package/lib/NestiaSdkApplication.js +156 -0
  10. package/lib/NestiaSdkApplication.js.map +1 -0
  11. package/lib/analyses/ControllerAnalyzer.d.ts +6 -0
  12. package/lib/analyses/ControllerAnalyzer.js +106 -0
  13. package/lib/analyses/ControllerAnalyzer.js.map +1 -0
  14. package/lib/analyses/GenericAnalyzer.d.ts +5 -0
  15. package/lib/analyses/GenericAnalyzer.js +41 -0
  16. package/lib/analyses/GenericAnalyzer.js.map +1 -0
  17. package/lib/analyses/ImportAnalyzer.d.ts +13 -0
  18. package/lib/analyses/ImportAnalyzer.js +86 -0
  19. package/lib/analyses/ImportAnalyzer.js.map +1 -0
  20. package/lib/analyses/PathAnalyzer.d.ts +5 -0
  21. package/lib/analyses/PathAnalyzer.js +51 -0
  22. package/lib/analyses/PathAnalyzer.js.map +1 -0
  23. package/lib/analyses/ReflectAnalyzer.d.ts +4 -0
  24. package/lib/analyses/ReflectAnalyzer.js +231 -0
  25. package/lib/analyses/ReflectAnalyzer.js.map +1 -0
  26. package/lib/analyses/SourceFinder.d.ts +4 -0
  27. package/lib/analyses/SourceFinder.js +71 -0
  28. package/lib/analyses/SourceFinder.js.map +1 -0
  29. package/lib/executable/internal/CommandParser.d.ts +3 -0
  30. package/lib/executable/internal/CommandParser.js +21 -0
  31. package/lib/executable/internal/CommandParser.js.map +1 -0
  32. package/lib/executable/internal/NestiaConfigCompilerOptions.d.ts +11 -0
  33. package/lib/executable/internal/NestiaConfigCompilerOptions.js +18 -0
  34. package/lib/executable/internal/NestiaConfigCompilerOptions.js.map +1 -0
  35. package/lib/executable/internal/NestiaSdkCommand.d.ts +4 -0
  36. package/lib/executable/internal/NestiaSdkCommand.js +128 -0
  37. package/lib/executable/internal/NestiaSdkCommand.js.map +1 -0
  38. package/lib/executable/internal/NestiaSdkConfig.d.ts +4 -0
  39. package/lib/executable/internal/NestiaSdkConfig.js +539 -0
  40. package/lib/executable/internal/NestiaSdkConfig.js.map +1 -0
  41. package/lib/executable/internal/nestia.config.getter.d.ts +1 -0
  42. package/lib/executable/internal/nestia.config.getter.js +24 -0
  43. package/lib/executable/internal/nestia.config.getter.js.map +1 -0
  44. package/lib/executable/sdk.d.ts +2 -0
  45. package/lib/executable/sdk.js +86 -0
  46. package/lib/executable/sdk.js.map +1 -0
  47. package/lib/generates/FileGenerator.d.ts +5 -0
  48. package/lib/generates/FileGenerator.js +138 -0
  49. package/lib/generates/FileGenerator.js.map +1 -0
  50. package/lib/generates/FunctionGenerator.d.ts +5 -0
  51. package/lib/generates/FunctionGenerator.js +204 -0
  52. package/lib/generates/FunctionGenerator.js.map +1 -0
  53. package/lib/generates/SdkGenerator.d.ts +7 -0
  54. package/lib/generates/SdkGenerator.js +45 -0
  55. package/lib/generates/SdkGenerator.js.map +1 -0
  56. package/lib/generates/SwaggerGenerator.d.ts +6 -0
  57. package/lib/generates/SwaggerGenerator.js +244 -0
  58. package/lib/generates/SwaggerGenerator.js.map +1 -0
  59. package/lib/index.d.ts +2 -0
  60. package/lib/index.js +28 -0
  61. package/lib/index.js.map +1 -0
  62. package/lib/module.d.ts +2 -0
  63. package/lib/module.js +19 -0
  64. package/lib/module.js.map +1 -0
  65. package/lib/structures/IController.d.ts +23 -0
  66. package/lib/structures/IController.js +3 -0
  67. package/lib/structures/IController.js.map +1 -0
  68. package/lib/structures/IRoute.d.ts +24 -0
  69. package/lib/structures/IRoute.js +3 -0
  70. package/lib/structures/IRoute.js.map +1 -0
  71. package/lib/structures/ISwagger.d.ts +48 -0
  72. package/lib/structures/ISwagger.js +3 -0
  73. package/lib/structures/ISwagger.js.map +1 -0
  74. package/lib/structures/ITypeTuple.d.ts +5 -0
  75. package/lib/structures/ITypeTuple.js +3 -0
  76. package/lib/structures/ITypeTuple.js.map +1 -0
  77. package/lib/structures/MethodType.d.ts +4 -0
  78. package/lib/structures/MethodType.js +14 -0
  79. package/lib/structures/MethodType.js.map +1 -0
  80. package/lib/structures/ParamCategory.d.ts +1 -0
  81. package/lib/structures/ParamCategory.js +3 -0
  82. package/lib/structures/ParamCategory.js.map +1 -0
  83. package/lib/structures/TypeEntry.d.ts +9 -0
  84. package/lib/structures/TypeEntry.js +21 -0
  85. package/lib/structures/TypeEntry.js.map +1 -0
  86. package/lib/test/TestBuilder.d.ts +4 -0
  87. package/lib/test/TestBuilder.js +64 -0
  88. package/lib/test/TestBuilder.js.map +1 -0
  89. package/lib/test/index.d.ts +1 -0
  90. package/lib/test/index.js +61 -0
  91. package/lib/test/index.js.map +1 -0
  92. package/lib/test/test.builder.executor.d.ts +1 -0
  93. package/lib/test/test.builder.executor.js +24 -0
  94. package/lib/test/test.builder.executor.js.map +1 -0
  95. package/lib/utils/ArrayUtil.d.ts +5 -0
  96. package/lib/utils/ArrayUtil.js +39 -0
  97. package/lib/utils/ArrayUtil.js.map +1 -0
  98. package/lib/utils/ImportDictionary.d.ts +6 -0
  99. package/lib/utils/ImportDictionary.js +50 -0
  100. package/lib/utils/ImportDictionary.js.map +1 -0
  101. package/lib/utils/MapUtil.d.ts +3 -0
  102. package/lib/utils/MapUtil.js +16 -0
  103. package/lib/utils/MapUtil.js.map +1 -0
  104. package/lib/utils/StripEnums.d.ts +3 -0
  105. package/lib/utils/StripEnums.js +3 -0
  106. package/lib/utils/StripEnums.js.map +1 -0
  107. package/package.json +74 -0
  108. package/src/INestiaConfig.ts +120 -0
  109. package/src/NestiaSdkApplication.ts +183 -0
  110. package/src/analyses/ControllerAnalyzer.ts +203 -0
  111. package/src/analyses/GenericAnalyzer.ts +53 -0
  112. package/src/analyses/ImportAnalyzer.ts +143 -0
  113. package/src/analyses/PathAnalyzer.ts +58 -0
  114. package/src/analyses/ReflectAnalyzer.ts +279 -0
  115. package/src/analyses/SourceFinder.ts +59 -0
  116. package/src/executable/internal/CommandParser.ts +15 -0
  117. package/src/executable/internal/NestiaConfigCompilerOptions.ts +18 -0
  118. package/src/executable/internal/NestiaSdkCommand.ts +174 -0
  119. package/src/executable/internal/NestiaSdkConfig.ts +35 -0
  120. package/src/executable/internal/nestia.config.getter.ts +12 -0
  121. package/src/executable/sdk.ts +51 -0
  122. package/src/generates/FileGenerator.ts +156 -0
  123. package/src/generates/FunctionGenerator.ts +287 -0
  124. package/src/generates/SdkGenerator.ts +50 -0
  125. package/src/generates/SwaggerGenerator.ts +393 -0
  126. package/src/index.ts +3 -0
  127. package/src/module.ts +2 -0
  128. package/src/structures/IController.ts +27 -0
  129. package/src/structures/IRoute.ts +29 -0
  130. package/src/structures/ISwagger.ts +55 -0
  131. package/src/structures/ITypeTuple.ts +6 -0
  132. package/src/structures/MethodType.ts +11 -0
  133. package/src/structures/ParamCategory.ts +1 -0
  134. package/src/structures/TypeEntry.ts +22 -0
  135. package/src/utils/ArrayUtil.ts +26 -0
  136. package/src/utils/ImportDictionary.ts +56 -0
  137. package/src/utils/MapUtil.ts +14 -0
  138. package/src/utils/StripEnums.ts +10 -0
@@ -0,0 +1,203 @@
1
+ import { HashMap } from "tstl/container/HashMap";
2
+ import ts from "typescript";
3
+
4
+ import { IController } from "../structures/IController";
5
+ import { IRoute } from "../structures/IRoute";
6
+ import { ITypeTuple } from "../structures/ITypeTuple";
7
+ import { GenericAnalyzer } from "./GenericAnalyzer";
8
+ import { ImportAnalyzer } from "./ImportAnalyzer";
9
+ import { PathAnalyzer } from "./PathAnalyzer";
10
+
11
+ export namespace ControllerAnalyzer {
12
+ export function analyze(
13
+ checker: ts.TypeChecker,
14
+ sourceFile: ts.SourceFile,
15
+ controller: IController,
16
+ ): IRoute[] {
17
+ // FIND CONTROLLER CLASS
18
+ const ret: IRoute[] = [];
19
+ ts.forEachChild(sourceFile, (node) => {
20
+ if (
21
+ ts.isClassDeclaration(node) &&
22
+ node.name?.escapedText === controller.name
23
+ ) {
24
+ // ANALYZE THE CONTROLLER
25
+ ret.push(..._Analyze_controller(checker, controller, node));
26
+ return;
27
+ }
28
+ });
29
+ return ret;
30
+ }
31
+
32
+ /* ---------------------------------------------------------
33
+ CLASS
34
+ --------------------------------------------------------- */
35
+ function _Analyze_controller(
36
+ checker: ts.TypeChecker,
37
+ controller: IController,
38
+ classNode: ts.ClassDeclaration,
39
+ ): IRoute[] {
40
+ const classType: ts.InterfaceType = checker.getTypeAtLocation(
41
+ classNode,
42
+ ) as ts.InterfaceType;
43
+ const genericDict: GenericAnalyzer.Dictionary = GenericAnalyzer.analyze(
44
+ checker,
45
+ classNode,
46
+ );
47
+
48
+ const ret: IRoute[] = [];
49
+ for (const property of classType.getProperties()) {
50
+ // GET METHOD DECLARATION
51
+ const declaration: ts.Declaration | undefined =
52
+ (property.declarations || [])[0];
53
+ if (!declaration || !ts.isMethodDeclaration(declaration)) continue;
54
+
55
+ // IDENTIFIER MUST BE
56
+ const identifier = declaration.name;
57
+ if (!ts.isIdentifier(identifier)) continue;
58
+
59
+ // ANALYZED WITH THE REFLECTED-FUNCTION
60
+ const runtime: IController.IFunction | undefined =
61
+ controller.functions.find(
62
+ (f) => f.name === identifier.escapedText,
63
+ );
64
+ if (runtime === undefined) continue;
65
+
66
+ const routes: IRoute[] = _Analyze_function(
67
+ checker,
68
+ controller,
69
+ genericDict,
70
+ runtime,
71
+ property,
72
+ );
73
+ ret.push(...routes);
74
+ }
75
+ return ret;
76
+ }
77
+
78
+ /* ---------------------------------------------------------
79
+ FUNCTION
80
+ --------------------------------------------------------- */
81
+ function _Analyze_function(
82
+ checker: ts.TypeChecker,
83
+ controller: IController,
84
+ genericDict: GenericAnalyzer.Dictionary,
85
+ func: IController.IFunction,
86
+ symbol: ts.Symbol,
87
+ ): IRoute[] {
88
+ // PREPARE ASSETS
89
+ const type: ts.Type = checker.getTypeOfSymbolAtLocation(
90
+ symbol,
91
+ symbol.valueDeclaration!,
92
+ );
93
+ const signature: ts.Signature | undefined = checker.getSignaturesOfType(
94
+ type,
95
+ ts.SignatureKind.Call,
96
+ )[0];
97
+
98
+ if (signature === undefined)
99
+ throw new Error(
100
+ `Error on ControllerAnalyzer.analyze(): unable to get the signature from the ${controller.name}.${func.name}().`,
101
+ );
102
+
103
+ const importDict: ImportAnalyzer.Dictionary = new HashMap();
104
+
105
+ // EXPLORE CHILDREN TYPES
106
+ const parameters: IRoute.IParameter[] = func.parameters.map((param) =>
107
+ _Analyze_parameter(
108
+ checker,
109
+ genericDict,
110
+ importDict,
111
+ controller,
112
+ func.name,
113
+ param,
114
+ signature.getParameters()[param.index],
115
+ ),
116
+ );
117
+ const output: ITypeTuple = ImportAnalyzer.analyze(
118
+ checker,
119
+ genericDict,
120
+ importDict,
121
+ signature.getReturnType(),
122
+ );
123
+ const imports: [string, string[]][] = importDict
124
+ .toJSON()
125
+ .map((pair) => [pair.first, pair.second.toJSON()]);
126
+
127
+ // CONSTRUCT COMMON DATA
128
+ const common: Omit<IRoute, "path"> = {
129
+ ...func,
130
+ parameters,
131
+ output,
132
+ imports,
133
+
134
+ symbol: `${controller.name}.${func.name}()`,
135
+ comments: signature.getDocumentationComment(undefined),
136
+ tags: signature.getJsDocTags(),
137
+ };
138
+
139
+ // CONFIGURE PATHS
140
+ const pathList: string[] = [];
141
+ for (const controllerPath of controller.paths)
142
+ for (const filePath of func.paths) {
143
+ const path: string = PathAnalyzer.join(
144
+ controllerPath,
145
+ filePath,
146
+ );
147
+ pathList.push(
148
+ PathAnalyzer.espace(
149
+ path,
150
+ () => "ControllerAnalyzer.analyze()",
151
+ ),
152
+ );
153
+ }
154
+
155
+ // RETURNS
156
+ return pathList.map((path) => ({
157
+ ...common,
158
+ path,
159
+ }));
160
+ }
161
+
162
+ /* ---------------------------------------------------------
163
+ PARAMETER
164
+ --------------------------------------------------------- */
165
+ function _Analyze_parameter(
166
+ checker: ts.TypeChecker,
167
+ genericDict: GenericAnalyzer.Dictionary,
168
+ importDict: ImportAnalyzer.Dictionary,
169
+ controller: IController,
170
+ funcName: string,
171
+ param: IController.IParameter,
172
+ symbol: ts.Symbol,
173
+ ): IRoute.IParameter {
174
+ const type: ts.Type = checker.getTypeOfSymbolAtLocation(
175
+ symbol,
176
+ symbol.valueDeclaration!,
177
+ );
178
+ const name: string = symbol.getEscapedName().toString();
179
+
180
+ // DO NOT SUPPORT BODY PARAMETER
181
+ if (param.category === "body" && param.field !== undefined) {
182
+ const method: string = `${controller.name}.${funcName}()`;
183
+ throw new Error(
184
+ `Error on ${method}: nestia does not support body field specification. ` +
185
+ `Therefore, erase the ${method}#${name} parameter and ` +
186
+ `re-define a new body decorator accepting full structured message.`,
187
+ );
188
+ }
189
+
190
+ return {
191
+ name,
192
+ category: param.category,
193
+ field: param.field,
194
+ encrypted: param.encrypted,
195
+ type: ImportAnalyzer.analyze(
196
+ checker,
197
+ genericDict,
198
+ importDict,
199
+ type,
200
+ ),
201
+ };
202
+ }
203
+ }
@@ -0,0 +1,53 @@
1
+ import ts from "typescript";
2
+
3
+ export namespace GenericAnalyzer {
4
+ export type Dictionary = WeakMap<ts.Type, ts.Type>;
5
+
6
+ export function analyze(
7
+ checker: ts.TypeChecker,
8
+ classNode: ts.ClassDeclaration,
9
+ ): Dictionary {
10
+ const dict: Dictionary = new WeakMap();
11
+ explore(checker, dict, classNode);
12
+ return dict;
13
+ }
14
+
15
+ function explore(
16
+ checker: ts.TypeChecker,
17
+ dict: Dictionary,
18
+ classNode: ts.ClassDeclaration,
19
+ ): void {
20
+ if (classNode.heritageClauses === undefined) return;
21
+
22
+ for (const heritage of classNode.heritageClauses)
23
+ for (const hType of heritage.types) {
24
+ // MUST BE CLASS
25
+ const expression: ts.Type = checker.getTypeAtLocation(
26
+ hType.expression,
27
+ );
28
+ const superNode: ts.Declaration =
29
+ expression.symbol.getDeclarations()![0];
30
+
31
+ if (!ts.isClassDeclaration(superNode)) continue;
32
+
33
+ // SPECIFY GENERICS
34
+ const usages: ReadonlyArray<ts.TypeNode> =
35
+ hType.typeArguments || [];
36
+ const parameters: ReadonlyArray<ts.TypeParameterDeclaration> =
37
+ superNode.typeParameters || [];
38
+
39
+ parameters.forEach((param, index) => {
40
+ const paramType: ts.Type = checker.getTypeAtLocation(param);
41
+ const usageType: ts.Type =
42
+ usages[index] !== undefined
43
+ ? checker.getTypeAtLocation(usages[index])
44
+ : checker.getTypeAtLocation(param.default!);
45
+
46
+ dict.set(paramType, usageType);
47
+ });
48
+
49
+ // RECUSRIVE EXPLORATION
50
+ explore(checker, dict, superNode);
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,143 @@
1
+ import { HashMap } from "tstl/container/HashMap";
2
+ import { HashSet } from "tstl/container/HashSet";
3
+ import ts from "typescript";
4
+
5
+ import { ITypeTuple } from "../structures/ITypeTuple";
6
+ import { GenericAnalyzer } from "./GenericAnalyzer";
7
+
8
+ export namespace ImportAnalyzer {
9
+ export interface IOutput {
10
+ features: [string, string[]][];
11
+ alias: string;
12
+ }
13
+
14
+ export type Dictionary = HashMap<string, HashSet<string>>;
15
+
16
+ export function analyze(
17
+ checker: ts.TypeChecker,
18
+ genericDict: GenericAnalyzer.Dictionary,
19
+ importDict: Dictionary,
20
+ type: ts.Type,
21
+ ): ITypeTuple {
22
+ type = get_type(checker, type);
23
+ return {
24
+ type,
25
+ name: explore_escaped_name(checker, genericDict, importDict, type),
26
+ };
27
+ }
28
+
29
+ /* ---------------------------------------------------------
30
+ TYPE
31
+ --------------------------------------------------------- */
32
+ function get_type(checker: ts.TypeChecker, type: ts.Type): ts.Type {
33
+ const symbol: ts.Symbol | undefined = type.getSymbol();
34
+ return symbol && get_name(symbol) === "Promise"
35
+ ? escape_promise(checker, type)
36
+ : type;
37
+ }
38
+
39
+ function escape_promise(checker: ts.TypeChecker, type: ts.Type): ts.Type {
40
+ const generic: readonly ts.Type[] = checker.getTypeArguments(
41
+ type as ts.TypeReference,
42
+ );
43
+ if (generic.length !== 1)
44
+ throw new Error(
45
+ "Error on ImportAnalyzer.analyze(): invalid promise type.",
46
+ );
47
+ return generic[0];
48
+ }
49
+
50
+ function get_name(symbol: ts.Symbol): string {
51
+ return explore_name(
52
+ symbol.escapedName.toString(),
53
+ symbol.getDeclarations()![0].parent,
54
+ );
55
+ }
56
+
57
+ /* ---------------------------------------------------------
58
+ ESCAPED TEXT WITH IMPORT STATEMENTS
59
+ --------------------------------------------------------- */
60
+ function explore_escaped_name(
61
+ checker: ts.TypeChecker,
62
+ genericDict: GenericAnalyzer.Dictionary,
63
+ importDict: Dictionary,
64
+ type: ts.Type,
65
+ ): string {
66
+ //----
67
+ // CONDITIONAL BRANCHES
68
+ //----
69
+ // DECOMPOSE GENERIC ARGUMENT
70
+ while (genericDict.has(type) === true) type = genericDict.get(type)!;
71
+
72
+ // PRIMITIVE
73
+ const symbol: ts.Symbol | undefined =
74
+ type.aliasSymbol || type.getSymbol();
75
+ if (symbol === undefined)
76
+ return checker.typeToString(type, undefined, undefined);
77
+ // UNION OR INTERSECT
78
+ else if (
79
+ type.aliasSymbol === undefined &&
80
+ type.isUnionOrIntersection()
81
+ ) {
82
+ const joiner: string = type.isIntersection() ? " & " : " | ";
83
+ return type.types
84
+ .map((child) =>
85
+ explore_escaped_name(
86
+ checker,
87
+ genericDict,
88
+ importDict,
89
+ child,
90
+ ),
91
+ )
92
+ .join(joiner);
93
+ }
94
+
95
+ //----
96
+ // SPECIALIZATION
97
+ //----
98
+ const name: string = get_name(symbol);
99
+ const sourceFile: ts.SourceFile =
100
+ symbol.declarations![0].getSourceFile();
101
+
102
+ if (sourceFile.fileName.indexOf("typescript/lib") === -1) {
103
+ const set: HashSet<string> = importDict.take(
104
+ sourceFile.fileName,
105
+ () => new HashSet(),
106
+ );
107
+ set.insert(name.split(".")[0]);
108
+ }
109
+
110
+ // CHECK GENERIC
111
+ const generic: readonly ts.Type[] = type.aliasSymbol
112
+ ? type.aliasTypeArguments || []
113
+ : checker.getTypeArguments(type as ts.TypeReference);
114
+ return generic.length
115
+ ? name === "Promise"
116
+ ? explore_escaped_name(
117
+ checker,
118
+ genericDict,
119
+ importDict,
120
+ generic[0],
121
+ )
122
+ : `${name}<${generic
123
+ .map((child) =>
124
+ explore_escaped_name(
125
+ checker,
126
+ genericDict,
127
+ importDict,
128
+ child,
129
+ ),
130
+ )
131
+ .join(", ")}>`
132
+ : name;
133
+ }
134
+
135
+ function explore_name(name: string, decl: ts.Node): string {
136
+ return ts.isModuleBlock(decl)
137
+ ? explore_name(
138
+ `${decl.parent.name.getText()}.${name}`,
139
+ decl.parent.parent,
140
+ )
141
+ : name;
142
+ }
143
+ }
@@ -0,0 +1,58 @@
1
+ import path from "path";
2
+ import { Token, parse } from "path-to-regexp";
3
+
4
+ export namespace PathAnalyzer {
5
+ export const join = (...args: string[]) =>
6
+ "/" +
7
+ _Trim(
8
+ path
9
+ .join(...args)
10
+ .split("\\")
11
+ .join("/"),
12
+ );
13
+
14
+ export const espace = (str: string, method: () => string) =>
15
+ "/" +
16
+ _Parse(str, method)
17
+ .map((arg) => (arg.type === "param" ? `:${arg.value}` : arg.value))
18
+ .join("/");
19
+
20
+ export const parameters = (str: string, method: () => string) =>
21
+ _Parse(str, method)
22
+ .filter((arg) => arg.type === "param")
23
+ .map((arg) => arg.value);
24
+
25
+ function _Parse(str: string, method: () => string): IArgument[] {
26
+ const tokens: Token[] = parse(path.join(str).split("\\").join("/"));
27
+ const output: IArgument[] = [];
28
+
29
+ for (const key of tokens) {
30
+ if (typeof key === "string")
31
+ output.push({
32
+ type: "path",
33
+ value: _Trim(key),
34
+ });
35
+ else if (typeof key.name === "number" || _Trim(key.name) === "")
36
+ throw new Error(`Error on ${method}: ${ERROR_MESSAGE}.`);
37
+ else
38
+ output.push({
39
+ type: "param",
40
+ value: _Trim(key.name),
41
+ });
42
+ }
43
+ return output;
44
+ }
45
+
46
+ function _Trim(str: string): string {
47
+ if (str[0] === "/") str = str.substring(1);
48
+ if (str[str.length - 1] === "/") str = str.substring(0, str.length - 1);
49
+ return str;
50
+ }
51
+
52
+ interface IArgument {
53
+ type: "param" | "path";
54
+ value: string;
55
+ }
56
+ }
57
+
58
+ const ERROR_MESSAGE = "nestia supports only string typed parameter on path";