Skip to content

Commit eac33ad

Browse files
committed
Merge remote-tracking branch 'origin/main' into 1.37-releases
2 parents 24a9531 + 097c960 commit eac33ad

29 files changed

+594
-218
lines changed

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Third-Party Notices
22

33
The following third-party software is used by and included in **MongoDB Compass**.
4-
This document was automatically generated on Sun May 14 2023.
4+
This document was automatically generated on Mon May 15 2023.
55

66
## List of dependencies
77

packages/compass-e2e-tests/tests/collection-import.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ describe('Collection import', function () {
569569
delete importCompletedEvent.duration; // Duration varies.
570570
expect(importCompletedEvent).to.deep.equal({
571571
delimiter: ',',
572+
newline: '\n',
572573
file_type: 'csv',
573574
all_fields: false,
574575
stop_on_error_selected: false,

packages/compass-e2e-tests/tests/collection-indexes-tab.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ describe('Collection indexes tab', function () {
169169
});
170170
});
171171

172-
describe('server version 6.3.0', function () {
172+
describe('server version 20.0.0', function () {
173173
// This feature got moved behind a feature flag
174174
// https://jira.mongodb.org/browse/SERVER-74901
175175
it.skip('supports creating a columnstore index', async function () {
176-
if (serverSatisfies('< 6.3.0-alpha0')) {
176+
if (serverSatisfies('< 20.0.0-alpha0')) {
177177
return this.skip();
178178
}
179179

packages/compass-import-export/scripts/analyze-csv.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ function run() {
55
console.log(process.argv);
66
const input = fs.createReadStream(process.argv[2]);
77
const delimiter = ' ';
8+
const newline = '\n';
89
let numRows = 0;
910
let start = Date.now();
1011
const progressCallback = () => {
@@ -14,7 +15,7 @@ function run() {
1415
start = Date.now();
1516
}
1617
};
17-
return analyzeCSVFields({ input, delimiter, progressCallback });
18+
return analyzeCSVFields({ input, delimiter, newline, progressCallback });
1819
}
1920

2021
run()

packages/compass-import-export/src/components/import-modal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import {
3737
setFieldType,
3838
} from '../modules/import';
3939
import type { RootImportState } from '../stores/import-store';
40-
import type { CSVDelimiter, FieldFromCSV } from '../modules/import';
40+
import type { FieldFromCSV } from '../modules/import';
4141
import { ImportFileInput } from './import-file-input';
42-
import type { CSVParsableFieldType } from '../csv/csv-types';
42+
import type { Delimiter, CSVParsableFieldType } from '../csv/csv-types';
4343

4444
const closeButtonStyles = css({
4545
marginRight: spacing[2],
@@ -82,8 +82,8 @@ type ImportModalProps = {
8282
* See `<ImportOptions />`
8383
*/
8484
selectImportFileName: (fileName: string) => void;
85-
setDelimiter: (delimiter: CSVDelimiter) => void;
86-
delimiter: CSVDelimiter;
85+
setDelimiter: (delimiter: Delimiter) => void;
86+
delimiter: Delimiter;
8787
fileType: AcceptedFileType | '';
8888
fileName: string;
8989
stopOnErrors: boolean;

packages/compass-import-export/src/components/import-options.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '@mongodb-js/compass-components';
1212

1313
import type { AcceptedFileType } from '../constants/file-types';
14-
import type { CSVDelimiter } from '../modules/import';
14+
import type { Delimiter } from '../csv/csv-types';
1515
import { ImportFileInput } from './import-file-input';
1616

1717
const formStyles = css({
@@ -43,7 +43,7 @@ const checkboxStyles = css({
4343
});
4444

4545
const delimiters: {
46-
value: CSVDelimiter;
46+
value: Delimiter;
4747
label: string;
4848
}[] = [
4949
{
@@ -66,8 +66,8 @@ const delimiters: {
6666

6767
type ImportOptionsProps = {
6868
selectImportFileName: (fileName: string) => void;
69-
setDelimiter: (delimiter: CSVDelimiter) => void;
70-
delimiter: CSVDelimiter;
69+
setDelimiter: (delimiter: Delimiter) => void;
70+
delimiter: Delimiter;
7171
fileType: AcceptedFileType | '';
7272
fileName: string;
7373
stopOnErrors: boolean;
@@ -120,7 +120,7 @@ function ImportOptions({
120120
aria-label="Delimiter"
121121
data-testid="import-delimiter-select"
122122
onChange={(delimiter: string) =>
123-
void setDelimiter(delimiter as CSVDelimiter)
123+
void setDelimiter(delimiter as Delimiter)
124124
}
125125
value={delimiter}
126126
allowDeselect={false}

packages/compass-import-export/src/csv/csv-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
export const supportedDelimiters = [',', '\t', ';', ' '] as const;
1616
export type Delimiter = typeof supportedDelimiters[number];
1717

18-
export const supportedLinebreaks = ['\r\n', '\n'];
18+
export const supportedLinebreaks = ['\r\n', '\n'] as const;
1919
export type Linebreak = typeof supportedLinebreaks[number];
2020

2121
// the subset of bson types that we can detect

packages/compass-import-export/src/export/export-csv.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,11 @@ async function analyzeAndImportCSV(
448448
assert(typeResult.type === 'csv');
449449

450450
const csvDelimiter = typeResult.csvDelimiter;
451+
const newline = typeResult.newline;
451452
const analyzeResult = await analyzeCSVFields({
452453
input: fs.createReadStream(filepath),
453454
delimiter: csvDelimiter,
455+
newline,
454456
ignoreEmptyStrings: true,
455457
});
456458

@@ -486,6 +488,7 @@ async function analyzeAndImportCSV(
486488
fields,
487489
input: fs.createReadStream(filepath),
488490
delimiter: csvDelimiter,
491+
newline,
489492
ignoreEmptyStrings: true,
490493
});
491494

packages/compass-import-export/src/export/gather-fields.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,11 @@ async function analyzeAndImportCSV(
364364
assert(typeResult.type === 'csv');
365365

366366
const csvDelimiter = typeResult.csvDelimiter;
367+
const newline = typeResult.newline;
367368
const analyzeResult = await analyzeCSVFields({
368369
input: fs.createReadStream(filepath),
369370
delimiter: csvDelimiter,
371+
newline,
370372
ignoreEmptyStrings: true,
371373
});
372374

@@ -400,6 +402,7 @@ async function analyzeAndImportCSV(
400402
dataService,
401403
ns: testNS,
402404
fields,
405+
newline,
403406
input: fs.createReadStream(filepath),
404407
delimiter: csvDelimiter,
405408
ignoreEmptyStrings: true,

packages/compass-import-export/src/import/analyze-csv-fields.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ describe('analyzeCSVFields', function () {
1818
});
1919
assert(typeResult.type === 'csv');
2020
const csvDelimiter = typeResult.csvDelimiter;
21+
const newline = typeResult.newline;
2122

2223
const abortController = new AbortController();
2324
const progressCallback = sinon.spy();
2425
const result = await analyzeCSVFields({
2526
input: fs.createReadStream(filepath),
2627
delimiter: csvDelimiter,
28+
newline,
2729
abortSignal: abortController.signal,
2830
progressCallback,
2931
ignoreEmptyStrings: true,
@@ -137,6 +139,7 @@ describe('analyzeCSVFields', function () {
137139
const result = await analyzeCSVFields({
138140
input: fs.createReadStream(filepath),
139141
delimiter: ',',
142+
newline: '\n',
140143
abortSignal: abortController.signal,
141144
progressCallback,
142145
ignoreEmptyStrings: true,
@@ -166,6 +169,7 @@ describe('analyzeCSVFields', function () {
166169
const result = await analyzeCSVFields({
167170
input: fs.createReadStream(fixtures.csvByType.null),
168171
delimiter: ',',
172+
newline: '\n',
169173
abortSignal: abortController.signal,
170174
progressCallback,
171175
ignoreEmptyStrings: false,
@@ -196,6 +200,7 @@ describe('analyzeCSVFields', function () {
196200
const result = await analyzeCSVFields({
197201
input: fs.createReadStream(fixtures.csv.complex),
198202
delimiter: ',',
203+
newline: '\n',
199204
abortSignal: abortController.signal,
200205
progressCallback,
201206
ignoreEmptyStrings: true,
@@ -215,6 +220,7 @@ describe('analyzeCSVFields', function () {
215220
const result = await analyzeCSVFields({
216221
input,
217222
delimiter: ',',
223+
newline: '\n',
218224
});
219225
expect(Object.keys(result.fields)).to.deep.equal(['_id', 'value']);
220226
});
@@ -227,6 +233,7 @@ describe('analyzeCSVFields', function () {
227233
analyzeCSVFields({
228234
input,
229235
delimiter: ',',
236+
newline: '\n',
230237
})
231238
).to.be.rejectedWith(
232239
TypeError,
@@ -240,6 +247,7 @@ describe('analyzeCSVFields', function () {
240247
const result = await analyzeCSVFields({
241248
input,
242249
delimiter: ',',
250+
newline: '\n',
243251
});
244252
expect(Object.keys(result.fields)).to.deep.equal(['_id', 'value']);
245253
});

0 commit comments

Comments
 (0)