evaengine 1.0.14 → 2.0.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 (199) hide show
  1. package/README.md +15 -1
  2. package/bin/engine +2 -31
  3. package/dist/bin.d.ts +1 -0
  4. package/dist/bin.js +40 -0
  5. package/dist/bin.js.map +1 -0
  6. package/{src/commands/index.js → dist/commands/index.d.ts} +1 -8
  7. package/dist/commands/index.js +6 -0
  8. package/dist/commands/index.js.map +1 -0
  9. package/dist/commands/interface.d.ts +18 -0
  10. package/dist/commands/interface.js +40 -0
  11. package/dist/commands/interface.js.map +1 -0
  12. package/dist/commands/make_entity.d.ts +47 -0
  13. package/dist/commands/make_entity.js +410 -0
  14. package/dist/commands/make_entity.js.map +1 -0
  15. package/dist/commands/tramp.d.ts +7 -0
  16. package/dist/commands/tramp.js +29 -0
  17. package/dist/commands/tramp.js.map +1 -0
  18. package/dist/config/index.d.ts +92 -0
  19. package/dist/config/index.js +96 -0
  20. package/dist/config/index.js.map +1 -0
  21. package/dist/di.d.ts +73 -0
  22. package/dist/di.js +76 -0
  23. package/dist/di.js.map +1 -0
  24. package/dist/engine.d.ts +85 -0
  25. package/dist/engine.js +404 -0
  26. package/dist/engine.js.map +1 -0
  27. package/dist/entities/index.d.ts +54 -0
  28. package/dist/entities/index.js +228 -0
  29. package/dist/entities/index.js.map +1 -0
  30. package/dist/exceptions/index.d.ts +153 -0
  31. package/dist/exceptions/index.js +439 -0
  32. package/dist/exceptions/index.js.map +1 -0
  33. package/dist/index.d.ts +45 -0
  34. package/dist/index.js +45 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/middlewares/auth.d.ts +5 -0
  37. package/dist/middlewares/auth.js +63 -0
  38. package/dist/middlewares/auth.js.map +1 -0
  39. package/dist/middlewares/auth_kong.d.ts +2 -0
  40. package/dist/middlewares/auth_kong.js +24 -0
  41. package/dist/middlewares/auth_kong.js.map +1 -0
  42. package/dist/middlewares/debug.d.ts +3 -0
  43. package/dist/middlewares/debug.js +50 -0
  44. package/dist/middlewares/debug.js.map +1 -0
  45. package/{src/middlewares/index.js → dist/middlewares/index.d.ts} +1 -11
  46. package/dist/middlewares/index.js +9 -0
  47. package/dist/middlewares/index.js.map +1 -0
  48. package/dist/middlewares/providers.d.ts +25 -0
  49. package/dist/middlewares/providers.js +63 -0
  50. package/dist/middlewares/providers.js.map +1 -0
  51. package/dist/middlewares/session.d.ts +6 -0
  52. package/dist/middlewares/session.js +51 -0
  53. package/dist/middlewares/session.js.map +1 -0
  54. package/dist/middlewares/trace.d.ts +52 -0
  55. package/dist/middlewares/trace.js +225 -0
  56. package/dist/middlewares/trace.js.map +1 -0
  57. package/dist/middlewares/validator.d.ts +10 -0
  58. package/dist/middlewares/validator.js +43 -0
  59. package/dist/middlewares/validator.js.map +1 -0
  60. package/dist/middlewares/view_cache.d.ts +14 -0
  61. package/dist/middlewares/view_cache.js +102 -0
  62. package/dist/middlewares/view_cache.js.map +1 -0
  63. package/dist/services/cache.d.ts +66 -0
  64. package/dist/services/cache.js +207 -0
  65. package/dist/services/cache.js.map +1 -0
  66. package/dist/services/config.d.ts +25 -0
  67. package/dist/services/config.js +88 -0
  68. package/dist/services/config.js.map +1 -0
  69. package/dist/services/env.d.ts +12 -0
  70. package/dist/services/env.js +24 -0
  71. package/dist/services/env.js.map +1 -0
  72. package/dist/services/event_manager.d.ts +29 -0
  73. package/dist/services/event_manager.js +75 -0
  74. package/dist/services/event_manager.js.map +1 -0
  75. package/dist/services/http_client.d.ts +66 -0
  76. package/dist/services/http_client.js +62 -0
  77. package/dist/services/http_client.js.map +1 -0
  78. package/{src/services/index.js → dist/services/index.d.ts} +1 -15
  79. package/dist/services/index.js +14 -0
  80. package/dist/services/index.js.map +1 -0
  81. package/{src/services/interface.js → dist/services/interface.d.ts} +1 -3
  82. package/dist/services/interface.js +6 -0
  83. package/dist/services/interface.js.map +1 -0
  84. package/{src/services/joi.js → dist/services/joi.d.ts} +2 -9
  85. package/dist/services/joi.js +11 -0
  86. package/dist/services/joi.js.map +1 -0
  87. package/dist/services/jwt_token.d.ts +24 -0
  88. package/dist/services/jwt_token.js +77 -0
  89. package/dist/services/jwt_token.js.map +1 -0
  90. package/dist/services/jwt_token_kong.d.ts +25 -0
  91. package/dist/services/jwt_token_kong.js +65 -0
  92. package/dist/services/jwt_token_kong.js.map +1 -0
  93. package/dist/services/logger.d.ts +30 -0
  94. package/dist/services/logger.js +126 -0
  95. package/dist/services/logger.js.map +1 -0
  96. package/dist/services/namespace.d.ts +55 -0
  97. package/dist/services/namespace.js +157 -0
  98. package/dist/services/namespace.js.map +1 -0
  99. package/dist/services/now.d.ts +14 -0
  100. package/dist/services/now.js +43 -0
  101. package/dist/services/now.js.map +1 -0
  102. package/dist/services/providers.d.ts +55 -0
  103. package/dist/services/providers.js +134 -0
  104. package/dist/services/providers.js.map +1 -0
  105. package/dist/services/redis.d.ts +18 -0
  106. package/dist/services/redis.js +53 -0
  107. package/dist/services/redis.js.map +1 -0
  108. package/dist/services/rest_client.d.ts +48 -0
  109. package/dist/services/rest_client.js +96 -0
  110. package/dist/services/rest_client.js.map +1 -0
  111. package/dist/swagger/index.d.ts +223 -0
  112. package/dist/swagger/index.js +564 -0
  113. package/dist/swagger/index.js.map +1 -0
  114. package/dist/types/express.d.ts +14 -0
  115. package/dist/types/vendor.d.ts +102 -0
  116. package/dist/utils/api_scaffold.d.ts +74 -0
  117. package/dist/utils/api_scaffold.js +220 -0
  118. package/dist/utils/api_scaffold.js.map +1 -0
  119. package/dist/utils/case_converter.d.ts +7 -0
  120. package/dist/utils/case_converter.js +29 -0
  121. package/dist/utils/case_converter.js.map +1 -0
  122. package/dist/utils/crc32.d.ts +2 -0
  123. package/dist/utils/crc32.js +43 -0
  124. package/dist/utils/crc32.js.map +1 -0
  125. package/dist/utils/cron.d.ts +27 -0
  126. package/dist/utils/cron.js +186 -0
  127. package/dist/utils/cron.js.map +1 -0
  128. package/dist/utils/datetime.d.ts +4 -0
  129. package/dist/utils/datetime.js +6 -0
  130. package/dist/utils/datetime.js.map +1 -0
  131. package/dist/utils/host.d.ts +18 -0
  132. package/dist/utils/host.js +33 -0
  133. package/dist/utils/host.js.map +1 -0
  134. package/{src/utils/index.js → dist/utils/index.d.ts} +2 -26
  135. package/dist/utils/index.js +12 -0
  136. package/dist/utils/index.js.map +1 -0
  137. package/dist/utils/pagination.d.ts +150 -0
  138. package/dist/utils/pagination.js +242 -0
  139. package/dist/utils/pagination.js.map +1 -0
  140. package/dist/utils/random.d.ts +3 -0
  141. package/dist/utils/random.js +18 -0
  142. package/dist/utils/random.js.map +1 -0
  143. package/dist/utils/request_client.d.ts +33 -0
  144. package/dist/utils/request_client.js +153 -0
  145. package/dist/utils/request_client.js.map +1 -0
  146. package/dist/utils/smart_query.d.ts +144 -0
  147. package/dist/utils/smart_query.js +310 -0
  148. package/dist/utils/smart_query.js.map +1 -0
  149. package/dist/utils/test.d.ts +14 -0
  150. package/dist/utils/test.js +37 -0
  151. package/dist/utils/test.js.map +1 -0
  152. package/dist/utils/wrapper.d.ts +3 -0
  153. package/dist/utils/wrapper.js +5 -0
  154. package/dist/utils/wrapper.js.map +1 -0
  155. package/package.json +24 -10
  156. package/index.js +0 -2
  157. package/src/commands/interface.js +0 -45
  158. package/src/commands/make_entity.js +0 -490
  159. package/src/commands/tramp.js +0 -34
  160. package/src/config/index.js +0 -95
  161. package/src/di.js +0 -96
  162. package/src/engine.js +0 -556
  163. package/src/entities/index.js +0 -272
  164. package/src/exceptions/index.js +0 -501
  165. package/src/index.js +0 -55
  166. package/src/middlewares/auth.js +0 -67
  167. package/src/middlewares/auth_kong.js +0 -28
  168. package/src/middlewares/debug.js +0 -88
  169. package/src/middlewares/providers.js +0 -73
  170. package/src/middlewares/session.js +0 -63
  171. package/src/middlewares/trace.js +0 -254
  172. package/src/middlewares/validator.js +0 -50
  173. package/src/middlewares/view_cache.js +0 -127
  174. package/src/services/cache.js +0 -223
  175. package/src/services/config.js +0 -115
  176. package/src/services/env.js +0 -28
  177. package/src/services/event_manager.js +0 -84
  178. package/src/services/http_client.js +0 -69
  179. package/src/services/jwt_token.js +0 -89
  180. package/src/services/jwt_token_kong.js +0 -75
  181. package/src/services/logger.js +0 -150
  182. package/src/services/namespace.js +0 -176
  183. package/src/services/now.js +0 -49
  184. package/src/services/providers.js +0 -158
  185. package/src/services/redis.js +0 -63
  186. package/src/services/rest_client.js +0 -112
  187. package/src/swagger/index.js +0 -665
  188. package/src/utils/api_scaffold.js +0 -240
  189. package/src/utils/case_converter.js +0 -33
  190. package/src/utils/crc32.js +0 -44
  191. package/src/utils/cron.js +0 -208
  192. package/src/utils/datetime.js +0 -13
  193. package/src/utils/host.js +0 -39
  194. package/src/utils/pagination.js +0 -260
  195. package/src/utils/random.js +0 -23
  196. package/src/utils/request_client.js +0 -179
  197. package/src/utils/smart_query.js +0 -352
  198. package/src/utils/test.js +0 -48
  199. package/src/utils/wrapper.js +0 -8
