@graphty/graph-io 0.0.0 → 0.2.1

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 (339) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +250 -28
  3. package/dist/chunks/children-CL3Cy0ez.js +238 -0
  4. package/dist/chunks/children-CL3Cy0ez.js.map +1 -0
  5. package/dist/chunks/escape-DyI8JofU.js +938 -0
  6. package/dist/chunks/escape-DyI8JofU.js.map +1 -0
  7. package/dist/chunks/importer-CQnJuWJw.js +2987 -0
  8. package/dist/chunks/importer-CQnJuWJw.js.map +1 -0
  9. package/dist/chunks/importer-CpCpfbxr.js +2015 -0
  10. package/dist/chunks/importer-CpCpfbxr.js.map +1 -0
  11. package/dist/chunks/importer-DbnGYr3_.js +2342 -0
  12. package/dist/chunks/importer-DbnGYr3_.js.map +1 -0
  13. package/dist/chunks/importer-GozH8DkN.js +3050 -0
  14. package/dist/chunks/importer-GozH8DkN.js.map +1 -0
  15. package/dist/chunks/records-CGpxszm1.js +605 -0
  16. package/dist/chunks/records-CGpxszm1.js.map +1 -0
  17. package/dist/chunks/text-CajMdVFy.js +189 -0
  18. package/dist/chunks/text-CajMdVFy.js.map +1 -0
  19. package/dist/chunks/writer-DxSKC7TL.js +2842 -0
  20. package/dist/chunks/writer-DxSKC7TL.js.map +1 -0
  21. package/dist/csv.d.ts +1 -0
  22. package/dist/csv.js +1702 -0
  23. package/dist/csv.js.map +1 -0
  24. package/dist/dot.d.ts +1 -0
  25. package/dist/dot.js +8 -0
  26. package/dist/dot.js.map +1 -0
  27. package/dist/gexf.d.ts +1 -0
  28. package/dist/gexf.js +3466 -0
  29. package/dist/gexf.js.map +1 -0
  30. package/dist/gml.d.ts +1 -0
  31. package/dist/gml.js +2647 -0
  32. package/dist/gml.js.map +1 -0
  33. package/dist/graph-io.d.ts +1 -0
  34. package/dist/graph-io.js +790 -0
  35. package/dist/graph-io.js.map +1 -0
  36. package/dist/graphml.d.ts +1 -0
  37. package/dist/graphml.js +8 -0
  38. package/dist/graphml.js.map +1 -0
  39. package/dist/json.d.ts +1 -0
  40. package/dist/json.js +11 -0
  41. package/dist/json.js.map +1 -0
  42. package/dist/neo4j.d.ts +1 -0
  43. package/dist/neo4j.js +2046 -0
  44. package/dist/neo4j.js.map +1 -0
  45. package/dist/pajek.d.ts +1 -0
  46. package/dist/pajek.js +8 -0
  47. package/dist/pajek.js.map +1 -0
  48. package/dist/src/children.d.ts +134 -0
  49. package/dist/src/children.d.ts.map +1 -0
  50. package/dist/src/children.js +274 -0
  51. package/dist/src/children.js.map +1 -0
  52. package/dist/src/common/attributes.d.ts +229 -0
  53. package/dist/src/common/attributes.d.ts.map +1 -0
  54. package/dist/src/common/attributes.js +368 -0
  55. package/dist/src/common/attributes.js.map +1 -0
  56. package/dist/src/common/codes.d.ts +105 -0
  57. package/dist/src/common/codes.d.ts.map +1 -0
  58. package/dist/src/common/codes.js +107 -0
  59. package/dist/src/common/codes.js.map +1 -0
  60. package/dist/src/common/declared-types.d.ts +84 -0
  61. package/dist/src/common/declared-types.d.ts.map +1 -0
  62. package/dist/src/common/declared-types.js +326 -0
  63. package/dist/src/common/declared-types.js.map +1 -0
  64. package/dist/src/common/direction.d.ts +206 -0
  65. package/dist/src/common/direction.d.ts.map +1 -0
  66. package/dist/src/common/direction.js +370 -0
  67. package/dist/src/common/direction.js.map +1 -0
  68. package/dist/src/common/escape.d.ts +92 -0
  69. package/dist/src/common/escape.d.ts.map +1 -0
  70. package/dist/src/common/escape.js +212 -0
  71. package/dist/src/common/escape.js.map +1 -0
  72. package/dist/src/common/export.d.ts +249 -0
  73. package/dist/src/common/export.d.ts.map +1 -0
  74. package/dist/src/common/export.js +594 -0
  75. package/dist/src/common/export.js.map +1 -0
  76. package/dist/src/common/format.d.ts +59 -0
  77. package/dist/src/common/format.d.ts.map +1 -0
  78. package/dist/src/common/format.js +106 -0
  79. package/dist/src/common/format.js.map +1 -0
  80. package/dist/src/common/ids.d.ts +83 -0
  81. package/dist/src/common/ids.d.ts.map +1 -0
  82. package/dist/src/common/ids.js +158 -0
  83. package/dist/src/common/ids.js.map +1 -0
  84. package/dist/src/common/input.d.ts +100 -0
  85. package/dist/src/common/input.d.ts.map +1 -0
  86. package/dist/src/common/input.js +335 -0
  87. package/dist/src/common/input.js.map +1 -0
  88. package/dist/src/common/lists.d.ts +34 -0
  89. package/dist/src/common/lists.d.ts.map +1 -0
  90. package/dist/src/common/lists.js +185 -0
  91. package/dist/src/common/lists.js.map +1 -0
  92. package/dist/src/common/options.d.ts +108 -0
  93. package/dist/src/common/options.d.ts.map +1 -0
  94. package/dist/src/common/options.js +265 -0
  95. package/dist/src/common/options.js.map +1 -0
  96. package/dist/src/common/report.d.ts +187 -0
  97. package/dist/src/common/report.d.ts.map +1 -0
  98. package/dist/src/common/report.js +274 -0
  99. package/dist/src/common/report.js.map +1 -0
  100. package/dist/src/common/temporal.d.ts +71 -0
  101. package/dist/src/common/temporal.d.ts.map +1 -0
  102. package/dist/src/common/temporal.js +266 -0
  103. package/dist/src/common/temporal.js.map +1 -0
  104. package/dist/src/common/text.d.ts +104 -0
  105. package/dist/src/common/text.d.ts.map +1 -0
  106. package/dist/src/common/text.js +255 -0
  107. package/dist/src/common/text.js.map +1 -0
  108. package/dist/src/common/weights.d.ts +77 -0
  109. package/dist/src/common/weights.d.ts.map +1 -0
  110. package/dist/src/common/weights.js +156 -0
  111. package/dist/src/common/weights.js.map +1 -0
  112. package/dist/src/common/writer.d.ts +51 -0
  113. package/dist/src/common/writer.d.ts.map +1 -0
  114. package/dist/src/common/writer.js +108 -0
  115. package/dist/src/common/writer.js.map +1 -0
  116. package/dist/src/common/xml.d.ts +245 -0
  117. package/dist/src/common/xml.d.ts.map +1 -0
  118. package/dist/src/common/xml.js +942 -0
  119. package/dist/src/common/xml.js.map +1 -0
  120. package/dist/src/formats/csv/exporter.d.ts +70 -0
  121. package/dist/src/formats/csv/exporter.d.ts.map +1 -0
  122. package/dist/src/formats/csv/exporter.js +682 -0
  123. package/dist/src/formats/csv/exporter.js.map +1 -0
  124. package/dist/src/formats/csv/header.d.ts +66 -0
  125. package/dist/src/formats/csv/header.d.ts.map +1 -0
  126. package/dist/src/formats/csv/header.js +152 -0
  127. package/dist/src/formats/csv/header.js.map +1 -0
  128. package/dist/src/formats/csv/importer.d.ts +82 -0
  129. package/dist/src/formats/csv/importer.d.ts.map +1 -0
  130. package/dist/src/formats/csv/importer.js +849 -0
  131. package/dist/src/formats/csv/importer.js.map +1 -0
  132. package/dist/src/formats/csv/index.d.ts +60 -0
  133. package/dist/src/formats/csv/index.d.ts.map +1 -0
  134. package/dist/src/formats/csv/index.js +63 -0
  135. package/dist/src/formats/csv/index.js.map +1 -0
  136. package/dist/src/formats/csv/records.d.ts +188 -0
  137. package/dist/src/formats/csv/records.d.ts.map +1 -0
  138. package/dist/src/formats/csv/records.js +702 -0
  139. package/dist/src/formats/csv/records.js.map +1 -0
  140. package/dist/src/formats/csv/values.d.ts +105 -0
  141. package/dist/src/formats/csv/values.d.ts.map +1 -0
  142. package/dist/src/formats/csv/values.js +192 -0
  143. package/dist/src/formats/csv/values.js.map +1 -0
  144. package/dist/src/formats/dot/exporter.d.ts +52 -0
  145. package/dist/src/formats/dot/exporter.d.ts.map +1 -0
  146. package/dist/src/formats/dot/exporter.js +836 -0
  147. package/dist/src/formats/dot/exporter.js.map +1 -0
  148. package/dist/src/formats/dot/importer.d.ts +102 -0
  149. package/dist/src/formats/dot/importer.d.ts.map +1 -0
  150. package/dist/src/formats/dot/importer.js +1291 -0
  151. package/dist/src/formats/dot/importer.js.map +1 -0
  152. package/dist/src/formats/dot/index.d.ts +7 -0
  153. package/dist/src/formats/dot/index.d.ts.map +1 -0
  154. package/dist/src/formats/dot/index.js +7 -0
  155. package/dist/src/formats/dot/index.js.map +1 -0
  156. package/dist/src/formats/dot/names.d.ts +29 -0
  157. package/dist/src/formats/dot/names.d.ts.map +1 -0
  158. package/dist/src/formats/dot/names.js +28 -0
  159. package/dist/src/formats/dot/names.js.map +1 -0
  160. package/dist/src/formats/dot/tokenizer.d.ts +114 -0
  161. package/dist/src/formats/dot/tokenizer.d.ts.map +1 -0
  162. package/dist/src/formats/dot/tokenizer.js +341 -0
  163. package/dist/src/formats/dot/tokenizer.js.map +1 -0
  164. package/dist/src/formats/gexf/exporter.d.ts +56 -0
  165. package/dist/src/formats/gexf/exporter.d.ts.map +1 -0
  166. package/dist/src/formats/gexf/exporter.js +1395 -0
  167. package/dist/src/formats/gexf/exporter.js.map +1 -0
  168. package/dist/src/formats/gexf/importer.d.ts +73 -0
  169. package/dist/src/formats/gexf/importer.d.ts.map +1 -0
  170. package/dist/src/formats/gexf/importer.js +1880 -0
  171. package/dist/src/formats/gexf/importer.js.map +1 -0
  172. package/dist/src/formats/gexf/index.d.ts +96 -0
  173. package/dist/src/formats/gexf/index.d.ts.map +1 -0
  174. package/dist/src/formats/gexf/index.js +97 -0
  175. package/dist/src/formats/gexf/index.js.map +1 -0
  176. package/dist/src/formats/gexf/schema.d.ts +135 -0
  177. package/dist/src/formats/gexf/schema.d.ts.map +1 -0
  178. package/dist/src/formats/gexf/schema.js +323 -0
  179. package/dist/src/formats/gexf/schema.js.map +1 -0
  180. package/dist/src/formats/gml/exporter.d.ts +69 -0
  181. package/dist/src/formats/gml/exporter.d.ts.map +1 -0
  182. package/dist/src/formats/gml/exporter.js +1093 -0
  183. package/dist/src/formats/gml/exporter.js.map +1 -0
  184. package/dist/src/formats/gml/importer.d.ts +66 -0
  185. package/dist/src/formats/gml/importer.d.ts.map +1 -0
  186. package/dist/src/formats/gml/importer.js +1331 -0
  187. package/dist/src/formats/gml/importer.js.map +1 -0
  188. package/dist/src/formats/gml/index.d.ts +85 -0
  189. package/dist/src/formats/gml/index.d.ts.map +1 -0
  190. package/dist/src/formats/gml/index.js +88 -0
  191. package/dist/src/formats/gml/index.js.map +1 -0
  192. package/dist/src/formats/gml/syntax.d.ts +186 -0
  193. package/dist/src/formats/gml/syntax.d.ts.map +1 -0
  194. package/dist/src/formats/gml/syntax.js +467 -0
  195. package/dist/src/formats/gml/syntax.js.map +1 -0
  196. package/dist/src/formats/graphml/constants.d.ts +169 -0
  197. package/dist/src/formats/graphml/constants.d.ts.map +1 -0
  198. package/dist/src/formats/graphml/constants.js +165 -0
  199. package/dist/src/formats/graphml/constants.js.map +1 -0
  200. package/dist/src/formats/graphml/exporter.d.ts +34 -0
  201. package/dist/src/formats/graphml/exporter.d.ts.map +1 -0
  202. package/dist/src/formats/graphml/exporter.js +1176 -0
  203. package/dist/src/formats/graphml/exporter.js.map +1 -0
  204. package/dist/src/formats/graphml/importer.d.ts +31 -0
  205. package/dist/src/formats/graphml/importer.d.ts.map +1 -0
  206. package/dist/src/formats/graphml/importer.js +1607 -0
  207. package/dist/src/formats/graphml/importer.js.map +1 -0
  208. package/dist/src/formats/graphml/index.d.ts +8 -0
  209. package/dist/src/formats/graphml/index.d.ts.map +1 -0
  210. package/dist/src/formats/graphml/index.js +8 -0
  211. package/dist/src/formats/graphml/index.js.map +1 -0
  212. package/dist/src/formats/graphml/tree.d.ts +72 -0
  213. package/dist/src/formats/graphml/tree.d.ts.map +1 -0
  214. package/dist/src/formats/graphml/tree.js +290 -0
  215. package/dist/src/formats/graphml/tree.js.map +1 -0
  216. package/dist/src/formats/json/dialect.d.ts +125 -0
  217. package/dist/src/formats/json/dialect.d.ts.map +1 -0
  218. package/dist/src/formats/json/dialect.js +262 -0
  219. package/dist/src/formats/json/dialect.js.map +1 -0
  220. package/dist/src/formats/json/exporter.d.ts +89 -0
  221. package/dist/src/formats/json/exporter.d.ts.map +1 -0
  222. package/dist/src/formats/json/exporter.js +1358 -0
  223. package/dist/src/formats/json/exporter.js.map +1 -0
  224. package/dist/src/formats/json/importer.d.ts +108 -0
  225. package/dist/src/formats/json/importer.d.ts.map +1 -0
  226. package/dist/src/formats/json/importer.js +1838 -0
  227. package/dist/src/formats/json/importer.js.map +1 -0
  228. package/dist/src/formats/json/index.d.ts +8 -0
  229. package/dist/src/formats/json/index.d.ts.map +1 -0
  230. package/dist/src/formats/json/index.js +8 -0
  231. package/dist/src/formats/json/index.js.map +1 -0
  232. package/dist/src/formats/neo4j/exporter.d.ts +68 -0
  233. package/dist/src/formats/neo4j/exporter.d.ts.map +1 -0
  234. package/dist/src/formats/neo4j/exporter.js +1055 -0
  235. package/dist/src/formats/neo4j/exporter.js.map +1 -0
  236. package/dist/src/formats/neo4j/header.d.ts +52 -0
  237. package/dist/src/formats/neo4j/header.d.ts.map +1 -0
  238. package/dist/src/formats/neo4j/header.js +131 -0
  239. package/dist/src/formats/neo4j/header.js.map +1 -0
  240. package/dist/src/formats/neo4j/importer.d.ts +73 -0
  241. package/dist/src/formats/neo4j/importer.d.ts.map +1 -0
  242. package/dist/src/formats/neo4j/importer.js +932 -0
  243. package/dist/src/formats/neo4j/importer.js.map +1 -0
  244. package/dist/src/formats/neo4j/index.d.ts +79 -0
  245. package/dist/src/formats/neo4j/index.d.ts.map +1 -0
  246. package/dist/src/formats/neo4j/index.js +83 -0
  247. package/dist/src/formats/neo4j/index.js.map +1 -0
  248. package/dist/src/formats/pajek/exporter.d.ts +58 -0
  249. package/dist/src/formats/pajek/exporter.d.ts.map +1 -0
  250. package/dist/src/formats/pajek/exporter.js +825 -0
  251. package/dist/src/formats/pajek/exporter.js.map +1 -0
  252. package/dist/src/formats/pajek/importer.d.ts +88 -0
  253. package/dist/src/formats/pajek/importer.d.ts.map +1 -0
  254. package/dist/src/formats/pajek/importer.js +1047 -0
  255. package/dist/src/formats/pajek/importer.js.map +1 -0
  256. package/dist/src/formats/pajek/index.d.ts +7 -0
  257. package/dist/src/formats/pajek/index.d.ts.map +1 -0
  258. package/dist/src/formats/pajek/index.js +7 -0
  259. package/dist/src/formats/pajek/index.js.map +1 -0
  260. package/dist/src/formats/pajek/syntax.d.ts +112 -0
  261. package/dist/src/formats/pajek/syntax.d.ts.map +1 -0
  262. package/dist/src/formats/pajek/syntax.js +269 -0
  263. package/dist/src/formats/pajek/syntax.js.map +1 -0
  264. package/dist/src/index.d.ts +35 -0
  265. package/dist/src/index.d.ts.map +1 -0
  266. package/dist/src/index.js +39 -0
  267. package/dist/src/index.js.map +1 -0
  268. package/dist/src/registry.d.ts +207 -0
  269. package/dist/src/registry.d.ts.map +1 -0
  270. package/dist/src/registry.js +481 -0
  271. package/dist/src/registry.js.map +1 -0
  272. package/dist/src/sniff.d.ts +104 -0
  273. package/dist/src/sniff.d.ts.map +1 -0
  274. package/dist/src/sniff.js +357 -0
  275. package/dist/src/sniff.js.map +1 -0
  276. package/dist/src/types.d.ts +238 -0
  277. package/dist/src/types.d.ts.map +1 -0
  278. package/dist/src/types.js +29 -0
  279. package/dist/src/types.js.map +1 -0
  280. package/dist/tsconfig.build.tsbuildinfo +1 -0
  281. package/package.json +122 -7
  282. package/src/children.ts +335 -0
  283. package/src/common/attributes.ts +520 -0
  284. package/src/common/codes.ts +153 -0
  285. package/src/common/declared-types.ts +374 -0
  286. package/src/common/direction.ts +518 -0
  287. package/src/common/escape.ts +231 -0
  288. package/src/common/export.ts +817 -0
  289. package/src/common/format.ts +111 -0
  290. package/src/common/ids.ts +176 -0
  291. package/src/common/input.ts +378 -0
  292. package/src/common/lists.ts +196 -0
  293. package/src/common/options.ts +377 -0
  294. package/src/common/report.ts +352 -0
  295. package/src/common/temporal.ts +302 -0
  296. package/src/common/text.ts +294 -0
  297. package/src/common/weights.ts +202 -0
  298. package/src/common/writer.ts +123 -0
  299. package/src/common/xml.ts +1053 -0
  300. package/src/formats/csv/exporter.ts +894 -0
  301. package/src/formats/csv/header.ts +172 -0
  302. package/src/formats/csv/importer.ts +1104 -0
  303. package/src/formats/csv/index.ts +88 -0
  304. package/src/formats/csv/records.ts +813 -0
  305. package/src/formats/csv/values.ts +224 -0
  306. package/src/formats/dot/exporter.ts +1014 -0
  307. package/src/formats/dot/importer.ts +1549 -0
  308. package/src/formats/dot/index.ts +7 -0
  309. package/src/formats/dot/names.ts +40 -0
  310. package/src/formats/dot/tokenizer.ts +384 -0
  311. package/src/formats/gexf/exporter.ts +1696 -0
  312. package/src/formats/gexf/importer.ts +2333 -0
  313. package/src/formats/gexf/index.ts +142 -0
  314. package/src/formats/gexf/schema.ts +361 -0
  315. package/src/formats/gml/exporter.ts +1404 -0
  316. package/src/formats/gml/importer.ts +1591 -0
  317. package/src/formats/gml/index.ts +128 -0
  318. package/src/formats/gml/syntax.ts +545 -0
  319. package/src/formats/graphml/constants.ts +225 -0
  320. package/src/formats/graphml/exporter.ts +1458 -0
  321. package/src/formats/graphml/importer.ts +2027 -0
  322. package/src/formats/graphml/index.ts +8 -0
  323. package/src/formats/graphml/tree.ts +318 -0
  324. package/src/formats/json/dialect.ts +317 -0
  325. package/src/formats/json/exporter.ts +1616 -0
  326. package/src/formats/json/importer.ts +2271 -0
  327. package/src/formats/json/index.ts +8 -0
  328. package/src/formats/neo4j/exporter.ts +1287 -0
  329. package/src/formats/neo4j/header.ts +156 -0
  330. package/src/formats/neo4j/importer.ts +1220 -0
  331. package/src/formats/neo4j/index.ts +116 -0
  332. package/src/formats/pajek/exporter.ts +1000 -0
  333. package/src/formats/pajek/importer.ts +1311 -0
  334. package/src/formats/pajek/index.ts +7 -0
  335. package/src/formats/pajek/syntax.ts +307 -0
  336. package/src/index.ts +244 -0
  337. package/src/registry.ts +617 -0
  338. package/src/sniff.ts +397 -0
  339. package/src/types.ts +262 -0
