@resistdesign/voltra 3.0.0-alpha.3 → 3.0.0-alpha.4

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 (225) hide show
  1. package/README.md +75 -0
  2. package/SearchTypes-DjN6YQzE.d.ts +577 -0
  3. package/Types-C7XjUjoF.d.ts +240 -0
  4. package/Validation-CFP59oIP.d.ts +226 -0
  5. package/api/index.d.ts +6 -0
  6. package/api/index.js +7968 -0
  7. package/app/index.d.ts +5 -0
  8. package/app/index.js +810 -0
  9. package/common/Testing/CLI.js +432 -0
  10. package/common/index.d.ts +4 -0
  11. package/common/index.js +1760 -0
  12. package/iac/index.d.ts +2 -0
  13. package/iac/index.js +1661 -0
  14. package/iac/packs/index.d.ts +1 -0
  15. package/iac/packs/index.js +1620 -0
  16. package/index-BkFZlfit.d.ts +112 -0
  17. package/index-C3-iD9Mh.d.ts +690 -0
  18. package/index-DZ2BB4iX.d.ts +5357 -0
  19. package/{src/iac/types/IaCTypes.d.ts → index-DcvJOZ_c.d.ts} +1018 -23
  20. package/index-IokxSNxm.d.ts +745 -0
  21. package/index.d.ts +13 -0
  22. package/index.js +10973 -0
  23. package/package.json +40 -41
  24. package/src/api/DataAccessControl.d.ts +0 -85
  25. package/src/api/DataAccessControl.js +0 -159
  26. package/src/api/ORM/DACUtils.d.ts +0 -60
  27. package/src/api/ORM/DACUtils.js +0 -197
  28. package/src/api/ORM/ListItemUtils.d.ts +0 -7
  29. package/src/api/ORM/ListItemUtils.js +0 -22
  30. package/src/api/ORM/ORMRouteMap.d.ts +0 -19
  31. package/src/api/ORM/ORMRouteMap.js +0 -82
  32. package/src/api/ORM/TypeInfoORMService.d.ts +0 -103
  33. package/src/api/ORM/TypeInfoORMService.js +0 -581
  34. package/src/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +0 -63
  35. package/src/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.js +0 -2
  36. package/src/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +0 -36
  37. package/src/api/ORM/drivers/DynamoDBDataItemDBDriver.js +0 -282
  38. package/src/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +0 -90
  39. package/src/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.js +0 -2
  40. package/src/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +0 -45
  41. package/src/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.js +0 -127
  42. package/src/api/ORM/drivers/S3FileItemDBDriver.d.ts +0 -44
  43. package/src/api/ORM/drivers/S3FileItemDBDriver.js +0 -182
  44. package/src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +0 -12
  45. package/src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.js +0 -20
  46. package/src/api/ORM/drivers/common/Types.d.ts +0 -77
  47. package/src/api/ORM/drivers/common/Types.js +0 -14
  48. package/src/api/ORM/drivers/common/index.d.ts +0 -2
  49. package/src/api/ORM/drivers/common/index.js +0 -18
  50. package/src/api/ORM/drivers/index.d.ts +0 -3
  51. package/src/api/ORM/drivers/index.js +0 -19
  52. package/src/api/ORM/index.d.ts +0 -4
  53. package/src/api/ORM/index.js +0 -43
  54. package/src/api/Router/AWS.d.ts +0 -26
  55. package/src/api/Router/AWS.js +0 -76
  56. package/src/api/Router/Auth.d.ts +0 -2
  57. package/src/api/Router/Auth.js +0 -9
  58. package/src/api/Router/CORS.d.ts +0 -6
  59. package/src/api/Router/CORS.js +0 -27
  60. package/src/api/Router/Types.d.ts +0 -71
  61. package/src/api/Router/Types.js +0 -2
  62. package/src/api/Router/index.d.ts +0 -18
  63. package/src/api/Router/index.js +0 -145
  64. package/src/api/index.d.ts +0 -3
  65. package/src/api/index.js +0 -39
  66. package/src/app/index.d.ts +0 -1
  67. package/src/app/index.js +0 -37
  68. package/src/app/utils/ApplicationState.d.ts +0 -52
  69. package/src/app/utils/ApplicationState.js +0 -86
  70. package/src/app/utils/ApplicationStateLoader.d.ts +0 -46
  71. package/src/app/utils/ApplicationStateLoader.js +0 -57
  72. package/src/app/utils/Controller.d.ts +0 -4
  73. package/src/app/utils/Controller.js +0 -47
  74. package/src/app/utils/Debug.d.ts +0 -4
  75. package/src/app/utils/Debug.js +0 -30
  76. package/src/app/utils/EasyLayout.d.ts +0 -49
  77. package/src/app/utils/EasyLayout.js +0 -122
  78. package/src/app/utils/Route.d.ts +0 -28
  79. package/src/app/utils/Route.js +0 -102
  80. package/src/app/utils/Service.d.ts +0 -12
  81. package/src/app/utils/Service.js +0 -34
  82. package/src/app/utils/TypeInfoORMAPIUtils.d.ts +0 -20
  83. package/src/app/utils/TypeInfoORMAPIUtils.js +0 -62
  84. package/src/app/utils/TypeInfoORMClient.d.ts +0 -24
  85. package/src/app/utils/TypeInfoORMClient.js +0 -69
  86. package/src/app/utils/index.d.ts +0 -8
  87. package/src/app/utils/index.js +0 -24
  88. package/src/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +0 -1
  89. package/src/common/CommandLine/collectRequiredEnvironmentVariables.js +0 -16
  90. package/src/common/HelperTypes.d.ts +0 -3
  91. package/src/common/HelperTypes.js +0 -2
  92. package/src/common/IdGeneration/getSimpleId.d.ts +0 -4
  93. package/src/common/IdGeneration/getSimpleId.js +0 -16
  94. package/src/common/IdGeneration/index.d.ts +0 -1
  95. package/src/common/IdGeneration/index.js +0 -17
  96. package/src/common/ItemRelationshipInfoTypes.d.ts +0 -46
  97. package/src/common/ItemRelationshipInfoTypes.js +0 -20
  98. package/src/common/ItemRelationships/ItemRelationshipValidation.d.ts +0 -10
  99. package/src/common/ItemRelationships/ItemRelationshipValidation.js +0 -43
  100. package/src/common/ItemRelationships/index.d.ts +0 -1
  101. package/src/common/ItemRelationships/index.js +0 -17
  102. package/src/common/Logging/Utils.d.ts +0 -10
  103. package/src/common/Logging/Utils.js +0 -33
  104. package/src/common/Logging/index.d.ts +0 -1
  105. package/src/common/Logging/index.js +0 -17
  106. package/src/common/Routing.d.ts +0 -25
  107. package/src/common/Routing.js +0 -102
  108. package/src/common/SearchTypes.d.ts +0 -98
  109. package/src/common/SearchTypes.js +0 -39
  110. package/src/common/SearchUtils.d.ts +0 -22
  111. package/src/common/SearchUtils.js +0 -134
  112. package/src/common/SearchValidation.d.ts +0 -17
  113. package/src/common/SearchValidation.js +0 -90
  114. package/src/common/Storyboarding/Types.d.ts +0 -25
  115. package/src/common/Storyboarding/Types.js +0 -2
  116. package/src/common/StringTransformers.d.ts +0 -17
  117. package/src/common/StringTransformers.js +0 -36
  118. package/src/common/Testing/CLI.d.ts +0 -2
  119. package/src/common/Testing/CLI.js +0 -56
  120. package/src/common/Testing/Types.d.ts +0 -117
  121. package/src/common/Testing/Types.js +0 -19
  122. package/src/common/Testing/Utils.d.ts +0 -48
  123. package/src/common/Testing/Utils.js +0 -334
  124. package/src/common/Testing/index.d.ts +0 -2
  125. package/src/common/Testing/index.js +0 -18
  126. package/src/common/TypeInfoDataItemUtils.d.ts +0 -10
  127. package/src/common/TypeInfoDataItemUtils.js +0 -55
  128. package/src/common/TypeInfoORM/Types.d.ts +0 -76
  129. package/src/common/TypeInfoORM/Types.js +0 -55
  130. package/src/common/TypeInfoORM/index.d.ts +0 -1
  131. package/src/common/TypeInfoORM/index.js +0 -17
  132. package/src/common/TypeParsing/Constants.d.ts +0 -1
  133. package/src/common/TypeParsing/Constants.js +0 -4
  134. package/src/common/TypeParsing/ParsingUtils/Constants.d.ts +0 -5
  135. package/src/common/TypeParsing/ParsingUtils/Constants.js +0 -8
  136. package/src/common/TypeParsing/ParsingUtils/checkType.d.ts +0 -8
  137. package/src/common/TypeParsing/ParsingUtils/checkType.js +0 -46
  138. package/src/common/TypeParsing/ParsingUtils/checkUnionType.d.ts +0 -6
  139. package/src/common/TypeParsing/ParsingUtils/checkUnionType.js +0 -15
  140. package/src/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +0 -2
  141. package/src/common/TypeParsing/ParsingUtils/extractCommentTags.js +0 -105
  142. package/src/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +0 -6
  143. package/src/common/TypeParsing/ParsingUtils/extractLiteralValues.js +0 -42
  144. package/src/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +0 -8
  145. package/src/common/TypeParsing/ParsingUtils/extractTypeDetails.js +0 -14
  146. package/src/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +0 -5
  147. package/src/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.js +0 -27
  148. package/src/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +0 -3
  149. package/src/common/TypeParsing/ParsingUtils/getTypeInfo.js +0 -27
  150. package/src/common/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +0 -3
  151. package/src/common/TypeParsing/ParsingUtils/getTypeInfoField.js +0 -44
  152. package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +0 -4
  153. package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.js +0 -28
  154. package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +0 -4
  155. package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.js +0 -105
  156. package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +0 -4
  157. package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.js +0 -20
  158. package/src/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +0 -3
  159. package/src/common/TypeParsing/ParsingUtils/getTypeKeyword.js +0 -17
  160. package/src/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +0 -4
  161. package/src/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.js +0 -49
  162. package/src/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +0 -2
  163. package/src/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.js +0 -24
  164. package/src/common/TypeParsing/TypeInfo.d.ts +0 -142
  165. package/src/common/TypeParsing/TypeInfo.js +0 -13
  166. package/src/common/TypeParsing/TypeMapping.d.ts +0 -9
  167. package/src/common/TypeParsing/TypeMapping.js +0 -32
  168. package/src/common/TypeParsing/TypeParsing.d.ts +0 -5
  169. package/src/common/TypeParsing/TypeParsing.js +0 -39
  170. package/src/common/TypeParsing/Utils.d.ts +0 -21
  171. package/src/common/TypeParsing/Utils.js +0 -94
  172. package/src/common/TypeParsing/Validation.d.ts +0 -92
  173. package/src/common/TypeParsing/Validation.js +0 -340
  174. package/src/common/TypeParsing/index.d.ts +0 -5
  175. package/src/common/TypeParsing/index.js +0 -44
  176. package/src/common/index.d.ts +0 -11
  177. package/src/common/index.js +0 -47
  178. package/src/iac/SimpleCFT.d.ts +0 -48
  179. package/src/iac/SimpleCFT.js +0 -82
  180. package/src/iac/index.d.ts +0 -9
  181. package/src/iac/index.js +0 -48
  182. package/src/iac/packs/auth/user-management.d.ts +0 -14
  183. package/src/iac/packs/auth/user-management.js +0 -302
  184. package/src/iac/packs/auth.d.ts +0 -19
  185. package/src/iac/packs/auth.js +0 -47
  186. package/src/iac/packs/build/utils.d.ts +0 -100
  187. package/src/iac/packs/build/utils.js +0 -23
  188. package/src/iac/packs/build.d.ts +0 -29
  189. package/src/iac/packs/build.js +0 -217
  190. package/src/iac/packs/cdn.d.ts +0 -12
  191. package/src/iac/packs/cdn.js +0 -126
  192. package/src/iac/packs/cloud-function.d.ts +0 -17
  193. package/src/iac/packs/cloud-function.js +0 -69
  194. package/src/iac/packs/database.d.ts +0 -29
  195. package/src/iac/packs/database.js +0 -27
  196. package/src/iac/packs/dns.d.ts +0 -13
  197. package/src/iac/packs/dns.js +0 -26
  198. package/src/iac/packs/file-storage.d.ts +0 -14
  199. package/src/iac/packs/file-storage.js +0 -71
  200. package/src/iac/packs/gateway.d.ts +0 -27
  201. package/src/iac/packs/gateway.js +0 -342
  202. package/src/iac/packs/index.d.ts +0 -11
  203. package/src/iac/packs/index.js +0 -27
  204. package/src/iac/packs/repo.d.ts +0 -10
  205. package/src/iac/packs/repo.js +0 -34
  206. package/src/iac/packs/ssl-certificate.d.ts +0 -10
  207. package/src/iac/packs/ssl-certificate.js +0 -36
  208. package/src/iac/types/CloudFormationResourceSpecification.d.ts +0 -2
  209. package/src/iac/types/Constants.d.ts +0 -9
  210. package/src/iac/types/Constants.js +0 -20
  211. package/src/iac/types/IaCTypes.js +0 -14
  212. package/src/iac/types/Renderers.d.ts +0 -12
  213. package/src/iac/types/Renderers.js +0 -112
  214. package/src/iac/types/Types.d.ts +0 -37
  215. package/src/iac/types/Types.js +0 -2
  216. package/src/iac/types/Utils.d.ts +0 -2
  217. package/src/iac/types/Utils.js +0 -60
  218. package/src/iac/types/generate.d.ts +0 -1
  219. package/src/iac/types/generate.js +0 -31
  220. package/src/iac/utils/index.d.ts +0 -36
  221. package/src/iac/utils/index.js +0 -105
  222. package/src/iac/utils/patch-utils.d.ts +0 -15
  223. package/src/iac/utils/patch-utils.js +0 -62
  224. package/src/index.d.ts +0 -178
  225. package/src/index.js +0 -214
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSearchFields = exports.SEARCH_VALIDATION_ERRORS = void 0;
4
- const SearchTypes_1 = require("./SearchTypes");
5
- const Validation_1 = require("./TypeParsing/Validation");
6
- const TypeInfo_1 = require("./TypeParsing/TypeInfo");
7
- const Routing_1 = require("./Routing");
8
- /**
9
- * Search validation errors.
10
- * */
11
- exports.SEARCH_VALIDATION_ERRORS = {
12
- INVALID_TYPE_INFO: "INVALID_TYPE_INFO",
13
- RELATIONAL_FIELDS_NOT_ALLOWED: "RELATIONAL_FIELDS_NOT_ALLOWED",
14
- INVALID_FIELD: "INVALID_FIELD",
15
- INVALID_VALUE_OPTION: "INVALID_VALUE_OPTION",
16
- INVALID_OPERATOR: "INVALID_OPERATOR",
17
- };
18
- /**
19
- * Validate search fields against type info fields.
20
- * */
21
- const validateSearchFields = (typeInfoName, typeInfoMap, searchFields = [], disallowRelationalFields, customValidators) => {
22
- const typeInfo = typeInfoMap[typeInfoName];
23
- const results = {
24
- typeName: typeInfoName,
25
- valid: true,
26
- error: "",
27
- errorMap: {},
28
- };
29
- if (typeInfo) {
30
- const { fields = {} } = typeInfo;
31
- for (const f of searchFields) {
32
- const { fieldName, operator, customOperator, value, valueOptions } = f;
33
- if (!customOperator &&
34
- (!operator || !Object.values(SearchTypes_1.ComparisonOperators).includes(operator))) {
35
- results.valid = false;
36
- results.errorMap[fieldName] = [
37
- exports.SEARCH_VALIDATION_ERRORS.INVALID_OPERATOR,
38
- ];
39
- }
40
- else {
41
- const tIF = fields[fieldName];
42
- if (tIF) {
43
- const { typeReference, tags = {} } = tIF;
44
- const { deniedOperations: { READ: denyRead = false } = {} } = tags;
45
- if (denyRead) {
46
- results.valid = false;
47
- results.errorMap[fieldName] = [
48
- exports.SEARCH_VALIDATION_ERRORS.INVALID_FIELD,
49
- ];
50
- }
51
- else if (disallowRelationalFields && typeReference) {
52
- results.valid = false;
53
- results.errorMap[fieldName] = [
54
- exports.SEARCH_VALIDATION_ERRORS.RELATIONAL_FIELDS_NOT_ALLOWED,
55
- ];
56
- }
57
- else {
58
- const targetValueOptions = Array.isArray(valueOptions)
59
- ? valueOptions
60
- : [value];
61
- for (const tVO of targetValueOptions) {
62
- const { valid: valueIsValid, errorMap: valueErrorMap } = (0, Validation_1.validateTypeInfoFieldValue)(tVO, tIF, typeInfoMap, false, true, customValidators, TypeInfo_1.TypeOperation.READ, disallowRelationalFields
63
- ? Validation_1.RelationshipValidationType.STRICT_EXCLUDE
64
- : Validation_1.RelationshipValidationType.INCLUDE, true);
65
- if (!valueIsValid) {
66
- results.valid = false;
67
- for (const fE in valueErrorMap) {
68
- results.errorMap[(0, Routing_1.getPathString)([fieldName, fE])] =
69
- valueErrorMap[fE];
70
- }
71
- }
72
- }
73
- }
74
- }
75
- else {
76
- results.valid = false;
77
- results.errorMap[fieldName] = [
78
- exports.SEARCH_VALIDATION_ERRORS.INVALID_FIELD,
79
- ];
80
- }
81
- }
82
- }
83
- }
84
- else {
85
- results.valid = false;
86
- results.error = exports.SEARCH_VALIDATION_ERRORS.INVALID_TYPE_INFO;
87
- }
88
- return results;
89
- };
90
- exports.validateSearchFields = validateSearchFields;
@@ -1,25 +0,0 @@
1
- /**
2
- * A storyboard use case scenario.
3
- * */
4
- export type UseCase = {
5
- targetExport: string;
6
- description: string;
7
- conditions: Record<string, any>;
8
- };
9
- /**
10
- * A storyboard for a component.
11
- * */
12
- export type Storyboard = {
13
- targetFile: string;
14
- useCases: UseCase[];
15
- };
16
- /**
17
- * A storyboard that has been loaded from a JSON file.
18
- * */
19
- export type LoadedStoryboard = {
20
- path: string;
21
- } & Storyboard;
22
- /**
23
- * A map of {@link LoadedStoryboard}s.
24
- * */
25
- export type LoadedStoryboardMap = Record<string, LoadedStoryboard>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- import { TypeKeyword } from "./TypeParsing/TypeInfo";
2
- /**
3
- * A function that transforms a value into a string.
4
- * */
5
- export type StringTransformer = (value: any) => string;
6
- /**
7
- * A map of string transformers for each type keyword.
8
- * */
9
- export declare const STRING_TRANSFORMERS: Record<TypeKeyword, StringTransformer>;
10
- /**
11
- * A map of custom string transformers for each custom type.
12
- * */
13
- export declare const CUSTOM_STRING_TRANSFORMERS: Record<string, StringTransformer>;
14
- /**
15
- * Transform a value into a string based on the type keyword or custom type.
16
- * */
17
- export declare const transformValueToString: (value: any, typeKeyword: TypeKeyword, customType?: string) => string;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformValueToString = exports.CUSTOM_STRING_TRANSFORMERS = exports.STRING_TRANSFORMERS = void 0;
4
- /**
5
- * Transform a value into a string when a string is expected.
6
- * */
7
- const transformWhenStringExpected = (value) => (value ?? false) === false ? "" : `${value}`;
8
- /**
9
- * A map of string transformers for each type keyword.
10
- * */
11
- exports.STRING_TRANSFORMERS = {
12
- string: transformWhenStringExpected,
13
- number: transformWhenStringExpected,
14
- boolean: (value) => (value ? "true" : "false"),
15
- };
16
- /**
17
- * A map of custom string transformers for each custom type.
18
- * */
19
- exports.CUSTOM_STRING_TRANSFORMERS = {
20
- date: (value) => value.toISOString(),
21
- time: (value) => value.toISOString(),
22
- datetime: (value) => value.toISOString(),
23
- duration: (value) => value.toString(),
24
- reference: (value) => value.toString(),
25
- unknown: (value) => value.toString(),
26
- };
27
- /**
28
- * Transform a value into a string based on the type keyword or custom type.
29
- * */
30
- const transformValueToString = (value, typeKeyword, customType) => {
31
- const transformer = customType
32
- ? exports.CUSTOM_STRING_TRANSFORMERS[customType]
33
- : exports.STRING_TRANSFORMERS[typeKeyword];
34
- return transformer ? transformer(value) : "";
35
- };
36
- exports.transformValueToString = transformValueToString;
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env ts-node
2
- export declare const main: () => Promise<void>;
@@ -1,56 +0,0 @@
1
- #!/usr/bin/env ts-node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.main = void 0;
8
- const Utils_1 = require("./Utils");
9
- const fast_glob_1 = __importDefault(require("fast-glob"));
10
- const picocolors_1 = __importDefault(require("picocolors"));
11
- const main = async () => {
12
- const args = process.argv.slice(2);
13
- const generateMode = args.includes("--generate");
14
- const testPath = args.filter((arg) => arg !== "--generate")[0];
15
- console.log(`${picocolors_1.default.bgMagenta(picocolors_1.default.whiteBright(" VEST "))}\n`);
16
- if (!testPath) {
17
- console.error("Usage: vest [--generate] <test-directory-path>");
18
- process.exit(1);
19
- }
20
- const testFiles = await (0, fast_glob_1.default)(testPath);
21
- if (testFiles.length === 0) {
22
- console.warn(`No test files found in ${testPath}`);
23
- process.exit(0);
24
- }
25
- let results = {
26
- messages: [],
27
- passes: [],
28
- failures: [],
29
- errors: [],
30
- };
31
- await (0, Utils_1.executeTestingCommand)(testFiles, generateMode, (latestResults) => {
32
- const { messages = [], generated = [], passes = [], failures = [], errors = [], } = latestResults;
33
- results = (0, Utils_1.mergeTestResults)(results, latestResults);
34
- messages.forEach((message) => console.log(`${picocolors_1.default.blueBright("MESSAGE:")} ${message}\n`));
35
- generated.forEach((generated) => console.log(`${picocolors_1.default.greenBright("GENERATED:")} ${generated}\n`));
36
- passes.forEach((pass) => console.log(`${picocolors_1.default.greenBright("PASSED:")} ${pass}\n`));
37
- failures.forEach((failure) => console.error(`${picocolors_1.default.redBright("FAILED:")} ${failure}\n`));
38
- errors.forEach((error) => console.error(`${picocolors_1.default.redBright(picocolors_1.default.italic("ERROR:"))} ${error}\n`));
39
- });
40
- const { generated = [], passes = [], failures = [], errors = [] } = results;
41
- const exitValue = failures.length + errors.length;
42
- if (generateMode) {
43
- console.log(`${picocolors_1.default.greenBright("GENERATED:")} ${generated.length}
44
- ${picocolors_1.default.redBright(picocolors_1.default.italic("ERRORS:"))} ${errors.length}
45
- `);
46
- }
47
- else {
48
- console.log(`${picocolors_1.default.greenBright("PASSES:")} ${passes.length}
49
- ${picocolors_1.default.redBright("FAILURES:")} ${failures.length}
50
- ${picocolors_1.default.redBright(picocolors_1.default.italic("ERRORS:"))} ${errors.length}
51
- `);
52
- }
53
- process.exit(exitValue);
54
- };
55
- exports.main = main;
56
- (0, exports.main)().then();
@@ -1,117 +0,0 @@
1
- /**
2
- * Operations used for comparison of during tests.
3
- * */
4
- export declare enum TestComparisonOperation {
5
- EQUALS = "===",
6
- NOT_EQUALS = "!==",
7
- IN = "IN",
8
- ARRAY_CONTAINS = "ARRAY_CONTAINS",
9
- BETWEEN = "BETWEEN",
10
- CONTAINS = "CONTAINS",
11
- REGEX = "REGEX",
12
- EXT_REGEX = "EXT_REGEX",
13
- DEEP_EQUALS = "DEEP_EQUALS",
14
- ARRAY_EQUALS = "ARRAY_EQUALS"
15
- }
16
- /**
17
- * A pattern definition object for use with extended regex expectations.
18
- * */
19
- export type PatternElement = {
20
- value: string;
21
- escaped?: boolean;
22
- };
23
- /**
24
- * An extended regex expectation with a patter structure, optional flags and
25
- * escaping properties that allow for clear and explicit declaration of regex
26
- * patterns in JSON.
27
- *
28
- * Used when a `TestCondition` `operation` is `TestComparisonOperation.EXT_REGEX`.
29
- * */
30
- export type EXTRegexExpectation = {
31
- pattern: PatternElement[];
32
- flags?: string;
33
- };
34
- /**
35
- * A regex expectation with a pattern and optional flags.
36
- *
37
- * Used when a `TestCondition` `operation` is `TestComparisonOperation.REGEX`.
38
- * */
39
- export type RegexExpectation = {
40
- pattern: string;
41
- flags?: string;
42
- };
43
- /**
44
- * A configuration used to acquire conditions from code instead of a JSON array.
45
- * */
46
- export type ConditionConfig = {
47
- file: string;
48
- export: string;
49
- };
50
- /**
51
- * Preparation for a test when some setup is required or a class needs to be instantiated.
52
- * */
53
- export type TestSetup = {
54
- conditions: unknown[] | ConditionConfig;
55
- export: string;
56
- instantiate?: boolean;
57
- };
58
- /**
59
- * The basis for a test.
60
- * */
61
- export type BaseTest = {
62
- export: string;
63
- setup?: TestSetup;
64
- conditions: unknown[] | ConditionConfig;
65
- expectUndefined?: boolean;
66
- };
67
- /**
68
- * A singular test with specific types of expectations for a given operation.
69
- * */
70
- export type Test = BaseTest & ({
71
- operation?: TestComparisonOperation.EQUALS | TestComparisonOperation.NOT_EQUALS;
72
- expectation: string | number | boolean | null | undefined;
73
- } | {
74
- operation: TestComparisonOperation.IN | TestComparisonOperation.ARRAY_CONTAINS;
75
- expectation: unknown[];
76
- } | {
77
- operation: TestComparisonOperation.BETWEEN;
78
- expectation: [number, number];
79
- } | {
80
- operation: TestComparisonOperation.CONTAINS;
81
- expectation: string;
82
- } | {
83
- operation: TestComparisonOperation.REGEX;
84
- expectation: RegexExpectation;
85
- } | {
86
- operation: TestComparisonOperation.EXT_REGEX;
87
- expectation: EXTRegexExpectation;
88
- } | {
89
- operation: TestComparisonOperation.DEEP_EQUALS;
90
- expectation: Record<string, unknown>;
91
- } | {
92
- operation: TestComparisonOperation.ARRAY_EQUALS;
93
- expectation: unknown[];
94
- });
95
- /**
96
- * A configuration for a test. Designed to be used in JSON for declarative test files.
97
- * */
98
- export type TestConfig = {
99
- file: string;
100
- tests: Test[];
101
- };
102
- /**
103
- * A resolved test configuration with the module and tests.
104
- * */
105
- export type ResolvedTestConfig = {
106
- targetModule: any;
107
- } & TestConfig;
108
- /**
109
- * The results from running one or more tests.
110
- * */
111
- export type TestResults = {
112
- messages?: string[];
113
- generated?: string[];
114
- passes?: string[];
115
- failures?: string[];
116
- errors?: string[];
117
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestComparisonOperation = void 0;
4
- /**
5
- * Operations used for comparison of during tests.
6
- * */
7
- var TestComparisonOperation;
8
- (function (TestComparisonOperation) {
9
- TestComparisonOperation["EQUALS"] = "===";
10
- TestComparisonOperation["NOT_EQUALS"] = "!==";
11
- TestComparisonOperation["IN"] = "IN";
12
- TestComparisonOperation["ARRAY_CONTAINS"] = "ARRAY_CONTAINS";
13
- TestComparisonOperation["BETWEEN"] = "BETWEEN";
14
- TestComparisonOperation["CONTAINS"] = "CONTAINS";
15
- TestComparisonOperation["REGEX"] = "REGEX";
16
- TestComparisonOperation["EXT_REGEX"] = "EXT_REGEX";
17
- TestComparisonOperation["DEEP_EQUALS"] = "DEEP_EQUALS";
18
- TestComparisonOperation["ARRAY_EQUALS"] = "ARRAY_EQUALS";
19
- })(TestComparisonOperation || (exports.TestComparisonOperation = TestComparisonOperation = {}));
@@ -1,48 +0,0 @@
1
- import { ConditionConfig, ResolvedTestConfig, Test, TestComparisonOperation, TestConfig, TestResults } from "./Types";
2
- /**
3
- * A map of comparison functions for each `TestComparisonOperation`.
4
- * */
5
- export declare const OPERATIONS: Record<string, (a: unknown, b: unknown) => boolean>;
6
- /**
7
- * Compare a result with an expectation using a specified `TestComparisonOperation`.
8
- * */
9
- export declare const compare: (result: unknown, expectation: unknown, operation?: TestComparisonOperation) => boolean;
10
- /**
11
- * Get the target module for testing from a file being tested.
12
- * */
13
- export declare const getResolvedConditions: (testFilePath: string, targetTestIndex: number, targetTestExport: string, conditions: unknown[] | ConditionConfig, isSetup?: boolean) => unknown[];
14
- /**
15
- * Get the target base instance from a module, for a given test setup.
16
- * */
17
- export declare const getSetupInstance: (testFilePath: string, targetTestIndex: number, targetTestExport: string, test: Test, module: any) => Promise<any>;
18
- export declare const getTestFunction: (testFilePath: string, file: string, targetTestIndex: number, test: Test, targetModule: any) => Promise<(...args: unknown[]) => Promise<unknown> | unknown>;
19
- /**
20
- * Get the test configuration from a test file.
21
- * */
22
- export declare const getTestConfig: (testFilePath: string) => Promise<TestConfig>;
23
- /**
24
- * Get the target module for testing from a file being tested.
25
- * */
26
- export declare const getResolvedTestConfig: (testFilePath: string) => Promise<ResolvedTestConfig>;
27
- /**
28
- * Merge multiple test results into a single result.
29
- * */
30
- export declare const mergeTestResults: (...results: TestResults[]) => TestResults;
31
- /**
32
- * Run a test using a test function and a test condition.
33
- * */
34
- export declare const runTest: (testFilePath: string, testFunction: (...args: unknown[]) => Promise<unknown> | unknown, test: Test, index: number, targetExport: string, report: (results: TestResults) => void) => Promise<void>;
35
- /**
36
- * Generate tests for a file by running the tests, capturing the current result and storing it as the new expectation.
37
- * */
38
- export declare const generateTestsForFile: (testFilePath: string, report: (results: TestResults) => void) => Promise<void>;
39
- /**
40
- * Run the tests for a given test file.
41
- *
42
- * The test file content is expected to be a JSON in the structure of a `TestConfig`.
43
- * */
44
- export declare const runTestsForFile: (testFilePath: string, report: (results: TestResults) => void) => Promise<void>;
45
- /**
46
- * Run or generate all of the tests in the specified `testPath` glob.
47
- * */
48
- export declare const executeTestingCommand: (testFiles: string[], generateMode: boolean | undefined, report: (results: TestResults) => void) => Promise<void>;