refactor(reader): extract.rs moves into ledger-reader (U0d)
D-61 (Q-9): the writer sheds the typesetter and the crate map is layered again. The PDF/XLSX reader (extract.rs, plan P6) is now the plain library crate ledger-reader, moved whole with git mv and no behavior change. ledger-store depends on it instead of ledger-import, so the store no longer builds Typst or the fonts; ledger-import re-exports it as ledger_import::extract so gui, mcp, host and the fuzz targets compile unchanged, and still never depends on the store. New crate carries only the dependencies extract.rs imports (hayro, hayro-interpret, kurbo, zip, quick-xml, thiserror); fuzz/Cargo.lock gains the new package. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
f98471516e
commit
bb1eb84200
15 files changed
+344
-68
No files matched your search
@@ -45,7 +45,7 @@ use ledger_core::{
|
||||
payroll::{PayrollAccounts, payroll_entry_plan, payroll_remit_plan},
|
||||
reports,
|
||||
};
|
||||
use ledger_import::extract::{EXTRACTOR as E_EXTRACTOR, VERSION as E_VERSION};
|
||||
use ledger_reader::{EXTRACTOR as E_EXTRACTOR, VERSION as E_VERSION};
|
||||
use rusqlite::{Connection, OptionalExtension, params};
|
||||
use rust_decimal::Decimal;
|
||||
use serde_json::{Value, json};
|
||||
@@ -368,7 +368,7 @@ pub struct Extraction {
|
||||
pub attachment_id: u64,
|
||||
/// The text's blob (its SHA-256), when there is text.
|
||||
pub text_sha256: Option<String>,
|
||||
/// What read it (`ledger_import::extract::EXTRACTOR`).
|
||||
/// What read it (`ledger_reader::EXTRACTOR`).
|
||||
pub extractor: String,
|
||||
/// That extractor's version.
|
||||
pub version: String,
|
||||
@@ -4620,7 +4620,7 @@ impl Store {
|
||||
if let Some(already) = self.extraction_for(attachment_id, E_EXTRACTOR, E_VERSION)? {
|
||||
return Ok(already);
|
||||
}
|
||||
let got = ledger_import::extract::extract(bytes, mime_type, file_name);
|
||||
let got = ledger_reader::extract(bytes, mime_type, file_name);
|
||||
let text_sha = match &got.text {
|
||||
Some(text) => Some(self.blobs.put(text.as_bytes())?.0),
|
||||
None => None,
|
||||
@@ -4644,9 +4644,9 @@ impl Store {
|
||||
version: E_VERSION.into(),
|
||||
pages: got.pages,
|
||||
status: match got.status {
|
||||
ledger_import::extract::ExtractStatus::Ok => ExtractionStatus::Ok,
|
||||
ledger_import::extract::ExtractStatus::None => ExtractionStatus::None,
|
||||
ledger_import::extract::ExtractStatus::Failed => ExtractionStatus::Failed,
|
||||
ledger_reader::ExtractStatus::Ok => ExtractionStatus::Ok,
|
||||
ledger_reader::ExtractStatus::None => ExtractionStatus::None,
|
||||
ledger_reader::ExtractStatus::Failed => ExtractionStatus::Failed,
|
||||
},
|
||||
seq: line.seq,
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user