mock-config-server 5.0.0-beta.1 → 5.0.0-beta.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.
Files changed (524) hide show
  1. package/README.md +6 -53
  2. package/dist/_virtual/_rolldown/runtime.mjs +6 -0
  3. package/dist/bin/bin.d.mts +1 -0
  4. package/dist/bin/bin.mjs +8 -0
  5. package/dist/bin/build.mjs +43 -0
  6. package/dist/bin/cli.mjs +41 -0
  7. package/dist/bin/helpers/createTemplate.mjs +21 -0
  8. package/dist/bin/helpers/index.mjs +5 -0
  9. package/dist/bin/helpers/resolveConfigFile.mjs +13 -0
  10. package/dist/bin/helpers/resolveConfigFilePath.mjs +11 -0
  11. package/dist/bin/helpers/resolveExportsFromSourceCode.mjs +14 -0
  12. package/dist/bin/init.mjs +104 -0
  13. package/dist/bin/run.mjs +19 -0
  14. package/dist/index.d.mts +42 -0
  15. package/dist/index.mjs +29 -0
  16. package/dist/package.mjs +90 -0
  17. package/dist/src/core/database/createDatabaseRoutes/createDatabaseRoutes.mjs +30 -0
  18. package/dist/src/core/database/createDatabaseRoutes/helpers/array/createNewId/createNewId.mjs +8 -0
  19. package/dist/src/core/database/createDatabaseRoutes/helpers/array/findIndexById/findIndexById.mjs +4 -0
  20. package/dist/src/core/database/createDatabaseRoutes/helpers/array/isIndex/isIndex.mjs +4 -0
  21. package/dist/src/core/database/createDatabaseRoutes/helpers/createNestedDatabaseRoutes/createNestedDatabaseRoutes.mjs +95 -0
  22. package/dist/src/core/database/createDatabaseRoutes/helpers/createRewrittenDatabaseRoutes/createRewrittenDatabaseRoutes.mjs +7 -0
  23. package/dist/src/core/database/createDatabaseRoutes/helpers/createShallowDatabaseRoutes/createShallowDatabaseRoutes.mjs +64 -0
  24. package/dist/src/core/database/createDatabaseRoutes/helpers/filter/filter.mjs +47 -0
  25. package/dist/src/core/database/createDatabaseRoutes/helpers/index.mjs +8 -0
  26. package/dist/src/core/database/createDatabaseRoutes/helpers/pagination/pagination.mjs +30 -0
  27. package/dist/src/core/database/createDatabaseRoutes/helpers/search/search.mjs +14 -0
  28. package/dist/src/core/database/createDatabaseRoutes/helpers/sort/sort.mjs +30 -0
  29. package/dist/src/core/database/createDatabaseRoutes/helpers/splitDatabaseByNesting/splitDatabaseByNesting.mjs +25 -0
  30. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.mjs +49 -0
  31. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.mjs +43 -0
  32. package/dist/src/core/database/createDatabaseRoutes/storages/Memory/MemoryStorage.mjs +42 -0
  33. package/dist/src/core/database/createDatabaseRoutes/storages/index.mjs +3 -0
  34. package/dist/src/core/database/createOrm/createOrm.mjs +96 -0
  35. package/dist/src/core/database/createStorage/createStorage.mjs +8 -0
  36. package/dist/src/core/database/index.mjs +4 -0
  37. package/dist/src/core/entities/handlers/endsWith.d.mts +5 -0
  38. package/dist/src/core/entities/handlers/endsWith.mjs +6 -0
  39. package/dist/src/core/entities/handlers/equals.d.mts +5 -0
  40. package/dist/src/core/entities/handlers/equals.mjs +6 -0
  41. package/dist/src/core/entities/handlers/every.d.mts +5 -0
  42. package/dist/src/core/entities/handlers/every.mjs +6 -0
  43. package/dist/src/core/entities/handlers/exists.d.mts +5 -0
  44. package/dist/src/core/entities/handlers/exists.mjs +6 -0
  45. package/dist/src/core/entities/handlers/fn.d.mts +6 -0
  46. package/dist/src/core/entities/handlers/fn.mjs +6 -0
  47. package/dist/src/core/entities/handlers/greater.d.mts +5 -0
  48. package/dist/src/core/entities/handlers/greater.mjs +6 -0
  49. package/dist/src/core/entities/handlers/greaterOrEquals.d.mts +5 -0
  50. package/dist/src/core/entities/handlers/greaterOrEquals.mjs +6 -0
  51. package/dist/src/core/entities/handlers/haveEntries.d.mts +6 -0
  52. package/dist/src/core/entities/handlers/haveEntries.mjs +6 -0
  53. package/dist/src/core/entities/handlers/haveType.d.mts +6 -0
  54. package/dist/src/core/entities/handlers/haveType.mjs +6 -0
  55. package/dist/src/core/entities/handlers/inRange.d.mts +5 -0
  56. package/dist/src/core/entities/handlers/inRange.mjs +6 -0
  57. package/dist/src/core/entities/handlers/includes.d.mts +5 -0
  58. package/dist/src/core/entities/handlers/includes.mjs +6 -0
  59. package/dist/src/core/entities/handlers/index.d.mts +21 -0
  60. package/dist/src/core/entities/handlers/index.mjs +22 -0
  61. package/dist/src/core/entities/handlers/length.d.mts +5 -0
  62. package/dist/src/core/entities/handlers/length.mjs +6 -0
  63. package/dist/src/core/entities/handlers/less.d.mts +5 -0
  64. package/dist/src/core/entities/handlers/less.mjs +6 -0
  65. package/dist/src/core/entities/handlers/lessOrEquals.d.mts +5 -0
  66. package/dist/src/core/entities/handlers/lessOrEquals.mjs +6 -0
  67. package/dist/src/core/entities/handlers/maxLength.d.mts +5 -0
  68. package/dist/src/core/entities/handlers/maxLength.mjs +6 -0
  69. package/dist/src/core/entities/handlers/minLength.d.mts +5 -0
  70. package/dist/src/core/entities/handlers/minLength.mjs +6 -0
  71. package/dist/src/core/entities/handlers/not.d.mts +5 -0
  72. package/dist/src/core/entities/handlers/not.mjs +6 -0
  73. package/dist/src/core/entities/handlers/oneOf.d.mts +5 -0
  74. package/dist/src/core/entities/handlers/oneOf.mjs +6 -0
  75. package/dist/src/core/entities/handlers/regExp.d.mts +5 -0
  76. package/dist/src/core/entities/handlers/regExp.mjs +6 -0
  77. package/dist/src/core/entities/handlers/some.d.mts +5 -0
  78. package/dist/src/core/entities/handlers/some.mjs +6 -0
  79. package/dist/src/core/entities/handlers/startsWith.d.mts +5 -0
  80. package/dist/src/core/entities/handlers/startsWith.mjs +6 -0
  81. package/dist/src/core/entities/index.d.mts +21 -0
  82. package/dist/src/core/entities/index.mjs +23 -0
  83. package/dist/src/core/functions/graphql/graphql.d.mts +69 -0
  84. package/dist/src/core/functions/graphql/graphql.mjs +133 -0
  85. package/dist/src/core/functions/graphql/helpers/createQueueHandler/createQueueHandler.mjs +24 -0
  86. package/dist/src/core/functions/index.d.mts +4 -0
  87. package/dist/src/core/functions/index.mjs +5 -0
  88. package/dist/src/core/functions/mock.d.mts +5 -0
  89. package/dist/src/core/functions/mock.mjs +4 -0
  90. package/dist/src/core/functions/rest/helpers/createFileHandler/createFileHandler.mjs +16 -0
  91. package/dist/src/core/functions/rest/helpers/createQueueHandler/createQueueHandler.mjs +24 -0
  92. package/dist/src/core/functions/rest/helpers/formatSsePayload/formatSsePayload.mjs +23 -0
  93. package/dist/src/core/functions/rest/helpers/index.mjs +4 -0
  94. package/dist/src/core/functions/rest/rest.d.mts +116 -0
  95. package/dist/src/core/functions/rest/rest.mjs +134 -0
  96. package/dist/src/core/functions/ws/ws.d.mts +19 -0
  97. package/dist/src/core/functions/ws/ws.mjs +24 -0
  98. package/dist/src/core/graphql/createGraphQLRoute/createGraphQLRoute.mjs +127 -0
  99. package/dist/src/core/graphql/createGraphQLRoute/helpers/calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight.mjs +14 -0
  100. package/dist/src/core/graphql/createGraphQLRoute/helpers/index.mjs +4 -0
  101. package/dist/src/core/graphql/createGraphQLRoute/helpers/matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts.mjs +23 -0
  102. package/dist/src/core/graphql/createGraphQLRoute/helpers/prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts.mjs +4 -0
  103. package/dist/src/core/graphql/index.mjs +6 -0
  104. package/dist/src/core/middlewares/contextMiddleware/contextMiddleware.mjs +52 -0
  105. package/dist/src/core/middlewares/cookieParseMiddleware/cookieParseMiddleware.mjs +12 -0
  106. package/dist/src/core/middlewares/corsMiddleware/corsMiddleware.mjs +34 -0
  107. package/dist/src/core/middlewares/corsMiddleware/helpers/getAllowedOrigins/getAllowedOrigins.mjs +8 -0
  108. package/dist/src/core/middlewares/destroyerMiddleware/destroyerMiddleware.mjs +22 -0
  109. package/dist/src/core/middlewares/errorMiddleware/errorMiddleware.mjs +12 -0
  110. package/dist/src/core/middlewares/index.mjs +9 -0
  111. package/dist/src/core/middlewares/noCorsMiddleware/noCorsMiddleware.mjs +20 -0
  112. package/dist/src/core/middlewares/requestInterceptorMiddleware/requestInterceptorMiddleware.mjs +15 -0
  113. package/dist/src/core/middlewares/staticMiddleware/staticMiddleware.mjs +25 -0
  114. package/dist/src/core/rest/createRestRoute/createRestRoute.mjs +138 -0
  115. package/dist/src/core/rest/createRestRoute/helpers/calculateRestRouteConfigWeight/calculateRestRouteConfigWeight.mjs +14 -0
  116. package/dist/src/core/rest/createRestRoute/helpers/index.mjs +4 -0
  117. package/dist/src/core/rest/createRestRoute/helpers/matchRestRequestArtifacts/matchRestRequestArtifacts.mjs +22 -0
  118. package/dist/src/core/rest/createRestRoute/helpers/prepareRestRequestArtifacts/prepareRestRequestArtifacts.mjs +26 -0
  119. package/dist/src/core/rest/index.mjs +6 -0
  120. package/dist/src/core/ws/createWsRoute/createWsRoute.mjs +204 -0
  121. package/dist/src/core/ws/createWsRoute/helpers/calculateGraphqlTransportWsRouteConfigWeight/calculateGraphqlTransportWsRouteConfigWeight.mjs +4 -0
  122. package/dist/src/core/ws/createWsRoute/helpers/index.mjs +5 -0
  123. package/dist/src/core/ws/createWsRoute/helpers/matchGraphqlTransportWsRequestArtifacts/matchGraphqlTransportWsRequestArtifacts.mjs +23 -0
  124. package/dist/src/core/ws/createWsRoute/helpers/matchRawRequestArtifacts/matchRawRequestArtifacts.mjs +4 -0
  125. package/dist/src/core/ws/createWsRoute/helpers/prepareWsRequestArtifacts/prepareWsRequestArtifacts.mjs +4 -0
  126. package/dist/src/core/ws/index.mjs +7 -0
  127. package/dist/src/index.d.mts +41 -0
  128. package/dist/src/index.mjs +31 -0
  129. package/dist/src/server/createMockServer/createMockServer.d.mts +7 -0
  130. package/dist/src/server/createMockServer/createMockServer.mjs +159 -0
  131. package/dist/src/server/index.d.mts +2 -0
  132. package/dist/src/server/index.mjs +3 -0
  133. package/dist/src/server/startMockServer/startMockServer.d.mts +7 -0
  134. package/dist/src/server/startMockServer/startMockServer.mjs +17 -0
  135. package/dist/src/utils/constants/appPath.mjs +4 -0
  136. package/dist/src/utils/constants/default.mjs +14 -0
  137. package/dist/src/utils/constants/entitites.d.mts +4 -0
  138. package/dist/src/utils/constants/entitites.mjs +4 -0
  139. package/dist/src/utils/constants/index.mjs +4 -0
  140. package/dist/src/utils/helpers/asyncHandler.d.mts +1 -0
  141. package/dist/src/utils/helpers/asyncHandler.mjs +4 -0
  142. package/dist/src/utils/helpers/date/formatTimestamp/formatTimestamp.mjs +11 -0
  143. package/dist/src/utils/helpers/entities/createComparator/createComparator.d.mts +1 -0
  144. package/dist/src/utils/helpers/entities/createComparator/createComparator.mjs +9 -0
  145. package/dist/src/utils/helpers/entities/index.d.mts +1 -0
  146. package/dist/src/utils/helpers/entities/index.mjs +4 -0
  147. package/dist/src/utils/helpers/entities/isComparator/isComparator.d.mts +1 -0
  148. package/dist/src/utils/helpers/entities/isComparator/isComparator.mjs +6 -0
  149. package/dist/src/utils/helpers/entities/resolveEntityValues/resolveEntityValues.d.mts +27 -0
  150. package/dist/src/utils/helpers/entities/resolveEntityValues/resolveEntityValues.mjs +88 -0
  151. package/dist/src/utils/helpers/files/isFilePathValid/isFilePathValid.mjs +14 -0
  152. package/dist/src/utils/helpers/graphql/getGraphQLInput/getGraphQLInput.d.mts +1 -0
  153. package/dist/src/utils/helpers/graphql/getGraphQLInput/getGraphQLInput.mjs +18 -0
  154. package/dist/src/utils/helpers/graphql/getGraphqlTransportWsInput/getGraphqlTransportWsInput.d.mts +1 -0
  155. package/dist/src/utils/helpers/graphql/getGraphqlTransportWsInput/getGraphqlTransportWsInput.mjs +16 -0
  156. package/dist/src/utils/helpers/graphql/index.d.mts +1 -0
  157. package/dist/src/utils/helpers/graphql/index.mjs +5 -0
  158. package/dist/src/utils/helpers/graphql/parseGraphQLQuery/parseGraphQLQuery.d.mts +1 -0
  159. package/dist/src/utils/helpers/graphql/parseGraphQLQuery/parseGraphQLQuery.mjs +20 -0
  160. package/dist/src/utils/helpers/graphql/parseGraphQLRequest/parseGraphQLRequest.d.mts +1 -0
  161. package/dist/src/utils/helpers/graphql/parseGraphQLRequest/parseGraphQLRequest.mjs +2 -0
  162. package/dist/src/utils/helpers/index.d.mts +1 -0
  163. package/dist/src/utils/helpers/index.mjs +23 -0
  164. package/dist/src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.d.mts +1 -0
  165. package/dist/src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.mjs +27 -0
  166. package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.d.mts +1 -0
  167. package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.mjs +68 -0
  168. package/dist/src/utils/helpers/interceptors/index.d.mts +1 -0
  169. package/dist/src/utils/helpers/isPlainObject/isPlainObject.mjs +4 -0
  170. package/dist/src/utils/helpers/isPrimitive/isPrimitive.d.mts +1 -0
  171. package/dist/src/utils/helpers/isPrimitive/isPrimitive.mjs +4 -0
  172. package/dist/src/utils/helpers/logger/callRequestLogger/callRequestLogger.d.mts +1 -0
  173. package/dist/src/utils/helpers/logger/callRequestLogger/callRequestLogger.mjs +37 -0
  174. package/dist/src/utils/helpers/logger/callResponseLogger/callResponseLogger.d.mts +1 -0
  175. package/dist/src/utils/helpers/logger/callResponseLogger/callResponseLogger.mjs +41 -0
  176. package/dist/src/utils/helpers/logger/helpers/filterTokens/filterTokens.mjs +28 -0
  177. package/dist/src/utils/helpers/logger/helpers/formatTokens/formatTokens.mjs +12 -0
  178. package/dist/src/utils/helpers/logger/index.d.mts +1 -0
  179. package/dist/src/utils/helpers/request/index.d.mts +1 -0
  180. package/dist/src/utils/helpers/request/parseCookie/parseCookie.d.mts +1 -0
  181. package/dist/src/utils/helpers/request/parseCookie/parseCookie.mjs +13 -0
  182. package/dist/src/utils/helpers/request/parseQuery/parseQuery.mjs +20 -0
  183. package/dist/src/utils/helpers/sleep.mjs +6 -0
  184. package/dist/src/utils/helpers/url/normalizeUrl/normalizeUrl.mjs +7 -0
  185. package/dist/src/utils/helpers/url/urlJoin/urlJoin.mjs +5 -0
  186. package/dist/src/utils/types/cors.d.mts +17 -0
  187. package/dist/src/utils/types/database.d.mts +40 -0
  188. package/dist/src/utils/types/entities.d.mts +15 -0
  189. package/dist/src/utils/types/files.d.mts +9 -0
  190. package/dist/src/utils/types/graphql-transport-ws.d.mts +84 -0
  191. package/dist/src/utils/types/graphql.d.mts +71 -0
  192. package/dist/src/utils/types/index.d.mts +14 -0
  193. package/dist/src/utils/types/interceptors.d.mts +44 -0
  194. package/dist/src/utils/types/logger.d.mts +43 -0
  195. package/dist/src/utils/types/rest.d.mts +78 -0
  196. package/dist/src/utils/types/server.d.mts +61 -0
  197. package/dist/src/utils/types/shared.d.mts +4 -0
  198. package/dist/src/utils/types/utils.d.mts +8 -0
  199. package/dist/src/utils/types/values.d.mts +14 -0
  200. package/dist/src/utils/types/ws.d.mts +80 -0
  201. package/dist/src/utils/validate/baseUrlSchema/baseUrlSchema.mjs +6 -0
  202. package/dist/src/utils/validate/corsSchema/corsSchema.mjs +25 -0
  203. package/dist/src/utils/validate/databaseConfigSchema/databaseConfigSchema.mjs +11 -0
  204. package/dist/src/utils/validate/getMostSpecificPathFromError.mjs +24 -0
  205. package/dist/src/utils/validate/getValidationMessageFromPath.mjs +7 -0
  206. package/dist/src/utils/validate/graphqlRequestConfigSchema/graphqlRequestConfigSchema.mjs +14 -0
  207. package/dist/src/utils/validate/graphqlRequestConfigSchema/routeConfigSchema/routeConfigSchema.mjs +23 -0
  208. package/dist/src/utils/validate/graphqlSubscriptionConfigSchema/graphqlSubscriptionConfigSchema.mjs +14 -0
  209. package/dist/src/utils/validate/graphqlSubscriptionConfigSchema/subscriptionRouteConfigSchema/subscriptionRouteConfigSchema.mjs +13 -0
  210. package/dist/src/utils/validate/index.mjs +18 -0
  211. package/dist/src/utils/validate/interceptorsSchema/interceptorsSchema.mjs +8 -0
  212. package/dist/src/utils/validate/portSchema/portSchema.mjs +4 -0
  213. package/dist/src/utils/validate/restRequestConfigSchema/restRequestConfigSchema.mjs +23 -0
  214. package/dist/src/utils/validate/restRequestConfigSchema/routeConfigSchema/routeConfigSchema.mjs +33 -0
  215. package/dist/src/utils/validate/settingsSchema/settingsSchema.mjs +8 -0
  216. package/dist/src/utils/validate/staticPathSchema/staticPathSchema.mjs +12 -0
  217. package/dist/src/utils/validate/utils/entitiesSchema/entitiesSchema.mjs +24 -0
  218. package/dist/src/utils/validate/utils/index.mjs +4 -0
  219. package/dist/src/utils/validate/utils/plainObjectSchema/plainObjectSchema.mjs +5 -0
  220. package/dist/src/utils/validate/utils/sharedSchema/sharedSchema.mjs +6 -0
  221. package/dist/src/utils/validate/validateMockServerConfig.mjs +45 -0
  222. package/dist/src/utils/validate/wsConfigSchema/routeConfigSchema/routeConfigSchema.mjs +19 -0
  223. package/dist/src/utils/validate/wsConfigSchema/wsConfigSchema.mjs +12 -0
  224. package/package.json +18 -24
  225. package/dist/bin/bin.d.ts +0 -2
  226. package/dist/bin/bin.js +0 -10
  227. package/dist/bin/build.d.ts +0 -4
  228. package/dist/bin/build.js +0 -57
  229. package/dist/bin/cli.d.ts +0 -1
  230. package/dist/bin/cli.js +0 -57
  231. package/dist/bin/helpers/createTemplate.d.ts +0 -9
  232. package/dist/bin/helpers/createTemplate.js +0 -33
  233. package/dist/bin/helpers/index.d.ts +0 -4
  234. package/dist/bin/helpers/index.js +0 -21
  235. package/dist/bin/helpers/resolveConfigFile.d.ts +0 -2
  236. package/dist/bin/helpers/resolveConfigFile.js +0 -25
  237. package/dist/bin/helpers/resolveConfigFilePath.d.ts +0 -1
  238. package/dist/bin/helpers/resolveConfigFilePath.js +0 -23
  239. package/dist/bin/helpers/resolveExportsFromSourceCode.d.ts +0 -1
  240. package/dist/bin/helpers/resolveExportsFromSourceCode.js +0 -16
  241. package/dist/bin/init.d.ts +0 -2
  242. package/dist/bin/init.js +0 -115
  243. package/dist/bin/run.d.ts +0 -5
  244. package/dist/bin/run.js +0 -36
  245. package/dist/index.d.ts +0 -1
  246. package/dist/index.js +0 -18
  247. package/dist/src/core/database/createDatabaseRoutes/createDatabaseRoutes.d.ts +0 -3
  248. package/dist/src/core/database/createDatabaseRoutes/createDatabaseRoutes.js +0 -31
  249. package/dist/src/core/database/createDatabaseRoutes/helpers/array/createNewId/createNewId.d.ts +0 -4
  250. package/dist/src/core/database/createDatabaseRoutes/helpers/array/createNewId/createNewId.js +0 -19
  251. package/dist/src/core/database/createDatabaseRoutes/helpers/array/findIndexById/findIndexById.d.ts +0 -4
  252. package/dist/src/core/database/createDatabaseRoutes/helpers/array/findIndexById/findIndexById.js +0 -11
  253. package/dist/src/core/database/createDatabaseRoutes/helpers/array/index.d.ts +0 -3
  254. package/dist/src/core/database/createDatabaseRoutes/helpers/array/index.js +0 -20
  255. package/dist/src/core/database/createDatabaseRoutes/helpers/array/isIndex/isIndex.d.ts +0 -1
  256. package/dist/src/core/database/createDatabaseRoutes/helpers/array/isIndex/isIndex.js +0 -11
  257. package/dist/src/core/database/createDatabaseRoutes/helpers/createNestedDatabaseRoutes/createNestedDatabaseRoutes.d.ts +0 -4
  258. package/dist/src/core/database/createDatabaseRoutes/helpers/createNestedDatabaseRoutes/createNestedDatabaseRoutes.js +0 -160
  259. package/dist/src/core/database/createDatabaseRoutes/helpers/createRewrittenDatabaseRoutes/createRewrittenDatabaseRoutes.d.ts +0 -2
  260. package/dist/src/core/database/createDatabaseRoutes/helpers/createRewrittenDatabaseRoutes/createRewrittenDatabaseRoutes.js +0 -19
  261. package/dist/src/core/database/createDatabaseRoutes/helpers/createShallowDatabaseRoutes/createShallowDatabaseRoutes.d.ts +0 -4
  262. package/dist/src/core/database/createDatabaseRoutes/helpers/createShallowDatabaseRoutes/createShallowDatabaseRoutes.js +0 -95
  263. package/dist/src/core/database/createDatabaseRoutes/helpers/filter/filter.d.ts +0 -2
  264. package/dist/src/core/database/createDatabaseRoutes/helpers/filter/filter.js +0 -60
  265. package/dist/src/core/database/createDatabaseRoutes/helpers/index.d.ts +0 -5
  266. package/dist/src/core/database/createDatabaseRoutes/helpers/index.js +0 -22
  267. package/dist/src/core/database/createDatabaseRoutes/helpers/pagination/pagination.d.ts +0 -13
  268. package/dist/src/core/database/createDatabaseRoutes/helpers/pagination/pagination.js +0 -37
  269. package/dist/src/core/database/createDatabaseRoutes/helpers/search/search.d.ts +0 -3
  270. package/dist/src/core/database/createDatabaseRoutes/helpers/search/search.js +0 -39
  271. package/dist/src/core/database/createDatabaseRoutes/helpers/sort/sort.d.ts +0 -2
  272. package/dist/src/core/database/createDatabaseRoutes/helpers/sort/sort.js +0 -45
  273. package/dist/src/core/database/createDatabaseRoutes/helpers/splitDatabaseByNesting/splitDatabaseByNesting.d.ts +0 -5
  274. package/dist/src/core/database/createDatabaseRoutes/helpers/splitDatabaseByNesting/splitDatabaseByNesting.js +0 -31
  275. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.d.ts +0 -9
  276. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.js +0 -74
  277. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.d.ts +0 -11
  278. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.js +0 -61
  279. package/dist/src/core/database/createDatabaseRoutes/storages/Memory/MemoryStorage.d.ts +0 -8
  280. package/dist/src/core/database/createDatabaseRoutes/storages/Memory/MemoryStorage.js +0 -60
  281. package/dist/src/core/database/createDatabaseRoutes/storages/index.d.ts +0 -2
  282. package/dist/src/core/database/createDatabaseRoutes/storages/index.js +0 -19
  283. package/dist/src/core/database/createOrm/createOrm.d.ts +0 -2
  284. package/dist/src/core/database/createOrm/createOrm.js +0 -119
  285. package/dist/src/core/database/createStorage/createStorage.d.ts +0 -2
  286. package/dist/src/core/database/createStorage/createStorage.js +0 -13
  287. package/dist/src/core/database/index.d.ts +0 -3
  288. package/dist/src/core/database/index.js +0 -20
  289. package/dist/src/core/functions/graphql/graphql.d.ts +0 -54
  290. package/dist/src/core/functions/graphql/graphql.js +0 -126
  291. package/dist/src/core/functions/graphql/helpers/createQueueHandler/createQueueHandler.d.ts +0 -5
  292. package/dist/src/core/functions/graphql/helpers/createQueueHandler/createQueueHandler.js +0 -35
  293. package/dist/src/core/functions/graphql/helpers/index.d.ts +0 -1
  294. package/dist/src/core/functions/graphql/helpers/index.js +0 -18
  295. package/dist/src/core/functions/index.d.ts +0 -3
  296. package/dist/src/core/functions/index.js +0 -20
  297. package/dist/src/core/functions/mock.d.ts +0 -2
  298. package/dist/src/core/functions/mock.js +0 -11
  299. package/dist/src/core/functions/rest/helpers/createFileHandler/createFileHandler.d.ts +0 -2
  300. package/dist/src/core/functions/rest/helpers/createFileHandler/createFileHandler.js +0 -29
  301. package/dist/src/core/functions/rest/helpers/createQueueHandler/createQueueHandler.d.ts +0 -5
  302. package/dist/src/core/functions/rest/helpers/createQueueHandler/createQueueHandler.js +0 -35
  303. package/dist/src/core/functions/rest/helpers/formatSsePayload/formatSsePayload.d.ts +0 -5
  304. package/dist/src/core/functions/rest/helpers/formatSsePayload/formatSsePayload.js +0 -50
  305. package/dist/src/core/functions/rest/helpers/index.d.ts +0 -3
  306. package/dist/src/core/functions/rest/helpers/index.js +0 -20
  307. package/dist/src/core/functions/rest/index.d.ts +0 -1
  308. package/dist/src/core/functions/rest/index.js +0 -18
  309. package/dist/src/core/functions/rest/rest.d.ts +0 -114
  310. package/dist/src/core/functions/rest/rest.js +0 -171
  311. package/dist/src/core/graphql/createGraphQLRoute/createGraphQLRoute.d.ts +0 -8
  312. package/dist/src/core/graphql/createGraphQLRoute/createGraphQLRoute.js +0 -158
  313. package/dist/src/core/graphql/createGraphQLRoute/helpers/calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight.d.ts +0 -2
  314. package/dist/src/core/graphql/createGraphQLRoute/helpers/calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight.js +0 -34
  315. package/dist/src/core/graphql/createGraphQLRoute/helpers/index.d.ts +0 -3
  316. package/dist/src/core/graphql/createGraphQLRoute/helpers/index.js +0 -20
  317. package/dist/src/core/graphql/createGraphQLRoute/helpers/matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts.d.ts +0 -12
  318. package/dist/src/core/graphql/createGraphQLRoute/helpers/matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts.js +0 -28
  319. package/dist/src/core/graphql/createGraphQLRoute/helpers/prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts.d.ts +0 -2
  320. package/dist/src/core/graphql/createGraphQLRoute/helpers/prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts.js +0 -11
  321. package/dist/src/core/graphql/index.d.ts +0 -2
  322. package/dist/src/core/graphql/index.js +0 -19
  323. package/dist/src/core/middlewares/contextMiddleware/contextMiddleware.d.ts +0 -19
  324. package/dist/src/core/middlewares/contextMiddleware/contextMiddleware.js +0 -44
  325. package/dist/src/core/middlewares/cookieParseMiddleware/cookieParseMiddleware.d.ts +0 -2
  326. package/dist/src/core/middlewares/cookieParseMiddleware/cookieParseMiddleware.js +0 -21
  327. package/dist/src/core/middlewares/cookieParseMiddleware/helpers/index.d.ts +0 -1
  328. package/dist/src/core/middlewares/cookieParseMiddleware/helpers/index.js +0 -18
  329. package/dist/src/core/middlewares/cookieParseMiddleware/helpers/parseCookie/parseCookie.d.ts +0 -2
  330. package/dist/src/core/middlewares/cookieParseMiddleware/helpers/parseCookie/parseCookie.js +0 -22
  331. package/dist/src/core/middlewares/corsMiddleware/corsMiddleware.d.ts +0 -3
  332. package/dist/src/core/middlewares/corsMiddleware/corsMiddleware.js +0 -55
  333. package/dist/src/core/middlewares/corsMiddleware/helpers/getAllowedOrigins/getAllowedOrigins.d.ts +0 -2
  334. package/dist/src/core/middlewares/corsMiddleware/helpers/getAllowedOrigins/getAllowedOrigins.js +0 -21
  335. package/dist/src/core/middlewares/corsMiddleware/helpers/index.d.ts +0 -1
  336. package/dist/src/core/middlewares/corsMiddleware/helpers/index.js +0 -18
  337. package/dist/src/core/middlewares/destroyerMiddleware/destroyerMiddleware.d.ts +0 -6
  338. package/dist/src/core/middlewares/destroyerMiddleware/destroyerMiddleware.js +0 -29
  339. package/dist/src/core/middlewares/errorMiddleware/errorMiddleware.d.ts +0 -2
  340. package/dist/src/core/middlewares/errorMiddleware/errorMiddleware.js +0 -27
  341. package/dist/src/core/middlewares/index.d.ts +0 -8
  342. package/dist/src/core/middlewares/index.js +0 -25
  343. package/dist/src/core/middlewares/noCorsMiddleware/noCorsMiddleware.d.ts +0 -2
  344. package/dist/src/core/middlewares/noCorsMiddleware/noCorsMiddleware.js +0 -27
  345. package/dist/src/core/middlewares/requestInterceptorMiddleware/requestInterceptorMiddleware.d.ts +0 -9
  346. package/dist/src/core/middlewares/requestInterceptorMiddleware/requestInterceptorMiddleware.js +0 -20
  347. package/dist/src/core/middlewares/staticMiddleware/staticMiddleware.d.ts +0 -3
  348. package/dist/src/core/middlewares/staticMiddleware/staticMiddleware.js +0 -38
  349. package/dist/src/core/rest/createRestRoute/createRestRoute.d.ts +0 -8
  350. package/dist/src/core/rest/createRestRoute/createRestRoute.js +0 -190
  351. package/dist/src/core/rest/createRestRoute/helpers/calculateRestRouteConfigWeight/calculateRestRouteConfigWeight.d.ts +0 -2
  352. package/dist/src/core/rest/createRestRoute/helpers/calculateRestRouteConfigWeight/calculateRestRouteConfigWeight.js +0 -35
  353. package/dist/src/core/rest/createRestRoute/helpers/index.d.ts +0 -3
  354. package/dist/src/core/rest/createRestRoute/helpers/index.js +0 -20
  355. package/dist/src/core/rest/createRestRoute/helpers/matchRestRequestArtifacts/matchRestRequestArtifacts.d.ts +0 -11
  356. package/dist/src/core/rest/createRestRoute/helpers/matchRestRequestArtifacts/matchRestRequestArtifacts.js +0 -31
  357. package/dist/src/core/rest/createRestRoute/helpers/prepareRestRequestArtifacts/prepareRestRequestArtifacts.d.ts +0 -2
  358. package/dist/src/core/rest/createRestRoute/helpers/prepareRestRequestArtifacts/prepareRestRequestArtifacts.js +0 -37
  359. package/dist/src/core/rest/index.d.ts +0 -2
  360. package/dist/src/core/rest/index.js +0 -19
  361. package/dist/src/index.d.ts +0 -3
  362. package/dist/src/index.js +0 -20
  363. package/dist/src/server/createMockServer/createMockServer.d.ts +0 -3
  364. package/dist/src/server/createMockServer/createMockServer.js +0 -130
  365. package/dist/src/server/index.d.ts +0 -2
  366. package/dist/src/server/index.js +0 -19
  367. package/dist/src/server/startMockServer/startMockServer.d.ts +0 -4
  368. package/dist/src/server/startMockServer/startMockServer.js +0 -30
  369. package/dist/src/utils/constants/appPath.d.ts +0 -1
  370. package/dist/src/utils/constants/appPath.js +0 -11
  371. package/dist/src/utils/constants/checkModes.d.ts +0 -6
  372. package/dist/src/utils/constants/checkModes.js +0 -61
  373. package/dist/src/utils/constants/default.d.ts +0 -11
  374. package/dist/src/utils/constants/default.js +0 -21
  375. package/dist/src/utils/constants/index.d.ts +0 -3
  376. package/dist/src/utils/constants/index.js +0 -20
  377. package/dist/src/utils/helpers/asyncHandler.d.ts +0 -2
  378. package/dist/src/utils/helpers/asyncHandler.js +0 -11
  379. package/dist/src/utils/helpers/config/index.d.ts +0 -1
  380. package/dist/src/utils/helpers/config/index.js +0 -18
  381. package/dist/src/utils/helpers/config/resolveEntityValues/resolveEntityValues.d.ts +0 -20
  382. package/dist/src/utils/helpers/config/resolveEntityValues/resolveEntityValues.js +0 -77
  383. package/dist/src/utils/helpers/date/formatTimestamp/formatTimestamp.d.ts +0 -1
  384. package/dist/src/utils/helpers/date/formatTimestamp/formatTimestamp.js +0 -18
  385. package/dist/src/utils/helpers/date/index.d.ts +0 -1
  386. package/dist/src/utils/helpers/date/index.js +0 -18
  387. package/dist/src/utils/helpers/entities/convertToEntityDescriptor/convertToEntityDescriptor.d.ts +0 -2
  388. package/dist/src/utils/helpers/entities/convertToEntityDescriptor/convertToEntityDescriptor.js +0 -15
  389. package/dist/src/utils/helpers/entities/index.d.ts +0 -2
  390. package/dist/src/utils/helpers/entities/index.js +0 -19
  391. package/dist/src/utils/helpers/entities/isEntityDescriptor/isEntityDescriptor.d.ts +0 -2
  392. package/dist/src/utils/helpers/entities/isEntityDescriptor/isEntityDescriptor.js +0 -12
  393. package/dist/src/utils/helpers/files/index.d.ts +0 -2
  394. package/dist/src/utils/helpers/files/index.js +0 -19
  395. package/dist/src/utils/helpers/files/isFileDescriptor/isFileDescriptor.d.ts +0 -2
  396. package/dist/src/utils/helpers/files/isFileDescriptor/isFileDescriptor.js +0 -16
  397. package/dist/src/utils/helpers/files/isFilePathValid/isFilePathValid.d.ts +0 -1
  398. package/dist/src/utils/helpers/files/isFilePathValid/isFilePathValid.js +0 -26
  399. package/dist/src/utils/helpers/graphql/getGraphQLInput/getGraphQLInput.d.ts +0 -8
  400. package/dist/src/utils/helpers/graphql/getGraphQLInput/getGraphQLInput.js +0 -33
  401. package/dist/src/utils/helpers/graphql/index.d.ts +0 -3
  402. package/dist/src/utils/helpers/graphql/index.js +0 -20
  403. package/dist/src/utils/helpers/graphql/parseGraphQLRequest/parseGraphQLRequest.d.ts +0 -3
  404. package/dist/src/utils/helpers/graphql/parseGraphQLRequest/parseGraphQLRequest.js +0 -17
  405. package/dist/src/utils/helpers/graphql/parseQuery/parseQuery.d.ts +0 -7
  406. package/dist/src/utils/helpers/graphql/parseQuery/parseQuery.js +0 -28
  407. package/dist/src/utils/helpers/index.d.ts +0 -12
  408. package/dist/src/utils/helpers/index.js +0 -29
  409. package/dist/src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.d.ts +0 -8
  410. package/dist/src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.js +0 -32
  411. package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.d.ts +0 -15
  412. package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.js +0 -80
  413. package/dist/src/utils/helpers/interceptors/helpers/setDelay.d.ts +0 -1
  414. package/dist/src/utils/helpers/interceptors/helpers/setDelay.js +0 -14
  415. package/dist/src/utils/helpers/interceptors/index.d.ts +0 -2
  416. package/dist/src/utils/helpers/interceptors/index.js +0 -19
  417. package/dist/src/utils/helpers/isPlainObject/isPlainObject.d.ts +0 -1
  418. package/dist/src/utils/helpers/isPlainObject/isPlainObject.js +0 -11
  419. package/dist/src/utils/helpers/isPrimitive/isPrimitive.d.ts +0 -2
  420. package/dist/src/utils/helpers/isPrimitive/isPrimitive.js +0 -11
  421. package/dist/src/utils/helpers/logger/callRequestLogger/callRequestLogger.d.ts +0 -8
  422. package/dist/src/utils/helpers/logger/callRequestLogger/callRequestLogger.js +0 -50
  423. package/dist/src/utils/helpers/logger/callResponseLogger/callResponseLogger.d.ts +0 -10
  424. package/dist/src/utils/helpers/logger/callResponseLogger/callResponseLogger.js +0 -54
  425. package/dist/src/utils/helpers/logger/helpers/filterTokens/filterTokens.d.ts +0 -5
  426. package/dist/src/utils/helpers/logger/helpers/filterTokens/filterTokens.js +0 -44
  427. package/dist/src/utils/helpers/logger/helpers/formatTokens/formatTokens.d.ts +0 -2
  428. package/dist/src/utils/helpers/logger/helpers/formatTokens/formatTokens.js +0 -23
  429. package/dist/src/utils/helpers/logger/helpers/index.d.ts +0 -2
  430. package/dist/src/utils/helpers/logger/helpers/index.js +0 -19
  431. package/dist/src/utils/helpers/logger/index.d.ts +0 -2
  432. package/dist/src/utils/helpers/logger/index.js +0 -19
  433. package/dist/src/utils/helpers/sleep.d.ts +0 -1
  434. package/dist/src/utils/helpers/sleep.js +0 -13
  435. package/dist/src/utils/helpers/tests/createTmpDir.d.ts +0 -1
  436. package/dist/src/utils/helpers/tests/createTmpDir.js +0 -19
  437. package/dist/src/utils/helpers/tests/index.d.ts +0 -1
  438. package/dist/src/utils/helpers/tests/index.js +0 -18
  439. package/dist/src/utils/helpers/url/convertWin32PathToUnix/convertWin32PathToUnix.d.ts +0 -1
  440. package/dist/src/utils/helpers/url/convertWin32PathToUnix/convertWin32PathToUnix.js +0 -11
  441. package/dist/src/utils/helpers/url/index.d.ts +0 -3
  442. package/dist/src/utils/helpers/url/index.js +0 -20
  443. package/dist/src/utils/helpers/url/normalizeUrl/normalizeUrl.d.ts +0 -1
  444. package/dist/src/utils/helpers/url/normalizeUrl/normalizeUrl.js +0 -15
  445. package/dist/src/utils/helpers/url/urlJoin/urlJoin.d.ts +0 -1
  446. package/dist/src/utils/helpers/url/urlJoin/urlJoin.js +0 -22
  447. package/dist/src/utils/types/checkModes.d.ts +0 -18
  448. package/dist/src/utils/types/checkModes.js +0 -4
  449. package/dist/src/utils/types/database.d.ts +0 -36
  450. package/dist/src/utils/types/database.js +0 -4
  451. package/dist/src/utils/types/entities.d.ts +0 -18
  452. package/dist/src/utils/types/entities.js +0 -4
  453. package/dist/src/utils/types/files.d.ts +0 -5
  454. package/dist/src/utils/types/files.js +0 -4
  455. package/dist/src/utils/types/graphql.d.ts +0 -73
  456. package/dist/src/utils/types/graphql.js +0 -4
  457. package/dist/src/utils/types/index.d.ts +0 -12
  458. package/dist/src/utils/types/index.js +0 -29
  459. package/dist/src/utils/types/interceptors.d.ts +0 -40
  460. package/dist/src/utils/types/interceptors.js +0 -4
  461. package/dist/src/utils/types/logger.d.ts +0 -43
  462. package/dist/src/utils/types/logger.js +0 -4
  463. package/dist/src/utils/types/rest.d.ts +0 -77
  464. package/dist/src/utils/types/rest.js +0 -4
  465. package/dist/src/utils/types/server.d.ts +0 -79
  466. package/dist/src/utils/types/server.js +0 -4
  467. package/dist/src/utils/types/shared.d.ts +0 -1
  468. package/dist/src/utils/types/shared.js +0 -4
  469. package/dist/src/utils/types/utils.d.ts +0 -8
  470. package/dist/src/utils/types/utils.js +0 -4
  471. package/dist/src/utils/types/values.d.ts +0 -10
  472. package/dist/src/utils/types/values.js +0 -4
  473. package/dist/src/utils/validate/baseUrlSchema/baseUrlSchema.d.ts +0 -1
  474. package/dist/src/utils/validate/baseUrlSchema/baseUrlSchema.js +0 -12
  475. package/dist/src/utils/validate/corsSchema/corsSchema.d.ts +0 -23
  476. package/dist/src/utils/validate/corsSchema/corsSchema.js +0 -35
  477. package/dist/src/utils/validate/databaseConfigSchema/databaseConfigSchema.d.ts +0 -11
  478. package/dist/src/utils/validate/databaseConfigSchema/databaseConfigSchema.js +0 -22
  479. package/dist/src/utils/validate/getMostSpecificPathFromError.d.ts +0 -2
  480. package/dist/src/utils/validate/getMostSpecificPathFromError.js +0 -40
  481. package/dist/src/utils/validate/getValidationMessageFromPath.d.ts +0 -1
  482. package/dist/src/utils/validate/getValidationMessageFromPath.js +0 -14
  483. package/dist/src/utils/validate/graphqlConfigSchema/graphqlConfigSchema.d.ts +0 -193
  484. package/dist/src/utils/validate/graphqlConfigSchema/graphqlConfigSchema.js +0 -55
  485. package/dist/src/utils/validate/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +0 -17
  486. package/dist/src/utils/validate/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.js +0 -30
  487. package/dist/src/utils/validate/index.d.ts +0 -12
  488. package/dist/src/utils/validate/index.js +0 -29
  489. package/dist/src/utils/validate/interceptorsSchema/interceptorsSchema.d.ts +0 -11
  490. package/dist/src/utils/validate/interceptorsSchema/interceptorsSchema.js +0 -15
  491. package/dist/src/utils/validate/portSchema/portSchema.d.ts +0 -2
  492. package/dist/src/utils/validate/portSchema/portSchema.js +0 -13
  493. package/dist/src/utils/validate/queueSchema/queueSchema.d.ts +0 -11
  494. package/dist/src/utils/validate/queueSchema/queueSchema.js +0 -18
  495. package/dist/src/utils/validate/restConfigSchema/restConfigSchema.d.ts +0 -451
  496. package/dist/src/utils/validate/restConfigSchema/restConfigSchema.js +0 -45
  497. package/dist/src/utils/validate/restConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +0 -18
  498. package/dist/src/utils/validate/restConfigSchema/routeConfigSchema/routeConfigSchema.js +0 -42
  499. package/dist/src/utils/validate/settingsSchema/settingsSchema.d.ts +0 -11
  500. package/dist/src/utils/validate/settingsSchema/settingsSchema.js +0 -15
  501. package/dist/src/utils/validate/staticPathSchema/staticPathSchema.d.ts +0 -20
  502. package/dist/src/utils/validate/staticPathSchema/staticPathSchema.js +0 -24
  503. package/dist/src/utils/validate/utils/checkModeSchema/checkModeSchema.d.ts +0 -23
  504. package/dist/src/utils/validate/utils/checkModeSchema/checkModeSchema.js +0 -53
  505. package/dist/src/utils/validate/utils/entitiesSchema/entitiesSchema.d.ts +0 -4
  506. package/dist/src/utils/validate/utils/entitiesSchema/entitiesSchema.js +0 -94
  507. package/dist/src/utils/validate/utils/extendedDiscriminatedUnion/extendedDiscriminatedUnion.d.ts +0 -8
  508. package/dist/src/utils/validate/utils/extendedDiscriminatedUnion/extendedDiscriminatedUnion.js +0 -46
  509. package/dist/src/utils/validate/utils/index.d.ts +0 -6
  510. package/dist/src/utils/validate/utils/index.js +0 -23
  511. package/dist/src/utils/validate/utils/jsonSchema/jsonSchema.d.ts +0 -8
  512. package/dist/src/utils/validate/utils/jsonSchema/jsonSchema.js +0 -33
  513. package/dist/src/utils/validate/utils/nestedObjectOrArraySchema/nestedObjectOrArraySchema.d.ts +0 -3
  514. package/dist/src/utils/validate/utils/nestedObjectOrArraySchema/nestedObjectOrArraySchema.js +0 -22
  515. package/dist/src/utils/validate/utils/plainObjectSchema/plainObjectSchema.d.ts +0 -2
  516. package/dist/src/utils/validate/utils/plainObjectSchema/plainObjectSchema.js +0 -12
  517. package/dist/src/utils/validate/utils/requiredPropertiesSchema/requiredPropertiesSchema.d.ts +0 -3
  518. package/dist/src/utils/validate/utils/requiredPropertiesSchema/requiredPropertiesSchema.js +0 -13
  519. package/dist/src/utils/validate/utils/sharedSchema/sharedSchema.d.ts +0 -3
  520. package/dist/src/utils/validate/utils/sharedSchema/sharedSchema.js +0 -21
  521. package/dist/src/utils/validate/validateFlatMockServerConfig.d.ts +0 -2
  522. package/dist/src/utils/validate/validateFlatMockServerConfig.js +0 -53
  523. package/dist/src/utils/validate/validateMockServerConfig.d.ts +0 -2
  524. package/dist/src/utils/validate/validateMockServerConfig.js +0 -53
