@cfxlabsinc/b2b-services
    Preparing search index...

    Module @cfxlabsinc/document-services

    document-services

    The document index every dashboard tenant shares: files and folders whose bytes live in S3 under the owner's root and whose listing is one row per node in the owner's table (bank.bank_document, b2b.customer_document, both from defineDocumentTable in @cfxlabsinc/db).

    DocumentIndex is the engine: reads (get, search folders first, getStream, getDownloadUrl, getHead) behind one SearchCache namespace per owner kind, and protected writes (writeFile, writeFolder, signUpload, indexUpload, removeDocument, reconcileOwner) for the owner's writer to expose. An owner kind is one DocumentIndexConfig: the field it is named by (bankId), its error-code prefix (BANK_DOCUMENT_*), its table, its owner and user tables, its S3 root and per-type prefixes, and its cache tags. See BankDocumentService and CustomerDocumentService.

    • A type whose prefix nests inside another's (the customer's terms/ under its CUSTOM root) reserves its first segment at that type's root, and reconcile skips its subtree there. Both come from typePrefixes; nothing lists them by hand.
    • fileWritten / fileDeleted are hooks for an owner that publishes events.
    • reconcileKey is reconcileOwner for one key, and the engine behind each owner's reconcileObject({ key }). It never reads an event type: it lists the key's versions in S3 and compares them with the table. A live object with no live row is inserted with its folders, a live row whose object is gone is soft-deleted, and a signed upload (uploaded-by metadata) is left to completeUpload. Outcomes are INSERTED, DELETED, UNCHANGED, or SKIPPED with reason NOT_A_DOCUMENT_KEY, OWNER_NOT_FOUND or SIGNED_UPLOAD.
    • @cfxlabsinc/document-services/documentUpload holds the upload rules (extensions, 25 MB, names) and imports nothing, so a browser bundle can use it.
    • @cfxlabsinc/document-services/test is an S3 fake for owners' tests.
    DocumentIndex
    DocumentCreateArgs
    DocumentDeleteArgs
    DocumentErrorCode
    DocumentIndexConfig
    DocumentNode
    DocumentOwnerArg
    DocumentSearchArgs
    DocumentUploadArgs
    DocumentUserPathArgs
    OwnedDocument
    OwnedDocumentFile
    OwnedDocumentStream
    ReconciledObject
    documentCacheKey
    nullIfMissing