@@ -0,0 +1,165 @@
1
+ /**
2
+ * What the GraphML importer and exporter share: the namespace, the format facts, the reserved
3
+ * column names of the XML-attribute-derived columns (design section 5.6), the `meta.extra`
4
+ * keys the importer records for the exporter, and the issue and loss codes.
5
+ */
6
+ import { BAD_DEFAULT_CODE, COLUMN_RENAMED_CODE, COUNT_HINT_CODE, DIRECTION_FORCED_CODE, DIRECTION_REFUSED_CODE, DUPLICATE_EDGE_ID_CODE, DUPLICATE_KEY_CODE, DUPLICATE_NODE_CODE, HYPEREDGE_CODE, ID_MERGED_CODE, ID_TEXT_TYPE_CODE, INVALID_UTF8_CODE, MISSING_ENDPOINT_CODE, MISSING_ID_CODE, MIXED_DIRECTION_CODE, MULTIPLE_GRAPHS_CODE, MUTUAL_AS_UNDIRECTED_CODE, NO_GRAPH_CODE, OPTION_IGNORED_CODE, PARENTS_DROPPED_CODE, PRECISION_CODE, ROLE_DROPPED_CODE, ROLE_TAKEN_CODE, SINK_OPTION_CODE, STRAY_TEXT_CODE, UNKNOWN_ATTR_TYPE_CODE, UNKNOWN_ELEMENT_CODE, XML_SYNTAX_CODE, } from "../../common/codes.js";
7
+ /** The GraphML namespace. */
8
+ export const GRAPHML_NAMESPACE = "http://graphml.graphdrawing.org/xmlns";
9
+ /** The yFiles extension namespace, declared as `xmlns:y` when a yfiles column is written. */
10
+ export const YFILES_NAMESPACE = "http://www.yworks.com/xml/graphml";
11
+ /** The XML Schema instance namespace and the schema location the exporter writes. */
12
+ export const XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
13
+ /** The GraphML schema location written by the exporter. */
14
+ export const SCHEMA_LOCATION = "http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd";
15
+ /** The format name. */
16
+ export const FORMAT = "graphml";
17
+ /** File extensions. */
18
+ export const EXTENSIONS = Object.freeze([".graphml", ".xml"]);
19
+ /** MIME types. */
20
+ export const MIME_TYPES = Object.freeze(["application/graphml+xml", "application/xml", "text/xml"]);
21
+ /** The `attr.name` of the node key that carries ids rewritten by `sanitizeIds: "mangle"` (design section 8.5). */
22
+ export const ORIGINAL_ID_ATTRIBUTE = "graphty:originalId";
23
+ /** The node column that keeps original ids when `restoreMangledIds` is off (design section 5.6). */
24
+ export const ORIGINAL_ID_COLUMN = "graphty.originalId";
25
+ /** The edge column of the `id` XML attribute (role id, unique). */
26
+ export const EDGE_ID_COLUMN = "id";
27
+ /** The edge columns of the `sourceport` / `targetport` XML attributes (roles sourcePort / targetPort). */
28
+ export const SOURCE_PORT_COLUMN = "sourceport";
29
+ /** The edge column of the `targetport` XML attribute. */
30
+ export const TARGET_PORT_COLUMN = "targetport";
31
+ /** The node column of the containing node of a nested graph (u32, role parent, refersTo node). */
32
+ export const PARENT_COLUMN = "parent";
33
+ /** The bool node column marking the hub nodes synthesised for hyperedges under `hyperedges: "star"`. */
34
+ export const HYPEREDGE_HUB_COLUMN = "graphty.hyperedge";
35
+ /** The column name a node key titled `label` receives the `label` role under. */
36
+ export const LABEL_COLUMN = "label";
37
+ /** Edge column names reserved for the XML-attribute-derived columns; a key titled like one is renamed `<name>#<id>`. */
38
+ export const RESERVED_EDGE_NAMES = new Set([
39
+ EDGE_ID_COLUMN,
40
+ SOURCE_PORT_COLUMN,
41
+ TARGET_PORT_COLUMN,
42
+ ]);
43
+ /** Node column names reserved for the XML-derived columns. */
44
+ export const RESERVED_NODE_NAMES = new Set([PARENT_COLUMN]);
45
+ /** The `meta.extra` key under which the importer records what the exporter needs. */
46
+ export const META_KEY = "graphml";
47
+ /**
48
+ * The issue codes the GraphML importer records (design section 8.6), by name: the codes shared
49
+ * with the other importers (src/common/codes.ts) and the GraphML-specific ones. A key is the code
50
+ * without its severity and format prefixes.
51
+ */
52
+ export const GRAPHML_ISSUE = Object.freeze({
53
+ /** Fatal: the input is not well-formed XML. */
54
+ XML_SYNTAX: XML_SYNTAX_CODE,
55
+ /** Fatal: the input holds invalid UTF-8. */
56
+ INVALID_UTF8: INVALID_UTF8_CODE,
57
+ /** Fatal: the root element is not `<graphml>`. */
58
+ NOT_GRAPHML: "E_NOT_GRAPHML",
59
+ /** Fatal: the document has no `<graph>`. */
60
+ NO_GRAPH: NO_GRAPH_CODE,
61
+ /** A `<key>` without an id. */
62
+ KEY_MISSING_ID: "E_GRAPHML_KEY_MISSING_ID",
63
+ /** Two `<key>` elements with the same id. */
64
+ DUPLICATE_KEY: DUPLICATE_KEY_CODE,
65
+ /** A key declared for hyperedges, ports or endpoints (never used). */
66
+ KEY_DOMAIN_UNSUPPORTED: "W_GRAPHML_KEY_DOMAIN_UNSUPPORTED",
67
+ /** A `<node>` without an id. */
68
+ MISSING_ID: MISSING_ID_CODE,
69
+ /** An `<edge>` without a source or a target. */
70
+ MISSING_ENDPOINT: MISSING_ENDPOINT_CODE,
71
+ /** A `<data>` whose key was never declared. */
72
+ UNKNOWN_KEY: "E_GRAPHML_UNKNOWN_KEY",
73
+ /** A `<data>` whose key is declared for another domain. */
74
+ KEY_DOMAIN: "W_GRAPHML_KEY_DOMAIN",
75
+ /** A `<data>` without a key attribute. */
76
+ DATA_MISSING_KEY: "E_GRAPHML_DATA_MISSING_KEY",
77
+ /** A `<key>` whose `for` is not a GraphML domain. */
78
+ KEY_FOR_INVALID: "E_GRAPHML_KEY_FOR_INVALID",
79
+ /** Data of a nested `<graph>`; only the top-level graph has attributes. */
80
+ NESTED_GRAPH_DATA: "W_GRAPHML_NESTED_GRAPH_DATA",
81
+ /** Data of a hyperedge expanded to a star or clique. */
82
+ HYPEREDGE_DATA_DROPPED: "W_GRAPHML_HYPEREDGE_DATA_DROPPED",
83
+ /** Nested elements in the `<data>` of a typed (non-yfiles) key. */
84
+ DATA_NESTED: "E_GRAPHML_DATA_NESTED",
85
+ /** A `<node>` declared twice. */
86
+ DUPLICATE_NODE: DUPLICATE_NODE_CODE,
87
+ /** An edge id already used by another edge. */
88
+ DUPLICATE_EDGE_ID: DUPLICATE_EDGE_ID_CODE,
89
+ /** A `directed` attribute that is neither true nor false. */
90
+ INVALID_DIRECTED: "E_GRAPHML_INVALID_DIRECTED",
91
+ /** An `edgedefault` that is neither directed nor undirected. */
92
+ INVALID_EDGEDEFAULT: "E_GRAPHML_INVALID_EDGEDEFAULT",
93
+ /** A `<graph>` without edgedefault; the `defaultDirected` option applies. */
94
+ EDGEDEFAULT_MISSING: "W_GRAPHML_EDGEDEFAULT_MISSING",
95
+ /** A second top-level `<graph>`; its nodes and edges are merged into the first. */
96
+ MULTIPLE_GRAPHS: MULTIPLE_GRAPHS_CODE,
97
+ /** A `parse.nodes` / `parse.edges` hint the sink cannot reserve (ignored). */
98
+ COUNT_HINT: COUNT_HINT_CODE,
99
+ /** A hyperedge under `hyperedges: "error"`. */
100
+ HYPEREDGE: HYPEREDGE_CODE,
101
+ /** Hyperedges skipped under `hyperedges: "skip"`. */
102
+ HYPEREDGE_SKIPPED: "W_GRAPHML_HYPEREDGE_SKIPPED",
103
+ /** An endpoint of a hyperedge without a node, or with an unknown type. */
104
+ HYPEREDGE_ENDPOINT: "E_GRAPHML_HYPEREDGE_ENDPOINT",
105
+ /** `<port>` declarations (and their data) are not kept; sourceport / targetport edge attributes are. */
106
+ PORT_DECLARATION: "W_GRAPHML_PORT_DECLARATION",
107
+ /** A `<locator>` element. */
108
+ LOCATOR_DROPPED: "W_GRAPHML_LOCATOR_DROPPED",
109
+ /** A `<desc>` of a node, an edge or a hyperedge. */
110
+ DESC_DROPPED: "W_GRAPHML_DESC_DROPPED",
111
+ /** An element the GraphML schema does not define at that place. */
112
+ UNKNOWN_ELEMENT: UNKNOWN_ELEMENT_CODE,
113
+ /** Non-whitespace text where the schema allows only elements. */
114
+ STRAY_TEXT: STRAY_TEXT_CODE,
115
+ /** Two distinct id texts merged into one number under `ids: "number"`. */
116
+ ID_MERGED: ID_MERGED_CODE,
117
+ /** An option GraphML has no use for (`nodeIdFrom`: nodes are identified by their id attribute). */
118
+ OPTION_IGNORED: OPTION_IGNORED_CODE,
119
+ /** A yFiles key under `yfiles: "skip"`. */
120
+ YFILES_SKIPPED: "W_GRAPHML_YFILES_SKIPPED",
121
+ /** A key renamed `<name>#<id>` because the name was taken (design section 5.6). */
122
+ COLUMN_RENAMED: COLUMN_RENAMED_CODE,
123
+ /** A key declared without its role because the table already holds it. */
124
+ ROLE_TAKEN: ROLE_TAKEN_CODE,
125
+ /** A declared type the format does not define (kept as string). */
126
+ UNKNOWN_ATTR_TYPE: UNKNOWN_ATTR_TYPE_CODE,
127
+ /** A default that does not parse as the declared type. */
128
+ BAD_DEFAULT: BAD_DEFAULT_CODE,
129
+ /** A long value beyond 2^53 rounded. */
130
+ PRECISION: PRECISION_CODE,
131
+ /** A builder-policy option the sink does not honour. */
132
+ SINK_OPTION: SINK_OPTION_CODE,
133
+ /** The sink refused the file's direction. */
134
+ DIRECTION_REFUSED: DIRECTION_REFUSED_CODE,
135
+ /** Edges forced to the policy's direction. */
136
+ DIRECTION_FORCED: DIRECTION_FORCED_CODE,
137
+ /** A mixed file under onMixedDirection "error" (fatal). */
138
+ MIXED_DIRECTION: MIXED_DIRECTION_CODE,
139
+ });
140
+ /**
141
+ * Loss note codes of the GraphML importer (report.lossy) and exporter (check()): the GraphML
142
+ * ones; the generic ones (dtypes, lists, json text, positions, visual and temporal roles,
143
+ * extension tables, id charsets, the weight key clash, name changes) are those of `LOSS`.
144
+ */
145
+ export const GRAPHML_LOSS = Object.freeze({
146
+ /** yFiles nested XML kept as a JSON tree: structure preserved, not byte-exact. */
147
+ YFILES_JSON: "W_GRAPHML_YFILES_JSON",
148
+ /** A mutual pair written as one undirected edge; the mark is lost. */
149
+ MUTUAL_AS_UNDIRECTED: MUTUAL_AS_UNDIRECTED_CODE,
150
+ /** A `parents` (multi-parent) column cannot be written as nested graphs. */
151
+ PARENTS_DROPPED: PARENTS_DROPPED_CODE,
152
+ /** A role column GraphML has no slot for (kind, node ids, ...) written as a plain attribute. */
153
+ ROLE_DROPPED: ROLE_DROPPED_CODE,
154
+ /** Containment order differs from index order; node indices change after a round trip. */
155
+ HIERARCHY_REORDERED: "W_GRAPHML_HIERARCHY_REORDERED",
156
+ /** Nodes whose parent chain never reaches a root are written at the top level. */
157
+ PARENT_CYCLE: "W_GRAPHML_PARENT_CYCLE",
158
+ /** Node ids that change type after a round trip under the canonical rule (design section 4.1). */
159
+ ID_TEXT_TYPE: ID_TEXT_TYPE_CODE,
160
+ /** A numeric edge id column reads back as string. */
161
+ EDGE_ID_TEXT: "W_GRAPHML_EDGE_ID_TEXT",
162
+ /** A yfiles json value that is not a serialisable tree: export() will throw E_COLUMN_TYPE. */
163
+ YFILES_TREE: "E_GRAPHML_YFILES_TREE",
164
+ });
165
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/formats/graphml/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,GAClB,MAAM,uBAAuB,CAAC;AAE/B,6BAA6B;AAC7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AAEzE,6FAA6F;AAC7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;AAEpE,qFAAqF;AACrF,MAAM,CAAC,MAAM,aAAa,GAAG,2CAA2C,CAAC;AAEzE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GACxB,6FAA6F,CAAC;AAElG,uBAAuB;AACvB,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAEhC,uBAAuB;AACvB,MAAM,CAAC,MAAM,UAAU,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjF,kBAAkB;AAClB,MAAM,CAAC,MAAM,UAAU,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,yBAAyB,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;AAEvH,kHAAkH;AAClH,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAA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;IACxC,SAAS,EAAE,cAAc;IACzB,wDAAwD;IACxD,WAAW,EAAE,gBAAgB;IAC7B,6CAA6C;IAC7C,iBAAiB,EAAE,sBAAsB;IACzC,8CAA8C;IAC9C,gBAAgB,EAAE,qBAAqB;IACvC,2DAA2D;IAC3D,eAAe,EAAE,oBAAoB;CACxC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,kFAAkF;IAClF,WAAW,EAAE,uBAAuB;IACpC,sEAAsE;IACtE,oBAAoB,EAAE,yBAAyB;IAC/C,4EAA4E;IAC5E,eAAe,EAAE,oBAAoB;IACrC,gGAAgG;IAChG,YAAY,EAAE,iBAAiB;IAC/B,0FAA0F;IAC1F,mBAAmB,EAAE,+BAA+B;IACpD,kFAAkF;IAClF,YAAY,EAAE,wBAAwB;IACtC,kGAAkG;IAClG,YAAY,EAAE,iBAAiB;IAC/B,qDAAqD;IACrD,YAAY,EAAE,wBAAwB;IACtC,8FAA8F;IAC9F,WAAW,EAAE,uBAAuB;CACvC,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The GraphML exporter (design section 8.5; research note 07 section 9): `<key>` declarations
3
+ * regenerated from ColumnMeta.origin when the column came from GraphML (key id, attr.name,
4
+ * attr.type, yfiles.type) and derived from the dtype otherwise; node ids sanitised to NMTOKEN
5
+ * (`sanitizeIds: "error"` refuses, `"mangle"` rewrites and keeps the original in a
6
+ * `graphty:originalId` data attribute the importer restores); mixed direction written with
7
+ * `edgedefault` plus per-edge `directed` attributes, folding expanded pairs back through the
8
+ * `pair` / `directed` role columns; explicit weights only (the role-weight column's validity);
9
+ * containment (`parent` role) as nested graphs; yFiles json columns as nested XML again.
10
+ *
11
+ * check() lists every loss before anything is written: the generic capability gaps of
12
+ * checkCapabilities() (dict / u32 / u8 dtypes, lists, components, options, positions, visual and
13
+ * temporal roles, extension tables) plus the GraphML-specific ones (mutual edges written as
14
+ * undirected, json columns without a yfiles origin written as JSON text, multi-parent columns,
15
+ * containment order, ids that change type under the canonical rule, edge ids that read back as
16
+ * strings, roles GraphML cannot express, yfiles values that are not serialisable trees).
17
+ */
18
+ import { type GraphExporter } from "../../types.js";
19
+ /** The format-specific options of the GraphML exporter. */
20
+ export interface GraphmlExportOptions {
21
+ /** Indent nested elements (default true); false writes one element per line without indentation. */
22
+ pretty?: boolean | undefined;
23
+ /**
24
+ * The top-level `edgedefault`. By default the one the importer recorded in
25
+ * `meta.extra.graphml` (so a mixed file re-imports with the same edge layout), else the
26
+ * snapshot's direction, with the majority direction for a mixed snapshot.
27
+ */
28
+ edgedefault?: "directed" | "undirected" | undefined;
29
+ }
30
+ /**
31
+ * The GraphML exporter (design section 8.5).
32
+ */
33
+ export declare const graphmlExporter: GraphExporter<GraphmlExportOptions>;
34
+ //# sourceMappingURL=exporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../../src/formats/graphml/exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsBH,OAAO,EAAqD,KAAK,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AAqBtH,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACjC,oGAAoG;IACpG,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;CACvD;AAw0CD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,oBAAoB,CAiC9D,CAAC"}