paper-search-cli 0.3.1 → 0.3.2
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/README.md +1 -1
- package/README.zh.md +1 -1
- package/dist/capabilities/body-snippet-search/handler.d.ts +9 -0
- package/dist/capabilities/body-snippet-search/handler.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/handler.js +17 -0
- package/dist/capabilities/body-snippet-search/handler.js.map +1 -0
- package/dist/capabilities/body-snippet-search/index.d.ts +7 -0
- package/dist/capabilities/body-snippet-search/index.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/index.js +6 -0
- package/dist/capabilities/body-snippet-search/index.js.map +1 -0
- package/dist/capabilities/body-snippet-search/schemas.d.ts +36 -0
- package/dist/capabilities/body-snippet-search/schemas.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/schemas.js +16 -0
- package/dist/capabilities/body-snippet-search/schemas.js.map +1 -0
- package/dist/capabilities/body-snippet-search/service.d.ts +4 -0
- package/dist/capabilities/body-snippet-search/service.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/service.js +4 -0
- package/dist/capabilities/body-snippet-search/service.js.map +1 -0
- package/dist/capabilities/body-snippet-search/tools.d.ts +187 -0
- package/dist/capabilities/body-snippet-search/tools.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/tools.js +49 -0
- package/dist/capabilities/body-snippet-search/tools.js.map +1 -0
- package/dist/capabilities/body-snippet-search/types.d.ts +14 -0
- package/dist/capabilities/body-snippet-search/types.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/types.js +2 -0
- package/dist/capabilities/body-snippet-search/types.js.map +1 -0
- package/dist/capabilities/citation-expansion/CitationService.d.ts +47 -0
- package/dist/capabilities/citation-expansion/CitationService.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/CitationService.js +243 -0
- package/dist/capabilities/citation-expansion/CitationService.js.map +1 -0
- package/dist/capabilities/citation-expansion/handler.d.ts +36 -0
- package/dist/capabilities/citation-expansion/handler.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/handler.js +44 -0
- package/dist/capabilities/citation-expansion/handler.js.map +1 -0
- package/dist/capabilities/citation-expansion/index.d.ts +6 -0
- package/dist/capabilities/citation-expansion/index.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/index.js +5 -0
- package/dist/capabilities/citation-expansion/index.js.map +1 -0
- package/dist/capabilities/citation-expansion/schemas.d.ts +28 -0
- package/dist/capabilities/citation-expansion/schemas.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/schemas.js +13 -0
- package/dist/capabilities/citation-expansion/schemas.js.map +1 -0
- package/dist/capabilities/citation-expansion/tools.d.ts +82 -0
- package/dist/capabilities/citation-expansion/tools.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/tools.js +48 -0
- package/dist/capabilities/citation-expansion/tools.js.map +1 -0
- package/dist/capabilities/citation-expansion/types.d.ts +22 -0
- package/dist/capabilities/citation-expansion/types.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/types.js +2 -0
- package/dist/capabilities/citation-expansion/types.js.map +1 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.d.ts +3 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.js +142 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.js.map +1 -0
- package/dist/capabilities/journal-metrics/handler.d.ts +12 -0
- package/dist/capabilities/journal-metrics/handler.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/handler.js +38 -0
- package/dist/capabilities/journal-metrics/handler.js.map +1 -0
- package/dist/capabilities/journal-metrics/index.d.ts +6 -0
- package/dist/capabilities/journal-metrics/index.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/index.js +5 -0
- package/dist/capabilities/journal-metrics/index.js.map +1 -0
- package/dist/capabilities/journal-metrics/schemas.d.ts +28 -0
- package/dist/capabilities/journal-metrics/schemas.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/schemas.js +13 -0
- package/dist/capabilities/journal-metrics/schemas.js.map +1 -0
- package/dist/capabilities/journal-metrics/tools.d.ts +67 -0
- package/dist/capabilities/journal-metrics/tools.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/tools.js +27 -0
- package/dist/capabilities/journal-metrics/tools.js.map +1 -0
- package/dist/capabilities/journal-metrics/types.d.ts +36 -0
- package/dist/capabilities/journal-metrics/types.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/types.js +2 -0
- package/dist/capabilities/journal-metrics/types.js.map +1 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.d.ts +9 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.js +78 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.js.map +1 -0
- package/dist/capabilities/metadata-search/handler.d.ts +23 -0
- package/dist/capabilities/metadata-search/handler.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/handler.js +163 -0
- package/dist/capabilities/metadata-search/handler.js.map +1 -0
- package/dist/capabilities/metadata-search/index.d.ts +6 -0
- package/dist/capabilities/metadata-search/index.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/index.js +5 -0
- package/dist/capabilities/metadata-search/index.js.map +1 -0
- package/dist/capabilities/metadata-search/schemas.d.ts +83 -0
- package/dist/capabilities/metadata-search/schemas.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/schemas.js +81 -0
- package/dist/capabilities/metadata-search/schemas.js.map +1 -0
- package/dist/capabilities/metadata-search/tools.d.ts +178 -0
- package/dist/capabilities/metadata-search/tools.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/tools.js +75 -0
- package/dist/capabilities/metadata-search/tools.js.map +1 -0
- package/dist/capabilities/metadata-search/types.d.ts +13 -0
- package/dist/capabilities/metadata-search/types.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/types.js +2 -0
- package/dist/capabilities/metadata-search/types.js.map +1 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.d.ts +22 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.js +2 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.js.map +1 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts +10 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js +53 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js.map +1 -0
- package/dist/capabilities/pdf-discovery/handler.d.ts +19 -0
- package/dist/capabilities/pdf-discovery/handler.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/handler.js +56 -0
- package/dist/capabilities/pdf-discovery/handler.js.map +1 -0
- package/dist/capabilities/pdf-discovery/index.d.ts +7 -0
- package/dist/capabilities/pdf-discovery/index.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/index.js +5 -0
- package/dist/capabilities/pdf-discovery/index.js.map +1 -0
- package/dist/capabilities/pdf-discovery/schemas.d.ts +37 -0
- package/dist/capabilities/pdf-discovery/schemas.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/schemas.js +22 -0
- package/dist/capabilities/pdf-discovery/schemas.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.js +27 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.js +21 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.js +35 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.js +21 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.js +29 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tools.d.ts +114 -0
- package/dist/capabilities/pdf-discovery/tools.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tools.js +42 -0
- package/dist/capabilities/pdf-discovery/tools.js.map +1 -0
- package/dist/capabilities/pdf-discovery/types.d.ts +19 -0
- package/dist/capabilities/pdf-discovery/types.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/types.js +2 -0
- package/dist/capabilities/pdf-discovery/types.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/cli.js.map +1 -1
- package/dist/core/capabilityProfile.d.ts +1 -17
- package/dist/core/capabilityProfile.d.ts.map +1 -1
- package/dist/core/capabilityProfile.js +1 -166
- package/dist/core/capabilityProfile.js.map +1 -1
- package/dist/core/diagnostics.d.ts +1 -42
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/diagnostics.js +1 -585
- package/dist/core/diagnostics.js.map +1 -1
- package/dist/core/handleToolCall.d.ts +1 -0
- package/dist/core/handleToolCall.d.ts.map +1 -1
- package/dist/core/handleToolCall.js +265 -509
- package/dist/core/handleToolCall.js.map +1 -1
- package/dist/core/httpPolicies.d.ts +2 -0
- package/dist/core/httpPolicies.d.ts.map +1 -0
- package/dist/core/httpPolicies.js +2 -0
- package/dist/core/httpPolicies.js.map +1 -0
- package/dist/core/liveSmoke.d.ts +1 -41
- package/dist/core/liveSmoke.d.ts.map +1 -1
- package/dist/core/liveSmoke.js +1 -225
- package/dist/core/liveSmoke.js.map +1 -1
- package/dist/core/platformFactories.d.ts +2 -0
- package/dist/core/platformFactories.d.ts.map +1 -0
- package/dist/core/platformFactories.js +2 -0
- package/dist/core/platformFactories.js.map +1 -0
- package/dist/core/platformMetadata.d.ts +1 -27
- package/dist/core/platformMetadata.d.ts.map +1 -1
- package/dist/core/platformMetadata.js +1 -257
- package/dist/core/platformMetadata.js.map +1 -1
- package/dist/core/schemas.d.ts +10 -202
- package/dist/core/schemas.d.ts.map +1 -1
- package/dist/core/schemas.js +11 -118
- package/dist/core/schemas.js.map +1 -1
- package/dist/core/searchers.d.ts +24 -24
- package/dist/core/searchers.d.ts.map +1 -1
- package/dist/core/searchers.js +14 -79
- package/dist/core/searchers.js.map +1 -1
- package/dist/core/textReports.d.ts +1 -20
- package/dist/core/textReports.d.ts.map +1 -1
- package/dist/core/textReports.js +1 -84
- package/dist/core/textReports.js.map +1 -1
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/core/tools.js +15 -237
- package/dist/core/tools.js.map +1 -1
- package/dist/infrastructure/cache/RequestCache.d.ts +26 -0
- package/dist/infrastructure/cache/RequestCache.d.ts.map +1 -0
- package/dist/infrastructure/cache/RequestCache.js +66 -0
- package/dist/infrastructure/cache/RequestCache.js.map +1 -0
- package/dist/infrastructure/http/ErrorHandler.d.ts +99 -0
- package/dist/infrastructure/http/ErrorHandler.d.ts.map +1 -0
- package/dist/infrastructure/http/ErrorHandler.js +266 -0
- package/dist/infrastructure/http/ErrorHandler.js.map +1 -0
- package/dist/infrastructure/http/HttpClient.d.ts +31 -0
- package/dist/infrastructure/http/HttpClient.d.ts.map +1 -0
- package/dist/infrastructure/http/HttpClient.js +50 -0
- package/dist/infrastructure/http/HttpClient.js.map +1 -0
- package/dist/infrastructure/pdf/PDFExtractor.d.ts +34 -0
- package/dist/infrastructure/pdf/PDFExtractor.d.ts.map +1 -0
- package/dist/infrastructure/pdf/PDFExtractor.js +130 -0
- package/dist/infrastructure/pdf/PDFExtractor.js.map +1 -0
- package/dist/infrastructure/pdf/PdfDownload.d.ts +7 -0
- package/dist/infrastructure/pdf/PdfDownload.d.ts.map +1 -0
- package/dist/infrastructure/pdf/PdfDownload.js +175 -0
- package/dist/infrastructure/pdf/PdfDownload.js.map +1 -0
- package/dist/infrastructure/rate-limit/RateLimiter.d.ts +50 -0
- package/dist/infrastructure/rate-limit/RateLimiter.d.ts.map +1 -0
- package/dist/infrastructure/rate-limit/RateLimiter.js +128 -0
- package/dist/infrastructure/rate-limit/RateLimiter.js.map +1 -0
- package/dist/infrastructure/security/SecurityUtils.d.ts +80 -0
- package/dist/infrastructure/security/SecurityUtils.d.ts.map +1 -0
- package/dist/infrastructure/security/SecurityUtils.js +357 -0
- package/dist/infrastructure/security/SecurityUtils.js.map +1 -0
- package/dist/management/capability-profile/index.d.ts +18 -0
- package/dist/management/capability-profile/index.d.ts.map +1 -0
- package/dist/management/capability-profile/index.js +167 -0
- package/dist/management/capability-profile/index.js.map +1 -0
- package/dist/management/config/index.d.ts +2 -0
- package/dist/management/config/index.d.ts.map +1 -0
- package/dist/management/config/index.js +2 -0
- package/dist/management/config/index.js.map +1 -0
- package/dist/management/diagnostics/index.d.ts +43 -0
- package/dist/management/diagnostics/index.d.ts.map +1 -0
- package/dist/management/diagnostics/index.js +586 -0
- package/dist/management/diagnostics/index.js.map +1 -0
- package/dist/management/reports/index.d.ts +21 -0
- package/dist/management/reports/index.d.ts.map +1 -0
- package/dist/management/reports/index.js +85 -0
- package/dist/management/reports/index.js.map +1 -0
- package/dist/management/skills/index.d.ts +2 -0
- package/dist/management/skills/index.d.ts.map +1 -0
- package/dist/management/skills/index.js +2 -0
- package/dist/management/skills/index.js.map +1 -0
- package/dist/management/smoke/index.d.ts +42 -0
- package/dist/management/smoke/index.d.ts.map +1 -0
- package/dist/management/smoke/index.js +226 -0
- package/dist/management/smoke/index.js.map +1 -0
- package/dist/registry/aliases.d.ts +2 -0
- package/dist/registry/aliases.d.ts.map +1 -0
- package/dist/registry/aliases.js +2 -0
- package/dist/registry/aliases.js.map +1 -0
- package/dist/registry/httpPolicies.d.ts +3 -0
- package/dist/registry/httpPolicies.d.ts.map +1 -0
- package/dist/registry/httpPolicies.js +17 -0
- package/dist/registry/httpPolicies.js.map +1 -0
- package/dist/registry/platformFactories.d.ts +8 -0
- package/dist/registry/platformFactories.d.ts.map +1 -0
- package/dist/registry/platformFactories.js +55 -0
- package/dist/registry/platformFactories.js.map +1 -0
- package/dist/registry/platformMetadata.d.ts +39 -0
- package/dist/registry/platformMetadata.d.ts.map +1 -0
- package/dist/registry/platformMetadata.js +321 -0
- package/dist/registry/platformMetadata.js.map +1 -0
- package/dist/services/CitationService.d.ts +2 -65
- package/dist/services/CitationService.d.ts.map +1 -1
- package/dist/services/CitationService.js +1 -242
- package/dist/services/CitationService.js.map +1 -1
- package/dist/services/JournalMetricsService.d.ts +2 -37
- package/dist/services/JournalMetricsService.d.ts.map +1 -1
- package/dist/services/JournalMetricsService.js +1 -141
- package/dist/services/JournalMetricsService.js.map +1 -1
- package/dist/services/MultiSourceSearchService.d.ts +2 -18
- package/dist/services/MultiSourceSearchService.d.ts.map +1 -1
- package/dist/services/MultiSourceSearchService.js +1 -77
- package/dist/services/MultiSourceSearchService.js.map +1 -1
- package/dist/services/OpenAccessFallbackService.d.ts +3 -40
- package/dist/services/OpenAccessFallbackService.d.ts.map +1 -1
- package/dist/services/OpenAccessFallbackService.js +1 -146
- package/dist/services/OpenAccessFallbackService.js.map +1 -1
- package/dist/utils/ErrorHandler.d.ts +2 -98
- package/dist/utils/ErrorHandler.d.ts.map +1 -1
- package/dist/utils/ErrorHandler.js +2 -265
- package/dist/utils/ErrorHandler.js.map +1 -1
- package/dist/utils/HttpClient.d.ts +1 -5
- package/dist/utils/HttpClient.d.ts.map +1 -1
- package/dist/utils/HttpClient.js +1 -29
- package/dist/utils/HttpClient.js.map +1 -1
- package/dist/utils/PDFExtractor.d.ts +2 -33
- package/dist/utils/PDFExtractor.d.ts.map +1 -1
- package/dist/utils/PDFExtractor.js +2 -129
- package/dist/utils/PDFExtractor.js.map +1 -1
- package/dist/utils/PdfDownload.d.ts +1 -6
- package/dist/utils/PdfDownload.d.ts.map +1 -1
- package/dist/utils/PdfDownload.js +1 -141
- package/dist/utils/PdfDownload.js.map +1 -1
- package/dist/utils/RateLimiter.d.ts +1 -49
- package/dist/utils/RateLimiter.d.ts.map +1 -1
- package/dist/utils/RateLimiter.js +1 -127
- package/dist/utils/RateLimiter.js.map +1 -1
- package/dist/utils/RequestCache.d.ts +2 -25
- package/dist/utils/RequestCache.d.ts.map +1 -1
- package/dist/utils/RequestCache.js +2 -65
- package/dist/utils/RequestCache.js.map +1 -1
- package/dist/utils/SecurityUtils.d.ts +2 -79
- package/dist/utils/SecurityUtils.d.ts.map +1 -1
- package/dist/utils/SecurityUtils.js +2 -356
- package/dist/utils/SecurityUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
includeRaw?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export interface JournalMetricsRow {
|
|
6
|
-
journal: string;
|
|
7
|
-
status: 'found' | 'not_found' | 'error';
|
|
8
|
-
source: 'easyScholar';
|
|
9
|
-
message?: string;
|
|
10
|
-
core: {
|
|
11
|
-
impact_factor?: string;
|
|
12
|
-
impact_factor_5y?: string;
|
|
13
|
-
jcr_quartile?: string;
|
|
14
|
-
ssci_quartile?: string;
|
|
15
|
-
jci?: string;
|
|
16
|
-
cas_base?: string;
|
|
17
|
-
cas_upgraded?: string;
|
|
18
|
-
cas_small?: string;
|
|
19
|
-
cas_top?: string;
|
|
20
|
-
cas_zone?: string;
|
|
21
|
-
cas_small_zones?: string[];
|
|
22
|
-
esi?: string;
|
|
23
|
-
warning?: string;
|
|
24
|
-
pku?: string;
|
|
25
|
-
cssci?: string;
|
|
26
|
-
cscd?: string;
|
|
27
|
-
ahci?: string;
|
|
28
|
-
ccf?: string;
|
|
29
|
-
ei?: string;
|
|
30
|
-
china_st_core?: string;
|
|
31
|
-
};
|
|
32
|
-
official_all?: Record<string, unknown>;
|
|
33
|
-
official_select?: Record<string, unknown>;
|
|
34
|
-
custom_rank?: unknown;
|
|
35
|
-
}
|
|
36
|
-
export declare function queryJournalMetrics(options: QueryJournalMetricsOptions): Promise<JournalMetricsRow[]>;
|
|
37
|
-
export {};
|
|
1
|
+
export { queryJournalMetrics } from '../capabilities/journal-metrics/JournalMetricsService.js';
|
|
2
|
+
export type { JournalMetricsRow, QueryJournalMetricsOptions } from '../capabilities/journal-metrics/types.js';
|
|
38
3
|
//# sourceMappingURL=JournalMetricsService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JournalMetricsService.d.ts","sourceRoot":"","sources":["../../src/services/JournalMetricsService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JournalMetricsService.d.ts","sourceRoot":"","sources":["../../src/services/JournalMetricsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAE/F,YAAY,EACV,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,0CAA0C,CAAC"}
|
|
@@ -1,142 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const EASYSCHOLAR_URL = 'https://www.easyscholar.cc/open/getPublicationRank';
|
|
3
|
-
const REQUEST_DELAY_MS = 500;
|
|
4
|
-
function easyScholarKey() {
|
|
5
|
-
const key = process.env.EASYSCHOLAR_KEY || '';
|
|
6
|
-
if (!key.trim()) {
|
|
7
|
-
throw new Error('EasyScholar API key not configured. Set EASYSCHOLAR_KEY with `paper-search setup EASYSCHOLAR_KEY`.');
|
|
8
|
-
}
|
|
9
|
-
return key.trim();
|
|
10
|
-
}
|
|
11
|
-
function uniqueJournals(journals) {
|
|
12
|
-
const seen = new Set();
|
|
13
|
-
const unique = [];
|
|
14
|
-
for (const journal of journals.map(item => item.trim()).filter(Boolean)) {
|
|
15
|
-
if (seen.has(journal))
|
|
16
|
-
continue;
|
|
17
|
-
seen.add(journal);
|
|
18
|
-
unique.push(journal);
|
|
19
|
-
}
|
|
20
|
-
return unique;
|
|
21
|
-
}
|
|
22
|
-
function stringValue(value) {
|
|
23
|
-
if (typeof value !== 'string')
|
|
24
|
-
return undefined;
|
|
25
|
-
const trimmed = value.trim();
|
|
26
|
-
return trimmed || undefined;
|
|
27
|
-
}
|
|
28
|
-
function extractZone(value) {
|
|
29
|
-
const text = stringValue(value);
|
|
30
|
-
const match = text?.match(/(\d+)区/);
|
|
31
|
-
return match?.[1];
|
|
32
|
-
}
|
|
33
|
-
function extractSmallZones(value) {
|
|
34
|
-
const text = stringValue(value);
|
|
35
|
-
if (!text)
|
|
36
|
-
return undefined;
|
|
37
|
-
const matches = [...text.matchAll(/([^/。;;]+?)([1-4])区/g)].map(match => `${match[1].trim()}${match[2]}区`);
|
|
38
|
-
return matches.length ? matches : undefined;
|
|
39
|
-
}
|
|
40
|
-
function normalizeOfficialRank(all) {
|
|
41
|
-
const casUpgraded = stringValue(all.sciUp);
|
|
42
|
-
const casBase = stringValue(all.sciBase);
|
|
43
|
-
const casSmall = stringValue(all.sciUpSmall);
|
|
44
|
-
const core = {
|
|
45
|
-
impact_factor: stringValue(all.sciif),
|
|
46
|
-
impact_factor_5y: stringValue(all.sciif5),
|
|
47
|
-
jcr_quartile: stringValue(all.sci),
|
|
48
|
-
ssci_quartile: stringValue(all.ssci),
|
|
49
|
-
jci: stringValue(all.jci),
|
|
50
|
-
cas_base: casBase,
|
|
51
|
-
cas_upgraded: casUpgraded,
|
|
52
|
-
cas_small: casSmall,
|
|
53
|
-
cas_top: stringValue(all.sciUpTop),
|
|
54
|
-
cas_zone: extractZone(casUpgraded) || extractZone(casBase),
|
|
55
|
-
cas_small_zones: extractSmallZones(casSmall),
|
|
56
|
-
esi: stringValue(all.esi),
|
|
57
|
-
warning: stringValue(all.sciwarn),
|
|
58
|
-
pku: stringValue(all.pku),
|
|
59
|
-
cssci: stringValue(all.cssci),
|
|
60
|
-
cscd: stringValue(all.cscd),
|
|
61
|
-
ahci: stringValue(all.ahci),
|
|
62
|
-
ccf: stringValue(all.ccf),
|
|
63
|
-
ei: stringValue(all.eii),
|
|
64
|
-
china_st_core: stringValue(all.zhongguokejihexin)
|
|
65
|
-
};
|
|
66
|
-
return Object.fromEntries(Object.entries(core).filter(([, value]) => value !== undefined));
|
|
67
|
-
}
|
|
68
|
-
function formatResult(journal, data, includeRaw) {
|
|
69
|
-
if (data.code !== 200 || data.msg !== 'SUCCESS' || !data.data) {
|
|
70
|
-
return {
|
|
71
|
-
journal,
|
|
72
|
-
status: 'not_found',
|
|
73
|
-
source: 'easyScholar',
|
|
74
|
-
message: data.msg || `EasyScholar returned code ${data.code ?? 'unknown'}`,
|
|
75
|
-
core: {}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const officialAll = data.data.officialRank?.all || {};
|
|
79
|
-
const officialSelect = data.data.officialRank?.select || {};
|
|
80
|
-
if (Object.keys(officialAll).length === 0) {
|
|
81
|
-
return {
|
|
82
|
-
journal,
|
|
83
|
-
status: 'not_found',
|
|
84
|
-
source: 'easyScholar',
|
|
85
|
-
message: 'No officialRank.all fields returned for this journal.',
|
|
86
|
-
core: {}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
const row = {
|
|
90
|
-
journal,
|
|
91
|
-
status: 'found',
|
|
92
|
-
source: 'easyScholar',
|
|
93
|
-
core: normalizeOfficialRank(officialAll)
|
|
94
|
-
};
|
|
95
|
-
if (includeRaw) {
|
|
96
|
-
row.official_all = officialAll;
|
|
97
|
-
row.official_select = officialSelect;
|
|
98
|
-
row.custom_rank = data.data.customRank || {};
|
|
99
|
-
}
|
|
100
|
-
return row;
|
|
101
|
-
}
|
|
102
|
-
async function delay(ms) {
|
|
103
|
-
await new Promise(resolve => setTimeout(resolve, ms));
|
|
104
|
-
}
|
|
105
|
-
export async function queryJournalMetrics(options) {
|
|
106
|
-
const secretKey = easyScholarKey();
|
|
107
|
-
const journals = uniqueJournals(options.journals);
|
|
108
|
-
if (journals.length === 0) {
|
|
109
|
-
throw new Error('Provide at least one journal name.');
|
|
110
|
-
}
|
|
111
|
-
const rows = [];
|
|
112
|
-
for (let index = 0; index < journals.length; index += 1) {
|
|
113
|
-
const journal = journals[index];
|
|
114
|
-
try {
|
|
115
|
-
const response = await axios.get(EASYSCHOLAR_URL, {
|
|
116
|
-
params: {
|
|
117
|
-
secretKey,
|
|
118
|
-
publicationName: journal
|
|
119
|
-
},
|
|
120
|
-
timeout: 15000,
|
|
121
|
-
headers: {
|
|
122
|
-
'User-Agent': 'Paper-Search-CLI/JournalMetrics'
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
rows.push(formatResult(journal, response.data, Boolean(options.includeRaw)));
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
rows.push({
|
|
129
|
-
journal,
|
|
130
|
-
status: 'error',
|
|
131
|
-
source: 'easyScholar',
|
|
132
|
-
message: error?.message || String(error),
|
|
133
|
-
core: {}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
if (index < journals.length - 1) {
|
|
137
|
-
await delay(REQUEST_DELAY_MS);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return rows;
|
|
141
|
-
}
|
|
1
|
+
export { queryJournalMetrics } from '../capabilities/journal-metrics/JournalMetricsService.js';
|
|
142
2
|
//# sourceMappingURL=JournalMetricsService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JournalMetricsService.js","sourceRoot":"","sources":["../../src/services/JournalMetricsService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"JournalMetricsService.js","sourceRoot":"","sources":["../../src/services/JournalMetricsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC"}
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { SearchOptions } from '../platforms/PaperSource.js';
|
|
4
|
-
export interface MultiSourceSearchResult {
|
|
5
|
-
query: string;
|
|
6
|
-
sources_requested: string;
|
|
7
|
-
sources_used: string[];
|
|
8
|
-
source_results: Record<string, number>;
|
|
9
|
-
errors: Record<string, string>;
|
|
10
|
-
failed_sources: string[];
|
|
11
|
-
warnings: string[];
|
|
12
|
-
total: number;
|
|
13
|
-
raw_total: number;
|
|
14
|
-
papers: Record<string, unknown>[];
|
|
15
|
-
}
|
|
16
|
-
export declare function parseSourceList(sources: string | undefined, searchers: Searchers): string[];
|
|
17
|
-
export declare function searchMultipleSources(searchers: Searchers, query: string, sources: string, options: SearchOptions, sourceTimeoutMs?: number): Promise<MultiSourceSearchResult>;
|
|
18
|
-
export declare function dedupePapers(papers: Paper[]): Paper[];
|
|
1
|
+
export { dedupePapers, parseSourceList, searchMultipleSources } from '../capabilities/metadata-search/MultiSourceSearchService.js';
|
|
2
|
+
export type { MultiSourceSearchResult } from '../capabilities/metadata-search/types.js';
|
|
19
3
|
//# sourceMappingURL=MultiSourceSearchService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSourceSearchService.d.ts","sourceRoot":"","sources":["../../src/services/MultiSourceSearchService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MultiSourceSearchService.d.ts","sourceRoot":"","sources":["../../src/services/MultiSourceSearchService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,qBAAqB,EACtB,MAAM,6DAA6D,CAAC;AAErE,YAAY,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -1,78 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { PaperFactory } from '../models/Paper.js';
|
|
3
|
-
import { withTimeout } from '../utils/SecurityUtils.js';
|
|
4
|
-
import { getAliasMap, getDefaultAllSources, resolvePlatformId } from '../core/platformMetadata.js';
|
|
5
|
-
const ALIASES = getAliasMap();
|
|
6
|
-
export function parseSourceList(sources, searchers) {
|
|
7
|
-
const requested = !sources || sources.trim() === '' ? 'crossref' : sources.trim();
|
|
8
|
-
if (requested.toLowerCase() === 'all') {
|
|
9
|
-
return getDefaultAllSources().filter(source => source in searchers);
|
|
10
|
-
}
|
|
11
|
-
return requested
|
|
12
|
-
.split(',')
|
|
13
|
-
.map(source => source.trim().toLowerCase())
|
|
14
|
-
.filter(Boolean)
|
|
15
|
-
.map(source => ALIASES[source] || resolvePlatformId(source))
|
|
16
|
-
.filter((source, index, values) => values.indexOf(source) === index)
|
|
17
|
-
.filter(source => source in searchers);
|
|
18
|
-
}
|
|
19
|
-
export async function searchMultipleSources(searchers, query, sources, options, sourceTimeoutMs = TIMEOUTS.SOURCE_TASK) {
|
|
20
|
-
const selected = parseSourceList(sources, searchers);
|
|
21
|
-
const settled = await Promise.allSettled(selected.map(async (source) => {
|
|
22
|
-
const searcher = searchers[source];
|
|
23
|
-
const results = await withTimeout(searcher.search(query, options), sourceTimeoutMs, `${source} search timed out after ${sourceTimeoutMs}ms`);
|
|
24
|
-
return { source, results };
|
|
25
|
-
}));
|
|
26
|
-
const sourceResults = {};
|
|
27
|
-
const errors = {};
|
|
28
|
-
const failedSources = [];
|
|
29
|
-
const merged = [];
|
|
30
|
-
for (let i = 0; i < settled.length; i += 1) {
|
|
31
|
-
const source = selected[i];
|
|
32
|
-
const result = settled[i];
|
|
33
|
-
if (result.status === 'rejected') {
|
|
34
|
-
sourceResults[source] = 0;
|
|
35
|
-
errors[source] = result.reason?.message || String(result.reason);
|
|
36
|
-
failedSources.push(source);
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
sourceResults[source] = result.value.results.length;
|
|
40
|
-
merged.push(...result.value.results);
|
|
41
|
-
}
|
|
42
|
-
const deduped = dedupePapers(merged);
|
|
43
|
-
return {
|
|
44
|
-
query,
|
|
45
|
-
sources_requested: sources,
|
|
46
|
-
sources_used: selected,
|
|
47
|
-
source_results: sourceResults,
|
|
48
|
-
errors,
|
|
49
|
-
failed_sources: failedSources,
|
|
50
|
-
warnings: failedSources.map(source => `${source}: ${errors[source]}`),
|
|
51
|
-
total: deduped.length,
|
|
52
|
-
raw_total: merged.length,
|
|
53
|
-
papers: deduped.map(paper => PaperFactory.toDict(paper))
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export function dedupePapers(papers) {
|
|
57
|
-
const seen = new Set();
|
|
58
|
-
const out = [];
|
|
59
|
-
for (const paper of papers) {
|
|
60
|
-
const key = paperKey(paper);
|
|
61
|
-
if (seen.has(key))
|
|
62
|
-
continue;
|
|
63
|
-
seen.add(key);
|
|
64
|
-
out.push(paper);
|
|
65
|
-
}
|
|
66
|
-
return out;
|
|
67
|
-
}
|
|
68
|
-
function paperKey(paper) {
|
|
69
|
-
const doi = (paper.doi || '').trim().toLowerCase();
|
|
70
|
-
if (doi)
|
|
71
|
-
return `doi:${doi}`;
|
|
72
|
-
const title = (paper.title || '').trim().toLowerCase();
|
|
73
|
-
const authors = (paper.authors || []).join(';').trim().toLowerCase();
|
|
74
|
-
if (title)
|
|
75
|
-
return `title:${title}|authors:${authors}`;
|
|
76
|
-
return `id:${paper.source || 'unknown'}:${paper.paperId || 'unknown'}`;
|
|
77
|
-
}
|
|
1
|
+
export { dedupePapers, parseSourceList, searchMultipleSources } from '../capabilities/metadata-search/MultiSourceSearchService.js';
|
|
78
2
|
//# sourceMappingURL=MultiSourceSearchService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSourceSearchService.js","sourceRoot":"","sources":["../../src/services/MultiSourceSearchService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiSourceSearchService.js","sourceRoot":"","sources":["../../src/services/MultiSourceSearchService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,qBAAqB,EACtB,MAAM,6DAA6D,CAAC"}
|
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
paperId: string;
|
|
5
|
-
doi?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
savePath?: string;
|
|
8
|
-
/** When false, suppress the final Sci-Hub fallback. Default is true. */
|
|
9
|
-
useSciHub?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface DownloadWithFallbackResult {
|
|
12
|
-
status: 'ok' | 'error';
|
|
13
|
-
path?: string;
|
|
14
|
-
attempts: Array<{
|
|
15
|
-
stage: string;
|
|
16
|
-
status: 'ok' | 'error' | 'skipped';
|
|
17
|
-
message: string;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
export interface DownloadTier {
|
|
21
|
-
id: string;
|
|
22
|
-
stage: string;
|
|
23
|
-
run(context: DownloadTierContext): Promise<DownloadTierResult>;
|
|
24
|
-
}
|
|
25
|
-
export interface DownloadTierContext {
|
|
26
|
-
searchers: Searchers;
|
|
27
|
-
source: string;
|
|
28
|
-
paperId: string;
|
|
29
|
-
doi?: string;
|
|
30
|
-
title?: string;
|
|
31
|
-
savePath: string;
|
|
32
|
-
useSciHub: boolean;
|
|
33
|
-
}
|
|
34
|
-
export interface DownloadTierResult {
|
|
35
|
-
status: 'ok' | 'error' | 'skipped';
|
|
36
|
-
path?: string;
|
|
37
|
-
message: string;
|
|
38
|
-
}
|
|
39
|
-
export declare const INSTITUTIONAL_ACCESS_TIER_ID = "institutional_access";
|
|
40
|
-
export declare function downloadWithFallback(searchers: Searchers, options: DownloadWithFallbackOptions): Promise<DownloadWithFallbackResult>;
|
|
1
|
+
export { createDefaultDownloadTiers, downloadWithFallback, INSTITUTIONAL_ACCESS_TIER_ID, insertDownloadTierBefore } from '../capabilities/pdf-discovery/OpenAccessFallbackService.js';
|
|
2
|
+
export type { DownloadTier, DownloadTierContext, DownloadTierResult } from '../capabilities/pdf-discovery/DownloadTier.js';
|
|
3
|
+
export type { DownloadWithFallbackOptions, DownloadWithFallbackResult } from '../capabilities/pdf-discovery/types.js';
|
|
41
4
|
//# sourceMappingURL=OpenAccessFallbackService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAccessFallbackService.d.ts","sourceRoot":"","sources":["../../src/services/OpenAccessFallbackService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"OpenAccessFallbackService.d.ts","sourceRoot":"","sources":["../../src/services/OpenAccessFallbackService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,4DAA4D,CAAC;AAEpE,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,+CAA+C,CAAC;AAEvD,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC3B,MAAM,wCAAwC,CAAC"}
|
|
@@ -1,147 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export const INSTITUTIONAL_ACCESS_TIER_ID = 'institutional_access';
|
|
3
|
-
const REPOSITORY_SOURCES = ['pmc', 'europepmc', 'core', 'openaire'];
|
|
4
|
-
const DEFAULT_DOWNLOAD_TIERS = [
|
|
5
|
-
{
|
|
6
|
-
id: 'primary',
|
|
7
|
-
stage: 'primary',
|
|
8
|
-
run: tryPrimaryDownload
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: 'direct_pdf_url',
|
|
12
|
-
stage: 'direct_pdf_url',
|
|
13
|
-
run: tryDirectMetadataUrl
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: 'repositories',
|
|
17
|
-
stage: 'repositories',
|
|
18
|
-
run: tryRepositoryFallback
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 'unpaywall',
|
|
22
|
-
stage: 'unpaywall',
|
|
23
|
-
run: tryUnpaywall
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: 'scihub',
|
|
27
|
-
stage: 'scihub',
|
|
28
|
-
run: trySciHub
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
export async function downloadWithFallback(searchers, options) {
|
|
32
|
-
const savePath = options.savePath || './downloads';
|
|
33
|
-
const attempts = [];
|
|
34
|
-
const context = {
|
|
35
|
-
searchers,
|
|
36
|
-
source: normalizeSource(options.source),
|
|
37
|
-
paperId: options.paperId,
|
|
38
|
-
doi: options.doi,
|
|
39
|
-
title: options.title,
|
|
40
|
-
savePath,
|
|
41
|
-
useSciHub: options.useSciHub !== false
|
|
42
|
-
};
|
|
43
|
-
for (const tier of DEFAULT_DOWNLOAD_TIERS) {
|
|
44
|
-
const result = await tier.run(context);
|
|
45
|
-
attempts.push({ stage: tier.stage, status: result.status, message: result.message });
|
|
46
|
-
if (result.status === 'ok' && result.path) {
|
|
47
|
-
return { status: 'ok', path: result.path, attempts };
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return { status: 'error', attempts };
|
|
51
|
-
}
|
|
52
|
-
async function tryPrimaryDownload(context) {
|
|
53
|
-
const primary = context.searchers[context.source];
|
|
54
|
-
if (!primary?.getCapabilities().download) {
|
|
55
|
-
return { status: 'skipped', message: `No primary downloader for ${context.source}` };
|
|
56
|
-
}
|
|
57
|
-
try {
|
|
58
|
-
const path = await primary.downloadPdf(context.paperId, { savePath: context.savePath });
|
|
59
|
-
return { status: 'ok', path, message: path };
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
return { status: 'error', message: error?.message || String(error) };
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async function tryDirectMetadataUrl(context) {
|
|
66
|
-
const searcher = context.searchers[context.source];
|
|
67
|
-
if (!searcher) {
|
|
68
|
-
return { status: 'skipped', message: `No metadata searcher for ${context.source}.` };
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const paper = await searcher.getPaperByDoi(context.paperId);
|
|
72
|
-
if (!paper?.pdfUrl) {
|
|
73
|
-
return { status: 'skipped', message: 'No pdf_url found in source metadata.' };
|
|
74
|
-
}
|
|
75
|
-
const path = await downloadPdfFromUrl(paper.pdfUrl, context.savePath, `${context.source}_${safeFilename(paper.paperId)}`);
|
|
76
|
-
return { status: 'ok', path, message: path };
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
return { status: 'error', message: error?.message || String(error) };
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async function tryRepositoryFallback(context) {
|
|
83
|
-
const queries = [context.doi || '', context.title || ''].filter(Boolean);
|
|
84
|
-
if (queries.length === 0) {
|
|
85
|
-
return { status: 'skipped', message: 'No DOI/title provided for repository discovery.' };
|
|
86
|
-
}
|
|
87
|
-
for (const source of REPOSITORY_SOURCES) {
|
|
88
|
-
const searcher = context.searchers[source];
|
|
89
|
-
if (!searcher)
|
|
90
|
-
continue;
|
|
91
|
-
for (const query of queries) {
|
|
92
|
-
try {
|
|
93
|
-
const papers = await searcher.search(query, { maxResults: 3 });
|
|
94
|
-
const paper = papers.find(candidate => candidate.pdfUrl);
|
|
95
|
-
if (!paper?.pdfUrl)
|
|
96
|
-
continue;
|
|
97
|
-
const path = await downloadPdfFromUrl(paper.pdfUrl, context.savePath, `${source}_${safeFilename(paper.paperId)}`);
|
|
98
|
-
return { status: 'ok', path, message: path };
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return { status: 'skipped', message: 'No repository PDF candidate succeeded.' };
|
|
106
|
-
}
|
|
107
|
-
async function tryUnpaywall(context) {
|
|
108
|
-
if (!context.doi) {
|
|
109
|
-
return { status: 'skipped', message: 'DOI not provided.' };
|
|
110
|
-
}
|
|
111
|
-
try {
|
|
112
|
-
const unpaywall = context.searchers.unpaywall;
|
|
113
|
-
const pdfUrl = await unpaywall.resolveBestPdfUrl(context.doi);
|
|
114
|
-
if (!pdfUrl) {
|
|
115
|
-
return { status: 'skipped', message: 'No OA PDF URL found or email not configured.' };
|
|
116
|
-
}
|
|
117
|
-
const path = await downloadPdfFromUrl(pdfUrl, context.savePath, `unpaywall_${safeFilename(context.doi)}`);
|
|
118
|
-
return { status: 'ok', path, message: path };
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
return { status: 'error', message: error?.message || String(error) };
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
async function trySciHub(context) {
|
|
125
|
-
if (!context.useSciHub) {
|
|
126
|
-
return { status: 'skipped', message: 'Sci-Hub fallback disabled by useSciHub=false.' };
|
|
127
|
-
}
|
|
128
|
-
const identifier = context.doi || context.title || context.paperId;
|
|
129
|
-
try {
|
|
130
|
-
const path = await context.searchers.scihub.downloadPdf(identifier, { savePath: context.savePath });
|
|
131
|
-
return { status: 'ok', path, message: path };
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
return { status: 'error', message: error?.message || String(error) };
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function normalizeSource(source) {
|
|
138
|
-
const normalized = source.trim().toLowerCase();
|
|
139
|
-
if (normalized === 'google_scholar')
|
|
140
|
-
return 'googlescholar';
|
|
141
|
-
if (normalized === 'pubmed_central')
|
|
142
|
-
return 'pmc';
|
|
143
|
-
if (normalized === 'europe_pmc')
|
|
144
|
-
return 'europepmc';
|
|
145
|
-
return normalized;
|
|
146
|
-
}
|
|
1
|
+
export { createDefaultDownloadTiers, downloadWithFallback, INSTITUTIONAL_ACCESS_TIER_ID, insertDownloadTierBefore } from '../capabilities/pdf-discovery/OpenAccessFallbackService.js';
|
|
147
2
|
//# sourceMappingURL=OpenAccessFallbackService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAccessFallbackService.js","sourceRoot":"","sources":["../../src/services/OpenAccessFallbackService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenAccessFallbackService.js","sourceRoot":"","sources":["../../src/services/OpenAccessFallbackService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,4DAA4D,CAAC"}
|
|
@@ -1,99 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Provides consistent error handling across all platforms
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* API Error codes and their meanings
|
|
7
|
-
*/
|
|
8
|
-
export declare const HTTP_ERROR_CODES: {
|
|
9
|
-
readonly 400: "Bad Request - Invalid parameters or syntax";
|
|
10
|
-
readonly 401: "Unauthorized - Invalid or missing API key";
|
|
11
|
-
readonly 403: "Forbidden - Access denied or rate limit exceeded";
|
|
12
|
-
readonly 404: "Not Found - Resource does not exist";
|
|
13
|
-
readonly 405: "Method Not Allowed - HTTP method not supported";
|
|
14
|
-
readonly 408: "Request Timeout - Server took too long to respond";
|
|
15
|
-
readonly 429: "Too Many Requests - Rate limit exceeded";
|
|
16
|
-
readonly 500: "Internal Server Error - Server error";
|
|
17
|
-
readonly 502: "Bad Gateway - Server communication error";
|
|
18
|
-
readonly 503: "Service Unavailable - Server temporarily unavailable";
|
|
19
|
-
readonly 504: "Gateway Timeout - Server timeout";
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Custom API Error class with detailed information
|
|
23
|
-
*/
|
|
24
|
-
export declare class ApiError extends Error {
|
|
25
|
-
readonly status?: number;
|
|
26
|
-
readonly platform: string;
|
|
27
|
-
readonly operation: string;
|
|
28
|
-
readonly timestamp: string;
|
|
29
|
-
readonly retryable: boolean;
|
|
30
|
-
readonly details?: any;
|
|
31
|
-
constructor(options: {
|
|
32
|
-
message: string;
|
|
33
|
-
status?: number;
|
|
34
|
-
platform: string;
|
|
35
|
-
operation: string;
|
|
36
|
-
details?: any;
|
|
37
|
-
});
|
|
38
|
-
private isRetryable;
|
|
39
|
-
toJSON(): {
|
|
40
|
-
name: string;
|
|
41
|
-
message: string;
|
|
42
|
-
status: number | undefined;
|
|
43
|
-
platform: string;
|
|
44
|
-
operation: string;
|
|
45
|
-
timestamp: string;
|
|
46
|
-
retryable: boolean;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Error Handler class for unified error processing
|
|
51
|
-
*/
|
|
52
|
-
export declare class ErrorHandler {
|
|
53
|
-
private platform;
|
|
54
|
-
private verbose;
|
|
55
|
-
constructor(platform: string, verbose?: boolean);
|
|
56
|
-
/**
|
|
57
|
-
* Handle HTTP errors from axios or similar libraries
|
|
58
|
-
*/
|
|
59
|
-
handleHttpError(error: any, operation: string): never;
|
|
60
|
-
/**
|
|
61
|
-
* Handle generic errors
|
|
62
|
-
*/
|
|
63
|
-
handleError(error: any, operation: string): never;
|
|
64
|
-
/**
|
|
65
|
-
* Extract error message from various error formats
|
|
66
|
-
*/
|
|
67
|
-
private extractErrorMessage;
|
|
68
|
-
/**
|
|
69
|
-
* Create user-friendly error message
|
|
70
|
-
*/
|
|
71
|
-
private createUserMessage;
|
|
72
|
-
/**
|
|
73
|
-
* Sanitize URL for logging
|
|
74
|
-
*/
|
|
75
|
-
private sanitizeUrl;
|
|
76
|
-
/**
|
|
77
|
-
* Log error with consistent format
|
|
78
|
-
*/
|
|
79
|
-
private logError;
|
|
80
|
-
/**
|
|
81
|
-
* Check if an error is retryable
|
|
82
|
-
*/
|
|
83
|
-
static isRetryable(error: any): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Get suggested retry delay based on error
|
|
86
|
-
*/
|
|
87
|
-
static getRetryDelay(error: any, attempt?: number): number;
|
|
88
|
-
/**
|
|
89
|
-
* Retry a function with exponential backoff and full jitter
|
|
90
|
-
*/
|
|
91
|
-
static retryWithBackoff<T>(fn: () => Promise<T>, options?: {
|
|
92
|
-
maxRetries?: number;
|
|
93
|
-
initialDelayMs?: number;
|
|
94
|
-
maxDelayMs?: number;
|
|
95
|
-
context?: string;
|
|
96
|
-
}): Promise<T>;
|
|
97
|
-
}
|
|
98
|
-
export default ErrorHandler;
|
|
1
|
+
export * from '../infrastructure/http/ErrorHandler.js';
|
|
2
|
+
export { default } from '../infrastructure/http/ErrorHandler.js';
|
|
99
3
|
//# sourceMappingURL=ErrorHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../src/utils/ErrorHandler.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../src/utils/ErrorHandler.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC"}
|