@graphty/graph-io 0.2.4 → 0.3.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 (180) hide show
  1. package/README.md +29 -7
  2. package/dist/chunks/{escape-DyI8JofU.js → escape-CKied3Ri.js} +16 -10
  3. package/dist/chunks/escape-CKied3Ri.js.map +1 -0
  4. package/dist/chunks/{importer-DbnGYr3_.js → importer-C6QcIRIb.js} +129 -39
  5. package/dist/chunks/importer-C6QcIRIb.js.map +1 -0
  6. package/dist/chunks/{importer-CpCpfbxr.js → importer-D5pAsweZ.js} +136 -31
  7. package/dist/chunks/importer-D5pAsweZ.js.map +1 -0
  8. package/dist/chunks/{importer-GozH8DkN.js → importer-DbMrAR_w.js} +10 -4
  9. package/dist/chunks/importer-DbMrAR_w.js.map +1 -0
  10. package/dist/chunks/{importer-CQnJuWJw.js → importer-DkzjTvHc.js} +82 -40
  11. package/dist/chunks/importer-DkzjTvHc.js.map +1 -0
  12. package/dist/chunks/{records-CGpxszm1.js → records-BKSMowhR.js} +3 -3
  13. package/dist/chunks/{records-CGpxszm1.js.map → records-BKSMowhR.js.map} +1 -1
  14. package/dist/chunks/{text-CajMdVFy.js → text-Dr0Ifpag.js} +2 -2
  15. package/dist/chunks/{text-CajMdVFy.js.map → text-Dr0Ifpag.js.map} +1 -1
  16. package/dist/chunks/{writer-DxSKC7TL.js → writer-BdMak4_J.js} +341 -112
  17. package/dist/chunks/writer-BdMak4_J.js.map +1 -0
  18. package/dist/csv.js +24 -6
  19. package/dist/csv.js.map +1 -1
  20. package/dist/dot.js +1 -1
  21. package/dist/gexf.js +42 -10
  22. package/dist/gexf.js.map +1 -1
  23. package/dist/gml.js +69 -25
  24. package/dist/gml.js.map +1 -1
  25. package/dist/graph-io.js +186 -129
  26. package/dist/graph-io.js.map +1 -1
  27. package/dist/graphml.js +1 -1
  28. package/dist/json.js +1 -1
  29. package/dist/neo4j.js +10 -4
  30. package/dist/neo4j.js.map +1 -1
  31. package/dist/pajek.js +1 -1
  32. package/dist/src/common/codes.d.ts +6 -0
  33. package/dist/src/common/codes.d.ts.map +1 -1
  34. package/dist/src/common/codes.js +6 -0
  35. package/dist/src/common/codes.js.map +1 -1
  36. package/dist/src/common/escape.d.ts +5 -4
  37. package/dist/src/common/escape.d.ts.map +1 -1
  38. package/dist/src/common/escape.js +6 -5
  39. package/dist/src/common/escape.js.map +1 -1
  40. package/dist/src/common/format.d.ts +3 -3
  41. package/dist/src/common/format.js +5 -5
  42. package/dist/src/common/format.js.map +1 -1
  43. package/dist/src/common/input.d.ts +24 -6
  44. package/dist/src/common/input.d.ts.map +1 -1
  45. package/dist/src/common/input.js +259 -23
  46. package/dist/src/common/input.js.map +1 -1
  47. package/dist/src/common/options.d.ts +2 -0
  48. package/dist/src/common/options.d.ts.map +1 -1
  49. package/dist/src/common/options.js +17 -0
  50. package/dist/src/common/options.js.map +1 -1
  51. package/dist/src/common/text.js +4 -4
  52. package/dist/src/common/text.js.map +1 -1
  53. package/dist/src/common/weights.d.ts.map +1 -1
  54. package/dist/src/common/weights.js +8 -0
  55. package/dist/src/common/weights.js.map +1 -1
  56. package/dist/src/common/xml.d.ts +7 -0
  57. package/dist/src/common/xml.d.ts.map +1 -1
  58. package/dist/src/common/xml.js +12 -0
  59. package/dist/src/common/xml.js.map +1 -1
  60. package/dist/src/formats/csv/exporter.d.ts +5 -1
  61. package/dist/src/formats/csv/exporter.d.ts.map +1 -1
  62. package/dist/src/formats/csv/exporter.js +8 -1
  63. package/dist/src/formats/csv/exporter.js.map +1 -1
  64. package/dist/src/formats/csv/importer.d.ts.map +1 -1
  65. package/dist/src/formats/csv/importer.js +1 -0
  66. package/dist/src/formats/csv/importer.js.map +1 -1
  67. package/dist/src/formats/csv/index.d.ts +6 -0
  68. package/dist/src/formats/csv/index.d.ts.map +1 -1
  69. package/dist/src/formats/csv/index.js +7 -1
  70. package/dist/src/formats/csv/index.js.map +1 -1
  71. package/dist/src/formats/csv/records.js +1 -1
  72. package/dist/src/formats/csv/records.js.map +1 -1
  73. package/dist/src/formats/dot/exporter.d.ts +1 -1
  74. package/dist/src/formats/dot/exporter.d.ts.map +1 -1
  75. package/dist/src/formats/dot/exporter.js +3 -3
  76. package/dist/src/formats/dot/exporter.js.map +1 -1
  77. package/dist/src/formats/dot/importer.d.ts +6 -0
  78. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  79. package/dist/src/formats/dot/importer.js +151 -24
  80. package/dist/src/formats/dot/importer.js.map +1 -1
  81. package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
  82. package/dist/src/formats/gexf/exporter.js +32 -7
  83. package/dist/src/formats/gexf/exporter.js.map +1 -1
  84. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  85. package/dist/src/formats/gexf/importer.js +2 -2
  86. package/dist/src/formats/gexf/importer.js.map +1 -1
  87. package/dist/src/formats/gexf/index.d.ts +6 -0
  88. package/dist/src/formats/gexf/index.d.ts.map +1 -1
  89. package/dist/src/formats/gexf/index.js +7 -1
  90. package/dist/src/formats/gexf/index.js.map +1 -1
  91. package/dist/src/formats/gml/importer.d.ts +2 -2
  92. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  93. package/dist/src/formats/gml/importer.js +66 -25
  94. package/dist/src/formats/gml/importer.js.map +1 -1
  95. package/dist/src/formats/gml/index.d.ts +7 -1
  96. package/dist/src/formats/gml/index.d.ts.map +1 -1
  97. package/dist/src/formats/gml/index.js +8 -2
  98. package/dist/src/formats/gml/index.js.map +1 -1
  99. package/dist/src/formats/graphml/constants.d.ts +6 -0
  100. package/dist/src/formats/graphml/constants.d.ts.map +1 -1
  101. package/dist/src/formats/graphml/constants.js +7 -1
  102. package/dist/src/formats/graphml/constants.js.map +1 -1
  103. package/dist/src/formats/graphml/importer.d.ts.map +1 -1
  104. package/dist/src/formats/graphml/importer.js +2 -2
  105. package/dist/src/formats/graphml/importer.js.map +1 -1
  106. package/dist/src/formats/json/exporter.d.ts.map +1 -1
  107. package/dist/src/formats/json/exporter.js +14 -5
  108. package/dist/src/formats/json/exporter.js.map +1 -1
  109. package/dist/src/formats/json/importer.d.ts +8 -0
  110. package/dist/src/formats/json/importer.d.ts.map +1 -1
  111. package/dist/src/formats/json/importer.js +84 -37
  112. package/dist/src/formats/json/importer.js.map +1 -1
  113. package/dist/src/formats/neo4j/importer.js +1 -1
  114. package/dist/src/formats/neo4j/importer.js.map +1 -1
  115. package/dist/src/formats/neo4j/index.d.ts +6 -0
  116. package/dist/src/formats/neo4j/index.d.ts.map +1 -1
  117. package/dist/src/formats/neo4j/index.js +7 -1
  118. package/dist/src/formats/neo4j/index.js.map +1 -1
  119. package/dist/src/formats/pajek/exporter.d.ts +2 -0
  120. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  121. package/dist/src/formats/pajek/exporter.js +13 -2
  122. package/dist/src/formats/pajek/exporter.js.map +1 -1
  123. package/dist/src/formats/pajek/importer.d.ts +8 -2
  124. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  125. package/dist/src/formats/pajek/importer.js +122 -26
  126. package/dist/src/formats/pajek/importer.js.map +1 -1
  127. package/dist/src/index.d.ts +1 -1
  128. package/dist/src/index.d.ts.map +1 -1
  129. package/dist/src/index.js +1 -1
  130. package/dist/src/index.js.map +1 -1
  131. package/dist/src/registry.d.ts +26 -0
  132. package/dist/src/registry.d.ts.map +1 -1
  133. package/dist/src/registry.js +101 -35
  134. package/dist/src/registry.js.map +1 -1
  135. package/dist/src/sniff.d.ts +1 -1
  136. package/dist/src/sniff.d.ts.map +1 -1
  137. package/dist/src/sniff.js +6 -1
  138. package/dist/src/sniff.js.map +1 -1
  139. package/dist/src/types.d.ts +22 -3
  140. package/dist/src/types.d.ts.map +1 -1
  141. package/dist/src/types.js.map +1 -1
  142. package/package.json +4 -3
  143. package/src/common/codes.ts +9 -0
  144. package/src/common/escape.ts +6 -5
  145. package/src/common/format.ts +5 -5
  146. package/src/common/input.ts +293 -22
  147. package/src/common/options.ts +24 -0
  148. package/src/common/text.ts +4 -4
  149. package/src/common/weights.ts +9 -0
  150. package/src/common/xml.ts +14 -0
  151. package/src/formats/csv/exporter.ts +12 -1
  152. package/src/formats/csv/importer.ts +1 -0
  153. package/src/formats/csv/index.ts +9 -0
  154. package/src/formats/csv/records.ts +1 -1
  155. package/src/formats/dot/exporter.ts +3 -3
  156. package/src/formats/dot/importer.ts +172 -32
  157. package/src/formats/gexf/exporter.ts +38 -7
  158. package/src/formats/gexf/importer.ts +12 -2
  159. package/src/formats/gexf/index.ts +9 -0
  160. package/src/formats/gml/importer.ts +75 -22
  161. package/src/formats/gml/index.ts +10 -1
  162. package/src/formats/graphml/constants.ts +9 -0
  163. package/src/formats/graphml/importer.ts +9 -2
  164. package/src/formats/json/exporter.ts +14 -5
  165. package/src/formats/json/importer.ts +104 -36
  166. package/src/formats/neo4j/importer.ts +1 -1
  167. package/src/formats/neo4j/index.ts +9 -0
  168. package/src/formats/pajek/exporter.ts +19 -2
  169. package/src/formats/pajek/importer.ts +145 -28
  170. package/src/index.ts +1 -0
  171. package/src/registry.ts +131 -40
  172. package/src/sniff.ts +6 -1
  173. package/src/types.ts +26 -3
  174. package/dist/chunks/escape-DyI8JofU.js.map +0 -1
  175. package/dist/chunks/importer-CQnJuWJw.js.map +0 -1
  176. package/dist/chunks/importer-CpCpfbxr.js.map +0 -1
  177. package/dist/chunks/importer-DbnGYr3_.js.map +0 -1
  178. package/dist/chunks/importer-GozH8DkN.js.map +0 -1
  179. package/dist/chunks/writer-DxSKC7TL.js.map +0 -1
  180. package/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/graph-io.js CHANGED
