mock-config-server 4.0.3 → 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.
- package/README.md +229 -237
- package/dist/bin/build.d.ts +3 -3
- package/dist/bin/build.js +1 -11
- package/dist/bin/helpers/createTemplate.js +6 -6
- package/dist/bin/helpers/resolveConfigFile.d.ts +2 -2
- package/dist/bin/helpers/resolveConfigFile.js +2 -3
- package/dist/bin/helpers/resolveConfigFilePath.js +4 -4
- package/dist/bin/init.d.ts +2 -2
- package/dist/bin/init.js +7 -7
- package/dist/bin/run.d.ts +3 -3
- package/dist/bin/run.js +17 -24
- package/dist/bin/templates/js/full/mock-requests/graphql/index.js +2 -2
- package/dist/bin/templates/js/full/mock-requests/graphql/user.js +35 -35
- package/dist/bin/templates/js/full/mock-requests/graphql/users.js +12 -12
- package/dist/bin/templates/js/full/mock-requests/rest/index.js +2 -2
- package/dist/bin/templates/js/full/mock-requests/rest/user.js +35 -35
- package/dist/bin/templates/js/full/mock-requests/rest/users.js +12 -12
- package/dist/bin/templates/js/full/mock-server.config.js +19 -19
- package/dist/bin/templates/js/graphql/mock-requests/index.js +2 -2
- package/dist/bin/templates/js/graphql/mock-requests/user.js +35 -35
- package/dist/bin/templates/js/graphql/mock-requests/users.js +12 -12
- package/dist/bin/templates/js/graphql/mock-server.config.js +14 -14
- package/dist/bin/templates/js/rest/mock-requests/index.js +2 -2
- package/dist/bin/templates/js/rest/mock-requests/user.js +35 -35
- package/dist/bin/templates/js/rest/mock-requests/users.js +12 -12
- package/dist/bin/templates/js/rest/mock-server.config.js +14 -14
- package/dist/bin/templates/ts/full/mock-requests/graphql/index.ts +2 -2
- package/dist/bin/templates/ts/full/mock-requests/graphql/user.ts +37 -37
- package/dist/bin/templates/ts/full/mock-requests/graphql/users.ts +14 -14
- package/dist/bin/templates/ts/full/mock-requests/rest/index.ts +2 -2
- package/dist/bin/templates/ts/full/mock-requests/rest/user.ts +37 -37
- package/dist/bin/templates/ts/full/mock-requests/rest/users.ts +14 -14
- package/dist/bin/templates/ts/full/mock-server.config.ts +21 -21
- package/dist/bin/templates/ts/graphql/mock-requests/index.ts +2 -2
- package/dist/bin/templates/ts/graphql/mock-requests/user.ts +37 -37
- package/dist/bin/templates/ts/graphql/mock-requests/users.ts +14 -14
- package/dist/bin/templates/ts/graphql/mock-server.config.ts +16 -16
- package/dist/bin/templates/ts/rest/mock-requests/index.ts +2 -2
- package/dist/bin/templates/ts/rest/mock-requests/user.ts +37 -37
- package/dist/bin/templates/ts/rest/mock-requests/users.ts +14 -14
- package/dist/bin/templates/ts/rest/mock-server.config.ts +16 -16
- package/dist/src/core/database/createDatabaseRoutes/helpers/search/search.js +3 -3
- package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.js +4 -4
- package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.js +2 -2
- package/dist/src/core/functions/graphql/graphql.d.ts +54 -0
- package/dist/src/core/functions/graphql/graphql.js +126 -0
- package/dist/src/core/functions/graphql/helpers/createQueueHandler/createQueueHandler.d.ts +5 -0
- package/dist/src/core/functions/graphql/helpers/createQueueHandler/createQueueHandler.js +35 -0
- package/dist/src/core/functions/graphql/helpers/index.d.ts +1 -0
- package/dist/src/core/{rest/createRestRoutes → functions/graphql}/helpers/index.js +1 -1
- package/dist/src/core/functions/index.d.ts +3 -0
- package/dist/src/core/functions/index.js +20 -0
- package/dist/src/core/functions/mock.d.ts +2 -0
- package/dist/src/core/functions/mock.js +11 -0
- package/dist/src/core/functions/rest/helpers/createFileHandler/createFileHandler.d.ts +2 -0
- package/dist/src/core/functions/rest/helpers/createFileHandler/createFileHandler.js +29 -0
- package/dist/src/core/functions/rest/helpers/createQueueHandler/createQueueHandler.d.ts +5 -0
- package/dist/src/core/functions/rest/helpers/createQueueHandler/createQueueHandler.js +35 -0
- package/dist/src/core/functions/rest/helpers/formatSsePayload/formatSsePayload.d.ts +5 -0
- package/dist/src/core/functions/rest/helpers/formatSsePayload/formatSsePayload.js +50 -0
- package/dist/src/core/functions/rest/helpers/index.d.ts +3 -0
- package/dist/src/core/functions/rest/helpers/index.js +20 -0
- package/dist/src/core/functions/rest/index.d.ts +1 -0
- package/dist/src/core/{graphql/createGraphQLRoutes/helpers → functions/rest}/index.js +1 -1
- package/dist/src/core/functions/rest/rest.d.ts +102 -0
- package/dist/src/core/functions/rest/rest.js +165 -0
- package/dist/src/core/graphql/createGraphQLRoute/createGraphQLRoute.d.ts +8 -0
- package/dist/src/core/graphql/createGraphQLRoute/createGraphQLRoute.js +158 -0
- package/dist/src/core/graphql/createGraphQLRoute/helpers/calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight.d.ts +2 -0
- package/dist/src/core/graphql/{createGraphQLRoutes/helpers/prepareGraphQLRequestConfigs/prepareGraphQLRequestConfigs.js → createGraphQLRoute/helpers/calculateGraphQLRouteConfigWeight/calculateGraphQLRouteConfigWeight.js} +3 -11
- package/dist/src/core/graphql/createGraphQLRoute/helpers/index.d.ts +3 -0
- package/dist/src/core/graphql/createGraphQLRoute/helpers/index.js +20 -0
- package/dist/src/core/graphql/createGraphQLRoute/helpers/matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts.d.ts +12 -0
- package/dist/src/core/graphql/createGraphQLRoute/helpers/matchGraphQLRequestArtifacts/matchGraphQLRequestArtifacts.js +28 -0
- package/dist/src/core/graphql/createGraphQLRoute/helpers/prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts.d.ts +2 -0
- package/dist/src/core/graphql/createGraphQLRoute/helpers/prepareGraphQLRequestArtifacts/prepareGraphQLRequestArtifacts.js +11 -0
- package/dist/src/core/graphql/index.d.ts +2 -1
- package/dist/src/core/graphql/index.js +2 -1
- package/dist/src/core/middlewares/contextMiddleware/contextMiddleware.d.ts +6 -4
- package/dist/src/core/rest/createRestRoute/createRestRoute.d.ts +8 -0
- package/dist/src/core/rest/createRestRoute/createRestRoute.js +190 -0
- package/dist/src/core/rest/createRestRoute/helpers/calculateRestRouteConfigWeight/calculateRestRouteConfigWeight.d.ts +2 -0
- package/dist/src/core/rest/createRestRoute/helpers/calculateRestRouteConfigWeight/calculateRestRouteConfigWeight.js +35 -0
- package/dist/src/core/rest/createRestRoute/helpers/index.d.ts +3 -0
- package/dist/src/core/rest/createRestRoute/helpers/index.js +20 -0
- package/dist/src/core/rest/createRestRoute/helpers/matchRestRequestArtifacts/matchRestRequestArtifacts.d.ts +11 -0
- package/dist/src/core/rest/createRestRoute/helpers/matchRestRequestArtifacts/matchRestRequestArtifacts.js +31 -0
- package/dist/src/core/rest/createRestRoute/helpers/prepareRestRequestArtifacts/prepareRestRequestArtifacts.d.ts +2 -0
- package/dist/src/core/rest/createRestRoute/helpers/prepareRestRequestArtifacts/prepareRestRequestArtifacts.js +37 -0
- package/dist/src/core/rest/index.d.ts +2 -1
- package/dist/src/core/rest/index.js +2 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/server/createMockServer/createMockServer.d.ts +1 -1
- package/dist/src/server/createMockServer/createMockServer.js +76 -45
- package/dist/src/server/index.d.ts +0 -8
- package/dist/src/server/index.js +0 -8
- package/dist/src/server/startMockServer/startMockServer.d.ts +2 -2
- package/dist/src/server/startMockServer/startMockServer.js +4 -3
- package/dist/src/utils/constants/checkModes.js +7 -7
- package/dist/src/utils/helpers/config/resolveEntityValues/resolveEntityValues.js +1 -1
- package/dist/src/utils/helpers/files/isFileDescriptor/isFileDescriptor.js +2 -2
- package/dist/src/utils/helpers/files/isFilePathValid/isFilePathValid.js +3 -3
- package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.d.ts +3 -3
- package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.js +2 -2
- package/dist/src/utils/helpers/tests/createTmpDir.js +4 -4
- package/dist/src/utils/helpers/url/index.d.ts +1 -2
- package/dist/src/utils/helpers/url/index.js +1 -2
- package/dist/src/utils/helpers/url/normalizeUrl/normalizeUrl.d.ts +1 -0
- package/dist/src/utils/helpers/url/normalizeUrl/normalizeUrl.js +15 -0
- package/dist/src/utils/helpers/url/urlJoin/urlJoin.js +4 -4
- package/dist/src/utils/types/graphql.d.ts +44 -18
- package/dist/src/utils/types/rest.d.ts +44 -27
- package/dist/src/utils/types/server.d.ts +7 -24
- package/dist/src/utils/types/values.d.ts +6 -1
- package/dist/src/utils/validate/graphqlConfigSchema/graphqlConfigSchema.d.ts +41 -383
- package/dist/src/utils/validate/graphqlConfigSchema/graphqlConfigSchema.js +3 -3
- package/dist/src/utils/validate/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +3 -66
- package/dist/src/utils/validate/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.js +7 -22
- package/dist/src/utils/validate/index.d.ts +0 -2
- package/dist/src/utils/validate/index.js +0 -2
- package/dist/src/utils/validate/queueSchema/queueSchema.d.ts +2 -11
- package/dist/src/utils/validate/queueSchema/queueSchema.js +7 -13
- package/dist/src/utils/validate/restConfigSchema/restConfigSchema.d.ts +101 -1309
- package/dist/src/utils/validate/restConfigSchema/restConfigSchema.js +3 -3
- package/dist/src/utils/validate/restConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +3 -82
- package/dist/src/utils/validate/restConfigSchema/routeConfigSchema/routeConfigSchema.js +6 -28
- package/dist/src/utils/validate/settingsSchema/settingsSchema.d.ts +0 -3
- package/dist/src/utils/validate/settingsSchema/settingsSchema.js +0 -1
- package/dist/src/utils/validate/utils/checkModeSchema/checkModeSchema.js +6 -6
- package/dist/src/utils/validate/utils/entitiesSchema/entitiesSchema.js +4 -4
- package/dist/src/utils/validate/utils/jsonSchema/jsonSchema.js +3 -3
- package/dist/src/utils/validate/utils/requiredPropertiesSchema/requiredPropertiesSchema.js +1 -1
- package/dist/src/utils/validate/utils/sharedSchema/sharedSchema.js +3 -3
- package/dist/src/utils/validate/validateMockServerConfig.js +18 -8
- package/package.json +17 -40
- package/LICENSE +0 -21
- package/dist/bin/runFlatConfig.d.ts +0 -5
- package/dist/bin/runFlatConfig.js +0 -36
- package/dist/src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.d.ts +0 -9
- package/dist/src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.js +0 -160
- package/dist/src/core/graphql/createGraphQLRoutes/helpers/index.d.ts +0 -1
- package/dist/src/core/graphql/createGraphQLRoutes/helpers/prepareGraphQLRequestConfigs/prepareGraphQLRequestConfigs.d.ts +0 -2
- package/dist/src/core/rest/createRestRoutes/createRestRoutes.d.ts +0 -9
- package/dist/src/core/rest/createRestRoutes/createRestRoutes.js +0 -184
- package/dist/src/core/rest/createRestRoutes/helpers/index.d.ts +0 -1
- package/dist/src/core/rest/createRestRoutes/helpers/prepareRestRequestConfigs/prepareRestRequestConfigs.d.ts +0 -2
- package/dist/src/core/rest/createRestRoutes/helpers/prepareRestRequestConfigs/prepareRestRequestConfigs.js +0 -67
- package/dist/src/server/createDatabaseMockServer/createDatabaseMockServer.d.ts +0 -3
- package/dist/src/server/createDatabaseMockServer/createDatabaseMockServer.js +0 -62
- package/dist/src/server/createFlatMockServer/createFlatMockServer.d.ts +0 -3
- package/dist/src/server/createFlatMockServer/createFlatMockServer.js +0 -128
- package/dist/src/server/createGraphQLMockServer/createGraphQLMockServer.d.ts +0 -3
- package/dist/src/server/createGraphQLMockServer/createGraphQLMockServer.js +0 -67
- package/dist/src/server/createRestMockServer/createRestMockServer.d.ts +0 -3
- package/dist/src/server/createRestMockServer/createRestMockServer.js +0 -67
- package/dist/src/server/startDatabaseMockServer/startDatabaseMockServer.d.ts +0 -4
- package/dist/src/server/startDatabaseMockServer/startDatabaseMockServer.js +0 -29
- package/dist/src/server/startFlatMockServer/startFlatMockServer.d.ts +0 -4
- package/dist/src/server/startFlatMockServer/startFlatMockServer.js +0 -30
- package/dist/src/server/startGraphQLMockServer/startGraphQLMockServer.d.ts +0 -4
- package/dist/src/server/startGraphQLMockServer/startGraphQLMockServer.js +0 -29
- package/dist/src/server/startRestMockServer/startRestMockServer.d.ts +0 -4
- package/dist/src/server/startRestMockServer/startRestMockServer.js +0 -29
- package/dist/src/utils/helpers/url/getUrlParts/getUrlParts.d.ts +0 -1
- package/dist/src/utils/helpers/url/getUrlParts/getUrlParts.js +0 -12
- package/dist/src/utils/helpers/url/removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes.d.ts +0 -1
- package/dist/src/utils/helpers/url/removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes.js +0 -11
- package/dist/src/utils/validate/isOnlyRequestedDataResolvingPropertyExists.d.ts +0 -4
- package/dist/src/utils/validate/isOnlyRequestedDataResolvingPropertyExists.js +0 -16
- package/dist/src/utils/validate/validateApiMockServerConfig.d.ts +0 -2
- package/dist/src/utils/validate/validateApiMockServerConfig.js +0 -48
|
@@ -11,11 +11,14 @@ Object.defineProperty(exports, "routeConfigSchema", {
|
|
|
11
11
|
const _zod = require("zod");
|
|
12
12
|
const _helpers = require("../../../helpers");
|
|
13
13
|
const _interceptorsSchema = require("../../interceptorsSchema/interceptorsSchema");
|
|
14
|
-
const _isOnlyRequestedDataResolvingPropertyExists = require("../../isOnlyRequestedDataResolvingPropertyExists");
|
|
15
|
-
const _queueSchema = require("../../queueSchema/queueSchema");
|
|
16
14
|
const _settingsSchema = require("../../settingsSchema/settingsSchema");
|
|
17
15
|
const _utils = require("../../utils");
|
|
18
|
-
const
|
|
16
|
+
const dataRouteConfigSchema = _zod.z.strictObject({
|
|
17
|
+
settings: (0, _utils.plainObjectSchema)(_settingsSchema.settingsSchema).optional(),
|
|
18
|
+
data: _zod.z.union([
|
|
19
|
+
_zod.z.function(),
|
|
20
|
+
_zod.z.any()
|
|
21
|
+
]),
|
|
19
22
|
entities: (0, _utils.plainObjectSchema)(_zod.z.strictObject({
|
|
20
23
|
headers: _utils.mappedEntitySchema.optional(),
|
|
21
24
|
cookies: _utils.mappedEntitySchema.optional(),
|
|
@@ -24,22 +27,4 @@ const baseRouteConfigSchema = _zod.z.strictObject({
|
|
|
24
27
|
})).optional(),
|
|
25
28
|
interceptors: (0, _utils.plainObjectSchema)(_interceptorsSchema.interceptorsSchema).optional()
|
|
26
29
|
});
|
|
27
|
-
const
|
|
28
|
-
settings: (0, _utils.plainObjectSchema)(_settingsSchema.settingsSchema.extend({
|
|
29
|
-
polling: _zod.z.literal(false).optional()
|
|
30
|
-
})).optional(),
|
|
31
|
-
data: _zod.z.union([
|
|
32
|
-
_zod.z.function(),
|
|
33
|
-
_zod.z.any()
|
|
34
|
-
])
|
|
35
|
-
}).merge(baseRouteConfigSchema);
|
|
36
|
-
const queueRouteConfigSchema = _zod.z.strictObject({
|
|
37
|
-
settings: _settingsSchema.settingsSchema.extend({
|
|
38
|
-
polling: _zod.z.literal(true)
|
|
39
|
-
}),
|
|
40
|
-
queue: _queueSchema.queueSchema
|
|
41
|
-
}).merge(baseRouteConfigSchema);
|
|
42
|
-
const routeConfigSchema = _zod.z.union([
|
|
43
|
-
_zod.z.custom((value)=>(0, _helpers.isPlainObject)(value) && (0, _isOnlyRequestedDataResolvingPropertyExists.isOnlyRequestedDataResolvingPropertyExists)(value, 'data')).pipe(dataRouteConfigSchema),
|
|
44
|
-
_zod.z.custom((value)=>(0, _helpers.isPlainObject)(value) && (0, _isOnlyRequestedDataResolvingPropertyExists.isOnlyRequestedDataResolvingPropertyExists)(value, 'queue')).pipe(queueRouteConfigSchema)
|
|
45
|
-
]);
|
|
30
|
+
const routeConfigSchema = _zod.z.custom((value)=>(0, _helpers.isPlainObject)(value) && 'data' in value).pipe(dataRouteConfigSchema);
|
|
@@ -9,6 +9,4 @@ export * from './portSchema/portSchema';
|
|
|
9
9
|
export * from './restConfigSchema/restConfigSchema';
|
|
10
10
|
export * from './staticPathSchema/staticPathSchema';
|
|
11
11
|
export * from './utils';
|
|
12
|
-
export * from './validateApiMockServerConfig';
|
|
13
|
-
export * from './validateFlatMockServerConfig';
|
|
14
12
|
export * from './validateMockServerConfig';
|
|
@@ -13,8 +13,6 @@ _export_star(require("./portSchema/portSchema"), exports);
|
|
|
13
13
|
_export_star(require("./restConfigSchema/restConfigSchema"), exports);
|
|
14
14
|
_export_star(require("./staticPathSchema/staticPathSchema"), exports);
|
|
15
15
|
_export_star(require("./utils"), exports);
|
|
16
|
-
_export_star(require("./validateApiMockServerConfig"), exports);
|
|
17
|
-
_export_star(require("./validateFlatMockServerConfig"), exports);
|
|
18
16
|
_export_star(require("./validateMockServerConfig"), exports);
|
|
19
17
|
function _export_star(from, to) {
|
|
20
18
|
Object.keys(from).forEach(function(k) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const queueSchema: z.ZodArray<z.
|
|
2
|
+
export declare const queueSchema: z.ZodArray<z.ZodObject<{
|
|
3
3
|
time: z.ZodOptional<z.ZodNumber>;
|
|
4
4
|
data: z.ZodUnion<[z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>, z.ZodAny]>;
|
|
5
5
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -8,13 +8,4 @@ export declare const queueSchema: z.ZodArray<z.ZodUnion<[z.ZodPipeline<z.ZodType
|
|
|
8
8
|
}, {
|
|
9
9
|
data?: any;
|
|
10
10
|
time?: number | undefined;
|
|
11
|
-
}
|
|
12
|
-
time: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
file: z.ZodString;
|
|
14
|
-
}, "strict", z.ZodTypeAny, {
|
|
15
|
-
file: string;
|
|
16
|
-
time?: number | undefined;
|
|
17
|
-
}, {
|
|
18
|
-
file: string;
|
|
19
|
-
time?: number | undefined;
|
|
20
|
-
}>]>, "many">;
|
|
11
|
+
}>, "many">;
|
|
@@ -9,16 +9,10 @@ Object.defineProperty(exports, "queueSchema", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _zod = require("zod");
|
|
12
|
-
const queueSchema = _zod.z.array(_zod.z.
|
|
13
|
-
_zod.z.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})),
|
|
20
|
-
_zod.z.strictObject({
|
|
21
|
-
time: _zod.z.number().int().nonnegative().optional(),
|
|
22
|
-
file: _zod.z.string()
|
|
23
|
-
})
|
|
24
|
-
]));
|
|
12
|
+
const queueSchema = _zod.z.array(_zod.z.strictObject({
|
|
13
|
+
time: _zod.z.number().int().nonnegative().optional(),
|
|
14
|
+
data: _zod.z.union([
|
|
15
|
+
_zod.z.function(),
|
|
16
|
+
_zod.z.any()
|
|
17
|
+
])
|
|
18
|
+
}));
|