@graphty/graph-io 0.3.39 → 0.3.40

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 (94) hide show
  1. package/dist/chunks/{escape-BpYMQZVa.js → escape-BJRLd3vJ.js} +3 -2
  2. package/dist/chunks/escape-BJRLd3vJ.js.map +1 -0
  3. package/dist/chunks/{exporter-BqKs1Q12.js → exporter-6ocL_9x_.js} +5 -4
  4. package/dist/chunks/exporter-6ocL_9x_.js.map +1 -0
  5. package/dist/chunks/{exporter-DXqCPNrI.js → exporter-BVXnV9-9.js} +42 -29
  6. package/dist/chunks/exporter-BVXnV9-9.js.map +1 -0
  7. package/dist/chunks/{exporter-CNJZF_BN.js → exporter-Bcp-l4Bo.js} +2 -2
  8. package/dist/chunks/{exporter-CNJZF_BN.js.map → exporter-Bcp-l4Bo.js.map} +1 -1
  9. package/dist/chunks/{importer-CqgYq4Ld.js → importer-AjwOJrn2.js} +2 -2
  10. package/dist/chunks/{importer-CqgYq4Ld.js.map → importer-AjwOJrn2.js.map} +1 -1
  11. package/dist/chunks/{importer-BfJ1jnNr.js → importer-BJlGAOht.js} +27 -12
  12. package/dist/chunks/importer-BJlGAOht.js.map +1 -0
  13. package/dist/chunks/{importer-PVXkeoaS.js → importer-BpuS3J8C.js} +8 -8
  14. package/dist/chunks/importer-BpuS3J8C.js.map +1 -0
  15. package/dist/chunks/{importer-CSt-gaYE.js → importer-CPqnIY8m.js} +4 -4
  16. package/dist/chunks/{importer-CSt-gaYE.js.map → importer-CPqnIY8m.js.map} +1 -1
  17. package/dist/chunks/{importer-B7Ir269L.js → importer-DEp_fYjf.js} +28 -10
  18. package/dist/chunks/importer-DEp_fYjf.js.map +1 -0
  19. package/dist/chunks/{importer-DvFznt5-.js → importer-D_srHyj6.js} +111 -61
  20. package/dist/chunks/importer-D_srHyj6.js.map +1 -0
  21. package/dist/chunks/{importer--tQQsY4W.js → importer-DcKB97kW.js} +2 -2
  22. package/dist/chunks/{importer--tQQsY4W.js.map → importer-DcKB97kW.js.map} +1 -1
  23. package/dist/chunks/{json-elements-CXs4z1iL.js → json-elements-DpO6AXIc.js} +5 -3
  24. package/dist/chunks/{json-elements-CXs4z1iL.js.map → json-elements-DpO6AXIc.js.map} +1 -1
  25. package/dist/chunks/{records-C9jd7yLD.js → records-r3SFHz11.js} +136 -95
  26. package/dist/chunks/records-r3SFHz11.js.map +1 -0
  27. package/dist/csv.js +2 -2
  28. package/dist/cx.js +1 -1
  29. package/dist/cx2.js +2 -2
  30. package/dist/cys.js +1 -1
  31. package/dist/dot.js +1 -1
  32. package/dist/gexf.js +5 -3
  33. package/dist/gexf.js.map +1 -1
  34. package/dist/gml.js +1 -1
  35. package/dist/graph-io.js +19 -19
  36. package/dist/graphml.js +1 -1
  37. package/dist/json.js +1 -1
  38. package/dist/neo4j.js +2 -2
  39. package/dist/pajek.js +1 -1
  40. package/dist/src/common/json-elements.d.ts.map +1 -1
  41. package/dist/src/common/json-elements.js +4 -2
  42. package/dist/src/common/json-elements.js.map +1 -1
  43. package/dist/src/common/xml.d.ts.map +1 -1
  44. package/dist/src/common/xml.js +2 -1
  45. package/dist/src/common/xml.js.map +1 -1
  46. package/dist/src/formats/csv/records.d.ts.map +1 -1
  47. package/dist/src/formats/csv/records.js +138 -100
  48. package/dist/src/formats/csv/records.js.map +1 -1
  49. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  50. package/dist/src/formats/cx/importer.js +108 -53
  51. package/dist/src/formats/cx/importer.js.map +1 -1
  52. package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
  53. package/dist/src/formats/cx2/exporter.js +2 -1
  54. package/dist/src/formats/cx2/exporter.js.map +1 -1
  55. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  56. package/dist/src/formats/cx2/importer.js +28 -6
  57. package/dist/src/formats/cx2/importer.js.map +1 -1
  58. package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
  59. package/dist/src/formats/gexf/exporter.js +4 -2
  60. package/dist/src/formats/gexf/exporter.js.map +1 -1
  61. package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
  62. package/dist/src/formats/graphml/exporter.js +2 -1
  63. package/dist/src/formats/graphml/exporter.js.map +1 -1
  64. package/dist/src/formats/graphml/importer.d.ts.map +1 -1
  65. package/dist/src/formats/graphml/importer.js +3 -2
  66. package/dist/src/formats/graphml/importer.js.map +1 -1
  67. package/dist/src/formats/xgmml/emit.d.ts +6 -0
  68. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  69. package/dist/src/formats/xgmml/emit.js +33 -10
  70. package/dist/src/formats/xgmml/emit.js.map +1 -1
  71. package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
  72. package/dist/src/formats/xgmml/exporter.js +54 -22
  73. package/dist/src/formats/xgmml/exporter.js.map +1 -1
  74. package/dist/xgmml.js +2 -2
  75. package/package.json +2 -2
  76. package/src/common/json-elements.ts +4 -2
  77. package/src/common/xml.ts +2 -1
  78. package/src/formats/csv/records.ts +143 -99
  79. package/src/formats/cx/importer.ts +140 -58
  80. package/src/formats/cx2/exporter.ts +2 -1
  81. package/src/formats/cx2/importer.ts +34 -10
  82. package/src/formats/gexf/exporter.ts +4 -2
  83. package/src/formats/graphml/exporter.ts +2 -3
  84. package/src/formats/graphml/importer.ts +3 -2
  85. package/src/formats/xgmml/emit.ts +34 -10
  86. package/src/formats/xgmml/exporter.ts +63 -23
  87. package/dist/chunks/escape-BpYMQZVa.js.map +0 -1
  88. package/dist/chunks/exporter-BqKs1Q12.js.map +0 -1
  89. package/dist/chunks/exporter-DXqCPNrI.js.map +0 -1
  90. package/dist/chunks/importer-B7Ir269L.js.map +0 -1
  91. package/dist/chunks/importer-BfJ1jnNr.js.map +0 -1
  92. package/dist/chunks/importer-DvFznt5-.js.map +0 -1
  93. package/dist/chunks/importer-PVXkeoaS.js.map +0 -1
  94. package/dist/chunks/records-C9jd7yLD.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { INVALID_INDEX, GraphFormatError } from "@graphty/graph-format";
