xmlui 0.9.23 → 0.9.30

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 (113) hide show
  1. package/dist/lib/apiInterceptorWorker-D8UVXhKa.mjs +818 -0
  2. package/dist/{index-B8C8yAZL.mjs → lib/index-BF7GNHsi.mjs} +12083 -3320
  3. package/dist/{style.css → lib/index.css} +7587 -5788
  4. package/dist/lib/language-server-web-worker.d.ts +655 -0
  5. package/dist/{language-server-web-worker.mjs → lib/language-server-web-worker.mjs} +1 -1
  6. package/dist/lib/language-server.d.ts +657 -0
  7. package/dist/{language-server.mjs → lib/language-server.mjs} +1 -1
  8. package/dist/lib/lint-CYAUfk0_.mjs +168 -0
  9. package/dist/lib/metadata-utils-CCIMqe69.mjs +466 -0
  10. package/dist/{server-common-DW5h7Q34.mjs → lib/server-common-B0FCNpIT.mjs} +4427 -1758
  11. package/dist/{lint-EcgF-9Wr.mjs → lib/transform-DC0Gy6qw.mjs} +1246 -540
  12. package/dist/{xmlui-parser.d.ts → lib/xmlui-parser.d.ts} +682 -4
  13. package/dist/{xmlui-parser.mjs → lib/xmlui-parser.mjs} +49 -48
  14. package/dist/{xmlui.d.ts → lib/xmlui.d.ts} +641 -1
  15. package/dist/{xmlui.mjs → lib/xmlui.mjs} +10 -10
  16. package/dist/{index.css → metadata/style.css} +6657 -6948
  17. package/dist/{xmlui-metadata.mjs → metadata/xmlui-metadata.mjs} +2703 -2553
  18. package/dist/{xmlui-metadata.umd.js → metadata/xmlui-metadata.umd.js} +2705 -2555
  19. package/dist/scripts/package.json +245 -0
  20. package/dist/scripts/src/components/App/App.js +0 -2
  21. package/dist/scripts/src/components/App/AppNative.js +22 -12
  22. package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
  23. package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +4 -5
  24. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -2
  25. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +13 -10
  26. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +7 -3
  27. package/dist/scripts/src/components/CodeBlock/CodeBlock.js +35 -0
  28. package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +101 -0
  29. package/dist/scripts/src/components/CodeBlock/highlight-code.js +203 -0
  30. package/dist/scripts/src/components/ComponentProvider.js +5 -0
  31. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +1 -0
  32. package/dist/scripts/src/components/Footer/FooterNative.js +2 -1
  33. package/dist/scripts/src/components/Form/FormNative.js +34 -18
  34. package/dist/scripts/src/components/FormItem/FormItem.js +5 -2
  35. package/dist/scripts/src/components/FormItem/FormItemNative.js +3 -3
  36. package/dist/scripts/src/components/Heading/Heading.js +16 -0
  37. package/dist/scripts/src/components/Heading/HeadingNative.js +2 -2
  38. package/dist/scripts/src/components/HtmlTags/HtmlTags.js +11 -7
  39. package/dist/scripts/src/components/Icon/DarkToLightIcon.js +10 -0
  40. package/dist/scripts/src/components/Icon/LightToDark.js +10 -0
  41. package/dist/scripts/src/components/IconProvider.js +4 -0
  42. package/dist/scripts/src/components/Image/ImageNative.js +1 -1
  43. package/dist/scripts/src/components/Link/Link.js +5 -5
  44. package/dist/scripts/src/components/List/ListNative.js +1 -1
  45. package/dist/scripts/src/components/Markdown/Markdown.js +56 -16
  46. package/dist/scripts/src/components/Markdown/MarkdownNative.js +73 -80
  47. package/dist/scripts/src/components/Markdown/highlight-code.js +160 -0
  48. package/dist/scripts/src/components/Markdown/parse-binding-expr.js +60 -0
  49. package/dist/scripts/src/components/Markdown/utils.js +282 -0
  50. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
  51. package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
  52. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +2 -2
  53. package/dist/scripts/src/components/NestedApp/NestedApp.js +61 -0
  54. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +125 -0
  55. package/dist/scripts/src/components/NestedApp/Tooltip.js +46 -0
  56. package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -1
  57. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
  58. package/dist/scripts/src/components/Option/Option.js +3 -2
  59. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +2 -1
  60. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +17 -1
  61. package/dist/scripts/src/components/Select/Select.js +5 -3
  62. package/dist/scripts/src/components/Select/SelectNative.js +53 -42
  63. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +1 -1
  64. package/dist/scripts/src/components/Spinner/Spinner.js +0 -1
  65. package/dist/scripts/src/components/Switch/Switch.js +5 -3
  66. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -0
  67. package/dist/scripts/src/components/Text/Text.js +10 -4
  68. package/dist/scripts/src/components/Text/TextNative.js +5 -1
  69. package/dist/scripts/src/components/TextBox/TextBox.js +6 -1
  70. package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
  71. package/dist/scripts/src/components/Theme/ThemeNative.js +7 -3
  72. package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -3
  73. package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
  74. package/dist/scripts/src/components-core/TableOfContentsContext.js +1 -1
  75. package/dist/scripts/src/components-core/appContext/date-functions.js +23 -0
  76. package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
  77. package/dist/scripts/src/components-core/appContext/misc-utils.js +13 -0
  78. package/dist/scripts/src/components-core/interception/ApiInterceptor.js +199 -0
  79. package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
  80. package/dist/scripts/src/components-core/interception/Backend.js +128 -0
  81. package/dist/scripts/src/components-core/interception/Errors.js +129 -0
  82. package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
  83. package/dist/scripts/src/components-core/interception/IndexedDb.js +207 -0
  84. package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
  85. package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
  86. package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
  87. package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
  88. package/dist/scripts/src/components-core/rendering/AppContent.js +336 -0
  89. package/dist/scripts/src/components-core/rendering/AppRoot.js +84 -0
  90. package/dist/scripts/src/components-core/rendering/AppWrapper.js +49 -0
  91. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +17 -7
  92. package/dist/scripts/src/components-core/rendering/Container.js +2 -1
  93. package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -7
  94. package/dist/scripts/src/components-core/theming/themes/root.js +1 -0
  95. package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
  96. package/dist/scripts/src/components-core/utils/hooks.js +26 -0
  97. package/dist/scripts/src/components-core/utils/misc.js +1 -1
  98. package/dist/scripts/src/components-core/utils/request-params.js +70 -0
  99. package/dist/scripts/src/logging/LoggerContext.js +22 -0
  100. package/dist/scripts/src/logging/LoggerInitializer.js +14 -0
  101. package/dist/scripts/src/logging/LoggerService.js +60 -0
  102. package/dist/scripts/src/parsers/xmlui-parser/transform.js +7 -0
  103. package/dist/standalone/xmlui-standalone.es.d.ts +2812 -0
  104. package/dist/{xmlui-standalone.umd.js → standalone/xmlui-standalone.umd.js} +34881 -31402
  105. package/package.json +31 -34
  106. package/dist/apiInterceptorWorker-DZyEgCvB.mjs +0 -8447
  107. package/dist/language-server-web-worker.d.ts +0 -22
  108. package/dist/language-server.d.ts +0 -24
  109. package/dist/parser-CBXS8ft2.mjs +0 -1196
  110. /package/dist/{core-XLM8cuFP.mjs → lib/core-XLM8cuFP.mjs} +0 -0
  111. /package/dist/{grammar.tmLanguage-CiEHpsbo.mjs → lib/grammar.tmLanguage-CiEHpsbo.mjs} +0 -0
  112. /package/dist/{wasm-DDgzZJey.mjs → lib/wasm-DDgzZJey.mjs} +0 -0
  113. /package/dist/{xmlui-h2uM9PUY.mjs → lib/xmlui-h2uM9PUY.mjs} +0 -0
