Skip to content

Page Import Table

Overview

Backend-owned lifecycle and source metadata for one public URL capture. Detailed DOM, computed-style, asset, and screenshot evidence is stored in S3; PostgreSQL stores the source request, lifecycle fences, and artifact pointers used to start Code2Des.

Table Definition

Logical Name Physical Name Column Name Data Type Primary Key Relation Unique Nullable Default Value Remarks
Page Import page_import id string โ—ฏ Backend UUIDv7 (varchar(255)); API pageImportId and worker page_import_id
organization_id number organization:id Organization scope; cascade on update/delete
project_id number project:id Project scope; cascade on update/delete
source_kind string public_url Capture source discriminator (varchar(32)); currently always public_url
source_url string Normalized public HTTP(S) URL (text); URL fragments are removed before persistence
viewport_width number Browser viewport width in CSS pixels (integer)
viewport_height number Browser viewport height in CSS pixels (integer)
device_scale_factor number 1 Browser device scale factor (real)
ready_selector string โ—ฏ Optional readiness selector (varchar(512))
status enum '0' page_import_status; see Type Codes
attempt number 1 Worker-attempt fence (integer); fixed at 1 until a retry path is introduced
nonce string Per-job callback/manifest correlation fence (varchar(255)); not exposed by the user API
result_url string โ—ฏ Successful capture artifact or failed artifact pointer (varchar(1000))
capture_hash string โ—ฏ SHA-256 identity for the exact completed capture JSON bytes (varchar(80))
screenshot_url string โ—ฏ Full-page screenshot artifact pointer (varchar(1000))
error_message string โ—ฏ Safe terminal failure detail (text)
created_at datetime CURRENT_TIMESTAMP Shared audit field
updated_at datetime CURRENT_TIMESTAMP Shared audit field
deleted_at datetime โ—ฏ Shared soft-delete field
created_by string Cognito subject or backend actor (varchar(50))
updated_by string Cognito subject or backend actor (varchar(50))
deleted_by string โ—ฏ Cognito subject or backend actor (varchar(50))

Relations

  • organization_id โ†’ organization.id with update/delete cascade
  • project_id โ†’ project.id with update/delete cascade
  • code2des.page_import_id โ†’ page_import.id through a non-unique foreign key, so one completed capture can be reused by multiple Code2Des jobs

Indexes

  • PRIMARY KEY (id)
  • INDEX page_import_project_status_idx (project_id, status)
  • INDEX page_import_org_project_idx (organization_id, project_id)

Type Codes

Database enum: page_import_status.

Value Meaning
'0' processing
'1' completed and eligible as a Code2Des source
'2' failed

Notes

  • The backend inserts the processing row before publishing the SQS message. The worker receives the source request and correlation fields but never receives PostgreSQL credentials.
  • The webhook must match the persisted job id, attempt, and nonce; the manifest must repeat the same identity. The database update also requires the row to remain processing and non-deleted.
  • A successful callback stores result_url, capture_hash, and screenshot_url. A failed callback stores a safe error_message and may store a failure result_url.
  • Code2Des requires the Page Import to be completed with non-null result_url and capture_hash. Triggering Code2Des does not modify or consume the Page Import row.