@konstit/csv 0.4.3 → 0.5.0

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.
Files changed (63) hide show
  1. package/README.md +42 -26
  2. package/THIRD_PARTY_NOTICES.md +7 -1
  3. package/dist/api.d.ts +39 -249
  4. package/dist/api.js +40 -304
  5. package/dist/batches.d.ts +5 -53
  6. package/dist/batches.js +66 -43
  7. package/dist/cli-command.d.ts +7 -0
  8. package/dist/cli-command.js +350 -0
  9. package/dist/cli-schema.d.ts +111 -0
  10. package/dist/cli-schema.js +219 -0
  11. package/dist/cli.js +2 -604
  12. package/dist/file-stream.d.ts +57 -2
  13. package/dist/file-stream.js +241 -36
  14. package/dist/files.d.ts +11 -11
  15. package/dist/files.js +11 -9
  16. package/dist/filter.d.ts +4 -6
  17. package/dist/format-bytes.d.ts +1 -0
  18. package/dist/format-bytes.js +11 -0
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +2 -14
  21. package/dist/inspect-file.d.ts +12 -0
  22. package/dist/inspect-file.js +88 -0
  23. package/dist/latin1-rows.d.ts +3 -1
  24. package/dist/latin1-rows.js +61 -23
  25. package/dist/materialize-field.d.ts +2 -0
  26. package/dist/materialize-field.js +20 -15
  27. package/dist/native.d.ts +29 -9
  28. package/dist/native.js +27 -29
  29. package/dist/normalize.d.ts +15 -2
  30. package/dist/normalize.js +41 -2
  31. package/dist/options-snapshot.js +3 -2
  32. package/dist/options.d.ts +4 -30
  33. package/dist/options.js +0 -6
  34. package/dist/parser.d.ts +14 -15
  35. package/dist/parser.js +38 -54
  36. package/dist/strict-schema.d.ts +5 -3
  37. package/dist/types.d.ts +88 -222
  38. package/dist/zip-reader.d.ts +11 -1
  39. package/dist/zip-reader.js +12 -3
  40. package/package.json +34 -32
  41. package/prebuilds/darwin-arm64/libcsv_native.dylib +0 -0
  42. package/prebuilds/darwin-x64/libcsv_native.dylib +0 -0
  43. package/prebuilds/linux-x64/libcsv_native.so +0 -0
  44. package/prebuilds/manifest.json +9 -8
  45. package/prebuilds/provenance/darwin-arm64.json +1 -1
  46. package/prebuilds/provenance/darwin-x64.json +1 -1
  47. package/prebuilds/provenance/linux-x64.json +1 -1
  48. package/dist/worker-count.d.ts +0 -34
  49. package/dist/worker-count.js +0 -101
  50. package/dist/worker-factory.d.ts +0 -3
  51. package/dist/worker-factory.js +0 -9
  52. package/dist/worker-filter.d.ts +0 -29
  53. package/dist/worker-filter.js +0 -46
  54. package/dist/worker-module.d.ts +0 -1
  55. package/dist/worker-module.js +0 -4
  56. package/dist/worker-pool.d.ts +0 -93
  57. package/dist/worker-pool.js +0 -298
  58. package/dist/worker-rows.d.ts +0 -36
  59. package/dist/worker-rows.js +0 -127
  60. package/dist/workers/count.worker.d.ts +0 -1
  61. package/dist/workers/count.worker.js +0 -36
  62. package/dist/workers/rows.worker.d.ts +0 -1
  63. package/dist/workers/rows.worker.js +0 -56
