@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 @@
|
|
|
1
|
+
{"version":3,"file":"context-cgmmOxZ2.js","sources":["../../src/sources/context.ts"],"sourcesContent":["/**\n * The source context (design sections 2.1, 6.2, 7.2 and 9): the guarded `ctx.fetch` every source\n * reads through. It applies the credential only to the origins it is bound to, refuses credentials\n * in clear text and across redirects, retries what HTTP says is safe to retry, paces requests,\n * enforces the caps, counts decoded bytes, times the load out and turns every failure into a coded\n * issue. A source never sees the credential.\n */\n\nimport { throwIfAborted } from \"../common/input.js\";\nimport { type ImportReportBuilder } from \"../common/report.js\";\nimport { type ImportReport } from \"../types.js\";\nimport { type SourceBlockedCause } from \"./codes.js\";\nimport { applyCredential, originOf } from \"./credentials.js\";\nimport { failOn, warnOn } from \"./fail.js\";\nimport {\n type Credential,\n type LoadFromSourceOptions,\n type SourceContext,\n type SourceCursor,\n type SourceDescriptor,\n type SourceFinish,\n type SourceLimitOptions,\n type SourceLimits,\n type SourceReportInfo,\n type SourceRequestInit,\n type SourceRuntime,\n} from \"./types.js\";\n\n/** Statuses HTTP says a client may retry. */\nconst RETRY_STATUSES: ReadonlySet<number> = new Set([429, 502, 503, 504]);\n\n/** Statuses whose response has no body by definition. */\nconst NULL_BODY_STATUSES: ReadonlySet<number> = new Set([101, 204, 205, 304]);\n\n/** Redirect statuses. */\nconst REDIRECT_STATUSES: ReadonlySet<number> = new Set([301, 302, 303, 307, 308]);\n\n/** Same-origin redirects followed with a credential before giving up. */\nconst MAX_REDIRECTS = 5;\n\n/**\n * Thrown inside a load when a cap stops it under `onLimit: \"stop\"`; the runner catches it, keeps\n * what came first and records where to resume. Never leaves graph-io.\n */\nexport class LimitStop extends Error {\n /**\n * Create one.\n * @param limit - the cap's option name\n * @param value - the value that reached it\n */\n constructor(\n readonly limit: string,\n readonly value: number,\n ) {\n super(`${limit} reached at ${String(value)}`);\n this.name = \"LimitStop\";\n }\n}\n\n/**\n * Where code is running. Node is checked first, since a test may stub a `document`.\n * @returns the runtime\n */\nexport function detectRuntime(): SourceRuntime {\n const g = globalThis as {\n process?: { versions?: { node?: unknown } };\n importScripts?: unknown;\n window?: unknown;\n document?: unknown;\n };\n if (typeof g.process?.versions?.node === \"string\") {\n return \"node\";\n }\n if (typeof g.importScripts === \"function\") {\n return \"worker\";\n }\n return g.window !== undefined && g.document !== undefined ? \"browser\" : \"other\";\n}\n\n/**\n * A URL as reports show it: origin and path, never the query string.\n * @param url - the URL\n * @returns origin plus path\n */\nfunction originPath(url: URL): string {\n return `${originOf(url)}${url.pathname}`;\n}\n\n/**\n * Whether a host is this machine.\n * @param hostname - the URL's hostname\n * @returns true for localhost, 127.0.0.0/8 and ::1\n */\nexport function isLoopback(hostname: string): boolean {\n const host = hostname.replaceAll(/(?:^\\[)|(?:\\]$)/g, \"\").toLowerCase();\n return host === \"localhost\" || host.endsWith(\".localhost\") || /^127(\\.\\d{1,3}){3}$/.test(host) || host === \"::1\";\n}\n\n/**\n * Whether a host is on a local network: loopback, private IPv4 ranges, link-local, unique local\n * IPv6 or an mDNS `.local` name.\n * @param hostname - the URL's hostname\n * @returns true for a local-network host\n */\nexport function isLocalNetwork(hostname: string): boolean {\n const host = hostname.replaceAll(/(?:^\\[)|(?:\\]$)/g, \"\").toLowerCase();\n return (\n isLoopback(host) ||\n host.endsWith(\".local\") ||\n /^10(\\.\\d{1,3}){3}$/.test(host) ||\n /^192\\.168(\\.\\d{1,3}){2}$/.test(host) ||\n /^169\\.254(\\.\\d{1,3}){2}$/.test(host) ||\n /^172\\.(1[6-9]|2\\d|3[01])(\\.\\d{1,3}){2}$/.test(host) ||\n /^f[cd][0-9a-f]{2}:/.test(host) ||\n host.startsWith(\"fe80:\")\n );\n}\n\n/** Requests in flight and recently sent, per source and origin, for `descriptor.rateLimit`. */\ninterface Pacer {\n active: number;\n times: number[];\n readonly waiters: (() => void)[];\n}\n\n/** One pacer per source id and origin, shared by every load in this process. */\nconst PACERS = new Map<string, Pacer>();\n\n/** What the runner reads back from a context after a load. */\nexport interface ContextState {\n /** Requests sent. */\n requests: number;\n /** Decoded response bytes read. */\n bytes: number;\n /** What the source passed to finish(). */\n finish: SourceFinish | null;\n}\n\n/** What createSourceContext() needs. */\ninterface ContextInput {\n /** The source id. */\n readonly id: string;\n /** The source's descriptor, if it has one. */\n readonly descriptor: SourceDescriptor | undefined;\n /** The caller's options. */\n readonly options: LoadFromSourceOptions;\n /** The load's report. */\n readonly report: ImportReportBuilder;\n /** The resolved endpoint. */\n readonly endpoint: URL | null;\n /** The cursor the source sees (version stripped). */\n readonly cursor: SourceCursor | null;\n /** What progress counts: \"bytes\" for a file source, \"items\" otherwise. */\n readonly unit: \"items\" | \"bytes\";\n /** What the sink has received so far. */\n readonly counts: () => { readonly nodes: number; readonly edges: number };\n /** The runtime to act as; detected when absent (tests set it). */\n readonly runtime?: SourceRuntime | undefined;\n}\n\n/** A context and what the runner needs to close it. */\nexport interface CreatedContext {\n /** The context handed to the source. */\n readonly ctx: SourceContext;\n /** Counters the runner reads. */\n readonly state: ContextState;\n /**\n * The report's `source` member as it stands.\n * @param next - where to resume\n * @returns the info\n */\n info(next: SourceCursor | null): SourceReportInfo;\n /** Clear the timeout and detach from the caller's signal. */\n dispose(): void;\n}\n\n/**\n * Wait, unless the signal aborts first.\n * @param ms - milliseconds\n * @param signal - the signal\n * @returns a promise that settles after the wait\n */\nexport function sleep(ms: number, signal: AbortSignal): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (signal.aborted) {\n reject(signal.reason as Error);\n return;\n }\n const onAbort = (): void => {\n clearTimeout(timer);\n reject(signal.reason as Error);\n };\n const timer = setTimeout(() => {\n signal.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n signal.addEventListener(\"abort\", onAbort, { once: true });\n });\n}\n\n/**\n * The milliseconds a readable Retry-After header asks for.\n * @param response - the response\n * @returns milliseconds, or null when absent or unreadable\n */\nfunction retryAfterMs(response: Response): number | null {\n const value = response.headers.get(\"retry-after\");\n if (value === null) {\n return null;\n }\n const seconds = Number(value);\n if (Number.isFinite(seconds)) {\n return Math.max(0, seconds * 1000);\n }\n const date = Date.parse(value);\n return Number.isNaN(date) ? null : Math.max(0, date - Date.now());\n}\n\n/**\n * The origins a credential goes to: its own, else the endpoint's.\n * @param credential - the credential, if any\n * @param endpoint - the endpoint, if any\n * @returns the origins\n */\nfunction boundOrigins(credential: Credential | undefined, endpoint: URL | null): readonly string[] {\n if (credential === undefined) {\n return [];\n }\n if (credential.origins.length > 0) {\n return credential.origins;\n }\n return endpoint === null ? [] : [originOf(endpoint)];\n}\n\n/** The retry settings, resolved. */\ninterface RetrySettings {\n readonly retries: number;\n readonly baseDelayMs: number;\n readonly maxDelayMs: number;\n}\n\n/**\n * The machinery behind one context: the guarded fetch, the caps, pacing, the timeout and the\n * counters.\n */\nclass SourceFetcher {\n readonly state: ContextState = { requests: 0, bytes: 0, finish: null };\n readonly signal: AbortSignal;\n readonly runtime: SourceRuntime;\n private readonly controller = new AbortController();\n private readonly fetchImpl: typeof fetch;\n private readonly limitOptions: SourceLimitOptions;\n private readonly retry: RetrySettings;\n private readonly credentialOrigins: readonly string[];\n private readonly warnedLimits = new Set<string>();\n private readonly timer: ReturnType<typeof setTimeout> | undefined;\n private byteTotal: number | undefined;\n\n /**\n * Set up one call.\n * @param input - the source, options, report and counters\n */\n constructor(private readonly input: ContextInput) {\n const { options, endpoint } = input;\n this.runtime = input.runtime ?? detectRuntime();\n this.fetchImpl = options.fetch ?? ((...args) => globalThis.fetch(...args));\n this.limitOptions = options.limits ?? {};\n const retry = options.retry === false ? { retries: 0 } : (options.retry ?? {});\n this.retry = {\n retries: retry.retries ?? 3,\n baseDelayMs: retry.baseDelayMs ?? 500,\n maxDelayMs: retry.maxDelayMs ?? 30_000,\n };\n this.credentialOrigins = boundOrigins(options.credential, endpoint);\n // one controller for the caller's signal and the load timeout; its reason is what rejects\n const callerSignal = options.signal;\n if (callerSignal?.aborted === true) {\n this.controller.abort(callerSignal.reason);\n } else {\n callerSignal?.addEventListener(\"abort\", this.onCallerAbort, { once: true });\n }\n const { timeoutMs } = this.limitOptions;\n this.timer =\n timeoutMs === undefined\n ? undefined\n : setTimeout(() => {\n this.timeOut(timeoutMs);\n }, timeoutMs);\n this.signal = this.controller.signal;\n }\n\n /** Clear the timeout and detach from the caller's signal. */\n dispose(): void {\n clearTimeout(this.timer);\n this.input.options.signal?.removeEventListener(\"abort\", this.onCallerAbort);\n }\n\n /** Forward the caller's abort, with its reason. */\n private readonly onCallerAbort = (): void => {\n this.controller.abort(this.input.options.signal?.reason);\n };\n\n /**\n * Abort the load with E_SOURCE_TIMEOUT as the reason.\n * @param timeoutMs - the limit that passed\n */\n private timeOut(timeoutMs: number): void {\n try {\n failOn(this.input.report, \"E_SOURCE_TIMEOUT\", `the load ran longer than ${String(timeoutMs)} ms`, {\n timeoutMs,\n serverSide: false,\n });\n } catch (err) {\n this.controller.abort(err);\n }\n }\n\n /**\n * A cap was reached: fail under \"error\", else warn once and stop.\n * @param limit - the option name\n * @param value - the value reached\n */\n limitHit(limit: string, value: number): never {\n const { report } = this.input;\n if ((this.limitOptions.onLimit ?? \"stop\") === \"error\") {\n failOn(report, \"E_SOURCE_LIMIT\", `${limit} of ${String(value)} reached`, { limit, value });\n }\n if (!this.warnedLimits.has(limit)) {\n this.warnedLimits.add(limit);\n warnOn(report, \"W_SOURCE_LIMIT\", `${limit} reached at ${String(value)}; what came first is kept`, {\n limit,\n value,\n });\n }\n throw new LimitStop(limit, value);\n }\n\n /**\n * Whether a cap is reached; warns once under \"stop\", throws under \"error\".\n * @returns true when the source should stop\n */\n reached(): boolean {\n const { nodes, edges } = this.input.counts();\n const caps: [string, number, number | undefined][] = [\n [\"maxNodes\", nodes, this.limitOptions.maxNodes],\n [\"maxEdges\", edges, this.limitOptions.maxEdges],\n [\"maxBytes\", this.state.bytes, this.limitOptions.maxBytes],\n [\"maxRequests\", this.state.requests, this.limitOptions.maxRequests],\n ];\n const hit = caps.find(([, value, cap]) => cap !== undefined && value >= cap);\n if (hit === undefined) {\n return false;\n }\n try {\n this.limitHit(hit[0], hit[1]);\n } catch (err) {\n if (!(err instanceof LimitStop)) {\n throw err;\n }\n }\n return true;\n }\n\n /**\n * Report progress.\n * @param done - how much is done\n * @param total - the total, when known\n * @param unit - what is counted\n */\n progress(done: number, total?: number, unit: \"items\" | \"bytes\" = \"items\"): void {\n if (unit === \"bytes\") {\n this.byteTotal = total;\n }\n this.input.options.onProgress?.(done, total, unit);\n }\n\n /**\n * Resolve a request URL against the endpoint and refuse what must never be sent.\n * @param target - the source's URL\n * @returns the absolute URL\n */\n private resolve(target: string | URL): URL {\n const { report, endpoint } = this.input;\n let url: URL;\n try {\n url = endpoint === null ? new URL(target) : new URL(target, endpoint);\n } catch {\n return failOn(report, \"E_SOURCE_PARAM\", \"a relative URL needs an endpoint\", {\n name: \"endpoint\",\n reason: \"missing\",\n });\n }\n if (url.username !== \"\" || url.password !== \"\") {\n failOn(report, \"E_SOURCE_PARAM\", \"a URL may not carry a user name or password\", {\n name: \"endpoint\",\n reason: \"credentials-in-url\",\n });\n }\n const page = (globalThis as { location?: { protocol?: string } }).location;\n const plain = url.protocol === \"http:\" || url.protocol === \"ws:\";\n if (this.runtime === \"browser\" && page?.protocol === \"https:\" && plain && !isLoopback(url.hostname)) {\n failOn(report, \"E_SOURCE_RUNTIME\", \"an https page cannot reach a plain http endpoint\", {\n runtime: this.runtime,\n reason: \"insecure-endpoint\",\n });\n }\n return url;\n }\n\n /**\n * Wait for a slot under the descriptor's rate limit.\n * @param url - the request URL\n * @returns a release function\n */\n private async pace(url: URL): Promise<() => void> {\n const rate = this.input.descriptor?.rateLimit;\n if (rate === undefined) {\n return () => undefined;\n }\n const key = `${this.input.id} ${originOf(url)}`;\n const p = PACERS.get(key) ?? { active: 0, times: [], waiters: [] };\n PACERS.set(key, p);\n for (;;) {\n const now = Date.now();\n p.times = p.times.filter((t) => now - t < rate.perMs);\n if (rate.concurrent !== undefined && p.active >= rate.concurrent) {\n await new Promise<void>((r) => p.waiters.push(r));\n } else if (p.times.length >= rate.requests) {\n await sleep(Math.max(1, rate.perMs - (now - p.times[0])), this.signal);\n } else {\n p.times.push(now);\n p.active++;\n return () => {\n p.active--;\n p.waiters.shift()?.();\n };\n }\n }\n }\n\n /**\n * Count the decoded bytes of a body as it is read, against `maxBytes`.\n * @param response - the response\n * @returns the response, with a counted body\n */\n private counted(response: Response): Response {\n if (response.body === null || NULL_BODY_STATUSES.has(response.status)) {\n return response;\n }\n const counter = new TransformStream<Uint8Array, Uint8Array>({\n transform: (chunk, ctrl): void => {\n this.state.bytes += chunk.byteLength;\n const cap = this.limitOptions.maxBytes;\n if (cap !== undefined && this.state.bytes > cap) {\n this.limitHit(\"maxBytes\", this.state.bytes);\n }\n if (this.input.unit === \"bytes\") {\n this.input.options.onProgress?.(this.state.bytes, this.byteTotal, \"bytes\");\n }\n ctrl.enqueue(chunk);\n },\n });\n return new Response(response.body.pipeThrough(counter), {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n }\n\n /**\n * Raise the coded issue of a status outside 200 to 299.\n * @param response - the response\n * @param url - the request URL\n * @returns never; it throws\n */\n private async statusFailure(response: Response, url: URL): Promise<never> {\n await response.body?.cancel().catch(() => undefined);\n const { report } = this.input;\n const { status } = response;\n const where = originPath(url);\n switch (status) {\n case 401:\n return failOn(report, \"E_SOURCE_AUTH\", `${where} answered 401`, {\n origin: originOf(url),\n status,\n scheme: response.headers.get(\"www-authenticate\")?.split(/\\s/)[0] ?? null,\n serverCode: null,\n });\n case 403:\n return failOn(report, \"E_SOURCE_FORBIDDEN\", `${where} answered 403`, { status, serverCode: null });\n case 404:\n return failOn(report, \"E_SOURCE_NOT_FOUND\", `${where} answered 404`, { what: \"url\", value: where });\n case 429:\n return failOn(report, \"E_SOURCE_QUOTA\", `${where} answered 429`, {\n retryAfterMs: retryAfterMs(response),\n });\n default:\n return failOn(report, \"E_FETCH\", `${where} answered ${String(status)}`, { url: where, status });\n }\n }\n\n /**\n * Build one request, with the credential when the URL's origin is bound.\n * @param url - the request URL\n * @param init - the source's init\n * @param attach - whether the credential goes with it\n * @returns the request\n */\n private async request(url: URL, init: SourceRequestInit, attach: boolean): Promise<Request> {\n const { options, report } = this.input;\n const headers = new Headers(init.headers);\n if (options.userAgent !== undefined && this.runtime === \"node\") {\n headers.set(\"User-Agent\", options.userAgent);\n }\n const { retry: _retry, idempotent: _idempotent, allowStatus: _allowStatus, ...requestInit } = init;\n const guarded: RequestInit = {\n cache: \"no-store\",\n credentials: \"omit\",\n redirect: this.runtime === \"browser\" ? \"error\" : \"manual\",\n };\n const request = new Request(url, { ...requestInit, headers, signal: this.signal, ...(attach ? guarded : {}) });\n if (!attach || options.credential === undefined) {\n return request;\n }\n const signed = await applyCredential(options.credential, request);\n const after = new URL(signed.url);\n if (originOf(after) !== originOf(url)) {\n failOn(report, \"E_SOURCE_REDIRECT\", \"the credential changed the request's origin\", {\n from: originPath(url),\n to: originPath(after),\n });\n }\n return signed;\n }\n\n /**\n * Send one request, following same-origin redirects by hand while a credential is attached.\n * @param url - the request URL\n * @param init - the source's init\n * @param hops - redirects followed so far\n * @returns the response\n */\n private async send(url: URL, init: SourceRequestInit, hops: number): Promise<Response> {\n const { options, report } = this.input;\n const attach = options.credential !== undefined && this.credentialOrigins.includes(originOf(url));\n const plain = url.protocol === \"http:\" || url.protocol === \"ws:\";\n if (attach && plain && !isLoopback(url.hostname) && options.allowInsecure !== true) {\n failOn(report, \"E_SOURCE_PARAM\", \"a credential is never sent without TLS\", {\n name: \"endpoint\",\n reason: \"insecure-endpoint\",\n });\n }\n const request = await this.request(url, init, attach);\n this.state.requests++;\n const response = await this.fetchImpl(request);\n if (!attach || !REDIRECT_STATUSES.has(response.status)) {\n return response;\n }\n const location = response.headers.get(\"location\");\n await response.body?.cancel().catch(() => undefined);\n const to = location === null ? null : new URL(location, url);\n if (to === null || originOf(to) !== originOf(url) || hops >= MAX_REDIRECTS) {\n return failOn(report, \"E_SOURCE_REDIRECT\", \"a redirect while a credential was attached\", {\n from: originPath(url),\n to: to === null ? null : originPath(to),\n });\n }\n return this.send(to, response.status === 303 ? { ...init, method: \"GET\", body: null } : init, hops + 1);\n }\n\n /**\n * Whether a browser refused a credentialed request because it was redirected (sent with\n * `redirect: \"error\"`, which fails like a CORS refusal): the same URL once more, WITHOUT the\n * credential, under `redirect: \"manual\"`, whose answer to a redirect is an opaque redirect.\n * @param url - the refused URL\n * @returns true when the URL answers with a redirect\n */\n private async redirects(url: URL): Promise<boolean> {\n if (this.input.options.retry === false) {\n return false;\n }\n try {\n const response = await this.fetchImpl(url, {\n method: \"GET\",\n redirect: \"manual\",\n credentials: \"omit\",\n cache: \"no-store\",\n signal: this.signal,\n });\n await response.body?.cancel().catch(() => undefined);\n return response.type === \"opaqueredirect\";\n } catch {\n throwIfAborted(this.signal);\n return false;\n }\n }\n\n /**\n * Why the browser refused a request: one bodyless no-cors GET of the origin's root.\n * @param url - the refused URL\n * @returns the cause\n */\n private async diagnose(url: URL): Promise<SourceBlockedCause> {\n const page = (globalThis as { location?: { hostname?: string } }).location;\n if (page?.hostname !== undefined && !isLocalNetwork(page.hostname) && isLocalNetwork(url.hostname)) {\n return \"local-network\";\n }\n if (this.input.options.retry === false) {\n return \"unknown\";\n }\n try {\n await this.fetchImpl(`${originOf(url)}/`, {\n mode: \"no-cors\",\n method: \"GET\",\n credentials: \"omit\",\n cache: \"no-store\",\n signal: this.signal,\n });\n return \"cors\";\n } catch {\n throwIfAborted(this.signal);\n return \"unreachable\";\n }\n }\n\n /**\n * A full-jitter backoff delay.\n * @param attempt - the attempt that failed, from 0\n * @returns milliseconds\n */\n private backoff(attempt: number): number {\n const jitter = Math.random(); // NOSONAR(S2245): retry jitter, not a security value\n return jitter * Math.min(this.retry.maxDelayMs, this.retry.baseDelayMs * 2 ** attempt);\n }\n\n /**\n * What a network failure becomes: a retry (true), or the coded issue.\n * @param err - what fetch threw\n * @param url - the request URL\n * @param attempt - the attempt, from 0\n * @param tries - the retries allowed\n * @param statuses - the statuses seen so far\n * @param probeRedirect - whether a refused redirect may explain it (a credentialed GET or HEAD)\n * @returns true to retry\n */\n private async networkFailure(\n err: unknown,\n url: URL,\n attempt: number,\n tries: number,\n statuses: (number | null)[],\n probeRedirect: boolean,\n ): Promise<boolean> {\n throwIfAborted(this.signal);\n if (!(err instanceof TypeError)) {\n throw err;\n }\n const { report } = this.input;\n statuses.push(null);\n if (this.runtime === \"browser\") {\n if (probeRedirect && (await this.redirects(url))) {\n return failOn(report, \"E_SOURCE_REDIRECT\", \"a redirect while a credential was attached\", {\n from: originPath(url),\n to: null,\n });\n }\n const cause = await this.diagnose(url);\n // a hidden 429 looks like a CORS refusal, so that one cause is retried once\n if (cause === \"cors\" && attempt === 0 && tries > 0) {\n await sleep(this.backoff(0), this.signal);\n return true;\n }\n return failOn(report, \"E_SOURCE_BLOCKED\", `the browser refused ${originPath(url)}`, {\n url: originPath(url),\n cause,\n });\n }\n if (attempt < tries) {\n await sleep(this.backoff(attempt), this.signal);\n return true;\n }\n return failOn(report, \"E_FETCH\", `${originPath(url)} could not be reached`, {\n url: originPath(url),\n status: null,\n });\n }\n\n /**\n * Send one attempt under the request cap and the rate limit.\n * @param url - the request URL\n * @param init - the source's init\n * @param attempt - the attempt, from 0\n * @param tries - the retries allowed\n * @param statuses - the statuses seen so far\n * @returns the response, or null to try again\n */\n private async attempt(\n url: URL,\n init: SourceRequestInit,\n attempt: number,\n tries: number,\n statuses: (number | null)[],\n ): Promise<Response | null> {\n const cap = this.limitOptions.maxRequests;\n if (cap !== undefined && this.state.requests >= cap) {\n this.limitHit(\"maxRequests\", this.state.requests);\n }\n const release = await this.pace(url);\n try {\n return await this.send(url, init, 0);\n } catch (err) {\n const method = (init.method ?? \"GET\").toUpperCase();\n const credentialed =\n this.input.options.credential !== undefined && this.credentialOrigins.includes(originOf(url));\n await this.networkFailure(\n err,\n url,\n attempt,\n tries,\n statuses,\n credentialed && (method === \"GET\" || method === \"HEAD\"),\n );\n return null;\n } finally {\n release();\n }\n }\n\n /**\n * The guarded fetch handed to sources.\n * @param target - the URL, relative to the endpoint or absolute\n * @param init - fetch's init and the source options\n * @returns the response\n */\n async fetch(target: string | URL, init: SourceRequestInit = {}): Promise<Response> {\n throwIfAborted(this.signal);\n const url = this.resolve(target);\n const method = (init.method ?? \"GET\").toUpperCase();\n const idempotent = method === \"GET\" || method === \"HEAD\" || init.idempotent === true;\n const tries = init.retry === false || !idempotent ? 0 : this.retry.retries;\n const statuses: (number | null)[] = [];\n for (let attempt = 0; ; attempt++) {\n const response = await this.attempt(url, init, attempt, tries, statuses);\n if (response === null) {\n continue;\n }\n if (!RETRY_STATUSES.has(response.status) || attempt >= tries) {\n return this.settle(response, url, init, attempt, statuses);\n }\n statuses.push(response.status);\n const asked = retryAfterMs(response);\n await response.body?.cancel().catch(() => undefined);\n await sleep(asked === null ? this.backoff(attempt) : Math.min(asked, this.retry.maxDelayMs), this.signal);\n }\n }\n\n /**\n * What a fetch returns: a retried success warned, a failing status raised, the body counted.\n * @param response - the response\n * @param url - the request URL\n * @param init - the source's init\n * @param attempt - the attempt, from 0\n * @param statuses - the statuses retried before it\n * @returns the counted response\n */\n private settle(\n response: Response,\n url: URL,\n init: SourceRequestInit,\n attempt: number,\n statuses: readonly (number | null)[],\n ): Response | Promise<never> {\n if (statuses.length > 0 && response.ok) {\n const attempts = attempt + 1;\n warnOn(\n this.input.report,\n \"W_SOURCE_RETRIED\",\n `${originPath(url)} answered after ${String(attempts)} attempts`,\n {\n attempts,\n statuses,\n },\n );\n }\n if (!response.ok && response.status !== 304 && !(init.allowStatus ?? []).includes(response.status)) {\n return this.statusFailure(response, url);\n }\n return this.counted(response);\n }\n\n /**\n * Fetch and parse JSON.\n * @param target - the URL\n * @param init - the request init\n * @returns the parsed body\n */\n async fetchJson<T>(target: string | URL, init: SourceRequestInit = {}): Promise<T> {\n const headers = new Headers(init.headers);\n if (!headers.has(\"accept\")) {\n headers.set(\"Accept\", \"application/json\");\n }\n const response = await this.fetch(target, { ...init, headers });\n let text: string;\n try {\n text = await response.text();\n } catch (err) {\n throwIfAborted(this.signal);\n throw err;\n }\n try {\n return JSON.parse(text) as T;\n } catch {\n return failOn(this.input.report, \"E_SOURCE_RESPONSE\", \"the response is not JSON\", {\n expected: \"json\",\n contentType: response.headers.get(\"content-type\"),\n });\n }\n }\n\n /**\n * The report's `source` member as it stands.\n * @param next - where to resume\n * @returns the info\n */\n info(next: SourceCursor | null): SourceReportInfo {\n const { finish } = this.state;\n const { id, descriptor, endpoint } = this.input;\n return Object.freeze({\n id,\n version: descriptor?.version ?? 1,\n endpoint: endpoint === null ? null : originPath(endpoint),\n requests: this.state.requests,\n bytes: this.state.bytes,\n next,\n ...(finish?.server === undefined ? {} : { server: finish.server }),\n ...(finish?.budget === undefined ? {} : { budget: finish.budget }),\n ...(finish?.validators === undefined ? {} : { validators: finish.validators }),\n });\n }\n}\n\n/** The caller's options behind each context, for transports that cannot go through ctx.fetch. */\nconst CONTEXT_OPTIONS = new WeakMap<SourceContext, LoadFromSourceOptions>();\n\n/**\n * The credential and transport options of a context's load. Internal to graph-io: a transport that\n * hands a credential to a driver (Bolt) reads it here and applies the origin and TLS rules itself.\n * Sources outside graph-io never see a credential.\n * @param ctx - the context\n * @returns the options that matter to a transport\n */\nexport function transportOptions(\n ctx: SourceContext,\n): Pick<LoadFromSourceOptions, \"credential\" | \"allowInsecure\" | \"userAgent\"> {\n const options = CONTEXT_OPTIONS.get(ctx) ?? {};\n return { credential: options.credential, allowInsecure: options.allowInsecure, userAgent: options.userAgent };\n}\n\n/**\n * Create the context of one source call.\n * @param input - the source, options, report and counters\n * @returns the context and its controls\n */\nexport function createSourceContext(input: ContextInput): CreatedContext {\n const f = new SourceFetcher(input);\n const limits: SourceLimits = Object.freeze({ ...input.options.limits, reached: () => f.reached() });\n const ctx: SourceContext = Object.freeze({\n fetch: (target: string | URL, init?: SourceRequestInit) => f.fetch(target, init),\n fetchJson: <T>(target: string | URL, init?: SourceRequestInit) => f.fetchJson<T>(target, init),\n endpoint: input.endpoint,\n signal: f.signal,\n report: input.report,\n limits,\n cursor: input.cursor,\n runtime: f.runtime,\n progress: (done: number, total?: number, unit?: \"items\" | \"bytes\") => {\n f.progress(done, total, unit);\n },\n finish: (result?: SourceFinish): ImportReport => {\n f.state.finish = result ?? {};\n return Object.freeze({ ...input.report.finish(), source: f.info(result?.next ?? null) });\n },\n });\n CONTEXT_OPTIONS.set(ctx, input.options);\n return {\n ctx,\n state: f.state,\n info: (next) => f.info(next),\n dispose: () => {\n f.dispose();\n },\n };\n}\n"],"names":[],"mappings":";;AA6BA,MAAM,qCAA0C,IAAI,CAAC,KAAK,KAAK,KAAK,GAAG,CAAC;AAGxE,MAAM,yCAA8C,IAAI,CAAC,KAAK,KAA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,GAAG,MAAM,QAAQ,QAAQ,SAAS,MAAM,EAAE,QAAA,GAAW;AAClG,QAAM,MAAqB,OAAO,OAAO;AAAA,IACrC,OAAO,CAAC,QAAsB,SAA6B,EAAE,MAAM,QAAQ,IAAI;AAAA,IAC/E,WAAW,CAAI,QAAsB,SAA6B,EAAE,UAAa,QAAQ,IAAI;AAAA,IAC7F,UAAU,MAAM;AAAA,IAChB,QAAQ,EAAE;AAAA,IACV,QAAQ,MAAM;AAAA,IACd;AAAA,IACA,QAAQ,MAAM;AAAA,IACd,SAAS,EAAE;AAAA,IACX,UAAU,CAAC,MAAc,OAAgB,SAA6B;AAClE,QAAE,SAAS,MAAM,OAAO,IAAI;AAAA,IAChC;AAAA,IACA,QAAQ,CAAC,WAAwC;AAC7C,QAAE,MAAM,SAAS,UAAU,CAAA;AAC3B,aAAO,OAAO,OAAO,EAAE,GAAG,MAAM,OAAO,OAAA,GAAU,QAAQ,EAAE,KAAK,QAAQ,QAAQ,IAAI,GAAG;AAAA,IAC3F;AAAA,EAAA,CACH;AACD,kBAAgB,IAAI,KAAK,MAAM,OAAO;AACtC,SAAO;AAAA,IACH;AAAA,IACA,OAAO,EAAE;AAAA,IACT,MAAM,CAAC,SAAS,EAAE,KAAK,IAAI;AAAA,IAC3B,SAAS,MAAM;AACX,QAAE,QAAA;AAAA,IACN;AAAA,EAAA;AAER;"}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { K as ImportReportBuilder } from "./report-CgdsL9Hb.js";
|
|
2
|
+
const NDEX_SOURCE_ID = "ndex";
|
|
3
|
+
const CYPHER_SOURCE_ID = "cypher";
|
|
4
|
+
const NEO4J_SOURCE_ID = "neo4j";
|
|
5
|
+
const NEPTUNE_SOURCE_ID = "neptune";
|
|
6
|
+
const REST_SOURCE_ID = "rest";
|
|
7
|
+
const OPENALEX_SOURCE_ID = "openalex";
|
|
8
|
+
const SOURCE_ATTR_PREFIX = "_source.";
|
|
9
|
+
const SOURCE_STUB_ATTR = "_source.stub";
|
|
10
|
+
const SOURCE_ENTITY_ATTR = "_source.entity";
|
|
11
|
+
const SOURCE_DEGREE_ATTR = "_source.degree";
|
|
12
|
+
const SOURCE_FORMAT_PREFIX = "source:";
|
|
13
|
+
const CATEGORY = {
|
|
14
|
+
E_SOURCE_PARAM: "validation-error",
|
|
15
|
+
E_SOURCE_INVALID: "validation-error",
|
|
16
|
+
E_SOURCE_RESPONSE: "parse-error",
|
|
17
|
+
E_SOURCE_NOT_A_GRAPH: "parse-error",
|
|
18
|
+
E_SOURCE_NOT_FOUND: "missing-value",
|
|
19
|
+
E_SOURCE_UNKNOWN: "missing-value"
|
|
20
|
+
};
|
|
21
|
+
function failOn(report, code, message, params) {
|
|
22
|
+
return report.fork().failWith(CATEGORY[code] ?? "unsupported", code, message, void 0, params, params);
|
|
23
|
+
}
|
|
24
|
+
function failAlone(code, message, params, format = "source") {
|
|
25
|
+
failOn(new ImportReportBuilder(format, 0), code, message, params);
|
|
26
|
+
}
|
|
27
|
+
function warnOn(report, code, message, params) {
|
|
28
|
+
report.warning("unsupported", code, message, void 0, params);
|
|
29
|
+
}
|
|
30
|
+
const ID_FORM = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
31
|
+
const FEATURE_METHODS = [
|
|
32
|
+
["expand", "expand"],
|
|
33
|
+
["probe", "probe"],
|
|
34
|
+
["list", "list"],
|
|
35
|
+
["validate", "validate"]
|
|
36
|
+
];
|
|
37
|
+
function invalid(id, reason, message) {
|
|
38
|
+
failAlone("E_SOURCE_INVALID", message, { id, reason });
|
|
39
|
+
}
|
|
40
|
+
function checkSourceId(id) {
|
|
41
|
+
if (typeof id !== "string" || !ID_FORM.test(id)) {
|
|
42
|
+
invalid(String(id), "id", `source id ${JSON.stringify(id)} must be lowercase letters, digits and dashes`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function featuresOf(source) {
|
|
46
|
+
return FEATURE_METHODS.filter(([, method]) => typeof source[method] === "function").map(([f]) => f);
|
|
47
|
+
}
|
|
48
|
+
function checkSource(source, declared) {
|
|
49
|
+
checkSourceId(source.id);
|
|
50
|
+
const reads = ["records", "file", "import"].filter((m) => typeof source[m] === "function");
|
|
51
|
+
if (reads.length !== 1) {
|
|
52
|
+
invalid(source.id, "read-methods", `source ${source.id} must have exactly one of records, file and import`);
|
|
53
|
+
}
|
|
54
|
+
const features = (declared ?? source.descriptor)?.features;
|
|
55
|
+
if (features !== void 0) {
|
|
56
|
+
const has = new Set(featuresOf(source));
|
|
57
|
+
for (const f of features) {
|
|
58
|
+
if (f !== "page" && !has.has(f)) {
|
|
59
|
+
invalid(source.id, "features", `source ${source.id} declares ${f} but has no ${f} method`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function checkLazySource(source) {
|
|
65
|
+
checkSourceId(source.id);
|
|
66
|
+
if (typeof source.load !== "function" || typeof source.descriptor !== "object") {
|
|
67
|
+
invalid(source.id, "lazy", `lazy source ${source.id} needs a descriptor and a load function`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function defineSource(source) {
|
|
71
|
+
checkSource(source);
|
|
72
|
+
return source;
|
|
73
|
+
}
|
|
74
|
+
function numberProblem(p, value) {
|
|
75
|
+
if (typeof value !== "number" || Number.isNaN(value) || p.type === "integer" && !Number.isInteger(value)) {
|
|
76
|
+
return "type";
|
|
77
|
+
}
|
|
78
|
+
if (p.min !== void 0 && value < p.min || p.max !== void 0 && value > p.max) {
|
|
79
|
+
return "range";
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
function urlProblem(value) {
|
|
84
|
+
let url;
|
|
85
|
+
try {
|
|
86
|
+
url = new URL(typeof value === "string" ? value : "");
|
|
87
|
+
} catch {
|
|
88
|
+
return "type";
|
|
89
|
+
}
|
|
90
|
+
return url.username !== "" || url.password !== "" ? "credentials-in-url" : null;
|
|
91
|
+
}
|
|
92
|
+
function paramProblem(p, value) {
|
|
93
|
+
switch (p.type) {
|
|
94
|
+
case "integer":
|
|
95
|
+
case "number":
|
|
96
|
+
return numberProblem(p, value);
|
|
97
|
+
case "boolean":
|
|
98
|
+
return typeof value === "boolean" ? null : "type";
|
|
99
|
+
case "enum":
|
|
100
|
+
return p.values !== void 0 && !p.values.some((v) => v.value === value) ? "enum" : null;
|
|
101
|
+
case "url":
|
|
102
|
+
return urlProblem(value);
|
|
103
|
+
default:
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function checkParams(params, descriptor, report) {
|
|
108
|
+
if (typeof params !== "object" || params === null) {
|
|
109
|
+
failOn(report, "E_SOURCE_PARAM", "params must be an object", { name: "params", reason: "type" });
|
|
110
|
+
}
|
|
111
|
+
for (const p of descriptor?.params ?? []) {
|
|
112
|
+
const value = params[p.name];
|
|
113
|
+
const missing = value === void 0 || value === null;
|
|
114
|
+
let reason = null;
|
|
115
|
+
if (!missing) {
|
|
116
|
+
reason = paramProblem(p, value);
|
|
117
|
+
} else if (p.required === true && p.default === void 0) {
|
|
118
|
+
reason = "required";
|
|
119
|
+
}
|
|
120
|
+
if (reason !== null) {
|
|
121
|
+
failOn(report, "E_SOURCE_PARAM", `parameter ${p.name}: ${reason}`, { name: p.name, reason });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const SECRETS = /* @__PURE__ */ new WeakMap();
|
|
126
|
+
const INSPECT = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
127
|
+
function originOf(url) {
|
|
128
|
+
return `${url.protocol}//${url.host}`;
|
|
129
|
+
}
|
|
130
|
+
function bindOrigins(bind) {
|
|
131
|
+
return Object.freeze(
|
|
132
|
+
(bind?.origins ?? []).map((o) => {
|
|
133
|
+
let url;
|
|
134
|
+
try {
|
|
135
|
+
url = new URL(o);
|
|
136
|
+
} catch {
|
|
137
|
+
return failAlone("E_SOURCE_PARAM", `credential origin ${JSON.stringify(o)} is not a URL`, {
|
|
138
|
+
name: "origins",
|
|
139
|
+
reason: "origin"
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return originOf(url);
|
|
143
|
+
})
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
class SourceCredential {
|
|
147
|
+
/**
|
|
148
|
+
* Create one; only the factories do.
|
|
149
|
+
* @param secret - the secret
|
|
150
|
+
* @param bind - the origins it is bound to
|
|
151
|
+
*/
|
|
152
|
+
constructor(secret, bind) {
|
|
153
|
+
this.kind = secret.kind === "custom" ? secret.name : secret.kind;
|
|
154
|
+
this.origins = bindOrigins(bind);
|
|
155
|
+
this.username = secret.kind === "basic" ? secret.username : void 0;
|
|
156
|
+
SECRETS.set(this, secret);
|
|
157
|
+
Object.freeze(this);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* What JSON.stringify writes: never the secret.
|
|
161
|
+
* @returns kind, origins and a basic credential's user name
|
|
162
|
+
*/
|
|
163
|
+
toJSON() {
|
|
164
|
+
return this.username === void 0 ? { kind: this.kind, origins: this.origins } : { kind: this.kind, origins: this.origins, username: this.username };
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* What util.inspect and console.log show in Node: never the secret.
|
|
168
|
+
* @returns the same as toJSON
|
|
169
|
+
*/
|
|
170
|
+
[INSPECT]() {
|
|
171
|
+
return this.toJSON();
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* What string conversion shows: never the secret.
|
|
175
|
+
* @returns a description
|
|
176
|
+
*/
|
|
177
|
+
toString() {
|
|
178
|
+
return `[Credential ${this.kind}]`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function base64(text) {
|
|
182
|
+
let binary = "";
|
|
183
|
+
for (const b of new TextEncoder().encode(text)) {
|
|
184
|
+
binary += String.fromCodePoint(b);
|
|
185
|
+
}
|
|
186
|
+
return btoa(binary);
|
|
187
|
+
}
|
|
188
|
+
const credentials = Object.freeze({
|
|
189
|
+
/**
|
|
190
|
+
* An `Authorization: Bearer` token, or a function returning a fresh one per request.
|
|
191
|
+
* @param token - the token or a function returning it
|
|
192
|
+
* @param bind - the origins it may be sent to
|
|
193
|
+
* @returns the credential
|
|
194
|
+
*/
|
|
195
|
+
bearer(token, bind) {
|
|
196
|
+
return new SourceCredential({ kind: "bearer", token }, bind);
|
|
197
|
+
},
|
|
198
|
+
/**
|
|
199
|
+
* HTTP basic authentication (a database user and password).
|
|
200
|
+
* @param username - the user name
|
|
201
|
+
* @param password - the password
|
|
202
|
+
* @param bind - the origins it may be sent to
|
|
203
|
+
* @returns the credential
|
|
204
|
+
*/
|
|
205
|
+
basic(username, password, bind) {
|
|
206
|
+
return new SourceCredential({ kind: "basic", username, password }, bind);
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* An API key sent in a request header or a query parameter.
|
|
210
|
+
* @param where - `{ header: "X-Api-Key" }` or `{ query: "api_key" }`
|
|
211
|
+
* @param value - the key
|
|
212
|
+
* @param bind - the origins it may be sent to
|
|
213
|
+
* @returns the credential
|
|
214
|
+
*/
|
|
215
|
+
apiKey(where, value, bind) {
|
|
216
|
+
const header = "header" in where ? where.header : null;
|
|
217
|
+
const query = "query" in where ? where.query : null;
|
|
218
|
+
return new SourceCredential({ kind: "api-key", header, query, value }, bind);
|
|
219
|
+
},
|
|
220
|
+
/**
|
|
221
|
+
* AWS Signature Version 4 (Amazon Neptune). The signer loads on first use.
|
|
222
|
+
* @param options - region, service and the credentials or a provider of them
|
|
223
|
+
* @param bind - the origins it may be sent to
|
|
224
|
+
* @returns the credential
|
|
225
|
+
*/
|
|
226
|
+
awsSigV4(options, bind) {
|
|
227
|
+
return new SourceCredential({ kind: "aws-sigv4", options }, bind);
|
|
228
|
+
},
|
|
229
|
+
/**
|
|
230
|
+
* Anything else: a function that returns the request with its authentication added. The
|
|
231
|
+
* request's origin must not change.
|
|
232
|
+
* @param apply - adds the authentication
|
|
233
|
+
* @param kind - what to call it in `credential.kind`
|
|
234
|
+
* @param bind - the origins it may be sent to
|
|
235
|
+
* @returns the credential
|
|
236
|
+
*/
|
|
237
|
+
custom(apply, kind, bind) {
|
|
238
|
+
return new SourceCredential({ kind: "custom", name: kind, apply }, bind);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
function secretOf(credential) {
|
|
242
|
+
return SECRETS.get(credential);
|
|
243
|
+
}
|
|
244
|
+
async function applyCredential(credential, request) {
|
|
245
|
+
const secret = secretOf(credential);
|
|
246
|
+
if (secret === void 0) {
|
|
247
|
+
return failAlone("E_SOURCE_PARAM", "the credential was not made by the credentials factories", {
|
|
248
|
+
name: "credential",
|
|
249
|
+
reason: "type"
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
switch (secret.kind) {
|
|
253
|
+
case "bearer": {
|
|
254
|
+
const token = typeof secret.token === "string" ? secret.token : await secret.token();
|
|
255
|
+
const headers = new Headers(request.headers);
|
|
256
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
257
|
+
return new Request(request, { headers });
|
|
258
|
+
}
|
|
259
|
+
case "basic": {
|
|
260
|
+
const headers = new Headers(request.headers);
|
|
261
|
+
const pair = `${secret.username}:${secret.password}`;
|
|
262
|
+
headers.set("Authorization", `Basic ${base64(pair)}`);
|
|
263
|
+
return new Request(request, { headers });
|
|
264
|
+
}
|
|
265
|
+
case "api-key": {
|
|
266
|
+
if (secret.header !== null) {
|
|
267
|
+
const headers = new Headers(request.headers);
|
|
268
|
+
headers.set(secret.header, secret.value);
|
|
269
|
+
return new Request(request, { headers });
|
|
270
|
+
}
|
|
271
|
+
const url = new URL(request.url);
|
|
272
|
+
url.searchParams.set(secret.query ?? "api_key", secret.value);
|
|
273
|
+
return new Request(url, request);
|
|
274
|
+
}
|
|
275
|
+
case "aws-sigv4": {
|
|
276
|
+
const { signRequest } = await import("./sigv4-LkAzsLAu.js");
|
|
277
|
+
return signRequest(request, secret.options);
|
|
278
|
+
}
|
|
279
|
+
case "custom":
|
|
280
|
+
return secret.apply(request);
|
|
281
|
+
default:
|
|
282
|
+
return request;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function unwrapCredential(credential) {
|
|
286
|
+
const secret = secretOf(credential);
|
|
287
|
+
if (secret?.kind === "basic") {
|
|
288
|
+
return { kind: "basic", username: secret.username, password: secret.password };
|
|
289
|
+
}
|
|
290
|
+
if (secret?.kind === "bearer") {
|
|
291
|
+
return { kind: "bearer", token: secret.token };
|
|
292
|
+
}
|
|
293
|
+
return secret === void 0 ? void 0 : { kind: credential.kind };
|
|
294
|
+
}
|
|
295
|
+
function storableCredential(credential) {
|
|
296
|
+
const secret = secretOf(credential);
|
|
297
|
+
switch (secret?.kind) {
|
|
298
|
+
case "basic":
|
|
299
|
+
return { kind: "basic", username: secret.username, password: secret.password };
|
|
300
|
+
case "api-key":
|
|
301
|
+
return { kind: "api-key", header: secret.header, query: secret.query, value: secret.value };
|
|
302
|
+
case "bearer":
|
|
303
|
+
return typeof secret.token === "string" ? { kind: "bearer", token: secret.token } : null;
|
|
304
|
+
default:
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function fromStorableCredential(parts, bind) {
|
|
309
|
+
switch (parts.kind) {
|
|
310
|
+
case "basic":
|
|
311
|
+
return credentials.basic(parts.username, parts.password, bind);
|
|
312
|
+
case "bearer":
|
|
313
|
+
return credentials.bearer(parts.token, bind);
|
|
314
|
+
default:
|
|
315
|
+
return new SourceCredential(
|
|
316
|
+
{ kind: "api-key", header: parts.header, query: parts.query, value: parts.value },
|
|
317
|
+
bind
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
export {
|
|
322
|
+
CYPHER_SOURCE_ID as C,
|
|
323
|
+
NDEX_SOURCE_ID as N,
|
|
324
|
+
OPENALEX_SOURCE_ID as O,
|
|
325
|
+
REST_SOURCE_ID as R,
|
|
326
|
+
SOURCE_ENTITY_ATTR as S,
|
|
327
|
+
applyCredential as a,
|
|
328
|
+
failAlone as b,
|
|
329
|
+
credentials as c,
|
|
330
|
+
defineSource as d,
|
|
331
|
+
SOURCE_STUB_ATTR as e,
|
|
332
|
+
failOn as f,
|
|
333
|
+
NEO4J_SOURCE_ID as g,
|
|
334
|
+
NEPTUNE_SOURCE_ID as h,
|
|
335
|
+
SOURCE_FORMAT_PREFIX as i,
|
|
336
|
+
checkParams as j,
|
|
337
|
+
checkLazySource as k,
|
|
338
|
+
checkSource as l,
|
|
339
|
+
SOURCE_ATTR_PREFIX as m,
|
|
340
|
+
SOURCE_DEGREE_ATTR as n,
|
|
341
|
+
originOf as o,
|
|
342
|
+
fromStorableCredential as p,
|
|
343
|
+
storableCredential as s,
|
|
344
|
+
unwrapCredential as u,
|
|
345
|
+
warnOn as w
|
|
346
|
+
};
|
|
347
|
+
//# sourceMappingURL=credentials-BiQsnMTb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AACp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