From c2c0a221b8652e3823339a89530311e9a8b45ccc Mon Sep 17 00:00:00 2001 From: Nick K Date: Fri, 7 Feb 2025 09:13:44 -0700 Subject: [PATCH 1/5] AQI-8706: Updated to protobuf library v7.3.0 --- ONE.Interfaces.ProtocolBuffers | 2 +- lib/package-lock.json | 4 ++-- lib/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ONE.Interfaces.ProtocolBuffers b/ONE.Interfaces.ProtocolBuffers index e695d6c..a4bb04a 160000 --- a/ONE.Interfaces.ProtocolBuffers +++ b/ONE.Interfaces.ProtocolBuffers @@ -1 +1 @@ -Subproject commit e695d6c3404675257dd6529f3033bcc93f3545cc +Subproject commit a4bb04a163b2bd8b8e0a92ca136fa57fc35b00ec diff --git a/lib/package-lock.json b/lib/package-lock.json index 845c163..3ff89bb 100644 --- a/lib/package-lock.json +++ b/lib/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.2.0", + "version": "15.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.2.0", + "version": "15.4.0", "license": "UNLICENSED", "dependencies": { "protobufjs": "^6.9.0" diff --git a/lib/package.json b/lib/package.json index 0225a70..a5527df 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,7 +1,7 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.2.0", - "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 6.13.0 of ONE.Interfaces.ProtocolBuffers", + "version": "15.4.0", + "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.3.0 of ONE.Interfaces.ProtocolBuffers", "license": "UNLICENSED", "main": "src/apiresponse.js", "types": "types.d.ts", From fcf344beb4548e0fec0d19e4ea048ef24568226a Mon Sep 17 00:00:00 2001 From: RajeebSaha-AI Date: Mon, 28 Jul 2025 16:37:26 -0700 Subject: [PATCH 2/5] PA-2940- Added model tags protobuf Enum --- ONE.Interfaces.ProtocolBuffers | 2 +- lib/package-lock.json | 4 ++-- lib/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ONE.Interfaces.ProtocolBuffers b/ONE.Interfaces.ProtocolBuffers index a4bb04a..2b35655 160000 --- a/ONE.Interfaces.ProtocolBuffers +++ b/ONE.Interfaces.ProtocolBuffers @@ -1 +1 @@ -Subproject commit a4bb04a163b2bd8b8e0a92ca136fa57fc35b00ec +Subproject commit 2b356559c081f53c3cd8ba3b78e5017cd3c34f7b diff --git a/lib/package-lock.json b/lib/package-lock.json index 3ff89bb..5a69880 100644 --- a/lib/package-lock.json +++ b/lib/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.4.0", + "version": "15.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.4.0", + "version": "15.5.0", "license": "UNLICENSED", "dependencies": { "protobufjs": "^6.9.0" diff --git a/lib/package.json b/lib/package.json index a5527df..11e2d4f 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,7 +1,7 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.4.0", - "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.3.0 of ONE.Interfaces.ProtocolBuffers", + "version": "15.5.0", + "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.10.0 of ONE.Interfaces.ProtocolBuffers", "license": "UNLICENSED", "main": "src/apiresponse.js", "types": "types.d.ts", From 299b93da13e22debee8d7fd46e40a29f2a017ac3 Mon Sep 17 00:00:00 2001 From: RajeebSaha-AI Date: Wed, 30 Jul 2025 14:14:07 -0700 Subject: [PATCH 3/5] PA-2940-Updated to protobuf library v7.10.1 Renamed unknown tag to remove python conflict --- ONE.Interfaces.ProtocolBuffers | 2 +- lib/package-lock.json | 4 ++-- lib/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ONE.Interfaces.ProtocolBuffers b/ONE.Interfaces.ProtocolBuffers index 2b35655..adbf24e 160000 --- a/ONE.Interfaces.ProtocolBuffers +++ b/ONE.Interfaces.ProtocolBuffers @@ -1 +1 @@ -Subproject commit 2b356559c081f53c3cd8ba3b78e5017cd3c34f7b +Subproject commit adbf24eeae9dfdc0089e00f6773321e91e98031e diff --git a/lib/package-lock.json b/lib/package-lock.json index 5a69880..0c2ddf2 100644 --- a/lib/package-lock.json +++ b/lib/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.0", + "version": "15.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.0", + "version": "15.5.1", "license": "UNLICENSED", "dependencies": { "protobufjs": "^6.9.0" diff --git a/lib/package.json b/lib/package.json index 11e2d4f..81b3e3b 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,7 +1,7 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.0", - "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.10.0 of ONE.Interfaces.ProtocolBuffers", + "version": "15.5.1", + "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.10.1 of ONE.Interfaces.ProtocolBuffers", "license": "UNLICENSED", "main": "src/apiresponse.js", "types": "types.d.ts", From 1320948a159d90c673a986f80ec5cb54993a053f Mon Sep 17 00:00:00 2001 From: RajeebSaha-AI Date: Wed, 30 Jul 2025 19:51:37 -0700 Subject: [PATCH 4/5] updated the generateJS.sh script, so we don't need to move the Enums on the bottom of the apiresponse.js file manually. Now we will able to run the genAndPublish.sh script directly --- generation/generateJS.sh | 15 ++- generation/reorganize-enums.js | 181 +++++++++++++++++++++++++++++++++ lib/package-lock.json | 4 +- lib/package.json | 2 +- 4 files changed, 197 insertions(+), 5 deletions(-) create mode 100644 generation/reorganize-enums.js diff --git a/generation/generateJS.sh b/generation/generateJS.sh index 47222c1..c3a26e1 100755 --- a/generation/generateJS.sh +++ b/generation/generateJS.sh @@ -14,11 +14,22 @@ npm install PROTOPATHS=`find ../one.interfaces.protocolbuffers -type d -print | xargs -n 1 -I {} echo "-p {}" | xargs echo` # == compile with protobufjs == -for P in `find ../one.interfaces.protocolbuffers/proto/one -name "*.proto"` +for P in `find ../one.interfaces.protocolbuffers/proto/flat -name "*.proto"` do PROTO=`basename -s .proto ${P}` echo "=== ${P} :: (${PROTO})" - node_modules/protobufjs/cli/bin/pbjs -t static-module -w commonjs ${PROTOPATHS} -o ./out/js/${PROTO}.js ${P} + # Special handling for apiresponse to include all enum files + if [ "$PROTO" = "apiresponse" ]; then + echo "=== Including all enum files for apiresponse ===" + ENUM_FILES=`find ../one.interfaces.protocolbuffers/proto/flat -name "enum_*.proto" | xargs echo` + node_modules/protobufjs/cli/bin/pbjs -t static-module -w commonjs ${PROTOPATHS} -o ./out/js/${PROTO}.js ${P} ${ENUM_FILES} + else + node_modules/protobufjs/cli/bin/pbjs -t static-module -w commonjs ${PROTOPATHS} -o ./out/js/${PROTO}.js ${P} + fi done + +# == post-process files to move enums to bottom == +echo "=== Post-processing files to move enums to bottom ===" +node reorganize-enums.js diff --git a/generation/reorganize-enums.js b/generation/reorganize-enums.js new file mode 100644 index 0000000..94a073c --- /dev/null +++ b/generation/reorganize-enums.js @@ -0,0 +1,181 @@ +const fs = require('fs'); +const path = require('path'); + +console.log('=== Enum Reorganization Script ==='); + +const outputDir = './out/js'; +if (!fs.existsSync(outputDir)) { + console.log('Output directory does not exist. Run the full generation first.'); + process.exit(1); +} + +const files = fs.readdirSync(outputDir).filter(f => f.endsWith('.js')); +console.log(`Found ${files.length} JS files to process`); + +files.forEach(filename => { + const filepath = path.join(outputDir, filename); + const content = fs.readFileSync(filepath, 'utf8'); + + console.log(`Processing ${filename}...`); + + // Check if file has already been processed + if (content.includes('// === ENUMS SECTION - All enums moved to bottom ===')) { + console.log(` - Already processed, skipping ${filename}`); + return; + } + + const lines = content.split('\n'); + const cleanLines = []; + const enumBlocks = []; + let i = 0; + + // First pass: Find all enum definitions and their JSDoc comments + while (i < lines.length) { + const line = lines[i]; + + // Check if this is an enum definition + if (line.match(/^\$root\.Enum.*= \(function\(\)/)) { + const enumNameMatch = line.match(/^\$root\.(Enum\w+)/); + const enumName = enumNameMatch ? enumNameMatch[1] : null; + + console.log(` Found enum: ${enumName}`); + + // Find the end of the enum definition + let enumLines = [line]; + let braceCount = 1; + let j = i + 1; + + while (j < lines.length && braceCount > 0) { + const nextLine = lines[j]; + enumLines.push(nextLine); + + // Count braces + const openBraces = (nextLine.match(/\(/g) || []).length; + const closeBraces = (nextLine.match(/\)/g) || []).length; + braceCount += openBraces - closeBraces; + + if (braceCount === 0 && nextLine.match(/^\}\)\(\);/)) { + break; + } + j++; + } + + // Look for JSDoc comment for this enum (search backwards from current position first, then forwards) + let enumComment = null; + + // Search backwards first (more likely to be nearby) + for (let k = i - 1; k >= 0; k--) { + if (lines[k] && lines[k].includes(`@exports ${enumName}`)) { + // Found the JSDoc comment, find its boundaries + let commentStart = k; + while (commentStart > 0 && lines[commentStart] && !lines[commentStart].match(/^\s*\/\*\*/)) { + commentStart--; + } + + let commentEnd = k; + while (commentEnd < lines.length && lines[commentEnd] && !lines[commentEnd].match(/^\s*\*\//)) { + commentEnd++; + } + + if (commentStart >= 0 && commentEnd < lines.length && lines[commentStart] && lines[commentEnd]) { + enumComment = lines.slice(commentStart, commentEnd + 1).join('\n'); + console.log(` Found JSDoc comment for ${enumName} (backward search)`); + } + break; + } + } + + // If not found backwards, search forwards + if (!enumComment) { + for (let k = j + 1; k < lines.length; k++) { + if (lines[k] && lines[k].includes(`@exports ${enumName}`)) { + // Found the JSDoc comment, find its boundaries + let commentStart = k; + while (commentStart > 0 && lines[commentStart] && !lines[commentStart].match(/^\s*\/\*\*/)) { + commentStart--; + } + + let commentEnd = k; + while (commentEnd < lines.length && lines[commentEnd] && !lines[commentEnd].match(/^\s*\*\//)) { + commentEnd++; + } + + if (commentStart >= 0 && commentEnd < lines.length && lines[commentStart] && lines[commentEnd]) { + enumComment = lines.slice(commentStart, commentEnd + 1).join('\n'); + console.log(` Found JSDoc comment for ${enumName} (forward search)`); + } + break; + } + } + } + + // Create the complete enum block + let enumBlock = ''; + if (enumComment) { + enumBlock = enumComment + '\n' + enumLines.join('\n'); + } else { + enumBlock = enumLines.join('\n'); + console.log(` No JSDoc comment found for ${enumName}`); + } + + enumBlocks.push(enumBlock); + + // Skip past this enum definition + i = j + 1; + continue; + } + + // Check if this line is part of an enum JSDoc comment (to be removed) + if (line.match(/^\s*\/\*\*/) || line.match(/^\s*\*\s*@exports\s+Enum/)) { + // This might be an enum JSDoc comment, check if it's for an enum + let isEnumComment = false; + let commentEnd = i; + + // Find the end of this comment block + while (commentEnd < lines.length && !lines[commentEnd].match(/^\s*\*\//)) { + if (lines[commentEnd].match(/^\s*\*\s*@exports\s+Enum/)) { + isEnumComment = true; + } + commentEnd++; + } + + if (isEnumComment) { + console.log(` Removing orphaned enum JSDoc comment at line ${i + 1}`); + // Skip this entire comment block + i = commentEnd + 1; + continue; + } + } + + // This is a regular line, keep it + cleanLines.push(line); + i++; + } + + console.log(` Found ${enumBlocks.length} enum blocks`); + + // Reconstruct file with enums at bottom + if (enumBlocks.length > 0) { + // Remove the last module.exports line if it exists + while (cleanLines.length > 0 && (cleanLines[cleanLines.length - 1].trim() === '' || cleanLines[cleanLines.length - 1].includes('module.exports'))) { + cleanLines.pop(); + } + + const newContent = [ + ...cleanLines, + '', + '// === ENUMS SECTION - All enums moved to bottom ===', + '', + ...enumBlocks, + '', + 'module.exports = $root;' + ].join('\n'); + + fs.writeFileSync(filepath, newContent); + console.log(` ✓ Moved ${enumBlocks.length} enum(s) to bottom in ${filename}`); + } else { + console.log(` - No enums found in ${filename}`); + } +}); + +console.log('=== Enum reorganization complete ==='); diff --git a/lib/package-lock.json b/lib/package-lock.json index 0c2ddf2..85fd3e0 100644 --- a/lib/package-lock.json +++ b/lib/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.1", + "version": "15.5.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.1", + "version": "15.5.3", "license": "UNLICENSED", "dependencies": { "protobufjs": "^6.9.0" diff --git a/lib/package.json b/lib/package.json index 81b3e3b..b565240 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.1", + "version": "15.5.3", "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.10.1 of ONE.Interfaces.ProtocolBuffers", "license": "UNLICENSED", "main": "src/apiresponse.js", From 63e03ebed51c7628d5300c3cf60f5acf36a654c6 Mon Sep 17 00:00:00 2001 From: RajeebSaha-AI Date: Thu, 7 Aug 2025 16:17:06 -0700 Subject: [PATCH 5/5] PA-3028 - Rainfall tag for Delphi model Enum EnumDelphiModelTagSumo24 --- ONE.Interfaces.ProtocolBuffers | 2 +- lib/package-lock.json | 4 ++-- lib/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ONE.Interfaces.ProtocolBuffers b/ONE.Interfaces.ProtocolBuffers index adbf24e..a3e04d7 160000 --- a/ONE.Interfaces.ProtocolBuffers +++ b/ONE.Interfaces.ProtocolBuffers @@ -1 +1 @@ -Subproject commit adbf24eeae9dfdc0089e00f6773321e91e98031e +Subproject commit a3e04d7a10387119776cc65f3df0c749bde60abb diff --git a/lib/package-lock.json b/lib/package-lock.json index 85fd3e0..ecc160a 100644 --- a/lib/package-lock.json +++ b/lib/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.3", + "version": "15.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.3", + "version": "15.6.0", "license": "UNLICENSED", "dependencies": { "protobufjs": "^6.9.0" diff --git a/lib/package.json b/lib/package.json index b565240..9913254 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,7 +1,7 @@ { "name": "@aquaticinformatics/claros_protobuf", - "version": "15.5.3", - "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.10.1 of ONE.Interfaces.ProtocolBuffers", + "version": "15.6.0", + "description": "Claros Protocol Buffers for JavaScript (& TypeScript). Version 7.11.0 of ONE.Interfaces.ProtocolBuffers", "license": "UNLICENSED", "main": "src/apiresponse.js", "types": "types.d.ts",