@graphty/graph-io 0.3.28 → 0.3.30
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/dist/chunks/{choose-DrXtu_96.js → choose-BfOLq6OX.js} +2 -2
- package/dist/chunks/{choose-DrXtu_96.js.map → choose-BfOLq6OX.js.map} +1 -1
- package/dist/chunks/{constants-ikG85dT8.js → constants-M8Qsjz1C.js} +2 -2
- package/dist/chunks/{constants-ikG85dT8.js.map → constants-M8Qsjz1C.js.map} +1 -1
- package/dist/chunks/{escape-D1HPTUrP.js → escape-UMMpQZqs.js} +2 -2
- package/dist/chunks/{escape-D1HPTUrP.js.map → escape-UMMpQZqs.js.map} +1 -1
- package/dist/chunks/{export-CHd4tQE2.js → export-Dq4U8Ubq.js} +165 -148
- package/dist/chunks/{export-CHd4tQE2.js.map → export-Dq4U8Ubq.js.map} +1 -1
- package/dist/chunks/{exporter-DhtW6FxK.js → exporter-BUosqV0K.js} +34 -34
- package/dist/chunks/exporter-BUosqV0K.js.map +1 -0
- package/dist/chunks/{exporter-D23CKNqF.js → exporter-Bd_VZ9ph.js} +9 -10
- package/dist/chunks/exporter-Bd_VZ9ph.js.map +1 -0
- package/dist/chunks/{exporter-DfWTgrti.js → exporter-COgVm-ff.js} +8 -7
- package/dist/chunks/{exporter-DfWTgrti.js.map → exporter-COgVm-ff.js.map} +1 -1
- package/dist/chunks/{exporter-Cl021ZIE.js → exporter-DEk_XLLs.js} +4 -4
- package/dist/chunks/{exporter-Cl021ZIE.js.map → exporter-DEk_XLLs.js.map} +1 -1
- package/dist/chunks/{importer-BZB7iP9r.js → importer-AQ3KpNHz.js} +11 -20
- package/dist/chunks/importer-AQ3KpNHz.js.map +1 -0
- package/dist/chunks/{importer-BVRE--Un.js → importer-BsZa2Phx.js} +5 -5
- package/dist/chunks/importer-BsZa2Phx.js.map +1 -0
- package/dist/chunks/{importer-DpEW5zeG.js → importer-CV8au8gH.js} +4 -4
- package/dist/chunks/{importer-DpEW5zeG.js.map → importer-CV8au8gH.js.map} +1 -1
- package/dist/chunks/{importer-BSALvkui.js → importer-Cj4-lXlv.js} +10 -9
- package/dist/chunks/importer-Cj4-lXlv.js.map +1 -0
- package/dist/chunks/{importer-B2W_58pz.js → importer-DQsgmhxc.js} +5 -5
- package/dist/chunks/{importer-B2W_58pz.js.map → importer-DQsgmhxc.js.map} +1 -1
- package/dist/chunks/{importer-CIAzt-wo.js → importer-Dkn79TjB.js} +6 -6
- package/dist/chunks/importer-Dkn79TjB.js.map +1 -0
- package/dist/chunks/{importer-z_FL4VMb.js → importer-DwSZvMDq.js} +10 -19
- package/dist/chunks/importer-DwSZvMDq.js.map +1 -0
- package/dist/chunks/{json-elements-BAmNBZok.js → json-elements-CreeKoaH.js} +12 -16
- package/dist/chunks/{json-elements-BAmNBZok.js.map → json-elements-CreeKoaH.js.map} +1 -1
- package/dist/chunks/{ontology-export-Bab4eUA8.js → ontology-export-C5Xd3W-7.js} +2 -2
- package/dist/chunks/{ontology-export-Bab4eUA8.js.map → ontology-export-C5Xd3W-7.js.map} +1 -1
- package/dist/chunks/{records-CdlvL4RO.js → records-BwaH_2ll.js} +2 -2
- package/dist/chunks/{records-CdlvL4RO.js.map → records-BwaH_2ll.js.map} +1 -1
- package/dist/chunks/{text-DzXjAiTl.js → text-4HHe6YH3.js} +2 -2
- package/dist/chunks/{text-DzXjAiTl.js.map → text-4HHe6YH3.js.map} +1 -1
- package/dist/csv.js +22 -15
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +1 -1
- package/dist/gexf.js +9 -8
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +3 -3
- package/dist/graph-io.js +69 -69
- package/dist/graphml.js +2 -2
- package/dist/json.js +1 -1
- package/dist/neo4j.js +3 -3
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/export.d.ts +6 -0
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +62 -28
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/format.d.ts +0 -8
- package/dist/src/common/format.d.ts.map +1 -1
- package/dist/src/common/format.js +0 -10
- package/dist/src/common/format.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +1 -9
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +2 -12
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/formats/csv/exporter.d.ts.map +1 -1
- package/dist/src/formats/csv/exporter.js +18 -7
- package/dist/src/formats/csv/exporter.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +3 -3
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +3 -3
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cys/exporter.d.ts.map +1 -1
- package/dist/src/formats/cys/exporter.js +4 -3
- package/dist/src/formats/cys/exporter.js.map +1 -1
- package/dist/src/formats/dot/exporter.js +1 -1
- package/dist/src/formats/dot/importer.d.ts +2 -2
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +7 -11
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts +2 -2
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +7 -5
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/schema.js +1 -1
- package/dist/src/formats/json/exporter.js +1 -1
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +4 -6
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/obo/syntax.d.ts +4 -0
- package/dist/src/formats/obo/syntax.d.ts.map +1 -1
- package/dist/src/formats/obo/syntax.js +35 -31
- package/dist/src/formats/obo/syntax.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +5 -4
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +3 -7
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts +1 -1
- package/dist/src/formats/pajek/syntax.js +1 -1
- package/dist/src/formats/xgmml/constants.d.ts +1 -1
- package/dist/src/formats/xgmml/constants.js +1 -1
- package/dist/src/formats/xgmml/emit.js +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +4 -3
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/types.d.ts +6 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/xgmml.js +2 -2
- package/package.json +1 -1
- package/src/common/export.ts +105 -62
- package/src/common/format.ts +0 -11
- package/src/common/json-elements.ts +2 -13
- package/src/formats/csv/exporter.ts +19 -15
- package/src/formats/cx/importer.ts +2 -3
- package/src/formats/cx2/importer.ts +2 -3
- package/src/formats/cys/exporter.ts +4 -3
- package/src/formats/dot/exporter.ts +1 -1
- package/src/formats/dot/importer.ts +7 -17
- package/src/formats/gexf/exporter.ts +7 -5
- package/src/formats/gexf/schema.ts +1 -1
- package/src/formats/json/exporter.ts +1 -1
- package/src/formats/json/importer.ts +4 -7
- package/src/formats/obo/syntax.ts +35 -31
- package/src/formats/pajek/exporter.ts +5 -4
- package/src/formats/pajek/importer.ts +3 -13
- package/src/formats/pajek/syntax.ts +1 -1
- package/src/formats/xgmml/constants.ts +1 -1
- package/src/formats/xgmml/emit.ts +1 -1
- package/src/formats/xgmml/exporter.ts +4 -3
- package/src/types.ts +6 -0
- package/dist/chunks/exporter-D23CKNqF.js.map +0 -1
- package/dist/chunks/exporter-DhtW6FxK.js.map +0 -1
- package/dist/chunks/importer-BSALvkui.js.map +0 -1
- package/dist/chunks/importer-BVRE--Un.js.map +0 -1
- package/dist/chunks/importer-BZB7iP9r.js.map +0 -1
- package/dist/chunks/importer-CIAzt-wo.js.map +0 -1
- package/dist/chunks/importer-z_FL4VMb.js.map +0 -1
package/dist/csv.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b as plural,
|
|
2
|
-
import { i as inferTextDtype, T as TextCellWriter, p as parseTextCell, W as WIDENING_UNSUPPORTED_CODE } from "./chunks/text-
|
|
1
|
+
import { b as plural, bU as DICT_SAMPLE_ROWS, ac as DictHeuristic, R as ROLE_TAKEN_CODE$1, I as ID_MERGED_CODE$1, m as DUPLICATE_EDGE_ID_CODE$1, n as DUPLICATE_NODE_CODE$1, t as MISSING_ID_CODE$1, s as MISSING_ENDPOINT_CODE$1, E as EMPTY_INPUT_CODE$1, al as resolveImportOptions, a8 as ImportReportBuilder, ao as reportSinkOptions, an as reportUnusedOptions, aq as DirectionResolver, ar as IdCoercer, am as throwIfAborted, O as OPTION_IGNORED_CODE, aK as parseWeightText, a0 as uniqueColumnName, ay as RENAMED_CODE, a1 as declareResolved, c as capabilities, L as LOSS, a as checkCapabilities, r as resolveExportOptions, p as pairFolding, bD as countMixedEdges, $ as agree, e as explicitWeights, b_ as otherFormatDialect, bS as joinListText, aG as formatInteger, aF as formatDecimal, aH as canonicalId, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, C as COLUMN_RENAMED_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, P as PRECISION_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE } from "./chunks/export-Dq4U8Ubq.js";
|
|
2
|
+
import { i as inferTextDtype, T as TextCellWriter, p as parseTextCell, W as WIDENING_UNSUPPORTED_CODE } from "./chunks/text-4HHe6YH3.js";
|
|
3
3
|
import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
|
|
4
|
-
import { s as stripLeadingComments, a as sniffNewline, b as sniffDelimiter, D as DELIMITER_CANDIDATES, c as checkRecordSyntax, C as CsvRecordReader, d as splitRecords, B as BAD_QUOTE_CODE, U as UNCLOSED_QUOTE_CODE } from "./chunks/records-
|
|
5
|
-
import { o as quoteCsvCell } from "./chunks/escape-
|
|
4
|
+
import { s as stripLeadingComments, a as sniffNewline, b as sniffDelimiter, D as DELIMITER_CANDIDATES, c as checkRecordSyntax, C as CsvRecordReader, d as splitRecords, B as BAD_QUOTE_CODE, U as UNCLOSED_QUOTE_CODE } from "./chunks/records-BwaH_2ll.js";
|
|
5
|
+
import { o as quoteCsvCell } from "./chunks/escape-UMMpQZqs.js";
|
|
6
6
|
import { j as joinText, e as encodeChunks } from "./chunks/writer-DxjgHwSe.js";
|
|
7
7
|
const SOURCE_NAMES = Object.freeze([
|
|
8
8
|
"source",
|
|
@@ -1911,15 +1911,18 @@ function cellText(column, row) {
|
|
|
1911
1911
|
}
|
|
1912
1912
|
}
|
|
1913
1913
|
}
|
|
1914
|
-
function nodeTableNote(names, table,
|
|
1914
|
+
function nodeTableNote(names, table, notes) {
|
|
1915
1915
|
const written = names.length;
|
|
1916
1916
|
if (written > 0) {
|
|
1917
1917
|
const shown = names.slice(0, 3).map((n) => JSON.stringify(n)).join(", ") + (written > 3 ? ", ..." : "");
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1918
|
+
notes.push(
|
|
1919
|
+
Object.freeze({
|
|
1920
|
+
code: CSV_LOSS.NODE_TABLE,
|
|
1921
|
+
message: `the ${table === "adjacency" ? "adjacency" : "edge"} table has no room for node attributes: ${written} node column${plural(written)} (${shown}) ${agree(written, "is", "are")} written only by a second export with table: "nodes"`,
|
|
1922
|
+
column: null,
|
|
1923
|
+
count: written,
|
|
1924
|
+
columns: Object.freeze([...names])
|
|
1925
|
+
})
|
|
1923
1926
|
);
|
|
1924
1927
|
}
|
|
1925
1928
|
}
|
|
@@ -1980,7 +1983,7 @@ function planExport(snapshot, options, values) {
|
|
|
1980
1983
|
edgeRows.push(e);
|
|
1981
1984
|
}
|
|
1982
1985
|
}
|
|
1983
|
-
if (csv.dialect.type === null || csv.table === "adjacency") {
|
|
1986
|
+
if (csv.table !== "nodes" && (csv.dialect.type === null || csv.table === "adjacency")) {
|
|
1984
1987
|
const where = csv.table === "adjacency" ? "an adjacency table" : "the generic dialect";
|
|
1985
1988
|
const mixed = countMixedEdges(snapshot);
|
|
1986
1989
|
if (!snapshot.directed) {
|
|
@@ -2006,7 +2009,7 @@ function planExport(snapshot, options, values) {
|
|
|
2006
2009
|
0
|
|
2007
2010
|
);
|
|
2008
2011
|
}
|
|
2009
|
-
if (folding.mutualCount > 0) {
|
|
2012
|
+
if (folding.mutualCount > 0 && csv.table !== "nodes") {
|
|
2010
2013
|
note(
|
|
2011
2014
|
CSV_LOSS.MUTUAL_EXPANDED,
|
|
2012
2015
|
`${folding.mutualCount} mutual pair${plural(folding.mutualCount)} ${agree(folding.mutualCount, "is", "are")} written as two directed rows; the mutual mark is lost`,
|
|
@@ -2077,7 +2080,7 @@ function planExport(snapshot, options, values) {
|
|
|
2077
2080
|
nodeTableNote(
|
|
2078
2081
|
[...nodeLabel === null ? [] : [nodeLabel.meta.name], ...nodeColumns.map((c) => c.column.meta.name)],
|
|
2079
2082
|
csv.table,
|
|
2080
|
-
|
|
2083
|
+
notes
|
|
2081
2084
|
);
|
|
2082
2085
|
}
|
|
2083
2086
|
return {
|
|
@@ -2463,7 +2466,8 @@ function headerlessNotes(plan) {
|
|
|
2463
2466
|
code: CSV_LOSS.HEADERLESS,
|
|
2464
2467
|
message: `without a header the file is read back by position (${csv.table === "nodes" ? "id" : "source, target, weight"}, then unnamed columns), so ${names.length === 1 ? "the column" : "the columns"} ${shown} ${agree(names.length, "reads", "read")} back unnamed or in another column's place; write the header, or for an edge list pass dialect: "generic" and write only source, target and weight`,
|
|
2465
2468
|
column: null,
|
|
2466
|
-
count: names.length
|
|
2469
|
+
count: names.length,
|
|
2470
|
+
columns: Object.freeze([...names])
|
|
2467
2471
|
})
|
|
2468
2472
|
];
|
|
2469
2473
|
}
|
|
@@ -2492,7 +2496,10 @@ function headerlessEdgeColumns(plan) {
|
|
|
2492
2496
|
function check(snapshot, options) {
|
|
2493
2497
|
const plan = planExport(snapshot, options, true);
|
|
2494
2498
|
return Object.freeze([
|
|
2495
|
-
...checkCapabilities(snapshot, CSV_CAPABILITIES, plan.common, {
|
|
2499
|
+
...checkCapabilities(snapshot, CSV_CAPABILITIES, plan.common, {
|
|
2500
|
+
roles: KEPT_ROLES,
|
|
2501
|
+
...plan.csv.table === "nodes" ? { tables: ["node"] } : {}
|
|
2502
|
+
}),
|
|
2496
2503
|
...plan.notes,
|
|
2497
2504
|
...headerlessNotes(plan)
|
|
2498
2505
|
]);
|