mock-config-server 4.0.2 → 5.0.0-beta.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 (173) hide show
  1. package/README.md +229 -237
  2. package/dist/bin/build.d.ts +3 -3
  3. package/dist/bin/build.js +1 -11
  4. package/dist/bin/helpers/createTemplate.js +6 -6
  5. package/dist/bin/helpers/resolveConfigFile.d.ts +2 -2
  6. package/dist/bin/helpers/resolveConfigFile.js +2 -3
  7. package/dist/bin/helpers/resolveConfigFilePath.js +4 -4
  8. package/dist/bin/init.d.ts +2 -2
  9. package/dist/bin/init.js +7 -7
  10. package/dist/bin/run.d.ts +3 -3
  11. package/dist/bin/run.js +17 -24
  12. package/dist/bin/templates/js/full/mock-requests/graphql/index.js +2 -2
  13. package/dist/bin/templates/js/full/mock-requests/graphql/user.js +35 -35
  14. package/dist/bin/templates/js/full/mock-requests/graphql/users.js +12 -12
  15. package/dist/bin/templates/js/full/mock-requests/rest/index.js +2 -2
  16. package/dist/bin/templates/js/full/mock-requests/rest/user.js +35 -35
  17. package/dist/bin/templates/js/full/mock-requests/rest/users.js +12 -12
  18. package/dist/bin/templates/js/full/mock-server.config.js +19 -19
  19. package/dist/bin/templates/js/graphql/mock-requests/index.js +2 -2
  20. package/dist/bin/templates/js/graphql/mock-requests/user.js +35 -35
  21. package/dist/bin/templates/js/graphql/mock-requests/users.js +12 -12
  22. package/dist/bin/templates/js/graphql/mock-server.config.js +14 -14
  23. package/dist/bin/templates/js/rest/mock-requests/index.js +2 -2
  24. package/dist/bin/templates/js/rest/mock-requests/user.js +35 -35
  25. package/dist/bin/templates/js/rest/mock-requests/users.js +12 -12
  26. package/dist/bin/templates/js/rest/mock-server.config.js +14 -14
  27. package/dist/bin/templates/ts/full/mock-requests/graphql/index.ts +2 -2
  28. package/dist/bin/templates/ts/full/mock-requests/graphql/user.ts +37 -37
  29. package/dist/bin/templates/ts/full/mock-requests/graphql/users.ts +14 -14
  30. package/dist/bin/templates/ts/full/mock-requests/rest/index.ts +2 -2
  31. package/dist/bin/templates/ts/full/mock-requests/rest/user.ts +37 -37
  32. package/dist/bin/templates/ts/full/mock-requests/rest/users.ts +14 -14
  33. package/dist/bin/templates/ts/full/mock-server.config.ts +21 -21
  34. package/dist/bin/templates/ts/graphql/mock-requests/index.ts +2 -2
  35. package/dist/bin/templates/ts/graphql/mock-requests/user.ts +37 -37
  36. package/dist/bin/templates/ts/graphql/mock-requests/users.ts +14 -14
  37. package/dist/bin/templates/ts/graphql/mock-server.config.ts +16 -16
  38. package/dist/bin/templates/ts/rest/mock-requests/index.ts +2 -2
  39. package/dist/bin/templates/ts/rest/mock-requests/user.ts +37 -37
  40. package/dist/bin/templates/ts/rest/mock-requests/users.ts +14 -14
  41. package/dist/bin/templates/ts/rest/mock-server.config.ts +16 -16
  42. package/dist/src/core/database/createDatabaseRoutes/helpers/search/search.js +3 -3
  43. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.js +4 -4
  44. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.js +2 -2
  45. package/dist/src/core/functions/graphql/graphql.d.ts +54 -0
  46. package/dist/src/core/functions/graphql/graphql.js +126 -0
  47. package/dist/src/core/functions/graphql/helpers/createQueueHandler/createQueueHandler.d.ts +5 -0
  48. package/dist/src/core/functions/graphql/helpers/createQueueHandler/createQueueHandler.js +35 -0
  49. package/dist/src/core/functions/graphql/helpers/index.d.ts +1 -0
  50. package/dist/src/core/{rest/createRestRoutes → functions/graphql}/helpers/index.js +1 -1
  51. package/dist/src/core/functions/index.d.ts +3 -0
  52. package/dist/src/core/functions/index.js +20 -0
  53. package/dist/src/core/functions/mock.d.ts +2 -0
  54. package/dist/src/core/functions/mock.js +11 -0
  55. package/dist/src/core/functions/rest/helpers/createFileHandler/createFileHandler.d.ts +2 -0
  56. package/dist/src/core/functions/rest/helpers/createFileHandler/createFileHandler.js +29 -0
  57. package/dist/src/core/functions/rest/helpers/createQueueHandler/createQueueHandler.d.ts +5 -0
  58. package/dist/src/core/functions/rest/helpers/createQueueHandler/createQueueHandler.js +35 -0
  59. package/dist/src/core/functions/rest/helpers/formatSsePayload/formatSsePayload.d.ts +5 -0
  60. package/dist/src/core/functions/rest/helpers/formatSsePayload/formatSsePayload.js +50 -0
  61. package/dist/src/core/functions/rest/helpers/index.d.ts +3 -0
  62. package/dist/src/core/functions/rest/helpers/index.js +20 -0
  63. package/dist/src/core/functions/rest/index.d.ts +1 -0
  64. package/dist/src/core/{graphql/createGraphQLRoutes/helpers → functions/rest}/index.js +1 -1
  65. package/dist/src/core/functions/rest/rest.d.ts +102 -0
  66. package/dist/src/core/functions/rest/rest.js +165 -0
  67. package/dist/src/core/graphql/createGraphQLRoute/createGraphQLRoute.d.ts +8 -0
  68. package/dist/src/core/graphql/createGraphQLRoute/createGraphQLRoute.js +158 -0
  69. package/dist/src/core/graphql/createGraphQLRoute/helpers/calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight.d.ts +2 -0
  70. package/dist/src/core/graphql/{createGraphQLRoutes/helpers/prepareGraphQLRequestConfigs/prepareGraphQLRequestConfigs.js → createGraphQLRoute/helpers/calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight.js} +3 -11
  71. package/dist/src/core/graphql/createGraphQLRoute/helpers/index.d.ts +3 -0
  72. package/dist/src/core/graphql/createGraphQLRoute/helpers/index.js +20 -0
  73. package/dist/src/core/graphql/createGraphQLRoute/helpers/matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts.d.ts +12 -0
  74. package/dist/src/core/graphql/createGraphQLRoute/helpers/matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts.js +28 -0
  75. package/dist/src/core/graphql/createGraphQLRoute/helpers/prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts.d.ts +2 -0
  76. package/dist/src/core/graphql/createGraphQLRoute/helpers/prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts.js +11 -0
  77. package/dist/src/core/graphql/index.d.ts +2 -1
  78. package/dist/src/core/graphql/index.js +2 -1
  79. package/dist/src/core/middlewares/contextMiddleware/contextMiddleware.d.ts +6 -4
  80. package/dist/src/core/middlewares/contextMiddleware/contextMiddleware.js +1 -2
  81. package/dist/src/core/rest/createRestRoute/createRestRoute.d.ts +8 -0
  82. package/dist/src/core/rest/createRestRoute/createRestRoute.js +190 -0
  83. package/dist/src/core/rest/createRestRoute/helpers/calculateRestRouteConfigWeight/calculateRestRouteConfigWeight.d.ts +2 -0
  84. package/dist/src/core/rest/createRestRoute/helpers/calculateRestRouteConfigWeight/calculateRestRouteConfigWeight.js +35 -0
  85. package/dist/src/core/rest/createRestRoute/helpers/index.d.ts +3 -0
  86. package/dist/src/core/rest/createRestRoute/helpers/index.js +20 -0
  87. package/dist/src/core/rest/createRestRoute/helpers/matchRestRequestArtifacts/matchRestRequestArtifacts.d.ts +11 -0
  88. package/dist/src/core/rest/createRestRoute/helpers/matchRestRequestArtifacts/matchRestRequestArtifacts.js +31 -0
  89. package/dist/src/core/rest/createRestRoute/helpers/prepareRestRequestArtifacts/prepareRestRequestArtifacts.d.ts +2 -0
  90. package/dist/src/core/rest/createRestRoute/helpers/prepareRestRequestArtifacts/prepareRestRequestArtifacts.js +37 -0
  91. package/dist/src/core/rest/index.d.ts +2 -1
  92. package/dist/src/core/rest/index.js +2 -1
  93. package/dist/src/index.d.ts +1 -0
  94. package/dist/src/index.js +1 -0
  95. package/dist/src/server/createMockServer/createMockServer.d.ts +1 -1
  96. package/dist/src/server/createMockServer/createMockServer.js +76 -45
  97. package/dist/src/server/index.d.ts +0 -8
  98. package/dist/src/server/index.js +0 -8
  99. package/dist/src/server/startMockServer/startMockServer.d.ts +2 -2
  100. package/dist/src/server/startMockServer/startMockServer.js +4 -3
  101. package/dist/src/utils/constants/checkModes.js +7 -7
  102. package/dist/src/utils/helpers/config/resolveEntityValues/resolveEntityValues.js +1 -1
  103. package/dist/src/utils/helpers/files/isFileDescriptor/isFileDescriptor.js +2 -2
  104. package/dist/src/utils/helpers/files/isFilePathValid/isFilePathValid.js +3 -3
  105. package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.d.ts +3 -3
  106. package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.js +2 -2
  107. package/dist/src/utils/helpers/tests/createTmpDir.js +4 -4
  108. package/dist/src/utils/helpers/url/index.d.ts +1 -2
  109. package/dist/src/utils/helpers/url/index.js +1 -2
  110. package/dist/src/utils/helpers/url/normalizeUrl/normalizeUrl.d.ts +1 -0
  111. package/dist/src/utils/helpers/url/normalizeUrl/normalizeUrl.js +15 -0
  112. package/dist/src/utils/helpers/url/urlJoin/urlJoin.js +4 -4
  113. package/dist/src/utils/types/graphql.d.ts +44 -18
  114. package/dist/src/utils/types/rest.d.ts +44 -27
  115. package/dist/src/utils/types/server.d.ts +7 -24
  116. package/dist/src/utils/types/values.d.ts +6 -1
  117. package/dist/src/utils/validate/graphqlConfigSchema/graphqlConfigSchema.d.ts +41 -383
  118. package/dist/src/utils/validate/graphqlConfigSchema/graphqlConfigSchema.js +3 -3
  119. package/dist/src/utils/validate/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +3 -66
  120. package/dist/src/utils/validate/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.js +7 -22
  121. package/dist/src/utils/validate/index.d.ts +0 -2
  122. package/dist/src/utils/validate/index.js +0 -2
  123. package/dist/src/utils/validate/queueSchema/queueSchema.d.ts +2 -11
  124. package/dist/src/utils/validate/queueSchema/queueSchema.js +7 -13
  125. package/dist/src/utils/validate/restConfigSchema/restConfigSchema.d.ts +101 -1309
  126. package/dist/src/utils/validate/restConfigSchema/restConfigSchema.js +3 -3
  127. package/dist/src/utils/validate/restConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +3 -82
  128. package/dist/src/utils/validate/restConfigSchema/routeConfigSchema/routeConfigSchema.js +6 -28
  129. package/dist/src/utils/validate/settingsSchema/settingsSchema.d.ts +0 -3
  130. package/dist/src/utils/validate/settingsSchema/settingsSchema.js +0 -1
  131. package/dist/src/utils/validate/utils/checkModeSchema/checkModeSchema.js +6 -6
  132. package/dist/src/utils/validate/utils/entitiesSchema/entitiesSchema.js +4 -4
  133. package/dist/src/utils/validate/utils/jsonSchema/jsonSchema.js +3 -3
  134. package/dist/src/utils/validate/utils/requiredPropertiesSchema/requiredPropertiesSchema.js +1 -1
  135. package/dist/src/utils/validate/utils/sharedSchema/sharedSchema.js +3 -3
  136. package/dist/src/utils/validate/validateMockServerConfig.js +18 -8
  137. package/package.json +17 -40
  138. package/LICENSE +0 -21
  139. package/dist/bin/runFlatConfig.d.ts +0 -5
  140. package/dist/bin/runFlatConfig.js +0 -36
  141. package/dist/src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.d.ts +0 -9
  142. package/dist/src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.js +0 -160
  143. package/dist/src/core/graphql/createGraphQLRoutes/helpers/index.d.ts +0 -1
  144. package/dist/src/core/graphql/createGraphQLRoutes/helpers/prepareGraphQLRequestConfigs/prepareGraphQLRequestConfigs.d.ts +0 -2
  145. package/dist/src/core/rest/createRestRoutes/createRestRoutes.d.ts +0 -9
  146. package/dist/src/core/rest/createRestRoutes/createRestRoutes.js +0 -184
  147. package/dist/src/core/rest/createRestRoutes/helpers/index.d.ts +0 -1
  148. package/dist/src/core/rest/createRestRoutes/helpers/prepareRestRequestConfigs/prepareRestRequestConfigs.d.ts +0 -2
  149. package/dist/src/core/rest/createRestRoutes/helpers/prepareRestRequestConfigs/prepareRestRequestConfigs.js +0 -67
  150. package/dist/src/server/createDatabaseMockServer/createDatabaseMockServer.d.ts +0 -3
  151. package/dist/src/server/createDatabaseMockServer/createDatabaseMockServer.js +0 -62
  152. package/dist/src/server/createFlatMockServer/createFlatMockServer.d.ts +0 -3
  153. package/dist/src/server/createFlatMockServer/createFlatMockServer.js +0 -128
  154. package/dist/src/server/createGraphQLMockServer/createGraphQLMockServer.d.ts +0 -3
  155. package/dist/src/server/createGraphQLMockServer/createGraphQLMockServer.js +0 -67
  156. package/dist/src/server/createRestMockServer/createRestMockServer.d.ts +0 -3
  157. package/dist/src/server/createRestMockServer/createRestMockServer.js +0 -67
  158. package/dist/src/server/startDatabaseMockServer/startDatabaseMockServer.d.ts +0 -4
  159. package/dist/src/server/startDatabaseMockServer/startDatabaseMockServer.js +0 -29
  160. package/dist/src/server/startFlatMockServer/startFlatMockServer.d.ts +0 -4
  161. package/dist/src/server/startFlatMockServer/startFlatMockServer.js +0 -32
  162. package/dist/src/server/startGraphQLMockServer/startGraphQLMockServer.d.ts +0 -4
  163. package/dist/src/server/startGraphQLMockServer/startGraphQLMockServer.js +0 -29
  164. package/dist/src/server/startRestMockServer/startRestMockServer.d.ts +0 -4
  165. package/dist/src/server/startRestMockServer/startRestMockServer.js +0 -29
  166. package/dist/src/utils/helpers/url/getUrlParts/getUrlParts.d.ts +0 -1
  167. package/dist/src/utils/helpers/url/getUrlParts/getUrlParts.js +0 -12
  168. package/dist/src/utils/helpers/url/removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes.d.ts +0 -1
  169. package/dist/src/utils/helpers/url/removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes.js +0 -11
  170. package/dist/src/utils/validate/isOnlyRequestedDataResolvingPropertyExists.d.ts +0 -4
  171. package/dist/src/utils/validate/isOnlyRequestedDataResolvingPropertyExists.js +0 -16
  172. package/dist/src/utils/validate/validateApiMockServerConfig.d.ts +0 -2
  173. package/dist/src/utils/validate/validateApiMockServerConfig.js +0 -48
