@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.
- package/README.md +49 -414
- package/dist/chunks/children-CL3Cy0ez.js.map +1 -1
- package/dist/chunks/choose-BbJI55dx.js +56 -0
- package/dist/chunks/choose-BbJI55dx.js.map +1 -0
- package/dist/chunks/constants-BCsFsMj4.js +231 -0
- package/dist/chunks/constants-BCsFsMj4.js.map +1 -0
- package/dist/chunks/{escape-B-tkk_Cl.js → escape-D0g6NNUy.js} +382 -92
- package/dist/chunks/escape-D0g6NNUy.js.map +1 -0
- package/dist/chunks/export-BTI4yQgy.js +4333 -0
- package/dist/chunks/export-BTI4yQgy.js.map +1 -0
- package/dist/chunks/exporter-BMqk5oxW.js +3465 -0
- package/dist/chunks/exporter-BMqk5oxW.js.map +1 -0
- package/dist/chunks/{importer-eUREhBGj.js → exporter-Cra2GYcN.js} +4969 -3201
- package/dist/chunks/exporter-Cra2GYcN.js.map +1 -0
- package/dist/chunks/{exporter-BGrsWamJ.js → exporter-Dxh231ZF.js} +38 -229
- package/dist/chunks/exporter-Dxh231ZF.js.map +1 -0
- package/dist/chunks/{exporter-DIeGJXAZ.js → exporter-tne475KK.js} +22 -20
- package/dist/chunks/exporter-tne475KK.js.map +1 -0
- package/dist/chunks/importer-90YWhJoF.js +2811 -0
- package/dist/chunks/importer-90YWhJoF.js.map +1 -0
- package/dist/chunks/{importer-D_e7e7LX.js → importer-Bcl1d4xH.js} +398 -145
- package/dist/chunks/importer-Bcl1d4xH.js.map +1 -0
- package/dist/chunks/{importer-BWY2FFc5.js → importer-BfIsp1f9.js} +255 -77
- package/dist/chunks/importer-BfIsp1f9.js.map +1 -0
- package/dist/chunks/{importer-zGLo8Dg_.js → importer-C_TEA1zJ.js} +484 -157
- package/dist/chunks/importer-C_TEA1zJ.js.map +1 -0
- package/dist/chunks/{importer-DET1tg6s.js → importer-DCjOvO7U.js} +1687 -310
- package/dist/chunks/importer-DCjOvO7U.js.map +1 -0
- package/dist/chunks/{importer-vi3bSdtw.js → importer-DfVu6j59.js} +509 -76
- package/dist/chunks/importer-DfVu6j59.js.map +1 -0
- package/dist/chunks/{importer-DIrbbnAf.js → importer-Dku_VAIY.js} +585 -226
- package/dist/chunks/importer-Dku_VAIY.js.map +1 -0
- package/dist/chunks/json-elements-3tnyt5uZ.js +1225 -0
- package/dist/chunks/json-elements-3tnyt5uZ.js.map +1 -0
- package/dist/chunks/ontology-export-B9Tcf37D.js +357 -0
- package/dist/chunks/ontology-export-B9Tcf37D.js.map +1 -0
- package/dist/chunks/{records-dbRkxwaq.js → records-CQXT__mY.js} +298 -114
- package/dist/chunks/records-CQXT__mY.js.map +1 -0
- package/dist/chunks/{text-Dr0Ifpag.js → text-DmcUs5_Q.js} +29 -11
- package/dist/chunks/text-DmcUs5_Q.js.map +1 -0
- package/dist/chunks/{writer-C7flM-Ih.js → writer-DxjgHwSe.js} +19 -1
- package/dist/chunks/writer-DxjgHwSe.js.map +1 -0
- package/dist/csv.js +951 -261
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +6 -3
- package/dist/cx2.js +2 -2
- package/dist/cys.js +6 -3
- package/dist/dot.js +1 -1
- package/dist/gexf.js +554 -122
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +342 -85
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +1105 -213
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -2
- package/dist/graphml.js.map +1 -1
- package/dist/json.js +3 -2
- package/dist/neo4j.js +564 -157
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +6 -3
- package/dist/pajek.js +1 -1
- package/dist/src/children.d.ts +18 -6
- package/dist/src/children.d.ts.map +1 -1
- package/dist/src/children.js +6 -3
- package/dist/src/children.js.map +1 -1
- package/dist/src/common/attributes.d.ts +29 -11
- package/dist/src/common/attributes.d.ts.map +1 -1
- package/dist/src/common/attributes.js +25 -7
- package/dist/src/common/attributes.js.map +1 -1
- package/dist/src/common/cell-budget.d.ts +9 -2
- package/dist/src/common/cell-budget.d.ts.map +1 -1
- package/dist/src/common/cell-budget.js +11 -3
- package/dist/src/common/cell-budget.js.map +1 -1
- package/dist/src/common/choose.d.ts +19 -0
- package/dist/src/common/choose.d.ts.map +1 -0
- package/dist/src/common/choose.js +72 -0
- package/dist/src/common/choose.js.map +1 -0
- package/dist/src/common/codes.d.ts +456 -66
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +458 -66
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/compare.d.ts +81 -0
- package/dist/src/common/compare.d.ts.map +1 -0
- package/dist/src/common/compare.js +394 -0
- package/dist/src/common/compare.js.map +1 -0
- package/dist/src/common/cx-export.d.ts +123 -0
- package/dist/src/common/cx-export.d.ts.map +1 -0
- package/dist/src/common/cx-export.js +334 -0
- package/dist/src/common/cx-export.js.map +1 -0
- package/dist/src/common/declared-types.d.ts +22 -2
- package/dist/src/common/declared-types.d.ts.map +1 -1
- package/dist/src/common/declared-types.js +19 -1
- package/dist/src/common/declared-types.js.map +1 -1
- package/dist/src/common/direction.d.ts +74 -50
- package/dist/src/common/direction.d.ts.map +1 -1
- package/dist/src/common/direction.js +47 -27
- package/dist/src/common/direction.js.map +1 -1
- package/dist/src/common/escape.d.ts +21 -9
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +33 -17
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/export.d.ts +144 -32
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +216 -42
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/format.d.ts +23 -1
- package/dist/src/common/format.d.ts.map +1 -1
- package/dist/src/common/format.js +26 -1
- package/dist/src/common/format.js.map +1 -1
- package/dist/src/common/ids.d.ts +9 -2
- package/dist/src/common/ids.d.ts.map +1 -1
- package/dist/src/common/ids.js +6 -2
- package/dist/src/common/ids.js.map +1 -1
- package/dist/src/common/input.d.ts +122 -28
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +890 -124
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +144 -20
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +868 -188
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/line-format.d.ts +90 -0
- package/dist/src/common/line-format.d.ts.map +1 -0
- package/dist/src/common/line-format.js +185 -0
- package/dist/src/common/line-format.js.map +1 -0
- package/dist/src/common/lists.d.ts +6 -1
- package/dist/src/common/lists.d.ts.map +1 -1
- package/dist/src/common/lists.js +2 -0
- package/dist/src/common/lists.js.map +1 -1
- package/dist/src/common/ontology-export.d.ts +167 -0
- package/dist/src/common/ontology-export.d.ts.map +1 -0
- package/dist/src/common/ontology-export.js +359 -0
- package/dist/src/common/ontology-export.js.map +1 -0
- package/dist/src/common/ontology.d.ts +25 -3
- package/dist/src/common/ontology.d.ts.map +1 -1
- package/dist/src/common/ontology.js +30 -9
- package/dist/src/common/ontology.js.map +1 -1
- package/dist/src/common/options.d.ts +62 -12
- package/dist/src/common/options.d.ts.map +1 -1
- package/dist/src/common/options.js +89 -11
- package/dist/src/common/options.js.map +1 -1
- package/dist/src/common/plural.d.ts +31 -0
- package/dist/src/common/plural.d.ts.map +1 -0
- package/dist/src/common/plural.js +46 -0
- package/dist/src/common/plural.js.map +1 -0
- package/dist/src/common/report.d.ts +72 -14
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +146 -22
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/common/temporal.d.ts +22 -5
- package/dist/src/common/temporal.d.ts.map +1 -1
- package/dist/src/common/temporal.js +13 -2
- package/dist/src/common/temporal.js.map +1 -1
- package/dist/src/common/text.d.ts +39 -23
- package/dist/src/common/text.d.ts.map +1 -1
- package/dist/src/common/text.js +51 -21
- package/dist/src/common/text.js.map +1 -1
- package/dist/src/common/weights.d.ts +37 -4
- package/dist/src/common/weights.d.ts.map +1 -1
- package/dist/src/common/weights.js +61 -2
- package/dist/src/common/weights.js.map +1 -1
- package/dist/src/common/writer.d.ts +19 -3
- package/dist/src/common/writer.d.ts.map +1 -1
- package/dist/src/common/writer.js +30 -2
- package/dist/src/common/writer.js.map +1 -1
- package/dist/src/common/xml.d.ts +125 -9
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +400 -83
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/common/zip.d.ts +44 -4
- package/dist/src/common/zip.d.ts.map +1 -1
- package/dist/src/common/zip.js +134 -5
- package/dist/src/common/zip.js.map +1 -1
- package/dist/src/formats/csv/exporter.d.ts +80 -24
- package/dist/src/formats/csv/exporter.d.ts.map +1 -1
- package/dist/src/formats/csv/exporter.js +145 -32
- package/dist/src/formats/csv/exporter.js.map +1 -1
- package/dist/src/formats/csv/header.d.ts +38 -9
- package/dist/src/formats/csv/header.d.ts.map +1 -1
- package/dist/src/formats/csv/header.js +46 -10
- package/dist/src/formats/csv/header.js.map +1 -1
- package/dist/src/formats/csv/importer.d.ts +187 -37
- package/dist/src/formats/csv/importer.d.ts.map +1 -1
- package/dist/src/formats/csv/importer.js +835 -204
- package/dist/src/formats/csv/importer.js.map +1 -1
- package/dist/src/formats/csv/index.d.ts +100 -19
- package/dist/src/formats/csv/index.d.ts.map +1 -1
- package/dist/src/formats/csv/index.js +94 -21
- package/dist/src/formats/csv/index.js.map +1 -1
- package/dist/src/formats/csv/records.d.ts +95 -10
- package/dist/src/formats/csv/records.d.ts.map +1 -1
- package/dist/src/formats/csv/records.js +333 -122
- package/dist/src/formats/csv/records.js.map +1 -1
- package/dist/src/formats/csv/values.d.ts +1 -0
- package/dist/src/formats/csv/values.d.ts.map +1 -1
- package/dist/src/formats/csv/values.js +1 -0
- package/dist/src/formats/csv/values.js.map +1 -1
- package/dist/src/formats/cx/exporter.d.ts +102 -0
- package/dist/src/formats/cx/exporter.d.ts.map +1 -0
- package/dist/src/formats/cx/exporter.js +1217 -0
- package/dist/src/formats/cx/exporter.js.map +1 -0
- package/dist/src/formats/cx/importer.d.ts +79 -32
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +680 -285
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/index.d.ts +4 -3
- package/dist/src/formats/cx/index.d.ts.map +1 -1
- package/dist/src/formats/cx/index.js +4 -3
- package/dist/src/formats/cx/index.js.map +1 -1
- package/dist/src/formats/cx2/exporter.d.ts +29 -11
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx2/exporter.js +39 -268
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts +78 -28
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +226 -79
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/index.d.ts +2 -1
- package/dist/src/formats/cx2/index.d.ts.map +1 -1
- package/dist/src/formats/cx2/index.js +2 -1
- package/dist/src/formats/cx2/index.js.map +1 -1
- package/dist/src/formats/cys/constants.d.ts +66 -17
- package/dist/src/formats/cys/constants.d.ts.map +1 -1
- package/dist/src/formats/cys/constants.js +59 -18
- package/dist/src/formats/cys/constants.js.map +1 -1
- package/dist/src/formats/cys/exporter.d.ts +118 -0
- package/dist/src/formats/cys/exporter.d.ts.map +1 -0
- package/dist/src/formats/cys/exporter.js +1072 -0
- package/dist/src/formats/cys/exporter.js.map +1 -0
- package/dist/src/formats/cys/importer.d.ts +22 -8
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +510 -149
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/index.d.ts +4 -2
- package/dist/src/formats/cys/index.d.ts.map +1 -1
- package/dist/src/formats/cys/index.js +4 -2
- package/dist/src/formats/cys/index.js.map +1 -1
- package/dist/src/formats/cys/session.d.ts +46 -7
- package/dist/src/formats/cys/session.d.ts.map +1 -1
- package/dist/src/formats/cys/session.js +98 -24
- package/dist/src/formats/cys/session.js.map +1 -1
- package/dist/src/formats/cys/tables.d.ts +9 -2
- package/dist/src/formats/cys/tables.d.ts.map +1 -1
- package/dist/src/formats/cys/tables.js +29 -7
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +42 -14
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +56 -29
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +91 -29
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +190 -39
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +2 -1
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +2 -1
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/names.d.ts +44 -11
- package/dist/src/formats/dot/names.d.ts.map +1 -1
- package/dist/src/formats/dot/names.js +44 -11
- package/dist/src/formats/dot/names.js.map +1 -1
- package/dist/src/formats/dot/tokenizer.d.ts +9 -2
- package/dist/src/formats/dot/tokenizer.d.ts.map +1 -1
- package/dist/src/formats/dot/tokenizer.js +20 -5
- package/dist/src/formats/dot/tokenizer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts +46 -15
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +45 -15
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +87 -23
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +471 -90
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +84 -21
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +80 -23
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gexf/schema.d.ts +67 -15
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +59 -13
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gml/exporter.d.ts +69 -21
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +74 -29
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +116 -25
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +290 -61
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +87 -24
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +79 -26
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/syntax.d.ts +67 -18
- package/dist/src/formats/gml/syntax.d.ts.map +1 -1
- package/dist/src/formats/gml/syntax.js +108 -26
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +174 -44
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +165 -44
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts +17 -9
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +33 -12
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts +19 -7
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +466 -39
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/index.d.ts +2 -1
- package/dist/src/formats/graphml/index.d.ts.map +1 -1
- package/dist/src/formats/graphml/index.js +2 -1
- package/dist/src/formats/graphml/index.js.map +1 -1
- package/dist/src/formats/graphml/tree.d.ts +6 -2
- package/dist/src/formats/graphml/tree.d.ts.map +1 -1
- package/dist/src/formats/graphml/tree.js +6 -2
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +8 -3
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +36 -15
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts +88 -24
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +109 -19
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts +134 -22
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +135 -54
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +173 -52
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +899 -220
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/index.d.ts +3 -2
- package/dist/src/formats/json/index.d.ts.map +1 -1
- package/dist/src/formats/json/index.js +3 -2
- package/dist/src/formats/json/index.js.map +1 -1
- package/dist/src/formats/json/obographs-export.d.ts +68 -0
- package/dist/src/formats/json/obographs-export.d.ts.map +1 -0
- package/dist/src/formats/json/obographs-export.js +941 -0
- package/dist/src/formats/json/obographs-export.js.map +1 -0
- package/dist/src/formats/json/obographs.d.ts +26 -0
- package/dist/src/formats/json/obographs.d.ts.map +1 -1
- package/dist/src/formats/json/obographs.js +297 -80
- package/dist/src/formats/json/obographs.js.map +1 -1
- package/dist/src/formats/neo4j/exporter.d.ts +109 -21
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +238 -85
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/neo4j/header.d.ts +17 -4
- package/dist/src/formats/neo4j/header.d.ts.map +1 -1
- package/dist/src/formats/neo4j/header.js +36 -4
- package/dist/src/formats/neo4j/header.js.map +1 -1
- package/dist/src/formats/neo4j/importer.d.ts +107 -27
- package/dist/src/formats/neo4j/importer.d.ts.map +1 -1
- package/dist/src/formats/neo4j/importer.js +415 -63
- package/dist/src/formats/neo4j/importer.js.map +1 -1
- package/dist/src/formats/neo4j/index.d.ts +73 -23
- package/dist/src/formats/neo4j/index.d.ts.map +1 -1
- package/dist/src/formats/neo4j/index.js +65 -25
- package/dist/src/formats/neo4j/index.js.map +1 -1
- package/dist/src/formats/obo/exporter.d.ts +150 -0
- package/dist/src/formats/obo/exporter.d.ts.map +1 -0
- package/dist/src/formats/obo/exporter.js +1736 -0
- package/dist/src/formats/obo/exporter.js.map +1 -0
- package/dist/src/formats/obo/importer.d.ts +95 -19
- package/dist/src/formats/obo/importer.d.ts.map +1 -1
- package/dist/src/formats/obo/importer.js +475 -104
- package/dist/src/formats/obo/importer.js.map +1 -1
- package/dist/src/formats/obo/index.d.ts +6 -3
- package/dist/src/formats/obo/index.d.ts.map +1 -1
- package/dist/src/formats/obo/index.js +6 -3
- package/dist/src/formats/obo/index.js.map +1 -1
- package/dist/src/formats/obo/syntax.d.ts +108 -4
- package/dist/src/formats/obo/syntax.d.ts.map +1 -1
- package/dist/src/formats/obo/syntax.js +211 -34
- package/dist/src/formats/obo/syntax.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +54 -16
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +66 -34
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +84 -22
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +303 -83
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +2 -1
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js +2 -1
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts +77 -14
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +183 -51
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts +1 -0
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -1
- package/dist/src/formats/xgmml/columns.js +4 -0
- package/dist/src/formats/xgmml/columns.js.map +1 -1
- package/dist/src/formats/xgmml/constants.d.ts +186 -56
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -1
- package/dist/src/formats/xgmml/constants.js +181 -57
- package/dist/src/formats/xgmml/constants.js.map +1 -1
- package/dist/src/formats/xgmml/document.d.ts +65 -11
- package/dist/src/formats/xgmml/document.d.ts.map +1 -1
- package/dist/src/formats/xgmml/document.js +157 -28
- package/dist/src/formats/xgmml/document.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +61 -3
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +129 -26
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts +13 -6
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +20 -21
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.d.ts +33 -12
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
- package/dist/src/formats/xgmml/importer.js +35 -72
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/formats/xgmml/index.d.ts +1 -0
- package/dist/src/formats/xgmml/index.d.ts.map +1 -1
- package/dist/src/formats/xgmml/index.js +1 -0
- package/dist/src/formats/xgmml/index.js.map +1 -1
- package/dist/src/formats/xgmml/values.d.ts +8 -1
- package/dist/src/formats/xgmml/values.d.ts.map +1 -1
- package/dist/src/formats/xgmml/values.js +7 -2
- package/dist/src/formats/xgmml/values.js.map +1 -1
- package/dist/src/index.d.ts +23 -18
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +28 -16
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts +478 -92
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +807 -88
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sniff.d.ts +61 -19
- package/dist/src/sniff.d.ts.map +1 -1
- package/dist/src/sniff.js +121 -29
- package/dist/src/sniff.js.map +1 -1
- package/dist/src/types.d.ts +362 -112
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +28 -7
- package/dist/src/types.js.map +1 -1
- package/dist/xgmml.js +2 -2
- package/docs/samples/README.md +25 -0
- package/docs/samples/got-edges.csv +353 -0
- package/docs/samples/got-network.graphml +1384 -0
- package/docs/samples/got-nodes.csv +108 -0
- package/docs/samples/got.cx +930 -0
- package/docs/samples/got.cx2 +465 -0
- package/docs/samples/got.gexf +471 -0
- package/docs/samples/got.gml +2650 -0
- package/docs/samples/got.json +2546 -0
- package/docs/samples/got.net +461 -0
- package/docs/samples/movies-nodes.csv +9 -0
- package/docs/samples/movies-rels.csv +8 -0
- package/docs/samples/networks.cys +0 -0
- package/docs/samples/proteins.xgmml +9 -0
- package/docs/samples/teams.gv +24 -0
- package/docs/samples/vehicles.obo +25 -0
- package/package.json +9 -4
- package/src/children.ts +18 -6
- package/src/common/attributes.ts +29 -11
- package/src/common/cell-budget.ts +11 -3
- package/src/common/choose.ts +89 -0
- package/src/common/codes.ts +490 -66
- package/src/common/compare.ts +472 -0
- package/src/common/cx-export.ts +432 -0
- package/src/common/declared-types.ts +38 -4
- package/src/common/direction.ts +78 -51
- package/src/common/escape.ts +33 -17
- package/src/common/export.ts +284 -47
- package/src/common/format.ts +30 -1
- package/src/common/ids.ts +14 -3
- package/src/common/input.ts +1057 -134
- package/src/common/json-elements.ts +1034 -198
- package/src/common/line-format.ts +249 -0
- package/src/common/lists.ts +6 -1
- package/src/common/ontology-export.ts +461 -0
- package/src/common/ontology.ts +31 -9
- package/src/common/options.ts +110 -15
- package/src/common/plural.ts +49 -0
- package/src/common/report.ts +168 -25
- package/src/common/temporal.ts +22 -5
- package/src/common/text.ts +62 -23
- package/src/common/weights.ts +74 -4
- package/src/common/writer.ts +37 -3
- package/src/common/xml.ts +477 -88
- package/src/common/zip.ts +169 -7
- package/src/formats/csv/exporter.ts +201 -46
- package/src/formats/csv/header.ts +50 -11
- package/src/formats/csv/importer.ts +1133 -245
- package/src/formats/csv/index.ts +106 -19
- package/src/formats/csv/records.ts +396 -122
- package/src/formats/csv/values.ts +1 -0
- package/src/formats/cx/exporter.ts +1483 -0
- package/src/formats/cx/importer.ts +888 -300
- package/src/formats/cx/index.ts +4 -3
- package/src/formats/cx2/exporter.ts +61 -338
- package/src/formats/cx2/importer.ts +317 -86
- package/src/formats/cx2/index.ts +2 -1
- package/src/formats/cys/constants.ts +62 -17
- package/src/formats/cys/exporter.ts +1368 -0
- package/src/formats/cys/importer.ts +659 -157
- package/src/formats/cys/index.ts +4 -2
- package/src/formats/cys/session.ts +139 -31
- package/src/formats/cys/tables.ts +47 -9
- package/src/formats/dot/exporter.ts +83 -37
- package/src/formats/dot/importer.ts +248 -54
- package/src/formats/dot/index.ts +2 -1
- package/src/formats/dot/names.ts +44 -11
- package/src/formats/dot/tokenizer.ts +25 -6
- package/src/formats/gexf/exporter.ts +57 -18
- package/src/formats/gexf/importer.ts +636 -105
- package/src/formats/gexf/index.ts +90 -21
- package/src/formats/gexf/schema.ts +67 -15
- package/src/formats/gml/exporter.ts +90 -36
- package/src/formats/gml/importer.ts +388 -67
- package/src/formats/gml/index.ts +85 -24
- package/src/formats/gml/syntax.ts +111 -26
- package/src/formats/graphml/constants.ts +178 -44
- package/src/formats/graphml/exporter.ts +52 -18
- package/src/formats/graphml/importer.ts +640 -60
- package/src/formats/graphml/index.ts +2 -1
- package/src/formats/graphml/tree.ts +6 -2
- package/src/formats/graphml/yfiles.ts +37 -15
- package/src/formats/json/dialect.ts +128 -29
- package/src/formats/json/exporter.ts +205 -68
- package/src/formats/json/importer.ts +1163 -253
- package/src/formats/json/index.ts +3 -1
- package/src/formats/json/obographs-export.ts +1197 -0
- package/src/formats/json/obographs.ts +353 -92
- package/src/formats/neo4j/exporter.ts +320 -101
- package/src/formats/neo4j/header.ts +44 -6
- package/src/formats/neo4j/importer.ts +512 -73
- package/src/formats/neo4j/index.ts +75 -23
- package/src/formats/obo/exporter.ts +2210 -0
- package/src/formats/obo/importer.ts +622 -109
- package/src/formats/obo/index.ts +6 -3
- package/src/formats/obo/syntax.ts +232 -37
- package/src/formats/pajek/exporter.ts +89 -41
- package/src/formats/pajek/importer.ts +407 -93
- package/src/formats/pajek/index.ts +2 -1
- package/src/formats/pajek/syntax.ts +213 -52
- package/src/formats/xgmml/columns.ts +10 -0
- package/src/formats/xgmml/constants.ts +183 -56
- package/src/formats/xgmml/document.ts +212 -34
- package/src/formats/xgmml/emit.ts +175 -34
- package/src/formats/xgmml/exporter.ts +35 -27
- package/src/formats/xgmml/importer.ts +64 -86
- package/src/formats/xgmml/index.ts +1 -0
- package/src/formats/xgmml/values.ts +11 -3
- package/src/index.ts +81 -11
- package/src/registry.ts +1121 -135
- package/src/sniff.ts +163 -32
- package/src/types.ts +385 -114
- package/dist/chunks/escape-B-tkk_Cl.js.map +0 -1
- package/dist/chunks/export-Bh60Dv-n.js +0 -582
- package/dist/chunks/export-Bh60Dv-n.js.map +0 -1
- package/dist/chunks/exporter-BGrsWamJ.js.map +0 -1
- package/dist/chunks/exporter-DIeGJXAZ.js.map +0 -1
- package/dist/chunks/importer-BWY2FFc5.js.map +0 -1
- package/dist/chunks/importer-DD-xv9_Y.js +0 -1471
- package/dist/chunks/importer-DD-xv9_Y.js.map +0 -1
- package/dist/chunks/importer-DET1tg6s.js.map +0 -1
- package/dist/chunks/importer-DEcKhsmQ.js +0 -1614
- package/dist/chunks/importer-DEcKhsmQ.js.map +0 -1
- package/dist/chunks/importer-DIrbbnAf.js.map +0 -1
- package/dist/chunks/importer-D_e7e7LX.js.map +0 -1
- package/dist/chunks/importer-eUREhBGj.js.map +0 -1
- package/dist/chunks/importer-vi3bSdtw.js.map +0 -1
- package/dist/chunks/importer-zGLo8Dg_.js.map +0 -1
- package/dist/chunks/json-elements-DDS8N2Dd.js +0 -779
- package/dist/chunks/json-elements-DDS8N2Dd.js.map +0 -1
- package/dist/chunks/ontology-BnrJ4I98.js +0 -113
- package/dist/chunks/ontology-BnrJ4I98.js.map +0 -1
- package/dist/chunks/records-dbRkxwaq.js.map +0 -1
- package/dist/chunks/report-B1z4WT9e.js +0 -2372
- package/dist/chunks/report-B1z4WT9e.js.map +0 -1
- package/dist/chunks/text-Dr0Ifpag.js.map +0 -1
- package/dist/chunks/weights-Dzba96G3.js +0 -176
- package/dist/chunks/weights-Dzba96G3.js.map +0 -1
- package/dist/chunks/writer-C7flM-Ih.js.map +0 -1
|
@@ -10,10 +10,16 @@
|
|
|
10
10
|
* (an ImportError, an abort reason, a programming error) unchanged.
|
|
11
11
|
*/
|
|
12
12
|
import { ImportError, type ImportIssue, type ImportReport, type IssueCategory, type LossNote } from "../types.js";
|
|
13
|
+
/**
|
|
14
|
+
* The most warnings of one code a report keeps; later ones are counted in one W_ISSUES_SUPPRESSED
|
|
15
|
+
* warning, so a per-row warning on a large file cannot grow the report without bound.
|
|
16
|
+
* @category Issue and loss codes
|
|
17
|
+
*/
|
|
18
|
+
export declare const MAX_WARNINGS_PER_CODE = 1000;
|
|
13
19
|
/**
|
|
14
20
|
* Where an issue was found: the 1-based line and the element (id or attribute name) when known.
|
|
15
|
-
* Consumed by the per-format importers and exporters under src/formats.
|
|
16
21
|
* @public
|
|
22
|
+
* @category Writing a format
|
|
17
23
|
*/
|
|
18
24
|
export interface IssueLocation {
|
|
19
25
|
/** The 1-based source line, when known. */
|
|
@@ -23,8 +29,8 @@ export interface IssueLocation {
|
|
|
23
29
|
}
|
|
24
30
|
/**
|
|
25
31
|
* The mutable element counters of a report in progress; importers increment them directly in hot loops.
|
|
26
|
-
* Consumed by the per-format importers and exporters under src/formats.
|
|
27
32
|
* @public
|
|
33
|
+
* @category Plugin helpers
|
|
28
34
|
*/
|
|
29
35
|
export interface MutableCounts {
|
|
30
36
|
/** Nodes pushed. */
|
|
@@ -35,21 +41,19 @@ export interface MutableCounts {
|
|
|
35
41
|
skippedNodes: number;
|
|
36
42
|
/** Edges skipped after an error. */
|
|
37
43
|
skippedEdges: number;
|
|
38
|
-
/** Source edges expanded into two logical edges
|
|
44
|
+
/** Source edges expanded into two logical edges. */
|
|
39
45
|
expandedMixed: number;
|
|
40
46
|
}
|
|
41
47
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* input) propagates out of import() untouched, so no importer records this code any more; the
|
|
45
|
-
* constant stays for consumers that switch on the codes of earlier reports.
|
|
48
|
+
* No longer recorded; kept so code that switches on older reports still compiles.
|
|
49
|
+
* @category Issue and loss codes
|
|
46
50
|
*/
|
|
47
51
|
export declare const PARSE_ERROR_CODE = "E_PARSE";
|
|
48
52
|
/**
|
|
49
53
|
* Accumulates an ImportReport while an importer runs. Errors count toward the error limit; the
|
|
50
54
|
* error that takes the count beyond the limit is still recorded, `truncated` is set, and an
|
|
51
|
-
* ImportError carrying the report so far is thrown
|
|
52
|
-
*
|
|
55
|
+
* ImportError carrying the report so far is thrown. Warnings never abort.
|
|
56
|
+
* @category Writing a format
|
|
53
57
|
*/
|
|
54
58
|
export declare class ImportReportBuilder {
|
|
55
59
|
/** The importer's format name. */
|
|
@@ -61,6 +65,8 @@ export declare class ImportReportBuilder {
|
|
|
61
65
|
private readonly issueList;
|
|
62
66
|
private readonly lossList;
|
|
63
67
|
private readonly onceCodes;
|
|
68
|
+
/** Warnings recorded per code, kept or not. */
|
|
69
|
+
private readonly warningsByCode;
|
|
64
70
|
private errors;
|
|
65
71
|
private warnings;
|
|
66
72
|
private truncatedFlag;
|
|
@@ -107,7 +113,9 @@ export declare class ImportReportBuilder {
|
|
|
107
113
|
*/
|
|
108
114
|
error(category: IssueCategory, code: string, message: string, where?: IssueLocation): ImportIssue;
|
|
109
115
|
/**
|
|
110
|
-
* Record a warning; warnings never count toward the limit.
|
|
116
|
+
* Record a warning; warnings never count toward the limit. Beyond MAX_WARNINGS_PER_CODE
|
|
117
|
+
* warnings of one code the warning is counted, not kept: finish() adds one W_ISSUES_SUPPRESSED
|
|
118
|
+
* warning per such code with the number dropped.
|
|
111
119
|
* @param category - the issue category
|
|
112
120
|
* @param code - a stable code such as "W_WIDENED"
|
|
113
121
|
* @param message - a plain-ASCII message
|
|
@@ -137,7 +145,7 @@ export declare class ImportReportBuilder {
|
|
|
137
145
|
*/
|
|
138
146
|
loss(code: string, message: string, column?: string | null, count?: number | null): LossNote;
|
|
139
147
|
/**
|
|
140
|
-
* The per-element catch
|
|
148
|
+
* The per-element catch: record a thrown GraphFormatError as an error
|
|
141
149
|
* issue with its code and the category the code implies. Anything else is re-thrown unchanged:
|
|
142
150
|
* an ImportError (the import already aborted), an abort reason, and any other thrown value (a
|
|
143
151
|
* TypeError or RangeError is a programming error in the importer or the sink, never a defect of
|
|
@@ -147,6 +155,13 @@ export declare class ImportReportBuilder {
|
|
|
147
155
|
* @returns the recorded issue
|
|
148
156
|
*/
|
|
149
157
|
recordError(err: unknown, where?: IssueLocation): ImportIssue;
|
|
158
|
+
/**
|
|
159
|
+
* A builder that starts from everything this one recorded so far: issues, counts, loss notes,
|
|
160
|
+
* the warnOnce keys, the error and warning counts and the truncation flag. For an importer that
|
|
161
|
+
* reads its input once and emits several graphs, each with its own report.
|
|
162
|
+
* @returns the copy; later records to either builder do not reach the other
|
|
163
|
+
*/
|
|
164
|
+
fork(): ImportReportBuilder;
|
|
150
165
|
/**
|
|
151
166
|
* Build the ImportError that aborts the import, carrying the report so far. The caller throws
|
|
152
167
|
* it; this method only constructs it so it can be used in expression position.
|
|
@@ -164,6 +179,34 @@ export declare class ImportReportBuilder {
|
|
|
164
179
|
* @param details - optional machine-readable context for the ImportError
|
|
165
180
|
*/
|
|
166
181
|
fail(code: string, message: string, where?: IssueLocation, details?: Readonly<Record<string, unknown>>): never;
|
|
182
|
+
/**
|
|
183
|
+
* Record a fatal error of any category and abort, as fail() does for a parse error: a size
|
|
184
|
+
* limit (E_TOO_LARGE, category "unsupported") stops an import without being a defect of the
|
|
185
|
+
* syntax. A fatal error is not the error limit: `truncated` stays as it was.
|
|
186
|
+
* @param category - the issue category
|
|
187
|
+
* @param code - a stable code
|
|
188
|
+
* @param message - a plain-ASCII message
|
|
189
|
+
* @param where - the line and element, when known
|
|
190
|
+
* @param details - optional machine-readable context for the ImportError
|
|
191
|
+
*/
|
|
192
|
+
failWith(category: IssueCategory, code: string, message: string, where?: IssueLocation, details?: Readonly<Record<string, unknown>>): never;
|
|
193
|
+
/**
|
|
194
|
+
* Add a finished report to this one: its issues after the ones recorded so far, its counts, its
|
|
195
|
+
* loss notes and its truncated flag. Use it when an importer hands part of the work to another
|
|
196
|
+
* importer (for example, a wrapper around the CSV importer) and returns one report for both. The issues
|
|
197
|
+
* keep their codes; errors added this way do not count toward this report's error limit, since
|
|
198
|
+
* the other importer applied its own.
|
|
199
|
+
* @param report - the report the other importer returned
|
|
200
|
+
* @returns this builder
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const report = new ImportReportBuilder("netscope", opts.errorLimit);
|
|
204
|
+
* const text = await readText(input, report, opts);
|
|
205
|
+
* report.include(await csvImporter.import(text, sink, options));
|
|
206
|
+
* return report.finish();
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
include(report: ImportReport): this;
|
|
167
210
|
/**
|
|
168
211
|
* The report as it stands: a frozen snapshot with the parse duration so far. Can be called more
|
|
169
212
|
* than once; each call reflects everything recorded up to that point.
|
|
@@ -172,16 +215,31 @@ export declare class ImportReportBuilder {
|
|
|
172
215
|
finish(): ImportReport;
|
|
173
216
|
}
|
|
174
217
|
/**
|
|
175
|
-
* Whether a thrown value
|
|
176
|
-
*
|
|
218
|
+
* Whether a thrown value means the load was cancelled rather than failed: the DOMException or Error
|
|
219
|
+
* named "AbortError" that an aborted signal throws, or the "TimeoutError" of AbortSignal.timeout().
|
|
220
|
+
* Use it in a `catch` block to say nothing to the user when they cancelled. A custom reason passed
|
|
221
|
+
* to `abort(reason)` is not recognized: compare it with `signal.reason`. A format plugin uses it to
|
|
222
|
+
* let a cancellation through untouched.
|
|
177
223
|
* @param err - the thrown value
|
|
178
|
-
* @returns true for an AbortError
|
|
224
|
+
* @returns true for an AbortError or a TimeoutError
|
|
225
|
+
* @example
|
|
226
|
+
* ```ts
|
|
227
|
+
* try {
|
|
228
|
+
* await loadFromUrl(url, { signal });
|
|
229
|
+
* } catch (err) {
|
|
230
|
+
* if (!isAbortError(err)) {
|
|
231
|
+
* showError(err);
|
|
232
|
+
* }
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
* @category Reports and errors
|
|
179
236
|
*/
|
|
180
237
|
export declare function isAbortError(err: unknown): boolean;
|
|
181
238
|
/**
|
|
182
239
|
* The message of a thrown value: an Error's message, a string as is, anything else described by type.
|
|
183
240
|
* @param err - the thrown value
|
|
184
241
|
* @returns a plain message
|
|
242
|
+
* @category Plugin helpers
|
|
185
243
|
*/
|
|
186
244
|
export declare function messageOf(err: unknown): string;
|
|
187
245
|
//# sourceMappingURL=report.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/common/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/common/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,WAAW,EAAE,KAAK,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AAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,WAAW;IAIhF;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK;IAI9G;;;;;;;;;OASG;IACH,QAAQ,CACJ,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC5C,KAAK;IAMR;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAoBnC;;;;OAIG;IACH,MAAM,IAAI,YAAY;CA4BzB;AA4BD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAMlD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQ9C"}
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { GraphFormatError } from "@graphty/graph-format";
|
|
13
13
|
import { ImportError } from "../types.js";
|
|
14
|
+
import { ISSUES_SUPPRESSED_CODE } from "./codes.js";
|
|
15
|
+
import { agree, plural } from "./plural.js";
|
|
16
|
+
/**
|
|
17
|
+
* The most warnings of one code a report keeps; later ones are counted in one W_ISSUES_SUPPRESSED
|
|
18
|
+
* warning, so a per-row warning on a large file cannot grow the report without bound.
|
|
19
|
+
* @category Issue and loss codes
|
|
20
|
+
*/
|
|
21
|
+
export const MAX_WARNINGS_PER_CODE = 1000;
|
|
14
22
|
/**
|
|
15
23
|
* The category a thrown GraphFormatError maps to when an importer catches it per element: the codes
|
|
16
24
|
* that mean "the file referenced something it never declared" are missing values, a refused
|
|
@@ -26,17 +34,28 @@ const CATEGORY_BY_CODE = {
|
|
|
26
34
|
E_GPU_INELIGIBLE: "unsupported",
|
|
27
35
|
};
|
|
28
36
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* input) propagates out of import() untouched, so no importer records this code any more; the
|
|
32
|
-
* constant stays for consumers that switch on the codes of earlier reports.
|
|
37
|
+
* No longer recorded; kept so code that switches on older reports still compiles.
|
|
38
|
+
* @category Issue and loss codes
|
|
33
39
|
*/
|
|
34
40
|
export const PARSE_ERROR_CODE = "E_PARSE";
|
|
41
|
+
/**
|
|
42
|
+
* An issue message as the ImportError shows it: prefixed with its line when the issue has one and the
|
|
43
|
+
* message does not already name it.
|
|
44
|
+
* @param message - the issue message
|
|
45
|
+
* @param where - the issue location
|
|
46
|
+
* @returns the message for the error
|
|
47
|
+
*/
|
|
48
|
+
function withLine(message, where) {
|
|
49
|
+
const line = where?.line;
|
|
50
|
+
return line === undefined || line === null || message.includes(`line ${line}`)
|
|
51
|
+
? message
|
|
52
|
+
: `line ${line}: ${message}`;
|
|
53
|
+
}
|
|
35
54
|
/**
|
|
36
55
|
* Accumulates an ImportReport while an importer runs. Errors count toward the error limit; the
|
|
37
56
|
* error that takes the count beyond the limit is still recorded, `truncated` is set, and an
|
|
38
|
-
* ImportError carrying the report so far is thrown
|
|
39
|
-
*
|
|
57
|
+
* ImportError carrying the report so far is thrown. Warnings never abort.
|
|
58
|
+
* @category Writing a format
|
|
40
59
|
*/
|
|
41
60
|
export class ImportReportBuilder {
|
|
42
61
|
/**
|
|
@@ -50,6 +69,8 @@ export class ImportReportBuilder {
|
|
|
50
69
|
this.issueList = [];
|
|
51
70
|
this.lossList = [];
|
|
52
71
|
this.onceCodes = new Set();
|
|
72
|
+
/** Warnings recorded per code, kept or not. */
|
|
73
|
+
this.warningsByCode = new Map();
|
|
53
74
|
this.errors = 0;
|
|
54
75
|
this.warnings = 0;
|
|
55
76
|
this.truncatedFlag = false;
|
|
@@ -107,7 +128,7 @@ export class ImportReportBuilder {
|
|
|
107
128
|
this.errors++;
|
|
108
129
|
if (this.errors > this.errorLimit) {
|
|
109
130
|
this.truncatedFlag = true;
|
|
110
|
-
throw this.abort(`error limit of ${this.errorLimit} exceeded: ${message}`, {
|
|
131
|
+
throw this.abort(`error limit of ${this.errorLimit} exceeded: ${withLine(message, where)}`, {
|
|
111
132
|
code,
|
|
112
133
|
limit: this.errorLimit,
|
|
113
134
|
});
|
|
@@ -115,7 +136,9 @@ export class ImportReportBuilder {
|
|
|
115
136
|
return issue;
|
|
116
137
|
}
|
|
117
138
|
/**
|
|
118
|
-
* Record a warning; warnings never count toward the limit.
|
|
139
|
+
* Record a warning; warnings never count toward the limit. Beyond MAX_WARNINGS_PER_CODE
|
|
140
|
+
* warnings of one code the warning is counted, not kept: finish() adds one W_ISSUES_SUPPRESSED
|
|
141
|
+
* warning per such code with the number dropped.
|
|
119
142
|
* @param category - the issue category
|
|
120
143
|
* @param code - a stable code such as "W_WIDENED"
|
|
121
144
|
* @param message - a plain-ASCII message
|
|
@@ -124,8 +147,12 @@ export class ImportReportBuilder {
|
|
|
124
147
|
*/
|
|
125
148
|
warning(category, code, message, where) {
|
|
126
149
|
const issue = makeIssue(category, "warning", code, message, where);
|
|
127
|
-
this.
|
|
128
|
-
this.
|
|
150
|
+
const seen = (this.warningsByCode.get(code) ?? 0) + 1;
|
|
151
|
+
this.warningsByCode.set(code, seen);
|
|
152
|
+
if (seen <= MAX_WARNINGS_PER_CODE) {
|
|
153
|
+
this.issueList.push(issue);
|
|
154
|
+
this.warnings++;
|
|
155
|
+
}
|
|
129
156
|
return issue;
|
|
130
157
|
}
|
|
131
158
|
/**
|
|
@@ -160,7 +187,7 @@ export class ImportReportBuilder {
|
|
|
160
187
|
return note;
|
|
161
188
|
}
|
|
162
189
|
/**
|
|
163
|
-
* The per-element catch
|
|
190
|
+
* The per-element catch: record a thrown GraphFormatError as an error
|
|
164
191
|
* issue with its code and the category the code implies. Anything else is re-thrown unchanged:
|
|
165
192
|
* an ImportError (the import already aborted), an abort reason, and any other thrown value (a
|
|
166
193
|
* TypeError or RangeError is a programming error in the importer or the sink, never a defect of
|
|
@@ -172,10 +199,36 @@ export class ImportReportBuilder {
|
|
|
172
199
|
recordError(err, where) {
|
|
173
200
|
if (err instanceof GraphFormatError && !(err instanceof ImportError)) {
|
|
174
201
|
const category = CATEGORY_BY_CODE[err.code] ?? "validation-error";
|
|
202
|
+
if (err.code === "E_TOO_LARGE") {
|
|
203
|
+
// the sink is full: every later element would fail the same way, so the import stops
|
|
204
|
+
return this.failWith(category, err.code, err.message, where);
|
|
205
|
+
}
|
|
175
206
|
return this.error(category, err.code, err.message, where);
|
|
176
207
|
}
|
|
177
208
|
throw err;
|
|
178
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* A builder that starts from everything this one recorded so far: issues, counts, loss notes,
|
|
212
|
+
* the warnOnce keys, the error and warning counts and the truncation flag. For an importer that
|
|
213
|
+
* reads its input once and emits several graphs, each with its own report.
|
|
214
|
+
* @returns the copy; later records to either builder do not reach the other
|
|
215
|
+
*/
|
|
216
|
+
fork() {
|
|
217
|
+
const copy = new ImportReportBuilder(this.format, this.errorLimit);
|
|
218
|
+
Object.assign(copy.counts, this.counts);
|
|
219
|
+
copy.issueList.push(...this.issueList);
|
|
220
|
+
copy.lossList.push(...this.lossList);
|
|
221
|
+
for (const key of this.onceCodes) {
|
|
222
|
+
copy.onceCodes.add(key);
|
|
223
|
+
}
|
|
224
|
+
for (const [code, count] of this.warningsByCode) {
|
|
225
|
+
copy.warningsByCode.set(code, count);
|
|
226
|
+
}
|
|
227
|
+
copy.errors = this.errors;
|
|
228
|
+
copy.warnings = this.warnings;
|
|
229
|
+
copy.truncatedFlag = this.truncatedFlag;
|
|
230
|
+
return copy;
|
|
231
|
+
}
|
|
179
232
|
/**
|
|
180
233
|
* Build the ImportError that aborts the import, carrying the report so far. The caller throws
|
|
181
234
|
* it; this method only constructs it so it can be used in expression position.
|
|
@@ -195,13 +248,58 @@ export class ImportReportBuilder {
|
|
|
195
248
|
* @param details - optional machine-readable context for the ImportError
|
|
196
249
|
*/
|
|
197
250
|
fail(code, message, where, details) {
|
|
198
|
-
|
|
199
|
-
|
|
251
|
+
this.failWith("parse-error", code, message, where, details);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Record a fatal error of any category and abort, as fail() does for a parse error: a size
|
|
255
|
+
* limit (E_TOO_LARGE, category "unsupported") stops an import without being a defect of the
|
|
256
|
+
* syntax. A fatal error is not the error limit: `truncated` stays as it was.
|
|
257
|
+
* @param category - the issue category
|
|
258
|
+
* @param code - a stable code
|
|
259
|
+
* @param message - a plain-ASCII message
|
|
260
|
+
* @param where - the line and element, when known
|
|
261
|
+
* @param details - optional machine-readable context for the ImportError
|
|
262
|
+
*/
|
|
263
|
+
failWith(category, code, message, where, details) {
|
|
264
|
+
this.issueList.push(makeIssue(category, "error", code, message, where));
|
|
200
265
|
this.errors++;
|
|
201
|
-
|
|
202
|
-
|
|
266
|
+
throw this.abort(withLine(message, where), { code, ...details });
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Add a finished report to this one: its issues after the ones recorded so far, its counts, its
|
|
270
|
+
* loss notes and its truncated flag. Use it when an importer hands part of the work to another
|
|
271
|
+
* importer (for example, a wrapper around the CSV importer) and returns one report for both. The issues
|
|
272
|
+
* keep their codes; errors added this way do not count toward this report's error limit, since
|
|
273
|
+
* the other importer applied its own.
|
|
274
|
+
* @param report - the report the other importer returned
|
|
275
|
+
* @returns this builder
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* const report = new ImportReportBuilder("netscope", opts.errorLimit);
|
|
279
|
+
* const text = await readText(input, report, opts);
|
|
280
|
+
* report.include(await csvImporter.import(text, sink, options));
|
|
281
|
+
* return report.finish();
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
include(report) {
|
|
285
|
+
for (const issue of report.issues) {
|
|
286
|
+
this.issueList.push(issue);
|
|
287
|
+
if (issue.severity === "error") {
|
|
288
|
+
this.errors++;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
this.warnings++;
|
|
292
|
+
}
|
|
203
293
|
}
|
|
204
|
-
|
|
294
|
+
const { counts } = report;
|
|
295
|
+
this.counts.nodes += counts.nodes;
|
|
296
|
+
this.counts.edges += counts.edges;
|
|
297
|
+
this.counts.skippedNodes += counts.skippedNodes;
|
|
298
|
+
this.counts.skippedEdges += counts.skippedEdges;
|
|
299
|
+
this.counts.expandedMixed += counts.expandedMixed;
|
|
300
|
+
this.lossList.push(...report.lossy);
|
|
301
|
+
this.truncatedFlag || (this.truncatedFlag = report.truncated);
|
|
302
|
+
return this;
|
|
205
303
|
}
|
|
206
304
|
/**
|
|
207
305
|
* The report as it stands: a frozen snapshot with the parse duration so far. Can be called more
|
|
@@ -210,12 +308,19 @@ export class ImportReportBuilder {
|
|
|
210
308
|
*/
|
|
211
309
|
finish() {
|
|
212
310
|
const { nodes, edges, skippedNodes, skippedEdges, expandedMixed } = this.counts;
|
|
311
|
+
const suppressed = [];
|
|
312
|
+
for (const [code, seen] of this.warningsByCode) {
|
|
313
|
+
if (seen > MAX_WARNINGS_PER_CODE) {
|
|
314
|
+
const more = seen - MAX_WARNINGS_PER_CODE;
|
|
315
|
+
suppressed.push(makeIssue("unsupported", "warning", ISSUES_SUPPRESSED_CODE, `${more} more ${code} warning${plural(more)} ${agree(more, "was", "were")} not kept (the report keeps the first ${MAX_WARNINGS_PER_CODE})`, { element: code }));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
213
318
|
return Object.freeze({
|
|
214
319
|
format: this.format,
|
|
215
320
|
counts: Object.freeze({ nodes, edges, skippedNodes, skippedEdges, expandedMixed }),
|
|
216
|
-
issues: Object.freeze([...this.issueList]),
|
|
321
|
+
issues: Object.freeze([...this.issueList, ...suppressed]),
|
|
217
322
|
errorCount: this.errors,
|
|
218
|
-
warningCount: this.warnings,
|
|
323
|
+
warningCount: this.warnings + suppressed.length,
|
|
219
324
|
truncated: this.truncatedFlag,
|
|
220
325
|
lossy: Object.freeze([...this.lossList]),
|
|
221
326
|
durationMs: now() - this.startedAt,
|
|
@@ -242,18 +347,37 @@ function makeIssue(category, severity, code, message, where) {
|
|
|
242
347
|
});
|
|
243
348
|
}
|
|
244
349
|
/**
|
|
245
|
-
* Whether a thrown value
|
|
246
|
-
*
|
|
350
|
+
* Whether a thrown value means the load was cancelled rather than failed: the DOMException or Error
|
|
351
|
+
* named "AbortError" that an aborted signal throws, or the "TimeoutError" of AbortSignal.timeout().
|
|
352
|
+
* Use it in a `catch` block to say nothing to the user when they cancelled. A custom reason passed
|
|
353
|
+
* to `abort(reason)` is not recognized: compare it with `signal.reason`. A format plugin uses it to
|
|
354
|
+
* let a cancellation through untouched.
|
|
247
355
|
* @param err - the thrown value
|
|
248
|
-
* @returns true for an AbortError
|
|
356
|
+
* @returns true for an AbortError or a TimeoutError
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* try {
|
|
360
|
+
* await loadFromUrl(url, { signal });
|
|
361
|
+
* } catch (err) {
|
|
362
|
+
* if (!isAbortError(err)) {
|
|
363
|
+
* showError(err);
|
|
364
|
+
* }
|
|
365
|
+
* }
|
|
366
|
+
* ```
|
|
367
|
+
* @category Reports and errors
|
|
249
368
|
*/
|
|
250
369
|
export function isAbortError(err) {
|
|
251
|
-
|
|
370
|
+
if (typeof err !== "object" || err === null) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
const { name } = err;
|
|
374
|
+
return name === "AbortError" || name === "TimeoutError";
|
|
252
375
|
}
|
|
253
376
|
/**
|
|
254
377
|
* The message of a thrown value: an Error's message, a string as is, anything else described by type.
|
|
255
378
|
* @param err - the thrown value
|
|
256
379
|
* @returns a plain message
|
|
380
|
+
* @category Plugin helpers
|
|
257
381
|
*/
|
|
258
382
|
export function messageOf(err) {
|
|
259
383
|
if (err instanceof Error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/common/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAA6B,MAAM,uBAAuB,CAAC;AAEpF,OAAO,EAAE,WAAW,EAA0E,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/common/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAA6B,MAAM,uBAAuB,CAAC;AAEpF,OAAO,EAAE,WAAW,EAA0E,MAAM,aAAa,CAAC;AAClH,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAgC1C;;;;;GAKG;AACH,MAAM,gBAAgB,GAAmE;IACrF,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,eAAe;IACjC,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,aAAa;IAC1B,aAAa,EAAE,aAAa;IAC5B,gBAAgB,EAAE,aAAa;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAE1C;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,OAAe,EAAE,KAAgC;IAC/D,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC;IACzB,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC1E,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,QAAQ,IAAI,KAAK,OAAO,EAAE,CAAC;AACrC,CAAC;AAED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OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,QAAQ;QACR,QAAQ;QACR,IAAI;QACJ,OAAO;QACP,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,IAAI;QACzB,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,IAAI;KAClC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACrC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,GAAyB,CAAC;IAC3C,OAAO,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,cAAc,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,qBAAqB,OAAO,GAAG,GAAG,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,SAAS,GAAG;IACR,OAAO,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC5E,CAAC"}
|
|
@@ -10,30 +10,43 @@
|
|
|
10
10
|
* grammar rather than Date.parse, so two hosts agree on every value.
|
|
11
11
|
*/
|
|
12
12
|
import { type ColumnDecl, type ColumnRole } from "@graphty/graph-format";
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The temporal kinds a declared type can map to; each fixes the parse grammar and the canonical text.
|
|
15
|
+
* @category Plugin helpers
|
|
16
|
+
*/
|
|
14
17
|
export type TemporalKind = "date" | "dateTime" | "localDateTime" | "time" | "localTime";
|
|
15
18
|
/**
|
|
16
19
|
* The GEXF `timeformat` values (design section 5.9).
|
|
17
|
-
* Consumed by the per-format importers and exporters under src/formats.
|
|
18
20
|
* @public
|
|
21
|
+
* @category Plugin helpers
|
|
19
22
|
*/
|
|
20
23
|
export type TimeFormat = "integer" | "double" | "date" | "dateTime";
|
|
21
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* A parsed temporal value: the number stored in the column and the source text when it must be kept.
|
|
26
|
+
* @category Plugin helpers
|
|
27
|
+
*/
|
|
22
28
|
export interface TemporalValue {
|
|
23
29
|
/** Epoch milliseconds (date, dateTime, localDateTime), milliseconds since midnight (time, localTime), or the raw number. */
|
|
24
30
|
readonly value: number;
|
|
25
31
|
/** The source text when formatTemporal(value) would not reproduce it; null otherwise. */
|
|
26
32
|
readonly text: string | null;
|
|
27
33
|
}
|
|
28
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The role of a companion text column.
|
|
36
|
+
* @category Plugin helpers
|
|
37
|
+
*/
|
|
29
38
|
export declare const TIME_TEXT_ROLE: ColumnRole;
|
|
30
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* The suffix of a companion text column's name.
|
|
41
|
+
* @category Plugin helpers
|
|
42
|
+
*/
|
|
31
43
|
export declare const TIME_TEXT_SUFFIX = ".text";
|
|
32
44
|
/**
|
|
33
45
|
* Parse an ISO-8601 temporal text of one kind.
|
|
34
46
|
* @param text - the source text (already trimmed)
|
|
35
47
|
* @param kind - the temporal kind
|
|
36
48
|
* @returns the value and, when the canonical form differs, the source text; E_COLUMN_TYPE when the text is not of the kind
|
|
49
|
+
* @category Plugin helpers
|
|
37
50
|
*/
|
|
38
51
|
export declare function parseTemporal(text: string, kind: TemporalKind): TemporalValue;
|
|
39
52
|
/**
|
|
@@ -44,6 +57,7 @@ export declare function parseTemporal(text: string, kind: TemporalKind): Tempora
|
|
|
44
57
|
* @param text - the source text
|
|
45
58
|
* @param timeFormat - the graph's timeformat, or null when the file declares none
|
|
46
59
|
* @returns the value and the source text when it must be kept
|
|
60
|
+
* @category Plugin helpers
|
|
47
61
|
*/
|
|
48
62
|
export declare function parseTimeText(text: string, timeFormat: TimeFormat | null): TemporalValue;
|
|
49
63
|
/**
|
|
@@ -52,6 +66,7 @@ export declare function parseTimeText(text: string, timeFormat: TimeFormat | nul
|
|
|
52
66
|
* @param kind - the temporal kind
|
|
53
67
|
* @returns the canonical text: `YYYY-MM-DD`, `YYYY-MM-DDTHH:MM:SS[.mmm]Z`, `YYYY-MM-DDTHH:MM:SS[.mmm]`,
|
|
54
68
|
* `HH:MM:SS[.mmm]Z` or `HH:MM:SS[.mmm]`
|
|
69
|
+
* @category Plugin helpers
|
|
55
70
|
*/
|
|
56
71
|
export declare function formatTemporal(value: number, kind: TemporalKind): string;
|
|
57
72
|
/**
|
|
@@ -60,12 +75,14 @@ export declare function formatTemporal(value: number, kind: TemporalKind): strin
|
|
|
60
75
|
* @param value - the value as stored
|
|
61
76
|
* @param timeFormat - the graph's timeformat, or null for a file that declares none (double)
|
|
62
77
|
* @returns the text
|
|
78
|
+
* @category Plugin helpers
|
|
63
79
|
*/
|
|
64
80
|
export declare function formatTimeValue(value: number, timeFormat: TimeFormat | null): string;
|
|
65
81
|
/**
|
|
66
82
|
* The declaration of the companion text column of a temporal column (design section 5.1).
|
|
67
83
|
* @param column - the temporal column's name
|
|
68
84
|
* @returns a string column named `<column>.text` with role timeText and `extra.for` naming the column
|
|
85
|
+
* @category Plugin helpers
|
|
69
86
|
*/
|
|
70
87
|
export declare function timeTextCompanion(column: string): ColumnDecl;
|
|
71
88
|
//# sourceMappingURL=temporal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temporal.d.ts","sourceRoot":"","sources":["../../../src/common/temporal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAoB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,9 +10,15 @@
|
|
|
10
10
|
* grammar rather than Date.parse, so two hosts agree on every value.
|
|
11
11
|
*/
|
|
12
12
|
import { GraphFormatError } from "@graphty/graph-format";
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The role of a companion text column.
|
|
15
|
+
* @category Plugin helpers
|
|
16
|
+
*/
|
|
14
17
|
export const TIME_TEXT_ROLE = "timeText";
|
|
15
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The suffix of a companion text column's name.
|
|
20
|
+
* @category Plugin helpers
|
|
21
|
+
*/
|
|
16
22
|
export const TIME_TEXT_SUFFIX = ".text";
|
|
17
23
|
const DATE_TIME = /^(-?[0-9]{4,})-([0-9]{2})-([0-9]{2})(?:[T ]([0-9]{2}):([0-9]{2})(?::([0-9]{2})(?:\.([0-9]{1,9}))?)?)?(Z|z|[+-][0-9]{2}(?::?[0-9]{2})?)?$/;
|
|
18
24
|
const TIME = /^([0-9]{2}):([0-9]{2})(?::([0-9]{2})(?:\.([0-9]{1,9}))?)?(Z|z|[+-][0-9]{2}(?::?[0-9]{2})?)?$/;
|
|
@@ -24,6 +30,7 @@ const MS_PER_DAY = 86400000;
|
|
|
24
30
|
* @param text - the source text (already trimmed)
|
|
25
31
|
* @param kind - the temporal kind
|
|
26
32
|
* @returns the value and, when the canonical form differs, the source text; E_COLUMN_TYPE when the text is not of the kind
|
|
33
|
+
* @category Plugin helpers
|
|
27
34
|
*/
|
|
28
35
|
export function parseTemporal(text, kind) {
|
|
29
36
|
let value;
|
|
@@ -53,6 +60,7 @@ export function parseTemporal(text, kind) {
|
|
|
53
60
|
* @param text - the source text
|
|
54
61
|
* @param timeFormat - the graph's timeformat, or null when the file declares none
|
|
55
62
|
* @returns the value and the source text when it must be kept
|
|
63
|
+
* @category Plugin helpers
|
|
56
64
|
*/
|
|
57
65
|
export function parseTimeText(text, timeFormat) {
|
|
58
66
|
const trimmed = text.trim();
|
|
@@ -78,6 +86,7 @@ export function parseTimeText(text, timeFormat) {
|
|
|
78
86
|
* @param kind - the temporal kind
|
|
79
87
|
* @returns the canonical text: `YYYY-MM-DD`, `YYYY-MM-DDTHH:MM:SS[.mmm]Z`, `YYYY-MM-DDTHH:MM:SS[.mmm]`,
|
|
80
88
|
* `HH:MM:SS[.mmm]Z` or `HH:MM:SS[.mmm]`
|
|
89
|
+
* @category Plugin helpers
|
|
81
90
|
*/
|
|
82
91
|
export function formatTemporal(value, kind) {
|
|
83
92
|
switch (kind) {
|
|
@@ -113,6 +122,7 @@ export function formatTemporal(value, kind) {
|
|
|
113
122
|
* @param value - the value as stored
|
|
114
123
|
* @param timeFormat - the graph's timeformat, or null for a file that declares none (double)
|
|
115
124
|
* @returns the text
|
|
125
|
+
* @category Plugin helpers
|
|
116
126
|
*/
|
|
117
127
|
export function formatTimeValue(value, timeFormat) {
|
|
118
128
|
switch (timeFormat) {
|
|
@@ -134,6 +144,7 @@ export function formatTimeValue(value, timeFormat) {
|
|
|
134
144
|
* The declaration of the companion text column of a temporal column (design section 5.1).
|
|
135
145
|
* @param column - the temporal column's name
|
|
136
146
|
* @returns a string column named `<column>.text` with role timeText and `extra.for` naming the column
|
|
147
|
+
* @category Plugin helpers
|
|
137
148
|
*/
|
|
138
149
|
export function timeTextCompanion(column) {
|
|
139
150
|
return {
|