@lowdefy/server 6.2.0 → 6.2.2

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.
@@ -16,18 +16,18 @@
16
16
 
17
17
  import { lowdefyErrorNames, readErrorCodes } from '@lowdefy/errors';
18
18
 
19
- import maskCredentialKeys from './maskCredentialKeys.js';
20
-
21
19
  // Kept only on nodes named as a Lowdefy error class: libraries reuse some of
22
20
  // these names for their own data - axios's `config` carries auth, params and
23
21
  // headers - so keying on the field alone would let a library's copy through.
22
+ // `received` is not among them: it holds an operator's or control's evaluated
23
+ // input - a user's ID number, a token from an earlier step - and the log names
24
+ // where a fault happened, not the values it ran on. The dev server's log keeps it.
24
25
  const lowdefyErrorFields = [
25
26
  'configKey',
26
27
  'source',
27
28
  'config',
28
29
  'handled',
29
30
  'isLowdefyError',
30
- 'received',
31
31
  'typeName',
32
32
  'location',
33
33
  'service',
@@ -37,6 +37,11 @@ const lowdefyErrorFields = [
37
37
  'blockId',
38
38
  'pageId',
39
39
  'isReject',
40
+ // A failed request step's ids (callRequestResolver), so its error log names the step
41
+ // rather than its inputs.
42
+ 'endpointId',
43
+ 'stepId',
44
+ 'connectionId',
40
45
  ];
41
46
 
42
47
  function projectErrorForLog(err) {
@@ -46,7 +51,6 @@ function projectErrorForLog(err) {
46
51
  lowdefyErrorFields.forEach((field) => {
47
52
  props[field] = err[field];
48
53
  });
49
- props.received = maskCredentialKeys(err.received);
50
54
  }
51
55
  props.cause = err.cause;
52
56
  return props;
@@ -16,7 +16,6 @@
16
16
 
17
17
  import { OperatorError, RequestError, UserError } from '@lowdefy/errors';
18
18
 
19
- import maskCredentialKeys from './maskCredentialKeys.js';
20
19
  import projectErrorForLog from './projectErrorForLog.js';
21
20
  import serializeErrorForLog from './serializeErrorForLog.js';
22
21
 
@@ -32,7 +31,6 @@ const allowedErrorKeys = new Set([
32
31
  'config',
33
32
  'handled',
34
33
  'isLowdefyError',
35
- 'received',
36
34
  'typeName',
37
35
  'location',
38
36
  'service',
@@ -42,10 +40,12 @@ const allowedErrorKeys = new Set([
42
40
  'blockId',
43
41
  'pageId',
44
42
  'isReject',
43
+ 'endpointId',
44
+ 'stepId',
45
+ 'connectionId',
45
46
  ]);
46
47
 
47
- // Every serialized error node carries `stack`; free-form values under
48
- // `received` in these fixtures never do.
48
+ // Every serialized error node carries `stack`.
49
49
  function collectErrorNodes(value, nodes = []) {
50
50
  if (value === null || typeof value !== 'object') return nodes;
51
51
  if (!Array.isArray(value) && Object.hasOwn(value, 'stack')) nodes.push(value);
@@ -128,54 +128,36 @@ test('serializeErrorForLog drops input from a Node ERR_INVALID_URL error', () =>
128
128
  expect(Object.keys(serialized)).not.toContain('input');
129
129
  });
130
130
 
131
- test('serializeErrorForLog masks credential keys in received and keeps the other received properties', () => {
132
- const received = {
133
- url: 'https://api.example.com/items',
134
- method: 'get',
135
- headers: { Authorization: 'Bearer runtime-token-1', Accept: 'application/json' },
136
- params: { access_token: 'runtime-token-2', page: 2 },
137
- 'x-api-key': 'runtime-token-3',
138
- };
139
- const error = new RequestError('Upstream failed.', {
140
- typeName: 'AxiosHttp',
131
+ test('serializeErrorForLog leaves out the evaluated input an operator error carries as received', () => {
132
+ const received = { idNumber: '8001015009087' };
133
+ const error = new OperatorError('_string.concat failed.', {
134
+ typeName: '_string.concat',
141
135
  received,
142
- cause: new OperatorError('Inner failed.', { typeName: '_step', received }),
136
+ cause: new OperatorError('Inner failed.', { typeName: '_get', received }),
143
137
  });
144
- const expectedReceived = {
145
- url: 'https://api.example.com/items',
146
- method: 'get',
147
- headers: { Authorization: '[REDACTED]', Accept: 'application/json' },
148
- params: { access_token: '[REDACTED]', page: 2 },
149
- 'x-api-key': '[REDACTED]',
150
- };
151
138
  const serialized = serializeErrorForLog(error);
152
- expect(serialized.received).toEqual(expectedReceived);
153
- expect(serialized.cause.received).toEqual(expectedReceived);
154
- expect(JSON.stringify(serialized)).not.toMatch(/runtime-token/);
155
- });
156
-
157
- test('serializeErrorForLog does not mutate the received it masks', () => {
158
- const received = { headers: { Authorization: 'Bearer runtime-token' } };
159
- serializeErrorForLog(new RequestError('Upstream failed.', { received }));
160
- expect(received).toEqual({ headers: { Authorization: 'Bearer runtime-token' } });
139
+ expect(serialized.typeName).toEqual('_string.concat');
140
+ expect(serialized.received).toBeUndefined();
141
+ expect(serialized.cause.received).toBeUndefined();
142
+ expect(JSON.stringify(serialized)).not.toMatch(/8001015009087/);
161
143
  });
162
144
 
163
- test('serializeErrorForLog projects an Error nested seven levels deep inside a cause property', () => {
145
+ // metaData is the one kept free-form field, so an error placed in it is walked like any other value.
146
+ test('serializeErrorForLog projects an Error nested seven levels deep inside a kept field', () => {
164
147
  let nested = createAxiosError();
165
148
  for (let level = 7; level >= 1; level -= 1) {
166
- nested = new RequestError(`Level ${level}.`, { received: nested });
149
+ const wrapper = new RequestError(`Level ${level}.`);
150
+ wrapper.metaData = nested;
151
+ nested = wrapper;
167
152
  }
168
- // An explicit received, so the top node does not inherit the cause's.
169
- const error = new RequestError('Top.', {
170
- received: { page: 1 },
171
- cause: new OperatorError('Cause.', { received: nested }),
172
- });
153
+ const error = new RequestError('Top.', { cause: new OperatorError('Cause.') });
154
+ error.cause.metaData = nested;
173
155
  const serialized = serializeErrorForLog(error);
174
156
 
175
- let node = serialized.cause.received;
157
+ let node = serialized.cause.metaData;
176
158
  for (let level = 1; level <= 7; level += 1) {
177
159
  expect(node.message).toEqual(`Level ${level}.`);
178
- node = node.received;
160
+ node = node.metaData;
179
161
  }
180
162
  expect(node.name).toEqual('AxiosError');
181
163
  expect(node.statusCode).toEqual(401);
@@ -190,6 +172,33 @@ test('serializeErrorForLog projects an Error nested seven levels deep inside a c
190
172
  expect(JSON.stringify(serialized)).not.toMatch(/planted/);
191
173
  });
192
174
 
175
+ test("serializeErrorForLog keeps a failed request's ids and leaves out the connection's error it keeps for the dev tools", () => {
176
+ const driverError = new Error('Document failed validation');
177
+ driverError.name = 'MongoServerError';
178
+ driverError.errInfo = { details: { document: { message: 'planted-chat-text' } } };
179
+ const error = new RequestError('Document failed validation', {
180
+ cause: new Error('Document failed validation'),
181
+ typeName: 'MongoDBInsertOne',
182
+ location: 'threads/save_thread',
183
+ });
184
+ Object.assign(error, {
185
+ endpointId: 'save-thread',
186
+ stepId: 'save_thread',
187
+ connectionId: 'threads',
188
+ });
189
+ Object.defineProperty(error, 'devCause', { value: driverError });
190
+
191
+ const serialized = serializeErrorForLog(error);
192
+
193
+ expect(serialized).toMatchObject({
194
+ name: 'RequestError',
195
+ endpointId: 'save-thread',
196
+ stepId: 'save_thread',
197
+ connectionId: 'threads',
198
+ });
199
+ expect(JSON.stringify(serialized)).not.toMatch(/planted/);
200
+ });
201
+
193
202
  test('serializeErrorForLog keeps UserError metaData, blockId, pageId and isReject', () => {
194
203
  const error = new UserError('Please fill in the form.', {
195
204
  blockId: 'submit_button',
@@ -246,79 +255,6 @@ test('projectErrorForLog reads statusCode from the node and passes the cause thr
246
255
  expect(projected.cause).toBe(cause);
247
256
  });
248
257
 
249
- test('maskCredentialKeys masks keys containing each credential word after lower-casing and removing - and _', () => {
250
- expect(
251
- maskCredentialKeys({
252
- Authorization: 'a',
253
- access_token: 'b',
254
- 'x-api-key': 'c',
255
- client_secret: 'd',
256
- Password: 'e',
257
- Cookie: 'f',
258
- API_KEY: 'g',
259
- tokenCount: 3,
260
- name: 'kept',
261
- })
262
- ).toEqual({
263
- Authorization: '[REDACTED]',
264
- access_token: '[REDACTED]',
265
- 'x-api-key': '[REDACTED]',
266
- client_secret: '[REDACTED]',
267
- Password: '[REDACTED]',
268
- Cookie: '[REDACTED]',
269
- API_KEY: '[REDACTED]',
270
- tokenCount: '[REDACTED]',
271
- name: 'kept',
272
- });
273
- });
274
-
275
- test('maskCredentialKeys replaces a whole object value under a credential key', () => {
276
- expect(maskCredentialKeys({ tokens: { access: 'a', refresh: 'b' } })).toEqual({
277
- tokens: '[REDACTED]',
278
- });
279
- });
280
-
281
- test('maskCredentialKeys recurses into arrays and nested objects', () => {
282
- expect(
283
- maskCredentialKeys({ items: [{ secret: 'a', id: 1 }, [{ cookie: 'b' }], 'plain'] })
284
- ).toEqual({ items: [{ secret: '[REDACTED]', id: 1 }, [{ cookie: '[REDACTED]' }], 'plain'] });
285
- });
286
-
287
- test('maskCredentialKeys returns primitives, Dates, Errors and class instances unchanged', () => {
288
- class Client {
289
- constructor() {
290
- this.password = 'internal';
291
- }
292
- }
293
- const date = new Date(0);
294
- const error = new Error('x');
295
- const client = new Client();
296
- expect(maskCredentialKeys('text')).toEqual('text');
297
- expect(maskCredentialKeys(undefined)).toBeUndefined();
298
- expect(maskCredentialKeys(date)).toBe(date);
299
- expect(maskCredentialKeys(error)).toBe(error);
300
- expect(maskCredentialKeys(client)).toBe(client);
301
- });
302
-
303
- test('serializeErrorForLog marks a class instance in received by type name only', () => {
304
- class Client {
305
- constructor() {
306
- this.password = 'planted';
307
- }
308
- }
309
- const serialized = serializeErrorForLog(
310
- new RequestError('Failed.', { received: { client: new Client() } })
311
- );
312
- expect(serialized.received).toEqual({ client: '[Object: Client]' });
313
- });
314
-
315
- test('serializeErrorForLog marks a cycle in received as circular', () => {
316
- const received = { name: 'loop' };
317
- received.self = received;
318
- const serialized = serializeErrorForLog(new RequestError('Failed.', { received }));
319
- expect(serialized.received).toEqual({ name: 'loop', self: '[Circular]' });
320
- });
321
-
322
258
  test('serializeErrorForLog returns a non-Error value unchanged', () => {
323
259
  expect(serializeErrorForLog('plain string')).toEqual('plain string');
324
260
  expect(serializeErrorForLog({ message: 'object' })).toEqual({ message: 'object' });
@@ -51,7 +51,7 @@ function createRequestError() {
51
51
  });
52
52
  }
53
53
 
54
- test('captureSentryError sends the log projection as extra.error, without axios config and with received credential keys masked', () => {
54
+ test('captureSentryError sends the log projection as extra.error, without axios config or received', () => {
55
55
  const error = createRequestError();
56
56
  captureSentryError({ error, context: { rid: 'req-1', pageId: 'orders' } });
57
57
  expect(captureException).toHaveBeenCalledTimes(1);
@@ -59,10 +59,7 @@ test('captureSentryError sends the log projection as extra.error, without axios
59
59
  expect(captured).toBe(error);
60
60
  expect(extra.error.typeName).toEqual('AxiosHttp');
61
61
  expect(extra.error.statusCode).toEqual(401);
62
- expect(extra.error.received).toEqual({
63
- url: 'https://api.example.com/items',
64
- headers: { Authorization: '[REDACTED]', Accept: 'application/json' },
65
- });
62
+ expect(extra.error.received).toBeUndefined();
66
63
  expect(extra.error.cause).toEqual({
67
64
  name: 'AxiosError',
68
65
  message: 'Request failed with status code 401',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -44,27 +44,27 @@
44
44
  "@hono/auth-js": "1.1.1",
45
45
  "@hono/mcp": "0.3.0",
46
46
  "@hono/node-server": "2.0.10",
47
- "@lowdefy/actions-core": "6.2.0",
48
- "@lowdefy/api": "6.2.0",
49
- "@lowdefy/block-utils": "6.2.0",
50
- "@lowdefy/blocks-aggrid": "6.2.0",
51
- "@lowdefy/blocks-antd": "6.2.0",
52
- "@lowdefy/blocks-antd-x": "6.2.0",
53
- "@lowdefy/blocks-basic": "6.2.0",
54
- "@lowdefy/blocks-echarts": "6.2.0",
55
- "@lowdefy/blocks-files": "6.2.0",
56
- "@lowdefy/blocks-loaders": "6.2.0",
57
- "@lowdefy/blocks-markdown": "6.2.0",
58
- "@lowdefy/blocks-tiptap": "6.2.0",
59
- "@lowdefy/client": "6.2.0",
60
- "@lowdefy/errors": "6.2.0",
61
- "@lowdefy/helpers": "6.2.0",
62
- "@lowdefy/layout": "6.2.0",
63
- "@lowdefy/logger": "6.2.0",
64
- "@lowdefy/node-utils": "6.2.0",
65
- "@lowdefy/operators-js": "6.2.0",
66
- "@lowdefy/plugin-next-auth": "6.2.0",
67
- "@lowdefy/websockets-core": "6.2.0",
47
+ "@lowdefy/actions-core": "6.2.2",
48
+ "@lowdefy/api": "6.2.2",
49
+ "@lowdefy/block-utils": "6.2.2",
50
+ "@lowdefy/blocks-aggrid": "6.2.2",
51
+ "@lowdefy/blocks-antd": "6.2.2",
52
+ "@lowdefy/blocks-antd-x": "6.2.2",
53
+ "@lowdefy/blocks-basic": "6.2.2",
54
+ "@lowdefy/blocks-echarts": "6.2.2",
55
+ "@lowdefy/blocks-files": "6.2.2",
56
+ "@lowdefy/blocks-loaders": "6.2.2",
57
+ "@lowdefy/blocks-markdown": "6.2.2",
58
+ "@lowdefy/blocks-tiptap": "6.2.2",
59
+ "@lowdefy/client": "6.2.2",
60
+ "@lowdefy/errors": "6.2.2",
61
+ "@lowdefy/helpers": "6.2.2",
62
+ "@lowdefy/layout": "6.2.2",
63
+ "@lowdefy/logger": "6.2.2",
64
+ "@lowdefy/node-utils": "6.2.2",
65
+ "@lowdefy/operators-js": "6.2.2",
66
+ "@lowdefy/plugin-next-auth": "6.2.2",
67
+ "@lowdefy/websockets-core": "6.2.2",
68
68
  "@sentry/browser": "10.57.0",
69
69
  "@sentry/node": "10.57.0",
70
70
  "@sentry/vite-plugin": "5.3.0",
@@ -83,7 +83,7 @@
83
83
  "ws": "8.21.0"
84
84
  },
85
85
  "devDependencies": {
86
- "@lowdefy/build": "6.2.0",
86
+ "@lowdefy/build": "6.2.2",
87
87
  "@tailwindcss/postcss": "4.3.1",
88
88
  "jest": "28.1.3",
89
89
  "tailwindcss": "4.3.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -52,27 +52,27 @@
52
52
  "@hono/auth-js": "1.1.1",
53
53
  "@hono/mcp": "0.3.0",
54
54
  "@hono/node-server": "2.0.10",
55
- "@lowdefy/actions-core": "6.2.0",
56
- "@lowdefy/api": "6.2.0",
57
- "@lowdefy/block-utils": "6.2.0",
58
- "@lowdefy/blocks-aggrid": "6.2.0",
59
- "@lowdefy/blocks-antd": "6.2.0",
60
- "@lowdefy/blocks-antd-x": "6.2.0",
61
- "@lowdefy/blocks-basic": "6.2.0",
62
- "@lowdefy/blocks-echarts": "6.2.0",
63
- "@lowdefy/blocks-files": "6.2.0",
64
- "@lowdefy/blocks-loaders": "6.2.0",
65
- "@lowdefy/blocks-markdown": "6.2.0",
66
- "@lowdefy/blocks-tiptap": "6.2.0",
67
- "@lowdefy/client": "6.2.0",
68
- "@lowdefy/errors": "6.2.0",
69
- "@lowdefy/helpers": "6.2.0",
70
- "@lowdefy/layout": "6.2.0",
71
- "@lowdefy/logger": "6.2.0",
72
- "@lowdefy/node-utils": "6.2.0",
73
- "@lowdefy/operators-js": "6.2.0",
74
- "@lowdefy/plugin-next-auth": "6.2.0",
75
- "@lowdefy/websockets-core": "6.2.0",
55
+ "@lowdefy/actions-core": "6.2.2",
56
+ "@lowdefy/api": "6.2.2",
57
+ "@lowdefy/block-utils": "6.2.2",
58
+ "@lowdefy/blocks-aggrid": "6.2.2",
59
+ "@lowdefy/blocks-antd": "6.2.2",
60
+ "@lowdefy/blocks-antd-x": "6.2.2",
61
+ "@lowdefy/blocks-basic": "6.2.2",
62
+ "@lowdefy/blocks-echarts": "6.2.2",
63
+ "@lowdefy/blocks-files": "6.2.2",
64
+ "@lowdefy/blocks-loaders": "6.2.2",
65
+ "@lowdefy/blocks-markdown": "6.2.2",
66
+ "@lowdefy/blocks-tiptap": "6.2.2",
67
+ "@lowdefy/client": "6.2.2",
68
+ "@lowdefy/errors": "6.2.2",
69
+ "@lowdefy/helpers": "6.2.2",
70
+ "@lowdefy/layout": "6.2.2",
71
+ "@lowdefy/logger": "6.2.2",
72
+ "@lowdefy/node-utils": "6.2.2",
73
+ "@lowdefy/operators-js": "6.2.2",
74
+ "@lowdefy/plugin-next-auth": "6.2.2",
75
+ "@lowdefy/websockets-core": "6.2.2",
76
76
  "@sentry/browser": "10.57.0",
77
77
  "@sentry/node": "10.57.0",
78
78
  "@sentry/vite-plugin": "5.3.0",
@@ -91,7 +91,7 @@
91
91
  "ws": "8.21.0"
92
92
  },
93
93
  "devDependencies": {
94
- "@lowdefy/build": "6.2.0",
94
+ "@lowdefy/build": "6.2.2",
95
95
  "@tailwindcss/postcss": "4.3.1",
96
96
  "jest": "28.1.3",
97
97
  "tailwindcss": "4.3.1",
@@ -1,37 +0,0 @@
1
- /*
2
- Copyright 2020-2026 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import { mapPlainValues } from '@lowdefy/helpers';
18
-
19
- // `received` is the one kept log field holding values fetched at runtime (a token
20
- // from an earlier step sent as a header), which the by-value secret scrub
21
- // cannot recognise, so credential-looking keys are masked by name instead.
22
- const credentialKeyParts = ['authorization', 'token', 'secret', 'password', 'apikey', 'cookie'];
23
-
24
- function isCredentialKey(key) {
25
- const normalized = key.toLowerCase().replace(/[-_]/g, '');
26
- return credentialKeyParts.some((part) => normalized.includes(part));
27
- }
28
-
29
- // Shared references and cycles are copied as such, so the serializer walk still
30
- // marks them '[Circular]'.
31
- function maskCredentialKeys(value) {
32
- return mapPlainValues(value, (item, key) =>
33
- key !== undefined && isCredentialKey(key) ? '[REDACTED]' : item
34
- );
35
- }
36
-
37
- export default maskCredentialKeys;