@@ -0,0 +1,102 @@
1
+ import type { BaseRestRequestConfig, Data, RestEntitiesByEntityName, RestFileResponse, RestMethod, RestParams, RestRequestConfig, RestSettings } from '../../../utils/types';
2
+ interface RestRequestInput {
3
+ body?: unknown;
4
+ params?: unknown;
5
+ query?: unknown;
6
+ response?: Data;
7
+ }
8
+ type ReservedRestConfigKeys = {
9
+ [K in 'file' | 'handler' | 'match' | 'queue' | 'response']?: never;
10
+ };
11
+ type RestInlineResponse<Response> = Response extends Record<string, unknown> ? Response & ReservedRestConfigKeys : Response;
12
+ type RestFunction<Method extends RestMethod, Options extends RestRequestInput, AdditionalParams = {}> = (params: RestParams<Method, Options['query'], Options['body'], Options['params'], Options['response']> & AdditionalParams) => Options['response'] | Promise<Options['response']>;
13
+ interface RestResponseObject<Method extends RestMethod, Response> {
14
+ match?: RestEntitiesByEntityName<Method>;
15
+ response: Response;
16
+ }
17
+ interface RestHandlerObject<Method extends RestMethod, Options extends RestRequestInput> {
18
+ handler: RestFunction<Method, Options>;
19
+ match?: RestEntitiesByEntityName<Method>;
20
+ }
21
+ interface RestFileObject<Method extends RestMethod> {
22
+ file: RestFileResponse;
23
+ match?: RestEntitiesByEntityName<Method>;
24
+ }
25
+ interface RestQueueObject<Method extends RestMethod, Options extends RestRequestInput> {
26
+ match?: RestEntitiesByEntityName<Method>;
27
+ queue: Array<{
28
+ file: RestFileResponse;
29
+ time?: number;
30
+ } | {
31
+ handler: RestFunction<Method, Options>;
32
+ time?: number;
33
+ } | {
34
+ response: Options['response'];
35
+ time?: number;
36
+ }>;
37
+ }
38
+ interface RestSseClient<Response extends string> {
39
+ close: () => void;
40
+ send: (data: Response, meta?: {
41
+ event?: string;
42
+ id?: string;
43
+ retry?: number;
44
+ }) => void;
45
+ }
46
+ export declare const rest: {
47
+ delete: {
48
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestResponseObject<"delete", Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"delete">;
49
+ (path: RestRequestConfig["path"], config: RestFileObject<"delete">, settings?: RestSettings): BaseRestRequestConfig<"delete">;
50
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestHandlerObject<"delete", Options>, settings?: RestSettings): BaseRestRequestConfig<"delete">;
51
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestFunction<"delete", Options, {}>, settings?: RestSettings): BaseRestRequestConfig<"delete">;
52
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestQueueObject<"delete", Options>, settings?: RestSettings): BaseRestRequestConfig<"delete">;
53
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestInlineResponse<Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"delete">;
54
+ };
55
+ get: {
56
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestResponseObject<"get", Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"get">;
57
+ (path: RestRequestConfig["path"], config: RestFileObject<"get">, settings?: RestSettings): BaseRestRequestConfig<"get">;
58
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestHandlerObject<"get", Options>, settings?: RestSettings): BaseRestRequestConfig<"get">;
59
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestFunction<"get", Options, {}>, settings?: RestSettings): BaseRestRequestConfig<"get">;
60
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestQueueObject<"get", Options>, settings?: RestSettings): BaseRestRequestConfig<"get">;
61
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestInlineResponse<Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"get">;
62
+ };
63
+ options: {
64
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestResponseObject<"options", Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"options">;
65
+ (path: RestRequestConfig["path"], config: RestFileObject<"options">, settings?: RestSettings): BaseRestRequestConfig<"options">;
66
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestHandlerObject<"options", Options>, settings?: RestSettings): BaseRestRequestConfig<"options">;
67
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestFunction<"options", Options, {}>, settings?: RestSettings): BaseRestRequestConfig<"options">;
68
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestQueueObject<"options", Options>, settings?: RestSettings): BaseRestRequestConfig<"options">;
69
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestInlineResponse<Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"options">;
70
+ };
71
+ patch: {
72
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestResponseObject<"patch", Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"patch">;
73
+ (path: RestRequestConfig["path"], config: RestFileObject<"patch">, settings?: RestSettings): BaseRestRequestConfig<"patch">;
74
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestHandlerObject<"patch", Options>, settings?: RestSettings): BaseRestRequestConfig<"patch">;
75
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestFunction<"patch", Options, {}>, settings?: RestSettings): BaseRestRequestConfig<"patch">;
76
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestQueueObject<"patch", Options>, settings?: RestSettings): BaseRestRequestConfig<"patch">;
77
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestInlineResponse<Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"patch">;
78
+ };
79
+ post: {
80
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestResponseObject<"post", Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"post">;
81
+ (path: RestRequestConfig["path"], config: RestFileObject<"post">, settings?: RestSettings): BaseRestRequestConfig<"post">;
82
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestHandlerObject<"post", Options>, settings?: RestSettings): BaseRestRequestConfig<"post">;
83
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestFunction<"post", Options, {}>, settings?: RestSettings): BaseRestRequestConfig<"post">;
84
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestQueueObject<"post", Options>, settings?: RestSettings): BaseRestRequestConfig<"post">;
85
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestInlineResponse<Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"post">;
86
+ };
87
+ put: {
88
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestResponseObject<"put", Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"put">;
89
+ (path: RestRequestConfig["path"], config: RestFileObject<"put">, settings?: RestSettings): BaseRestRequestConfig<"put">;
90
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestHandlerObject<"put", Options>, settings?: RestSettings): BaseRestRequestConfig<"put">;
91
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestFunction<"put", Options, {}>, settings?: RestSettings): BaseRestRequestConfig<"put">;
92
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestQueueObject<"put", Options>, settings?: RestSettings): BaseRestRequestConfig<"put">;
93
+ <Options extends RestRequestInput = Partial<RestRequestInput>>(path: RestRequestConfig["path"], config: RestInlineResponse<Options["response"]>, settings?: RestSettings): BaseRestRequestConfig<"put">;
94
+ };
95
+ sse: <Options extends RestRequestInput = Partial<RestRequestInput>, Response extends string = string>(path: RestRequestConfig["path"], config: RestFunction<"get", Options, {
96
+ client: RestSseClient<Response>;
97
+ }>, settings?: RestSettings) => BaseRestRequestConfig<"get">;
98
+ stream: <Options extends RestRequestInput = Partial<RestRequestInput>, Response extends string = string>(path: RestRequestConfig["path"], config: RestFunction<"post", Options, {
99
+ client: RestSseClient<Response>;
100
+ }>, settings?: RestSettings) => BaseRestRequestConfig<"post">;
101
+ };
102
+ export {};
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "rest", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return rest;
9
+ }
10
+ });
11
+ const _helpers = require("./helpers");
12
+ const resolveConfigType = (config)=>{
13
+ if (typeof config === 'function') return {
14
+ type: 'inlineHandler',
15
+ config
16
+ };
17
+ if (typeof config !== 'object' || config === null) return {
18
+ type: 'inlineResponse',
19
+ config
20
+ };
21
+ if ('queue' in config) return {
22
+ type: 'queue',
23
+ config
24
+ };
25
+ if ('file' in config) return {
26
+ type: 'file',
27
+ config
28
+ };
29
+ if ('response' in config) return {
30
+ type: 'data',
31
+ config
32
+ };
33
+ if ('handler' in config) return {
34
+ type: 'handler',
35
+ config
36
+ };
37
+ return {
38
+ type: 'inlineResponse',
39
+ config
40
+ };
41
+ };
42
+ const createConfigResolver = (config, settings = {})=>{
43
+ const resolvedConfig = resolveConfigType(config);
44
+ switch(resolvedConfig.type){
45
+ case 'inlineResponse':
46
+ return {
47
+ data: resolvedConfig.config,
48
+ settings
49
+ };
50
+ case 'data':
51
+ {
52
+ return {
53
+ data: resolvedConfig.config.response,
54
+ entities: resolvedConfig.config.match,
55
+ settings
56
+ };
57
+ }
58
+ case 'file':
59
+ {
60
+ return {
61
+ data: (0, _helpers.createFileHandler)(resolvedConfig.config.file),
62
+ entities: resolvedConfig.config.match,
63
+ settings
64
+ };
65
+ }
66
+ case 'queue':
67
+ {
68
+ const normalizedQueue = resolvedConfig.config.queue.map((item)=>{
69
+ if ('handler' in item) {
70
+ return {
71
+ data: item.handler,
72
+ time: item.time
73
+ };
74
+ }
75
+ if ('response' in item) {
76
+ return {
77
+ data: item.response,
78
+ time: item.time
79
+ };
80
+ }
81
+ if ('file' in item) {
82
+ return {
83
+ data: (0, _helpers.createFileHandler)(item.file),
84
+ time: item.time
85
+ };
86
+ }
87
+ throw new Error(`Unexpected queue item kind: ${JSON.stringify(item, null, 2)}`);
88
+ });
89
+ return {
90
+ data: (0, _helpers.createQueueHandler)(normalizedQueue),
91
+ entities: resolvedConfig.config.match,
92
+ settings
93
+ };
94
+ }
95
+ case 'inlineHandler':
96
+ return {
97
+ data: resolvedConfig.config,
98
+ settings
99
+ };
100
+ case 'handler':
101
+ {
102
+ return {
103
+ data: resolvedConfig.config.handler,
104
+ entities: resolvedConfig.config.match,
105
+ settings
106
+ };
107
+ }
108
+ default:
109
+ {
110
+ throw new Error(`Unexpected route config kind: ${JSON.stringify(config, null, 2)}`);
111
+ }
112
+ }
113
+ };
114
+ const createRestFactory = (method)=>{
115
+ function createRequestConfig(path, config, settings) {
116
+ return {
117
+ method,
118
+ path,
119
+ routes: [
120
+ createConfigResolver(config, settings)
121
+ ]
122
+ };
123
+ }
124
+ return createRequestConfig;
125
+ };
126
+ const createSseRestFactory = (method)=>{
127
+ function createSseRequestConfig(path, config, settings) {
128
+ const wrapperHandler = (params)=>{
129
+ params.setHeader('connection', 'keep-alive');
130
+ params.setHeader('content-type', 'text/event-stream');
131
+ params.setHeader('cache-control', 'no-cache');
132
+ const client = {
133
+ send (message, meta) {
134
+ const payload = (0, _helpers.formatSsePayload)(message, meta);
135
+ params.response.write(payload);
136
+ },
137
+ close () {
138
+ params.response.end();
139
+ }
140
+ };
141
+ return config({
142
+ ...params,
143
+ client
144
+ });
145
+ };
146
+ return {
147
+ method,
148
+ path,
149
+ routes: [
150
+ createConfigResolver(wrapperHandler, settings)
151
+ ]
152
+ };
153
+ }
154
+ return createSseRequestConfig;
155
+ };
156
+ const rest = {
157
+ delete: createRestFactory('delete'),
158
+ get: createRestFactory('get'),
159
+ options: createRestFactory('options'),
160
+ patch: createRestFactory('patch'),
161
+ post: createRestFactory('post'),
162
+ put: createRestFactory('put'),
163
+ sse: createSseRestFactory('get'),
164
+ stream: createSseRestFactory('post')
165
+ };
@@ -0,0 +1,8 @@
1
+ import type { Express } from 'express';
2
+ import type { GraphQLRequestArtifact } from '../../../utils/types';
3
+ interface CreateGraphQLRouteParams {
4
+ graphQLRequestArtifacts: GraphQLRequestArtifact[];
5
+ server: Express;
6
+ }
7
+ export declare const createGraphQLRoute: ({ server, graphQLRequestArtifacts }: CreateGraphQLRouteParams) => Express;
8
+ export {};
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createGraphQLRoute", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createGraphQLRoute;
9
+ }
10
+ });
11
+ const _flat = require("flat");
12
+ const _helpers = require("../../../utils/helpers");
13
+ const _helpers1 = require("./helpers");
14
+ const createGraphQLRoute = ({ server, graphQLRequestArtifacts })=>server.use((0, _helpers.asyncHandler)(async (request, response, next)=>{
15
+ var _matchedRouteConfig_config_settings, _matchedRouteConfig_config_settings1;
16
+ if (request.method !== 'GET' && request.method !== 'POST') return next();
17
+ const graphQLInput = (0, _helpers.getGraphQLInput)(request);
18
+ if (!graphQLInput.query) return next();
19
+ const query = (0, _helpers.parseQuery)(graphQLInput.query);
20
+ if (!query) return next();
21
+ const matchedRequestArtifacts = (0, _helpers1.matchGraphQLRequestArtifacts)({
22
+ artifacts: graphQLRequestArtifacts,
23
+ meta: {
24
+ path: (0, _helpers.normalizeUrl)(request.path),
25
+ query: graphQLInput.query,
26
+ operationType: query.operationType,
27
+ operationName: query.operationName
28
+ }
29
+ });
30
+ if (!matchedRequestArtifacts.length) return next();
31
+ const matchedRouteConfig = matchedRequestArtifacts.find(({ config })=>{
32
+ if (!config.entities) return true;
33
+ const entityEntries = Object.entries(config.entities);
34
+ return entityEntries.every(([entityName, entityDescriptorOrValue])=>{
35
+ const isEntityVariablesByTopLevelDescriptor = entityName === 'variables' && (0, _helpers.isEntityDescriptor)(entityDescriptorOrValue);
36
+ if (isEntityVariablesByTopLevelDescriptor) {
37
+ const variablesDescriptor = entityDescriptorOrValue;
38
+ if (variablesDescriptor.checkMode === 'exists' || variablesDescriptor.checkMode === 'notExists') {
39
+ return (0, _helpers.resolveEntityValues)({
40
+ actualValue: graphQLInput.variables,
41
+ checkMode: variablesDescriptor.checkMode
42
+ });
43
+ }
44
+ var _variablesDescriptor_oneOf;
45
+ return (0, _helpers.resolveEntityValues)({
46
+ actualValue: graphQLInput.variables,
47
+ descriptorValue: variablesDescriptor.value,
48
+ checkMode: variablesDescriptor.checkMode,
49
+ oneOf: (_variablesDescriptor_oneOf = variablesDescriptor.oneOf) !== null && _variablesDescriptor_oneOf !== void 0 ? _variablesDescriptor_oneOf : false
50
+ });
51
+ }
52
+ const actualEntity = (0, _flat.flatten)(entityName === 'variables' ? graphQLInput.variables : request[entityName]);
53
+ const entityValueEntries = Object.entries(entityDescriptorOrValue);
54
+ return entityValueEntries.every(([entityPropertyKey, entityPropertyDescriptorOrValue])=>{
55
+ const entityPropertyDescriptor = (0, _helpers.convertToEntityDescriptor)(entityPropertyDescriptorOrValue);
56
+ const actualPropertyKey = entityName === 'headers' ? entityPropertyKey.toLowerCase() : entityPropertyKey;
57
+ const actualPropertyValue = actualEntity[actualPropertyKey];
58
+ if (entityPropertyDescriptor.checkMode === 'exists' || entityPropertyDescriptor.checkMode === 'notExists') {
59
+ return (0, _helpers.resolveEntityValues)({
60
+ actualValue: actualPropertyValue,
61
+ checkMode: entityPropertyDescriptor.checkMode
62
+ });
63
+ }
64
+ var _entityPropertyDescriptor_oneOf;
65
+ return (0, _helpers.resolveEntityValues)({
66
+ actualValue: actualPropertyValue,
67
+ descriptorValue: entityPropertyDescriptor.value,
68
+ checkMode: entityPropertyDescriptor.checkMode,
69
+ oneOf: (_entityPropertyDescriptor_oneOf = entityPropertyDescriptor.oneOf) !== null && _entityPropertyDescriptor_oneOf !== void 0 ? _entityPropertyDescriptor_oneOf : false
70
+ });
71
+ });
72
+ });
73
+ });
74
+ if (!matchedRouteConfig) return next();
75
+ if (matchedRouteConfig.componentRequestInterceptor) {
76
+ await (0, _helpers.callRequestInterceptor)({
77
+ request,
78
+ interceptor: matchedRouteConfig.componentRequestInterceptor
79
+ });
80
+ }
81
+ if (matchedRouteConfig.requestRequestInterceptor) {
82
+ await (0, _helpers.callRequestInterceptor)({
83
+ request,
84
+ interceptor: matchedRouteConfig.requestRequestInterceptor
85
+ });
86
+ }
87
+ if (matchedRouteConfig.routeRequestInterceptor) {
88
+ await (0, _helpers.callRequestInterceptor)({
89
+ request,
90
+ interceptor: matchedRouteConfig.routeRequestInterceptor
91
+ });
92
+ }
93
+ var _matchedRouteConfig_config_entities;
94
+ const params = {
95
+ request,
96
+ response,
97
+ next,
98
+ entities: (_matchedRouteConfig_config_entities = matchedRouteConfig.config.entities) !== null && _matchedRouteConfig_config_entities !== void 0 ? _matchedRouteConfig_config_entities : {},
99
+ appendHeader: (field, value)=>{
100
+ response.append(field, value);
101
+ },
102
+ attachment: (filename)=>{
103
+ response.attachment(filename);
104
+ },
105
+ clearCookie: (name, options)=>{
106
+ response.clearCookie(name, options);
107
+ },
108
+ getCookie: (name)=>request.cookies[name],
109
+ getRequestHeader: (field)=>request.headers[field],
110
+ getRequestHeaders: ()=>request.headers,
111
+ getResponseHeader: (field)=>response.getHeader(field),
112
+ getResponseHeaders: ()=>response.getHeaders(),
113
+ setCookie: (name, value, options)=>{
114
+ if (options) {
115
+ response.cookie(name, value, options);
116
+ return;
117
+ }
118
+ response.cookie(name, value);
119
+ },
120
+ setDelay: async (delay)=>{
121
+ await (0, _helpers.sleep)(delay === Infinity ? 99999999 : delay);
122
+ },
123
+ setHeader: (field, value)=>{
124
+ response.set(field, value);
125
+ },
126
+ setStatusCode: (statusCode)=>{
127
+ response.statusCode = statusCode;
128
+ }
129
+ };
130
+ const resolvedData = typeof matchedRouteConfig.config.data === 'function' ? await matchedRouteConfig.config.data(params) : matchedRouteConfig.config.data;
131
+ if (response.headersSent) {
132
+ return;
133
+ }
134
+ if ((_matchedRouteConfig_config_settings = matchedRouteConfig.config.settings) === null || _matchedRouteConfig_config_settings === void 0 ? void 0 : _matchedRouteConfig_config_settings.status) {
135
+ response.statusCode = matchedRouteConfig.config.settings.status;
136
+ }
137
+ if (matchedRouteConfig.operationType === 'query') {
138
+ response.set('Cache-control', 'no-cache');
139
+ }
140
+ const data = await (0, _helpers.callResponseInterceptors)({
141
+ data: resolvedData,
142
+ request,
143
+ response,
144
+ interceptors: {
145
+ routeInterceptor: matchedRouteConfig.routeResponseInterceptor,
146
+ componentInterceptor: matchedRouteConfig.componentResponseInterceptor,
147
+ requestInterceptor: matchedRouteConfig.requestResponseInterceptor,
148
+ serverInterceptor: matchedRouteConfig.serverResponseInterceptor
149
+ }
150
+ });
151
+ if ((_matchedRouteConfig_config_settings1 = matchedRouteConfig.config.settings) === null || _matchedRouteConfig_config_settings1 === void 0 ? void 0 : _matchedRouteConfig_config_settings1.delay) {
152
+ await (0, _helpers.sleep)(matchedRouteConfig.config.settings.delay);
153
+ }
154
+ if (response.headersSent) {
155
+ return;
156
+ }
157
+ return response.json(data);
158
+ }));
@@ -0,0 +1,2 @@
1
+ import type { GraphQLRouteConfig } from '../../../../../utils/types';
2
+ export declare const calculateGraphQLRouteConfigWeight: (graphQLRouteConfig: GraphQLRouteConfig) => number;
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "prepareGraphQLRequestConfigs", {
5
+ Object.defineProperty(exports, "calculateGraphQLRouteConfigWeight", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return prepareGraphQLRequestConfigs;
8
+ return calculateGraphQLRouteConfigWeight;
9
9
  }
10
10
  });