@@ -26,12 +26,16 @@ exports.Text = (0, react_1.forwardRef)(function Text(_a, forwardedRef) {
26
26
  var { uid, variant, maxLines = 0, style, children, preserveLinebreaks, ellipses = true } = _a, variantSpecificProps = __rest(_a, ["uid", "variant", "maxLines", "style", "children", "preserveLinebreaks", "ellipses"]);
27
27
  const innerRef = (0, react_1.useRef)(null);
28
28
  const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(innerRef, forwardedRef) : innerRef;
29
+ // NOTE: This is to accept syntax highlight classes coming from shiki
30
+ // classes need not to be added to the rendered html element, so we remove them from props
31
+ const { syntaxHighlightClasses } = variantSpecificProps, restVariantSpecificProps = __rest(variantSpecificProps, ["syntaxHighlightClasses"]);
29
32
  const Element = (0, react_1.useMemo)(() => {
30
33
  if (!variant || !abstractions_1.TextVariantElement[variant])
31
34
  return "div"; //todo illesg, could be a span?
32
35
  return abstractions_1.TextVariantElement[variant];
33
36
  }, [variant]);
34
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Element, Object.assign({}, variantSpecificProps, { ref: ref, className: (0, classnames_1.default)([
37
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Element, Object.assign({}, restVariantSpecificProps, { ref: ref, className: (0, classnames_1.default)([
38
+ syntaxHighlightClasses,
35
39
  Text_module_scss_1.default.text,
36
40
  Text_module_scss_1.default[variant || "default"],
37
41
  {
@@ -32,6 +32,9 @@ exports.TextBoxMd = (0, ComponentDefs_1.createMetadata)({
32
32
  startIcon: (0, metadata_helpers_1.dStartIcon)(),
33
33
  endText: (0, metadata_helpers_1.dEndText)(),
34
34
  endIcon: (0, metadata_helpers_1.dEndIcon)(),
35
+ gap: {
36
+ description: "This property defines the gap between the adornments and the input area.",
37
+ },
35
38
  },
36
39
  events: {
37
40
  gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
@@ -52,6 +55,7 @@ exports.TextBoxMd = (0, ComponentDefs_1.createMetadata)({
52
55
  "borderWidth-Input": "1px",
53
56
  "minHeight-Input": "39px",
54
57
  "padding-Input": "$space-2",
58
+ "gap-adornment-Input": "$space-2",
55
59
  "borderStyle-Input": "solid",
56
60
  "borderColor-Input--disabled": "$borderColor--disabled",
57
61
  "textColor-Input--disabled": "$textColor--disabled",
@@ -73,7 +77,8 @@ exports.TextBoxMd = (0, ComponentDefs_1.createMetadata)({
73
77
  },
74
78
  });
75
79
  function renderTextBox(layoutCss, state, updateState, extractValue, node, lookupEventHandler, registerComponentApi, type = "text") {
76
- return ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, { type: type, style: layoutCss, value: state.value, updateState: updateState, initialValue: extractValue(node.props.initialValue), maxLength: extractValue(node.props.maxLength), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue.asOptionalString(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
80
+ delete layoutCss.gap;
81
+ return ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, { type: type, style: layoutCss, value: state.value, updateState: updateState, initialValue: extractValue(node.props.initialValue), maxLength: extractValue(node.props.maxLength), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), gap: extractValue.asOptionalString(node.props.gap), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue.asOptionalString(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
77
82
  }
78
83
  exports.textBoxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TextBoxMd, ({ node, state, updateState, lookupEventHandler, extractValue, layoutCss, registerComponentApi, }) => {
79
84
  return renderTextBox(layoutCss, state, updateState, extractValue, node, lookupEventHandler, registerComponentApi);
@@ -46,7 +46,7 @@ const constants_1 = require("../../components-core/constants");
46
46
  const misc_1 = require("../../components-core/utils/misc");
47
47
  const InputAdornment_1 = require("../Input/InputAdornment");
48
48
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
49
- exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text", value = "", updateState = constants_1.noop, initialValue = "", style, maxLength, enabled = true, placeholder, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
49
+ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text", value = "", updateState = constants_1.noop, initialValue = "", style, maxLength, enabled = true, placeholder, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
50
50
  id = id || (0, react_1.useId)();
51
51
  const inputRef = (0, react_2.useRef)(null);
52
52
  (0, react_2.useEffect)(() => {
@@ -103,5 +103,5 @@ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text",
103
103
  [TextBox_module_scss_1.default.error]: validationStatus === "error",
104
104
  [TextBox_module_scss_1.default.warning]: validationStatus === "warning",
105
105
  [TextBox_module_scss_1.default.valid]: validationStatus === "valid",
106
- }), tabIndex: -1, onFocus: focus, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: type, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
106
+ }), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: type, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
107
107
  });
@@ -31,7 +31,7 @@ function calculateHash(str) {
31
31
  }
32
32
  return hash;
33
33
  }
34
- function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 5000, themeVars = constants_1.EMPTY_OBJECT, layoutContext, children }) {
34
+ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 5000, themeVars = constants_1.EMPTY_OBJECT, layoutContext, children, }) {
35
35
  const generatedId = (0, react_1.useId)();
36
36
  const { themes, resources, resourceMap, activeThemeId, setRoot, root } = (0, ThemeContext_1.useThemes)();
37
37
  const { activeTheme, activeThemeTone } = (0, ThemeContext_1.useTheme)();
@@ -123,11 +123,15 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
123
123
  }, [devToolsEnabled, devToolsSide, devToolsSize]);
124
124
  if (isRoot) {
125
125
  const faviconUrl = getResourceUrl("resource:favicon") || "/resources/favicon.ico";
126
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_async_1.Helmet, { children: [!!faviconUrl && (0, jsx_runtime_1.jsx)("link", { rel: "icon", type: "image/svg+xml", href: faviconUrl }), fontLinks === null || fontLinks === void 0 ? void 0 : fontLinks.map((fontLink) => (0, jsx_runtime_1.jsx)("link", { href: fontLink, rel: "stylesheet" }, fontLink))] }), (0, jsx_runtime_1.jsx)("style", { type: "text/css", children: `.${className} {${css}}` }), (0, jsx_runtime_1.jsxs)("div", { style: inspectStyle, id: "_ui-engine-theme-root", className: (0, classnames_1.default)(Theme_module_scss_1.default.baseRootComponent, className), ref: (el) => {
126
+ return (
127
+ // <ThemeContext.Provider value={currentThemeContextValue}>
128
+ (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_async_1.Helmet, { children: [!!faviconUrl && (0, jsx_runtime_1.jsx)("link", { rel: "icon", type: "image/svg+xml", href: faviconUrl }), fontLinks === null || fontLinks === void 0 ? void 0 : fontLinks.map((fontLink) => (0, jsx_runtime_1.jsx)("link", { href: fontLink, rel: "stylesheet" }, fontLink))] }), (0, jsx_runtime_1.jsx)("style", { type: "text/css", "data-theme-root": true, children: `.${className} {${css}}` }), (0, jsx_runtime_1.jsxs)("div", { style: inspectStyle, id: "_ui-engine-theme-root", className: (0, classnames_1.default)(Theme_module_scss_1.default.baseRootComponent, className), ref: (el) => {
127
129
  if (el) {
128
130
  setRoot(el);
129
131
  }
130
- }, children: [(0, jsx_runtime_1.jsxs)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "theme-root", children: [renderChild(node.children), children] }), (0, jsx_runtime_1.jsx)(NotificationToast_1.NotificationToast, { toastDuration: toastDuration })] })] }));
132
+ }, children: [(0, jsx_runtime_1.jsxs)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "theme-root", children: [renderChild(node.children), children] }), (0, jsx_runtime_1.jsx)(NotificationToast_1.NotificationToast, { toastDuration: toastDuration })] })] })
133
+ // </ThemeContext.Provider>
134
+ );
131
135
  }
