@kapeta/local-cluster-service 0.54.4 → 0.54.6

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,18 @@
1
+ ## [0.54.6](https://github.com/kapetacom/local-cluster-service/compare/v0.54.5...v0.54.6) (2024-06-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * dont run codegen after moving block to dest folder ([#186](https://github.com/kapetacom/local-cluster-service/issues/186)) ([f0f4a36](https://github.com/kapetacom/local-cluster-service/commit/f0f4a363c32c20074fbf9aa333f87ceada4a81a2))
7
+
8
+ ## [0.54.5](https://github.com/kapetacom/local-cluster-service/compare/v0.54.4...v0.54.5) (2024-06-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * enable filesToBeFixed inclusion list in codefix ([4eaf272](https://github.com/kapetacom/local-cluster-service/commit/4eaf2720bc49b5709c170f88a85614b1a1a8bb8b))
14
+ * forward FILE_FAILED events from streams ([fc22b68](https://github.com/kapetacom/local-cluster-service/commit/fc22b68e129546166c117ea5d13efeebf4bd9d72))
15
+
1
16
  ## [0.54.4](https://github.com/kapetacom/local-cluster-service/compare/v0.54.3...v0.54.4) (2024-06-20)
2
17
 
3
18
 
@@ -195,6 +195,17 @@ class StormCodegen {
195
195
  },
196
196
  });
197
197
  return true;
198
+ case 'FILE_FAILED':
199
+ this.out.emit('data', {
200
+ ...data,
201
+ payload: {
202
+ ...data.payload,
203
+ path: (0, path_2.join)(basePath, data.payload.filename),
204
+ blockName,
205
+ blockRef,
206
+ instanceId,
207
+ },
208
+ });
198
209
  }
199
210
  return false;
200
211
  }
@@ -428,8 +439,9 @@ class StormCodegen {
428
439
  if (errors.size > 0) {
429
440
  this.emitBlockStatus(blockUri, blockName, events_1.StormEventBlockStatusType.FIXING);
430
441
  const promises = Array.from(errors.entries()).map(([filename, fileErrors]) => {
431
- // todo: only try to fix file if it is part of filesToBeFixed
432
- return this.tryToFixFile(blockUri, blockName, basePath, filename, fileErrors, allFiles, codeGenerator);
442
+ if (filesToBeFixed.some((file) => file.filename === filename)) {
443
+ return this.tryToFixFile(blockUri, blockName, basePath, filename, fileErrors, allFiles, codeGenerator);
444
+ }
433
445
  });
434
446
  await Promise.all(promises);
435
447
  }
@@ -200,6 +200,12 @@ export interface StormEventFileDone extends StormEventFileBase {
200
200
  content: string;
201
201
  };
202
202
  }
203
+ export interface StormEventFileFailed extends StormEventFileBase {
204
+ type: 'FILE_FAILED';
205
+ payload: StormEventFileBasePayload & {
206
+ error: string;
207
+ };
208
+ }
203
209
  export interface StormEventFileChunk extends StormEventFileBase {
204
210
  type: 'FILE_CHUNK';
205
211
  payload: StormEventFileBasePayload & {
@@ -259,4 +265,4 @@ export interface StormEventPhases {
259
265
  phaseType: StormEventPhaseType;
260
266
  };
261
267
  }
262
- export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState | StormEventFileDone | StormEventFileChunk | StormEventDone | StormEventDefinitionChange | StormEventErrorClassifier | StormEventCodeFix | StormEventErrorDetails | StormEventBlockReady | StormEventPhases | StormEventBlockStatus | StormEventCreateDSLRetry;
268
+ export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState | StormEventFileDone | StormEventFileFailed | StormEventFileChunk | StormEventDone | StormEventDefinitionChange | StormEventErrorClassifier | StormEventCodeFix | StormEventErrorDetails | StormEventBlockReady | StormEventPhases | StormEventBlockStatus | StormEventCreateDSLRetry;
@@ -117,7 +117,9 @@ router.post('/block/create', async (req, res) => {
117
117
  overwrite: true,
118
118
  });
119
119
  }
120
- const [asset] = await assetManager_1.assetManager.createAsset(ymlPath, createRequest.definition);
120
+ // Create asset without running codegen if the asset already exists
121
+ const shouldCodegen = !isExisting;
122
+ const [asset] = await assetManager_1.assetManager.createAsset(ymlPath, createRequest.definition, 'user', shouldCodegen);
121
123
  res.send(asset);
122
124
  }
123
125
  catch (err) {
@@ -195,6 +195,17 @@ class StormCodegen {
195
195
  },
196
196
  });
197
197
  return true;
198
+ case 'FILE_FAILED':
199
+ this.out.emit('data', {
200
+ ...data,
201
+ payload: {
202
+ ...data.payload,
203
+ path: (0, path_2.join)(basePath, data.payload.filename),
204
+ blockName,
205
+ blockRef,
206
+ instanceId,
207
+ },
208
+ });
198
209
  }
199
210
  return false;
200
211
  }
