mock-config-server 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +614 -502
- package/dist/bin/bin.js +8 -3
- package/dist/bin/build.js +51 -45
- package/dist/bin/cli.js +37 -44
- package/dist/bin/helpers/index.js +36 -17
- package/dist/bin/helpers/resolveConfigFile.js +20 -17
- package/dist/bin/helpers/resolveConfigFilePath.js +12 -35
- package/dist/bin/helpers/resolveExportsFromSourceCode.js +11 -8
- package/dist/bin/resolveConfigFilePath/resolveConfigFilePath.js +12 -35
- package/dist/bin/run.js +17 -12
- package/dist/bin/validateMockServerConfig/helpers/index.js +25 -16
- package/dist/bin/validateMockServerConfig/helpers/isCheckModeValid/index.js +14 -15
- package/dist/bin/validateMockServerConfig/helpers/isCheckModeValid/isCheckModeValid.js +8 -6
- package/dist/bin/validateMockServerConfig/helpers/isDescriptorValueValid/index.js +14 -15
- package/dist/bin/validateMockServerConfig/helpers/isDescriptorValueValid/isDescriptorValueValid.js +15 -18
- package/dist/bin/validateMockServerConfig/validateBaseUrl/validateBaseUrl.js +12 -9
- package/dist/bin/validateMockServerConfig/validateCors/validateCors.js +75 -73
- package/dist/bin/validateMockServerConfig/validateDatabaseConfig/validateDatabaseConfig.d.ts +1 -0
- package/dist/bin/validateMockServerConfig/validateDatabaseConfig/validateDatabaseConfig.js +45 -0
- package/dist/bin/validateMockServerConfig/validateGraphqlConfig/validateGraphqlConfig.js +47 -43
- package/dist/bin/validateMockServerConfig/validateGraphqlConfig/validateRoutes/validateRoutes.js +90 -83
- package/dist/bin/validateMockServerConfig/validateInterceptors/validateInterceptors.js +22 -16
- package/dist/bin/validateMockServerConfig/validateMockServerConfig.js +29 -27
- package/dist/bin/validateMockServerConfig/validatePort/validatePort.js +9 -6
- package/dist/bin/validateMockServerConfig/validateRestConfig/validateRestConfig.js +52 -47
- package/dist/bin/validateMockServerConfig/validateRestConfig/validateRoutes/validateRoutes.js +94 -87
- package/dist/bin/validateMockServerConfig/validateStaticPath/validateStaticPath.js +43 -34
- package/dist/src/core/database/createDatabaseRoutes/createDatabaseRoutes.d.ts +3 -0
- package/dist/src/core/database/createDatabaseRoutes/createDatabaseRoutes.js +33 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/createNewId/createNewId.d.ts +4 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/createNewId/createNewId.js +16 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/findIndexById/findIndexById.d.ts +4 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/findIndexById/findIndexById.js +8 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/index.d.ts +3 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/index.js +38 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/isIndex/isIndex.d.ts +1 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/array/isIndex/isIndex.js +8 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/createNestedDatabaseRoutes/createNestedDatabaseRoutes.d.ts +4 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/createNestedDatabaseRoutes/createNestedDatabaseRoutes.js +88 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/createRewrittenDatabaseRoutes/createRewrittenDatabaseRoutes.d.ts +2 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/createRewrittenDatabaseRoutes/createRewrittenDatabaseRoutes.js +12 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/createShallowDatabaseRoutes/createShallowDatabaseRoutes.d.ts +4 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/createShallowDatabaseRoutes/createShallowDatabaseRoutes.js +38 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/index.d.ts +5 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/index.js +60 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/splitDatabaseByNesting/splitDatabaseByNesting.d.ts +5 -0
- package/dist/src/core/database/createDatabaseRoutes/helpers/splitDatabaseByNesting/splitDatabaseByNesting.js +30 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.d.ts +11 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.js +64 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.d.ts +11 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.js +58 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/Memory/MemoryStorage.d.ts +10 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/Memory/MemoryStorage.js +54 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/index.d.ts +2 -0
- package/dist/src/core/database/createDatabaseRoutes/storages/index.js +27 -0
- package/dist/src/core/database/index.d.ts +1 -0
- package/dist/src/core/database/index.js +16 -0
- package/dist/src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.js +96 -83
- package/dist/src/core/graphql/createGraphQLRoutes/helpers/index.js +14 -15
- package/dist/src/core/graphql/createGraphQLRoutes/helpers/prepareGraphQLRequestConfigs/prepareGraphQLRequestConfigs.js +36 -30
- package/dist/src/core/graphql/index.js +14 -15
- package/dist/src/core/middlewares/cookieParseMiddleware/cookieParseMiddleware.js +15 -13
- package/dist/src/core/middlewares/cookieParseMiddleware/helpers/index.js +14 -15
- package/dist/src/core/middlewares/cookieParseMiddleware/helpers/parseCookie/parseCookie.js +16 -14
- package/dist/src/core/middlewares/corsMiddleware/corsMiddleware.js +48 -41
- package/dist/src/core/middlewares/corsMiddleware/helpers/getAllowedOrigins/getAllowedOrigins.js +13 -10
- package/dist/src/core/middlewares/corsMiddleware/helpers/index.js +14 -15
- package/dist/src/core/middlewares/destroyerMiddleware/destroyerMiddleware.js +21 -18
- package/dist/src/core/middlewares/errorMiddleware/errorMiddleware.js +18 -15
- package/dist/src/core/middlewares/index.js +92 -23
- package/dist/src/core/middlewares/noCorsMiddleware/noCorsMiddleware.js +21 -21
- package/dist/src/core/middlewares/notFoundMiddleware/helpers/getGraphqlUrlSuggestions/getGraphqlUrlSuggestions.js +24 -16
- package/dist/src/core/middlewares/notFoundMiddleware/helpers/getLevenshteinDistance/getLevenshteinDistance.js +78 -74
- package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/getRestUrlSuggestions.js +36 -31
- package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/helpers/getActualRestUrlMeaningfulString/getActualRestUrlMeaningfulString.js +6 -5
- package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/helpers/getPatternRestUrlMeaningfulString/getPatternRestUrlMeaningfulString.js +6 -3
- package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/helpers/index.js +25 -16
- package/dist/src/core/middlewares/notFoundMiddleware/helpers/index.js +36 -17
- package/dist/src/core/middlewares/notFoundMiddleware/notFoundMiddleware.js +63 -48
- package/dist/src/core/middlewares/requestInterceptorMiddleware/requestInterceptorMiddleware.js +13 -7
- package/dist/src/core/middlewares/staticMiddleware/staticMiddleware.js +26 -25
- package/dist/src/core/rest/createRestRoutes/createRestRoutes.js +71 -56
- package/dist/src/core/rest/createRestRoutes/helpers/index.js +14 -15
- package/dist/src/core/rest/createRestRoutes/helpers/prepareRestRequestConfigs/prepareRestRequestConfigs.js +38 -32
- package/dist/src/core/rest/index.js +14 -15
- package/dist/src/index.js +36 -17
- package/dist/src/server/createMockServer/createMockServer.js +74 -53
- package/dist/src/server/index.js +25 -16
- package/dist/src/server/startMockServer/startMockServer.js +20 -17
- package/dist/src/static/views/assets/icons/scheme-dark.svg +3 -3
- package/dist/src/static/views/assets/icons/scheme-light.svg +3 -3
- package/dist/src/static/views/assets/styles/global.css +88 -88
- package/dist/src/static/views/components/header/index.css +55 -55
- package/dist/src/static/views/components/header/index.ejs +39 -39
- package/dist/src/static/views/components/header/index.js +1 -1
- package/dist/src/static/views/features/scheme/dark.css +12 -12
- package/dist/src/static/views/features/scheme/index.ejs +3 -3
- package/dist/src/static/views/features/scheme/index.js +31 -31
- package/dist/src/static/views/features/scheme/light.css +12 -12
- package/dist/src/static/views/features/tab/index.css +30 -30
- package/dist/src/static/views/features/tab/index.ejs +1 -1
- package/dist/src/static/views/features/tab/index.js +12 -12
- package/dist/src/static/views/pages/404/index.css +10 -10
- package/dist/src/static/views/pages/404/index.ejs +84 -84
- package/dist/src/utils/constants/appPath.js +6 -2
- package/dist/src/utils/constants/checkModes.js +21 -30
- package/dist/src/utils/constants/default.js +15 -11
- package/dist/src/utils/constants/index.js +36 -17
- package/dist/src/utils/helpers/asyncHandler.js +6 -3
- package/dist/src/utils/helpers/config/index.js +14 -15
- package/dist/src/utils/helpers/config/resolveEntityValues/resolveEntityValues.js +109 -122
- package/dist/src/utils/helpers/entities/convertToEntityDescriptor/convertToEntityDescriptor.js +10 -6
- package/dist/src/utils/helpers/entities/index.js +25 -16
- package/dist/src/utils/helpers/entities/isEntityDescriptor/isEntityDescriptor.js +7 -4
- package/dist/src/utils/helpers/graphql/getGraphQLInput/getGraphQLInput.js +28 -18
- package/dist/src/utils/helpers/graphql/index.js +36 -17
- package/dist/src/utils/helpers/graphql/parseGraphQLRequest/parseGraphQLRequest.js +11 -9
- package/dist/src/utils/helpers/graphql/parseQuery/parseQuery.js +20 -17
- package/dist/src/utils/helpers/index.js +114 -25
- package/dist/src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.js +22 -16
- package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.js +56 -48
- package/dist/src/utils/helpers/interceptors/helpers/setDelay.js +8 -5
- package/dist/src/utils/helpers/interceptors/index.js +25 -16
- package/dist/src/utils/helpers/isPlainObject/isPlainObject.js +6 -6
- package/dist/src/utils/helpers/isPrimitive/isPrimitive.js +6 -3
- package/dist/src/utils/helpers/isRegExp/isRegExp.js +6 -3
- package/dist/src/utils/helpers/sleep.js +7 -4
- package/dist/src/utils/helpers/url/convertWin32PathToUnix/convertWin32PathToUnix.js +6 -6
- package/dist/src/utils/helpers/url/getUrlParts/getUrlParts.js +7 -4
- package/dist/src/utils/helpers/url/index.js +47 -18
- package/dist/src/utils/helpers/url/removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes.js +6 -3
- package/dist/src/utils/helpers/url/urlJoin/urlJoin.js +11 -10
- package/dist/src/utils/types/checkModes.js +1 -2
- package/dist/src/utils/types/database.d.ts +6 -0
- package/dist/src/utils/types/database.js +1 -0
- package/dist/src/utils/types/graphql.js +1 -2
- package/dist/src/utils/types/index.d.ts +1 -0
- package/dist/src/utils/types/index.js +80 -20
- package/dist/src/utils/types/interceptors.js +1 -2
- package/dist/src/utils/types/rest.js +1 -2
- package/dist/src/utils/types/server.d.ts +5 -0
- package/dist/src/utils/types/server.js +1 -2
- package/dist/src/utils/types/values.js +1 -2
- package/package.json +130 -113
- package/dist/index.js +0 -17
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.isRegExp = void 0;
|
|
4
|
-
const isRegExp =
|
|
5
|
-
exports.isRegExp = isRegExp;
|
|
7
|
+
const isRegExp = value => value instanceof RegExp;
|
|
8
|
+
exports.isRegExp = isRegExp;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.sleep = void 0;
|
|
4
|
-
const sleep =
|
|
5
|
-
|
|
7
|
+
const sleep = milliseconds => new Promise(resolve => {
|
|
8
|
+
setTimeout(resolve, milliseconds);
|
|
6
9
|
});
|
|
7
|
-
exports.sleep = sleep;
|
|
10
|
+
exports.sleep = sleep;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.convertWin32PathToUnix = void 0;
|
|
4
|
-
const convertWin32PathToUnix =
|
|
5
|
-
|
|
6
|
-
.replace(/\\/g, '/')
|
|
7
|
-
.replace(/\/\/+/g, '/');
|
|
8
|
-
exports.convertWin32PathToUnix = convertWin32PathToUnix;
|
|
7
|
+
const convertWin32PathToUnix = win32Path => win32Path.replace(/^\\\\\?\\/, '').replace(/\\/g, '/').replace(/\/\/+/g, '/');
|
|
8
|
+
exports.convertWin32PathToUnix = convertWin32PathToUnix;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.getUrlParts = void 0;
|
|
4
|
-
|
|
5
|
-
const getUrlParts =
|
|
6
|
-
exports.getUrlParts = getUrlParts;
|
|
7
|
+
var _removeLeadingAndTrailingSlashes = require("../removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes");
|
|
8
|
+
const getUrlParts = url => (0, _removeLeadingAndTrailingSlashes.removeLeadingAndTrailingSlashes)(url).split('/');
|
|
9
|
+
exports.getUrlParts = getUrlParts;
|
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _convertWin32PathToUnix = require("./convertWin32PathToUnix/convertWin32PathToUnix");
|
|
7
|
+
Object.keys(_convertWin32PathToUnix).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _convertWin32PathToUnix[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _convertWin32PathToUnix[key];
|
|
7
14
|
}
|
|
8
|
-
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _getUrlParts = require("./getUrlParts/getUrlParts");
|
|
18
|
+
Object.keys(_getUrlParts).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _getUrlParts[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _getUrlParts[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _removeLeadingAndTrailingSlashes = require("./removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes");
|
|
29
|
+
Object.keys(_removeLeadingAndTrailingSlashes).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _removeLeadingAndTrailingSlashes[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _removeLeadingAndTrailingSlashes[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _urlJoin = require("./urlJoin/urlJoin");
|
|
40
|
+
Object.keys(_urlJoin).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _urlJoin[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _urlJoin[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.removeLeadingAndTrailingSlashes = void 0;
|
|
4
|
-
const removeLeadingAndTrailingSlashes =
|
|
5
|
-
exports.removeLeadingAndTrailingSlashes = removeLeadingAndTrailingSlashes;
|
|
7
|
+
const removeLeadingAndTrailingSlashes = string => string.replace(/^\/+|\/+$/g, '');
|
|
8
|
+
exports.removeLeadingAndTrailingSlashes = removeLeadingAndTrailingSlashes;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
6
|
exports.urlJoin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var _os = _interopRequireDefault(require("os"));
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _convertWin32PathToUnix = require("../convertWin32PathToUnix/convertWin32PathToUnix");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
11
|
const urlJoin = (...paths) => {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const pathsToJoin = _os.default.platform() === 'win32' ? paths.map(path => (0, _convertWin32PathToUnix.convertWin32PathToUnix)(path)) : paths;
|
|
13
|
+
return _path.default.posix.join(...pathsToJoin);
|
|
13
14
|
};
|
|
14
|
-
exports.urlJoin = urlJoin;
|
|
15
|
+
exports.urlJoin = urlJoin;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -1,22 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _checkModes = require("./checkModes");
|
|
7
|
+
Object.keys(_checkModes).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _checkModes[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _checkModes[key];
|
|
7
14
|
}
|
|
8
|
-
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _database = require("./database");
|
|
18
|
+
Object.keys(_database).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _database[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _database[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _graphql = require("./graphql");
|
|
29
|
+
Object.keys(_graphql).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _graphql[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _graphql[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _interceptors = require("./interceptors");
|
|
40
|
+
Object.keys(_interceptors).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _interceptors[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _interceptors[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _rest = require("./rest");
|
|
51
|
+
Object.keys(_rest).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _rest[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _rest[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _server = require("./server");
|
|
62
|
+
Object.keys(_server).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _server[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _server[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _values = require("./values");
|
|
73
|
+
Object.keys(_values).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _values[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _values[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -29,10 +29,15 @@ export interface GraphqlConfig {
|
|
|
29
29
|
configs: GraphQLRequestConfig[];
|
|
30
30
|
interceptors?: Interceptors;
|
|
31
31
|
}
|
|
32
|
+
export type DatabaseConfig = {
|
|
33
|
+
data: Record<string, unknown> | `${string}.json`;
|
|
34
|
+
routes?: Record<`/${string}`, `/${string}`> | `${string}.json`;
|
|
35
|
+
};
|
|
32
36
|
export interface MockServerConfig {
|
|
33
37
|
baseUrl?: BaseUrl;
|
|
34
38
|
rest?: RestConfig;
|
|
35
39
|
graphql?: GraphqlConfig;
|
|
40
|
+
database?: DatabaseConfig;
|
|
36
41
|
port?: Port;
|
|
37
42
|
staticPath?: StaticPath;
|
|
38
43
|
interceptors?: Interceptors;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
package/package.json
CHANGED
|
@@ -1,113 +1,130 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mock-config-server",
|
|
3
|
-
"version": "3.0
|
|
4
|
-
"description": "Tool that easily and quickly imitates server operation, create full fake api in few steps",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "SIBERIA CAN CODE 🧊",
|
|
7
|
-
"url": "https://github.com/siberiacancode"
|
|
8
|
-
},
|
|
9
|
-
"contributors": [
|
|
10
|
-
{
|
|
11
|
-
"name": "Dmitry Babin",
|
|
12
|
-
"url": "https://github.com/debabin"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"name": "Nursultan Zianurov",
|
|
16
|
-
"url": "https://github.com/MiaInturi"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"name": "Sergey Kryavkin",
|
|
20
|
-
"url": "https://github.com/RiceWithMeat"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"dist"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"@types/
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "mock-config-server",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "Tool that easily and quickly imitates server operation, create full fake api in few steps",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "SIBERIA CAN CODE 🧊",
|
|
7
|
+
"url": "https://github.com/siberiacancode"
|
|
8
|
+
},
|
|
9
|
+
"contributors": [
|
|
10
|
+
{
|
|
11
|
+
"name": "Dmitry Babin",
|
|
12
|
+
"url": "https://github.com/debabin"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Nursultan Zianurov",
|
|
16
|
+
"url": "https://github.com/MiaInturi"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "Sergey Kryavkin",
|
|
20
|
+
"url": "https://github.com/RiceWithMeat"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Alexander Vasilchuk",
|
|
24
|
+
"url": "https://github.com/anv296"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"bin": {
|
|
31
|
+
"mock-config-server": "dist/bin/bin.js",
|
|
32
|
+
"mcs": "dist/bin/bin.js"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=10"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"prepare": "husky install && yarn build",
|
|
42
|
+
"build:types": "tsc -p tsconfig.production.json && tsc-alias -p tsconfig.production.json",
|
|
43
|
+
"build:babel": "babel --delete-dir-on-start bin --out-dir dist/bin --extensions \".ts,.tsx\" && babel src --out-dir dist/src --extensions \".ts,.tsx\" --copy-files --no-copy-ignored && babel ./index.ts --out-dir dist",
|
|
44
|
+
"build": "yarn build:babel && yarn build:types",
|
|
45
|
+
"start": "yarn build && node ./dist/bin/bin.js",
|
|
46
|
+
"dev": "nodemon --watch src --watch bin --watch mock-server.config.* -e js,ts,ejs --exec \"yarn start\"",
|
|
47
|
+
"test": "jest",
|
|
48
|
+
"type": "tsc --noEmit",
|
|
49
|
+
"lint": "eslint . --ext .ts --no-error-on-unmatched-pattern --fix",
|
|
50
|
+
"stylelint": "stylelint \"src/static/**/*.css\" --fix",
|
|
51
|
+
"format": "prettier --write \"{src,bin}/**/*.ts\"",
|
|
52
|
+
"pretty": "yarn format && yarn lint"
|
|
53
|
+
},
|
|
54
|
+
"lint-staged": {
|
|
55
|
+
"*.css": [
|
|
56
|
+
"stylelint --fix"
|
|
57
|
+
],
|
|
58
|
+
"*.js": [
|
|
59
|
+
"prettier --write"
|
|
60
|
+
],
|
|
61
|
+
"*.ts": [
|
|
62
|
+
"prettier --write",
|
|
63
|
+
"eslint --no-error-on-unmatched-pattern --fix"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@types/body-parser": "^1.19.2",
|
|
68
|
+
"@types/express": "^4.17.17",
|
|
69
|
+
"@types/flat": "^5.0.2",
|
|
70
|
+
"@types/yargs": "^17.0.24",
|
|
71
|
+
"ansi-colors": "^4.1.3",
|
|
72
|
+
"body-parser": "^1.20.0",
|
|
73
|
+
"ejs": "^3.1.9",
|
|
74
|
+
"esbuild": "^0.18.17",
|
|
75
|
+
"express": "^4.18.1",
|
|
76
|
+
"express-urlrewrite": "^2.0.1",
|
|
77
|
+
"flat": "^5.0.2",
|
|
78
|
+
"graphql": "^16.6.0",
|
|
79
|
+
"please-upgrade-node": "^3.2.0",
|
|
80
|
+
"yargs": "^17.7.1"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@babel/cli": "^7.22.10",
|
|
84
|
+
"@babel/core": "^7.22.10",
|
|
85
|
+
"@babel/preset-env": "^7.22.10",
|
|
86
|
+
"@babel/preset-typescript": "^7.22.5",
|
|
87
|
+
"@types/jest": "^29.4.0",
|
|
88
|
+
"@types/supertest": "^2.0.12",
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
90
|
+
"@typescript-eslint/parser": "^6.2.0",
|
|
91
|
+
"eslint": "^8.35.0",
|
|
92
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
93
|
+
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
94
|
+
"eslint-config-prettier": "^8.7.0",
|
|
95
|
+
"eslint-import-resolver-typescript": "^3.4.1",
|
|
96
|
+
"eslint-plugin-import": "^2.27.5",
|
|
97
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
98
|
+
"husky": "^8.0.1",
|
|
99
|
+
"jest": "^29.4.2",
|
|
100
|
+
"lint-staged": "^13.1.1",
|
|
101
|
+
"nodemon": "^3.0.1",
|
|
102
|
+
"prettier": "^3.0.0",
|
|
103
|
+
"style-loader": "^3.3.2",
|
|
104
|
+
"stylelint": "^15.6.1",
|
|
105
|
+
"stylelint-config-prettier": "^9.0.5",
|
|
106
|
+
"stylelint-config-standard": "^34.0.0",
|
|
107
|
+
"stylelint-order": "^6.0.3",
|
|
108
|
+
"supertest": "^6.3.3",
|
|
109
|
+
"ts-jest": "^29.0.3",
|
|
110
|
+
"tsc-alias": "^1.8.5",
|
|
111
|
+
"typescript": "^5.1.6"
|
|
112
|
+
},
|
|
113
|
+
"homepage": "https://github.com/siberiacancode/mock-config-server",
|
|
114
|
+
"repository": {
|
|
115
|
+
"type": "git",
|
|
116
|
+
"url": "https://github.com/siberiacancode/mock-config-server.git"
|
|
117
|
+
},
|
|
118
|
+
"keywords": [
|
|
119
|
+
"server",
|
|
120
|
+
"fake",
|
|
121
|
+
"REST",
|
|
122
|
+
"rest",
|
|
123
|
+
"API",
|
|
124
|
+
"api",
|
|
125
|
+
"mock",
|
|
126
|
+
"mocking",
|
|
127
|
+
"config",
|
|
128
|
+
"data"
|
|
129
|
+
]
|
|
130
|
+
}
|
package/dist/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./src"), exports);
|