Skip to content

Commit 76be60e

Browse files
harivyasiclaude
andcommitted
chore(dist): build
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 756b61b commit 76be60e

1 file changed

Lines changed: 35 additions & 29 deletions

File tree

‎dist/standalone/fetchers/fetcher_file.js‎

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Object.defineProperty(exports, "__esModule", {
55
});
66
exports.default = void 0;
77
var _humps = require("humps");
8+
// The backend reads an absent field as "none" and parses several as JSON. A value the editor
9+
// does not have (undefined) would otherwise go out as the string "undefined", which fails
10+
// to parse.
11+
const appendDefined = (data, key, value) => {
12+
if (value !== undefined) data.append(key, value);
13+
};
814
const convertFile = target => {
915
const {
1016
file,
@@ -46,23 +52,23 @@ const saveFile = target => {
4652
const data = new FormData();
4753
data.append('src', src);
4854
data.append('dst', dst);
49-
data.append('molfile', mol);
50-
data.append('filename', filename);
51-
data.append('peaks_str', peakStr);
55+
appendDefined(data, 'molfile', mol);
56+
appendDefined(data, 'filename', filename);
57+
appendDefined(data, 'peaks_str', peakStr);
5258
if (shift) {
53-
data.append('shift_select_x', shift.peak.x);
54-
data.append('shift_ref_name', shift.ref.name);
55-
data.append('shift_ref_value', shift.ref.value);
59+
appendDefined(data, 'shift_select_x', shift.peak.x);
60+
appendDefined(data, 'shift_ref_name', shift.ref.name);
61+
appendDefined(data, 'shift_ref_value', shift.ref.value);
5662
}
57-
data.append('mass', mass);
58-
data.append('scan', scan);
59-
data.append('thres', thres);
60-
data.append('predict', predict);
61-
data.append('integration', integration);
62-
data.append('multiplicity', multiplicity);
63-
data.append('wave_length', waveLength);
64-
data.append('cyclic_volta', cyclicvolta);
65-
data.append('dsc_meta_data', dscMetaData);
63+
appendDefined(data, 'mass', mass);
64+
appendDefined(data, 'scan', scan);
65+
appendDefined(data, 'thres', thres);
66+
appendDefined(data, 'predict', predict);
67+
appendDefined(data, 'integration', integration);
68+
appendDefined(data, 'multiplicity', multiplicity);
69+
appendDefined(data, 'wave_length', waveLength);
70+
appendDefined(data, 'cyclic_volta', cyclicvolta);
71+
appendDefined(data, 'dsc_meta_data', dscMetaData);
6672
if (dstList) {
6773
dstList.forEach(dstFile => {
6874
data.append('dst_list', dstFile);
@@ -122,20 +128,20 @@ const refreshFile = target => {
122128
const data = new FormData();
123129
data.append('src', src);
124130
data.append('dst', dst);
125-
data.append('molfile', mol);
126-
data.append('filename', filename);
127-
data.append('peaks_str', peakStr);
128-
data.append('shift_select_x', shift.peak.x);
129-
data.append('shift_ref_name', shift.ref.name);
130-
data.append('shift_ref_value', shift.ref.value);
131-
data.append('mass', mass);
132-
data.append('scan', scan);
133-
data.append('thres', thres);
134-
data.append('predict', predict);
135-
data.append('integration', integration);
136-
data.append('multiplicity', multiplicity);
137-
data.append('wave_length', waveLength);
138-
data.append('cyclic_volta', cyclicvolta);
131+
appendDefined(data, 'molfile', mol);
132+
appendDefined(data, 'filename', filename);
133+
appendDefined(data, 'peaks_str', peakStr);
134+
appendDefined(data, 'shift_select_x', shift.peak.x);
135+
appendDefined(data, 'shift_ref_name', shift.ref.name);
136+
appendDefined(data, 'shift_ref_value', shift.ref.value);
137+
appendDefined(data, 'mass', mass);
138+
appendDefined(data, 'scan', scan);
139+
appendDefined(data, 'thres', thres);
140+
appendDefined(data, 'predict', predict);
141+
appendDefined(data, 'integration', integration);
142+
appendDefined(data, 'multiplicity', multiplicity);
143+
appendDefined(data, 'wave_length', waveLength);
144+
appendDefined(data, 'cyclic_volta', cyclicvolta);
139145
if (dstList) {
140146
dstList.forEach(dstFile => {
141147
data.append('dst_list', dstFile);

0 commit comments

Comments
 (0)