mock-config-server 3.4.1 → 3.6.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 (148) hide show
  1. package/README.md +2 -0
  2. package/dist/bin/bin.js +3 -6
  3. package/dist/bin/build.js +52 -50
  4. package/dist/bin/cli.js +50 -43
  5. package/dist/bin/helpers/createTemplate.js +29 -21
  6. package/dist/bin/helpers/getMostSpecificPathFromError.js +34 -30
  7. package/dist/bin/helpers/getValidationMessageFromPath.js +11 -8
  8. package/dist/bin/helpers/index.js +21 -79
  9. package/dist/bin/helpers/isOnlyRequestedDataResolvingPropertyExists.js +13 -6
  10. package/dist/bin/helpers/resolveConfigFile.js +22 -19
  11. package/dist/bin/helpers/resolveConfigFilePath.js +19 -12
  12. package/dist/bin/helpers/resolveExportsFromSourceCode.js +13 -10
  13. package/dist/bin/init.js +114 -97
  14. package/dist/bin/run.js +42 -43
  15. package/dist/bin/validateMockServerConfig/baseUrlSchema/baseUrlSchema.js +9 -5
  16. package/dist/bin/validateMockServerConfig/corsSchema/corsSchema.d.ts +2 -2
  17. package/dist/bin/validateMockServerConfig/corsSchema/corsSchema.js +32 -14
  18. package/dist/bin/validateMockServerConfig/databaseConfigSchema/databaseConfigSchema.js +19 -9
  19. package/dist/bin/validateMockServerConfig/graphqlConfigSchema/graphqlConfigSchema.d.ts +82 -72
  20. package/dist/bin/validateMockServerConfig/graphqlConfigSchema/graphqlConfigSchema.js +38 -22
  21. package/dist/bin/validateMockServerConfig/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +25 -21
  22. package/dist/bin/validateMockServerConfig/graphqlConfigSchema/routeConfigSchema/routeConfigSchema.js +36 -28
  23. package/dist/bin/validateMockServerConfig/interceptorsSchema/interceptorsSchema.js +12 -8
  24. package/dist/bin/validateMockServerConfig/portSchema/portSchema.js +9 -5
  25. package/dist/bin/validateMockServerConfig/queueSchema/queueSchema.d.ts +2 -2
  26. package/dist/bin/validateMockServerConfig/queueSchema/queueSchema.js +18 -9
  27. package/dist/bin/validateMockServerConfig/restConfigSchema/restConfigSchema.d.ts +270 -240
  28. package/dist/bin/validateMockServerConfig/restConfigSchema/restConfigSchema.js +33 -19
  29. package/dist/bin/validateMockServerConfig/restConfigSchema/routeConfigSchema/routeConfigSchema.d.ts +33 -28
  30. package/dist/bin/validateMockServerConfig/restConfigSchema/routeConfigSchema/routeConfigSchema.js +60 -48
  31. package/dist/bin/validateMockServerConfig/settingsSchema/settingsSchema.js +13 -9
  32. package/dist/bin/validateMockServerConfig/staticPathSchema/staticPathSchema.js +19 -9
  33. package/dist/bin/validateMockServerConfig/utils/checkModeSchema/checkModeSchema.js +27 -9
  34. package/dist/bin/validateMockServerConfig/utils/entitiesSchema/entitiesSchema.d.ts +4 -8
  35. package/dist/bin/validateMockServerConfig/utils/entitiesSchema/entitiesSchema.js +117 -60
  36. package/dist/bin/validateMockServerConfig/utils/index.js +20 -68
  37. package/dist/bin/validateMockServerConfig/utils/jsonSchema/jsonSchema.js +30 -10
  38. package/dist/bin/validateMockServerConfig/utils/plainObjectSchema/plainObjectSchema.js +9 -8
  39. package/dist/bin/validateMockServerConfig/utils/requiredPropertiesSchema/requiredPropertiesSchema.d.ts +1 -1
  40. package/dist/bin/validateMockServerConfig/utils/requiredPropertiesSchema/requiredPropertiesSchema.js +10 -7
  41. package/dist/bin/validateMockServerConfig/utils/sharedSchema/sharedSchema.js +18 -6
  42. package/dist/bin/validateMockServerConfig/validateApiMockServerConfig.js +43 -40
  43. package/dist/bin/validateMockServerConfig/validateMockServerConfig.js +38 -35
  44. package/dist/index.js +15 -13
  45. package/dist/src/core/database/createDatabaseRoutes/createDatabaseRoutes.js +25 -28
  46. package/dist/src/core/database/createDatabaseRoutes/helpers/array/createNewId/createNewId.js +14 -11
  47. package/dist/src/core/database/createDatabaseRoutes/helpers/array/findIndexById/findIndexById.js +8 -5
  48. package/dist/src/core/database/createDatabaseRoutes/helpers/array/index.js +17 -35
  49. package/dist/src/core/database/createDatabaseRoutes/helpers/array/isIndex/isIndex.js +8 -5
  50. package/dist/src/core/database/createDatabaseRoutes/helpers/createNestedDatabaseRoutes/createNestedDatabaseRoutes.js +159 -143
  51. package/dist/src/core/database/createDatabaseRoutes/helpers/createRewrittenDatabaseRoutes/createRewrittenDatabaseRoutes.js +15 -8
  52. package/dist/src/core/database/createDatabaseRoutes/helpers/createShallowDatabaseRoutes/createShallowDatabaseRoutes.js +90 -94
  53. package/dist/src/core/database/createDatabaseRoutes/helpers/filter/filter.js +49 -46
  54. package/dist/src/core/database/createDatabaseRoutes/helpers/index.js +19 -57
  55. package/dist/src/core/database/createDatabaseRoutes/helpers/pagination/pagination.js +32 -31
  56. package/dist/src/core/database/createDatabaseRoutes/helpers/search/search.js +34 -24
  57. package/dist/src/core/database/createDatabaseRoutes/helpers/sort/sort.js +37 -33
  58. package/dist/src/core/database/createDatabaseRoutes/helpers/splitDatabaseByNesting/splitDatabaseByNesting.js +26 -25
  59. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileStorage.js +65 -50
  60. package/dist/src/core/database/createDatabaseRoutes/storages/File/FileWriter.js +55 -48
  61. package/dist/src/core/database/createDatabaseRoutes/storages/Memory/MemoryStorage.js +51 -41
  62. package/dist/src/core/database/createDatabaseRoutes/storages/index.js +16 -24
  63. package/dist/src/core/database/index.js +15 -13
  64. package/dist/src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.js +131 -140
  65. package/dist/src/core/graphql/createGraphQLRoutes/helpers/index.js +15 -13
  66. package/dist/src/core/graphql/createGraphQLRoutes/helpers/prepareGraphQLRequestConfigs/prepareGraphQLRequestConfigs.js +36 -41
  67. package/dist/src/core/graphql/index.js +15 -13
  68. package/dist/src/core/middlewares/cookieParseMiddleware/cookieParseMiddleware.js +16 -13
  69. package/dist/src/core/middlewares/cookieParseMiddleware/helpers/index.js +15 -13
  70. package/dist/src/core/middlewares/cookieParseMiddleware/helpers/parseCookie/parseCookie.js +18 -15
  71. package/dist/src/core/middlewares/corsMiddleware/corsMiddleware.js +50 -47
  72. package/dist/src/core/middlewares/corsMiddleware/helpers/getAllowedOrigins/getAllowedOrigins.js +17 -12
  73. package/dist/src/core/middlewares/corsMiddleware/helpers/index.js +15 -13
  74. package/dist/src/core/middlewares/destroyerMiddleware/destroyerMiddleware.js +23 -20
  75. package/dist/src/core/middlewares/errorMiddleware/errorMiddleware.js +23 -17
  76. package/dist/src/core/middlewares/index.js +23 -91
  77. package/dist/src/core/middlewares/noCorsMiddleware/noCorsMiddleware.js +22 -19
  78. package/dist/src/core/middlewares/notFoundMiddleware/helpers/getGraphqlUrlSuggestions/getGraphqlUrlSuggestions.js +21 -23
  79. package/dist/src/core/middlewares/notFoundMiddleware/helpers/getLevenshteinDistance/getLevenshteinDistance.js +80 -80
  80. package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/getRestUrlSuggestions.js +34 -34
  81. package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/helpers/getActualRestUrlMeaningfulString/getActualRestUrlMeaningfulString.js +8 -5
  82. package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/helpers/getPatternRestUrlMeaningfulString/getPatternRestUrlMeaningfulString.js +8 -5
  83. package/dist/src/core/middlewares/notFoundMiddleware/helpers/getRestUrlSuggestions/helpers/index.js +16 -24
  84. package/dist/src/core/middlewares/notFoundMiddleware/helpers/index.js +17 -35
  85. package/dist/src/core/middlewares/notFoundMiddleware/notFoundMiddleware.js +58 -60
  86. package/dist/src/core/middlewares/requestInterceptorMiddleware/requestInterceptorMiddleware.js +16 -17
  87. package/dist/src/core/middlewares/staticMiddleware/staticMiddleware.js +32 -25
  88. package/dist/src/core/rest/createRestRoutes/createRestRoutes.js +125 -130
  89. package/dist/src/core/rest/createRestRoutes/helpers/index.js +15 -13
  90. package/dist/src/core/rest/createRestRoutes/helpers/prepareRestRequestConfigs/prepareRestRequestConfigs.js +37 -43
  91. package/dist/src/core/rest/index.js +15 -13
  92. package/dist/src/index.js +16 -24
  93. package/dist/src/server/createDatabaseMockServer/createDatabaseMockServer.js +56 -53
  94. package/dist/src/server/createGraphQLMockServer/createGraphQLMockServer.js +64 -62
  95. package/dist/src/server/createMockServer/createMockServer.js +94 -91
  96. package/dist/src/server/createRestMockServer/createRestMockServer.js +64 -62
  97. package/dist/src/server/index.js +23 -91
  98. package/dist/src/server/startDatabaseMockServer/startDatabaseMockServer.js +25 -19
  99. package/dist/src/server/startGraphQLMockServer/startGraphQLMockServer.js +25 -19
  100. package/dist/src/server/startMockServer/startMockServer.js +25 -19
  101. package/dist/src/server/startRestMockServer/startRestMockServer.js +25 -19
  102. package/dist/src/utils/constants/appPath.js +8 -4
  103. package/dist/src/utils/constants/checkModes.js +74 -11
  104. package/dist/src/utils/constants/default.js +18 -14
  105. package/dist/src/utils/constants/index.js +17 -35
  106. package/dist/src/utils/helpers/asyncHandler.js +8 -5
  107. package/dist/src/utils/helpers/config/index.js +15 -13
  108. package/dist/src/utils/helpers/config/resolveEntityValues/resolveEntityValues.js +103 -110
  109. package/dist/src/utils/helpers/entities/convertToEntityDescriptor/convertToEntityDescriptor.js +12 -9
  110. package/dist/src/utils/helpers/entities/index.js +16 -24
  111. package/dist/src/utils/helpers/entities/isEntityDescriptor/isEntityDescriptor.js +9 -6
  112. package/dist/src/utils/helpers/files/index.js +15 -13
  113. package/dist/src/utils/helpers/files/isFilePathValid/isFilePathValid.js +22 -15
  114. package/dist/src/utils/helpers/graphql/getGraphQLInput/getGraphQLInput.js +25 -29
  115. package/dist/src/utils/helpers/graphql/index.js +17 -35
  116. package/dist/src/utils/helpers/graphql/parseGraphQLRequest/parseGraphQLRequest.js +13 -10
  117. package/dist/src/utils/helpers/graphql/parseQuery/parseQuery.js +23 -19
  118. package/dist/src/utils/helpers/index.js +26 -124
  119. package/dist/src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.js +21 -21
  120. package/dist/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.js +62 -64
  121. package/dist/src/utils/helpers/interceptors/helpers/setDelay.js +10 -7
  122. package/dist/src/utils/helpers/interceptors/index.js +16 -24
  123. package/dist/src/utils/helpers/isPlainObject/isPlainObject.js +8 -5
  124. package/dist/src/utils/helpers/isPrimitive/isPrimitive.js +8 -5
  125. package/dist/src/utils/helpers/isRegExp/isRegExp.js +8 -5
  126. package/dist/src/utils/helpers/sleep.js +9 -6
  127. package/dist/src/utils/helpers/tests/createTmpDir.js +16 -9
  128. package/dist/src/utils/helpers/tests/index.js +15 -13
  129. package/dist/src/utils/helpers/url/convertWin32PathToUnix/convertWin32PathToUnix.js +8 -5
  130. package/dist/src/utils/helpers/url/getUrlParts/getUrlParts.js +9 -6
  131. package/dist/src/utils/helpers/url/index.js +18 -46
  132. package/dist/src/utils/helpers/url/removeLeadingAndTrailingSlashes/removeLeadingAndTrailingSlashes.js +8 -5
  133. package/dist/src/utils/helpers/url/urlJoin/urlJoin.js +18 -11
  134. package/dist/src/utils/types/checkModes.js +4 -1
  135. package/dist/src/utils/types/database.js +4 -1
  136. package/dist/src/utils/types/entities.js +4 -1
  137. package/dist/src/utils/types/graphql.d.ts +1 -1
  138. package/dist/src/utils/types/graphql.js +4 -1
  139. package/dist/src/utils/types/index.js +24 -102
  140. package/dist/src/utils/types/interceptors.js +4 -1
  141. package/dist/src/utils/types/rest.d.ts +1 -1
  142. package/dist/src/utils/types/rest.js +4 -1
  143. package/dist/src/utils/types/server.js +4 -1
  144. package/dist/src/utils/types/utils.js +4 -1
  145. package/dist/src/utils/types/values.js +4 -1
  146. package/package.json +26 -29
  147. package/dist/bin/templates/.eslintrc.js +0 -14
  148. package/dist/bin/templates/tsconfig.json +0 -11
