@kapeta/local-cluster-service 0.56.0 → 0.56.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,17 @@
1
+ ## [0.56.2](https://github.com/kapetacom/local-cluster-service/compare/v0.56.1...v0.56.2) (2024-07-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * missing pural on MODEL RETRY ([ca33bdd](https://github.com/kapetacom/local-cluster-service/commit/ca33bdd5e47b0c601d19ddf4149de5e925aa0040))
7
+
8
+ ## [0.56.1](https://github.com/kapetacom/local-cluster-service/compare/v0.56.0...v0.56.1) (2024-07-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * fix way of checking for kind ([495fdfa](https://github.com/kapetacom/local-cluster-service/commit/495fdfa13267bdd425e2486ec02f0a9922eca4ab))
14
+
1
15
  # [0.56.0](https://github.com/kapetacom/local-cluster-service/compare/v0.55.3...v0.56.0) (2024-07-15)
2
16
 
3
17
 
@@ -263,11 +263,14 @@ class StormCodegen {
263
263
  }
264
264
  const kapetaYaml = yaml_1.default.stringify(block.content);
265
265
  const blockDefinition = block.content;
266
+ const basePath = this.getBasePath(blockDefinition.metadata.name);
266
267
  // Generate the code for the block using the standard codegen templates
267
268
  const generatedResult = await this.generateBlock(blockDefinition);
268
269
  if (!generatedResult) {
269
270
  return;
270
271
  }
272
+ const kapetaYmlPath = (0, path_2.join)(basePath, 'kapeta.yml');
273
+ await (0, promises_1.writeFile)(kapetaYmlPath, kapetaYaml);
271
274
  const allFiles = this.toStormFiles(generatedResult);
272
275
  // Send all the non-ai files to the stream
273
276
  await this.emitStaticFiles((0, nodejs_utils_1.parseKapetaUri)(block.uri), block.aiName, allFiles);