@@ -1,25 +1,25 @@
1
- import { I as ImportReportBuilder, a as throwIfAborted } from "./chunks/writer-DxSKC7TL.js";
2
- import { B, b, C, c, d, D, e, f, g, h, i, j, k, l, E, m, H, n, o, p, q, r, s, u, L, v, M, w, x, y, z, A, F, N, G, O, J, P, K, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, t, aE } from "./chunks/writer-DxSKC7TL.js";
1
+ import { I as ImportReportBuilder, a as throwIfAborted } from "./chunks/writer-BdMak4_J.js";
2
+ import { B, b, C, c, d, D, e, f, g, h, i, j, k, l, E, m, n, H, o, p, q, r, s, u, v, w, L, x, M, y, z, A, F, G, J, N, K, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aG, t, aH } from "./chunks/writer-BdMak4_J.js";
3
3
  import { C as C2, c as c2, a } from "./chunks/children-CL3Cy0ez.js";
4
- import { GraphBuilder, GraphFormatError } from "@graphty/graph-format";
4
+ import { GraphFormatError, GraphBuilder } from "@graphty/graph-format";
5
5
  import { csvImporter, csvExporter } from "./csv.js";
6
6
  import { CSV_CAPABILITIES, CSV_ISSUE, CSV_LOSS } from "./csv.js";