2
2
  import { M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, I as ID_MERGED_CODE, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, f as STRAY_TEXT_CODE, g as UNKNOWN_ELEMENT_CODE, U as UNKNOWN_ATTR_TYPE_CODE, b6 as EQUATION_AS_TEXT_CODE, ai as PARENT_CYCLE_CODE, q as UNKNOWN_PARENT_CODE, o as DUPLICATE_ATTRIBUTE_CODE, i as DANGLING_REFERENCE_CODE, P as PRECISION_CODE, aj as WIDENED_CODE, a3 as BAD_VALUE_CODE, m as DUPLICATE_EDGE_ID_CODE, n as DUPLICATE_NODE_CODE, s as MISSING_ENDPOINT_CODE, t as MISSING_ID_CODE, N as NO_GRAPH_CODE, v as ENCODING_CONFLICT_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, X as XML_SYNTAX_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, bj as STORAGE_CLASS_CODE, bp as WEIGHT_KEY_CLASH_CODE, au as ROLE_ASSUMED_CODE, a$ as COLUMN_RENAMED_LOSS_CODE, J as ID_TEXT_TYPE_CODE, bc as MUTUAL_EXPANDED_CODE, Q as PARENTS_DROPPED_CODE, K as ROLE_DROPPED_CODE, bl as TEMPORAL_TEXT_DROPPED_CODE, bk as TEMPORAL_DROPPED_CODE, ax as XML_ILLEGAL_CHAR_CODE, a0 as uniqueColumnName, a1 as declareResolved, ac as DictHeuristic, ar as IdCoercer, aq as DirectionResolver, b as plural, $ as agree, am as throwIfAborted, aK as parseWeightText, ao as reportSinkOptions, an as reportUnusedOptions, a7 as chooseGraph, ap as graphChosen, al as resolveImportOptions, a8 as ImportReportBuilder, a4 as textChunks, c0 as elementCount } from "./export-B-aVCwyG.js";
