@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,10 +0,0 @@
1
- import { TypeInfoValidationResults } from "../TypeParsing/Validation";
2
- import { ItemRelationshipInfoKeys, ItemRelationshipInfoType } from "../ItemRelationshipInfoTypes";
3
- export declare const TYPE_INFO_ORM_RELATIONSHIP_ERRORS: {
4
- INVALID_RELATIONSHIP_ITEM: string;
5
- INVALID_RELATIONSHIP_ITEM_FIELD: string;
6
- };
7
- /**
8
- * Validates a relationship item.
9
- * */
10
- export declare const validateRelationshipItem: (relationshipItem: ItemRelationshipInfoType, omitFields?: ItemRelationshipInfoKeys[]) => TypeInfoValidationResults;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateRelationshipItem = exports.TYPE_INFO_ORM_RELATIONSHIP_ERRORS = void 0;
4
- const ItemRelationshipInfoTypes_1 = require("../ItemRelationshipInfoTypes");
5
- exports.TYPE_INFO_ORM_RELATIONSHIP_ERRORS = {
6
- INVALID_RELATIONSHIP_ITEM: "INVALID_RELATIONSHIP_ITEM",
7
- INVALID_RELATIONSHIP_ITEM_FIELD: "INVALID_RELATIONSHIP_ITEM_FIELD",
8
- };
9
- /**
10
- * Validates a relationship item.
11
- * */
12
- const validateRelationshipItem = (relationshipItem, omitFields = []) => {
13
- const { fromTypeName } = relationshipItem;
14
- const results = {
15
- typeName: fromTypeName,
16
- valid: true,
17
- error: "",
18
- errorMap: {},
19
- };
20
- if (typeof relationshipItem === "object" && relationshipItem !== null) {
21
- const relKeyValues = Object.values(ItemRelationshipInfoTypes_1.ItemRelationshipInfoKeys);
22
- for (const rKV of relKeyValues) {
23
- const universalRKV = rKV;
24
- const omitRKV = omitFields.includes(rKV);
25
- if (!omitRKV &&
26
- (typeof relationshipItem[universalRKV] !== "string" ||
27
- !relationshipItem[universalRKV])) {
28
- results.valid = false;
29
- results.error =
30
- exports.TYPE_INFO_ORM_RELATIONSHIP_ERRORS.INVALID_RELATIONSHIP_ITEM;
31
- results.errorMap[rKV] = [
32
- exports.TYPE_INFO_ORM_RELATIONSHIP_ERRORS.INVALID_RELATIONSHIP_ITEM_FIELD,
33
- ];
34
- }
35
- }
36
- }
37
- else {
38
- results.valid = false;
39
- results.error = exports.TYPE_INFO_ORM_RELATIONSHIP_ERRORS.INVALID_RELATIONSHIP_ITEM;
40
- }
41
- return results;
42
- };
43
- exports.validateRelationshipItem = validateRelationshipItem;
@@ -1 +0,0 @@
1
- export * from "./ItemRelationshipValidation";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ItemRelationshipValidation"), exports);
@@ -1,10 +0,0 @@
1
- export declare enum LOGGING_MESSAGES {
2
- LOGGING_FUNCTION_CALL = "LOGGING_FUNCTION_CALL",
3
- INPUT = "INPUT",
4
- OUTPUT = "OUTPUT",
5
- ERROR = "ERROR"
6
- }
7
- /**
8
- * Make a function call and automatically log the input, output and errors, asynchronously.
9
- * */
10
- export declare const logFunctionCall: (label: string, args: any[], functionRef: (...args: any[]) => Promise<any> | any, enabled: boolean) => Promise<any>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logFunctionCall = exports.LOGGING_MESSAGES = void 0;
4
- var LOGGING_MESSAGES;
5
- (function (LOGGING_MESSAGES) {
6
- LOGGING_MESSAGES["LOGGING_FUNCTION_CALL"] = "LOGGING_FUNCTION_CALL";
7
- LOGGING_MESSAGES["INPUT"] = "INPUT";
8
- LOGGING_MESSAGES["OUTPUT"] = "OUTPUT";
9
- LOGGING_MESSAGES["ERROR"] = "ERROR";
10
- })(LOGGING_MESSAGES || (exports.LOGGING_MESSAGES = LOGGING_MESSAGES = {}));
11
- /**
12
- * Make a function call and automatically log the input, output and errors, asynchronously.
13
- * */
14
- const logFunctionCall = async (label, args, functionRef, enabled) => {
15
- if (enabled) {
16
- console.log(LOGGING_MESSAGES.LOGGING_FUNCTION_CALL, LOGGING_MESSAGES.INPUT, label, ":", JSON.stringify(args, null, 2));
17
- }
18
- try {
19
- const result = await functionRef(...args);
20
- if (enabled) {
21
- console.log(LOGGING_MESSAGES.LOGGING_FUNCTION_CALL, LOGGING_MESSAGES.OUTPUT, label, ":", JSON.stringify(result, null, 2));
22
- }
23
- return result;
24
- }
25
- catch (error) {
26
- if (enabled) {
27
- console.error(LOGGING_MESSAGES.LOGGING_FUNCTION_CALL, LOGGING_MESSAGES.ERROR, label, ":", error);
28
- }
29
- // IMPORTANT: Rethrow the error after logging it.
30
- throw error;
31
- }
32
- };
33
- exports.logFunctionCall = logFunctionCall;
@@ -1 +0,0 @@
1
- export * from "./Utils";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Utils"), exports);
@@ -1,25 +0,0 @@
1
- /**
2
- * The delimiter used to separate paths.
3
- * */
4
- export declare const PATH_DELIMITER = "/";
5
- export declare const getPotentialJSONValue: (value: string) => any;
6
- /**
7
- * Get the path segments from a path string.
8
- * */
9
- export declare const getPathArray: (path: string, delimiter?: string, filterEmptyOutput?: boolean, filterEmptyInput?: boolean, useJson?: boolean, uriDecodeParts?: boolean) => any[];
10
- /**
11
- * Get the path string from path segments.
12
- * */
13
- export declare const getPathString: (parts?: any[], delimiter?: string, filterEmptyInput?: boolean, useJson?: boolean, uriEncodeParts?: boolean) => string;
14
- /**
15
- * Merge two path strings.
16
- * */
17
- export declare const mergeStringPaths: (path1: string, path2: string, delimiter?: string, filterEmptyOutput?: boolean, filterEmptyInput?: boolean, useJson?: boolean, uriEncodeParts?: boolean) => string;
18
- /**
19
- * Resolve a path string against another path string.
20
- * */
21
- export declare const resolvePath: (currentPath: string, newPath: string) => string;
22
- /**
23
- * Get the parameter values from a path string and test the `path` against a `testPath`.
24
- * */
25
- export declare const getParamsAndTestPath: (path: string, testPath: string, exact?: boolean) => Record<string, any> | false;
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getParamsAndTestPath = exports.resolvePath = exports.mergeStringPaths = exports.getPathString = exports.getPathArray = exports.getPotentialJSONValue = exports.PATH_DELIMITER = void 0;
4
- /**
5
- * The delimiter used to separate paths.
6
- * */
7
- exports.PATH_DELIMITER = "/";
8
- const getPotentialJSONValue = (value) => {
9
- try {
10
- return JSON.parse(value);
11
- }
12
- catch (error) {
13
- return value;
14
- }
15
- };
16
- exports.getPotentialJSONValue = getPotentialJSONValue;
17
- /**
18
- * Get the path segments from a path string.
19
- * */
20
- const getPathArray = (path, delimiter = exports.PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriDecodeParts = true) => path
21
- .split(delimiter)
22
- .filter(filterEmptyInput ? (p) => p !== "" : () => true)
23
- .map(uriDecodeParts ? decodeURIComponent : (x) => x)
24
- .map(useJson ? exports.getPotentialJSONValue : (p) => p)
25
- .filter(filterEmptyOutput ? (p) => p ?? false : () => true);
26
- exports.getPathArray = getPathArray;
27
- /**
28
- * Get the path string from path segments.
29
- * */
30
- const getPathString = (parts = [], delimiter = exports.PATH_DELIMITER, filterEmptyInput = false, useJson = true, uriEncodeParts = false) => parts
31
- .filter(filterEmptyInput ? (p) => p ?? false : () => true)
32
- .map(useJson ? (p) => JSON.stringify(p) : (x) => x)
33
- .map(uriEncodeParts ? encodeURIComponent : (x) => x)
34
- .join(delimiter);
35
- exports.getPathString = getPathString;
36
- /**
37
- * Merge two path strings.
38
- * */
39
- const mergeStringPaths = (path1, path2, delimiter = exports.PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriEncodeParts = false) => (0, exports.getPathString)([
40
- ...(0, exports.getPathArray)(path1, delimiter, filterEmptyOutput, filterEmptyInput, useJson, uriEncodeParts),
41
- ...(0, exports.getPathArray)(path2, delimiter, filterEmptyOutput, filterEmptyInput, useJson, uriEncodeParts),
42
- ], delimiter, filterEmptyInput, useJson, uriEncodeParts);
43
- exports.mergeStringPaths = mergeStringPaths;
44
- /**
45
- * Resolve a path string against another path string.
46
- * */
47
- const resolvePath = (currentPath, newPath) => {
48
- const newSegments = (0, exports.getPathArray)(newPath, exports.PATH_DELIMITER, true);
49
- let currentSegments = (0, exports.getPathArray)(currentPath, exports.PATH_DELIMITER, true);
50
- // If the new path is absolute, start from the root
51
- if (newPath.startsWith("/")) {
52
- currentSegments = [];
53
- }
54
- // Iterate over the new path segments and modify the current path accordingly
55
- newSegments.forEach((segment) => {
56
- if (segment === "..") {
57
- // Go up one level (if possible)
58
- if (currentSegments.length > 0) {
59
- currentSegments.pop();
60
- }
61
- }
62
- else if (segment !== ".") {
63
- // Add the new segment
64
- currentSegments.push(segment);
65
- }
66
- // '.' represents the current directory, so we do nothing
67
- });
68
- // Join the segments back into a path
69
- return "/" + currentSegments.join("/");
70
- };
71
- exports.resolvePath = resolvePath;
72
- /**
73
- * Get the parameter values from a path string and test the `path` against a `testPath`.
74
- * */
75
- const getParamsAndTestPath = (path, testPath, exact = false) => {
76
- const pathList = (0, exports.getPathArray)(path);
77
- const testPathList = (0, exports.getPathArray)(testPath);
78
- if (exact && pathList.length !== testPathList.length) {
79
- return false;
80
- }
81
- else {
82
- let params = {};
83
- if (pathList.length >= testPathList.length) {
84
- for (let i = 0; i < testPathList.length; i++) {
85
- const testPathPart = testPathList[i];
86
- const pathPart = pathList[i];
87
- if (testPathPart.startsWith(":")) {
88
- const paramName = testPathPart.slice(1);
89
- params[paramName] = pathPart;
90
- }
91
- else if (pathPart !== testPathPart) {
92
- return false;
93
- }
94
- }
95
- }
96
- else {
97
- return false;
98
- }
99
- return params;
100
- }
101
- };
102
- exports.getParamsAndTestPath = getParamsAndTestPath;
@@ -1,98 +0,0 @@
1
- import { ItemRelationshipInfo, ItemRelationshipOriginItemInfo } from "./ItemRelationshipInfoTypes";
2
- /**
3
- * The logical operators for a search criteria.
4
- * */
5
- export declare enum LogicalOperators {
6
- AND = "AND",
7
- OR = "OR"
8
- }
9
- /**
10
- * The comparison operators for a field criterion.
11
- * */
12
- export declare enum ComparisonOperators {
13
- EQUALS = "EQUALS",
14
- NOT_EQUALS = "NOT_EQUALS",
15
- GREATER_THAN = "GREATER_THAN",
16
- GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL",
17
- LESS_THAN = "LESS_THAN",
18
- LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL",
19
- IN = "IN",
20
- NOT_IN = "NOT_IN",
21
- LIKE = "LIKE",
22
- NOT_LIKE = "NOT_LIKE",
23
- EXISTS = "EXISTS",
24
- NOT_EXISTS = "NOT_EXISTS",
25
- IS_NOT_EMPTY = "IS_NOT_EMPTY",
26
- IS_EMPTY = "IS_EMPTY",
27
- BETWEEN = "BETWEEN",
28
- NOT_BETWEEN = "NOT_BETWEEN",
29
- CONTAINS = "CONTAINS",
30
- NOT_CONTAINS = "NOT_CONTAINS",
31
- STARTS_WITH = "STARTS_WITH",
32
- ENDS_WITH = "ENDS_WITH",
33
- DOES_NOT_START_WITH = "DOES_NOT_START_WITH",
34
- DOES_NOT_END_WITH = "DOES_NOT_END_WITH"
35
- }
36
- /**
37
- * The field criterion for a search criteria.
38
- * */
39
- export type FieldCriterion = {
40
- fieldName: string;
41
- operator?: ComparisonOperators;
42
- customOperator?: string;
43
- value?: any;
44
- valueOptions?: any[];
45
- };
46
- /**
47
- * The criteria for a search.
48
- * */
49
- export type SearchCriteria = {
50
- logicalOperator: LogicalOperators;
51
- fieldCriteria: FieldCriterion[];
52
- };
53
- /**
54
- * The results from a request to list items.
55
- * */
56
- export type ListItemsResults<ItemType extends Record<any, any>> = {
57
- cursor?: string;
58
- items: ItemType[];
59
- };
60
- /**
61
- * The information used to sort a list of items by a specified field.
62
- * */
63
- export type SortField = {
64
- field?: string;
65
- reverse?: boolean;
66
- };
67
- /**
68
- * The data used to page a specific set of search results that uses full paging.
69
- * @see SupportedTags.fullPaging
70
- * */
71
- export type StandardExpandedPagingCursor = {
72
- currentPage?: number;
73
- totalPages?: number;
74
- };
75
- /**
76
- * The information for paging through a list of items.
77
- * */
78
- export type PagingInfo = {
79
- itemsPerPage?: number;
80
- cursor?: string;
81
- };
82
- /**
83
- * The configuration for listing and searching for items.
84
- * */
85
- export type ListItemsConfig = PagingInfo & {
86
- criteria?: SearchCriteria;
87
- sortFields?: SortField[];
88
- };
89
- /**
90
- * A configuration for listing relationships.
91
- * */
92
- export type ListRelationshipsConfig = PagingInfo & {
93
- relationshipItemOrigin: ItemRelationshipOriginItemInfo;
94
- };
95
- /**
96
- * The results from a request to list relationships.
97
- * */
98
- export type ListRelationshipsResults = ListItemsResults<ItemRelationshipInfo>;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComparisonOperators = exports.LogicalOperators = void 0;
4
- /**
5
- * The logical operators for a search criteria.
6
- * */
7
- var LogicalOperators;
8
- (function (LogicalOperators) {
9
- LogicalOperators["AND"] = "AND";
10
- LogicalOperators["OR"] = "OR";
11
- })(LogicalOperators || (exports.LogicalOperators = LogicalOperators = {}));
12
- /**
13
- * The comparison operators for a field criterion.
14
- * */
15
- var ComparisonOperators;
16
- (function (ComparisonOperators) {
17
- ComparisonOperators["EQUALS"] = "EQUALS";
18
- ComparisonOperators["NOT_EQUALS"] = "NOT_EQUALS";
19
- ComparisonOperators["GREATER_THAN"] = "GREATER_THAN";
20
- ComparisonOperators["GREATER_THAN_OR_EQUAL"] = "GREATER_THAN_OR_EQUAL";
21
- ComparisonOperators["LESS_THAN"] = "LESS_THAN";
22
- ComparisonOperators["LESS_THAN_OR_EQUAL"] = "LESS_THAN_OR_EQUAL";
23
- ComparisonOperators["IN"] = "IN";
24
- ComparisonOperators["NOT_IN"] = "NOT_IN";
25
- ComparisonOperators["LIKE"] = "LIKE";
26
- ComparisonOperators["NOT_LIKE"] = "NOT_LIKE";
27
- ComparisonOperators["EXISTS"] = "EXISTS";
28
- ComparisonOperators["NOT_EXISTS"] = "NOT_EXISTS";
29
- ComparisonOperators["IS_NOT_EMPTY"] = "IS_NOT_EMPTY";
30
- ComparisonOperators["IS_EMPTY"] = "IS_EMPTY";
31
- ComparisonOperators["BETWEEN"] = "BETWEEN";
32
- ComparisonOperators["NOT_BETWEEN"] = "NOT_BETWEEN";
33
- ComparisonOperators["CONTAINS"] = "CONTAINS";
34
- ComparisonOperators["NOT_CONTAINS"] = "NOT_CONTAINS";
35
- ComparisonOperators["STARTS_WITH"] = "STARTS_WITH";
36
- ComparisonOperators["ENDS_WITH"] = "ENDS_WITH";
37
- ComparisonOperators["DOES_NOT_START_WITH"] = "DOES_NOT_START_WITH";
38
- ComparisonOperators["DOES_NOT_END_WITH"] = "DOES_NOT_END_WITH";
39
- })(ComparisonOperators || (exports.ComparisonOperators = ComparisonOperators = {}));
@@ -1,22 +0,0 @@
1
- import { TypeInfoDataItem, TypeInfoMap } from "./TypeParsing/TypeInfo";
2
- import { ComparisonOperators, FieldCriterion, SearchCriteria, SortField } from "./SearchTypes";
3
- /**
4
- * Basic comparison operators for filtering data.
5
- * */
6
- export declare const COMPARATORS: Record<ComparisonOperators, (criterionValue: any, criterionValueOptions: any[] | undefined, fieldValue: any) => boolean>;
7
- /**
8
- * Compare a field criterion to a field value.
9
- * */
10
- export declare const compare: (fieldCriterion: FieldCriterion, fieldValue: any) => boolean;
11
- /**
12
- * Compare a field criterion to an array of field values.
13
- * */
14
- export declare const compareArray: (fieldCriterion: FieldCriterion, fieldValue: any[] | undefined) => boolean;
15
- /**
16
- * Get the filtered data items based on the search criteria.
17
- * */
18
- export declare const getFilterTypeInfoDataItemsBySearchCriteria: (searchCriteria: SearchCriteria, items: TypeInfoDataItem[], typeInfoName?: string, typeInfoMap?: TypeInfoMap) => TypeInfoDataItem[];
19
- /**
20
- * Get the sorted data items based on the given sort fields.
21
- * */
22
- export declare const getSortedItems: (sortFields?: SortField[], items?: TypeInfoDataItem[]) => TypeInfoDataItem[];
@@ -1,134 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSortedItems = exports.getFilterTypeInfoDataItemsBySearchCriteria = exports.compareArray = exports.compare = exports.COMPARATORS = void 0;
4
- const SearchTypes_1 = require("./SearchTypes");
5
- /**
6
- * Basic comparison operators for filtering data.
7
- * */
8
- exports.COMPARATORS = {
9
- [SearchTypes_1.ComparisonOperators.EQUALS]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue === criterionValue,
10
- [SearchTypes_1.ComparisonOperators.NOT_EQUALS]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue !== criterionValue,
11
- [SearchTypes_1.ComparisonOperators.GREATER_THAN]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue > criterionValue,
12
- [SearchTypes_1.ComparisonOperators.GREATER_THAN_OR_EQUAL]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue >= criterionValue,
13
- [SearchTypes_1.ComparisonOperators.LESS_THAN]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue < criterionValue,
14
- [SearchTypes_1.ComparisonOperators.LESS_THAN_OR_EQUAL]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue <= criterionValue,
15
- [SearchTypes_1.ComparisonOperators.IN]: (criterionValue, criterionValueOptions, fieldValue) => Array.isArray(criterionValueOptions) &&
16
- criterionValueOptions.includes(fieldValue),
17
- [SearchTypes_1.ComparisonOperators.NOT_IN]: (criterionValue, criterionValueOptions, fieldValue) => !Array.isArray(criterionValueOptions) ||
18
- !criterionValueOptions.includes(fieldValue),
19
- [SearchTypes_1.ComparisonOperators.LIKE]: (criterionValue, criterionValueOptions, fieldValue) => `${fieldValue}`.includes(`${criterionValue}`),
20
- [SearchTypes_1.ComparisonOperators.NOT_LIKE]: (criterionValue, criterionValueOptions, fieldValue) => !`${fieldValue}`.includes(`${criterionValue}`),
21
- [SearchTypes_1.ComparisonOperators.EXISTS]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue !== undefined && fieldValue !== null,
22
- [SearchTypes_1.ComparisonOperators.NOT_EXISTS]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue === undefined || fieldValue === null,
23
- [SearchTypes_1.ComparisonOperators.IS_NOT_EMPTY]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue !== undefined && fieldValue !== null && fieldValue !== "",
24
- [SearchTypes_1.ComparisonOperators.IS_EMPTY]: (criterionValue, criterionValueOptions, fieldValue) => fieldValue === undefined || fieldValue === null || fieldValue === "",
25
- [SearchTypes_1.ComparisonOperators.BETWEEN]: (criterionValue, criterionValueOptions, fieldValue) => Array.isArray(criterionValueOptions) &&
26
- fieldValue >= criterionValueOptions[0] &&
27
- fieldValue <= criterionValueOptions[1],
28
- [SearchTypes_1.ComparisonOperators.NOT_BETWEEN]: (criterionValue, criterionValueOptions, fieldValue) => !Array.isArray(criterionValueOptions) ||
29
- fieldValue < criterionValueOptions[0] ||
30
- fieldValue > criterionValueOptions[1],
31
- [SearchTypes_1.ComparisonOperators.CONTAINS]: (criterionValue, criterionValueOptions, fieldValue) => Array.isArray(fieldValue) && fieldValue.includes(criterionValue),
32
- [SearchTypes_1.ComparisonOperators.NOT_CONTAINS]: (criterionValue, criterionValueOptions, fieldValue) => !Array.isArray(fieldValue) || !fieldValue.includes(criterionValue),
33
- [SearchTypes_1.ComparisonOperators.STARTS_WITH]: (criterionValue, criterionValueOptions, fieldValue) => `${fieldValue}`.startsWith(`${criterionValue}`),
34
- [SearchTypes_1.ComparisonOperators.ENDS_WITH]: (criterionValue, criterionValueOptions, fieldValue) => `${fieldValue}`.endsWith(`${criterionValue}`),
35
- [SearchTypes_1.ComparisonOperators.DOES_NOT_START_WITH]: (criterionValue, criterionValueOptions, fieldValue) => !`${fieldValue}`.startsWith(`${criterionValue}`),
36
- [SearchTypes_1.ComparisonOperators.DOES_NOT_END_WITH]: (criterionValue, criterionValueOptions, fieldValue) => !`${fieldValue}`.endsWith(`${criterionValue}`),
37
- };
38
- /**
39
- * Compare a field criterion to a field value.
40
- * */
41
- const compare = (fieldCriterion, fieldValue) => {
42
- const { operator, value: criterionValue, valueOptions: criterionValueOptions, } = fieldCriterion;
43
- const comparator = operator ? exports.COMPARATORS[operator] : undefined;
44
- if (comparator) {
45
- return comparator(criterionValue, criterionValueOptions, fieldValue);
46
- }
47
- else {
48
- return false;
49
- }
50
- };
51
- exports.compare = compare;
52
- /**
53
- * Compare a field criterion to an array of field values.
54
- * */
55
- const compareArray = (fieldCriterion, fieldValue) => {
56
- if (Array.isArray(fieldValue)) {
57
- const { operator } = fieldCriterion;
58
- const isArrayOperator = operator === SearchTypes_1.ComparisonOperators.CONTAINS ||
59
- operator === SearchTypes_1.ComparisonOperators.NOT_CONTAINS;
60
- return isArrayOperator
61
- ? (0, exports.compare)(fieldCriterion, fieldValue)
62
- : fieldValue.some((value) => (0, exports.compare)(fieldCriterion, value));
63
- }
64
- else {
65
- return false;
66
- }
67
- };
68
- exports.compareArray = compareArray;
69
- /**
70
- * Get the filtered data items based on the search criteria.
71
- * */
72
- const getFilterTypeInfoDataItemsBySearchCriteria = (searchCriteria, items, typeInfoName, typeInfoMap) => {
73
- const { fields = {} } = typeInfoMap?.[typeInfoName] || {};
74
- const { logicalOperator = SearchTypes_1.LogicalOperators.AND, fieldCriteria = [] } = searchCriteria;
75
- const filteredItems = [];
76
- for (const currentItem of items) {
77
- if (typeof currentItem === "object" && currentItem !== null) {
78
- let meetsCriteria = true;
79
- for (const fieldCriterion of fieldCriteria) {
80
- const { fieldName } = fieldCriterion;
81
- const { array: isArrayType, typeReference } = fields[fieldName] || {};
82
- const currentFieldValue = currentItem[fieldName];
83
- if (!typeReference) {
84
- const result = isArrayType
85
- ? (0, exports.compareArray)(fieldCriterion, currentFieldValue)
86
- : (0, exports.compare)(fieldCriterion, currentFieldValue);
87
- if (logicalOperator === SearchTypes_1.LogicalOperators.AND) {
88
- meetsCriteria = result;
89
- if (!meetsCriteria) {
90
- break;
91
- }
92
- }
93
- else {
94
- meetsCriteria = meetsCriteria || result;
95
- if (meetsCriteria) {
96
- break;
97
- }
98
- }
99
- }
100
- }
101
- if (meetsCriteria) {
102
- filteredItems.push(currentItem);
103
- }
104
- }
105
- }
106
- return filteredItems;
107
- };
108
- exports.getFilterTypeInfoDataItemsBySearchCriteria = getFilterTypeInfoDataItemsBySearchCriteria;
109
- /**
110
- * Get the sorted data items based on the given sort fields.
111
- * */
112
- const getSortedItems = (sortFields = [], items = []) => {
113
- let newItems = [...items];
114
- if (sortFields.length > 0) {
115
- for (const sortF of sortFields) {
116
- const { field, reverse } = sortF;
117
- newItems = newItems.sort((a, b) => {
118
- const aValue = a[field];
119
- const bValue = b[field];
120
- if (aValue < bValue) {
121
- return reverse ? 1 : -1;
122
- }
123
- else if (aValue > bValue) {
124
- return reverse ? -1 : 1;
125
- }
126
- else {
127
- return 0;
128
- }
129
- });
130
- }
131
- }
132
- return newItems;
133
- };
134
- exports.getSortedItems = getSortedItems;
@@ -1,17 +0,0 @@
1
- import { FieldCriterion } from "./SearchTypes";
2
- import { CustomTypeInfoFieldValidatorMap, TypeInfoValidationResults } from "./TypeParsing/Validation";
3
- import { TypeInfoMap } from "./TypeParsing/TypeInfo";
4
- /**
5
- * Search validation errors.
6
- * */
7
- export declare const SEARCH_VALIDATION_ERRORS: {
8
- INVALID_TYPE_INFO: string;
9
- RELATIONAL_FIELDS_NOT_ALLOWED: string;
10
- INVALID_FIELD: string;
11
- INVALID_VALUE_OPTION: string;
12
- INVALID_OPERATOR: string;
13
- };
14
- /**
15
- * Validate search fields against type info fields.
16
- * */
17
- export declare const validateSearchFields: (typeInfoName: string, typeInfoMap: TypeInfoMap, searchFields?: FieldCriterion[], disallowRelationalFields?: boolean, customValidators?: CustomTypeInfoFieldValidatorMap) => TypeInfoValidationResults;