@graphty/graph-io 0.3.28 → 0.3.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/chunks/{choose-DrXtu_96.js → choose-DT5da6OC.js} +2 -2
  2. package/dist/chunks/{choose-DrXtu_96.js.map → choose-DT5da6OC.js.map} +1 -1
  3. package/dist/chunks/{constants-ikG85dT8.js → constants-DowRD9ai.js} +2 -2
  4. package/dist/chunks/{constants-ikG85dT8.js.map → constants-DowRD9ai.js.map} +1 -1
  5. package/dist/chunks/{escape-D1HPTUrP.js → escape-DQC5HWqF.js} +2 -2
  6. package/dist/chunks/{escape-D1HPTUrP.js.map → escape-DQC5HWqF.js.map} +1 -1
  7. package/dist/chunks/{export-CHd4tQE2.js → export-CVi12U7J.js} +81 -60
  8. package/dist/chunks/{export-CHd4tQE2.js.map → export-CVi12U7J.js.map} +1 -1
  9. package/dist/chunks/{exporter-D23CKNqF.js → exporter-C3Pa2PSd.js} +5 -5
  10. package/dist/chunks/{exporter-D23CKNqF.js.map → exporter-C3Pa2PSd.js.map} +1 -1
  11. package/dist/chunks/{exporter-DfWTgrti.js → exporter-CgsO2nSl.js} +4 -4
  12. package/dist/chunks/{exporter-DfWTgrti.js.map → exporter-CgsO2nSl.js.map} +1 -1
  13. package/dist/chunks/{exporter-Cl021ZIE.js → exporter-Cy_1da4c.js} +4 -4
  14. package/dist/chunks/{exporter-Cl021ZIE.js.map → exporter-Cy_1da4c.js.map} +1 -1
  15. package/dist/chunks/{exporter-DhtW6FxK.js → exporter-JubAlNWi.js} +34 -34
  16. package/dist/chunks/exporter-JubAlNWi.js.map +1 -0
  17. package/dist/chunks/{importer-CIAzt-wo.js → importer-BA_hZKo7.js} +4 -4
  18. package/dist/chunks/{importer-CIAzt-wo.js.map → importer-BA_hZKo7.js.map} +1 -1
  19. package/dist/chunks/{importer-BZB7iP9r.js → importer-CDXlxXlS.js} +5 -5
  20. package/dist/chunks/{importer-BZB7iP9r.js.map → importer-CDXlxXlS.js.map} +1 -1
  21. package/dist/chunks/{importer-BVRE--Un.js → importer-DLz2Vb4q.js} +3 -3
  22. package/dist/chunks/{importer-BVRE--Un.js.map → importer-DLz2Vb4q.js.map} +1 -1
  23. package/dist/chunks/{importer-B2W_58pz.js → importer-DVxzzibh.js} +4 -4
  24. package/dist/chunks/{importer-B2W_58pz.js.map → importer-DVxzzibh.js.map} +1 -1
  25. package/dist/chunks/{importer-BSALvkui.js → importer-Dej72hIF.js} +6 -6
  26. package/dist/chunks/{importer-BSALvkui.js.map → importer-Dej72hIF.js.map} +1 -1
  27. package/dist/chunks/{importer-z_FL4VMb.js → importer-lLH9gQF_.js} +5 -5
  28. package/dist/chunks/{importer-z_FL4VMb.js.map → importer-lLH9gQF_.js.map} +1 -1
  29. package/dist/chunks/{importer-DpEW5zeG.js → importer-q-R-Q98w.js} +4 -4
  30. package/dist/chunks/{importer-DpEW5zeG.js.map → importer-q-R-Q98w.js.map} +1 -1
  31. package/dist/chunks/{json-elements-BAmNBZok.js → json-elements-1IUzkRNy.js} +3 -3
  32. package/dist/chunks/{json-elements-BAmNBZok.js.map → json-elements-1IUzkRNy.js.map} +1 -1
  33. package/dist/chunks/{ontology-export-Bab4eUA8.js → ontology-export-b0GLNIj-.js} +2 -2
  34. package/dist/chunks/{ontology-export-Bab4eUA8.js.map → ontology-export-b0GLNIj-.js.map} +1 -1
  35. package/dist/chunks/{records-CdlvL4RO.js → records-CdyqwXeY.js} +2 -2
  36. package/dist/chunks/{records-CdlvL4RO.js.map → records-CdyqwXeY.js.map} +1 -1
  37. package/dist/chunks/{text-DzXjAiTl.js → text-CDgjbkLC.js} +2 -2
  38. package/dist/chunks/{text-DzXjAiTl.js.map → text-CDgjbkLC.js.map} +1 -1
  39. package/dist/csv.js +22 -15
  40. package/dist/csv.js.map +1 -1
  41. package/dist/cx.js +1 -1
  42. package/dist/cx2.js +2 -2
  43. package/dist/cys.js +1 -1
  44. package/dist/dot.js +1 -1
  45. package/dist/gexf.js +2 -2
  46. package/dist/gml.js +3 -3
  47. package/dist/graph-io.js +26 -26
  48. package/dist/graphml.js +2 -2
  49. package/dist/json.js +1 -1
  50. package/dist/neo4j.js +3 -3
  51. package/dist/obo.js +1 -1
  52. package/dist/pajek.js +1 -1
  53. package/dist/src/common/export.d.ts +6 -0
  54. package/dist/src/common/export.d.ts.map +1 -1
  55. package/dist/src/common/export.js +62 -28
  56. package/dist/src/common/export.js.map +1 -1
  57. package/dist/src/formats/csv/exporter.d.ts.map +1 -1
  58. package/dist/src/formats/csv/exporter.js +18 -7
  59. package/dist/src/formats/csv/exporter.js.map +1 -1
  60. package/dist/src/formats/obo/syntax.d.ts +4 -0
  61. package/dist/src/formats/obo/syntax.d.ts.map +1 -1
  62. package/dist/src/formats/obo/syntax.js +35 -31
  63. package/dist/src/formats/obo/syntax.js.map +1 -1
  64. package/dist/src/types.d.ts +6 -0
  65. package/dist/src/types.d.ts.map +1 -1
  66. package/dist/src/types.js.map +1 -1
  67. package/dist/xgmml.js +2 -2
  68. package/package.json +1 -1
  69. package/src/common/export.ts +105 -62
  70. package/src/formats/csv/exporter.ts +19 -15
  71. package/src/formats/obo/syntax.ts +35 -31
  72. package/src/types.ts +6 -0
  73. package/dist/chunks/exporter-DhtW6FxK.js.map +0 -1
