Api reference
components.async_exports.public.actions ¶
increment_download_counts ¶
increment_export_download_counts ¶
Increment download counts for export results that the user has permission to access.
This function will: 1. Get export results with proper permission filtering 2. Increment download_count for each result 3. Set first_downloaded_at if not set 4. Update last_downloaded_at 5. Commit the changes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int
|
The user ID for permission checking |
required |
export_result_ids
|
list[UUID]
|
List of export result UUIDs that were downloaded |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in components/async_exports/public/actions/increment_download_counts.py
components.async_exports.public.dependencies ¶
AsyncExportsDependency ¶
Bases: ABC
AsyncExportsDependency defines the interface that apps using the async_exports component need to implement This interface is used to generate exports asynchronously.
generate_export
abstractmethod
¶
Generates an export based on the provided export type, filters, and file format. return a dictionary containing the export file content and metadata (items count, mimetype, etc.)
Source code in components/async_exports/public/dependencies.py
get_app_dependency ¶
Retrieves at runtime the async_exports dependency set by set_app_dependency
Source code in components/async_exports/public/dependencies.py
set_app_dependency ¶
Sets the async_exports dependency to the app so it can be accessed within this component at runtime
Source code in components/async_exports/public/dependencies.py
components.async_exports.public.entities ¶
export_info ¶
ExportInfo
dataclass
¶
ExportInfo(
*,
export_request_id,
export_type,
file_format,
filters,
created_at,
context_account_id,
company_ids,
operational_scope_ids,
export_result_id,
processing_status,
outcome=None,
items_count=None,
processed_at=None,
error_message=None
)
Information about an export request and its result.
to_dict ¶
Convert ExportInfo to a dictionary.
Source code in components/async_exports/public/entities/export_info.py
export_request_data ¶
ExportRequestData
dataclass
¶
ExportRequestData(
*,
profile_id,
export_type,
filters,
file_format,
context_account_id,
company_ids,
operational_scope_ids
)
Bases: DataClassJsonMixin
Represents data required to create an export request.
export_result_data ¶
ExportResultData
dataclass
¶
ExportResultData(
*,
id,
export_request_id,
export_type,
file_format,
outcome,
uri,
items_count,
created_at,
context_account_id,
company_ids,
operational_scope_ids
)
Represents export result data for file downloads.
components.async_exports.public.enums ¶
enums ¶
export_type ¶
ExportConfig ¶
Single source of truth for export types and their scope configuration.
EXPORT_DEFINITIONS
class-attribute
instance-attribute
¶
EXPORT_DEFINITIONS = {
ExportType("employees"): ExportConfiguration(
scope="global", retention_period_days=30
),
ExportType("exemptions"): ExportConfiguration(
scope="local", retention_period_days=30
),
ExportType(
"premium_discrepancies"
): ExportConfiguration(
scope="local", retention_period_days=30
),
}
is_global_export
classmethod
¶
Check if an export type uses global components.
Source code in components/async_exports/public/enums/export_type.py
is_local_export
classmethod
¶
Check if an export type uses local components.
Source code in components/async_exports/public/enums/export_type.py
ExportConfiguration
dataclass
¶
ExportType ¶
Bases: AlanBaseEnum
This enum defines the export types that can be generated. It serves as a single source of truth for export types and their scope configuration. Add new export types here as needed.
components.async_exports.public.queries ¶
get_export_results ¶
get_export_results_for_download ¶
Get export results for download with permission filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int
|
The user ID for permission checking |
required |
export_result_ids
|
set[UUID]
|
List of export result IDs to retrieve |
required |
Returns:
| Type | Description |
|---|---|
list[ExportResultData]
|
List of ExportResultData objects for permitted results |