@graphty/graph-io 0.3.24 → 0.3.26

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 (581) hide show
  1. package/README.md +49 -414
  2. package/dist/chunks/children-CL3Cy0ez.js.map +1 -1
  3. package/dist/chunks/choose-BbJI55dx.js +56 -0
  4. package/dist/chunks/choose-BbJI55dx.js.map +1 -0
  5. package/dist/chunks/constants-BCsFsMj4.js +231 -0
  6. package/dist/chunks/constants-BCsFsMj4.js.map +1 -0
  7. package/dist/chunks/{escape-B-tkk_Cl.js → escape-D0g6NNUy.js} +382 -92
  8. package/dist/chunks/escape-D0g6NNUy.js.map +1 -0
  9. package/dist/chunks/export-BTI4yQgy.js +4333 -0
  10. package/dist/chunks/export-BTI4yQgy.js.map +1 -0
  11. package/dist/chunks/exporter-BMqk5oxW.js +3465 -0
  12. package/dist/chunks/exporter-BMqk5oxW.js.map +1 -0
  13. package/dist/chunks/{importer-eUREhBGj.js → exporter-Cra2GYcN.js} +4969 -3201
  14. package/dist/chunks/exporter-Cra2GYcN.js.map +1 -0
  15. package/dist/chunks/{exporter-BGrsWamJ.js → exporter-Dxh231ZF.js} +38 -229
  16. package/dist/chunks/exporter-Dxh231ZF.js.map +1 -0
  17. package/dist/chunks/{exporter-DIeGJXAZ.js → exporter-tne475KK.js} +22 -20
  18. package/dist/chunks/exporter-tne475KK.js.map +1 -0
  19. package/dist/chunks/importer-90YWhJoF.js +2811 -0
  20. package/dist/chunks/importer-90YWhJoF.js.map +1 -0
  21. package/dist/chunks/{importer-D_e7e7LX.js → importer-Bcl1d4xH.js} +398 -145
  22. package/dist/chunks/importer-Bcl1d4xH.js.map +1 -0
  23. package/dist/chunks/{importer-BWY2FFc5.js → importer-BfIsp1f9.js} +255 -77
  24. package/dist/chunks/importer-BfIsp1f9.js.map +1 -0
  25. package/dist/chunks/{importer-zGLo8Dg_.js → importer-C_TEA1zJ.js} +484 -157
  26. package/dist/chunks/importer-C_TEA1zJ.js.map +1 -0
  27. package/dist/chunks/{importer-DET1tg6s.js → importer-DCjOvO7U.js} +1687 -310
  28. package/dist/chunks/importer-DCjOvO7U.js.map +1 -0
  29. package/dist/chunks/{importer-vi3bSdtw.js → importer-DfVu6j59.js} +509 -76
  30. package/dist/chunks/importer-DfVu6j59.js.map +1 -0
  31. package/dist/chunks/{importer-DIrbbnAf.js → importer-Dku_VAIY.js} +585 -226
  32. package/dist/chunks/importer-Dku_VAIY.js.map +1 -0
  33. package/dist/chunks/json-elements-3tnyt5uZ.js +1225 -0
  34. package/dist/chunks/json-elements-3tnyt5uZ.js.map +1 -0
  35. package/dist/chunks/ontology-export-B9Tcf37D.js +357 -0
  36. package/dist/chunks/ontology-export-B9Tcf37D.js.map +1 -0
  37. package/dist/chunks/{records-dbRkxwaq.js → records-CQXT__mY.js} +298 -114
  38. package/dist/chunks/records-CQXT__mY.js.map +1 -0
  39. package/dist/chunks/{text-Dr0Ifpag.js → text-DmcUs5_Q.js} +29 -11
  40. package/dist/chunks/text-DmcUs5_Q.js.map +1 -0
  41. package/dist/chunks/{writer-C7flM-Ih.js → writer-DxjgHwSe.js} +19 -1
  42. package/dist/chunks/writer-DxjgHwSe.js.map +1 -0
  43. package/dist/csv.js +951 -261
  44. package/dist/csv.js.map +1 -1
  45. package/dist/cx.js +6 -3
  46. package/dist/cx2.js +2 -2
  47. package/dist/cys.js +6 -3
  48. package/dist/dot.js +1 -1
  49. package/dist/gexf.js +554 -122
  50. package/dist/gexf.js.map +1 -1
  51. package/dist/gml.js +342 -85
  52. package/dist/gml.js.map +1 -1
  53. package/dist/graph-io.js +1105 -213
  54. package/dist/graph-io.js.map +1 -1
  55. package/dist/graphml.js +3 -2
  56. package/dist/graphml.js.map +1 -1
  57. package/dist/json.js +3 -2
  58. package/dist/neo4j.js +564 -157
  59. package/dist/neo4j.js.map +1 -1
  60. package/dist/obo.js +6 -3
  61. package/dist/pajek.js +1 -1
  62. package/dist/src/children.d.ts +18 -6
  63. package/dist/src/children.d.ts.map +1 -1
  64. package/dist/src/children.js +6 -3
  65. package/dist/src/children.js.map +1 -1
  66. package/dist/src/common/attributes.d.ts +29 -11
  67. package/dist/src/common/attributes.d.ts.map +1 -1
  68. package/dist/src/common/attributes.js +25 -7
  69. package/dist/src/common/attributes.js.map +1 -1
  70. package/dist/src/common/cell-budget.d.ts +9 -2
  71. package/dist/src/common/cell-budget.d.ts.map +1 -1
  72. package/dist/src/common/cell-budget.js +11 -3
  73. package/dist/src/common/cell-budget.js.map +1 -1
  74. package/dist/src/common/choose.d.ts +19 -0
  75. package/dist/src/common/choose.d.ts.map +1 -0
  76. package/dist/src/common/choose.js +72 -0
  77. package/dist/src/common/choose.js.map +1 -0
  78. package/dist/src/common/codes.d.ts +456 -66
  79. package/dist/src/common/codes.d.ts.map +1 -1
  80. package/dist/src/common/codes.js +458 -66
  81. package/dist/src/common/codes.js.map +1 -1
  82. package/dist/src/common/compare.d.ts +81 -0
  83. package/dist/src/common/compare.d.ts.map +1 -0
  84. package/dist/src/common/compare.js +394 -0
  85. package/dist/src/common/compare.js.map +1 -0
  86. package/dist/src/common/cx-export.d.ts +123 -0
  87. package/dist/src/common/cx-export.d.ts.map +1 -0
  88. package/dist/src/common/cx-export.js +334 -0
  89. package/dist/src/common/cx-export.js.map +1 -0
  90. package/dist/src/common/declared-types.d.ts +22 -2
  91. package/dist/src/common/declared-types.d.ts.map +1 -1
  92. package/dist/src/common/declared-types.js +19 -1
  93. package/dist/src/common/declared-types.js.map +1 -1
  94. package/dist/src/common/direction.d.ts +74 -50
  95. package/dist/src/common/direction.d.ts.map +1 -1
  96. package/dist/src/common/direction.js +47 -27
  97. package/dist/src/common/direction.js.map +1 -1
  98. package/dist/src/common/escape.d.ts +21 -9
  99. package/dist/src/common/escape.d.ts.map +1 -1
  100. package/dist/src/common/escape.js +33 -17
  101. package/dist/src/common/escape.js.map +1 -1
  102. package/dist/src/common/export.d.ts +144 -32
  103. package/dist/src/common/export.d.ts.map +1 -1
  104. package/dist/src/common/export.js +216 -42
  105. package/dist/src/common/export.js.map +1 -1
  106. package/dist/src/common/format.d.ts +23 -1
  107. package/dist/src/common/format.d.ts.map +1 -1
  108. package/dist/src/common/format.js +26 -1
  109. package/dist/src/common/format.js.map +1 -1
  110. package/dist/src/common/ids.d.ts +9 -2
  111. package/dist/src/common/ids.d.ts.map +1 -1
  112. package/dist/src/common/ids.js +6 -2
  113. package/dist/src/common/ids.js.map +1 -1
  114. package/dist/src/common/input.d.ts +122 -28
  115. package/dist/src/common/input.d.ts.map +1 -1
  116. package/dist/src/common/input.js +890 -124
  117. package/dist/src/common/input.js.map +1 -1
  118. package/dist/src/common/json-elements.d.ts +144 -20
  119. package/dist/src/common/json-elements.d.ts.map +1 -1
  120. package/dist/src/common/json-elements.js +868 -188
  121. package/dist/src/common/json-elements.js.map +1 -1
  122. package/dist/src/common/line-format.d.ts +90 -0
  123. package/dist/src/common/line-format.d.ts.map +1 -0
  124. package/dist/src/common/line-format.js +185 -0
  125. package/dist/src/common/line-format.js.map +1 -0
  126. package/dist/src/common/lists.d.ts +6 -1
  127. package/dist/src/common/lists.d.ts.map +1 -1
  128. package/dist/src/common/lists.js +2 -0
  129. package/dist/src/common/lists.js.map +1 -1
  130. package/dist/src/common/ontology-export.d.ts +167 -0
  131. package/dist/src/common/ontology-export.d.ts.map +1 -0
  132. package/dist/src/common/ontology-export.js +359 -0
  133. package/dist/src/common/ontology-export.js.map +1 -0
  134. package/dist/src/common/ontology.d.ts +25 -3
  135. package/dist/src/common/ontology.d.ts.map +1 -1
  136. package/dist/src/common/ontology.js +30 -9
  137. package/dist/src/common/ontology.js.map +1 -1
  138. package/dist/src/common/options.d.ts +62 -12
  139. package/dist/src/common/options.d.ts.map +1 -1
  140. package/dist/src/common/options.js +89 -11
  141. package/dist/src/common/options.js.map +1 -1
  142. package/dist/src/common/plural.d.ts +31 -0
  143. package/dist/src/common/plural.d.ts.map +1 -0
  144. package/dist/src/common/plural.js +46 -0
  145. package/dist/src/common/plural.js.map +1 -0
  146. package/dist/src/common/report.d.ts +72 -14
  147. package/dist/src/common/report.d.ts.map +1 -1
  148. package/dist/src/common/report.js +146 -22
  149. package/dist/src/common/report.js.map +1 -1
  150. package/dist/src/common/temporal.d.ts +22 -5
  151. package/dist/src/common/temporal.d.ts.map +1 -1
  152. package/dist/src/common/temporal.js +13 -2
  153. package/dist/src/common/temporal.js.map +1 -1
  154. package/dist/src/common/text.d.ts +39 -23
  155. package/dist/src/common/text.d.ts.map +1 -1
  156. package/dist/src/common/text.js +51 -21
  157. package/dist/src/common/text.js.map +1 -1
  158. package/dist/src/common/weights.d.ts +37 -4
  159. package/dist/src/common/weights.d.ts.map +1 -1
  160. package/dist/src/common/weights.js +61 -2
  161. package/dist/src/common/weights.js.map +1 -1
  162. package/dist/src/common/writer.d.ts +19 -3
  163. package/dist/src/common/writer.d.ts.map +1 -1
  164. package/dist/src/common/writer.js +30 -2
  165. package/dist/src/common/writer.js.map +1 -1
  166. package/dist/src/common/xml.d.ts +125 -9
  167. package/dist/src/common/xml.d.ts.map +1 -1
  168. package/dist/src/common/xml.js +400 -83
  169. package/dist/src/common/xml.js.map +1 -1
  170. package/dist/src/common/zip.d.ts +44 -4
  171. package/dist/src/common/zip.d.ts.map +1 -1
  172. package/dist/src/common/zip.js +134 -5
  173. package/dist/src/common/zip.js.map +1 -1
  174. package/dist/src/formats/csv/exporter.d.ts +80 -24
  175. package/dist/src/formats/csv/exporter.d.ts.map +1 -1
  176. package/dist/src/formats/csv/exporter.js +145 -32
  177. package/dist/src/formats/csv/exporter.js.map +1 -1
  178. package/dist/src/formats/csv/header.d.ts +38 -9
  179. package/dist/src/formats/csv/header.d.ts.map +1 -1
  180. package/dist/src/formats/csv/header.js +46 -10
  181. package/dist/src/formats/csv/header.js.map +1 -1
  182. package/dist/src/formats/csv/importer.d.ts +187 -37
  183. package/dist/src/formats/csv/importer.d.ts.map +1 -1
  184. package/dist/src/formats/csv/importer.js +835 -204
  185. package/dist/src/formats/csv/importer.js.map +1 -1
  186. package/dist/src/formats/csv/index.d.ts +100 -19
  187. package/dist/src/formats/csv/index.d.ts.map +1 -1
  188. package/dist/src/formats/csv/index.js +94 -21
  189. package/dist/src/formats/csv/index.js.map +1 -1
  190. package/dist/src/formats/csv/records.d.ts +95 -10
  191. package/dist/src/formats/csv/records.d.ts.map +1 -1
  192. package/dist/src/formats/csv/records.js +333 -122
  193. package/dist/src/formats/csv/records.js.map +1 -1
  194. package/dist/src/formats/csv/values.d.ts +1 -0
  195. package/dist/src/formats/csv/values.d.ts.map +1 -1
  196. package/dist/src/formats/csv/values.js +1 -0
  197. package/dist/src/formats/csv/values.js.map +1 -1
  198. package/dist/src/formats/cx/exporter.d.ts +102 -0
  199. package/dist/src/formats/cx/exporter.d.ts.map +1 -0
  200. package/dist/src/formats/cx/exporter.js +1217 -0
  201. package/dist/src/formats/cx/exporter.js.map +1 -0
  202. package/dist/src/formats/cx/importer.d.ts +79 -32
  203. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  204. package/dist/src/formats/cx/importer.js +680 -285
  205. package/dist/src/formats/cx/importer.js.map +1 -1
  206. package/dist/src/formats/cx/index.d.ts +4 -3
  207. package/dist/src/formats/cx/index.d.ts.map +1 -1
  208. package/dist/src/formats/cx/index.js +4 -3
  209. package/dist/src/formats/cx/index.js.map +1 -1
  210. package/dist/src/formats/cx2/exporter.d.ts +29 -11
  211. package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
  212. package/dist/src/formats/cx2/exporter.js +39 -268
  213. package/dist/src/formats/cx2/exporter.js.map +1 -1
  214. package/dist/src/formats/cx2/importer.d.ts +78 -28
  215. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  216. package/dist/src/formats/cx2/importer.js +226 -79
  217. package/dist/src/formats/cx2/importer.js.map +1 -1
  218. package/dist/src/formats/cx2/index.d.ts +2 -1
  219. package/dist/src/formats/cx2/index.d.ts.map +1 -1
  220. package/dist/src/formats/cx2/index.js +2 -1
  221. package/dist/src/formats/cx2/index.js.map +1 -1
  222. package/dist/src/formats/cys/constants.d.ts +66 -17
  223. package/dist/src/formats/cys/constants.d.ts.map +1 -1
  224. package/dist/src/formats/cys/constants.js +59 -18
  225. package/dist/src/formats/cys/constants.js.map +1 -1
  226. package/dist/src/formats/cys/exporter.d.ts +118 -0
  227. package/dist/src/formats/cys/exporter.d.ts.map +1 -0
  228. package/dist/src/formats/cys/exporter.js +1072 -0
  229. package/dist/src/formats/cys/exporter.js.map +1 -0
  230. package/dist/src/formats/cys/importer.d.ts +22 -8
  231. package/dist/src/formats/cys/importer.d.ts.map +1 -1
  232. package/dist/src/formats/cys/importer.js +510 -149
  233. package/dist/src/formats/cys/importer.js.map +1 -1
  234. package/dist/src/formats/cys/index.d.ts +4 -2
  235. package/dist/src/formats/cys/index.d.ts.map +1 -1
  236. package/dist/src/formats/cys/index.js +4 -2
  237. package/dist/src/formats/cys/index.js.map +1 -1
  238. package/dist/src/formats/cys/session.d.ts +46 -7
  239. package/dist/src/formats/cys/session.d.ts.map +1 -1
  240. package/dist/src/formats/cys/session.js +98 -24
  241. package/dist/src/formats/cys/session.js.map +1 -1
  242. package/dist/src/formats/cys/tables.d.ts +9 -2
  243. package/dist/src/formats/cys/tables.d.ts.map +1 -1
  244. package/dist/src/formats/cys/tables.js +29 -7
  245. package/dist/src/formats/cys/tables.js.map +1 -1
  246. package/dist/src/formats/dot/exporter.d.ts +42 -14
  247. package/dist/src/formats/dot/exporter.d.ts.map +1 -1
  248. package/dist/src/formats/dot/exporter.js +56 -29
  249. package/dist/src/formats/dot/exporter.js.map +1 -1
  250. package/dist/src/formats/dot/importer.d.ts +91 -29
  251. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  252. package/dist/src/formats/dot/importer.js +190 -39
  253. package/dist/src/formats/dot/importer.js.map +1 -1
  254. package/dist/src/formats/dot/index.d.ts +2 -1
  255. package/dist/src/formats/dot/index.d.ts.map +1 -1
  256. package/dist/src/formats/dot/index.js +2 -1
  257. package/dist/src/formats/dot/index.js.map +1 -1
  258. package/dist/src/formats/dot/names.d.ts +44 -11
  259. package/dist/src/formats/dot/names.d.ts.map +1 -1
  260. package/dist/src/formats/dot/names.js +44 -11
  261. package/dist/src/formats/dot/names.js.map +1 -1
  262. package/dist/src/formats/dot/tokenizer.d.ts +9 -2
  263. package/dist/src/formats/dot/tokenizer.d.ts.map +1 -1
  264. package/dist/src/formats/dot/tokenizer.js +20 -5
  265. package/dist/src/formats/dot/tokenizer.js.map +1 -1
  266. package/dist/src/formats/gexf/exporter.d.ts +46 -15
  267. package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
  268. package/dist/src/formats/gexf/exporter.js +45 -15
  269. package/dist/src/formats/gexf/exporter.js.map +1 -1
  270. package/dist/src/formats/gexf/importer.d.ts +87 -23
  271. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  272. package/dist/src/formats/gexf/importer.js +471 -90
  273. package/dist/src/formats/gexf/importer.js.map +1 -1
  274. package/dist/src/formats/gexf/index.d.ts +84 -21
  275. package/dist/src/formats/gexf/index.d.ts.map +1 -1
  276. package/dist/src/formats/gexf/index.js +80 -23
  277. package/dist/src/formats/gexf/index.js.map +1 -1
  278. package/dist/src/formats/gexf/schema.d.ts +67 -15
  279. package/dist/src/formats/gexf/schema.d.ts.map +1 -1
  280. package/dist/src/formats/gexf/schema.js +59 -13
  281. package/dist/src/formats/gexf/schema.js.map +1 -1
  282. package/dist/src/formats/gml/exporter.d.ts +69 -21
  283. package/dist/src/formats/gml/exporter.d.ts.map +1 -1
  284. package/dist/src/formats/gml/exporter.js +74 -29
  285. package/dist/src/formats/gml/exporter.js.map +1 -1
  286. package/dist/src/formats/gml/importer.d.ts +116 -25
  287. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  288. package/dist/src/formats/gml/importer.js +290 -61
  289. package/dist/src/formats/gml/importer.js.map +1 -1
  290. package/dist/src/formats/gml/index.d.ts +87 -24
  291. package/dist/src/formats/gml/index.d.ts.map +1 -1
  292. package/dist/src/formats/gml/index.js +79 -26
  293. package/dist/src/formats/gml/index.js.map +1 -1
  294. package/dist/src/formats/gml/syntax.d.ts +67 -18
  295. package/dist/src/formats/gml/syntax.d.ts.map +1 -1
  296. package/dist/src/formats/gml/syntax.js +108 -26
  297. package/dist/src/formats/gml/syntax.js.map +1 -1
  298. package/dist/src/formats/graphml/constants.d.ts +174 -44
  299. package/dist/src/formats/graphml/constants.d.ts.map +1 -1
  300. package/dist/src/formats/graphml/constants.js +165 -44
  301. package/dist/src/formats/graphml/constants.js.map +1 -1
  302. package/dist/src/formats/graphml/exporter.d.ts +17 -9
  303. package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
  304. package/dist/src/formats/graphml/exporter.js +33 -12
  305. package/dist/src/formats/graphml/exporter.js.map +1 -1
  306. package/dist/src/formats/graphml/importer.d.ts +19 -7
  307. package/dist/src/formats/graphml/importer.d.ts.map +1 -1
  308. package/dist/src/formats/graphml/importer.js +466 -39
  309. package/dist/src/formats/graphml/importer.js.map +1 -1
  310. package/dist/src/formats/graphml/index.d.ts +2 -1
  311. package/dist/src/formats/graphml/index.d.ts.map +1 -1
  312. package/dist/src/formats/graphml/index.js +2 -1
  313. package/dist/src/formats/graphml/index.js.map +1 -1
  314. package/dist/src/formats/graphml/tree.d.ts +6 -2
  315. package/dist/src/formats/graphml/tree.d.ts.map +1 -1
  316. package/dist/src/formats/graphml/tree.js +6 -2
  317. package/dist/src/formats/graphml/tree.js.map +1 -1
  318. package/dist/src/formats/graphml/yfiles.d.ts +8 -3
  319. package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
  320. package/dist/src/formats/graphml/yfiles.js +36 -15
  321. package/dist/src/formats/graphml/yfiles.js.map +1 -1
  322. package/dist/src/formats/json/dialect.d.ts +88 -24
  323. package/dist/src/formats/json/dialect.d.ts.map +1 -1
  324. package/dist/src/formats/json/dialect.js +109 -19
  325. package/dist/src/formats/json/dialect.js.map +1 -1
  326. package/dist/src/formats/json/exporter.d.ts +134 -22
  327. package/dist/src/formats/json/exporter.d.ts.map +1 -1
  328. package/dist/src/formats/json/exporter.js +135 -54
  329. package/dist/src/formats/json/exporter.js.map +1 -1
  330. package/dist/src/formats/json/importer.d.ts +173 -52
  331. package/dist/src/formats/json/importer.d.ts.map +1 -1
  332. package/dist/src/formats/json/importer.js +899 -220
  333. package/dist/src/formats/json/importer.js.map +1 -1
  334. package/dist/src/formats/json/index.d.ts +3 -2
  335. package/dist/src/formats/json/index.d.ts.map +1 -1
  336. package/dist/src/formats/json/index.js +3 -2
  337. package/dist/src/formats/json/index.js.map +1 -1
  338. package/dist/src/formats/json/obographs-export.d.ts +68 -0
  339. package/dist/src/formats/json/obographs-export.d.ts.map +1 -0
  340. package/dist/src/formats/json/obographs-export.js +941 -0
  341. package/dist/src/formats/json/obographs-export.js.map +1 -0
  342. package/dist/src/formats/json/obographs.d.ts +26 -0
  343. package/dist/src/formats/json/obographs.d.ts.map +1 -1
  344. package/dist/src/formats/json/obographs.js +297 -80
  345. package/dist/src/formats/json/obographs.js.map +1 -1
  346. package/dist/src/formats/neo4j/exporter.d.ts +109 -21
  347. package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
  348. package/dist/src/formats/neo4j/exporter.js +238 -85
  349. package/dist/src/formats/neo4j/exporter.js.map +1 -1
  350. package/dist/src/formats/neo4j/header.d.ts +17 -4
  351. package/dist/src/formats/neo4j/header.d.ts.map +1 -1
  352. package/dist/src/formats/neo4j/header.js +36 -4
  353. package/dist/src/formats/neo4j/header.js.map +1 -1
  354. package/dist/src/formats/neo4j/importer.d.ts +107 -27
  355. package/dist/src/formats/neo4j/importer.d.ts.map +1 -1
  356. package/dist/src/formats/neo4j/importer.js +415 -63
  357. package/dist/src/formats/neo4j/importer.js.map +1 -1
  358. package/dist/src/formats/neo4j/index.d.ts +73 -23
  359. package/dist/src/formats/neo4j/index.d.ts.map +1 -1
  360. package/dist/src/formats/neo4j/index.js +65 -25
  361. package/dist/src/formats/neo4j/index.js.map +1 -1
  362. package/dist/src/formats/obo/exporter.d.ts +150 -0
  363. package/dist/src/formats/obo/exporter.d.ts.map +1 -0
  364. package/dist/src/formats/obo/exporter.js +1736 -0
  365. package/dist/src/formats/obo/exporter.js.map +1 -0
  366. package/dist/src/formats/obo/importer.d.ts +95 -19
  367. package/dist/src/formats/obo/importer.d.ts.map +1 -1
  368. package/dist/src/formats/obo/importer.js +475 -104
  369. package/dist/src/formats/obo/importer.js.map +1 -1
  370. package/dist/src/formats/obo/index.d.ts +6 -3
  371. package/dist/src/formats/obo/index.d.ts.map +1 -1
  372. package/dist/src/formats/obo/index.js +6 -3
  373. package/dist/src/formats/obo/index.js.map +1 -1
  374. package/dist/src/formats/obo/syntax.d.ts +108 -4
  375. package/dist/src/formats/obo/syntax.d.ts.map +1 -1
  376. package/dist/src/formats/obo/syntax.js +211 -34
  377. package/dist/src/formats/obo/syntax.js.map +1 -1
  378. package/dist/src/formats/pajek/exporter.d.ts +54 -16
  379. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  380. package/dist/src/formats/pajek/exporter.js +66 -34
  381. package/dist/src/formats/pajek/exporter.js.map +1 -1
  382. package/dist/src/formats/pajek/importer.d.ts +84 -22
  383. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  384. package/dist/src/formats/pajek/importer.js +303 -83
  385. package/dist/src/formats/pajek/importer.js.map +1 -1
  386. package/dist/src/formats/pajek/index.d.ts +2 -1
  387. package/dist/src/formats/pajek/index.d.ts.map +1 -1
  388. package/dist/src/formats/pajek/index.js +2 -1
  389. package/dist/src/formats/pajek/index.js.map +1 -1
  390. package/dist/src/formats/pajek/syntax.d.ts +77 -14
  391. package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
  392. package/dist/src/formats/pajek/syntax.js +183 -51
  393. package/dist/src/formats/pajek/syntax.js.map +1 -1
  394. package/dist/src/formats/xgmml/columns.d.ts +1 -0
  395. package/dist/src/formats/xgmml/columns.d.ts.map +1 -1
  396. package/dist/src/formats/xgmml/columns.js +4 -0
  397. package/dist/src/formats/xgmml/columns.js.map +1 -1
  398. package/dist/src/formats/xgmml/constants.d.ts +186 -56
  399. package/dist/src/formats/xgmml/constants.d.ts.map +1 -1
  400. package/dist/src/formats/xgmml/constants.js +181 -57
  401. package/dist/src/formats/xgmml/constants.js.map +1 -1
  402. package/dist/src/formats/xgmml/document.d.ts +65 -11
  403. package/dist/src/formats/xgmml/document.d.ts.map +1 -1
  404. package/dist/src/formats/xgmml/document.js +157 -28
  405. package/dist/src/formats/xgmml/document.js.map +1 -1
  406. package/dist/src/formats/xgmml/emit.d.ts +61 -3
  407. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  408. package/dist/src/formats/xgmml/emit.js +129 -26
  409. package/dist/src/formats/xgmml/emit.js.map +1 -1
  410. package/dist/src/formats/xgmml/exporter.d.ts +13 -6
  411. package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
  412. package/dist/src/formats/xgmml/exporter.js +20 -21
  413. package/dist/src/formats/xgmml/exporter.js.map +1 -1
  414. package/dist/src/formats/xgmml/importer.d.ts +33 -12
  415. package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
  416. package/dist/src/formats/xgmml/importer.js +35 -72
  417. package/dist/src/formats/xgmml/importer.js.map +1 -1
  418. package/dist/src/formats/xgmml/index.d.ts +1 -0
  419. package/dist/src/formats/xgmml/index.d.ts.map +1 -1
  420. package/dist/src/formats/xgmml/index.js +1 -0
  421. package/dist/src/formats/xgmml/index.js.map +1 -1
  422. package/dist/src/formats/xgmml/values.d.ts +8 -1
  423. package/dist/src/formats/xgmml/values.d.ts.map +1 -1
  424. package/dist/src/formats/xgmml/values.js +7 -2
  425. package/dist/src/formats/xgmml/values.js.map +1 -1
  426. package/dist/src/index.d.ts +23 -18
  427. package/dist/src/index.d.ts.map +1 -1
  428. package/dist/src/index.js +28 -16
  429. package/dist/src/index.js.map +1 -1
  430. package/dist/src/registry.d.ts +478 -92
  431. package/dist/src/registry.d.ts.map +1 -1
  432. package/dist/src/registry.js +807 -88
  433. package/dist/src/registry.js.map +1 -1
  434. package/dist/src/sniff.d.ts +61 -19
  435. package/dist/src/sniff.d.ts.map +1 -1
  436. package/dist/src/sniff.js +121 -29
  437. package/dist/src/sniff.js.map +1 -1
  438. package/dist/src/types.d.ts +362 -112
  439. package/dist/src/types.d.ts.map +1 -1
  440. package/dist/src/types.js +28 -7
  441. package/dist/src/types.js.map +1 -1
  442. package/dist/xgmml.js +2 -2
  443. package/docs/samples/README.md +25 -0
  444. package/docs/samples/got-edges.csv +353 -0
  445. package/docs/samples/got-network.graphml +1384 -0
  446. package/docs/samples/got-nodes.csv +108 -0
  447. package/docs/samples/got.cx +930 -0
  448. package/docs/samples/got.cx2 +465 -0
  449. package/docs/samples/got.gexf +471 -0
  450. package/docs/samples/got.gml +2650 -0
  451. package/docs/samples/got.json +2546 -0
  452. package/docs/samples/got.net +461 -0
  453. package/docs/samples/movies-nodes.csv +9 -0
  454. package/docs/samples/movies-rels.csv +8 -0
  455. package/docs/samples/networks.cys +0 -0
  456. package/docs/samples/proteins.xgmml +9 -0
  457. package/docs/samples/teams.gv +24 -0
  458. package/docs/samples/vehicles.obo +25 -0
  459. package/package.json +9 -4
  460. package/src/children.ts +18 -6
  461. package/src/common/attributes.ts +29 -11
  462. package/src/common/cell-budget.ts +11 -3
  463. package/src/common/choose.ts +89 -0
  464. package/src/common/codes.ts +490 -66
  465. package/src/common/compare.ts +472 -0
  466. package/src/common/cx-export.ts +432 -0
  467. package/src/common/declared-types.ts +38 -4
  468. package/src/common/direction.ts +78 -51
  469. package/src/common/escape.ts +33 -17
  470. package/src/common/export.ts +284 -47
  471. package/src/common/format.ts +30 -1
  472. package/src/common/ids.ts +14 -3
  473. package/src/common/input.ts +1057 -134
  474. package/src/common/json-elements.ts +1034 -198
  475. package/src/common/line-format.ts +249 -0
  476. package/src/common/lists.ts +6 -1
  477. package/src/common/ontology-export.ts +461 -0
  478. package/src/common/ontology.ts +31 -9
  479. package/src/common/options.ts +110 -15
  480. package/src/common/plural.ts +49 -0
  481. package/src/common/report.ts +168 -25
  482. package/src/common/temporal.ts +22 -5
  483. package/src/common/text.ts +62 -23
  484. package/src/common/weights.ts +74 -4
  485. package/src/common/writer.ts +37 -3
  486. package/src/common/xml.ts +477 -88
  487. package/src/common/zip.ts +169 -7
  488. package/src/formats/csv/exporter.ts +201 -46
  489. package/src/formats/csv/header.ts +50 -11
  490. package/src/formats/csv/importer.ts +1133 -245
  491. package/src/formats/csv/index.ts +106 -19
  492. package/src/formats/csv/records.ts +396 -122
  493. package/src/formats/csv/values.ts +1 -0
  494. package/src/formats/cx/exporter.ts +1483 -0
  495. package/src/formats/cx/importer.ts +888 -300
  496. package/src/formats/cx/index.ts +4 -3
  497. package/src/formats/cx2/exporter.ts +61 -338
  498. package/src/formats/cx2/importer.ts +317 -86
  499. package/src/formats/cx2/index.ts +2 -1
  500. package/src/formats/cys/constants.ts +62 -17
  501. package/src/formats/cys/exporter.ts +1368 -0
  502. package/src/formats/cys/importer.ts +659 -157
  503. package/src/formats/cys/index.ts +4 -2
  504. package/src/formats/cys/session.ts +139 -31
  505. package/src/formats/cys/tables.ts +47 -9
  506. package/src/formats/dot/exporter.ts +83 -37
  507. package/src/formats/dot/importer.ts +248 -54
  508. package/src/formats/dot/index.ts +2 -1
  509. package/src/formats/dot/names.ts +44 -11
  510. package/src/formats/dot/tokenizer.ts +25 -6
  511. package/src/formats/gexf/exporter.ts +57 -18
  512. package/src/formats/gexf/importer.ts +636 -105
  513. package/src/formats/gexf/index.ts +90 -21
  514. package/src/formats/gexf/schema.ts +67 -15
  515. package/src/formats/gml/exporter.ts +90 -36
  516. package/src/formats/gml/importer.ts +388 -67
  517. package/src/formats/gml/index.ts +85 -24
  518. package/src/formats/gml/syntax.ts +111 -26
  519. package/src/formats/graphml/constants.ts +178 -44
  520. package/src/formats/graphml/exporter.ts +52 -18
  521. package/src/formats/graphml/importer.ts +640 -60
  522. package/src/formats/graphml/index.ts +2 -1
  523. package/src/formats/graphml/tree.ts +6 -2
  524. package/src/formats/graphml/yfiles.ts +37 -15
  525. package/src/formats/json/dialect.ts +128 -29
  526. package/src/formats/json/exporter.ts +205 -68
  527. package/src/formats/json/importer.ts +1163 -253
  528. package/src/formats/json/index.ts +3 -1
  529. package/src/formats/json/obographs-export.ts +1197 -0
  530. package/src/formats/json/obographs.ts +353 -92
  531. package/src/formats/neo4j/exporter.ts +320 -101
  532. package/src/formats/neo4j/header.ts +44 -6
  533. package/src/formats/neo4j/importer.ts +512 -73
  534. package/src/formats/neo4j/index.ts +75 -23
  535. package/src/formats/obo/exporter.ts +2210 -0
  536. package/src/formats/obo/importer.ts +622 -109
  537. package/src/formats/obo/index.ts +6 -3
  538. package/src/formats/obo/syntax.ts +232 -37
  539. package/src/formats/pajek/exporter.ts +89 -41
  540. package/src/formats/pajek/importer.ts +407 -93
  541. package/src/formats/pajek/index.ts +2 -1
  542. package/src/formats/pajek/syntax.ts +213 -52
  543. package/src/formats/xgmml/columns.ts +10 -0
  544. package/src/formats/xgmml/constants.ts +183 -56
  545. package/src/formats/xgmml/document.ts +212 -34
  546. package/src/formats/xgmml/emit.ts +175 -34
  547. package/src/formats/xgmml/exporter.ts +35 -27
  548. package/src/formats/xgmml/importer.ts +64 -86
  549. package/src/formats/xgmml/index.ts +1 -0
  550. package/src/formats/xgmml/values.ts +11 -3
  551. package/src/index.ts +81 -11
  552. package/src/registry.ts +1121 -135
  553. package/src/sniff.ts +163 -32
  554. package/src/types.ts +385 -114
  555. package/dist/chunks/escape-B-tkk_Cl.js.map +0 -1
  556. package/dist/chunks/export-Bh60Dv-n.js +0 -582
  557. package/dist/chunks/export-Bh60Dv-n.js.map +0 -1
  558. package/dist/chunks/exporter-BGrsWamJ.js.map +0 -1
  559. package/dist/chunks/exporter-DIeGJXAZ.js.map +0 -1
  560. package/dist/chunks/importer-BWY2FFc5.js.map +0 -1
  561. package/dist/chunks/importer-DD-xv9_Y.js +0 -1471
  562. package/dist/chunks/importer-DD-xv9_Y.js.map +0 -1
  563. package/dist/chunks/importer-DET1tg6s.js.map +0 -1
  564. package/dist/chunks/importer-DEcKhsmQ.js +0 -1614
  565. package/dist/chunks/importer-DEcKhsmQ.js.map +0 -1
  566. package/dist/chunks/importer-DIrbbnAf.js.map +0 -1
  567. package/dist/chunks/importer-D_e7e7LX.js.map +0 -1
  568. package/dist/chunks/importer-eUREhBGj.js.map +0 -1
  569. package/dist/chunks/importer-vi3bSdtw.js.map +0 -1
  570. package/dist/chunks/importer-zGLo8Dg_.js.map +0 -1
  571. package/dist/chunks/json-elements-DDS8N2Dd.js +0 -779
  572. package/dist/chunks/json-elements-DDS8N2Dd.js.map +0 -1
  573. package/dist/chunks/ontology-BnrJ4I98.js +0 -113
  574. package/dist/chunks/ontology-BnrJ4I98.js.map +0 -1
  575. package/dist/chunks/records-dbRkxwaq.js.map +0 -1
  576. package/dist/chunks/report-B1z4WT9e.js +0 -2372
  577. package/dist/chunks/report-B1z4WT9e.js.map +0 -1
  578. package/dist/chunks/text-Dr0Ifpag.js.map +0 -1
  579. package/dist/chunks/weights-Dzba96G3.js +0 -176
  580. package/dist/chunks/weights-Dzba96G3.js.map +0 -1
  581. package/dist/chunks/writer-C7flM-Ih.js.map +0 -1