@@ -1,23 +1,37 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.restConfigSchema = void 0;
7
- var _zod = require("zod");
8
- var _baseUrlSchema = require("../baseUrlSchema/baseUrlSchema");
9
- var _interceptorsSchema = require("../interceptorsSchema/interceptorsSchema");
10
- var _utils = require("../utils");
11
- var _routeConfigSchema = require("./routeConfigSchema/routeConfigSchema");
12
- const baseRequestConfigSchema = method => _zod.z.strictObject({
13
- path: _zod.z.union([_utils.stringForwardSlashSchema, _zod.z.instanceof(RegExp)]),
14
- method: _zod.z.literal(method),
15
- routes: _zod.z.array((0, _routeConfigSchema.routeConfigSchema)(method)),
16
- interceptors: (0, _utils.plainObjectSchema)(_interceptorsSchema.interceptorsSchema).optional()
5
+ Object.defineProperty(exports, "restConfigSchema", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return restConfigSchema;
9
+ }
10
+ });
11
+ const _zod = require("zod");
12
+ const _baseUrlSchema = require("../baseUrlSchema/baseUrlSchema");
13
+ const _interceptorsSchema = require("../interceptorsSchema/interceptorsSchema");
14
+ const _utils = require("../utils");
15
+ const _routeConfigSchema = require("./routeConfigSchema/routeConfigSchema");
16
+ const baseRequestConfigSchema = (method)=>_zod.z.strictObject({
17
+ path: _zod.z.union([
18
+ _utils.stringForwardSlashSchema,
19
+ _zod.z.instanceof(RegExp)
20
+ ]),
21
+ method: _zod.z.literal(method),
22
+ routes: _zod.z.array((0, _routeConfigSchema.routeConfigSchema)(method)),
23
+ interceptors: (0, _utils.plainObjectSchema)(_interceptorsSchema.interceptorsSchema).optional()
24
+ });
25
+ const requestConfigSchema = _zod.z.union([
26
+ baseRequestConfigSchema('get'),
27
+ baseRequestConfigSchema('post'),
28
+ baseRequestConfigSchema('put'),
29
+ baseRequestConfigSchema('delete'),
30
+ baseRequestConfigSchema('patch'),
31
+ baseRequestConfigSchema('options')
32
+ ]);
33
+ const restConfigSchema = _zod.z.strictObject({
34
+ baseUrl: _baseUrlSchema.baseUrlSchema.optional(),
35
+ configs: _zod.z.array(requestConfigSchema),
36
+ interceptors: (0, _utils.plainObjectSchema)(_interceptorsSchema.interceptorsSchema).optional()
17
37
  });