@@ -357,7 +360,6 @@ class StormCodegen {
357
360
  if (this.isAborted()) {
358
361
  return;
359
362
  }
360
- const basePath = this.getBasePath(blockDefinition.metadata.name);
361
363
  const screenFilesConverted = screenFiles.map((screenFile) => {
362
364
  return {
363
365
  filename: screenFile.payload.filename,
@@ -397,8 +399,6 @@ class StormCodegen {
397
399
  const filePath = (0, path_2.join)(basePath, webRouterFile.filename);
398
400
  await (0, promises_1.writeFile)(filePath, webRouterFile.content);
399
401
  }
400
- const kapetaYmlPath = (0, path_2.join)(basePath, 'kapeta.yml');
401
- await (0, promises_1.writeFile)(kapetaYmlPath, kapetaYaml);
402
402
  const blockRef = block.uri;
403
403
  this.emitBlockStatus(blockUri, block.aiName, events_1.StormEventBlockStatusType.QA);
404
404
  /* TODO: temporarily disabled - enable again when codegen is more stable
@@ -224,7 +224,7 @@ class StormEventParser {
224
224
  block.apis = [];
225
225
  });
226
226
  break;
227
- case 'MODEL_RETRY':
227
+ case 'MODELS_RETRY':
228
228
  Object.values(this.blocks).forEach((block) => {
229
229
  block.models = [];
230
230
  });
@@ -282,7 +282,11 @@ class StormEventParser {
282
282
  console.warn('Client consumer not found: %s', apiConnection.toComponent, apiConnection);
283
283
  return;
284
284
  }
285
- const apiResource = apiProviderBlock.content.spec.providers?.find((p) => p.kind === this.options.apiKind && p.metadata.name === apiConnection.fromResource);
285
+ const apiResource = apiProviderBlock.content.spec.providers?.find((p) => {
286
+ const pKind = (0, nodejs_utils_1.normalizeKapetaUri)(p.kind);
287
+ const apiKind = (0, nodejs_utils_1.normalizeKapetaUri)(this.options.apiKind);
288
+ return pKind === apiKind && p.metadata.name === apiConnection.fromResource;
289
+ });
286
290
  if (!apiResource) {
287
291
  if (warn) {
288
292
  console.warn('API resource not found: %s on %s', apiConnection.fromResource, apiProviderRef.toNormalizedString(), apiConnection);
@@ -610,7 +614,11 @@ class StormEventParser {
610
614
  console.warn('Provider block not found: %s', connection.fromComponent, connection);
611
615
  return;
612
616
  }
613
- const apiResource = apiProviderBlock.content.spec.providers?.find((p) => p.kind === this.options.apiKind && p.metadata.name === connection.fromResource);
617
+ const apiResource = apiProviderBlock.content.spec.providers?.find((p) => {
618
+ const pKind = (0, nodejs_utils_1.normalizeKapetaUri)(p.kind);
619
+ const apiKind = (0, nodejs_utils_1.normalizeKapetaUri)(this.options.apiKind);
620
+ return pKind === apiKind && p.metadata.name === connection.fromResource;
621
+ });
614
622
  if (!apiResource) {
615
623
  if (warn) {
616
624
  console.warn('API resource not found: %s on %s', connection.fromResource, fromRef.toNormalizedString(), connection);
@@ -94,7 +94,7 @@ export interface StormEventCreateDSLResource extends Omit<StormEventCreateDSL, '
94
94
  };
95
95
  }
96
96
  export interface StormEventCreateDSLRetry {
97
- type: 'API_RETRY' | 'MODEL_RETRY';
97
+ type: 'API_RETRY' | 'MODELS_RETRY';
98
98
  reason: string;
99
99
  created: number;
100
100
  payload: {
@@ -263,11 +263,14 @@ class StormCodegen {
263
263
  }
264
264
  const kapetaYaml = yaml_1.default.stringify(block.content);
265
265
  const blockDefinition = block.content;
266
+ const basePath = this.getBasePath(blockDefinition.metadata.name);
266
267
  // Generate the code for the block using the standard codegen templates
267
268
  const generatedResult = await this.generateBlock(blockDefinition);
268
269
  if (!generatedResult) {
269
270
  return;
270
271
  }
272
+ const kapetaYmlPath = (0, path_2.join)(basePath, 'kapeta.yml');
273
+ await (0, promises_1.writeFile)(kapetaYmlPath, kapetaYaml);
271
274
  const allFiles = this.toStormFiles(generatedResult);
272
275
  // Send all the non-ai files to the stream
273
276
  await this.emitStaticFiles((0, nodejs_utils_1.parseKapetaUri)(block.uri), block.aiName, allFiles);
@@ -357,7 +360,6 @@ class StormCodegen {
357
360
  if (this.isAborted()) {
358
361
  return;
359
362
  }
360
- const basePath = this.getBasePath(blockDefinition.metadata.name);
361
363
  const screenFilesConverted = screenFiles.map((screenFile) => {
362
364
  return {
363
365
  filename: screenFile.payload.filename,
@@ -397,8 +399,6 @@ class StormCodegen {
397
399
  const filePath = (0, path_2.join)(basePath, webRouterFile.filename);
398
400
  await (0, promises_1.writeFile)(filePath, webRouterFile.content);
399
401
  }
400
- const kapetaYmlPath = (0, path_2.join)(basePath, 'kapeta.yml');
401
- await (0, promises_1.writeFile)(kapetaYmlPath, kapetaYaml);
402
402
  const blockRef = block.uri;
403
403
  this.emitBlockStatus(blockUri, block.aiName, events_1.StormEventBlockStatusType.QA);
404
404
  /* TODO: temporarily disabled - enable again when codegen is more stable
@@ -224,7 +224,7 @@ class StormEventParser {
224
224
  block.apis = [];
225
225
  });
226
226
  break;
227
- case 'MODEL_RETRY':
227
+ case 'MODELS_RETRY':
228
228
  Object.values(this.blocks).forEach((block) => {
229
229
  block.models = [];
230
230
  });
@@ -282,7 +282,11 @@ class StormEventParser {
282
282
  console.warn('Client consumer not found: %s', apiConnection.toComponent, apiConnection);
283
283
  return;
284
284
  }
285
- const apiResource = apiProviderBlock.content.spec.providers?.find((p) => p.kind === this.options.apiKind && p.metadata.name === apiConnection.fromResource);
285
+ const apiResource = apiProviderBlock.content.spec.providers?.find((p) => {
286
+ const pKind = (0, nodejs_utils_1.normalizeKapetaUri)(p.kind);
287
+ const apiKind = (0, nodejs_utils_1.normalizeKapetaUri)(this.options.apiKind);
288
+ return pKind === apiKind && p.metadata.name === apiConnection.fromResource;
289
+ });
286
290
  if (!apiResource) {
287
291
  if (warn) {
288
292
  console.warn('API resource not found: %s on %s', apiConnection.fromResource, apiProviderRef.toNormalizedString(), apiConnection);
@@ -610,7 +614,11 @@ class StormEventParser {
610
614
  console.warn('Provider block not found: %s', connection.fromComponent, connection);
611
615
  return;
612
616
  }
613
- const apiResource = apiProviderBlock.content.spec.providers?.find((p) => p.kind === this.options.apiKind && p.metadata.name === connection.fromResource);
617
+ const apiResource = apiProviderBlock.content.spec.providers?.find((p) => {
618
+ const pKind = (0, nodejs_utils_1.normalizeKapetaUri)(p.kind);
619
+ const apiKind = (0, nodejs_utils_1.normalizeKapetaUri)(this.options.apiKind);
620
+ return pKind === apiKind && p.metadata.name === connection.fromResource;
621
+ });
614
622
  if (!apiResource) {
615
623
  if (warn) {
616
624
  console.warn('API resource not found: %s on %s', connection.fromResource, fromRef.toNormalizedString(), connection);
@@ -94,7 +94,7 @@ export interface StormEventCreateDSLResource extends Omit<StormEventCreateDSL, '
94
94
  };
95
95
  }
96
96
  export interface StormEventCreateDSLRetry {
97
- type: 'API_RETRY' | 'MODEL_RETRY';
97
+ type: 'API_RETRY' | 'MODELS_RETRY';
98
98
  reason: string;
99
99
  created: number;
100
100
  payload: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.56.0",
3
+ "version": "0.56.2",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -299,6 +299,7 @@ export class StormCodegen {
299
299
 
300
300
  const kapetaYaml = YAML.stringify(block.content);
301
301
  const blockDefinition = block.content;
302
+ const basePath = this.getBasePath(blockDefinition.metadata.name);
302
303
 
303
304
  // Generate the code for the block using the standard codegen templates
304
305
  const generatedResult = await this.generateBlock(blockDefinition);
@@ -306,6 +307,9 @@ export class StormCodegen {
306
307
  return;
307
308
  }
308
309
 
310
+ const kapetaYmlPath = join(basePath, 'kapeta.yml');
311
+ await writeFile(kapetaYmlPath, kapetaYaml);
312
+
309
313
  const allFiles = this.toStormFiles(generatedResult);
310
314
 
311
315
  // Send all the non-ai files to the stream
@@ -421,7 +425,6 @@ export class StormCodegen {
421
425
  if (this.isAborted()) {
422
426
  return;
423
427
  }
424
- const basePath = this.getBasePath(blockDefinition.metadata.name);
425
428
 
426
429
  const screenFilesConverted = screenFiles.map((screenFile) => {
427
430
  return {
@@ -485,8 +488,6 @@ export class StormCodegen {
485
488
  await writeFile(filePath, webRouterFile.content);
486
489
  }
487
490
 
488
- const kapetaYmlPath = join(basePath, 'kapeta.yml');
489
- await writeFile(kapetaYmlPath, kapetaYaml);
490
491
 
491
492
  const blockRef = block.uri;
492
493
 
@@ -340,7 +340,7 @@ export class StormEventParser {
340
340
  block.apis = [];
341
341
  });
342
342
  break;
343
- case 'MODEL_RETRY':
343
+ case 'MODELS_RETRY':
344
344
  Object.values(this.blocks).forEach((block) => {
345
345
  block.models = [];
346
346
  });
@@ -406,7 +406,11 @@ export class StormEventParser {
406
406
  }
407
407
 
408
408
  const apiResource = apiProviderBlock.content.spec.providers?.find(
409
- (p) => p.kind === this.options.apiKind && p.metadata.name === apiConnection.fromResource
409
+ (p) => {
410
+ const pKind = normalizeKapetaUri(p.kind);
411
+ const apiKind = normalizeKapetaUri(this.options.apiKind);
412
+ return pKind === apiKind && p.metadata.name === apiConnection.fromResource
413
+ }
410
414
  );
411
415
 
412
416
  if (!apiResource) {
@@ -791,8 +795,12 @@ export class StormEventParser {
791
795
  }
792
796
 
793
797
  const apiResource = apiProviderBlock.content.spec.providers?.find(
794
- (p) => p.kind === this.options.apiKind && p.metadata.name === connection.fromResource
795
- );
798
+ (p) => {
799
+ const pKind = normalizeKapetaUri(p.kind);
800
+ const apiKind = normalizeKapetaUri(this.options.apiKind);
801
+ return pKind === apiKind && p.metadata.name === connection.fromResource
802
+ }
803
+ );
796
804
 
797
805
  if (!apiResource) {
798
806
  if (warn) {
@@ -120,7 +120,7 @@ export interface StormEventCreateDSLResource extends Omit<StormEventCreateDSL, '
120
120
  }
121
121
 
122
122
  export interface StormEventCreateDSLRetry {
123
- type: 'API_RETRY' | 'MODEL_RETRY';
123
+ type: 'API_RETRY' | 'MODELS_RETRY';
124
124
  reason: string;
125
125
  created: number;
126
126
  payload: {