7
- import { b as dotImporter, d as dotExporter } from "./chunks/importer-DbnGYr3_.js";
8
- import { D as D2, a as a10 } from "./chunks/importer-DbnGYr3_.js";
7
+ import { b as dotImporter, d as dotExporter } from "./chunks/importer-C6QcIRIb.js";
8
+ import { D as D2, a as a10 } from "./chunks/importer-C6QcIRIb.js";
9
9
  import { gexfImporter, gexfExporter } from "./gexf.js";
10
10
  import { GEXF_1_2_CAPABILITIES, GEXF_ISSUE, GEXF_LOSS } from "./gexf.js";
11
11
  import { gmlImporter, gmlExporter } from "./gml.js";
12
12
  import { GML_ISSUE, GML_LOSS } from "./gml.js";
13
- import { b as graphmlImporter, g as graphmlExporter } from "./chunks/importer-GozH8DkN.js";
14
- import { G as G2, a as a11 } from "./chunks/importer-GozH8DkN.js";
15
- import { s as sniffJsonDialect, e as jsonImporter, c as jsonExporter } from "./chunks/importer-CQnJuWJw.js";
16
- import { J as J2, a as a12, b as b2, d as d2, j as j2 } from "./chunks/importer-CQnJuWJw.js";
13
+ import { b as graphmlImporter, g as graphmlExporter } from "./chunks/importer-DbMrAR_w.js";
14
+ import { G as G2, a as a11 } from "./chunks/importer-DbMrAR_w.js";
15
+ import { s as sniffJsonDialect, e as jsonImporter, c as jsonExporter } from "./chunks/importer-DkzjTvHc.js";
16
+ import { J as J2, a as a12, b as b2, d as d2, j as j2 } from "./chunks/importer-DkzjTvHc.js";
17
17
  import { neo4jImporter, neo4jExporter } from "./neo4j.js";