11
11
  const _helpers = require("../../../../../utils/helpers");
12
- const calculateRouteConfigWeight = (graphQLRouteConfig)=>{
12
+ const calculateGraphQLRouteConfigWeight = (graphQLRouteConfig)=>{
13
13
  const { entities } = graphQLRouteConfig;
14
14
  if (!entities) return 0;
15
15
  let routeConfigWeight = 0;
@@ -32,11 +32,3 @@ const calculateRouteConfigWeight = (graphQLRouteConfig)=>{
32
32
  }
33
33
  return routeConfigWeight;
34
34
  };
35
- const prepareGraphQLRequestConfigs = (requestConfigs)=>{
36
- requestConfigs.forEach((requestConfig)=>{
37
- requestConfig.routes.sort((first, second)=>// ✅ important:
38
- // Lift more specific configs for correct working of routes
39
- calculateRouteConfigWeight(second) - calculateRouteConfigWeight(first));
40
- });
41
- return requestConfigs;
42
- };
@@ -0,0 +1,3 @@
1
+ export * from './calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight';
2
+ export * from './matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts';
3
+ export * from './prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight"), exports);
6
+ _export_star(require("./matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts"), exports);
7
+ _export_star(require("./prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts"), exports);
8
+ function _export_star(from, to) {
9
+ Object.keys(from).forEach(function(k) {
10
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
11
+ Object.defineProperty(to, k, {
12
+ enumerable: true,
13
+ get: function() {
14
+ return from[k];
15
+ }
16
+ });
17
+ }
18
+ });
19
+ return from;
20
+ }
@@ -0,0 +1,12 @@
1
+ import type { GraphQLRequestArtifact } from '../../../../../utils/types';
2
+ interface MatchGraphQLRequestArtifactsParams {
3
+ artifacts: GraphQLRequestArtifact[];
4
+ meta: {
5
+ path: string;
6
+ operationType: string;
7
+ query?: string;
8
+ operationName?: string;
9
+ };
10
+ }
11
+ export declare const matchGraphQLRequestArtifacts: ({ artifacts, meta }: MatchGraphQLRequestArtifactsParams) => GraphQLRequestArtifact[];
12
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "matchGraphQLRequestArtifacts", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return matchGraphQLRequestArtifacts;
9
+ }
10
+ });
11
+ const _graphql = require("graphql");
12
+ const _helpers = require("../../../../../utils/helpers");
13
+ const matchGraphQLRequestArtifacts = ({ artifacts, meta })=>artifacts.filter((artifact)=>{
14
+ if ((0, _helpers.normalizeUrl)(meta.path) !== (0, _helpers.normalizeUrl)(artifact.baseUrl)) {
15
+ return false;
16
+ }
17
+ if (artifact.operationType !== meta.operationType) return false;
18
+ if (artifact.query) {
19
+ if (!meta.query) return false;
20
+ return (0, _graphql.stripIgnoredCharacters)((0, _graphql.print)((0, _graphql.parse)(artifact.query))) === (0, _graphql.stripIgnoredCharacters)((0, _graphql.print)((0, _graphql.parse)(meta.query)));
21
+ }
22
+ if (artifact.operationName) {
23
+ if (!meta.operationName) return false;
24
+ return artifact.operationName instanceof RegExp ? new RegExp(artifact.operationName).test(meta.operationName) : artifact.operationName === meta.operationName;
25
+ }
26
+ console.warn(`[mock-config] GraphQL artifact with no query or operationName was skipped: ${JSON.stringify(artifact)}`);
27
+ return false;
28
+ });
@@ -0,0 +1,2 @@
1
+ import type { GraphQLRequestArtifact } from '../../../../../utils/types';
2
+ export declare const prepareGraphQLRequestArtifacts: (requestArtifacts: GraphQLRequestArtifact[]) => GraphQLRequestArtifact[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "prepareGraphQLRequestArtifacts", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return prepareGraphQLRequestArtifacts;
9
+ }
10
+ });
11
+ const prepareGraphQLRequestArtifacts = (requestArtifacts)=>requestArtifacts.toSorted((first, second)=>second.weight - first.weight);
@@ -1 +1,2 @@
1
- export * from './createGraphQLRoutes/createGraphQLRoutes';
1
+ export * from './createGraphQLRoute/createGraphQLRoute';
2
+ export * from './createGraphQLRoute/helpers';
@@ -2,7 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./createGraphQLRoutes/createGraphQLRoutes"), exports);
5
+ _export_star(require("./createGraphQLRoute/createGraphQLRoute"), exports);
6
+ _export_star(require("./createGraphQLRoute/helpers"), exports);
6
7
  function _export_star(from, to) {
7
8
  Object.keys(from).forEach(function(k) {
8
9
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -1,17 +1,19 @@
1
1
  import type { Express } from 'express';
2
- import type { GraphQLEntity, GraphQLOperationName, GraphQLOperationType, MockServerConfig } from '../../../utils/types';
2
+ import type { DatabaseConfig, GraphQLEntity, GraphQLOperationName, GraphQLOperationType } from '../../../utils/types';
3
3
  declare global {
4
4
  namespace Express {
5
5
  interface Request {
6
- id: number;
7
- timestamp: number;
8
6
  graphQL: {
9
7
  operationType: GraphQLOperationType;
10
8
  operationName?: GraphQLOperationName;
11
9
  query: string;
12
10
  variables?: GraphQLEntity<'variables'>;
13
11
  } | null;
12
+ id: number;
13
+ timestamp: number;
14
14
  }
15
15
  }
16
16
  }
17
- export declare const contextMiddleware: (server: Express, { database }: Pick<MockServerConfig, "database">) => void;
17
+ export declare const contextMiddleware: (server: Express, { database }: {
18
+ database?: DatabaseConfig;
19
+ }) => void;
@@ -24,6 +24,7 @@ const contextMiddleware = (server, { database })=>{
24
24
  requestId += 1;
25
25
  request.id = requestId;
26
26
  request.timestamp = Date.now();
27
+ request.graphQL = null;
27
28
  if (request.method === 'GET' || request.method === 'POST') {
28
29
  const graphQLInput = (0, _helpers.getGraphQLInput)(request);
29
30
  var _graphQLInput_query;
@@ -35,10 +36,8 @@ const contextMiddleware = (server, { database })=>{
35
36
  query: graphQLInput.query,
36
37
  variables: graphQLInput.variables
37
38
  };
38
- return next();
39
39
  }
40
40
  }
41
- request.graphQL = null;
42
41
  request.context = context;
43
42
  return next();
44
43
  });
@@ -0,0 +1,8 @@
1
+ import type { Express } from 'express';
2
+ import type { RestRequestArtifact } from '../../../utils/types';
3
+ interface CreateRestRoutesParams {
4
+ restRequestArtifacts: RestRequestArtifact[];
5
+ server: Express;
6
+ }
7
+ export declare const createRestRoute: ({ server, restRequestArtifacts }: CreateRestRoutesParams) => Express;
8
+ export {};