@@ -428,8 +439,9 @@ class StormCodegen {
428
439
  if (errors.size > 0) {
429
440
  this.emitBlockStatus(blockUri, blockName, events_1.StormEventBlockStatusType.FIXING);
430
441
  const promises = Array.from(errors.entries()).map(([filename, fileErrors]) => {
431
- // todo: only try to fix file if it is part of filesToBeFixed
432
- return this.tryToFixFile(blockUri, blockName, basePath, filename, fileErrors, allFiles, codeGenerator);
442
+ if (filesToBeFixed.some((file) => file.filename === filename)) {
443
+ return this.tryToFixFile(blockUri, blockName, basePath, filename, fileErrors, allFiles, codeGenerator);
444
+ }
433
445
  });
434
446
  await Promise.all(promises);
435
447
  }
@@ -200,6 +200,12 @@ export interface StormEventFileDone extends StormEventFileBase {
200
200
  content: string;
201
201
  };
202
202
  }
203
+ export interface StormEventFileFailed extends StormEventFileBase {
204
+ type: 'FILE_FAILED';
205
+ payload: StormEventFileBasePayload & {
206
+ error: string;
207
+ };
208
+ }
203
209
  export interface StormEventFileChunk extends StormEventFileBase {
204
210
  type: 'FILE_CHUNK';
205
211
  payload: StormEventFileBasePayload & {
@@ -259,4 +265,4 @@ export interface StormEventPhases {
259
265
  phaseType: StormEventPhaseType;
260
266
  };
261
267
  }
262
- export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState | StormEventFileDone | StormEventFileChunk | StormEventDone | StormEventDefinitionChange | StormEventErrorClassifier | StormEventCodeFix | StormEventErrorDetails | StormEventBlockReady | StormEventPhases | StormEventBlockStatus | StormEventCreateDSLRetry;
268
+ export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState | StormEventFileDone | StormEventFileFailed | StormEventFileChunk | StormEventDone | StormEventDefinitionChange | StormEventErrorClassifier | StormEventCodeFix | StormEventErrorDetails | StormEventBlockReady | StormEventPhases | StormEventBlockStatus | StormEventCreateDSLRetry;
@@ -117,7 +117,9 @@ router.post('/block/create', async (req, res) => {
117
117
  overwrite: true,
118
118
  });
119
119
  }
120
- const [asset] = await assetManager_1.assetManager.createAsset(ymlPath, createRequest.definition);
120
+ // Create asset without running codegen if the asset already exists
121
+ const shouldCodegen = !isExisting;
122
+ const [asset] = await assetManager_1.assetManager.createAsset(ymlPath, createRequest.definition, 'user', shouldCodegen);
121
123
  res.send(asset);
122
124
  }
123
125
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.54.4",
3
+ "version": "0.54.6",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -217,6 +217,17 @@ export class StormCodegen {
217
217
  },
218
218
  });
219
219
  return true;
220
+ case 'FILE_FAILED':
221
+ this.out.emit('data', {
222
+ ...data,
223
+ payload: {
224
+ ...data.payload,
225
+ path: join(basePath, data.payload.filename),
226
+ blockName,
227
+ blockRef,
228
+ instanceId,
229
+ },
230
+ });
220
231
  }
221
232
 
222
233
  return false;
@@ -524,16 +535,17 @@ export class StormCodegen {
524
535
  this.emitBlockStatus(blockUri, blockName, StormEventBlockStatusType.FIXING);
525
536
 
526
537
  const promises = Array.from(errors.entries()).map(([filename, fileErrors]) => {
527
- // todo: only try to fix file if it is part of filesToBeFixed
528
- return this.tryToFixFile(
529
- blockUri,
530
- blockName,
531
- basePath,
532
- filename,
533
- fileErrors,
534
- allFiles,
535
- codeGenerator
536
- );
538
+ if (filesToBeFixed.some((file) => file.filename === filename)) {
539
+ return this.tryToFixFile(
540
+ blockUri,
541
+ blockName,
542
+ basePath,
543
+ filename,
544
+ fileErrors,
545
+ allFiles,
546
+ codeGenerator
547
+ );
548
+ }
537
549
  });
538
550
 
539
551
  await Promise.all(promises);
@@ -241,6 +241,13 @@ export interface StormEventFileDone extends StormEventFileBase {
241
241
  };
242
242
  }
243
243
 
244
+ export interface StormEventFileFailed extends StormEventFileBase {
245
+ type: 'FILE_FAILED';
246
+ payload: StormEventFileBasePayload & {
247
+ error: string;
248
+ };
249
+ }
250
+
244
251
  export interface StormEventFileChunk extends StormEventFileBase {
245
252
  type: 'FILE_CHUNK';
246
253
  payload: StormEventFileBasePayload & {
@@ -322,6 +329,7 @@ export type StormEvent =
322
329
  | StormEventFileLogical
323
330
  | StormEventFileState
324
331
  | StormEventFileDone
332
+ | StormEventFileFailed
325
333
  | StormEventFileChunk
326
334
  | StormEventDone
327
335
  | StormEventDefinitionChange
@@ -153,7 +153,9 @@ router.post('/block/create', async (req: KapetaBodyRequest, res: Response) => {
153
153
  overwrite: true,
154
154
  });
155
155
  }
156
- const [asset] = await assetManager.createAsset(ymlPath, createRequest.definition);
156
+ // Create asset without running codegen if the asset already exists
157
+ const shouldCodegen = !isExisting;
158
+ const [asset] = await assetManager.createAsset(ymlPath, createRequest.definition, 'user', shouldCodegen);
157
159
  res.send(asset);
158
160
  } catch (err: any) {
159
161
  res.status(500).send({ error: err.message });