@graphty/graph-io 0.3.48 → 0.3.50
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-C2riR4NT.js → approximations-BRXsll0T.js} +2 -2
- package/dist/chunks/{approximations-C2riR4NT.js.map → approximations-BRXsll0T.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-Cu22ewuS.js → block-yl0f_qLO.js} +931 -164
- package/dist/chunks/block-yl0f_qLO.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-CV_Bhcyi.js → codes-BE2xir2k.js} +6 -2
- package/dist/chunks/codes-BE2xir2k.js.map +1 -0
- package/dist/chunks/{constants-D0LqcsLJ.js → constants-CKkYLPtt.js} +2 -2
- package/dist/chunks/{constants-D0LqcsLJ.js.map → constants-CKkYLPtt.js.map} +1 -1
- package/dist/chunks/{context-cgmmOxZ2.js → context-DizmppHy.js} +5 -4
- package/dist/chunks/{context-cgmmOxZ2.js.map → context-DizmppHy.js.map} +1 -1
- 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-BiQsnMTb.js → credentials-CmvJXYeH.js} +67 -16
- package/dist/chunks/credentials-CmvJXYeH.js.map +1 -0
- package/dist/chunks/{cx-export-BEeF6ymo.js → cx-export-Bt6NoqTQ.js} +3 -3
- package/dist/chunks/{cx-export-BEeF6ymo.js.map → cx-export-Bt6NoqTQ.js.map} +1 -1
- package/dist/chunks/descriptor-B28U25x4.js +60 -0
- package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
- package/dist/chunks/{descriptor-BJ-W0Jd-.js → descriptor-Dhez_Cew.js} +11 -2
- package/dist/chunks/descriptor-Dhez_Cew.js.map +1 -0
- package/dist/chunks/{emit-CD8xnY8s.js → emit-7Jkpg0yd.js} +1788 -133
- package/dist/chunks/emit-7Jkpg0yd.js.map +1 -0
- package/dist/chunks/{escape-DH2Egt-l.js → escape-CuCIzNMB.js} +8 -8
- package/dist/chunks/{escape-DH2Egt-l.js.map → escape-CuCIzNMB.js.map} +1 -1
- package/dist/chunks/{export-CZ7VRm4I.js → export-Cha4dRFz.js} +45 -387
- package/dist/chunks/export-Cha4dRFz.js.map +1 -0
- package/dist/chunks/{exporter-ChjL5fmP.js → exporter-1Ajud15J.js} +9 -8
- package/dist/chunks/{exporter-ChjL5fmP.js.map → exporter-1Ajud15J.js.map} +1 -1
- package/dist/chunks/{exporter-BIdaoIgh.js → exporter-B6yvL3wy.js} +7 -7
- package/dist/chunks/{exporter-BIdaoIgh.js.map → exporter-B6yvL3wy.js.map} +1 -1
- package/dist/chunks/{exporter-Dcw7Ldtq.js → exporter-BP6otMO6.js} +6 -6
- package/dist/chunks/{exporter-Dcw7Ldtq.js.map → exporter-BP6otMO6.js.map} +1 -1
- package/dist/chunks/{exporter-DtVU80Fa.js → exporter-CA5q8ROP.js} +9 -8
- package/dist/chunks/{exporter-DtVU80Fa.js.map → exporter-CA5q8ROP.js.map} +1 -1
- package/dist/chunks/{exporter-bxxjOrDZ.js → exporter-CQQZFJ2v.js} +1284 -156
- package/dist/chunks/exporter-CQQZFJ2v.js.map +1 -0
- package/dist/chunks/format-BXiAb-1h.js +408 -0
- package/dist/chunks/format-BXiAb-1h.js.map +1 -0
- package/dist/chunks/{generic-CP6YD34u.js → generic-Dc21MAdg.js} +387 -31
- package/dist/chunks/generic-Dc21MAdg.js.map +1 -0
- package/dist/chunks/{importer-B87_fmVx.js → importer-C6NVpCXp.js} +327 -84
- package/dist/chunks/importer-C6NVpCXp.js.map +1 -0
- package/dist/chunks/{importer-DPZDN40-.js → importer-CKFe4q54.js} +25 -17
- package/dist/chunks/importer-CKFe4q54.js.map +1 -0
- package/dist/chunks/{importer-Bji2MeWr.js → importer-CKbUbsJA.js} +13 -10
- package/dist/chunks/{importer-Bji2MeWr.js.map → importer-CKbUbsJA.js.map} +1 -1
- package/dist/chunks/{importer-CB_zV5_L.js → importer-ClCsdgTJ.js} +208 -1104
- package/dist/chunks/importer-ClCsdgTJ.js.map +1 -0
- package/dist/chunks/{importer-e3huMZbm.js → importer-CyVZTrf0.js} +14 -10
- package/dist/chunks/importer-CyVZTrf0.js.map +1 -0
- package/dist/chunks/{importer-CVT-JyDE.js → importer-DgG4v1Ms.js} +1537 -355
- package/dist/chunks/importer-DgG4v1Ms.js.map +1 -0
- package/dist/chunks/{importer-Cyy6UseH.js → importer-asFUrIsj.js} +66 -13
- package/dist/chunks/importer-asFUrIsj.js.map +1 -0
- package/dist/chunks/{input-Ccg9I22A.js → input-CAxt_aV-.js} +4 -4
- package/dist/chunks/{input-Ccg9I22A.js.map → input-CAxt_aV-.js.map} +1 -1
- package/dist/chunks/{json-elements-By172SVq.js → json-elements-Cq76WjnZ.js} +4 -4
- package/dist/chunks/{json-elements-By172SVq.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
- package/dist/chunks/{lexicon-u2SI5xcx.js → lexicon-IVRq2Uoo.js} +282 -74
- package/dist/chunks/lexicon-IVRq2Uoo.js.map +1 -0
- package/dist/chunks/{ontology-export-BwgMyuF0.js → ontology-export-OMo91mb0.js} +4 -4
- package/dist/chunks/{ontology-export-BwgMyuF0.js.map → ontology-export-OMo91mb0.js.map} +1 -1
- package/dist/chunks/{records-Cgvxz-Vx.js → records-NJiYvekn.js} +2 -2
- package/dist/chunks/{records-Cgvxz-Vx.js.map → records-NJiYvekn.js.map} +1 -1
- package/dist/chunks/{report-CgdsL9Hb.js → report-CwMfYa9J.js} +23 -23
- package/dist/chunks/{report-CgdsL9Hb.js.map → report-CwMfYa9J.js.map} +1 -1
- package/dist/chunks/round-trip-Cy3_SHRZ.js +79 -0
- package/dist/chunks/round-trip-Cy3_SHRZ.js.map +1 -0
- package/dist/chunks/{sigv4-LkAzsLAu.js → sigv4-BXwVbza3.js} +5 -5
- package/dist/chunks/sigv4-BXwVbza3.js.map +1 -0
- package/dist/chunks/{styles-CaABMoO1.js → styles-CAVmBLgp.js} +1237 -138
- package/dist/chunks/styles-CAVmBLgp.js.map +1 -0
- package/dist/chunks/styles-CPczw1Jz.js +1928 -0
- package/dist/chunks/styles-CPczw1Jz.js.map +1 -0
- package/dist/chunks/styles-boK6Ln54.js +2847 -0
- package/dist/chunks/styles-boK6Ln54.js.map +1 -0
- package/dist/chunks/{styles-yed-Cs1nmrjn.js → styles-yed-XeFBQ6VS.js} +506 -175
- package/dist/chunks/styles-yed-XeFBQ6VS.js.map +1 -0
- package/dist/chunks/{text-BuKQVMz2.js → text-ystE2bYi.js} +2 -2
- package/dist/chunks/{text-BuKQVMz2.js.map → text-ystE2bYi.js.map} +1 -1
- package/dist/csv.js +7 -7
- package/dist/cx.js +2 -2
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +8 -4
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +42 -12
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +848 -194
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +230 -193
- 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 -6
- 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.js +141 -23
- package/dist/sources-cypher.js.map +1 -1
- package/dist/sources-ndex.js +2 -2
- package/dist/sources-rest.js +32 -6
- package/dist/sources-rest.js.map +1 -1
- package/dist/sources-sparql.d.ts +1 -0
- package/dist/sources-sparql.js +439 -0
- package/dist/sources-sparql.js.map +1 -0
- 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 +117 -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/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +34 -2
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +6 -1
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +170 -33
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +3 -1
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +2 -1
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/label-places.d.ts +41 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -0
- package/dist/src/formats/dot/label-places.js +185 -0
- package/dist/src/formats/dot/label-places.js.map +1 -0
- package/dist/src/formats/dot/names.d.ts +13 -0
- package/dist/src/formats/dot/names.d.ts.map +1 -1
- package/dist/src/formats/dot/names.js +13 -0
- package/dist/src/formats/dot/names.js.map +1 -1
- 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 +72 -2
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +1500 -119
- 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 +58 -31
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +848 -225
- 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 +754 -102
- 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 +6 -10
- 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 +695 -164
- 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 +431 -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 +1843 -136
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +104 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -0
- package/dist/src/formats/pajek/draw.js +382 -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 +1395 -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 +277 -60
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -5
- 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/sources/builtins.d.ts +1 -1
- package/dist/src/sources/builtins.d.ts.map +1 -1
- package/dist/src/sources/builtins.js +8 -2
- package/dist/src/sources/builtins.js.map +1 -1
- package/dist/src/sources/context.d.ts.map +1 -1
- package/dist/src/sources/context.js +1 -0
- package/dist/src/sources/context.js.map +1 -1
- package/dist/src/sources/credentials.d.ts +50 -1
- package/dist/src/sources/credentials.d.ts.map +1 -1
- package/dist/src/sources/credentials.js +69 -0
- package/dist/src/sources/credentials.js.map +1 -1
- package/dist/src/sources/cypher/descriptor.d.ts.map +1 -1
- package/dist/src/sources/cypher/descriptor.js +5 -0
- package/dist/src/sources/cypher/descriptor.js.map +1 -1
- package/dist/src/sources/cypher/index.d.ts.map +1 -1
- package/dist/src/sources/cypher/index.js +125 -18
- package/dist/src/sources/cypher/index.js.map +1 -1
- package/dist/src/sources/cypher/params.d.ts +1 -1
- package/dist/src/sources/cypher/params.d.ts.map +1 -1
- package/dist/src/sources/cypher/query-builder.d.ts +17 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -1
- package/dist/src/sources/cypher/query-builder.js +31 -0
- package/dist/src/sources/cypher/query-builder.js.map +1 -1
- package/dist/src/sources/ids.d.ts +5 -0
- package/dist/src/sources/ids.d.ts.map +1 -1
- package/dist/src/sources/ids.js +5 -0
- package/dist/src/sources/ids.js.map +1 -1
- package/dist/src/sources/params.d.ts +3 -0
- package/dist/src/sources/params.d.ts.map +1 -1
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -1
- package/dist/src/sources/rest/descriptor.js +9 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -1
- package/dist/src/sources/rest/openalex.d.ts +4 -2
- package/dist/src/sources/rest/openalex.d.ts.map +1 -1
- package/dist/src/sources/rest/openalex.js +4 -2
- package/dist/src/sources/rest/openalex.js.map +1 -1
- package/dist/src/sources/rest/source.d.ts.map +1 -1
- package/dist/src/sources/rest/source.js +38 -0
- package/dist/src/sources/rest/source.js.map +1 -1
- package/dist/src/sources/run.d.ts +2 -0
- package/dist/src/sources/run.d.ts.map +1 -1
- package/dist/src/sources/run.js +30 -3
- package/dist/src/sources/run.js.map +1 -1
- package/dist/src/sources/sigv4.d.ts +5 -3
- package/dist/src/sources/sigv4.d.ts.map +1 -1
- package/dist/src/sources/sigv4.js +6 -4
- package/dist/src/sources/sigv4.js.map +1 -1
- 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 +327 -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 +73 -0
- package/dist/src/sources/sparql/query.d.ts.map +1 -0
- package/dist/src/sources/sparql/query.js +164 -0
- package/dist/src/sources/sparql/query.js.map +1 -0
- package/dist/src/sources/types.d.ts +60 -0
- package/dist/src/sources/types.d.ts.map +1 -1
- 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 +89 -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 +1139 -79
- 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 +4 -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 +232 -10
- 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 +44 -1
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +475 -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 +156 -48
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +91 -3
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +387 -77
- 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 +42 -2
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +623 -17
- package/dist/src/styles/cytoscape/resolve.js.map +1 -1
- package/dist/src/styles/defaults.d.ts +46 -26
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +308 -71
- 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/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 +6 -1
- 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 +11 -0
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +40 -4
- 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 +687 -6
- 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 +224 -0
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/styles.js +30 -239
- package/dist/styles.js.map +1 -1
- package/dist/xgmml.js +3 -3
- package/package.json +27 -7
- package/src/formats/cx/importer.ts +6 -1
- package/src/formats/cx/styles.ts +143 -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/exporter.ts +37 -1
- package/src/formats/dot/importer.ts +192 -36
- package/src/formats/dot/index.ts +3 -1
- package/src/formats/dot/label-places.ts +241 -0
- package/src/formats/dot/names.ts +15 -0
- package/src/formats/dot/record.ts +336 -0
- package/src/formats/dot/styles.ts +1702 -149
- 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 +1099 -245
- 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 +852 -110
- package/src/formats/graphml/styles-plain.ts +6 -15
- package/src/formats/graphml/styles-yed.ts +765 -176
- package/src/formats/graphml/styles-yfiles3.ts +487 -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 +2123 -171
- package/src/formats/pajek/draw.ts +469 -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 +1506 -133
- package/src/formats/pajek/syntax.ts +27 -2
- package/src/formats/xgmml/emit.ts +73 -5
- package/src/formats/xgmml/styles.ts +330 -71
- package/src/index.ts +12 -1
- 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/sources/builtins.ts +8 -1
- package/src/sources/context.ts +1 -0
- package/src/sources/credentials.ts +90 -1
- package/src/sources/cypher/descriptor.ts +7 -1
- package/src/sources/cypher/index.ts +149 -18
- package/src/sources/cypher/params.ts +1 -1
- package/src/sources/cypher/query-builder.ts +33 -0
- package/src/sources/ids.ts +6 -0
- package/src/sources/params.ts +3 -0
- package/src/sources/rest/descriptor.ts +9 -0
- package/src/sources/rest/openalex.ts +4 -2
- package/src/sources/rest/source.ts +41 -0
- package/src/sources/run.ts +35 -3
- package/src/sources/sigv4.ts +6 -4
- package/src/sources/sparql/descriptor.ts +67 -0
- package/src/sources/sparql/index.ts +371 -0
- package/src/sources/sparql/ntriples.ts +219 -0
- package/src/sources/sparql/params.ts +28 -0
- package/src/sources/sparql/query.ts +216 -0
- package/src/sources/types.ts +68 -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 +107 -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 +1303 -84
- package/src/styles/cyjs/defaults-table.ts +4 -0
- package/src/styles/cyjs/emit.ts +268 -14
- package/src/styles/cyjs/face.ts +372 -0
- package/src/styles/cyjs/mappers.ts +506 -27
- package/src/styles/cyjs/routes.ts +432 -0
- package/src/styles/cytoscape/charts.ts +684 -0
- package/src/styles/cytoscape/emit.ts +170 -48
- package/src/styles/cytoscape/lexicon.ts +431 -78
- package/src/styles/cytoscape/mappings.ts +108 -0
- package/src/styles/cytoscape/resolve.ts +741 -17
- package/src/styles/defaults.ts +417 -108
- package/src/styles/index.ts +5 -0
- package/src/styles/internal.ts +1 -0
- package/src/styles/io/generic.ts +79 -23
- package/src/styles/io/round-trip.ts +202 -0
- package/src/styles/io/writer.ts +6 -1
- 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 +47 -4
- package/src/styles/slots.ts +25 -0
- package/src/styles/types.ts +698 -5
- package/src/styles/vocabulary.ts +232 -2
- package/dist/chunks/block-Cu22ewuS.js.map +0 -1
- package/dist/chunks/choose-Cdx6Enl2.js +0 -57
- package/dist/chunks/choose-Cdx6Enl2.js.map +0 -1
- package/dist/chunks/codes-CV_Bhcyi.js.map +0 -1
- package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
- package/dist/chunks/credentials-BiQsnMTb.js.map +0 -1
- package/dist/chunks/descriptor-BJ-W0Jd-.js.map +0 -1
- package/dist/chunks/emit-CD8xnY8s.js.map +0 -1
- package/dist/chunks/export-CZ7VRm4I.js.map +0 -1
- package/dist/chunks/exporter-bxxjOrDZ.js.map +0 -1
- package/dist/chunks/format-BMS-1Nxb.js +0 -64
- package/dist/chunks/format-BMS-1Nxb.js.map +0 -1
- package/dist/chunks/generic-CP6YD34u.js.map +0 -1
- package/dist/chunks/importer-B87_fmVx.js.map +0 -1
- package/dist/chunks/importer-CB_zV5_L.js.map +0 -1
- package/dist/chunks/importer-CVT-JyDE.js.map +0 -1
- package/dist/chunks/importer-Cyy6UseH.js.map +0 -1
- package/dist/chunks/importer-DPZDN40-.js.map +0 -1
- package/dist/chunks/importer-e3huMZbm.js.map +0 -1
- package/dist/chunks/lexicon-u2SI5xcx.js.map +0 -1
- package/dist/chunks/sigv4-LkAzsLAu.js.map +0 -1
- package/dist/chunks/styles-CaABMoO1.js.map +0 -1
- package/dist/chunks/styles-P_gmFAOi.js +0 -770
- package/dist/chunks/styles-P_gmFAOi.js.map +0 -1
- package/dist/chunks/styles-yed-Cs1nmrjn.js.map +0 -1
- package/dist/chunks/writer-DvHTl36J.js +0 -449
- package/dist/chunks/writer-DvHTl36J.js.map +0 -1
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { GraphBuilder } from "@graphty/graph-format";
|
|
2
|
-
import { b as chooseGraph } from "./export-CZ7VRm4I.js";
|
|
3
|
-
import { K as ImportReportBuilder } from "./report-CgdsL9Hb.js";
|
|
4
|
-
async function importChosenGraph(importer, input, sink, options) {
|
|
5
|
-
const importAll = importer.importAll?.bind(importer);
|
|
6
|
-
if (importAll === void 0) {
|
|
7
|
-
return importer.import(input, sink, options);
|
|
8
|
-
}
|
|
9
|
-
const replay = await replayable(input);
|
|
10
|
-
const scratch = [];
|
|
11
|
-
await importAll(replay, (i) => scratch[i] = new GraphBuilder({ directed: false }), {
|
|
12
|
-
...options,
|
|
13
|
-
onProgress: void 0
|
|
14
|
-
});
|
|
15
|
-
const names = scratch.map((b) => {
|
|
16
|
-
try {
|
|
17
|
-
return b.freeze().meta.name;
|
|
18
|
-
} catch {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const chosen = chooseGraph(names, options, new ImportReportBuilder(importer.format, 0));
|
|
23
|
-
const reports = await importAll(
|
|
24
|
-
replay,
|
|
25
|
-
(i) => i === chosen ? sink : new GraphBuilder({ directed: false }),
|
|
26
|
-
options
|
|
27
|
-
);
|
|
28
|
-
return reports[chosen];
|
|
29
|
-
}
|
|
30
|
-
async function replayable(input) {
|
|
31
|
-
if (typeof input === "string" || input instanceof Uint8Array) {
|
|
32
|
-
return input;
|
|
33
|
-
}
|
|
34
|
-
const parts = [];
|
|
35
|
-
const encoder = new TextEncoder();
|
|
36
|
-
if (typeof input.getReader === "function") {
|
|
37
|
-
const reader = input.getReader();
|
|
38
|
-
for (let r = await reader.read(); !r.done; r = await reader.read()) {
|
|
39
|
-
parts.push(r.value);
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
for await (const chunk of input) {
|
|
43
|
-
parts.push(typeof chunk === "string" ? encoder.encode(chunk) : chunk);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const out = new Uint8Array(parts.reduce((n, p) => n + p.byteLength, 0));
|
|
47
|
-
let offset = 0;
|
|
48
|
-
for (const part of parts) {
|
|
49
|
-
out.set(part, offset);
|
|
50
|
-
offset += part.byteLength;
|
|
51
|
-
}
|
|
52
|
-
return out;
|
|
53
|
-
}
|
|
54
|
-
export {
|
|
55
|
-
importChosenGraph as i
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=choose-Cdx6Enl2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"choose-Cdx6Enl2.js","sources":["../../src/common/choose.ts"],"sourcesContent":["/**\n * The graph choice of an importer that can read every graph of a file (importAll) but has no cheap\n * listing: `graphIndex` / `graphName` passed to its import() directly, as the registry would honor\n * them, so a caller with its own builder is not silently given the first graph.\n */\n\nimport { GraphBuilder, type GraphSink } from \"@graphty/graph-format\";\n\nimport {\n type CommonImportOptions,\n type GraphChoiceOptions,\n type GraphImporter,\n type ImportInput,\n type ImportReport,\n} from \"../types.js\";\nimport { chooseGraph } from \"./options.js\";\nimport { ImportReportBuilder } from \"./report.js\";\n\n/**\n * Read the graph `graphIndex` or `graphName` chooses into the sink: every graph is read once into a\n * scratch builder to learn the names (E_GRAPH_NOT_FOUND lists them), then the input again with the\n * chosen graph going to the sink.\n * @param importer - the importer, which has importAll()\n * @param input - the input\n * @param sink - the caller's sink\n * @param options - the import options, with the choice\n * @returns the chosen graph's report\n */\nexport async function importChosenGraph<O>(\n importer: GraphImporter<O>,\n input: ImportInput,\n sink: GraphSink,\n options: (O & CommonImportOptions & GraphChoiceOptions) | undefined,\n): Promise<ImportReport> {\n const importAll = importer.importAll?.bind(importer);\n if (importAll === undefined) {\n return importer.import(input, sink, options);\n }\n const replay = await replayable(input);\n const scratch: GraphBuilder[] = [];\n await importAll(replay, (i) => (scratch[i] = new GraphBuilder({ directed: false })), {\n ...options,\n onProgress: undefined,\n } as O & CommonImportOptions);\n const names = scratch.map((b) => {\n try {\n return b.freeze().meta.name;\n } catch {\n return null;\n }\n });\n const chosen = chooseGraph(names, options, new ImportReportBuilder(importer.format, 0));\n const reports = await importAll(\n replay,\n (i) => (i === chosen ? sink : new GraphBuilder({ directed: false })),\n options,\n );\n return reports[chosen];\n}\n\n/**\n * The input as a string or bytes that can be read twice.\n * @param input - the input\n * @returns the same text or bytes, or the stream's bytes\n */\nasync function replayable(input: ImportInput): Promise<string | Uint8Array> {\n if (typeof input === \"string\" || input instanceof Uint8Array) {\n return input;\n }\n const parts: Uint8Array[] = [];\n const encoder = new TextEncoder();\n if (typeof (input as ReadableStream<Uint8Array>).getReader === \"function\") {\n const reader = (input as ReadableStream<Uint8Array>).getReader();\n for (let r = await reader.read(); !r.done; r = await reader.read()) {\n parts.push(r.value);\n }\n } else {\n for await (const chunk of input as AsyncIterable<string | Uint8Array>) {\n parts.push(typeof chunk === \"string\" ? encoder.encode(chunk) : chunk);\n }\n }\n const out = new Uint8Array(parts.reduce((n, p) => n + p.byteLength, 0));\n let offset = 0;\n for (const part of parts) {\n out.set(part, offset);\n offset += part.byteLength;\n }\n return out;\n}\n"],"names":[],"mappings":";;;AA4BA,eAAsB,kBAClB,UACA,OACA,MACA,SACqB;AACrB,QAAM,YAAY,SAAS,WAAW,KAAK,QAAQ;AACnD,MAAI,cAAc,QAAW;AACzB,WAA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I,SAAS;AACb,aAAW,QAAQ,OAAO;AACtB,QAAI,IAAI,MAAM,MAAM;AACpB,cAAU,KAAK;AAAA,EACnB;AACA,SAAO;AACX;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codes-CV_Bhcyi.js","sources":["../../src/sources/cypher/descriptor.ts","../../src/sources/codes.ts"],"sourcesContent":["/**\n * The descriptors of the Cypher source and its presets: catalog data, available without loading\n * the sources' code.\n */\n\nimport { type SourceDescriptor, type SourceParamDescriptor } from \"../types.js\";\n\n/** The parameters every Cypher source shares. */\nconst CYPHER_PARAMS: readonly SourceParamDescriptor[] = [\n { name: \"query\", plainName: \"Query\", type: \"query\", language: \"cypher\" },\n {\n name: \"mode\",\n plainName: \"Mode\",\n type: \"enum\",\n values: [\n { value: \"query\", label: \"Query\" },\n { value: \"all\", label: \"Everything\" },\n { value: \"neighborhood\", label: \"Neighborhood\" },\n ],\n },\n { name: \"ids\", plainName: \"Seed ids\", type: \"node-id\" },\n { name: \"depth\", plainName: \"Depth\", type: \"integer\", default: 1, min: 1, max: 10 },\n { name: \"labels\", plainName: \"Labels\", type: \"string\", role: \"filter\", advanced: true },\n { name: \"relationshipTypes\", plainName: \"Relationship types\", type: \"string\", role: \"filter\", advanced: true },\n { name: \"idProperty\", plainName: \"Id property\", type: \"string\", advanced: true },\n { name: \"database\", plainName: \"Database\", type: \"string\" },\n {\n name: \"long\",\n plainName: \"Large integers\",\n type: \"enum\",\n advanced: true,\n values: [\n { value: \"f64\", label: \"Number\" },\n { value: \"string\", label: \"Text\" },\n ],\n },\n { name: \"countFirst\", plainName: \"Count first\", type: \"boolean\", advanced: true },\n { name: \"pageSize\", plainName: \"Page size\", type: \"integer\", default: 1000, min: 1, max: 100000, advanced: true },\n];\n\n/** The transport parameter of the generic source. */\nconst TRANSPORT_PARAM: SourceParamDescriptor = {\n name: \"transport\",\n plainName: \"Transport\",\n type: \"enum\",\n values: [\n { value: \"query-api\", label: \"Neo4j Query API\" },\n { value: \"bolt\", label: \"Bolt\" },\n { value: \"neptune-https\", label: \"Neptune Database\" },\n { value: \"neptune-analytics\", label: \"Neptune Analytics\" },\n ],\n};\n\n/**\n * The descriptor of the generic `cypher` source. Experimental.\n * @category Network sources\n */\nexport const CYPHER_DESCRIPTOR: SourceDescriptor = Object.freeze({\n plainName: \"Cypher database\",\n kind: \"database\",\n version: 1,\n auth: [\"basic\", \"bearer\", \"aws-sigv4\"],\n authRequired: \"optional\",\n params: [...CYPHER_PARAMS, TRANSPORT_PARAM],\n});\n\n/**\n * The descriptor of the `neo4j` preset. Experimental.\n * @category Network sources\n */\nexport const NEO4J_DESCRIPTOR: SourceDescriptor = Object.freeze({\n plainName: \"Neo4j\",\n kind: \"database\",\n version: 1,\n auth: [\"basic\", \"bearer\"],\n authRequired: \"optional\",\n params: [\n ...CYPHER_PARAMS,\n {\n // no default: a bolt: or bolt+s: endpoint picks Bolt, any other the Query API\n ...TRANSPORT_PARAM,\n values: TRANSPORT_PARAM.values?.filter((v) => v.value === \"query-api\" || v.value === \"bolt\"),\n },\n ],\n samples: [\n {\n id: \"neo4j-movies\",\n plainName: \"Neo4j demo: movies\",\n endpoint: \"https://demo.neo4jlabs.com:7473\",\n params: { database: \"movies\", mode: \"all\" },\n publicLogin: { username: \"movies\", password: \"movies\" }, // NOSONAR(S2068): the public login Neo4j publishes for its demo server\n counts: { nodes: 171, edges: 253 },\n },\n {\n id: \"hetionet\",\n plainName: \"Hetionet\",\n endpoint: \"bolt+s://neo4j.het.io:7687\",\n params: { transport: \"bolt\", mode: \"neighborhood\", idProperty: \"name\", ids: [\"Metformin\"], depth: 1 },\n counts: { nodes: 47031, edges: 2250197 },\n whole: false,\n },\n ],\n});\n\n/**\n * The descriptor of the `neptune` preset. Experimental.\n * @category Network sources\n */\nexport const NEPTUNE_DESCRIPTOR: SourceDescriptor = Object.freeze({\n plainName: \"Amazon Neptune\",\n kind: \"database\",\n version: 1,\n auth: [\"aws-sigv4\"],\n authRequired: \"optional\",\n params: [\n ...CYPHER_PARAMS,\n {\n // no default: a neptune-graph host picks Neptune Analytics, any other Neptune Database\n ...TRANSPORT_PARAM,\n values: TRANSPORT_PARAM.values?.filter((v) => v.value.startsWith(\"neptune\")),\n },\n ],\n // Neptune sends no CORS headers (Database), or is not shown to (Analytics)\n runtimes: { browser: { supported: false, reason: \"cors\" }, worker: { supported: false, reason: \"cors\" } },\n});\n","/**\n * The issue codes of network sources (design section 8). Every failure a source or the framework\n * raises is an ImportIssue with one of these codes and machine-readable `params`; graph-io writes\n * no reader-facing sentence. The English `message` is for logs.\n *\n * Experimental, with the source contract.\n */\n\nimport { FETCH_CODE } from \"../common/codes.js\";\n\n/**\n * Every issue code a network source can report, keyed by itself, so `SOURCE_ISSUE.E_SOURCE_AUTH`\n * autocompletes and `keyof typeof SOURCE_ISSUE` is the code union. Experimental.\n * @category Network sources\n */\nexport const SOURCE_ISSUE = Object.freeze({\n /** Another HTTP status, or an unreachable host (Node). Params: `url`, `status`. */\n E_FETCH: FETCH_CODE,\n /** The browser refused the request and hid why. Params: `url`, `cause`. */\n E_SOURCE_BLOCKED: \"E_SOURCE_BLOCKED\",\n /** 401 or a database login failure. Params: `origin`, `status`, `scheme`, `serverCode`. */\n E_SOURCE_AUTH: \"E_SOURCE_AUTH\",\n /** 403 or a database authorization failure. Params: `status`, `serverCode`. */\n E_SOURCE_FORBIDDEN: \"E_SOURCE_FORBIDDEN\",\n /** The named item does not exist. Params: `what`, `value`. */\n E_SOURCE_NOT_FOUND: \"E_SOURCE_NOT_FOUND\",\n /** 429 after the retries. Params: `retryAfterMs`. */\n E_SOURCE_QUOTA: \"E_SOURCE_QUOTA\",\n /** `timeoutMs` passed, or the server's own timeout. Params: `timeoutMs`, `serverSide`. */\n E_SOURCE_TIMEOUT: \"E_SOURCE_TIMEOUT\",\n /** The server rejected the query. Params: `serverCode`, `line`, `column`, `serverMessage`. */\n E_SOURCE_QUERY: \"E_SOURCE_QUERY\",\n /** The result holds no node, relationship or path. Params: `columns`. */\n E_SOURCE_NOT_A_GRAPH: \"E_SOURCE_NOT_A_GRAPH\",\n /** A response body of the wrong shape. Params: `expected`, `contentType`. */\n E_SOURCE_RESPONSE: \"E_SOURCE_RESPONSE\",\n /** A redirect, or a changed origin, while a credential was attached. Params: `from`, `to`. */\n E_SOURCE_REDIRECT: \"E_SOURCE_REDIRECT\",\n /** The source cannot run in this runtime. Params: `runtime`, `reason`, `package`. */\n E_SOURCE_RUNTIME: \"E_SOURCE_RUNTIME\",\n /** A parameter or option is invalid. Params: `name`, `reason`. */\n E_SOURCE_PARAM: \"E_SOURCE_PARAM\",\n /** A cap was reached under `onLimit: \"error\"`. Params: `limit`, `value`. */\n E_SOURCE_LIMIT: \"E_SOURCE_LIMIT\",\n /** No source has that id. Params: `id`, `known`. */\n E_SOURCE_UNKNOWN: \"E_SOURCE_UNKNOWN\",\n /** The source lacks the feature. Params: `feature`, `needs`. */\n E_SOURCE_UNSUPPORTED: \"E_SOURCE_UNSUPPORTED\",\n /** A malformed source at registration. Params: `id`, `reason`. */\n E_SOURCE_INVALID: \"E_SOURCE_INVALID\",\n /** A cap stopped the load; what came first is kept. Params: `limit`, `value`. */\n W_SOURCE_LIMIT: \"W_SOURCE_LIMIT\",\n /** A later page needs a credential; the pages before it are kept. Params: `origin`, `status`. */\n W_SOURCE_AUTH: \"W_SOURCE_AUTH\",\n /** The request succeeded after retries. Params: `attempts`, `statuses`. */\n W_SOURCE_RETRIED: \"W_SOURCE_RETRIED\",\n /** A server value with no dtype. Params: `type`, `column`, `as`. */\n W_SOURCE_VALUE: \"W_SOURCE_VALUE\",\n} as const);\n\n/**\n * A network source issue code. Experimental.\n * @category Network sources\n */\nexport type SourceIssueCode = keyof typeof SOURCE_ISSUE;\n\n/**\n * Why `E_SOURCE_BLOCKED` was raised, as far as a page can tell. Open: handle unknown values.\n * @category Network sources\n */\nexport type SourceBlockedCause = \"cors\" | \"unreachable\" | \"local-network\" | \"unknown\" | (string & {}); // NOSONAR(S4335): open string union, keeps the known names autocompleting\n\n/**\n * The `params` of each source issue code. Every URL is origin and path only. Experimental.\n * @category Network sources\n */\nexport interface SourceIssueParams {\n /** Another status, or an unreachable host. */\n readonly E_FETCH: {\n /** The address, origin and path only. */\n readonly url: string;\n /** The HTTP status, or null when there was none. */\n readonly status: number | null;\n };\n /** Refused by the browser. */\n readonly E_SOURCE_BLOCKED: {\n /** The address, origin and path only. */\n readonly url: string;\n /** Why, as far as the page can tell. */\n readonly cause: SourceBlockedCause;\n };\n /** A credential is needed or was refused. */\n readonly E_SOURCE_AUTH: {\n /** The origin that asked for a credential. */\n readonly origin: string;\n /** The HTTP status, or null when there was none. */\n readonly status: number | null;\n /** The authentication scheme the server named, or null. */\n readonly scheme: string | null;\n /** The service's own code, passed through, or null. */\n readonly serverCode: string | null;\n /** Set by graphty-element when the credential came from its store. */\n readonly stored?: boolean;\n };\n /** Not allowed. */\n readonly E_SOURCE_FORBIDDEN: {\n /** The HTTP status, or null when there was none. */\n readonly status: number | null;\n /** The service's own code, passed through, or null. */\n readonly serverCode: string | null;\n };\n /** No such item. */\n readonly E_SOURCE_NOT_FOUND: {\n /** What was looked up (`url`, `network`, `node`). */\n readonly what: string;\n /** The value that reached the cap, or what was looked up. */\n readonly value: string;\n };\n /** Out of quota. */\n readonly E_SOURCE_QUOTA: {\n /** How long the service asked to wait, when readable. */\n readonly retryAfterMs: number | null;\n };\n /** Took too long. */\n readonly E_SOURCE_TIMEOUT: {\n /** The time limit, or null for the server's own. */\n readonly timeoutMs: number | null;\n /** Whether the server timed the query out. */\n readonly serverSide: boolean;\n };\n /** The query was refused. */\n readonly E_SOURCE_QUERY: {\n /** The service's own code, passed through, or null. */\n readonly serverCode: string | null;\n /** The query line the server named, or null. */\n readonly line: number | null;\n /** The query column the server named, or null. */\n readonly column: number | null;\n /** The server's message from a JSON 4xx body, at most 500 characters, or null. */\n readonly serverMessage: string | null;\n };\n /** Scalars only. */\n readonly E_SOURCE_NOT_A_GRAPH: {\n /** The result's column names. */\n readonly columns: readonly string[];\n };\n /** Wrong body. */\n readonly E_SOURCE_RESPONSE: {\n /** What shape was expected (`json`, `graph-file`, `link-header`). */\n readonly expected: string;\n /** The response's Content-Type, or null. */\n readonly contentType: string | null;\n };\n /** A redirect with a credential; `to` is null in a browser, which hides it. */\n readonly E_SOURCE_REDIRECT: {\n /** Where the request was going, origin and path. */\n readonly from: string;\n /** Where it was sent instead, or null when the browser hides it. */\n readonly to: string | null;\n };\n /** Cannot run here. */\n readonly E_SOURCE_RUNTIME: {\n /** The runtime it ran in. */\n readonly runtime: string;\n /** Why, as a code. */\n readonly reason: string;\n /** The optional package that is missing. */\n readonly package?: string;\n };\n /** A bad parameter or option. */\n readonly E_SOURCE_PARAM: {\n /** The parameter or option's name. */\n readonly name: string;\n /** Why, as a code. */\n readonly reason: string;\n };\n /** A cap under onLimit \"error\". */\n readonly E_SOURCE_LIMIT: {\n /** The cap's option name (`maxNodes`, `maxBytes`, ...). */\n readonly limit: string;\n /** The value that reached the cap, or what was looked up. */\n readonly value: number;\n };\n /** No such source. */\n readonly E_SOURCE_UNKNOWN: {\n /** The source id. */\n readonly id: string;\n /** The ids that are registered. */\n readonly known: readonly string[];\n };\n /** The source lacks the feature. */\n readonly E_SOURCE_UNSUPPORTED: {\n /** The feature asked for. */\n readonly feature: string;\n /** What it needs, when known. */\n readonly needs?: string;\n };\n /** A malformed source. */\n readonly E_SOURCE_INVALID: {\n /** The source id. */\n readonly id: string;\n /** Why, as a code. */\n readonly reason: string;\n };\n /** A cap stopped the load. */\n readonly W_SOURCE_LIMIT: {\n /** The cap's option name (`maxNodes`, `maxBytes`, ...). */\n readonly limit: string;\n /** The value that reached the cap, or what was looked up. */\n readonly value: number;\n };\n /** A later page needs a credential. */\n readonly W_SOURCE_AUTH: {\n /** The origin that asked for a credential. */\n readonly origin: string;\n /** The HTTP status, or null when there was none. */\n readonly status: number | null;\n };\n /** Retried. */\n readonly W_SOURCE_RETRIED: {\n /** How many attempts were made. */\n readonly attempts: number;\n /** The status of each failed attempt, null for a network failure. */\n readonly statuses: readonly (number | null)[];\n };\n /** A value with no dtype. */\n readonly W_SOURCE_VALUE: {\n /** The server's value type. */\n readonly type: string;\n /** The column (of the query, or of the graph) involved. */\n readonly column: string;\n /** What the value was kept as. */\n readonly as: string;\n };\n}\n"],"names":[],"mappings":";AAQA,MAAM,gBAAkD;AAAA,EACpD,EAAE,MAAM,SAAS,WAAW,SAAS,MAAM,SAAS,UAAU,SAAA;AAAA,EAC9D;AAAA,IACI,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,QAAQ;AAAA,MACJ,EAAE,OAAO,SAAS,OAAO,QAAA;AAAA,MACzB,EAAE,OAAO,OAAO,OAAO,aAAA;AAAA,MACvB,EAAE,OAAO,gBAAgB,OAAO,eAAA;AAAA,IAAe;AAAA,EACnD;AAAA,EAEJ,EAAE,MAAM,OAAO,WAAW,YAAY,MAAM,UAAA;AAAA,EAC5C,EAAE,MAAM,SAAS,WAAW,SAAS,MAAM,WAAW,SAAS,GAAG,KAAK,GAAG,KAAK,GAAA;AAAA,EAC/E,EAAE,MAAM,UAAU,WAAW,UAAU,MAAM,UAAU,MAAM,UAAU,UAAU,KAAA;AAAA,EACjF,EAAE,MAAM,qBAAqB,WAAW,sBAAsB,MAAM,UAAU,MAAM,UAAU,UAAU,KAAA;AAAA,EACxG,EAAE,MAAM,cAAc,WAAW,eAAe,MAAM,UAAU,UAAU,KAAA;AAAA,EAC1E,EAAE,MAAM,YAAY,WAAW,YAAY,MAAM,SAAA;AAAA,EACjD;AAAA,IACI,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,MACJ,EAAE,OAAO,OAAO,OAAO,SAAA;AAAA,MACvB,EAAE,OAAO,UAAU,OAAO,OAAA;AAAA,IAAO;AAAA,EACrC;AAAA,EAEJ,EAAE,MAAM,cAAc,WAAW,eAAe,MAAM,WAAW,UAAU,KA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,gBAAgB;AACpB,CAAU;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert-BcQ8_jMo.js","sources":["../../src/positions/convert.ts"],"sourcesContent":["/**\n * The coordinate conversions between a file's spelling and the neutral convention (center, y up):\n * the y flip, the top-left anchor shift, and `toFilePositions()`, the inverse a writer uses. Format\n * modules import from here, so they never pull in the reader.\n */\n\nimport type { PositionColumnExtra } from \"./types.js\";\n\n/**\n * A y that grows downward as one that grows upward, and back: a negation that never yields -0.\n * @param y - the coordinate\n * @returns the flipped coordinate\n * @category Positions\n */\nexport function flipY(y: number): number {\n return y === 0 ? 0 : -y;\n}\n\n/**\n * One coordinate from a file's spelling into the neutral convention, in place.\n * @param p - x, y, z as the file wrote them; becomes the node's center, y up\n * @param extra - how the file spells it\n * @param size - the node's width and height, for a top-left anchor; null when unknown\n * @param realZ - whether the file has a z that differs between nodes\n */\nexport function toNeutral(\n p: [number, number, number],\n extra: PositionColumnExtra,\n size: readonly [number, number] | null,\n realZ: boolean,\n): void {\n if (extra.anchor === \"top-left\" && size !== null) {\n p[0] += size[0] / 2;\n p[1] += extra.yAxis === \"down\" ? size[1] / 2 : -size[1] / 2;\n }\n p[2] = realZ ? p[2] - (extra.zOrigin ?? 0) : 0;\n if (extra.yAxis === \"down\") {\n // with a real z this turns the drawing 180 degrees about x, so a 3D shape is never mirrored\n p[1] = flipY(p[1]);\n p[2] = flipY(p[2]);\n }\n}\n\n/**\n * Neutral coordinates (center, y up, as `extractPositions()` returns them) back into a column\n * spelled as `extra` declares, for a writer: the y flip, Pajek's z origin and yEd's top-left corner\n * are undone. Rows that are NaN stay NaN.\n * @param coords - x, y, z per node\n * @param extra - the spelling of the column to write\n * @param sizes - each node's width and height, needed for a top-left anchor\n * @param sizes.width - widths by node index\n * @param sizes.height - heights by node index\n * @returns a new array, x, y, z per node in the file's spelling\n * @category Positions\n */\nexport function toFilePositions(\n coords: Float64Array,\n extra: PositionColumnExtra,\n sizes?: { width: Float64Array; height: Float64Array },\n): Float64Array {\n const out = new Float64Array(coords.length);\n const down = extra.yAxis === \"down\";\n for (let i = 0; i < coords.length; i += 3) {\n let y = coords[i + 1];\n let z = coords[i + 2];\n if (down) {\n y = flipY(y);\n z = flipY(z);\n }\n out[i] = coords[i];\n out[i + 1] = y;\n out[i + 2] = z === 0 && extra.sourceDims !== 3 ? 0 : z + (extra.zOrigin ?? 0);\n const row = i / 3;\n if (extra.anchor === \"top-left\" && sizes !== undefined) {\n out[i] -= sizes.width[row] / 2;\n out[i + 1] -= down ? sizes.height[row] / 2 : -sizes.height[row] / 2;\n }\n }\n return out;\n}\n\n/**\n * The median of some numbers.\n * @param values - the numbers, reordered in place\n * @returns the median, or null for none\n * @category Positions\n */\nexport function median(values: number[]): number | null {\n if (values.length === 0) {\n return null;\n }\n values.sort((a, b) => a - b);\n const mid = values.length >> 1;\n return values.length % 2 === 1 ? values[mid] : (values[mid - 1] + values[mid]) / 2;\n}\n\n/**\n * How each built-in writer that writes the position column as it stands spells a coordinate:\n * GML (y down, as yEd draws it) and Pajek (y down, z centered on 0.5). Every other built-in writer\n * either converts the neutral form itself (JSON, XGMML, CX, CX2, Cytoscape sessions, yEd graphics\n * in a styled GraphML) or writes a y-up format (GEXF, DOT).\n */\nconst WRITTEN_SPELLING: Readonly<Record<string, PositionColumnExtra>> = {\n gml: { yAxis: \"down\" },\n pajek: { yAxis: \"down\", zOrigin: 0.5 },\n};\n\n/**\n * Neutral coordinates (center, y up) as a built-in format's writer expects its position column, so\n * a graph whose positions are in the neutral form is written the way up its program draws it.\n * @example\n * ```ts\n * const column = writtenPositions(\"gml\", coords); // y flipped for GML\n * ```\n * @param format - the format being written\n * @param coords - x, y, z per node; NaN for a node with no position\n * @returns the coordinates to write (the same array when the format needs no conversion)\n * @category Positions\n */\nexport function writtenPositions(format: string, coords: Float64Array): Float64Array {\n const spelling = WRITTEN_SPELLING[format];\n return spelling === undefined ? coords : toFilePositions(coords, spelling);\n}\n"],"names":[],"mappings":"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AO,QAAiC;AACpD,MAAI,OAAO,WAAW,GAAG;AACrB,WAAO;AAAA,EACX;AACA,SAAO,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAC3B,QAAM,MAAM,OAAO,UAAU;AAC7B,SAAO,OAAO,SAAS,MAAM,IAAI,OAAO,GAAG,KAAK,OAAO,MAAM,CAAC,IAAI,OAAO,GAAG,KAAK;AACrF;AAQA,MAAM,mBAAkE;AAAA,EACpE,KAAK,EAAE,OAAO,OAAA;AAAA,EACd,OAAO,EAAE,OAAO,QAAQ,SAAS,IAAA;AACrC;AAcO,SAAS,iBAAiB,QAAgB,QAAoC;AACjF,QAAM,WAAW,iBAAiB,MAAM;AACxC,SAAO,aAAa,SAAY,SAAS,gBAAgB,QAAQ,QAAQ;AAC7E;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentials-BiQsnMTb.js","sources":["../../src/sources/ids.ts","../../src/sources/fail.ts","../../src/sources/define.ts","../../src/sources/credentials.ts"],"sourcesContent":["/**\n * The public names of network sources: one constant per built-in source id, and the reserved\n * `_source.` attribute names. Nothing else in graph-io spells them, so a rename is one edit here.\n *\n * Experimental: the ids and the `_source.` namespace await the owner's final word (design\n * section 22, items 4 and 5).\n */\n\n/**\n * The NDEx source (www.ndexbio.org). Experimental.\n * @category Network sources\n */\nexport const NDEX_SOURCE_ID = \"ndex\";\n\n/**\n * The generic Cypher source, for any openCypher server. Experimental.\n * @category Network sources\n */\nexport const CYPHER_SOURCE_ID = \"cypher\";\n\n/**\n * The Neo4j preset of the Cypher source. Experimental.\n * @category Network sources\n */\nexport const NEO4J_SOURCE_ID = \"neo4j\";\n\n/**\n * The Amazon Neptune preset of the Cypher source. Experimental.\n * @category Network sources\n */\nexport const NEPTUNE_SOURCE_ID = \"neptune\";\n\n/**\n * The generic REST mapping source. Experimental.\n * @category Network sources\n */\nexport const REST_SOURCE_ID = \"rest\";\n\n/**\n * The OpenAlex preset of the REST mapping source. Experimental.\n * @category Network sources\n */\nexport const OPENALEX_SOURCE_ID = \"openalex\";\n\n/**\n * The prefix of the reserved attribute namespace sources and graphty-element write facts under.\n * @category Network sources\n */\nexport const SOURCE_ATTR_PREFIX = \"_source.\";\n\n/**\n * Node attribute: true on a stub, a node known only by its id until it is hydrated or expanded.\n * @category Network sources\n */\nexport const SOURCE_STUB_ATTR = \"_source.stub\";\n\n/**\n * Node attribute: the entity a stub node is (a REST mapping's entity name).\n * @category Network sources\n */\nexport const SOURCE_ENTITY_ATTR = \"_source.entity\";\n\n/**\n * Node attribute: the node's degree at the source, when the source returns it at no extra cost\n * (the Cypher source's degree hint).\n * @category Network sources\n */\nexport const SOURCE_DEGREE_ATTR = \"_source.degree\";\n\n/**\n * The prefix of `ImportGraphResult.format` for a load from a source: `\"source:<id>\"`.\n * @category Network sources\n */\nexport const SOURCE_FORMAT_PREFIX = \"source:\";\n","/**\n * Raising a network source issue: one place that turns a code and its params into an ImportError\n * whose `issue.params` and `details` both carry the params, so callers branch on\n * `err.issue.code` and read `err.issue.params` as with every other graph-io failure.\n */\n\nimport { ImportReportBuilder } from \"../common/report.js\";\nimport { type IssueCategory } from \"../types.js\";\nimport { type SourceIssueCode } from \"./codes.js\";\n\n/** The category each code is filed under. */\nconst CATEGORY: Readonly<Partial<Record<SourceIssueCode, IssueCategory>>> = {\n E_SOURCE_PARAM: \"validation-error\",\n E_SOURCE_INVALID: \"validation-error\",\n E_SOURCE_RESPONSE: \"parse-error\",\n E_SOURCE_NOT_A_GRAPH: \"parse-error\",\n E_SOURCE_NOT_FOUND: \"missing-value\",\n E_SOURCE_UNKNOWN: \"missing-value\",\n};\n\n/**\n * Abort a load with a source error, carrying the load's report so far plus the error.\n * @param report - the load's report\n * @param code - the code\n * @param message - a plain-ASCII message, for logs\n * @param params - the issue's values\n * @returns never; it throws the ImportError\n */\nexport function failOn(\n report: ImportReportBuilder,\n code: SourceIssueCode,\n message: string,\n params: Readonly<Record<string, unknown>>,\n): never {\n // a fork, so a failure the runner turns into a warning (a later page's 401, a cap) leaves no\n // error in the load's own report; the ImportError carries everything recorded so far\n return report.fork().failWith(CATEGORY[code] ?? \"unsupported\", code, message, undefined, params, params);\n}\n\n/**\n * Raise a source error outside a load (registration, a credential factory).\n * @param code - the code\n * @param message - a plain-ASCII message, for logs\n * @param params - the issue's values\n * @param format - the report's format name\n */\nexport function failAlone(\n code: SourceIssueCode,\n message: string,\n params: Readonly<Record<string, unknown>>,\n format = \"source\",\n): never {\n failOn(new ImportReportBuilder(format, 0), code, message, params);\n}\n\n/**\n * Record a source warning on a report.\n * @param report - the report\n * @param code - the code\n * @param message - a plain-ASCII message, for logs\n * @param params - the issue's values\n */\nexport function warnOn(\n report: ImportReportBuilder,\n code: SourceIssueCode,\n message: string,\n params: Readonly<Record<string, unknown>>,\n): void {\n report.warning(\"unsupported\", code, message, undefined, params);\n}\n","/**\n * `defineSource` and the registration checks (design section 2): the id form, exactly one read\n * method, and the declared features against the methods present. Also the parameter checks every\n * load runs against the descriptor before any request.\n */\n\nimport { type ImportReportBuilder } from \"../common/report.js\";\nimport { failAlone, failOn } from \"./fail.js\";\nimport {\n type GraphSource,\n type LazySource,\n type SourceDescriptor,\n type SourceFeature,\n type SourceParamDescriptor,\n} from \"./types.js\";\n\n/** Lowercase letters, digits and single dashes between them. */\nconst ID_FORM = /^[a-z0-9]+(-[a-z0-9]+)*$/;\n\n/** The optional methods and the feature each one is. */\nconst FEATURE_METHODS: readonly (readonly [SourceFeature, \"expand\" | \"probe\" | \"list\" | \"validate\"])[] = [\n [\"expand\", \"expand\"],\n [\"probe\", \"probe\"],\n [\"list\", \"list\"],\n [\"validate\", \"validate\"],\n];\n\n/**\n * Refuse a malformed source.\n * @param id - the source id\n * @param reason - why\n * @param message - for logs\n */\nfunction invalid(id: string, reason: string, message: string): never {\n failAlone(\"E_SOURCE_INVALID\", message, { id, reason });\n}\n\n/**\n * Check a source id.\n * @param id - the id\n */\nfunction checkSourceId(id: unknown): asserts id is string {\n if (typeof id !== \"string\" || !ID_FORM.test(id)) {\n invalid(String(id), \"id\", `source id ${JSON.stringify(id)} must be lowercase letters, digits and dashes`);\n }\n}\n\n/**\n * The features a loaded source has, from its methods.\n * @param source - the source\n * @returns the features\n */\nfunction featuresOf(source: GraphSource<never>): readonly SourceFeature[] {\n return FEATURE_METHODS.filter(([, method]) => typeof source[method] === \"function\").map(([f]) => f);\n}\n\n/**\n * Check a loaded source: its id, exactly one read method, and its declared features.\n * @param source - the source\n * @param declared - features a lazy registration declared, if any\n */\nexport function checkSource(source: GraphSource<never>, declared?: SourceDescriptor): void {\n checkSourceId((source as { id?: unknown }).id);\n const reads = ([\"records\", \"file\", \"import\"] as const).filter((m) => typeof source[m] === \"function\");\n if (reads.length !== 1) {\n invalid(source.id, \"read-methods\", `source ${source.id} must have exactly one of records, file and import`);\n }\n const features = (declared ?? source.descriptor)?.features;\n if (features !== undefined) {\n const has = new Set(featuresOf(source));\n for (const f of features) {\n if (f !== \"page\" && !has.has(f)) {\n invalid(source.id, \"features\", `source ${source.id} declares ${f} but has no ${f} method`);\n }\n }\n }\n}\n\n/**\n * Check a lazy registration before its code is loaded.\n * @param source - the lazy source\n */\nexport function checkLazySource(source: LazySource): void {\n checkSourceId(source.id);\n if (typeof source.load !== \"function\" || typeof source.descriptor !== \"object\") {\n invalid(source.id, \"lazy\", `lazy source ${source.id} needs a descriptor and a load function`);\n }\n}\n\n/**\n * Define a network source: returns it unchanged, with its parameter type inferred, after the\n * registration checks (an id of lowercase letters, digits and dashes; exactly one of `records`,\n * `file` and `import`; declared features backed by methods). A malformed source throws an\n * ImportError whose `issue.code` is E_SOURCE_INVALID. Experimental.\n * @param source - the source\n * @returns the same source\n * @example\n * ```ts\n * const people = defineSource({\n * id: \"people\",\n * async records(params: { team: string }, ctx) {\n * const rows = await ctx.fetchJson<{ id: string; name: string }[]>(`/api/people?team=${params.team}`);\n * return { nodes: rows };\n * },\n * });\n * ```\n * @category Network sources\n */\nexport function defineSource<P>(source: GraphSource<P>): GraphSource<P> {\n checkSource(source);\n return source;\n}\n\n/**\n * Why a number or integer param is wrong, if it is.\n * @param p - the param's descriptor\n * @param value - the value given\n * @returns the reason, or null when it is fine\n */\nfunction numberProblem(p: SourceParamDescriptor, value: unknown): string | null {\n if (typeof value !== \"number\" || Number.isNaN(value) || (p.type === \"integer\" && !Number.isInteger(value))) {\n return \"type\";\n }\n if ((p.min !== undefined && value < p.min) || (p.max !== undefined && value > p.max)) {\n return \"range\";\n }\n return null;\n}\n\n/**\n * Why a URL param is wrong, if it is.\n * @param value - the value given\n * @returns the reason, or null when it is fine\n */\nfunction urlProblem(value: unknown): string | null {\n let url: URL;\n try {\n url = new URL(typeof value === \"string\" ? value : \"\");\n } catch {\n return \"type\";\n }\n return url.username !== \"\" || url.password !== \"\" ? \"credentials-in-url\" : null;\n}\n\n/**\n * Why a present param value is wrong for its descriptor, if it is.\n * @param p - the param's descriptor\n * @param value - the value given (not undefined or null)\n * @returns the reason, or null when it is fine\n */\nfunction paramProblem(p: SourceParamDescriptor, value: unknown): string | null {\n switch (p.type) {\n case \"integer\":\n case \"number\":\n return numberProblem(p, value);\n case \"boolean\":\n return typeof value === \"boolean\" ? null : \"type\";\n case \"enum\":\n return p.values !== undefined && !p.values.some((v) => v.value === value) ? \"enum\" : null;\n case \"url\":\n return urlProblem(value);\n default:\n return null;\n }\n}\n\n/**\n * Check params against a descriptor before any request: required ones present, numbers and\n * integers in range, booleans, enums, URLs (never with a user name or password in them).\n * @param params - the caller's params\n * @param descriptor - the source's descriptor\n * @param report - the load's report\n */\nexport function checkParams(\n params: Readonly<Record<string, unknown>>,\n descriptor: SourceDescriptor | undefined,\n report: ImportReportBuilder,\n): void {\n if (typeof params !== \"object\" || (params as unknown) === null) {\n failOn(report, \"E_SOURCE_PARAM\", \"params must be an object\", { name: \"params\", reason: \"type\" });\n }\n for (const p of descriptor?.params ?? []) {\n const value = params[p.name];\n const missing = value === undefined || value === null;\n let reason: string | null = null;\n if (!missing) {\n reason = paramProblem(p, value);\n } else if (p.required === true && p.default === undefined) {\n reason = \"required\";\n }\n if (reason !== null) {\n failOn(report, \"E_SOURCE_PARAM\", `parameter ${p.name}: ${reason}`, { name: p.name, reason });\n }\n }\n}\n","/**\n * Credentials (design section 6): objects made by factories, holding their secret where no code\n * can read it back. graph-io applies a credential inside `ctx.fetch`, only to the origins it is\n * bound to, and keeps nothing after a load settles.\n *\n * Experimental, with the source contract.\n */\n\nimport { failAlone } from \"./fail.js\";\nimport { type AwsCredentials, type Credential, type CredentialKind } from \"./types.js\";\n\n/**\n * Where a credential may go: the load's endpoint origin by default. Experimental.\n * @category Network sources\n */\nexport interface CredentialBind {\n /** The origins (scheme, host and port) it may be sent to. */\n readonly origins?: readonly string[] | undefined;\n}\n\n/**\n * The options of `credentials.awsSigV4`. Experimental.\n * @category Network sources\n */\nexport interface AwsSigV4Options {\n /** The AWS region (\"us-east-1\"). */\n readonly region: string;\n /** The signing service: \"neptune-db\" (default) or \"neptune-graph\" for Neptune Analytics. */\n readonly service?: string | undefined;\n /** The credentials, or a function returning fresh ones per request. */\n readonly credentials: AwsCredentials | (() => Promise<AwsCredentials>);\n}\n\n/** What only graph-io's own code can read about a credential. */\ntype Secret =\n | { readonly kind: \"bearer\"; readonly token: string | (() => Promise<string>) }\n | { readonly kind: \"basic\"; readonly username: string; readonly password: string }\n | {\n readonly kind: \"api-key\";\n readonly header: string | null;\n readonly query: string | null;\n readonly value: string;\n }\n | { readonly kind: \"aws-sigv4\"; readonly options: AwsSigV4Options }\n | {\n readonly kind: \"custom\";\n readonly name: string;\n readonly apply: (request: Request) => Promise<Request> | Request;\n };\n\n/** The secrets, by credential; a WeakMap so nothing reachable from the object holds them. */\nconst SECRETS = new WeakMap<Credential, Secret>();\n\n/** The key Node's util.inspect looks up. */\nconst INSPECT = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * The scheme, host and port of a URL. `URL.origin` is \"null\" for schemes such as bolt+s:, so this\n * is used everywhere instead.\n * @param url - the URL\n * @returns the origin string\n */\nexport function originOf(url: URL): string {\n return `${url.protocol}//${url.host}`;\n}\n\n/**\n * Normalize the origins a credential is bound to.\n * @param bind - the bind option\n * @returns the normalized origins\n */\nfunction bindOrigins(bind: CredentialBind | undefined): readonly string[] {\n return Object.freeze(\n (bind?.origins ?? []).map((o) => {\n let url: URL;\n try {\n url = new URL(o);\n } catch {\n return failAlone(\"E_SOURCE_PARAM\", `credential origin ${JSON.stringify(o)} is not a URL`, {\n name: \"origins\",\n reason: \"origin\",\n });\n }\n return originOf(url);\n }),\n );\n}\n\n/** The object every factory returns: kind and origins visible, the secret in SECRETS. */\nclass SourceCredential implements Credential {\n readonly kind: CredentialKind;\n readonly origins: readonly string[];\n readonly username: string | undefined;\n\n /**\n * Create one; only the factories do.\n * @param secret - the secret\n * @param bind - the origins it is bound to\n */\n constructor(secret: Secret, bind: CredentialBind | undefined) {\n this.kind = secret.kind === \"custom\" ? secret.name : secret.kind;\n this.origins = bindOrigins(bind);\n this.username = secret.kind === \"basic\" ? secret.username : undefined;\n SECRETS.set(this, secret);\n Object.freeze(this);\n }\n\n /**\n * What JSON.stringify writes: never the secret.\n * @returns kind, origins and a basic credential's user name\n */\n toJSON(): Record<string, unknown> {\n return this.username === undefined\n ? { kind: this.kind, origins: this.origins }\n : { kind: this.kind, origins: this.origins, username: this.username };\n }\n\n /**\n * What util.inspect and console.log show in Node: never the secret.\n * @returns the same as toJSON\n */\n [INSPECT](): Record<string, unknown> {\n return this.toJSON();\n }\n\n /**\n * What string conversion shows: never the secret.\n * @returns a description\n */\n toString(): string {\n return `[Credential ${this.kind}]`;\n }\n}\n\n/**\n * Base64 of a string's UTF-8 bytes.\n * @param text - the text\n * @returns base64\n */\nfunction base64(text: string): string {\n let binary = \"\";\n for (const b of new TextEncoder().encode(text)) {\n binary += String.fromCodePoint(b);\n }\n return btoa(binary);\n}\n\n/**\n * The factories that make credentials. Pass the result as the `credential` option of a load; it is\n * sent only to the load's endpoint origin, or to `bind.origins` when you give them. Experimental.\n * @example\n * ```ts\n * await loadFromSource(\"people\", { team: \"core\" }, {\n * endpoint: \"https://example.com\",\n * credential: credentials.bearer(token),\n * });\n * ```\n * @category Network sources\n */\nexport const credentials = Object.freeze({\n /**\n * An `Authorization: Bearer` token, or a function returning a fresh one per request.\n * @param token - the token or a function returning it\n * @param bind - the origins it may be sent to\n * @returns the credential\n */\n bearer(token: string | (() => Promise<string>), bind?: CredentialBind): Credential {\n return new SourceCredential({ kind: \"bearer\", token }, bind);\n },\n /**\n * HTTP basic authentication (a database user and password).\n * @param username - the user name\n * @param password - the password\n * @param bind - the origins it may be sent to\n * @returns the credential\n */\n basic(username: string, password: string, bind?: CredentialBind): Credential {\n return new SourceCredential({ kind: \"basic\", username, password }, bind);\n },\n /**\n * An API key sent in a request header or a query parameter.\n * @param where - `{ header: \"X-Api-Key\" }` or `{ query: \"api_key\" }`\n * @param value - the key\n * @param bind - the origins it may be sent to\n * @returns the credential\n */\n apiKey(\n where: { readonly header: string } | { readonly query: string },\n value: string,\n bind?: CredentialBind,\n ): Credential {\n const header = \"header\" in where ? where.header : null;\n const query = \"query\" in where ? where.query : null;\n return new SourceCredential({ kind: \"api-key\", header, query, value }, bind);\n },\n /**\n * AWS Signature Version 4 (Amazon Neptune). The signer loads on first use.\n * @param options - region, service and the credentials or a provider of them\n * @param bind - the origins it may be sent to\n * @returns the credential\n */\n awsSigV4(options: AwsSigV4Options, bind?: CredentialBind): Credential {\n return new SourceCredential({ kind: \"aws-sigv4\", options }, bind);\n },\n /**\n * Anything else: a function that returns the request with its authentication added. The\n * request's origin must not change.\n * @param apply - adds the authentication\n * @param kind - what to call it in `credential.kind`\n * @param bind - the origins it may be sent to\n * @returns the credential\n */\n custom(apply: (request: Request) => Promise<Request> | Request, kind: string, bind?: CredentialBind): Credential {\n return new SourceCredential({ kind: \"custom\", name: kind, apply }, bind);\n },\n});\n\n/**\n * The secret of a credential made by the factories, or undefined for any other object.\n * @param credential - the credential\n * @returns the secret\n */\nfunction secretOf(credential: Credential): Secret | undefined {\n return SECRETS.get(credential);\n}\n\n/**\n * Whether an object is a credential made by the `credentials` factories.\n * @param value - the value\n * @returns true for a factory-made credential\n */\nexport function isCredential(value: unknown): value is Credential {\n return typeof value === \"object\" && value !== null && secretOf(value as Credential) !== undefined;\n}\n\n/**\n * The request header a credential sets, for the browser checks; null for a query key or a custom one.\n * @param credential - the credential\n * @returns the header name, lowercase\n */\nexport function credentialHeader(credential: Credential): string | null {\n const secret = secretOf(credential);\n if (secret?.kind === \"api-key\") {\n return secret.header?.toLowerCase() ?? null;\n }\n return secret?.kind === \"bearer\" || secret?.kind === \"basic\" || secret?.kind === \"aws-sigv4\"\n ? \"authorization\"\n : null;\n}\n\n/**\n * Add a credential to a request. Internal to graph-io: only `ctx.fetch` calls it.\n * @param credential - the credential\n * @param request - the request\n * @returns the request with its authentication\n */\nexport async function applyCredential(credential: Credential, request: Request): Promise<Request> {\n const secret = secretOf(credential);\n if (secret === undefined) {\n return failAlone(\"E_SOURCE_PARAM\", \"the credential was not made by the credentials factories\", {\n name: \"credential\",\n reason: \"type\",\n });\n }\n switch (secret.kind) {\n case \"bearer\": {\n const token = typeof secret.token === \"string\" ? secret.token : await secret.token();\n const headers = new Headers(request.headers);\n headers.set(\"Authorization\", `Bearer ${token}`);\n return new Request(request, { headers });\n }\n case \"basic\": {\n const headers = new Headers(request.headers);\n const pair = `${secret.username}:${secret.password}`;\n headers.set(\"Authorization\", `Basic ${base64(pair)}`);\n return new Request(request, { headers });\n }\n case \"api-key\": {\n if (secret.header !== null) {\n const headers = new Headers(request.headers);\n headers.set(secret.header, secret.value);\n return new Request(request, { headers });\n }\n const url = new URL(request.url);\n url.searchParams.set(secret.query ?? \"api_key\", secret.value);\n return new Request(url, request);\n }\n case \"aws-sigv4\": {\n const { signRequest } = await import(\"./sigv4.js\");\n return signRequest(request, secret.options);\n }\n case \"custom\":\n return secret.apply(request);\n default:\n return request;\n }\n}\n\n/**\n * The raw secret, for a transport that must hand it to a driver (Bolt). Internal to graph-io; the\n * caller applies the origin and TLS rules itself.\n * @param credential - the credential\n * @returns the kind and the values the driver needs\n */\nexport function unwrapCredential(\n credential: Credential,\n):\n | { readonly kind: \"basic\"; readonly username: string; readonly password: string }\n | { readonly kind: \"bearer\"; readonly token: string | (() => Promise<string>) }\n | { readonly kind: CredentialKind }\n | undefined {\n const secret = secretOf(credential);\n if (secret?.kind === \"basic\") {\n return { kind: \"basic\", username: secret.username, password: secret.password };\n }\n if (secret?.kind === \"bearer\") {\n return { kind: \"bearer\", token: secret.token };\n }\n return secret === undefined ? undefined : { kind: credential.kind };\n}\n\n/**\n * Whether a credential can be remembered: its secret is a plain value, not a function. A token\n * refresher, a custom credential and an AWS provider cannot.\n * @param credential - the credential\n * @returns true for basic, a bearer string token and an API key\n */\nexport function isStorableCredential(credential: Credential): boolean {\n const secret = secretOf(credential);\n return (\n secret?.kind === \"basic\" ||\n secret?.kind === \"api-key\" ||\n (secret?.kind === \"bearer\" && typeof secret.token === \"string\")\n );\n}\n\n/**\n * The plain parts of a credential that can be remembered. Experimental.\n * @category Network sources\n */\nexport type StorableCredential =\n | {\n /** A user name and password, sent as HTTP Basic authentication. */\n readonly kind: \"basic\";\n /** The user name. */\n readonly username: string;\n /** The password. */\n readonly password: string;\n }\n | {\n /** A bearer token, sent in the Authorization header. */\n readonly kind: \"bearer\";\n /** The token. */\n readonly token: string;\n }\n | {\n /** An API key, sent in a header or a query parameter. */\n readonly kind: \"api-key\";\n /** The header that carries the key, or null when a query parameter does. */\n readonly header: string | null;\n /** The query parameter that carries the key, or null when a header does. */\n readonly query: string | null;\n /** The key. */\n readonly value: string;\n };\n\n/**\n * The parts of a credential a credential store saves (graphty-element's `CredentialStore` is the\n * one caller), or null when it cannot be saved: a token function, an AWS provider or a custom\n * credential. The result HOLDS THE SECRET: never log it, and keep it only where you would keep the\n * password itself. `fromStorableCredential` makes the credential again. Experimental.\n * @param credential - a credential made by the `credentials` factories\n * @returns the parts, or null\n * @category Network sources\n */\nexport function storableCredential(credential: Credential): StorableCredential | null {\n const secret = secretOf(credential);\n switch (secret?.kind) {\n case \"basic\":\n return { kind: \"basic\", username: secret.username, password: secret.password };\n case \"api-key\":\n return { kind: \"api-key\", header: secret.header, query: secret.query, value: secret.value };\n case \"bearer\":\n return typeof secret.token === \"string\" ? { kind: \"bearer\", token: secret.token } : null;\n default:\n return null;\n }\n}\n\n/**\n * The credential `storableCredential` took apart, bound to the origins given. Experimental.\n * @param parts - what `storableCredential` returned\n * @param bind - the origins it may be sent to\n * @returns the credential\n * @category Network sources\n */\nexport function fromStorableCredential(parts: StorableCredential, bind?: CredentialBind): Credential {\n switch (parts.kind) {\n case \"basic\":\n return credentials.basic(parts.username, parts.password, bind);\n case \"bearer\":\n return credentials.bearer(parts.token, bind);\n default:\n return new SourceCredential(\n { kind: \"api-key\", header: parts.header, query: parts.query, value: parts.value },\n bind,\n );\n }\n}\n"],"names":[],"mappings":";AAYO,MAAM,iBAAiB;AAMvB,MAAM,mBAAmB;AAMzB,MAAM,kBAAkB;AAMxB,MAAM,oBAAoB;AAM1B,MAAM,iBAAiB;AAMvB,MAAM,qBAAqB;AAM3B,MAAM,qBAAqB;AAM3B,MAAM,mBAAmB;AAMzB,MAAM,qBAAqB;AAO3B,MAAM,qBAAqB;AAM3B,MAAM,uBAAuB;AC9DpC,MAAM,WAAsE;AAAA,EACxE,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EACpB,kBAAkB;AACtB;AAUO,SAAS,OACZ,QACA,MACA,SACA,QACK;AAGL,SAAO,OAAO,KAAA,EAAO,SAAS,SAAS,IAAI,KAAK,eAAe,MAAM,SAAS,QAAW,QAAQ,MAAM;AAC3G;AASO,SAAS,UACZ,MACA,SACA,QACA,SAAS,UACJ;AACL,SAAO,IAAI,oBAAoB,QAAQ,CAAC,GAAG,MAAM,SAAS,MAAM;AACpE;AASO,SAAS,OACZ,QACA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ACjE,KAAK;AACD,aAAO,YAAY,OAAO,MAAM,OAAO,IAAI;AAAA,IAC/C;AACI,aAAO,IAAI;AAAA,QACP,EAAE,MAAM,WAAW,QAAQ,MAAM,QAAQ,OAAO,MAAM,OAAO,OAAO,MAAM,MAAA;AAAA,QAC1E;AAAA,MAAA;AAAA,EACJ;AAEZ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-BJ-W0Jd-.js","sources":["../../src/sources/rest/samples/deps-dev.ts","../../src/sources/rest/samples/string.ts","../../src/sources/rest/descriptor.ts"],"sourcesContent":["/**\n * A sample mapping: the resolved dependency graph of one package version from deps.dev\n * (https://deps.dev). The body already holds a node array and an edge array whose ends are node\n * positions, so the body is a container and `#` gives each package its position as its id.\n * Catalog data for the `rest` source's samples.\n */\n\nimport { type RestMapping } from \"../params.js\";\n\n/** The deps.dev dependencies mapping: `system` (npm, pypi, ...), `package` and `version`. */\nexport const DEPS_DEV_MAPPING: RestMapping = Object.freeze<RestMapping>({\n version: 1,\n endpoint: \"https://api.deps.dev\",\n load: \"dependencies\",\n directed: true,\n requests: {\n dependencies: {\n path: \"/v3/systems/{system}/packages/{package}/versions/{version}:dependencies\",\n records: \".\",\n entity: \"graph\",\n },\n },\n entities: {\n graph: {\n id: \"nodes\",\n node: false,\n edges: [\n {\n each: \"edges[]\",\n from: \"fromNode\",\n to: \"toNode\",\n type: \"depends_on\",\n entity: \"package\",\n fields: { requirement: \"requirement\" },\n },\n ],\n embedded: [{ at: \"nodes[]\", entity: \"package\" }],\n },\n package: {\n id: \"#\",\n fields: {\n name: \"versionKey.name\",\n version: \"versionKey.version\",\n system: \"versionKey.system\",\n relation: \"relation\",\n },\n },\n },\n});\n","/**\n * A sample mapping: STRING's functional partners of a protein (https://string-db.org). Each\n * interaction record names both proteins, so both are embedded nodes and the record itself is only\n * the edge. Catalog data for the `rest` source's samples.\n */\n\nimport { type RestMapping } from \"../params.js\";\n\n/** The STRING network mapping: `identifiers`, `species` (NCBI taxon) and `add_nodes`. */\nexport const STRING_MAPPING: RestMapping = Object.freeze<RestMapping>({\n version: 1,\n endpoint: \"https://string-db.org\",\n load: \"network\",\n directed: false,\n requests: {\n network: {\n path: \"/api/json/network\",\n query: { identifiers: \"{identifiers}\", species: \"{species}\", add_nodes: \"{add_nodes}\" },\n records: \".\",\n entity: \"interaction\",\n },\n },\n entities: {\n interaction: {\n id: \"stringId_A\",\n node: false,\n edges: [\n {\n from: \"stringId_A\",\n to: \"stringId_B\",\n type: \"interacts_with\",\n entity: \"protein-b\",\n fields: { score: \"score\" },\n },\n ],\n embedded: [\n { at: \".\", entity: \"protein-a\" },\n { at: \".\", entity: \"protein-b\" },\n ],\n },\n \"protein-a\": { id: \"stringId_A\", label: \"protein\", fields: { name: \"preferredName_A\" } },\n \"protein-b\": { id: \"stringId_B\", label: \"protein\", fields: { name: \"preferredName_B\" } },\n },\n});\n","/**\n * The descriptors of the REST mapping source and its `openalex` preset: catalog data, available\n * without loading the sources' code.\n */\n\nimport { type SourceDescriptor } from \"../types.js\";\nimport { DEPS_DEV_MAPPING } from \"./samples/deps-dev.js\";\nimport { STRING_MAPPING } from \"./samples/string.js\";\n\n/**\n * The descriptor of the generic `rest` source. Experimental.\n * @category Network sources\n */\nexport const REST_DESCRIPTOR: SourceDescriptor = Object.freeze({\n plainName: \"REST API\",\n kind: \"rest\",\n version: 1,\n auth: [\"bearer\", \"api-key\"],\n authRequired: \"optional\",\n params: [{ name: \"mapping\", plainName: \"Mapping\", type: \"text\", required: true }],\n samples: [\n {\n id: \"string-tp53\",\n plainName: \"STRING: TP53's functional partners\",\n params: { mapping: STRING_MAPPING, identifiers: \"TP53\", species: \"9606\", add_nodes: \"20\" },\n endpoint: STRING_MAPPING.endpoint,\n counts: { nodes: 21, edges: 113 },\n },\n {\n id: \"deps-dev-webpack\",\n plainName: \"deps.dev: webpack 5.90.0\",\n params: { mapping: DEPS_DEV_MAPPING, system: \"npm\", package: \"webpack\", version: \"5.90.0\" },\n endpoint: DEPS_DEV_MAPPING.endpoint,\n counts: { nodes: 84, edges: 121 },\n },\n ],\n});\n\n/**\n * The descriptor of the `openalex` preset. Experimental.\n * @category Network sources\n */\nexport const OPENALEX_DESCRIPTOR: SourceDescriptor = Object.freeze({\n plainName: \"OpenAlex\",\n kind: \"rest\",\n version: 1,\n defaultEndpoint: \"https://api.openalex.org\",\n auth: [\"api-key\"],\n authRequired: \"optional\",\n rateLimit: { requests: 10, perMs: 1000 },\n params: [\n { name: \"work\", plainName: \"Work\", type: \"string\" },\n { name: \"author\", plainName: \"Author\", type: \"string\" },\n {\n name: \"graph\",\n plainName: \"Graph\",\n type: \"enum\",\n default: \"citation\",\n values: [\n { value: \"citation\", label: \"Citations\" },\n { value: \"coauthorship\", label: \"Co-authors\" },\n ],\n },\n { name: \"include\", plainName: \"Include\", type: \"string\", advanced: true },\n ],\n samples: [\n {\n id: \"openalex-watts-strogatz\",\n plainName: \"Watts-Strogatz paper's citations\",\n params: { work: \"W2112090702\" },\n whole: false,\n },\n ],\n});\n"],"names":[],"mappings":"AAUO,MAAM,mBAAgC,OAAO,OAAoB;AAAA,EACpE,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,IACN,cAAc;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAQ;AAAA,IAAA;AAAA,EACZ;AAAA,EAEJ,UAAU;AAAA,IACN,OAAO;AAAA,MACH,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,QACH;AAAA,UACI,MAAM;AAAA,UACN,MAAM;AAAA,UACN,IAAI;AAAA,UACJ,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,QAAQ,EAAE,aAAa,cAAA;AAAA,QAAc;AAAA,MACzC;AAAA,MAEJ,UAAU,CAAC,EAAE,IAAI,WAAW,QAAQ,WAAW;AAAA,IAAA;AAAA,IAEnD,SAAS;AAAA,MACL,IAAI;AAAA,M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