package/README.md CHANGED
@@ -223,6 +223,7 @@ fetch("http://localhost:31299/graphql", {
223
223
  .then((data) => console.log(data)); // { emoji: '🦁', name: 'Nursultan' }
224
224
  ```
225
225
 
226
+ // TODO: rewrite to handlers
226
227
  #### Entity descriptors
227
228
 
228
229
  If you need more complex logic for matching entities, you can use entity descriptors.
@@ -241,7 +242,7 @@ Allowed `checkModes`
241
242
  - endsWith - checks actual value for ending with descriptor value.
242
243
  - notEndsWith - checks actual value for non-ending with descriptor value.
243
244
  - regExp - checks actual value with descriptor regExp.
244
- - function - checks actual value with descriptor function.
245
+ - fn - checks actual value with descriptor function.
245
246
 
246
247
  ```javascript
247
248
  /** @type {import('mock-config-server').FlatMockServerConfig} */
@@ -290,58 +291,10 @@ const flatMockServerConfig = [
290
291
  export default flatMockServerConfig;
291
292
  ```
292
293
 
293
- #### Descriptor _oneOf_ property
294
-
295
- For `checkMode` with the `value` property (all `checkMode` options except `exists` and `notExists`) you can use an array as value.
296
- Mock server will find matches by iterating through the array until **some** match is found.
297
- To be able to use this functionality you need to explicitly set `oneOf: true` property in descriptor object.
298
-
299
- ```javascript
300
- /** @type {import('mock-config-server').FlatMockServerConfig} */
301
- const flatMockServerConfig = [
302
- {
303
- baseUrl: "/api",
304
- },
305
- {
306
- configs: [
307
- {
308
- path: "/user",
309
- method: "post",
310
- routes: [
311
- {
312
- entities: {
313
- // if body equals to { key1: 'value1' } OR { key2: 'value2' } then mock-config-server return 'Some user data 1'
314
- body: {
315
- checkMode: "equals",
316
- value: [{ key1: "value1" }, { key2: "value2" }],
317
- oneOf: true,
318
- },
319
- },
320
- data: "Some user data 1",
321
- },
322
- {
323
- entities: {
324
- // if body equals to [{ key1: 'value1' }, { key2: 'value2' }] then mock-config-server return 'Some user data 2'
325
- // NO `oneOf` => array processed entirely
326
- body: {
327
- checkMode: "equals",
328
- value: [{ key1: "value1" }, { key2: "value2" }],
329
- },
330
- },
331
- data: "Some user data 2",
332
- },
333
- ],
334
- },
335
- ],
336
- },
337
- ];
338
-
339
- export default flatMockServerConfig;
340
- ```
341
-
294
+ // TODO: rewrite
342
295
  #### Function check mode
343
296
 
344
- `function checkMode` is the most powerful way to describe your `entities` logic, but in most cases you will be fine using other `checkModes`.
297
+ `fn checkMode` is the most powerful way to describe your `entities` logic, but in most cases you will be fine using other `checkModes`.
345
298
 
346
299
  `Function value` has the following signature `(actualValue, checkFunction) => boolean`.
347
300
  Return `true` if `actualValue` matches your logic or `false` otherwise.
@@ -365,14 +318,14 @@ const flatMockServerConfig = [
365
318
  entities: {
366
319
  params: {
367
320
  postId: {
368
- checkMode: "function",
321
+ checkMode: "fn",
369
322
  value: (actualValue) =>
370
323
  +actualValue >= 0 && +actualValue <= 50,
371
324
  },
372
325
  },
373
326
  cookies: {
374
327
  authToken: {
375
- checkMode: "function",
328
+ checkMode: "fn",
376
329
  value: (actualValue, checkFunction) =>
377
330
  checkFunction("equals", actualValue, 123) ||
378
331
  checkFunction("startsWith", actualValue, 2),
@@ -0,0 +1,6 @@
1
+ import { createRequire } from "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
+ //#endregion
6
+ export { __commonJSMin, __require };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { __require } from "../_virtual/_rolldown/runtime.mjs";
3
+ import { require_package } from "../package.mjs";
4
+ //#region bin/bin.ts
5
+ __require("please-upgrade-node")(require_package());
6
+ import("./cli.mjs").then(({ cli }) => cli());
7
+ //#endregion
8
+ export {};
@@ -0,0 +1,43 @@
1
+ import { resolveConfigFile } from "./helpers/resolveConfigFile.mjs";
2
+ import { resolveConfigFilePath } from "./helpers/resolveConfigFilePath.mjs";
3
+ import "./helpers/index.mjs";
4
+ import { run } from "./run.mjs";
5
+ import { build, context } from "esbuild";
6
+ //#region bin/build.ts
7
+ const build$1 = async (argv) => {
8
+ const configFilePath = resolveConfigFilePath(argv.config);
9
+ if (!configFilePath) throw new Error("Cannot find config file mock-server.config.(ts|mts|cts|js|mjs|cjs)");
10
+ const buildOptions = {
11
+ entryPoints: [configFilePath],
12
+ bundle: true,
13
+ platform: "node",
14
+ target: "esnext",
15
+ minifySyntax: true,
16
+ minify: true,
17
+ write: false,
18
+ metafile: false,
19
+ logLevel: "info",
20
+ format: "esm",
21
+ plugins: []
22
+ };
23
+ if (argv.watch) {
24
+ buildOptions.plugins.push({
25
+ name: "watch",
26
+ setup: (build) => {
27
+ let instance;
28
+ build.onStart(() => {
29
+ instance?.destroy();
30
+ });
31
+ build.onEnd((result) => {
32
+ if (!result.errors.length) instance = run(resolveConfigFile(result.outputFiles[0].text), argv);
33
+ });
34
+ }
35
+ });
36
+ (await context(buildOptions)).watch();
37
+ return;
38
+ }
39
+ const { outputFiles } = await build(buildOptions);
40
+ return run(resolveConfigFile(outputFiles[0].text), argv);
41
+ };
42
+ //#endregion
43
+ export { build$1 as build };
@@ -0,0 +1,41 @@
1
+ import { build } from "./build.mjs";
2
+ import { init } from "./init.mjs";
3
+ import yargs from "yargs";
4
+ import { hideBin } from "yargs/helpers";
5
+ //#region bin/cli.ts
6
+ const initOptions = {
7
+ baseUrl: {
8
+ alias: "b",
9
+ description: "Set base url for mock server",
10
+ type: "string"
11
+ },
12
+ port: {
13
+ alias: "p",
14
+ description: "Set port for server",
15
+ type: "number"
16
+ },
17
+ staticPath: {
18
+ alias: "s",
19
+ description: "Set static path for mock server",
20
+ type: "string"
21
+ }
22
+ };
23
+ const cli = () => {
24
+ const processArgv = hideBin(process.argv);
25
+ if (processArgv.includes("init")) return init(yargs(processArgv).options(initOptions).parse());
26
+ build(yargs(processArgv).usage("mcs [options]").epilogue("More info: https://github.com/siberiacancode/mock-config-server#readme").options({
27
+ ...initOptions,
28
+ config: {
29
+ alias: "c",
30
+ description: "Set path to config file",
31
+ type: "string"
32
+ },
33
+ watch: {
34
+ alias: "w",
35
+ description: "Enables server restart after config file changes",
36
+ type: "boolean"
37
+ }
38
+ }).version().alias("version", "v").help().alias("help", "h").parse());
39
+ };
40
+ //#endregion
41
+ export { cli };
@@ -0,0 +1,21 @@
1
+ import { APP_PATH } from "../../src/utils/constants/appPath.mjs";
2
+ import { DEFAULT } from "../../src/utils/constants/default.mjs";
3
+ import "../../src/utils/constants/index.mjs";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ //#region bin/helpers/createTemplate.ts
7
+ const createTemplate = (options) => {
8
+ const language = options.withTypescript ? "ts" : "js";
9
+ const templatePath = path.join(__dirname, "..", `templates/${language}/${options.apiType}`);
10
+ fs.cpSync(`${templatePath}/mock-requests`, `${APP_PATH}/mock-requests`, {
11
+ recursive: true,
12
+ force: true
13
+ });
14
+ let mockServerConfig = fs.readFileSync(`${templatePath}/mock-server.config.${language}`, "utf8");
15
+ if (options.staticPath !== "/") mockServerConfig = mockServerConfig.replace(`port: ${DEFAULT.PORT}`, `port: ${DEFAULT.PORT},\n\u0020\u0020\u0020\u0020staticPath: '${options.staticPath}'`);
16
+ mockServerConfig = mockServerConfig.replace(`port: ${DEFAULT.PORT}`, `port: ${options.port.toString()}`);
17
+ mockServerConfig = mockServerConfig.replace("baseUrl: '/'", `baseUrl: '${options.baseUrl}'`);
18
+ fs.writeFileSync(`${APP_PATH}/mock-server.config.${language}`, mockServerConfig);
19
+ };
20
+ //#endregion
21
+ export { createTemplate };
@@ -0,0 +1,5 @@
1
+ import "./createTemplate.mjs";
2
+ import "./resolveExportsFromSourceCode.mjs";
3
+ import "./resolveConfigFile.mjs";
4
+ import "./resolveConfigFilePath.mjs";
5
+ export {};
@@ -0,0 +1,13 @@
1
+ import { APP_PATH } from "../../src/utils/constants/appPath.mjs";
2
+ import "../../src/utils/constants/index.mjs";
3
+ import { resolveExportsFromSourceCode } from "./resolveExportsFromSourceCode.mjs";
4
+ //#region bin/helpers/resolveConfigFile.ts
5
+ const resolveConfigFile = (configSourceCode) => {
6
+ if (!configSourceCode) throw new Error("Cannot handle source code of mock-server.config.(ts|js)");
7
+ const mockServerConfig = resolveExportsFromSourceCode(configSourceCode, APP_PATH).default;
8
+ if (!mockServerConfig) throw new Error("Cannot handle exports of mock-server.config.(ts|js)");
9
+ if (!Array.isArray(mockServerConfig)) throw new TypeError("configuration should be array config; see our doc (https://www.npmjs.com/package/mock-config-server) for more information");
10
+ return mockServerConfig;
11
+ };
12
+ //#endregion
13
+ export { resolveConfigFile };
@@ -0,0 +1,11 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ //#region bin/helpers/resolveConfigFilePath.ts
4
+ const resolveConfigFilePath = (cliConfigFilePath) => {
5
+ const appPath = process.cwd();
6
+ if (cliConfigFilePath) return path.resolve(appPath, cliConfigFilePath);
7
+ const configFileNameRegex = /mock-server.config.(?:ts|mts|cts|js|mjs|cjs)/;
8
+ return fs.readdirSync(appPath).find((fileName) => configFileNameRegex.test(fileName));
9
+ };
10
+ //#endregion
11
+ export { resolveConfigFilePath };
@@ -0,0 +1,14 @@
1
+ import { Module, createRequire } from "node:module";
2
+ import path from "node:path";
3
+ //#region bin/helpers/resolveExportsFromSourceCode.ts
4
+ const resolveExportsFromSourceCode = (sourceCode, configDirname) => {
5
+ const filename = path.join(configDirname, "mock-server.config.cjs");
6
+ const requireFromConfig = createRequire(filename);
7
+ const moduleInstance = new Module(filename);
8
+ moduleInstance.filename = filename;
9
+ moduleInstance.paths = requireFromConfig.resolve.paths("mock-server.config.cjs") ?? [];
10
+ moduleInstance._compile(sourceCode, moduleInstance.filename);
11
+ return moduleInstance.exports;
12
+ };
13
+ //#endregion
14
+ export { resolveExportsFromSourceCode };
@@ -0,0 +1,104 @@
1
+ import { baseUrlSchema } from "../src/utils/validate/baseUrlSchema/baseUrlSchema.mjs";
2
+ import { portSchema } from "../src/utils/validate/portSchema/portSchema.mjs";
3
+ import { staticPathSchema } from "../src/utils/validate/staticPathSchema/staticPathSchema.mjs";
4
+ import "../src/utils/validate/index.mjs";
5
+ import { createTemplate } from "./helpers/createTemplate.mjs";
6
+ import "./helpers/index.mjs";
7
+ import color from "ansi-colors";
8
+ import prompts from "prompts";
9
+ //#region bin/init.ts
10
+ const init = async (argv) => {
11
+ try {
12
+ const response = await prompts([
13
+ {
14
+ name: "withTypescript",
15
+ type: "toggle",
16
+ message: "Would you like to use TypeScript?",
17
+ initial: true,
18
+ active: "Yes",
19
+ inactive: "No"
20
+ },
21
+ {
22
+ type: "select",
23
+ name: "apiType",
24
+ message: "Choose API type",
25
+ initial: 0,
26
+ choices: [
27
+ {
28
+ title: "REST",
29
+ description: "REST API sample",
30
+ value: "rest"
31
+ },
32
+ {
33
+ title: "GraphQL",
34
+ description: "GraphQL API sample",
35
+ value: "graphql"
36
+ },
37
+ {
38
+ title: "Both",
39
+ description: "REST API and GraphQL API sample",
40
+ value: "full"
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ name: "baseUrl",
46
+ type: argv.baseUrl ? null : "text",
47
+ message: "Base URL (must start with a forward slash):",
48
+ initial: "/",
49
+ validate: (baseUrl) => {
50
+ try {
51
+ baseUrlSchema.parse(baseUrl);
52
+ return true;
53
+ } catch {
54
+ return "Invalid base URL value";
55
+ }
56
+ }
57
+ },
58
+ {
59
+ name: "port",
60
+ type: argv.port ? null : "number",
61
+ message: "Port:",
62
+ initial: 31299,
63
+ validate: (port) => {
64
+ try {
65
+ portSchema.parse(+port);
66
+ return true;
67
+ } catch {
68
+ return "Invalid port value";
69
+ }
70
+ }
71
+ },
72
+ {
73
+ name: "staticPath",
74
+ type: argv.staticPath ? null : "text",
75
+ message: "Static path (must start with a forward slash):",
76
+ initial: "/",
77
+ validate: (staticPath) => {
78
+ try {
79
+ staticPathSchema.parse(staticPath);
80
+ return true;
81
+ } catch {
82
+ return "Invalid static path value";
83
+ }
84
+ }
85
+ }
86
+ ], { onCancel: () => {
87
+ throw new Error("❌ Operation cancelled");
88
+ } });
89
+ await createTemplate({
90
+ ...argv,
91
+ ...response
92
+ });
93
+ const userAgent = process.env.npm_config_user_agent ?? "";
94
+ const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : "npx";
95
+ console.log("\n");
96
+ console.log(color.bold("🎉 Thanks for using mock-config-server! 🎉"));
97
+ console.log(`start command: ${color.bold(color.green(`${packageManager} mcs`))}`);
98
+ } catch (cancelled) {
99
+ console.log(cancelled?.message);
100
+ process.exit(1);
101
+ }
102
+ };
103
+ //#endregion
104
+ export { init };
@@ -0,0 +1,19 @@
1
+ import { startMockServer } from "../src/server/startMockServer/startMockServer.mjs";
2
+ import "../src/server/index.mjs";
3
+ //#region bin/run.ts
4
+ const run = (mockServerConfig, { baseUrl, port, staticPath }) => {
5
+ try {
6
+ const [option, ...mockServerComponents] = mockServerConfig;
7
+ const mockServerSettings = !("configs" in option) ? option : void 0;
8
+ return startMockServer([{
9
+ ...mockServerSettings,
10
+ ...baseUrl && { baseUrl },
11
+ ...port && { port },
12
+ ...staticPath && { staticPath }
13
+ }, ...mockServerSettings ? mockServerComponents : mockServerConfig]);
14
+ } catch (error) {
15
+ console.error(error.message);
16
+ }
17
+ };
18
+ //#endregion
19
+ export { run };
@@ -0,0 +1,42 @@
1
+ import { endsWith } from "./src/core/entities/handlers/endsWith.mjs";
2
+ import { equals } from "./src/core/entities/handlers/equals.mjs";
3
+ import { BodyEntity, Comparator, MappedEntity, VariablesEntity } from "./src/utils/types/entities.mjs";
4
+ import { Database, DatabaseConfig, NestedDatabase, NestedDatabaseId, NestedOrm, Orm, ShallowDatabase, ShallowOrm, Storage, StorageIndex } from "./src/utils/types/database.mjs";
5
+ import { Cookies, Data, Headers, Params, PlainObject, Primitive, Query } from "./src/utils/types/values.mjs";
6
+ import { Entries, MaybePromise, ValueOf } from "./src/utils/types/utils.mjs";
7
+ import { GraphqlTransportWsCompleteMessage, GraphqlTransportWsConnectionAckMessage, GraphqlTransportWsConnectionInitMessage, GraphqlTransportWsDataResponse, GraphqlTransportWsEntitiesByEntityName, GraphqlTransportWsErrorMessage, GraphqlTransportWsExecutionResult, GraphqlTransportWsMessage, GraphqlTransportWsMessagePayload, GraphqlTransportWsNextMessage, GraphqlTransportWsOperationId, GraphqlTransportWsOperationType, GraphqlTransportWsParams, GraphqlTransportWsPingMessage, GraphqlTransportWsPongMessage, GraphqlTransportWsRequestConfig, GraphqlTransportWsRouteConfig, GraphqlTransportWsSettings, GraphqlTransportWsSubscribeMessage } from "./src/utils/types/graphql-transport-ws.mjs";
8
+ import { ConnectionWsRequestArtifact, GraphqlTransportWsRequestArtifact, RawWsRequestArtifact, WsConnectionDataResponse, WsConnectionEntitiesByEntityName, WsConnectionEntityName, WsConnectionParams, WsConnectionRequestConfig, WsConnectionRouteConfig, WsDataResponse, WsFrame, WsFrameBinary, WsFrameText, WsParams, WsRawRequestConfig, WsRawRouteConfig, WsRequestArtifact, WsRequestConfig, WsSettings } from "./src/utils/types/ws.mjs";
9
+ import { BaseServerConfig, BaseUrl, MockServerCliArgv, MockServerComponent, MockServerConfig, MockServerSettings, Port, StaticPath } from "./src/utils/types/server.mjs";
10
+ import { GraphQLDataResponse, GraphQLDataResponseFunction, GraphQLEntitiesByEntityName, GraphQLEntity, GraphQLEntityName, GraphQLExecutionResult, GraphQLIdentifier, GraphQLOperationType, GraphQLParams, GraphQLRequestArtifact, GraphQLRequestConfig, GraphQLRouteConfig, GraphQLSettings } from "./src/utils/types/graphql.mjs";
11
+ import { ApiType } from "./src/utils/types/shared.mjs";
12
+ import { Logger, LoggerBaseTokens, LoggerOptions, LoggerTokens, LoggerType } from "./src/utils/types/logger.mjs";
13
+ import { Interceptors, RequestInterceptor, RequestInterceptorParams, ResponseInterceptor, ResponseInterceptorParams } from "./src/utils/types/interceptors.mjs";
14
+ import { BaseRestRequestConfig, RestDataResponse, RestDataResponseFunction, RestEntitiesByEntityName, RestEntity, RestEntityName, RestEntityNamesByMethod, RestFileResponse, RestMethod, RestParams, RestPathString, RestRequestArtifact, RestRequestConfig, RestRouteConfig, RestSettings } from "./src/utils/types/rest.mjs";
15
+ import { Cors, CorsHeader, CorsOrigin } from "./src/utils/types/cors.mjs";
16
+ import { FileDescriptor } from "./src/utils/types/files.mjs";
17
+ import { every } from "./src/core/entities/handlers/every.mjs";
18
+ import { exists } from "./src/core/entities/handlers/exists.mjs";
19
+ import { fn } from "./src/core/entities/handlers/fn.mjs";
20
+ import { greater } from "./src/core/entities/handlers/greater.mjs";
21
+ import { greaterOrEquals } from "./src/core/entities/handlers/greaterOrEquals.mjs";
22
+ import { haveEntries } from "./src/core/entities/handlers/haveEntries.mjs";
23
+ import { haveType } from "./src/core/entities/handlers/haveType.mjs";
24
+ import { includes } from "./src/core/entities/handlers/includes.mjs";
25
+ import { inRange } from "./src/core/entities/handlers/inRange.mjs";
26
+ import { length } from "./src/core/entities/handlers/length.mjs";
27
+ import { less } from "./src/core/entities/handlers/less.mjs";
28
+ import { lessOrEquals } from "./src/core/entities/handlers/lessOrEquals.mjs";
29
+ import { maxLength } from "./src/core/entities/handlers/maxLength.mjs";
30
+ import { minLength } from "./src/core/entities/handlers/minLength.mjs";
31
+ import { not } from "./src/core/entities/handlers/not.mjs";
32
+ import { oneOf } from "./src/core/entities/handlers/oneOf.mjs";
33
+ import { regExp } from "./src/core/entities/handlers/regExp.mjs";
34
+ import { some } from "./src/core/entities/handlers/some.mjs";
35
+ import { startsWith } from "./src/core/entities/handlers/startsWith.mjs";
36
+ import { graphql } from "./src/core/functions/graphql/graphql.mjs";
37
+ import { mock } from "./src/core/functions/mock.mjs";
38
+ import { rest } from "./src/core/functions/rest/rest.mjs";
39
+ import { createWsConnectionRequestConfig, createWsMessageRequestConfig, ws } from "./src/core/functions/ws/ws.mjs";
40
+ import { createMockServer } from "./src/server/createMockServer/createMockServer.mjs";
41
+ import { startMockServer } from "./src/server/startMockServer/startMockServer.mjs";
42
+ export { ApiType, BaseRestRequestConfig, BaseServerConfig, BaseUrl, BodyEntity, Comparator, ConnectionWsRequestArtifact, Cookies, Cors, CorsHeader, CorsOrigin, Data, Database, DatabaseConfig, Entries, FileDescriptor, GraphQLDataResponse, GraphQLDataResponseFunction, GraphQLEntitiesByEntityName, GraphQLEntity, GraphQLEntityName, GraphQLExecutionResult, GraphQLIdentifier, GraphQLOperationType, GraphQLParams, GraphQLRequestArtifact, GraphQLRequestConfig, GraphQLRouteConfig, GraphQLSettings, GraphqlTransportWsCompleteMessage, GraphqlTransportWsConnectionAckMessage, GraphqlTransportWsConnectionInitMessage, GraphqlTransportWsDataResponse, GraphqlTransportWsEntitiesByEntityName, GraphqlTransportWsErrorMessage, GraphqlTransportWsExecutionResult, GraphqlTransportWsMessage, GraphqlTransportWsMessagePayload, GraphqlTransportWsNextMessage, GraphqlTransportWsOperationId, GraphqlTransportWsOperationType, GraphqlTransportWsParams, GraphqlTransportWsPingMessage, GraphqlTransportWsPongMessage, GraphqlTransportWsRequestArtifact, GraphqlTransportWsRequestConfig, GraphqlTransportWsRouteConfig, GraphqlTransportWsSettings, GraphqlTransportWsSubscribeMessage, Headers, Interceptors, Logger, LoggerBaseTokens, LoggerOptions, LoggerTokens, LoggerType, MappedEntity, MaybePromise, MockServerCliArgv, MockServerComponent, MockServerConfig, MockServerSettings, NestedDatabase, NestedDatabaseId, NestedOrm, Orm, Params, PlainObject, Port, Primitive, Query, RawWsRequestArtifact, RequestInterceptor, RequestInterceptorParams, ResponseInterceptor, ResponseInterceptorParams, RestDataResponse, RestDataResponseFunction, RestEntitiesByEntityName, RestEntity, RestEntityName, RestEntityNamesByMethod, RestFileResponse, RestMethod, RestParams, RestPathString, RestRequestArtifact, RestRequestConfig, RestRouteConfig, RestSettings, ShallowDatabase, ShallowOrm, StaticPath, Storage, StorageIndex, ValueOf, VariablesEntity, WsConnectionDataResponse, WsConnectionEntitiesByEntityName, WsConnectionEntityName, WsConnectionParams, WsConnectionRequestConfig, WsConnectionRouteConfig, WsDataResponse, WsFrame, WsFrameBinary, WsFrameText, WsParams, WsRawRequestConfig, WsRawRouteConfig, WsRequestArtifact, WsRequestConfig, WsSettings, createMockServer, createWsConnectionRequestConfig, createWsMessageRequestConfig, endsWith, equals, every, exists, fn, graphql, greater, greaterOrEquals, haveEntries, haveType, inRange, includes, length, less, lessOrEquals, maxLength, minLength, mock, not, oneOf, regExp, rest, some, startMockServer, startsWith, ws };
package/dist/index.mjs ADDED
@@ -0,0 +1,29 @@
1
+ import { endsWith } from "./src/core/entities/handlers/endsWith.mjs";
2
+ import { equals } from "./src/core/entities/handlers/equals.mjs";
3
+ import { every } from "./src/core/entities/handlers/every.mjs";
4
+ import { exists } from "./src/core/entities/handlers/exists.mjs";
5
+ import { fn } from "./src/core/entities/handlers/fn.mjs";
6
+ import { greater } from "./src/core/entities/handlers/greater.mjs";
7
+ import { greaterOrEquals } from "./src/core/entities/handlers/greaterOrEquals.mjs";
8
+ import { haveEntries } from "./src/core/entities/handlers/haveEntries.mjs";
9
+ import { haveType } from "./src/core/entities/handlers/haveType.mjs";
10
+ import { includes } from "./src/core/entities/handlers/includes.mjs";
11
+ import { inRange } from "./src/core/entities/handlers/inRange.mjs";
12
+ import { length } from "./src/core/entities/handlers/length.mjs";
13
+ import { less } from "./src/core/entities/handlers/less.mjs";
14
+ import { lessOrEquals } from "./src/core/entities/handlers/lessOrEquals.mjs";
15
+ import { maxLength } from "./src/core/entities/handlers/maxLength.mjs";
16
+ import { minLength } from "./src/core/entities/handlers/minLength.mjs";
17
+ import { not } from "./src/core/entities/handlers/not.mjs";
18
+ import { oneOf } from "./src/core/entities/handlers/oneOf.mjs";
19
+ import { regExp } from "./src/core/entities/handlers/regExp.mjs";
20
+ import { some } from "./src/core/entities/handlers/some.mjs";
21
+ import { startsWith } from "./src/core/entities/handlers/startsWith.mjs";
22
+ import { graphql } from "./src/core/functions/graphql/graphql.mjs";
23
+ import { mock } from "./src/core/functions/mock.mjs";
24
+ import { rest } from "./src/core/functions/rest/rest.mjs";
25
+ import { createWsConnectionRequestConfig, createWsMessageRequestConfig, ws } from "./src/core/functions/ws/ws.mjs";
26
+ import { createMockServer } from "./src/server/createMockServer/createMockServer.mjs";
27
+ import { startMockServer } from "./src/server/startMockServer/startMockServer.mjs";
28
+ import "./src/index.mjs";
29
+ export { createMockServer, createWsConnectionRequestConfig, createWsMessageRequestConfig, endsWith, equals, every, exists, fn, graphql, greater, greaterOrEquals, haveEntries, haveType, inRange, includes, length, less, lessOrEquals, maxLength, minLength, mock, not, oneOf, regExp, rest, some, startMockServer, startsWith, ws };
@@ -0,0 +1,90 @@
1
+ import { __commonJSMin } from "./_virtual/_rolldown/runtime.mjs";
2
+ //#region package.json
3
+ var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ module.exports = {
5
+ "name": "mock-config-server",
6
+ "version": "5.0.0-beta.3",
7
+ "description": "Tool that easily and quickly imitates server operation, create full fake api in few steps",
8
+ "author": {
9
+ "name": "SIBERIA CAN CODE 🧊",
10
+ "url": "https://github.com/siberiacancode"
11
+ },
12
+ "license": "MIT",
13
+ "homepage": "https://github.com/siberiacancode/mock-config",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/siberiacancode/mock-config-server.git"
17
+ },
18
+ "bugs": { "url": "https://github.com/siberiacancode/mock-config/issues" },
19
+ "keywords": [
20
+ "server",
21
+ "fake",
22
+ "REST",
23
+ "rest",
24
+ "API",
25
+ "api",
26
+ "mock",
27
+ "mocking",
28
+ "config",
29
+ "data"
30
+ ],
31
+ "main": "dist/index.mjs",
32
+ "types": "./dist/index.d.mts",
33
+ "bin": {
34
+ "mock-config-server": "dist/bin/bin.mjs",
35
+ "mcs": "dist/bin/bin.mjs"
36
+ },
37
+ "files": ["dist"],
38
+ "engines": { "node": ">=20.19.0" },
39
+ "scripts": {
40
+ "prepublishOnly": "git diff --exit-code",
41
+ "lint-staged": "lint-staged",
42
+ "prepare": "husky && pnpm build",
43
+ "build": "tsdown",
44
+ "start": "pnpm build && node ./dist/bin/bin.mjs",
45
+ "dev": "nodemon --watch src --watch bin --watch mock-server.config.* -e js,ts --exec \"pnpm start\"",
46
+ "type": "tsc --noEmit",
47
+ "unit-test": "vitest",
48
+ "lint": "eslint . --fix",
49
+ "lint-inspector": "npx @eslint/config-inspector",
50
+ "format": "prettier --write \"**/*.(ts|js)\"",
51
+ "pretty": "pnpm lint && pnpm format"
52
+ },
53
+ "dependencies": {
54
+ "@types/body-parser": "^1.19.5",
55
+ "@types/express": "^4.17.21",
56
+ "@types/express-serve-static-core": "^5.0.7",
57
+ "@types/prompts": "^2.4.9",
58
+ "@types/yargs": "^17.0.33",
59
+ "ansi-colors": "^4.1.3",
60
+ "body-parser": "^2.0.2",
61
+ "esbuild": "^0.24.2",
62
+ "express": "^4.21.2",
63
+ "express-urlrewrite": "^2.0.3",
64
+ "flat": "^6.0.1",
65
+ "graphql": "^16.10.0",
66
+ "please-upgrade-node": "^3.2.0",
67
+ "prompts": "^2.4.2",
68
+ "ws": "^8.20.0",
69
+ "yargs": "^17.7.2",
70
+ "zod": "^3.24.1"
71
+ },
72
+ "devDependencies": {
73
+ "@siberiacancode/vitest": "^2.4.1",
74
+ "@types/supertest": "^6.0.3",
75
+ "@types/ws": "^8.18.1",
76
+ "nodemon": "^3.1.14",
77
+ "shx": "^0.4.0",
78
+ "supertest": "^7.2.2",
79
+ "tsdown": "^0.22.2",
80
+ "vitest": "^4.1.8"
81
+ },
82
+ "lint-staged": {
83
+ "*.js": ["prettier --write"],
84
+ "*.ts": ["eslint --no-error-on-unmatched-pattern --fix", "prettier --write"]
85
+ }
86
+ };
87
+ }));
88
+ //#endregion
89
+ export default require_package();
90
+ export { require_package };
@@ -0,0 +1,30 @@
1
+ import { createNestedDatabaseRoutes } from "./helpers/createNestedDatabaseRoutes/createNestedDatabaseRoutes.mjs";
2
+ import { createRewrittenDatabaseRoutes } from "./helpers/createRewrittenDatabaseRoutes/createRewrittenDatabaseRoutes.mjs";
3
+ import { createShallowDatabaseRoutes } from "./helpers/createShallowDatabaseRoutes/createShallowDatabaseRoutes.mjs";
4
+ import { splitDatabaseByNesting } from "./helpers/splitDatabaseByNesting/splitDatabaseByNesting.mjs";
5
+ import "./helpers/index.mjs";
6
+ import { FileStorage } from "./storages/File/FileStorage.mjs";
7
+ import { MemoryStorage } from "./storages/Memory/MemoryStorage.mjs";
8
+ import "./storages/index.mjs";
9
+ import { createStorage } from "../createStorage/createStorage.mjs";
10
+ //#region src/core/database/createDatabaseRoutes/createDatabaseRoutes.ts
11
+ const isVariableJsonFile = (variable) => typeof variable === "string" && variable.endsWith(".json");
12
+ const createDatabaseRoutes = (router, { data, routes }) => {
13
+ if (routes) {
14
+ const storage = createStorage(routes);
15
+ createRewrittenDatabaseRoutes(router, storage.read());
16
+ router.route("/__routes").get((_request, response) => {
17
+ response.json(storage.read());
18
+ });
19
+ }
20
+ const storage = isVariableJsonFile(data) ? new FileStorage(data) : new MemoryStorage(data);
21
+ const { shallowDatabase, nestedDatabase } = splitDatabaseByNesting(storage.read());
22
+ createShallowDatabaseRoutes(router, shallowDatabase, storage);
23
+ createNestedDatabaseRoutes(router, nestedDatabase, storage);
24
+ router.route("/__db").get((_request, response) => {
25
+ response.json(storage.read());
26
+ });
27
+ return router;
28
+ };
29
+ //#endregion
30
+ export { createDatabaseRoutes };
@@ -0,0 +1,8 @@
1
+ //#region src/core/database/createDatabaseRoutes/helpers/array/createNewId/createNewId.ts
2
+ const createNewId = (array) => {
3
+ let maxId = -1;
4
+ for (let i = 0; i < array.length; i += 1) if (typeof array[i].id === "number" && array[i].id > maxId) maxId = array[i].id;
5
+ return maxId + 1;
6
+ };
7
+ //#endregion
8
+ export { createNewId };
@@ -0,0 +1,4 @@
1
+ //#region src/core/database/createDatabaseRoutes/helpers/array/findIndexById/findIndexById.ts
2
+ const findIndexById = (array, id) => array.findIndex((item) => item.id.toString() === id.toString());
3
+ //#endregion
4
+ export { findIndexById };
@@ -0,0 +1,4 @@
1
+ //#region src/core/database/createDatabaseRoutes/helpers/array/isIndex/isIndex.ts
2
+ const isIndex = (value) => Number.isInteger(value) && value >= 0;
3
+ //#endregion
4
+ export { isIndex };