@graphty/graph-io 0.3.17 → 0.3.19
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/LICENSE +1 -1
- package/README.md +64 -3
- package/dist/chunks/{escape-scjHxjpr.js → escape-CWExcecC.js} +3 -2
- package/dist/chunks/{escape-scjHxjpr.js.map → escape-CWExcecC.js.map} +1 -1
- package/dist/chunks/exporter-CbMZyVt-.js +735 -0
- package/dist/chunks/exporter-CbMZyVt-.js.map +1 -0
- package/dist/chunks/importer-BAP4PrxR.js +2194 -0
- package/dist/chunks/importer-BAP4PrxR.js.map +1 -0
- package/dist/chunks/{importer-Xg07gk7p.js → importer-BNFuV1-K.js} +5 -3
- package/dist/chunks/{importer-Xg07gk7p.js.map → importer-BNFuV1-K.js.map} +1 -1
- package/dist/chunks/{importer-BmOl9gLW.js → importer-BVGtU1NA.js} +5 -3
- package/dist/chunks/{importer-BmOl9gLW.js.map → importer-BVGtU1NA.js.map} +1 -1
- package/dist/chunks/{importer-ruMWWvVs.js → importer-BW-Ft2ps.js} +5 -3
- package/dist/chunks/{importer-ruMWWvVs.js.map → importer-BW-Ft2ps.js.map} +1 -1
- package/dist/chunks/{importer-B6rKRxzv.js → importer-Bm1_5vPS.js} +781 -104
- package/dist/chunks/importer-Bm1_5vPS.js.map +1 -0
- package/dist/chunks/importer-ByPGO-09.js +1614 -0
- package/dist/chunks/importer-ByPGO-09.js.map +1 -0
- package/dist/chunks/importer-DOepkgnG.js +1713 -0
- package/dist/chunks/importer-DOepkgnG.js.map +1 -0
- package/dist/chunks/json-elements-CZY1wiZh.js +779 -0
- package/dist/chunks/json-elements-CZY1wiZh.js.map +1 -0
- package/dist/chunks/ontology-BnrJ4I98.js +113 -0
- package/dist/chunks/ontology-BnrJ4I98.js.map +1 -0
- package/dist/chunks/{records-DSpbTE5s.js → records-BzNicMsf.js} +2 -2
- package/dist/chunks/{records-DSpbTE5s.js.map → records-BzNicMsf.js.map} +1 -1
- package/dist/chunks/{writer-DHHfHn11.js → report-BcWboivV.js} +106 -928
- package/dist/chunks/report-BcWboivV.js.map +1 -0
- package/dist/chunks/weights-CwISIpCP.js +176 -0
- package/dist/chunks/weights-CwISIpCP.js.map +1 -0
- package/dist/chunks/writer-DQiKgQJc.js +656 -0
- package/dist/chunks/writer-DQiKgQJc.js.map +1 -0
- package/dist/csv.js +5 -3
- package/dist/csv.js.map +1 -1
- package/dist/cx.d.ts +1 -0
- package/dist/cx.js +6 -0
- package/dist/cx.js.map +1 -0
- package/dist/cx2.d.ts +1 -0
- package/dist/cx2.js +10 -0
- package/dist/cx2.js.map +1 -0
- package/dist/dot.js +1 -1
- package/dist/gexf.js +15 -3
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +5 -3
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +158 -383
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +5 -3
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.d.ts +1 -0
- package/dist/obo.js +6 -0
- package/dist/obo.js.map +1 -0
- package/dist/pajek.js +1 -1
- package/dist/src/common/json-elements.d.ts +286 -0
- package/dist/src/common/json-elements.d.ts.map +1 -0
- package/dist/src/common/json-elements.js +926 -0
- package/dist/src/common/json-elements.js.map +1 -0
- package/dist/src/common/ontology.d.ts +59 -0
- package/dist/src/common/ontology.d.ts.map +1 -0
- package/dist/src/common/ontology.js +147 -0
- package/dist/src/common/ontology.js.map +1 -0
- package/dist/src/formats/cx/importer.d.ts +133 -0
- package/dist/src/formats/cx/importer.d.ts.map +1 -0
- package/dist/src/formats/cx/importer.js +2220 -0
- package/dist/src/formats/cx/importer.js.map +1 -0
- package/dist/src/formats/cx/index.d.ts +7 -0
- package/dist/src/formats/cx/index.d.ts.map +1 -0
- package/dist/src/formats/cx/index.js +7 -0
- package/dist/src/formats/cx/index.js.map +1 -0
- package/dist/src/formats/cx2/exporter.d.ts +59 -0
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -0
- package/dist/src/formats/cx2/exporter.js +864 -0
- package/dist/src/formats/cx2/exporter.js.map +1 -0
- package/dist/src/formats/cx2/importer.d.ts +169 -0
- package/dist/src/formats/cx2/importer.d.ts.map +1 -0
- package/dist/src/formats/cx2/importer.js +1652 -0
- package/dist/src/formats/cx2/importer.js.map +1 -0
- package/dist/src/formats/cx2/index.d.ts +7 -0
- package/dist/src/formats/cx2/index.d.ts.map +1 -0
- package/dist/src/formats/cx2/index.js +7 -0
- package/dist/src/formats/cx2/index.js.map +1 -0
- package/dist/src/formats/gexf/exporter.d.ts +2 -0
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +6 -0
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +2 -4
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +2 -4
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +1 -1
- package/dist/src/formats/gexf/index.js +2 -2
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gml/exporter.js +1 -1
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts +8 -6
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +26 -3
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +324 -7
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +159 -126
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/obographs.d.ts +21 -0
- package/dist/src/formats/json/obographs.d.ts.map +1 -0
- package/dist/src/formats/json/obographs.js +476 -0
- package/dist/src/formats/json/obographs.js.map +1 -0
- package/dist/src/formats/obo/importer.d.ts +90 -0
- package/dist/src/formats/obo/importer.d.ts.map +1 -0
- package/dist/src/formats/obo/importer.js +1248 -0
- package/dist/src/formats/obo/importer.js.map +1 -0
- package/dist/src/formats/obo/index.d.ts +7 -0
- package/dist/src/formats/obo/index.d.ts.map +1 -0
- package/dist/src/formats/obo/index.js +7 -0
- package/dist/src/formats/obo/index.js.map +1 -0
- package/dist/src/formats/obo/syntax.d.ts +121 -0
- package/dist/src/formats/obo/syntax.d.ts.map +1 -0
- package/dist/src/formats/obo/syntax.js +424 -0
- package/dist/src/formats/obo/syntax.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +8 -1
- 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 +25 -3
- package/dist/src/sniff.js.map +1 -1
- package/package.json +16 -1
- package/src/common/json-elements.ts +1147 -0
- package/src/common/ontology.ts +169 -0
- package/src/formats/cx/importer.ts +2733 -0
- package/src/formats/cx/index.ts +7 -0
- package/src/formats/cx2/exporter.ts +1036 -0
- package/src/formats/cx2/importer.ts +2187 -0
- package/src/formats/cx2/index.ts +7 -0
- package/src/formats/gexf/exporter.ts +11 -0
- package/src/formats/gexf/importer.ts +2 -2
- package/src/formats/gexf/index.ts +1 -1
- package/src/formats/gml/exporter.ts +1 -1
- package/src/formats/json/dialect.ts +37 -7
- package/src/formats/json/importer.ts +210 -132
- package/src/formats/json/obographs.ts +563 -0
- package/src/formats/obo/importer.ts +1695 -0
- package/src/formats/obo/index.ts +7 -0
- package/src/formats/obo/syntax.ts +466 -0
- package/src/index.ts +11 -0
- package/src/registry.ts +8 -1
- package/src/sniff.ts +48 -5
- package/dist/chunks/importer-B6rKRxzv.js.map +0 -1
- package/dist/chunks/writer-DHHfHn11.js.map +0 -1
package/dist/graph-io.js
CHANGED
|
@@ -1,269 +1,35 @@
|
|
|
1
|
-
import { I as ImportReportBuilder,
|
|
2
|
-
import { A,
|
|
3
|
-
import { C as C2, c as c2, a } from "./chunks/children-CL3Cy0ez.js";
|
|
1
|
+
import { I as ImportReportBuilder, t as throwIfAborted } from "./chunks/report-BcWboivV.js";
|
|
2
|
+
import { A, a, B, b, c, d, C, e, f, g, D, h, i, j, k, l, m, n, o, p, E, q, r, s, G, H, u, v, w, x, y, z, F, J, L, M, K, N, 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 } from "./chunks/report-BcWboivV.js";
|
|
3
|
+
import { C as C2, c as c2, a as a10 } from "./chunks/children-CL3Cy0ez.js";
|
|
4
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 {
|
|
8
|
-
import {
|
|
7
|
+
import { c as cxImporter } from "./chunks/importer-BAP4PrxR.js";
|
|
8
|
+
import { C as C3 } from "./chunks/importer-BAP4PrxR.js";
|
|
9
|
+
import { c as cx2Exporter } from "./chunks/exporter-CbMZyVt-.js";
|
|
10
|
+
import { C as C4, a as a11 } from "./chunks/exporter-CbMZyVt-.js";
|
|
11
|
+
import { c as cx2Importer } from "./chunks/importer-DOepkgnG.js";
|
|
12
|
+
import { C as C5 } from "./chunks/importer-DOepkgnG.js";
|
|
13
|
+
import { b as dotImporter, d as dotExporter } from "./chunks/importer-BNFuV1-K.js";
|
|
14
|
+
import { D as D2, a as a12 } from "./chunks/importer-BNFuV1-K.js";
|
|
9
15
|
import { gexfImporter, gexfExporter } from "./gexf.js";
|
|
10
16
|
import { GEXF_1_2_CAPABILITIES, GEXF_ISSUE, GEXF_LOSS } from "./gexf.js";
|
|
11
17
|
import { gmlImporter, gmlExporter } from "./gml.js";
|
|
12
18
|
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
|
|
15
|
-
import {
|
|
16
|
-
import { J as J2, a as
|
|
19
|
+
import { b as graphmlImporter, g as graphmlExporter } from "./chunks/importer-BW-Ft2ps.js";
|
|
20
|
+
import { G as G2, a as a13 } from "./chunks/importer-BW-Ft2ps.js";
|
|
21
|
+
import { r as rankFormats, S as SNIFF_HEAD_BYTES, e as jsonImporter, c as jsonExporter } from "./chunks/importer-Bm1_5vPS.js";
|
|
22
|
+
import { G as G3, J as J2, a as a14, b as b2, d as d2, f as f2, h as h2, j as j2, n as n2, s as s2, g as g2 } from "./chunks/importer-Bm1_5vPS.js";
|
|
17
23
|
import { neo4jImporter, neo4jExporter } from "./neo4j.js";
|
|
18
24
|
import { ID_SPACE_COLUMN, LABELS_COLUMN, NEO4J_CAPABILITIES, NEO4J_ISSUE, NEO4J_LOSS, ORIGINAL_ID_COLUMN, TYPE_COLUMN } from "./neo4j.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"csv",
|
|
28
|
-
"gml",
|
|
29
|
-
"dot",
|
|
30
|
-
"pajek",
|
|
31
|
-
"neo4j"
|
|
32
|
-
]);
|
|
33
|
-
const SNIFF_HEAD_BYTES = 8192;
|
|
34
|
-
function extensionOf(filename) {
|
|
35
|
-
const base = filename.slice(Math.max(filename.lastIndexOf("/"), filename.lastIndexOf("\\")) + 1);
|
|
36
|
-
const dot = base.lastIndexOf(".");
|
|
37
|
-
if (dot <= 0 || dot === base.length - 1) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return base.slice(dot).toLowerCase();
|
|
41
|
-
}
|
|
42
|
-
function normalizeMimeType(mimeType) {
|
|
43
|
-
const semicolon = mimeType.indexOf(";");
|
|
44
|
-
return (semicolon < 0 ? mimeType : mimeType.slice(0, semicolon)).trim().toLowerCase();
|
|
45
|
-
}
|
|
46
|
-
function headBytes(head) {
|
|
47
|
-
if (typeof head === "string") {
|
|
48
|
-
return new TextEncoder().encode(head.slice(0, SNIFF_HEAD_BYTES)).subarray(0, SNIFF_HEAD_BYTES);
|
|
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
|
-
}
|
|
54
|
-
return head.byteLength > SNIFF_HEAD_BYTES ? head.subarray(0, SNIFF_HEAD_BYTES) : head;
|
|
55
|
-
}
|
|
56
|
-
function rankFormats(hints, importers) {
|
|
57
|
-
const extension = typeof hints.filename === "string" ? extensionOf(hints.filename) : null;
|
|
58
|
-
const mime = typeof hints.mimeType === "string" ? normalizeMimeType(hints.mimeType) : null;
|
|
59
|
-
const head = hints.head === void 0 || hints.head === null ? null : headBytes(hints.head);
|
|
60
|
-
const candidates = [];
|
|
61
|
-
let rank = 0;
|
|
62
|
-
for (const importer of importers) {
|
|
63
|
-
const extensionMatch = extension !== null && importer.extensions.some((e2) => e2.toLowerCase() === extension);
|
|
64
|
-
const mimeMatch = mime !== null && importer.mimeTypes.some((m2) => m2.toLowerCase() === mime);
|
|
65
|
-
let content = 0;
|
|
66
|
-
if (head !== null && head.byteLength > 0 && typeof importer.sniff === "function") {
|
|
67
|
-
content = clamp(importer.sniff(head));
|
|
68
|
-
}
|
|
69
|
-
let confidence;
|
|
70
|
-
if (content > 0) {
|
|
71
|
-
confidence = 0.5 + 0.35 * content + (extensionMatch ? 0.1 : 0) + (mimeMatch ? 0.05 : 0);
|
|
72
|
-
} else if (extensionMatch || mimeMatch) {
|
|
73
|
-
confidence = (extensionMatch ? 0.3 : 0) + (mimeMatch ? 0.1 : 0);
|
|
74
|
-
} else {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
const dialect = importer.format === "json" && head !== null ? sniffJsonDialectHead(head) : null;
|
|
78
|
-
const result2 = Object.freeze({
|
|
79
|
-
format: importer.format,
|
|
80
|
-
confidence: Math.min(1, confidence),
|
|
81
|
-
content,
|
|
82
|
-
extension: extensionMatch,
|
|
83
|
-
mimeType: mimeMatch,
|
|
84
|
-
dialect
|
|
85
|
-
});
|
|
86
|
-
candidates.push({ result: result2, rank: rank++ });
|
|
87
|
-
}
|
|
88
|
-
candidates.sort((a16, b3) => b3.result.confidence - a16.result.confidence || a16.rank - b3.rank);
|
|
89
|
-
return candidates.map((c3) => c3.result);
|
|
90
|
-
}
|
|
91
|
-
function sniffFormat(hints, importers) {
|
|
92
|
-
const ranked = rankFormats(hints, importers);
|
|
93
|
-
return ranked.length > 0 ? ranked[0] : null;
|
|
94
|
-
}
|
|
95
|
-
function sniffJsonDialectHead(head) {
|
|
96
|
-
const text = typeof head === "string" ? head : new TextDecoder("utf-8", { fatal: false }).decode(head);
|
|
97
|
-
const body = text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
98
|
-
const trimmed = body.trimStart();
|
|
99
|
-
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
let root;
|
|
103
|
-
try {
|
|
104
|
-
root = JSON.parse(trimmed);
|
|
105
|
-
} catch {
|
|
106
|
-
root = skeletonOf(trimmed);
|
|
107
|
-
}
|
|
108
|
-
return sniffJsonDialect(root);
|
|
109
|
-
}
|
|
110
|
-
function skeletonOf(text) {
|
|
111
|
-
const keys = scanKeys(text);
|
|
112
|
-
if (text.startsWith("[")) {
|
|
113
|
-
const first = keys.get("nodes[0]");
|
|
114
|
-
return first === void 0 ? null : [objectOf(first)];
|
|
115
|
-
}
|
|
116
|
-
const rootKeys = keys.get("");
|
|
117
|
-
if (rootKeys === void 0) {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
const root = {};
|
|
121
|
-
for (const key of rootKeys) {
|
|
122
|
-
switch (key) {
|
|
123
|
-
case "graph":
|
|
124
|
-
case "options":
|
|
125
|
-
root[key] = objectOf(keys.get(key));
|
|
126
|
-
break;
|
|
127
|
-
case "graphs":
|
|
128
|
-
root[key] = [];
|
|
129
|
-
break;
|
|
130
|
-
case "nodes":
|
|
131
|
-
case "edges":
|
|
132
|
-
case "links": {
|
|
133
|
-
const first = keys.get(`${key}[0]`);
|
|
134
|
-
root[key] = first === void 0 ? [] : [objectOf(first)];
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
default:
|
|
138
|
-
root[key] = true;
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return root;
|
|
143
|
-
}
|
|
144
|
-
function objectOf(names) {
|
|
145
|
-
const out = {};
|
|
146
|
-
if (names !== void 0) {
|
|
147
|
-
for (const name of names) {
|
|
148
|
-
out[name] = name === "attributes" || name === "data" ? {} : true;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return out;
|
|
152
|
-
}
|
|
153
|
-
function scanKeys(text) {
|
|
154
|
-
const found = /* @__PURE__ */ new Map();
|
|
155
|
-
const kinds = [];
|
|
156
|
-
const labels = [];
|
|
157
|
-
const counts = [];
|
|
158
|
-
let pendingKey = null;
|
|
159
|
-
let expectingKey = false;
|
|
160
|
-
const pathOf = () => {
|
|
161
|
-
const depth = kinds.length;
|
|
162
|
-
if (depth === 1) {
|
|
163
|
-
return kinds[0] === "object" ? "" : null;
|
|
164
|
-
}
|
|
165
|
-
if (depth === 2 && kinds[0] === "array" && kinds[1] === "object" && labels[1] === "0") {
|
|
166
|
-
return "nodes[0]";
|
|
167
|
-
}
|
|
168
|
-
if (depth === 2 && kinds[0] === "object" && kinds[1] === "object") {
|
|
169
|
-
return labels[1] === "graph" || labels[1] === "options" ? labels[1] : null;
|
|
170
|
-
}
|
|
171
|
-
if (depth === 3 && kinds[0] === "object" && kinds[1] === "array" && kinds[2] === "object") {
|
|
172
|
-
const section = labels[1];
|
|
173
|
-
if ((section === "nodes" || section === "edges" || section === "links") && labels[2] === "0") {
|
|
174
|
-
return `${section}[0]`;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return null;
|
|
178
|
-
};
|
|
179
|
-
let i3 = 0;
|
|
180
|
-
const n2 = text.length;
|
|
181
|
-
while (i3 < n2) {
|
|
182
|
-
const ch = text[i3];
|
|
183
|
-
if (ch === '"') {
|
|
184
|
-
const end = scanString(text, i3 + 1);
|
|
185
|
-
if (end < 0) {
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
const literal = text.slice(i3 + 1, end);
|
|
189
|
-
i3 = end + 1;
|
|
190
|
-
if (expectingKey) {
|
|
191
|
-
pendingKey = decodeKey(literal);
|
|
192
|
-
expectingKey = false;
|
|
193
|
-
}
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
if (ch === "{" || ch === "[") {
|
|
197
|
-
let label = "";
|
|
198
|
-
if (kinds.length > 0) {
|
|
199
|
-
label = kinds[kinds.length - 1] === "object" ? pendingKey ?? "" : String(counts[counts.length - 1]);
|
|
200
|
-
}
|
|
201
|
-
kinds.push(ch === "{" ? "object" : "array");
|
|
202
|
-
labels.push(label);
|
|
203
|
-
counts.push(0);
|
|
204
|
-
expectingKey = ch === "{";
|
|
205
|
-
pendingKey = null;
|
|
206
|
-
} else if (ch === "}" || ch === "]") {
|
|
207
|
-
kinds.pop();
|
|
208
|
-
labels.pop();
|
|
209
|
-
counts.pop();
|
|
210
|
-
expectingKey = false;
|
|
211
|
-
pendingKey = null;
|
|
212
|
-
} else if (ch === ":") {
|
|
213
|
-
if (pendingKey !== null) {
|
|
214
|
-
const path = pathOf();
|
|
215
|
-
if (path !== null) {
|
|
216
|
-
let set = found.get(path);
|
|
217
|
-
if (set === void 0) {
|
|
218
|
-
set = /* @__PURE__ */ new Set();
|
|
219
|
-
found.set(path, set);
|
|
220
|
-
}
|
|
221
|
-
set.add(pendingKey);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
} else if (ch === ",") {
|
|
225
|
-
const top = kinds.length - 1;
|
|
226
|
-
if (top >= 0) {
|
|
227
|
-
counts[top]++;
|
|
228
|
-
expectingKey = kinds[top] === "object";
|
|
229
|
-
}
|
|
230
|
-
pendingKey = null;
|
|
231
|
-
}
|
|
232
|
-
i3++;
|
|
233
|
-
}
|
|
234
|
-
return found;
|
|
235
|
-
}
|
|
236
|
-
function scanString(text, from) {
|
|
237
|
-
let i3 = from;
|
|
238
|
-
while (i3 < text.length) {
|
|
239
|
-
const ch = text[i3];
|
|
240
|
-
if (ch === "\\") {
|
|
241
|
-
i3 += 2;
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
if (ch === '"') {
|
|
245
|
-
return i3;
|
|
246
|
-
}
|
|
247
|
-
i3++;
|
|
248
|
-
}
|
|
249
|
-
return -1;
|
|
250
|
-
}
|
|
251
|
-
function decodeKey(literal) {
|
|
252
|
-
if (!literal.includes("\\")) {
|
|
253
|
-
return literal;
|
|
254
|
-
}
|
|
255
|
-
try {
|
|
256
|
-
return JSON.parse(`"${literal}"`);
|
|
257
|
-
} catch {
|
|
258
|
-
return literal;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
function clamp(value) {
|
|
262
|
-
if (!(value > 0)) {
|
|
263
|
-
return 0;
|
|
264
|
-
}
|
|
265
|
-
return value > 1 ? 1 : value;
|
|
266
|
-
}
|
|
25
|
+
import { o as oboImporter } from "./chunks/importer-ByPGO-09.js";
|
|
26
|
+
import { O as O2 } from "./chunks/importer-ByPGO-09.js";
|
|
27
|
+
import { b as pajekImporter, p as pajekExporter } from "./chunks/importer-BVGtU1NA.js";
|
|
28
|
+
import { P as P2, a as a15 } from "./chunks/importer-BVGtU1NA.js";
|
|
29
|
+
import { D as D3, L as L2, N as N2, c as c3, a as a16, b as b3, d as d3, e as e2, i as i2, j as j3, m as m2, s as s3, t } from "./chunks/writer-DQiKgQJc.js";
|
|
30
|
+
import { e as e3, f as f3, a as a17, b as b4, c as c4, d as d4, i as i3, p as p2 } from "./chunks/weights-CwISIpCP.js";
|
|
31
|
+
import { T as T2, W as W2, i as i4, a as a18, p as p3 } from "./chunks/text-Dr0Ifpag.js";
|
|
32
|
+
import { X as X2, a as a19, h as h3, t as t2, x as x2 } from "./chunks/escape-CWExcecC.js";
|
|
267
33
|
const UNKNOWN_FORMAT_CODE = "E_UNKNOWN_FORMAT";
|
|
268
34
|
const REGISTRY_KEYS = /* @__PURE__ */ new Set(["format", "filename", "mimeType", "builder", "freeze"]);
|
|
269
35
|
class FormatRegistry {
|
|
@@ -425,7 +191,7 @@ class FormatRegistry {
|
|
|
425
191
|
await chosen.peeked?.close();
|
|
426
192
|
throw err;
|
|
427
193
|
}
|
|
428
|
-
return reports.map((report,
|
|
194
|
+
return reports.map((report, i5) => result(chosen, builders[i5], report, options));
|
|
429
195
|
}
|
|
430
196
|
/**
|
|
431
197
|
* The graphs of an input that can hold several, without importing them (a Cytoscape session's
|
|
@@ -500,7 +266,7 @@ class FormatRegistry {
|
|
|
500
266
|
}
|
|
501
267
|
}
|
|
502
268
|
function createRegistry() {
|
|
503
|
-
return new FormatRegistry().registerImporter(jsonImporter).registerExporter(jsonExporter).registerImporter(graphmlImporter).registerExporter(graphmlExporter).registerImporter(gexfImporter).registerExporter(gexfExporter).registerImporter(csvImporter).registerExporter(csvExporter).registerImporter(gmlImporter).registerExporter(gmlExporter).registerImporter(dotImporter).registerExporter(dotExporter).registerImporter(pajekImporter).registerExporter(pajekExporter).registerImporter(neo4jImporter).registerExporter(neo4jExporter);
|
|
269
|
+
return new FormatRegistry().registerImporter(jsonImporter).registerExporter(jsonExporter).registerImporter(graphmlImporter).registerExporter(graphmlExporter).registerImporter(gexfImporter).registerExporter(gexfExporter).registerImporter(csvImporter).registerExporter(csvExporter).registerImporter(gmlImporter).registerExporter(gmlExporter).registerImporter(dotImporter).registerExporter(dotExporter).registerImporter(pajekImporter).registerExporter(pajekExporter).registerImporter(neo4jImporter).registerExporter(neo4jExporter).registerImporter(cx2Importer).registerExporter(cx2Exporter).registerImporter(cxImporter).registerImporter(oboImporter);
|
|
504
270
|
}
|
|
505
271
|
const registry = createRegistry();
|
|
506
272
|
function importGraph(input, options) {
|
|
@@ -604,10 +370,10 @@ async function peekHead(input, bytes, signal) {
|
|
|
604
370
|
return { head: joinHead(buffered, bytes), input: replayed, close: () => replayed.close() };
|
|
605
371
|
}
|
|
606
372
|
function joinHead(chunks, bytes) {
|
|
607
|
-
if (chunks.every((
|
|
373
|
+
if (chunks.every((c5) => c5 instanceof Uint8Array)) {
|
|
608
374
|
const total = Math.min(
|
|
609
375
|
bytes,
|
|
610
|
-
chunks.reduce((sum,
|
|
376
|
+
chunks.reduce((sum, c5) => sum + c5.byteLength, 0)
|
|
611
377
|
);
|
|
612
378
|
const head = new Uint8Array(total);
|
|
613
379
|
let offset = 0;
|
|
@@ -694,36 +460,40 @@ function readerIterator(stream) {
|
|
|
694
460
|
}
|
|
695
461
|
export {
|
|
696
462
|
A as AMBIGUOUS_GRAPH_NAME_CODE,
|
|
697
|
-
|
|
463
|
+
a as ASPECT_ORDER_CODE,
|
|
698
464
|
B as BAD_ASPECT_BLOCK_CODE,
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
465
|
+
b as BAD_DEFAULT_CODE,
|
|
466
|
+
c as BAD_OPTIONS_CODE,
|
|
467
|
+
d as BAD_VALUE_CODE,
|
|
702
468
|
C as COLUMN_RENAMED_CODE,
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
469
|
+
e as COLUMN_RENAMED_LOSS_CODE,
|
|
470
|
+
f as COUNT_HINT_CODE,
|
|
471
|
+
g as COUNT_MISMATCH_CODE,
|
|
706
472
|
CSV_CAPABILITIES,
|
|
707
473
|
CSV_ISSUE,
|
|
708
474
|
CSV_LOSS,
|
|
475
|
+
C4 as CX2_CAPABILITIES,
|
|
476
|
+
C5 as CX2_ISSUE,
|
|
477
|
+
a11 as CX2_LOSS,
|
|
478
|
+
C3 as CX_ISSUE,
|
|
709
479
|
C2 as ChildrenCsr,
|
|
710
480
|
D as DANGLING_REFERENCE_CODE,
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
481
|
+
D3 as DEFAULT_CHUNK_BYTES,
|
|
482
|
+
h as DEFAULT_ERROR_LIMIT,
|
|
483
|
+
i as DIRECTED_COLUMN,
|
|
484
|
+
j as DIRECTION_FORCED_CODE,
|
|
485
|
+
k as DIRECTION_REFUSED_CODE,
|
|
716
486
|
D2 as DOT_ISSUE,
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
487
|
+
a12 as DOT_LOSS,
|
|
488
|
+
l as DUPLICATE_ATTRIBUTE_CODE,
|
|
489
|
+
m as DUPLICATE_EDGE_ID_CODE,
|
|
490
|
+
n as DUPLICATE_KEY_CODE,
|
|
491
|
+
o as DUPLICATE_NODE_CODE,
|
|
492
|
+
p as DirectionResolver,
|
|
723
493
|
E as EMPTY_COLUMN_DROPPED_CODE,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
494
|
+
q as EMPTY_INPUT_CODE,
|
|
495
|
+
r as ENCODING_FALLBACK_CODE,
|
|
496
|
+
s as EQUATION_AS_TEXT_CODE,
|
|
727
497
|
FormatRegistry,
|
|
728
498
|
GEXF_1_2_CAPABILITIES,
|
|
729
499
|
GEXF_ISSUE,
|
|
@@ -731,155 +501,160 @@ export {
|
|
|
731
501
|
GML_ISSUE,
|
|
732
502
|
GML_LOSS,
|
|
733
503
|
G2 as GRAPHML_ISSUE,
|
|
734
|
-
|
|
735
|
-
GRAPH_FORMATS,
|
|
504
|
+
a13 as GRAPHML_LOSS,
|
|
505
|
+
G3 as GRAPH_FORMATS,
|
|
736
506
|
G as GRAPH_NOT_FOUND_CODE,
|
|
737
507
|
H as HYPEREDGE_CODE,
|
|
738
|
-
|
|
508
|
+
u as ID_MERGED_CODE,
|
|
739
509
|
ID_SPACE_COLUMN,
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
510
|
+
v as ID_TEXT_COLLISION_CODE,
|
|
511
|
+
w as ID_TEXT_TYPE_CODE,
|
|
512
|
+
x as INTEGRAL_F64_CODE,
|
|
513
|
+
y as INVALID_ENCODING_CODE,
|
|
514
|
+
z as INVALID_UTF8_CODE,
|
|
515
|
+
F as IdCoercer,
|
|
516
|
+
J as ImportError,
|
|
747
517
|
ImportReportBuilder,
|
|
748
518
|
J2 as JSON_DIALECTS,
|
|
749
|
-
|
|
519
|
+
a14 as JSON_ISSUE,
|
|
750
520
|
b2 as JSON_LOSS,
|
|
751
521
|
LABELS_COLUMN,
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
522
|
+
L2 as LOSS,
|
|
523
|
+
L as LineReader,
|
|
524
|
+
M as MISSING_ENDPOINT_CODE,
|
|
525
|
+
K as MISSING_ID_CODE,
|
|
526
|
+
N as MIXED_DIRECTION_CODE,
|
|
527
|
+
O as MULTIPLE_GRAPHS_CODE,
|
|
528
|
+
P as MUTUAL_AS_UNDIRECTED_CODE,
|
|
529
|
+
Q as MUTUAL_COLUMN,
|
|
530
|
+
R as MUTUAL_EXPANDED_CODE,
|
|
761
531
|
NEO4J_CAPABILITIES,
|
|
762
532
|
NEO4J_ISSUE,
|
|
763
533
|
NEO4J_LOSS,
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
534
|
+
N2 as NO_CAPABILITIES,
|
|
535
|
+
S as NO_GRAPH_CODE,
|
|
536
|
+
O2 as OBO_ISSUE,
|
|
537
|
+
T as OPTIONS_GAINED_CODE,
|
|
538
|
+
U as OPTION_IGNORED_CODE,
|
|
768
539
|
ORIGINAL_ID_COLUMN,
|
|
769
|
-
|
|
540
|
+
V as PAIR_COLUMN,
|
|
770
541
|
P2 as PAJEK_ISSUE,
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
542
|
+
a15 as PAJEK_LOSS,
|
|
543
|
+
W as PARENTS_DROPPED_CODE,
|
|
544
|
+
X as PARENT_CYCLE_CODE,
|
|
545
|
+
Y as PARSE_ERROR_CODE,
|
|
546
|
+
Z as PRECISION_CODE,
|
|
547
|
+
_ as RENAMED_CODE,
|
|
548
|
+
$ as ROLE_ASSUMED_CODE,
|
|
549
|
+
a0 as ROLE_DROPPED_CODE,
|
|
550
|
+
a1 as ROLE_TAKEN_CODE,
|
|
551
|
+
a2 as SINK_OPTION_CODE,
|
|
781
552
|
SNIFF_HEAD_BYTES,
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
553
|
+
a3 as STATUS_FAILED_CODE,
|
|
554
|
+
a4 as STATUS_WARNING_CODE,
|
|
555
|
+
a5 as STORAGE_CLASS_CODE,
|
|
556
|
+
a6 as STRAY_TEXT_CODE,
|
|
557
|
+
a7 as STYLES_NOT_IMPORTED_CODE,
|
|
558
|
+
a8 as SYNTAX_CODE,
|
|
559
|
+
a9 as TEMPORAL_DROPPED_CODE,
|
|
560
|
+
aa as TEMPORAL_TEXT_DROPPED_CODE,
|
|
561
|
+
ab as TEXT_INFERRED_CODE,
|
|
562
|
+
ac as TOO_LARGE_CODE,
|
|
792
563
|
TYPE_COLUMN,
|
|
793
564
|
T2 as TextCellWriter,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
565
|
+
ad as UNKNOWN_ATTR_TYPE_CODE,
|
|
566
|
+
ae as UNKNOWN_ELEMENT_CODE,
|
|
567
|
+
af as UNKNOWN_ENCODING_CODE,
|
|
797
568
|
UNKNOWN_FORMAT_CODE,
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
569
|
+
ag as UNKNOWN_PARENT_CODE,
|
|
570
|
+
ah as UNKNOWN_TYPE_CODE,
|
|
571
|
+
ai as WEIGHT_KEY_CLASH_CODE,
|
|
572
|
+
aj as WIDENED_CODE,
|
|
802
573
|
W2 as WIDENING_UNSUPPORTED_CODE,
|
|
803
|
-
|
|
804
|
-
|
|
574
|
+
ak as XML_ILLEGAL_CHAR_CODE,
|
|
575
|
+
al as XML_SYNTAX_CODE,
|
|
805
576
|
X2 as XmlSyntaxError,
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
577
|
+
a19 as XmlTokenizer,
|
|
578
|
+
am as canonicalId,
|
|
579
|
+
c3 as capabilities,
|
|
580
|
+
a16 as checkCapabilities,
|
|
810
581
|
checkExport,
|
|
811
582
|
c2 as childrenCsr,
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
583
|
+
a10 as childrenFromColumn,
|
|
584
|
+
an as chooseGraph,
|
|
585
|
+
ao as coerceId,
|
|
586
|
+
ap as coerceIdText,
|
|
587
|
+
b3 as collectBytes,
|
|
817
588
|
createRegistry,
|
|
818
589
|
csvExporter,
|
|
819
590
|
csvImporter,
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
591
|
+
cx2Exporter,
|
|
592
|
+
cx2Importer,
|
|
593
|
+
cxImporter,
|
|
594
|
+
aq as declareCompanion,
|
|
595
|
+
ar as declareResolved,
|
|
596
|
+
d3 as decodeChunks,
|
|
597
|
+
as as decodeEntryName,
|
|
824
598
|
d2 as dialectCapabilities,
|
|
825
599
|
dotExporter,
|
|
826
600
|
dotImporter,
|
|
827
|
-
|
|
828
|
-
|
|
601
|
+
e2 as encodeChunks,
|
|
602
|
+
e3 as explicitWeights,
|
|
829
603
|
exportGraph,
|
|
830
604
|
exportGraphToString,
|
|
831
|
-
extensionOf,
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
605
|
+
f2 as extensionOf,
|
|
606
|
+
f3 as formatDecimal,
|
|
607
|
+
a17 as formatF32,
|
|
608
|
+
b4 as formatF64,
|
|
609
|
+
c4 as formatGmlReal,
|
|
610
|
+
d4 as formatInteger,
|
|
837
611
|
gexfExporter,
|
|
838
612
|
gexfImporter,
|
|
839
613
|
gmlExporter,
|
|
840
614
|
gmlImporter,
|
|
841
615
|
graphmlExporter,
|
|
842
616
|
graphmlImporter,
|
|
843
|
-
|
|
844
|
-
headBytes,
|
|
617
|
+
h3 as hasIllegalXmlChar,
|
|
618
|
+
h2 as headBytes,
|
|
845
619
|
importAllGraphs,
|
|
846
620
|
importGraph,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
621
|
+
i4 as inferTextDtype,
|
|
622
|
+
at as inputLength,
|
|
623
|
+
au as isAbortError,
|
|
624
|
+
av as isCanonicalIntegerText,
|
|
625
|
+
aw as isImportInput,
|
|
626
|
+
i2 as isNmtoken,
|
|
627
|
+
a18 as isNumericText,
|
|
628
|
+
i3 as isWeightField,
|
|
629
|
+
j3 as joinText,
|
|
856
630
|
j2 as jsonCapabilities,
|
|
857
631
|
jsonExporter,
|
|
858
632
|
jsonImporter,
|
|
859
633
|
listGraphs,
|
|
860
|
-
|
|
634
|
+
m2 as mangleNmtoken,
|
|
861
635
|
neo4jExporter,
|
|
862
636
|
neo4jImporter,
|
|
863
|
-
normalizeMimeType,
|
|
864
|
-
|
|
637
|
+
n2 as normalizeMimeType,
|
|
638
|
+
oboImporter,
|
|
639
|
+
ax as pairFolding,
|
|
865
640
|
pajekExporter,
|
|
866
641
|
pajekImporter,
|
|
867
|
-
|
|
868
|
-
|
|
642
|
+
p3 as parseTextCell,
|
|
643
|
+
p2 as parseWeightText,
|
|
869
644
|
rankFormats,
|
|
870
|
-
|
|
645
|
+
ay as readText,
|
|
871
646
|
registry,
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
647
|
+
az as reportSinkOptions,
|
|
648
|
+
aA as reportUnusedOptions,
|
|
649
|
+
aB as resolveExportOptions,
|
|
650
|
+
aC as resolveImportOptions,
|
|
651
|
+
s3 as sanitizeIds,
|
|
877
652
|
sniff,
|
|
878
|
-
sniffFormat,
|
|
879
|
-
sniffJsonDialectHead,
|
|
880
|
-
|
|
653
|
+
s2 as sniffFormat,
|
|
654
|
+
g2 as sniffJsonDialectHead,
|
|
655
|
+
aD as textChunks,
|
|
881
656
|
throwIfAborted,
|
|
882
|
-
|
|
657
|
+
t as toReadableStream,
|
|
883
658
|
t2 as tokenizeXml,
|
|
884
659
|
x2 as xmlIllegalTextNotes
|
|
885
660
|
};
|