@graphty/graph-io 0.3.47 → 0.3.49
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/dist/chunks/{approximations-wWjCRzKj.js → approximations-Bzn3L-je.js} +2 -2
- package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-Bzn3L-je.js.map} +1 -1
- package/dist/chunks/bends-BGXjv_U4.js +129 -0
- package/dist/chunks/bends-BGXjv_U4.js.map +1 -0
- package/dist/chunks/{block-DiGq58c3.js → block-iptrlMBb.js} +947 -134
- package/dist/chunks/block-iptrlMBb.js.map +1 -0
- package/dist/chunks/choose-CczZJaX_.js +717 -0
- package/dist/chunks/choose-CczZJaX_.js.map +1 -0
- package/dist/chunks/codes-BE2xir2k.js +157 -0
- package/dist/chunks/codes-BE2xir2k.js.map +1 -0
- package/dist/chunks/{constants-BKwqelYD.js → constants-CKkYLPtt.js} +2 -2
- package/dist/chunks/{constants-BKwqelYD.js.map → constants-CKkYLPtt.js.map} +1 -1
- package/dist/chunks/context-C3p0RQxR.js +664 -0
- package/dist/chunks/context-C3p0RQxR.js.map +1 -0
- package/dist/chunks/{convert-BcQ8_jMo.js → convert-Ct2zelbQ.js} +7 -2
- package/dist/chunks/convert-Ct2zelbQ.js.map +1 -0
- package/dist/chunks/credentials-DXHx7nwR.js +349 -0
- package/dist/chunks/credentials-DXHx7nwR.js.map +1 -0
- package/dist/chunks/cx-export-Bt6NoqTQ.js +259 -0
- package/dist/chunks/cx-export-Bt6NoqTQ.js.map +1 -0
- package/dist/chunks/descriptor-B28U25x4.js +60 -0
- package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
- package/dist/chunks/descriptor-C-YDhtsn.js +48 -0
- package/dist/chunks/descriptor-C-YDhtsn.js.map +1 -0
- package/dist/chunks/descriptor-DLA5kINx.js +142 -0
- package/dist/chunks/descriptor-DLA5kINx.js.map +1 -0
- package/dist/chunks/{emit-CwU8cUmG.js → emit-BwHQkZle.js} +1690 -103
- package/dist/chunks/emit-BwHQkZle.js.map +1 -0
- package/dist/chunks/{escape-CgzxiYPg.js → escape-CuCIzNMB.js} +12 -12
- package/dist/chunks/{escape-CgzxiYPg.js.map → escape-CuCIzNMB.js.map} +1 -1
- package/dist/chunks/{export-BvqAXCKh.js → export-Cha4dRFz.js} +48 -1780
- package/dist/chunks/export-Cha4dRFz.js.map +1 -0
- package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-BP6otMO6.js} +6 -4
- package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-BP6otMO6.js.map} +1 -1
- package/dist/chunks/{exporter-CrDWIyiq.js → exporter-D2CETOMK.js} +1222 -154
- package/dist/chunks/exporter-D2CETOMK.js.map +1 -0
- package/dist/chunks/{exporter-DndFlGSa.js → exporter-D9yMtocA.js} +7 -6
- package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-D9yMtocA.js.map} +1 -1
- package/dist/chunks/exporter-_jrBTnos.js +1009 -0
- package/dist/chunks/exporter-_jrBTnos.js.map +1 -0
- package/dist/chunks/{exporter-CJgfhF-l.js → exporter-nDfxIK5D.js} +9 -7
- package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-nDfxIK5D.js.map} +1 -1
- package/dist/chunks/format-BXiAb-1h.js +408 -0
- package/dist/chunks/format-BXiAb-1h.js.map +1 -0
- package/dist/chunks/{generic-Dq1ntt9q.js → generic-ymWCETAJ.js} +387 -31
- package/dist/chunks/generic-ymWCETAJ.js.map +1 -0
- package/dist/chunks/{importer-CMmeMWlC.js → importer-B92x1xY5.js} +15 -263
- package/dist/chunks/importer-B92x1xY5.js.map +1 -0
- package/dist/chunks/{importer-DiZRmOQG.js → importer-CT9mJ1nn.js} +328 -90
- package/dist/chunks/importer-CT9mJ1nn.js.map +1 -0
- package/dist/chunks/{importer-COTK9Tsl.js → importer-DaLTjbds.js} +116 -1099
- package/dist/chunks/importer-DaLTjbds.js.map +1 -0
- package/dist/chunks/{importer-iFYPEKaJ.js → importer-GREKMdIf.js} +28 -16
- package/dist/chunks/importer-GREKMdIf.js.map +1 -0
- package/dist/chunks/{importer-BSvfrX_h.js → importer-PqaaKKnY.js} +23 -1016
- package/dist/chunks/importer-PqaaKKnY.js.map +1 -0
- package/dist/chunks/{importer-yh_aBCU6.js → importer-Vn5QvmmJ.js} +66 -12
- package/dist/chunks/importer-Vn5QvmmJ.js.map +1 -0
- package/dist/chunks/{importer-e6LGpqHB.js → importer-vRq4h3j5.js} +1470 -354
- package/dist/chunks/importer-vRq4h3j5.js.map +1 -0
- package/dist/chunks/input-CAxt_aV-.js +1397 -0
- package/dist/chunks/input-CAxt_aV-.js.map +1 -0
- package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-Cq76WjnZ.js} +4 -4
- package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
- package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-Clf4QIyl.js} +299 -77
- package/dist/chunks/lexicon-Clf4QIyl.js.map +1 -0
- package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-OMo91mb0.js} +4 -3
- package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-OMo91mb0.js.map} +1 -1
- package/dist/chunks/{records-CiaWZrFH.js → records-NJiYvekn.js} +2 -2
- package/dist/chunks/{records-CiaWZrFH.js.map → records-NJiYvekn.js.map} +1 -1
- package/dist/chunks/{format-BpQBx8MZ.js → report-CwMfYa9J.js} +70 -127
- package/dist/chunks/report-CwMfYa9J.js.map +1 -0
- package/dist/chunks/round-trip-Zm3_ivgq.js +79 -0
- package/dist/chunks/round-trip-Zm3_ivgq.js.map +1 -0
- package/dist/chunks/sigv4-EokFic1V.js +247 -0
- package/dist/chunks/sigv4-EokFic1V.js.map +1 -0
- package/dist/chunks/{styles-BQnsga7p.js → styles-CCs214_3.js} +1300 -168
- package/dist/chunks/styles-CCs214_3.js.map +1 -0
- package/dist/chunks/styles-Cm62yyQX.js +2812 -0
- package/dist/chunks/styles-Cm62yyQX.js.map +1 -0
- package/dist/chunks/styles-DPQQIig4.js +1928 -0
- package/dist/chunks/styles-DPQQIig4.js.map +1 -0
- package/dist/chunks/styles-yed-UMFdNqze.js +1213 -0
- package/dist/chunks/styles-yed-UMFdNqze.js.map +1 -0
- package/dist/chunks/{text-CzJNFOS9.js → text-ystE2bYi.js} +2 -2
- package/dist/chunks/{text-CzJNFOS9.js.map → text-ystE2bYi.js.map} +1 -1
- package/dist/csv.js +7 -5
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +5 -4
- package/dist/cx.js.map +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +5 -4
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +42 -10
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +850 -193
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +1189 -220
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -3
- package/dist/json.js +3 -2
- package/dist/neo4j.js +6 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/positions.js +45 -3
- package/dist/positions.js.map +1 -1
- package/dist/sources-cypher.d.ts +1 -0
- package/dist/sources-cypher.js +1351 -0
- package/dist/sources-cypher.js.map +1 -0
- package/dist/sources-ndex.d.ts +1 -0
- package/dist/sources-ndex.js +278 -0
- package/dist/sources-ndex.js.map +1 -0
- package/dist/sources-rest.d.ts +1 -0
- package/dist/sources-rest.js +1377 -0
- package/dist/sources-rest.js.map +1 -0
- package/dist/sources-sparql.d.ts +1 -0
- package/dist/sources-sparql.js +405 -0
- package/dist/sources-sparql.js.map +1 -0
- package/dist/src/common/report.d.ts +6 -3
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +15 -9
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +5 -1
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +24 -1
- package/dist/src/formats/cx/styles.d.ts.map +1 -1
- package/dist/src/formats/cx/styles.js +118 -11
- package/dist/src/formats/cx/styles.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +1 -0
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts.map +1 -1
- package/dist/src/formats/cx2/styles.js +3 -1
- package/dist/src/formats/cx2/styles.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +1 -0
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +2 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -1
- package/dist/src/formats/cys/styles.js +15 -7
- package/dist/src/formats/cys/styles.js.map +1 -1
- package/dist/src/formats/dot/drawing.d.ts +98 -0
- package/dist/src/formats/dot/drawing.d.ts.map +1 -0
- package/dist/src/formats/dot/drawing.js +734 -0
- package/dist/src/formats/dot/drawing.js.map +1 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +108 -31
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/label-places.d.ts +34 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -0
- package/dist/src/formats/dot/label-places.js +179 -0
- package/dist/src/formats/dot/label-places.js.map +1 -0
- package/dist/src/formats/dot/record.d.ts +50 -0
- package/dist/src/formats/dot/record.d.ts.map +1 -0
- package/dist/src/formats/dot/record.js +275 -0
- package/dist/src/formats/dot/record.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +62 -2
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +1457 -120
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
- package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
- package/dist/src/formats/gexf/dialog-metrics.js +59 -0
- package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
- package/dist/src/formats/gexf/importer.d.ts +7 -0
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +41 -5
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/preview.d.ts +77 -0
- package/dist/src/formats/gexf/preview.d.ts.map +1 -0
- package/dist/src/formats/gexf/preview.js +191 -0
- package/dist/src/formats/gexf/preview.js.map +1 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +2 -1
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +60 -16
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +883 -131
- package/dist/src/formats/gexf/styles.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +5 -2
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +258 -71
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +1 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +1 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +7 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -1
- package/dist/src/formats/gml/positions.js +29 -7
- package/dist/src/formats/gml/positions.js.map +1 -1
- package/dist/src/formats/gml/styles.d.ts.map +1 -1
- package/dist/src/formats/gml/styles.js +756 -103
- package/dist/src/formats/gml/styles.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-plain.js +8 -12
- package/dist/src/formats/graphml/styles-plain.js.map +1 -1
- package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yed.js +749 -148
- package/dist/src/formats/graphml/styles-yed.js.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.js +429 -64
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +3 -3
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +16 -6
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts +3 -2
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +39 -5
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +13 -2
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +42 -6
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/index.d.ts +1 -1
- package/dist/src/formats/json/index.d.ts.map +1 -1
- package/dist/src/formats/json/index.js +1 -1
- package/dist/src/formats/json/index.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +5 -2
- package/dist/src/formats/json/positions.d.ts.map +1 -1
- package/dist/src/formats/json/positions.js +20 -4
- package/dist/src/formats/json/positions.js.map +1 -1
- package/dist/src/formats/json/styles.d.ts +12 -1
- package/dist/src/formats/json/styles.d.ts.map +1 -1
- package/dist/src/formats/json/styles.js +1755 -136
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +96 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -0
- package/dist/src/formats/pajek/draw.js +372 -0
- package/dist/src/formats/pajek/draw.js.map +1 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +70 -51
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +9 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +233 -102
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +1 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +15 -7
- package/dist/src/formats/pajek/styles.d.ts.map +1 -1
- package/dist/src/formats/pajek/styles.js +1279 -114
- package/dist/src/formats/pajek/styles.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts +10 -1
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +26 -2
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +1 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +65 -5
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +23 -3
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
- package/dist/src/formats/xgmml/styles.js +278 -60
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +10 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/convert.d.ts.map +1 -1
- package/dist/src/positions/convert.js +11 -1
- package/dist/src/positions/convert.js.map +1 -1
- package/dist/src/positions/extract.d.ts.map +1 -1
- package/dist/src/positions/extract.js +53 -1
- package/dist/src/positions/extract.js.map +1 -1
- package/dist/src/positions/index.d.ts +1 -1
- package/dist/src/positions/index.d.ts.map +1 -1
- package/dist/src/positions/types.d.ts +59 -0
- package/dist/src/positions/types.d.ts.map +1 -1
- package/dist/src/registry.d.ts +173 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +196 -1
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sources/builtins.d.ts +11 -0
- package/dist/src/sources/builtins.d.ts.map +1 -0
- package/dist/src/sources/builtins.js +53 -0
- package/dist/src/sources/builtins.js.map +1 -0
- package/dist/src/sources/codes.d.ts +230 -0
- package/dist/src/sources/codes.d.ts.map +1 -0
- package/dist/src/sources/codes.js +58 -0
- package/dist/src/sources/codes.js.map +1 -0
- package/dist/src/sources/context.d.ts +112 -0
- package/dist/src/sources/context.d.ts.map +1 -0
- package/dist/src/sources/context.js +740 -0
- package/dist/src/sources/context.js.map +1 -0
- package/dist/src/sources/credentials.d.ts +179 -0
- package/dist/src/sources/credentials.d.ts.map +1 -0
- package/dist/src/sources/credentials.js +301 -0
- package/dist/src/sources/credentials.js.map +1 -0
- package/dist/src/sources/cypher/descriptor.d.ts +21 -0
- package/dist/src/sources/cypher/descriptor.d.ts.map +1 -0
- package/dist/src/sources/cypher/descriptor.js +124 -0
- package/dist/src/sources/cypher/descriptor.js.map +1 -0
- package/dist/src/sources/cypher/flatten.d.ts +72 -0
- package/dist/src/sources/cypher/flatten.d.ts.map +1 -0
- package/dist/src/sources/cypher/flatten.js +279 -0
- package/dist/src/sources/cypher/flatten.js.map +1 -0
- package/dist/src/sources/cypher/index.d.ts +33 -0
- package/dist/src/sources/cypher/index.d.ts.map +1 -0
- package/dist/src/sources/cypher/index.js +511 -0
- package/dist/src/sources/cypher/index.js.map +1 -0
- package/dist/src/sources/cypher/params.d.ts +40 -0
- package/dist/src/sources/cypher/params.d.ts.map +1 -0
- package/dist/src/sources/cypher/params.js +6 -0
- package/dist/src/sources/cypher/params.js.map +1 -0
- package/dist/src/sources/cypher/profiles.d.ts +44 -0
- package/dist/src/sources/cypher/profiles.d.ts.map +1 -0
- package/dist/src/sources/cypher/profiles.js +61 -0
- package/dist/src/sources/cypher/profiles.js.map +1 -0
- package/dist/src/sources/cypher/query-builder.d.ts +123 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
- package/dist/src/sources/cypher/query-builder.js +267 -0
- package/dist/src/sources/cypher/query-builder.js.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts +21 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.js +185 -0
- package/dist/src/sources/cypher/transports/bolt.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts +15 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js +38 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts +31 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.js +104 -0
- package/dist/src/sources/cypher/transports/neptune-https.js.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts +14 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.js +80 -0
- package/dist/src/sources/cypher/transports/query-api.js.map +1 -0
- package/dist/src/sources/cypher/transports/transport.d.ts +78 -0
- package/dist/src/sources/cypher/transports/transport.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/transport.js +77 -0
- package/dist/src/sources/cypher/transports/transport.js.map +1 -0
- package/dist/src/sources/cypher/types-map.d.ts +91 -0
- package/dist/src/sources/cypher/types-map.d.ts.map +1 -0
- package/dist/src/sources/cypher/types-map.js +306 -0
- package/dist/src/sources/cypher/types-map.js.map +1 -0
- package/dist/src/sources/define.d.ts +47 -0
- package/dist/src/sources/define.d.ts.map +1 -0
- package/dist/src/sources/define.js +173 -0
- package/dist/src/sources/define.js.map +1 -0
- package/dist/src/sources/fail.d.ts +33 -0
- package/dist/src/sources/fail.d.ts.map +1 -0
- package/dist/src/sources/fail.js +49 -0
- package/dist/src/sources/fail.js.map +1 -0
- package/dist/src/sources/ids.d.ts +69 -0
- package/dist/src/sources/ids.d.ts.map +1 -0
- package/dist/src/sources/ids.js +69 -0
- package/dist/src/sources/ids.js.map +1 -0
- package/dist/src/sources/ndex/client.d.ts +31 -0
- package/dist/src/sources/ndex/client.d.ts.map +1 -0
- package/dist/src/sources/ndex/client.js +90 -0
- package/dist/src/sources/ndex/client.js.map +1 -0
- package/dist/src/sources/ndex/descriptor.d.ts +10 -0
- package/dist/src/sources/ndex/descriptor.d.ts.map +1 -0
- package/dist/src/sources/ndex/descriptor.js +55 -0
- package/dist/src/sources/ndex/descriptor.js.map +1 -0
- package/dist/src/sources/ndex/expand.d.ts +20 -0
- package/dist/src/sources/ndex/expand.d.ts.map +1 -0
- package/dist/src/sources/ndex/expand.js +87 -0
- package/dist/src/sources/ndex/expand.js.map +1 -0
- package/dist/src/sources/ndex/index.d.ts +25 -0
- package/dist/src/sources/ndex/index.d.ts.map +1 -0
- package/dist/src/sources/ndex/index.js +191 -0
- package/dist/src/sources/ndex/index.js.map +1 -0
- package/dist/src/sources/ndex/params.d.ts +17 -0
- package/dist/src/sources/ndex/params.d.ts.map +1 -0
- package/dist/src/sources/ndex/params.js +6 -0
- package/dist/src/sources/ndex/params.js.map +1 -0
- package/dist/src/sources/ndex/share-url.d.ts +40 -0
- package/dist/src/sources/ndex/share-url.d.ts.map +1 -0
- package/dist/src/sources/ndex/share-url.js +64 -0
- package/dist/src/sources/ndex/share-url.js.map +1 -0
- package/dist/src/sources/params.d.ts +31 -0
- package/dist/src/sources/params.d.ts.map +1 -0
- package/dist/src/sources/params.js +6 -0
- package/dist/src/sources/params.js.map +1 -0
- package/dist/src/sources/registry.d.ts +118 -0
- package/dist/src/sources/registry.d.ts.map +1 -0
- package/dist/src/sources/registry.js +193 -0
- package/dist/src/sources/registry.js.map +1 -0
- package/dist/src/sources/rest/descriptor.d.ts +16 -0
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -0
- package/dist/src/sources/rest/descriptor.js +76 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -0
- package/dist/src/sources/rest/index.d.ts +14 -0
- package/dist/src/sources/rest/index.d.ts.map +1 -0
- package/dist/src/sources/rest/index.js +13 -0
- package/dist/src/sources/rest/index.js.map +1 -0
- package/dist/src/sources/rest/mapping.d.ts +30 -0
- package/dist/src/sources/rest/mapping.d.ts.map +1 -0
- package/dist/src/sources/rest/mapping.js +362 -0
- package/dist/src/sources/rest/mapping.js.map +1 -0
- package/dist/src/sources/rest/openalex.d.ts +27 -0
- package/dist/src/sources/rest/openalex.d.ts.map +1 -0
- package/dist/src/sources/rest/openalex.js +269 -0
- package/dist/src/sources/rest/openalex.js.map +1 -0
- package/dist/src/sources/rest/paging.d.ts +53 -0
- package/dist/src/sources/rest/paging.d.ts.map +1 -0
- package/dist/src/sources/rest/paging.js +138 -0
- package/dist/src/sources/rest/paging.js.map +1 -0
- package/dist/src/sources/rest/params.d.ts +216 -0
- package/dist/src/sources/rest/params.d.ts.map +1 -0
- package/dist/src/sources/rest/params.js +7 -0
- package/dist/src/sources/rest/params.js.map +1 -0
- package/dist/src/sources/rest/records.d.ts +41 -0
- package/dist/src/sources/rest/records.d.ts.map +1 -0
- package/dist/src/sources/rest/records.js +240 -0
- package/dist/src/sources/rest/records.js.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts +10 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.js +47 -0
- package/dist/src/sources/rest/samples/deps-dev.js.map +1 -0
- package/dist/src/sources/rest/samples/string.d.ts +9 -0
- package/dist/src/sources/rest/samples/string.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/string.js +42 -0
- package/dist/src/sources/rest/samples/string.js.map +1 -0
- package/dist/src/sources/rest/selectors.d.ts +41 -0
- package/dist/src/sources/rest/selectors.d.ts.map +1 -0
- package/dist/src/sources/rest/selectors.js +81 -0
- package/dist/src/sources/rest/selectors.js.map +1 -0
- package/dist/src/sources/rest/source.d.ts +67 -0
- package/dist/src/sources/rest/source.d.ts.map +1 -0
- package/dist/src/sources/rest/source.js +650 -0
- package/dist/src/sources/rest/source.js.map +1 -0
- package/dist/src/sources/rest/templates.d.ts +38 -0
- package/dist/src/sources/rest/templates.d.ts.map +1 -0
- package/dist/src/sources/rest/templates.js +125 -0
- package/dist/src/sources/rest/templates.js.map +1 -0
- package/dist/src/sources/run.d.ts +93 -0
- package/dist/src/sources/run.d.ts.map +1 -0
- package/dist/src/sources/run.js +673 -0
- package/dist/src/sources/run.js.map +1 -0
- package/dist/src/sources/sha256.d.ts +12 -0
- package/dist/src/sources/sha256.d.ts.map +1 -0
- package/dist/src/sources/sha256.js +95 -0
- package/dist/src/sources/sha256.js.map +1 -0
- package/dist/src/sources/sigv4.d.ts +26 -0
- package/dist/src/sources/sigv4.d.ts.map +1 -0
- package/dist/src/sources/sigv4.js +184 -0
- package/dist/src/sources/sigv4.js.map +1 -0
- package/dist/src/sources/sparql/descriptor.d.ts +10 -0
- package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
- package/dist/src/sources/sparql/descriptor.js +64 -0
- package/dist/src/sources/sparql/descriptor.js.map +1 -0
- package/dist/src/sources/sparql/index.d.ts +28 -0
- package/dist/src/sources/sparql/index.d.ts.map +1 -0
- package/dist/src/sources/sparql/index.js +314 -0
- package/dist/src/sources/sparql/index.js.map +1 -0
- package/dist/src/sources/sparql/ntriples.d.ts +69 -0
- package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
- package/dist/src/sources/sparql/ntriples.js +180 -0
- package/dist/src/sources/sparql/ntriples.js.map +1 -0
- package/dist/src/sources/sparql/params.d.ts +27 -0
- package/dist/src/sources/sparql/params.d.ts.map +1 -0
- package/dist/src/sources/sparql/params.js +5 -0
- package/dist/src/sources/sparql/params.js.map +1 -0
- package/dist/src/sources/sparql/query.d.ts +72 -0
- package/dist/src/sources/sparql/query.d.ts.map +1 -0
- package/dist/src/sources/sparql/query.js +113 -0
- package/dist/src/sources/sparql/query.js.map +1 -0
- package/dist/src/sources/testing.d.ts +96 -0
- package/dist/src/sources/testing.d.ts.map +1 -0
- package/dist/src/sources/testing.js +138 -0
- package/dist/src/sources/testing.js.map +1 -0
- package/dist/src/sources/types.d.ts +696 -0
- package/dist/src/sources/types.d.ts.map +1 -0
- package/dist/src/sources/types.js +10 -0
- package/dist/src/sources/types.js.map +1 -0
- package/dist/src/styles/annotations.d.ts +61 -5
- package/dist/src/styles/annotations.d.ts.map +1 -1
- package/dist/src/styles/annotations.js +130 -22
- package/dist/src/styles/annotations.js.map +1 -1
- package/dist/src/styles/canon/bends.d.ts +46 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -1
- package/dist/src/styles/canon/bends.js +123 -0
- package/dist/src/styles/canon/bends.js.map +1 -1
- package/dist/src/styles/canon/color-tables.d.ts +6 -1
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
- package/dist/src/styles/canon/color-tables.js +10 -4
- package/dist/src/styles/canon/color-tables.js.map +1 -1
- package/dist/src/styles/canon/color.d.ts +3 -1
- package/dist/src/styles/canon/color.d.ts.map +1 -1
- package/dist/src/styles/canon/color.js +103 -3
- package/dist/src/styles/canon/color.js.map +1 -1
- package/dist/src/styles/canon/enums.d.ts +2 -2
- package/dist/src/styles/canon/enums.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.js +82 -7
- package/dist/src/styles/canon/enums.js.map +1 -1
- package/dist/src/styles/canon/graphviz.d.ts +12 -3
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
- package/dist/src/styles/canon/graphviz.js +57 -9
- package/dist/src/styles/canon/graphviz.js.map +1 -1
- package/dist/src/styles/canon/number.d.ts +8 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -1
- package/dist/src/styles/canon/number.js +18 -0
- package/dist/src/styles/canon/number.js.map +1 -1
- package/dist/src/styles/canon/text.d.ts +29 -2
- package/dist/src/styles/canon/text.d.ts.map +1 -1
- package/dist/src/styles/canon/text.js +156 -16
- package/dist/src/styles/canon/text.js.map +1 -1
- package/dist/src/styles/codes.d.ts +2 -0
- package/dist/src/styles/codes.d.ts.map +1 -1
- package/dist/src/styles/codes.js +2 -0
- package/dist/src/styles/codes.js.map +1 -1
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
- package/dist/src/styles/cyjs/cascade.js +1037 -35
- package/dist/src/styles/cyjs/cascade.js.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.js +5 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
- package/dist/src/styles/cyjs/emit.js +216 -12
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cyjs/face.d.ts +20 -0
- package/dist/src/styles/cyjs/face.d.ts.map +1 -0
- package/dist/src/styles/cyjs/face.js +332 -0
- package/dist/src/styles/cyjs/face.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +48 -2
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +463 -26
- package/dist/src/styles/cyjs/mappers.js.map +1 -1
- package/dist/src/styles/cyjs/routes.d.ts +53 -0
- package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
- package/dist/src/styles/cyjs/routes.js +360 -0
- package/dist/src/styles/cyjs/routes.js.map +1 -0
- package/dist/src/styles/cytoscape/charts.d.ts +23 -0
- package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/charts.js +560 -0
- package/dist/src/styles/cytoscape/charts.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/emit.js +204 -44
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +97 -3
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +413 -79
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
- package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/mappings.js +92 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -1
- package/dist/src/styles/cytoscape/resolve.d.ts +46 -3
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +632 -22
- package/dist/src/styles/cytoscape/resolve.js.map +1 -1
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/translate.js +10 -10
- package/dist/src/styles/cytoscape/translate.js.map +1 -1
- package/dist/src/styles/defaults.d.ts +50 -0
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +315 -37
- package/dist/src/styles/defaults.js.map +1 -1
- package/dist/src/styles/index.d.ts +4 -3
- package/dist/src/styles/index.d.ts.map +1 -1
- package/dist/src/styles/index.js +3 -2
- package/dist/src/styles/index.js.map +1 -1
- package/dist/src/styles/internal.d.ts +1 -0
- package/dist/src/styles/internal.d.ts.map +1 -1
- package/dist/src/styles/internal.js +1 -0
- package/dist/src/styles/internal.js.map +1 -1
- package/dist/src/styles/io/block.d.ts.map +1 -1
- package/dist/src/styles/io/block.js +9 -0
- package/dist/src/styles/io/block.js.map +1 -1
- package/dist/src/styles/io/generic.d.ts.map +1 -1
- package/dist/src/styles/io/generic.js +56 -16
- package/dist/src/styles/io/generic.js.map +1 -1
- package/dist/src/styles/io/round-trip.d.ts +56 -0
- package/dist/src/styles/io/round-trip.d.ts.map +1 -0
- package/dist/src/styles/io/round-trip.js +138 -0
- package/dist/src/styles/io/round-trip.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -1
- package/dist/src/styles/io/writer.js +13 -4
- package/dist/src/styles/io/writer.js.map +1 -1
- package/dist/src/styles/notes.d.ts.map +1 -1
- package/dist/src/styles/notes.js +1 -0
- package/dist/src/styles/notes.js.map +1 -1
- package/dist/src/styles/plan/features.d.ts +1 -1
- package/dist/src/styles/plan/features.d.ts.map +1 -1
- package/dist/src/styles/plan/features.js +22 -2
- package/dist/src/styles/plan/features.js.map +1 -1
- package/dist/src/styles/plan/index.d.ts +1 -1
- package/dist/src/styles/plan/index.d.ts.map +1 -1
- package/dist/src/styles/plan/index.js +1 -1
- package/dist/src/styles/plan/index.js.map +1 -1
- package/dist/src/styles/plan/plan.d.ts.map +1 -1
- package/dist/src/styles/plan/plan.js +61 -4
- package/dist/src/styles/plan/plan.js.map +1 -1
- package/dist/src/styles/plan/resolve.d.ts +13 -1
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +53 -6
- package/dist/src/styles/plan/resolve.js.map +1 -1
- package/dist/src/styles/slots.d.ts +14 -0
- package/dist/src/styles/slots.d.ts.map +1 -0
- package/dist/src/styles/slots.js +20 -0
- package/dist/src/styles/slots.js.map +1 -0
- package/dist/src/styles/types.d.ts +638 -5
- package/dist/src/styles/types.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.d.ts +3 -2
- package/dist/src/styles/vocabulary.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.js +218 -1
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/src/types.d.ts +19 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.js +29 -238
- package/dist/styles.js.map +1 -1
- package/dist/xgmml.js +3 -3
- package/docs/samples/people.json +6 -0
- package/package.json +53 -8
- package/src/common/report.ts +27 -7
- package/src/formats/cx/importer.ts +6 -1
- package/src/formats/cx/styles.ts +144 -9
- package/src/formats/cx2/importer.ts +1 -0
- package/src/formats/cx2/styles.ts +3 -1
- package/src/formats/cys/importer.ts +1 -0
- package/src/formats/cys/styles.ts +27 -5
- package/src/formats/dot/drawing.ts +799 -0
- package/src/formats/dot/importer.ts +120 -35
- package/src/formats/dot/label-places.ts +228 -0
- package/src/formats/dot/record.ts +336 -0
- package/src/formats/dot/styles.ts +1657 -154
- package/src/formats/gexf/dialog-metrics.ts +61 -0
- package/src/formats/gexf/importer.ts +50 -5
- package/src/formats/gexf/preview.ts +217 -0
- package/src/formats/gexf/schema.ts +2 -1
- package/src/formats/gexf/styles.ts +1144 -142
- package/src/formats/gml/importer.ts +291 -76
- package/src/formats/gml/index.ts +1 -1
- package/src/formats/gml/positions.ts +29 -7
- package/src/formats/gml/styles.ts +854 -111
- package/src/formats/graphml/styles-plain.ts +8 -23
- package/src/formats/graphml/styles-yed.ts +821 -159
- package/src/formats/graphml/styles-yfiles3.ts +485 -63
- package/src/formats/graphml/yfiles.ts +19 -6
- package/src/formats/json/dialect.ts +41 -5
- package/src/formats/json/importer.ts +59 -7
- package/src/formats/json/index.ts +1 -0
- package/src/formats/json/positions.ts +22 -5
- package/src/formats/json/styles.ts +2041 -185
- package/src/formats/pajek/draw.ts +458 -0
- package/src/formats/pajek/exporter.ts +81 -49
- package/src/formats/pajek/importer.ts +278 -103
- package/src/formats/pajek/index.ts +1 -0
- package/src/formats/pajek/styles.ts +1382 -133
- package/src/formats/pajek/syntax.ts +27 -2
- package/src/formats/xgmml/emit.ts +73 -5
- package/src/formats/xgmml/styles.ts +331 -71
- package/src/index.ts +94 -0
- package/src/positions/convert.ts +12 -1
- package/src/positions/extract.ts +55 -1
- package/src/positions/index.ts +1 -0
- package/src/positions/types.ts +60 -0
- package/src/registry.ts +326 -1
- package/src/sources/builtins.ts +63 -0
- package/src/sources/codes.ts +235 -0
- package/src/sources/context.ts +894 -0
- package/src/sources/credentials.ts +409 -0
- package/src/sources/cypher/descriptor.ts +131 -0
- package/src/sources/cypher/flatten.ts +323 -0
- package/src/sources/cypher/index.ts +628 -0
- package/src/sources/cypher/params.ts +41 -0
- package/src/sources/cypher/profiles.ts +78 -0
- package/src/sources/cypher/query-builder.ts +327 -0
- package/src/sources/cypher/transports/bolt.ts +228 -0
- package/src/sources/cypher/transports/neptune-analytics.ts +41 -0
- package/src/sources/cypher/transports/neptune-https.ts +122 -0
- package/src/sources/cypher/transports/query-api.ts +100 -0
- package/src/sources/cypher/transports/transport.ts +139 -0
- package/src/sources/cypher/types-map.ts +418 -0
- package/src/sources/define.ts +195 -0
- package/src/sources/fail.ts +70 -0
- package/src/sources/ids.ts +80 -0
- package/src/sources/ndex/client.ts +102 -0
- package/src/sources/ndex/descriptor.ts +64 -0
- package/src/sources/ndex/expand.ts +100 -0
- package/src/sources/ndex/index.ts +235 -0
- package/src/sources/ndex/params.ts +17 -0
- package/src/sources/ndex/share-url.ts +84 -0
- package/src/sources/params.ts +32 -0
- package/src/sources/registry.ts +325 -0
- package/src/sources/rest/descriptor.ts +79 -0
- package/src/sources/rest/index.ts +22 -0
- package/src/sources/rest/mapping.ts +401 -0
- package/src/sources/rest/openalex.ts +288 -0
- package/src/sources/rest/paging.ts +180 -0
- package/src/sources/rest/params.ts +243 -0
- package/src/sources/rest/records.ts +289 -0
- package/src/sources/rest/samples/deps-dev.ts +49 -0
- package/src/sources/rest/samples/string.ts +44 -0
- package/src/sources/rest/selectors.ts +91 -0
- package/src/sources/rest/source.ts +776 -0
- package/src/sources/rest/templates.ts +151 -0
- package/src/sources/run.ts +793 -0
- package/src/sources/sha256.ts +99 -0
- package/src/sources/sigv4.ts +209 -0
- package/src/sources/sparql/descriptor.ts +67 -0
- package/src/sources/sparql/index.ts +356 -0
- package/src/sources/sparql/ntriples.ts +219 -0
- package/src/sources/sparql/params.ts +28 -0
- package/src/sources/sparql/query.ts +162 -0
- package/src/sources/testing.ts +210 -0
- package/src/sources/types.ts +776 -0
- package/src/styles/annotations.ts +201 -27
- package/src/styles/canon/bends.ts +137 -0
- package/src/styles/canon/color-tables.ts +10 -4
- package/src/styles/canon/color.ts +105 -3
- package/src/styles/canon/enums.ts +99 -8
- package/src/styles/canon/graphviz.ts +71 -10
- package/src/styles/canon/number.ts +19 -0
- package/src/styles/canon/text.ts +187 -16
- package/src/styles/codes.ts +2 -0
- package/src/styles/cyjs/cascade.ts +1193 -38
- package/src/styles/cyjs/defaults-table.ts +5 -0
- package/src/styles/cyjs/emit.ts +247 -16
- package/src/styles/cyjs/face.ts +372 -0
- package/src/styles/cyjs/mappers.ts +498 -28
- package/src/styles/cyjs/routes.ts +432 -0
- package/src/styles/cytoscape/charts.ts +684 -0
- package/src/styles/cytoscape/emit.ts +220 -44
- package/src/styles/cytoscape/lexicon.ts +459 -80
- package/src/styles/cytoscape/mappings.ts +108 -0
- package/src/styles/cytoscape/resolve.ts +763 -23
- package/src/styles/cytoscape/translate.ts +11 -11
- package/src/styles/defaults.ts +436 -38
- package/src/styles/index.ts +5 -0
- package/src/styles/internal.ts +1 -0
- package/src/styles/io/block.ts +10 -0
- package/src/styles/io/generic.ts +79 -23
- package/src/styles/io/round-trip.ts +202 -0
- package/src/styles/io/writer.ts +14 -4
- package/src/styles/notes.ts +1 -0
- package/src/styles/plan/features.ts +23 -2
- package/src/styles/plan/index.ts +1 -1
- package/src/styles/plan/plan.ts +69 -5
- package/src/styles/plan/resolve.ts +61 -6
- package/src/styles/slots.ts +25 -0
- package/src/styles/types.ts +658 -4
- package/src/styles/vocabulary.ts +226 -3
- package/src/types.ts +19 -5
- package/dist/chunks/block-DiGq58c3.js.map +0 -1
- package/dist/chunks/choose--jM0yYCo.js +0 -57
- package/dist/chunks/choose--jM0yYCo.js.map +0 -1
- package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
- package/dist/chunks/emit-CwU8cUmG.js.map +0 -1
- package/dist/chunks/export-BvqAXCKh.js.map +0 -1
- package/dist/chunks/exporter-CrDWIyiq.js.map +0 -1
- package/dist/chunks/format-BpQBx8MZ.js.map +0 -1
- package/dist/chunks/generic-Dq1ntt9q.js.map +0 -1
- package/dist/chunks/importer-BSvfrX_h.js.map +0 -1
- package/dist/chunks/importer-CMmeMWlC.js.map +0 -1
- package/dist/chunks/importer-COTK9Tsl.js.map +0 -1
- package/dist/chunks/importer-DiZRmOQG.js.map +0 -1
- package/dist/chunks/importer-e6LGpqHB.js.map +0 -1
- package/dist/chunks/importer-iFYPEKaJ.js.map +0 -1
- package/dist/chunks/importer-yh_aBCU6.js.map +0 -1
- package/dist/chunks/lexicon-CT69Kd87.js.map +0 -1
- package/dist/chunks/styles-BQnsga7p.js.map +0 -1
- package/dist/chunks/styles-D3fRphrO.js +0 -690
- package/dist/chunks/styles-D3fRphrO.js.map +0 -1
- package/dist/chunks/styles-yed-BF5x3_Y5.js +0 -842
- package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
- package/dist/chunks/writer-DMKvthQE.js +0 -448
- package/dist/chunks/writer-DMKvthQE.js.map +0 -1
|
@@ -0,0 +1,1351 @@
|
|
|
1
|
+
import { b as throwIfAborted } from "./chunks/input-CAxt_aV-.js";
|
|
2
|
+
import { P as PRECISION_CODE, ah as ImportError } from "./chunks/report-CwMfYa9J.js";
|
|
3
|
+
import { C as CYPHER_DESCRIPTOR, N as NEO4J_DESCRIPTOR, a as NEPTUNE_DESCRIPTOR, S as SOURCE_ISSUE } from "./chunks/codes-BE2xir2k.js";
|
|
4
|
+
import { w as warnOn, f as failOn, p as SOURCE_DEGREE_ATTR, b as failAlone, o as originOf, u as unwrapCredential, d as defineSource, C as CYPHER_SOURCE_ID, h as NEO4J_SOURCE_ID, i as NEPTUNE_SOURCE_ID } from "./chunks/credentials-DXHx7nwR.js";
|
|
5
|
+
import { sha256Hex } from "./chunks/sigv4-EokFic1V.js";
|
|
6
|
+
import { INVALID_INDEX } from "@graphty/graph-format";
|
|
7
|
+
import { t as transportOptions, i as isLoopback } from "./chunks/context-C3p0RQxR.js";
|
|
8
|
+
class GraphNode {
|
|
9
|
+
/**
|
|
10
|
+
* Create one.
|
|
11
|
+
* @param id - the server's element id
|
|
12
|
+
* @param labels - its labels
|
|
13
|
+
* @param properties - its mapped properties
|
|
14
|
+
*/
|
|
15
|
+
constructor(id, labels, properties) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
this.labels = labels;
|
|
18
|
+
this.properties = properties;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
class GraphRel {
|
|
22
|
+
/**
|
|
23
|
+
* Create one.
|
|
24
|
+
* @param id - the server's element id
|
|
25
|
+
* @param start - the start node's element id
|
|
26
|
+
* @param end - the end node's element id
|
|
27
|
+
* @param type - its type
|
|
28
|
+
* @param properties - its mapped properties
|
|
29
|
+
*/
|
|
30
|
+
constructor(id, start, end, type, properties) {
|
|
31
|
+
this.id = id;
|
|
32
|
+
this.start = start;
|
|
33
|
+
this.end = end;
|
|
34
|
+
this.type = type;
|
|
35
|
+
this.properties = properties;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
39
|
+
function integer(digits, column2, m) {
|
|
40
|
+
let big;
|
|
41
|
+
try {
|
|
42
|
+
big = BigInt(digits);
|
|
43
|
+
} catch {
|
|
44
|
+
return Number(digits);
|
|
45
|
+
}
|
|
46
|
+
if (big <= SAFE && big >= -SAFE) {
|
|
47
|
+
return Number(big);
|
|
48
|
+
}
|
|
49
|
+
if (m.long === "string") {
|
|
50
|
+
return big.toString();
|
|
51
|
+
}
|
|
52
|
+
m.report.warnOnce(
|
|
53
|
+
"precision",
|
|
54
|
+
PRECISION_CODE,
|
|
55
|
+
`column ${column2}: an integer beyond 2^53 was stored as the nearest 64-bit float; pass long: "string" to keep every digit`,
|
|
56
|
+
void 0,
|
|
57
|
+
`${PRECISION_CODE}:${column2}`
|
|
58
|
+
);
|
|
59
|
+
return Number(big);
|
|
60
|
+
}
|
|
61
|
+
function epoch(text, type, column2, m) {
|
|
62
|
+
const ms = Date.parse(withoutZoneName(text));
|
|
63
|
+
if (Number.isNaN(ms)) {
|
|
64
|
+
warnOn(m.report, "W_SOURCE_VALUE", `column ${column2}: a ${type} kept as text`, { type, column: column2, as: "string" });
|
|
65
|
+
return text;
|
|
66
|
+
}
|
|
67
|
+
return ms;
|
|
68
|
+
}
|
|
69
|
+
function dropped(type, column2, m) {
|
|
70
|
+
warnOn(m.report, "W_SOURCE_VALUE", `column ${column2}: a ${type} value was dropped`, {
|
|
71
|
+
type,
|
|
72
|
+
column: column2,
|
|
73
|
+
as: "dropped"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function mapEntries(value, each) {
|
|
77
|
+
const out = {};
|
|
78
|
+
for (const [k, v] of Object.entries(value)) {
|
|
79
|
+
const mapped = each(v, k);
|
|
80
|
+
if (mapped !== void 0) {
|
|
81
|
+
out[k] = mapped;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
function wktPoint(text) {
|
|
87
|
+
const match = /^SRID=(\d+);POINT(?: Z)? ?\(([^)]*)\)$/i.exec(text.trim());
|
|
88
|
+
if (match === null) {
|
|
89
|
+
return text;
|
|
90
|
+
}
|
|
91
|
+
const [x = 0, y = 0, z] = match[2].trim().split(/\s+/).map(Number);
|
|
92
|
+
return z === void 0 ? { srid: Number(match[1]), x, y } : { srid: Number(match[1]), x, y, z };
|
|
93
|
+
}
|
|
94
|
+
function fromTypedJson(v, column2, m) {
|
|
95
|
+
if (v === null || typeof v !== "object" || !("$type" in v)) {
|
|
96
|
+
return v ?? null;
|
|
97
|
+
}
|
|
98
|
+
const { $type: type, _value: value } = v;
|
|
99
|
+
switch (type) {
|
|
100
|
+
case "Null":
|
|
101
|
+
return null;
|
|
102
|
+
case "Boolean":
|
|
103
|
+
case "String":
|
|
104
|
+
return value;
|
|
105
|
+
case "Integer":
|
|
106
|
+
return integer(String(value), column2, m);
|
|
107
|
+
case "Float":
|
|
108
|
+
return Number(value);
|
|
109
|
+
case "Date":
|
|
110
|
+
return epoch(`${String(value)}T00:00:00Z`, type, column2, m);
|
|
111
|
+
case "OffsetDateTime":
|
|
112
|
+
case "ZonedDateTime":
|
|
113
|
+
return epoch(String(value), type, column2, m);
|
|
114
|
+
case "LocalDateTime":
|
|
115
|
+
case "LocalTime":
|
|
116
|
+
case "Time":
|
|
117
|
+
case "Duration":
|
|
118
|
+
return String(value);
|
|
119
|
+
case "Point":
|
|
120
|
+
return wktPoint(String(value));
|
|
121
|
+
case "Base64":
|
|
122
|
+
dropped(type, column2, m);
|
|
123
|
+
return void 0;
|
|
124
|
+
case "List":
|
|
125
|
+
return value.map((x) => fromTypedJson(x, column2, m));
|
|
126
|
+
case "Map":
|
|
127
|
+
return mapEntries(value, (x) => fromTypedJson(x, column2, m));
|
|
128
|
+
case "Node": {
|
|
129
|
+
const n = value;
|
|
130
|
+
return new GraphNode(
|
|
131
|
+
n._element_id,
|
|
132
|
+
n._labels,
|
|
133
|
+
mapEntries(n._properties, (x, k) => fromTypedJson(x, k, m))
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
case "Relationship": {
|
|
137
|
+
const r = value;
|
|
138
|
+
return new GraphRel(
|
|
139
|
+
r._element_id,
|
|
140
|
+
r._start_node_element_id,
|
|
141
|
+
r._end_node_element_id,
|
|
142
|
+
r._type,
|
|
143
|
+
mapEntries(r._properties, (x, k) => fromTypedJson(x, k, m))
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
case "Path":
|
|
147
|
+
return value.map((x) => fromTypedJson(x, column2, m));
|
|
148
|
+
default:
|
|
149
|
+
warnOn(m.report, "W_SOURCE_VALUE", `column ${column2}: a ${type} kept as text`, {
|
|
150
|
+
type,
|
|
151
|
+
column: column2,
|
|
152
|
+
as: "string"
|
|
153
|
+
});
|
|
154
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function withoutZoneName(text) {
|
|
158
|
+
const end = text.length - 1;
|
|
159
|
+
if (text[end] !== "]") {
|
|
160
|
+
return text;
|
|
161
|
+
}
|
|
162
|
+
const open2 = text.indexOf("[", text.lastIndexOf("]", end - 1) + 1);
|
|
163
|
+
return open2 === -1 || open2 >= end ? text : text.slice(0, open2);
|
|
164
|
+
}
|
|
165
|
+
function fromEntity(e, node, m, t) {
|
|
166
|
+
const props = mapEntries(e.properties, (x, k) => fromDriver(x, k, m, t));
|
|
167
|
+
const id = e.elementId ?? String(e.identity);
|
|
168
|
+
return node ? new GraphNode(id, [...e.labels ?? []], props) : new GraphRel(
|
|
169
|
+
id,
|
|
170
|
+
e.startNodeElementId ?? String(e.start),
|
|
171
|
+
e.endNodeElementId ?? String(e.end),
|
|
172
|
+
e.type ?? "",
|
|
173
|
+
props
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
function fromPoint(p) {
|
|
177
|
+
const srid = Number(String(p.srid));
|
|
178
|
+
return p.z === void 0 ? { srid, x: p.x, y: p.y } : { srid, x: p.x, y: p.y, z: p.z };
|
|
179
|
+
}
|
|
180
|
+
function fromDriver(v, column2, m, t) {
|
|
181
|
+
if (v === null || v === void 0) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
if (typeof v !== "object") {
|
|
185
|
+
return typeof v === "bigint" ? integer(v.toString(), column2, m) : v;
|
|
186
|
+
}
|
|
187
|
+
const text = () => v.toString();
|
|
188
|
+
if (t.isInt(v)) {
|
|
189
|
+
return integer(text(), column2, m);
|
|
190
|
+
}
|
|
191
|
+
if (t.isNode(v) || t.isRelationship(v)) {
|
|
192
|
+
return fromEntity(v, t.isNode(v), m, t);
|
|
193
|
+
}
|
|
194
|
+
if (t.isPath(v)) {
|
|
195
|
+
const p = v;
|
|
196
|
+
return [p.start, ...p.segments.flatMap((s) => [s.relationship, s.end])].map((x) => fromDriver(x, column2, m, t));
|
|
197
|
+
}
|
|
198
|
+
if (t.isDate(v)) {
|
|
199
|
+
return epoch(`${text()}T00:00:00Z`, "Date", column2, m);
|
|
200
|
+
}
|
|
201
|
+
if (t.isDateTime(v)) {
|
|
202
|
+
return epoch(text(), "DateTime", column2, m);
|
|
203
|
+
}
|
|
204
|
+
if (t.isLocalDateTime(v) || t.isLocalTime(v) || t.isTime(v) || t.isDuration(v)) {
|
|
205
|
+
return text();
|
|
206
|
+
}
|
|
207
|
+
if (t.isPoint(v)) {
|
|
208
|
+
return fromPoint(v);
|
|
209
|
+
}
|
|
210
|
+
if (v instanceof Uint8Array || v instanceof ArrayBuffer) {
|
|
211
|
+
dropped("ByteArray", column2, m);
|
|
212
|
+
return void 0;
|
|
213
|
+
}
|
|
214
|
+
if (Array.isArray(v)) {
|
|
215
|
+
return v.map((x) => fromDriver(x, column2, m, t));
|
|
216
|
+
}
|
|
217
|
+
return mapEntries(v, (x) => fromDriver(x, column2, m, t));
|
|
218
|
+
}
|
|
219
|
+
function fromNeptune(v, column2, m) {
|
|
220
|
+
if (typeof v === "number" && Number.isInteger(v) && !Number.isSafeInteger(v)) {
|
|
221
|
+
return integer(BigInt(v).toString(), column2, m);
|
|
222
|
+
}
|
|
223
|
+
if (v === null || typeof v !== "object") {
|
|
224
|
+
return v ?? null;
|
|
225
|
+
}
|
|
226
|
+
if (Array.isArray(v)) {
|
|
227
|
+
return v.map((x) => fromNeptune(x, column2, m));
|
|
228
|
+
}
|
|
229
|
+
const o = v;
|
|
230
|
+
const props = () => mapEntries(o["~properties"] ?? {}, (x, k) => fromNeptune(x, k, m));
|
|
231
|
+
switch (o["~entityType"]) {
|
|
232
|
+
case "node":
|
|
233
|
+
return new GraphNode(String(o["~id"]), o["~labels"] ?? [], props());
|
|
234
|
+
case "relationship":
|
|
235
|
+
return new GraphRel(String(o["~id"]), String(o["~start"]), String(o["~end"]), String(o["~type"]), props());
|
|
236
|
+
default:
|
|
237
|
+
return mapEntries(o, (x) => fromNeptune(x, column2, m));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const LABELS_COLUMN = "labels";
|
|
241
|
+
const TYPE_COLUMN = "type";
|
|
242
|
+
const LABELS_DECL = {
|
|
243
|
+
name: LABELS_COLUMN,
|
|
244
|
+
dtype: "list",
|
|
245
|
+
itemDtype: "dict",
|
|
246
|
+
nullable: true,
|
|
247
|
+
role: "labels"
|
|
248
|
+
};
|
|
249
|
+
const TYPE_DECL = { name: TYPE_COLUMN, dtype: "dict", nullable: true, role: "kind" };
|
|
250
|
+
const EDGE_ID_DECL = { name: "id", dtype: "string", nullable: true, role: "id" };
|
|
251
|
+
class Collector {
|
|
252
|
+
constructor() {
|
|
253
|
+
this.nodes = /* @__PURE__ */ new Map();
|
|
254
|
+
this.rels = /* @__PURE__ */ new Map();
|
|
255
|
+
this.degrees = /* @__PURE__ */ new Map();
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Collect a result.
|
|
259
|
+
* @param result - the result
|
|
260
|
+
* @param hints - whether its `key` / `degree` / `degrees` columns are the generated queries' hints
|
|
261
|
+
*/
|
|
262
|
+
add(result, hints) {
|
|
263
|
+
const key = hints ? result.fields.indexOf("key") : -1;
|
|
264
|
+
const degree = hints ? result.fields.indexOf("degree") : -1;
|
|
265
|
+
const degrees = hints ? result.fields.indexOf("degrees") : -1;
|
|
266
|
+
for (const row of result.rows) {
|
|
267
|
+
row.forEach((value, i) => {
|
|
268
|
+
if (i === degrees && Array.isArray(value)) {
|
|
269
|
+
for (const pair of value) {
|
|
270
|
+
if (Array.isArray(pair) && typeof pair[1] === "number") {
|
|
271
|
+
this.degrees.set(String(pair[0]), pair[1]);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else if (i !== key && i !== degree) {
|
|
275
|
+
this.visit(value);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
if (key >= 0 && degree >= 0 && typeof row[degree] === "number") {
|
|
279
|
+
this.degrees.set(String(row[key]), row[degree]);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Collect every node and relationship inside a value.
|
|
285
|
+
* @param value - the value
|
|
286
|
+
*/
|
|
287
|
+
visit(value) {
|
|
288
|
+
if (value instanceof GraphNode) {
|
|
289
|
+
this.nodes.set(value.id, value);
|
|
290
|
+
} else if (value instanceof GraphRel) {
|
|
291
|
+
this.rels.set(value.id, value);
|
|
292
|
+
} else if (Array.isArray(value)) {
|
|
293
|
+
value.forEach((v) => {
|
|
294
|
+
this.visit(v);
|
|
295
|
+
});
|
|
296
|
+
} else if (value !== null && typeof value === "object") {
|
|
297
|
+
Object.values(value).forEach((v) => {
|
|
298
|
+
this.visit(v);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Whether nothing was collected.
|
|
304
|
+
* @returns true when no node or relationship was found
|
|
305
|
+
*/
|
|
306
|
+
get empty() {
|
|
307
|
+
return this.nodes.size === 0 && this.rels.size === 0;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function requireGraph(result, collector, report) {
|
|
311
|
+
if (result.rows.length > 0 && collector.empty) {
|
|
312
|
+
failOn(report, "E_SOURCE_NOT_A_GRAPH", "the query returned no node, relationship or path", {
|
|
313
|
+
columns: result.fields
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function nodeIdOf(node, idProperty) {
|
|
318
|
+
const value = idProperty === null ? void 0 : node.properties[idProperty];
|
|
319
|
+
return typeof value === "string" || typeof value === "number" ? value : node.id;
|
|
320
|
+
}
|
|
321
|
+
function column(sink, decl, domain) {
|
|
322
|
+
const existing = domain === "node" ? sink.nodeColumn(decl.name) : sink.edgeColumn(decl.name);
|
|
323
|
+
if (existing !== INVALID_INDEX) {
|
|
324
|
+
return existing;
|
|
325
|
+
}
|
|
326
|
+
return domain === "node" ? sink.declareNodeColumn(decl) : sink.declareEdgeColumn(decl);
|
|
327
|
+
}
|
|
328
|
+
function writeCollected(c, sink, idProperty, report, signal) {
|
|
329
|
+
if (sink.edgeCount === 0 && !sink.directedLocked && !sink.directed) {
|
|
330
|
+
sink.setDirected(true);
|
|
331
|
+
}
|
|
332
|
+
const ids = writeNodes(c, sink, idProperty, report, signal);
|
|
333
|
+
writeRels(c, sink, ids, report, signal, c.nodes.size);
|
|
334
|
+
}
|
|
335
|
+
function writeNodes(c, sink, idProperty, report, signal) {
|
|
336
|
+
const ids = /* @__PURE__ */ new Map();
|
|
337
|
+
let n = 0;
|
|
338
|
+
for (const node of c.nodes.values()) {
|
|
339
|
+
if (n++ % 64 === 0) {
|
|
340
|
+
throwIfAborted(signal);
|
|
341
|
+
}
|
|
342
|
+
const id = nodeIdOf(node, idProperty);
|
|
343
|
+
ids.set(node.id, id);
|
|
344
|
+
const degree = c.degrees.get(String(idProperty === null ? node.id : id));
|
|
345
|
+
try {
|
|
346
|
+
const fresh = sink.indexOf(id) === INVALID_INDEX;
|
|
347
|
+
const index = sink.addNodeRecord(
|
|
348
|
+
id,
|
|
349
|
+
degree === void 0 ? node.properties : { ...node.properties, [SOURCE_DEGREE_ATTR]: degree }
|
|
350
|
+
);
|
|
351
|
+
sink.setNodeValue(column(sink, LABELS_DECL, "node"), index, node.labels);
|
|
352
|
+
if (fresh) {
|
|
353
|
+
report.counts.nodes++;
|
|
354
|
+
}
|
|
355
|
+
} catch (err) {
|
|
356
|
+
report.recordError(err, { element: String(id) });
|
|
357
|
+
report.counts.skippedNodes++;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return ids;
|
|
361
|
+
}
|
|
362
|
+
function writeRels(c, sink, ids, report, signal, written) {
|
|
363
|
+
let n = written;
|
|
364
|
+
for (const rel of c.rels.values()) {
|
|
365
|
+
if (n++ % 64 === 0) {
|
|
366
|
+
throwIfAborted(signal);
|
|
367
|
+
}
|
|
368
|
+
const s = ids.get(rel.start) ?? rel.start;
|
|
369
|
+
const t = ids.get(rel.end) ?? rel.end;
|
|
370
|
+
try {
|
|
371
|
+
for (const end of [s, t]) {
|
|
372
|
+
if (sink.indexOf(end) === INVALID_INDEX) {
|
|
373
|
+
sink.addNode(end);
|
|
374
|
+
report.counts.nodes++;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const e = sink.addEdgeRecord(s, t, rel.properties, null);
|
|
378
|
+
sink.setEdgeValue(column(sink, TYPE_DECL, "edge"), e, rel.type);
|
|
379
|
+
sink.setEdgeValue(column(sink, EDGE_ID_DECL, "edge"), e, rel.id);
|
|
380
|
+
report.counts.edges++;
|
|
381
|
+
} catch (err) {
|
|
382
|
+
report.recordError(err, { element: `${String(s)} -> ${String(t)}` });
|
|
383
|
+
report.counts.skippedEdges++;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function compareText(a, b) {
|
|
388
|
+
if (a === b) {
|
|
389
|
+
return 0;
|
|
390
|
+
}
|
|
391
|
+
return a < b ? -1 : 1;
|
|
392
|
+
}
|
|
393
|
+
function member(key, value) {
|
|
394
|
+
return `${JSON.stringify(key)}:${canonical(value)}`;
|
|
395
|
+
}
|
|
396
|
+
function canonical(value) {
|
|
397
|
+
if (Array.isArray(value)) {
|
|
398
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
399
|
+
}
|
|
400
|
+
if (value !== null && typeof value === "object") {
|
|
401
|
+
const entries = Object.entries(value).sort(([a], [b]) => compareText(a, b));
|
|
402
|
+
const members = entries.map(([k, v]) => member(k, v));
|
|
403
|
+
return `{${members.join(",")}}`;
|
|
404
|
+
}
|
|
405
|
+
return JSON.stringify(value) ?? "null";
|
|
406
|
+
}
|
|
407
|
+
function canonicalRows(c, idProperty) {
|
|
408
|
+
const ids = /* @__PURE__ */ new Map();
|
|
409
|
+
const lines = [];
|
|
410
|
+
for (const node of c.nodes.values()) {
|
|
411
|
+
const id = nodeIdOf(node, idProperty);
|
|
412
|
+
ids.set(node.id, id);
|
|
413
|
+
lines.push(canonical(["n", id, [...node.labels].sort(compareText), node.properties]));
|
|
414
|
+
}
|
|
415
|
+
for (const rel of c.rels.values()) {
|
|
416
|
+
lines.push(
|
|
417
|
+
canonical([
|
|
418
|
+
"r",
|
|
419
|
+
rel.id,
|
|
420
|
+
ids.get(rel.start) ?? rel.start,
|
|
421
|
+
ids.get(rel.end) ?? rel.end,
|
|
422
|
+
rel.type,
|
|
423
|
+
rel.properties
|
|
424
|
+
])
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
return lines;
|
|
428
|
+
}
|
|
429
|
+
function neo4jProfile(version, product = "Neo4j") {
|
|
430
|
+
const major = version === null ? Number.NaN : Number.parseInt(version, 10);
|
|
431
|
+
return {
|
|
432
|
+
name: "neo4j",
|
|
433
|
+
elementIds: Number.isNaN(major) || major >= 5,
|
|
434
|
+
product,
|
|
435
|
+
version,
|
|
436
|
+
readOnly: "enforced"
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function profileFromAgent(agent) {
|
|
440
|
+
const [product = "", version = ""] = agent.split("/");
|
|
441
|
+
if (product.toLowerCase() === "neo4j") {
|
|
442
|
+
return neo4jProfile(version === "" ? null : version);
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
name: "neo4j",
|
|
446
|
+
elementIds: false,
|
|
447
|
+
product,
|
|
448
|
+
version: version === "" ? null : version,
|
|
449
|
+
readOnly: "enforced"
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function neptuneProfile(version = null) {
|
|
453
|
+
return { name: "neptune", elementIds: false, product: "Neptune", version, readOnly: "not-enforced" };
|
|
454
|
+
}
|
|
455
|
+
function serverFacts(profile) {
|
|
456
|
+
return {
|
|
457
|
+
product: profile.product,
|
|
458
|
+
profile: profile.name,
|
|
459
|
+
readOnly: profile.readOnly,
|
|
460
|
+
...profile.version === null ? {} : { version: profile.version }
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
const MAX_DEPTH = 10;
|
|
464
|
+
const MAX_PAGE_SIZE = 1e5;
|
|
465
|
+
const DEFAULT_PAGE_SIZE = 1e3;
|
|
466
|
+
function identifierProblem(name) {
|
|
467
|
+
return typeof name !== "string" || name === "" || name.includes("\0") ? "identifier" : null;
|
|
468
|
+
}
|
|
469
|
+
function cypherIdentifier(name) {
|
|
470
|
+
if (identifierProblem(name) !== null) {
|
|
471
|
+
failAlone("E_SOURCE_PARAM", "a Cypher identifier must be a non-empty string without NUL", {
|
|
472
|
+
name: "identifier",
|
|
473
|
+
reason: "identifier"
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
return `\`${name.replaceAll("`", "``")}\``;
|
|
477
|
+
}
|
|
478
|
+
function quoted(name, param, report) {
|
|
479
|
+
if (identifierProblem(name) !== null) {
|
|
480
|
+
failOn(report, "E_SOURCE_PARAM", `parameter ${param}: not a Cypher identifier`, {
|
|
481
|
+
name: param,
|
|
482
|
+
reason: "identifier"
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
return cypherIdentifier(name);
|
|
486
|
+
}
|
|
487
|
+
function checkedInteger(value, name, min, max, report) {
|
|
488
|
+
if (typeof value !== "number" || !Number.isInteger(value)) {
|
|
489
|
+
failOn(report, "E_SOURCE_PARAM", `parameter ${name}: not an integer`, { name, reason: "type" });
|
|
490
|
+
}
|
|
491
|
+
if (value < min || value > max) {
|
|
492
|
+
failOn(report, "E_SOURCE_PARAM", `parameter ${name}: outside ${String(min)} to ${String(max)}`, {
|
|
493
|
+
name,
|
|
494
|
+
reason: "range"
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
return String(value);
|
|
498
|
+
}
|
|
499
|
+
function idExpression(v, profile, filters, node = true) {
|
|
500
|
+
if (node && filters.idProperty !== null) {
|
|
501
|
+
return `${v}.${filters.idProperty}`;
|
|
502
|
+
}
|
|
503
|
+
return profile.elementIds ? `elementId(${v})` : `id(${v})`;
|
|
504
|
+
}
|
|
505
|
+
function nodePredicate(v, filters) {
|
|
506
|
+
const parts = [];
|
|
507
|
+
if (filters.labels.length > 0) {
|
|
508
|
+
const prefix = `${v}:`;
|
|
509
|
+
parts.push(`(${filters.labels.map((l) => prefix + l).join(" OR ")})`);
|
|
510
|
+
}
|
|
511
|
+
if (filters.idProperty !== null) {
|
|
512
|
+
parts.push(`${v}.${filters.idProperty} IS NOT NULL`);
|
|
513
|
+
}
|
|
514
|
+
return parts.length === 0 ? null : parts.join(" AND ");
|
|
515
|
+
}
|
|
516
|
+
function typesPattern(filters) {
|
|
517
|
+
return filters.relationshipTypes.length === 0 ? "" : `:${filters.relationshipTypes.join("|")}`;
|
|
518
|
+
}
|
|
519
|
+
function degreeOf(v) {
|
|
520
|
+
return `size([(${v})--() | 1])`;
|
|
521
|
+
}
|
|
522
|
+
const ARROWS = { out: ["-", "->"], in: ["<-", "-"], both: ["-", "-"] };
|
|
523
|
+
function nodePage(profile, filters, pageSize, after, degree) {
|
|
524
|
+
const where = nodePredicate("n", filters);
|
|
525
|
+
return [
|
|
526
|
+
"MATCH (n)",
|
|
527
|
+
where === null ? null : `WHERE ${where}`,
|
|
528
|
+
`WITH n, ${idExpression("n", profile, filters)} AS key`,
|
|
529
|
+
after ? "WHERE key > $after" : null,
|
|
530
|
+
degree ? `RETURN n, key, ${degreeOf("n")} AS degree` : "RETURN n, key",
|
|
531
|
+
`ORDER BY key LIMIT ${pageSize}`
|
|
532
|
+
].filter((l) => l !== null).join(" ");
|
|
533
|
+
}
|
|
534
|
+
function edgePage(profile, filters, pageSize, after) {
|
|
535
|
+
const a = nodePredicate("a", filters);
|
|
536
|
+
const b = nodePredicate("b", filters);
|
|
537
|
+
const where = [a, b].filter((p) => p !== null);
|
|
538
|
+
return [
|
|
539
|
+
`MATCH (a)-[r${typesPattern(filters)}]->(b)`,
|
|
540
|
+
where.length === 0 ? null : `WHERE ${where.join(" AND ")}`,
|
|
541
|
+
`WITH a, r, b, ${idExpression("r", profile, filters, false)} AS key`,
|
|
542
|
+
after ? "WHERE key > $after" : null,
|
|
543
|
+
"RETURN a, r, b, key",
|
|
544
|
+
`ORDER BY key LIMIT ${pageSize}`
|
|
545
|
+
].filter((l) => l !== null).join(" ");
|
|
546
|
+
}
|
|
547
|
+
function edgesAmong(profile, filters, after) {
|
|
548
|
+
const where = [nodePredicate("a", filters), nodePredicate("b", filters)].filter((p) => p !== null);
|
|
549
|
+
return [
|
|
550
|
+
`MATCH (a)-[r${typesPattern(filters)}]->(b)`,
|
|
551
|
+
where.length === 0 ? null : `WHERE ${where.join(" AND ")}`,
|
|
552
|
+
`WITH a, r, b, ${idExpression("a", profile, filters)} AS ka, ${idExpression("b", profile, filters)} AS kb`,
|
|
553
|
+
`WHERE ka <= $last AND kb <= $last${after ? " AND (ka > $after OR kb > $after)" : ""}`,
|
|
554
|
+
"RETURN a, r, b"
|
|
555
|
+
].filter((l) => l !== null).join(" ");
|
|
556
|
+
}
|
|
557
|
+
function neighborhood(profile, filters, shape, degree) {
|
|
558
|
+
const rel = `[${typesPattern(filters)}*1..${shape.depth}]`;
|
|
559
|
+
const [left, right] = ARROWS[shape.direction];
|
|
560
|
+
const pattern = `${left}${rel}${right}`;
|
|
561
|
+
const x = nodePredicate("x", filters);
|
|
562
|
+
const degrees = degree ? `, [m IN CASE WHEN p IS NULL THEN [s] ELSE nodes(p) END | [${idExpression("m", profile, filters)}, ${degreeOf("m")}]] AS degrees` : "";
|
|
563
|
+
const head = [
|
|
564
|
+
`MATCH (s) WHERE ${idExpression("s", profile, filters)} IN $ids`,
|
|
565
|
+
`OPTIONAL MATCH p = (s)${pattern}(x)${whereClause(x)}`
|
|
566
|
+
];
|
|
567
|
+
if (shape.limit === null) {
|
|
568
|
+
return [...head, "WITH s, p", `RETURN s, p${degrees}`].join(" ");
|
|
569
|
+
}
|
|
570
|
+
return [
|
|
571
|
+
...head,
|
|
572
|
+
`WITH s, p, ${idExpression("x", profile, filters)} AS key`,
|
|
573
|
+
shape.after === true ? "WHERE key > $after" : null,
|
|
574
|
+
`WITH s, p, key ORDER BY key LIMIT ${shape.limit}`,
|
|
575
|
+
`RETURN s, p, key${degrees}`
|
|
576
|
+
].filter((l) => l !== null).join(" ");
|
|
577
|
+
}
|
|
578
|
+
function whereClause(predicate) {
|
|
579
|
+
return predicate === null ? "" : ` WHERE ${predicate}`;
|
|
580
|
+
}
|
|
581
|
+
function counts(filters) {
|
|
582
|
+
const n = nodePredicate("n", filters);
|
|
583
|
+
const where = [nodePredicate("a", filters), nodePredicate("b", filters)].filter((p) => p !== null);
|
|
584
|
+
return [
|
|
585
|
+
`MATCH (n)${whereClause(n)} RETURN count(n) AS c`,
|
|
586
|
+
`MATCH (a)-[r${typesPattern(filters)}]->(b)${whereClause(where.length === 0 ? null : where.join(" AND "))} RETURN count(r) AS c`
|
|
587
|
+
];
|
|
588
|
+
}
|
|
589
|
+
function storeCount(label) {
|
|
590
|
+
const pattern = label === void 0 ? "n" : `n:${label}`;
|
|
591
|
+
return `MATCH (${pattern}) RETURN count(n) AS c`;
|
|
592
|
+
}
|
|
593
|
+
const MAX_SERVER_MESSAGE = 500;
|
|
594
|
+
function serverError(report, err, origin, database) {
|
|
595
|
+
const code = err.code ?? "";
|
|
596
|
+
if (/Security\.Unauthorized|AuthenticationRateLimit|UnauthorizedException/i.test(code)) {
|
|
597
|
+
return failOn(report, "E_SOURCE_AUTH", `${origin} refused the login`, {
|
|
598
|
+
origin,
|
|
599
|
+
status: err.status,
|
|
600
|
+
scheme: null,
|
|
601
|
+
serverCode: err.code
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
if (/Security\.Forbidden|AccessMode|AccessDenied/i.test(code)) {
|
|
605
|
+
return failOn(report, "E_SOURCE_FORBIDDEN", `${origin} refused the statement`, {
|
|
606
|
+
status: err.status,
|
|
607
|
+
serverCode: err.code
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
if (/TimedOut|Timeout|TimeLimitExceeded/i.test(code)) {
|
|
611
|
+
return failOn(report, "E_SOURCE_TIMEOUT", `${origin} timed the statement out`, {
|
|
612
|
+
timeoutMs: null,
|
|
613
|
+
serverSide: true
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
if (/DatabaseNotFound/i.test(code)) {
|
|
617
|
+
return failOn(report, "E_SOURCE_NOT_FOUND", `${origin} has no database ${String(database)}`, {
|
|
618
|
+
what: "database",
|
|
619
|
+
value: database ?? null
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
const where = /line (\d+), column (\d+)/i.exec(err.message);
|
|
623
|
+
return failOn(report, "E_SOURCE_QUERY", `${origin} refused the query: ${code}`, {
|
|
624
|
+
serverCode: err.code,
|
|
625
|
+
line: where === null ? null : Number(where[1]),
|
|
626
|
+
column: where === null ? null : Number(where[2]),
|
|
627
|
+
serverMessage: err.showable && err.message !== "" ? err.message.slice(0, MAX_SERVER_MESSAGE) : null
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function parseJson(text) {
|
|
631
|
+
try {
|
|
632
|
+
return JSON.parse(text);
|
|
633
|
+
} catch {
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
function objectRows(results, map) {
|
|
638
|
+
const fields = [...new Set(results.flatMap((r) => Object.keys(r)))];
|
|
639
|
+
return { fields, rows: results.map((r) => fields.map((f) => map(r[f], f))) };
|
|
640
|
+
}
|
|
641
|
+
const DRIVER_PACKAGE = "neo4j-driver";
|
|
642
|
+
const DIRECT_SCHEMES = /* @__PURE__ */ new Set(["bolt:", "bolt+s:", "bolt+ssc:"]);
|
|
643
|
+
async function loadDriver(input) {
|
|
644
|
+
let mod;
|
|
645
|
+
try {
|
|
646
|
+
mod = await import("neo4j-driver");
|
|
647
|
+
} catch {
|
|
648
|
+
return failOn(input.ctx.report, "E_SOURCE_RUNTIME", `the bolt transport needs ${DRIVER_PACKAGE} installed`, {
|
|
649
|
+
runtime: input.ctx.runtime,
|
|
650
|
+
reason: "needs-peer-dependency",
|
|
651
|
+
package: DRIVER_PACKAGE
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
return mod.default ?? mod;
|
|
655
|
+
}
|
|
656
|
+
function refuseMixedContent(ctx, url) {
|
|
657
|
+
const page = globalThis.location;
|
|
658
|
+
if (ctx.runtime === "browser" && page?.protocol === "https:" && url.protocol === "bolt:" && !isLoopback(url.hostname)) {
|
|
659
|
+
failOn(ctx.report, "E_SOURCE_RUNTIME", "an https page cannot open a plain Bolt WebSocket", {
|
|
660
|
+
runtime: ctx.runtime,
|
|
661
|
+
reason: "insecure-endpoint"
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
async function connection(input, neo4j) {
|
|
666
|
+
const { ctx } = input;
|
|
667
|
+
const { report } = ctx;
|
|
668
|
+
const bad = (reason, message) => failOn(report, "E_SOURCE_PARAM", message, { name: "endpoint", reason });
|
|
669
|
+
const url = ctx.endpoint ?? bad("missing", "the bolt transport needs an endpoint");
|
|
670
|
+
if (!DIRECT_SCHEMES.has(url.protocol)) {
|
|
671
|
+
bad(url.protocol.startsWith("neo4j") ? "routing" : "scheme", `${url.protocol} is not a direct Bolt scheme`);
|
|
672
|
+
}
|
|
673
|
+
refuseMixedContent(ctx, url);
|
|
674
|
+
const { credential, allowInsecure } = transportOptions(ctx);
|
|
675
|
+
const origin = originOf(url);
|
|
676
|
+
const bound = credential !== void 0 && (credential.origins.length === 0 || credential.origins.includes(origin));
|
|
677
|
+
if (!bound || credential === void 0) {
|
|
678
|
+
return { url, auth: void 0 };
|
|
679
|
+
}
|
|
680
|
+
if (url.protocol === "bolt+ssc:") {
|
|
681
|
+
bad("unverified-tls", "bolt+ssc accepts any certificate, so no credential is sent over it");
|
|
682
|
+
}
|
|
683
|
+
if (url.protocol === "bolt:" && !isLoopback(url.hostname) && allowInsecure !== true) {
|
|
684
|
+
bad("insecure-endpoint", "a credential is never sent without TLS");
|
|
685
|
+
}
|
|
686
|
+
const secret = unwrapCredential(credential);
|
|
687
|
+
if (secret !== void 0 && "username" in secret) {
|
|
688
|
+
return { url, auth: neo4j.auth.basic(secret.username, secret.password) };
|
|
689
|
+
}
|
|
690
|
+
if (secret !== void 0 && "token" in secret) {
|
|
691
|
+
const token = typeof secret.token === "string" ? secret.token : await secret.token();
|
|
692
|
+
return { url, auth: neo4j.auth.bearer(token) };
|
|
693
|
+
}
|
|
694
|
+
return failOn(report, "E_SOURCE_PARAM", "the bolt transport takes a basic or bearer credential", {
|
|
695
|
+
name: "credential",
|
|
696
|
+
reason: "kind"
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
async function boltTransport(input) {
|
|
700
|
+
const { ctx, params, m } = input;
|
|
701
|
+
throwIfAborted(ctx.signal);
|
|
702
|
+
const neo4j = await loadDriver(input);
|
|
703
|
+
const { url, auth } = await connection(input, neo4j);
|
|
704
|
+
throwIfAborted(ctx.signal);
|
|
705
|
+
const origin = originOf(url);
|
|
706
|
+
const { userAgent } = transportOptions(ctx);
|
|
707
|
+
const driver = neo4j.driver(`${url.protocol}//${url.host}`, auth, userAgent === void 0 ? {} : { userAgent });
|
|
708
|
+
const session = driver.session({
|
|
709
|
+
defaultAccessMode: neo4j.session.READ,
|
|
710
|
+
...params.database === void 0 ? {} : { database: params.database }
|
|
711
|
+
});
|
|
712
|
+
let closed = null;
|
|
713
|
+
const close = () => {
|
|
714
|
+
closed ??= session.close().catch(() => void 0).then(() => driver.close()).catch(() => void 0);
|
|
715
|
+
return closed;
|
|
716
|
+
};
|
|
717
|
+
const onAbort = () => {
|
|
718
|
+
void close();
|
|
719
|
+
};
|
|
720
|
+
ctx.signal.addEventListener("abort", onAbort, { once: true });
|
|
721
|
+
const fail = (err) => {
|
|
722
|
+
throwIfAborted(ctx.signal);
|
|
723
|
+
const e = err;
|
|
724
|
+
const code = typeof e.code === "string" ? e.code : null;
|
|
725
|
+
if (code === null || code === "ServiceUnavailable" || code === "SessionExpired") {
|
|
726
|
+
return ctx.runtime === "browser" ? failOn(ctx.report, "E_SOURCE_BLOCKED", `${origin} could not be reached over Bolt`, {
|
|
727
|
+
url: origin,
|
|
728
|
+
cause: "unknown"
|
|
729
|
+
}) : failOn(ctx.report, "E_FETCH", `${origin} could not be reached over Bolt`, {
|
|
730
|
+
url: origin,
|
|
731
|
+
status: null
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
return serverError(
|
|
735
|
+
ctx.report,
|
|
736
|
+
{
|
|
737
|
+
code,
|
|
738
|
+
message: typeof e.message === "string" ? e.message : "",
|
|
739
|
+
status: null,
|
|
740
|
+
showable: code.startsWith("Neo.ClientError.")
|
|
741
|
+
},
|
|
742
|
+
origin,
|
|
743
|
+
params.database
|
|
744
|
+
);
|
|
745
|
+
};
|
|
746
|
+
let detected = null;
|
|
747
|
+
const profile = async () => {
|
|
748
|
+
if (detected === null) {
|
|
749
|
+
const info = await driver.getServerInfo().catch(fail);
|
|
750
|
+
detected = profileFromAgent(info.agent ?? "");
|
|
751
|
+
}
|
|
752
|
+
return detected;
|
|
753
|
+
};
|
|
754
|
+
const timeout = ctx.limits.timeoutMs;
|
|
755
|
+
return {
|
|
756
|
+
async run(statement, parameters) {
|
|
757
|
+
throwIfAborted(ctx.signal);
|
|
758
|
+
const result = await session.run(statement, parameters, timeout === void 0 ? void 0 : { timeout }).catch(fail);
|
|
759
|
+
const fields = (result.records[0]?.keys ?? []).map(String);
|
|
760
|
+
return {
|
|
761
|
+
fields,
|
|
762
|
+
rows: result.records.map((r) => fields.map((k) => fromDriver(r.get(k), k, m, neo4j)))
|
|
763
|
+
};
|
|
764
|
+
},
|
|
765
|
+
profile,
|
|
766
|
+
probe: profile,
|
|
767
|
+
close: async () => {
|
|
768
|
+
ctx.signal.removeEventListener("abort", onAbort);
|
|
769
|
+
await close();
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
function nodeOnly(ctx, transport) {
|
|
774
|
+
if (ctx.runtime === "browser" || ctx.runtime === "worker") {
|
|
775
|
+
failOn(ctx.report, "E_SOURCE_RUNTIME", `the ${transport} transport cannot run in a browser`, {
|
|
776
|
+
runtime: ctx.runtime,
|
|
777
|
+
reason: "cors"
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
function trailingError(text) {
|
|
782
|
+
for (let at = text.lastIndexOf("{"); at > 0; at = text.lastIndexOf("{", at - 1)) {
|
|
783
|
+
const tail = parseJson(text.slice(at));
|
|
784
|
+
if (tail !== null && typeof tail.code === "string") {
|
|
785
|
+
return tail;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return null;
|
|
789
|
+
}
|
|
790
|
+
async function neptuneResult(input, response) {
|
|
791
|
+
const { ctx, m } = input;
|
|
792
|
+
const origin = ctx.endpoint === null ? "" : originOf(ctx.endpoint);
|
|
793
|
+
const text = await response.text();
|
|
794
|
+
const body = parseJson(text);
|
|
795
|
+
let error = typeof body?.code === "string" ? body : null;
|
|
796
|
+
if (body === null) {
|
|
797
|
+
error = trailingError(text);
|
|
798
|
+
}
|
|
799
|
+
if (error !== null) {
|
|
800
|
+
serverError(
|
|
801
|
+
ctx.report,
|
|
802
|
+
{
|
|
803
|
+
code: error.code ?? null,
|
|
804
|
+
message: error.detailedMessage ?? error.message ?? "",
|
|
805
|
+
status: response.status,
|
|
806
|
+
showable: body !== null && response.status >= 400 && response.status < 500
|
|
807
|
+
},
|
|
808
|
+
origin,
|
|
809
|
+
void 0
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
if (!response.ok) {
|
|
813
|
+
failOn(ctx.report, "E_FETCH", `${origin} answered ${String(response.status)}`, {
|
|
814
|
+
url: origin,
|
|
815
|
+
status: response.status
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
if (body === null || !Array.isArray(body.results)) {
|
|
819
|
+
failOn(ctx.report, "E_SOURCE_RESPONSE", "the Neptune answer has no results", {
|
|
820
|
+
expected: "json",
|
|
821
|
+
contentType: response.headers.get("content-type")
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
return objectRows(body.results, (v, column2) => fromNeptune(v, column2, m));
|
|
825
|
+
}
|
|
826
|
+
function neptuneHttpsTransport(input) {
|
|
827
|
+
const { ctx } = input;
|
|
828
|
+
nodeOnly(ctx, "neptune-https");
|
|
829
|
+
return {
|
|
830
|
+
async run(statement, parameters) {
|
|
831
|
+
const response = await ctx.fetch("openCypher", {
|
|
832
|
+
method: "POST",
|
|
833
|
+
idempotent: true,
|
|
834
|
+
allowStatus: [400, 500],
|
|
835
|
+
body: new URLSearchParams({ query: statement, parameters: JSON.stringify(parameters) })
|
|
836
|
+
});
|
|
837
|
+
return neptuneResult(input, response);
|
|
838
|
+
},
|
|
839
|
+
profile: () => Promise.resolve(neptuneProfile()),
|
|
840
|
+
probe: async () => {
|
|
841
|
+
const status = await ctx.fetchJson("status");
|
|
842
|
+
return neptuneProfile(typeof status.dbEngineVersion === "string" ? status.dbEngineVersion : null);
|
|
843
|
+
},
|
|
844
|
+
close: () => Promise.resolve()
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
function neptuneAnalyticsTransport(input) {
|
|
848
|
+
const { ctx } = input;
|
|
849
|
+
nodeOnly(ctx, "neptune-analytics");
|
|
850
|
+
const run = async (statement, parameters) => {
|
|
851
|
+
const response = await ctx.fetch("queries", {
|
|
852
|
+
method: "POST",
|
|
853
|
+
idempotent: true,
|
|
854
|
+
allowStatus: [400, 500],
|
|
855
|
+
headers: { "Content-Type": "application/json" },
|
|
856
|
+
body: JSON.stringify({ query: statement, language: "OPEN_CYPHER", parameters })
|
|
857
|
+
});
|
|
858
|
+
return neptuneResult(input, response);
|
|
859
|
+
};
|
|
860
|
+
return {
|
|
861
|
+
run,
|
|
862
|
+
profile: () => Promise.resolve(neptuneProfile()),
|
|
863
|
+
probe: async () => {
|
|
864
|
+
await run("RETURN 1 AS ok", {});
|
|
865
|
+
return neptuneProfile();
|
|
866
|
+
},
|
|
867
|
+
close: () => Promise.resolve()
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
const TYPED_JSON = "application/vnd.neo4j.query.v1.1";
|
|
871
|
+
const ERROR_STATUSES = [400, 404, 500];
|
|
872
|
+
function queryApiTransport(input) {
|
|
873
|
+
const { ctx, params, m } = input;
|
|
874
|
+
const database = params.database ?? "neo4j";
|
|
875
|
+
const path = `db/${encodeURIComponent(database)}/query/v2`;
|
|
876
|
+
const origin = ctx.endpoint === null ? "" : originOf(ctx.endpoint);
|
|
877
|
+
const run = async (statement, parameters) => {
|
|
878
|
+
const response = await ctx.fetch(path, {
|
|
879
|
+
method: "POST",
|
|
880
|
+
idempotent: true,
|
|
881
|
+
allowStatus: ERROR_STATUSES,
|
|
882
|
+
headers: { "Content-Type": "application/json", Accept: TYPED_JSON },
|
|
883
|
+
body: JSON.stringify({ statement, parameters, accessMode: "Read" })
|
|
884
|
+
});
|
|
885
|
+
const body = parseJson(await response.text());
|
|
886
|
+
const first = body?.errors?.[0];
|
|
887
|
+
if (first !== void 0) {
|
|
888
|
+
serverError(
|
|
889
|
+
ctx.report,
|
|
890
|
+
{
|
|
891
|
+
code: first.code ?? null,
|
|
892
|
+
message: first.message ?? "",
|
|
893
|
+
status: response.status,
|
|
894
|
+
showable: response.status >= 400 && response.status < 500
|
|
895
|
+
},
|
|
896
|
+
origin,
|
|
897
|
+
params.database
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
if (response.status === 404) {
|
|
901
|
+
failOn(ctx.report, "E_SOURCE_NOT_FOUND", `${origin} has no Query API at ${path}`, {
|
|
902
|
+
what: "url",
|
|
903
|
+
value: `${origin}/${path}`
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
if (!response.ok) {
|
|
907
|
+
failOn(ctx.report, "E_FETCH", `${origin} answered ${String(response.status)}`, {
|
|
908
|
+
url: `${origin}/${path}`,
|
|
909
|
+
status: response.status
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
if (body?.data === void 0) {
|
|
913
|
+
failOn(ctx.report, "E_SOURCE_RESPONSE", "the Query API answer has no data", {
|
|
914
|
+
expected: "json",
|
|
915
|
+
contentType: response.headers.get("content-type")
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
const { fields, values } = body.data;
|
|
919
|
+
return { fields, rows: values.map((row) => row.map((v, i) => fromTypedJson(v, fields[i] ?? "", m))) };
|
|
920
|
+
};
|
|
921
|
+
return {
|
|
922
|
+
run,
|
|
923
|
+
// the Query API exists from Neo4j 5.26, so ids are elementId()
|
|
924
|
+
profile: () => Promise.resolve(neo4jProfile(null)),
|
|
925
|
+
probe: async () => {
|
|
926
|
+
const res = await run(
|
|
927
|
+
"CALL dbms.components() YIELD name, versions, edition RETURN name, versions, edition",
|
|
928
|
+
{}
|
|
929
|
+
);
|
|
930
|
+
const kernel = res.rows.find((r) => r[0] === "Neo4j Kernel") ?? res.rows[0];
|
|
931
|
+
const versions = kernel?.[1];
|
|
932
|
+
const version = Array.isArray(versions) && typeof versions[0] === "string" ? versions[0] : null;
|
|
933
|
+
return neo4jProfile(version);
|
|
934
|
+
},
|
|
935
|
+
close: () => Promise.resolve()
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
const DIRECTIONS = /* @__PURE__ */ new Set(["out", "in", "both"]);
|
|
939
|
+
function withoutTrailingSemicolons(query) {
|
|
940
|
+
let end = query.length;
|
|
941
|
+
while (end > 0 && query[end - 1] === ";") {
|
|
942
|
+
end--;
|
|
943
|
+
}
|
|
944
|
+
return query.slice(0, end);
|
|
945
|
+
}
|
|
946
|
+
function listParam(value, name, report) {
|
|
947
|
+
if (value === void 0 || value === null) {
|
|
948
|
+
return [];
|
|
949
|
+
}
|
|
950
|
+
if (Array.isArray(value)) {
|
|
951
|
+
return value;
|
|
952
|
+
}
|
|
953
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
954
|
+
return [value];
|
|
955
|
+
}
|
|
956
|
+
return failOn(report, "E_SOURCE_PARAM", `parameter ${name}: not a list`, { name, reason: "type" });
|
|
957
|
+
}
|
|
958
|
+
function transportName(params, ctx, preset) {
|
|
959
|
+
if (params.transport !== void 0) {
|
|
960
|
+
return params.transport;
|
|
961
|
+
}
|
|
962
|
+
const scheme = ctx.endpoint?.protocol ?? "";
|
|
963
|
+
if (scheme.startsWith("bolt") || scheme.startsWith("neo4j")) {
|
|
964
|
+
return "bolt";
|
|
965
|
+
}
|
|
966
|
+
if (ctx.endpoint?.hostname.endsWith(".neptune-graph.amazonaws.com") === true) {
|
|
967
|
+
return "neptune-analytics";
|
|
968
|
+
}
|
|
969
|
+
return preset.transport;
|
|
970
|
+
}
|
|
971
|
+
class Reader {
|
|
972
|
+
/**
|
|
973
|
+
* Set up a read.
|
|
974
|
+
* @param transport - the transport
|
|
975
|
+
* @param params - the params
|
|
976
|
+
* @param ctx - the context
|
|
977
|
+
*/
|
|
978
|
+
constructor(transport, params, ctx) {
|
|
979
|
+
this.transport = transport;
|
|
980
|
+
this.params = params;
|
|
981
|
+
this.ctx = ctx;
|
|
982
|
+
this.known = null;
|
|
983
|
+
this.degree = true;
|
|
984
|
+
const { report } = ctx;
|
|
985
|
+
this.idProperty = params.idProperty ?? null;
|
|
986
|
+
this.filters = {
|
|
987
|
+
labels: listParam(params.labels, "labels", report).map((l) => quoted(l, "labels", report)),
|
|
988
|
+
relationshipTypes: listParam(params.relationshipTypes, "relationshipTypes", report).map(
|
|
989
|
+
(t) => quoted(t, "relationshipTypes", report)
|
|
990
|
+
),
|
|
991
|
+
idProperty: this.idProperty === null ? null : quoted(this.idProperty, "idProperty", report)
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* The server's profile: the params' choice, else the transport's detection.
|
|
996
|
+
* @returns the profile
|
|
997
|
+
*/
|
|
998
|
+
async profile() {
|
|
999
|
+
if (this.known === null) {
|
|
1000
|
+
const detected = await this.transport.profile();
|
|
1001
|
+
this.known = detected;
|
|
1002
|
+
if (this.params.profile === "neptune") {
|
|
1003
|
+
this.known = neptuneProfile(detected.version);
|
|
1004
|
+
} else if (this.params.profile === "neo4j" && detected.name !== "neo4j") {
|
|
1005
|
+
this.known = neo4jProfile(detected.version);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
return this.known;
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Run a generated statement with the degree hint, and without it once if the server refuses it.
|
|
1012
|
+
* @param build - builds the statement, with or without the hint
|
|
1013
|
+
* @param parameters - its parameters
|
|
1014
|
+
* @returns the result, collected
|
|
1015
|
+
*/
|
|
1016
|
+
async generated(build, parameters) {
|
|
1017
|
+
let result;
|
|
1018
|
+
try {
|
|
1019
|
+
result = await this.transport.run(build(this.degree), parameters);
|
|
1020
|
+
} catch (err) {
|
|
1021
|
+
if (!this.degree || !(err instanceof ImportError) || err.issue?.code !== SOURCE_ISSUE.E_SOURCE_QUERY) {
|
|
1022
|
+
throw err;
|
|
1023
|
+
}
|
|
1024
|
+
this.degree = false;
|
|
1025
|
+
result = await this.transport.run(build(false), parameters);
|
|
1026
|
+
}
|
|
1027
|
+
const collected = new Collector();
|
|
1028
|
+
collected.add(result, true);
|
|
1029
|
+
return { collected, rows: result.rows, fields: result.fields };
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* The pages of a read, as `mode` asks.
|
|
1033
|
+
* @param cursor - where to resume
|
|
1034
|
+
* @param counting - whether a first page of mode "all" may count what the source holds
|
|
1035
|
+
* @yields one page at a time
|
|
1036
|
+
*/
|
|
1037
|
+
async *pages(cursor, counting = true) {
|
|
1038
|
+
const { params, ctx } = this;
|
|
1039
|
+
const { report } = ctx;
|
|
1040
|
+
const mode = params.mode ?? (typeof params.query === "string" && params.query !== "" ? "query" : "all");
|
|
1041
|
+
if (mode === "query") {
|
|
1042
|
+
if (typeof params.query !== "string" || params.query.trim() === "") {
|
|
1043
|
+
failOn(report, "E_SOURCE_PARAM", "mode query needs a query", { name: "query", reason: "required" });
|
|
1044
|
+
}
|
|
1045
|
+
yield await this.userQuery(params.query, cursor);
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
const profile = await this.profile();
|
|
1049
|
+
if (mode === "neighborhood") {
|
|
1050
|
+
const ids = listParam(params.ids, "ids", report);
|
|
1051
|
+
if (ids.length === 0) {
|
|
1052
|
+
failOn(report, "E_SOURCE_PARAM", "mode neighborhood needs ids", { name: "ids", reason: "required" });
|
|
1053
|
+
}
|
|
1054
|
+
const shape = {
|
|
1055
|
+
depth: checkedInteger(params.depth ?? 1, "depth", 1, MAX_DEPTH, report),
|
|
1056
|
+
direction: "both",
|
|
1057
|
+
limit: ctx.limits.maxNodes === void 0 ? null : checkedInteger(ctx.limits.maxNodes, "maxNodes", 1, Number.MAX_SAFE_INTEGER, report)
|
|
1058
|
+
};
|
|
1059
|
+
const { collected } = await this.generated((d) => neighborhood(profile, this.filters, shape, d), { ids });
|
|
1060
|
+
yield { collected, next: null };
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
yield* this.everything(profile, cursor, counting);
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Mode "query": the reader's own query, as written. With a node cap (or a cursor from a capped
|
|
1067
|
+
* run) the server returns at most that many rows (`CALL { query } RETURN * LIMIT n`), and a full
|
|
1068
|
+
* result hands back a cursor that runs the query again with twice the rows, for the caller to
|
|
1069
|
+
* merge. A server that refuses the wrapper runs the query uncapped.
|
|
1070
|
+
* @param query - the query
|
|
1071
|
+
* @param cursor - where to resume: `{ rows }` from an earlier capped run
|
|
1072
|
+
* @returns the one page
|
|
1073
|
+
*/
|
|
1074
|
+
async userQuery(query, cursor) {
|
|
1075
|
+
const { params, ctx } = this;
|
|
1076
|
+
const parameters = params.parameters ?? {};
|
|
1077
|
+
const asked = cursor?.rows ?? ctx.limits.maxNodes;
|
|
1078
|
+
const rows = asked === void 0 || asked === null ? null : Number(checkedInteger(asked, "maxNodes", 1, Number.MAX_SAFE_INTEGER, ctx.report));
|
|
1079
|
+
let result;
|
|
1080
|
+
let capped = rows !== null;
|
|
1081
|
+
try {
|
|
1082
|
+
result = await this.transport.run(
|
|
1083
|
+
rows === null ? query : `CALL {
|
|
1084
|
+
${withoutTrailingSemicolons(query.trim())}
|
|
1085
|
+
}
|
|
1086
|
+
RETURN * LIMIT ${String(rows)}`,
|
|
1087
|
+
parameters
|
|
1088
|
+
);
|
|
1089
|
+
} catch (err) {
|
|
1090
|
+
if (!capped || !(err instanceof ImportError) || err.issue?.code !== SOURCE_ISSUE.E_SOURCE_QUERY) {
|
|
1091
|
+
throw err;
|
|
1092
|
+
}
|
|
1093
|
+
capped = false;
|
|
1094
|
+
result = await this.transport.run(query, parameters);
|
|
1095
|
+
}
|
|
1096
|
+
const collected = new Collector();
|
|
1097
|
+
collected.add(result, false);
|
|
1098
|
+
requireGraph(result, collected, ctx.report);
|
|
1099
|
+
const full = capped && rows !== null && result.rows.length >= rows;
|
|
1100
|
+
return { collected, next: full ? { rows: rows * 2 } : null };
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Mode "all": the nodes, then the relationships with their ends, each paged by keyset on the
|
|
1104
|
+
* id expression (never SKIP), so a page is stable under unrelated writes.
|
|
1105
|
+
* @param profile - the server's profile
|
|
1106
|
+
* @param cursor - where to resume
|
|
1107
|
+
* @param counting - whether a first page may count what the source holds
|
|
1108
|
+
* @yields one page at a time
|
|
1109
|
+
*/
|
|
1110
|
+
async *everything(profile, cursor, counting) {
|
|
1111
|
+
const { params, ctx } = this;
|
|
1112
|
+
const size = checkedInteger(params.pageSize ?? DEFAULT_PAGE_SIZE, "pageSize", 1, MAX_PAGE_SIZE, ctx.report);
|
|
1113
|
+
if (cursor === null && counting) {
|
|
1114
|
+
this.counted = await this.count(profile);
|
|
1115
|
+
}
|
|
1116
|
+
const cap = ctx.limits.maxNodes;
|
|
1117
|
+
if (cap !== void 0 && cursor?.phase !== "edges") {
|
|
1118
|
+
const capped = Number(checkedInteger(cap, "maxNodes", 1, Number.MAX_SAFE_INTEGER, ctx.report));
|
|
1119
|
+
yield* this.cappedNodes(profile, cursor, Math.min(Number(size), capped));
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
let phase = cursor?.phase === "edges" ? "edges" : "nodes";
|
|
1123
|
+
let after = cursor?.after ?? null;
|
|
1124
|
+
const { counted } = this;
|
|
1125
|
+
const total = params.countFirst === true && counted !== void 0 ? (counted.nodes ?? 0) + (counted.edges ?? 0) : void 0;
|
|
1126
|
+
for (; ; ) {
|
|
1127
|
+
const nodes = phase === "nodes";
|
|
1128
|
+
const { collected, rows, fields } = await this.generated(
|
|
1129
|
+
(d) => nodes ? nodePage(profile, this.filters, size, after !== null, d) : edgePage(profile, this.filters, size, after !== null),
|
|
1130
|
+
after === null ? {} : { after }
|
|
1131
|
+
);
|
|
1132
|
+
const next = nextCursor(phase, rows, fields, Number(size));
|
|
1133
|
+
yield { collected, next };
|
|
1134
|
+
const { counts: done } = ctx.report;
|
|
1135
|
+
ctx.progress(done.nodes + done.edges, total, "items");
|
|
1136
|
+
if (next === null) {
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
phase = next.phase === "edges" ? "edges" : "nodes";
|
|
1140
|
+
after = next.after ?? null;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Mode "all" under a node cap: pages of at most the cap's nodes, each with the relationships
|
|
1145
|
+
* among the nodes loaded so far, so a capped load stops at its cap with its edges, and its
|
|
1146
|
+
* next page (`data.more`) continues by key.
|
|
1147
|
+
* @param profile - the server's profile
|
|
1148
|
+
* @param cursor - where to resume
|
|
1149
|
+
* @param size - the page size
|
|
1150
|
+
* @yields one page at a time
|
|
1151
|
+
*/
|
|
1152
|
+
async *cappedNodes(profile, cursor, size) {
|
|
1153
|
+
let after = cursor?.after ?? null;
|
|
1154
|
+
for (; ; ) {
|
|
1155
|
+
const { collected, rows, fields } = await this.generated(
|
|
1156
|
+
(d) => nodePage(profile, this.filters, String(size), after !== null, d),
|
|
1157
|
+
after === null ? {} : { after }
|
|
1158
|
+
);
|
|
1159
|
+
const last = rows.at(-1)?.[fields.indexOf("key")];
|
|
1160
|
+
const key = typeof last === "string" || typeof last === "number" ? last : null;
|
|
1161
|
+
if (key !== null) {
|
|
1162
|
+
const among = await this.transport.run(edgesAmong(profile, this.filters, after !== null), {
|
|
1163
|
+
last: key,
|
|
1164
|
+
...after === null ? {} : { after }
|
|
1165
|
+
});
|
|
1166
|
+
collected.add(among, false);
|
|
1167
|
+
}
|
|
1168
|
+
const next = rows.length >= size && key !== null ? { phase: "nodes", after: key } : null;
|
|
1169
|
+
yield { collected, next };
|
|
1170
|
+
if (next === null) {
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
after = key;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* What a first page of mode "all" counts: with `countFirst`, the nodes and relationships the
|
|
1178
|
+
* filters match (for progress too); else, on Neo4j with at most one label and the server's
|
|
1179
|
+
* ids, the nodes from the count store; else nothing.
|
|
1180
|
+
* @param profile - the server's profile
|
|
1181
|
+
* @returns the count, or undefined
|
|
1182
|
+
*/
|
|
1183
|
+
async count(profile) {
|
|
1184
|
+
const first = async (statement) => {
|
|
1185
|
+
const c = Number((await this.transport.run(statement, {})).rows[0]?.[0]);
|
|
1186
|
+
return Number.isSafeInteger(c) && c >= 0 ? c : void 0;
|
|
1187
|
+
};
|
|
1188
|
+
const { labels, idProperty } = this.filters;
|
|
1189
|
+
if (this.params.countFirst === true) {
|
|
1190
|
+
const [n, r] = counts(this.filters);
|
|
1191
|
+
const [nodes2, edges] = await Promise.all([first(n), first(r)]);
|
|
1192
|
+
return { ...nodes2 === void 0 ? {} : { nodes: nodes2 }, ...edges === void 0 ? {} : { edges } };
|
|
1193
|
+
}
|
|
1194
|
+
if (profile.name !== "neo4j" || labels.length > 1 || idProperty !== null) {
|
|
1195
|
+
return void 0;
|
|
1196
|
+
}
|
|
1197
|
+
const nodes = await first(storeCount(labels[0]));
|
|
1198
|
+
return nodes === void 0 ? void 0 : { nodes };
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* The server facts and validators of what was read.
|
|
1202
|
+
* @param lines - the canonical rows
|
|
1203
|
+
* @returns the server facts and validators
|
|
1204
|
+
*/
|
|
1205
|
+
async facts(lines) {
|
|
1206
|
+
const profile = await this.profile();
|
|
1207
|
+
const contentHash = await sha256Hex([...lines].sort(compareText).join("\n"));
|
|
1208
|
+
return {
|
|
1209
|
+
server: serverFacts(profile),
|
|
1210
|
+
validators: profile.version === null ? { contentHash } : { contentHash, serverVersion: profile.version }
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
function nextCursor(phase, rows, fields, size) {
|
|
1215
|
+
const last = rows.at(-1)?.[fields.indexOf("key")];
|
|
1216
|
+
const key = typeof last === "string" || typeof last === "number" ? last : null;
|
|
1217
|
+
if (rows.length >= size && key !== null) {
|
|
1218
|
+
return { phase, after: key };
|
|
1219
|
+
}
|
|
1220
|
+
return phase === "nodes" ? { phase: "edges", after: null } : null;
|
|
1221
|
+
}
|
|
1222
|
+
async function open(params, ctx, preset) {
|
|
1223
|
+
throwIfAborted(ctx.signal);
|
|
1224
|
+
const input = { ctx, params, m: { long: params.long ?? "f64", report: ctx.report } };
|
|
1225
|
+
const name = transportName(params, ctx, preset);
|
|
1226
|
+
let transport;
|
|
1227
|
+
switch (name) {
|
|
1228
|
+
case "bolt":
|
|
1229
|
+
transport = await boltTransport(input);
|
|
1230
|
+
break;
|
|
1231
|
+
case "neptune-https":
|
|
1232
|
+
transport = neptuneHttpsTransport(input);
|
|
1233
|
+
break;
|
|
1234
|
+
case "neptune-analytics":
|
|
1235
|
+
transport = neptuneAnalyticsTransport(input);
|
|
1236
|
+
break;
|
|
1237
|
+
default:
|
|
1238
|
+
transport = queryApiTransport(input);
|
|
1239
|
+
break;
|
|
1240
|
+
}
|
|
1241
|
+
try {
|
|
1242
|
+
return new Reader(transport, params, ctx);
|
|
1243
|
+
} catch (err) {
|
|
1244
|
+
await transport.close();
|
|
1245
|
+
throw err;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
async function withReader(params, ctx, preset, body) {
|
|
1249
|
+
const reader = await open(params, ctx, preset);
|
|
1250
|
+
try {
|
|
1251
|
+
return await body(reader);
|
|
1252
|
+
} finally {
|
|
1253
|
+
await reader.transport.close();
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
function cypher(preset) {
|
|
1257
|
+
return defineSource({
|
|
1258
|
+
id: preset.id,
|
|
1259
|
+
descriptor: preset.descriptor,
|
|
1260
|
+
import: (params, sink, ctx) => withReader(params, ctx, preset, async (reader) => {
|
|
1261
|
+
const lines = [];
|
|
1262
|
+
let next = null;
|
|
1263
|
+
for await (const page of reader.pages(ctx.cursor)) {
|
|
1264
|
+
writeCollected(page.collected, sink, reader.idProperty, ctx.report, ctx.signal);
|
|
1265
|
+
lines.push(...canonicalRows(page.collected, reader.idProperty));
|
|
1266
|
+
({ next } = page);
|
|
1267
|
+
if (next !== null && ctx.limits.reached()) {
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
const total = reader.counted === void 0 ? {} : { total: reader.counted };
|
|
1272
|
+
return ctx.finish({ next, ...total, ...await reader.facts(lines) });
|
|
1273
|
+
}),
|
|
1274
|
+
expand: (request, sink, ctx) => withReader(request.params, ctx, preset, (reader) => expand(reader, request, sink)),
|
|
1275
|
+
probe: (params, ctx) => withReader(params, ctx, preset, async (reader) => {
|
|
1276
|
+
const profile = await reader.transport.probe();
|
|
1277
|
+
return { ok: true, server: serverFacts(profile) };
|
|
1278
|
+
}),
|
|
1279
|
+
validate: (params, seen, ctx) => withReader(params, ctx, preset, async (reader) => {
|
|
1280
|
+
const lines = [];
|
|
1281
|
+
for await (const page of reader.pages(null, false)) {
|
|
1282
|
+
lines.push(...canonicalRows(page.collected, reader.idProperty));
|
|
1283
|
+
}
|
|
1284
|
+
const { validators } = await reader.facts(lines);
|
|
1285
|
+
let status = "unverifiable";
|
|
1286
|
+
if (seen.contentHash !== void 0) {
|
|
1287
|
+
status = seen.contentHash === validators.contentHash ? "current" : "changed";
|
|
1288
|
+
}
|
|
1289
|
+
return { status, via: "hash", validators };
|
|
1290
|
+
})
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
async function expand(reader, request, sink) {
|
|
1294
|
+
const { ctx } = reader;
|
|
1295
|
+
const { report } = ctx;
|
|
1296
|
+
if (request.ids.length === 0) {
|
|
1297
|
+
failOn(report, "E_SOURCE_PARAM", "an expansion needs seed ids", { name: "ids", reason: "required" });
|
|
1298
|
+
}
|
|
1299
|
+
const direction = request.direction ?? "both";
|
|
1300
|
+
if (!DIRECTIONS.has(direction)) {
|
|
1301
|
+
failOn(report, "E_SOURCE_PARAM", "direction must be out, in or both", { name: "direction", reason: "enum" });
|
|
1302
|
+
}
|
|
1303
|
+
const limit = request.limit ?? ctx.limits.maxNodes;
|
|
1304
|
+
const after = ctx.cursor?.after ?? null;
|
|
1305
|
+
const shape = {
|
|
1306
|
+
depth: checkedInteger(request.depth ?? 1, "depth", 1, MAX_DEPTH, report),
|
|
1307
|
+
direction,
|
|
1308
|
+
limit: limit === void 0 ? null : checkedInteger(limit, "limit", 1, Number.MAX_SAFE_INTEGER, report),
|
|
1309
|
+
after: after !== null
|
|
1310
|
+
};
|
|
1311
|
+
const filters = request.relationshipTypes === void 0 ? reader.filters : {
|
|
1312
|
+
...reader.filters,
|
|
1313
|
+
relationshipTypes: request.relationshipTypes.map((t) => quoted(t, "relationshipTypes", report))
|
|
1314
|
+
};
|
|
1315
|
+
const profile = await reader.profile();
|
|
1316
|
+
const { collected, rows, fields } = await reader.generated((d) => neighborhood(profile, filters, shape, d), {
|
|
1317
|
+
ids: request.ids,
|
|
1318
|
+
...after === null ? {} : { after }
|
|
1319
|
+
});
|
|
1320
|
+
writeCollected(collected, sink, reader.idProperty, report, ctx.signal);
|
|
1321
|
+
const { server } = await reader.facts([]);
|
|
1322
|
+
const last = rows.at(-1)?.[fields.indexOf("key")];
|
|
1323
|
+
const full = shape.limit !== null && rows.length >= Number(shape.limit);
|
|
1324
|
+
const next = full && (typeof last === "string" || typeof last === "number") ? { after: last } : null;
|
|
1325
|
+
return ctx.finish({ server, next });
|
|
1326
|
+
}
|
|
1327
|
+
const cypherSource = cypher({
|
|
1328
|
+
id: CYPHER_SOURCE_ID,
|
|
1329
|
+
descriptor: CYPHER_DESCRIPTOR,
|
|
1330
|
+
transport: "query-api"
|
|
1331
|
+
});
|
|
1332
|
+
const neo4jSource = cypher({
|
|
1333
|
+
id: NEO4J_SOURCE_ID,
|
|
1334
|
+
descriptor: NEO4J_DESCRIPTOR,
|
|
1335
|
+
transport: "query-api"
|
|
1336
|
+
});
|
|
1337
|
+
const neptuneSource = cypher({
|
|
1338
|
+
id: NEPTUNE_SOURCE_ID,
|
|
1339
|
+
descriptor: NEPTUNE_DESCRIPTOR,
|
|
1340
|
+
transport: "neptune-https"
|
|
1341
|
+
});
|
|
1342
|
+
export {
|
|
1343
|
+
CYPHER_DESCRIPTOR,
|
|
1344
|
+
NEO4J_DESCRIPTOR,
|
|
1345
|
+
NEPTUNE_DESCRIPTOR,
|
|
1346
|
+
cypherIdentifier,
|
|
1347
|
+
cypherSource,
|
|
1348
|
+
neo4jSource,
|
|
1349
|
+
neptuneSource
|
|
1350
|
+
};
|
|
1351
|
+
//# sourceMappingURL=sources-cypher.js.map
|