@@ -0,0 +1,223 @@
1
+ import { type GlobOptionsWithoutFileTypes } from 'fs';
2
+ import * as doctrine from 'doctrine';
3
+ import * as acorn from 'acorn';
4
+ import Entitles from '../entities/index.js';
5
+ import { StandardException, type ExceptionInput } from '../exceptions/index.js';
6
+ export declare class AcornParsingException extends StandardException {
7
+ }
8
+ export declare class YamlParsingException extends StandardException {
9
+ annotation: Partial<Annotation>;
10
+ setAnnotation(annotation: Annotation): this;
11
+ getAnnotation(): Partial<Annotation>;
12
+ toString(): string;
13
+ constructor(exceptionOrMsg: ExceptionInput);
14
+ }
15
+ export declare const MODEL_TO_FRAGMENT_TYPES_MAPPING: Record<string, string>;
16
+ export declare class Fragment {
17
+ getTypes(): string[];
18
+ isPath(): boolean;
19
+ isDefinition(): boolean;
20
+ isUnknown(): boolean;
21
+ isException(): boolean;
22
+ setParentFragment(fragment: Fragment): this;
23
+ getParentFragment(): Fragment | null;
24
+ correctSwaggerPath(swaggerDoc?: object): object;
25
+ toSwaggerDoc(exceptions?: Record<string, StandardException>): {
26
+ paths: {
27
+ [x: string]: {
28
+ [x: string]: object;
29
+ };
30
+ };
31
+ definitions?: undefined;
32
+ } | {
33
+ definitions: {
34
+ [x: string]: object;
35
+ };
36
+ paths?: undefined;
37
+ } | {
38
+ paths?: undefined;
39
+ definitions?: undefined;
40
+ } | {
41
+ definitions: {
42
+ [x: string]: {
43
+ properties: {
44
+ code: {
45
+ type: string;
46
+ format: string;
47
+ };
48
+ message: {
49
+ type: string;
50
+ };
51
+ };
52
+ required: string[];
53
+ example: {
54
+ code: number;
55
+ message: string;
56
+ };
57
+ };
58
+ };
59
+ paths: {
60
+ [x: string]: {
61
+ [x: string]: {
62
+ responses: {
63
+ [x: number]: {
64
+ description: string;
65
+ schema: {
66
+ $ref: string;
67
+ };
68
+ };
69
+ };
70
+ };
71
+ };
72
+ };
73
+ };
74
+ static exceptionMapping(exception: StandardException): {
75
+ properties: {
76
+ code: {
77
+ type: string;
78
+ format: string;
79
+ };
80
+ message: {
81
+ type: string;
82
+ };
83
+ };
84
+ required: string[];
85
+ example: {
86
+ code: number;
87
+ message: string;
88
+ };
89
+ };
90
+ static factory(jsdoc: doctrine.AnnotationTag, annotation: Annotation): Fragment;
91
+ type: string;
92
+ description: string;
93
+ value: unknown;
94
+ file: string;
95
+ start: number;
96
+ end: number;
97
+ parent: Fragment | null;
98
+ constructor({ type, description, value, file, start, end }: {
99
+ type: string;
100
+ description: string;
101
+ value: unknown;
102
+ file: string;
103
+ start: number;
104
+ end: number;
105
+ });
106
+ }
107
+ export declare class Annotation {
108
+ getFragments(): Fragment[];
109
+ toString(): string;
110
+ getYamlErrors(): YamlParsingException[];
111
+ value: string;
112
+ file: string;
113
+ start: number;
114
+ end: number;
115
+ yamlErrors: YamlParsingException[];
116
+ fragments: Fragment[] | null;
117
+ constructor({ type, //Block
118
+ value, //Long string
119
+ file, //String
120
+ start, end }: {
121
+ type: string;
122
+ value: string;
123
+ file: string;
124
+ start: number;
125
+ end: number;
126
+ });
127
+ }
128
+ export declare class AnnotationsContainer {
129
+ getFile(): string;
130
+ hasAnnotations(): boolean;
131
+ getAnnotations(): Annotation[];
132
+ collectFragments(): Fragment[];
133
+ collectYamlErrors(): YamlParsingException[];
134
+ file: string;
135
+ annotations: Annotation[];
136
+ fragments: Fragment[];
137
+ constructor(file: string, acornComments: acorn.Comment[]);
138
+ }
139
+ type SwaggerLogger = {
140
+ debug: (...args: unknown[]) => void;
141
+ warn: (...args: unknown[]) => void;
142
+ error: (...args: unknown[]) => void;
143
+ };
144
+ type ExceptionInterface = abstract new (...args: never[]) => object;
145
+ type ModelAttributeLike = {
146
+ type: {
147
+ key: string;
148
+ };
149
+ comment?: string | null;
150
+ defaultValue?: unknown;
151
+ allowNull?: boolean;
152
+ };
153
+ type SwaggerModelProperty = {
154
+ type: string;
155
+ description?: string | null;
156
+ default?: unknown;
157
+ };
158
+ type SwaggerModelDefinition = {
159
+ type: string;
160
+ properties: Record<string, SwaggerModelProperty>;
161
+ required?: string[];
162
+ };
163
+ interface ExSwaggerOptions {
164
+ sourceRootPath: string;
165
+ compileDistPath: string;
166
+ models?: Entitles | null;
167
+ modelBlacklist?: string[];
168
+ swaggerDocsTemplate?: Record<string, unknown>;
169
+ logger?: SwaggerLogger | null;
170
+ swaggerUIPath?: string;
171
+ swaggerDocsPath?: string;
172
+ sourceFilesPath?: string | string[];
173
+ exceptionInterface?: ExceptionInterface;
174
+ extraSourcePaths?: string[];
175
+ exceptionPaths?: string[];
176
+ }
177
+ /**
178
+ * A Swagger Json document generator
179
+ * Generate document from
180
+ * - JS source code annotations (Parser is Doctrine)
181
+ * - ORM entities (Based on Sequelize)
182
+ * - EvaEngine Exceptions
183
+ */
184
+ export declare class ExSwagger {
185
+ /**
186
+ * Get file path array by glob
187
+ */
188
+ static scanFiles(path: string, options?: GlobOptionsWithoutFileTypes): Promise<string[]>;
189
+ /**
190
+ * Get annotations from comments
191
+ * An annotation MUST start with double stars
192
+ */
193
+ static filesToAnnotationsContainers(files: string[]): Promise<AnnotationsContainer[]>;
194
+ static modelToSwaggerDefinition(model: Record<string, ModelAttributeLike>): SwaggerModelDefinition;
195
+ static modelsToSwaggerDefinitions(models: Record<string, unknown>, blacklist?: string[]): Map<string, SwaggerModelDefinition>;
196
+ static scanExceptions(path: string, exceptionInterface?: ExceptionInterface): Promise<Record<string, StandardException>>;
197
+ exportJson(dist?: string): Promise<Record<string, unknown>>;
198
+ static mergeAll(_template: Record<string, unknown>, fragments: Fragment[], exceptions: Record<string, StandardException>, modelDefinitions: Map<string, object>): Record<string, unknown>;
199
+ getStates(): {
200
+ swaggerTemplate: Record<string, unknown>;
201
+ modelBlacklist: string[];
202
+ sourceFilesPath: string[];
203
+ exceptionPaths: string[];
204
+ compileDistPath: string;
205
+ swaggerUIPath: string;
206
+ swaggerDocsPath: string;
207
+ };
208
+ getSwaggerUIPath(): string;
209
+ getSwaggerIndexHtml(): Promise<string>;
210
+ getCompileDistPath(): string;
211
+ logger: SwaggerLogger;
212
+ swaggerDocsTemplate: Record<string, unknown>;
213
+ models: Record<string, unknown> | null;
214
+ modelBlacklist: string[];
215
+ sourceFilesPath: string[];
216
+ exceptionPaths: string[];
217
+ exceptionInterface: ExceptionInterface;
218
+ compileDistPath: string;
219
+ swaggerUIPath: string;
220
+ swaggerDocsPath: string;
221
+ constructor({ sourceRootPath, compileDistPath, models, modelBlacklist, swaggerDocsTemplate, logger, swaggerUIPath, swaggerDocsPath, sourceFilesPath, exceptionInterface, extraSourcePaths, exceptionPaths }: ExSwaggerOptions);
222
+ }
223
+ export {};