@omen.foundation/node-microservice-runtime 0.1.106 → 0.1.108

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omen.foundation/node-microservice-runtime",
3
- "version": "0.1.106",
3
+ "version": "0.1.108",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -789,8 +789,8 @@ async function discoverStorageObjects(srcDir, cwd = process.cwd()) {
789
789
  id: storageName,
790
790
  enabled: true,
791
791
  templateId: 'small', // Match C# CLI default (DeploymentService.cs line 1620)
792
- checksum: null,
793
- archived: false,
792
+ archived: false, // Match C# CLI default (DeploymentService.cs line 1618)
793
+ checksum: null, // Not sent to backend, just for internal tracking
794
794
  });
795
795
  console.log(`[beamo-node] ✓ Discovered storage object: ${storageName} (from ${path.relative(cwd, file)})`);
796
796
  }
@@ -935,40 +935,48 @@ async function updateManifest({
935
935
  if (!storageMap.has(s.id)) {
936
936
  // New storage - create ServiceStorageReference matching backend case class:
937
937
  // case class ServiceStorageReference(id: String, storageType: String, enabled: Boolean, templateId: Option[String] = None, archived: Option[Boolean] = None)
938
- // Match C# CLI behavior: always set templateId to "small" (DeploymentService.cs line 1620)
938
+ // Match C# CLI behavior: always set templateId="small" and archived=false (DeploymentService.cs lines 1618, 1620)
939
939
  const newStorage = {
940
940
  id: s.id,
941
941
  storageType: 'mongov1', // All discovered storage uses MongoDB
942
942
  enabled: true,
943
943
  templateId: s.templateId || 'small', // Default to "small" like C# CLI
944
- ...(s.archived !== undefined ? { archived: s.archived } : {}),
944
+ archived: s.archived !== undefined ? s.archived : false, // Always include archived, default to false like C# CLI
945
945
  };
946
946
  storageMap.set(s.id, newStorage);
947
947
  console.log(`[beamo-node] Adding new storage to manifest: ${s.id} (type: ${newStorage.storageType}, enabled: ${newStorage.enabled})`);
948
948
  } else {
949
949
  // Update existing storage to ensure storageType is 'mongov1' and format is correct
950
- // Match C# CLI behavior: always set templateId to "small" if not present (DeploymentService.cs line 1620)
950
+ // Match C# CLI behavior: always set templateId="small" and archived=false (DeploymentService.cs lines 1618, 1620)
951
951
  const existing = storageMap.get(s.id);
952
952
  const updatedStorage = {
953
953
  id: existing.id,
954
954
  storageType: 'mongov1',
955
955
  enabled: existing.enabled !== false, // Ensure enabled is true unless explicitly false
956
956
  templateId: existing.templateId || 'small', // Default to "small" like C# CLI
957
- ...(existing.archived !== undefined ? { archived: existing.archived } : {}),
957
+ archived: existing.archived !== undefined ? existing.archived : false, // Always include archived, default to false like C# CLI
958
958
  };
959
959
  storageMap.set(s.id, updatedStorage);
960
960
  console.log(`[beamo-node] Updating existing storage in manifest: ${s.id} (type: mongov1, enabled: ${updatedStorage.enabled})`);
961
961
  }
962
962
  });
963
963
  // Convert to array and remove any extra fields (like checksum) that backend doesn't expect
964
- // Ensure templateId is always set to "small" (matching C# CLI behavior)
964
+ // Match C# CLI behavior exactly: always include templateId="small" and archived=false
965
965
  const storageReferences = Array.from(storageMap.values()).map(s => ({
966
966
  id: s.id,
967
967
  storageType: s.storageType,
968
968
  enabled: s.enabled,
969
969
  templateId: s.templateId || 'small', // Always include templateId, default to "small" like C# CLI
970
- ...(s.archived !== undefined ? { archived: s.archived } : {}),
970
+ archived: s.archived !== undefined ? s.archived : false, // Always include archived, default to false like C# CLI
971
971
  }));
972
+
973
+ // Log storage references being sent to backend for debugging
974
+ if (storageReferences.length > 0) {
975
+ console.log(`[beamo-node] Publishing ${storageReferences.length} storage reference(s) to backend:`);
976
+ storageReferences.forEach(sr => {
977
+ console.log(`[beamo-node] - ${sr.id}: type=${sr.storageType}, enabled=${sr.enabled}, templateId=${sr.templateId || 'small'}`);
978
+ });
979
+ }
972
980
 
973
981
  // Extract existing components and dependencies for the service
974
982
  const existingServiceRef = serviceReferences.find(
@@ -1065,13 +1073,6 @@ async function updateManifest({
1065
1073
  });
1066
1074
  }
1067
1075
 
1068
- const requestBody = {
1069
- autoDeploy: true,
1070
- comments: comments ?? '',
1071
- manifest: mappedServices,
1072
- storageReferences,
1073
- };
1074
-
1075
1076
  // Log storage references being sent to backend
1076
1077
  if (storageReferences.length > 0) {
1077
1078
  console.log(`[beamo-node] Publishing ${storageReferences.length} storage reference(s) in manifest:`);
@@ -1091,6 +1092,21 @@ async function updateManifest({
1091
1092
  console.warn(`[beamo-node] Make sure you have @StorageObject('StorageName') decorators in your code.`);
1092
1093
  }
1093
1094
 
1095
+ // Build request body matching C# CLI format exactly
1096
+ // C# sends: { comments, manifest, storageReferences } where storageReferences comes from manifest.storageReference
1097
+ // C# assigns it directly, so if null/empty it serializes as null (not omitted)
1098
+ const requestBody = {
1099
+ autoDeploy: true,
1100
+ comments: comments ?? '',
1101
+ manifest: mappedServices,
1102
+ storageReferences: storageReferences.length > 0 ? storageReferences : null,
1103
+ };
1104
+
1105
+ // Log full request body structure to verify format
1106
+ if (storageReferences.length > 0) {
1107
+ console.log(`[beamo-node] Request body includes storageReferences: ${storageReferences.length} reference(s)`);
1108
+ }
1109
+
1094
1110
  const publishUrl = new URL('/basic/beamo/manifest', apiHost);
1095
1111
  const publishHeaders = {
1096
1112
  Authorization: `Bearer ${token}`,