3
- import { l as localName, a as escapeXmlText, j as isWhitespace, e as escapeXmlAttribute, t as tokenizeXml, f as xmlDeclaredEncoding, X as XmlSyntaxError } from "./escape-BpYMQZVa.js";
3
+ import { l as localName, a as escapeXmlText, j as isWhitespace, e as escapeXmlAttribute, t as tokenizeXml, f as xmlDeclaredEncoding, X as XmlSyntaxError } from "./escape-BJRLd3vJ.js";
4
4
  import { p as parseTextCell, i as inferTextDtype } from "./text-Bjfa1xYL.js";
5
5
  const FORMAT = "xgmml";
6
6
  const EXTENSIONS = Object.freeze([".xgmml", ".xml"]);
@@ -1747,6 +1747,9 @@ function parseCoordinate(text) {
1747
1747
  function localRef(href) {
1748
1748
  return href.startsWith("#") ? href.slice(1) : null;
1749
1749
  }
1750
+ function memberRef(id, href) {
1751
+ return id ?? (href === null ? null : localRef(href));
1752
+ }
1750
1753
  function membersOf(doc, graph) {
1751
1754
  if (graph === null) {
1752
1755
  return { nodes: doc.nodes, edges: doc.edges, dangling: 0 };
@@ -2036,10 +2039,16 @@ class XgmmlEmitter {
2036
2039
  }
2037
2040
  const lower = t.toLowerCase();
2038
2041
  const readable = lower === "true" || lower === "yes" || lower === "false" || lower === "no";
2042
+ let readAs;
2043
+ if (readable) {
2044
+ readAs = lower === "true" || lower === "yes" ? "1" : "0";
2045
+ } else {
2046
+ readAs = fallback ? "directed" : "undirected";
2047
+ }
2039
2048
  this.report.warnOnce(
2040
2049
  "validation-error",
2041
2050
  XGMML_ISSUE.BAD_DIRECTED,
2042
- readable ? `${this.prefix()}directed="${text}" is not 0 or 1; read as ${lower === "true" || lower === "yes" ? "1" : "0"}` : `${this.prefix()}directed="${text}" is not 0 or 1; read as ${fallback ? "directed" : "undirected"}`,
2051
+ `${this.prefix()}directed="${text}" is not 0 or 1; read as ${readAs}`,
2043
2052
  where,
2044
2053
  `${XGMML_ISSUE.BAD_DIRECTED}:${text}`
2045
2054
  );
@@ -2305,17 +2314,17 @@ class XgmmlEmitter {
2305
2314
  }
2306
2315
  });
2307
2316
  }
2308
- /** The `xgmml.networks` membership of nodes in root-level subgraphs of a generic document. */
2309
- writeNetworks() {
2310
- const { subgraphs } = this.doc.root;
2311
- if (subgraphs.length === 0) {
2312
- return;
2313
- }
2317
+ /**
2318
+ * The names of the subgraphs each node row is a member of.
2319
+ * @param subgraphs - the root-level subgraphs
2320
+ * @returns the subgraph names by node row index
2321
+ */
2322
+ networkMembership(subgraphs) {
2314
2323
  const member = /* @__PURE__ */ new Map();
2315
2324
  for (const graph of subgraphs) {
2316
2325
  const name = graph.id ?? graph.label ?? "";
2317
2326
  for (const m of graph.members) {
2318
- const id = m.kind === "node" ? m.id ?? (m.href === null ? null : localRef(m.href)) : null;
2327
+ const id = m.kind === "node" ? memberRef(m.id, m.href) : null;
2319
2328
  const row = id === null ? void 0 : this.rows.get(id);
2320
2329
  if (row !== void 0 && row.index >= 0) {
2321
2330
  const list = member.get(row.index) ?? [];
@@ -2324,6 +2333,15 @@ class XgmmlEmitter {
2324
2333
  }
2325
2334
  }
2326
2335
  }
2336
+ return member;
2337
+ }
2338
+ /** The `xgmml.networks` membership of nodes in root-level subgraphs of a generic document. */
2339
+ writeNetworks() {
2340
+ const { subgraphs } = this.doc.root;
2341
+ if (subgraphs.length === 0) {
2342
+ return;
2343
+ }
2344
+ const member = this.networkMembership(subgraphs);
2327
2345
  if (member.size === 0) {
2328
2346
  return;
2329
2347
  }
@@ -3305,4 +3323,4 @@ export {
3305
3323
  resolveSettings as r,
3306
3324
  xgmmlImporter as x
3307
3325
  };
3308
- //# sourceMappingURL=importer-B7Ir269L.js.map
3326
+ //# sourceMappingURL=importer-DEp_fYjf.js.map