@omen.foundation/node-microservice-runtime 0.1.104 → 0.1.105

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.104",
3
+ "version": "0.1.105",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -911,8 +911,10 @@ async function updateManifest({
911
911
  id: reference.id?.Value ?? reference.id,
912
912
  storageType: reference.storageType?.Value ?? reference.storageType ?? 'mongov1',
913
913
  enabled: reference.enabled?.Value ?? reference.enabled ?? true,
914
- checksum: reference.checksum?.Value ?? reference.checksum,
915
- archived: reference.archived?.Value ?? reference.archived ?? false,
914
+ // templateId and archived are optional - only include if present
915
+ ...(reference.templateId ? { templateId: reference.templateId?.Value ?? reference.templateId } : {}),
916
+ ...(reference.archived !== undefined ? { archived: reference.archived?.Value ?? reference.archived ?? false } : {}),
917
+ // Note: checksum is computed by backend, we don't send it
916
918
  }))
917
919
  : [];
918
920
 
@@ -930,20 +932,41 @@ async function updateManifest({
930
932
  });
931
933
  discoveredStorage.forEach(s => {
932
934
  if (!storageMap.has(s.id)) {
933
- storageMap.set(s.id, {
934
- ...s,
935
+ // New storage - create ServiceStorageReference matching backend case class:
936
+ // case class ServiceStorageReference(id: String, storageType: String, enabled: Boolean, templateId: Option[String] = None, archived: Option[Boolean] = None)
937
+ const newStorage = {
938
+ id: s.id,
935
939
  storageType: 'mongov1', // All discovered storage uses MongoDB
936
- });
940
+ enabled: true,
941
+ // templateId and archived are optional - only include if explicitly set
942
+ ...(s.templateId ? { templateId: s.templateId } : {}),
943
+ ...(s.archived !== undefined ? { archived: s.archived } : {}),
944
+ };
945
+ storageMap.set(s.id, newStorage);
946
+ console.log(`[beamo-node] Adding new storage to manifest: ${s.id} (type: ${newStorage.storageType}, enabled: ${newStorage.enabled})`);
937
947
  } else {
938
- // Update existing storage to ensure storageType is 'mongov1'
948
+ // Update existing storage to ensure storageType is 'mongov1' and format is correct
939
949
  const existing = storageMap.get(s.id);
940
- storageMap.set(s.id, {
941
- ...existing,
950
+ const updatedStorage = {
951
+ id: existing.id,
942
952
  storageType: 'mongov1',
943
- });
953
+ enabled: existing.enabled !== false, // Ensure enabled is true unless explicitly false
954
+ // Only include optional fields if they have values
955
+ ...(existing.templateId ? { templateId: existing.templateId } : {}),
956
+ ...(existing.archived !== undefined ? { archived: existing.archived } : {}),
957
+ };
958
+ storageMap.set(s.id, updatedStorage);
959
+ console.log(`[beamo-node] Updating existing storage in manifest: ${s.id} (type: mongov1, enabled: ${updatedStorage.enabled})`);
944
960
  }
945
961
  });
946
- const storageReferences = Array.from(storageMap.values());
962
+ // Convert to array and remove any extra fields (like checksum) that backend doesn't expect
963
+ const storageReferences = Array.from(storageMap.values()).map(s => ({
964
+ id: s.id,
965
+ storageType: s.storageType,
966
+ enabled: s.enabled,
967
+ ...(s.templateId ? { templateId: s.templateId } : {}),
968
+ ...(s.archived !== undefined ? { archived: s.archived } : {}),
969
+ }));
947
970
 
948
971
  // Extract existing components and dependencies for the service
949
972
  const existingServiceRef = serviceReferences.find(
@@ -1051,10 +1074,19 @@ async function updateManifest({
1051
1074
  if (storageReferences.length > 0) {
1052
1075
  console.log(`[beamo-node] Publishing ${storageReferences.length} storage reference(s) in manifest:`);
1053
1076
  storageReferences.forEach(s => {
1054
- console.log(`[beamo-node] - ${s.id} (type: ${s.storageType || 'mongov1'}, enabled: ${s.enabled !== false})`);
1077
+ const details = [
1078
+ `id: ${s.id}`,
1079
+ `storageType: ${s.storageType || 'mongov1'}`,
1080
+ `enabled: ${s.enabled !== false}`,
1081
+ ...(s.templateId ? [`templateId: ${s.templateId}`] : []),
1082
+ ...(s.archived !== undefined ? [`archived: ${s.archived}`] : []),
1083
+ ].join(', ');
1084
+ console.log(`[beamo-node] - ${details}`);
1055
1085
  });
1086
+ console.log(`[beamo-node] Storage references JSON: ${JSON.stringify(storageReferences, null, 2)}`);
1056
1087
  } else {
1057
- console.warn(`[beamo-node] Warning: No storage references in manifest. Database will not be created automatically.`);
1088
+ console.warn(`[beamo-node] ⚠️ WARNING: No storage references in manifest. Database will NOT be created automatically.`);
1089
+ console.warn(`[beamo-node] Make sure you have @StorageObject('StorageName') decorators in your code.`);
1058
1090
  }
1059
1091
 
1060
1092
  const publishUrl = new URL('/basic/beamo/manifest', apiHost);