18
- const requestConfigSchema = _zod.z.union([baseRequestConfigSchema('get'), baseRequestConfigSchema('post'), baseRequestConfigSchema('put'), baseRequestConfigSchema('delete'), baseRequestConfigSchema('patch'), baseRequestConfigSchema('options')]);
19
- const restConfigSchema = exports.restConfigSchema = _zod.z.strictObject({
20
- baseUrl: _baseUrlSchema.baseUrlSchema.optional(),
21
- configs: _zod.z.array(requestConfigSchema),
22
- interceptors: (0, _utils.plainObjectSchema)(_interceptorsSchema.interceptorsSchema).optional()
23
- });
@@ -1,48 +1,45 @@
1
1
  import { z } from 'zod';
2
2
  import type { RestMethod } from '../../../../src/utils/types';
3
- export declare const routeConfigSchema: (method: RestMethod) => z.ZodUnion<[z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodObject<{
4
- data: z.ZodUnion<[z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>, z.ZodAny]>;
3
+ export declare const routeConfigSchema: (method: RestMethod) => z.ZodUnion<[z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodObject<z.objectUtil.extendShape<{
5
4
  settings: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
5
+ data: z.ZodUnion<[z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>, z.ZodAny]>;
6
+ }, {
6
7
  entities: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
7
8
  interceptors: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
8
- }, "strict", z.ZodTypeAny, {
9
+ }>, "strict", z.ZodTypeAny, {
9
10
  data?: any;
10
- settings?: any;
11
- entities?: any;
12
11
  interceptors?: any;
12
+ entities?: any;
13
+ settings?: any;
13
14
  }, {
14
15
  data?: any;
15
- settings?: unknown;
16
- entities?: unknown;
17
16
  interceptors?: unknown;
18
- }>>, z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodObject<{
19
- file: z.ZodString;
17
+ entities?: unknown;
18
+ settings?: unknown;
19
+ }>>, z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodObject<z.objectUtil.extendShape<{
20
20
  settings: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
21
+ file: z.ZodString;
22
+ }, {
21
23
  entities: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
22
24
  interceptors: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
23
- }, "strict", z.ZodTypeAny, {
25
+ }>, "strict", z.ZodTypeAny, {
24
26
  file: string;
25
- settings?: any;
26
- entities?: any;
27
27
  interceptors?: any;
28
+ entities?: any;
29
+ settings?: any;
28
30
  }, {
29
31
  file: string;
30
- settings?: unknown;
31
- entities?: unknown;
32
32
  interceptors?: unknown;
33
- }>>, z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodObject<{
34
- queue: z.ZodArray<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodType<{
35
- time?: number | undefined;
36
- data?: any;
37
- }, z.ZodTypeDef, {
38
- time?: number | undefined;
39
- data?: any;
40
- }>>, "many">;
41
- settings: z.ZodObject<{
33
+ entities?: unknown;
34
+ settings?: unknown;
35
+ }>>, z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodObject<z.objectUtil.extendShape<{
36
+ settings: z.ZodObject<z.objectUtil.extendShape<{
37
+ polling: z.ZodOptional<z.ZodBoolean>;
42
38
  status: z.ZodOptional<z.ZodNumber>;
43
39
  delay: z.ZodOptional<z.ZodNumber>;
40
+ }, {
44
41
  polling: z.ZodLiteral<true>;
45
- }, "strict", z.ZodTypeAny, {
42
+ }>, "strict", z.ZodTypeAny, {
46
43
  polling: true;
47
44
  status?: number | undefined;
48
45
  delay?: number | undefined;
@@ -51,20 +48,28 @@ export declare const routeConfigSchema: (method: RestMethod) => z.ZodUnion<[z.Zo
51
48
  status?: number | undefined;
52
49
  delay?: number | undefined;
53
50
  }>;
51
+ queue: z.ZodArray<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodType<{
52
+ data?: any;
53
+ time?: number | undefined;
54
+ }, z.ZodTypeDef, {
55
+ data?: any;
56
+ time?: number | undefined;
57
+ }>>, "many">;
58
+ }, {
54
59
  entities: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
55
60
  interceptors: z.ZodOptional<z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>>;
56
- }, "strict", z.ZodTypeAny, {
61
+ }>, "strict", z.ZodTypeAny, {
57
62
  queue: {
58
- time?: number | undefined;
59
63
  data?: any;
64
+ time?: number | undefined;
60
65
  }[];
61
66
  settings: {
62
67
  polling: true;
63
68
  status?: number | undefined;
64
69
  delay?: number | undefined;
65
70
  };
66
- entities?: any;
67
71
  interceptors?: any;
72
+ entities?: any;
68
73
  }, {
69
74
  queue: unknown[];
70
75
  settings: {
@@ -72,6 +77,6 @@ export declare const routeConfigSchema: (method: RestMethod) => z.ZodUnion<[z.Zo
72
77
  status?: number | undefined;
73
78
  delay?: number | undefined;
74
79
  };
75
- entities?: unknown;
76
80
  interceptors?: unknown;
81
+ entities?: unknown;
77
82
  }>>]>;
@@ -1,52 +1,64 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.routeConfigSchema = void 0;
7
- var _zod = require("zod");
8
- var _helpers = require("../../../../src/utils/helpers");
9
- var _helpers2 = require("../../../helpers");
10
- var _interceptorsSchema = require("../../interceptorsSchema/interceptorsSchema");
11
- var _queueSchema = require("../../queueSchema/queueSchema");
12
- var _settingsSchema = require("../../settingsSchema/settingsSchema");
13
- var _utils = require("../../utils");
14
- const METHODS_WITH_BODY = ['post', 'put', 'patch'];
15
- const entitiesByEntityNameSchema = method => {
16
- const isMethodWithBody = METHODS_WITH_BODY.includes(method);
17
- return (0, _utils.plainObjectSchema)(_zod.z.strictObject({
18
- headers: _utils.mappedEntitySchema.optional(),
19
- cookies: _utils.mappedEntitySchema.optional(),
20
- params: _utils.mappedEntitySchema.optional(),
21
- query: _utils.mappedEntitySchema.optional(),
22
- ...(isMethodWithBody && {
23
- body: _utils.plainEntitySchema.optional()
24
- })
25
- }));
26
- };
27
- const baseRouteConfigSchema = method => _zod.z.strictObject({
28
- entities: entitiesByEntityNameSchema(method).optional(),
29
- interceptors: (0, _utils.plainObjectSchema)(_interceptorsSchema.interceptorsSchema.pick({
30
- response: true
31
- })).optional()
5
+ Object.defineProperty(exports, "routeConfigSchema", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return routeConfigSchema;
9
+ }
32
10
  });
33
- const dataRouteConfigSchema = method => _zod.z.strictObject({
34
- settings: (0, _utils.plainObjectSchema)(_settingsSchema.settingsSchema.extend({
35
- polling: _zod.z.literal(false).optional()
36
- })).optional(),
37
- data: _zod.z.union([_zod.z.function(), _zod.z.any()])
38
- }).merge(baseRouteConfigSchema(method));
39
- const fileRouteConfigSchema = method => _zod.z.strictObject({
40
- settings: (0, _utils.plainObjectSchema)(_settingsSchema.settingsSchema.extend({
41
- polling: _zod.z.literal(false).optional()
42
- })).optional(),
43
- file: _zod.z.string()
44
- }).merge(baseRouteConfigSchema(method));
45
- const queueRouteConfigSchema = method => _zod.z.strictObject({
46
- settings: _settingsSchema.settingsSchema.extend({
47
- polling: _zod.z.literal(true)
48
- }),
49
- queue: _queueSchema.queueSchema
50
- }).merge(baseRouteConfigSchema(method));
51
- const routeConfigSchema = method => _zod.z.union([_zod.z.custom(value => (0, _helpers.isPlainObject)(value) && (0, _helpers2.isOnlyRequestedDataResolvingPropertyExists)(value, 'data')).pipe(dataRouteConfigSchema(method)), _zod.z.custom(value => (0, _helpers.isPlainObject)(value) && (0, _helpers2.isOnlyRequestedDataResolvingPropertyExists)(value, 'file')).pipe(fileRouteConfigSchema(method)), _zod.z.custom(value => (0, _helpers.isPlainObject)(value) && (0, _helpers2.isOnlyRequestedDataResolvingPropertyExists)(value, 'queue')).pipe(queueRouteConfigSchema(method))]);
52
- exports.routeConfigSchema = routeConfigSchema;
11
+ const _zod = require("zod");
12
+ const _helpers = require("../../../../src/utils/helpers");
13
+ const _helpers1 = require("../../../helpers");
14
+ const _interceptorsSchema = require("../../interceptorsSchema/interceptorsSchema");
15
+ const _queueSchema = require("../../queueSchema/queueSchema");
16
+ const _settingsSchema = require("../../settingsSchema/settingsSchema");
17
+ const _utils = require("../../utils");
18
+ const METHODS_WITH_BODY = [
19
+ 'post',
20
+ 'put',
21
+ 'patch'
22
+ ];
23
+ const entitiesByEntityNameSchema = (method)=>{
24
+ const isMethodWithBody = METHODS_WITH_BODY.includes(method);
25
+ return (0, _utils.plainObjectSchema)(_zod.z.strictObject({
26
+ headers: _utils.mappedEntitySchema.optional(),
27
+ cookies: _utils.mappedEntitySchema.optional(),
28
+ params: _utils.mappedEntitySchema.optional(),
29
+ query: _utils.mappedEntitySchema.optional(),
30
+ ...isMethodWithBody && {
31
+ body: _utils.plainEntitySchema.optional()
32
+ }
33
+ }));
34
+ };
35
+ const baseRouteConfigSchema = (method)=>_zod.z.strictObject({
36
+ entities: entitiesByEntityNameSchema(method).optional(),
37
+ interceptors: (0, _utils.plainObjectSchema)(_interceptorsSchema.interceptorsSchema).optional()
38
+ });
39
+ const dataRouteConfigSchema = (method)=>_zod.z.strictObject({
40
+ settings: (0, _utils.plainObjectSchema)(_settingsSchema.settingsSchema.extend({
41
+ polling: _zod.z.literal(false).optional()
42
+ })).optional(),
43
+ data: _zod.z.union([
44
+ _zod.z.function(),
45
+ _zod.z.any()
46
+ ])
47
+ }).merge(baseRouteConfigSchema(method));
48
+ const fileRouteConfigSchema = (method)=>_zod.z.strictObject({
49
+ settings: (0, _utils.plainObjectSchema)(_settingsSchema.settingsSchema.extend({
50
+ polling: _zod.z.literal(false).optional()
51
+ })).optional(),
52
+ file: _zod.z.string()
53
+ }).merge(baseRouteConfigSchema(method));
54
+ const queueRouteConfigSchema = (method)=>_zod.z.strictObject({
55
+ settings: _settingsSchema.settingsSchema.extend({
56
+ polling: _zod.z.literal(true)
57
+ }),
58
+ queue: _queueSchema.queueSchema
59
+ }).merge(baseRouteConfigSchema(method));
60
+ const routeConfigSchema = (method)=>_zod.z.union([
61
+ _zod.z.custom((value)=>(0, _helpers.isPlainObject)(value) && (0, _helpers1.isOnlyRequestedDataResolvingPropertyExists)(value, 'data')).pipe(dataRouteConfigSchema(method)),
62
+ _zod.z.custom((value)=>(0, _helpers.isPlainObject)(value) && (0, _helpers1.isOnlyRequestedDataResolvingPropertyExists)(value, 'file')).pipe(fileRouteConfigSchema(method)),
63
+ _zod.z.custom((value)=>(0, _helpers.isPlainObject)(value) && (0, _helpers1.isOnlyRequestedDataResolvingPropertyExists)(value, 'queue')).pipe(queueRouteConfigSchema(method))
64
+ ]);
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "settingsSchema", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return settingsSchema;
9
+ }
10
+ });
11
+ const _zod = require("zod");
12
+ const settingsSchema = _zod.z.strictObject({
13
+ polling: _zod.z.boolean().optional(),
14
+ status: _zod.z.number().min(200).max(599).optional(),
15
+ delay: _zod.z.number().nonnegative().optional()
5
16
  });
6
- exports.settingsSchema = void 0;
7
- var _zod = require("zod");
8
- const settingsSchema = exports.settingsSchema = _zod.z.strictObject({
9
- polling: _zod.z.boolean().optional(),
10
- status: _zod.z.number().min(200).max(599).optional(),
11
- delay: _zod.z.number().nonnegative().optional()
12
- });
@@ -1,14 +1,24 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.staticPathSchema = void 0;
7
- var _zod = require("zod");
8
- var _utils = require("../utils");
5
+ Object.defineProperty(exports, "staticPathSchema", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return staticPathSchema;
9
+ }
10
+ });
11
+ const _zod = require("zod");
12
+ const _utils = require("../utils");
9
13
  const staticPathObjectSchema = _zod.z.strictObject({
10
- prefix: _utils.stringForwardSlashSchema,
11
- path: _utils.stringForwardSlashSchema
14
+ prefix: _utils.stringForwardSlashSchema,
15
+ path: _utils.stringForwardSlashSchema
12
16
  });
