Skip to content

Commit d61e2bc

Browse files
update sync stream defaults
1 parent 9fd74e8 commit d61e2bc

File tree

4 files changed

+38
-40
lines changed

4 files changed

+38
-40
lines changed

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@powersync/management-types": "0.0.1",
2121
"@powersync/service-sync-rules": "^0.30.0",
2222
"@powersync/service-types": "^0.13.3",
23-
"@powersync-community/sync-config-rewriter": "0.1.0",
23+
"@powersync-community/sync-config-rewriter": "^0.1.1",
2424
"jose": "^6.1.3",
2525
"lodash": "^4.17.23",
2626
"fastify": "^5.0.0",
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
# See Documentation for more information:
2-
# https://docs.powersync.com/usage/sync-rules
3-
4-
# See https://docs.powersync.com/usage/sync-rules/compatibility for config:edition details
1+
# See https://docs.powersync.com/sync/advanced/compatibility
52
config:
63
edition: 2
4+
sync_config_compiler: true
75

8-
# Define sync config to control which data is synced to each user
9-
# Docs: https://docs.powersync.com/usage/sync-rules
10-
bucket_definitions:
6+
# Define Sync Streams to control which data is synced to each user
7+
# Docs: https://docs.powersync.com/sync/streams/overview
8+
streams:
119
global:
12-
# Sync config without parameter queries will sync to all users
13-
data:
14-
# Sync all rows
10+
# Streams without parameters sync the same data to all users
11+
auto_subscribe: true
12+
queries:
13+
# Sync all rows
1514
- SELECT * FROM mytable
16-
# Only sync some rows
15+
# Only sync some rows
1716
- SELECT * FROM mytable WHERE mycolumn = false
18-
# Wildcards can be used, useful in development to quickly sync all tables
19-
# - SELECT * FROM "%"
17+
# Wildcards can be used, useful in development to quickly sync all tables
18+
#- SELECT * FROM "%"
19+
2020
by_user:
21-
# Only sync rows belonging to the user, using fields from the auth token
22-
parameters: SELECT request.user_id() as user_id
23-
data:
24-
- SELECT * FROM mytable WHERE mytable.user_id = bucket.user_id
21+
# Only sync rows belonging to the user, using fields from the auth token
22+
auto_subscribe: true
23+
query: SELECT * FROM mytable WHERE mytable.user_id = auth.user_id()
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
# See Documentation for more information:
2-
# https://docs.powersync.com/usage/sync-rules
3-
4-
# See https://docs.powersync.com/usage/sync-rules/compatibility for config:edition details
1+
# See https://docs.powersync.com/sync/advanced/compatibility
52
config:
63
edition: 2
4+
sync_config_compiler: true
75

8-
# Define sync config to control which data is synced to each user
9-
# Docs: https://docs.powersync.com/usage/sync-rules
10-
bucket_definitions:
6+
# Define Sync Streams to control which data is synced to each user
7+
# Docs: https://docs.powersync.com/sync/streams/overview
8+
streams:
119
global:
12-
# Sync config without parameter queries will sync to all users
13-
data:
14-
# Sync all rows
10+
# Streams without parameters sync the same data to all users
11+
auto_subscribe: true
12+
queries:
13+
# Sync all rows
1514
- SELECT * FROM mytable
16-
# Only sync some rows
15+
# Only sync some rows
1716
- SELECT * FROM mytable WHERE mycolumn = false
18-
# Wildcards can be used, useful in development to quickly sync all tables
19-
# - SELECT * FROM "%"
17+
# Wildcards can be used, useful in development to quickly sync all tables
18+
#- SELECT * FROM "%"
19+
2020
by_user:
21-
# Only sync rows belonging to the user, using fields from the auth token
22-
parameters: SELECT request.user_id() as user_id
23-
data:
24-
- SELECT * FROM mytable WHERE mytable.user_id = bucket.user_id
21+
# Only sync rows belonging to the user, using fields from the auth token
22+
auto_subscribe: true
23+
query: SELECT * FROM mytable WHERE mytable.user_id = auth.user_id()

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)