@kapeta/local-cluster-service 0.54.1 → 0.54.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,10 @@
1
+ ## [0.54.2](https://github.com/kapetacom/local-cluster-service/compare/v0.54.1...v0.54.2) (2024-06-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * handle error events to/from screen AIs ([#181](https://github.com/kapetacom/local-cluster-service/issues/181)) ([6cfd9d4](https://github.com/kapetacom/local-cluster-service/commit/6cfd9d48d221ba3c3b16c8514a7d19d6e4ffd805))
7
+
1
8
  ## [0.54.1](https://github.com/kapetacom/local-cluster-service/compare/v0.54.0...v0.54.1) (2024-06-19)
2
9
 
3
10
 
@@ -151,6 +151,9 @@ class StormCodegen {
151
151
  break;
152
152
  case 'FILE_DONE':
153
153
  return this.handleFileDoneOutput(blockUri, blockName, data);
154
+ default:
155
+ console.warn('Unknown event type', data);
156
+ break;
154
157
  }
155
158
  }
156
159
  handleFileEvents(blockUri, blockName, data) {
@@ -250,6 +253,13 @@ class StormCodegen {
250
253
  filteredEvents = [];
251
254
  }
252
255
  }
256
+ const failedEvents = filteredEvents.filter((event) => event.type.endsWith('_FAILED'));
257
+ if (failedEvents.length > 0) {
258
+ console.warn('Codegen encountered failed plan events. Plan might be invalid', failedEvents);
259
+ }
260
+ // Skip failed events - they are not relevant to the materializer
261
+ // TODO: should the materializer be able to handle failed events?
262
+ filteredEvents = filteredEvents.filter((event) => !event.type.endsWith('_FAILED') && !event.type.endsWith('ERROR_INTERNAL'));
253
263
  const screenEvents = [];
254
264
  const getScreenEventsFile = () => ({
255
265
  content: JSON.stringify(screenEvents),
@@ -350,7 +360,6 @@ class StormCodegen {
350
360
  return;
351
361
  }
352
362
  for (const screenFile of screenFilesConverted) {
353
- // this.emitFile(blockUri, block.aiName, screenFile.filename, screenFile.content);
354
363
  const filePath = (0, path_2.join)(basePath, screenFile.filename);
355
364
  await (0, promises_1.writeFile)(filePath, screenFile.content);
356
365
  }
@@ -151,6 +151,9 @@ class StormCodegen {
151
151
  break;
152
152
  case 'FILE_DONE':
153
153
  return this.handleFileDoneOutput(blockUri, blockName, data);
154
+ default:
155
+ console.warn('Unknown event type', data);
156
+ break;
154
157
  }
155
158
  }
156
159
  handleFileEvents(blockUri, blockName, data) {
@@ -250,6 +253,13 @@ class StormCodegen {
250
253
  filteredEvents = [];
251
254
  }
252
255
  }
256
+ const failedEvents = filteredEvents.filter((event) => event.type.endsWith('_FAILED'));
257
+ if (failedEvents.length > 0) {
258
+ console.warn('Codegen encountered failed plan events. Plan might be invalid', failedEvents);
259
+ }
260
+ // Skip failed events - they are not relevant to the materializer
261
+ // TODO: should the materializer be able to handle failed events?
262
+ filteredEvents = filteredEvents.filter((event) => !event.type.endsWith('_FAILED') && !event.type.endsWith('ERROR_INTERNAL'));
253
263
  const screenEvents = [];
254
264
  const getScreenEventsFile = () => ({
255
265
  content: JSON.stringify(screenEvents),
@@ -350,7 +360,6 @@ class StormCodegen {
350
360
  return;
351
361
  }
352
362
  for (const screenFile of screenFilesConverted) {
353
- // this.emitFile(blockUri, block.aiName, screenFile.filename, screenFile.content);
354
363
  const filePath = (0, path_2.join)(basePath, screenFile.filename);
355
364
  await (0, promises_1.writeFile)(filePath, screenFile.content);
356
365
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.54.1",
3
+ "version": "0.54.2",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -174,6 +174,9 @@ export class StormCodegen {
174
174
  break;
175
175
  case 'FILE_DONE':
176
176
  return this.handleFileDoneOutput(blockUri, blockName, data);
177
+ default:
178
+ console.warn('Unknown event type', data);
179
+ break;
177
180
  }
178
181
  }
179
182
 
@@ -279,6 +282,7 @@ export class StormCodegen {
279
282
  );
280
283
  const uiTemplates = allFiles.filter((file) => file.type === AIFileTypes.WEB_SCREEN);
281
284
  const screenFiles: StormEventFileDone[] = [];
285
+
282
286
  let filteredEvents = [] as StormEvent[];
283
287
  for (const event of this.events) {
284
288
  filteredEvents.push(event);
@@ -287,6 +291,16 @@ export class StormCodegen {
287
291
  }
288
292
  }
289
293
 
294
+ const failedEvents = filteredEvents.filter((event) => event.type.endsWith('_FAILED'));
295
+ if (failedEvents.length > 0) {
296
+ console.warn('Codegen encountered failed plan events. Plan might be invalid', failedEvents);
297
+ }
298
+ // Skip failed events - they are not relevant to the materializer
299
+ // TODO: should the materializer be able to handle failed events?
300
+ filteredEvents = filteredEvents.filter(
301
+ (event) => !event.type.endsWith('_FAILED') && !event.type.endsWith('ERROR_INTERNAL')
302
+ );
303
+
290
304
  const screenEvents: StormEventScreen[] = [];
291
305
  const getScreenEventsFile = () => ({
292
306
  content: JSON.stringify(screenEvents),
@@ -419,7 +433,6 @@ export class StormCodegen {
419
433
  }
420
434
 
421
435
  for (const screenFile of screenFilesConverted) {
422
- // this.emitFile(blockUri, block.aiName, screenFile.filename, screenFile.content);
423
436
  const filePath = join(basePath, screenFile.filename);
424
437
  await writeFile(filePath, screenFile.content);
425
438
  }