@kapeta/local-cluster-service 0.54.10 → 0.54.11

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.11](https://github.com/kapetacom/local-cluster-service/compare/v0.54.10...v0.54.11) (2024-07-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * handle unpredictable AI outputs ([#189](https://github.com/kapetacom/local-cluster-service/issues/189)) ([651c1dc](https://github.com/kapetacom/local-cluster-service/commit/651c1dc1c15e5392fc4f4b09f27ce42e4f7ae7a5))
7
+
1
8
  ## [0.54.10](https://github.com/kapetacom/local-cluster-service/compare/v0.54.9...v0.54.10) (2024-07-09)
2
9
 
3
10
 
@@ -386,12 +386,12 @@ class StormEventParser {
386
386
  const blockSpec = blockDefinitionInfo.content.spec;
387
387
  const apiResources = {};
388
388
  let dbResource = undefined;
389
- blockInfo.resources.forEach((resource) => {
389
+ (blockInfo.resources || []).forEach((resource) => {
390
390
  const port = {
391
391
  type: this.toPortType(resource.type),
392
392
  };
393
393
  switch (resource.type) {
394
- case 'API':
394
+ case 'API': {
395
395
  const apiResource = {
396
396
  kind: this.toResourceKind(resource.type),
397
397
  metadata: {
@@ -411,6 +411,7 @@ class StormEventParser {
411
411
  apiResources[resource.name] = apiResource;
412
412
  blockSpec.providers.push(apiResource);
413
413
  break;
414
+ }
414
415
  case 'CLIENT':
415
416
  blockSpec.consumers.push({
416
417
  kind: this.toResourceKind(resource.type),
@@ -508,7 +509,12 @@ class StormEventParser {
508
509
  // available rest resource
509
510
  const firstKey = Object.keys(apiResources)[0];
510
511
  const firstEntry = apiResources[firstKey];
511
- firstEntry.spec.source.value += api + '\n\n';
512
+ if (firstEntry) {
513
+ firstEntry.spec.source.value += api + '\n\n';
514
+ }
515
+ else {
516
+ console.warn('Unable to find resource for API', api);
517
+ }
512
518
  }
513
519
  });
514
520
  blockInfo.types.forEach((type) => {
@@ -386,12 +386,12 @@ class StormEventParser {
386
386
  const blockSpec = blockDefinitionInfo.content.spec;
387
387
  const apiResources = {};
388
388
  let dbResource = undefined;
389
- blockInfo.resources.forEach((resource) => {
389
+ (blockInfo.resources || []).forEach((resource) => {
390
390
  const port = {
391
391
  type: this.toPortType(resource.type),
392
392
  };
393
393
  switch (resource.type) {
394
- case 'API':
394
+ case 'API': {
395
395
  const apiResource = {
396
396
  kind: this.toResourceKind(resource.type),
397
397
  metadata: {
@@ -411,6 +411,7 @@ class StormEventParser {
411
411
  apiResources[resource.name] = apiResource;
412
412
  blockSpec.providers.push(apiResource);
413
413
  break;
414
+ }
414
415
  case 'CLIENT':
415
416
  blockSpec.consumers.push({
416
417
  kind: this.toResourceKind(resource.type),
@@ -508,7 +509,12 @@ class StormEventParser {
508
509
  // available rest resource
509
510
  const firstKey = Object.keys(apiResources)[0];
510
511
  const firstEntry = apiResources[firstKey];
511
- firstEntry.spec.source.value += api + '\n\n';
512
+ if (firstEntry) {
513
+ firstEntry.spec.source.value += api + '\n\n';
514
+ }
515
+ else {
516
+ console.warn('Unable to find resource for API', api);
517
+ }
512
518
  }
513
519
  });
514
520
  blockInfo.types.forEach((type) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.54.10",
3
+ "version": "0.54.11",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -26,7 +26,8 @@ import {
26
26
  DSLAPIParser,
27
27
  DSLController,
28
28
  DSLConverters,
29
- DSLDataTypeParser, DSLEntityType,
29
+ DSLDataTypeParser,
30
+ DSLEntityType,
30
31
  DSLMethod,
31
32
  DSLParser,
32
33
  KAPLANG_ID,
@@ -540,12 +541,12 @@ export class StormEventParser {
540
541
  const apiResources: { [key: string]: Resource | undefined } = {};
541
542
  let dbResource: Resource | undefined = undefined;
542
543
 
543
- blockInfo.resources.forEach((resource) => {
544
+ (blockInfo.resources || []).forEach((resource) => {
544
545
  const port = {
545
546
  type: this.toPortType(resource.type),
546
547
  };
547
548
  switch (resource.type) {
548
- case 'API':
549
+ case 'API': {
549
550
  const apiResource = {
550
551
  kind: this.toResourceKind(resource.type),
551
552
  metadata: {
@@ -565,6 +566,7 @@ export class StormEventParser {
565
566
  apiResources[resource.name] = apiResource;
566
567
  blockSpec.providers!.push(apiResource);
567
568
  break;
569
+ }
568
570
  case 'CLIENT':
569
571
  blockSpec.consumers!.push({
570
572
  kind: this.toResourceKind(resource.type),
@@ -665,7 +667,11 @@ export class StormEventParser {
665
667
  // available rest resource
666
668
  const firstKey = Object.keys(apiResources)[0];
667
669
  const firstEntry = apiResources[firstKey];
668
- firstEntry!.spec.source.value += api + '\n\n';
670
+ if (firstEntry) {
671
+ firstEntry.spec.source.value += api + '\n\n';
672
+ } else {
673
+ console.warn('Unable to find resource for API', api);
674
+ }
669
675
  }
670
676
  });
671
677