@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.
- package/README.md +29 -7
- package/dist/chunks/{escape-DyI8JofU.js → escape-CKied3Ri.js} +16 -10
- package/dist/chunks/escape-CKied3Ri.js.map +1 -0
- package/dist/chunks/{importer-DbnGYr3_.js → importer-C6QcIRIb.js} +129 -39
- package/dist/chunks/importer-C6QcIRIb.js.map +1 -0
- package/dist/chunks/{importer-CpCpfbxr.js → importer-D5pAsweZ.js} +136 -31
- package/dist/chunks/importer-D5pAsweZ.js.map +1 -0
- package/dist/chunks/{importer-GozH8DkN.js → importer-DbMrAR_w.js} +10 -4
- package/dist/chunks/importer-DbMrAR_w.js.map +1 -0
- package/dist/chunks/{importer-CQnJuWJw.js → importer-DkzjTvHc.js} +82 -40
- package/dist/chunks/importer-DkzjTvHc.js.map +1 -0
- package/dist/chunks/{records-CGpxszm1.js → records-BKSMowhR.js} +3 -3
- package/dist/chunks/{records-CGpxszm1.js.map → records-BKSMowhR.js.map} +1 -1
- package/dist/chunks/{text-CajMdVFy.js → text-Dr0Ifpag.js} +2 -2
- package/dist/chunks/{text-CajMdVFy.js.map → text-Dr0Ifpag.js.map} +1 -1
- package/dist/chunks/{writer-DxSKC7TL.js → writer-BdMak4_J.js} +341 -112
- package/dist/chunks/writer-BdMak4_J.js.map +1 -0
- package/dist/csv.js +24 -6
- package/dist/csv.js.map +1 -1
- package/dist/dot.js +1 -1
- package/dist/gexf.js +42 -10
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +69 -25
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +186 -129
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +10 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/codes.d.ts +6 -0
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +6 -0
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/escape.d.ts +5 -4
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +6 -5
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/format.d.ts +3 -3
- package/dist/src/common/format.js +5 -5
- package/dist/src/common/format.js.map +1 -1
- package/dist/src/common/input.d.ts +24 -6
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +259 -23
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/options.d.ts +2 -0
- package/dist/src/common/options.d.ts.map +1 -1
- package/dist/src/common/options.js +17 -0
- package/dist/src/common/options.js.map +1 -1
- package/dist/src/common/text.js +4 -4
- package/dist/src/common/text.js.map +1 -1
- package/dist/src/common/weights.d.ts.map +1 -1
- package/dist/src/common/weights.js +8 -0
- package/dist/src/common/weights.js.map +1 -1
- package/dist/src/common/xml.d.ts +7 -0
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +12 -0
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/csv/exporter.d.ts +5 -1
- package/dist/src/formats/csv/exporter.d.ts.map +1 -1
- package/dist/src/formats/csv/exporter.js +8 -1
- package/dist/src/formats/csv/exporter.js.map +1 -1
- package/dist/src/formats/csv/importer.d.ts.map +1 -1
- package/dist/src/formats/csv/importer.js +1 -0
- package/dist/src/formats/csv/importer.js.map +1 -1
- package/dist/src/formats/csv/index.d.ts +6 -0
- package/dist/src/formats/csv/index.d.ts.map +1 -1
- package/dist/src/formats/csv/index.js +7 -1
- package/dist/src/formats/csv/index.js.map +1 -1
- package/dist/src/formats/csv/records.js +1 -1
- package/dist/src/formats/csv/records.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +1 -1
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +3 -3
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +6 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +151 -24
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +32 -7
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +2 -2
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +6 -0
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +7 -1
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +2 -2
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +66 -25
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +7 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +8 -2
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +6 -0
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +7 -1
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +2 -2
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +14 -5
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +8 -0
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +84 -37
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/neo4j/importer.js +1 -1
- package/dist/src/formats/neo4j/importer.js.map +1 -1
- package/dist/src/formats/neo4j/index.d.ts +6 -0
- package/dist/src/formats/neo4j/index.d.ts.map +1 -1
- package/dist/src/formats/neo4j/index.js +7 -1
- package/dist/src/formats/neo4j/index.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +2 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +13 -2
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +8 -2
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +122 -26
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts +26 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +101 -35
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sniff.d.ts +1 -1
- package/dist/src/sniff.d.ts.map +1 -1
- package/dist/src/sniff.js +6 -1
- package/dist/src/sniff.js.map +1 -1
- package/dist/src/types.d.ts +22 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +4 -3
- package/src/common/codes.ts +9 -0
- package/src/common/escape.ts +6 -5
- package/src/common/format.ts +5 -5
- package/src/common/input.ts +293 -22
- package/src/common/options.ts +24 -0
- package/src/common/text.ts +4 -4
- package/src/common/weights.ts +9 -0
- package/src/common/xml.ts +14 -0
- package/src/formats/csv/exporter.ts +12 -1
- package/src/formats/csv/importer.ts +1 -0
- package/src/formats/csv/index.ts +9 -0
- package/src/formats/csv/records.ts +1 -1
- package/src/formats/dot/exporter.ts +3 -3
- package/src/formats/dot/importer.ts +172 -32
- package/src/formats/gexf/exporter.ts +38 -7
- package/src/formats/gexf/importer.ts +12 -2
- package/src/formats/gexf/index.ts +9 -0
- package/src/formats/gml/importer.ts +75 -22
- package/src/formats/gml/index.ts +10 -1
- package/src/formats/graphml/constants.ts +9 -0
- package/src/formats/graphml/importer.ts +9 -2
- package/src/formats/json/exporter.ts +14 -5
- package/src/formats/json/importer.ts +104 -36
- package/src/formats/neo4j/importer.ts +1 -1
- package/src/formats/neo4j/index.ts +9 -0
- package/src/formats/pajek/exporter.ts +19 -2
- package/src/formats/pajek/importer.ts +145 -28
- package/src/index.ts +1 -0
- package/src/registry.ts +131 -40
- package/src/sniff.ts +6 -1
- package/src/types.ts +26 -3
- package/dist/chunks/escape-DyI8JofU.js.map +0 -1
- package/dist/chunks/importer-CQnJuWJw.js.map +0 -1
- package/dist/chunks/importer-CpCpfbxr.js.map +0 -1
- package/dist/chunks/importer-DbnGYr3_.js.map +0 -1
- package/dist/chunks/importer-GozH8DkN.js.map +0 -1
- package/dist/chunks/writer-DxSKC7TL.js.map +0 -1
- 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-
|
|
2
|
-
import { B, b, C, c, d, D, e, f, g, h, i, j, k, l, E, m,
|
|
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 {
|
|
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-
|
|
8
|
-
import { D as D2, a as a10 } from "./chunks/importer-
|
|
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-
|
|
14
|
-
import { G as G2, a as a11 } from "./chunks/importer-
|
|
15
|
-
import { s as sniffJsonDialect, e as jsonImporter, c as jsonExporter } from "./chunks/importer-
|
|
16
|
-
import { J as J2, a as a12, b as b2, d as d2, j as j2 } from "./chunks/importer-
|
|
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-
|
|
20
|
-
import { P as P2, a as a13 } from "./chunks/importer-
|
|
21
|
-
import { T as T2, W as W2, i as i2, a as a14, p as p2 } from "./chunks/text-
|
|
22
|
-
import { X as X2, a as a15, h as h2, t as t2, x as x2 } from "./chunks/escape-
|
|
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
|
|
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
|
|
379
|
-
|
|
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
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
|
605
|
-
if (
|
|
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:
|
|
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
|
-
|
|
709
|
+
o as ID_MERGED_CODE,
|
|
656
710
|
ID_SPACE_COLUMN,
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
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
|
-
|
|
724
|
+
x as LineReader,
|
|
670
725
|
M as MISSING_ENDPOINT_CODE,
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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
|
-
|
|
736
|
+
K as NO_GRAPH_CODE,
|
|
682
737
|
O as OPTIONS_GAINED_CODE,
|
|
683
|
-
|
|
684
|
-
|
|
738
|
+
P as OPTION_IGNORED_CODE,
|
|
739
|
+
Q as PAIR_COLUMN,
|
|
685
740
|
P2 as PAJEK_ISSUE,
|
|
686
741
|
a13 as PAJEK_LOSS,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
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
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
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
|
-
|
|
705
|
-
|
|
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
|
-
|
|
708
|
-
|
|
709
|
-
|
|
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
|
-
|
|
712
|
-
|
|
767
|
+
a9 as XML_ILLEGAL_CHAR_CODE,
|
|
768
|
+
aa as XML_SYNTAX_CODE,
|
|
713
769
|
X2 as XmlSyntaxError,
|
|
714
770
|
a15 as XmlTokenizer,
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
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
|
-
|
|
722
|
-
|
|
723
|
-
|
|
777
|
+
ae as coerceId,
|
|
778
|
+
af as coerceIdText,
|
|
779
|
+
ag as collectBytes,
|
|
724
780
|
createRegistry,
|
|
725
781
|
csvExporter,
|
|
726
782
|
csvImporter,
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
783
|
+
ah as declareCompanion,
|
|
784
|
+
ai as declareResolved,
|
|
785
|
+
aj as decodeChunks,
|
|
730
786
|
d2 as dialectCapabilities,
|
|
731
787
|
dotExporter,
|
|
732
788
|
dotImporter,
|
|
733
|
-
|
|
734
|
-
|
|
789
|
+
ak as encodeChunks,
|
|
790
|
+
al as explicitWeights,
|
|
735
791
|
exportGraph,
|
|
736
792
|
exportGraphToString,
|
|
737
793
|
extensionOf,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
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
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
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
|
-
|
|
760
|
-
|
|
816
|
+
aw as isWeightField,
|
|
817
|
+
ax as joinText,
|
|
761
818
|
j2 as jsonCapabilities,
|
|
762
819
|
jsonExporter,
|
|
763
820
|
jsonImporter,
|
|
764
|
-
|
|
821
|
+
ay as mangleNmtoken,
|
|
765
822
|
neo4jExporter,
|
|
766
823
|
neo4jImporter,
|
|
767
824
|
normalizeMimeType,
|
|
768
|
-
|
|
825
|
+
az as pairFolding,
|
|
769
826
|
pajekExporter,
|
|
770
827
|
pajekImporter,
|
|
771
828
|
p2 as parseTextCell,
|
|
772
|
-
|
|
829
|
+
aA as parseWeightText,
|
|
773
830
|
rankFormats,
|
|
774
|
-
|
|
831
|
+
aB as readText,
|
|
775
832
|
registry,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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
|
-
|
|
843
|
+
aH as toReadableStream,
|
|
787
844
|
t2 as tokenizeXml,
|
|
788
845
|
x2 as xmlIllegalTextNotes
|
|
789
846
|
};
|