@omen.foundation/node-microservice-runtime 0.1.114 → 0.1.116
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 +1 -1
- package/scripts/publish-service.mjs +46 -31
package/package.json
CHANGED
|
@@ -753,7 +753,7 @@ async function discoverStorageObjects(srcDir, cwd = process.cwd()) {
|
|
|
753
753
|
// Resolve src path relative to current working directory (where publish is run from)
|
|
754
754
|
const srcPath = path.isAbsolute(srcDir) ? srcDir : path.resolve(cwd, srcDir || 'src');
|
|
755
755
|
|
|
756
|
-
console.log(`[beamo-node] Searching for @StorageObject decorators in: ${srcPath}`);
|
|
756
|
+
// Suppressed: console.log(`[beamo-node] Searching for @StorageObject decorators in: ${srcPath}`);
|
|
757
757
|
|
|
758
758
|
// Check if directory exists
|
|
759
759
|
try {
|
|
@@ -774,7 +774,7 @@ async function discoverStorageObjects(srcDir, cwd = process.cwd()) {
|
|
|
774
774
|
return storageObjects;
|
|
775
775
|
}
|
|
776
776
|
|
|
777
|
-
console.log(`[beamo-node] Scanning ${files.length} TypeScript file(s) for @StorageObject decorators...`);
|
|
777
|
+
// Suppressed: console.log(`[beamo-node] Scanning ${files.length} TypeScript file(s) for @StorageObject decorators...`);
|
|
778
778
|
|
|
779
779
|
for (const file of files) {
|
|
780
780
|
const content = await fs.readFile(file, 'utf-8');
|
|
@@ -792,15 +792,15 @@ async function discoverStorageObjects(srcDir, cwd = process.cwd()) {
|
|
|
792
792
|
archived: false, // Match C# CLI default (DeploymentService.cs line 1618)
|
|
793
793
|
checksum: null, // Not sent to backend, just for internal tracking
|
|
794
794
|
});
|
|
795
|
-
console.log(`[beamo-node] ✓ Discovered storage object: ${storageName} (from ${path.relative(cwd, file)})`);
|
|
795
|
+
// Suppressed: console.log(`[beamo-node] ✓ Discovered storage object: ${storageName} (from ${path.relative(cwd, file)})`);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
799
|
|
|
800
|
-
if (storageObjects.length === 0) {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
800
|
+
// Suppressed: if (storageObjects.length === 0) {
|
|
801
|
+
// console.log(`[beamo-node] No @StorageObject decorators found in ${files.length} file(s) in ${srcPath}`);
|
|
802
|
+
// console.log(`[beamo-node] Make sure your storage classes are decorated with @StorageObject('StorageName')`);
|
|
803
|
+
// }
|
|
804
804
|
} catch (error) {
|
|
805
805
|
console.warn(`[beamo-node] Error discovering storage objects: ${error instanceof Error ? error.message : String(error)}`);
|
|
806
806
|
if (error instanceof Error && error.stack) {
|
|
@@ -975,7 +975,7 @@ async function updateManifest({
|
|
|
975
975
|
archived: s.archived !== undefined ? s.archived : false, // Always include archived, default to false like C# CLI
|
|
976
976
|
};
|
|
977
977
|
storageMap.set(s.id, newStorage);
|
|
978
|
-
console.log(`[beamo-node] Adding new storage to manifest: ${s.id} (type: ${newStorage.storageType}, enabled: ${newStorage.enabled})`);
|
|
978
|
+
// Suppressed: console.log(`[beamo-node] Adding new storage to manifest: ${s.id} (type: ${newStorage.storageType}, enabled: ${newStorage.enabled})`);
|
|
979
979
|
} else {
|
|
980
980
|
// Update existing storage to ensure storageType is 'mongov1' and format is correct
|
|
981
981
|
// Match C# CLI behavior: always set templateId="small" and archived=false (DeploymentService.cs lines 1618, 1620)
|
|
@@ -988,7 +988,7 @@ async function updateManifest({
|
|
|
988
988
|
archived: existing.archived !== undefined ? existing.archived : false, // Always include archived, default to false like C# CLI
|
|
989
989
|
};
|
|
990
990
|
storageMap.set(s.id, updatedStorage);
|
|
991
|
-
console.log(`[beamo-node] Updating existing storage in manifest: ${s.id} (type: mongov1, enabled: ${updatedStorage.enabled})`);
|
|
991
|
+
// Suppressed: console.log(`[beamo-node] Updating existing storage in manifest: ${s.id} (type: mongov1, enabled: ${updatedStorage.enabled})`);
|
|
992
992
|
}
|
|
993
993
|
});
|
|
994
994
|
// Convert to array and remove any extra fields (like checksum) that backend doesn't expect
|
|
@@ -1001,13 +1001,13 @@ async function updateManifest({
|
|
|
1001
1001
|
archived: s.archived !== undefined ? s.archived : false, // Always include archived, default to false like C# CLI
|
|
1002
1002
|
}));
|
|
1003
1003
|
|
|
1004
|
-
// Log storage references being sent to backend for debugging
|
|
1005
|
-
if (storageReferences.length > 0) {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1004
|
+
// Suppressed: Log storage references being sent to backend for debugging
|
|
1005
|
+
// if (storageReferences.length > 0) {
|
|
1006
|
+
// console.log(`[beamo-node] Publishing ${storageReferences.length} storage reference(s) to backend:`);
|
|
1007
|
+
// storageReferences.forEach(sr => {
|
|
1008
|
+
// console.log(`[beamo-node] - ${sr.id}: type=${sr.storageType}, enabled=${sr.enabled}, templateId=${sr.templateId || 'small'}`);
|
|
1009
|
+
// });
|
|
1010
|
+
// }
|
|
1011
1011
|
|
|
1012
1012
|
// Extract existing components and dependencies for the service
|
|
1013
1013
|
const existingServiceRef = serviceReferences.find(
|
|
@@ -1021,18 +1021,22 @@ async function updateManifest({
|
|
|
1021
1021
|
?? [];
|
|
1022
1022
|
|
|
1023
1023
|
// Components are ServiceComponent objects with {name: string}
|
|
1024
|
-
//
|
|
1024
|
+
// For federated components (IFederatedInventory/* and IFederatedLogin/*), replace all existing with newly discovered
|
|
1025
|
+
// For other components, merge discovered with existing (preserve existing, add new)
|
|
1025
1026
|
const componentsMap = new Map();
|
|
1026
|
-
// Add existing components
|
|
1027
|
+
// Add existing components, but filter out federated ones (they will be replaced)
|
|
1027
1028
|
if (Array.isArray(existingComponents)) {
|
|
1028
1029
|
existingComponents.forEach(comp => {
|
|
1029
1030
|
const name = comp.name?.Value ?? comp.name ?? comp;
|
|
1030
1031
|
if (typeof name === 'string') {
|
|
1031
|
-
|
|
1032
|
+
// Skip federated components - they will be replaced by discovered ones
|
|
1033
|
+
if (!name.startsWith('IFederatedInventory/') && !name.startsWith('IFederatedLogin/')) {
|
|
1034
|
+
componentsMap.set(name, { name });
|
|
1035
|
+
}
|
|
1032
1036
|
}
|
|
1033
1037
|
});
|
|
1034
1038
|
}
|
|
1035
|
-
// Add discovered components (will overwrite existing if same name)
|
|
1039
|
+
// Add discovered components (will overwrite existing if same name, and replace all federated components)
|
|
1036
1040
|
(discoveredComponents || []).forEach(compName => {
|
|
1037
1041
|
componentsMap.set(compName, { name: compName });
|
|
1038
1042
|
});
|
|
@@ -1124,7 +1128,7 @@ async function updateManifest({
|
|
|
1124
1128
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
1125
1129
|
const manifestFile = path.join(publishHistoryDir, `manifest_${timestamp}.json`);
|
|
1126
1130
|
await fs.writeFile(manifestFile, JSON.stringify(requestBody, null, 2), 'utf8');
|
|
1127
|
-
console.log(`${colors.dim}Manifest saved to: ${manifestFile}${colors.reset}`);
|
|
1131
|
+
// Suppressed: console.log(`${colors.dim}Manifest saved to: ${manifestFile}${colors.reset}`);
|
|
1128
1132
|
} catch (err) {
|
|
1129
1133
|
console.log(`${colors.yellow}⚠${colors.reset} Could not save manifest to file: ${err.message}`);
|
|
1130
1134
|
}
|
|
@@ -1156,7 +1160,10 @@ async function updateManifest({
|
|
|
1156
1160
|
}
|
|
1157
1161
|
|
|
1158
1162
|
const responseBody = await response.json();
|
|
1159
|
-
|
|
1163
|
+
|
|
1164
|
+
// Collect success messages to return and display after progress bar
|
|
1165
|
+
const successMessages = [];
|
|
1166
|
+
successMessages.push(`${colors.green}✓${colors.reset} Manifest published successfully`);
|
|
1160
1167
|
|
|
1161
1168
|
// Always try to get and display the storage connection string if storage references exist
|
|
1162
1169
|
if (storageReferences.length > 0) {
|
|
@@ -1173,8 +1180,8 @@ async function updateManifest({
|
|
|
1173
1180
|
|
|
1174
1181
|
if (storageConnectionResponse.ok) {
|
|
1175
1182
|
const connectionString = await storageConnectionResponse.text();
|
|
1176
|
-
|
|
1177
|
-
|
|
1183
|
+
successMessages.push(`${colors.green}✓${colors.reset} MongoDB Connection String:`);
|
|
1184
|
+
successMessages.push(`${colors.cyan}${connectionString}${colors.reset}`);
|
|
1178
1185
|
} else {
|
|
1179
1186
|
const errorText = await storageConnectionResponse.text();
|
|
1180
1187
|
let errorMessage = errorText;
|
|
@@ -1184,17 +1191,19 @@ async function updateManifest({
|
|
|
1184
1191
|
} catch {
|
|
1185
1192
|
// Not JSON, use as-is
|
|
1186
1193
|
}
|
|
1187
|
-
|
|
1194
|
+
successMessages.push(`${colors.red}✗${colors.reset} Could not retrieve connection string: ${errorMessage}`);
|
|
1188
1195
|
if (errorMessage.includes('Could not open connection to database') ||
|
|
1189
1196
|
errorMessage.includes('Credentials have not been generated') ||
|
|
1190
1197
|
errorMessage.includes('storageGroupId')) {
|
|
1191
|
-
|
|
1198
|
+
successMessages.push(`${colors.yellow}⚠${colors.reset} This may prevent "Explore Data" from working. storageGroupId may not be set in the manifest.`);
|
|
1192
1199
|
}
|
|
1193
1200
|
}
|
|
1194
1201
|
} catch (err) {
|
|
1195
|
-
|
|
1202
|
+
successMessages.push(`${colors.yellow}⚠${colors.reset} Could not retrieve connection string: ${err.message}`);
|
|
1196
1203
|
}
|
|
1197
1204
|
}
|
|
1205
|
+
|
|
1206
|
+
return successMessages;
|
|
1198
1207
|
}
|
|
1199
1208
|
|
|
1200
1209
|
async function prepareDockerContext({ entry, distDir, openapiPath, packageJson, packageLock, nodeVersion }) {
|
|
@@ -1578,15 +1587,15 @@ async function main() {
|
|
|
1578
1587
|
storageType: 'mongov1', // MongoDB storage type (matches ServiceStorageReference in backend)
|
|
1579
1588
|
}));
|
|
1580
1589
|
|
|
1581
|
-
if (discoveredStorage.length > 0) {
|
|
1582
|
-
|
|
1583
|
-
}
|
|
1590
|
+
// Suppressed: if (discoveredStorage.length > 0) {
|
|
1591
|
+
// console.log(`[beamo-node] Discovered ${discoveredStorage.length} storage object(s): ${discoveredStorage.map(s => s.id).join(', ')}`);
|
|
1592
|
+
// }
|
|
1584
1593
|
|
|
1585
1594
|
progress.complete('Storage and components discovered');
|
|
1586
1595
|
|
|
1587
1596
|
// Step 8: Publish manifest
|
|
1588
1597
|
progress.start('Publishing manifest');
|
|
1589
|
-
await updateManifest({
|
|
1598
|
+
const successMessages = await updateManifest({
|
|
1590
1599
|
apiHost,
|
|
1591
1600
|
token,
|
|
1592
1601
|
cid,
|
|
@@ -1601,6 +1610,12 @@ async function main() {
|
|
|
1601
1610
|
packageJson: packageJsonPath,
|
|
1602
1611
|
});
|
|
1603
1612
|
progress.complete('Manifest published');
|
|
1613
|
+
|
|
1614
|
+
// Display success messages after progress bar completes
|
|
1615
|
+
if (successMessages && successMessages.length > 0) {
|
|
1616
|
+
console.log(''); // New line after progress bar
|
|
1617
|
+
successMessages.forEach(msg => console.log(msg));
|
|
1618
|
+
}
|
|
1604
1619
|
|
|
1605
1620
|
// Success message
|
|
1606
1621
|
console.log(`\n${colors.green}${colors.bright}✓ Publish complete!${colors.reset}`);
|