18
18
  import { ID_SPACE_COLUMN, LABELS_COLUMN, NEO4J_CAPABILITIES, NEO4J_ISSUE, NEO4J_LOSS, TYPE_COLUMN } from "./neo4j.js";
19
- import { b as pajekImporter, p as pajekExporter } from "./chunks/importer-CpCpfbxr.js";
20
- import { P as P2, a as a13 } from "./chunks/importer-CpCpfbxr.js";
21
- import { T as T2, W as W2, i as i2, a as a14, p as p2 } from "./chunks/text-CajMdVFy.js";
22
- import { X as X2, a as a15, h as h2, t as t2, x as x2 } from "./chunks/escape-DyI8JofU.js";
19
+ import { b as pajekImporter, p as pajekExporter } from "./chunks/importer-D5pAsweZ.js";
20
+ import { P as P2, a as a13 } from "./chunks/importer-D5pAsweZ.js";
21
+ import { T as T2, W as W2, i as i2, a as a14, p as p2 } from "./chunks/text-Dr0Ifpag.js";
22
+ import { X as X2, a as a15, h as h2, t as t2, x as x2 } from "./chunks/escape-CKied3Ri.js";
23
23
  const GRAPH_FORMATS = Object.freeze([
24
24
  "json",
25
25
  "graphml",
@@ -47,6 +47,10 @@ function headBytes(head) {
47
47
  if (typeof head === "string") {
48
48
  return new TextEncoder().encode(head.slice(0, SNIFF_HEAD_BYTES)).subarray(0, SNIFF_HEAD_BYTES);
49
49
  }
50
+ if (head.byteLength >= 2 && (head[0] === 255 && head[1] === 254 || head[0] === 254 && head[1] === 255)) {
51
+ const encoding = head[0] === 255 ? "utf-16le" : "utf-16be";
52
+ return headBytes(new TextDecoder(encoding).decode(head.subarray(0, SNIFF_HEAD_BYTES)));
53
+ }
50
54
  return head.byteLength > SNIFF_HEAD_BYTES ? head.subarray(0, SNIFF_HEAD_BYTES) : head;
51
55
  }
52
56
  function rankFormats(hints, importers) {
@@ -71,7 +75,7 @@ function rankFormats(hints, importers) {
71
75
  continue;
72
76
  }
73
77
  const dialect = importer.format === "json" && head !== null ? sniffJsonDialectHead(head) : null;
74
- const result = Object.freeze({
78
+ const result2 = Object.freeze({
75
79
  format: importer.format,
76
80
  confidence: Math.min(1, confidence),
77
81
  content,
@@ -79,7 +83,7 @@ function rankFormats(hints, importers) {
79
83
  mimeType: mimeMatch,
80
84
  dialect
81
85
  });
82
- candidates.push({ result, rank: rank++ });
86
+ candidates.push({ result: result2, rank: rank++ });
83
87
  }
84
88
  candidates.sort((a16, b3) => b3.result.confidence - a16.result.confidence || a16.rank - b3.rank);
85
89
  return candidates.map((c3) => c3.result);
@@ -370,56 +374,82 @@ class FormatRegistry {
370
374
  * own a sink). The format is the one named in the options, else sniffed from the filename,
371
375
  * the MIME type and the first bytes of the content; the builder is seeded from the common
372
376
  * options with `directed: true` as a placeholder that the importer overrides from the file.
377
+ * An input holding several graphs yields the first, with a warning naming how many were
378
+ * skipped; importAllGraphs() returns every one.
373
379
  * @param input - the text, bytes, stream or chunks to read
374
380
  * @param options - the format, hints, common and format-specific import options
375
381
  * @returns the snapshot, the import report and the freeze report
376
382
  */
377
383
  async importGraph(input, options = {}) {
378
- const requested = options.format ?? "auto";
379
- let importer;
380
- let sniff2 = null;
381
- let source = input;
382
- let peeked = null;
383
- if (requested === "auto") {
384
- peeked = await peekHead(input, SNIFF_HEAD_BYTES, options.signal ?? null);
385
- source = peeked.input;
386
- sniff2 = this.sniff({ filename: options.filename, mimeType: options.mimeType, head: peeked.head });
387
- if (sniff2 === null) {
388
- const report2 = new ImportReportBuilder("unknown", 0);
389
- return report2.fail(
390
- UNKNOWN_FORMAT_CODE,
391
- `no registered importer recognises the input${describeHints(options)}; pass the format explicitly`,
392
- void 0,
393
- { formats: this.formats() }
394
- );
395
- }
396
- importer = this.importer(sniff2.format);
397
- } else {
398
- importer = this.importer(requested);
399
- }
400
- const builder = new GraphBuilder({
401
- weightDtype: options.weightDtype ?? "f64",
402
- ...options.builder,
403
- directed: true,
404
- addMissingNodes: options.addMissingNodes ?? true,
405
- duplicateEdges: options.duplicateEdges ?? "keep",
406
- selfLoops: options.selfLoops ?? "keep"
407
- });
384
+ const chosen = await this.choose(input, options);
385
+ const builder = seededBuilder(options);
408
386
  let report;
409
387
  try {
410
- report = await importer.import(source, builder, importerOptions(options));
388
+ report = await chosen.importer.import(chosen.source, builder, importerOptions(options));
411
389
  } catch (err) {
412
- await peeked?.close();
390
+ await chosen.peeked?.close();
413
391
  throw err;
414
392
  }
415
- const frozen = builder.freezeWithReport(options.freeze);
416
- return Object.freeze({
417
- format: importer.format,
418
- sniff: sniff2,
419
- snapshot: frozen.snapshot,
420
- report,
421
- freeze: frozen.report
422
- });
393
+ return result(chosen, builder, report, options);
394
+ }
395
+ /**
396
+ * Read every graph of an input (a DOT file with several graphs, a Pajek project with several
397
+ * networks, a JGF document with a `graphs` array), each into its own fresh builder, frozen.
398
+ * A format whose importer has no importAll() holds one graph per input, so the result has one
399
+ * entry. Options, sniffing and the builder seed are those of importGraph().
400
+ * @param input - the text, bytes, stream or chunks to read
401
+ * @param options - the format, hints, common and format-specific import options
402
+ * @returns one result per graph, in document order
403
+ */
404
+ async importAllGraphs(input, options = {}) {
405
+ const chosen = await this.choose(input, options);
406
+ const { importer } = chosen;
407
+ const builders = [];
408
+ let reports;
409
+ try {
410
+ if (importer.importAll === void 0) {
411
+ builders.push(seededBuilder(options));
412
+ reports = [await importer.import(chosen.source, builders[0], importerOptions(options))];
413
+ } else {
414
+ reports = await importer.importAll(
415
+ chosen.source,
416
+ () => {
417
+ const builder = seededBuilder(options);
418
+ builders.push(builder);
419
+ return builder;
420
+ },
421
+ importerOptions(options)
422
+ );
423
+ }
424
+ } catch (err) {
425
+ await chosen.peeked?.close();
426
+ throw err;
427
+ }
428
+ return reports.map((report, i3) => result(chosen, builders[i3], report, options));
429
+ }
430
+ /**
431
+ * The importer for an input: the named format, or the sniffed one.
432
+ * @param input - the input
433
+ * @param options - the importGraph options
434
+ * @returns the importer, the sniff, and the input to read (replayed for a stream)
435
+ */
436
+ async choose(input, options) {
437
+ const requested = options.format ?? "auto";
438
+ if (requested !== "auto") {
439
+ return { importer: this.importer(requested), sniff: null, source: input, peeked: null };
440
+ }
441
+ const peeked = await peekHead(input, SNIFF_HEAD_BYTES, options.signal ?? null);
442
+ const sniff2 = this.sniff({ filename: options.filename, mimeType: options.mimeType, head: peeked.head });
443
+ if (sniff2 === null) {
444
+ const report = new ImportReportBuilder("unknown", 0);
445
+ return report.fail(
446
+ UNKNOWN_FORMAT_CODE,
447
+ `no registered importer recognises the input${describeHints(options)}; pass the format explicitly`,
448
+ void 0,
449
+ { formats: this.formats() }
450
+ );
451
+ }
452
+ return { importer: this.importer(sniff2.format), sniff: sniff2, source: peeked.input, peeked };
423
453
  }
424
454
  /**
425
455
  * Write a snapshot in a format, as UTF-8 chunks (design section 8.5).
@@ -459,6 +489,9 @@ const registry = createRegistry();
459
489
  function importGraph(input, options) {
460
490
  return registry.importGraph(input, options);
461
491
  }
492
+ function importAllGraphs(input, options) {
493
+ return registry.importAllGraphs(input, options);
494
+ }
462
495
  function exportGraph(snapshot, format, options) {
463
496
  return registry.exportGraph(snapshot, format, options);
464
497
  }
@@ -480,6 +513,26 @@ function importerOptions(options) {
480
513
  }
481
514
  return out;
482
515
  }
516
+ function seededBuilder(options) {
517
+ return new GraphBuilder({
518
+ weightDtype: options.weightDtype ?? "f64",
519
+ ...options.builder,
520
+ directed: true,
521
+ addMissingNodes: options.addMissingNodes ?? true,
522
+ duplicateEdges: options.duplicateEdges ?? "keep",
523
+ selfLoops: options.selfLoops ?? "keep"
524
+ });
525
+ }
526
+ function result(chosen, builder, report, options) {
527
+ const frozen = builder.freezeWithReport(options.freeze);
528
+ return Object.freeze({
529
+ format: chosen.importer.format,
530
+ sniff: chosen.sniff,
531
+ snapshot: frozen.snapshot,
532
+ report,
533
+ freeze: frozen.report
534
+ });
535
+ }
483
536
  function unknownFormat(kind, format, known) {
484
537
  const supported = [...known];
485
538
  return new GraphFormatError(
@@ -601,13 +654,13 @@ function readerIterator(stream) {
601
654
  if (done) {
602
655
  return { done: true, value: void 0 };
603
656
  }
604
- const result = await reader.read();
605
- if (result.done) {
657
+ const result2 = await reader.read();
658
+ if (result2.done) {
606
659
  done = true;
607
660
  reader.releaseLock();
608
661
  return { done: true, value: void 0 };
609
662
  }
610
- return { done: false, value: result.value };
663
+ return { done: false, value: result2.value };
611
664
  },
612
665
  async return() {
613
666
  if (!done) {
@@ -642,6 +695,7 @@ export {
642
695
  l as DirectionResolver,
643
696
  E as EMPTY_COLUMN_DROPPED_CODE,
644
697
  m as EMPTY_INPUT_CODE,
698
+ n as ENCODING_FALLBACK_CODE,
645
699
  FormatRegistry,
646
700
  GEXF_1_2_CAPABILITIES,
647
701
  GEXF_ISSUE,
@@ -652,94 +706,96 @@ export {
652
706
  a11 as GRAPHML_LOSS,
653
707
  GRAPH_FORMATS,
654
708
  H as HYPEREDGE_CODE,
655
- n as ID_MERGED_CODE,
709
+ o as ID_MERGED_CODE,
656
710
  ID_SPACE_COLUMN,
657
- o as ID_TEXT_COLLISION_CODE,
658
- p as ID_TEXT_TYPE_CODE,
659
- q as INTEGRAL_F64_CODE,
660
- r as INVALID_UTF8_CODE,
661
- s as IdCoercer,
662
- u as ImportError,
711
+ p as ID_TEXT_COLLISION_CODE,
712
+ q as ID_TEXT_TYPE_CODE,
713
+ r as INTEGRAL_F64_CODE,
714
+ s as INVALID_ENCODING_CODE,
715
+ u as INVALID_UTF8_CODE,
716
+ v as IdCoercer,
717
+ w as ImportError,
663
718
  ImportReportBuilder,
664
719
  J2 as JSON_DIALECTS,
665
720
  a12 as JSON_ISSUE,
666
721
  b2 as JSON_LOSS,
667
722
  LABELS_COLUMN,
668
723
  L as LOSS,
669
- v as LineReader,
724
+ x as LineReader,
670
725
  M as MISSING_ENDPOINT_CODE,
671
- w as MISSING_ID_CODE,
672
- x as MIXED_DIRECTION_CODE,
673
- y as MULTIPLE_GRAPHS_CODE,
674
- z as MUTUAL_AS_UNDIRECTED_CODE,
675
- A as MUTUAL_COLUMN,
676
- F as MUTUAL_EXPANDED_CODE,
726
+ y as MISSING_ID_CODE,
727
+ z as MIXED_DIRECTION_CODE,
728
+ A as MULTIPLE_GRAPHS_CODE,
729
+ F as MUTUAL_AS_UNDIRECTED_CODE,
730
+ G as MUTUAL_COLUMN,
731
+ J as MUTUAL_EXPANDED_CODE,
677
732
  NEO4J_CAPABILITIES,
678
733
  NEO4J_ISSUE,
679
734
  NEO4J_LOSS,
680
735
  N as NO_CAPABILITIES,
681
- G as NO_GRAPH_CODE,
736
+ K as NO_GRAPH_CODE,
682
737
  O as OPTIONS_GAINED_CODE,
683
- J as OPTION_IGNORED_CODE,
684
- P as PAIR_COLUMN,
738
+ P as OPTION_IGNORED_CODE,
739
+ Q as PAIR_COLUMN,
685
740
  P2 as PAJEK_ISSUE,
686
741
  a13 as PAJEK_LOSS,
687
- K as PARENTS_DROPPED_CODE,
688
- Q as PARSE_ERROR_CODE,
689
- R as PRECISION_CODE,
690
- S as RENAMED_CODE,
691
- T as ROLE_ASSUMED_CODE,
692
- U as ROLE_DROPPED_CODE,
693
- V as ROLE_TAKEN_CODE,
694
- W as SINK_OPTION_CODE,
742
+ R as PARENTS_DROPPED_CODE,
743
+ S as PARSE_ERROR_CODE,
744
+ T as PRECISION_CODE,
745
+ U as RENAMED_CODE,
746
+ V as ROLE_ASSUMED_CODE,
747
+ W as ROLE_DROPPED_CODE,
748
+ X as ROLE_TAKEN_CODE,
749
+ Y as SINK_OPTION_CODE,
695
750
  SNIFF_HEAD_BYTES,
696
- X as STORAGE_CLASS_CODE,
697
- Y as STRAY_TEXT_CODE,
698
- Z as SYNTAX_CODE,
699
- _ as TEMPORAL_DROPPED_CODE,
700
- $ as TEMPORAL_TEXT_DROPPED_CODE,
701
- a0 as TEXT_INFERRED_CODE,
751
+ Z as STORAGE_CLASS_CODE,
752
+ _ as STRAY_TEXT_CODE,
753
+ $ as SYNTAX_CODE,
754
+ a0 as TEMPORAL_DROPPED_CODE,
755
+ a1 as TEMPORAL_TEXT_DROPPED_CODE,
756
+ a2 as TEXT_INFERRED_CODE,
702
757
  TYPE_COLUMN,
703
758
  T2 as TextCellWriter,
704
- a1 as UNKNOWN_ATTR_TYPE_CODE,
705
- a2 as UNKNOWN_ELEMENT_CODE,
759
+ a3 as UNKNOWN_ATTR_TYPE_CODE,
760
+ a4 as UNKNOWN_ELEMENT_CODE,
761
+ a5 as UNKNOWN_ENCODING_CODE,
706
762
  UNKNOWN_FORMAT_CODE,
707
- a3 as UNKNOWN_PARENT_CODE,
708
- a4 as UNKNOWN_TYPE_CODE,
709
- a5 as WEIGHT_KEY_CLASH_CODE,
763
+ a6 as UNKNOWN_PARENT_CODE,
764
+ a7 as UNKNOWN_TYPE_CODE,
765
+ a8 as WEIGHT_KEY_CLASH_CODE,
710
766
  W2 as WIDENING_UNSUPPORTED_CODE,
711
- a6 as XML_ILLEGAL_CHAR_CODE,
712
- a7 as XML_SYNTAX_CODE,
767
+ a9 as XML_ILLEGAL_CHAR_CODE,
768
+ aa as XML_SYNTAX_CODE,
713
769
  X2 as XmlSyntaxError,
714
770
  a15 as XmlTokenizer,
715
- a8 as canonicalId,
716
- a9 as capabilities,
717
- aa as checkCapabilities,
771
+ ab as canonicalId,
772
+ ac as capabilities,
773
+ ad as checkCapabilities,
718
774
  checkExport,
719
775
  c2 as childrenCsr,
720
776
  a as childrenFromColumn,
721
- ab as coerceId,
722
- ac as coerceIdText,
723
- ad as collectBytes,
777
+ ae as coerceId,
778
+ af as coerceIdText,
779
+ ag as collectBytes,
724
780
  createRegistry,
725
781
  csvExporter,
726
782
  csvImporter,
727
- ae as declareCompanion,
728
- af as declareResolved,
729
- ag as decodeChunks,
783
+ ah as declareCompanion,
784
+ ai as declareResolved,
785
+ aj as decodeChunks,
730
786
  d2 as dialectCapabilities,
731
787
  dotExporter,
732
788
  dotImporter,
733
- ah as encodeChunks,
734
- ai as explicitWeights,
789
+ ak as encodeChunks,
790
+ al as explicitWeights,
735
791
  exportGraph,
736
792
  exportGraphToString,
737
793
  extensionOf,
738
- aj as formatDecimal,
739
- ak as formatF32,
740
- al as formatF64,
741
- am as formatGmlReal,
742
- an as formatInteger,
794
+ am as formatDecimal,
795
+ an as formatF32,
796
+ ao as formatF64,
797
+ ap as formatGmlReal,
798
+ aq as formatInteger,
743
799
  gexfExporter,
744
800
  gexfImporter,
745
801
  gmlExporter,
@@ -748,42 +804,43 @@ export {
748
804
  graphmlImporter,
749
805
  h2 as hasIllegalXmlChar,
750
806
  headBytes,
807
+ importAllGraphs,
751
808
  importGraph,
752
809
  i2 as inferTextDtype,
753
- ao as inputLength,
754
- ap as isAbortError,
755
- aq as isCanonicalIntegerText,
756
- ar as isImportInput,
757
- as as isNmtoken,
810
+ ar as inputLength,
811
+ as as isAbortError,
812
+ at as isCanonicalIntegerText,
813
+ au as isImportInput,
814
+ av as isNmtoken,
758
815
  a14 as isNumericText,
759
- at as isWeightField,
760
- au as joinText,
816
+ aw as isWeightField,
817
+ ax as joinText,
761
818
  j2 as jsonCapabilities,
762
819
  jsonExporter,
763
820
  jsonImporter,
764
- av as mangleNmtoken,
821
+ ay as mangleNmtoken,
765
822
  neo4jExporter,
766
823
  neo4jImporter,
767
824
  normalizeMimeType,
768
- aw as pairFolding,
825
+ az as pairFolding,
769
826
  pajekExporter,
770
827
  pajekImporter,
771
828
  p2 as parseTextCell,
772
- ax as parseWeightText,
829
+ aA as parseWeightText,
773
830
  rankFormats,
774
- ay as readText,
831
+ aB as readText,
775
832
  registry,
776
- az as reportSinkOptions,
777
- aA as reportUnusedOptions,
778
- aB as resolveExportOptions,
779
- aC as resolveImportOptions,
780
- aD as sanitizeIds,
833
+ aC as reportSinkOptions,
834
+ aD as reportUnusedOptions,
835
+ aE as resolveExportOptions,
836
+ aF as resolveImportOptions,
837
+ aG as sanitizeIds,
781
838
  sniff,
782
839
  sniffFormat,
783
840
  sniffJsonDialectHead,
784
841
  t as textChunks,
785
842
  throwIfAborted,
786
- aE as toReadableStream,
843
+ aH as toReadableStream,
787
844
  t2 as tokenizeXml,
788
845
  x2 as xmlIllegalTextNotes
789
846
  };