132
136
  return ((0, jsx_runtime_1.jsxs)(ThemeContext_1.ThemeContext.Provider, { value: currentThemeContextValue, children: [(0, jsx_runtime_1.jsx)("style", { children: `.${rangeClassName} {${css}}` }), (0, jsx_runtime_1.jsx)("style", { children: `.${className} {${css}}` }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Theme_module_scss_1.default.from, fromClass) }), renderChild(node.children, Object.assign(Object.assign({}, layoutContext), { themeClassName: className })), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Theme_module_scss_1.default.to, toClass) }), root &&
133
137
  (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className), ref: (el) => {
@@ -15,9 +15,7 @@ exports.ToneChangerButtonMd = (0, ComponentDefs_1.createMetadata)({
15
15
  });
16
16
  function ToneChangerButton() {
17
17
  const { activeThemeTone, setActiveThemeTone } = (0, ThemeContext_1.useThemes)();
18
- return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: activeThemeTone === "light" ? "stars" : "sun" }), onClick: () => {
19
- activeThemeTone === "light" ? setActiveThemeTone("dark") : setActiveThemeTone("light");
20
- } }));
18
+ return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", style: { flexShrink: 0 }, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: activeThemeTone === "light" ? "lightToDark" : "darkToLight" }), onClick: () => activeThemeTone === "light" ? setActiveThemeTone("dark") : setActiveThemeTone("light") }));
21
19
  }
