@ncukondo/search-hub 0.1.0
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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/_virtual/___vite-browser-external.js +7 -0
- package/dist/_virtual/___vite-browser-external.js.map +1 -0
- package/dist/_virtual/__vite-browser-external.js +5 -0
- package/dist/_virtual/__vite-browser-external.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +28 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/cli-progress.js +6 -0
- package/dist/_virtual/cli-progress.js.map +1 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/cli/commands/config.d.ts +37 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +117 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/export.d.ts +26 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +86 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/init.d.ts +45 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +134 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/query/translate.d.ts +32 -0
- package/dist/cli/commands/query/translate.d.ts.map +1 -0
- package/dist/cli/commands/query/translate.js +76 -0
- package/dist/cli/commands/query/translate.js.map +1 -0
- package/dist/cli/commands/query/validate.d.ts +25 -0
- package/dist/cli/commands/query/validate.d.ts.map +1 -0
- package/dist/cli/commands/query/validate.js +68 -0
- package/dist/cli/commands/query/validate.js.map +1 -0
- package/dist/cli/commands/register.d.ts +39 -0
- package/dist/cli/commands/register.d.ts.map +1 -0
- package/dist/cli/commands/register.js +78 -0
- package/dist/cli/commands/register.js.map +1 -0
- package/dist/cli/commands/resume-executor.d.ts +19 -0
- package/dist/cli/commands/resume-executor.d.ts.map +1 -0
- package/dist/cli/commands/resume-executor.js +170 -0
- package/dist/cli/commands/resume-executor.js.map +1 -0
- package/dist/cli/commands/resume.d.ts +26 -0
- package/dist/cli/commands/resume.d.ts.map +1 -0
- package/dist/cli/commands/resume.js +51 -0
- package/dist/cli/commands/resume.js.map +1 -0
- package/dist/cli/commands/search-executor.d.ts +26 -0
- package/dist/cli/commands/search-executor.d.ts.map +1 -0
- package/dist/cli/commands/search-executor.js +315 -0
- package/dist/cli/commands/search-executor.js.map +1 -0
- package/dist/cli/commands/search.d.ts +30 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +67 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/status.d.ts +41 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +123 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/e2e-helpers.d.ts +165 -0
- package/dist/cli/e2e-helpers.d.ts.map +1 -0
- package/dist/cli/exit-codes.d.ts +25 -0
- package/dist/cli/exit-codes.d.ts.map +1 -0
- package/dist/cli/exit-codes.js +18 -0
- package/dist/cli/exit-codes.js.map +1 -0
- package/dist/cli/index.d.ts +25 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +638 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/progress.d.ts +24 -0
- package/dist/cli/utils/progress.d.ts.map +1 -0
- package/dist/cli/utils/progress.js +128 -0
- package/dist/cli/utils/progress.js.map +1 -0
- package/dist/cli/utils/sessions-dir.d.ts +14 -0
- package/dist/cli/utils/sessions-dir.d.ts.map +1 -0
- package/dist/cli/utils/sessions-dir.js +21 -0
- package/dist/cli/utils/sessions-dir.js.map +1 -0
- package/dist/cli/utils/validation.d.ts +18 -0
- package/dist/cli/utils/validation.d.ts.map +1 -0
- package/dist/cli/utils/validation.js +24 -0
- package/dist/cli/utils/validation.js.map +1 -0
- package/dist/config/defaults.d.ts +12 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +10 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/env.d.ts +12 -0
- package/dist/config/env.d.ts.map +1 -0
- package/dist/config/env.js +36 -0
- package/dist/config/env.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/loader.d.ts +49 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +72 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/paths.d.ts +23 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +22 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/schema.d.ts +109 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +74 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/ref-cli.d.ts +41 -0
- package/dist/integration/ref-cli.d.ts.map +1 -0
- package/dist/integration/ref-cli.js +132 -0
- package/dist/integration/ref-cli.js.map +1 -0
- package/dist/integration/register.d.ts +27 -0
- package/dist/integration/register.d.ts.map +1 -0
- package/dist/integration/register.js +108 -0
- package/dist/integration/register.js.map +1 -0
- package/dist/integration/types.d.ts +61 -0
- package/dist/integration/types.d.ts.map +1 -0
- package/dist/integration/types.js +61 -0
- package/dist/integration/types.js.map +1 -0
- package/dist/node_modules/cli-progress/cli-progress.js +37 -0
- package/dist/node_modules/cli-progress/cli-progress.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/eta.js +52 -0
- package/dist/node_modules/cli-progress/lib/eta.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/format-bar.js +16 -0
- package/dist/node_modules/cli-progress/lib/format-bar.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/format-time.js +32 -0
- package/dist/node_modules/cli-progress/lib/format-time.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/format-value.js +25 -0
- package/dist/node_modules/cli-progress/lib/format-value.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/formatter.js +57 -0
- package/dist/node_modules/cli-progress/lib/formatter.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/generic-bar.js +137 -0
- package/dist/node_modules/cli-progress/lib/generic-bar.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/multi-bar.js +147 -0
- package/dist/node_modules/cli-progress/lib/multi-bar.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/options.js +59 -0
- package/dist/node_modules/cli-progress/lib/options.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/single-bar.js +95 -0
- package/dist/node_modules/cli-progress/lib/single-bar.js.map +1 -0
- package/dist/node_modules/cli-progress/lib/terminal.js +125 -0
- package/dist/node_modules/cli-progress/lib/terminal.js.map +1 -0
- package/dist/node_modules/cli-progress/node_modules/ansi-regex/index.js +18 -0
- package/dist/node_modules/cli-progress/node_modules/ansi-regex/index.js.map +1 -0
- package/dist/node_modules/cli-progress/node_modules/emoji-regex/index.js +14 -0
- package/dist/node_modules/cli-progress/node_modules/emoji-regex/index.js.map +1 -0
- package/dist/node_modules/cli-progress/node_modules/string-width/index.js +44 -0
- package/dist/node_modules/cli-progress/node_modules/string-width/index.js.map +1 -0
- package/dist/node_modules/cli-progress/node_modules/strip-ansi/index.js +14 -0
- package/dist/node_modules/cli-progress/node_modules/strip-ansi/index.js.map +1 -0
- package/dist/node_modules/cli-progress/presets/index.js +25 -0
- package/dist/node_modules/cli-progress/presets/index.js.map +1 -0
- package/dist/node_modules/cli-progress/presets/legacy.js +16 -0
- package/dist/node_modules/cli-progress/presets/legacy.js.map +1 -0
- package/dist/node_modules/cli-progress/presets/rect.js +16 -0
- package/dist/node_modules/cli-progress/presets/rect.js.map +1 -0
- package/dist/node_modules/cli-progress/presets/shades-classic.js +16 -0
- package/dist/node_modules/cli-progress/presets/shades-classic.js.map +1 -0
- package/dist/node_modules/cli-progress/presets/shades-grey.js +16 -0
- package/dist/node_modules/cli-progress/presets/shades-grey.js.map +1 -0
- package/dist/node_modules/env-paths/index.js +58 -0
- package/dist/node_modules/env-paths/index.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/ignoreAttributes.js +22 -0
- package/dist/node_modules/fast-xml-parser/src/ignoreAttributes.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/util.js +33 -0
- package/dist/node_modules/fast-xml-parser/src/util.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/validator.js +309 -0
- package/dist/node_modules/fast-xml-parser/src/validator.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +265 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +53 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +515 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +68 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/node2json.js +88 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/node2json.js.map +1 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +36 -0
- package/dist/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js.map +1 -0
- package/dist/node_modules/is-fullwidth-code-point/index.js +37 -0
- package/dist/node_modules/is-fullwidth-code-point/index.js.map +1 -0
- package/dist/node_modules/strnum/strnum.js +100 -0
- package/dist/node_modules/strnum/strnum.js.map +1 -0
- package/dist/providers/arxiv/client.d.ts +54 -0
- package/dist/providers/arxiv/client.d.ts.map +1 -0
- package/dist/providers/arxiv/client.js +105 -0
- package/dist/providers/arxiv/client.js.map +1 -0
- package/dist/providers/arxiv/index.d.ts +14 -0
- package/dist/providers/arxiv/index.d.ts.map +1 -0
- package/dist/providers/arxiv/parser.d.ts +16 -0
- package/dist/providers/arxiv/parser.d.ts.map +1 -0
- package/dist/providers/arxiv/parser.js +144 -0
- package/dist/providers/arxiv/parser.js.map +1 -0
- package/dist/providers/arxiv/provider.d.ts +39 -0
- package/dist/providers/arxiv/provider.d.ts.map +1 -0
- package/dist/providers/arxiv/provider.js +153 -0
- package/dist/providers/arxiv/provider.js.map +1 -0
- package/dist/providers/arxiv/translator.d.ts +17 -0
- package/dist/providers/arxiv/translator.d.ts.map +1 -0
- package/dist/providers/arxiv/translator.js +112 -0
- package/dist/providers/arxiv/translator.js.map +1 -0
- package/dist/providers/arxiv/types.d.ts +71 -0
- package/dist/providers/arxiv/types.d.ts.map +1 -0
- package/dist/providers/arxiv/types.js +17 -0
- package/dist/providers/arxiv/types.js.map +1 -0
- package/dist/providers/base/index.d.ts +16 -0
- package/dist/providers/base/index.d.ts.map +1 -0
- package/dist/providers/base/mock-provider.d.ts +76 -0
- package/dist/providers/base/mock-provider.d.ts.map +1 -0
- package/dist/providers/base/mock-provider.js +159 -0
- package/dist/providers/base/mock-provider.js.map +1 -0
- package/dist/providers/base/provider.d.ts +95 -0
- package/dist/providers/base/provider.d.ts.map +1 -0
- package/dist/providers/base/provider.js +117 -0
- package/dist/providers/base/provider.js.map +1 -0
- package/dist/providers/base/rate-limiter.d.ts +70 -0
- package/dist/providers/base/rate-limiter.d.ts.map +1 -0
- package/dist/providers/base/rate-limiter.js +111 -0
- package/dist/providers/base/rate-limiter.js.map +1 -0
- package/dist/providers/base/registry.d.ts +52 -0
- package/dist/providers/base/registry.d.ts.map +1 -0
- package/dist/providers/base/registry.js +55 -0
- package/dist/providers/base/registry.js.map +1 -0
- package/dist/providers/base/types.d.ts +163 -0
- package/dist/providers/base/types.d.ts.map +1 -0
- package/dist/providers/base/types.js +29 -0
- package/dist/providers/base/types.js.map +1 -0
- package/dist/providers/eric/client.d.ts +40 -0
- package/dist/providers/eric/client.d.ts.map +1 -0
- package/dist/providers/eric/client.js +93 -0
- package/dist/providers/eric/client.js.map +1 -0
- package/dist/providers/eric/index.d.ts +14 -0
- package/dist/providers/eric/index.d.ts.map +1 -0
- package/dist/providers/eric/parser.d.ts +21 -0
- package/dist/providers/eric/parser.d.ts.map +1 -0
- package/dist/providers/eric/parser.js +86 -0
- package/dist/providers/eric/parser.js.map +1 -0
- package/dist/providers/eric/provider.d.ts +59 -0
- package/dist/providers/eric/provider.d.ts.map +1 -0
- package/dist/providers/eric/provider.js +166 -0
- package/dist/providers/eric/provider.js.map +1 -0
- package/dist/providers/eric/translator.d.ts +12 -0
- package/dist/providers/eric/translator.d.ts.map +1 -0
- package/dist/providers/eric/translator.js +81 -0
- package/dist/providers/eric/translator.js.map +1 -0
- package/dist/providers/eric/types.d.ts +84 -0
- package/dist/providers/eric/types.d.ts.map +1 -0
- package/dist/providers/pubmed/client.d.ts +54 -0
- package/dist/providers/pubmed/client.d.ts.map +1 -0
- package/dist/providers/pubmed/client.js +141 -0
- package/dist/providers/pubmed/client.js.map +1 -0
- package/dist/providers/pubmed/index.d.ts +27 -0
- package/dist/providers/pubmed/index.d.ts.map +1 -0
- package/dist/providers/pubmed/parser.d.ts +22 -0
- package/dist/providers/pubmed/parser.d.ts.map +1 -0
- package/dist/providers/pubmed/parser.js +174 -0
- package/dist/providers/pubmed/parser.js.map +1 -0
- package/dist/providers/pubmed/provider.d.ts +44 -0
- package/dist/providers/pubmed/provider.d.ts.map +1 -0
- package/dist/providers/pubmed/provider.js +224 -0
- package/dist/providers/pubmed/provider.js.map +1 -0
- package/dist/providers/pubmed/translator.d.ts +7 -0
- package/dist/providers/pubmed/translator.d.ts.map +1 -0
- package/dist/providers/pubmed/translator.js +143 -0
- package/dist/providers/pubmed/translator.js.map +1 -0
- package/dist/providers/pubmed/types.d.ts +72 -0
- package/dist/providers/pubmed/types.d.ts.map +1 -0
- package/dist/providers/scopus/client.d.ts +64 -0
- package/dist/providers/scopus/client.d.ts.map +1 -0
- package/dist/providers/scopus/client.js +155 -0
- package/dist/providers/scopus/client.js.map +1 -0
- package/dist/providers/scopus/index.d.ts +21 -0
- package/dist/providers/scopus/index.d.ts.map +1 -0
- package/dist/providers/scopus/parser.d.ts +11 -0
- package/dist/providers/scopus/parser.d.ts.map +1 -0
- package/dist/providers/scopus/parser.js +128 -0
- package/dist/providers/scopus/parser.js.map +1 -0
- package/dist/providers/scopus/provider.d.ts +39 -0
- package/dist/providers/scopus/provider.d.ts.map +1 -0
- package/dist/providers/scopus/provider.js +175 -0
- package/dist/providers/scopus/provider.js.map +1 -0
- package/dist/providers/scopus/translator.d.ts +7 -0
- package/dist/providers/scopus/translator.d.ts.map +1 -0
- package/dist/providers/scopus/translator.js +83 -0
- package/dist/providers/scopus/translator.js.map +1 -0
- package/dist/providers/scopus/types.d.ts +86 -0
- package/dist/providers/scopus/types.d.ts.map +1 -0
- package/dist/query/index.d.ts +12 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/parser.d.ts +18 -0
- package/dist/query/parser.d.ts.map +1 -0
- package/dist/query/parser.js +16 -0
- package/dist/query/parser.js.map +1 -0
- package/dist/query/types.d.ts +85 -0
- package/dist/query/types.d.ts.map +1 -0
- package/dist/query/validator.d.ts +635 -0
- package/dist/query/validator.d.ts.map +1 -0
- package/dist/query/validator.js +117 -0
- package/dist/query/validator.js.map +1 -0
- package/dist/session/index.d.ts +14 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/logger.d.ts +15 -0
- package/dist/session/logger.d.ts.map +1 -0
- package/dist/session/logger.js +18 -0
- package/dist/session/logger.js.map +1 -0
- package/dist/session/manager.d.ts +63 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +193 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/types.d.ts +182 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/utils/deep-merge.d.ts +17 -0
- package/dist/utils/deep-merge.d.ts.map +1 -0
- package/dist/utils/deep-merge.js +23 -0
- package/dist/utils/deep-merge.js.map +1 -0
- package/dist/utils/path.d.ts +9 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +15 -0
- package/dist/utils/path.js.map +1 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ncukondo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @ncukondo/search-hub
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ncukondo/search-hub)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A CLI tool for systematic literature searching across multiple academic databases.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Multi-database search**: PubMed, ERIC, arXiv, Scopus (Web of Science, Embase planned)
|
|
11
|
+
- **Unified query syntax**: YAML-based DSL with automatic translation
|
|
12
|
+
- **Reproducible searches**: Full session logging for PRISMA reporting
|
|
13
|
+
- **Resume support**: Continue interrupted searches at DB or page level
|
|
14
|
+
- **Reference manager integration**: Works with [reference-manager](https://github.com/ncukondo/reference-manager)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @ncukondo/search-hub
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires Node.js 22+.
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
1. Initialize configuration:
|
|
27
|
+
```bash
|
|
28
|
+
search-hub init
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This creates config and data directories in platform-specific locations:
|
|
32
|
+
|
|
33
|
+
| Platform | Config | Data |
|
|
34
|
+
|----------|--------|------|
|
|
35
|
+
| Linux | `~/.config/search-hub/` | `~/.local/share/search-hub/` |
|
|
36
|
+
| macOS | `~/Library/Preferences/search-hub/` | `~/Library/Application Support/search-hub/` |
|
|
37
|
+
| Windows | `%APPDATA%/search-hub/Config/` | `%LOCALAPPDATA%/search-hub/Data/` |
|
|
38
|
+
|
|
39
|
+
2. Create a query file (`query.yaml`):
|
|
40
|
+
```yaml
|
|
41
|
+
name: my_review
|
|
42
|
+
description: "Literature search for scoping review"
|
|
43
|
+
|
|
44
|
+
query:
|
|
45
|
+
- field: title_abstract
|
|
46
|
+
terms:
|
|
47
|
+
keywords:
|
|
48
|
+
- diabetes
|
|
49
|
+
- "machine learning"
|
|
50
|
+
operator: OR
|
|
51
|
+
|
|
52
|
+
filters:
|
|
53
|
+
year_from: 2020
|
|
54
|
+
language:
|
|
55
|
+
- en
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
3. Run search:
|
|
59
|
+
```bash
|
|
60
|
+
search-hub search query.yaml
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
4. Export results:
|
|
64
|
+
```bash
|
|
65
|
+
search-hub export <session-id> --format ids
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
- [Query Guide](./docs/query-guide.md) - How to write query files
|
|
71
|
+
- [Command Reference](./docs/commands.md) - All CLI commands and options
|
|
72
|
+
- [Configuration](./docs/configuration.md) - Setup and configuration
|
|
73
|
+
- [Databases](./docs/databases.md) - Supported databases and tips
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Install dependencies
|
|
79
|
+
npm install
|
|
80
|
+
|
|
81
|
+
# Run tests
|
|
82
|
+
npm test
|
|
83
|
+
|
|
84
|
+
# Lint
|
|
85
|
+
npm run lint
|
|
86
|
+
|
|
87
|
+
# Build
|
|
88
|
+
npm run build
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as __viteBrowserExternal from "./__vite-browser-external.js";
|
|
2
|
+
import { getAugmentedNamespace } from "./_commonjsHelpers.js";
|
|
3
|
+
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal);
|
|
4
|
+
export {
|
|
5
|
+
require$$3 as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=___vite-browser-external.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"___vite-browser-external.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__vite-browser-external.js","sources":["../../__vite-browser-external"],"sourcesContent":["export default {}"],"names":[],"mappings":"AAAA,MAAA,wBAAe,CAAA;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function getAugmentedNamespace(n) {
|
|
2
|
+
if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
|
|
3
|
+
var f = n.default;
|
|
4
|
+
if (typeof f == "function") {
|
|
5
|
+
var a = function a2() {
|
|
6
|
+
if (this instanceof a2) {
|
|
7
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
8
|
+
}
|
|
9
|
+
return f.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
a.prototype = f.prototype;
|
|
12
|
+
} else a = {};
|
|
13
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
14
|
+
Object.keys(n).forEach(function(k) {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
16
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return n[k];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return a;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
getAugmentedNamespace
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=_commonjsHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-progress.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Config } from '../../config/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Result of a config operation.
|
|
4
|
+
*/
|
|
5
|
+
export interface ConfigResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
value?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get a nested value from an object using dot notation.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* getNestedValue({ a: { b: 1 } }, 'a.b') // returns 1
|
|
15
|
+
*/
|
|
16
|
+
export declare function getNestedValue(obj: Record<string, unknown>, path: string): unknown;
|
|
17
|
+
/**
|
|
18
|
+
* Set a nested value in an object using dot notation.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* setNestedValue({ a: { b: 1 } }, 'a.b', 2) // modifies obj to { a: { b: 2 } }
|
|
22
|
+
*/
|
|
23
|
+
export declare function setNestedValue(obj: Record<string, unknown>, path: string, value: unknown): void;
|
|
24
|
+
/**
|
|
25
|
+
* View all configuration values.
|
|
26
|
+
*/
|
|
27
|
+
export declare function viewConfig(config: Config): string;
|
|
28
|
+
/**
|
|
29
|
+
* View a specific configuration key.
|
|
30
|
+
*/
|
|
31
|
+
export declare function viewConfigKey(config: Config, key: string): ConfigResult;
|
|
32
|
+
/**
|
|
33
|
+
* Set a configuration key to a new value.
|
|
34
|
+
* Only allows setting keys that already exist in the configuration.
|
|
35
|
+
*/
|
|
36
|
+
export declare function setConfigKey(config: Config, key: string, value: string): ConfigResult;
|
|
37
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAeT;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,IAAI,CAcN;AAqCD;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAiBvE;AAoBD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,YAAY,CAiCd"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function getNestedValue(obj, path) {
|
|
2
|
+
const keys = path.split(".");
|
|
3
|
+
let current = obj;
|
|
4
|
+
for (const key of keys) {
|
|
5
|
+
if (current === null || current === void 0) {
|
|
6
|
+
return void 0;
|
|
7
|
+
}
|
|
8
|
+
if (typeof current !== "object") {
|
|
9
|
+
return void 0;
|
|
10
|
+
}
|
|
11
|
+
current = current[key];
|
|
12
|
+
}
|
|
13
|
+
return current;
|
|
14
|
+
}
|
|
15
|
+
function setNestedValue(obj, path, value) {
|
|
16
|
+
const keys = path.split(".");
|
|
17
|
+
let current = obj;
|
|
18
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
19
|
+
const key = keys[i];
|
|
20
|
+
if (!(key in current) || typeof current[key] !== "object") {
|
|
21
|
+
current[key] = {};
|
|
22
|
+
}
|
|
23
|
+
current = current[key];
|
|
24
|
+
}
|
|
25
|
+
const lastKey = keys[keys.length - 1];
|
|
26
|
+
current[lastKey] = value;
|
|
27
|
+
}
|
|
28
|
+
function flattenObject(obj, prefix = "") {
|
|
29
|
+
const result = [];
|
|
30
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
31
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
32
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
33
|
+
result.push(
|
|
34
|
+
...flattenObject(value, fullKey)
|
|
35
|
+
);
|
|
36
|
+
} else {
|
|
37
|
+
result.push({ key: fullKey, value });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
function formatValue(value) {
|
|
43
|
+
if (value === null) return "null";
|
|
44
|
+
if (value === void 0) return "undefined";
|
|
45
|
+
if (typeof value === "string") return value;
|
|
46
|
+
if (typeof value === "object") return JSON.stringify(value, null, 2);
|
|
47
|
+
return String(value);
|
|
48
|
+
}
|
|
49
|
+
function viewConfig(config) {
|
|
50
|
+
const flattened = flattenObject(config);
|
|
51
|
+
const lines = flattened.map(({ key, value }) => {
|
|
52
|
+
const formattedValue = formatValue(value);
|
|
53
|
+
return `${key} = ${formattedValue}`;
|
|
54
|
+
});
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
57
|
+
function viewConfigKey(config, key) {
|
|
58
|
+
const value = getNestedValue(
|
|
59
|
+
config,
|
|
60
|
+
key
|
|
61
|
+
);
|
|
62
|
+
if (value === void 0) {
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
error: `Key "${key}" not found in configuration`
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
success: true,
|
|
70
|
+
value: formatValue(value)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function parseValue(value, existingValue) {
|
|
74
|
+
if (value === "true") return true;
|
|
75
|
+
if (value === "false") return false;
|
|
76
|
+
if (typeof existingValue === "number") {
|
|
77
|
+
const num = Number(value);
|
|
78
|
+
if (!isNaN(num)) return num;
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
function setConfigKey(config, key, value) {
|
|
83
|
+
if (!key) {
|
|
84
|
+
return {
|
|
85
|
+
success: false,
|
|
86
|
+
error: "Key cannot be empty"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const existingValue = getNestedValue(
|
|
90
|
+
config,
|
|
91
|
+
key
|
|
92
|
+
);
|
|
93
|
+
if (existingValue === void 0) {
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
error: `Unknown configuration key: "${key}". Use "search-hub config" to see available keys.`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const parsedValue = parseValue(value, existingValue);
|
|
100
|
+
setNestedValue(
|
|
101
|
+
config,
|
|
102
|
+
key,
|
|
103
|
+
parsedValue
|
|
104
|
+
);
|
|
105
|
+
return {
|
|
106
|
+
success: true,
|
|
107
|
+
value: formatValue(parsedValue)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
getNestedValue,
|
|
112
|
+
setConfigKey,
|
|
113
|
+
setNestedValue,
|
|
114
|
+
viewConfig,
|
|
115
|
+
viewConfigKey
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/cli/commands/config.ts"],"sourcesContent":["/**\n * Config command implementation.\n *\n * Provides functionality to view and edit configuration values.\n */\nimport type { Config } from '../../config/index.js';\n\n/**\n * Result of a config operation.\n */\nexport interface ConfigResult {\n success: boolean;\n value?: string;\n error?: string;\n}\n\n/**\n * Get a nested value from an object using dot notation.\n *\n * @example\n * getNestedValue({ a: { b: 1 } }, 'a.b') // returns 1\n */\nexport function getNestedValue(\n obj: Record<string, unknown>,\n path: string\n): unknown {\n const keys = path.split('.');\n let current: unknown = obj;\n\n for (const key of keys) {\n if (current === null || current === undefined) {\n return undefined;\n }\n if (typeof current !== 'object') {\n return undefined;\n }\n current = (current as Record<string, unknown>)[key];\n }\n\n return current;\n}\n\n/**\n * Set a nested value in an object using dot notation.\n *\n * @example\n * setNestedValue({ a: { b: 1 } }, 'a.b', 2) // modifies obj to { a: { b: 2 } }\n */\nexport function setNestedValue(\n obj: Record<string, unknown>,\n path: string,\n value: unknown\n): void {\n const keys = path.split('.');\n let current = obj;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i]!;\n if (!(key in current) || typeof current[key] !== 'object') {\n current[key] = {};\n }\n current = current[key] as Record<string, unknown>;\n }\n\n const lastKey = keys[keys.length - 1]!;\n current[lastKey] = value;\n}\n\n/**\n * Flatten a nested object into dot-notation keys.\n */\nfunction flattenObject(\n obj: Record<string, unknown>,\n prefix = ''\n): Array<{ key: string; value: unknown }> {\n const result: Array<{ key: string; value: unknown }> = [];\n\n for (const [key, value] of Object.entries(obj)) {\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n result.push(\n ...flattenObject(value as Record<string, unknown>, fullKey)\n );\n } else {\n result.push({ key: fullKey, value });\n }\n }\n\n return result;\n}\n\n/**\n * Format a value for display.\n */\nfunction formatValue(value: unknown): string {\n if (value === null) return 'null';\n if (value === undefined) return 'undefined';\n if (typeof value === 'string') return value;\n if (typeof value === 'object') return JSON.stringify(value, null, 2);\n return String(value);\n}\n\n/**\n * View all configuration values.\n */\nexport function viewConfig(config: Config): string {\n const flattened = flattenObject(config as unknown as Record<string, unknown>);\n const lines = flattened.map(({ key, value }) => {\n const formattedValue = formatValue(value);\n return `${key} = ${formattedValue}`;\n });\n return lines.join('\\n');\n}\n\n/**\n * View a specific configuration key.\n */\nexport function viewConfigKey(config: Config, key: string): ConfigResult {\n const value = getNestedValue(\n config as unknown as Record<string, unknown>,\n key\n );\n\n if (value === undefined) {\n return {\n success: false,\n error: `Key \"${key}\" not found in configuration`,\n };\n }\n\n return {\n success: true,\n value: formatValue(value),\n };\n}\n\n/**\n * Parse a string value to its appropriate type.\n */\nfunction parseValue(value: string, existingValue: unknown): unknown {\n // Boolean\n if (value === 'true') return true;\n if (value === 'false') return false;\n\n // Number (if existing value is a number)\n if (typeof existingValue === 'number') {\n const num = Number(value);\n if (!isNaN(num)) return num;\n }\n\n // Default to string\n return value;\n}\n\n/**\n * Set a configuration key to a new value.\n * Only allows setting keys that already exist in the configuration.\n */\nexport function setConfigKey(\n config: Config,\n key: string,\n value: string\n): ConfigResult {\n if (!key) {\n return {\n success: false,\n error: 'Key cannot be empty',\n };\n }\n\n const existingValue = getNestedValue(\n config as unknown as Record<string, unknown>,\n key\n );\n\n // Reject unknown keys\n if (existingValue === undefined) {\n return {\n success: false,\n error: `Unknown configuration key: \"${key}\". Use \"search-hub config\" to see available keys.`,\n };\n }\n\n const parsedValue = parseValue(value, existingValue);\n\n setNestedValue(\n config as unknown as Record<string, unknown>,\n key,\n parsedValue\n );\n\n return {\n success: true,\n value: formatValue(parsedValue),\n };\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProviderName, Article } from '../../providers/base/types.js';
|
|
2
|
+
export type ExportFormat = 'ids' | 'json' | 'jsonl';
|
|
3
|
+
export type IdType = 'doi' | 'pmid' | 'all';
|
|
4
|
+
export interface ExportCommandOptions {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
format: ExportFormat;
|
|
7
|
+
outputPath?: string;
|
|
8
|
+
providers?: ProviderName[];
|
|
9
|
+
idType?: IdType;
|
|
10
|
+
}
|
|
11
|
+
export interface CommandLineOptions {
|
|
12
|
+
format?: string | undefined;
|
|
13
|
+
output?: string | undefined;
|
|
14
|
+
db?: string | undefined;
|
|
15
|
+
idType?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface ValidationResult {
|
|
18
|
+
valid: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function parseExportOptions(sessionId: string, options: CommandLineOptions): ExportCommandOptions;
|
|
22
|
+
export declare function validateExportInput(options: ExportCommandOptions): ValidationResult;
|
|
23
|
+
export declare function formatIds(articles: Article[], idType: IdType): string;
|
|
24
|
+
export declare function formatJson(articles: Article[]): string;
|
|
25
|
+
export declare function formatJsonl(articles: Article[]): string;
|
|
26
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAG7D,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AACpD,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAE5C,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,kBAAkB,GAC1B,oBAAoB,CAmBtB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,gBAAgB,CAgCnF;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAsBrE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAEtD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAKvD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { parseProviderNames } from "../utils/validation.js";
|
|
2
|
+
const VALID_FORMATS = ["ids", "json", "jsonl"];
|
|
3
|
+
const VALID_ID_TYPES = ["doi", "pmid", "all"];
|
|
4
|
+
function parseExportOptions(sessionId, options) {
|
|
5
|
+
const result = {
|
|
6
|
+
sessionId,
|
|
7
|
+
format: options.format || "jsonl"
|
|
8
|
+
};
|
|
9
|
+
if (options.output) {
|
|
10
|
+
result.outputPath = options.output;
|
|
11
|
+
}
|
|
12
|
+
if (options.db) {
|
|
13
|
+
result.providers = parseProviderNames(options.db);
|
|
14
|
+
}
|
|
15
|
+
if (options.idType) {
|
|
16
|
+
result.idType = options.idType;
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
function validateExportInput(options) {
|
|
21
|
+
if (!options.sessionId || options.sessionId.trim() === "") {
|
|
22
|
+
return {
|
|
23
|
+
valid: false,
|
|
24
|
+
error: "A session ID is required"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (!VALID_FORMATS.includes(options.format)) {
|
|
28
|
+
return {
|
|
29
|
+
valid: false,
|
|
30
|
+
error: `Invalid format: ${options.format}. Valid formats are: ${VALID_FORMATS.join(", ")}`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (options.idType) {
|
|
34
|
+
if (!VALID_ID_TYPES.includes(options.idType)) {
|
|
35
|
+
return {
|
|
36
|
+
valid: false,
|
|
37
|
+
error: `Invalid id-type: ${options.idType}. Valid types are: ${VALID_ID_TYPES.join(", ")}`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (options.format !== "ids") {
|
|
41
|
+
return {
|
|
42
|
+
valid: false,
|
|
43
|
+
error: "--id-type can only be used with --format ids"
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { valid: true };
|
|
48
|
+
}
|
|
49
|
+
function formatIds(articles, idType) {
|
|
50
|
+
const ids = [];
|
|
51
|
+
for (const article of articles) {
|
|
52
|
+
if (idType === "doi") {
|
|
53
|
+
if (article.doi) {
|
|
54
|
+
ids.push(article.doi);
|
|
55
|
+
}
|
|
56
|
+
} else if (idType === "pmid") {
|
|
57
|
+
if (article.pmid) {
|
|
58
|
+
ids.push(article.pmid);
|
|
59
|
+
}
|
|
60
|
+
} else if (idType === "all") {
|
|
61
|
+
if (article.doi) ids.push(`doi:${article.doi}`);
|
|
62
|
+
if (article.pmid) ids.push(`pmid:${article.pmid}`);
|
|
63
|
+
if (article.arxivId) ids.push(`arxiv:${article.arxivId}`);
|
|
64
|
+
if (article.scopusId) ids.push(`scopus:${article.scopusId}`);
|
|
65
|
+
if (article.ericId) ids.push(`eric:${article.ericId}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return ids.join("\n");
|
|
69
|
+
}
|
|
70
|
+
function formatJson(articles) {
|
|
71
|
+
return JSON.stringify(articles, null, 2);
|
|
72
|
+
}
|
|
73
|
+
function formatJsonl(articles) {
|
|
74
|
+
if (articles.length === 0) {
|
|
75
|
+
return "";
|
|
76
|
+
}
|
|
77
|
+
return articles.map((article) => JSON.stringify(article)).join("\n");
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
formatIds,
|
|
81
|
+
formatJson,
|
|
82
|
+
formatJsonl,
|
|
83
|
+
parseExportOptions,
|
|
84
|
+
validateExportInput
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sources":["../../../src/cli/commands/export.ts"],"sourcesContent":["import type { ProviderName } from '../../providers/base/types.js';\nimport type { Article } from '../../providers/base/types.js';\nimport { parseProviderNames } from '../utils/validation.js';\n\nexport type ExportFormat = 'ids' | 'json' | 'jsonl';\nexport type IdType = 'doi' | 'pmid' | 'all';\n\nexport interface ExportCommandOptions {\n sessionId: string;\n format: ExportFormat;\n outputPath?: string;\n providers?: ProviderName[];\n idType?: IdType;\n}\n\nexport interface CommandLineOptions {\n format?: string | undefined;\n output?: string | undefined;\n db?: string | undefined;\n idType?: string | undefined;\n}\n\nexport interface ValidationResult {\n valid: boolean;\n error?: string;\n}\n\nconst VALID_FORMATS: ExportFormat[] = ['ids', 'json', 'jsonl'];\nconst VALID_ID_TYPES: IdType[] = ['doi', 'pmid', 'all'];\n\nexport function parseExportOptions(\n sessionId: string,\n options: CommandLineOptions\n): ExportCommandOptions {\n const result: ExportCommandOptions = {\n sessionId,\n format: (options.format as ExportFormat) || 'jsonl',\n };\n\n if (options.output) {\n result.outputPath = options.output;\n }\n\n if (options.db) {\n result.providers = parseProviderNames(options.db);\n }\n\n if (options.idType) {\n result.idType = options.idType as IdType;\n }\n\n return result;\n}\n\nexport function validateExportInput(options: ExportCommandOptions): ValidationResult {\n if (!options.sessionId || options.sessionId.trim() === '') {\n return {\n valid: false,\n error: 'A session ID is required',\n };\n }\n\n if (!VALID_FORMATS.includes(options.format)) {\n return {\n valid: false,\n error: `Invalid format: ${options.format}. Valid formats are: ${VALID_FORMATS.join(', ')}`,\n };\n }\n\n if (options.idType) {\n if (!VALID_ID_TYPES.includes(options.idType)) {\n return {\n valid: false,\n error: `Invalid id-type: ${options.idType}. Valid types are: ${VALID_ID_TYPES.join(', ')}`,\n };\n }\n\n if (options.format !== 'ids') {\n return {\n valid: false,\n error: '--id-type can only be used with --format ids',\n };\n }\n }\n\n return { valid: true };\n}\n\nexport function formatIds(articles: Article[], idType: IdType): string {\n const ids: string[] = [];\n\n for (const article of articles) {\n if (idType === 'doi') {\n if (article.doi) {\n ids.push(article.doi);\n }\n } else if (idType === 'pmid') {\n if (article.pmid) {\n ids.push(article.pmid);\n }\n } else if (idType === 'all') {\n if (article.doi) ids.push(`doi:${article.doi}`);\n if (article.pmid) ids.push(`pmid:${article.pmid}`);\n if (article.arxivId) ids.push(`arxiv:${article.arxivId}`);\n if (article.scopusId) ids.push(`scopus:${article.scopusId}`);\n if (article.ericId) ids.push(`eric:${article.ericId}`);\n }\n }\n\n return ids.join('\\n');\n}\n\nexport function formatJson(articles: Article[]): string {\n return JSON.stringify(articles, null, 2);\n}\n\nexport function formatJsonl(articles: Article[]): string {\n if (articles.length === 0) {\n return '';\n }\n return articles.map((article) => JSON.stringify(article)).join('\\n');\n}\n"],"names":[],"mappings":";AA2BA,MAAM,gBAAgC,CAAC,OAAO,QAAQ,OAAO;AAC7D,MAAM,iBAA2B,CAAC,OAAO,QAAQ,KAAK;AAE/C,SAAS,mBACd,WACA,SACsB;AACtB,QAAM,SAA+B;AAAA,IACnC;AAAA,IACA,QAAS,QAAQ,UAA2B;AAAA,EAAA;AAG9C,MAAI,QAAQ,QAAQ;AAClB,WAAO,aAAa,QAAQ;AAAA,EAC9B;AAEA,MAAI,QAAQ,IAAI;AACd,WAAO,YAAY,mBAAmB,QAAQ,EAAE;AAAA,EAClD;AAEA,MAAI,QAAQ,QAAQ;AAClB,WAAO,SAAS,QAAQ;AAAA,EAC1B;AAEA,SAAO;AACT;AAEO,SAAS,oBAAoB,SAAiD;AACnF,MAAI,CAAC,QAAQ,aAAa,QAAQ,UAAU,KAAA,MAAW,IAAI;AACzD,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IAAA;AAAA,EAEX;AAEA,MAAI,CAAC,cAAc,SAAS,QAAQ,MAAM,GAAG;AAC3C,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO,mBAAmB,QAAQ,MAAM,wBAAwB,cAAc,KAAK,IAAI,CAAC;AAAA,IAAA;AAAA,EAE5F;AAEA,MAAI,QAAQ,QAAQ;AAClB,QAAI,CAAC,eAAe,SAAS,QAAQ,MAAM,GAAG;AAC5C,aAAO;AAAA,QACL,OAAO;AAAA,QACP,OAAO,oBAAoB,QAAQ,MAAM,sBAAsB,eAAe,KAAK,IAAI,CAAC;AAAA,MAAA;AAAA,IAE5F;AAEA,QAAI,QAAQ,WAAW,OAAO;AAC5B,aAAO;AAAA,QACL,OAAO;AAAA,QACP,OAAO;AAAA,MAAA;AAAA,IAEX;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,KAAA;AAClB;AAEO,SAAS,UAAU,UAAqB,QAAwB;AACrE,QAAM,MAAgB,CAAA;AAEtB,aAAW,WAAW,UAAU;AAC9B,QAAI,WAAW,OAAO;AACpB,UAAI,QAAQ,KAAK;AACf,YAAI,KAAK,QAAQ,GAAG;AAAA,MACtB;AAAA,IACF,WAAW,WAAW,QAAQ;AAC5B,UAAI,QAAQ,MAAM;AAChB,YAAI,KAAK,QAAQ,IAAI;AAAA,MACvB;AAAA,IACF,WAAW,WAAW,OAAO;AAC3B,UAAI,QAAQ,IAAK,KAAI,KAAK,OAAO,QAAQ,GAAG,EAAE;AAC9C,UAAI,QAAQ,KAAM,KAAI,KAAK,QAAQ,QAAQ,IAAI,EAAE;AACjD,UAAI,QAAQ,QAAS,KAAI,KAAK,SAAS,QAAQ,OAAO,EAAE;AACxD,UAAI,QAAQ,SAAU,KAAI,KAAK,UAAU,QAAQ,QAAQ,EAAE;AAC3D,UAAI,QAAQ,OAAQ,KAAI,KAAK,QAAQ,QAAQ,MAAM,EAAE;AAAA,IACvD;AAAA,EACF;AAEA,SAAO,IAAI,KAAK,IAAI;AACtB;AAEO,SAAS,WAAW,UAA6B;AACtD,SAAO,KAAK,UAAU,UAAU,MAAM,CAAC;AACzC;AAEO,SAAS,YAAY,UAA6B;AACvD,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO;AAAA,EACT;AACA,SAAO,SAAS,IAAI,CAAC,YAAY,KAAK,UAAU,OAAO,CAAC,EAAE,KAAK,IAAI;AACrE;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the init command.
|
|
3
|
+
*/
|
|
4
|
+
export interface InitOptions {
|
|
5
|
+
/** Config directory (defaults to platform-specific via getConfigDir()) */
|
|
6
|
+
configDir?: string;
|
|
7
|
+
/** Data directory (defaults to platform-specific via getDataDir()) */
|
|
8
|
+
dataDir?: string;
|
|
9
|
+
/** Force overwrite if directory already exists */
|
|
10
|
+
force?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Result of the init command.
|
|
14
|
+
*/
|
|
15
|
+
export interface InitResult {
|
|
16
|
+
/** Whether initialization was successful */
|
|
17
|
+
success: boolean;
|
|
18
|
+
/** Path to the created config file */
|
|
19
|
+
configPath: string;
|
|
20
|
+
/** Path to the sessions directory */
|
|
21
|
+
sessionsDir: string;
|
|
22
|
+
/** Path to the config directory */
|
|
23
|
+
configDir: string;
|
|
24
|
+
/** Path to the data directory */
|
|
25
|
+
dataDir: string;
|
|
26
|
+
/** Whether files already existed (only when success=false) */
|
|
27
|
+
alreadyExists?: boolean;
|
|
28
|
+
/** Whether existing files were overwritten (only when force=true) */
|
|
29
|
+
overwritten?: boolean;
|
|
30
|
+
/** Message describing the result */
|
|
31
|
+
message?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the search-hub configuration directory.
|
|
35
|
+
*
|
|
36
|
+
* Creates:
|
|
37
|
+
* - Config directory with config.toml
|
|
38
|
+
* - Data directory with sessions/ subdirectory
|
|
39
|
+
*
|
|
40
|
+
* On Linux (XDG):
|
|
41
|
+
* - ~/.config/search-hub/config.toml
|
|
42
|
+
* - ~/.local/share/search-hub/sessions/
|
|
43
|
+
*/
|
|
44
|
+
export declare function init(options?: InitOptions): Promise<InitResult>;
|
|
45
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qEAAqE;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAqGD;;;;;;;;;;GAUG;AACH,wBAAsB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAiDzE"}
|