Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Module Replication: MongoDB & MySQL support #133

Merged
merged 366 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
366 commits
Select commit Hold shift + click to select a range
e095f3e
added table debug info calls
stevensJourney Aug 14, 2024
5700fe8
Update Walstream classes to use the factories from the service context
Rentacookie Aug 14, 2024
3188c45
added connection schema api method and initial workings for replicati…
stevensJourney Aug 15, 2024
d738bce
update from base
stevensJourney Aug 15, 2024
338d490
update replication lag API. Cleanup queries
stevensJourney Aug 15, 2024
f174f01
cleanup
stevensJourney Aug 15, 2024
196f21c
cleanup retried queries. Add SSL config for MySQL config
stevensJourney Aug 15, 2024
a6614f1
Use framework errors. Update DataSourceConfig and ResolvedDataSourceC…
stevensJourney Aug 15, 2024
4a0b5ce
more mysql cleanup
stevensJourney Aug 15, 2024
b3a5c08
update failing Github action name to be clearer
stevensJourney Aug 15, 2024
76bac2f
share some utilities. Playing around with replication
stevensJourney Aug 15, 2024
ce78ee8
unfortunate implementation of replication lag
stevensJourney Aug 15, 2024
78e4f23
track binlog positions in replicated GTID identifier
stevensJourney Aug 19, 2024
7ef26f4
Introduces the AbstractReplicator concept as a more flexible alternat…
Rentacookie Aug 20, 2024
bef4198
wip
stevensJourney Aug 21, 2024
fbd99a5
Cleaned up WalStream Replicator and ReplicationJobs
Rentacookie Aug 21, 2024
dfa4c14
Removed no longer used Teardown function
Rentacookie Aug 21, 2024
2e1725d
Fixed outdated comments and exporting only used Replication classes
Rentacookie Aug 21, 2024
dd3c568
Updated and re-enabled postgres tests
Rentacookie Aug 21, 2024
2e552c4
Updated lock file
Rentacookie Aug 21, 2024
ec4f71d
more hacks to get writerows to work
stevensJourney Aug 21, 2024
7155d40
wip: before implementing update
stevensJourney Aug 22, 2024
df50b5c
added zongji types
stevensJourney Aug 22, 2024
ff8e557
update typescript
stevensJourney Aug 22, 2024
3aaa90e
shuffle files arround
stevensJourney Aug 22, 2024
cc1ca9f
update after shuffle
stevensJourney Aug 22, 2024
39dfdef
merge in changes
stevensJourney Aug 22, 2024
bb0be0f
Test: Try changing order of filter expression in github test action
Rentacookie Aug 22, 2024
f1336ae
Replication job start no longer immediately cancels
Rentacookie Aug 22, 2024
e2422e8
use new replicator interfaces
stevensJourney Aug 22, 2024
56c3dbf
Move connection factory shutdown
Rentacookie Aug 22, 2024
9250b19
move toSQLite function to common
stevensJourney Aug 22, 2024
bf2725a
update types
stevensJourney Aug 22, 2024
4378c77
move
stevensJourney Aug 22, 2024
912de61
Made column type optional since for Postgres the column type is not p…
Rentacookie Aug 23, 2024
dae4651
Fixed (hopefully) the test filtering for the test github action
Rentacookie Aug 23, 2024
c08c4f7
Corrected exclusion filter for test workflow
Rentacookie Aug 23, 2024
af8db7d
Added build:tests directive to postgres module
Rentacookie Aug 23, 2024
4be1846
Export populate_test_data
Rentacookie Aug 23, 2024
aefb056
Export the test utils from postgres module
Rentacookie Aug 23, 2024
d1be932
Moved data generation method to test utils
Rentacookie Aug 26, 2024
387b485
Moved data generation utils to tests
Rentacookie Aug 26, 2024
91d2cdb
Removed unused export
Rentacookie Aug 26, 2024
3e961bd
Updated test tsconfig to include jpgwire
Rentacookie Aug 26, 2024
02fb3c6
Try with outDir specified
Rentacookie Aug 26, 2024
8b9b909
Import from dist
Rentacookie Aug 26, 2024
2f858f5
Revert file move and now using import from dist
Rentacookie Aug 26, 2024
e6da973
cleanup
stevensJourney Aug 27, 2024
e3bf112
fix build error
stevensJourney Aug 27, 2024
76b0ce0
Ensure collections are created for tests
Rentacookie Aug 27, 2024
b9ad8ae
Added dedicated BucketStorageFactory for Postgres tests
Rentacookie Aug 27, 2024
18bf9e0
Moved custom factory into the test it is being used at
Rentacookie Aug 27, 2024
76c24e4
Revert factory imports
Rentacookie Aug 27, 2024
aad7428
Revert noEmit for postgres tests
Rentacookie Aug 27, 2024
79607c7
Trying moved factory again after tsconfig fix
Rentacookie Aug 27, 2024
e864a56
Create test collection conditionally
Rentacookie Aug 27, 2024
5bf7b3c
Added a few more TODOs
Rentacookie Aug 27, 2024
6165c47
Some more cleanup
Rentacookie Aug 28, 2024
101b2b1
Consolidated getDebugTableInfo
Rentacookie Aug 28, 2024
34d415b
Removed Postgres ZeroLSN from BucketStorage
Rentacookie Aug 28, 2024
83e0e30
Merge branch 'refs/heads/main' into feat/modular-replication-revised
Rentacookie Aug 28, 2024
82dd1b2
Writecheckpoint fix after conflict
Rentacookie Aug 28, 2024
755c708
fix: align debug_api field for compatibility (#6)
stevensJourney Sep 2, 2024
593cad2
Implement powersync instance teardown functionality
Rentacookie Sep 6, 2024
cbbcc6f
Merge branch 'refs/heads/feat/modular-replication-revised' into feat/…
Rentacookie Sep 6, 2024
eae3558
Merge branch 'refs/heads/feat/modular-replication-revised' into remov…
Rentacookie Sep 6, 2024
d6d22b5
Merge pull request #5 from journeyapps-platform/remove-zero-lsn-from-…
Rentacookie Sep 6, 2024
8886b10
Merge branch 'refs/heads/feat/modular-replication-revised' into feat/…
Rentacookie Sep 6, 2024
9fd9308
add some helpers
stevensJourney Sep 6, 2024
6a075e1
Adjusted checks in routes for the the RouterEngine
Rentacookie Sep 9, 2024
b433625
Merge branch 'refs/heads/feat/rework-teardown' into module-mysql
Rentacookie Sep 9, 2024
5b5792d
Updated lockfile
Rentacookie Sep 10, 2024
285afb0
Renamed storage provider storage dispose method.
Rentacookie Sep 10, 2024
7b10465
Merge pull request #8 from journeyapps-platform/feat/rework-teardown
Rentacookie Sep 10, 2024
3acfda0
Merge branch 'refs/heads/main' into feat/modular-replication-architec…
Rentacookie Sep 10, 2024
d2bfd9f
Update lockfile
Rentacookie Sep 10, 2024
04cc1bd
Basic MongoDB replication structure.
rkistner Sep 10, 2024
4ae6b23
Support resuming; multi-document operations.
rkistner Sep 12, 2024
bed97eb
Workaround for transaction boundaries; filter ns in pipeline.
rkistner Sep 13, 2024
f68a6ec
Proper initial snapshot + streaming afterwards.
rkistner Sep 13, 2024
9d68d5c
Use _id directly as replica identity.
rkistner Sep 16, 2024
5cf1474
Configurable defaultSchema.
rkistner Sep 16, 2024
e3576d6
Use _id directly as replica identity.
rkistner Sep 16, 2024
72ded17
Configurable defaultSchema.
rkistner Sep 16, 2024
48a1852
Fix tests.
rkistner Sep 16, 2024
22b95ce
Use 'test_schema' instead of 'public' for tests.
rkistner Sep 16, 2024
ba4fab4
Expand comment.
rkistner Sep 16, 2024
cf14271
Tweaks for ReplicaId.
rkistner Sep 16, 2024
ca2c97d
Fix subkey calculation & tests.
rkistner Sep 16, 2024
3ceae96
Fix more tests.
rkistner Sep 16, 2024
787ff88
Merge branch 'configurable-default-schema' into mongodb-poc
rkistner Sep 16, 2024
e36f306
Fix merge conflicts.
rkistner Sep 16, 2024
3facc2f
Fix Dockerfile.
rkistner Sep 16, 2024
505e728
Fix and test mongo data type conversion.
rkistner Sep 16, 2024
ae89a0d
More mongo format tests.
rkistner Sep 17, 2024
a2857bf
Fix initial snapshot; initial change-stream tests.
rkistner Sep 17, 2024
6c2645d
Fixed missing ErrorRateLimiter for WalStreamReplicationJob
Rentacookie Sep 17, 2024
a9da521
Record keepalive events.
rkistner Sep 17, 2024
aac8101
Another fix; basic replication tests passing.
rkistner Sep 17, 2024
78659d5
Added more logging for compact action
Rentacookie Sep 17, 2024
6a3b1e4
Handle collection drop and rename events.
rkistner Sep 17, 2024
9f1de16
Handle replace event.
rkistner Sep 17, 2024
64bb4f4
Handle missing fullDocument correctly.
rkistner Sep 17, 2024
834aa18
Improve keepalive stability.
rkistner Sep 17, 2024
b8fb012
Added start up and shutdown logging to engines.
Rentacookie Sep 17, 2024
2503cba
Merge branch 'feat/modular-replication-architecture' into configurabl…
rkistner Sep 17, 2024
00a9ed9
Merge remote-tracking branch 'origin/configurable-default-schema' int…
rkistner Sep 17, 2024
1858430
Merge branch 'feat/modular-replication-architecture' into module-mysql
Rentacookie Sep 17, 2024
4fad0b6
Merge pull request #83 from powersync-ja/configurable-default-schema
rkistner Sep 17, 2024
a31b727
Use checkpoints for standard replication.
rkistner Sep 17, 2024
594acc4
Support wildcard table patterns.
rkistner Sep 17, 2024
ef65356
Fix merge issue.
rkistner Sep 17, 2024
d51921f
Added changeset
Rentacookie Sep 18, 2024
74dcead
Made Postgres Module package public
Rentacookie Sep 18, 2024
1f4ded8
Updated lockfile
Rentacookie Sep 18, 2024
952cc1e
Update typescript, vitest, prettier.
rkistner Sep 18, 2024
11cf15e
Apply prettier changes.
rkistner Sep 18, 2024
d279db1
Fix type issues.
rkistner Sep 18, 2024
f433195
Fix tests.
rkistner Sep 18, 2024
6f54a28
Add changeset.
rkistner Sep 19, 2024
9725fac
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Sep 19, 2024
417cf5f
Merge pull request #84 from powersync-ja/update-tooling
rkistner Sep 19, 2024
e9bf63e
Fix aborting logic.
rkistner Sep 23, 2024
03a18c7
Normalize mongo connection parameters.
rkistner Sep 23, 2024
f428736
Remove error message when closing a ChangStreamReplicationJob.
rkistner Sep 23, 2024
9de2d35
Support M0 clusters; better error message on unsupported clusters.
rkistner Sep 23, 2024
3185e02
Fix sharded cluster check.
rkistner Sep 23, 2024
14b83eb
Fix initial replication regression.
rkistner Sep 23, 2024
df2725a
Refactor schema definitions to not be postgres-specific.
rkistner Sep 25, 2024
a197710
Rename original_type -> internal_type.
rkistner Sep 25, 2024
b0a4411
Include source types in the generated schema comments (optional).
rkistner Sep 25, 2024
3da71a9
Explicit TableSchema type.
rkistner Sep 25, 2024
4ecaee2
Add changeset.
rkistner Sep 25, 2024
43a10fa
Merge pull request #90 from powersync-ja/generic-schema-definitions
rkistner Sep 26, 2024
bfea461
remove mongodb publish config restriction in order to publish dev pac…
stevensJourney Oct 1, 2024
fb52b59
need to explicitly set MongDB package access to public for publish.
stevensJourney Oct 1, 2024
9863b16
Merge remote-tracking branch 'origin/main' into feat/modular-replicat…
rkistner Oct 2, 2024
2eb566a
Post-merge test fixes.
rkistner Oct 2, 2024
6dcfe68
Merge branch 'feat/modular-replication-architecture' into mongodb-alpha
rkistner Oct 2, 2024
354f762
Fix pnpm-lock.
rkistner Oct 2, 2024
b85150c
Implement basic diagnostics apis for MongoDB.
rkistner Oct 2, 2024
b863b67
Add test for getConnectionSchema.
rkistner Oct 2, 2024
5050204
Improve schema filtering; return defaultSchema in API.
rkistner Oct 2, 2024
60f6414
Initialize tag variable before use in nested function call.
Rentacookie Oct 3, 2024
04937a8
Add comment for tag default value
Rentacookie Oct 3, 2024
e4d19b2
Changeset
Rentacookie Oct 3, 2024
b8dfc98
Comment update
Rentacookie Oct 3, 2024
2feb679
Merge pull request #95 from powersync-ja/bugfix-unitialized-tag
Rentacookie Oct 3, 2024
4a654f1
list all databases (#96)
stevensJourney Oct 4, 2024
2a442dc
Merge branch 'feat/modular-replication-architecture' into mongodb-alpha
stevensJourney Oct 7, 2024
9683172
[MongoDB] Schema Endpoint Fix (#97)
stevensJourney Oct 7, 2024
f2963a7
Merge branch 'feat/modular-replication-architecture' into module-mysql
Rentacookie Oct 8, 2024
39638f4
Lockfile update and merge conflict fixes
Rentacookie Oct 8, 2024
aec43b9
Added dev docker compose for mysql
Rentacookie Oct 9, 2024
09cbcf3
Added MySQL connection manager and use appropriate connections
Rentacookie Oct 9, 2024
c8751d7
Added stricter type definition for checkpoints
Rentacookie Oct 9, 2024
9e7b41d
Fixed diagnostics route merge conflict
Rentacookie Oct 10, 2024
12191af
Add MySQLConnection management
Rentacookie Oct 10, 2024
cf002be
Made streamable mysql connections available
Rentacookie Oct 10, 2024
9941e20
Updated BinlogStream to use appropriate connections for snapshot stre…
Rentacookie Oct 10, 2024
49d01cd
Lockfile update
Rentacookie Oct 10, 2024
d2ece1b
[Modules] Feat: Replication Events (#105)
stevensJourney Oct 14, 2024
94c87aa
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Oct 14, 2024
04d5f30
Merge pull request #85 from powersync-ja/mongodb-alpha
rkistner Oct 15, 2024
0532cd8
Ignore auth errors on collections for mongodb schema.
rkistner Oct 15, 2024
04ddc98
Add changeset.
rkistner Oct 15, 2024
bb367f4
Filter out views.
rkistner Oct 15, 2024
8368671
Merge pull request #106 from powersync-ja/fix-atlas-permissions-handling
rkistner Oct 15, 2024
0932afb
Updated dev/test mysql docker compose
Rentacookie Oct 15, 2024
18ce275
Added BinlogStream tests (WiP)
Rentacookie Oct 15, 2024
20d4b0d
Initializing batch in constructor of MongoBucketBatch
Rentacookie Oct 15, 2024
9c4a14e
Merge branch 'feat/modular-replication-architecture' into module-mysql
Rentacookie Oct 15, 2024
203a737
Some MongoModule merge conflict handling and cleanup
Rentacookie Oct 15, 2024
e218216
Made mysql module publishing public
Rentacookie Oct 15, 2024
8befdce
Updated dockerfile
Rentacookie Oct 15, 2024
c2bd479
Added mysql module to service tsconfig
Rentacookie Oct 15, 2024
38737d4
Fixed dockerfile mysql module copy
Rentacookie Oct 16, 2024
62ffaac
Updated zongji dev package version
Rentacookie Oct 16, 2024
0864bc1
Merge branch 'main' into module_main_update
stevensJourney Oct 16, 2024
c11de66
updates after pulling in main branch
stevensJourney Oct 16, 2024
5aa2322
Merge pull request #107 from powersync-ja/module_main_update
stevensJourney Oct 16, 2024
1ff485d
Updated vitest
Rentacookie Oct 18, 2024
415019b
Added configuration error handling
Rentacookie Oct 18, 2024
186199d
Merge branch 'feat/modular-replication-architecture' into feat/mysql-…
Rentacookie Oct 18, 2024
b4b1f6e
Don't start replication if already aborted
Rentacookie Oct 18, 2024
049669b
Exposed DateStrings connection option in Zongji constructor
Rentacookie Oct 21, 2024
5758003
Lockfile
Rentacookie Oct 21, 2024
2f9e24f
Added ConnectionTester interface
Rentacookie Oct 22, 2024
2ccd6af
[Modules] Move Write Checkpoint APIs (#110)
stevensJourney Oct 22, 2024
cabcb93
Made it possible to specify timezone on zongji listener configuration…
Rentacookie Oct 23, 2024
5ce7ebf
Correctly handle date parsing on binlog events and table snapshotting
Rentacookie Oct 23, 2024
80f6c05
Merge branch 'feat/modular-replication-architecture' into feat/mysql-…
Rentacookie Oct 23, 2024
71f316f
Some cleanup
Rentacookie Oct 23, 2024
618b10e
fix esm stuff
dylanvorster Oct 23, 2024
00b079a
Using syncrule id for MySQL serverId
Rentacookie Oct 28, 2024
8610431
Changeset
Rentacookie Oct 28, 2024
8e7d223
Prevent mysql connection manager throwing errors on shutdown.
Rentacookie Oct 28, 2024
6d8aec9
Improved shutdown logic of binlog stream
Rentacookie Oct 28, 2024
7c073b1
Renamed Checkpoint to ReplicationCheckpoint
Rentacookie Oct 28, 2024
e1f854f
Merge pull request #111 from powersync-ja/feat/mysql-alpha
Rentacookie Oct 28, 2024
e4e8765
Reduce required permissions for replicating from a single database.
rkistner Oct 31, 2024
c6307d8
Add changeset.
rkistner Oct 31, 2024
26a7298
Merge pull request #113 from powersync-ja/mongodb-updates
rkistner Oct 31, 2024
ac03d8f
fix: Cached Parsed Sync Rules (#114)
stevensJourney Nov 1, 2024
03d465d
Merge remote-tracking branch 'origin/main' into chore/modular-main
stevensJourney Nov 4, 2024
43eb945
Merge remote-tracking branch 'origin/main' into chore/modular-main
stevensJourney Nov 4, 2024
5f31083
MySQL Type Consolidation (#115)
Rentacookie Nov 5, 2024
6ed725d
Properly replicate additional MongoDB types:
rkistner Nov 5, 2024
14bdceb
Test mongodb on GA.
rkistner Nov 5, 2024
0c9d991
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Nov 5, 2024
3bca30f
Also test with MongoDB 8.0.
rkistner Nov 5, 2024
f89a3b5
Merge pull request #119 from powersync-ja/mongodb-types
rkistner Nov 5, 2024
1e50d6b
Support compacting specific buckets when compacting manually.
rkistner Nov 6, 2024
dc04949
Merge pull request #118 from powersync-ja/chore/modular-main
stevensJourney Nov 6, 2024
5a58f45
Merge pull request #120 from powersync-ja/compact-specific-buckets
rkistner Nov 6, 2024
c75f480
Add configuration for using mongodb postimages.
rkistner Nov 6, 2024
ab9b0b1
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Nov 7, 2024
e4c60cd
Increase timeout between writes in tests.
rkistner Nov 7, 2024
9c3e7d6
Use "await using" to simplify tests.
rkistner Nov 7, 2024
a6cd6f9
Add postImage tests.
rkistner Nov 7, 2024
0b9d0e7
Test and fix wildcard collections.
rkistner Nov 7, 2024
ef85649
Invalidate changestream if postImage is not available.
rkistner Nov 7, 2024
0206aaa
Rename post_images config option.
rkistner Nov 7, 2024
7ba4d11
Parse returned mysql schema result (#122)
Rentacookie Nov 8, 2024
3395de6
More MongoDB type fixes and tests.
rkistner Nov 9, 2024
c209538
Merge pull request #123 from powersync-ja/mongodb-types-2
rkistner Nov 11, 2024
c879923
Handle improperly formatted mysql version strings (#124)
Rentacookie Nov 11, 2024
5160778
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Nov 12, 2024
81b8cbb
Automatically clear errors when restarting replication.
rkistner Nov 12, 2024
b8ccb40
Use commit instead of keepalive.
rkistner Nov 12, 2024
b4452aa
Fix initial snapshot implementation.
rkistner Nov 12, 2024
225af87
Avoid collMod permission on _powersync_checkpoints.
rkistner Nov 13, 2024
267ec11
Minor cleanup.
rkistner Nov 13, 2024
c5ca6e7
Validate changeStreamPreAndPostImages on existing collections.
rkistner Nov 13, 2024
52bc615
Avoid current_data document storage for MongoDB.
rkistner Nov 13, 2024
812b5c4
Fix tests.
rkistner Nov 13, 2024
80573ac
Merge pull request #121 from powersync-ja/mongodb-postimages
rkistner Nov 13, 2024
2b05388
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Nov 13, 2024
00af63e
Merge branch 'feat/modular-replication-architecture' into mongodb-fixes
rkistner Nov 13, 2024
91af7db
Merge pull request #128 from powersync-ja/mongodb-fixes
rkistner Nov 13, 2024
0db1a98
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Nov 13, 2024
62d8f3c
Merge pull request #129 from powersync-ja/mongodb-skip-currentdata
rkistner Nov 13, 2024
28e2269
Use $changeStreamSplitLargeEvent to handle large updates. (#130)
rkistner Nov 13, 2024
b1c3fef
Merge remote-tracking branch 'origin/feat/modular-replication-archite…
rkistner Nov 14, 2024
a8f28ea
Merge branch 'feat/modular-replication-architecture' into update-beta
rkistner Nov 14, 2024
7b168a2
Fix tests.
rkistner Nov 14, 2024
62cfb69
Fix managed write checkpoint filtering. (#134)
rkistner Nov 14, 2024
97df769
Merge pull request #132 from powersync-ja/update-beta
stevensJourney Nov 19, 2024
1f22484
Support json_each in parameter queries (#126)
rkistner Nov 19, 2024
cd698ac
Modular Architecture Prep for Merge (#137)
stevensJourney Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-items-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-module-mongodb': patch
---

Fix diagnostics schema authorization issues for MongoDB
5 changes: 5 additions & 0 deletions .changeset/fifty-dogs-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-module-mongodb': minor
---

Reduce permissions required for replicating a single mongodb database
5 changes: 5 additions & 0 deletions .changeset/gentle-icons-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-module-mysql': patch
---

Fixed MySQL version checking to better handle non-semantic version strings
6 changes: 6 additions & 0 deletions .changeset/green-peas-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@powersync/service-module-mongodb': minor
'@powersync/service-image': minor
---

Add MongoDB support (Alpha)
5 changes: 5 additions & 0 deletions .changeset/healthy-rules-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-module-mysql': patch
---

Fixed mysql schema json parsing
5 changes: 5 additions & 0 deletions .changeset/heavy-shirts-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-core': patch
---

Improved sync rules storage cached parsed sync rules, accommodating different parsing options where necessary.
8 changes: 8 additions & 0 deletions .changeset/lemon-terms-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@powersync/service-module-mysql': minor
---

Generate random serverId based on syncrule id for MySQL replication client
Consolidated type mappings between snapshot and replicated values
Enabled MySQL tests in CI

5 changes: 5 additions & 0 deletions .changeset/olive-spoons-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-core': patch
---

Moved tag variable initialization in diagnostics route to ensure it is initialized before usage
5 changes: 5 additions & 0 deletions .changeset/orange-eagles-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/lib-services-framework': minor
---

Added disposable listeners and observers
6 changes: 6 additions & 0 deletions .changeset/popular-snails-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@powersync/service-core': minor
'@powersync/service-sync-rules': minor
---

Added ability to emit data replication events
9 changes: 9 additions & 0 deletions .changeset/rotten-pumas-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@powersync/service-core': minor
'@powersync/service-module-mysql': minor
'@powersync/service-sync-rules': minor
---

Introduced alpha support for MySQL as a datasource for replication.
Bunch of cleanup

5 changes: 5 additions & 0 deletions .changeset/slow-stingrays-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-core': minor
---

Moved Write Checkpoint APIs to SyncBucketStorage
7 changes: 7 additions & 0 deletions .changeset/sour-turkeys-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@powersync/service-module-postgres': patch
'@powersync/service-rsocket-router': patch
'@powersync/service-types': patch
---

Updates from Replication events changes
16 changes: 16 additions & 0 deletions .changeset/tender-vans-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@powersync/service-core': minor
'@powersync/service-sync-rules': minor
'@powersync/lib-services-framework': minor
'@powersync/service-jpgwire': minor
'@powersync/service-types': minor
'@powersync/service-image': major
'@powersync/service-module-postgres': patch
---

- Introduced modules to the powersync service architecture
- Core functionality has been moved to "engine" classes. Modules can register additional functionality with these engines.
- The sync API functionality used by the routes has been abstracted to an interface. API routes are now managed by the RouterEngine.
- Replication is managed by the ReplicationEngine and new replication data sources can be registered to the engine by modules.
- Refactored existing Postgres replication as a module.
- Removed Postgres specific code from the core service packages.
5 changes: 5 additions & 0 deletions .changeset/violet-garlics-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-sync-rules': minor
---

Support json_each as a table-valued function.
5 changes: 5 additions & 0 deletions .changeset/weak-cats-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-sync-rules': minor
---

Optionally include original types in generated schemas as a comment.
178 changes: 171 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,67 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
- name: Test Build Docker Image
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=stevenontong/${{vars.DOCKER_REGISTRY}}:cache
context: .
platforms: linux/amd64
push: false
file: ./service/Dockerfile
# TODO remove this when removing Journey Micro
build-args: |
GITHUB_TOKEN=${{secrets.RESTRICTED_PACKAGES_TOKEN}}

run-tests:
name: Test
run-core-tests:
name: Core Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.8.0
with:
mongodb-version: '6.0'
mongodb-replica-set: test-rs

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Build
shell: bash
run: pnpm build

- name: Test
run: pnpm test --filter '!./modules/*'

run-postgres-tests:
name: Postgres Test
runs-on: ubuntu-latest
needs: run-core-tests

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -97,4 +142,123 @@ jobs:
run: pnpm build

- name: Test
run: pnpm test
run: pnpm test --filter='./modules/module-postgres'

run-mysql-tests:
name: MySQL Test
runs-on: ubuntu-latest
needs: run-core-tests

strategy:
fail-fast: false
matrix:
mysql-version: [5.7, 8.0, 8.4]

steps:
- uses: actions/checkout@v4

- name: Start MySQL
run: |
docker run \
--name MySQLTestDatabase \
-e MYSQL_ROOT_PASSWORD=mypassword \
-e MYSQL_DATABASE=mydatabase \
-p 3306:3306 \
-d mysql:${{ matrix.mysql-version }} \
--log-bin=/var/lib/mysql/mysql-bin.log \
--gtid_mode=ON \
--enforce_gtid_consistency=ON \
--server-id=1

- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.8.0
with:
mongodb-version: '6.0'
mongodb-replica-set: test-rs

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Build
shell: bash
run: pnpm build

- name: Test
run: pnpm test --filter='./modules/module-mysql'

run-mongodb-tests:
name: MongoDB Test
runs-on: ubuntu-latest
needs: run-core-tests

strategy:
fail-fast: false
matrix:
mongodb-version: ['6.0', '7.0', '8.0']

steps:
- uses: actions/checkout@v4

- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.8.0
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-replica-set: test-rs

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Build
shell: bash
run: pnpm build

- name: Test
run: pnpm test --filter='./modules/module-mongodb'
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/.git
**/node_modules
dist
lib
pnpm-lock.yaml
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<a href="https://www.powersync.com" target="_blank"><img src="https://github.com/powersync-ja/.github/assets/7372448/d2538c43-c1a0-4c47-9a76-41462dba484f"/></a>
</p>

*[PowerSync](https://www.powersync.com) is a sync engine for building local-first apps with instantly-responsive UI/UX and simplified state transfer. Syncs between SQLite on the client-side and Postgres, MongoDB or MySQL on the server-side.*
_[PowerSync](https://www.powersync.com) is a sync engine for building local-first apps with instantly-responsive UI/UX and simplified state transfer. Syncs between SQLite on the client-side and Postgres, MongoDB or MySQL on the server-side._

# PowerSync Service

Expand All @@ -11,6 +11,7 @@
The service can be started using the public Docker image. See the image [notes](./service/README.md)

# Monorepo Structure:

## Packages

- [packages/service-core](./packages/service-core/README.md)
Expand Down Expand Up @@ -52,13 +53,13 @@ Contains the PowerSync Service code. This project is used to build the `journeya

- [docs](./docs/README.md)

Technical documentation regarding the implementation of PowerSync.
Technical documentation regarding the implementation of PowerSync.

## Test Client

- [test-client](./test-client/README.md)

Contains a minimal client demonstrating direct usage of the HTTP stream sync API. This can be used to test sync rules in contexts such as automated testing.
Contains a minimal client demonstrating direct usage of the HTTP stream sync API. This can be used to test sync rules in contexts such as automated testing.

# Developing

Expand Down
4 changes: 3 additions & 1 deletion libs/lib-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
"dotenv": "^16.4.5",
"lodash": "^4.17.21",
"ts-codec": "^1.2.2",
"uuid": "^9.0.1",
"winston": "^3.13.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/lodash": "^4.17.5",
"vitest": "^0.34.6"
"@types/uuid": "^9.0.4",
"vitest": "^2.1.1"
}
}
Loading