@ncukondo/reference-manager 0.1.0 → 0.3.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 +40 -0
- package/dist/chunks/detector-DHztTaFY.js +619 -0
- package/dist/chunks/detector-DHztTaFY.js.map +1 -0
- package/dist/chunks/{detector-BF8Mcc72.js → loader-mQ25o6cV.js} +303 -664
- package/dist/chunks/loader-mQ25o6cV.js.map +1 -0
- package/dist/chunks/search-Be9vzUIH.js +29541 -0
- package/dist/chunks/search-Be9vzUIH.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 +101 -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/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/update.d.ts +26 -13
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/execution-context.d.ts +60 -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 +73 -10
- package/dist/cli/server-client.d.ts.map +1 -1
- package/dist/cli.js +1200 -528
- 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 +84 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/core/csl-json/types.d.ts +15 -3
- package/dist/core/csl-json/types.d.ts.map +1 -1
- package/dist/core/library.d.ts +60 -0
- 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/list.d.ts +28 -0
- package/dist/features/operations/list.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/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/dist/server/index.d.ts +3 -1
- 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 +215 -32
- package/dist/server.js.map +1 -1
- package/package.json +15 -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,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 { Library } from "../../core/library.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: Library, 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,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,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,OAAO,EAChB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CAwC9B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Library } from "../../core/library.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: Library, 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,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQrD;;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;AAuED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,CAerB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Library } from "../../core/library.js";
|
|
2
|
+
/**
|
|
3
|
+
* Output format options for list operation
|
|
4
|
+
*/
|
|
5
|
+
export type ListFormat = "pretty" | "json" | "bibtex" | "ids-only" | "uuid";
|
|
6
|
+
/**
|
|
7
|
+
* Options for listReferences operation
|
|
8
|
+
*/
|
|
9
|
+
export interface ListOptions {
|
|
10
|
+
/** Output format (default: "pretty") */
|
|
11
|
+
format?: ListFormat;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Result of listReferences operation
|
|
15
|
+
*/
|
|
16
|
+
export interface ListResult {
|
|
17
|
+
/** Formatted strings for each reference */
|
|
18
|
+
items: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* List all references from the library with specified format.
|
|
22
|
+
*
|
|
23
|
+
* @param library - The library to list references from
|
|
24
|
+
* @param options - Formatting options
|
|
25
|
+
* @returns Formatted strings for each reference
|
|
26
|
+
*/
|
|
27
|
+
export declare function listReferences(library: Library, options: ListOptions): ListResult;
|
|
28
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/features/operations/list.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,UAAU,CA6BjF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
2
|
+
import type { Library } from "../../core/library.js";
|
|
3
|
+
/**
|
|
4
|
+
* Options for removeReference operation
|
|
5
|
+
*/
|
|
6
|
+
export interface RemoveOperationOptions {
|
|
7
|
+
/** Reference ID or UUID */
|
|
8
|
+
identifier: string;
|
|
9
|
+
/** If true, identifier is treated as UUID; otherwise as ID (default: false) */
|
|
10
|
+
byUuid?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Result of removeReference operation
|
|
14
|
+
*/
|
|
15
|
+
export interface RemoveResult {
|
|
16
|
+
/** Whether the reference was removed */
|
|
17
|
+
removed: boolean;
|
|
18
|
+
/** The removed item (if found) */
|
|
19
|
+
item?: CslItem;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Remove a reference from the library.
|
|
23
|
+
*
|
|
24
|
+
* @param library - The library to remove from
|
|
25
|
+
* @param options - Remove options including identifier and lookup method
|
|
26
|
+
* @returns Result indicating success and the removed item
|
|
27
|
+
*/
|
|
28
|
+
export declare function removeReference(library: Library, options: RemoveOperationOptions): Promise<RemoveResult>;
|
|
29
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/features/operations/remove.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAqBvB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Library } from "../../core/library.js";
|
|
2
|
+
/**
|
|
3
|
+
* Output format options for search operation
|
|
4
|
+
*/
|
|
5
|
+
export type SearchFormat = "pretty" | "json" | "bibtex" | "ids-only" | "uuid";
|
|
6
|
+
/**
|
|
7
|
+
* Options for searchReferences operation
|
|
8
|
+
*/
|
|
9
|
+
export interface SearchOperationOptions {
|
|
10
|
+
/** Search query string */
|
|
11
|
+
query: string;
|
|
12
|
+
/** Output format (default: "pretty") */
|
|
13
|
+
format?: SearchFormat;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Result of searchReferences operation
|
|
17
|
+
*/
|
|
18
|
+
export interface SearchResult {
|
|
19
|
+
/** Formatted strings for each matching reference */
|
|
20
|
+
items: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Search references in the library and return formatted results.
|
|
24
|
+
*
|
|
25
|
+
* @param library - The library to search in
|
|
26
|
+
* @param options - Search query and formatting options
|
|
27
|
+
* @returns Formatted strings for each matching reference
|
|
28
|
+
*/
|
|
29
|
+
export declare function searchReferences(library: Library, options: SearchOperationOptions): SearchResult;
|
|
30
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/features/operations/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMrD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,GAAG,YAAY,CA2ChG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
2
|
+
import type { Library } from "../../core/library.js";
|
|
3
|
+
/**
|
|
4
|
+
* Options for updateReference operation
|
|
5
|
+
*/
|
|
6
|
+
export interface UpdateOperationOptions {
|
|
7
|
+
/** Reference ID or UUID */
|
|
8
|
+
identifier: string;
|
|
9
|
+
/** If true, identifier is treated as UUID; otherwise as ID (default: false) */
|
|
10
|
+
byUuid?: boolean;
|
|
11
|
+
/** Partial updates to apply to the reference */
|
|
12
|
+
updates: Partial<CslItem>;
|
|
13
|
+
/** How to handle ID collision: 'fail' (default) or 'suffix' */
|
|
14
|
+
onIdCollision?: "fail" | "suffix";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of updateReference operation
|
|
18
|
+
*/
|
|
19
|
+
export interface UpdateOperationResult {
|
|
20
|
+
/** Whether the update was successful */
|
|
21
|
+
updated: boolean;
|
|
22
|
+
/** The updated item (if successful) */
|
|
23
|
+
item?: CslItem;
|
|
24
|
+
/** True if ID collision occurred (only when updated=false and onIdCollision='fail') */
|
|
25
|
+
idCollision?: boolean;
|
|
26
|
+
/** True if the ID was changed due to collision resolution */
|
|
27
|
+
idChanged?: boolean;
|
|
28
|
+
/** The new ID after collision resolution (only when idChanged=true) */
|
|
29
|
+
newId?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Update a reference in the library.
|
|
33
|
+
*
|
|
34
|
+
* @param library - The library to update
|
|
35
|
+
* @param options - Update options including identifier, updates, and collision handling
|
|
36
|
+
* @returns Result indicating success and the updated item
|
|
37
|
+
*/
|
|
38
|
+
export declare function updateReference(library: Library, options: UpdateOperationOptions): Promise<UpdateOperationResult>;
|
|
39
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/features/operations/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAqChC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as computeFileHash, a as computeHash, b as backupConfigSchema, d as configSchema, e as defaultConfig, g as getDefaultBackupDirectory, f as getDefaultCurrentDirConfigFilename, h as getDefaultLibraryPath, i as getDefaultUserConfigPath, l as loadConfig, j as logLevelSchema, n as normalizePartialConfig, p as partialConfigSchema, w as watchConfigSchema } from "./chunks/loader-mQ25o6cV.js";
|
|
2
|
+
import { L, R, v, x, o, q, t, u, r, k, s, m } from "./chunks/loader-mQ25o6cV.js";
|
|
3
|
+
import { C as CslLibrarySchema, n as normalize, s as search, a as sortResults, t as tokenize, d as detectDuplicate } from "./chunks/detector-DHztTaFY.js";
|
|
4
|
+
import { b } from "./chunks/detector-DHztTaFY.js";
|
|
3
5
|
import * as fs from "node:fs/promises";
|
|
4
6
|
import { mkdir, readFile, copyFile, stat, unlink, readdir } from "node:fs/promises";
|
|
5
7
|
import * as path from "node:path";
|
|
@@ -93,7 +95,7 @@ async function listBackups(libraryName) {
|
|
|
93
95
|
return { file, mtime: stats.mtimeMs };
|
|
94
96
|
})
|
|
95
97
|
);
|
|
96
|
-
filesWithStats.sort((a,
|
|
98
|
+
filesWithStats.sort((a, b2) => b2.mtime - a.mtime);
|
|
97
99
|
return filesWithStats.map((f) => f.file);
|
|
98
100
|
}
|
|
99
101
|
async function cleanupOldBackups(libraryName, options) {
|
|
@@ -157,8 +159,8 @@ function getItemUuid(item) {
|
|
|
157
159
|
function getTimestamp(item) {
|
|
158
160
|
return item.custom?.timestamp || item.custom?.created_at || "1970-01-01T00:00:00.000Z";
|
|
159
161
|
}
|
|
160
|
-
function deepEqual(a,
|
|
161
|
-
return JSON.stringify(a) === JSON.stringify(
|
|
162
|
+
function deepEqual(a, b2) {
|
|
163
|
+
return JSON.stringify(a) === JSON.stringify(b2);
|
|
162
164
|
}
|
|
163
165
|
function resolveFieldConflict(localValue, remoteValue, localTimestamp, remoteTimestamp, options) {
|
|
164
166
|
if (localTimestamp > remoteTimestamp) {
|
|
@@ -535,7 +537,7 @@ class FileWatcher extends EventEmitter {
|
|
|
535
537
|
}
|
|
536
538
|
export {
|
|
537
539
|
index$3 as Config,
|
|
538
|
-
|
|
540
|
+
b as CslItemSchema,
|
|
539
541
|
CslLibrarySchema,
|
|
540
542
|
index$1 as Duplicate,
|
|
541
543
|
FileWatcher,
|
|
@@ -544,16 +546,16 @@ export {
|
|
|
544
546
|
R as Reference,
|
|
545
547
|
index$2 as Search,
|
|
546
548
|
index$4 as Utils,
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
549
|
+
v as ensureCustomMetadata,
|
|
550
|
+
x as extractUuidFromCustom,
|
|
551
|
+
o as generateId,
|
|
552
|
+
q as generateIdWithCollisionCheck,
|
|
553
|
+
t as generateUuid,
|
|
554
|
+
u as isValidUuid,
|
|
555
|
+
r as normalizeText,
|
|
556
|
+
k as parseCslJson,
|
|
557
|
+
s as serializeCslJson,
|
|
556
558
|
validateCslJson,
|
|
557
|
-
|
|
559
|
+
m as writeCslJson
|
|
558
560
|
};
|
|
559
561
|
//# sourceMappingURL=index.js.map
|