cadrumo.application.export.google_operation module¶
Canonical supervised Google Sheets calculation-workbook export.
This module owns the application sequence for a Google calculation-workbook export: exact active-profile admission, registry snapshot selection, plan construction, effect truth, and encrypted settlement. The remote transport is an injected port. Its concrete Google credentials, Drive-root configuration, preview/apply adapter calls, and sync-run repository are deliberately composed outside this application package by the authorised production composition step.
- exception GoogleSheetsExportCapabilityDisabledError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorThe active profile has not admitted Google workbook export.
- Parameters:
- Return type:
None
- code¶
- exception GoogleSheetsExportRootFolderRequiredError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorThe composed transport has no configured Drive root folder.
- Parameters:
- Return type:
None
- code¶
- exception GoogleSheetsExportClientMissingError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorThe active profile has no registered Google OAuth client.
- Parameters:
- Return type:
None
- code¶
- exception GoogleSheetsExportTokenMissingError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorThe active profile has no persisted Google OAuth token.
- Parameters:
- Return type:
None
- code¶
- exception GoogleSheetsExportAuthDependencyError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorThe Google authentication dependency is unavailable.
- Parameters:
- Return type:
None
- code¶
- exception GoogleSheetsExportActiveProfileRequiredError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorThe requested export profile is no longer the active profile.
- Parameters:
- Return type:
None
- code¶
- exception GoogleSheetsExportSubjectMismatchError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorThe supervised subject contradicts the export payload profile.
- Parameters:
- Return type:
None
- code¶
- class GoogleSheetsExportOperationRequest(**data)[source]¶
Bases:
CredentialFreeOperationRequestImmutable target for one active-profile Google Sheets export.
- Parameters:
data (Any)
- profile_id: UUID¶
- modelo: ModeloId¶
- filing_year: FilingYear¶
- period: str¶
- prefill_relations: bool¶
- dry_run: bool¶
- class GoogleSheetsWorkbookWriteFacts(**data)[source]¶
Bases:
BaseModelWhat one Google Sheets workbook write did, previewed or applied.
One concept with two carriers: the port returns these facts, and the operation retains them in encrypted custody alongside the provenance identifying which calculation produced them. Declaring them once keeps the carriers from drifting field by field – a counter added to the port’s return and not to the retained record would read as a silent zero downstream.
dry_runbelongs here rather than to either carrier because the port must return it exactly as received, so a preview can never be settled as an applied write.- Parameters:
data (Any)
- dry_run: bool¶
- root_folder_id: str | None¶
- spreadsheet_exists: bool | None¶
- folder_id: str | None¶
- spreadsheet_id: str | None¶
- spreadsheet_url: str | None¶
- value_cells_written: NonNegativeInt¶
- formula_cells_written: NonNegativeInt¶
- protected_ranges_written: NonNegativeInt¶
- tab_count: int¶
- ranges_to_clear: tuple[str, ...]¶
- value_cells_changed: int | None¶
- value_cells_unchanged: int | None¶
- formula_cells_to_write: int | None¶
- class GoogleSheetsExportRemoteResult(**data)[source]¶
Bases:
GoogleSheetsWorkbookWriteFactsSafe normalized facts returned by the injected remote export port.
This is the sole application-side translation boundary for concrete Google preview and apply records. The port must return
dry_runexactly as it received it, so an accidentally inverted composition cannot be settled as a successful operation.
- class GoogleSheetsExportOperationResult(**data)[source]¶
Bases:
GoogleSheetsWorkbookWriteFactsSafe completed or previewed workbook facts retained in encrypted custody.
- Parameters:
- profile_id: UUID¶
- modelo: ModeloId¶
- revision: RevisionId¶
- period: Period¶
- engine_version: str¶
- registry_sha: str¶
- class GoogleSheetsExportPublicResultV1(**data)[source]¶
Bases:
GoogleSheetsWorkbookWriteFactsRenderer-neutral settled export result with no domain-only field types.
- Parameters:
- profile_id: UUID¶
- modelo: ModeloId¶
- revision: RevisionId¶
- period: str¶
- filing_year: FilingYear¶
- engine_version: str¶
- registry_sha: str¶
- class GoogleSheetsExportPreparedPort(*args, **kwargs)[source]¶
Bases:
ProtocolIn-memory prepared transport whose remaining call may mutate remotely.
- execute(plan, dry_run)[source]¶
Preview or apply the plan after configuration and authentication succeeded.
- Return type:
- Parameters:
plan (SheetExportPlan)
dry_run (bool)
- project_google_sheets_export_result(result, _terminal_receipt)[source]¶
Project the private settled result into its strict public V1 shape.
- Return type:
BaseModel- Parameters:
result (BaseModel)
_terminal_receipt (object)
- class GoogleSheetsExportService(*, prepare_port=<function _unconfigured_google_sheets_export_prepare_port>, snapshot_resolver=<function _resolve_snapshot>, plan_builder=<function build_export_plan>)[source]¶
Bases:
objectCanonical application planning and remote handoff for one workbook export.
- Parameters:
prepare_port (GoogleSheetsExportPreparePort)
snapshot_resolver (GoogleSnapshotResolver)
plan_builder (GoogleExportPlanBuilder)
- execute(payload)[source]¶
Perform the synchronous application service for a frontend consumer.
The registered executor below owns supervision, durability, and effect truth. This service is deliberately the one reusable business path for legacy synchronous frontends while they are migrated to the supervisor; it never imports an adapter or constructs a concrete transport.
- Return type:
- Parameters:
payload (GoogleSheetsExportOperationRequest)
- admit(payload)[source]¶
Apply the active-profile and egress-capability admissions once.
- Return type:
- Parameters:
payload (GoogleSheetsExportOperationRequest)
- snapshot(payload)[source]¶
Resolve the exact temporal registry authority snapshot.
- Return type:
- Parameters:
payload (GoogleSheetsExportOperationRequest)
- plan(snapshot, *, prefill_relations)[source]¶
Build one canonical workbook plan from the resolved snapshot.
Core types:
RegistrySnapshot.- Return type:
- Parameters:
snapshot (RegistrySnapshot)
prefill_relations (bool)
- prepare(active_bucket_id)[source]¶
Resolve credentials and mandatory root configuration before mutation.
- Return type:
- Parameters:
active_bucket_id (str)
- remote(prepared, plan, *, dry_run)[source]¶
Cross the injected remote boundary without choosing an adapter.
- Return type:
- Parameters:
prepared (GoogleSheetsExportPreparedPort)
plan (SheetExportPlan)
dry_run (bool)
- static result(payload, snapshot, plan, remote)[source]¶
Normalize the safe, durable application result once.
Core types:
RegistrySnapshot.- Return type:
- Parameters:
payload (GoogleSheetsExportOperationRequest)
snapshot (RegistrySnapshot)
plan (SheetExportPlan)
remote (GoogleSheetsExportRemoteResult)
- class GoogleSheetsExportOperationExecutor(*, service)[source]¶
Bases:
objectRun the sole Google calculation-workbook export under supervision.
- Parameters:
service (GoogleSheetsExportService)
- async execute(request, context)[source]¶
Plan, preview, or apply one export while preserving effect truth.
- Return type:
- Parameters:
request (OperationRequest[GoogleSheetsExportOperationRequest])
context (OperationExecutorContext)
- build_google_sheets_export_operation_definition(*, prepare_port=<function _unconfigured_google_sheets_export_prepare_port>, snapshot_resolver=<function _resolve_snapshot>, plan_builder=<function build_export_plan>)[source]¶
Bind an injected remote-export port without importing concrete adapters.
- Return type:
- Parameters:
prepare_port (GoogleSheetsExportPreparePort)
snapshot_resolver (GoogleSnapshotResolver)
plan_builder (GoogleExportPlanBuilder)
- build_google_sheets_export_service(*, prepare_port=<function _unconfigured_google_sheets_export_prepare_port>, snapshot_resolver=<function _resolve_snapshot>, plan_builder=<function build_export_plan>)[source]¶
Build the reusable application service from injected boundary ports.
- Return type:
- Parameters:
prepare_port (GoogleSheetsExportPreparePort)
snapshot_resolver (GoogleSnapshotResolver)
plan_builder (GoogleExportPlanBuilder)
- build_google_sheets_export_operation_registration(definition)[source]¶
Bind the operation request and safe settled result to public identities.
- Return type:
- Parameters:
definition (OperationDefinition)