@@ -8,12 +8,16 @@
8
8
  * / `graph`), the d3 lineage of the same shape (`links`, `name` ids, integer index endpoints),
9
9
  * JSON Graph Format v2 (`graph.nodes` keyed by id, per-edge `directed`, hyperedges), Cytoscape.js
10
10
  * elements (`data.id` / `data.source` / `data.target`, `position`, `classes`, `data.parent`),
11
- * graphology serialisation (`key` / `attributes`, `undirected` edges, `options.type` / `multi`) and
11
+ * graphology serialization (`key` / `attributes`, `undirected` edges, `options.type` / `multi`) and
12
12
  * vis.js (`from` / `to`); read only: NetworkX adjacency_data (`nodes` + `adjacency`) and tree_data
13
13
  * (nested `id` / `children`).
14
14
  */
15
15
  import { capabilities } from "../../common/export.js";
16
- /** Every dialect name, for option checking and messages. */
16
+ import { trimTrailingZeros } from "../../common/text.js";
17
+ /**
18
+ * Every dialect name, for option checking and messages.
19
+ * @category Built-in formats
20
+ */
17
21
  export const JSON_DIALECTS = Object.freeze([
18
22
  "node-link",
19
23
  "d3",
@@ -21,20 +25,39 @@ export const JSON_DIALECTS = Object.freeze([
21
25
  "cytoscape",
22
26
  "graphology",
23
27
  "vis",
28
+ "obographs",
24
29
  ]);
25
- /** Every dialect the importer reads, for option checking and messages. */
30
+ /**
31
+ * Every dialect the importer reads, for option checking and messages.
32
+ * @category Plugin helpers
33
+ */
26
34
  export const JSON_IMPORT_DIALECTS = Object.freeze([
27
35
  ...JSON_DIALECTS,
28
36
  "adjacency",
29
37
  "tree",
30
- "obographs",
31
38
  ]);
32
- /** The key under `meta.extra` that holds the shape record (design section 8.5). */
39
+ /**
40
+ * The key under `meta.extra` that holds the shape record (design section 8.5).
41
+ * @category Plugin helpers
42
+ */
33
43
  export const META_KEY = "json";
44
+ /**
45
+ * What a JSON import recorded about the document's shape: the dialect it was read as
46
+ * (`jsonShapeOf(snapshot)?.dialect`), the keys it used, and so on. A JSON export with default
47
+ * options writes the same shape back.
48
+ * @param snapshot - a graph read from a JSON document
49
+ * @returns the shape, or null for a graph that was not read from JSON
50
+ * @category Built-in formats
51
+ */
52
+ export function jsonShapeOf(snapshot) {
53
+ const shape = snapshot.meta.extra[META_KEY];
54
+ return isJsonObject(shape) ? shape : null;
55
+ }
34
56
  /**
35
57
  * Whether a value is a plain JSON object (not null, not an array).
36
58
  * @param value - any value
37
59
  * @returns true for an object that is not an array
60
+ * @category Plugin helpers
38
61
  */
39
62
  export function isJsonObject(value) {
40
63
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -45,6 +68,7 @@ export function isJsonObject(value) {
45
68
  * @param record - the record
46
69
  * @param key - the key
47
70
  * @returns true when the key is an own property
71
+ * @category Plugin helpers
48
72
  */
49
73
  export function hasKey(record, key) {
50
74
  return Object.prototype.hasOwnProperty.call(record, key);
@@ -53,6 +77,7 @@ export function hasKey(record, key) {
53
77
  * Whether a text names a dialect.
54
78
  * @param value - any value
55
79
  * @returns true for one of JSON_DIALECTS
80
+ * @category Plugin helpers
56
81
  */
57
82
  export function isJsonDialect(value) {
58
83
  return typeof value === "string" && JSON_DIALECTS.includes(value);
@@ -61,6 +86,7 @@ export function isJsonDialect(value) {
61
86
  * Whether a text names a dialect the importer reads.
62
87
  * @param value - any value
63
88
  * @returns true for one of JSON_IMPORT_DIALECTS
89
+ * @category Plugin helpers
64
90
  */
65
91
  export function isJsonImportDialect(value) {
66
92
  return typeof value === "string" && JSON_IMPORT_DIALECTS.includes(value);
@@ -70,13 +96,15 @@ export function isJsonImportDialect(value) {
70
96
  * `elements` or a top-level array of `{ data }` elements; OBO Graphs: `graphs[]` whose first graph
71
97
  * has an edge with `sub` (or `subj`) and `obj` or a `pred`, or a node with `lbl`, `meta` or an OWL
72
98
  * `type`; JGF: `graph.nodes` / `graph.edges` or any other `graphs[]`; graphology: `options.type` / `options.multi`, `key` nodes without `id`, edges with
73
- * `undirected` or an `attributes` record; vis: edges with `from` / `to`; d3: `links` without
99
+ * `undirected` or an `attributes` record, and vis: edges with `from` / `to`, both only without
100
+ * NetworkX's `links` / `directed` / `multigraph` / `graph` keys; d3: `links` without
74
101
  * `directed` / `multigraph` / `graph`; NetworkX adjacency_data: `nodes` and `adjacency` without
75
102
  * `links` / `edges`; NetworkX tree_data: `children` without `nodes` / `links` / `edges`; else
76
103
  * node-link). Pure: the importer wraps it with its issue
77
104
  * codes, the registry's sniff() uses it on a head that parses as a whole document.
78
105
  * @param root - the parsed document
79
106
  * @returns the dialect, or null when the document is not a graph document in any dialect
107
+ * @category Plugin helpers
80
108
  */
81
109
  export function sniffJsonDialect(root) {
82
110
  if (Array.isArray(root)) {
@@ -93,7 +121,8 @@ export function sniffJsonDialect(root) {
93
121
  return "jgf";
94
122
  }
95
123
  if (Array.isArray(root.graphs)) {
96
- return isOboGraph(firstJsonObject(root.graphs)) ? "obographs" : "jgf";
124
+ // any graph decides: an ontology's first graph may be an empty stub before its imports
125
+ return root.graphs.some((g) => isJsonObject(g) && isOboGraph(g)) ? "obographs" : "jgf";
97
126
  }
98
127
  if (!hasKey(root, "edges") && !hasKey(root, "links")) {
99
128
  if (hasKey(root, "nodes") && hasKey(root, "adjacency")) {
@@ -108,15 +137,22 @@ export function sniffJsonDialect(root) {
108
137
  if (isJsonObject(root.options) && (hasKey(root.options, "type") || hasKey(root.options, "multi"))) {
109
138
  return "graphology";
110
139
  }
111
- if (firstNode !== null && hasKey(firstNode, "key") && !hasKey(firstNode, "id")) {
140
+ // NetworkX's own keys (links, directed, multigraph, graph) settle node-link: one attribute named
141
+ // like a graphology or vis field (`attributes`, `undirected`, `key`, `from`) must not re-route it
142
+ const networkx = hasKey(root, "links") || hasKey(root, "directed") || hasKey(root, "multigraph") || hasKey(root, "graph");
143
+ if (!networkx && firstNode !== null && hasKey(firstNode, "key") && !hasKey(firstNode, "id")) {
112
144
  return "graphology";
113
145
  }
114
- if (firstEdge !== null && !hasKey(firstEdge, "from")) {
146
+ if (!networkx && firstEdge !== null && !hasKey(firstEdge, "from")) {
115
147
  if (hasKey(firstEdge, "undirected") || isJsonObject(firstEdge.attributes)) {
116
148
  return "graphology";
117
149
  }
118
150
  }
119
- if (firstEdge !== null && hasKey(firstEdge, "from") && hasKey(firstEdge, "to") && !hasKey(firstEdge, "source")) {
151
+ if (!networkx &&
152
+ firstEdge !== null &&
153
+ hasKey(firstEdge, "from") &&
154
+ hasKey(firstEdge, "to") &&
155
+ !hasKey(firstEdge, "source")) {
120
156
  return "vis";
121
157
  }
122
158
  const bare = !hasKey(root, "directed") && !hasKey(root, "multigraph") && !hasKey(root, "graph");
@@ -158,6 +194,7 @@ function firstJsonObject(value) {
158
194
  * from the JSON importer.
159
195
  * @param meta - the snapshot's metadata
160
196
  * @returns the fields found under `meta.extra.json`, each only when it has the expected type
197
+ * @category Plugin helpers
161
198
  */
162
199
  export function shapeMetaOf(meta) {
163
200
  const raw = meta.extra[META_KEY];
@@ -180,7 +217,10 @@ export function shapeMetaOf(meta) {
180
217
  cytoscape: isJsonObject(raw.cytoscape) ? raw.cytoscape : undefined,
181
218
  };
182
219
  }
183
- /** The direction a dialect assumes when the file declares none (design section 8.4, `defaultDirected`). */
220
+ /**
221
+ * The direction a dialect assumes when the file declares none (design section 8.4, `defaultDirected`).
222
+ * @category Plugin helpers
223
+ */
184
224
  export const DIALECT_DEFAULT_DIRECTED = Object.freeze({
185
225
  "node-link": false,
186
226
  d3: false,
@@ -259,9 +299,18 @@ const TABLES = Object.freeze({
259
299
  hierarchy: false,
260
300
  graphAttributes: false,
261
301
  }),
302
+ // the OBO flat file's table: no column of the snapshot's own reads back as a column (the
303
+ // vocabulary columns have their places; every other one becomes property values or edge meta)
304
+ obographs: capabilities({
305
+ mixedDirection: false,
306
+ multiEdges: true,
307
+ selfLoops: true,
308
+ edgeIds: "none",
309
+ idCharset: "any",
310
+ }),
262
311
  });
263
312
  /**
264
- * What one dialect can express (design section 8.5): positions and visual columns are written as
313
+ * What one dialect can express: positions and visual columns are written as
265
314
  * plain attributes (an array for a multi-component column) and read back without their role,
266
315
  * except Cytoscape's `position` object; containment only as the Cytoscape `data.parent`; mixed
267
316
  * direction only where the dialect carries a per-edge flag (JGF `directed`, graphology
@@ -269,11 +318,15 @@ const TABLES = Object.freeze({
269
318
  * graph attributes everywhere but d3 (the bare shape) and vis.
270
319
  * @param dialect - the dialect
271
320
  * @returns its frozen capability table
321
+ * @category Built-in formats
272
322
  */
273
323
  export function dialectCapabilities(dialect) {
274
324
  return TABLES[dialect];
275
325
  }
276
- /** The Cytoscape element-level keys (everything else on an element lives under `data`). */
326
+ /**
327
+ * The Cytoscape element-level keys (everything else on an element lives under `data`).
328
+ * @category Plugin helpers
329
+ */
277
330
  export const CYTOSCAPE_ELEMENT_KEYS = new Set([
278
331
  "selected",
279
332
  "selectable",
@@ -284,12 +337,16 @@ export const CYTOSCAPE_ELEMENT_KEYS = new Set([
284
337
  "scratch",
285
338
  "renderedPosition",
286
339
  ]);
287
- /** The Cytoscape element keys the importer maps structurally rather than to columns. */
340
+ /**
341
+ * The Cytoscape element keys the importer maps structurally rather than to columns.
342
+ * @category Plugin helpers
343
+ */
288
344
  export const CYTOSCAPE_STRUCTURAL_KEYS = new Set(["data", "group", "position", "classes"]);
289
345
  /**
290
346
  * The suffix the importer appends to a column name that collides with a structural column or a
291
347
  * reserved key of its dialect (design section 5.6 names collisions deterministically); the exporter
292
348
  * strips it when the value goes back to the level the suffix names.
349
+ * @category Plugin helpers
293
350
  */
294
351
  export const SUFFIX = Object.freeze({
295
352
  /** A Cytoscape `data` key or a JGF / graphology attribute that collides with a structural column. */
@@ -297,14 +354,47 @@ export const SUFFIX = Object.freeze({
297
354
  /** An element-level key the dialect does not define (Cytoscape, JGF, graphology). */
298
355
  element: "#element",
299
356
  });
300
- /** The default source keys of a node-link edge record, tried in order (as fromRecords does). */
357
+ /**
358
+ * The default source keys of a node-link edge record, tried in order (as fromRecords does).
359
+ * @category Plugin helpers
360
+ */
301
361
  export const NODE_LINK_SOURCE_KEYS = Object.freeze(["source", "src", "from"]);
302
- /** The default target keys of a node-link edge record, tried in order. */
362
+ /**
363
+ * The default target keys of a node-link edge record, tried in order.
364
+ * @category Plugin helpers
365
+ */
303
366
  export const NODE_LINK_TARGET_KEYS = Object.freeze(["target", "dst", "to"]);
304
- /** The name of the position column every JSON dialect writes / reads (design section 5.2). */
367
+ /**
368
+ * The name of the position column every JSON dialect writes / reads (design section 5.2).
369
+ * @category Plugin helpers
370
+ */
305
371
  export const POSITION_COLUMN = "position";
306
- /** The name of the Cytoscape classes column (a list of strings with role "classes"). */
372
+ /**
373
+ * The name of the Cytoscape classes column (a list of strings with role "classes").
374
+ * @category Plugin helpers
375
+ */
307
376
  export const CLASSES_COLUMN = "classes";
308
- /** The name of the Cytoscape parent column (u32 refersTo node, role "parent"). */
377
+ /**
378
+ * The name of the Cytoscape parent column (u32 refersTo node, role "parent").
379
+ * @category Plugin helpers
380
+ */
309
381
  export const PARENT_COLUMN = "parent";
382
+ /**
383
+ * An integer text beyond 2^53 in exponent form (`100000000000000000000` -> `1e+20`, the same
384
+ * digits): the importer reads an integer literal that large as its exact digits (a string), so
385
+ * a number must not be written as one.
386
+ * @param text - the shortest decimal text of a finite number
387
+ * @returns the text, or its exponent form for an integer literal of 16 or more digits
388
+ * @category Plugin helpers
389
+ */
390
+ export function exponentIfUnsafe(text) {
391
+ const match = /^(-?)(\d{16,})$/.exec(text);
392
+ if (match === null || Number.isSafeInteger(Number(text))) {
393
+ return text;
394
+ }
395
+ const [, sign, digits] = match;
396
+ const mantissa = trimTrailingZeros(digits);
397
+ const fraction = mantissa.length > 1 ? `.${mantissa.slice(1)}` : "";
398
+ return `${sign}${mantissa[0]}${fraction}e+${digits.length - 1}`;
399
+ }
310
400
  //# sourceMappingURL=dialect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialect.js","sourceRoot":"","sources":["../../../../src/formats/json/dialect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAMtD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,aAAa,GAA2B,MAAM,CAAC,MAAM,CAAC;IAC/D,WAAW;IACX,IAAI;IACJ,KAAK;IACL,WAAW;IACX,YAAY;IACZ,KAAK;CACR,CAAC,CAAC;AAUH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAiC,MAAM,CAAC,MAAM,CAAC;IAC5E,GAAG,aAAa;IAChB,WAAW;IACX,MAAM;IACN,WAAW;CACd,CAAC,CAAC;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AA8B/B;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF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C,EAAE,CAAC;IACpE,OAAO,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;AACpE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The JSON exporter (design section 8.5): one GraphExporter with a `dialect` option writing
3
3
  * NetworkX node-link (the default), d3 (`links`, optional index endpoints), JSON Graph Format v2,
4
- * Cytoscape.js elements, graphology serialisation or vis.js. The dialect defaults to the one the
4
+ * Cytoscape.js elements, graphology serialization or vis.js. The dialect defaults to the one the
5
5
  * importer recorded under `meta.extra.json` so a JSON file re-exported as JSON keeps its shape,
6
6
  * and to node-link for a snapshot from any other source.
7
7
  *
@@ -17,48 +17,113 @@
17
17
  * value is its JSON text; an unset row writes no key (design section 5.3). Non-finite numbers,
18
18
  * which JSON cannot carry, become null and are reported.
19
19
  */
20
- import { type ExportCapabilities, type GraphExporter } from "../../types.js";
20
+ import { type CommonExportOptions, type ExportCapabilities, type GraphExporter } from "../../types.js";
21
21
  import { type JsonDialect } from "./dialect.js";
22
- /** The format-specific options of the JSON exporter. */
23
- export interface JsonExportOptions {
24
- /** The dialect to write; default: the dialect the importer recorded, else "node-link". */
22
+ /**
23
+ * The format-specific options of the JSON exporter.
24
+ * @category Built-in formats
25
+ */
26
+ export interface JsonExportOptions extends CommonExportOptions {
27
+ /**
28
+ * The dialect to write. The default is the dialect a JSON import read, else "node-link".
29
+ * Attributes are written under their own names; vis.js shows the `label` attribute, so rename
30
+ * the attribute you want shown to `label` first (`snapshot.nodes.rename("name", "label")`). A CSV
31
+ * dialect name ("gephi", "generic"), from an options object shared with CSV saves, is ignored.
32
+ * @defaultValue as read, else "node-link"
33
+ */
25
34
  dialect?: JsonDialect | undefined;
26
- /** Spaces per indentation level; 0 (default) writes compact JSON. */
27
- indent?: number | undefined;
28
- /** node-link / d3: the key of the edge array; default: the recorded key, else "edges" (d3: "links"). */
35
+ /**
36
+ * The indentation of one level: a number of spaces, or the text itself (spaces or tabs, such as
37
+ * "\t"). 0 or "" writes compact JSON on one line.
38
+ * @defaultValue 0
39
+ */
40
+ indent?: number | string | undefined;
41
+ /**
42
+ * node-link and d3: the key of the edge array. The default is the key a JSON import read, else
43
+ * "edges" ("links" for d3).
44
+ * @defaultValue as read, else "edges"
45
+ */
29
46
  edgesKey?: string | undefined;
30
- /** node-link / d3 / vis: the node id key; default: the recorded key, else "id". */
47
+ /**
48
+ * node-link, d3 and vis: the node id key. The default is the key a JSON import read, else "id".
49
+ * @defaultValue as read, else "id"
50
+ */
31
51
  nodeIdKey?: string | undefined;
32
- /** node-link / d3: write endpoints as node array positions; default: the recorded flag, else false. */
52
+ /**
53
+ * node-link and d3: write edge ends as positions in the node array instead of ids. The default
54
+ * is what a JSON import read, else false.
55
+ * @defaultValue as read, else false
56
+ */
33
57
  indexLinks?: boolean | undefined;
34
- /** node-link / d3 / vis: the source key; default: the recorded key, else "source" (vis: "from"). */
58
+ /**
59
+ * node-link, d3 and vis: the source key. The default is the key a JSON import read, else
60
+ * "source" ("from" for vis). graph-io finds "source", "src" and "from" by itself; for another
61
+ * key, read the file back with the same `sourceKey` import option. Without it every edge is an
62
+ * `E_MISSING_ENDPOINT` error and is skipped, and a file with more edges than `errorLimit` (100 by
63
+ * default) fails to load with an `ImportError`. `checkExport()` does not warn about this.
64
+ * @defaultValue as read, else "source"
65
+ */
35
66
  sourceKey?: string | undefined;
36
- /** node-link / d3 / vis: the target key; default: the recorded key, else "target" (vis: "to"). */
67
+ /**
68
+ * node-link, d3 and vis: the target key. The default is the key a JSON import read, else
69
+ * "target" ("to" for vis). graph-io finds "target", "dst" and "to" by itself; for another key,
70
+ * read the file back with the same `targetKey` import option, as for `sourceKey`.
71
+ * @defaultValue as read, else "target"
72
+ */
37
73
  targetKey?: string | undefined;
38
- /** The key the weight is written under; default: the key the JSON importer read it from, else "weight". */
74
+ /**
75
+ * The key the weight is written under, in every dialect but OBO Graphs, which always writes the
76
+ * weight as "weight" in each edge's `meta` (checkExport() then returns W_OBOGRAPHS_EDGE_COLUMN_AS_META).
77
+ * The default is the key a JSON import read the weights from, else "weight". For another key,
78
+ * read the file back with `weightFrom` set to it, or the weights come back as a plain edge
79
+ * attribute.
80
+ * @defaultValue as read, else "weight"
81
+ */
39
82
  weightKey?: string | undefined;
83
+ /**
84
+ * OBO Graphs: the graph id written when the graph has none. A graph read from an OBO Graphs
85
+ * document keeps its own graph id, which this option does not change. Node ids are written in
86
+ * the form graph-io reads back as the same id: an IRI as it is, a prefixed id such as
87
+ * `GO:0008150` as its OBO address, and an id without a prefix (`a`) under the default OBO
88
+ * address (`http://purl.obolibrary.org/obo/graph.owl#a`), or as it is when you pass another IRI
89
+ * here. The default is `http://purl.obolibrary.org/obo/<ontology>.owl`.
90
+ * @defaultValue the ontology's OBO address
91
+ */
92
+ ontologyIri?: string | undefined;
40
93
  }
41
94
  /**
42
95
  * The LossNote codes of the JSON exporter's check(): the dialect-specific ones and, aliased, the
43
96
  * shared ones it records (`LOSS` holds the rest of the generic pre-flight's codes). A key is the
44
97
  * code without its severity prefix.
98
+ * @category Built-in formats
45
99
  */
46
100
  export declare const JSON_LOSS: Readonly<{
47
101
  /** Non-finite numbers (columns, weights) are written as null. */
48
102
  NONFINITE_AS_NULL: "W_NONFINITE_AS_NULL";
49
- /** Cytoscape, vis and d3 carry no direction; the file re-imports with the dialect's default direction. */
103
+ /**
104
+ * The file cannot record direction: an undirected graph's edges read back as directed, or the whole graph reads
105
+ * back with the importer's default direction.
106
+ */
50
107
  DIRECTION_DROPPED: "W_DIRECTION_DROPPED";
51
108
  /** GEXF mutual pairs are written as two directed edges. */
52
109
  MUTUAL_EXPANDED: "W_MUTUAL_EXPANDED";
53
- /** JGF keys its nodes by string; numeric ids re-import as text unless ids: "canonical". */
110
+ /**
111
+ * JGF keys its nodes by text, so number ids read back as text, unless you read the file with `ids: "canonical"`.
112
+ */
54
113
  NUMERIC_IDS_STRINGIFIED: "W_NUMERIC_IDS_STRINGIFIED";
55
- /** JGF: two ids have the same text; export() throws E_INVALID_ID. */
114
+ /**
115
+ * Two node ids would be written as the same text (the number 5 and the text "5"); the save fails with
116
+ * E_INVALID_ID.
117
+ */
56
118
  ID_TEXT_COLLISION: "E_ID_TEXT_COLLISION";
57
- /** JGF: integer-like id keys are enumerated first and ascending by JSON parsers; node order changes on re-import. */
119
+ /** The nodes read back in a different order. */
58
120
  NODE_ORDER: "W_NODE_ORDER";
59
121
  /** A column named like a reserved key of the dialect (id, source, target, ...) is skipped. */
60
122
  RESERVED_KEY: "W_RESERVED_KEY";
61
- /** A plain edge column named like the weight key reads back as THE weight (or is skipped when weights are written). */
123
+ /**
124
+ * An attribute without the weight role is named like the key weights are written under; it reads back as the edge
125
+ * weight, or is not written when the graph has weights of its own.
126
+ */
62
127
  WEIGHT_KEY_CLASH: "W_WEIGHT_KEY_CLASH";
63
128
  /** A position column without a slot (every dialect but Cytoscape) is a plain array attribute; the role is lost. */
64
129
  POSITIONS_DROPPED: "W_POSITIONS_DROPPED";
@@ -66,24 +131,71 @@ export declare const JSON_LOSS: Readonly<{
66
131
  POSITION_Z_DROPPED: "W_POSITION_Z_DROPPED";
67
132
  /** Cytoscape has a single parent; a `parents` list column cannot be written. */
68
133
  PARENTS_DROPPED: "W_PARENTS_DROPPED";
69
- /** node-link / d3 have no edge id slot; the id column is written as a plain attribute. */
134
+ /** Node-link / d3 have no edge id slot; the id column is written as a plain attribute. */
70
135
  EDGE_IDS_DROPPED: "W_EDGE_IDS_DROPPED";
71
- /** An f64 column of integral values reads back as i32 (JSON declares no types). */
136
+ /**
137
+ * A number attribute whose values are all whole numbers reads back as integers, because the format does not record
138
+ * the type.
139
+ */
72
140
  INTEGRAL_F64_AS_I32: "W_INTEGRAL_F64_AS_I32";
73
- /** A role column the dialect has no slot for is a plain attribute; the role is lost. */
141
+ /** An attribute with a role the format has no place for is written as a plain attribute; the role is lost. */
74
142
  ROLE_DROPPED: "W_ROLE_DROPPED";
75
143
  /** A column without a set cell is not written (JSON declares no columns). */
76
144
  EMPTY_COLUMN_DROPPED: "W_EMPTY_COLUMN_DROPPED";
145
+ /**
146
+ * Obographs: an edge column (or the explicit weights) is written into each edge's meta and reads back inside the
147
+ * meta column.
148
+ */
149
+ OBOGRAPHS_EDGE_COLUMN_AS_META: "W_OBOGRAPHS_EDGE_COLUMN_AS_META";
150
+ /**
151
+ * Obographs: a node id or relation is written as an IRI the importer's default oboIds "curie" reads back as
152
+ * another id.
153
+ */
154
+ OBOGRAPHS_ID_CHANGED: "W_OBOGRAPHS_ID_CHANGED";
155
+ /** Obographs: a property_value's xsd datatype has no place in basicPropertyValues and reads back unset. */
156
+ OBOGRAPHS_DATATYPE_DROPPED: "W_OBOGRAPHS_DATATYPE_DROPPED";
157
+ /** Obographs: a node column outside the OBO vocabulary reads back inside the property_value column. */
158
+ COLUMN_AS_PROPERTY_VALUE: "W_COLUMN_AS_PROPERTY_VALUE";
159
+ /** Obographs: an edge without a relation is written with the pred is_a. */
160
+ RELATION_ASSUMED: "W_RELATION_ASSUMED";
161
+ /**
162
+ * Obographs: Typedef nodes are written as PROPERTY nodes, which read back as nodes only under typedefs: "nodes".
163
+ */
164
+ TYPEDEF_NODES: "W_TYPEDEF_NODES";
165
+ /**
166
+ * OBO Graphs: a graph attribute is written into the graph's `meta` and reads back in
167
+ * `snapshot.meta.extra.obographs`.
168
+ */
169
+ GRAPH_COLUMN_AS_METADATA: "W_GRAPH_COLUMN_AS_METADATA";
170
+ /** Obographs: numeric node ids are written as text and read back as strings. */
171
+ ID_TEXT_TYPE: "W_ID_TEXT_TYPE";
172
+ /**
173
+ * An attribute without a role is written where the format keeps a role (for example, a `name` column as the label), and
174
+ * reads back with that role.
175
+ */
176
+ ROLE_ASSUMED: "W_ROLE_ASSUMED";
177
+ /**
178
+ * An attribute with a role (for example, the label) is written where the format keeps that role, and reads back under the
179
+ * name the format's importer gives it.
180
+ */
181
+ COLUMN_NAME_CHANGED: "W_COLUMN_NAME_CHANGED";
182
+ /**
183
+ * OBO Graphs: an OBO attribute stored as text where graph-io uses a dictionary (or the other way round); it reads
184
+ * back with graph-io's usual type. The values are the same.
185
+ */
186
+ DTYPE_UNSUPPORTED: "W_DTYPE_UNSUPPORTED";
77
187
  }>;
78
188
  /**
79
- * The JSON exporter plugin (design section 8.5). `capabilities` is the node-link table (the
189
+ * The JSON exporter plugin. `capabilities` is the node-link table (the
80
190
  * default dialect); check() applies the table of the dialect actually selected.
191
+ * @category Built-in formats
81
192
  */
82
193
  export declare const jsonExporter: GraphExporter<JsonExportOptions>;
83
194
  /**
84
195
  * The capability table of one dialect, for callers that pick a dialect before check().
85
196
  * @param dialect - the dialect
86
197
  * @returns the frozen table
198
+ * @category Built-in formats
87
199
  */
88
200
  export declare function jsonCapabilities(dialect: JsonDialect): ExportCapabilities;
89
201
  //# sourceMappingURL=exporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../../src/formats/json/exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,OAAO,EAA4B,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AACtH,OAAO,EAMH,KAAK,WAAW,EAInB,MAAM,cAAc,CAAC;AAEtB,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,0FAA0F;IAC1F,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,wGAAwG;IACxG,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,uGAAuG;IACvG,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;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