@lowdefy/server 5.5.1 → 5.6.0

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.
@@ -15,9 +15,8 @@
15
15
  */
16
16
 
17
17
  import path from 'path';
18
- import { createApiContext } from '@lowdefy/api';
18
+ import { createApiContext, redactErrorResponse } from '@lowdefy/api';
19
19
  import { getSecretsFromEnv } from '@lowdefy/node-utils';
20
- import { serializer } from '@lowdefy/helpers';
21
20
  import { v4 as uuid } from 'uuid';
22
21
 
23
22
  import agents from '../../build/plugins/agents.js';
@@ -80,13 +79,7 @@ function apiWrapper(handler) {
80
79
  return response;
81
80
  } catch (error) {
82
81
  await context.handleError(error);
83
- const serialized = serializer.serialize(error);
84
- if (serialized?.['~e']) {
85
- delete serialized['~e'].received;
86
- delete serialized['~e'].stack;
87
- delete serialized['~e'].configKey;
88
- }
89
- res.status(500).json(serialized);
82
+ res.status(500).json(redactErrorResponse(context, error));
90
83
  }
91
84
  };
92
85
  }
@@ -59,7 +59,20 @@ function getEventType(error) {
59
59
  function createHandleError({ context }) {
60
60
  return async function handleError(error) {
61
61
  try {
62
- const { headers = {}, user = {} } = context;
62
+ // Set first, not after the log call: this function is the server's error
63
+ // sink, so reaching it is what makes the error already-logged, and the catch
64
+ // below guarantees something is written even when the steps here fail. The
65
+ // client reads `handled` to decide whether to POST the error to
66
+ // /api/client-error, so a later throw skipping this assignment would have it
67
+ // logged a second time. Not keyed on `source`, which a LowdefyInternalError
68
+ // never gets - location resolution is skipped for it below.
69
+ error.handled = true;
70
+
71
+ // `?? {}` rather than a destructuring default: context.user is null (not
72
+ // undefined) for an anonymous caller and for every system context, so a
73
+ // default would not fire and reading user.id below would throw.
74
+ const headers = context.headers ?? {};
75
+ const user = context.user ?? {};
63
76
  const eventType = getEventType(error);
64
77
  const isServiceError = error instanceof ServiceError;
65
78
  const isLowdefyInternalError = error instanceof LowdefyInternalError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -39,22 +39,22 @@
39
39
  "dependencies": {
40
40
  "@ant-design/cssinjs": "2.1.2",
41
41
  "@ant-design/x": "2.7.0",
42
- "@lowdefy/actions-core": "5.5.1",
43
- "@lowdefy/api": "5.5.1",
44
- "@lowdefy/block-utils": "5.5.1",
45
- "@lowdefy/blocks-antd": "5.5.1",
46
- "@lowdefy/blocks-antd-x": "5.5.1",
47
- "@lowdefy/blocks-basic": "5.5.1",
48
- "@lowdefy/blocks-loaders": "5.5.1",
49
- "@lowdefy/blocks-tiptap": "5.5.1",
50
- "@lowdefy/client": "5.5.1",
51
- "@lowdefy/errors": "5.5.1",
52
- "@lowdefy/helpers": "5.5.1",
53
- "@lowdefy/layout": "5.5.1",
54
- "@lowdefy/logger": "5.5.1",
55
- "@lowdefy/node-utils": "5.5.1",
56
- "@lowdefy/operators-js": "5.5.1",
57
- "@lowdefy/plugin-next-auth": "5.5.1",
42
+ "@lowdefy/actions-core": "5.6.0",
43
+ "@lowdefy/api": "5.6.0",
44
+ "@lowdefy/block-utils": "5.6.0",
45
+ "@lowdefy/blocks-antd": "5.6.0",
46
+ "@lowdefy/blocks-antd-x": "5.6.0",
47
+ "@lowdefy/blocks-basic": "5.6.0",
48
+ "@lowdefy/blocks-loaders": "5.6.0",
49
+ "@lowdefy/blocks-tiptap": "5.6.0",
50
+ "@lowdefy/client": "5.6.0",
51
+ "@lowdefy/errors": "5.6.0",
52
+ "@lowdefy/helpers": "5.6.0",
53
+ "@lowdefy/layout": "5.6.0",
54
+ "@lowdefy/logger": "5.6.0",
55
+ "@lowdefy/node-utils": "5.6.0",
56
+ "@lowdefy/operators-js": "5.6.0",
57
+ "@lowdefy/plugin-next-auth": "5.6.0",
58
58
  "@sentry/nextjs": "8.53.0",
59
59
  "@tailwindcss/postcss": "4.2.1",
60
60
  "antd": "6.3.1",
@@ -69,7 +69,7 @@
69
69
  "uuid": "13.0.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@lowdefy/build": "5.5.1",
72
+ "@lowdefy/build": "5.6.0",
73
73
  "@next/eslint-plugin-next": "16.1.6",
74
74
  "@tailwindcss/postcss": "4.2.1",
75
75
  "tailwindcss": "4.2.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -49,22 +49,22 @@
49
49
  "dependencies": {
50
50
  "@ant-design/cssinjs": "2.1.2",
51
51
  "@ant-design/x": "2.7.0",
52
- "@lowdefy/actions-core": "5.5.1",
53
- "@lowdefy/api": "5.5.1",
54
- "@lowdefy/block-utils": "5.5.1",
55
- "@lowdefy/blocks-antd": "5.5.1",
56
- "@lowdefy/blocks-antd-x": "5.5.1",
57
- "@lowdefy/blocks-basic": "5.5.1",
58
- "@lowdefy/blocks-loaders": "5.5.1",
59
- "@lowdefy/blocks-tiptap": "5.5.1",
60
- "@lowdefy/client": "5.5.1",
61
- "@lowdefy/errors": "5.5.1",
62
- "@lowdefy/helpers": "5.5.1",
63
- "@lowdefy/layout": "5.5.1",
64
- "@lowdefy/logger": "5.5.1",
65
- "@lowdefy/node-utils": "5.5.1",
66
- "@lowdefy/operators-js": "5.5.1",
67
- "@lowdefy/plugin-next-auth": "5.5.1",
52
+ "@lowdefy/actions-core": "5.6.0",
53
+ "@lowdefy/api": "5.6.0",
54
+ "@lowdefy/block-utils": "5.6.0",
55
+ "@lowdefy/blocks-antd": "5.6.0",
56
+ "@lowdefy/blocks-antd-x": "5.6.0",
57
+ "@lowdefy/blocks-basic": "5.6.0",
58
+ "@lowdefy/blocks-loaders": "5.6.0",
59
+ "@lowdefy/blocks-tiptap": "5.6.0",
60
+ "@lowdefy/client": "5.6.0",
61
+ "@lowdefy/errors": "5.6.0",
62
+ "@lowdefy/helpers": "5.6.0",
63
+ "@lowdefy/layout": "5.6.0",
64
+ "@lowdefy/logger": "5.6.0",
65
+ "@lowdefy/node-utils": "5.6.0",
66
+ "@lowdefy/operators-js": "5.6.0",
67
+ "@lowdefy/plugin-next-auth": "5.6.0",
68
68
  "@sentry/nextjs": "8.53.0",
69
69
  "@tailwindcss/postcss": "4.2.1",
70
70
  "antd": "6.3.1",
@@ -79,7 +79,7 @@
79
79
  "uuid": "13.0.0"
80
80
  },
81
81
  "devDependencies": {
82
- "@lowdefy/build": "5.5.1",
82
+ "@lowdefy/build": "5.6.0",
83
83
  "@next/eslint-plugin-next": "16.1.6",
84
84
  "@tailwindcss/postcss": "4.2.1",
85
85
  "tailwindcss": "4.2.1",
@@ -64,8 +64,10 @@ class LowdefyDocument extends Document {
64
64
  __html: `(function(){var s=document.createElement("style");s.id="__lf-layer-order";s.textContent="@layer theme, base, antd, components, utilities;";document.head.prepend(s);new MutationObserver(function(){if(document.head.firstChild!==s)document.head.prepend(s)}).observe(document.head,{childList:true})})();`,
65
65
  }}
66
66
  />
67
- {/* Synchronous pre-hydration background script — prevents mode-mismatch
68
- flash on page navigation. Mirrors useDarkMode.js resolution order:
67
+ {/* Synchronous pre-hydration script setting the <html> background and
68
+ color-scheme — prevents a mode-mismatch flash of the page and of
69
+ browser chrome (scrollbars, form controls) on page navigation.
70
+ Mirrors useDarkMode.js resolution order:
69
71
  configDarkMode → localStorage → prefers-color-scheme. Uses the user's
70
72
  configured colorBgLayout tokens when present (theme.antd.darkToken and
71
73
  theme.antd.lightToken), falling back to #000 in dark and no inline style
@@ -76,7 +78,7 @@ class LowdefyDocument extends Document {
76
78
  darkBg
77
79
  )};var lb=${safeScriptJson(
78
80
  lightBg
79
- )};var d;if(c==="dark")d=true;else if(c==="light")d=false;else{try{var p=localStorage.getItem("lowdefy_darkMode");if(p==="dark")d=true;else if(p==="light")d=false;else d=window.matchMedia("(prefers-color-scheme:dark)").matches}catch(e){d=window.matchMedia("(prefers-color-scheme:dark)").matches}}var bg=d?db:lb;if(bg)document.documentElement.style.backgroundColor=bg})();`,
81
+ )};var d;if(c==="dark")d=true;else if(c==="light")d=false;else{try{var p=localStorage.getItem("lowdefy_darkMode");if(p==="dark")d=true;else if(p==="light")d=false;else d=window.matchMedia("(prefers-color-scheme:dark)").matches}catch(e){d=window.matchMedia("(prefers-color-scheme:dark)").matches}}var bg=d?db:lb;document.documentElement.style.colorScheme=d?"dark":"light";if(bg)document.documentElement.style.backgroundColor=bg})();`,
80
82
  }}
81
83
  />
82
84
  <link rel="manifest" href={`${basePath}/manifest.webmanifest`} />