@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
package/app/index.js ADDED
@@ -0,0 +1,810 @@
1
+ import { createContext, useContext, useRef, useMemo, useCallback, useState, useEffect } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import styled from 'styled-components';
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/app/utils/index.ts
12
+ var utils_exports = {};
13
+ __export(utils_exports, {
14
+ ApplicationStateContext: () => ApplicationStateContext,
15
+ ApplicationStateProvider: () => ApplicationStateProvider,
16
+ Route: () => Route,
17
+ RouteContext: () => RouteContext,
18
+ RouteContextConsumer: () => RouteContextConsumer,
19
+ RouteContextProvider: () => RouteContextProvider,
20
+ TypeInfoORMClient: () => TypeInfoORMClient,
21
+ getApplicationStateIdentifier: () => getApplicationStateIdentifier,
22
+ getApplicationStateModified: () => getApplicationStateModified,
23
+ getApplicationStateValue: () => getApplicationStateValue,
24
+ getApplicationStateValueStructure: () => getApplicationStateValueStructure,
25
+ getChangedDependencyIndexes: () => getChangedDependencyIndexes,
26
+ getEasyLayout: () => getEasyLayout,
27
+ getEasyLayoutTemplateDetails: () => getEasyLayoutTemplateDetails,
28
+ getFullUrl: () => getFullUrl,
29
+ getPascalCaseAreaName: () => getPascalCaseAreaName,
30
+ handleRequest: () => handleRequest,
31
+ requestHandlerFactory: () => requestHandlerFactory,
32
+ sendServiceRequest: () => sendServiceRequest,
33
+ setApplicationStateModified: () => setApplicationStateModified,
34
+ setApplicationStateValue: () => setApplicationStateValue,
35
+ useApplicationStateLoader: () => useApplicationStateLoader,
36
+ useApplicationStateValue: () => useApplicationStateValue,
37
+ useApplicationStateValueStructure: () => useApplicationStateValueStructure,
38
+ useController: () => useController,
39
+ useDebugDependencies: () => useDebugDependencies,
40
+ useRouteContext: () => useRouteContext,
41
+ useTypeInfoORMAPI: () => useTypeInfoORMAPI
42
+ });
43
+ var getApplicationStateIdentifier = (subStateIdMap) => subStateIdMap ? subStateIdMap : {};
44
+ var getApplicationStateModified = (identifier, modificationState) => !!modificationState.get(identifier);
45
+ var getApplicationStateValue = (identifier, applicationState) => applicationState.get(identifier);
46
+ var setApplicationStateModified = (identifier, value, modificationState) => new Map(modificationState).set(identifier, value);
47
+ var setApplicationStateValue = (identifier, value, applicationState) => new Map(applicationState).set(identifier, value);
48
+ var getApplicationStateValueStructure = (idStructure, applicationState) => Object.keys(idStructure).reduce(
49
+ (acc, k) => ({
50
+ ...acc,
51
+ [k]: getApplicationStateValue(idStructure[k], applicationState)
52
+ }),
53
+ {}
54
+ );
55
+ var ApplicationStateContext = createContext({
56
+ modified: /* @__PURE__ */ new Map(),
57
+ value: /* @__PURE__ */ new Map(),
58
+ onChange: () => {
59
+ },
60
+ setModified: () => {
61
+ }
62
+ });
63
+ var { Provider } = ApplicationStateContext;
64
+ var useApplicationStateValue = (identifier) => {
65
+ const {
66
+ modified: modificationState,
67
+ value: applicationState,
68
+ onChange: setApplicationState,
69
+ setModified: setModificationState
70
+ } = useContext(ApplicationStateContext);
71
+ const appStateRef = useRef(applicationState);
72
+ appStateRef.current = applicationState;
73
+ const modified = useMemo(
74
+ () => getApplicationStateModified(identifier, modificationState),
75
+ [identifier, modificationState]
76
+ );
77
+ const value = useMemo(
78
+ () => getApplicationStateValue(identifier, applicationState),
79
+ [identifier, applicationState]
80
+ );
81
+ const setModified = useCallback(
82
+ (isModified) => {
83
+ setModificationState(
84
+ setApplicationStateModified(identifier, isModified, modificationState)
85
+ );
86
+ },
87
+ [identifier, setModificationState]
88
+ );
89
+ const onChange = useCallback(
90
+ (newValue) => {
91
+ setApplicationState(
92
+ setApplicationStateValue(identifier, newValue, appStateRef.current)
93
+ );
94
+ setModified(true);
95
+ },
96
+ [identifier, setApplicationState]
97
+ );
98
+ const controller = useMemo(
99
+ () => ({
100
+ modified,
101
+ value,
102
+ onChange,
103
+ setModified
104
+ }),
105
+ [modified, onChange, setModified, value]
106
+ );
107
+ return controller;
108
+ };
109
+ var useApplicationStateValueStructure = (idStructure) => {
110
+ const { value: applicationState, onChange: setApplicationState } = useContext(
111
+ ApplicationStateContext
112
+ );
113
+ const valueStructure = useMemo(
114
+ () => getApplicationStateValueStructure(idStructure, applicationState),
115
+ [applicationState, idStructure]
116
+ );
117
+ const onChangeStructure = useMemo(
118
+ () => Object.keys(idStructure).reduce(
119
+ (acc, k) => ({
120
+ ...acc,
121
+ [k]: (newValue) => {
122
+ setApplicationState(
123
+ setApplicationStateValue(
124
+ idStructure[k],
125
+ newValue,
126
+ applicationState
127
+ )
128
+ );
129
+ }
130
+ }),
131
+ {}
132
+ ),
133
+ [applicationState, idStructure, setApplicationState]
134
+ );
135
+ const controller = useMemo(
136
+ () => ({
137
+ valueStructure,
138
+ onChangeStructure
139
+ }),
140
+ [onChangeStructure, valueStructure]
141
+ );
142
+ return controller;
143
+ };
144
+ var ApplicationStateProvider = ({
145
+ children
146
+ }) => {
147
+ const [modified, setModified] = useState(
148
+ /* @__PURE__ */ new Map()
149
+ );
150
+ const [value, setValue] = useState(/* @__PURE__ */ new Map());
151
+ const controller = useMemo(
152
+ () => ({
153
+ modified,
154
+ value,
155
+ onChange: setValue,
156
+ setModified
157
+ }),
158
+ [modified, value]
159
+ );
160
+ return /* @__PURE__ */ jsx(Provider, { value: controller, children });
161
+ };
162
+
163
+ // src/common/Routing.ts
164
+ var PATH_DELIMITER = "/";
165
+ var getPotentialJSONValue = (value) => {
166
+ try {
167
+ return JSON.parse(value);
168
+ } catch (error) {
169
+ return value;
170
+ }
171
+ };
172
+ 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);
173
+ 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);
174
+ var mergeStringPaths = (path1, path2, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriEncodeParts = false) => getPathString(
175
+ [
176
+ ...getPathArray(
177
+ path1,
178
+ delimiter,
179
+ filterEmptyOutput,
180
+ filterEmptyInput,
181
+ useJson,
182
+ uriEncodeParts
183
+ ),
184
+ ...getPathArray(
185
+ path2,
186
+ delimiter,
187
+ filterEmptyOutput,
188
+ filterEmptyInput,
189
+ useJson,
190
+ uriEncodeParts
191
+ )
192
+ ],
193
+ delimiter,
194
+ filterEmptyInput,
195
+ useJson,
196
+ uriEncodeParts
197
+ );
198
+ var resolvePath = (currentPath, newPath) => {
199
+ const newSegments = getPathArray(newPath, PATH_DELIMITER, true);
200
+ let currentSegments = getPathArray(currentPath, PATH_DELIMITER, true);
201
+ if (newPath.startsWith("/")) {
202
+ currentSegments = [];
203
+ }
204
+ newSegments.forEach((segment) => {
205
+ if (segment === "..") {
206
+ if (currentSegments.length > 0) {
207
+ currentSegments.pop();
208
+ }
209
+ } else if (segment !== ".") {
210
+ currentSegments.push(segment);
211
+ }
212
+ });
213
+ return "/" + currentSegments.join("/");
214
+ };
215
+ var getParamsAndTestPath = (path, testPath, exact = false) => {
216
+ const pathList = getPathArray(path);
217
+ const testPathList = getPathArray(testPath);
218
+ if (exact && pathList.length !== testPathList.length) {
219
+ return false;
220
+ } else {
221
+ let params = {};
222
+ if (pathList.length >= testPathList.length) {
223
+ for (let i = 0; i < testPathList.length; i++) {
224
+ const testPathPart = testPathList[i];
225
+ const pathPart = pathList[i];
226
+ if (testPathPart.startsWith(":")) {
227
+ const paramName = testPathPart.slice(1);
228
+ params[paramName] = pathPart;
229
+ } else if (pathPart !== testPathPart) {
230
+ return false;
231
+ }
232
+ }
233
+ } else {
234
+ return false;
235
+ }
236
+ return params;
237
+ }
238
+ };
239
+
240
+ // src/app/utils/Service.ts
241
+ var getFullUrl = (protocol, domain, basePath = "", path = "", port) => {
242
+ const portString = !!port ? `:${port}` : "";
243
+ const fullPath = mergeStringPaths(
244
+ basePath,
245
+ path,
246
+ PATH_DELIMITER,
247
+ false,
248
+ false,
249
+ false
250
+ );
251
+ return `${protocol}://${domain}${portString}${fullPath}`;
252
+ };
253
+ var sendServiceRequest = async (config, path = "", args = []) => {
254
+ const { protocol, domain, port, basePath = "", authorization = "" } = config;
255
+ const fullUrl = getFullUrl(protocol, domain, basePath, path, port);
256
+ const requestHeaders = !!authorization ? {
257
+ Authorization: `Bearer ${authorization}`
258
+ } : void 0;
259
+ const response = await fetch(fullUrl, {
260
+ headers: requestHeaders,
261
+ credentials: "same-origin",
262
+ method: "POST",
263
+ body: JSON.stringify(args)
264
+ });
265
+ const { ok: responseIsOk } = response;
266
+ const data = await response.json();
267
+ if (responseIsOk) {
268
+ return data;
269
+ } else {
270
+ throw data;
271
+ }
272
+ };
273
+ var useApplicationStateLoader = (config) => {
274
+ const {
275
+ identifier,
276
+ remoteProcedureCall,
277
+ resetOnError = false,
278
+ onLoadComplete,
279
+ manual = false
280
+ } = config;
281
+ const { args = [] } = remoteProcedureCall;
282
+ const argsRef = useRef(args);
283
+ argsRef.current = args;
284
+ const [cacheValidity, setCacheValidity] = useState({});
285
+ const [loading, setLoading] = useState(false);
286
+ const [latestError, setLatestError] = useState();
287
+ const { onChange, setModified } = useApplicationStateValue(identifier);
288
+ const invalidate = useCallback(() => {
289
+ setCacheValidity({});
290
+ }, []);
291
+ const makeRemoteProcedureCall = useCallback(
292
+ async (...directArgs) => {
293
+ let success;
294
+ setLoading(true);
295
+ setLatestError(void 0);
296
+ try {
297
+ const { serviceConfig, path } = remoteProcedureCall;
298
+ const result = await sendServiceRequest(
299
+ serviceConfig,
300
+ path,
301
+ directArgs
302
+ );
303
+ success = true;
304
+ onChange(result);
305
+ setModified(false);
306
+ } catch (error) {
307
+ success = false;
308
+ setLatestError(error);
309
+ if (resetOnError) {
310
+ onChange(void 0);
311
+ setModified(false);
312
+ }
313
+ }
314
+ setLoading(false);
315
+ onLoadComplete?.(success);
316
+ },
317
+ [remoteProcedureCall, onChange, setModified, resetOnError, onLoadComplete]
318
+ );
319
+ const appStateLoader = useMemo(
320
+ () => ({
321
+ loading,
322
+ latestError,
323
+ invalidate,
324
+ makeRemoteProcedureCall
325
+ }),
326
+ [loading, latestError, invalidate, makeRemoteProcedureCall]
327
+ );
328
+ useEffect(() => {
329
+ if (!manual && argsRef.current) {
330
+ makeRemoteProcedureCall(...argsRef.current);
331
+ }
332
+ }, [cacheValidity, manual, makeRemoteProcedureCall]);
333
+ return appStateLoader;
334
+ };
335
+ var getKeyValueWithoutError = (obj, key) => {
336
+ try {
337
+ return obj[key];
338
+ } catch (e) {
339
+ return void 0;
340
+ }
341
+ };
342
+ var useController = (parentValue, key, onParentValueChange, isArrayIndex = false) => {
343
+ const [value, setValue] = useState(getKeyValueWithoutError(parentValue, key));
344
+ const onChange = useCallback(
345
+ (value2) => {
346
+ try {
347
+ setValue(value2);
348
+ if (isArrayIndex) {
349
+ const newArray = [...parentValue];
350
+ newArray[key] = value2;
351
+ onParentValueChange(newArray);
352
+ } else {
353
+ onParentValueChange({
354
+ ...parentValue,
355
+ [key]: value2
356
+ });
357
+ }
358
+ } catch (e) {
359
+ }
360
+ },
361
+ [parentValue, key, onParentValueChange, isArrayIndex]
362
+ );
363
+ useEffect(() => {
364
+ try {
365
+ setValue(getKeyValueWithoutError(parentValue, key));
366
+ } catch (e) {
367
+ setValue(void 0);
368
+ }
369
+ }, [parentValue, key]);
370
+ return [value, onChange];
371
+ };
372
+ var getChangedDependencyIndexes = (prevDeps, nextDeps) => nextDeps.map((dep, i) => dep !== prevDeps[i] ? i : null).filter((dep) => dep !== null);
373
+ var useDebugDependencies = (dependencies) => {
374
+ const firstRender = useRef(true);
375
+ const prevDeps = useRef(dependencies);
376
+ useEffect(() => {
377
+ if (firstRender.current) {
378
+ firstRender.current = false;
379
+ return;
380
+ }
381
+ const changedDeps = getChangedDependencyIndexes(
382
+ prevDeps.current,
383
+ dependencies
384
+ );
385
+ if (changedDeps.length > 0) {
386
+ console.log("Changed dependencies:", changedDeps);
387
+ }
388
+ prevDeps.current = dependencies;
389
+ }, dependencies);
390
+ };
391
+ var getPascalCaseAreaName = (area) => {
392
+ return area.split("-").map((a) => a[0].toUpperCase() + a.slice(1)).join("");
393
+ };
394
+ var convertLayoutToCSS = (layout = "") => {
395
+ const lines = layout.split("\n");
396
+ let areaRows = [];
397
+ let rows = [];
398
+ let css = "";
399
+ for (let i = 0; i < lines.length; i++) {
400
+ const line = lines[i].trim();
401
+ if (line.indexOf("\\") === 0) {
402
+ css += `
403
+ grid-template-columns: ${line.split("\\").join("").trim()};`;
404
+ } else {
405
+ const parts = line.split(",").map((p) => p && p.trim());
406
+ if (parts[0]) {
407
+ areaRows = [...areaRows, parts[0]];
408
+ if (parts[1]) {
409
+ rows = [...rows, parts[1]];
410
+ }
411
+ }
412
+ }
413
+ }
414
+ css += `
415
+ grid-template-areas:
416
+ ${areaRows.filter((a) => !!(a && a.trim())).map((a) => ` "${a}"`).join("\n")};`;
417
+ if (rows.length) {
418
+ css += `
419
+ grid-template-rows: ${rows.filter((r) => !!(r && r.trim())).join(" ")};`;
420
+ }
421
+ const areasList = Object.keys(
422
+ areaRows.reduce(
423
+ (acc, a) => [
424
+ ...acc,
425
+ ...a.split(" ").map((a2) => a2 && a2.trim()).filter((a2) => !!a2)
426
+ ],
427
+ []
428
+ ).reduce((acc, a) => ({ ...acc, [a]: true }), {})
429
+ );
430
+ return {
431
+ areasList,
432
+ css
433
+ };
434
+ };
435
+ var getEasyLayoutTemplateDetails = (layout = "") => convertLayoutToCSS(layout);
436
+ var getEasyLayout = (extendFrom, areasExtendFrom) => {
437
+ return (layoutTemplate, ...expressions) => {
438
+ const mergedTemplate = layoutTemplate.reduce((acc, l, ind) => {
439
+ const expr = expressions[ind - 1];
440
+ const exprStr = typeof expr === "undefined" ? "" : expr;
441
+ return `${acc}${l}${exprStr}`;
442
+ }, "");
443
+ const { areasList, css } = convertLayoutToCSS(mergedTemplate);
444
+ const baseLayoutComp = extendFrom ? styled(extendFrom) : styled.div;
445
+ const layout = baseLayoutComp`
446
+ display: grid;
447
+ ${css}
448
+ `;
449
+ const areas = areasList.reduce((acc, area) => {
450
+ const pascalCaseAreaName = getPascalCaseAreaName(area);
451
+ const baseCompFunc = areasExtendFrom ? styled(areasExtendFrom) : styled.div;
452
+ const component = baseCompFunc`
453
+ grid-area: ${area};
454
+ `;
455
+ return {
456
+ ...acc,
457
+ [pascalCaseAreaName]: component
458
+ };
459
+ }, {});
460
+ return {
461
+ layout,
462
+ areas
463
+ };
464
+ };
465
+ };
466
+ (function(history2) {
467
+ const pushState = history2.pushState;
468
+ history2.pushState = function(state, ...remainingArguments) {
469
+ if (typeof history2.onpushstate == "function") {
470
+ history2.onpushstate({ state });
471
+ }
472
+ const result = pushState.apply(history2, [state, ...remainingArguments]);
473
+ window.dispatchEvent(new CustomEvent("statechanged", { detail: state }));
474
+ return result;
475
+ };
476
+ })(window.history);
477
+ var CURRENT_PATH = window.location.pathname;
478
+ var RouteContext = createContext({
479
+ currentWindowPath: CURRENT_PATH,
480
+ parentPath: "",
481
+ params: {},
482
+ isTopLevel: true
483
+ });
484
+ var {
485
+ /**
486
+ * @ignore
487
+ * */
488
+ Provider: RouteContextProvider,
489
+ /**
490
+ * @ignore
491
+ * */
492
+ Consumer: RouteContextConsumer
493
+ } = RouteContext;
494
+ var useRouteContext = () => useContext(RouteContext);
495
+ var Route = ({
496
+ /**
497
+ * Use `:` as the first character to denote a parameter in the path.
498
+ * */
499
+ path = "",
500
+ onParamsChange,
501
+ exact = false,
502
+ children
503
+ }) => {
504
+ const [currentPath = "", setCurrentPath] = useState(CURRENT_PATH);
505
+ const {
506
+ currentWindowPath = "",
507
+ parentPath = "",
508
+ params: parentParams = {},
509
+ isTopLevel
510
+ } = useRouteContext();
511
+ const targetCurrentPath = useMemo(
512
+ () => isTopLevel ? currentPath : currentWindowPath,
513
+ [isTopLevel, currentPath, currentWindowPath]
514
+ );
515
+ const fullPath = useMemo(
516
+ () => mergeStringPaths(parentPath, path),
517
+ [parentPath, path]
518
+ );
519
+ const newParams = useMemo(
520
+ () => getParamsAndTestPath(targetCurrentPath, fullPath, exact),
521
+ [targetCurrentPath, fullPath, exact]
522
+ );
523
+ const params = useMemo(
524
+ () => ({
525
+ ...parentParams,
526
+ ...newParams ? newParams : {}
527
+ }),
528
+ [parentParams, newParams]
529
+ );
530
+ const newRouteContext = useMemo(
531
+ () => ({
532
+ currentWindowPath: targetCurrentPath,
533
+ parentPath: fullPath,
534
+ params,
535
+ isTopLevel: false
536
+ }),
537
+ [targetCurrentPath, fullPath, params]
538
+ );
539
+ useEffect(() => {
540
+ if (onParamsChange) {
541
+ onParamsChange(params);
542
+ }
543
+ }, [params, onParamsChange]);
544
+ useEffect(() => {
545
+ if (isTopLevel) {
546
+ const handleAnchorClick = (event) => {
547
+ let target = event.target;
548
+ while (target && target.nodeName !== "A") {
549
+ target = target.parentNode;
550
+ }
551
+ if (target && target.nodeName === "A") {
552
+ const aTarget = target;
553
+ const href = aTarget.getAttribute("href");
554
+ const title = aTarget.getAttribute("title") ?? "";
555
+ try {
556
+ new URL(href ? href : "");
557
+ } catch (error) {
558
+ const newPath = resolvePath(
559
+ window.location.pathname,
560
+ href ? href : ""
561
+ );
562
+ event.preventDefault();
563
+ history.pushState({}, title, newPath);
564
+ setCurrentPath(newPath);
565
+ }
566
+ }
567
+ };
568
+ const handlePopOrReplaceState = () => {
569
+ setCurrentPath(window.location.pathname);
570
+ };
571
+ window.document.addEventListener("click", handleAnchorClick);
572
+ window.addEventListener("popstate", handlePopOrReplaceState);
573
+ window.addEventListener("statechanged", handlePopOrReplaceState);
574
+ return () => {
575
+ window.document.removeEventListener("click", handleAnchorClick);
576
+ window.removeEventListener("popstate", handlePopOrReplaceState);
577
+ window.removeEventListener("statechanged", handlePopOrReplaceState);
578
+ };
579
+ }
580
+ }, [isTopLevel]);
581
+ return newParams ? /* @__PURE__ */ jsx(RouteContextProvider, { value: newRouteContext, children }) : null;
582
+ };
583
+
584
+ // src/common/IdGeneration/getSimpleId.ts
585
+ var LAST_HAST_ID = 0;
586
+ var getBase64EncodedString = (input) => Buffer.from(input).toString("base64");
587
+ var getSimpleId = () => {
588
+ const hashId = LAST_HAST_ID++;
589
+ const base64Datetime = getBase64EncodedString(
590
+ (/* @__PURE__ */ new Date()).toISOString()
591
+ );
592
+ const rand1 = Math.random().toString(36).substring(2, 15);
593
+ const rand2 = Math.random().toString(36).substring(2, 15);
594
+ return `${hashId}-${base64Datetime}-${rand1}-${rand2}`;
595
+ };
596
+
597
+ // src/app/utils/TypeInfoORMAPIUtils.ts
598
+ var handleRequest = async (requestId, args, typeInfoORMAPI, methodName, onRequestStateChange) => {
599
+ onRequestStateChange(methodName, requestId, { loading: true });
600
+ try {
601
+ const requestMethod = typeInfoORMAPI[methodName];
602
+ const result = await requestMethod(...args);
603
+ onRequestStateChange(methodName, requestId, {
604
+ loading: false,
605
+ data: result
606
+ });
607
+ } catch (error) {
608
+ onRequestStateChange(methodName, requestId, {
609
+ loading: false,
610
+ error: typeof error === "object" && error !== null && "message" in error ? error.message : void 0
611
+ });
612
+ }
613
+ };
614
+ var requestHandlerFactory = (typeInfoORMAPI, methodName, onRequestStateChange) => (...args) => {
615
+ const requestId = getSimpleId();
616
+ handleRequest(
617
+ requestId,
618
+ args,
619
+ typeInfoORMAPI,
620
+ methodName,
621
+ onRequestStateChange
622
+ );
623
+ return requestId;
624
+ };
625
+ var useTypeInfoORMAPI = (typeInfoORMAPI) => {
626
+ const [state, setState] = useState({});
627
+ const onRequestStateChange = useCallback(
628
+ (methodName, requestId, { loading, data, error }) => {
629
+ setState(
630
+ ({
631
+ [methodName]: {
632
+ activeRequests: prevActiveRequests = [],
633
+ data: prevData,
634
+ error: prevError
635
+ } = {},
636
+ ...prevState
637
+ }) => {
638
+ const newActiveRequests = loading ? [...prevActiveRequests, requestId] : prevActiveRequests.filter((id) => id !== requestId);
639
+ const currentlyLoading = newActiveRequests.length > 0;
640
+ return {
641
+ ...prevState,
642
+ [methodName]: {
643
+ activeRequests: newActiveRequests,
644
+ loading: currentlyLoading,
645
+ data: currentlyLoading ? void 0 : data ?? prevData,
646
+ error: currentlyLoading ? void 0 : error ?? prevError
647
+ }
648
+ };
649
+ }
650
+ );
651
+ },
652
+ []
653
+ );
654
+ const api = useMemo(() => {
655
+ const apiBase = {};
656
+ for (const aM in typeInfoORMAPI) {
657
+ const methodName = aM;
658
+ apiBase[methodName] = requestHandlerFactory(
659
+ typeInfoORMAPI,
660
+ methodName,
661
+ onRequestStateChange
662
+ );
663
+ }
664
+ return apiBase;
665
+ }, [typeInfoORMAPI, onRequestStateChange]);
666
+ return {
667
+ state,
668
+ api
669
+ };
670
+ };
671
+
672
+ // src/app/utils/TypeInfoORMClient.ts
673
+ var TypeInfoORMClient = class {
674
+ /**
675
+ * Create a client for TypeInfoORM routes.
676
+ *
677
+ * @param config - Service configuration for the API routes.
678
+ */
679
+ constructor(config) {
680
+ this.config = config;
681
+ }
682
+ /**
683
+ * Dispatch a request to the configured service.
684
+ *
685
+ * @param path - Route path for the ORM method.
686
+ * @param args - Arguments to send in the request body.
687
+ * @returns Parsed response payload.
688
+ */
689
+ makeRequest = async (path, args) => {
690
+ const result = await sendServiceRequest(this.config, path, args);
691
+ return result;
692
+ };
693
+ /**
694
+ * Create an item of the provided type.
695
+ *
696
+ * @param typeName - TypeInfo type name.
697
+ * @param item - Item payload to persist.
698
+ * @returns The created item result.
699
+ */
700
+ create = async (typeName, item) => {
701
+ return await this.makeRequest("create" /* CREATE */, [
702
+ typeName,
703
+ item
704
+ ]);
705
+ };
706
+ /**
707
+ * Read an item by its primary field value.
708
+ *
709
+ * @param typeName - TypeInfo type name.
710
+ * @param primaryFieldValue - Primary field value to lookup.
711
+ * @returns The retrieved item, if found.
712
+ */
713
+ read = async (typeName, primaryFieldValue) => {
714
+ return await this.makeRequest("read" /* READ */, [
715
+ typeName,
716
+ primaryFieldValue
717
+ ]);
718
+ };
719
+ /**
720
+ * Update an item by replacing it with the provided payload.
721
+ *
722
+ * @param typeName - TypeInfo type name.
723
+ * @param item - Updated item payload.
724
+ * @returns Whether the update succeeded.
725
+ */
726
+ update = async (typeName, item) => {
727
+ return await this.makeRequest("update" /* UPDATE */, [
728
+ typeName,
729
+ item
730
+ ]);
731
+ };
732
+ /**
733
+ * Delete an item by its primary field value.
734
+ *
735
+ * @param typeName - TypeInfo type name.
736
+ * @param primaryFieldValue - Primary field value to delete.
737
+ * @returns Whether the delete succeeded.
738
+ */
739
+ delete = async (typeName, primaryFieldValue) => {
740
+ return await this.makeRequest("delete" /* DELETE */, [
741
+ typeName,
742
+ primaryFieldValue
743
+ ]);
744
+ };
745
+ /**
746
+ * List items for a given type.
747
+ *
748
+ * @param typeName - TypeInfo type name.
749
+ * @param config - List configuration including filters and paging.
750
+ * @param selectedFields - Optional fields to project.
751
+ * @returns List results for the query.
752
+ */
753
+ list = async (typeName, config, selectedFields) => {
754
+ return await this.makeRequest("list" /* LIST */, [
755
+ typeName,
756
+ config,
757
+ selectedFields
758
+ ]);
759
+ };
760
+ /**
761
+ * Create a relationship between items.
762
+ *
763
+ * @param relationshipItem - Relationship payload.
764
+ * @returns Whether the relationship was created.
765
+ */
766
+ createRelationship = async (relationshipItem) => {
767
+ return await this.makeRequest(
768
+ "create-relationship" /* CREATE_RELATIONSHIP */,
769
+ [relationshipItem]
770
+ );
771
+ };
772
+ /**
773
+ * Delete a relationship between items.
774
+ *
775
+ * @param relationshipItem - Relationship payload.
776
+ * @returns Results describing the deletion.
777
+ */
778
+ deleteRelationship = async (relationshipItem) => {
779
+ return await this.makeRequest(
780
+ "delete-relationship" /* DELETE_RELATIONSHIP */,
781
+ [relationshipItem]
782
+ );
783
+ };
784
+ /**
785
+ * List relationship records matching the query.
786
+ *
787
+ * @param config - Relationship list query configuration.
788
+ * @returns Relationship list results.
789
+ */
790
+ listRelationships = async (config) => {
791
+ return await this.makeRequest("list-relationships" /* LIST_RELATIONSHIPS */, [
792
+ config
793
+ ]);
794
+ };
795
+ /**
796
+ * List related items for a relationship query.
797
+ *
798
+ * @param config - Relationship list query configuration.
799
+ * @param selectedFields - Optional fields to project on related items.
800
+ * @returns Related item list results.
801
+ */
802
+ listRelatedItems = async (config, selectedFields) => {
803
+ return await this.makeRequest("list-related-items" /* LIST_RELATED_ITEMS */, [
804
+ config,
805
+ selectedFields
806
+ ]);
807
+ };
808
+ };
809
+
810
+ export { utils_exports as Utils };