package/dist/api.js CHANGED
@@ -1,4 +1,3 @@
1
- import { NativeCsvRowView } from "./batches.js";
2
1
  import {
3
2
  prepareCsvFileInput,
4
3
  rejectAutoDelimiterSharding,
@@ -17,10 +16,11 @@ import {
17
16
  re
18
17
  } from "./filter.js";
19
18
  import { latin1Rows } from "./latin1-rows.js";
20
- import { optionalLatin1RowsNative } from "./native.js";
19
+ import { latin1RowsParser } from "./native.js";
21
20
  import {
22
- encodingCode,
23
- normalizeColumns
21
+ normalizeFixedColumnsCount,
22
+ prepareCsvBufferInput,
23
+ resolveInputEncoding
24
24
  } from "./normalize.js";
25
25
  import { snapshotCsvOptions } from "./options-snapshot.js";
26
26
  import { createPreparedParser } from "./parser.js";
@@ -28,12 +28,6 @@ import {
28
28
  rejectStrictSchemaUnsupported,
29
29
  strictSchemaValidator
30
30
  } from "./strict-schema.js";
31
- import { parallelCount } from "./worker-count.js";
32
- import {
33
- createWorkerPool,
34
- CsvWorkerPool
35
- } from "./worker-pool.js";
36
- import { parallelRows } from "./worker-rows.js";
37
31
  export async function parse(buffer, suppliedOptions = {}) {
38
32
  const options = snapshotCsvOptions(suppliedOptions);
39
33
  if ("compression" in options && options.compression !== void 0)
@@ -42,11 +36,12 @@ export async function parse(buffer, suppliedOptions = {}) {
42
36
  throw Error("parse() does not support automatic delimiter detection; specify delimiter or use a file API");
43
37
  rejectFilteredStrictSchema(options);
44
38
  const filters = toNativeFilters(options.where);
45
- const columns = selectedColumns(options);
39
+ const columns = options.columns;
46
40
  const projected = filters !== void 0 || options.strict !== !0 && columns !== void 0;
47
- using parser = createPreparedParser(toParserOptions(options), projected ? columns : void 0, filters);
41
+ const input = prepareCsvBufferInput(buffer, options.encoding, options.delimiter);
42
+ using parser = createPreparedParser(toParserOptions(options, input.parserEncoding), projected ? columns : void 0, filters);
48
43
  const validator = strictSchemaValidator(options);
49
- const batch = parser.writeBatch(buffer, !0);
44
+ const batch = parser.writeBatch(input.bytes, !0);
50
45
  try {
51
46
  validator?.validateBatch(batch);
52
47
  validator?.finish();
@@ -58,22 +53,19 @@ export async function parse(buffer, suppliedOptions = {}) {
58
53
  export function rows(path, options = {}) {
59
54
  return iterateRows(path, snapshotCsvOptions(options));
60
55
  }
61
- async function* iterateRows(path, options) {
62
- if ((options.workerCount ?? 1) > 1) {
63
- rejectCompressedSharding(options, "parallel row parsing");
64
- rejectAutoDelimiterSharding(options, "parallel row parsing");
65
- yield* parallelRows(path, options);
66
- return;
67
- }
56
+ export async function* iterateRows(path, options, probeFormat) {
68
57
  rejectFilteredStrictSchema(options);
69
58
  const filters = toNativeFilters(options.where);
70
- const columns = selectedColumns(options);
59
+ const columns = options.columns;
71
60
  const projected = filters !== void 0 || options.strict !== !0 && columns !== void 0;
72
- await using input = await prepareCsvFileInput(path, options);
73
- const parserOptions = toParserOptions(options, input.delimiter);
61
+ await using input = await prepareCsvFileInput(path, options, "read-ahead", probeFormat);
62
+ const parserOptions = toParserOptions(options, input.parserEncoding, input.delimiter);
74
63
  const validator = strictSchemaValidator(options);
75
- if (options.strict !== !0 && options.fixedColumns === void 0 && validator === void 0 && encodingCode(options.encoding) === 1 && optionalLatin1RowsNative() !== null) {
76
- yield* latin1Rows(input.chunks(), input.delimiter, columns, filters);
64
+ const reusableRows = options.reuseArrays === !0 ? [] : void 0;
65
+ if (options.strict !== !0 && validator === void 0 && input.parserEncoding === "latin1") {
66
+ const fixedColumns = normalizeFixedColumnsCount(options.fixedColumns, "fixed column count");
67
+ const createParser = latin1RowsParser(fixedColumns);
68
+ yield* latin1Rows(input.chunks(), input.delimiter, columns, filters, createParser, reusableRows);
77
69
  return;
78
70
  }
79
71
  using parser = createPreparedParser(parserOptions, projected ? columns : void 0, filters);
@@ -82,7 +74,7 @@ async function* iterateRows(path, options) {
82
74
  if (batch.rowCount > 0)
83
75
  try {
84
76
  validator?.validateBatch(batch);
85
- const values = materializeRows(batch, columns, projected);
77
+ const values = materializeRows(batch, columns, projected, reusableRows);
86
78
  if (values.length > 0)
87
79
  yield values;
88
80
  } finally {
@@ -96,7 +88,7 @@ async function* iterateRows(path, options) {
96
88
  try {
97
89
  validator?.validateBatch(batch);
98
90
  validator?.finish();
99
- const values = materializeRows(batch, columns, projected);
91
+ const values = materializeRows(batch, columns, projected, reusableRows);
100
92
  if (values.length > 0)
101
93
  yield values;
102
94
  } finally {
@@ -107,18 +99,17 @@ async function* iterateRows(path, options) {
107
99
  batch.close();
108
100
  }
109
101
  }
110
-
111
- export { parallelRows };
112
- export { CsvWorkerPool };
113
102
  export function batches(path, options = {}) {
114
103
  return iterateBatches(path, snapshotCsvOptions(options));
115
104
  }
116
105
  async function* iterateBatches(path, options) {
117
106
  rejectFilteredStrictSchema(options);
118
107
  const filters = toNativeFilters(options.where);
119
- const columns = filters === void 0 ? void 0 : selectedColumns(options);
108
+ const columns = options.columns;
109
+ if (options.strict === !0 && columns !== void 0)
110
+ throw Error("strict CSV validation is not supported for projected batches; use csv.rows() for strict projection");
120
111
  await using input = await prepareCsvFileInput(path, options);
121
- using parser = createPreparedParser(toParserOptions(options, input.delimiter), columns, filters);
112
+ using parser = createPreparedParser(toParserOptions(options, input.parserEncoding, input.delimiter), columns, filters);
122
113
  const validator = strictSchemaValidator(options);
123
114
  for await (const chunk of input.chunks()) {
124
115
  const batch = parser.writeBatch(chunk);
@@ -144,111 +135,17 @@ async function* iterateBatches(path, options) {
144
135
  }
145
136
  yield batch;
146
137
  } else {
147
- validator?.finish();
148
138
  batch.close();
149
- }
150
- }
151
- export async function withBatches(path, options, callback) {
152
- for await (const batch of batches(path, options))
153
- try {
154
- await callback(batch);
155
- } finally {
156
- batch.close();
157
- }
158
- }
159
- export async function forEachColumnarBatches(path, suppliedOptions = {}, callback) {
160
- const options = snapshotCsvOptions(suppliedOptions);
161
- ensureColumnarBatchesSupported(options);
162
- const filters = toNativeFilters(options.where);
163
- const columns = selectedColumns(options);
164
- const scopedBatch = new ScopedCsvColumnarBatchView(columns);
165
- let batchIndex = 0;
166
- await using input = await prepareCsvFileInput(path, options);
167
- using parser = createPreparedParser(toParserOptions(options, input.delimiter), columns, filters);
168
- const validator = strictSchemaValidator(options);
169
- for await (const chunk of input.chunks()) {
170
- const batch = parser.writeBatch(chunk);
171
- if (batch.rowCount > 0)
172
- try {
173
- validator?.validateBatch(batch);
174
- scopedBatch.bind(batch);
175
- try {
176
- const result = callback(scopedBatch, batchIndex);
177
- if (isPromiseLike(result))
178
- throw TypeError("columnar batch callback must be synchronous");
179
- } finally {
180
- scopedBatch.release();
181
- }
182
- ++batchIndex;
183
- } finally {
184
- batch.close();
185
- }
186
- else
187
- batch.close();
188
- }
189
- const batch = parser.endBatch();
190
- if (batch.rowCount > 0)
191
- try {
192
- validator?.validateBatch(batch);
193
- validator?.finish();
194
- scopedBatch.bind(batch);
195
- try {
196
- const result = callback(scopedBatch, batchIndex);
197
- if (isPromiseLike(result))
198
- throw TypeError("columnar batch callback must be synchronous");
199
- } finally {
200
- scopedBatch.release();
201
- }
202
- } finally {
203
- batch.close();
204
- }
205
- else {
206
139
  validator?.finish();
207
- batch.close();
208
140
  }
209
141
  }
210
- export function withColumnarBatches(path, options, callback) {
211
- return forEachColumnarBatches(path, options, callback);
212
- }
213
- export async function forEachRowViews(path, suppliedOptions = {}, callback) {
214
- const options = snapshotCsvOptions(suppliedOptions);
215
- ensureRowViewsSupported(options);
216
- const scopedRowView = new ScopedCsvRowView(selectedColumns(options));
217
- for await (const batch of batches(path, options))
218
- try {
219
- const rowCount = batch.rowCount;
220
- if (rowCount === 0)
221
- continue;
222
- const reusable = new NativeCsvRowView(batch.data(), batch.rowOffsets(), batch.fieldOffsets());
223
- for (let rowIndex = 0;rowIndex < rowCount; ++rowIndex) {
224
- scopedRowView.bind(reusable.moveTo(rowIndex));
225
- try {
226
- const result = callback(scopedRowView, rowIndex);
227
- if (isPromiseLike(result))
228
- throw TypeError("row view callback must be synchronous");
229
- } finally {
230
- scopedRowView.release();
231
- }
232
- }
233
- } finally {
234
- batch.close();
235
- }
236
- }
237
- export function withRowViews(path, options, callback) {
238
- return forEachRowViews(path, options, callback);
239
- }
240
142
  export async function count(path, suppliedOptions = {}) {
241
143
  const options = snapshotCsvOptions(suppliedOptions);
242
- if ((options.workerCount ?? 1) > 1) {
243
- rejectCompressedSharding(options, "parallel counting");
244
- rejectAutoDelimiterSharding(options, "parallel counting");
245
- return parallelCount(path, options);
246
- }
247
144
  const filters = toNativeFilters(options.where);
248
- await using input = await prepareCsvFileInput(path, options);
145
+ await using input = await prepareCsvFileInput(path, options, "count");
249
146
  if (options.strict === !0 && filters !== void 0)
250
147
  throw Error("strict CSV validation is not supported for count filters");
251
- using parser = createPreparedParser(toParserOptions(options, input.delimiter), void 0, filters);
148
+ using parser = createPreparedParser(toParserOptions(options, input.parserEncoding, input.delimiter), void 0, filters);
252
149
  const validator = strictSchemaValidator(options);
253
150
  let total = 0;
254
151
  if (options.strict === !0 && filters === void 0) {
@@ -276,22 +173,20 @@ export async function count(path, suppliedOptions = {}) {
276
173
  total += parser.endCount();
277
174
  return total;
278
175
  }
279
-
280
- export { parallelCount };
281
- export function findCsvSafeSplitOffsets(path, shardCount, suppliedOptions = {}) {
176
+ function findCsvSafeSplitOffsets(path, shardCount, suppliedOptions = {}) {
282
177
  const options = snapshotCsvOptions(suppliedOptions);
283
- rejectCompressedSharding(options, "CSV split offset scanning");
284
- rejectAutoDelimiterSharding(options, "CSV split offset scanning");
285
- return findCsvSafeSplitOffsetsNative(path, shardCount, options.delimiter ?? ",");
178
+ return findCsvSafeSplitOffsetsNative(path, shardCount, shardingDelimiter(options, "CSV split offset scanning"));
286
179
  }
287
- export function findCsvSafeShards(path, shardCount, suppliedOptions = {}) {
180
+ function findCsvSafeShards(path, shardCount, suppliedOptions = {}) {
288
181
  const options = snapshotCsvOptions(suppliedOptions);
289
- rejectCompressedSharding(options, "CSV shard scanning");
290
- rejectAutoDelimiterSharding(options, "CSV shard scanning");
291
- return findCsvSafeShardsNative(path, shardCount, options.delimiter ?? ",");
182
+ return findCsvSafeShardsNative(path, shardCount, shardingDelimiter(options, "CSV shard scanning"));
292
183
  }
293
- export function workerPool(path, options) {
294
- return createWorkerPool(path, options);
184
+ function shardingDelimiter(options, operation) {
185
+ rejectCompressedSharding(options, operation);
186
+ rejectAutoDelimiterSharding(options, operation);
187
+ if (typeof resolveInputEncoding(options.encoding) !== "string")
188
+ throw Error(`${operation} requires a native UTF-8 or Latin-1 encoding because offsets refer to the source file`);
189
+ return options.delimiter ?? ",";
295
190
  }
296
191
  export const csv = {
297
192
  all,
@@ -299,188 +194,29 @@ export const csv = {
299
194
  column,
300
195
  not,
301
196
  re,
302
- workerPool,
303
197
  parse,
304
198
  rows,
305
- parallelCount,
306
- parallelRows,
307
199
  batches,
308
- withBatches,
309
- forEachColumnarBatches,
310
- withColumnarBatches,
311
- forEachRowViews,
312
- withRowViews,
313
200
  count,
314
201
  findCsvSafeSplitOffsets,
315
202
  findCsvSafeShards
316
203
  };
317
- function toParserOptions(options, delimiter = options.delimiter) {
318
- const selectedColumns = "columns" in options && options.columns !== void 0 ? options.columns : options.selectedColumns;
319
- if ("columns" in options && options.columns !== void 0 && options.selectedColumns !== void 0)
320
- throw Error("use columns or selectedColumns, not both");
204
+ function toParserOptions(options, encoding, delimiter = options.delimiter) {
321
205
  return {
322
206
  delimiter,
323
- encoding: options.encoding,
207
+ encoding,
324
208
  strict: options.strict,
325
- selectedColumns,
209
+ columns: options.columns,
326
210
  fixedColumns: options.fixedColumns
327
211
  };
328
212
  }
329
- function selectedColumns(options) {
330
- if (options.columns !== void 0 && options.selectedColumns !== void 0)
331
- throw Error("use columns or selectedColumns, not both");
332
- const columns = options.columns ?? options.selectedColumns;
333
- normalizeColumns(columns);
334
- return columns;
335
- }
336
- function materializeRows(batch, columns, projected) {
337
- if (projected)
338
- return batch.rowsInto([]);
339
- return batch.rowsInto([], columns);
340
- }
341
- function ensureRowViewsSupported(options) {
342
- if ((options.workerCount ?? 1) > 1)
343
- throw Error("row view callbacks do not support workerCount; use rows()/parallelRows() for materialized rows or withBatches() for low-level streaming");
344
- }
345
- function ensureColumnarBatchesSupported(options) {
346
- ensureRowViewsSupported(options);
347
- if (options.strict === !0 && selectedColumns(options) !== void 0)
348
- throw Error("columnar batch callbacks do not support strict selectedColumns; use rows() for projected validation or withBatches() for manual low-level handling");
213
+ function materializeRows(batch, columns, projected, target = []) {
214
+ return batch.rowsInto(target, projected ? void 0 : columns);
349
215
  }
350
216
  function rejectFilteredStrictSchema(options) {
351
217
  if (options.where !== void 0)
352
218
  rejectStrictSchemaUnsupported(options, "filtered rows");
353
219
  }
354
- function isPromiseLike(value) {
355
- return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
356
- }
357
-
358
- class ScopedCsvRowView {
359
- #selectedColumns;
360
- #rowView = null;
361
- constructor(selectedColumns) {
362
- this.#selectedColumns = selectedColumns;
363
- }
364
- bind(rowView) {
365
- this.#rowView = rowView;
366
- return this;
367
- }
368
- release() {
369
- this.#rowView = null;
370
- }
371
- get rowIndex() {
372
- return this.#requireRowView().rowIndex;
373
- }
374
- get fieldCount() {
375
- return this.#requireRowView().fieldCount;
376
- }
377
- get selectedColumns() {
378
- return this.#selectedColumns;
379
- }
380
- fieldRange(columnIndex) {
381
- return this.#requireRowView().fieldRange(columnIndex);
382
- }
383
- range(columnIndex) {
384
- return this.#requireRowView().range(columnIndex);
385
- }
386
- fieldBytes(columnIndex) {
387
- return this.#requireRowView().fieldBytes(columnIndex);
388
- }
389
- bytes(columnIndex) {
390
- return this.#requireRowView().bytes(columnIndex);
391
- }
392
- fieldBuffer(columnIndex) {
393
- return this.#requireRowView().fieldBuffer(columnIndex);
394
- }
395
- buffer(columnIndex) {
396
- return this.#requireRowView().buffer(columnIndex);
397
- }
398
- fieldString(columnIndex) {
399
- return this.#requireRowView().fieldString(columnIndex);
400
- }
401
- getPhysical(columnIndex) {
402
- return this.#requireRowView().getPhysical(columnIndex);
403
- }
404
- get(columnIndex) {
405
- return this.#requireRowView().get(columnIndex);
406
- }
407
- pickPhysical(columns) {
408
- return this.#requireRowView().pickPhysical(columns);
409
- }
410
- pick(columns) {
411
- return this.#requireRowView().pick(columns);
412
- }
413
- #requireRowView() {
414
- if (this.#rowView === null)
415
- throw Error("row view is only valid during row view callback");
416
- return this.#rowView;
417
- }
418
- }
419
-
420
- class ScopedCsvColumnarBatchView {
421
- #selectedColumns;
422
- #batch = null;
423
- constructor(selectedColumns) {
424
- this.#selectedColumns = selectedColumns;
425
- }
426
- bind(batch) {
427
- this.#batch = batch;
428
- return this;
429
- }
430
- release() {
431
- this.#batch = null;
432
- }
433
- get rowCount() {
434
- return this.#requireBatch().rowCount;
435
- }
436
- get totalFields() {
437
- return this.#requireBatch().totalFields;
438
- }
439
- get dataLength() {
440
- return this.#requireBatch().dataLength;
441
- }
442
- get selectedColumns() {
443
- return this.#selectedColumns;
444
- }
445
- data() {
446
- return this.#requireBatch().data();
447
- }
448
- dataView() {
449
- return this.#requireBatch().dataView();
450
- }
451
- rowOffsets() {
452
- return this.#requireBatch().rowOffsets();
453
- }
454
- fieldOffsets() {
455
- return this.#requireBatch().fieldOffsets();
456
- }
457
- rowFieldCount(rowIndex) {
458
- return this.#requireBatch().rowFieldCount(rowIndex);
459
- }
460
- fieldRange(rowIndex, columnIndex) {
461
- return this.#requireBatch().fieldRange(rowIndex, columnIndex);
462
- }
463
- fieldBytes(rowIndex, columnIndex) {
464
- return this.#requireBatch().fieldBytes(rowIndex, columnIndex);
465
- }
466
- fieldBuffer(rowIndex, columnIndex) {
467
- return this.#requireBatch().fieldBuffer(rowIndex, columnIndex);
468
- }
469
- forEachColumnRange(columnIndex, callback, startRow, endRow) {
470
- return this.#requireBatch().forEachColumnRange(columnIndex, callback, startRow, endRow);
471
- }
472
- forEachColumnBytes(columnIndex, callback, startRow, endRow) {
473
- return this.#requireBatch().forEachColumnBytes(columnIndex, callback, startRow, endRow);
474
- }
475
- scanColumns(columns, callback, startRow, endRow) {
476
- return this.#requireBatch().scanColumns(columns, callback, startRow, endRow);
477
- }
478
- #requireBatch() {
479
- if (this.#batch === null)
480
- throw Error("columnar batch view is only valid during columnar batch callback");
481
- return this.#batch;
482
- }
483
- }
484
220
  function toNativeFilters(where) {
485
221
  return nativeFilterProgramFor(where);
486
222
  }
package/dist/batches.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type NativePointer } from './native.js';
2
2
  import type { CsvColumnBytesCallback, CsvColumnRangeCallback, CsvColumns, CsvFieldRange, CsvRow, CsvScanColumnsCallback, NativeCsvRowCallback } from './types.js';
3
+ declare const visitBatchRows: unique symbol;
3
4
  /**
4
5
  * A reusable, low-allocation view over one row in a {@link NativeCsvBatch}.
5
6
  *
@@ -49,13 +50,6 @@ export declare class NativeCsvRowView {
49
50
  * @returns A half-open byte range, or `null` when the row has no such field.
50
51
  * @throws {RangeError} If the row or offset table is malformed.
51
52
  */
52
- fieldRange(columnIndex: number): CsvFieldRange | null;
53
- /**
54
- * Returns the current row's field range as a half-open byte interval.
55
- *
56
- * @param columnIndex Zero-based field index in the current row.
57
- * @returns Offsets into the backing data, or `null` when the field is absent.
58
- */
59
53
  range(columnIndex: number): CsvFieldRange | null;
60
54
  /**
61
55
  * Returns a borrowed byte view for a field in the current row.
@@ -66,14 +60,6 @@ export declare class NativeCsvRowView {
66
60
  * @param columnIndex Zero-based field index.
67
61
  * @returns A borrowed byte view, or `null` when the field is absent.
68
62
  */
69
- fieldBytes(columnIndex: number): Uint8Array | null;
70
- /**
71
- * Returns borrowed bytes for a field in the current row.
72
- *
73
- * @param columnIndex Zero-based field index in the current row.
74
- * @returns A view sharing the batch storage, or `null` when the field is absent.
75
- * The view is valid only while the originating batch remains open.
76
- */
77
63
  bytes(columnIndex: number): Uint8Array | null;
78
64
  /**
79
65
  * Returns a borrowed `Buffer` view for a field in the current row.
@@ -84,14 +70,6 @@ export declare class NativeCsvRowView {
84
70
  * @param columnIndex Zero-based field index.
85
71
  * @returns A borrowed buffer, or `null` when the field is absent.
86
72
  */
87
- fieldBuffer(columnIndex: number): Buffer | null;
88
- /**
89
- * Returns a borrowed `Buffer` for a field in the current row.
90
- *
91
- * @param columnIndex Zero-based field index in the current row.
92
- * @returns A buffer sharing the batch storage, or `null` when the field is absent.
93
- * The buffer is valid only while the originating batch remains open.
94
- */
95
73
  buffer(columnIndex: number): Buffer | null;
96
74
  /**
97
75
  * Decodes a field as UTF-8 text.
@@ -99,23 +77,6 @@ export declare class NativeCsvRowView {
99
77
  * @param columnIndex Zero-based field index.
100
78
  * @returns The decoded field, or `null` when the field is absent.
101
79
  */
102
- fieldString(columnIndex: number): string | null;
103
- /**
104
- * Reads a field from the current row as UTF-8 text.
105
- *
106
- * @param columnIndex Zero-based field index in the current row.
107
- * @returns Decoded text, or `null` when the field is absent.
108
- */
109
- getPhysical(columnIndex: number): string | null;
110
- /**
111
- * Reads a field from the current row as UTF-8 text.
112
- *
113
- * This is the concise accessor; use `getPhysical()` when the source-column
114
- * interpretation should be explicit at the call site.
115
- *
116
- * @param columnIndex Zero-based field index in the current row.
117
- * @returns Decoded text, or `null` when the field is absent.
118
- */
119
80
  get(columnIndex: number): string | null;
120
81
  /**
121
82
  * Materializes selected fields from the current row in the requested order.
@@ -126,15 +87,8 @@ export declare class NativeCsvRowView {
126
87
  * this low-level accessor.
127
88
  * @returns A newly allocated array of decoded UTF-8 strings.
128
89
  */
129
- pickPhysical(columns: CsvColumns): string[];
130
- /**
131
- * Materializes selected fields from the current row in the requested order.
132
- *
133
- * @param columns Zero-based field indexes in the current row. Duplicate
134
- * indexes are allowed for this low-level accessor.
135
- * @returns A new array of decoded UTF-8 strings. Missing fields are `''`.
136
- */
137
90
  pick(columns: CsvColumns): string[];
91
+ static [visitBatchRows](batch: NativeCsvBatch, callback: NativeCsvRowCallback): void;
138
92
  }
139
93
  /**
140
94
  * Owns one native parser output batch and exposes low-allocation field views.
@@ -179,9 +133,8 @@ export declare class NativeCsvBatch {
179
133
  /**
180
134
  * Visits each row through one reusable {@link NativeCsvRowView}.
181
135
  *
182
- * The callback is invoked synchronously. The view object and its borrowed
183
- * byte results must not be retained for use after the callback or batch
184
- * lifetime.
136
+ * The callback must be synchronous. Row access is valid only during its call.
137
+ * Copy borrowed bytes before closing the batch.
185
138
  *
186
139
  * @param callback Function invoked with the reusable row view and its row index.
187
140
  */
@@ -331,8 +284,7 @@ export declare class NativeCsvBatch {
331
284
  * Calling `close()` more than once is safe.
332
285
  */
333
286
  close(): void;
334
- /** Alias for {@link close}, suitable for explicit resource management. */
335
- dispose(): void;
336
287
  /** Implements `using` / explicit resource management. */
337
288
  [Symbol.dispose](): void;
338
289
  }
290
+ export {};