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
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
export const getUserRequest = {
|
|
2
|
-
method: 'get',
|
|
3
|
-
path: '/users/:id',
|
|
4
|
-
routes: [
|
|
5
|
-
{
|
|
6
|
-
data: { id: 1, emoji: '🎉' }
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
data: { id: 2, emoji: '🔥' },
|
|
10
|
-
entities: {
|
|
11
|
-
params: {
|
|
12
|
-
id: 2
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const postUserRequest = {
|
|
20
|
-
method: 'post',
|
|
21
|
-
path: '/users',
|
|
22
|
-
routes: [
|
|
23
|
-
{
|
|
24
|
-
data: { id: 1, emoji: '🎉' }
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
data: { id: 2, emoji: '🔥' },
|
|
28
|
-
entities: {
|
|
29
|
-
body: {
|
|
30
|
-
emoji: '🔥'
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
};
|
|
1
|
+
export const getUserRequest = {
|
|
2
|
+
method: 'get',
|
|
3
|
+
path: '/users/:id',
|
|
4
|
+
routes: [
|
|
5
|
+
{
|
|
6
|
+
data: { id: 1, emoji: '🎉' }
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
data: { id: 2, emoji: '🔥' },
|
|
10
|
+
entities: {
|
|
11
|
+
params: {
|
|
12
|
+
id: 2
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const postUserRequest = {
|
|
20
|
+
method: 'post',
|
|
21
|
+
path: '/users',
|
|
22
|
+
routes: [
|
|
23
|
+
{
|
|
24
|
+
data: { id: 1, emoji: '🎉' }
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
data: { id: 2, emoji: '🔥' },
|
|
28
|
+
entities: {
|
|
29
|
+
body: {
|
|
30
|
+
emoji: '🔥'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export const getUsersRequest = {
|
|
2
|
-
path: '/users',
|
|
3
|
-
method: 'get',
|
|
4
|
-
routes: [
|
|
5
|
-
{
|
|
6
|
-
data: [
|
|
7
|
-
{ id: 1, emoji: '🎉' },
|
|
8
|
-
{ id: 2, emoji: '🔥' }
|
|
9
|
-
]
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
};
|
|
1
|
+
export const getUsersRequest = {
|
|
2
|
+
path: '/users',
|
|
3
|
+
method: 'get',
|
|
4
|
+
routes: [
|
|
5
|
+
{
|
|
6
|
+
data: [
|
|
7
|
+
{ id: 1, emoji: '🎉' },
|
|
8
|
+
{ id: 2, emoji: '🔥' }
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { getUserRequest, getUsersRequest, postUserRequest } from './mock-requests';
|
|
2
|
-
|
|
3
|
-
const mockServerConfig = [
|
|
4
|
-
{
|
|
5
|
-
port: 31299,
|
|
6
|
-
baseUrl: '/'
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
name: 'rest',
|
|
10
|
-
configs: [getUserRequest, getUsersRequest, postUserRequest]
|
|
11
|
-
}
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
export default mockServerConfig;
|
|
1
|
+
import { getUserRequest, getUsersRequest, postUserRequest } from './mock-requests';
|
|
2
|
+
|
|
3
|
+
const mockServerConfig = [
|
|
4
|
+
{
|
|
5
|
+
port: 31299,
|
|
6
|
+
baseUrl: '/'
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'rest',
|
|
10
|
+
configs: [getUserRequest, getUsersRequest, postUserRequest]
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default mockServerConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './user';
|
|
2
|
-
export * from './users';
|
|
1
|
+
export * from './user';
|
|
2
|
+
export * from './users';
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUserQuery: GraphQLRequestConfig = {
|
|
4
|
-
operationName: 'getUser',
|
|
5
|
-
operationType: 'query',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: { id: 1, emoji: '🎉' }
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
data: { id: 2, emoji: '🔥' },
|
|
12
|
-
entities: {
|
|
13
|
-
variables: {
|
|
14
|
-
id: 2
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const createUserMutation: GraphQLRequestConfig = {
|
|
22
|
-
operationName: 'createUser',
|
|
23
|
-
operationType: 'mutation',
|
|
24
|
-
routes: [
|
|
25
|
-
{
|
|
26
|
-
data: { id: 1, emoji: '🎉' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
data: { id: 2, emoji: '🔥' },
|
|
30
|
-
entities: {
|
|
31
|
-
variables: {
|
|
32
|
-
emoji: '🔥'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
};
|
|
1
|
+
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUserQuery: GraphQLRequestConfig = {
|
|
4
|
+
operationName: 'getUser',
|
|
5
|
+
operationType: 'query',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: { id: 1, emoji: '🎉' }
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
data: { id: 2, emoji: '🔥' },
|
|
12
|
+
entities: {
|
|
13
|
+
variables: {
|
|
14
|
+
id: 2
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const createUserMutation: GraphQLRequestConfig = {
|
|
22
|
+
operationName: 'createUser',
|
|
23
|
+
operationType: 'mutation',
|
|
24
|
+
routes: [
|
|
25
|
+
{
|
|
26
|
+
data: { id: 1, emoji: '🎉' }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
data: { id: 2, emoji: '🔥' },
|
|
30
|
+
entities: {
|
|
31
|
+
variables: {
|
|
32
|
+
emoji: '🔥'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUsersQuery: GraphQLRequestConfig = {
|
|
4
|
-
operationName: 'getUsers',
|
|
5
|
-
operationType: 'query',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: [
|
|
9
|
-
{ id: 1, emoji: '🎉' },
|
|
10
|
-
{ id: 2, emoji: '🔥' }
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
};
|
|
1
|
+
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUsersQuery: GraphQLRequestConfig = {
|
|
4
|
+
operationName: 'getUsers',
|
|
5
|
+
operationType: 'query',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: [
|
|
9
|
+
{ id: 1, emoji: '🎉' },
|
|
10
|
+
{ id: 2, emoji: '🔥' }
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './user';
|
|
2
|
-
export * from './users';
|
|
1
|
+
export * from './user';
|
|
2
|
+
export * from './users';
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUserRequest: RestRequestConfig = {
|
|
4
|
-
method: 'get',
|
|
5
|
-
path: '/users/:id',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: { id: 1, emoji: '🎉' }
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
data: { id: 2, emoji: '🔥' },
|
|
12
|
-
entities: {
|
|
13
|
-
params: {
|
|
14
|
-
id: 2
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const postUserRequest: RestRequestConfig = {
|
|
22
|
-
method: 'post',
|
|
23
|
-
path: '/users',
|
|
24
|
-
routes: [
|
|
25
|
-
{
|
|
26
|
-
data: { id: 1, emoji: '🎉' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
data: { id: 2, emoji: '🔥' },
|
|
30
|
-
entities: {
|
|
31
|
-
body: {
|
|
32
|
-
emoji: '🔥'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
};
|
|
1
|
+
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUserRequest: RestRequestConfig = {
|
|
4
|
+
method: 'get',
|
|
5
|
+
path: '/users/:id',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: { id: 1, emoji: '🎉' }
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
data: { id: 2, emoji: '🔥' },
|
|
12
|
+
entities: {
|
|
13
|
+
params: {
|
|
14
|
+
id: 2
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const postUserRequest: RestRequestConfig = {
|
|
22
|
+
method: 'post',
|
|
23
|
+
path: '/users',
|
|
24
|
+
routes: [
|
|
25
|
+
{
|
|
26
|
+
data: { id: 1, emoji: '🎉' }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
data: { id: 2, emoji: '🔥' },
|
|
30
|
+
entities: {
|
|
31
|
+
body: {
|
|
32
|
+
emoji: '🔥'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUsersRequest: RestRequestConfig = {
|
|
4
|
-
path: '/users',
|
|
5
|
-
method: 'get',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: [
|
|
9
|
-
{ id: 1, emoji: '🎉' },
|
|
10
|
-
{ id: 2, emoji: '🔥' }
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
};
|
|
1
|
+
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUsersRequest: RestRequestConfig = {
|
|
4
|
+
path: '/users',
|
|
5
|
+
method: 'get',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: [
|
|
9
|
+
{ id: 1, emoji: '🎉' },
|
|
10
|
+
{ id: 2, emoji: '🔥' }
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import { createUserMutation, getUserQuery, getUsersQuery } from './mock-requests/graphql';
|
|
4
|
-
import { getUserRequest, getUsersRequest, postUserRequest } from './mock-requests/rest';
|
|
5
|
-
|
|
6
|
-
const mockServerConfig:
|
|
7
|
-
{
|
|
8
|
-
port: 31299,
|
|
9
|
-
baseUrl: '/'
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: 'rest',
|
|
13
|
-
configs: [getUserRequest, getUsersRequest, postUserRequest]
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'graphql',
|
|
17
|
-
configs: [getUserQuery, getUsersQuery, createUserMutation]
|
|
18
|
-
}
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
export default mockServerConfig;
|
|
1
|
+
import type { MockServerConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
import { createUserMutation, getUserQuery, getUsersQuery } from './mock-requests/graphql';
|
|
4
|
+
import { getUserRequest, getUsersRequest, postUserRequest } from './mock-requests/rest';
|
|
5
|
+
|
|
6
|
+
const mockServerConfig: MockServerConfig = [
|
|
7
|
+
{
|
|
8
|
+
port: 31299,
|
|
9
|
+
baseUrl: '/'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'rest',
|
|
13
|
+
configs: [getUserRequest, getUsersRequest, postUserRequest]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'graphql',
|
|
17
|
+
configs: [getUserQuery, getUsersQuery, createUserMutation]
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export default mockServerConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './user';
|
|
2
|
-
export * from './users';
|
|
1
|
+
export * from './user';
|
|
2
|
+
export * from './users';
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUserQuery: GraphQLRequestConfig = {
|
|
4
|
-
operationName: 'getUser',
|
|
5
|
-
operationType: 'query',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: { id: 1, emoji: '🎉' }
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
data: { id: 2, emoji: '🔥' },
|
|
12
|
-
entities: {
|
|
13
|
-
variables: {
|
|
14
|
-
id: 2
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const createUserMutation: GraphQLRequestConfig = {
|
|
22
|
-
operationName: 'createUser',
|
|
23
|
-
operationType: 'mutation',
|
|
24
|
-
routes: [
|
|
25
|
-
{
|
|
26
|
-
data: { id: 1, emoji: '🎉' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
data: { id: 2, emoji: '🔥' },
|
|
30
|
-
entities: {
|
|
31
|
-
variables: {
|
|
32
|
-
emoji: '🔥'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
};
|
|
1
|
+
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUserQuery: GraphQLRequestConfig = {
|
|
4
|
+
operationName: 'getUser',
|
|
5
|
+
operationType: 'query',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: { id: 1, emoji: '🎉' }
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
data: { id: 2, emoji: '🔥' },
|
|
12
|
+
entities: {
|
|
13
|
+
variables: {
|
|
14
|
+
id: 2
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const createUserMutation: GraphQLRequestConfig = {
|
|
22
|
+
operationName: 'createUser',
|
|
23
|
+
operationType: 'mutation',
|
|
24
|
+
routes: [
|
|
25
|
+
{
|
|
26
|
+
data: { id: 1, emoji: '🎉' }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
data: { id: 2, emoji: '🔥' },
|
|
30
|
+
entities: {
|
|
31
|
+
variables: {
|
|
32
|
+
emoji: '🔥'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUsersQuery: GraphQLRequestConfig = {
|
|
4
|
-
operationName: 'getUsers',
|
|
5
|
-
operationType: 'query',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: [
|
|
9
|
-
{ id: 1, emoji: '🎉' },
|
|
10
|
-
{ id: 2, emoji: '🔥' }
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
};
|
|
1
|
+
import type { GraphQLRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUsersQuery: GraphQLRequestConfig = {
|
|
4
|
+
operationName: 'getUsers',
|
|
5
|
+
operationType: 'query',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: [
|
|
9
|
+
{ id: 1, emoji: '🎉' },
|
|
10
|
+
{ id: 2, emoji: '🔥' }
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import { createUserMutation, getUserQuery, getUsersQuery } from './mock-requests';
|
|
4
|
-
|
|
5
|
-
const mockServerConfig:
|
|
6
|
-
{
|
|
7
|
-
port: 31299,
|
|
8
|
-
baseUrl: '/graphql'
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
name: 'graphql',
|
|
12
|
-
configs: [getUserQuery, getUsersQuery, createUserMutation]
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
export default mockServerConfig;
|
|
1
|
+
import type { MockServerConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
import { createUserMutation, getUserQuery, getUsersQuery } from './mock-requests';
|
|
4
|
+
|
|
5
|
+
const mockServerConfig: MockServerConfig = [
|
|
6
|
+
{
|
|
7
|
+
port: 31299,
|
|
8
|
+
baseUrl: '/graphql'
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'graphql',
|
|
12
|
+
configs: [getUserQuery, getUsersQuery, createUserMutation]
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export default mockServerConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './user';
|
|
2
|
-
export * from './users';
|
|
1
|
+
export * from './user';
|
|
2
|
+
export * from './users';
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUserRequest: RestRequestConfig = {
|
|
4
|
-
method: 'get',
|
|
5
|
-
path: '/users/:id',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: { id: 1, emoji: '🎉' }
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
data: { id: 2, emoji: '🔥' },
|
|
12
|
-
entities: {
|
|
13
|
-
params: {
|
|
14
|
-
id: 2
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const postUserRequest: RestRequestConfig = {
|
|
22
|
-
method: 'post',
|
|
23
|
-
path: '/users',
|
|
24
|
-
routes: [
|
|
25
|
-
{
|
|
26
|
-
data: { id: 1, emoji: '🎉' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
data: { id: 2, emoji: '🔥' },
|
|
30
|
-
entities: {
|
|
31
|
-
body: {
|
|
32
|
-
emoji: '🔥'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
};
|
|
1
|
+
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUserRequest: RestRequestConfig = {
|
|
4
|
+
method: 'get',
|
|
5
|
+
path: '/users/:id',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: { id: 1, emoji: '🎉' }
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
data: { id: 2, emoji: '🔥' },
|
|
12
|
+
entities: {
|
|
13
|
+
params: {
|
|
14
|
+
id: 2
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const postUserRequest: RestRequestConfig = {
|
|
22
|
+
method: 'post',
|
|
23
|
+
path: '/users',
|
|
24
|
+
routes: [
|
|
25
|
+
{
|
|
26
|
+
data: { id: 1, emoji: '🎉' }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
data: { id: 2, emoji: '🔥' },
|
|
30
|
+
entities: {
|
|
31
|
+
body: {
|
|
32
|
+
emoji: '🔥'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
-
|
|
3
|
-
export const getUsersRequest: RestRequestConfig = {
|
|
4
|
-
path: '/users',
|
|
5
|
-
method: 'get',
|
|
6
|
-
routes: [
|
|
7
|
-
{
|
|
8
|
-
data: [
|
|
9
|
-
{ id: 1, emoji: '🎉' },
|
|
10
|
-
{ id: 2, emoji: '🔥' }
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
};
|
|
1
|
+
import type { RestRequestConfig } from 'mock-config-server';
|
|
2
|
+
|
|
3
|
+
export const getUsersRequest: RestRequestConfig = {
|
|
4
|
+
path: '/users',
|
|
5
|
+
method: 'get',
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
data: [
|
|
9
|
+
{ id: 1, emoji: '🎉' },
|
|
10
|
+
{ id: 2, emoji: '🔥' }
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
};
|