Implements a replication plugin that pulls data from the configured external source into internal Durable Object SQLite on a schedule, enabling close-to-edge read replicas.
Closes #72 /claim #72
ReplicationPlugin with task management endpointstmp_replication_tasks) and cursor statecursor_column + cursor_value) from external sourceINSERT OR REPLACEalarm()pnpm vitest run \
plugins/replication/index.test.ts \
src/do.test.ts \
src/handler.test.ts
# Create replication task
curl --location --request POST 'https://starbasedb.YOUR-ID-HERE.workers.dev/replication/tasks' \
--header 'Authorization: Bearer ABC123' \
--header 'Content-Type: application/json' \
--data '{
"sourceTable":"orders",
"targetTable":"orders",
"cursorColumn":"id",
"intervalSeconds":60,
"batchSize":500
}'
# List tasks
curl --location 'https://starbasedb.YOUR-ID-HERE.workers.dev/replication/tasks' \
--header 'Authorization: Bearer ABC123'
# Run once manually
curl --location --request POST 'https://starbasedb.YOUR-ID-HERE.workers.dev/replication/tasks/TASK_ID/run' \
--header 'Authorization: Bearer ABC123'
# Delete task
curl --location --request DELETE 'https://starbasedb.YOUR-ID-HERE.workers.dev/replication/tasks/TASK_ID' \
--header 'Authorization: Bearer ABC123'
No built-in plugin mechanism to regularly pull selected external tables into internal SQLite for edge-local reads.
Replication tasks can be configured per table with interval + cursor strategy, and are executed on schedule through DO alarms.
NIYOKWIZERA JEAND'AMOUR
@jeid12
Outerbase (YC W23)
@outerbase