@resistdesign/voltra 3.0.0-alpha.4 → 3.0.0-alpha.40
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 +379 -14
- package/api/DBX/DBXAsserts.d.ts +95 -0
- package/api/DBX/DBXRequest.d.ts +5 -0
- package/api/DBX/DBXRuntime.d.ts +5 -0
- package/api/DBX/DBXScenarioConfig.d.ts +9 -0
- package/api/DBX/DBXSeed.d.ts +124 -0
- package/api/DBX/DBXTypes.d.ts +176 -0
- package/api/DBX/index.d.ts +8 -0
- package/api/DataAccessControl.d.ts +220 -0
- package/api/Indexing/API.d.ts +224 -0
- package/api/Indexing/Cursor.d.ts +101 -0
- package/api/Indexing/Handler/Config.d.ts +39 -0
- package/api/Indexing/Handler.d.ts +166 -0
- package/api/Indexing/Trace.d.ts +54 -0
- package/api/Indexing/Types.d.ts +204 -0
- package/api/Indexing/ddb/AwsSdkV3Adapter.d.ts +8 -0
- package/api/Indexing/ddb/Types.d.ts +209 -0
- package/api/Indexing/docId.d.ts +27 -0
- package/api/Indexing/exact/ExactDdb.d.ts +58 -0
- package/api/Indexing/exact/ExactIndex.d.ts +90 -0
- package/api/Indexing/exact/ExactS3.d.ts +41 -0
- package/api/Indexing/fieldQualification.d.ts +12 -0
- package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +212 -0
- package/api/Indexing/fulltext/FullTextMemoryBackend.d.ts +93 -0
- package/api/Indexing/fulltext/Schema.d.ts +164 -0
- package/api/Indexing/hashUniversal.d.ts +13 -0
- package/api/Indexing/index.d.ts +45 -0
- package/api/Indexing/lossy/LossyDdb.d.ts +43 -0
- package/api/Indexing/lossy/LossyIndex.d.ts +72 -0
- package/api/Indexing/lossy/LossyS3.d.ts +40 -0
- package/api/Indexing/rel/Cursor.d.ts +25 -0
- package/api/Indexing/rel/Handlers.d.ts +144 -0
- package/api/Indexing/rel/RelationalDdb.d.ts +169 -0
- package/api/Indexing/rel/RelationalInMemoryBackend.d.ts +38 -0
- package/api/Indexing/rel/Types.d.ts +69 -0
- package/api/Indexing/structured/Cursor.d.ts +26 -0
- package/api/Indexing/structured/Handlers.d.ts +128 -0
- package/api/Indexing/structured/SearchStructured.d.ts +44 -0
- package/api/Indexing/structured/StructuredDdb.d.ts +184 -0
- package/api/Indexing/structured/StructuredDdbBackend.d.ts +112 -0
- package/api/Indexing/structured/StructuredInMemoryBackend.d.ts +40 -0
- package/api/Indexing/structured/StructuredInMemoryIndex.d.ts +61 -0
- package/api/Indexing/structured/StructuredStringLike.d.ts +54 -0
- package/api/Indexing/structured/StructuredWriter.d.ts +74 -0
- package/api/Indexing/structured/Types.d.ts +126 -0
- package/api/Indexing/structured/index.d.ts +9 -0
- package/api/Indexing/tokenize.d.ts +31 -0
- package/api/ORM/DACUtils.d.ts +270 -0
- package/api/ORM/ListItemUtils.d.ts +40 -0
- package/api/ORM/ORMRouteMap.d.ts +55 -0
- package/api/ORM/TypeInfoORMService.d.ts +740 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +89 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +55 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypes.d.ts +13 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver.d.ts +98 -0
- package/api/ORM/drivers/InMemoryItemRelationshipDBDriver.d.ts +16 -0
- package/api/ORM/drivers/IndexingRelationshipDriver.d.ts +123 -0
- package/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +322 -0
- package/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +118 -0
- package/api/ORM/drivers/S3FileItemDBDriver.d.ts +71 -0
- package/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +36 -0
- package/api/ORM/drivers/common/Types.d.ts +197 -0
- package/api/ORM/drivers/common/index.d.ts +2 -0
- package/api/ORM/drivers/index.d.ts +8 -0
- package/api/ORM/index.d.ts +9 -0
- package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +22 -0
- package/api/Router/AWS.d.ts +80 -0
- package/api/Router/Auth.d.ts +14 -0
- package/api/Router/CORS.d.ts +66 -0
- package/api/Router/Types.d.ts +138 -0
- package/api/Router/index.d.ts +89 -0
- package/api/index.d.ts +72 -6
- package/api/index.js +3291 -1954
- package/app/forms/Engine.d.ts +23 -0
- package/app/forms/UI.d.ts +83 -0
- package/app/forms/core/createAutoField.d.ts +43 -0
- package/app/forms/core/createFormRenderer.d.ts +25 -0
- package/app/forms/core/getFieldKind.d.ts +14 -0
- package/app/forms/core/index.d.ts +11 -0
- package/app/forms/core/mergeSuites.d.ts +23 -0
- package/app/forms/core/resolveSuite.d.ts +15 -0
- package/app/forms/core/types.d.ts +180 -0
- package/app/forms/index.d.ts +9 -0
- package/app/forms/types.d.ts +137 -0
- package/app/helpers/styled.d.ts +3 -0
- package/app/index.d.ts +102 -5
- package/app/index.js +98 -327
- package/app/utils/ApplicationState.d.ts +167 -0
- package/app/utils/ApplicationStateLoader.d.ts +86 -0
- package/app/utils/Controller.d.ts +10 -0
- package/app/utils/Debug.d.ts +14 -0
- package/app/utils/EasyLayout.d.ts +89 -0
- package/app/utils/History.d.ts +165 -0
- package/app/utils/Route.d.ts +173 -0
- package/app/utils/RouteHistory.d.ts +27 -0
- package/app/utils/Service.d.ts +45 -0
- package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
- package/app/utils/TypeInfoORMClient.d.ts +103 -0
- package/app/utils/UniversalRouteAdapter.d.ts +73 -0
- package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
- package/app/utils/easy-layout/computeTracks.d.ts +16 -0
- package/app/utils/easy-layout/index.d.ts +5 -0
- package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
- package/app/utils/easy-layout/types.d.ts +52 -0
- package/app/utils/easy-layout/validateAreas.d.ts +5 -0
- package/app/utils/index.d.ts +24 -0
- package/build/TypeMapping.d.ts +17 -0
- package/build/TypeParsing.d.ts +10 -0
- package/build/index.d.ts +15 -0
- package/build/index.js +569 -0
- package/chunk-2MOLWZMQ.js +71 -0
- package/chunk-7AMEFPPP.js +78 -0
- package/chunk-ATO2455Q.js +258 -0
- package/chunk-DT6WWJUI.js +1185 -0
- package/chunk-I2KLQ2HA.js +19 -0
- package/chunk-TJFTWPXQ.js +39 -0
- package/chunk-WNFRDIBW.js +121 -0
- package/chunk-YCTVEW2I.js +546 -0
- package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
- package/common/CommandLine/index.d.ts +6 -0
- package/common/HelperTypes.d.ts +9 -0
- package/common/IdGeneration/getSimpleId.d.ts +8 -0
- package/common/IdGeneration/index.d.ts +1 -0
- package/common/ItemRelationshipInfoTypes.d.ts +64 -0
- package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
- package/common/ItemRelationships/index.d.ts +2 -0
- package/common/Logging/Utils.d.ts +10 -0
- package/common/Logging/index.d.ts +1 -0
- package/common/Routing.d.ts +81 -0
- package/common/SearchTypes.d.ts +227 -0
- package/common/SearchUtils.d.ts +55 -0
- package/common/SearchValidation.d.ts +27 -0
- package/common/StringTransformers.d.ts +28 -0
- package/common/Testing/CLI.d.ts +6 -0
- package/common/Testing/Types.d.ts +216 -0
- package/common/Testing/Utils.d.ts +112 -0
- package/common/Testing/index.d.ts +8 -0
- package/common/TypeInfoDataItemUtils.d.ts +39 -0
- package/{Types-C7XjUjoF.d.ts → common/TypeInfoORM/Types.d.ts} +117 -15
- package/common/TypeInfoORM/index.d.ts +3 -0
- package/common/TypeParsing/Constants.d.ts +4 -0
- package/common/TypeParsing/ParsingUtils/Constants.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/checkType.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/checkUnionType.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
- package/common/TypeParsing/TypeInfo.d.ts +222 -0
- package/common/TypeParsing/Utils.d.ts +47 -0
- package/common/TypeParsing/Validation.d.ts +327 -0
- package/common/TypeParsing/index.d.ts +8 -0
- package/common/index.d.ts +40 -4
- package/common/index.js +25 -1737
- package/{index-BkFZlfit.d.ts → iac/SimpleCFT.d.ts} +5 -25
- package/iac/index.d.ts +40 -2
- package/iac/index.js +2 -1661
- package/iac/packs/auth.d.ts +131 -0
- package/iac/packs/build/utils.d.ts +289 -0
- package/iac/packs/build.d.ts +92 -0
- package/iac/packs/cdn.d.ts +33 -0
- package/iac/packs/cloud-function.d.ts +67 -0
- package/iac/packs/database.d.ts +32 -0
- package/iac/packs/dns.d.ts +34 -0
- package/iac/packs/file-storage.d.ts +46 -0
- package/iac/packs/gateway.d.ts +82 -0
- package/iac/packs/index.d.ts +60 -1
- package/iac/packs/index.js +311 -566
- package/iac/packs/repo.d.ts +28 -0
- package/iac/packs/ssl-certificate.d.ts +28 -0
- package/iac/types/Constants.d.ts +24 -0
- package/{index-DcvJOZ_c.d.ts → iac/types/IaCTypes.d.ts} +23 -1018
- package/iac/types/Renderers.d.ts +96 -0
- package/iac/types/Types.d.ts +131 -0
- package/iac/types/Utils.d.ts +9 -0
- package/iac/types/generate.d.ts +1 -0
- package/iac/utils/index.d.ts +87 -0
- package/iac/utils/patch-utils.d.ts +66 -0
- package/iac-packs/index.d.ts +6 -0
- package/native/forms/UI.d.ts +73 -0
- package/native/forms/createNativeFormRenderer.d.ts +21 -0
- package/native/forms/index.d.ts +25 -0
- package/native/forms/primitives/index.d.ts +38 -0
- package/native/forms/suite.d.ts +15 -0
- package/native/index.d.ts +19 -0
- package/native/index.js +748 -0
- package/native/testing/react-native.d.ts +46 -0
- package/native/utils/EasyLayout.d.ts +88 -0
- package/native/utils/History.d.ts +102 -0
- package/native/utils/Route.d.ts +80 -0
- package/native/utils/index.d.ts +20 -0
- package/package.json +54 -21
- package/web/forms/UI.d.ts +74 -0
- package/web/forms/createWebFormRenderer.d.ts +21 -0
- package/web/forms/index.d.ts +9 -0
- package/web/forms/primitives/index.d.ts +21 -0
- package/web/forms/suite.d.ts +15 -0
- package/web/index.d.ts +15 -0
- package/web/index.js +668 -0
- package/web/utils/EasyLayout.d.ts +47 -0
- package/web/utils/Route.d.ts +16 -0
- package/web/utils/index.d.ts +7 -0
- package/SearchTypes-DjN6YQzE.d.ts +0 -577
- package/Validation-CFP59oIP.d.ts +0 -226
- package/index-C3-iD9Mh.d.ts +0 -690
- package/index-DZ2BB4iX.d.ts +0 -5357
- package/index-IokxSNxm.d.ts +0 -745
- package/index.d.ts +0 -13
- package/index.js +0 -10973
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import { getPathString } from './chunk-WNFRDIBW.js';
|
|
2
|
+
|
|
3
|
+
// src/common/TypeParsing/TypeInfo.ts
|
|
4
|
+
var TypeOperation = /* @__PURE__ */ ((TypeOperation2) => {
|
|
5
|
+
TypeOperation2["CREATE"] = "CREATE";
|
|
6
|
+
TypeOperation2["READ"] = "READ";
|
|
7
|
+
TypeOperation2["UPDATE"] = "UPDATE";
|
|
8
|
+
TypeOperation2["DELETE"] = "DELETE";
|
|
9
|
+
return TypeOperation2;
|
|
10
|
+
})(TypeOperation || {});
|
|
11
|
+
|
|
12
|
+
// src/common/TypeParsing/Validation.ts
|
|
13
|
+
var RelationshipValidationType = /* @__PURE__ */ ((RelationshipValidationType2) => {
|
|
14
|
+
RelationshipValidationType2["INCLUDE"] = "INCLUDE";
|
|
15
|
+
RelationshipValidationType2["EXCLUDE"] = "EXCLUDE";
|
|
16
|
+
RelationshipValidationType2["STRICT_EXCLUDE"] = "STRICT_EXCLUDE";
|
|
17
|
+
return RelationshipValidationType2;
|
|
18
|
+
})(RelationshipValidationType || {});
|
|
19
|
+
var INVALID_CUSTOM_TYPE = "INVALID_CUSTOM_TYPE";
|
|
20
|
+
var PRIMITIVE_ERROR_MESSAGE_CONSTANTS = {
|
|
21
|
+
string: "NOT_A_STRING",
|
|
22
|
+
number: "NOT_A_NUMBER",
|
|
23
|
+
boolean: "NOT_A_BOOLEAN"
|
|
24
|
+
};
|
|
25
|
+
var DENIED_TYPE_OPERATIONS = {
|
|
26
|
+
CREATE: "DENIED_TYPE_OPERATION_CREATE",
|
|
27
|
+
READ: "DENIED_TYPE_OPERATION_READ",
|
|
28
|
+
UPDATE: "DENIED_TYPE_OPERATION_UPDATE",
|
|
29
|
+
DELETE: "DENIED_TYPE_OPERATION_DELETE"
|
|
30
|
+
};
|
|
31
|
+
var ERROR_MESSAGE_CONSTANTS = {
|
|
32
|
+
NONE: "NONE",
|
|
33
|
+
INVALID_CUSTOM_TYPE,
|
|
34
|
+
[PRIMITIVE_ERROR_MESSAGE_CONSTANTS.string]: PRIMITIVE_ERROR_MESSAGE_CONSTANTS.string,
|
|
35
|
+
[PRIMITIVE_ERROR_MESSAGE_CONSTANTS.number]: PRIMITIVE_ERROR_MESSAGE_CONSTANTS.number,
|
|
36
|
+
[PRIMITIVE_ERROR_MESSAGE_CONSTANTS.boolean]: PRIMITIVE_ERROR_MESSAGE_CONSTANTS.boolean,
|
|
37
|
+
[DENIED_TYPE_OPERATIONS.CREATE]: DENIED_TYPE_OPERATIONS.CREATE,
|
|
38
|
+
[DENIED_TYPE_OPERATIONS.READ]: DENIED_TYPE_OPERATIONS.READ,
|
|
39
|
+
[DENIED_TYPE_OPERATIONS.UPDATE]: DENIED_TYPE_OPERATIONS.UPDATE,
|
|
40
|
+
[DENIED_TYPE_OPERATIONS.DELETE]: DENIED_TYPE_OPERATIONS.DELETE,
|
|
41
|
+
MISSING_FIELD_VALUE: "MISSING_FIELD_VALUE",
|
|
42
|
+
INVALID_OPTION: "INVALID_OPTION",
|
|
43
|
+
INVALID_FIELD: "INVALID_FIELD",
|
|
44
|
+
RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED: "RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED",
|
|
45
|
+
INVALID_TYPE: "INVALID_TYPE",
|
|
46
|
+
NO_UNION_TYPE_MATCHED: "NO_UNION_TYPE_MATCHED",
|
|
47
|
+
TYPE_DOES_NOT_EXIST: "TYPE_DOES_NOT_EXIST",
|
|
48
|
+
INVALID_PATTERN: "INVALID_PATTERN",
|
|
49
|
+
VALUE_DOES_NOT_MATCH_PATTERN: "VALUE_DOES_NOT_MATCH_PATTERN",
|
|
50
|
+
VALUE_BELOW_MINIMUM: "VALUE_BELOW_MINIMUM",
|
|
51
|
+
VALUE_ABOVE_MAXIMUM: "VALUE_ABOVE_MAXIMUM"
|
|
52
|
+
};
|
|
53
|
+
var TYPE_KEYWORD_ERROR_MESSAGE_CONSTANTS = {
|
|
54
|
+
string: PRIMITIVE_ERROR_MESSAGE_CONSTANTS.string,
|
|
55
|
+
number: PRIMITIVE_ERROR_MESSAGE_CONSTANTS.number,
|
|
56
|
+
boolean: PRIMITIVE_ERROR_MESSAGE_CONSTANTS.boolean
|
|
57
|
+
};
|
|
58
|
+
var ARRAY_ITEM_ERROR_MAP_KEY = "__arrayItemErrors__";
|
|
59
|
+
var getErrorDescriptor = (code = ERROR_MESSAGE_CONSTANTS.NONE, values) => ({
|
|
60
|
+
code,
|
|
61
|
+
values
|
|
62
|
+
});
|
|
63
|
+
var getNoErrorDescriptor = () => getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.NONE);
|
|
64
|
+
var isArrayErrorDescriptorCollection = (value) => typeof value === "object" && value !== null && "itemErrorMap" in value;
|
|
65
|
+
var getErrorDescriptors = (values = []) => values.filter(
|
|
66
|
+
(value) => !isArrayErrorDescriptorCollection(value)
|
|
67
|
+
);
|
|
68
|
+
var getArrayItemErrorMap = (values = []) => values.reduce((acc, value) => {
|
|
69
|
+
if (isArrayErrorDescriptorCollection(value)) {
|
|
70
|
+
for (const [indexKey, descriptors] of Object.entries(value.itemErrorMap)) {
|
|
71
|
+
const index = Number(indexKey);
|
|
72
|
+
if (!Number.isFinite(index)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
acc[index] = [...acc[index] ?? [], ...descriptors];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return acc;
|
|
79
|
+
}, {});
|
|
80
|
+
var validateValueMatchesPattern = (typeName, value, pattern) => {
|
|
81
|
+
const results = {
|
|
82
|
+
typeName,
|
|
83
|
+
valid: true,
|
|
84
|
+
error: getNoErrorDescriptor(),
|
|
85
|
+
errorMap: {}
|
|
86
|
+
};
|
|
87
|
+
const valueSupplied = typeof value !== "undefined";
|
|
88
|
+
const patternSupplied = typeof pattern === "string" && pattern.trim() !== "";
|
|
89
|
+
if (valueSupplied && patternSupplied) {
|
|
90
|
+
try {
|
|
91
|
+
const regex = new RegExp(pattern);
|
|
92
|
+
const testResult = typeof value === "string" && regex.test(value);
|
|
93
|
+
if (!testResult) {
|
|
94
|
+
results.valid = false;
|
|
95
|
+
results.error = getErrorDescriptor(
|
|
96
|
+
ERROR_MESSAGE_CONSTANTS.VALUE_DOES_NOT_MATCH_PATTERN
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
} catch (e) {
|
|
100
|
+
results.valid = false;
|
|
101
|
+
results.error = getErrorDescriptor(
|
|
102
|
+
ERROR_MESSAGE_CONSTANTS.INVALID_PATTERN
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return results;
|
|
107
|
+
};
|
|
108
|
+
var getValidityValue = (existing, pending) => !existing ? false : pending;
|
|
109
|
+
var TYPE_KEYWORD_VALIDATORS = {
|
|
110
|
+
string: (value) => typeof value === "string",
|
|
111
|
+
number: (value) => typeof value === "number",
|
|
112
|
+
boolean: (value) => typeof value === "boolean"
|
|
113
|
+
};
|
|
114
|
+
var hasValue = (value) => {
|
|
115
|
+
if (typeof value === "undefined" || value === null) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (typeof value === "string") {
|
|
119
|
+
return value.length > 0;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
};
|
|
123
|
+
var validateKeywordType = (value, type) => {
|
|
124
|
+
const validator = TYPE_KEYWORD_VALIDATORS[type];
|
|
125
|
+
let valid = true;
|
|
126
|
+
if (validator) {
|
|
127
|
+
valid = validator(value);
|
|
128
|
+
}
|
|
129
|
+
return valid;
|
|
130
|
+
};
|
|
131
|
+
var validateCustomType = (value, customType, customValidators) => {
|
|
132
|
+
let valid = true;
|
|
133
|
+
if (customValidators && customType) {
|
|
134
|
+
const validator = customValidators[customType];
|
|
135
|
+
if (validator) {
|
|
136
|
+
try {
|
|
137
|
+
valid = validator(value);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
valid = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return valid;
|
|
144
|
+
};
|
|
145
|
+
var validateTypeInfoFieldValue = (value, typeInfoField, typeInfoMap, ignoreArray = false, strict = false, customValidators, typeOperation, relationshipValidationType = "STRICT_EXCLUDE" /* STRICT_EXCLUDE */, itemIsPartial) => {
|
|
146
|
+
const {
|
|
147
|
+
type,
|
|
148
|
+
typeReference,
|
|
149
|
+
array,
|
|
150
|
+
optional,
|
|
151
|
+
possibleValues,
|
|
152
|
+
tags: {
|
|
153
|
+
customType,
|
|
154
|
+
validation: {
|
|
155
|
+
emptyArrayIsValid: emptyArrayIsValidOverride = void 0
|
|
156
|
+
} = {},
|
|
157
|
+
constraints: {
|
|
158
|
+
pattern = void 0,
|
|
159
|
+
min = void 0,
|
|
160
|
+
max = void 0
|
|
161
|
+
} = {}
|
|
162
|
+
} = {}
|
|
163
|
+
} = typeInfoField;
|
|
164
|
+
const results = {
|
|
165
|
+
typeName: typeReference ?? type,
|
|
166
|
+
valid: true,
|
|
167
|
+
error: getNoErrorDescriptor(),
|
|
168
|
+
errorMap: {}
|
|
169
|
+
};
|
|
170
|
+
const requiredValueAllowed = !typeReference || relationshipValidationType === "INCLUDE" /* INCLUDE */;
|
|
171
|
+
const valueIsUndefined = typeof value === "undefined";
|
|
172
|
+
const valueIsNull = value === null;
|
|
173
|
+
const canSkipValidation = itemIsPartial && (valueIsUndefined || valueIsNull) || optional && valueIsUndefined;
|
|
174
|
+
const emptyArrayIsValid = emptyArrayIsValidOverride ?? false;
|
|
175
|
+
if (canSkipValidation) {
|
|
176
|
+
results.valid = true;
|
|
177
|
+
} else if (requiredValueAllowed && !itemIsPartial && !optional && !hasValue(value)) {
|
|
178
|
+
results.valid = false;
|
|
179
|
+
results.error = getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.MISSING_FIELD_VALUE);
|
|
180
|
+
} else if (array && !ignoreArray && !Array.isArray(value)) {
|
|
181
|
+
results.valid = false;
|
|
182
|
+
results.error = getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.INVALID_TYPE);
|
|
183
|
+
} else if (array && !ignoreArray && !optional && Array.isArray(value) && value.length === 0 && !emptyArrayIsValid) {
|
|
184
|
+
results.valid = false;
|
|
185
|
+
results.error = getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.MISSING_FIELD_VALUE);
|
|
186
|
+
} else if (array && !ignoreArray) {
|
|
187
|
+
const {
|
|
188
|
+
valid: validArray,
|
|
189
|
+
error: arrayError,
|
|
190
|
+
errorMap: arrayErrorMap
|
|
191
|
+
} = validateArrayOfTypeInfoFieldValues(
|
|
192
|
+
value,
|
|
193
|
+
typeInfoField,
|
|
194
|
+
typeInfoMap,
|
|
195
|
+
strict,
|
|
196
|
+
customValidators,
|
|
197
|
+
typeOperation,
|
|
198
|
+
relationshipValidationType,
|
|
199
|
+
itemIsPartial
|
|
200
|
+
);
|
|
201
|
+
results.valid = getValidityValue(results.valid, validArray);
|
|
202
|
+
results.error = arrayError;
|
|
203
|
+
results.errorMap = arrayErrorMap;
|
|
204
|
+
} else {
|
|
205
|
+
if (typeReference) {
|
|
206
|
+
if (relationshipValidationType === "INCLUDE" /* INCLUDE */) {
|
|
207
|
+
const {
|
|
208
|
+
valid: validTypeInfo,
|
|
209
|
+
error: typeInfoError,
|
|
210
|
+
errorMap: typeInfoErrorMap
|
|
211
|
+
} = validateTypeInfoValue(
|
|
212
|
+
value,
|
|
213
|
+
typeReference,
|
|
214
|
+
typeInfoMap,
|
|
215
|
+
strict,
|
|
216
|
+
customValidators,
|
|
217
|
+
typeOperation,
|
|
218
|
+
relationshipValidationType,
|
|
219
|
+
itemIsPartial
|
|
220
|
+
);
|
|
221
|
+
results.valid = getValidityValue(results.valid, validTypeInfo);
|
|
222
|
+
results.error = typeInfoError;
|
|
223
|
+
results.errorMap = typeInfoErrorMap;
|
|
224
|
+
} else if (relationshipValidationType === "STRICT_EXCLUDE" /* STRICT_EXCLUDE */) {
|
|
225
|
+
const valueSupplied = typeof value !== "undefined";
|
|
226
|
+
if (valueSupplied) {
|
|
227
|
+
results.valid = false;
|
|
228
|
+
results.error = getErrorDescriptor(
|
|
229
|
+
ERROR_MESSAGE_CONSTANTS.RELATIONSHIP_VALUES_ARE_STRICTLY_EXCLUDED
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
} else if (relationshipValidationType === "EXCLUDE" /* EXCLUDE */) {
|
|
233
|
+
results.valid = getValidityValue(results.valid, true);
|
|
234
|
+
}
|
|
235
|
+
} else if (possibleValues && !possibleValues.includes(value)) {
|
|
236
|
+
results.valid = false;
|
|
237
|
+
results.error = getErrorDescriptor(
|
|
238
|
+
ERROR_MESSAGE_CONSTANTS.INVALID_OPTION
|
|
239
|
+
);
|
|
240
|
+
} else {
|
|
241
|
+
const pendingValid = validateKeywordType(value, type);
|
|
242
|
+
const customValid = validateCustomType(
|
|
243
|
+
value,
|
|
244
|
+
customType,
|
|
245
|
+
customValidators
|
|
246
|
+
);
|
|
247
|
+
results.valid = getValidityValue(results.valid, pendingValid);
|
|
248
|
+
results.valid = getValidityValue(results.valid, customValid);
|
|
249
|
+
if (type === "string" && typeof pattern === "string") {
|
|
250
|
+
const { valid: patternValid, error: patternError } = validateValueMatchesPattern(typeReference ?? type, value, pattern);
|
|
251
|
+
results.valid = getValidityValue(results.valid, patternValid);
|
|
252
|
+
results.error = patternError;
|
|
253
|
+
}
|
|
254
|
+
if (type === "number" && typeof value === "number") {
|
|
255
|
+
if (typeof min === "number" && value < min) {
|
|
256
|
+
results.valid = false;
|
|
257
|
+
results.error = getErrorDescriptor(
|
|
258
|
+
ERROR_MESSAGE_CONSTANTS.VALUE_BELOW_MINIMUM,
|
|
259
|
+
[`${min}`]
|
|
260
|
+
);
|
|
261
|
+
} else if (typeof max === "number" && value > max) {
|
|
262
|
+
results.valid = false;
|
|
263
|
+
results.error = getErrorDescriptor(
|
|
264
|
+
ERROR_MESSAGE_CONSTANTS.VALUE_ABOVE_MAXIMUM,
|
|
265
|
+
[`${max}`]
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (!customValid) {
|
|
270
|
+
results.error = getErrorDescriptor(
|
|
271
|
+
ERROR_MESSAGE_CONSTANTS.INVALID_CUSTOM_TYPE
|
|
272
|
+
);
|
|
273
|
+
} else if (!results.valid) {
|
|
274
|
+
results.error = results.error.code !== ERROR_MESSAGE_CONSTANTS.NONE ? results.error : getErrorDescriptor(
|
|
275
|
+
TYPE_KEYWORD_ERROR_MESSAGE_CONSTANTS[type]
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return results;
|
|
281
|
+
};
|
|
282
|
+
var validateArrayOfTypeInfoFieldValues = (values = [], typeInfoField, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
|
|
283
|
+
const { type, typeReference } = typeInfoField;
|
|
284
|
+
const results = {
|
|
285
|
+
typeName: typeReference ?? type,
|
|
286
|
+
valid: true,
|
|
287
|
+
error: getNoErrorDescriptor(),
|
|
288
|
+
errorMap: {}
|
|
289
|
+
};
|
|
290
|
+
const itemErrorMap = {};
|
|
291
|
+
for (let i = 0; i < values.length; i++) {
|
|
292
|
+
const v = values[i];
|
|
293
|
+
const {
|
|
294
|
+
valid: indexValid,
|
|
295
|
+
error: indexError = getNoErrorDescriptor(),
|
|
296
|
+
errorMap: indexErrorMap
|
|
297
|
+
} = validateTypeInfoFieldValue(
|
|
298
|
+
v,
|
|
299
|
+
typeInfoField,
|
|
300
|
+
typeInfoMap,
|
|
301
|
+
true,
|
|
302
|
+
strict,
|
|
303
|
+
customValidators,
|
|
304
|
+
typeOperation,
|
|
305
|
+
relationshipValidationType,
|
|
306
|
+
itemIsPartial
|
|
307
|
+
);
|
|
308
|
+
results.valid = getValidityValue(results.valid, indexValid);
|
|
309
|
+
const indexErrors = [
|
|
310
|
+
...indexError.code !== ERROR_MESSAGE_CONSTANTS.NONE ? [indexError] : [],
|
|
311
|
+
...getErrorDescriptors(indexErrorMap[ARRAY_ITEM_ERROR_MAP_KEY] ?? []),
|
|
312
|
+
...Object.entries(indexErrorMap).filter(([key]) => key !== ARRAY_ITEM_ERROR_MAP_KEY).flatMap(([, entries]) => getErrorDescriptors(entries)).filter((descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE)
|
|
313
|
+
];
|
|
314
|
+
if (indexErrors.length) {
|
|
315
|
+
itemErrorMap[i] = indexErrors;
|
|
316
|
+
if (results.error.code === ERROR_MESSAGE_CONSTANTS.NONE) {
|
|
317
|
+
results.error = indexErrors[0];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
for (const [er, entries] of Object.entries(indexErrorMap)) {
|
|
321
|
+
if (er === ARRAY_ITEM_ERROR_MAP_KEY) {
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
results.errorMap[getPathString([i, er])] = entries;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
results.errorMap[ARRAY_ITEM_ERROR_MAP_KEY] = [{ itemErrorMap }];
|
|
328
|
+
return results;
|
|
329
|
+
};
|
|
330
|
+
var validateTypeInfoFieldOperationAllowed = (fieldName, fieldOperation, typeInfoField) => {
|
|
331
|
+
const results = {
|
|
332
|
+
typeName: null,
|
|
333
|
+
valid: true,
|
|
334
|
+
error: getNoErrorDescriptor(),
|
|
335
|
+
errorMap: {}
|
|
336
|
+
};
|
|
337
|
+
if (fieldOperation && typeInfoField) {
|
|
338
|
+
const {
|
|
339
|
+
type,
|
|
340
|
+
typeReference,
|
|
341
|
+
tags = {}
|
|
342
|
+
} = typeInfoField || {};
|
|
343
|
+
const { deniedOperations: { [fieldOperation]: denied = false } = {} } = tags;
|
|
344
|
+
results.typeName = typeReference ?? type;
|
|
345
|
+
results.valid = !denied;
|
|
346
|
+
if (!results.valid) {
|
|
347
|
+
results.error = getErrorDescriptor(
|
|
348
|
+
DENIED_TYPE_OPERATIONS[fieldOperation]
|
|
349
|
+
);
|
|
350
|
+
results.errorMap[fieldName] = [results.error];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return results;
|
|
354
|
+
};
|
|
355
|
+
var validateTypeOperationAllowed = (typeName, valueFields, typeOperation, typeInfo) => {
|
|
356
|
+
const results = {
|
|
357
|
+
typeName,
|
|
358
|
+
valid: true,
|
|
359
|
+
error: getNoErrorDescriptor(),
|
|
360
|
+
errorMap: {}
|
|
361
|
+
};
|
|
362
|
+
const { fields = {}, tags = {} } = typeInfo;
|
|
363
|
+
const { deniedOperations: { [typeOperation]: denied = false } = {} } = tags;
|
|
364
|
+
if (denied) {
|
|
365
|
+
results.valid = false;
|
|
366
|
+
results.error = getErrorDescriptor(DENIED_TYPE_OPERATIONS[typeOperation]);
|
|
367
|
+
} else {
|
|
368
|
+
for (const vF of valueFields) {
|
|
369
|
+
const vFieldInfo = fields[vF];
|
|
370
|
+
const { valid: vFValid, error: vFError } = validateTypeInfoFieldOperationAllowed(vF, typeOperation, vFieldInfo);
|
|
371
|
+
results.valid = getValidityValue(results.valid, vFValid);
|
|
372
|
+
if (!vFValid) {
|
|
373
|
+
results.errorMap[vF] = [vFError];
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return results;
|
|
378
|
+
};
|
|
379
|
+
var TYPE_INFO_DATA_ITEM_TYPE_NAME = "__TYPE_INFO_DATA_ITEM__";
|
|
380
|
+
var validateTypeInfoDataItem = (value = {}, typeInfo, customValidatorMap = {}, options) => {
|
|
381
|
+
const {
|
|
382
|
+
typeName = TYPE_INFO_DATA_ITEM_TYPE_NAME,
|
|
383
|
+
typeInfoMap = {},
|
|
384
|
+
strict = true,
|
|
385
|
+
customTypeValidators,
|
|
386
|
+
typeOperation = "CREATE" /* CREATE */,
|
|
387
|
+
relationshipValidationType = "STRICT_EXCLUDE" /* STRICT_EXCLUDE */,
|
|
388
|
+
itemIsPartial = typeOperation === "UPDATE" /* UPDATE */,
|
|
389
|
+
validateHidden = false,
|
|
390
|
+
validateReadonly = false
|
|
391
|
+
} = options ?? {};
|
|
392
|
+
const sourceFields = typeInfo.fields ?? {};
|
|
393
|
+
const normalizedFields = {};
|
|
394
|
+
for (const [fieldName, field] of Object.entries(sourceFields)) {
|
|
395
|
+
const validationTags = field.tags?.validation ?? {};
|
|
396
|
+
const shouldValidateHidden = validationTags.validateHidden ?? validateHidden;
|
|
397
|
+
const shouldValidateReadonly = validationTags.validateReadonly ?? validateReadonly;
|
|
398
|
+
const shouldSkipRequiredChecks = field.tags?.hidden && !shouldValidateHidden || field.readonly && !shouldValidateReadonly;
|
|
399
|
+
normalizedFields[fieldName] = shouldSkipRequiredChecks ? {
|
|
400
|
+
...field,
|
|
401
|
+
optional: true
|
|
402
|
+
} : field;
|
|
403
|
+
}
|
|
404
|
+
const normalizedTypeInfo = {
|
|
405
|
+
...typeInfo,
|
|
406
|
+
fields: normalizedFields
|
|
407
|
+
};
|
|
408
|
+
const results = validateTypeInfoValue(
|
|
409
|
+
value ?? {},
|
|
410
|
+
typeName,
|
|
411
|
+
{ ...typeInfoMap, [typeName]: normalizedTypeInfo },
|
|
412
|
+
strict,
|
|
413
|
+
customTypeValidators,
|
|
414
|
+
typeOperation,
|
|
415
|
+
relationshipValidationType,
|
|
416
|
+
itemIsPartial
|
|
417
|
+
);
|
|
418
|
+
for (const [fieldName, validator] of Object.entries(customValidatorMap)) {
|
|
419
|
+
const field = normalizedFields[fieldName];
|
|
420
|
+
if (!field) {
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
let error = getNoErrorDescriptor();
|
|
424
|
+
try {
|
|
425
|
+
error = validator(value[fieldName], field);
|
|
426
|
+
} catch (e) {
|
|
427
|
+
error = getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.INVALID_CUSTOM_TYPE);
|
|
428
|
+
}
|
|
429
|
+
if (error.code !== ERROR_MESSAGE_CONSTANTS.NONE) {
|
|
430
|
+
results.valid = false;
|
|
431
|
+
results.errorMap[fieldName] = [
|
|
432
|
+
...results.errorMap[fieldName] ?? [],
|
|
433
|
+
error
|
|
434
|
+
];
|
|
435
|
+
if (results.error.code === ERROR_MESSAGE_CONSTANTS.NONE) {
|
|
436
|
+
results.error = error;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return results;
|
|
441
|
+
};
|
|
442
|
+
var validateTypeInfoValue = (value, typeInfoFullName, typeInfoMap, strict = false, customValidators, typeOperation, relationshipValidationType, itemIsPartial) => {
|
|
443
|
+
const typeInfo = typeInfoMap[typeInfoFullName];
|
|
444
|
+
const results = {
|
|
445
|
+
typeName: typeInfoFullName,
|
|
446
|
+
valid: !!typeInfo,
|
|
447
|
+
error: !!typeInfo ? getNoErrorDescriptor() : getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.TYPE_DOES_NOT_EXIST),
|
|
448
|
+
errorMap: {}
|
|
449
|
+
};
|
|
450
|
+
if (typeInfo) {
|
|
451
|
+
const { primaryField, fields, unionFieldSets } = typeInfo;
|
|
452
|
+
if (typeOperation) {
|
|
453
|
+
const valueFields = typeof value === "object" ? Object.keys(value ?? {}) : [];
|
|
454
|
+
const {
|
|
455
|
+
valid: operationValid,
|
|
456
|
+
error: operationError,
|
|
457
|
+
errorMap: operationErrorMap
|
|
458
|
+
} = validateTypeOperationAllowed(
|
|
459
|
+
typeInfoFullName,
|
|
460
|
+
valueFields,
|
|
461
|
+
typeOperation,
|
|
462
|
+
typeInfo
|
|
463
|
+
);
|
|
464
|
+
results.valid = getValidityValue(results.valid, operationValid);
|
|
465
|
+
results.error = operationError;
|
|
466
|
+
for (const oE in operationErrorMap) {
|
|
467
|
+
const existingError = results.errorMap[oE] ?? [];
|
|
468
|
+
results.errorMap[oE] = existingError ? [...existingError, ...operationErrorMap[oE]] : operationErrorMap[oE];
|
|
469
|
+
}
|
|
470
|
+
if (!operationValid && operationError.code !== ERROR_MESSAGE_CONSTANTS.NONE) {
|
|
471
|
+
results.error = operationError;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (unionFieldSets) {
|
|
475
|
+
const valueFields = Object.keys(value || {});
|
|
476
|
+
let valid = false;
|
|
477
|
+
for (const uFS of unionFieldSets) {
|
|
478
|
+
valid = valueFields.every((vF) => uFS.includes(vF));
|
|
479
|
+
if (valid) {
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (!valid) {
|
|
484
|
+
results.valid = false;
|
|
485
|
+
results.error = getErrorDescriptor(
|
|
486
|
+
ERROR_MESSAGE_CONSTANTS.NO_UNION_TYPE_MATCHED
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
} else if (strict) {
|
|
490
|
+
const knownFields = Object.keys(fields || {});
|
|
491
|
+
const valueFields = Object.keys(value || {});
|
|
492
|
+
for (const vF of valueFields) {
|
|
493
|
+
if (!knownFields.includes(vF)) {
|
|
494
|
+
results.valid = false;
|
|
495
|
+
results.errorMap[vF] = [
|
|
496
|
+
getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.INVALID_FIELD)
|
|
497
|
+
];
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (fields) {
|
|
502
|
+
for (const key in fields) {
|
|
503
|
+
if (typeOperation !== "CREATE" /* CREATE */ || typeof primaryField !== "string" || key !== primaryField) {
|
|
504
|
+
const typeInfoField = fields[key];
|
|
505
|
+
const fieldValue = value[key];
|
|
506
|
+
const {
|
|
507
|
+
valid: fieldValid,
|
|
508
|
+
error: fieldError,
|
|
509
|
+
errorMap: fieldErrorMap
|
|
510
|
+
} = validateTypeInfoFieldValue(
|
|
511
|
+
fieldValue,
|
|
512
|
+
typeInfoField,
|
|
513
|
+
typeInfoMap,
|
|
514
|
+
false,
|
|
515
|
+
strict,
|
|
516
|
+
customValidators,
|
|
517
|
+
typeOperation,
|
|
518
|
+
relationshipValidationType,
|
|
519
|
+
itemIsPartial
|
|
520
|
+
);
|
|
521
|
+
results.valid = getValidityValue(results.valid, fieldValid);
|
|
522
|
+
const fieldEntries = [fieldError];
|
|
523
|
+
const arrayItemErrorMap = getArrayItemErrorMap(
|
|
524
|
+
fieldErrorMap[ARRAY_ITEM_ERROR_MAP_KEY]
|
|
525
|
+
);
|
|
526
|
+
if (Object.keys(arrayItemErrorMap).length) {
|
|
527
|
+
fieldEntries.push({ itemErrorMap: arrayItemErrorMap });
|
|
528
|
+
}
|
|
529
|
+
results.errorMap[key] = fieldEntries;
|
|
530
|
+
for (const [fE, entries] of Object.entries(fieldErrorMap)) {
|
|
531
|
+
if (fE === ARRAY_ITEM_ERROR_MAP_KEY) {
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
results.errorMap[getPathString([key, fE])] = entries;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (!results.valid && results.error.code === ERROR_MESSAGE_CONSTANTS.NONE) {
|
|
540
|
+
results.error = getErrorDescriptor(ERROR_MESSAGE_CONSTANTS.INVALID_TYPE);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return results;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export { DENIED_TYPE_OPERATIONS, ERROR_MESSAGE_CONSTANTS, INVALID_CUSTOM_TYPE, PRIMITIVE_ERROR_MESSAGE_CONSTANTS, RelationshipValidationType, TYPE_KEYWORD_ERROR_MESSAGE_CONSTANTS, TYPE_KEYWORD_VALIDATORS, TypeOperation, getArrayItemErrorMap, getErrorDescriptor, getErrorDescriptors, getNoErrorDescriptor, getValidityValue, hasValue, isArrayErrorDescriptorCollection, validateArrayOfTypeInfoFieldValues, validateCustomType, validateKeywordType, validateTypeInfoDataItem, validateTypeInfoFieldOperationAllowed, validateTypeInfoFieldValue, validateTypeInfoValue, validateTypeOperationAllowed, validateValueMatchesPattern };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collect required environment variables or throw with a missing-name error.
|
|
3
|
+
*
|
|
4
|
+
* @typeParam VarName - Allowed environment variable names.
|
|
5
|
+
* @param varNames - List of required environment variable names.
|
|
6
|
+
* @returns Map of environment variable names to values.
|
|
7
|
+
* @throws Error when a required variable is missing or empty.
|
|
8
|
+
*/
|
|
9
|
+
export declare const collectRequiredEnvironmentVariables: <VarName extends string>(varNames: VarName[]) => Record<VarName, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./getSimpleId";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relationship info types used by ORM and relationship utilities.
|
|
3
|
+
*/
|
|
4
|
+
import type { ExpandComplexType } from "./HelperTypes";
|
|
5
|
+
/**
|
|
6
|
+
* The keys for item relationship info.
|
|
7
|
+
* */
|
|
8
|
+
export declare enum ItemRelationshipInfoKeys {
|
|
9
|
+
/**
|
|
10
|
+
* Relationship origin type name.
|
|
11
|
+
* */
|
|
12
|
+
fromTypeName = "fromTypeName",
|
|
13
|
+
/**
|
|
14
|
+
* Relationship origin field name.
|
|
15
|
+
* */
|
|
16
|
+
fromTypeFieldName = "fromTypeFieldName",
|
|
17
|
+
/**
|
|
18
|
+
* Relationship origin primary field value.
|
|
19
|
+
* */
|
|
20
|
+
fromTypePrimaryFieldValue = "fromTypePrimaryFieldValue",
|
|
21
|
+
/**
|
|
22
|
+
* Relationship destination primary field value.
|
|
23
|
+
* */
|
|
24
|
+
toTypePrimaryFieldValue = "toTypePrimaryFieldValue"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The identifying keys for item relationship info.
|
|
28
|
+
* */
|
|
29
|
+
export declare enum ItemRelationshipInfoIdentifyingKeys {
|
|
30
|
+
/**
|
|
31
|
+
* Identifier value for a relationship item.
|
|
32
|
+
* */
|
|
33
|
+
id = "id"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The basis for an `ItemRelationshipInfo` without an assigned identifier.
|
|
37
|
+
* */
|
|
38
|
+
export type BaseItemRelationshipInfo = Record<ItemRelationshipInfoKeys, string>;
|
|
39
|
+
/**
|
|
40
|
+
* An item containing the information about a relationship between two items.
|
|
41
|
+
* */
|
|
42
|
+
export type ItemRelationshipInfo = BaseItemRelationshipInfo & Record<ItemRelationshipInfoIdentifyingKeys, string>;
|
|
43
|
+
/**
|
|
44
|
+
* The origination portion of an `ItemRelationshipInfo`.
|
|
45
|
+
* */
|
|
46
|
+
export type ItemRelationshipOriginInfo = Record<ItemRelationshipInfoKeys.fromTypeName | ItemRelationshipInfoKeys.fromTypeFieldName, string>;
|
|
47
|
+
/**
|
|
48
|
+
* The origination portion of an `ItemRelationshipInfo` for a specific item and field relationship.
|
|
49
|
+
* */
|
|
50
|
+
export type ItemRelationshipOriginItemInfo = ExpandComplexType<ItemRelationshipOriginInfo & Record<ItemRelationshipInfoKeys.fromTypePrimaryFieldValue, string>>;
|
|
51
|
+
/**
|
|
52
|
+
* The destination portion of an `ItemRelationshipInfo` for a specific, related item.
|
|
53
|
+
* */
|
|
54
|
+
export type ItemRelationshipDestinationItemInfo = Record<ItemRelationshipInfoKeys.toTypePrimaryFieldValue, string>;
|
|
55
|
+
/**
|
|
56
|
+
* The originating item info portion of an `ItemRelationshipInfo`.
|
|
57
|
+
*
|
|
58
|
+
* Used for relationship originating from a specific item, regardless of field relationship.
|
|
59
|
+
* */
|
|
60
|
+
export type ItemRelationshipOriginatingItemInfo = Record<ItemRelationshipInfoKeys.fromTypeName | ItemRelationshipInfoKeys.fromTypePrimaryFieldValue, string>;
|
|
61
|
+
/**
|
|
62
|
+
* One of the various types describing an item relationship.
|
|
63
|
+
* */
|
|
64
|
+
export type ItemRelationshipInfoType = BaseItemRelationshipInfo | ItemRelationshipInfo | ItemRelationshipOriginInfo | ItemRelationshipOriginItemInfo;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation helpers for relationship items.
|
|
3
|
+
*/
|
|
4
|
+
import type { TypeInfoValidationResults } from "../TypeParsing/Validation";
|
|
5
|
+
import { ItemRelationshipInfoKeys, ItemRelationshipInfoType } from "../ItemRelationshipInfoTypes";
|
|
6
|
+
/**
|
|
7
|
+
* Error codes for relationship validation.
|
|
8
|
+
* */
|
|
9
|
+
export declare const TYPE_INFO_ORM_RELATIONSHIP_ERRORS: {
|
|
10
|
+
INVALID_RELATIONSHIP_ITEM: string;
|
|
11
|
+
INVALID_RELATIONSHIP_ITEM_FIELD: string;
|
|
12
|
+
MISSING_RELATIONSHIP_ITEM_FIELD: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Validates a relationship item.
|
|
16
|
+
*
|
|
17
|
+
* @param relationshipItem - Relationship item to validate.
|
|
18
|
+
* @param omitFields - Relationship keys to ignore during validation.
|
|
19
|
+
* @returns Validation results with errors and errorMap when invalid.
|
|
20
|
+
* */
|
|
21
|
+
export declare const validateRelationshipItem: (relationshipItem: ItemRelationshipInfoType, omitFields: ItemRelationshipInfoKeys[]) => TypeInfoValidationResults;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging tags used by {@link logFunctionCall}.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum LOGGING_MESSAGES {
|
|
5
|
+
LOGGING_FUNCTION_CALL = "LOGGING_FUNCTION_CALL",
|
|
6
|
+
INPUT = "INPUT",
|
|
7
|
+
OUTPUT = "OUTPUT",
|
|
8
|
+
ERROR = "ERROR"
|
|
9
|
+
}
|
|
10
|
+
export declare const logFunctionCall: (label: string, args: any[], functionRef: (...args: any[]) => Promise<any> | any, enabled: boolean) => Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Utils";
|