@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,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSL Style Management
|
|
3
|
+
*
|
|
4
|
+
* Handles resolution and loading of CSL (Citation Style Language) style files.
|
|
5
|
+
*
|
|
6
|
+
* Style Resolution Order:
|
|
7
|
+
* 1. --csl-file <path> (exact file path)
|
|
8
|
+
* 2. Built-in style matching --style <name>
|
|
9
|
+
* 3. Search in csl_directory paths (in array order)
|
|
10
|
+
* 4. Default style from config (default_style)
|
|
11
|
+
* 5. "apa" (hardcoded default)
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Built-in styles available in @citation-js/plugin-csl
|
|
15
|
+
* These can be used directly without loading external files
|
|
16
|
+
*/
|
|
17
|
+
export declare const BUILTIN_STYLES: readonly ["apa", "vancouver", "harvard"];
|
|
18
|
+
export type BuiltinStyleName = (typeof BUILTIN_STYLES)[number];
|
|
19
|
+
/**
|
|
20
|
+
* Check if a style name is a built-in style
|
|
21
|
+
*/
|
|
22
|
+
export declare function isBuiltinStyle(styleName: string): styleName is BuiltinStyleName;
|
|
23
|
+
export interface StyleResolutionOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Exact path to CSL file (from --csl-file option)
|
|
26
|
+
* Takes highest priority
|
|
27
|
+
*/
|
|
28
|
+
cslFile?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Style name to resolve (from --style option)
|
|
31
|
+
*/
|
|
32
|
+
style?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Directory or directories to search for custom CSL files
|
|
35
|
+
* (from csl_directory config)
|
|
36
|
+
* Can be a single string or array of strings
|
|
37
|
+
*/
|
|
38
|
+
cslDirectory?: string | string[];
|
|
39
|
+
/**
|
|
40
|
+
* Default style to use if specified style not found
|
|
41
|
+
* (from default_style config)
|
|
42
|
+
*/
|
|
43
|
+
defaultStyle?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface StyleResolution {
|
|
46
|
+
/**
|
|
47
|
+
* Type of resolution: "builtin" for citation-js built-in styles,
|
|
48
|
+
* "custom" for external CSL files
|
|
49
|
+
*/
|
|
50
|
+
type: "builtin" | "custom";
|
|
51
|
+
/**
|
|
52
|
+
* The resolved style name (for built-in) or identifier (for custom)
|
|
53
|
+
*/
|
|
54
|
+
styleName: string;
|
|
55
|
+
/**
|
|
56
|
+
* CSL XML content (only for custom styles)
|
|
57
|
+
*/
|
|
58
|
+
styleXml?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Load CSL style file content from the given path
|
|
62
|
+
*
|
|
63
|
+
* @param stylePath - Path to the CSL style file
|
|
64
|
+
* @returns Content of the CSL style file (XML string)
|
|
65
|
+
* @throws Error if file cannot be read
|
|
66
|
+
*/
|
|
67
|
+
export declare function loadCSLStyleFile(stylePath: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the style based on resolution options
|
|
70
|
+
*
|
|
71
|
+
* Resolution order:
|
|
72
|
+
* 1. cslFile (exact path) - throws if doesn't exist
|
|
73
|
+
* 2. Built-in style matching style name
|
|
74
|
+
* 3. Search in csl_directory paths (in order)
|
|
75
|
+
* 4. Default style (defaultStyle) - if built-in
|
|
76
|
+
* 5. "apa" (hardcoded fallback)
|
|
77
|
+
*
|
|
78
|
+
* @param options - Style resolution options
|
|
79
|
+
* @returns StyleResolution with type, styleName, and optional styleXml
|
|
80
|
+
* @throws Error if cslFile is specified but doesn't exist
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveStyle(options: StyleResolutionOptions): StyleResolution;
|
|
83
|
+
//# sourceMappingURL=csl-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csl-styles.d.ts","sourceRoot":"","sources":["../../src/config/csl-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH;;;GAGG;AACH,eAAO,MAAM,cAAc,0CAA2C,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,IAAI,gBAAgB,CAE/E;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEjC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAE3B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAaD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CA4D7E"}
|
|
@@ -22,6 +22,16 @@ export declare function getDefaultUserConfigPath(): string;
|
|
|
22
22
|
* Uses .reference-manager.config.toml
|
|
23
23
|
*/
|
|
24
24
|
export declare function getDefaultCurrentDirConfigFilename(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get the default CSL directory
|
|
27
|
+
* Uses ~/.reference-manager/csl/
|
|
28
|
+
*/
|
|
29
|
+
export declare function getDefaultCslDirectory(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get the default fulltext directory
|
|
32
|
+
* Uses ~/.reference-manager/fulltext/
|
|
33
|
+
*/
|
|
34
|
+
export declare function getDefaultFulltextDirectory(): string;
|
|
25
35
|
/**
|
|
26
36
|
* Default configuration
|
|
27
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,IAAI,MAAM,CAE3D;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,IAAI,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MA+B3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,OAAO,EACL,KAAK,MAAM,EAMZ,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AA8ID;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAwClE"}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -20,9 +20,10 @@ export declare const backupConfigSchema: z.ZodObject<{
|
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
/**
|
|
22
22
|
* File watching configuration schema
|
|
23
|
+
* Note: File watching is always enabled in server mode (HTTP/MCP).
|
|
24
|
+
* CLI mode does not use file watching.
|
|
23
25
|
*/
|
|
24
26
|
export declare const watchConfigSchema: z.ZodObject<{
|
|
25
|
-
enabled: z.ZodBoolean;
|
|
26
27
|
debounceMs: z.ZodNumber;
|
|
27
28
|
pollIntervalMs: z.ZodNumber;
|
|
28
29
|
retryIntervalMs: z.ZodNumber;
|
|
@@ -35,6 +36,40 @@ export declare const serverConfigSchema: z.ZodObject<{
|
|
|
35
36
|
autoStart: z.ZodBoolean;
|
|
36
37
|
autoStopMinutes: z.ZodNumber;
|
|
37
38
|
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Citation format schema
|
|
41
|
+
*/
|
|
42
|
+
export declare const citationFormatSchema: z.ZodEnum<{
|
|
43
|
+
text: "text";
|
|
44
|
+
html: "html";
|
|
45
|
+
rtf: "rtf";
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Citation configuration schema
|
|
49
|
+
*/
|
|
50
|
+
export declare const citationConfigSchema: z.ZodObject<{
|
|
51
|
+
defaultStyle: z.ZodString;
|
|
52
|
+
cslDirectory: z.ZodArray<z.ZodString>;
|
|
53
|
+
defaultLocale: z.ZodString;
|
|
54
|
+
defaultFormat: z.ZodEnum<{
|
|
55
|
+
text: "text";
|
|
56
|
+
html: "html";
|
|
57
|
+
rtf: "rtf";
|
|
58
|
+
}>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
/**
|
|
61
|
+
* PubMed API configuration schema
|
|
62
|
+
*/
|
|
63
|
+
export declare const pubmedConfigSchema: z.ZodObject<{
|
|
64
|
+
email: z.ZodOptional<z.ZodString>;
|
|
65
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
/**
|
|
68
|
+
* Fulltext storage configuration schema
|
|
69
|
+
*/
|
|
70
|
+
export declare const fulltextConfigSchema: z.ZodObject<{
|
|
71
|
+
directory: z.ZodString;
|
|
72
|
+
}, z.core.$strip>;
|
|
38
73
|
/**
|
|
39
74
|
* Complete configuration schema
|
|
40
75
|
*/
|
|
@@ -51,7 +86,6 @@ export declare const configSchema: z.ZodObject<{
|
|
|
51
86
|
directory: z.ZodString;
|
|
52
87
|
}, z.core.$strip>;
|
|
53
88
|
watch: z.ZodObject<{
|
|
54
|
-
enabled: z.ZodBoolean;
|
|
55
89
|
debounceMs: z.ZodNumber;
|
|
56
90
|
pollIntervalMs: z.ZodNumber;
|
|
57
91
|
retryIntervalMs: z.ZodNumber;
|
|
@@ -61,6 +95,23 @@ export declare const configSchema: z.ZodObject<{
|
|
|
61
95
|
autoStart: z.ZodBoolean;
|
|
62
96
|
autoStopMinutes: z.ZodNumber;
|
|
63
97
|
}, z.core.$strip>;
|
|
98
|
+
citation: z.ZodObject<{
|
|
99
|
+
defaultStyle: z.ZodString;
|
|
100
|
+
cslDirectory: z.ZodArray<z.ZodString>;
|
|
101
|
+
defaultLocale: z.ZodString;
|
|
102
|
+
defaultFormat: z.ZodEnum<{
|
|
103
|
+
text: "text";
|
|
104
|
+
html: "html";
|
|
105
|
+
rtf: "rtf";
|
|
106
|
+
}>;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
pubmed: z.ZodObject<{
|
|
109
|
+
email: z.ZodOptional<z.ZodString>;
|
|
110
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
fulltext: z.ZodObject<{
|
|
113
|
+
directory: z.ZodString;
|
|
114
|
+
}, z.core.$strip>;
|
|
64
115
|
}, z.core.$strip>;
|
|
65
116
|
/**
|
|
66
117
|
* Partial configuration schema (for TOML files)
|
|
@@ -86,7 +137,6 @@ export declare const partialConfigSchema: z.ZodObject<{
|
|
|
86
137
|
directory: z.ZodOptional<z.ZodString>;
|
|
87
138
|
}, z.core.$strip>>;
|
|
88
139
|
watch: z.ZodOptional<z.ZodObject<{
|
|
89
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
90
140
|
debounceMs: z.ZodOptional<z.ZodNumber>;
|
|
91
141
|
debounce_ms: z.ZodOptional<z.ZodNumber>;
|
|
92
142
|
pollIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -102,6 +152,32 @@ export declare const partialConfigSchema: z.ZodObject<{
|
|
|
102
152
|
autoStopMinutes: z.ZodOptional<z.ZodNumber>;
|
|
103
153
|
auto_stop_minutes: z.ZodOptional<z.ZodNumber>;
|
|
104
154
|
}, z.core.$strip>>;
|
|
155
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
defaultStyle: z.ZodOptional<z.ZodString>;
|
|
157
|
+
default_style: z.ZodOptional<z.ZodString>;
|
|
158
|
+
cslDirectory: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
159
|
+
csl_directory: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
160
|
+
defaultLocale: z.ZodOptional<z.ZodString>;
|
|
161
|
+
default_locale: z.ZodOptional<z.ZodString>;
|
|
162
|
+
defaultFormat: z.ZodOptional<z.ZodEnum<{
|
|
163
|
+
text: "text";
|
|
164
|
+
html: "html";
|
|
165
|
+
rtf: "rtf";
|
|
166
|
+
}>>;
|
|
167
|
+
default_format: z.ZodOptional<z.ZodEnum<{
|
|
168
|
+
text: "text";
|
|
169
|
+
html: "html";
|
|
170
|
+
rtf: "rtf";
|
|
171
|
+
}>>;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
pubmed: z.ZodOptional<z.ZodObject<{
|
|
174
|
+
email: z.ZodOptional<z.ZodString>;
|
|
175
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
176
|
+
api_key: z.ZodOptional<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
fulltext: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>>;
|
|
105
181
|
}, z.core.$loose>;
|
|
106
182
|
/**
|
|
107
183
|
* Inferred types from schemas
|
|
@@ -110,6 +186,10 @@ export type LogLevel = z.infer<typeof logLevelSchema>;
|
|
|
110
186
|
export type BackupConfig = z.infer<typeof backupConfigSchema>;
|
|
111
187
|
export type WatchConfig = z.infer<typeof watchConfigSchema>;
|
|
112
188
|
export type ServerConfig = z.infer<typeof serverConfigSchema>;
|
|
189
|
+
export type CitationFormat = z.infer<typeof citationFormatSchema>;
|
|
190
|
+
export type CitationConfig = z.infer<typeof citationConfigSchema>;
|
|
191
|
+
export type PubmedConfig = z.infer<typeof pubmedConfigSchema>;
|
|
192
|
+
export type FulltextConfig = z.infer<typeof fulltextConfigSchema>;
|
|
113
193
|
export type Config = z.infer<typeof configSchema>;
|
|
114
194
|
export type PartialConfig = z.infer<typeof partialConfigSchema>;
|
|
115
195
|
/**
|
|
@@ -121,6 +201,9 @@ export type DeepPartialConfig = {
|
|
|
121
201
|
backup?: Partial<BackupConfig>;
|
|
122
202
|
watch?: Partial<WatchConfig>;
|
|
123
203
|
server?: Partial<ServerConfig>;
|
|
204
|
+
citation?: Partial<CitationConfig>;
|
|
205
|
+
pubmed?: Partial<PubmedConfig>;
|
|
206
|
+
fulltext?: Partial<FulltextConfig>;
|
|
124
207
|
};
|
|
125
208
|
/**
|
|
126
209
|
* Normalize snake_case fields to camelCase
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;EAAsC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;EAAsC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;iBAK5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;EAAkC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;iBAK/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASvB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2DhB,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACpC,CAAC;AAoKF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,iBAAiB,CAmEhF"}
|
|
@@ -4,7 +4,12 @@ declare const CslCustomSchema: z.ZodObject<{
|
|
|
4
4
|
created_at: z.ZodString;
|
|
5
5
|
timestamp: z.ZodString;
|
|
6
6
|
additional_urls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
|
-
|
|
7
|
+
fulltext: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
pdf: z.ZodOptional<z.ZodString>;
|
|
9
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
}, z.core.$loose>;
|
|
8
13
|
export declare const CslItemSchema: z.ZodObject<{
|
|
9
14
|
id: z.ZodString;
|
|
10
15
|
type: z.ZodString;
|
|
@@ -59,7 +64,12 @@ export declare const CslItemSchema: z.ZodObject<{
|
|
|
59
64
|
created_at: z.ZodString;
|
|
60
65
|
timestamp: z.ZodString;
|
|
61
66
|
additional_urls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
|
-
|
|
67
|
+
fulltext: z.ZodOptional<z.ZodObject<{
|
|
68
|
+
pdf: z.ZodOptional<z.ZodString>;
|
|
69
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
+
}, z.core.$loose>>;
|
|
63
73
|
}, z.core.$loose>;
|
|
64
74
|
export declare const CslLibrarySchema: z.ZodArray<z.ZodObject<{
|
|
65
75
|
id: z.ZodString;
|
|
@@ -115,7 +125,12 @@ export declare const CslLibrarySchema: z.ZodArray<z.ZodObject<{
|
|
|
115
125
|
created_at: z.ZodString;
|
|
116
126
|
timestamp: z.ZodString;
|
|
117
127
|
additional_urls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
|
-
|
|
128
|
+
fulltext: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
pdf: z.ZodOptional<z.ZodString>;
|
|
130
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
}, z.core.$loose>>;
|
|
119
134
|
}, z.core.$loose>>;
|
|
120
135
|
export type CslCustom = z.infer<typeof CslCustomSchema>;
|
|
121
136
|
export type CslItem = z.infer<typeof CslItemSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/csl-json/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/csl-json/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,QAAA,MAAM,eAAe;;;;;;;;;;iBASL,CAAC;AAGjB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BV,CAAC;AAGjB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAyB,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ILibrary - Common interface for library implementations.
|
|
3
|
+
*
|
|
4
|
+
* Both Library (local file-based) and ServerClient (HTTP-based) implement this interface,
|
|
5
|
+
* allowing operations to work with either implementation interchangeably.
|
|
6
|
+
*
|
|
7
|
+
* Design notes:
|
|
8
|
+
* - All methods are async to support HTTP-based implementations (ServerClient)
|
|
9
|
+
* - Methods return CslItem directly (not Reference) for simplicity and HTTP compatibility
|
|
10
|
+
* - Library internally uses Reference for ID generation and indexing, but exposes CslItem via ILibrary
|
|
11
|
+
* - ServerClient naturally returns CslItem from HTTP responses
|
|
12
|
+
*/
|
|
13
|
+
import type { CslItem } from "./csl-json/types.js";
|
|
14
|
+
/**
|
|
15
|
+
* Options for find operations.
|
|
16
|
+
*/
|
|
17
|
+
export interface FindOptions {
|
|
18
|
+
/** If true, treat the identifier as UUID; otherwise treat as citation ID (default: false) */
|
|
19
|
+
byUuid?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Options for remove operations.
|
|
23
|
+
* Currently identical to FindOptions, but defined separately for clarity and future extensibility.
|
|
24
|
+
*/
|
|
25
|
+
export type RemoveOptions = FindOptions;
|
|
26
|
+
/**
|
|
27
|
+
* Result of a remove operation.
|
|
28
|
+
*/
|
|
29
|
+
export interface RemoveResult {
|
|
30
|
+
/** Whether the removal was successful */
|
|
31
|
+
removed: boolean;
|
|
32
|
+
/** The removed item (only when removed=true, may be undefined if not available from server) */
|
|
33
|
+
removedItem?: CslItem;
|
|
34
|
+
}
|
|
35
|
+
export interface UpdateOptions {
|
|
36
|
+
/** How to handle ID collision: 'fail' (default) or 'suffix' */
|
|
37
|
+
onIdCollision?: "fail" | "suffix";
|
|
38
|
+
/** If true, treat the identifier as UUID; otherwise treat as citation ID (default: false) */
|
|
39
|
+
byUuid?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Result of an update operation.
|
|
43
|
+
*/
|
|
44
|
+
export interface UpdateResult {
|
|
45
|
+
/** Whether the update was successful */
|
|
46
|
+
updated: boolean;
|
|
47
|
+
/** The updated item (only when updated=true) */
|
|
48
|
+
item?: CslItem;
|
|
49
|
+
/** True if ID collision occurred (only when updated=false and onIdCollision='fail') */
|
|
50
|
+
idCollision?: boolean;
|
|
51
|
+
/** True if the ID was changed due to collision resolution */
|
|
52
|
+
idChanged?: boolean;
|
|
53
|
+
/** The new ID after collision resolution (only when idChanged=true) */
|
|
54
|
+
newId?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Common interface for library implementations.
|
|
58
|
+
*/
|
|
59
|
+
export interface ILibrary {
|
|
60
|
+
/**
|
|
61
|
+
* Find a reference by citation ID or UUID.
|
|
62
|
+
* @param identifier - The citation ID or UUID of the reference to find
|
|
63
|
+
* @param options - Find options (byUuid to use UUID lookup)
|
|
64
|
+
* @returns The CSL item if found, undefined otherwise
|
|
65
|
+
*/
|
|
66
|
+
find(identifier: string, options?: FindOptions): Promise<CslItem | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Get all references.
|
|
69
|
+
* @returns Array of all CSL items in the library
|
|
70
|
+
*/
|
|
71
|
+
getAll(): Promise<CslItem[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Add a new reference to the library.
|
|
74
|
+
* @param item - The CSL item to add
|
|
75
|
+
* @returns The added CSL item (with generated ID and UUID if not present)
|
|
76
|
+
*/
|
|
77
|
+
add(item: CslItem): Promise<CslItem>;
|
|
78
|
+
/**
|
|
79
|
+
* Update a reference by citation ID or UUID.
|
|
80
|
+
* @param identifier - The citation ID or UUID of the reference to update
|
|
81
|
+
* @param updates - Partial CSL item with fields to update
|
|
82
|
+
* @param options - Update options (byUuid to use UUID lookup, onIdCollision for collision handling)
|
|
83
|
+
* @returns Update result indicating success/failure, updated item, and any ID changes
|
|
84
|
+
*/
|
|
85
|
+
update(identifier: string, updates: Partial<CslItem>, options?: UpdateOptions): Promise<UpdateResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Remove a reference by citation ID or UUID.
|
|
88
|
+
* @param identifier - The citation ID or UUID of the reference to remove
|
|
89
|
+
* @param options - Remove options (byUuid to use UUID lookup)
|
|
90
|
+
* @returns Remove result with removed status and optionally the removed item
|
|
91
|
+
*/
|
|
92
|
+
remove(identifier: string, options?: RemoveOptions): Promise<RemoveResult>;
|
|
93
|
+
/**
|
|
94
|
+
* Save the library to persistent storage.
|
|
95
|
+
* For Library: writes to file
|
|
96
|
+
* For ServerClient: no-op (HTTP requests are already persisted)
|
|
97
|
+
*/
|
|
98
|
+
save(): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=library-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-interface.d.ts","sourceRoot":"","sources":["../../src/core/library-interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6FAA6F;IAC7F,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,+FAA+F;IAC/F,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,6FAA6F;IAC7F,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,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;;GAEG;AACH,MAAM,WAAW,QAAQ;IAKvB;;;;;OAKG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAE9E;;;OAGG;IACH,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAM7B;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EACzB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAM3E;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
|
package/dist/core/library.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { CslItem } from "./csl-json/types";
|
|
2
|
+
import type { FindOptions, ILibrary, RemoveOptions, RemoveResult, UpdateOptions, UpdateResult } from "./library-interface.js";
|
|
2
3
|
import { Reference } from "./reference";
|
|
4
|
+
export type { FindOptions, ILibrary, UpdateOptions, UpdateResult } from "./library-interface.js";
|
|
3
5
|
/**
|
|
4
|
-
* Library manager for CSL-JSON references
|
|
6
|
+
* Library manager for CSL-JSON references.
|
|
7
|
+
* Implements ILibrary interface for use with operations layer.
|
|
5
8
|
*/
|
|
6
|
-
export declare class Library {
|
|
9
|
+
export declare class Library implements ILibrary {
|
|
7
10
|
private filePath;
|
|
8
11
|
private references;
|
|
9
12
|
private currentHash;
|
|
@@ -21,25 +24,39 @@ export declare class Library {
|
|
|
21
24
|
*/
|
|
22
25
|
save(): Promise<void>;
|
|
23
26
|
/**
|
|
24
|
-
*
|
|
27
|
+
* Reloads the library from file if it was modified externally.
|
|
28
|
+
* Self-writes (detected via hash comparison) are skipped.
|
|
29
|
+
* @returns true if reload occurred, false if skipped (self-write detected)
|
|
25
30
|
*/
|
|
26
|
-
|
|
31
|
+
reload(): Promise<boolean>;
|
|
27
32
|
/**
|
|
28
|
-
*
|
|
33
|
+
* Add a reference to the library
|
|
34
|
+
* @param item - The CSL item to add
|
|
35
|
+
* @returns The added CSL item (with generated ID and UUID)
|
|
29
36
|
*/
|
|
30
|
-
|
|
37
|
+
add(item: CslItem): Promise<CslItem>;
|
|
31
38
|
/**
|
|
32
|
-
* Remove a reference by ID
|
|
39
|
+
* Remove a reference by citation ID or UUID.
|
|
40
|
+
* @param identifier - The citation ID or UUID of the reference to remove
|
|
41
|
+
* @param options - Remove options (byUuid to use UUID lookup)
|
|
42
|
+
* @returns Remove result with removed status and the removed item
|
|
33
43
|
*/
|
|
34
|
-
|
|
44
|
+
remove(identifier: string, options?: RemoveOptions): Promise<RemoveResult>;
|
|
35
45
|
/**
|
|
36
|
-
*
|
|
46
|
+
* Update a reference by citation ID or UUID.
|
|
47
|
+
* @param identifier - The citation ID or UUID of the reference to update
|
|
48
|
+
* @param updates - Partial updates to apply to the reference
|
|
49
|
+
* @param options - Update options (byUuid to use UUID lookup, onIdCollision for collision handling)
|
|
50
|
+
* @returns Update result with updated item, success status, and any ID changes
|
|
37
51
|
*/
|
|
38
|
-
|
|
52
|
+
update(identifier: string, updates: Partial<CslItem>, options?: UpdateOptions): Promise<UpdateResult>;
|
|
39
53
|
/**
|
|
40
|
-
* Find a reference by ID
|
|
54
|
+
* Find a reference by citation ID or UUID.
|
|
55
|
+
* @param identifier - The citation ID or UUID of the reference to find
|
|
56
|
+
* @param options - Find options (byUuid to use UUID lookup)
|
|
57
|
+
* @returns The CSL item if found, undefined otherwise
|
|
41
58
|
*/
|
|
42
|
-
|
|
59
|
+
find(identifier: string, options?: FindOptions): Promise<CslItem | undefined>;
|
|
43
60
|
/**
|
|
44
61
|
* Find a reference by DOI
|
|
45
62
|
*/
|
|
@@ -51,7 +68,7 @@ export declare class Library {
|
|
|
51
68
|
/**
|
|
52
69
|
* Get all references
|
|
53
70
|
*/
|
|
54
|
-
getAll():
|
|
71
|
+
getAll(): Promise<CslItem[]>;
|
|
55
72
|
/**
|
|
56
73
|
* Get the file path
|
|
57
74
|
*/
|
|
@@ -69,5 +86,31 @@ export declare class Library {
|
|
|
69
86
|
* Remove reference from all indices and array
|
|
70
87
|
*/
|
|
71
88
|
private removeReference;
|
|
89
|
+
/**
|
|
90
|
+
* Update a reference with partial updates.
|
|
91
|
+
* Preserves uuid and created_at, updates timestamp.
|
|
92
|
+
*/
|
|
93
|
+
private updateReference;
|
|
94
|
+
/**
|
|
95
|
+
* Resolve the new ID, handling collisions based on options.
|
|
96
|
+
*/
|
|
97
|
+
private resolveNewId;
|
|
98
|
+
/**
|
|
99
|
+
* Build the updated CslItem, preserving uuid and created_at.
|
|
100
|
+
*/
|
|
101
|
+
private buildUpdatedItem;
|
|
102
|
+
/**
|
|
103
|
+
* Remove a reference from all indices.
|
|
104
|
+
*/
|
|
105
|
+
private removeFromIndices;
|
|
106
|
+
/**
|
|
107
|
+
* Generate an alphabetic suffix for ID collision resolution.
|
|
108
|
+
* 0 -> 'a', 1 -> 'b', ..., 25 -> 'z', 26 -> 'aa', etc.
|
|
109
|
+
*/
|
|
110
|
+
private generateSuffix;
|
|
111
|
+
/**
|
|
112
|
+
* Resolve ID collision by appending alphabetic suffix.
|
|
113
|
+
*/
|
|
114
|
+
private resolveIdCollision;
|
|
72
115
|
}
|
|
73
116
|
//# sourceMappingURL=library.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/core/library.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/core/library.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEjG;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IACtC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAmB;IACrC,OAAO,CAAC,WAAW,CAAuB;IAG1C,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,SAAS,CAAqC;IAEtD,OAAO;IAWP;;OAEG;WACU,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQrD;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IA8BhC;;;;OAIG;IACG,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAe1C;;;;;OAKG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAWpF;;;;;;OAMG;IACG,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EACzB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC;IAWxB;;;;;OAKG;IACG,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAMvF;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI7C;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI/C;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAIlC;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,cAAc,IAAI,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAwCvB;;OAEG;IACH,OAAO,CAAC,YAAY;IA0BpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAatB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAgB3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bibtex.d.ts","sourceRoot":"","sources":["../../../src/features/format/bibtex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AA+J5D;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAMrD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import "@citation-js/plugin-csl";
|
|
2
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Options for CSL citation formatting
|
|
5
|
+
*/
|
|
6
|
+
export type CitationFormatOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* CSL style name (e.g., 'apa', 'vancouver', 'chicago')
|
|
9
|
+
* @default 'apa'
|
|
10
|
+
*/
|
|
11
|
+
style?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Output format: text, html, or rtf
|
|
14
|
+
* @default 'text'
|
|
15
|
+
*/
|
|
16
|
+
format?: "text" | "html" | "rtf";
|
|
17
|
+
/**
|
|
18
|
+
* Locale code (e.g., 'en-US', 'en-GB')
|
|
19
|
+
* @default 'en-US'
|
|
20
|
+
*/
|
|
21
|
+
locale?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Format CSL-JSON items as bibliography using CSL processor.
|
|
25
|
+
* Falls back to simplified format if CSL processing fails.
|
|
26
|
+
*
|
|
27
|
+
* @param items - Array of CSL-JSON items
|
|
28
|
+
* @param options - Formatting options
|
|
29
|
+
* @returns Formatted bibliography entries
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatBibliographyCSL(items: CslItem[], options: CitationFormatOptions): string;
|
|
32
|
+
/**
|
|
33
|
+
* Format CSL-JSON items as in-text citations using CSL processor.
|
|
34
|
+
* Falls back to simplified format if CSL processing fails.
|
|
35
|
+
*
|
|
36
|
+
* @param items - Array of CSL-JSON items
|
|
37
|
+
* @param options - Formatting options
|
|
38
|
+
* @returns Formatted in-text citation(s)
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatInTextCSL(items: CslItem[], options: CitationFormatOptions): string;
|
|
41
|
+
//# sourceMappingURL=citation-csl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-csl.d.ts","sourceRoot":"","sources":["../../../src/features/format/citation-csl.ts"],"names":[],"mappings":"AACA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAG5D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IAEjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CA+B9F;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CA+BxF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CslItem } from "../../core/csl-json/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Format CSL-JSON items as simplified AMA-like bibliography entries.
|
|
4
|
+
*
|
|
5
|
+
* Format: FirstAuthor [et al]. JournalAbbrev. YYYY;volume(issue):pages. PMID:xxxxx [or DOI:xxxxx]. Title.
|
|
6
|
+
*
|
|
7
|
+
* Multiple items are separated by double newlines.
|
|
8
|
+
*
|
|
9
|
+
* @param items - Array of CSL-JSON items
|
|
10
|
+
* @returns Formatted bibliography entries separated by double newlines
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatBibliography(items: CslItem[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format CSL-JSON items as simplified in-text citations.
|
|
15
|
+
*
|
|
16
|
+
* Format: (FirstAuthor et al, YYYY)
|
|
17
|
+
*
|
|
18
|
+
* Multiple items are separated by semicolons and enclosed in parentheses.
|
|
19
|
+
*
|
|
20
|
+
* @param items - Array of CSL-JSON items
|
|
21
|
+
* @returns Formatted in-text citation(s) enclosed in parentheses
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatInText(items: CslItem[]): string;
|
|
24
|
+
//# sourceMappingURL=citation-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-fallback.d.ts","sourceRoot":"","sources":["../../../src/features/format/citation-fallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAwK5D;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAM3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAOrD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output formatters for reference data
|
|
3
|
+
*/
|
|
4
|
+
export { formatJson } from "./json.js";
|
|
5
|
+
export { formatPretty } from "./pretty.js";
|
|
6
|
+
export { formatBibtex } from "./bibtex.js";
|
|
7
|
+
export { formatBibliography, formatInText } from "./citation-fallback.js";
|
|
8
|
+
export { formatBibliographyCSL, formatInTextCSL } from "./citation-csl.js";
|
|
9
|
+
export type { CitationFormatOptions } from "./citation-csl.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/format/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/features/format/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAEnD"}
|