13
- const staticPathStringOrObjectSchema = _zod.z.union([_utils.stringForwardSlashSchema, staticPathObjectSchema]);
14
- const staticPathSchema = exports.staticPathSchema = _zod.z.union([staticPathStringOrObjectSchema, _zod.z.array(staticPathStringOrObjectSchema)]);
17
+ const staticPathStringOrObjectSchema = _zod.z.union([
18
+ _utils.stringForwardSlashSchema,
19
+ staticPathObjectSchema
20
+ ]);
21
+ const staticPathSchema = _zod.z.union([
22
+ staticPathStringOrObjectSchema,
23
+ _zod.z.array(staticPathStringOrObjectSchema)
24
+ ]);
@@ -1,12 +1,30 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.compareWithDescriptorValueCheckModeSchema = exports.compareWithDescriptorStringValueCheckModeSchema = exports.compareWithDescriptorAnyValueCheckModeSchema = exports.checkActualValueCheckModeSchema = void 0;
7
- var _zod = require("zod");
8
- var _constants = require("../../../../src/utils/constants");
9
- const checkActualValueCheckModeSchema = exports.checkActualValueCheckModeSchema = _zod.z.enum(_constants.CHECK_ACTUAL_VALUE_CHECK_MODES);
10
- const compareWithDescriptorAnyValueCheckModeSchema = exports.compareWithDescriptorAnyValueCheckModeSchema = _zod.z.enum(_constants.COMPARE_WITH_DESCRIPTOR_ANY_VALUE_CHECK_MODES);
11
- const compareWithDescriptorStringValueCheckModeSchema = exports.compareWithDescriptorStringValueCheckModeSchema = _zod.z.enum(_constants.COMPARE_WITH_DESCRIPTOR_STRING_VALUE_CHECK_MODES);
12
- const compareWithDescriptorValueCheckModeSchema = exports.compareWithDescriptorValueCheckModeSchema = _zod.z.enum(_constants.COMPARE_WITH_DESCRIPTOR_VALUE_CHECK_MODES);
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ checkActualValueCheckModeSchema: function() {
13
+ return checkActualValueCheckModeSchema;
14
+ },
15
+ compareWithDescriptorAnyValueCheckModeSchema: function() {
16
+ return compareWithDescriptorAnyValueCheckModeSchema;
17
+ },
18
+ compareWithDescriptorStringValueCheckModeSchema: function() {
19
+ return compareWithDescriptorStringValueCheckModeSchema;
20
+ },
21
+ compareWithDescriptorValueCheckModeSchema: function() {
22
+ return compareWithDescriptorValueCheckModeSchema;
23
+ }
24
+ });
25
+ const _zod = require("zod");
26
+ const _constants = require("../../../../src/utils/constants");
27
+ const checkActualValueCheckModeSchema = _zod.z.enum(_constants.CHECK_ACTUAL_VALUE_CHECK_MODES);
28
+ const compareWithDescriptorAnyValueCheckModeSchema = _zod.z.enum(_constants.COMPARE_WITH_DESCRIPTOR_ANY_VALUE_CHECK_MODES);
29
+ const compareWithDescriptorStringValueCheckModeSchema = _zod.z.enum(_constants.COMPARE_WITH_DESCRIPTOR_STRING_VALUE_CHECK_MODES);
30
+ const compareWithDescriptorValueCheckModeSchema = _zod.z.enum(_constants.COMPARE_WITH_DESCRIPTOR_VALUE_CHECK_MODES);
@@ -4,11 +4,9 @@ export declare const plainEntitySchema: z.ZodUnion<[z.ZodPipeline<z.ZodType<unkn
4
4
  value: (...args: unknown[]) => unknown;
5
5
  } | {
6
6
  checkMode: "equals" | "notEquals";
7
- value: ((string | number | boolean | {
7
+ value: string | number | boolean | {
8
8
  [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
9
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[]) & (string | number | boolean | {
10
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
11
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | undefined)) | null;
9
+ } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
12
10
  } | {
13
11
  checkMode: "exists" | "notExists";
14
12
  }, z.ZodTypeDef, {
@@ -16,11 +14,9 @@ export declare const plainEntitySchema: z.ZodUnion<[z.ZodPipeline<z.ZodType<unkn
16
14
  value: (...args: unknown[]) => unknown;
17
15
  } | {
18
16
  checkMode: "equals" | "notEquals";
19
- value: ((string | number | boolean | {
20
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
21
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[]) & (string | number | boolean | {
17
+ value: string | number | boolean | {
22
18
  [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
23
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | undefined)) | null;
19
+ } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
24
20
  } | {
25
21
  checkMode: "exists" | "notExists";
26
22
  }>>, z.ZodPipeline<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeAny>, z.ZodArray<z.ZodIntersection<z.ZodType<string | number | boolean | {
@@ -1,67 +1,124 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.plainEntitySchema = exports.mappedEntitySchema = void 0;
7
- var _zod = require("zod");
8
- var _checkModeSchema = require("../checkModeSchema/checkModeSchema");
9
- var _jsonSchema = require("../jsonSchema/jsonSchema");
10
- var _plainObjectSchema = require("../plainObjectSchema/plainObjectSchema");
11
- var _requiredPropertiesSchema = require("../requiredPropertiesSchema/requiredPropertiesSchema");
12
- /* ----- Plain entity schema ----- */
13
-
14
- const topLevelPlainEntityDescriptorSchema = (0, _requiredPropertiesSchema.requiredPropertiesSchema)(_zod.z.discriminatedUnion('checkMode', [_zod.z.strictObject({
15
- checkMode: _zod.z.literal('function'),
16
- value: _zod.z.function()
17
- }), _zod.z.strictObject({
18
- checkMode: _checkModeSchema.compareWithDescriptorAnyValueCheckModeSchema,
19
- value: _jsonSchema.jsonSchema
20
- }), _zod.z.strictObject({
21
- checkMode: _checkModeSchema.checkActualValueCheckModeSchema
22
- })]), ['checkMode']);
23
- const propertyLevelPlainEntityDescriptorSchema = (0, _requiredPropertiesSchema.requiredPropertiesSchema)(_zod.z.discriminatedUnion('checkMode', [_zod.z.strictObject({
24
- checkMode: _zod.z.literal('function'),
25
- value: _zod.z.function()
26
- }), _zod.z.strictObject({
27
- checkMode: _checkModeSchema.compareWithDescriptorAnyValueCheckModeSchema,
28
- value: _jsonSchema.jsonSchema
29
- }), _zod.z.strictObject({
30
- checkMode: _zod.z.literal('regExp'),
31
- value: _zod.z.union([_zod.z.instanceof(RegExp), _zod.z.array(_zod.z.instanceof(RegExp))])
32
- }), _zod.z.strictObject({
33
- checkMode: _checkModeSchema.compareWithDescriptorStringValueCheckModeSchema,
34
- value: _zod.z.union([_jsonSchema.jsonLiteralSchema, _zod.z.array(_jsonSchema.jsonLiteralSchema)])
35
- }), _zod.z.strictObject({
36
- checkMode: _checkModeSchema.checkActualValueCheckModeSchema
37
- })]), ['checkMode']);
38
- const nonCheckModeRecordSchema = recordSchema => (0, _plainObjectSchema.plainObjectSchema)(recordSchema.and(_zod.z.object({
39
- checkMode: _zod.z.never().optional()
40
- })));
41
-
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ mappedEntitySchema: function() {
13
+ return mappedEntitySchema;
14
+ },
15
+ plainEntitySchema: function() {
16
+ return plainEntitySchema;
17
+ }
18
+ });
19
+ const _zod = require("zod");
20
+ const _checkModeSchema = require("../checkModeSchema/checkModeSchema");
21
+ const _jsonSchema = require("../jsonSchema/jsonSchema");
22
+ const _plainObjectSchema = require("../plainObjectSchema/plainObjectSchema");
23
+ const _requiredPropertiesSchema = require("../requiredPropertiesSchema/requiredPropertiesSchema");
24
+ /* ----- Plain entity schema ----- */ const topLevelPlainEntityDescriptorSchema = (0, _requiredPropertiesSchema.requiredPropertiesSchema)(_zod.z.discriminatedUnion('checkMode', [
25
+ _zod.z.strictObject({
26
+ checkMode: _zod.z.literal('function'),
27
+ value: _zod.z.function()
28
+ }),
29
+ _zod.z.strictObject({
30
+ checkMode: _checkModeSchema.compareWithDescriptorAnyValueCheckModeSchema,
31
+ value: _jsonSchema.jsonSchema
32
+ }),
33
+ _zod.z.strictObject({
34
+ checkMode: _checkModeSchema.checkActualValueCheckModeSchema
35
+ })
36
+ ]), [
37
+ 'checkMode'
38
+ ]);
39
+ const propertyLevelPlainEntityDescriptorSchema = (0, _requiredPropertiesSchema.requiredPropertiesSchema)(_zod.z.discriminatedUnion('checkMode', [
40
+ _zod.z.strictObject({
41
+ checkMode: _zod.z.literal('function'),
42
+ value: _zod.z.function()
43
+ }),
44
+ _zod.z.strictObject({
45
+ checkMode: _checkModeSchema.compareWithDescriptorAnyValueCheckModeSchema,
46
+ value: _jsonSchema.jsonSchema
47
+ }),
48
+ _zod.z.strictObject({
49
+ checkMode: _zod.z.literal('regExp'),
50
+ value: _zod.z.union([
51
+ _zod.z.instanceof(RegExp),
52
+ _zod.z.array(_zod.z.instanceof(RegExp))
53
+ ])
54
+ }),
55
+ _zod.z.strictObject({
56
+ checkMode: _checkModeSchema.compareWithDescriptorStringValueCheckModeSchema,
57
+ value: _zod.z.union([
58
+ _jsonSchema.jsonLiteralSchema,
59
+ _zod.z.array(_jsonSchema.jsonLiteralSchema)
60
+ ])
61
+ }),
62
+ _zod.z.strictObject({
63
+ checkMode: _checkModeSchema.checkActualValueCheckModeSchema
64
+ })
65
+ ]), [
66
+ 'checkMode'
67
+ ]);
68
+ const nonCheckModeRecordSchema = (recordSchema)=>(0, _plainObjectSchema.plainObjectSchema)(recordSchema.and(_zod.z.object({
69
+ checkMode: _zod.z.never().optional()
70
+ })));
42
71
  // ✅ important:
43
72
  // 1st property level record disallow checkMode
44
- const topLevelRecordValueSchema = _zod.z.union([_jsonSchema.jsonLiteralSchema, _zod.z.array(_jsonSchema.jsonSchema), nonCheckModeRecordSchema(_zod.z.record(_jsonSchema.jsonSchema))]);
45
-
73
+ const topLevelRecordValueSchema = _zod.z.union([
74
+ _jsonSchema.jsonLiteralSchema,
75
+ _zod.z.array(_jsonSchema.jsonSchema),
76
+ nonCheckModeRecordSchema(_zod.z.record(_jsonSchema.jsonSchema))
77
+ ]);
46
78
  // ✅ important:
47
79
  // top level record disallow checkMode
48
- const topLevelRecordSchema = nonCheckModeRecordSchema(_zod.z.record(_zod.z.union([propertyLevelPlainEntityDescriptorSchema, topLevelRecordValueSchema])));
49
- const topLevelArraySchema = _zod.z.array(_jsonSchema.jsonSchema.and(_zod.z.custom(value => !_jsonSchema.jsonLiteralSchema.safeParse(value).success)));
50
- const plainEntitySchema = exports.plainEntitySchema = _zod.z.union([topLevelPlainEntityDescriptorSchema, topLevelRecordSchema, topLevelArraySchema]);
51
-
52
- /* ----- Mapped entity schema ----- */
53
-
54
- const mappedEntityValueSchema = _zod.z.union([_zod.z.string(), _zod.z.number(), _zod.z.boolean()]);
55
- const mappedEntityDescriptorSchema = (0, _requiredPropertiesSchema.requiredPropertiesSchema)(_zod.z.discriminatedUnion('checkMode', [_zod.z.strictObject({
56
- checkMode: _zod.z.literal('function'),
57
- value: _zod.z.function()
58
- }), _zod.z.strictObject({
59
- checkMode: _zod.z.literal('regExp'),
60
- value: _zod.z.union([_zod.z.instanceof(RegExp), _zod.z.array(_zod.z.instanceof(RegExp))])
61
- }), _zod.z.strictObject({
62
- checkMode: _checkModeSchema.compareWithDescriptorValueCheckModeSchema,
63
- value: _zod.z.union([mappedEntityValueSchema, _zod.z.array(mappedEntityValueSchema)])
64
- }), _zod.z.strictObject({
65
- checkMode: _checkModeSchema.checkActualValueCheckModeSchema
66
- })]), ['checkMode']);
67
- const mappedEntitySchema = exports.mappedEntitySchema = (0, _plainObjectSchema.plainObjectSchema)(_zod.z.record(_zod.z.union([mappedEntityValueSchema, _zod.z.array(mappedEntityValueSchema), mappedEntityDescriptorSchema])));
80
+ const topLevelRecordSchema = nonCheckModeRecordSchema(_zod.z.record(_zod.z.union([
81
+ propertyLevelPlainEntityDescriptorSchema,
82
+ topLevelRecordValueSchema
83
+ ])));
84
+ const topLevelArraySchema = _zod.z.array(_jsonSchema.jsonSchema.and(_zod.z.custom((value)=>!_jsonSchema.jsonLiteralSchema.safeParse(value).success)));
85
+ const plainEntitySchema = _zod.z.union([
86
+ topLevelPlainEntityDescriptorSchema,
87
+ topLevelRecordSchema,
88
+ topLevelArraySchema
89
+ ]);
90
+ /* ----- Mapped entity schema ----- */ const mappedEntityValueSchema = _zod.z.union([
91
+ _zod.z.string(),
92
+ _zod.z.number(),
93
+ _zod.z.boolean()
94
+ ]);
95
+ const mappedEntityDescriptorSchema = (0, _requiredPropertiesSchema.requiredPropertiesSchema)(_zod.z.discriminatedUnion('checkMode', [
96
+ _zod.z.strictObject({
97
+ checkMode: _zod.z.literal('function'),
98
+ value: _zod.z.function()
99
+ }),
100
+ _zod.z.strictObject({
101
+ checkMode: _zod.z.literal('regExp'),
102
+ value: _zod.z.union([
103
+ _zod.z.instanceof(RegExp),
104
+ _zod.z.array(_zod.z.instanceof(RegExp))
105
+ ])
106
+ }),
107
+ _zod.z.strictObject({
108
+ checkMode: _checkModeSchema.compareWithDescriptorValueCheckModeSchema,
109
+ value: _zod.z.union([
110
+ mappedEntityValueSchema,
111
+ _zod.z.array(mappedEntityValueSchema)
112
+ ])
113
+ }),
114
+ _zod.z.strictObject({
115
+ checkMode: _checkModeSchema.checkActualValueCheckModeSchema
116
+ })
117
+ ]), [
118
+ 'checkMode'
119
+ ]);
120
+ const mappedEntitySchema = (0, _plainObjectSchema.plainObjectSchema)(_zod.z.record(_zod.z.union([
121
+ mappedEntityValueSchema,
122
+ _zod.z.array(mappedEntityValueSchema),
123
+ mappedEntityDescriptorSchema
124
+ ])));