package/dist/csv.js CHANGED
@@ -1,8 +1,8 @@
1
- import { b as plural, bV 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, aL 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, bE as countMixedEdges, $ as agree, e as explicitWeights, b$ as otherFormatDialect, bT 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-CHd4tQE2.js";
2
- import { i as inferTextDtype, T as TextCellWriter, p as parseTextCell, W as WIDENING_UNSUPPORTED_CODE } from "./chunks/text-DzXjAiTl.js";
1
+ import { b as plural, bV 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, aL 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, bE as countMixedEdges, $ as agree, e as explicitWeights, b$ as otherFormatDialect, bT 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-CVi12U7J.js";
2
+ import { i as inferTextDtype, T as TextCellWriter, p as parseTextCell, W as WIDENING_UNSUPPORTED_CODE } from "./chunks/text-CDgjbkLC.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-CdlvL4RO.js";
5
- import { o as quoteCsvCell } from "./chunks/escape-D1HPTUrP.js";
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-CdyqwXeY.js";
5
+ import { o as quoteCsvCell } from "./chunks/escape-DQC5HWqF.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, note) {
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
- note(
1919
- CSV_LOSS.NODE_TABLE,
1920
- `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"`,
1921
- null,
1922
- written
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
- note
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, { roles: KEPT_ROLES }),
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
  ]);