Public API Extensions
Relevant source files
The following files were used as context for generating this wiki page:
The flext-tap-ldif project provides a structured surface for extracting and processing LDAP Data Interchange Format (LDIF) files within the Singer ecosystem. While the project notes that no external public extensions are currently exposed, it defines a comprehensive internal Public API through a facade pattern that consolidates services, utilities, and data models for LDIF processing.
Sources: README.md:32, src/flext_tap_ldif/init.py:42-76
API Surface Architecture
The API surface is organized into specialized namespaces that encapsulate different domains of the tap's functionality. This structure is managed through a lazy loading system that ensures efficient resource utilization while providing a consistent entry point for consumers.
The diagram above illustrates how the public facade classes act as gateways to the specialized internal implementations.
Sources: src/flext_tap_ldif/init.py:42-76, src/flext_tap_ldif/_exports_lazy_part_01.py:11-47
Core API Components
The following table summarizes the primary namespaces exposed by the package:
| Namespace | Component Class | Primary Purpose |
|---|---|---|
s | FlextTapLdifService | Main service orchestrator for LDIF extraction logic. |
u | FlextTapLdifUtilities | Access to LDIF parsing, file discovery, and state management. |
m | FlextTapLdifModels | Data structures for entries, files, and processing metadata. |
c | FlextTapLdifConstants | Configuration defaults and schema field definitions. |
main | FlextTapLdifCli | Command-line interface entry points. |
Sources: src/flext_tap_ldif/init.py:42-76, src/flext_tap_ldif/_exports_lazy_part_01.py:11-47
Data Processing and Discovery API
The processing API is primarily handled by the Processor class, which interacts with the flext-ldif library to transform raw LDIF content into structured Singer records.
File Discovery Logic
The API supports discovering LDIF files through two primary modes: direct file paths or directory scanning with pattern matching.
The flow represents the logic used by the processor to identify valid source data.
Sources: src/flext_tap_ldif/_utilities/processor.py:27-62
Attribute Normalization
LDIF attributes are normalized to ensure compatibility with JSON-based Singer schemas. This includes lowercasing, replacing non-alphanumeric characters with underscores, and prefixing numeric start characters.
Sources: src/flext_tap_ldif/_utilities/data_processing.py:75-84, src/flext_tap_ldif/constants.py:32
Schema and Constants Extension
The API defines a standard schema for every entry extracted from an LDIF file. This ensures that downstream Singer targets receive consistent metadata regardless of the LDIF source.
Field Name (c.TapLdif.EntrySchema) | Description | Default / Example |
|---|---|---|
DN_FIELD | The Distinguished Name of the entry. | "uid=jdoe,ou=users,dc=ext" |
ATTRIBUTES_FIELD | Key-value mapping of LDAP attributes. | {"cn": ["John Doe"]} |
OBJECT_CLASS_FIELD | Convenience list of objectClass values. | ["inetOrgPerson"] |
SOURCE_FILE_FIELD | Path to the source LDIF file. | "/data/export.ldif" |
ENTRY_SIZE_FIELD | Size of the entry in bytes. | Computed at runtime |
Sources: src/flext_tap_ldif/constants.py:65-73, src/flext_tap_ldif/_utilities/processor.py:105-117
State Management API
Incremental syncs are supported via a dedicated state management utility. This allows the tap to track processing positions across multiple LDIF files.
This diagram shows the interaction between the tap logic and the state utility to maintain bookmarks.
Sources: src/flext_tap_ldif/_utilities/state_management.py:14-43
Processing Metadata Models
The LdifFile model provides a comprehensive structure for reporting the status of file-level operations.
# src/flext_tap_ldif/_models/file_metadata.py:15-54
class LdifFile(m.EnforcedModel):
file_path: str
file_size: int = 0
encoding: str = c.DEFAULT_ENCODING
total_lines: int = 0
entry_count: int = 0
processing_status: str = "pending"
last_processed_line: int = 0
processing_errors: t.StrSequence = ()
This model is used to generate the ldif_file_summary which includes calculated progress percentages and validation status.
Sources: src/flext_tap_ldif/_models/file_metadata.py:15-89
The public API extensions of flext-tap-ldif establish a robust, typed interface for LDIF data extraction. By centralizing logic in the FlextTapLdifService and providing rich utility namespaces (u.TapLdif), the project enables scalable and maintainable enterprise data integration.