@graphty/graph-io 0.0.0 → 0.2.0

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,84 @@
1
+ /**
2
+ * The declared-type table of design section 5.1: what the type text of a GEXF `<attribute>`, a
3
+ * GraphML `<key>`, a GML value class or a Neo4j CSV header maps to, and how a value's text is
4
+ * parsed once the column dtype is known.
5
+ *
6
+ * Declared types map exactly: `double` and `long` -> f64, `float` -> f32, `int` / `integer` /
7
+ * `short` / `byte` -> i32, `boolean` -> bool, `string` / `anyURI` / `char` -> string, `bigdecimal`
8
+ * / `biginteger` -> string, `date` / `dateTime` and the Neo4j temporal types -> f64 (epoch or
9
+ * time-of-day milliseconds, design section 5.1), `list*` and `[]` -> list of the item type, GML
10
+ * `record` and Neo4j `point` -> json. A declared `long` is stored as f64 with a precision flag
11
+ * (values beyond 2^53 are a `precision` issue) unless the importer option `long: "string"` keeps the
12
+ * whole column as text. Neo4j `duration` has no epoch and is kept as text. The declared type text is
13
+ * recorded in `origin.type` in every case so the exporter can restore the declaration.
14
+ */
15
+ import { type Dtype, type ScalarDtype } from "@graphty/graph-format";
16
+ import { type TemporalKind } from "./temporal.js";
17
+ /** The formats whose declarations this table covers. */
18
+ export type DeclaringFormat = "gexf" | "graphml" | "gml" | "neo4j";
19
+ /** How the text of one scalar value (or one list item) is parsed. */
20
+ type ValueKind = "boolean" | "integer" | "long" | "float" | "double" | "string" | "temporal" | "duration" | "point" | "json";
21
+ /** The resolved storage of a declared type. */
22
+ export interface DeclaredTypeSpec {
23
+ /** The declared type text as given by the file (origin.type). */
24
+ readonly declared: string;
25
+ /** The column dtype. */
26
+ readonly dtype: Dtype;
27
+ /** The item dtype of a list column, null otherwise. */
28
+ readonly itemDtype: ScalarDtype | null;
29
+ /** How each scalar value or list item text is parsed. */
30
+ readonly kind: ValueKind;
31
+ /** Whether the column is a list. */
32
+ readonly list: boolean;
33
+ /** The temporal kind of a temporal value, null otherwise. */
34
+ readonly temporal: TemporalKind | null;
35
+ /** Whether values may exceed 2^53 (a long stored as f64), so the importer checks Number.isSafeInteger. */
36
+ readonly precision: boolean;
37
+ }
38
+ /**
39
+ * Resolve a declared type text of one format to its storage.
40
+ * @param format - the declaring format
41
+ * @param type - the type text as written (matched case-insensitively; GEXF `list*` and Neo4j `[]` denote lists)
42
+ * @param long - how declared long / integer-64 columns are stored (the importer option)
43
+ * @returns the spec, or null when the format does not define the type (the importer reports it and keeps the text)
44
+ */
45
+ export declare function mapDeclaredType(format: DeclaringFormat, type: string, long: "f64" | "string"): DeclaredTypeSpec | null;
46
+ /**
47
+ * The spec of an untyped attribute: a string column with the given (or absent) type text.
48
+ * @param declared - the type text to record in origin.type, or null
49
+ * @returns a string spec
50
+ */
51
+ export declare function stringSpec(declared: string | null): DeclaredTypeSpec;
52
+ /**
53
+ * Parse the text of one scalar value (or list item) by its kind. Numeric and boolean kinds trim
54
+ * surrounding whitespace (pretty-printed XML puts newlines around `<data>` text); string kinds keep
55
+ * the text exactly.
56
+ * @param text - the value text
57
+ * @param kind - the value kind
58
+ * @param temporal - the temporal kind when `kind` is "temporal"
59
+ * @returns a boolean, a number, a string or (point / json) a JSON value; E_COLUMN_TYPE when the text is not of the kind
60
+ */
61
+ export declare function parseScalarText(text: string, kind: ValueKind, temporal?: TemporalKind | null): unknown;
62
+ /**
63
+ * Parse a boolean text the way the formats write it: `true` / `false` in any case, or `1` / `0`.
64
+ * @param text - the value text
65
+ * @returns the boolean, or null when the text is neither
66
+ */
67
+ export declare function parseBooleanText(text: string): boolean | null;
68
+ /**
69
+ * Parse a float / double text: a decimal or exponent literal, or the XSD / JSON spellings of the
70
+ * non-finite values (`INF`, `-INF`, `Infinity`, `-Infinity`, `NaN`).
71
+ * @param text - the value text
72
+ * @param kind - float or double, for the error
73
+ * @returns the number
74
+ */
75
+ export declare function parseDecimalText(text: string, kind?: ValueKind): number;
76
+ /**
77
+ * Parse a Neo4j point literal `{x:1.0, y:2.0, crs:'cartesian'}` (also `latitude` / `longitude` /
78
+ * `height` / `z` / `srid`) into a JSON object; a JSON object text is accepted as well.
79
+ * @param text - the value text
80
+ * @returns an object with numeric coordinates and string crs
81
+ */
82
+ export declare function parsePointText(text: string): Readonly<Record<string, number | string>>;
83
+ export {};
84
+ //# sourceMappingURL=declared-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-types.d.ts","sourceRoot":"","sources":["../../../src/common/declared-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,KAAK,EAAoB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjE,wDAA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G;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,SAAoB,GAAG,MAAM,CAmBjF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAgCtF"}
@@ -0,0 +1,326 @@
1
+ /**
2
+ * The declared-type table of design section 5.1: what the type text of a GEXF `<attribute>`, a
3
+ * GraphML `<key>`, a GML value class or a Neo4j CSV header maps to, and how a value's text is
4
+ * parsed once the column dtype is known.
5
+ *
6
+ * Declared types map exactly: `double` and `long` -> f64, `float` -> f32, `int` / `integer` /
7
+ * `short` / `byte` -> i32, `boolean` -> bool, `string` / `anyURI` / `char` -> string, `bigdecimal`
8
+ * / `biginteger` -> string, `date` / `dateTime` and the Neo4j temporal types -> f64 (epoch or
9
+ * time-of-day milliseconds, design section 5.1), `list*` and `[]` -> list of the item type, GML
10
+ * `record` and Neo4j `point` -> json. A declared `long` is stored as f64 with a precision flag
11
+ * (values beyond 2^53 are a `precision` issue) unless the importer option `long: "string"` keeps the
12
+ * whole column as text. Neo4j `duration` has no epoch and is kept as text. The declared type text is
13
+ * recorded in `origin.type` in every case so the exporter can restore the declaration.
14
+ */
15
+ import { GraphFormatError } from "@graphty/graph-format";
16
+ import { parseTemporal } from "./temporal.js";
17
+ const BOOLEAN = { dtype: "bool", kind: "boolean" };
18
+ const INTEGER = { dtype: "i32", kind: "integer" };
19
+ const LONG = { dtype: "f64", kind: "long", precision: true };
20
+ const FLOAT = { dtype: "f32", kind: "float" };
21
+ const DOUBLE = { dtype: "f64", kind: "double" };
22
+ const STRING = { dtype: "string", kind: "string" };
23
+ const DATE = { dtype: "f64", kind: "temporal", temporal: "date" };
24
+ const DATE_TIME = { dtype: "f64", kind: "temporal", temporal: "dateTime" };
25
+ const LOCAL_DATE_TIME = { dtype: "f64", kind: "temporal", temporal: "localDateTime" };
26
+ const TIME = { dtype: "f64", kind: "temporal", temporal: "time" };
27
+ const LOCAL_TIME = { dtype: "f64", kind: "temporal", temporal: "localTime" };
28
+ const DURATION = { dtype: "string", kind: "duration" };
29
+ const POINT = { dtype: "json", kind: "point" };
30
+ const RECORD = { dtype: "json", kind: "json" };
31
+ /** GEXF 1.2 / 1.3 scalar types (the `list*` variants are derived). */
32
+ const GEXF_SCALARS = {
33
+ integer: INTEGER,
34
+ long: LONG,
35
+ double: DOUBLE,
36
+ float: FLOAT,
37
+ boolean: BOOLEAN,
38
+ string: STRING,
39
+ anyuri: STRING,
40
+ char: STRING,
41
+ byte: INTEGER,
42
+ short: INTEGER,
43
+ bigdecimal: STRING,
44
+ biginteger: STRING,
45
+ date: DATE,
46
+ datetime: DATE_TIME,
47
+ };
48
+ /** GraphML `attr.type` values. */
49
+ const GRAPHML_SCALARS = {
50
+ boolean: BOOLEAN,
51
+ int: INTEGER,
52
+ long: LONG,
53
+ float: FLOAT,
54
+ double: DOUBLE,
55
+ string: STRING,
56
+ };
57
+ /** GML value classes (per value in the file; the GML importer names them per column). */
58
+ const GML_SCALARS = {
59
+ int: INTEGER,
60
+ real: DOUBLE,
61
+ string: STRING,
62
+ record: RECORD,
63
+ };
64
+ /** Neo4j CSV header types and Cypher property type names. */
65
+ const NEO4J_SCALARS = {
66
+ int: INTEGER,
67
+ integer: LONG,
68
+ long: LONG,
69
+ float: FLOAT,
70
+ double: DOUBLE,
71
+ boolean: BOOLEAN,
72
+ byte: INTEGER,
73
+ short: INTEGER,
74
+ char: STRING,
75
+ string: STRING,
76
+ point: POINT,
77
+ date: DATE,
78
+ localtime: LOCAL_TIME,
79
+ time: TIME,
80
+ localdatetime: LOCAL_DATE_TIME,
81
+ datetime: DATE_TIME,
82
+ duration: DURATION,
83
+ };
84
+ const TABLES = {
85
+ gexf: GEXF_SCALARS,
86
+ graphml: GRAPHML_SCALARS,
87
+ gml: GML_SCALARS,
88
+ neo4j: NEO4J_SCALARS,
89
+ };
90
+ const INTEGER_TEXT = /^[+-]?[0-9]+$/;
91
+ const DECIMAL_TEXT = /^[+-]?([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][+-]?[0-9]+)?$/;
92
+ const I32_MIN = -2147483648;
93
+ const I32_MAX = 2147483647;
94
+ /**
95
+ * Resolve a declared type text of one format to its storage.
96
+ * @param format - the declaring format
97
+ * @param type - the type text as written (matched case-insensitively; GEXF `list*` and Neo4j `[]` denote lists)
98
+ * @param long - how declared long / integer-64 columns are stored (the importer option)
99
+ * @returns the spec, or null when the format does not define the type (the importer reports it and keeps the text)
100
+ */
101
+ export function mapDeclaredType(format, type, long) {
102
+ const table = TABLES[format];
103
+ let key = type.trim().toLowerCase();
104
+ let list = false;
105
+ if (format === "gexf" && key.startsWith("list") && key.length > 4) {
106
+ list = true;
107
+ key = key.slice(4);
108
+ }
109
+ else if (format === "neo4j" && key.endsWith("[]")) {
110
+ list = true;
111
+ key = key.slice(0, -2);
112
+ }
113
+ else if (format === "gml" && key === "list") {
114
+ return {
115
+ declared: type,
116
+ dtype: "list",
117
+ itemDtype: "json",
118
+ kind: "json",
119
+ list: true,
120
+ temporal: null,
121
+ precision: false,
122
+ };
123
+ }
124
+ let entry = table[key];
125
+ if (entry === undefined) {
126
+ return null;
127
+ }
128
+ if (entry.kind === "long" && long === "string") {
129
+ entry = STRING;
130
+ }
131
+ return {
132
+ declared: type,
133
+ dtype: list ? "list" : entry.dtype,
134
+ itemDtype: list ? entry.dtype : null,
135
+ kind: entry.kind,
136
+ list,
137
+ temporal: entry.temporal ?? null,
138
+ precision: entry.precision ?? false,
139
+ };
140
+ }
141
+ /**
142
+ * The spec of an untyped attribute: a string column with the given (or absent) type text.
143
+ * @param declared - the type text to record in origin.type, or null
144
+ * @returns a string spec
145
+ */
146
+ export function stringSpec(declared) {
147
+ return {
148
+ declared: declared ?? "",
149
+ dtype: "string",
150
+ itemDtype: null,
151
+ kind: "string",
152
+ list: false,
153
+ temporal: null,
154
+ precision: false,
155
+ };
156
+ }
157
+ /**
158
+ * Parse the text of one scalar value (or list item) by its kind. Numeric and boolean kinds trim
159
+ * surrounding whitespace (pretty-printed XML puts newlines around `<data>` text); string kinds keep
160
+ * the text exactly.
161
+ * @param text - the value text
162
+ * @param kind - the value kind
163
+ * @param temporal - the temporal kind when `kind` is "temporal"
164
+ * @returns a boolean, a number, a string or (point / json) a JSON value; E_COLUMN_TYPE when the text is not of the kind
165
+ */
166
+ export function parseScalarText(text, kind, temporal = null) {
167
+ switch (kind) {
168
+ case "boolean": {
169
+ const value = parseBooleanText(text);
170
+ if (value === null) {
171
+ throw typeError(text, kind);
172
+ }
173
+ return value;
174
+ }
175
+ case "integer": {
176
+ const trimmed = text.trim();
177
+ if (!INTEGER_TEXT.test(trimmed)) {
178
+ throw typeError(text, kind);
179
+ }
180
+ const value = Number(trimmed);
181
+ if (value < I32_MIN || value > I32_MAX) {
182
+ throw new GraphFormatError("E_COLUMN_TYPE", `"${trimmed}" is outside the 32-bit integer range`, {
183
+ value: trimmed,
184
+ kind,
185
+ });
186
+ }
187
+ return value;
188
+ }
189
+ case "long": {
190
+ const trimmed = text.trim();
191
+ if (!INTEGER_TEXT.test(trimmed)) {
192
+ throw typeError(text, kind);
193
+ }
194
+ return Number(trimmed);
195
+ }
196
+ case "float":
197
+ case "double":
198
+ return parseDecimalText(text, kind);
199
+ case "string":
200
+ case "duration":
201
+ return text;
202
+ case "temporal": {
203
+ if (temporal === null) {
204
+ throw new GraphFormatError("E_COLUMN_TYPE", "a temporal value needs its temporal kind", { kind });
205
+ }
206
+ return parseTemporal(text.trim(), temporal).value;
207
+ }
208
+ case "point":
209
+ return parsePointText(text);
210
+ case "json":
211
+ return parseJsonText(text);
212
+ default: {
213
+ const name = kind;
214
+ throw new GraphFormatError("E_COLUMN_TYPE", `unknown value kind ${name}`, { kind: name });
215
+ }
216
+ }
217
+ }
218
+ /**
219
+ * Parse a boolean text the way the formats write it: `true` / `false` in any case, or `1` / `0`.
220
+ * @param text - the value text
221
+ * @returns the boolean, or null when the text is neither
222
+ */
223
+ export function parseBooleanText(text) {
224
+ switch (text.trim().toLowerCase()) {
225
+ case "true":
226
+ case "1":
227
+ return true;
228
+ case "false":
229
+ case "0":
230
+ return false;
231
+ default:
232
+ return null;
233
+ }
234
+ }
235
+ /**
236
+ * Parse a float / double text: a decimal or exponent literal, or the XSD / JSON spellings of the
237
+ * non-finite values (`INF`, `-INF`, `Infinity`, `-Infinity`, `NaN`).
238
+ * @param text - the value text
239
+ * @param kind - float or double, for the error
240
+ * @returns the number
241
+ */
242
+ export function parseDecimalText(text, kind = "double") {
243
+ const trimmed = text.trim();
244
+ if (DECIMAL_TEXT.test(trimmed)) {
245
+ return Number(trimmed);
246
+ }
247
+ switch (trimmed) {
248
+ case "INF":
249
+ case "+INF":
250
+ case "Infinity":
251
+ case "+Infinity":
252
+ return Infinity;
253
+ case "-INF":
254
+ case "-Infinity":
255
+ return -Infinity;
256
+ case "NaN":
257
+ return NaN;
258
+ default:
259
+ throw typeError(text, kind);
260
+ }
261
+ }
262
+ /**
263
+ * Parse a Neo4j point literal `{x:1.0, y:2.0, crs:'cartesian'}` (also `latitude` / `longitude` /
264
+ * `height` / `z` / `srid`) into a JSON object; a JSON object text is accepted as well.
265
+ * @param text - the value text
266
+ * @returns an object with numeric coordinates and string crs
267
+ */
268
+ export function parsePointText(text) {
269
+ const trimmed = text.trim();
270
+ if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
271
+ throw typeError(text, "point");
272
+ }
273
+ const out = {};
274
+ const inner = trimmed.slice(1, -1).trim();
275
+ if (inner.length === 0) {
276
+ return out;
277
+ }
278
+ for (const part of inner.split(",")) {
279
+ const colon = part.indexOf(":");
280
+ if (colon < 0) {
281
+ throw typeError(text, "point");
282
+ }
283
+ const key = part
284
+ .slice(0, colon)
285
+ .trim()
286
+ .replace(/^["']|["']$/g, "");
287
+ const raw = part.slice(colon + 1).trim();
288
+ if (key.length === 0) {
289
+ throw typeError(text, "point");
290
+ }
291
+ if (DECIMAL_TEXT.test(raw)) {
292
+ out[key] = Number(raw);
293
+ }
294
+ else if ((raw.startsWith("'") && raw.endsWith("'")) || (raw.startsWith('"') && raw.endsWith('"'))) {
295
+ out[key] = raw.slice(1, -1);
296
+ }
297
+ else {
298
+ throw typeError(text, "point");
299
+ }
300
+ }
301
+ return out;
302
+ }
303
+ /**
304
+ * Parse JSON text into a value.
305
+ * @param text - the JSON text
306
+ * @returns the parsed value
307
+ */
308
+ function parseJsonText(text) {
309
+ try {
310
+ return JSON.parse(text);
311
+ }
312
+ catch {
313
+ throw typeError(text, "json");
314
+ }
315
+ }
316
+ /**
317
+ * The E_COLUMN_TYPE error of a text that is not of a kind.
318
+ * @param text - the text
319
+ * @param kind - the kind
320
+ * @returns the error
321
+ */
322
+ function typeError(text, kind) {
323
+ const shown = text.length > 40 ? `${text.slice(0, 40)}...` : text;
324
+ return new GraphFormatError("E_COLUMN_TYPE", `"${shown}" is not a ${kind}`, { value: text, kind });
325
+ }
326
+ //# sourceMappingURL=declared-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-types.js","sourceRoot":"","sources":["../../../src/common/declared-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAc,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAqB,MAAM,eAAe,CAAC;AAmCjE,MAAM,OAAO,GAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAChE,MAAM,OAAO,GAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC/D,MAAM,IAAI,GAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC1E,MAAM,KAAK,GAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,C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,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,IAAY;IAC/B,IAAI,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,IAAe;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,OAAO,IAAI,gBAAgB,CAAC,eAAe,EAAE,IAAI,KAAK,cAAc,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACvG,CAAC"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Direction resolution through the sink (design sections 3.6 and 8.4, decision D-DIR): the
3
+ * importer reads the file's header direction, calls `sink.setDirected()` once before the first
4
+ * edge, then pushes every edge as it is read. Mixed files are handled per `onMixedDirection`:
5
+ *
6
+ * - "expand" (default): an undirected edge into a directed sink becomes two logical edges linked
7
+ * by the `graphty.pair` column with `graphty.directed` = false on both halves; a directed edge
8
+ * into an undirected sink triggers ONE `setDirected(true, { expand: true })`, after which the
9
+ * builder has expanded everything pushed so far and the importer continues in directed mode.
10
+ * - "directed" / "undirected": every edge is treated that way (the distinction is dropped and
11
+ * reported once, with the count).
12
+ * - "error": the first edge whose direction differs from the sink's aborts the import.
13
+ *
14
+ * A locked or non-empty sink wins over the file (design section 8.4 precedence): a refused
15
+ * `setDirected` is recorded as a coercion issue and the importer continues with `sink.directed`,
16
+ * expanding every edge that differs. A GEXF `mutual` edge expands like an undirected one with the
17
+ * additional `graphty.mutual` role column set on its primary half.
18
+ *
19
+ * The reserved columns are declared with exactly the builder's own declarations so that a sink the
20
+ * builder already expanded hands back the existing handles.
21
+ */
22
+ import { type GraphSink, type GraphSnapshot, type NodeId } from "@graphty/graph-format";
23
+ import { DIRECTION_FORCED_CODE, DIRECTION_REFUSED_CODE, MIXED_DIRECTION_CODE } from "./codes.js";
24
+ import { type ImportReportBuilder } from "./report.js";
25
+ /**
26
+ * The direction of one source edge.
27
+ * Consumed by the per-format importers and exporters under src/formats.
28
+ * @public
29
+ */
30
+ export type EdgeKind = "directed" | "undirected" | "mutual";
31
+ /**
32
+ * Where an edge or header was read, for issues.
33
+ * Consumed by the per-format importers and exporters under src/formats.
34
+ * @public
35
+ */
36
+ export interface EdgeLocation {
37
+ /** The 1-based line, when known. */
38
+ readonly line?: number | null | undefined;
39
+ /** The edge id or another element name, when known. */
40
+ readonly element?: string | null | undefined;
41
+ }
42
+ /** The name of the bool edge column marking source-directed edges (design section 3.6). */
43
+ export declare const DIRECTED_COLUMN = "graphty.directed";
44
+ /** The name of the u32 edge column pairing the halves of an expanded edge (design section 3.6). */
45
+ export declare const PAIR_COLUMN = "graphty.pair";
46
+ /** The name of the bool edge column marking GEXF mutual edges (design section 3.6). */
47
+ export declare const MUTUAL_COLUMN = "graphty.mutual";
48
+ export { DIRECTION_FORCED_CODE, DIRECTION_REFUSED_CODE, MIXED_DIRECTION_CODE };
49
+ /**
50
+ * Pushes edges into a sink while resolving direction per design section 8.4. One instance per
51
+ * import call; `setHeader()` before the first `addEdge()`.
52
+ */
53
+ export declare class DirectionResolver {
54
+ private readonly sink;
55
+ private readonly report;
56
+ private readonly policy;
57
+ private directedHandle;
58
+ private pairHandle;
59
+ private mutualHandle;
60
+ /** The first edge index this resolver pushed, for the backfill of graphty.directed; -1 before the first. */
61
+ private firstEdge;
62
+ /** The next edge index this resolver expects to receive (contiguity between compactions, I16). */
63
+ private nextEdge;
64
+ private forcedCount;
65
+ private headerSet;
66
+ private mirrorOfLast;
67
+ /**
68
+ * Create a resolver.
69
+ * @param sink - the sink edges are pushed into
70
+ * @param report - the report issues are recorded in
71
+ * @param policy - the resolved onMixedDirection option
72
+ */
73
+ constructor(sink: GraphSink, report: ImportReportBuilder, policy: "expand" | "directed" | "undirected" | "error");
74
+ /**
75
+ * The sink's current direction.
76
+ * @returns true when directed
77
+ */
78
+ get directed(): boolean;
79
+ /**
80
+ * Whether the reserved direction columns exist (the sink holds expanded edges).
81
+ * @returns true once graphty.pair was declared or adopted
82
+ */
83
+ get expanded(): boolean;
84
+ /**
85
+ * Rule 1 of design section 8.4: set the sink's direction from the file's header (or the
86
+ * `defaultDirected` option for a file that declares none) before the first edge. Under the
87
+ * "directed" / "undirected" policies the policy's direction is used instead and the difference
88
+ * is reported. A refusal (E_DIRECTED: locked, or a non-empty directed sink for an undirected
89
+ * header) is recorded as a coercion issue and the sink's direction stands; a non-empty unlocked
90
+ * undirected sink with a directed header is expanded in place.
91
+ * @param headerDirected - the direction the file declares (or the default)
92
+ * @param where - the line of the header, when known
93
+ */
94
+ setHeader(headerDirected: boolean, where?: EdgeLocation): void;
95
+ /**
96
+ * Pick up reserved columns a caller's sink already holds (an earlier expansion), so every edge
97
+ * pushed from now on gets its graphty.directed value.
98
+ */
99
+ private adoptExisting;
100
+ /**
101
+ * The mirror half of the edge most recently pushed by addEdge(), when it was expanded into a
102
+ * pair; INVALID_INDEX otherwise. An importer that learns an edge's weight after pushing it
103
+ * (a GEXF attvalue) sets it on both halves.
104
+ * @returns the mirror's logical index, or INVALID_INDEX
105
+ */
106
+ get lastMirror(): number;
107
+ /**
108
+ * Rule 2 of design section 8.4: push one source edge. An edge whose direction equals the
109
+ * sink's is one addEdge; one that differs is expanded, forced or refused per the policy.
110
+ * @param source - the source id
111
+ * @param target - the target id
112
+ * @param kind - the edge's direction in the file
113
+ * @param weight - the weight, or undefined when the file gives none
114
+ * @param where - the line and element, for issues
115
+ * @returns the logical index of the (primary) edge
116
+ */
117
+ addEdge(source: NodeId, target: NodeId, kind: EdgeKind, weight?: number, where?: EdgeLocation): number;
118
+ /**
119
+ * How many edges were pushed with a direction other than their own under the forcing policies.
120
+ * @returns the count
121
+ */
122
+ get forced(): number;
123
+ /**
124
+ * Expand one edge that differs from the sink's direction.
125
+ * @param source - the source id
126
+ * @param target - the target id
127
+ * @param kind - the edge's direction in the file
128
+ * @param weight - the weight, or undefined
129
+ * @param where - the line and element, for issues
130
+ * @returns the primary edge index
131
+ */
132
+ private expand;
133
+ /**
134
+ * Note an edge index this resolver pushed, for the backfill of graphty.directed.
135
+ * @param e - the edge index
136
+ */
137
+ private track;
138
+ /**
139
+ * Pick up the reserved columns the builder wrote during its own expansion.
140
+ */
141
+ private adoptExpansionColumns;
142
+ /**
143
+ * Declare the reserved columns on first use in a directed sink and backfill graphty.directed
144
+ * = true for every edge this resolver pushed so far (they were directed in the source).
145
+ */
146
+ private ensureExpansionColumns;
147
+ /** Declare graphty.mutual on first use. */
148
+ private ensureMutualColumn;
149
+ }
150
+ /**
151
+ * The expanded-pair view of a snapshot's logical edges for exporters (design sections 3.6 and
152
+ * 8.5): which edges are the mirror half of an expanded pair (and are folded back into their
153
+ * primary), which were undirected in the source, and which carry the GEXF mutual mark. One
154
+ * implementation for every exporter; the only per-format choice is whether a mutual pair folds
155
+ * back into one edge (`foldMutual`, for formats with a mutual or undirected slot) or is written as
156
+ * two directed edges (the default).
157
+ * Consumed by the per-format exporters under src/formats.
158
+ * @public
159
+ */
160
+ export interface PairFolding {
161
+ /** Whether the snapshot carries expanded pairs at all (the pair role column exists). */
162
+ readonly expanded: boolean;
163
+ /** The number of mutual primaries (edges with the mutual mark whose mirror exists). */
164
+ readonly mutualCount: number;
165
+ /**
166
+ * Whether an edge is the mirror half of a pair the exporter folds (its primary is written).
167
+ * @param e - the logical edge index
168
+ * @returns true when the edge must be skipped
169
+ */
170
+ folded(e: number): boolean;
171
+ /**
172
+ * The other half of an expanded pair.
173
+ * @param e - the logical edge index
174
+ * @returns the mate's index, or INVALID_INDEX when the edge is not paired
175
+ */
176
+ mateOf(e: number): number;
177
+ /**
178
+ * Whether an edge was directed in the source (true for every edge of a snapshot without the
179
+ * directed role column, and for an undirected snapshot's edges as far as the column says).
180
+ * @param e - the logical edge index
181
+ * @returns the source direction
182
+ */
183
+ sourceDirected(e: number): boolean;
184
+ /**
185
+ * Whether an edge is a mutual primary or mirror (the GEXF `mutual` type).
186
+ * @param e - the logical edge index
187
+ * @returns true for a mutual edge
188
+ */
189
+ isMutual(e: number): boolean;
190
+ }
191
+ /** The per-format choice of pairFolding(). */
192
+ export interface PairFoldingOptions {
193
+ /**
194
+ * Fold a mutual pair back into its primary (a format with a mutual or undirected slot);
195
+ * false (the default) writes both halves as directed edges, and the caller reports the mark.
196
+ */
197
+ readonly foldMutual?: boolean | undefined;
198
+ }
199
+ /**
200
+ * Build the pair-folding view of a snapshot (one pass over the role columns).
201
+ * @param snapshot - the snapshot
202
+ * @param options - the per-format choice
203
+ * @returns the view
204
+ */
205
+ export declare function pairFolding(snapshot: GraphSnapshot, options?: PairFoldingOptions): PairFolding;
206
+ //# sourceMappingURL=direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/common/direction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAKH,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,MAAM,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG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