@graphty/graph-io 0.3.46 → 0.3.48
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-C2riR4NT.js} +2 -2
- package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-C2riR4NT.js.map} +1 -1
- package/dist/chunks/{block-DiGq58c3.js → block-Cu22ewuS.js} +92 -21
- package/dist/chunks/block-Cu22ewuS.js.map +1 -0
- package/dist/chunks/{choose--jM0yYCo.js → choose-Cdx6Enl2.js} +3 -3
- package/dist/chunks/{choose--jM0yYCo.js.map → choose-Cdx6Enl2.js.map} +1 -1
- package/dist/chunks/codes-CV_Bhcyi.js +153 -0
- package/dist/chunks/codes-CV_Bhcyi.js.map +1 -0
- package/dist/chunks/{constants-BKwqelYD.js → constants-D0LqcsLJ.js} +2 -2
- package/dist/chunks/{constants-BKwqelYD.js.map → constants-D0LqcsLJ.js.map} +1 -1
- package/dist/chunks/context-cgmmOxZ2.js +663 -0
- package/dist/chunks/context-cgmmOxZ2.js.map +1 -0
- package/dist/chunks/credentials-BiQsnMTb.js +347 -0
- package/dist/chunks/credentials-BiQsnMTb.js.map +1 -0
- package/dist/chunks/cx-export-BEeF6ymo.js +259 -0
- package/dist/chunks/cx-export-BEeF6ymo.js.map +1 -0
- package/dist/chunks/descriptor-BJ-W0Jd-.js +137 -0
- package/dist/chunks/descriptor-BJ-W0Jd-.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/{emit-CwU8cUmG.js → emit-CD8xnY8s.js} +70 -10
- package/dist/chunks/emit-CD8xnY8s.js.map +1 -0
- package/dist/chunks/{escape-CgzxiYPg.js → escape-DH2Egt-l.js} +12 -12
- package/dist/chunks/{escape-CgzxiYPg.js.map → escape-DH2Egt-l.js.map} +1 -1
- package/dist/chunks/{export-BvqAXCKh.js → export-CZ7VRm4I.js} +53 -1443
- package/dist/chunks/export-CZ7VRm4I.js.map +1 -0
- package/dist/chunks/{exporter-DndFlGSa.js → exporter-BIdaoIgh.js} +7 -6
- package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-BIdaoIgh.js.map} +1 -1
- package/dist/chunks/{exporter-CJgfhF-l.js → exporter-ChjL5fmP.js} +8 -7
- package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-ChjL5fmP.js.map} +1 -1
- package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-Dcw7Ldtq.js} +6 -4
- package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-Dcw7Ldtq.js.map} +1 -1
- package/dist/chunks/exporter-DtVU80Fa.js +1008 -0
- package/dist/chunks/exporter-DtVU80Fa.js.map +1 -0
- package/dist/chunks/{exporter-CrDWIyiq.js → exporter-bxxjOrDZ.js} +11 -9
- package/dist/chunks/{exporter-CrDWIyiq.js.map → exporter-bxxjOrDZ.js.map} +1 -1
- package/dist/chunks/format-BMS-1Nxb.js +64 -0
- package/dist/chunks/format-BMS-1Nxb.js.map +1 -0
- package/dist/chunks/{generic-Dq1ntt9q.js → generic-CP6YD34u.js} +4 -4
- package/dist/chunks/{generic-Dq1ntt9q.js.map → generic-CP6YD34u.js.map} +1 -1
- package/dist/chunks/{importer-DiZRmOQG.js → importer-B87_fmVx.js} +13 -17
- package/dist/chunks/importer-B87_fmVx.js.map +1 -0
- package/dist/chunks/{importer-BSvfrX_h.js → importer-Bji2MeWr.js} +18 -1014
- package/dist/chunks/importer-Bji2MeWr.js.map +1 -0
- package/dist/chunks/{importer-COTK9Tsl.js → importer-CB_zV5_L.js} +14 -11
- package/dist/chunks/importer-CB_zV5_L.js.map +1 -0
- package/dist/chunks/{importer-e6LGpqHB.js → importer-CVT-JyDE.js} +12 -9
- package/dist/chunks/importer-CVT-JyDE.js.map +1 -0
- package/dist/chunks/{importer-yh_aBCU6.js → importer-Cyy6UseH.js} +7 -6
- package/dist/chunks/{importer-yh_aBCU6.js.map → importer-Cyy6UseH.js.map} +1 -1
- package/dist/chunks/{importer-iFYPEKaJ.js → importer-DPZDN40-.js} +14 -10
- package/dist/chunks/{importer-iFYPEKaJ.js.map → importer-DPZDN40-.js.map} +1 -1
- package/dist/chunks/{importer-CMmeMWlC.js → importer-e3huMZbm.js} +8 -260
- package/dist/chunks/importer-e3huMZbm.js.map +1 -0
- package/dist/chunks/input-Ccg9I22A.js +1397 -0
- package/dist/chunks/input-Ccg9I22A.js.map +1 -0
- package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-By172SVq.js} +4 -4
- package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-By172SVq.js.map} +1 -1
- package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-u2SI5xcx.js} +19 -5
- package/dist/chunks/lexicon-u2SI5xcx.js.map +1 -0
- package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-BwgMyuF0.js} +4 -3
- package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-BwgMyuF0.js.map} +1 -1
- package/dist/chunks/{records-CiaWZrFH.js → records-Cgvxz-Vx.js} +2 -2
- package/dist/chunks/{records-CiaWZrFH.js.map → records-Cgvxz-Vx.js.map} +1 -1
- package/dist/chunks/{format-BpQBx8MZ.js → report-CgdsL9Hb.js} +72 -129
- package/dist/chunks/report-CgdsL9Hb.js.map +1 -0
- package/dist/chunks/sigv4-LkAzsLAu.js +247 -0
- package/dist/chunks/sigv4-LkAzsLAu.js.map +1 -0
- package/dist/chunks/{styles-BQnsga7p.js → styles-CaABMoO1.js} +76 -43
- package/dist/chunks/styles-CaABMoO1.js.map +1 -0
- package/dist/chunks/{styles-D3fRphrO.js → styles-P_gmFAOi.js} +101 -21
- package/dist/chunks/styles-P_gmFAOi.js.map +1 -0
- package/dist/chunks/{styles-yed-BF5x3_Y5.js → styles-yed-Cs1nmrjn.js} +60 -20
- package/dist/chunks/styles-yed-Cs1nmrjn.js.map +1 -0
- package/dist/chunks/{text-CzJNFOS9.js → text-BuKQVMz2.js} +2 -2
- package/dist/chunks/{text-CzJNFOS9.js.map → text-BuKQVMz2.js.map} +1 -1
- package/dist/chunks/{writer-DMKvthQE.js → writer-DvHTl36J.js} +5 -4
- package/dist/chunks/writer-DvHTl36J.js.map +1 -0
- 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 +2 -2
- package/dist/gexf.js +7 -5
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +16 -13
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +1181 -224
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -3
- package/dist/json.js +1 -1
- 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/sources-cypher.d.ts +1 -0
- package/dist/sources-cypher.js +1236 -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 +1367 -0
- package/dist/sources-rest.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/styles.d.ts.map +1 -1
- package/dist/src/formats/cx/styles.js +1 -0
- package/dist/src/formats/cx/styles.js.map +1 -1
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +3 -1
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +29 -12
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +160 -31
- package/dist/src/formats/gexf/styles.js.map +1 -1
- package/dist/src/formats/gml/styles.d.ts.map +1 -1
- package/dist/src/formats/gml/styles.js +5 -4
- 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 +3 -3
- package/dist/src/formats/graphml/styles-plain.js.map +1 -1
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yed.js +89 -19
- package/dist/src/formats/graphml/styles-yed.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts.map +1 -1
- package/dist/src/formats/pajek/styles.js +1 -0
- package/dist/src/formats/pajek/styles.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
- package/dist/src/formats/xgmml/styles.js +1 -0
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +8 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -1
- package/dist/src/index.js.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 +47 -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 +739 -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 +119 -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 +405 -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 +106 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
- package/dist/src/sources/cypher/query-builder.js +236 -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 +64 -0
- package/dist/src/sources/ids.d.ts.map +1 -0
- package/dist/src/sources/ids.js +64 -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 +28 -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 +71 -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 +635 -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 +24 -0
- package/dist/src/sources/sigv4.d.ts.map +1 -0
- package/dist/src/sources/sigv4.js +182 -0
- package/dist/src/sources/sigv4.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 +665 -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/canon/enums.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.js +1 -0
- package/dist/src/styles/canon/enums.js.map +1 -1
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
- package/dist/src/styles/cyjs/cascade.js +68 -2
- 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 +2 -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 +18 -7
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cyjs/mappers.d.ts +4 -1
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +2 -0
- package/dist/src/styles/cyjs/mappers.js.map +1 -1
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/emit.js +59 -7
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +6 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +26 -2
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
- package/dist/src/styles/cytoscape/resolve.d.ts +4 -1
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +10 -6
- 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 +30 -0
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +45 -4
- package/dist/src/styles/defaults.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/writer.d.ts.map +1 -1
- package/dist/src/styles/io/writer.js +7 -3
- package/dist/src/styles/io/writer.js.map +1 -1
- package/dist/src/styles/plan/resolve.d.ts +2 -1
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +13 -2
- package/dist/src/styles/plan/resolve.js.map +1 -1
- package/dist/src/styles/types.d.ts +19 -2
- package/dist/src/styles/types.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.js +15 -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 +11 -11
- package/dist/xgmml.js +3 -3
- package/docs/samples/people.json +6 -0
- package/package.json +29 -4
- package/src/common/report.ts +27 -7
- package/src/formats/cx/styles.ts +1 -0
- package/src/formats/dot/styles.ts +3 -1
- package/src/formats/gexf/styles.ts +185 -37
- package/src/formats/gml/styles.ts +5 -4
- package/src/formats/graphml/styles-plain.ts +3 -9
- package/src/formats/graphml/styles-yed.ts +93 -20
- package/src/formats/pajek/styles.ts +1 -0
- package/src/formats/xgmml/styles.ts +1 -0
- package/src/index.ts +90 -0
- package/src/registry.ts +326 -1
- package/src/sources/builtins.ts +56 -0
- package/src/sources/codes.ts +235 -0
- package/src/sources/context.ts +893 -0
- package/src/sources/credentials.ts +409 -0
- package/src/sources/cypher/descriptor.ts +125 -0
- package/src/sources/cypher/flatten.ts +323 -0
- package/src/sources/cypher/index.ts +498 -0
- package/src/sources/cypher/params.ts +41 -0
- package/src/sources/cypher/profiles.ts +78 -0
- package/src/sources/cypher/query-builder.ts +294 -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 +74 -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 +29 -0
- package/src/sources/registry.ts +325 -0
- package/src/sources/rest/descriptor.ts +74 -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 +760 -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 +207 -0
- package/src/sources/testing.ts +210 -0
- package/src/sources/types.ts +741 -0
- package/src/styles/canon/enums.ts +1 -0
- package/src/styles/cyjs/cascade.ts +81 -2
- package/src/styles/cyjs/defaults-table.ts +2 -0
- package/src/styles/cyjs/emit.ts +18 -7
- package/src/styles/cyjs/mappers.ts +6 -1
- package/src/styles/cytoscape/emit.ts +61 -7
- package/src/styles/cytoscape/lexicon.ts +28 -2
- package/src/styles/cytoscape/resolve.ts +22 -6
- package/src/styles/cytoscape/translate.ts +11 -11
- package/src/styles/defaults.ts +93 -4
- package/src/styles/io/block.ts +10 -0
- package/src/styles/io/writer.ts +8 -3
- package/src/styles/plan/resolve.ts +14 -2
- package/src/styles/types.ts +28 -2
- package/src/styles/vocabulary.ts +15 -1
- package/src/types.ts +19 -5
- package/dist/chunks/block-DiGq58c3.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/format-BpQBx8MZ.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/lexicon-CT69Kd87.js.map +0 -1
- package/dist/chunks/styles-BQnsga7p.js.map +0 -1
- package/dist/chunks/styles-D3fRphrO.js.map +0 -1
- package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
- package/dist/chunks/writer-DMKvthQE.js.map +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineSource` and the registration checks (design section 2): the id form, exactly one read
|
|
3
|
+
* method, and the declared features against the methods present. Also the parameter checks every
|
|
4
|
+
* load runs against the descriptor before any request.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { type ImportReportBuilder } from "../common/report.js";
|
|
8
|
+
import { failAlone, failOn } from "./fail.js";
|
|
9
|
+
import {
|
|
10
|
+
type GraphSource,
|
|
11
|
+
type LazySource,
|
|
12
|
+
type SourceDescriptor,
|
|
13
|
+
type SourceFeature,
|
|
14
|
+
type SourceParamDescriptor,
|
|
15
|
+
} from "./types.js";
|
|
16
|
+
|
|
17
|
+
/** Lowercase letters, digits and single dashes between them. */
|
|
18
|
+
const ID_FORM = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
19
|
+
|
|
20
|
+
/** The optional methods and the feature each one is. */
|
|
21
|
+
const FEATURE_METHODS: readonly (readonly [SourceFeature, "expand" | "probe" | "list" | "validate"])[] = [
|
|
22
|
+
["expand", "expand"],
|
|
23
|
+
["probe", "probe"],
|
|
24
|
+
["list", "list"],
|
|
25
|
+
["validate", "validate"],
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Refuse a malformed source.
|
|
30
|
+
* @param id - the source id
|
|
31
|
+
* @param reason - why
|
|
32
|
+
* @param message - for logs
|
|
33
|
+
*/
|
|
34
|
+
function invalid(id: string, reason: string, message: string): never {
|
|
35
|
+
failAlone("E_SOURCE_INVALID", message, { id, reason });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Check a source id.
|
|
40
|
+
* @param id - the id
|
|
41
|
+
*/
|
|
42
|
+
function checkSourceId(id: unknown): asserts id is string {
|
|
43
|
+
if (typeof id !== "string" || !ID_FORM.test(id)) {
|
|
44
|
+
invalid(String(id), "id", `source id ${JSON.stringify(id)} must be lowercase letters, digits and dashes`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The features a loaded source has, from its methods.
|
|
50
|
+
* @param source - the source
|
|
51
|
+
* @returns the features
|
|
52
|
+
*/
|
|
53
|
+
function featuresOf(source: GraphSource<never>): readonly SourceFeature[] {
|
|
54
|
+
return FEATURE_METHODS.filter(([, method]) => typeof source[method] === "function").map(([f]) => f);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Check a loaded source: its id, exactly one read method, and its declared features.
|
|
59
|
+
* @param source - the source
|
|
60
|
+
* @param declared - features a lazy registration declared, if any
|
|
61
|
+
*/
|
|
62
|
+
export function checkSource(source: GraphSource<never>, declared?: SourceDescriptor): void {
|
|
63
|
+
checkSourceId((source as { id?: unknown }).id);
|
|
64
|
+
const reads = (["records", "file", "import"] as const).filter((m) => typeof source[m] === "function");
|
|
65
|
+
if (reads.length !== 1) {
|
|
66
|
+
invalid(source.id, "read-methods", `source ${source.id} must have exactly one of records, file and import`);
|
|
67
|
+
}
|
|
68
|
+
const features = (declared ?? source.descriptor)?.features;
|
|
69
|
+
if (features !== undefined) {
|
|
70
|
+
const has = new Set(featuresOf(source));
|
|
71
|
+
for (const f of features) {
|
|
72
|
+
if (f !== "page" && !has.has(f)) {
|
|
73
|
+
invalid(source.id, "features", `source ${source.id} declares ${f} but has no ${f} method`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check a lazy registration before its code is loaded.
|
|
81
|
+
* @param source - the lazy source
|
|
82
|
+
*/
|
|
83
|
+
export function checkLazySource(source: LazySource): void {
|
|
84
|
+
checkSourceId(source.id);
|
|
85
|
+
if (typeof source.load !== "function" || typeof source.descriptor !== "object") {
|
|
86
|
+
invalid(source.id, "lazy", `lazy source ${source.id} needs a descriptor and a load function`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Define a network source: returns it unchanged, with its parameter type inferred, after the
|
|
92
|
+
* registration checks (an id of lowercase letters, digits and dashes; exactly one of `records`,
|
|
93
|
+
* `file` and `import`; declared features backed by methods). A malformed source throws an
|
|
94
|
+
* ImportError whose `issue.code` is E_SOURCE_INVALID. Experimental.
|
|
95
|
+
* @param source - the source
|
|
96
|
+
* @returns the same source
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const people = defineSource({
|
|
100
|
+
* id: "people",
|
|
101
|
+
* async records(params: { team: string }, ctx) {
|
|
102
|
+
* const rows = await ctx.fetchJson<{ id: string; name: string }[]>(`/api/people?team=${params.team}`);
|
|
103
|
+
* return { nodes: rows };
|
|
104
|
+
* },
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
* @category Network sources
|
|
108
|
+
*/
|
|
109
|
+
export function defineSource<P>(source: GraphSource<P>): GraphSource<P> {
|
|
110
|
+
checkSource(source);
|
|
111
|
+
return source;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Why a number or integer param is wrong, if it is.
|
|
116
|
+
* @param p - the param's descriptor
|
|
117
|
+
* @param value - the value given
|
|
118
|
+
* @returns the reason, or null when it is fine
|
|
119
|
+
*/
|
|
120
|
+
function numberProblem(p: SourceParamDescriptor, value: unknown): string | null {
|
|
121
|
+
if (typeof value !== "number" || Number.isNaN(value) || (p.type === "integer" && !Number.isInteger(value))) {
|
|
122
|
+
return "type";
|
|
123
|
+
}
|
|
124
|
+
if ((p.min !== undefined && value < p.min) || (p.max !== undefined && value > p.max)) {
|
|
125
|
+
return "range";
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Why a URL param is wrong, if it is.
|
|
132
|
+
* @param value - the value given
|
|
133
|
+
* @returns the reason, or null when it is fine
|
|
134
|
+
*/
|
|
135
|
+
function urlProblem(value: unknown): string | null {
|
|
136
|
+
let url: URL;
|
|
137
|
+
try {
|
|
138
|
+
url = new URL(typeof value === "string" ? value : "");
|
|
139
|
+
} catch {
|
|
140
|
+
return "type";
|
|
141
|
+
}
|
|
142
|
+
return url.username !== "" || url.password !== "" ? "credentials-in-url" : null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Why a present param value is wrong for its descriptor, if it is.
|
|
147
|
+
* @param p - the param's descriptor
|
|
148
|
+
* @param value - the value given (not undefined or null)
|
|
149
|
+
* @returns the reason, or null when it is fine
|
|
150
|
+
*/
|
|
151
|
+
function paramProblem(p: SourceParamDescriptor, value: unknown): string | null {
|
|
152
|
+
switch (p.type) {
|
|
153
|
+
case "integer":
|
|
154
|
+
case "number":
|
|
155
|
+
return numberProblem(p, value);
|
|
156
|
+
case "boolean":
|
|
157
|
+
return typeof value === "boolean" ? null : "type";
|
|
158
|
+
case "enum":
|
|
159
|
+
return p.values !== undefined && !p.values.some((v) => v.value === value) ? "enum" : null;
|
|
160
|
+
case "url":
|
|
161
|
+
return urlProblem(value);
|
|
162
|
+
default:
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Check params against a descriptor before any request: required ones present, numbers and
|
|
169
|
+
* integers in range, booleans, enums, URLs (never with a user name or password in them).
|
|
170
|
+
* @param params - the caller's params
|
|
171
|
+
* @param descriptor - the source's descriptor
|
|
172
|
+
* @param report - the load's report
|
|
173
|
+
*/
|
|
174
|
+
export function checkParams(
|
|
175
|
+
params: Readonly<Record<string, unknown>>,
|
|
176
|
+
descriptor: SourceDescriptor | undefined,
|
|
177
|
+
report: ImportReportBuilder,
|
|
178
|
+
): void {
|
|
179
|
+
if (typeof params !== "object" || (params as unknown) === null) {
|
|
180
|
+
failOn(report, "E_SOURCE_PARAM", "params must be an object", { name: "params", reason: "type" });
|
|
181
|
+
}
|
|
182
|
+
for (const p of descriptor?.params ?? []) {
|
|
183
|
+
const value = params[p.name];
|
|
184
|
+
const missing = value === undefined || value === null;
|
|
185
|
+
let reason: string | null = null;
|
|
186
|
+
if (!missing) {
|
|
187
|
+
reason = paramProblem(p, value);
|
|
188
|
+
} else if (p.required === true && p.default === undefined) {
|
|
189
|
+
reason = "required";
|
|
190
|
+
}
|
|
191
|
+
if (reason !== null) {
|
|
192
|
+
failOn(report, "E_SOURCE_PARAM", `parameter ${p.name}: ${reason}`, { name: p.name, reason });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raising a network source issue: one place that turns a code and its params into an ImportError
|
|
3
|
+
* whose `issue.params` and `details` both carry the params, so callers branch on
|
|
4
|
+
* `err.issue.code` and read `err.issue.params` as with every other graph-io failure.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ImportReportBuilder } from "../common/report.js";
|
|
8
|
+
import { type IssueCategory } from "../types.js";
|
|
9
|
+
import { type SourceIssueCode } from "./codes.js";
|
|
10
|
+
|
|
11
|
+
/** The category each code is filed under. */
|
|
12
|
+
const CATEGORY: Readonly<Partial<Record<SourceIssueCode, IssueCategory>>> = {
|
|
13
|
+
E_SOURCE_PARAM: "validation-error",
|
|
14
|
+
E_SOURCE_INVALID: "validation-error",
|
|
15
|
+
E_SOURCE_RESPONSE: "parse-error",
|
|
16
|
+
E_SOURCE_NOT_A_GRAPH: "parse-error",
|
|
17
|
+
E_SOURCE_NOT_FOUND: "missing-value",
|
|
18
|
+
E_SOURCE_UNKNOWN: "missing-value",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Abort a load with a source error, carrying the load's report so far plus the error.
|
|
23
|
+
* @param report - the load's report
|
|
24
|
+
* @param code - the code
|
|
25
|
+
* @param message - a plain-ASCII message, for logs
|
|
26
|
+
* @param params - the issue's values
|
|
27
|
+
* @returns never; it throws the ImportError
|
|
28
|
+
*/
|
|
29
|
+
export function failOn(
|
|
30
|
+
report: ImportReportBuilder,
|
|
31
|
+
code: SourceIssueCode,
|
|
32
|
+
message: string,
|
|
33
|
+
params: Readonly<Record<string, unknown>>,
|
|
34
|
+
): never {
|
|
35
|
+
// a fork, so a failure the runner turns into a warning (a later page's 401, a cap) leaves no
|
|
36
|
+
// error in the load's own report; the ImportError carries everything recorded so far
|
|
37
|
+
return report.fork().failWith(CATEGORY[code] ?? "unsupported", code, message, undefined, params, params);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Raise a source error outside a load (registration, a credential factory).
|
|
42
|
+
* @param code - the code
|
|
43
|
+
* @param message - a plain-ASCII message, for logs
|
|
44
|
+
* @param params - the issue's values
|
|
45
|
+
* @param format - the report's format name
|
|
46
|
+
*/
|
|
47
|
+
export function failAlone(
|
|
48
|
+
code: SourceIssueCode,
|
|
49
|
+
message: string,
|
|
50
|
+
params: Readonly<Record<string, unknown>>,
|
|
51
|
+
format = "source",
|
|
52
|
+
): never {
|
|
53
|
+
failOn(new ImportReportBuilder(format, 0), code, message, params);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Record a source warning on a report.
|
|
58
|
+
* @param report - the report
|
|
59
|
+
* @param code - the code
|
|
60
|
+
* @param message - a plain-ASCII message, for logs
|
|
61
|
+
* @param params - the issue's values
|
|
62
|
+
*/
|
|
63
|
+
export function warnOn(
|
|
64
|
+
report: ImportReportBuilder,
|
|
65
|
+
code: SourceIssueCode,
|
|
66
|
+
message: string,
|
|
67
|
+
params: Readonly<Record<string, unknown>>,
|
|
68
|
+
): void {
|
|
69
|
+
report.warning("unsupported", code, message, undefined, params);
|
|
70
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public names of network sources: one constant per built-in source id, and the reserved
|
|
3
|
+
* `_source.` attribute names. Nothing else in graph-io spells them, so a rename is one edit here.
|
|
4
|
+
*
|
|
5
|
+
* Experimental: the ids and the `_source.` namespace await the owner's final word (design
|
|
6
|
+
* section 22, items 4 and 5).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The NDEx source (www.ndexbio.org). Experimental.
|
|
11
|
+
* @category Network sources
|
|
12
|
+
*/
|
|
13
|
+
export const NDEX_SOURCE_ID = "ndex";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The generic Cypher source, for any openCypher server. Experimental.
|
|
17
|
+
* @category Network sources
|
|
18
|
+
*/
|
|
19
|
+
export const CYPHER_SOURCE_ID = "cypher";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Neo4j preset of the Cypher source. Experimental.
|
|
23
|
+
* @category Network sources
|
|
24
|
+
*/
|
|
25
|
+
export const NEO4J_SOURCE_ID = "neo4j";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The Amazon Neptune preset of the Cypher source. Experimental.
|
|
29
|
+
* @category Network sources
|
|
30
|
+
*/
|
|
31
|
+
export const NEPTUNE_SOURCE_ID = "neptune";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The generic REST mapping source. Experimental.
|
|
35
|
+
* @category Network sources
|
|
36
|
+
*/
|
|
37
|
+
export const REST_SOURCE_ID = "rest";
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The OpenAlex preset of the REST mapping source. Experimental.
|
|
41
|
+
* @category Network sources
|
|
42
|
+
*/
|
|
43
|
+
export const OPENALEX_SOURCE_ID = "openalex";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The prefix of the reserved attribute namespace sources and graphty-element write facts under.
|
|
47
|
+
* @category Network sources
|
|
48
|
+
*/
|
|
49
|
+
export const SOURCE_ATTR_PREFIX = "_source.";
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Node attribute: true on a stub, a node known only by its id until it is hydrated or expanded.
|
|
53
|
+
* @category Network sources
|
|
54
|
+
*/
|
|
55
|
+
export const SOURCE_STUB_ATTR = "_source.stub";
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Node attribute: the entity a stub node is (a REST mapping's entity name).
|
|
59
|
+
* @category Network sources
|
|
60
|
+
*/
|
|
61
|
+
export const SOURCE_ENTITY_ATTR = "_source.entity";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Node attribute: the node's degree at the source, when the source returns it at no extra cost
|
|
65
|
+
* (the Cypher source's degree hint).
|
|
66
|
+
* @category Network sources
|
|
67
|
+
*/
|
|
68
|
+
export const SOURCE_DEGREE_ATTR = "_source.degree";
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The prefix of `ImportGraphResult.format` for a load from a source: `"source:<id>"`.
|
|
72
|
+
* @category Network sources
|
|
73
|
+
*/
|
|
74
|
+
export const SOURCE_FORMAT_PREFIX = "source:";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What every NDEx call shares: the checks on the endpoint and the network UUID, and a fetch that
|
|
3
|
+
* classifies NDEx's failures.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { failOn } from "../fail.js";
|
|
7
|
+
import { type SourceContext } from "../types.js";
|
|
8
|
+
|
|
9
|
+
/** An NDEx network UUID. */
|
|
10
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
11
|
+
|
|
12
|
+
/** The query parameter NDEx reads a link-share access key from. */
|
|
13
|
+
export const ACCESS_KEY_QUERY = "accesskey";
|
|
14
|
+
|
|
15
|
+
/** The statuses whose JSON body (NDEx's errorCode) is read; every other failure is classified by status alone. */
|
|
16
|
+
const READ_STATUSES = [401, 403, 404] as const;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Refuse an access key in the endpoint: it belongs in a credential, which is never logged.
|
|
20
|
+
* @param ctx - the context
|
|
21
|
+
*/
|
|
22
|
+
export function checkEndpoint(ctx: SourceContext): void {
|
|
23
|
+
if (ctx.endpoint?.searchParams.has(ACCESS_KEY_QUERY) === true) {
|
|
24
|
+
failOn(ctx.report, "E_SOURCE_PARAM", "an access key goes in a credential, never in the endpoint", {
|
|
25
|
+
name: "endpoint",
|
|
26
|
+
reason: "credentials-in-url",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Check a call's endpoint and network UUID.
|
|
33
|
+
* @param uuid - the network UUID
|
|
34
|
+
* @param ctx - the context
|
|
35
|
+
* @returns the UUID, lowercase and URL-safe
|
|
36
|
+
*/
|
|
37
|
+
export function checkedUuid(uuid: unknown, ctx: SourceContext): string {
|
|
38
|
+
checkEndpoint(ctx);
|
|
39
|
+
const value = String(uuid);
|
|
40
|
+
if (/accesskey/i.test(value)) {
|
|
41
|
+
failOn(ctx.report, "E_SOURCE_PARAM", "an access key goes in a credential, never in the uuid", {
|
|
42
|
+
name: "uuid",
|
|
43
|
+
reason: "credentials-in-url",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (!UUID.test(value)) {
|
|
47
|
+
failOn(ctx.report, "E_SOURCE_PARAM", "the uuid is not a network UUID", { name: "uuid", reason: "format" });
|
|
48
|
+
}
|
|
49
|
+
return value.toLowerCase();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Fetch from NDEx, turning a 401, 403 or 404 into its coded error with NDEx's own errorCode.
|
|
54
|
+
* @param ctx - the context
|
|
55
|
+
* @param path - the path, relative to the endpoint
|
|
56
|
+
* @param uuid - the network the request is about, for E_SOURCE_NOT_FOUND
|
|
57
|
+
* @param init - the request init
|
|
58
|
+
* @returns the response, status 2xx
|
|
59
|
+
*/
|
|
60
|
+
export async function ndexFetch(
|
|
61
|
+
ctx: SourceContext,
|
|
62
|
+
path: string,
|
|
63
|
+
uuid: string | null,
|
|
64
|
+
init: RequestInit & { readonly idempotent?: boolean } = {},
|
|
65
|
+
): Promise<Response> {
|
|
66
|
+
const response = await ctx.fetch(path, { ...init, allowStatus: READ_STATUSES });
|
|
67
|
+
if (response.ok) {
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
const url = new URL(path, ctx.endpoint ?? undefined);
|
|
71
|
+
const serverCode = await errorCode(response);
|
|
72
|
+
const { status } = response;
|
|
73
|
+
if (status === 401) {
|
|
74
|
+
failOn(ctx.report, "E_SOURCE_AUTH", `NDEx answered ${String(status)}`, {
|
|
75
|
+
origin: url.origin,
|
|
76
|
+
status,
|
|
77
|
+
scheme: response.headers.get("www-authenticate")?.split(/\s/)[0] ?? null,
|
|
78
|
+
serverCode,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (status === 403) {
|
|
82
|
+
failOn(ctx.report, "E_SOURCE_FORBIDDEN", "NDEx answered 403", { status, serverCode });
|
|
83
|
+
}
|
|
84
|
+
return failOn(ctx.report, "E_SOURCE_NOT_FOUND", "NDEx has no such network", {
|
|
85
|
+
what: uuid === null ? "url" : "network",
|
|
86
|
+
value: uuid ?? `${url.origin}${url.pathname}`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* NDEx's own error code from a JSON error body, never its message or stack trace.
|
|
92
|
+
* @param response - the failed response
|
|
93
|
+
* @returns the code, or null
|
|
94
|
+
*/
|
|
95
|
+
async function errorCode(response: Response): Promise<string | null> {
|
|
96
|
+
try {
|
|
97
|
+
const body = (await response.json()) as { errorCode?: unknown };
|
|
98
|
+
return typeof body.errorCode === "string" ? body.errorCode.slice(0, 100) : null;
|
|
99
|
+
} catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NDEx source's descriptor: catalog data, available without loading the source's code.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { type SourceDescriptor, type SourceSample } from "../types.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* One public NDEx network offered as a sample.
|
|
9
|
+
* @param id - the sample id
|
|
10
|
+
* @param plainName - its name
|
|
11
|
+
* @param uuid - the network UUID
|
|
12
|
+
* @param nodes - its node count
|
|
13
|
+
* @param edges - its edge count
|
|
14
|
+
* @returns the sample
|
|
15
|
+
*/
|
|
16
|
+
function sample(id: string, plainName: string, uuid: string, nodes: number, edges: number): SourceSample {
|
|
17
|
+
return { id, plainName, params: { uuid }, counts: { nodes, edges } };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The descriptor of the `ndex` source. Experimental.
|
|
22
|
+
* @category Network sources
|
|
23
|
+
*/
|
|
24
|
+
export const NDEX_DESCRIPTOR: SourceDescriptor = Object.freeze({
|
|
25
|
+
plainName: "NDEx",
|
|
26
|
+
kind: "repository",
|
|
27
|
+
version: 1,
|
|
28
|
+
defaultEndpoint: "https://www.ndexbio.org/",
|
|
29
|
+
auth: ["basic", "bearer", "api-key"],
|
|
30
|
+
authRequired: "optional",
|
|
31
|
+
rateLimit: { requests: 50, perMs: 1000, concurrent: 4 },
|
|
32
|
+
params: [
|
|
33
|
+
{ name: "uuid", plainName: "Network UUID", type: "string", required: true },
|
|
34
|
+
{
|
|
35
|
+
name: "format",
|
|
36
|
+
plainName: "Format",
|
|
37
|
+
type: "enum",
|
|
38
|
+
default: "cx2",
|
|
39
|
+
advanced: true,
|
|
40
|
+
values: [
|
|
41
|
+
{ value: "cx2", label: "CX2" },
|
|
42
|
+
{ value: "cx", label: "CX" },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{ name: "idAttribute", plainName: "Id attribute", type: "string", advanced: true },
|
|
46
|
+
],
|
|
47
|
+
features: ["probe", "list", "expand", "validate"],
|
|
48
|
+
samples: [
|
|
49
|
+
sample("ndex-wp5483", "WikiPathways WP5483", "86719f5b-1439-11f0-9806-005056ae3c32", 57, 34),
|
|
50
|
+
sample("ndex-nci-pid", "NCI PID cancer signaling", "640e2cef-795d-11e8-a4bf-0ac135e8bacf", 2794, 25296),
|
|
51
|
+
sample("ndex-huri", "HuRI human interactome", "73bc2c06-5fb2-11e9-9f06-0ac135e8bacf", 8275, 52569),
|
|
52
|
+
sample("ndex-signor", "Signor", "523fff27-afe8-11e9-8bb4-0ac135e8bacf", 10339, 33381),
|
|
53
|
+
sample("ndex-dgidb", "DGIdb drugs and target genes", "7e5e64ff-f6cf-11ea-99da-0ac135e8bacf", 12100, 32814),
|
|
54
|
+
sample(
|
|
55
|
+
"ndex-wikipathways-landscape",
|
|
56
|
+
"WikiPathways landscape",
|
|
57
|
+
"2b3ed6af-5031-11eb-9e72-0ac135e8bacf",
|
|
58
|
+
32077,
|
|
59
|
+
74109,
|
|
60
|
+
),
|
|
61
|
+
// 3.3 million edges and a 690 MB download: offered for neighborhoods, and as a maxBytes test
|
|
62
|
+
{ ...sample("ndex-pcnet", "PCNet 2.2", "8b4b54fa-e87d-11ee-9621-005056ae23aa", 18558, 3323928), whole: false },
|
|
63
|
+
],
|
|
64
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NDEx source's expand: NDEx's neighborhood query (`POST /v2/search/network/{uuid}/query`),
|
|
3
|
+
* which answers CX1, read by the CX importer. Seeds are node ids, sent as `nodeIds`; NDEx's CX1
|
|
4
|
+
* answer keeps the ids of the CX2 download (checked on 2026-10-17), so an expansion merges into a
|
|
5
|
+
* loaded network by id. With `idAttribute`, seeds are values of that node attribute instead,
|
|
6
|
+
* matched by NDEx's node search.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { type GraphSink } from "@graphty/graph-format";
|
|
10
|
+
|
|
11
|
+
import { cxImporter } from "../../formats/cx/importer.js";
|
|
12
|
+
import { type ImportReport } from "../../types.js";
|
|
13
|
+
import { failOn } from "../fail.js";
|
|
14
|
+
import { type ExpandRequest, type SourceContext } from "../types.js";
|
|
15
|
+
import { checkedUuid, ndexFetch } from "./client.js";
|
|
16
|
+
import { type NdexParams } from "./params.js";
|
|
17
|
+
|
|
18
|
+
/** The deepest neighborhood asked for, as for every built-in source. */
|
|
19
|
+
const MAX_DEPTH = 10;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Quote a value for NDEx's search syntax.
|
|
23
|
+
* @param value - the value
|
|
24
|
+
* @returns the quoted term
|
|
25
|
+
*/
|
|
26
|
+
function term(value: string): string {
|
|
27
|
+
const escaped = value.replaceAll(/["\\]/g, String.raw`\$&`);
|
|
28
|
+
return `"${escaped}"`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The query body: the seeds as node ids, or as values of `idAttribute`.
|
|
33
|
+
* @param request - the expand request
|
|
34
|
+
* @param ctx - the context
|
|
35
|
+
* @returns the body NDEx's query takes
|
|
36
|
+
*/
|
|
37
|
+
function queryBody(request: ExpandRequest<NdexParams>, ctx: SourceContext): Record<string, unknown> {
|
|
38
|
+
const { ids } = request;
|
|
39
|
+
const { idAttribute } = request.params;
|
|
40
|
+
const depth = request.depth ?? 1;
|
|
41
|
+
if (!Number.isInteger(depth) || depth < 1 || depth > MAX_DEPTH) {
|
|
42
|
+
failOn(ctx.report, "E_SOURCE_PARAM", "depth is an integer from 1 to 10", { name: "depth", reason: "range" });
|
|
43
|
+
}
|
|
44
|
+
if (ids.length === 0) {
|
|
45
|
+
failOn(ctx.report, "E_SOURCE_PARAM", "an expansion needs at least one id", { name: "ids", reason: "required" });
|
|
46
|
+
}
|
|
47
|
+
const limit = request.limit === undefined ? {} : { edgeLimit: request.limit, errorWhenLimitIsOver: false };
|
|
48
|
+
if (idAttribute !== undefined) {
|
|
49
|
+
if (!/^[A-Za-z_][\w.]*$/.test(idAttribute)) {
|
|
50
|
+
failOn(ctx.report, "E_SOURCE_PARAM", "idAttribute is not an attribute name", {
|
|
51
|
+
name: "idAttribute",
|
|
52
|
+
reason: "identifier",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const searchString = ids.map((id) => `${idAttribute}:${term(String(id))}`).join(" ");
|
|
56
|
+
return { searchString, searchDepth: depth, ...limit };
|
|
57
|
+
}
|
|
58
|
+
const nodeIds = ids.map(Number);
|
|
59
|
+
if (nodeIds.some((n) => !Number.isSafeInteger(n))) {
|
|
60
|
+
failOn(ctx.report, "E_SOURCE_PARAM", "NDEx node ids are integers; set idAttribute to seed by name", {
|
|
61
|
+
name: "ids",
|
|
62
|
+
reason: "type",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return { searchString: "", searchDepth: depth, nodeIds, ...limit };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Fetch the neighborhood of some nodes of an NDEx network into a sink.
|
|
70
|
+
* @param request - the seeds, depth and limit; `limit` caps the edges NDEx returns
|
|
71
|
+
* @param sink - where to write
|
|
72
|
+
* @param ctx - the context
|
|
73
|
+
* @returns the report
|
|
74
|
+
*/
|
|
75
|
+
export async function expandNdex(
|
|
76
|
+
request: ExpandRequest<NdexParams>,
|
|
77
|
+
sink: GraphSink,
|
|
78
|
+
ctx: SourceContext,
|
|
79
|
+
): Promise<ImportReport> {
|
|
80
|
+
const uuid = checkedUuid(request.params.uuid, ctx);
|
|
81
|
+
if (request.direction !== undefined && request.direction !== "both") {
|
|
82
|
+
failOn(ctx.report, "E_SOURCE_UNSUPPORTED", "NDEx expands in both directions only", {
|
|
83
|
+
feature: "direction",
|
|
84
|
+
needs: "both",
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if ((request.relationshipTypes ?? []).length > 0) {
|
|
88
|
+
failOn(ctx.report, "E_SOURCE_UNSUPPORTED", "NDEx cannot filter an expansion by relationship type", {
|
|
89
|
+
feature: "relationshipTypes",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const response = await ndexFetch(ctx, `v2/search/network/${uuid}/query`, uuid, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
idempotent: true,
|
|
95
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
96
|
+
body: JSON.stringify(queryBody(request, ctx)),
|
|
97
|
+
});
|
|
98
|
+
ctx.report.include(await cxImporter.import(response.body ?? "", sink, { signal: ctx.signal }));
|
|
99
|
+
return ctx.finish();
|
|
100
|
+
}
|