@kapeta/local-cluster-service 0.67.1 → 0.67.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.67.2](https://github.com/kapetacom/local-cluster-service/compare/v0.67.1...v0.67.2) (2024-08-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add stack trace to error event ([ad52d4d](https://github.com/kapetacom/local-cluster-service/commit/ad52d4d22b20c0f4e34f83e0a9bc167599b02a08))
7
+ * Don't check file existence when path is empty ([8d9aa1a](https://github.com/kapetacom/local-cluster-service/commit/8d9aa1a180c38f53a0ae6cd122fedc20c8a78307))
8
+
1
9
  ## [0.67.1](https://github.com/kapetacom/local-cluster-service/compare/v0.67.0...v0.67.1) (2024-08-28)
2
10
 
3
11
 
@@ -111,6 +111,7 @@ export interface StormEventError {
111
111
  created: number;
112
112
  payload: {
113
113
  error: string;
114
+ stack?: string;
114
115
  };
115
116
  }
116
117
  export interface StormEventErrorClassifier {
@@ -53,6 +53,9 @@ async function writeImageToDisk(systemId, event, prompt) {
53
53
  }
54
54
  exports.writeImageToDisk = writeImageToDisk;
55
55
  function hasPageOnDisk(systemId, method, path) {
56
+ if (!systemId || !method || !path) {
57
+ return false;
58
+ }
56
59
  const baseDir = getSystemBaseDir(systemId);
57
60
  const filePath = getFilePath(method);
58
61
  const fullPath = path_1.default.join(baseDir, normalizePath(path), filePath);
@@ -596,17 +596,21 @@ function sendError(err, res) {
596
596
  if (res.closed) {
597
597
  return;
598
598
  }
599
+ const errorPayload = {
600
+ error: err.message,
601
+ stack: err.stack,
602
+ };
599
603
  console.error('Failed to send prompt', err);
600
604
  if (res.headersSent) {
601
605
  sendEvent(res, {
602
606
  type: 'ERROR_INTERNAL',
603
607
  created: Date.now(),
604
- payload: { error: err.message },
608
+ payload: errorPayload,
605
609
  reason: 'Failed while sending prompt',
606
610
  });
607
611
  }
608
612
  else {
609
- res.status(400).send({ error: err.message });
613
+ res.status(400).send(errorPayload);
610
614
  }
611
615
  }
612
616
  function waitForStormStream(result) {
@@ -111,6 +111,7 @@ export interface StormEventError {
111
111
  created: number;
112
112
  payload: {
113
113
  error: string;
114
+ stack?: string;
114
115
  };
115
116
  }
116
117
  export interface StormEventErrorClassifier {
@@ -53,6 +53,9 @@ async function writeImageToDisk(systemId, event, prompt) {
53
53
  }
54
54
  exports.writeImageToDisk = writeImageToDisk;
55
55
  function hasPageOnDisk(systemId, method, path) {
56
+ if (!systemId || !method || !path) {
57
+ return false;
58
+ }
56
59
  const baseDir = getSystemBaseDir(systemId);
57
60
  const filePath = getFilePath(method);
58
61
  const fullPath = path_1.default.join(baseDir, normalizePath(path), filePath);
@@ -596,17 +596,21 @@ function sendError(err, res) {
596
596
  if (res.closed) {
597
597
  return;
598
598
  }
599
+ const errorPayload = {
600
+ error: err.message,
601
+ stack: err.stack,
602
+ };
599
603
  console.error('Failed to send prompt', err);
600
604
  if (res.headersSent) {
601
605
  sendEvent(res, {
602
606
  type: 'ERROR_INTERNAL',
603
607
  created: Date.now(),
604
- payload: { error: err.message },
608
+ payload: errorPayload,
605
609
  reason: 'Failed while sending prompt',
606
610
  });
607
611
  }
608
612
  else {
609
- res.status(400).send({ error: err.message });
613
+ res.status(400).send(errorPayload);
610
614
  }
611
615
  }
612
616
  function waitForStormStream(result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.67.1",
3
+ "version": "0.67.2",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -140,6 +140,7 @@ export interface StormEventError {
140
140
  created: number;
141
141
  payload: {
142
142
  error: string;
143
+ stack?: string;
143
144
  };
144
145
  }
145
146
 
@@ -69,6 +69,9 @@ export async function writeImageToDisk(systemId: string, event: StormImage, prom
69
69
  }
70
70
 
71
71
  export function hasPageOnDisk(systemId: string, method: string, path: string) {
72
+ if (!systemId || !method || !path) {
73
+ return false;
74
+ }
72
75
  const baseDir = getSystemBaseDir(systemId);
73
76
  const filePath = getFilePath(method);
74
77
  const fullPath = Path.join(baseDir, normalizePath(path), filePath);
@@ -737,16 +737,23 @@ function sendError(err: Error, res: Response) {
737
737
  if (res.closed) {
738
738
  return;
739
739
  }
740
+
741
+ const errorPayload = {
742
+ error: err.message,
743
+ stack: err.stack,
744
+ };
745
+
740
746
  console.error('Failed to send prompt', err);
747
+
741
748
  if (res.headersSent) {
742
749
  sendEvent(res, {
743
750
  type: 'ERROR_INTERNAL',
744
751
  created: Date.now(),
745
- payload: { error: err.message },
752
+ payload: errorPayload,
746
753
  reason: 'Failed while sending prompt',
747
754
  });
748
755
  } else {
749
- res.status(400).send({ error: err.message });
756
+ res.status(400).send(errorPayload);
750
757
  }
751
758
  }
752
759