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