22
20
  /**
23
21
  * Define the renderer for the Button component
@@ -294,7 +294,8 @@ class RestApiProxy {
294
294
  if (!response.clone().ok) {
295
295
  throw yield this.raiseError(response);
296
296
  }
297
- return yield parseResponse(response.clone());
297
+ const parsedResponse = yield parseResponse(response.clone());
298
+ return parsedResponse;
298
299
  }
299
300
  });
300
301
  this.tryParseResponse = (response) => __awaiter(this, void 0, void 0, function* () {
@@ -330,12 +331,14 @@ class RestApiProxy {
330
331
  const conf = (appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) || { apiUrl: "" };
331
332
  const { apiUrl, errorResponseTransform } = conf;
332
333
  this.appContext = appContext;
333
- const xsrfToken = (0, misc_1.readCookie)("XSRF-TOKEN");
334
- const xsrfHeaders = xsrfToken
335
- ? {
336
- "X-XSRF-TOKEN": (0, misc_1.readCookie)("XSRF-TOKEN"),
337
- }
338
- : {};
334
+ // const xsrfToken = readCookie("XSRF-TOKEN");
335
+ const xsrfHeaders =
336
+ // xsrfToken
337
+ // ? {
338
+ // "X-XSRF-TOKEN": readCookie("XSRF-TOKEN"),
339
+ // }
340
+ // :
341
+ {};
339
342
  this.config = {
340
343
  apiUrl,
341
344
  errorResponseTransform,
@@ -115,7 +115,7 @@ function TableOfContentsProvider({ children }) {
115
115
  }, [headings]);
116
116
  //the content could take time to load, this way we try to force the scroll to anchor mechanism to kick in
117
117
  const hasHeadings = sortedHeadings.length > 0;
118
- (0, react_1.useEffect)(() => {
118
+ (0, hooks_1.useIsomorphicLayoutEffect)(() => {
119
119
  if (hasHeadings) {
120
120
  forceRefreshAnchorScroll();
121
121
  }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dateFunctions = void 0;
4
+ const date_utils_1 = require("../utils/date-utils");
5
+ const date_fns_1 = require("date-fns");
6
+ exports.dateFunctions = {
7
+ isoDateString: date_utils_1.isoDateString,
8
+ formatDate: date_utils_1.formatDate,
9
+ formatDateTime: date_utils_1.formatDateTime,
10
+ formatTime: date_utils_1.formatTime,
11
+ formatTimeWithoutSeconds: date_utils_1.formatTimeWithoutSeconds,
12
+ formatDateWithoutYear: date_utils_1.formatDateWithoutYear,
13
+ getDate: date_utils_1.getDate,
14
+ getDateUntilNow: date_utils_1.getDateUntilNow,
15
+ smartFormatDateTime: date_utils_1.smartFormatDateTime,
16
+ smartFormatDate: date_utils_1.smartFormatDate,
17
+ isToday: date_utils_1.isDateToday,
18
+ isYesterday: date_utils_1.isDateYesterday,
19
+ isTomorrow: date_utils_1.isDateTomorrow,
20
+ differenceInMinutes: date_fns_1.differenceInMinutes,
21
+ isSameDay: date_fns_1.isSameDay,
22
+ isThisYear: date_fns_1.isThisYear,
23
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mathFunctions = void 0;
4
+ /**
5
+ * This function calculates the average of the specified values and returns it.
6
+ * @param values Values to calculate the average
7
+ * @param decimals Number of decimal places to round the result
8
+ */
9
+ function avg(values, decimals) {
10
+ if (values.length === 0) {
11
+ return 0;
12
+ }
13
+ const sumValues = sum(values);
14
+ const result = sumValues / values.length;
15
+ return decimals ? Number(result.toFixed(decimals)) : result;
16
+ }
17
+ /**
18
+ * This function calculates the sum of the specified values and returns it.
19
+ * @param values Values to calculate the sum
20
+ */
21
+ function sum(values) {
22
+ return values.reduce((acc, val) => acc + val, 0);
23
+ }
24
+ exports.mathFunctions = {
25
+ avg,
26
+ sum
27
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.miscellaneousUtils = void 0;
4
+ const lodash_es_1 = require("lodash-es");
5
+ const misc_1 = require("../utils/misc");
6
+ exports.miscellaneousUtils = {
7
+ capitalize: lodash_es_1.capitalize,
8
+ pluralize: misc_1.pluralize,
9
+ defaultTo: lodash_es_1.defaultTo,
10
+ toHashObject: misc_1.toHashObject,
11
+ findByField: misc_1.findByField,
12
+ distinct: misc_1.distinct
13
+ };
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ApiInterceptor = exports.AuthService = void 0;
13
+ const msw_1 = require("msw");
14
+ const lodash_es_1 = require("lodash-es");
15
+ const Backend_1 = require("../interception/Backend");
16
+ const IndexedDb_1 = require("../interception/IndexedDb");
17
+ const request_params_1 = require("../utils/request-params");
18
+ const Errors_1 = require("../interception/Errors");
19
+ const EngineError_1 = require("../EngineError");
20
+ const InMemoryDb_1 = require("../interception/InMemoryDb");
21
+ function mergeHeaders(...sources) {
22
+ const result = {};
23
+ for (const source of sources) {
24
+ if (!(0, lodash_es_1.isObject)(source)) {
25
+ throw new TypeError("All arguments must be of type object");
26
+ }
27
+ const headers = new Headers(source);
28
+ for (const [key, value] of headers.entries()) {
29
+ if (value === undefined || value === "undefined") {
30
+ delete result[key];
31
+ }
32
+ else {
33
+ result[key] = value;
34
+ }
35
+ }
36
+ }
37
+ return new Headers(result);
38
+ }
39
+ // Represents the authentication service used within an API interceptor
40
+ class AuthService {
41
+ constructor(auth) {
42
+ const cachedLoggedInUser = JSON.parse(sessionStorage.getItem("session-logged-in-user"));
43
+ this.loggedInUser = cachedLoggedInUser || (auth === null || auth === void 0 ? void 0 : auth.defaultLoggedInUser);
44
+ }
45
+ login(newLoggedInUser) {
46
+ this.loggedInUser = newLoggedInUser;
47
+ sessionStorage.setItem("session-logged-in-user", JSON.stringify(newLoggedInUser));
48
+ }
49
+ logout() {
50
+ this.loggedInUser = null;
51
+ sessionStorage.removeItem("session-logged-in-user");
52
+ }
53
+ getCookieToken() {
54
+ return sessionStorage.getItem("session-anonymous-token");
55
+ }
56
+ setCookieToken(token) {
57
+ sessionStorage.setItem("session-anonymous-token", token);
58
+ }
59
+ getLoggedInUser() {
60
+ return this.loggedInUser;
61
+ }
62
+ }
63
+ exports.AuthService = AuthService;
64
+ function initDb(apiDef) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ var _a, _b;
67
+ switch (apiDef.type) {
68
+ case "in-memory":
69
+ return new InMemoryDb_1.InMemoryDb((_a = apiDef.schemaDescriptor) === null || _a === void 0 ? void 0 : _a.tables, apiDef.initialData, apiDef.config);
70
+ default:
71
+ const indexedDb = new IndexedDb_1.IndexedDb((_b = apiDef.schemaDescriptor) === null || _b === void 0 ? void 0 : _b.tables, apiDef.initialData, apiDef.config);
72
+ yield indexedDb.initialize();
73
+ return indexedDb;
74
+ }
75
+ });
76
+ }
77
+ // An API interceptor implementation
78
+ class ApiInterceptor {
79
+ constructor(apiDef) {
80
+ this.apiDef = apiDef;
81
+ this.backend = null;
82
+ }
83
+ initialize() {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ // --- Transfer the handlers of API operations to the backend implementation
86
+ const backendOperations = {};
87
+ Object.entries(this.apiDef.operations || {}).forEach(([key, value]) => {
88
+ backendOperations[key] = value.handler;
89
+ });
90
+ const db = yield initDb(this.apiDef);
91
+ const authService = new AuthService(this.apiDef.auth);
92
+ const definition = {
93
+ operations: backendOperations,
94
+ initialize: this.apiDef.initialize,
95
+ helpers: this.apiDef.helpers,
96
+ };
97
+ this.backend = new Backend_1.Backend(definition, db, authService);
98
+ });
99
+ }
100
+ getOperations() {
101
+ return this.apiDef.operations || {};
102
+ }
103
+ getApiUrl() {
104
+ return this.apiDef.apiUrl || "";
105
+ }
106
+ // Use the "msw" package to execute the interceptor operation
107
+ executeOperation(operationId, req, cookies, params) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ var _a, _b;
110
+ if (this.backend === null) {
111
+ throw new Error("Interceptor not initialized");
112
+ }
113
+ const operation = (_a = this.apiDef.operations) === null || _a === void 0 ? void 0 : _a[operationId];
114
+ if (!operation) {
115
+ throw new Error(`Unknown API interceptor operation: ${operationId}`);
116
+ }
117
+ let reqBody;
118
+ try {
119
+ if (operation.requestShape === "formData") {
120
+ const formData = yield req.formData();
121
+ const obj = {};
122
+ for (const key of formData.keys()) {
123
+ const all = formData.getAll(key);
124
+ if (all.length === 1) {
125
+ obj[key] = all[0];
126
+ }
127
+ else {
128
+ obj[key] = all;
129
+ }
130
+ }
131
+ reqBody = obj;
132
+ }
133
+ else if (operation.requestShape === "blob") {
134
+ reqBody = yield req.blob();
135
+ }
136
+ else {
137
+ reqBody = yield req.json();
138
+ }
139
+ }
140
+ catch (e) { }
141
+ // --- Map path parameters
142
+ const mappedParams = this.convertRequestParams({
143
+ pathParams: params,
144
+ queryParams: Object.fromEntries(new URL(req.url).searchParams),
145
+ requestBody: reqBody,
146
+ cookies: cookies,
147
+ requestHeaders: Object.fromEntries(req.headers.entries()) || {},
148
+ }, operation);
149
+ //artificial delay for http requests
150
+ yield (0, msw_1.delay)();
151
+ const cookieService = new Backend_1.CookieService();
152
+ const headerService = new Backend_1.HeaderService();
153
+ try {
154
+ const ret = yield this.backend.executeOperation(operationId, mappedParams, cookieService, headerService);
155
+ const emptyBody = ret === undefined || ret === null;
156
+ const successStatusCode = (_b = operation.successStatusCode) !== null && _b !== void 0 ? _b : (emptyBody ? Errors_1.HttpStatusCode.NoContent : Errors_1.HttpStatusCode.Ok);
157
+ const headers = mergeHeaders(cookieService.getCookieHeader(), headerService.getHeaders());
158
+ if (ret instanceof File) {
159
+ headers.append("Content-type", ret.type);
160
+ headers.append("Content-Length", ret.size + "");
161
+ headers.append("Content-Disposition", `attachment; filename="${ret.name}"; filename*=utf-8''${ret.name}`);
162
+ return msw_1.HttpResponse.arrayBuffer(yield ret.arrayBuffer(), {
163
+ headers: headers,
164
+ status: successStatusCode,
165
+ });
166
+ }
167
+ if (emptyBody) {
168
+ return new msw_1.HttpResponse(null, {
169
+ headers: headers,
170
+ status: successStatusCode,
171
+ });
172
+ }
173
+ console.log(operationId, ret);
174
+ return msw_1.HttpResponse.json(ret, {
175
+ headers: headers,
176
+ status: successStatusCode,
177
+ });
178
+ }
179
+ catch (e) {
180
+ console.error(e);
181
+ if (e instanceof EngineError_1.ThrowStatementError && e.errorObject instanceof Errors_1.HttpError) {
182
+ return msw_1.HttpResponse.json(e.errorObject.details, {
183
+ headers: cookieService.getCookieHeader(),
184
+ status: e.errorObject.status,
185
+ });
186
+ }
187
+ return msw_1.HttpResponse.json({ message: e === null || e === void 0 ? void 0 : e.message }, {
188
+ headers: cookieService.getCookieHeader(),
189
+ status: Errors_1.HttpStatusCode.InternalServerError,
190
+ });
191
+ }
192
+ });
193
+ }
194
+ // Ensures that type path and query params are converted according to the operation definition
195
+ convertRequestParams(params, operation) {
196
+ return Object.assign(Object.assign({}, params), { pathParams: (0, request_params_1.convertRequestParamPart)(params.pathParams, operation.pathParamTypes), queryParams: (0, request_params_1.convertRequestParamPart)(params.queryParams, operation.queryParamTypes) });
197
+ }
198
+ }
199
+ exports.ApiInterceptor = ApiInterceptor;
@@ -0,0 +1,94 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.ApiInterceptorProvider = ApiInterceptorProvider;
46
+ const jsx_runtime_1 = require("react/jsx-runtime");
47
+ const react_1 = require("react");
48
+ const misc_1 = require("../utils/misc");
49
+ const useApiInterceptorContext_1 = require("./useApiInterceptorContext");
50
+ // This React component injects the API interceptor into the application's context
51
+ function ApiInterceptorProvider({ interceptor, children, apiWorker, useHashBasedRouting, }) {
52
+ const [initialized, setInitialized] = (0, react_1.useState)(!interceptor);
53
+ // --- Whenever the interceptor changes, update the provider accordingly
54
+ (0, react_1.useEffect)(() => {
55
+ if (interceptor) {
56
+ setInitialized(false);
57
+ // --- We use "msw" to manage the API interception
58
+ let interceptorWorker;
59
+ (() => __awaiter(this, void 0, void 0, function* () {
60
+ // --- Create the worker on the fly
61
+ if (process.env.VITE_MOCK_ENABLED) {
62
+ const { createApiInterceptorWorker } = yield Promise.resolve().then(() => __importStar(require("./apiInterceptorWorker")));
63
+ if (interceptor) {
64
+ interceptorWorker = yield createApiInterceptorWorker(interceptor, apiWorker);
65
+ // if the apiWorker comes from the outside, we don't handle the lifecycle here
66
+ if (!apiWorker) {
67
+ const workerFileLocation = (0, misc_1.normalizePath)(process.env.VITE_MOCK_WORKER_LOCATION || "mockServiceWorker.js");
68
+ yield interceptorWorker.start({
69
+ onUnhandledRequest: "bypass",
70
+ quiet: true,
71
+ serviceWorker: {
72
+ url: workerFileLocation,
73
+ },
74
+ });
75
+ }
76
+ }
77
+ }
78
+ setInitialized(true);
79
+ }))();
80
+ return () => {
81
+ // if the apiWorker comes from the outside, we don't handle the lifecycle here
82
+ if (!apiWorker) {
83
+ interceptorWorker === null || interceptorWorker === void 0 ? void 0 : interceptorWorker.stop();
84
+ }
85
+ };
86
+ }
87
+ }, [apiWorker, interceptor, useHashBasedRouting]);
88
+ const contextValue = (0, react_1.useMemo)(() => {
89
+ return {
90
+ isMocked: (url) => interceptor !== undefined && !!process.env.VITE_MOCK_ENABLED,
91
+ };
92
+ }, [interceptor]);
93
+ return ((0, jsx_runtime_1.jsx)(useApiInterceptorContext_1.ApiInterceptorContext.Provider, { value: contextValue, children: initialized ? children || null : null }));
94
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Backend = exports.HeaderService = exports.CookieService = exports.defaultBackendEnvironment = void 0;
16
+ const lodash_es_1 = require("lodash-es");
17
+ const misc_1 = require("../utils/misc");
18
+ const statementUtils_1 = require("../utils/statementUtils");
19
+ const date_functions_1 = require("../appContext/date-functions");
20
+ const misc_utils_1 = require("../appContext/misc-utils");
21
+ const date_utils_1 = require("../utils/date-utils");
22
+ const Errors_1 = __importDefault(require("../interception/Errors"));
23
+ // Use this backend environment as the default
24
+ exports.defaultBackendEnvironment = {
25
+ getDate: (date) => (date ? new Date(date) : new Date()),
26
+ };
27
+ const mapValuesDeep = (obj, cb) => {
28
+ if ((0, lodash_es_1.isArray)(obj)) {
29
+ return obj.map((innerObj) => mapValuesDeep(innerObj, cb));
30
+ }
31
+ else if ((0, lodash_es_1.isObject)(obj)) {
32
+ return (0, lodash_es_1.mapValues)(obj, (val) => mapValuesDeep(val, cb));
33
+ }
34
+ else {
35
+ return cb(obj);
36
+ }
37
+ };
38
+ class CookieService {
39
+ constructor() {
40
+ this.cookies = {};
41
+ }
42
+ setCookie(key, value) {
43
+ this.cookies[key] = value;
44
+ }
45
+ getCookieHeader() {
46
+ const cookieArrays = [];
47
+ Object.entries(this.cookies).forEach(([key, value]) => {
48
+ if (Array.isArray(value)) {
49
+ value.forEach((val) => cookieArrays.push(["Set-Cookie", `${key}=${val}`]));
50
+ }
51
+ else {
52
+ cookieArrays.push(["Set-Cookie", `${key}=${value}`]);
53
+ }
54
+ });
55
+ return new Headers(cookieArrays);
56
+ }
57
+ }
58
+ exports.CookieService = CookieService;
59
+ class HeaderService {
60
+ constructor() {
61
+ this.headers = {};
62
+ }
63
+ setHeader(key, value) {
64
+ this.headers[key] = value;
65
+ }
66
+ getHeaders() {
67
+ const headersArray = [];
68
+ Object.entries(this.headers).forEach(([key, value]) => {
69
+ headersArray.push([key, value]);
70
+ });
71
+ return new Headers(headersArray);
72
+ }
73
+ }
74
+ exports.HeaderService = HeaderService;
75
+ class Backend {
76
+ constructor(definition, db, authService) {
77
+ this.definition = definition;
78
+ this.db = db;
79
+ this.authService = authService;
80
+ this.apiStateHash = {};
81
+ this.resolvedHelpers = mapValuesDeep(definition.helpers, (helper) => {
82
+ if (typeof helper === "string") {
83
+ return (...params) => this.runFn(helper, ...params);
84
+ }
85
+ return helper;
86
+ });
87
+ if (definition.initialize) {
88
+ this.runFn(definition.initialize);
89
+ }
90
+ }
91
+ executeOperation(operationId, requestParams, cookieService, headerService) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ var _a;
94
+ const handler = (_a = this.definition.operations) === null || _a === void 0 ? void 0 : _a[operationId];
95
+ if (!handler) {
96
+ throw new Error(`Unknown backend operation: ${operationId}`);
97
+ }
98
+ return yield this.runFn(handler, requestParams, cookieService, headerService);
99
+ });
100
+ }
101
+ runFn(src, ...args) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ var _a, _b, _c, _d, _e, _f, _g;
104
+ let localContext = Object.assign(Object.assign({}, this.resolvedHelpers), { $db: this.db, $state: this.apiStateHash, $authService: this.authService, $env: exports.defaultBackendEnvironment, $loggedInUser: this.authService.getLoggedInUser(), $pathParams: (_a = args[0]) === null || _a === void 0 ? void 0 : _a.pathParams, $queryParams: (_b = args[0]) === null || _b === void 0 ? void 0 : _b.queryParams, $requestBody: (_c = args[0]) === null || _c === void 0 ? void 0 : _c.requestBody, $cookies: (_d = args[0]) === null || _d === void 0 ? void 0 : _d.cookies, $requestHeaders: (_e = args[0]) === null || _e === void 0 ? void 0 : _e.requestHeaders, $cookieService: args[1], $headerService: args[2] });
105
+ const evalContext = createEvalContext({
106
+ localContext: localContext,
107
+ eventArgs: args,
108
+ appContext: Object.assign(Object.assign(Object.assign({}, date_functions_1.dateFunctions), misc_utils_1.miscellaneousUtils), { delay: misc_1.delay,
109
+ Errors: Errors_1.default, createFile: (...args) => new File(args[0], args[1], args[2]), getDate: date_utils_1.getDate }),
110
+ });
111
+ yield (0, statementUtils_1.runEventHandlerCode)(src, evalContext);
112
+ return ((_g = (_f = evalContext.mainThread) === null || _f === void 0 ? void 0 : _f.blocks) === null || _g === void 0 ? void 0 : _g.length)
113
+ ? evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1].returnValue
114
+ : undefined;
115
+ });
116
+ }
117
+ }
118
+ exports.Backend = Backend;
119
+ function createEvalContext(parts) {
120
+ return Object.assign({
121
+ mainThread: {
122
+ childThreads: [],
123
+ blocks: [{ vars: {} }],
124
+ loops: [],
125
+ breakLabelValue: -1,
126
+ },
127
+ }, parts);
128
+ }