M-Tesla commented on issue #6008: URL: https://github.com/apache/couchdb/issues/6008#issuecomment-4725472600
Hey everyone, how's it going? I'm still not confident enough to open the PR, but I was having this problem and fixed it like this: What I installed inside src/fauxton: npm install lossless-json --save lossless-json is a library that parses/stringifies JSON preserving numbers that don't fit in Number. Then I created the following files: 1 - src/fauxton/app/core/safe-json.js This is simply a Helper that wraps lossless-json: safeParse(): safe numbers become Number; Large integers become LosslessNumber. safeStringify(): serializes back, keeping LosslessNumber as a literal number (without quotes). 2 - src/fauxton/app/core/__tests__/safe-json.test.js Just some unit tests for the helper. I also had to modify 3 files in fauxton: 1 - src/fauxton/app/addons/documents/shared-resources.js I overrode the fetch() method in Documents.Doc to retrieve the response as plain text (dataType: 'text') and parse it with safeParse. I overrode sync() to serialize the body with safeStringify instead of JSON.stringify. I updated prettyJSON() to use safeStringify. 2 - src/fauxton/app/addons/documents/doc-editor/components/DocEditorScreen.js I replaced JSON.stringify with safeStringify in the editor display and replaced JSON.parse with safeParse in the validation before saving. 3 - src/fauxton/package.json / package-lock.json I added the lossless-json dependency. I also updated the html-webpack-plugin from 5.5.0 to 5.6.7 to resolve the build error SecurityError: Cannot initialize local storage in Node.js 25. What was built: Fauxton Rebuild: cd src/fauxton npm run webpack:release I copied the generated assets from src/fauxton/dist/release to the folder that the CouchDB release actually uses: rm -rf rel/couchdb/share/www cp -r src/fauxton/dist/release rel/couchdb/share/www I restarted CouchDB to serve the new assets. Since I'm still a bit hesitant to make a PR, I'm commenting here so you know how I made it work for me. If you want, I can put the files in a fork for you to see and then evaluate. Sorry for my bad english. Thanks. :) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
