@resistdesign/voltra 3.0.0-alpha.16 → 3.0.0-alpha.18
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 +2 -2
- package/api/Indexing/API.d.ts +15 -27
- package/api/ORM/index.d.ts +0 -1
- package/api/index.d.ts +11 -15
- package/api/index.js +1 -163
- package/app/index.d.ts +5 -7
- package/app/index.js +2 -63
- package/app/utils/Route.d.ts +1 -1
- package/build/index.d.ts +9 -1
- package/common/TypeParsing/index.d.ts +3 -3
- package/common/index.d.ts +17 -48
- package/common/index.js +21 -890
- package/iac/SimpleCFT.d.ts +1 -1
- package/iac/index.d.ts +12 -10
- package/iac/index.js +2 -1405
- package/iac/packs/auth/user-management.d.ts +38 -14
- package/iac/packs/auth.d.ts +42 -22
- package/iac/packs/build.d.ts +2 -1
- package/iac/packs/cdn.d.ts +2 -1
- package/iac/packs/cloud-function.d.ts +3 -1
- package/iac/packs/database.d.ts +2 -1
- package/iac/packs/dns.d.ts +2 -1
- package/iac/packs/file-storage.d.ts +2 -1
- package/iac/packs/gateway.d.ts +3 -1
- package/iac/packs/index.d.ts +44 -0
- package/iac/packs/index.js +93 -91
- package/iac/packs/repo.d.ts +2 -1
- package/iac/packs/ssl-certificate.d.ts +2 -1
- package/native/index.d.ts +5 -7
- package/native/index.js +1 -46
- package/package.json +1 -1
- package/web/index.d.ts +5 -7
- package/web/index.js +1 -26
package/common/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
import { promises } from 'fs';
|
|
2
|
-
import Path from 'path';
|
|
3
|
-
import { pathToFileURL } from 'url';
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// src/common/CommandLine/index.ts
|
|
12
|
-
var CommandLine_exports = {};
|
|
13
|
-
__export(CommandLine_exports, {
|
|
14
|
-
collectRequiredEnvironmentVariables: () => collectRequiredEnvironmentVariables
|
|
15
|
-
});
|
|
16
|
-
|
|
17
1
|
// src/common/CommandLine/collectRequiredEnvironmentVariables.ts
|
|
18
2
|
var collectRequiredEnvironmentVariables = (varNames) => {
|
|
19
3
|
const result = {};
|
|
@@ -43,40 +27,7 @@ ${missingEnvVars.map((vN) => `- ${vN}`).join(`
|
|
|
43
27
|
return result;
|
|
44
28
|
};
|
|
45
29
|
|
|
46
|
-
// src/common/TypeParsing/index.ts
|
|
47
|
-
var TypeParsing_exports = {};
|
|
48
|
-
__export(TypeParsing_exports, {
|
|
49
|
-
Constants: () => Constants_exports,
|
|
50
|
-
TypeInfo: () => TypeInfo_exports,
|
|
51
|
-
Validation: () => Validation_exports
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// src/common/TypeParsing/Validation.ts
|
|
55
|
-
var Validation_exports = {};
|
|
56
|
-
__export(Validation_exports, {
|
|
57
|
-
DENIED_TYPE_OPERATIONS: () => DENIED_TYPE_OPERATIONS,
|
|
58
|
-
ERROR_MESSAGE_CONSTANTS: () => ERROR_MESSAGE_CONSTANTS,
|
|
59
|
-
INVALID_CUSTOM_TYPE: () => INVALID_CUSTOM_TYPE,
|
|
60
|
-
PRIMITIVE_ERROR_MESSAGE_CONSTANTS: () => PRIMITIVE_ERROR_MESSAGE_CONSTANTS,
|
|
61
|
-
RelationshipValidationType: () => RelationshipValidationType,
|
|
62
|
-
TYPE_KEYWORD_VALIDATORS: () => TYPE_KEYWORD_VALIDATORS,
|
|
63
|
-
getValidityValue: () => getValidityValue,
|
|
64
|
-
hasValue: () => hasValue,
|
|
65
|
-
validateArrayOfTypeInfoFieldValues: () => validateArrayOfTypeInfoFieldValues,
|
|
66
|
-
validateCustomType: () => validateCustomType,
|
|
67
|
-
validateKeywordType: () => validateKeywordType,
|
|
68
|
-
validateTypeInfoFieldOperationAllowed: () => validateTypeInfoFieldOperationAllowed,
|
|
69
|
-
validateTypeInfoFieldValue: () => validateTypeInfoFieldValue,
|
|
70
|
-
validateTypeInfoValue: () => validateTypeInfoValue,
|
|
71
|
-
validateTypeOperationAllowed: () => validateTypeOperationAllowed,
|
|
72
|
-
validateValueMatchesPattern: () => validateValueMatchesPattern
|
|
73
|
-
});
|
|
74
|
-
|
|
75
30
|
// src/common/TypeParsing/TypeInfo.ts
|
|
76
|
-
var TypeInfo_exports = {};
|
|
77
|
-
__export(TypeInfo_exports, {
|
|
78
|
-
TypeOperation: () => TypeOperation
|
|
79
|
-
});
|
|
80
31
|
var TypeOperation = /* @__PURE__ */ ((TypeOperation2) => {
|
|
81
32
|
TypeOperation2["CREATE"] = "CREATE";
|
|
82
33
|
TypeOperation2["READ"] = "READ";
|
|
@@ -85,92 +36,29 @@ var TypeOperation = /* @__PURE__ */ ((TypeOperation2) => {
|
|
|
85
36
|
return TypeOperation2;
|
|
86
37
|
})(TypeOperation || {});
|
|
87
38
|
|
|
39
|
+
// src/common/TypeInfoORM/Types.ts
|
|
40
|
+
var TypeInfoORMServiceError = /* @__PURE__ */ ((TypeInfoORMServiceError2) => {
|
|
41
|
+
TypeInfoORMServiceError2["NO_DRIVERS_SUPPLIED"] = "NO_DRIVERS_SUPPLIED";
|
|
42
|
+
TypeInfoORMServiceError2["NO_RELATIONSHIP_DRIVERS_SUPPLIED"] = "NO_RELATIONSHIP_DRIVERS_SUPPLIED";
|
|
43
|
+
TypeInfoORMServiceError2["NO_PRIMARY_FIELD_VALUE_SUPPLIED"] = "NO_PRIMARY_FIELD_VALUE_SUPPLIED";
|
|
44
|
+
TypeInfoORMServiceError2["INVALID_DRIVER"] = "INVALID_DRIVER";
|
|
45
|
+
TypeInfoORMServiceError2["INVALID_RELATIONSHIP_DRIVER"] = "INVALID_RELATIONSHIP_DRIVER";
|
|
46
|
+
TypeInfoORMServiceError2["INVALID_TYPE_INFO"] = "INVALID_TYPE_INFO";
|
|
47
|
+
TypeInfoORMServiceError2["TYPE_INFO_MISSING_PRIMARY_FIELD"] = "TYPE_INFO_MISSING_PRIMARY_FIELD";
|
|
48
|
+
TypeInfoORMServiceError2["INVALID_RELATIONSHIP"] = "INVALID_RELATIONSHIP";
|
|
49
|
+
TypeInfoORMServiceError2["INVALID_OPERATION"] = "INVALID_OPERATION";
|
|
50
|
+
TypeInfoORMServiceError2["MISSING_ACCESSING_ROLE"] = "MISSING_ACCESSING_ROLE";
|
|
51
|
+
TypeInfoORMServiceError2["INDEXING_UNSUPPORTED_CRITERIA"] = "INDEXING_UNSUPPORTED_CRITERIA";
|
|
52
|
+
TypeInfoORMServiceError2["INDEXING_UNSUPPORTED_COMBINATION"] = "INDEXING_UNSUPPORTED_COMBINATION";
|
|
53
|
+
TypeInfoORMServiceError2["INDEXING_MISSING_INDEX_FIELD"] = "INDEXING_MISSING_INDEX_FIELD";
|
|
54
|
+
TypeInfoORMServiceError2["INDEXING_MISSING_BACKEND"] = "INDEXING_MISSING_BACKEND";
|
|
55
|
+
TypeInfoORMServiceError2["INDEXING_REQUIRES_CRITERIA"] = "INDEXING_REQUIRES_CRITERIA";
|
|
56
|
+
return TypeInfoORMServiceError2;
|
|
57
|
+
})(TypeInfoORMServiceError || {});
|
|
58
|
+
|
|
88
59
|
// src/common/Routing.ts
|
|
89
|
-
var Routing_exports = {};
|
|
90
|
-
__export(Routing_exports, {
|
|
91
|
-
PATH_DELIMITER: () => PATH_DELIMITER,
|
|
92
|
-
getParamsAndTestPath: () => getParamsAndTestPath,
|
|
93
|
-
getPathArray: () => getPathArray,
|
|
94
|
-
getPathString: () => getPathString,
|
|
95
|
-
getPotentialJSONValue: () => getPotentialJSONValue,
|
|
96
|
-
mergeStringPaths: () => mergeStringPaths,
|
|
97
|
-
resolvePath: () => resolvePath
|
|
98
|
-
});
|
|
99
60
|
var PATH_DELIMITER = "/";
|
|
100
|
-
var getPotentialJSONValue = (value) => {
|
|
101
|
-
try {
|
|
102
|
-
return JSON.parse(value);
|
|
103
|
-
} catch (error) {
|
|
104
|
-
return value;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
var getPathArray = (path, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriDecodeParts = true) => path.split(delimiter).filter(filterEmptyInput ? (p) => p !== "" : () => true).map(uriDecodeParts ? decodeURIComponent : (x) => x).map(useJson ? getPotentialJSONValue : (p) => p).filter(filterEmptyOutput ? (p) => p ?? false : () => true);
|
|
108
61
|
var getPathString = (parts = [], delimiter = PATH_DELIMITER, filterEmptyInput = false, useJson = true, uriEncodeParts = false) => parts.filter(filterEmptyInput ? (p) => p ?? false : () => true).map(useJson ? (p) => JSON.stringify(p) : (x) => x).map(uriEncodeParts ? encodeURIComponent : (x) => x).join(delimiter);
|
|
109
|
-
var mergeStringPaths = (path1, path2, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriEncodeParts = false) => getPathString(
|
|
110
|
-
[
|
|
111
|
-
...getPathArray(
|
|
112
|
-
path1,
|
|
113
|
-
delimiter,
|
|
114
|
-
filterEmptyOutput,
|
|
115
|
-
filterEmptyInput,
|
|
116
|
-
useJson,
|
|
117
|
-
uriEncodeParts
|
|
118
|
-
),
|
|
119
|
-
...getPathArray(
|
|
120
|
-
path2,
|
|
121
|
-
delimiter,
|
|
122
|
-
filterEmptyOutput,
|
|
123
|
-
filterEmptyInput,
|
|
124
|
-
useJson,
|
|
125
|
-
uriEncodeParts
|
|
126
|
-
)
|
|
127
|
-
],
|
|
128
|
-
delimiter,
|
|
129
|
-
filterEmptyInput,
|
|
130
|
-
useJson,
|
|
131
|
-
uriEncodeParts
|
|
132
|
-
);
|
|
133
|
-
var resolvePath = (currentPath, newPath) => {
|
|
134
|
-
const newSegments = getPathArray(newPath, PATH_DELIMITER, true);
|
|
135
|
-
let currentSegments = getPathArray(currentPath, PATH_DELIMITER, true);
|
|
136
|
-
if (newPath.startsWith("/")) {
|
|
137
|
-
currentSegments = [];
|
|
138
|
-
}
|
|
139
|
-
newSegments.forEach((segment) => {
|
|
140
|
-
if (segment === "..") {
|
|
141
|
-
if (currentSegments.length > 0) {
|
|
142
|
-
currentSegments.pop();
|
|
143
|
-
}
|
|
144
|
-
} else if (segment !== ".") {
|
|
145
|
-
currentSegments.push(segment);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
return "/" + currentSegments.join("/");
|
|
149
|
-
};
|
|
150
|
-
var getParamsAndTestPath = (path, testPath, exact = false) => {
|
|
151
|
-
const pathList = getPathArray(path);
|
|
152
|
-
const testPathList = getPathArray(testPath);
|
|
153
|
-
if (exact && pathList.length !== testPathList.length) {
|
|
154
|
-
return false;
|
|
155
|
-
} else {
|
|
156
|
-
let params = {};
|
|
157
|
-
if (pathList.length >= testPathList.length) {
|
|
158
|
-
for (let i = 0; i < testPathList.length; i++) {
|
|
159
|
-
const testPathPart = testPathList[i];
|
|
160
|
-
const pathPart = pathList[i];
|
|
161
|
-
if (testPathPart.startsWith(":")) {
|
|
162
|
-
const paramName = testPathPart.slice(1);
|
|
163
|
-
params[paramName] = pathPart;
|
|
164
|
-
} else if (pathPart !== testPathPart) {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
return params;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
62
|
|
|
175
63
|
// src/common/TypeParsing/Validation.ts
|
|
176
64
|
var RelationshipValidationType = /* @__PURE__ */ ((RelationshipValidationType2) => {
|
|
@@ -522,761 +410,4 @@ var validateTypeInfoValue = (value, typeInfoFullName, typeInfoMap, strict = fals
|
|
|
522
410
|
return results;
|
|
523
411
|
};
|
|
524
412
|
|
|
525
|
-
|
|
526
|
-
var Constants_exports = {};
|
|
527
|
-
__export(Constants_exports, {
|
|
528
|
-
BUILTIN_TYPE_NAMES: () => BUILTIN_TYPE_NAMES
|
|
529
|
-
});
|
|
530
|
-
var BUILTIN_TYPE_NAMES = [
|
|
531
|
-
"string",
|
|
532
|
-
"number",
|
|
533
|
-
"boolean",
|
|
534
|
-
"null",
|
|
535
|
-
"object",
|
|
536
|
-
"array",
|
|
537
|
-
"any",
|
|
538
|
-
"unknown",
|
|
539
|
-
"never"
|
|
540
|
-
];
|
|
541
|
-
|
|
542
|
-
// src/common/IdGeneration/index.ts
|
|
543
|
-
var IdGeneration_exports = {};
|
|
544
|
-
__export(IdGeneration_exports, {
|
|
545
|
-
getSimpleId: () => getSimpleId
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
// src/common/IdGeneration/getSimpleId.ts
|
|
549
|
-
var LAST_HAST_ID = 0;
|
|
550
|
-
var textEncoder = new TextEncoder();
|
|
551
|
-
var bytesToBinaryString = (bytes) => {
|
|
552
|
-
let out = "";
|
|
553
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
554
|
-
out += String.fromCharCode(bytes[i]);
|
|
555
|
-
}
|
|
556
|
-
return out;
|
|
557
|
-
};
|
|
558
|
-
var getBase64EncodedString = (input) => {
|
|
559
|
-
const bytes = textEncoder.encode(input);
|
|
560
|
-
let base64 = "";
|
|
561
|
-
if (typeof globalThis.btoa === "function") {
|
|
562
|
-
const binary = bytesToBinaryString(bytes);
|
|
563
|
-
base64 = globalThis.btoa(binary);
|
|
564
|
-
} else {
|
|
565
|
-
const anyGlobal = globalThis;
|
|
566
|
-
if (typeof anyGlobal.Buffer === "function") {
|
|
567
|
-
base64 = anyGlobal.Buffer.from(bytes).toString("base64");
|
|
568
|
-
} else {
|
|
569
|
-
throw new Error("No base64 encoder available (need btoa or Buffer).");
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
return base64;
|
|
573
|
-
};
|
|
574
|
-
var getSimpleId = () => {
|
|
575
|
-
const hashId = LAST_HAST_ID++;
|
|
576
|
-
const base64Datetime = getBase64EncodedString(
|
|
577
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
578
|
-
);
|
|
579
|
-
const rand1 = Math.random().toString(36).substring(2, 15);
|
|
580
|
-
const rand2 = Math.random().toString(36).substring(2, 15);
|
|
581
|
-
return `${hashId}-${base64Datetime}-${rand1}-${rand2}`;
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
// src/common/SearchTypes.ts
|
|
585
|
-
var SearchTypes_exports = {};
|
|
586
|
-
__export(SearchTypes_exports, {
|
|
587
|
-
ComparisonOperators: () => ComparisonOperators,
|
|
588
|
-
LogicalOperators: () => LogicalOperators
|
|
589
|
-
});
|
|
590
|
-
var LogicalOperators = /* @__PURE__ */ ((LogicalOperators2) => {
|
|
591
|
-
LogicalOperators2["AND"] = "AND";
|
|
592
|
-
LogicalOperators2["OR"] = "OR";
|
|
593
|
-
return LogicalOperators2;
|
|
594
|
-
})(LogicalOperators || {});
|
|
595
|
-
var ComparisonOperators = /* @__PURE__ */ ((ComparisonOperators2) => {
|
|
596
|
-
ComparisonOperators2["EQUALS"] = "EQUALS";
|
|
597
|
-
ComparisonOperators2["NOT_EQUALS"] = "NOT_EQUALS";
|
|
598
|
-
ComparisonOperators2["GREATER_THAN"] = "GREATER_THAN";
|
|
599
|
-
ComparisonOperators2["GREATER_THAN_OR_EQUAL"] = "GREATER_THAN_OR_EQUAL";
|
|
600
|
-
ComparisonOperators2["LESS_THAN"] = "LESS_THAN";
|
|
601
|
-
ComparisonOperators2["LESS_THAN_OR_EQUAL"] = "LESS_THAN_OR_EQUAL";
|
|
602
|
-
ComparisonOperators2["IN"] = "IN";
|
|
603
|
-
ComparisonOperators2["NOT_IN"] = "NOT_IN";
|
|
604
|
-
ComparisonOperators2["LIKE"] = "LIKE";
|
|
605
|
-
ComparisonOperators2["NOT_LIKE"] = "NOT_LIKE";
|
|
606
|
-
ComparisonOperators2["EXISTS"] = "EXISTS";
|
|
607
|
-
ComparisonOperators2["NOT_EXISTS"] = "NOT_EXISTS";
|
|
608
|
-
ComparisonOperators2["IS_NOT_EMPTY"] = "IS_NOT_EMPTY";
|
|
609
|
-
ComparisonOperators2["IS_EMPTY"] = "IS_EMPTY";
|
|
610
|
-
ComparisonOperators2["BETWEEN"] = "BETWEEN";
|
|
611
|
-
ComparisonOperators2["NOT_BETWEEN"] = "NOT_BETWEEN";
|
|
612
|
-
ComparisonOperators2["CONTAINS"] = "CONTAINS";
|
|
613
|
-
ComparisonOperators2["NOT_CONTAINS"] = "NOT_CONTAINS";
|
|
614
|
-
ComparisonOperators2["STARTS_WITH"] = "STARTS_WITH";
|
|
615
|
-
ComparisonOperators2["ENDS_WITH"] = "ENDS_WITH";
|
|
616
|
-
ComparisonOperators2["DOES_NOT_START_WITH"] = "DOES_NOT_START_WITH";
|
|
617
|
-
ComparisonOperators2["DOES_NOT_END_WITH"] = "DOES_NOT_END_WITH";
|
|
618
|
-
return ComparisonOperators2;
|
|
619
|
-
})(ComparisonOperators || {});
|
|
620
|
-
|
|
621
|
-
// src/common/SearchUtils.ts
|
|
622
|
-
var SearchUtils_exports = {};
|
|
623
|
-
__export(SearchUtils_exports, {
|
|
624
|
-
COMPARATORS: () => COMPARATORS,
|
|
625
|
-
compare: () => compare,
|
|
626
|
-
compareArray: () => compareArray,
|
|
627
|
-
getFilterTypeInfoDataItemsBySearchCriteria: () => getFilterTypeInfoDataItemsBySearchCriteria,
|
|
628
|
-
getSortedItems: () => getSortedItems
|
|
629
|
-
});
|
|
630
|
-
var COMPARATORS = {
|
|
631
|
-
["EQUALS" /* EQUALS */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue === criterionValue,
|
|
632
|
-
["NOT_EQUALS" /* NOT_EQUALS */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue !== criterionValue,
|
|
633
|
-
["GREATER_THAN" /* GREATER_THAN */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue > criterionValue,
|
|
634
|
-
["GREATER_THAN_OR_EQUAL" /* GREATER_THAN_OR_EQUAL */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue >= criterionValue,
|
|
635
|
-
["LESS_THAN" /* LESS_THAN */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue < criterionValue,
|
|
636
|
-
["LESS_THAN_OR_EQUAL" /* LESS_THAN_OR_EQUAL */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue <= criterionValue,
|
|
637
|
-
["IN" /* IN */]: (criterionValue, criterionValueOptions, fieldValue) => Array.isArray(criterionValueOptions) && criterionValueOptions.includes(fieldValue),
|
|
638
|
-
["NOT_IN" /* NOT_IN */]: (criterionValue, criterionValueOptions, fieldValue) => !Array.isArray(criterionValueOptions) || !criterionValueOptions.includes(fieldValue),
|
|
639
|
-
["LIKE" /* LIKE */]: (criterionValue, criterionValueOptions, fieldValue) => `${fieldValue}`.includes(`${criterionValue}`),
|
|
640
|
-
["NOT_LIKE" /* NOT_LIKE */]: (criterionValue, criterionValueOptions, fieldValue) => !`${fieldValue}`.includes(`${criterionValue}`),
|
|
641
|
-
["EXISTS" /* EXISTS */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue !== void 0 && fieldValue !== null,
|
|
642
|
-
["NOT_EXISTS" /* NOT_EXISTS */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue === void 0 || fieldValue === null,
|
|
643
|
-
["IS_NOT_EMPTY" /* IS_NOT_EMPTY */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue !== void 0 && fieldValue !== null && fieldValue !== "",
|
|
644
|
-
["IS_EMPTY" /* IS_EMPTY */]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue === void 0 || fieldValue === null || fieldValue === "",
|
|
645
|
-
["BETWEEN" /* BETWEEN */]: (criterionValue, criterionValueOptions, fieldValue) => Array.isArray(criterionValueOptions) && fieldValue >= criterionValueOptions[0] && fieldValue <= criterionValueOptions[1],
|
|
646
|
-
["NOT_BETWEEN" /* NOT_BETWEEN */]: (criterionValue, criterionValueOptions, fieldValue) => !Array.isArray(criterionValueOptions) || fieldValue < criterionValueOptions[0] || fieldValue > criterionValueOptions[1],
|
|
647
|
-
["CONTAINS" /* CONTAINS */]: (criterionValue, criterionValueOptions, fieldValue) => Array.isArray(fieldValue) && fieldValue.includes(criterionValue),
|
|
648
|
-
["NOT_CONTAINS" /* NOT_CONTAINS */]: (criterionValue, criterionValueOptions, fieldValue) => !Array.isArray(fieldValue) || !fieldValue.includes(criterionValue),
|
|
649
|
-
["STARTS_WITH" /* STARTS_WITH */]: (criterionValue, criterionValueOptions, fieldValue) => `${fieldValue}`.startsWith(`${criterionValue}`),
|
|
650
|
-
["ENDS_WITH" /* ENDS_WITH */]: (criterionValue, criterionValueOptions, fieldValue) => `${fieldValue}`.endsWith(`${criterionValue}`),
|
|
651
|
-
["DOES_NOT_START_WITH" /* DOES_NOT_START_WITH */]: (criterionValue, criterionValueOptions, fieldValue) => !`${fieldValue}`.startsWith(`${criterionValue}`),
|
|
652
|
-
["DOES_NOT_END_WITH" /* DOES_NOT_END_WITH */]: (criterionValue, criterionValueOptions, fieldValue) => !`${fieldValue}`.endsWith(`${criterionValue}`)
|
|
653
|
-
};
|
|
654
|
-
var compare = (fieldCriterion, fieldValue) => {
|
|
655
|
-
const {
|
|
656
|
-
operator,
|
|
657
|
-
value: criterionValue,
|
|
658
|
-
valueOptions: criterionValueOptions
|
|
659
|
-
} = fieldCriterion;
|
|
660
|
-
const comparator = operator ? COMPARATORS[operator] : void 0;
|
|
661
|
-
if (comparator) {
|
|
662
|
-
return comparator(criterionValue, criterionValueOptions, fieldValue);
|
|
663
|
-
} else {
|
|
664
|
-
return false;
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
var compareArray = (fieldCriterion, fieldValue) => {
|
|
668
|
-
if (Array.isArray(fieldValue)) {
|
|
669
|
-
const { operator } = fieldCriterion;
|
|
670
|
-
const isArrayOperator = operator === "CONTAINS" /* CONTAINS */ || operator === "NOT_CONTAINS" /* NOT_CONTAINS */;
|
|
671
|
-
return isArrayOperator ? compare(fieldCriterion, fieldValue) : fieldValue.some((value) => compare(fieldCriterion, value));
|
|
672
|
-
} else {
|
|
673
|
-
return false;
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
var getFilterTypeInfoDataItemsBySearchCriteria = (searchCriteria, items, typeInfoName, typeInfoMap) => {
|
|
677
|
-
const { fields = {} } = typeInfoMap?.[typeInfoName] || {};
|
|
678
|
-
const { logicalOperator = "AND" /* AND */, fieldCriteria = [] } = searchCriteria;
|
|
679
|
-
const filteredItems = [];
|
|
680
|
-
for (const currentItem of items) {
|
|
681
|
-
if (typeof currentItem === "object" && currentItem !== null) {
|
|
682
|
-
let meetsCriteria = true;
|
|
683
|
-
for (const fieldCriterion of fieldCriteria) {
|
|
684
|
-
const { fieldName } = fieldCriterion;
|
|
685
|
-
const { array: isArrayType, typeReference } = fields[fieldName] || {};
|
|
686
|
-
const currentFieldValue = currentItem[fieldName];
|
|
687
|
-
if (!typeReference) {
|
|
688
|
-
const result = isArrayType ? compareArray(
|
|
689
|
-
fieldCriterion,
|
|
690
|
-
currentFieldValue
|
|
691
|
-
) : compare(fieldCriterion, currentFieldValue);
|
|
692
|
-
if (logicalOperator === "AND" /* AND */) {
|
|
693
|
-
meetsCriteria = result;
|
|
694
|
-
if (!meetsCriteria) {
|
|
695
|
-
break;
|
|
696
|
-
}
|
|
697
|
-
} else {
|
|
698
|
-
meetsCriteria = meetsCriteria || result;
|
|
699
|
-
if (meetsCriteria) {
|
|
700
|
-
break;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
if (meetsCriteria) {
|
|
706
|
-
filteredItems.push(currentItem);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return filteredItems;
|
|
711
|
-
};
|
|
712
|
-
var getSortedItems = (sortFields = [], items = []) => {
|
|
713
|
-
let newItems = [...items];
|
|
714
|
-
if (sortFields.length > 0) {
|
|
715
|
-
for (const sortF of sortFields) {
|
|
716
|
-
const { field, reverse } = sortF;
|
|
717
|
-
newItems = newItems.sort((a, b) => {
|
|
718
|
-
const aValue = a[field];
|
|
719
|
-
const bValue = b[field];
|
|
720
|
-
if (aValue < bValue) {
|
|
721
|
-
return reverse ? 1 : -1;
|
|
722
|
-
} else if (aValue > bValue) {
|
|
723
|
-
return reverse ? -1 : 1;
|
|
724
|
-
} else {
|
|
725
|
-
return 0;
|
|
726
|
-
}
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return newItems;
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
// src/common/StringTransformers.ts
|
|
734
|
-
var StringTransformers_exports = {};
|
|
735
|
-
__export(StringTransformers_exports, {
|
|
736
|
-
CUSTOM_STRING_TRANSFORMERS: () => CUSTOM_STRING_TRANSFORMERS,
|
|
737
|
-
STRING_TRANSFORMERS: () => STRING_TRANSFORMERS,
|
|
738
|
-
transformValueToString: () => transformValueToString
|
|
739
|
-
});
|
|
740
|
-
var transformWhenStringExpected = (value) => (value ?? false) === false ? "" : `${value}`;
|
|
741
|
-
var STRING_TRANSFORMERS = {
|
|
742
|
-
string: transformWhenStringExpected,
|
|
743
|
-
number: transformWhenStringExpected,
|
|
744
|
-
boolean: (value) => value ? "true" : "false"
|
|
745
|
-
};
|
|
746
|
-
var CUSTOM_STRING_TRANSFORMERS = {
|
|
747
|
-
date: (value) => value.toISOString(),
|
|
748
|
-
time: (value) => value.toISOString(),
|
|
749
|
-
datetime: (value) => value.toISOString(),
|
|
750
|
-
duration: (value) => value.toString(),
|
|
751
|
-
reference: (value) => value.toString(),
|
|
752
|
-
unknown: (value) => value.toString()
|
|
753
|
-
};
|
|
754
|
-
var transformValueToString = (value, typeKeyword, customType) => {
|
|
755
|
-
const transformer = customType ? CUSTOM_STRING_TRANSFORMERS[customType] : STRING_TRANSFORMERS[typeKeyword];
|
|
756
|
-
return transformer ? transformer(value) : "";
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
// src/common/ItemRelationshipInfoTypes.ts
|
|
760
|
-
var ItemRelationshipInfoTypes_exports = {};
|
|
761
|
-
__export(ItemRelationshipInfoTypes_exports, {
|
|
762
|
-
ItemRelationshipInfoIdentifyingKeys: () => ItemRelationshipInfoIdentifyingKeys,
|
|
763
|
-
ItemRelationshipInfoKeys: () => ItemRelationshipInfoKeys
|
|
764
|
-
});
|
|
765
|
-
var ItemRelationshipInfoKeys = /* @__PURE__ */ ((ItemRelationshipInfoKeys2) => {
|
|
766
|
-
ItemRelationshipInfoKeys2["fromTypeName"] = "fromTypeName";
|
|
767
|
-
ItemRelationshipInfoKeys2["fromTypeFieldName"] = "fromTypeFieldName";
|
|
768
|
-
ItemRelationshipInfoKeys2["fromTypePrimaryFieldValue"] = "fromTypePrimaryFieldValue";
|
|
769
|
-
ItemRelationshipInfoKeys2["toTypePrimaryFieldValue"] = "toTypePrimaryFieldValue";
|
|
770
|
-
return ItemRelationshipInfoKeys2;
|
|
771
|
-
})(ItemRelationshipInfoKeys || {});
|
|
772
|
-
var ItemRelationshipInfoIdentifyingKeys = /* @__PURE__ */ ((ItemRelationshipInfoIdentifyingKeys2) => {
|
|
773
|
-
ItemRelationshipInfoIdentifyingKeys2["id"] = "id";
|
|
774
|
-
return ItemRelationshipInfoIdentifyingKeys2;
|
|
775
|
-
})(ItemRelationshipInfoIdentifyingKeys || {});
|
|
776
|
-
|
|
777
|
-
// src/common/ItemRelationships/index.ts
|
|
778
|
-
var ItemRelationships_exports = {};
|
|
779
|
-
__export(ItemRelationships_exports, {
|
|
780
|
-
TYPE_INFO_ORM_RELATIONSHIP_ERRORS: () => TYPE_INFO_ORM_RELATIONSHIP_ERRORS,
|
|
781
|
-
validateRelationshipItem: () => validateRelationshipItem
|
|
782
|
-
});
|
|
783
|
-
|
|
784
|
-
// src/common/ItemRelationships/ItemRelationshipValidation.ts
|
|
785
|
-
var TYPE_INFO_ORM_RELATIONSHIP_ERRORS = {
|
|
786
|
-
INVALID_RELATIONSHIP_ITEM: "INVALID_RELATIONSHIP_ITEM",
|
|
787
|
-
INVALID_RELATIONSHIP_ITEM_FIELD: "INVALID_RELATIONSHIP_ITEM_FIELD",
|
|
788
|
-
MISSING_RELATIONSHIP_ITEM_FIELD: "MISSING_RELATIONSHIP_ITEM_FIELD"
|
|
789
|
-
};
|
|
790
|
-
var validateRelationshipItem = (relationshipItem, omitFields) => {
|
|
791
|
-
const { fromTypeName } = relationshipItem;
|
|
792
|
-
const results = {
|
|
793
|
-
typeName: fromTypeName,
|
|
794
|
-
valid: true,
|
|
795
|
-
error: "",
|
|
796
|
-
errorMap: {}
|
|
797
|
-
};
|
|
798
|
-
if (typeof relationshipItem === "object" && relationshipItem !== null) {
|
|
799
|
-
const relKeyValues = Object.values(ItemRelationshipInfoKeys);
|
|
800
|
-
for (const rKV of relKeyValues) {
|
|
801
|
-
const universalRKV = rKV;
|
|
802
|
-
const omitRKV = omitFields.includes(rKV);
|
|
803
|
-
if (
|
|
804
|
-
// Invalid Field Value
|
|
805
|
-
universalRKV in relationshipItem && typeof relationshipItem[universalRKV] !== "string" || omitRKV && universalRKV in relationshipItem
|
|
806
|
-
) {
|
|
807
|
-
results.valid = false;
|
|
808
|
-
results.error = TYPE_INFO_ORM_RELATIONSHIP_ERRORS.INVALID_RELATIONSHIP_ITEM;
|
|
809
|
-
results.errorMap[rKV] = [
|
|
810
|
-
TYPE_INFO_ORM_RELATIONSHIP_ERRORS.INVALID_RELATIONSHIP_ITEM_FIELD
|
|
811
|
-
];
|
|
812
|
-
} else if (
|
|
813
|
-
// Missing Field
|
|
814
|
-
!omitRKV && (!(universalRKV in relationshipItem) || !relationshipItem[universalRKV])
|
|
815
|
-
) {
|
|
816
|
-
results.valid = false;
|
|
817
|
-
results.error = TYPE_INFO_ORM_RELATIONSHIP_ERRORS.INVALID_RELATIONSHIP_ITEM;
|
|
818
|
-
results.errorMap[rKV] = [
|
|
819
|
-
TYPE_INFO_ORM_RELATIONSHIP_ERRORS.MISSING_RELATIONSHIP_ITEM_FIELD
|
|
820
|
-
];
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
} else {
|
|
824
|
-
results.valid = false;
|
|
825
|
-
results.error = TYPE_INFO_ORM_RELATIONSHIP_ERRORS.INVALID_RELATIONSHIP_ITEM;
|
|
826
|
-
}
|
|
827
|
-
return results;
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
// src/common/Testing/index.ts
|
|
831
|
-
var Testing_exports = {};
|
|
832
|
-
__export(Testing_exports, {
|
|
833
|
-
OPERATIONS: () => OPERATIONS,
|
|
834
|
-
TestComparisonOperation: () => TestComparisonOperation,
|
|
835
|
-
compare: () => compare2,
|
|
836
|
-
executeTestingCommand: () => executeTestingCommand,
|
|
837
|
-
generateTestsForFile: () => generateTestsForFile,
|
|
838
|
-
getResolvedConditions: () => getResolvedConditions,
|
|
839
|
-
getResolvedTestConfig: () => getResolvedTestConfig,
|
|
840
|
-
getSetupInstance: () => getSetupInstance,
|
|
841
|
-
getTestConfig: () => getTestConfig,
|
|
842
|
-
getTestFunction: () => getTestFunction,
|
|
843
|
-
mergeTestResults: () => mergeTestResults,
|
|
844
|
-
runTest: () => runTest,
|
|
845
|
-
runTestsForFile: () => runTestsForFile
|
|
846
|
-
});
|
|
847
|
-
|
|
848
|
-
// src/common/Testing/Types.ts
|
|
849
|
-
var TestComparisonOperation = /* @__PURE__ */ ((TestComparisonOperation2) => {
|
|
850
|
-
TestComparisonOperation2["EQUALS"] = "===";
|
|
851
|
-
TestComparisonOperation2["NOT_EQUALS"] = "!==";
|
|
852
|
-
TestComparisonOperation2["IN"] = "IN";
|
|
853
|
-
TestComparisonOperation2["ARRAY_CONTAINS"] = "ARRAY_CONTAINS";
|
|
854
|
-
TestComparisonOperation2["BETWEEN"] = "BETWEEN";
|
|
855
|
-
TestComparisonOperation2["CONTAINS"] = "CONTAINS";
|
|
856
|
-
TestComparisonOperation2["REGEX"] = "REGEX";
|
|
857
|
-
TestComparisonOperation2["EXT_REGEX"] = "EXT_REGEX";
|
|
858
|
-
TestComparisonOperation2["DEEP_EQUALS"] = "DEEP_EQUALS";
|
|
859
|
-
TestComparisonOperation2["ARRAY_EQUALS"] = "ARRAY_EQUALS";
|
|
860
|
-
return TestComparisonOperation2;
|
|
861
|
-
})(TestComparisonOperation || {});
|
|
862
|
-
var importModule = async (modulePath) => {
|
|
863
|
-
const moduleUrl = pathToFileURL(modulePath);
|
|
864
|
-
return import(moduleUrl.href);
|
|
865
|
-
};
|
|
866
|
-
var stringifyOutput = (value) => JSON.stringify(
|
|
867
|
-
value,
|
|
868
|
-
function(_key, value2) {
|
|
869
|
-
return typeof value2 === "function" ? "[Function]" : value2;
|
|
870
|
-
},
|
|
871
|
-
2
|
|
872
|
-
);
|
|
873
|
-
var OPERATIONS = {
|
|
874
|
-
["===" /* EQUALS */]: (a, b) => a === b,
|
|
875
|
-
["!==" /* NOT_EQUALS */]: (a, b) => a !== b,
|
|
876
|
-
["IN" /* IN */]: (a, b) => Array.isArray(b) && b.includes(a),
|
|
877
|
-
["BETWEEN" /* BETWEEN */]: (a, b) => {
|
|
878
|
-
if (Array.isArray(b) && b.length === 2 && typeof b[0] === "number" && typeof b[1] === "number") {
|
|
879
|
-
return typeof a === "number" && a >= b[0] && a <= b[1];
|
|
880
|
-
}
|
|
881
|
-
throw new Error("BETWEEN requires an array of two numbers as expectation.");
|
|
882
|
-
},
|
|
883
|
-
["CONTAINS" /* CONTAINS */]: (a, b) => typeof a === "string" && typeof b === "string" && a.includes(b),
|
|
884
|
-
["REGEX" /* REGEX */]: (a, b) => {
|
|
885
|
-
if (typeof b === "object" && b !== null && "pattern" in b) {
|
|
886
|
-
const { pattern, flags } = b;
|
|
887
|
-
try {
|
|
888
|
-
const regex = new RegExp(pattern, flags);
|
|
889
|
-
return typeof a === "string" && regex.test(a);
|
|
890
|
-
} catch (err) {
|
|
891
|
-
throw new Error(`Invalid REGEX: ${err.message}`);
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
throw new Error(
|
|
895
|
-
"REGEX requires an expectation with 'pattern' and optional 'flags'."
|
|
896
|
-
);
|
|
897
|
-
},
|
|
898
|
-
["EXT_REGEX" /* EXT_REGEX */]: (a, b) => {
|
|
899
|
-
if (typeof b === "object" && b !== null && "pattern" in b) {
|
|
900
|
-
const { pattern, flags } = b;
|
|
901
|
-
const buildRegexFromPattern = (pattern2, flags2 = "") => {
|
|
902
|
-
if (!Array.isArray(pattern2)) {
|
|
903
|
-
throw new Error("EXT_REGEX pattern must be an array of objects.");
|
|
904
|
-
}
|
|
905
|
-
const regexBody = pattern2.map(({ value, escaped }) => {
|
|
906
|
-
if (typeof value !== "string") {
|
|
907
|
-
throw new Error(
|
|
908
|
-
"Each pattern element must have a string 'value'."
|
|
909
|
-
);
|
|
910
|
-
}
|
|
911
|
-
return escaped ? value.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&") : value;
|
|
912
|
-
}).join("");
|
|
913
|
-
return new RegExp(regexBody, flags2);
|
|
914
|
-
};
|
|
915
|
-
try {
|
|
916
|
-
const regex = buildRegexFromPattern(pattern, flags);
|
|
917
|
-
return typeof a === "string" && regex.test(a);
|
|
918
|
-
} catch (err) {
|
|
919
|
-
throw new Error(`Invalid EXT_REGEX: ${err.message}`);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
throw new Error(
|
|
923
|
-
"EXT_REGEX requires an expectation with 'pattern' as an array of PatternElement and optional 'flags'."
|
|
924
|
-
);
|
|
925
|
-
},
|
|
926
|
-
["DEEP_EQUALS" /* DEEP_EQUALS */]: (a, b) => {
|
|
927
|
-
if (typeof a === "object" && typeof b === "object" && a !== null && b !== null) {
|
|
928
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
929
|
-
}
|
|
930
|
-
return false;
|
|
931
|
-
},
|
|
932
|
-
["ARRAY_CONTAINS" /* ARRAY_CONTAINS */]: (a, b) => {
|
|
933
|
-
if (Array.isArray(a)) {
|
|
934
|
-
return a.includes(b);
|
|
935
|
-
}
|
|
936
|
-
throw new Error("ARRAY_CONTAINS requires an array as the first argument.");
|
|
937
|
-
},
|
|
938
|
-
["ARRAY_EQUALS" /* ARRAY_EQUALS */]: (a, b) => {
|
|
939
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
940
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
941
|
-
}
|
|
942
|
-
throw new Error("ARRAY_EQUALS requires two arrays as arguments.");
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
var compare2 = (result, expectation, operation = "===" /* EQUALS */) => {
|
|
946
|
-
const op = OPERATIONS[operation];
|
|
947
|
-
if (!op) {
|
|
948
|
-
throw new Error(`Unsupported operation: ${operation}`);
|
|
949
|
-
}
|
|
950
|
-
return op(result, expectation);
|
|
951
|
-
};
|
|
952
|
-
var getResolvedConditions = async (testFilePath, targetTestIndex, targetTestExport, conditions, isSetup = false) => {
|
|
953
|
-
if (Array.isArray(conditions)) {
|
|
954
|
-
return conditions;
|
|
955
|
-
} else if (typeof conditions === "object" && conditions !== null) {
|
|
956
|
-
const { file, export: targetConditionExport } = conditions;
|
|
957
|
-
const modulePath = Path.resolve(Path.dirname(testFilePath), file);
|
|
958
|
-
const targetModule = await importModule(modulePath);
|
|
959
|
-
const conditionArray = targetModule[targetConditionExport];
|
|
960
|
-
if (Array.isArray(conditionArray)) {
|
|
961
|
-
return conditionArray;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
throw new Error(
|
|
965
|
-
`Invalid conditions for TEST${isSetup ? " SETUP" : ""} ${targetTestIndex + 1} (${targetTestExport}) in ${testFilePath}`
|
|
966
|
-
);
|
|
967
|
-
};
|
|
968
|
-
var getSetupInstance = async (testFilePath, targetTestIndex, targetTestExport, test, module) => {
|
|
969
|
-
const { setup } = test;
|
|
970
|
-
if (!setup) return module;
|
|
971
|
-
const { conditions: baseConditions, export: targetSetupExport } = setup;
|
|
972
|
-
const setupFunction = module[targetSetupExport];
|
|
973
|
-
const conditions = await getResolvedConditions(
|
|
974
|
-
testFilePath,
|
|
975
|
-
targetTestIndex,
|
|
976
|
-
targetTestExport,
|
|
977
|
-
baseConditions,
|
|
978
|
-
true
|
|
979
|
-
);
|
|
980
|
-
if (typeof setupFunction !== "function") {
|
|
981
|
-
throw new Error(`Setup export "${setup.export}" is not a function.`);
|
|
982
|
-
}
|
|
983
|
-
return setup.instantiate ? new setupFunction(...conditions) : await setupFunction(...conditions);
|
|
984
|
-
};
|
|
985
|
-
var getTestFunction = async (testFilePath, file, targetTestIndex, test, targetModule) => {
|
|
986
|
-
const { export: targetExport } = test;
|
|
987
|
-
if (!targetExport) {
|
|
988
|
-
throw new Error(
|
|
989
|
-
`Invalid test export (${targetExport}) for TEST ${targetTestIndex + 1} in ${testFilePath}`
|
|
990
|
-
);
|
|
991
|
-
}
|
|
992
|
-
const instance = await getSetupInstance(
|
|
993
|
-
testFilePath,
|
|
994
|
-
targetTestIndex,
|
|
995
|
-
targetExport,
|
|
996
|
-
test,
|
|
997
|
-
targetModule
|
|
998
|
-
);
|
|
999
|
-
const testFunction = instance[targetExport];
|
|
1000
|
-
if (typeof testFunction !== "function") {
|
|
1001
|
-
throw new Error(
|
|
1002
|
-
`Export "${targetExport}" from "${file}", declared in TEST ${targetTestIndex + 1}, is not a function.`
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
return testFunction;
|
|
1006
|
-
};
|
|
1007
|
-
var getTestConfig = async (testFilePath) => {
|
|
1008
|
-
const testConfig = JSON.parse(
|
|
1009
|
-
await promises.readFile(testFilePath, "utf8")
|
|
1010
|
-
);
|
|
1011
|
-
return testConfig;
|
|
1012
|
-
};
|
|
1013
|
-
var getResolvedTestConfig = async (testFilePath) => {
|
|
1014
|
-
const { file, tests } = await getTestConfig(testFilePath);
|
|
1015
|
-
if (!file) {
|
|
1016
|
-
throw new Error(`Invalid test configuration in ${testFilePath}`);
|
|
1017
|
-
}
|
|
1018
|
-
const modulePath = Path.resolve(Path.dirname(testFilePath), file);
|
|
1019
|
-
const targetModule = await importModule(modulePath);
|
|
1020
|
-
return {
|
|
1021
|
-
file,
|
|
1022
|
-
targetModule,
|
|
1023
|
-
tests
|
|
1024
|
-
};
|
|
1025
|
-
};
|
|
1026
|
-
var mergeTestResults = (...results) => results.reduce(
|
|
1027
|
-
({
|
|
1028
|
-
messages: accMessages = [],
|
|
1029
|
-
generated: accGenerated = [],
|
|
1030
|
-
passes: accPasses = [],
|
|
1031
|
-
failures: accFailures = [],
|
|
1032
|
-
errors: accErrors = []
|
|
1033
|
-
}, {
|
|
1034
|
-
messages = [],
|
|
1035
|
-
generated = [],
|
|
1036
|
-
passes = [],
|
|
1037
|
-
failures = [],
|
|
1038
|
-
errors = []
|
|
1039
|
-
}) => ({
|
|
1040
|
-
messages: [...accMessages, ...messages],
|
|
1041
|
-
generated: [...accGenerated, ...generated],
|
|
1042
|
-
passes: [...accPasses, ...passes],
|
|
1043
|
-
failures: [...accFailures, ...failures],
|
|
1044
|
-
errors: [...accErrors, ...errors]
|
|
1045
|
-
}),
|
|
1046
|
-
{ messages: [], passes: [], failures: [], errors: [] }
|
|
1047
|
-
);
|
|
1048
|
-
var runTest = async (testFilePath, testFunction, test, index, targetExport, report) => {
|
|
1049
|
-
const {
|
|
1050
|
-
conditions: baseConditions,
|
|
1051
|
-
expectation,
|
|
1052
|
-
operation,
|
|
1053
|
-
expectUndefined
|
|
1054
|
-
} = test;
|
|
1055
|
-
const conditions = await getResolvedConditions(
|
|
1056
|
-
testFilePath,
|
|
1057
|
-
index,
|
|
1058
|
-
targetExport,
|
|
1059
|
-
baseConditions
|
|
1060
|
-
);
|
|
1061
|
-
try {
|
|
1062
|
-
const result = await testFunction(...conditions);
|
|
1063
|
-
const passed = expectUndefined || compare2(result, expectation, operation);
|
|
1064
|
-
if (passed) {
|
|
1065
|
-
report({
|
|
1066
|
-
passes: [`Test ${index + 1} (${targetExport})`]
|
|
1067
|
-
});
|
|
1068
|
-
} else {
|
|
1069
|
-
report({
|
|
1070
|
-
failures: [
|
|
1071
|
-
`Test ${index + 1} (${targetExport}):
|
|
1072
|
-
|
|
1073
|
-
Result:
|
|
1074
|
-
|
|
1075
|
-
${stringifyOutput(result)}`
|
|
1076
|
-
]
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
} catch (err) {
|
|
1080
|
-
report({
|
|
1081
|
-
errors: [
|
|
1082
|
-
`Test ${index + 1} (${targetExport}):
|
|
1083
|
-
|
|
1084
|
-
Error:
|
|
1085
|
-
|
|
1086
|
-
${err.message}`
|
|
1087
|
-
]
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
};
|
|
1091
|
-
var generateTestsForFile = async (testFilePath, report) => {
|
|
1092
|
-
try {
|
|
1093
|
-
const { file, targetModule, tests } = await getResolvedTestConfig(testFilePath);
|
|
1094
|
-
report({
|
|
1095
|
-
messages: [`Generating expectations for tests in ${testFilePath}`]
|
|
1096
|
-
});
|
|
1097
|
-
const generatedTests = [];
|
|
1098
|
-
let hasNewExpectations = false;
|
|
1099
|
-
for (let i = 0; i < tests.length; i++) {
|
|
1100
|
-
const test = tests[i];
|
|
1101
|
-
const {
|
|
1102
|
-
export: targetExport,
|
|
1103
|
-
conditions: baseConditions,
|
|
1104
|
-
expectation,
|
|
1105
|
-
operation,
|
|
1106
|
-
expectUndefined
|
|
1107
|
-
} = test;
|
|
1108
|
-
const conditions = await getResolvedConditions(
|
|
1109
|
-
testFilePath,
|
|
1110
|
-
i,
|
|
1111
|
-
targetExport,
|
|
1112
|
-
baseConditions
|
|
1113
|
-
);
|
|
1114
|
-
if (expectation !== void 0 || expectUndefined) {
|
|
1115
|
-
generatedTests.push(test);
|
|
1116
|
-
} else {
|
|
1117
|
-
const testFunction = await getTestFunction(
|
|
1118
|
-
testFilePath,
|
|
1119
|
-
file,
|
|
1120
|
-
i,
|
|
1121
|
-
test,
|
|
1122
|
-
targetModule
|
|
1123
|
-
);
|
|
1124
|
-
const result = await testFunction(...conditions);
|
|
1125
|
-
report({
|
|
1126
|
-
generated: [
|
|
1127
|
-
`Expectation for TEST ${i + 1} (${targetExport}):
|
|
1128
|
-
|
|
1129
|
-
${stringifyOutput(result)}`
|
|
1130
|
-
]
|
|
1131
|
-
});
|
|
1132
|
-
generatedTests.push({
|
|
1133
|
-
...test,
|
|
1134
|
-
expectation: result,
|
|
1135
|
-
operation: operation || "===" /* EQUALS */
|
|
1136
|
-
});
|
|
1137
|
-
hasNewExpectations = true;
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
if (hasNewExpectations) {
|
|
1141
|
-
const updatedTestConfig = { file, tests: generatedTests };
|
|
1142
|
-
await promises.writeFile(
|
|
1143
|
-
testFilePath,
|
|
1144
|
-
JSON.stringify(updatedTestConfig, null, 2)
|
|
1145
|
-
);
|
|
1146
|
-
report({ messages: [`Updated test file saved to ${testFilePath}`] });
|
|
1147
|
-
} else {
|
|
1148
|
-
report({
|
|
1149
|
-
messages: [`No new expectations were generated for ${testFilePath}`]
|
|
1150
|
-
});
|
|
1151
|
-
}
|
|
1152
|
-
} catch (err) {
|
|
1153
|
-
report({
|
|
1154
|
-
errors: [`Error processing test file ${testFilePath}:
|
|
1155
|
-
|
|
1156
|
-
${err.message}`]
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
var runTestsForFile = async (testFilePath, report) => {
|
|
1161
|
-
try {
|
|
1162
|
-
const { file, targetModule, tests } = await getResolvedTestConfig(testFilePath);
|
|
1163
|
-
report({
|
|
1164
|
-
messages: [`Running tests from ${testFilePath}`]
|
|
1165
|
-
});
|
|
1166
|
-
for (const [index, test] of tests.entries()) {
|
|
1167
|
-
const { export: targetExport } = test;
|
|
1168
|
-
const testFunction = await getTestFunction(
|
|
1169
|
-
testFilePath,
|
|
1170
|
-
file,
|
|
1171
|
-
index,
|
|
1172
|
-
test,
|
|
1173
|
-
targetModule
|
|
1174
|
-
);
|
|
1175
|
-
await runTest(
|
|
1176
|
-
testFilePath,
|
|
1177
|
-
testFunction,
|
|
1178
|
-
test,
|
|
1179
|
-
index,
|
|
1180
|
-
targetExport,
|
|
1181
|
-
report
|
|
1182
|
-
);
|
|
1183
|
-
}
|
|
1184
|
-
} catch (err) {
|
|
1185
|
-
report({
|
|
1186
|
-
errors: [`Error processing test file ${testFilePath}: ${err.message}`]
|
|
1187
|
-
});
|
|
1188
|
-
}
|
|
1189
|
-
};
|
|
1190
|
-
var executeTestingCommand = async (testFiles, generateMode = false, report) => {
|
|
1191
|
-
const completeMessage = generateMode ? "Test generation complete." : "Testing complete.";
|
|
1192
|
-
try {
|
|
1193
|
-
for (const testFile of testFiles) {
|
|
1194
|
-
const resolvedTestFile = Path.resolve(testFile);
|
|
1195
|
-
if (generateMode) {
|
|
1196
|
-
await generateTestsForFile(resolvedTestFile, report);
|
|
1197
|
-
} else {
|
|
1198
|
-
await runTestsForFile(resolvedTestFile, report);
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
report({
|
|
1202
|
-
messages: [completeMessage]
|
|
1203
|
-
});
|
|
1204
|
-
} catch (err) {
|
|
1205
|
-
report({ errors: [`Error running tests:
|
|
1206
|
-
|
|
1207
|
-
${err.message}`] });
|
|
1208
|
-
}
|
|
1209
|
-
};
|
|
1210
|
-
|
|
1211
|
-
// src/common/Logging/index.ts
|
|
1212
|
-
var Logging_exports = {};
|
|
1213
|
-
__export(Logging_exports, {
|
|
1214
|
-
LOGGING_MESSAGES: () => LOGGING_MESSAGES,
|
|
1215
|
-
logFunctionCall: () => logFunctionCall
|
|
1216
|
-
});
|
|
1217
|
-
|
|
1218
|
-
// src/common/Logging/Utils.ts
|
|
1219
|
-
var LOGGING_MESSAGES = /* @__PURE__ */ ((LOGGING_MESSAGES2) => {
|
|
1220
|
-
LOGGING_MESSAGES2["LOGGING_FUNCTION_CALL"] = "LOGGING_FUNCTION_CALL";
|
|
1221
|
-
LOGGING_MESSAGES2["INPUT"] = "INPUT";
|
|
1222
|
-
LOGGING_MESSAGES2["OUTPUT"] = "OUTPUT";
|
|
1223
|
-
LOGGING_MESSAGES2["ERROR"] = "ERROR";
|
|
1224
|
-
return LOGGING_MESSAGES2;
|
|
1225
|
-
})(LOGGING_MESSAGES || {});
|
|
1226
|
-
var logFunctionCall = async (label, args, functionRef, enabled) => {
|
|
1227
|
-
if (enabled) {
|
|
1228
|
-
console.log(
|
|
1229
|
-
"LOGGING_FUNCTION_CALL" /* LOGGING_FUNCTION_CALL */,
|
|
1230
|
-
"INPUT" /* INPUT */,
|
|
1231
|
-
label,
|
|
1232
|
-
":",
|
|
1233
|
-
JSON.stringify(args, null, 2)
|
|
1234
|
-
);
|
|
1235
|
-
}
|
|
1236
|
-
try {
|
|
1237
|
-
const result = await functionRef(...args);
|
|
1238
|
-
if (enabled) {
|
|
1239
|
-
console.log(
|
|
1240
|
-
"LOGGING_FUNCTION_CALL" /* LOGGING_FUNCTION_CALL */,
|
|
1241
|
-
"OUTPUT" /* OUTPUT */,
|
|
1242
|
-
label,
|
|
1243
|
-
":",
|
|
1244
|
-
JSON.stringify(result, null, 2)
|
|
1245
|
-
);
|
|
1246
|
-
}
|
|
1247
|
-
return result;
|
|
1248
|
-
} catch (error) {
|
|
1249
|
-
if (enabled) {
|
|
1250
|
-
console.error(
|
|
1251
|
-
"LOGGING_FUNCTION_CALL" /* LOGGING_FUNCTION_CALL */,
|
|
1252
|
-
"ERROR" /* ERROR */,
|
|
1253
|
-
label,
|
|
1254
|
-
":",
|
|
1255
|
-
error
|
|
1256
|
-
);
|
|
1257
|
-
}
|
|
1258
|
-
throw error;
|
|
1259
|
-
}
|
|
1260
|
-
};
|
|
1261
|
-
|
|
1262
|
-
// src/common/TypeInfoORM/Types.ts
|
|
1263
|
-
var TypeInfoORMServiceError = /* @__PURE__ */ ((TypeInfoORMServiceError2) => {
|
|
1264
|
-
TypeInfoORMServiceError2["NO_DRIVERS_SUPPLIED"] = "NO_DRIVERS_SUPPLIED";
|
|
1265
|
-
TypeInfoORMServiceError2["NO_RELATIONSHIP_DRIVERS_SUPPLIED"] = "NO_RELATIONSHIP_DRIVERS_SUPPLIED";
|
|
1266
|
-
TypeInfoORMServiceError2["NO_PRIMARY_FIELD_VALUE_SUPPLIED"] = "NO_PRIMARY_FIELD_VALUE_SUPPLIED";
|
|
1267
|
-
TypeInfoORMServiceError2["INVALID_DRIVER"] = "INVALID_DRIVER";
|
|
1268
|
-
TypeInfoORMServiceError2["INVALID_RELATIONSHIP_DRIVER"] = "INVALID_RELATIONSHIP_DRIVER";
|
|
1269
|
-
TypeInfoORMServiceError2["INVALID_TYPE_INFO"] = "INVALID_TYPE_INFO";
|
|
1270
|
-
TypeInfoORMServiceError2["TYPE_INFO_MISSING_PRIMARY_FIELD"] = "TYPE_INFO_MISSING_PRIMARY_FIELD";
|
|
1271
|
-
TypeInfoORMServiceError2["INVALID_RELATIONSHIP"] = "INVALID_RELATIONSHIP";
|
|
1272
|
-
TypeInfoORMServiceError2["INVALID_OPERATION"] = "INVALID_OPERATION";
|
|
1273
|
-
TypeInfoORMServiceError2["MISSING_ACCESSING_ROLE"] = "MISSING_ACCESSING_ROLE";
|
|
1274
|
-
TypeInfoORMServiceError2["INDEXING_UNSUPPORTED_CRITERIA"] = "INDEXING_UNSUPPORTED_CRITERIA";
|
|
1275
|
-
TypeInfoORMServiceError2["INDEXING_UNSUPPORTED_COMBINATION"] = "INDEXING_UNSUPPORTED_COMBINATION";
|
|
1276
|
-
TypeInfoORMServiceError2["INDEXING_MISSING_INDEX_FIELD"] = "INDEXING_MISSING_INDEX_FIELD";
|
|
1277
|
-
TypeInfoORMServiceError2["INDEXING_MISSING_BACKEND"] = "INDEXING_MISSING_BACKEND";
|
|
1278
|
-
TypeInfoORMServiceError2["INDEXING_REQUIRES_CRITERIA"] = "INDEXING_REQUIRES_CRITERIA";
|
|
1279
|
-
return TypeInfoORMServiceError2;
|
|
1280
|
-
})(TypeInfoORMServiceError || {});
|
|
1281
|
-
|
|
1282
|
-
export { CommandLine_exports as CommandLine, DENIED_TYPE_OPERATIONS, ERROR_MESSAGE_CONSTANTS, IdGeneration_exports as IDGeneration, INVALID_CUSTOM_TYPE, ItemRelationshipInfoTypes_exports as ItemRelationshipInfoTypes, ItemRelationships_exports as ItemRelationships, Logging_exports as Logging, PRIMITIVE_ERROR_MESSAGE_CONSTANTS, RelationshipValidationType, Routing_exports as Routing, SearchTypes_exports as SearchTypes, SearchUtils_exports as SearchUtils, StringTransformers_exports as StringTransformers, TYPE_KEYWORD_VALIDATORS, Testing_exports as Testing, TypeInfoORMServiceError, TypeOperation, TypeParsing_exports as TypeParsing, collectRequiredEnvironmentVariables, getValidityValue, hasValue, validateArrayOfTypeInfoFieldValues, validateCustomType, validateKeywordType, validateTypeInfoFieldOperationAllowed, validateTypeInfoFieldValue, validateTypeInfoValue, validateTypeOperationAllowed, validateValueMatchesPattern };
|
|
413
|
+
export { DENIED_TYPE_OPERATIONS, ERROR_MESSAGE_CONSTANTS, INVALID_CUSTOM_TYPE, PRIMITIVE_ERROR_MESSAGE_CONSTANTS, RelationshipValidationType, TYPE_KEYWORD_VALIDATORS, TypeInfoORMServiceError, TypeOperation, collectRequiredEnvironmentVariables, getValidityValue, hasValue, validateArrayOfTypeInfoFieldValues, validateCustomType, validateKeywordType, validateTypeInfoFieldOperationAllowed, validateTypeInfoFieldValue, validateTypeInfoValue, validateTypeOperationAllowed, validateValueMatchesPattern };
|