@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 +8 -0
- package/dist/cjs/src/storm/events.d.ts +1 -0
- package/dist/cjs/src/storm/page-utils.js +3 -0
- package/dist/cjs/src/storm/routes.js +6 -2
- package/dist/esm/src/storm/events.d.ts +1 -0
- package/dist/esm/src/storm/page-utils.js +3 -0
- package/dist/esm/src/storm/routes.js +6 -2
- package/package.json +1 -1
- package/src/storm/events.ts +1 -0
- package/src/storm/page-utils.ts +3 -0
- package/src/storm/routes.ts +9 -2
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
|
|
@@ -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:
|
608
|
+
payload: errorPayload,
|
605
609
|
reason: 'Failed while sending prompt',
|
606
610
|
});
|
607
611
|
}
|
608
612
|
else {
|
609
|
-
res.status(400).send(
|
613
|
+
res.status(400).send(errorPayload);
|
610
614
|
}
|
611
615
|
}
|
612
616
|
function waitForStormStream(result) {
|
@@ -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:
|
608
|
+
payload: errorPayload,
|
605
609
|
reason: 'Failed while sending prompt',
|
606
610
|
});
|
607
611
|
}
|
608
612
|
else {
|
609
|
-
res.status(400).send(
|
613
|
+
res.status(400).send(errorPayload);
|
610
614
|
}
|
611
615
|
}
|
612
616
|
function waitForStormStream(result) {
|
package/package.json
CHANGED
package/src/storm/events.ts
CHANGED
package/src/storm/page-utils.ts
CHANGED
@@ -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);
|
package/src/storm/routes.ts
CHANGED
@@ -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:
|
752
|
+
payload: errorPayload,
|
746
753
|
reason: 'Failed while sending prompt',
|
747
754
|
});
|
748
755
|
} else {
|
749
|
-
res.status(400).send(
|
756
|
+
res.status(400).send(errorPayload);
|
750
757
|
}
|
751
758
|
}
|
752
759
|
|