@ncukondo/reference-manager 0.1.0 → 0.4.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/README.md +278 -80
- package/dist/chunks/{detector-BF8Mcc72.js → file-watcher-B-SiUw5f.js} +469 -327
- package/dist/chunks/file-watcher-B-SiUw5f.js.map +1 -0
- package/dist/chunks/index-DLIGxQaB.js +29851 -0
- package/dist/chunks/index-DLIGxQaB.js.map +1 -0
- package/dist/chunks/loader-DuzyKV70.js +394 -0
- package/dist/chunks/loader-DuzyKV70.js.map +1 -0
- package/dist/cli/commands/add.d.ts +44 -16
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/cite.d.ts +49 -0
- package/dist/cli/commands/cite.d.ts.map +1 -0
- package/dist/cli/commands/fulltext.d.ts +72 -0
- package/dist/cli/commands/fulltext.d.ts.map +1 -0
- package/dist/cli/commands/index.d.ts +14 -10
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/list.d.ts +23 -6
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/mcp.d.ts +16 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/remove.d.ts +47 -12
- package/dist/cli/commands/remove.d.ts.map +1 -1
- package/dist/cli/commands/search.d.ts +24 -7
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/server.d.ts +2 -0
- package/dist/cli/commands/server.d.ts.map +1 -1
- package/dist/cli/commands/update.d.ts +26 -13
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/execution-context.d.ts +47 -0
- package/dist/cli/execution-context.d.ts.map +1 -0
- package/dist/cli/helpers.d.ts +18 -0
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/server-client.d.ts +61 -14
- package/dist/cli/server-client.d.ts.map +1 -1
- package/dist/cli/server-detection.d.ts +1 -0
- package/dist/cli/server-detection.d.ts.map +1 -1
- package/dist/cli.js +21979 -564
- package/dist/cli.js.map +1 -1
- package/dist/config/csl-styles.d.ts +83 -0
- package/dist/config/csl-styles.d.ts.map +1 -0
- package/dist/config/defaults.d.ts +10 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/schema.d.ts +86 -3
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/core/csl-json/types.d.ts +18 -3
- package/dist/core/csl-json/types.d.ts.map +1 -1
- package/dist/core/library-interface.d.ts +100 -0
- package/dist/core/library-interface.d.ts.map +1 -0
- package/dist/core/library.d.ts +56 -13
- package/dist/core/library.d.ts.map +1 -1
- package/dist/features/format/bibtex.d.ts +6 -0
- package/dist/features/format/bibtex.d.ts.map +1 -0
- package/dist/features/format/citation-csl.d.ts +41 -0
- package/dist/features/format/citation-csl.d.ts.map +1 -0
- package/dist/features/format/citation-fallback.d.ts +24 -0
- package/dist/features/format/citation-fallback.d.ts.map +1 -0
- package/dist/features/format/index.d.ts +10 -0
- package/dist/features/format/index.d.ts.map +1 -0
- package/dist/features/format/json.d.ts +6 -0
- package/dist/features/format/json.d.ts.map +1 -0
- package/dist/features/format/pretty.d.ts +6 -0
- package/dist/features/format/pretty.d.ts.map +1 -0
- package/dist/features/fulltext/filename.d.ts +17 -0
- package/dist/features/fulltext/filename.d.ts.map +1 -0
- package/dist/features/fulltext/index.d.ts +7 -0
- package/dist/features/fulltext/index.d.ts.map +1 -0
- package/dist/features/fulltext/manager.d.ts +109 -0
- package/dist/features/fulltext/manager.d.ts.map +1 -0
- package/dist/features/fulltext/types.d.ts +12 -0
- package/dist/features/fulltext/types.d.ts.map +1 -0
- package/dist/features/import/cache.d.ts +37 -0
- package/dist/features/import/cache.d.ts.map +1 -0
- package/dist/features/import/detector.d.ts +42 -0
- package/dist/features/import/detector.d.ts.map +1 -0
- package/dist/features/import/fetcher.d.ts +49 -0
- package/dist/features/import/fetcher.d.ts.map +1 -0
- package/dist/features/import/importer.d.ts +61 -0
- package/dist/features/import/importer.d.ts.map +1 -0
- package/dist/features/import/index.d.ts +8 -0
- package/dist/features/import/index.d.ts.map +1 -0
- package/dist/features/import/normalizer.d.ts +15 -0
- package/dist/features/import/normalizer.d.ts.map +1 -0
- package/dist/features/import/parser.d.ts +33 -0
- package/dist/features/import/parser.d.ts.map +1 -0
- package/dist/features/import/rate-limiter.d.ts +45 -0
- package/dist/features/import/rate-limiter.d.ts.map +1 -0
- package/dist/features/operations/add.d.ts +65 -0
- package/dist/features/operations/add.d.ts.map +1 -0
- package/dist/features/operations/cite.d.ts +48 -0
- package/dist/features/operations/cite.d.ts.map +1 -0
- package/dist/features/operations/fulltext/attach.d.ts +47 -0
- package/dist/features/operations/fulltext/attach.d.ts.map +1 -0
- package/dist/features/operations/fulltext/detach.d.ts +38 -0
- package/dist/features/operations/fulltext/detach.d.ts.map +1 -0
- package/dist/features/operations/fulltext/get.d.ts +41 -0
- package/dist/features/operations/fulltext/get.d.ts.map +1 -0
- package/dist/features/operations/fulltext/index.d.ts +9 -0
- package/dist/features/operations/fulltext/index.d.ts.map +1 -0
- package/dist/features/operations/index.d.ts +15 -0
- package/dist/features/operations/index.d.ts.map +1 -0
- package/dist/features/operations/library-operations.d.ts +64 -0
- package/dist/features/operations/library-operations.d.ts.map +1 -0
- package/dist/features/operations/list.d.ts +28 -0
- package/dist/features/operations/list.d.ts.map +1 -0
- package/dist/features/operations/operations-library.d.ts +36 -0
- package/dist/features/operations/operations-library.d.ts.map +1 -0
- package/dist/features/operations/remove.d.ts +29 -0
- package/dist/features/operations/remove.d.ts.map +1 -0
- package/dist/features/operations/search.d.ts +30 -0
- package/dist/features/operations/search.d.ts.map +1 -0
- package/dist/features/operations/update.d.ts +39 -0
- package/dist/features/operations/update.d.ts.map +1 -0
- package/dist/features/search/matcher.d.ts.map +1 -1
- package/dist/features/search/normalizer.d.ts +12 -0
- package/dist/features/search/normalizer.d.ts.map +1 -1
- package/dist/features/search/tokenizer.d.ts.map +1 -1
- package/dist/features/search/types.d.ts +1 -1
- package/dist/features/search/types.d.ts.map +1 -1
- package/dist/features/search/uppercase.d.ts +41 -0
- package/dist/features/search/uppercase.d.ts.map +1 -0
- package/dist/index.js +21 -187
- package/dist/index.js.map +1 -1
- package/dist/mcp/context.d.ts +19 -0
- package/dist/mcp/context.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +20 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/resources/index.d.ts +10 -0
- package/dist/mcp/resources/index.d.ts.map +1 -0
- package/dist/mcp/resources/library.d.ts +26 -0
- package/dist/mcp/resources/library.d.ts.map +1 -0
- package/dist/mcp/tools/add.d.ts +17 -0
- package/dist/mcp/tools/add.d.ts.map +1 -0
- package/dist/mcp/tools/cite.d.ts +15 -0
- package/dist/mcp/tools/cite.d.ts.map +1 -0
- package/dist/mcp/tools/fulltext.d.ts +51 -0
- package/dist/mcp/tools/fulltext.d.ts.map +1 -0
- package/dist/mcp/tools/index.d.ts +12 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/list.d.ts +13 -0
- package/dist/mcp/tools/list.d.ts.map +1 -0
- package/dist/mcp/tools/remove.d.ts +19 -0
- package/dist/mcp/tools/remove.d.ts.map +1 -0
- package/dist/mcp/tools/search.d.ts +13 -0
- package/dist/mcp/tools/search.d.ts.map +1 -0
- package/dist/server/index.d.ts +26 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/routes/add.d.ts +11 -0
- package/dist/server/routes/add.d.ts.map +1 -0
- package/dist/server/routes/cite.d.ts +9 -0
- package/dist/server/routes/cite.d.ts.map +1 -0
- package/dist/server/routes/list.d.ts +25 -0
- package/dist/server/routes/list.d.ts.map +1 -0
- package/dist/server/routes/references.d.ts.map +1 -1
- package/dist/server/routes/search.d.ts +26 -0
- package/dist/server/routes/search.d.ts.map +1 -0
- package/dist/server.js +5 -88
- package/dist/server.js.map +1 -1
- package/package.json +16 -4
- package/dist/chunks/detector-BF8Mcc72.js.map +0 -1
- package/dist/cli/output/bibtex.d.ts +0 -6
- package/dist/cli/output/bibtex.d.ts.map +0 -1
- package/dist/cli/output/index.d.ts +0 -7
- package/dist/cli/output/index.d.ts.map +0 -1
- package/dist/cli/output/json.d.ts +0 -6
- package/dist/cli/output/json.d.ts.map +0 -1
- package/dist/cli/output/pretty.d.ts +0 -6
- package/dist/cli/output/pretty.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty.d.ts","sourceRoot":"","sources":["../../../src/features/format/pretty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AA+E5D;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAMrD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fulltext filename generation
|
|
3
|
+
*/
|
|
4
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
5
|
+
import { type FulltextType } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Generate a filename for a fulltext file.
|
|
8
|
+
*
|
|
9
|
+
* Format: {id}[-PMID{PMID}]-{uuid}.{ext}
|
|
10
|
+
*
|
|
11
|
+
* @param item - CSL item to generate filename for
|
|
12
|
+
* @param type - Fulltext type (pdf or markdown)
|
|
13
|
+
* @returns Generated filename
|
|
14
|
+
* @throws Error if custom.uuid is missing
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateFulltextFilename(item: CslItem, type: FulltextType): string;
|
|
17
|
+
//# sourceMappingURL=filename.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filename.d.ts","sourceRoot":"","sources":["../../../src/features/fulltext/filename.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAEpE;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAkBlF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fulltext management exports
|
|
3
|
+
*/
|
|
4
|
+
export * from "./types.js";
|
|
5
|
+
export { generateFulltextFilename } from "./filename.js";
|
|
6
|
+
export { FulltextManager, FulltextIOError, FulltextNotAttachedError, type AttachOptions, type AttachResult, type DetachOptions, type DetachResult, } from "./manager.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/fulltext/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fulltext file management
|
|
3
|
+
*/
|
|
4
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
5
|
+
import type { FulltextType } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Error thrown when fulltext I/O operation fails
|
|
8
|
+
*/
|
|
9
|
+
export declare class FulltextIOError extends Error {
|
|
10
|
+
readonly cause?: Error | undefined;
|
|
11
|
+
constructor(message: string, cause?: Error | undefined);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when trying to detach non-attached fulltext
|
|
15
|
+
*/
|
|
16
|
+
export declare class FulltextNotAttachedError extends Error {
|
|
17
|
+
readonly itemId: string;
|
|
18
|
+
readonly type: FulltextType;
|
|
19
|
+
constructor(itemId: string, type: FulltextType);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Options for attachFile
|
|
23
|
+
*/
|
|
24
|
+
export interface AttachOptions {
|
|
25
|
+
/** Move file instead of copy (default: false) */
|
|
26
|
+
move?: boolean;
|
|
27
|
+
/** Overwrite existing attachment without confirmation (default: false) */
|
|
28
|
+
force?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result of attachFile operation
|
|
32
|
+
*/
|
|
33
|
+
export interface AttachResult {
|
|
34
|
+
/** Generated filename */
|
|
35
|
+
filename: string;
|
|
36
|
+
/** Existing filename if already attached (when force=false) */
|
|
37
|
+
existingFile?: string;
|
|
38
|
+
/** Whether existing file was overwritten */
|
|
39
|
+
overwritten: boolean;
|
|
40
|
+
/** Old filename that was deleted (when force=true and filename changed) */
|
|
41
|
+
deletedOldFile?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Options for detachFile
|
|
45
|
+
*/
|
|
46
|
+
export interface DetachOptions {
|
|
47
|
+
/** Delete file from disk (default: false, metadata-only detach) */
|
|
48
|
+
delete?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Result of detachFile operation
|
|
52
|
+
*/
|
|
53
|
+
export interface DetachResult {
|
|
54
|
+
/** Detached filename */
|
|
55
|
+
filename: string;
|
|
56
|
+
/** Whether file was deleted from disk */
|
|
57
|
+
deleted: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Manages fulltext file operations
|
|
61
|
+
*/
|
|
62
|
+
export declare class FulltextManager {
|
|
63
|
+
private readonly fulltextDirectory;
|
|
64
|
+
constructor(fulltextDirectory: string);
|
|
65
|
+
/**
|
|
66
|
+
* Ensure the fulltext directory exists
|
|
67
|
+
*/
|
|
68
|
+
ensureDirectory(): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Attach a file to a reference
|
|
71
|
+
*/
|
|
72
|
+
attachFile(item: CslItem, sourcePath: string, type: FulltextType, options?: AttachOptions): Promise<AttachResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Validate that source file exists
|
|
75
|
+
*/
|
|
76
|
+
private validateSourceFile;
|
|
77
|
+
/**
|
|
78
|
+
* Delete old file if force mode and filename changed
|
|
79
|
+
* @returns Deleted filename or undefined
|
|
80
|
+
*/
|
|
81
|
+
private deleteOldFileIfNeeded;
|
|
82
|
+
/**
|
|
83
|
+
* Copy or move file to destination
|
|
84
|
+
*/
|
|
85
|
+
private copyOrMoveFile;
|
|
86
|
+
/**
|
|
87
|
+
* Get the full path for an attached file
|
|
88
|
+
* @returns Full path or null if not attached
|
|
89
|
+
*/
|
|
90
|
+
getFilePath(item: CslItem, type: FulltextType): string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Detach a file from a reference
|
|
93
|
+
*/
|
|
94
|
+
detachFile(item: CslItem, type: FulltextType, options?: DetachOptions): Promise<DetachResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Get list of attached fulltext types
|
|
97
|
+
*/
|
|
98
|
+
getAttachedTypes(item: CslItem): FulltextType[];
|
|
99
|
+
/**
|
|
100
|
+
* Check if item has attachment
|
|
101
|
+
* @param type Optional type to check; if omitted, checks for any attachment
|
|
102
|
+
*/
|
|
103
|
+
hasAttachment(item: CslItem, type?: FulltextType): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get existing filename from item metadata
|
|
106
|
+
*/
|
|
107
|
+
private getExistingFilename;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/features/fulltext/manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;aAGtB,KAAK,CAAC,EAAE,KAAK;gBAD7B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,KAAK,YAAA;CAKhC;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;aAE/B,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,YAAY;gBADlB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY;CAKrC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0EAA0E;IAC1E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,MAAM;IAEtD;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC;;OAEG;IACG,UAAU,CACd,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAyCxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;;OAGG;YACW,qBAAqB;IAkBnC;;OAEG;YACW,cAAc;IAgB5B;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI;IAQ7D;;OAEG;IACG,UAAU,CACd,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAuBxB;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,EAAE;IAc/C;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO;IAO1D;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAO5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fulltext management types
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Supported fulltext file types
|
|
6
|
+
*/
|
|
7
|
+
export type FulltextType = "pdf" | "markdown";
|
|
8
|
+
/**
|
|
9
|
+
* File extensions for each fulltext type
|
|
10
|
+
*/
|
|
11
|
+
export declare const FULLTEXT_EXTENSIONS: Record<FulltextType, string>;
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/fulltext/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,UAAU,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAG5D,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response cache for PMID and DOI metadata
|
|
3
|
+
*
|
|
4
|
+
* In-memory cache with TTL to avoid redundant API calls.
|
|
5
|
+
* - Per ADR-001: No persistent cache files on disk
|
|
6
|
+
* - Cache is warm during interactive sessions (server mode)
|
|
7
|
+
* - CLI invocations start fresh
|
|
8
|
+
*/
|
|
9
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Cache configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface CacheConfig {
|
|
14
|
+
/** Time-to-live in milliseconds (default: 1 hour) */
|
|
15
|
+
ttlMs?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get cached PMID result
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPmidFromCache(pmid: string): CslItem | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Cache PMID result
|
|
23
|
+
*/
|
|
24
|
+
export declare function cachePmidResult(pmid: string, item: CslItem, config?: CacheConfig): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get cached DOI result
|
|
27
|
+
*/
|
|
28
|
+
export declare function getDoiFromCache(doi: string): CslItem | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Cache DOI result
|
|
31
|
+
*/
|
|
32
|
+
export declare function cacheDoiResult(doi: string, item: CslItem, config?: CacheConfig): void;
|
|
33
|
+
/**
|
|
34
|
+
* Reset all caches (for test isolation)
|
|
35
|
+
*/
|
|
36
|
+
export declare function resetCache(): void;
|
|
37
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/features/import/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAK5D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAyDD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAElE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAEvF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAEhE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAErF;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAGjC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format detection module for multi-format import
|
|
3
|
+
*
|
|
4
|
+
* Detects input format based on:
|
|
5
|
+
* - File extension (.json, .bib, .ris)
|
|
6
|
+
* - Content patterns (JSON, BibTeX, RIS)
|
|
7
|
+
* - Identifier patterns (PMID, DOI)
|
|
8
|
+
* - Multiple whitespace-separated identifiers
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Supported input formats
|
|
12
|
+
*/
|
|
13
|
+
export type InputFormat = "json" | "bibtex" | "ris" | "pmid" | "doi" | "identifiers" | "unknown";
|
|
14
|
+
/**
|
|
15
|
+
* Detect the format of the given input
|
|
16
|
+
*
|
|
17
|
+
* @param input - File path, identifier, or empty string for stdin
|
|
18
|
+
* @param content - Optional content to analyze (for stdin or unknown extension)
|
|
19
|
+
* @returns Detected format
|
|
20
|
+
*/
|
|
21
|
+
export declare function detectFormat(input: string, content?: string): InputFormat;
|
|
22
|
+
/**
|
|
23
|
+
* Detect format based on file extension
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectByExtension(input: string): InputFormat;
|
|
26
|
+
/**
|
|
27
|
+
* Detect format based on content patterns
|
|
28
|
+
*/
|
|
29
|
+
export declare function detectByContent(content: string): InputFormat;
|
|
30
|
+
/**
|
|
31
|
+
* Detect if a single string is a PMID or DOI
|
|
32
|
+
*/
|
|
33
|
+
export declare function detectSingleIdentifier(input: string): "pmid" | "doi" | "unknown";
|
|
34
|
+
/**
|
|
35
|
+
* Check if string is a valid DOI
|
|
36
|
+
*/
|
|
37
|
+
export declare function isDoi(input: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check if string is a valid PMID (numeric only)
|
|
40
|
+
*/
|
|
41
|
+
export declare function isPmid(input: string): boolean;
|
|
42
|
+
//# sourceMappingURL=detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../../src/features/import/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,aAAa,GAAG,SAAS,CAAC;AAqBjG;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAwBzE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAW5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAqB5D;AAkCD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAYhF;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAW5C;AA0BD;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO7C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetcher module for PMID and DOI metadata retrieval
|
|
3
|
+
*
|
|
4
|
+
* - PMID: Uses PMC Citation Exporter API (returns CSL-JSON directly)
|
|
5
|
+
* - DOI: Uses citation-js plugin-doi (Cite.async)
|
|
6
|
+
*/
|
|
7
|
+
import "@citation-js/plugin-doi";
|
|
8
|
+
import { type CslItem } from "../../core/csl-json/types.js";
|
|
9
|
+
/**
|
|
10
|
+
* PubMed configuration for API requests
|
|
11
|
+
*/
|
|
12
|
+
export interface PubmedConfig {
|
|
13
|
+
email?: string;
|
|
14
|
+
apiKey?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of fetching a single identifier
|
|
18
|
+
*/
|
|
19
|
+
export type FetchResult = {
|
|
20
|
+
success: true;
|
|
21
|
+
item: CslItem;
|
|
22
|
+
} | {
|
|
23
|
+
success: false;
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Result of fetching a PMID (includes pmid for tracking)
|
|
28
|
+
*/
|
|
29
|
+
export type PmidFetchResult = {
|
|
30
|
+
pmid: string;
|
|
31
|
+
success: true;
|
|
32
|
+
item: CslItem;
|
|
33
|
+
} | {
|
|
34
|
+
pmid: string;
|
|
35
|
+
success: false;
|
|
36
|
+
error: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Results of fetching multiple PMIDs
|
|
40
|
+
*/
|
|
41
|
+
export type FetchResults = PmidFetchResult[];
|
|
42
|
+
export declare function fetchPmids(pmids: string[], config: PubmedConfig): Promise<FetchResults>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetch metadata for a DOI using citation-js
|
|
45
|
+
*
|
|
46
|
+
* Uses @citation-js/plugin-doi for content negotiation
|
|
47
|
+
*/
|
|
48
|
+
export declare function fetchDoi(doi: string): Promise<FetchResult>;
|
|
49
|
+
//# sourceMappingURL=fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/features/import/fetcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,8BAA8B,CAAC;AAY3E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/F;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;AAiG7C,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CA+C7F;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA0ChE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importer orchestration module
|
|
3
|
+
*
|
|
4
|
+
* Coordinates format detection, parsing, and fetching to import references
|
|
5
|
+
* from various input formats.
|
|
6
|
+
*/
|
|
7
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
8
|
+
import type { InputFormat } from "./detector.js";
|
|
9
|
+
import type { PubmedConfig } from "./fetcher.js";
|
|
10
|
+
/**
|
|
11
|
+
* Result of importing a single item
|
|
12
|
+
*/
|
|
13
|
+
export type ImportItemResult = {
|
|
14
|
+
success: true;
|
|
15
|
+
item: CslItem;
|
|
16
|
+
source: string;
|
|
17
|
+
} | {
|
|
18
|
+
success: false;
|
|
19
|
+
error: string;
|
|
20
|
+
source: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Result of an import operation
|
|
24
|
+
*/
|
|
25
|
+
export interface ImportResult {
|
|
26
|
+
results: ImportItemResult[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options for import operations
|
|
30
|
+
*/
|
|
31
|
+
export interface ImportOptions {
|
|
32
|
+
pubmedConfig?: PubmedConfig;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Import references from content string
|
|
36
|
+
*
|
|
37
|
+
* @param content - The content to parse
|
|
38
|
+
* @param format - The format of the content (or "auto" for detection)
|
|
39
|
+
* @param options - Import options
|
|
40
|
+
* @returns Import result with parsed items
|
|
41
|
+
*/
|
|
42
|
+
export declare function importFromContent(content: string, format: InputFormat | "auto", _options: ImportOptions): Promise<ImportResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Import references from identifier strings (PMID or DOI)
|
|
45
|
+
*
|
|
46
|
+
* @param identifiers - Array of identifier strings
|
|
47
|
+
* @param options - Import options (requires pubmedConfig for PMID fetching)
|
|
48
|
+
* @returns Import result with fetched items
|
|
49
|
+
*/
|
|
50
|
+
export declare function importFromIdentifiers(identifiers: string[], options: ImportOptions): Promise<ImportResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Options for importFromInputs
|
|
53
|
+
*/
|
|
54
|
+
export interface ImportInputsOptions extends ImportOptions {
|
|
55
|
+
/** Explicit format specification (default: auto) */
|
|
56
|
+
format?: InputFormat | "auto";
|
|
57
|
+
/** Content from stdin (if provided, processed before file/identifier inputs) */
|
|
58
|
+
stdinContent?: string;
|
|
59
|
+
}
|
|
60
|
+
export declare function importFromInputs(inputs: string[], options: ImportInputsOptions): Promise<ImportResult>;
|
|
61
|
+
//# sourceMappingURL=importer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../../src/features/import/importer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAI5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAwMD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,GAAG,MAAM,EAC5B,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC,CAuCvB;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EAAE,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAuBvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,oDAAoD;IACpD,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAsGD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,YAAY,CAAC,CAiCvB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import feature public API
|
|
3
|
+
*
|
|
4
|
+
* Provides unified entry point for importing references from various formats.
|
|
5
|
+
*/
|
|
6
|
+
export { importFromInputs } from "./importer.js";
|
|
7
|
+
export type { ImportInputsOptions, ImportItemResult, ImportResult } from "./importer.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/import/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOI normalizer module
|
|
3
|
+
*
|
|
4
|
+
* Normalizes DOI identifiers by:
|
|
5
|
+
* - Removing URL prefixes (doi.org, dx.doi.org)
|
|
6
|
+
* - Trimming whitespace
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Normalize a DOI identifier
|
|
10
|
+
*
|
|
11
|
+
* @param doi - DOI string, possibly with URL prefix
|
|
12
|
+
* @returns Normalized DOI (10.xxx/xxx format)
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeDoi(doi: string): string;
|
|
15
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../src/features/import/normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAoBhD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser module for BibTeX and RIS formats
|
|
3
|
+
*
|
|
4
|
+
* Uses citation-js plugins for parsing:
|
|
5
|
+
* - @citation-js/plugin-bibtex for BibTeX
|
|
6
|
+
* - @citation-js/plugin-ris for RIS
|
|
7
|
+
*/
|
|
8
|
+
import "@citation-js/plugin-bibtex";
|
|
9
|
+
import "@citation-js/plugin-ris";
|
|
10
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Result of a parse operation
|
|
13
|
+
*/
|
|
14
|
+
export type ParseResult = {
|
|
15
|
+
success: boolean;
|
|
16
|
+
items: CslItem[];
|
|
17
|
+
error?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Parse BibTeX content to CSL-JSON
|
|
21
|
+
*
|
|
22
|
+
* @param content - BibTeX content string
|
|
23
|
+
* @returns Parse result with CSL-JSON items
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseBibtex(content: string): ParseResult;
|
|
26
|
+
/**
|
|
27
|
+
* Parse RIS content to CSL-JSON
|
|
28
|
+
*
|
|
29
|
+
* @param content - RIS content string
|
|
30
|
+
* @returns Parse result with CSL-JSON items
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseRis(content: string): ParseResult;
|
|
33
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/features/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,4BAA4B,CAAC;AACpC,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAErD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate limiter module for API calls
|
|
3
|
+
*
|
|
4
|
+
* Uses factory + lazy initialization singleton pattern:
|
|
5
|
+
* - RateLimiter class: Delay-based rate limiting with configurable requests/second
|
|
6
|
+
* - getRateLimiter(api, config): Returns singleton per API type
|
|
7
|
+
* - resetRateLimiters(): Clears singletons for test isolation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* API types supported by the rate limiter
|
|
11
|
+
*/
|
|
12
|
+
export type ApiType = "pubmed" | "crossref";
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for rate limiter
|
|
15
|
+
*/
|
|
16
|
+
export interface RateLimiterConfig {
|
|
17
|
+
pubmedApiKey?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Rate limiter interface
|
|
21
|
+
*/
|
|
22
|
+
export interface RateLimiter {
|
|
23
|
+
readonly requestsPerSecond: number;
|
|
24
|
+
readonly intervalMs: number;
|
|
25
|
+
readonly lastRequestTime: number;
|
|
26
|
+
acquire(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a new rate limiter instance
|
|
30
|
+
*/
|
|
31
|
+
export declare function createRateLimiter(options: {
|
|
32
|
+
requestsPerSecond: number;
|
|
33
|
+
}): RateLimiter;
|
|
34
|
+
/**
|
|
35
|
+
* Get singleton rate limiter for the specified API type
|
|
36
|
+
*
|
|
37
|
+
* Note: Configuration is only used on first call. Subsequent calls
|
|
38
|
+
* return the existing singleton regardless of config changes.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getRateLimiter(api: ApiType, config: RateLimiterConfig): RateLimiter;
|
|
41
|
+
/**
|
|
42
|
+
* Reset all rate limiter singletons (for test isolation)
|
|
43
|
+
*/
|
|
44
|
+
export declare function resetRateLimiters(): void;
|
|
45
|
+
//# sourceMappingURL=rate-limiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../../src/features/import/rate-limiter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AA2DD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,WAAW,CAEd;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,GAAG,WAAW,CAWnF;AAcD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ILibrary } from "../../core/library-interface.js";
|
|
2
|
+
import type { InputFormat } from "../import/detector.js";
|
|
3
|
+
import type { PubmedConfig } from "../import/fetcher.js";
|
|
4
|
+
/**
|
|
5
|
+
* Options for adding references
|
|
6
|
+
*/
|
|
7
|
+
export interface AddReferencesOptions {
|
|
8
|
+
/** Skip duplicate detection */
|
|
9
|
+
force?: boolean;
|
|
10
|
+
/** Explicit input format (default: auto) */
|
|
11
|
+
format?: InputFormat | "auto";
|
|
12
|
+
/** PubMed API configuration */
|
|
13
|
+
pubmedConfig?: PubmedConfig;
|
|
14
|
+
/** Content from stdin (if provided, processed before file/identifier inputs) */
|
|
15
|
+
stdinContent?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Information about a successfully added reference
|
|
19
|
+
*/
|
|
20
|
+
export interface AddedItem {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
/** True if the ID was changed due to collision */
|
|
24
|
+
idChanged?: boolean;
|
|
25
|
+
/** Original ID before collision resolution */
|
|
26
|
+
originalId?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Information about a failed import
|
|
30
|
+
*/
|
|
31
|
+
export interface FailedItem {
|
|
32
|
+
source: string;
|
|
33
|
+
error: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Information about a skipped duplicate
|
|
37
|
+
*/
|
|
38
|
+
export interface SkippedItem {
|
|
39
|
+
source: string;
|
|
40
|
+
existingId: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Result of addReferences operation
|
|
44
|
+
*/
|
|
45
|
+
export interface AddReferencesResult {
|
|
46
|
+
added: AddedItem[];
|
|
47
|
+
failed: FailedItem[];
|
|
48
|
+
skipped: SkippedItem[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add references to a library from various input sources.
|
|
52
|
+
*
|
|
53
|
+
* This function orchestrates:
|
|
54
|
+
* 1. Import from inputs (files or identifiers)
|
|
55
|
+
* 2. Duplicate detection (unless force=true)
|
|
56
|
+
* 3. ID collision resolution
|
|
57
|
+
* 4. Library save
|
|
58
|
+
*
|
|
59
|
+
* @param inputs - File paths or identifiers (PMID, DOI)
|
|
60
|
+
* @param library - Target library
|
|
61
|
+
* @param options - Add options
|
|
62
|
+
* @returns Result with added, failed, and skipped items
|
|
63
|
+
*/
|
|
64
|
+
export declare function addReferences(inputs: string[], library: ILibrary, options: AddReferencesOptions): Promise<AddReferencesResult>;
|
|
65
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/features/operations/add.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAOzD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,+BAA+B;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CAwC9B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ILibrary } from "../../core/library-interface.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for citeReferences operation
|
|
4
|
+
*/
|
|
5
|
+
export interface CiteOperationOptions {
|
|
6
|
+
/** Reference IDs or UUIDs to cite */
|
|
7
|
+
identifiers: string[];
|
|
8
|
+
/** If true, identifiers are treated as UUIDs; otherwise as IDs (default: false) */
|
|
9
|
+
byUuid?: boolean;
|
|
10
|
+
/** CSL style name or path to CSL file */
|
|
11
|
+
style?: string;
|
|
12
|
+
/** Path to custom CSL file */
|
|
13
|
+
cslFile?: string;
|
|
14
|
+
/** Locale for citation formatting (default: "en-US") */
|
|
15
|
+
locale?: string;
|
|
16
|
+
/** Output format (default: "text") */
|
|
17
|
+
format?: "text" | "html" | "rtf";
|
|
18
|
+
/** If true, generate in-text citation instead of bibliography */
|
|
19
|
+
inText?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result for a single citation
|
|
23
|
+
*/
|
|
24
|
+
export type CiteItemResult = {
|
|
25
|
+
success: true;
|
|
26
|
+
identifier: string;
|
|
27
|
+
citation: string;
|
|
28
|
+
} | {
|
|
29
|
+
success: false;
|
|
30
|
+
identifier: string;
|
|
31
|
+
error: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Result of citeReferences operation
|
|
35
|
+
*/
|
|
36
|
+
export interface CiteResult {
|
|
37
|
+
/** Results for each identifier */
|
|
38
|
+
results: CiteItemResult[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Generate citations for references.
|
|
42
|
+
*
|
|
43
|
+
* @param library - The library to cite from
|
|
44
|
+
* @param options - Citation options including identifiers and style settings
|
|
45
|
+
* @returns Results array with citation or error for each identifier
|
|
46
|
+
*/
|
|
47
|
+
export declare function citeReferences(library: ILibrary, options: CiteOperationOptions): Promise<CiteResult>;
|
|
48
|
+
//# sourceMappingURL=cite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../../../src/features/operations/cite.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAQhE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mFAAmF;IACnF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACjC,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,kCAAkC;IAClC,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAsED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,CAerB"}
|