powersync 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +67 -0
- package/README.md +1376 -173
- package/bin/dev.cmd +3 -3
- package/bin/dev.js +20 -7
- package/bin/run.cmd +3 -3
- package/bin/run.js +9 -5
- package/dist/api/cloud/create-cloud-instance.d.ts +15 -0
- package/dist/api/cloud/create-cloud-instance.js +19 -0
- package/dist/api/cloud/fetch-cloud-config.d.ts +12 -0
- package/dist/api/cloud/fetch-cloud-config.js +18 -0
- package/dist/api/cloud/fetch-cloud-sync-rules-content.d.ts +7 -0
- package/dist/api/cloud/fetch-cloud-sync-rules-content.js +26 -0
- package/dist/api/cloud/test-connection.d.ts +16 -0
- package/dist/api/cloud/test-connection.js +36 -0
- package/dist/api/cloud/validate-cloud-link-config.d.ts +17 -0
- package/dist/api/cloud/validate-cloud-link-config.js +47 -0
- package/dist/api/cloud/wait-for-operation.d.ts +16 -0
- package/dist/api/cloud/wait-for-operation.js +33 -0
- package/dist/api/cloud/write-cloud-link.d.ts +10 -0
- package/dist/api/cloud/write-cloud-link.js +21 -0
- package/dist/api/display-status.d.ts +4 -0
- package/dist/api/display-status.js +80 -0
- package/dist/api/ide/configure-vscode-ide.d.ts +14 -0
- package/dist/api/ide/configure-vscode-ide.js +62 -0
- package/dist/api/login-server.d.ts +26 -0
- package/dist/api/login-server.js +137 -0
- package/dist/api/run-validation-tests.d.ts +63 -0
- package/dist/api/run-validation-tests.js +202 -0
- package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.d.ts +7 -0
- package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.js +26 -0
- package/dist/commands/configure/ide.d.ts +8 -0
- package/dist/commands/configure/ide.js +58 -0
- package/dist/commands/configure/index.d.ts +8 -0
- package/dist/commands/configure/index.js +11 -0
- package/dist/commands/deploy/index.d.ts +48 -0
- package/dist/commands/deploy/index.js +333 -0
- package/dist/commands/deploy/service-config.d.ts +14 -0
- package/dist/commands/deploy/service-config.js +30 -0
- package/dist/commands/deploy/sync-config.d.ts +24 -0
- package/dist/commands/deploy/sync-config.js +103 -0
- package/dist/commands/destroy.d.ts +14 -0
- package/dist/commands/destroy.js +62 -0
- package/dist/commands/fetch/config.d.ts +14 -0
- package/dist/commands/fetch/config.js +33 -0
- package/dist/commands/fetch/index.d.ts +13 -0
- package/dist/commands/fetch/index.js +16 -0
- package/dist/commands/fetch/instances.d.ts +47 -0
- package/dist/commands/fetch/instances.js +177 -0
- package/dist/commands/fetch/status.d.ts +18 -0
- package/dist/commands/fetch/status.js +60 -0
- package/dist/commands/{instance/schema.d.ts → generate/index.d.ts} +3 -1
- package/dist/commands/generate/index.js +11 -0
- package/dist/commands/generate/schema.d.ts +19 -0
- package/dist/commands/generate/schema.js +72 -0
- package/dist/commands/generate/token.d.ts +25 -0
- package/dist/commands/generate/token.js +124 -0
- package/dist/commands/init/cloud.d.ts +11 -0
- package/dist/commands/init/cloud.js +64 -0
- package/dist/commands/{init.d.ts → init/index.d.ts} +2 -1
- package/dist/commands/init/index.js +11 -0
- package/dist/commands/init/self-hosted.d.ts +11 -0
- package/dist/commands/init/self-hosted.js +60 -0
- package/dist/commands/link/cloud.d.ts +15 -0
- package/dist/commands/link/cloud.js +111 -0
- package/dist/commands/{instance/config.d.ts → link/index.d.ts} +3 -1
- package/dist/commands/link/index.js +11 -0
- package/dist/commands/link/self-hosted.d.ts +12 -0
- package/dist/commands/link/self-hosted.js +54 -0
- package/dist/commands/login.d.ts +8 -0
- package/dist/commands/login.js +107 -0
- package/dist/commands/logout.d.ts +8 -0
- package/dist/commands/logout.js +19 -0
- package/dist/commands/migrate/index.d.ts +7 -0
- package/dist/commands/migrate/index.js +10 -0
- package/dist/commands/migrate/sync-rules.d.ts +15 -0
- package/dist/commands/migrate/sync-rules.js +51 -0
- package/dist/commands/{instances.d.ts → pull/index.d.ts} +3 -1
- package/dist/commands/pull/index.js +11 -0
- package/dist/commands/pull/instance.d.ts +14 -0
- package/dist/commands/pull/instance.js +108 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +2 -0
- package/dist/commands/stop.d.ts +14 -0
- package/dist/commands/stop.js +62 -0
- package/dist/commands/validate.d.ts +16 -0
- package/dist/commands/validate.js +165 -0
- package/dist/help.d.ts +31 -0
- package/dist/help.js +123 -0
- package/oclif.manifest.json +1259 -330
- package/package.json +104 -75
- package/templates/cloud/powersync/cli.yaml +3 -0
- package/templates/cloud/powersync/service.yaml +174 -0
- package/templates/cloud/powersync/sync-config.yaml +22 -0
- package/templates/self-hosted/base/powersync/cli.yaml +3 -0
- package/templates/self-hosted/base/powersync/service.yaml +243 -0
- package/templates/self-hosted/base/powersync/sync-config.yaml +22 -0
- package/templates/vscode/settings.json +3 -0
- package/dist/commands/init.js +0 -66
- package/dist/commands/instance/config.js +0 -23
- package/dist/commands/instance/create.d.ts +0 -36
- package/dist/commands/instance/create.js +0 -137
- package/dist/commands/instance/deploy.d.ts +0 -21
- package/dist/commands/instance/deploy.js +0 -91
- package/dist/commands/instance/destroy.d.ts +0 -9
- package/dist/commands/instance/destroy.js +0 -46
- package/dist/commands/instance/generate-dev-token.d.ts +0 -10
- package/dist/commands/instance/generate-dev-token.js +0 -54
- package/dist/commands/instance/schema.js +0 -20
- package/dist/commands/instance/set.d.ts +0 -9
- package/dist/commands/instance/set.js +0 -31
- package/dist/commands/instance/status.d.ts +0 -12
- package/dist/commands/instance/status.js +0 -50
- package/dist/commands/instance/stop.d.ts +0 -9
- package/dist/commands/instance/stop.js +0 -42
- package/dist/commands/instance/sync-rules/deploy.d.ts +0 -10
- package/dist/commands/instance/sync-rules/deploy.js +0 -49
- package/dist/commands/instance/sync-rules/generate-schema.d.ts +0 -10
- package/dist/commands/instance/sync-rules/generate-schema.js +0 -56
- package/dist/commands/instance/sync-rules/validate.d.ts +0 -9
- package/dist/commands/instance/sync-rules/validate.js +0 -29
- package/dist/commands/instances.js +0 -29
- package/dist/commands.utils.d.ts +0 -2
- package/dist/commands.utils.js +0 -131
- package/dist/connection.utils.d.ts +0 -56
- package/dist/connection.utils.js +0 -76
- package/dist/constants.d.ts +0 -8
- package/dist/constants.js +0 -10
- package/dist/instance-command-flags.d.ts +0 -13
- package/dist/instance-command-flags.js +0 -22
- package/dist/service/accounts.client.js +0 -11307
- package/dist/service/powersync.client.js +0 -75510
- package/dist/service/types.js +0 -1
- package/dist/service/utils.js +0 -153
- package/dist/utils.d.ts +0 -14
- package/dist/utils.js +0 -68
package/package.json
CHANGED
|
@@ -1,102 +1,131 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"name": "powersync",
|
|
3
|
+
"description": "A CLI for managing PowerSync instances",
|
|
4
|
+
"version": "0.9.1",
|
|
5
|
+
"author": "POWERSYNC",
|
|
3
6
|
"bin": {
|
|
4
7
|
"powersync": "./bin/run.js"
|
|
5
8
|
},
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
+
"bugs": "https://github.com/powersync-ja/powersync-cli/issues",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@fastify/cors": "^10.0.0",
|
|
12
|
+
"@inquirer/prompts": "^7.2.0",
|
|
13
|
+
"@oclif/core": "^4",
|
|
14
|
+
"@oclif/plugin-autocomplete": "^3.2.40",
|
|
15
|
+
"@oclif/plugin-commands": "^4.1.40",
|
|
16
|
+
"@oclif/plugin-help": "^6",
|
|
17
|
+
"@oclif/plugin-plugins": "^5",
|
|
18
|
+
"@powersync-community/sync-config-rewriter": "^0.1.2",
|
|
19
|
+
"@powersync/management-client": "^0.0.4",
|
|
20
|
+
"@powersync/management-types": "^0.0.3",
|
|
21
|
+
"@powersync/service-sync-rules": "^0.32.0",
|
|
22
|
+
"@powersync/service-types": "^0.15.0",
|
|
23
|
+
"bson": "^7.2.0",
|
|
24
|
+
"fastify": "^5.0.0",
|
|
25
|
+
"jose": "^6.1.3",
|
|
26
|
+
"lodash": "^4.17.23",
|
|
27
|
+
"open": "^11.0.0",
|
|
28
|
+
"ora": "^9.0.0",
|
|
29
|
+
"ts-codec": "^1.3.0",
|
|
30
|
+
"yaml": "^2",
|
|
31
|
+
"@powersync/cli-core": "0.9.1",
|
|
32
|
+
"@powersync/cli-plugin-config-edit": "0.9.1",
|
|
33
|
+
"@powersync/cli-plugin-docker": "0.9.1",
|
|
34
|
+
"@powersync/cli-schemas": "0.9.1"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@oclif/prettier-config": "^0.2.1",
|
|
38
|
+
"@oclif/test": "^4",
|
|
39
|
+
"@types/lodash": "^4.17.23",
|
|
40
|
+
"@types/node": "^24",
|
|
41
|
+
"oclif": "4.22.81",
|
|
42
|
+
"shx": "^0.3.3",
|
|
43
|
+
"ts-node": "^10",
|
|
44
|
+
"tsx": "^4",
|
|
45
|
+
"typescript": "^5",
|
|
46
|
+
"vitest": "^4.0.0"
|
|
9
47
|
},
|
|
10
|
-
"description": "PowerSync CLI",
|
|
11
48
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
49
|
+
"node": ">=18.0.0"
|
|
13
50
|
},
|
|
14
51
|
"files": [
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
52
|
+
"./bin",
|
|
53
|
+
"./dist",
|
|
54
|
+
"./templates",
|
|
55
|
+
"./oclif.manifest.json"
|
|
18
56
|
],
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
57
|
+
"homepage": "https://github.com/powersync-ja/powersync-cli",
|
|
58
|
+
"keywords": [
|
|
59
|
+
"oclif"
|
|
60
|
+
],
|
|
61
|
+
"license": "FSL-1.1-ALv2",
|
|
62
|
+
"main": "dist/index.js",
|
|
23
63
|
"type": "module",
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
64
|
+
"exports": {
|
|
65
|
+
".": {
|
|
66
|
+
"import": "./dist/index.js",
|
|
67
|
+
"types": "./dist/index.d.ts",
|
|
68
|
+
"default": "./dist/index.js"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
27
71
|
"oclif": {
|
|
28
72
|
"bin": "powersync",
|
|
29
73
|
"dirname": "powersync",
|
|
30
74
|
"commands": "./dist/commands",
|
|
75
|
+
"macos": {
|
|
76
|
+
"identifier": "com.powersync.cli"
|
|
77
|
+
},
|
|
78
|
+
"helpClass": "./dist/help.js",
|
|
31
79
|
"plugins": [
|
|
32
80
|
"@oclif/plugin-help",
|
|
33
|
-
"@oclif/plugin-
|
|
34
|
-
"@
|
|
81
|
+
"@oclif/plugin-plugins",
|
|
82
|
+
"@powersync/cli-plugin-docker",
|
|
83
|
+
"@powersync/cli-plugin-config-edit",
|
|
84
|
+
"@oclif/plugin-autocomplete",
|
|
85
|
+
"@oclif/plugin-commands"
|
|
35
86
|
],
|
|
87
|
+
"topicSeparator": " ",
|
|
36
88
|
"topics": {
|
|
37
|
-
"
|
|
38
|
-
"description": "
|
|
89
|
+
"deploy": {
|
|
90
|
+
"description": "[Cloud only] Deploy local config changes to the Cloud instance. Run \"powersync deploy --help\" to list subcommands."
|
|
39
91
|
},
|
|
40
|
-
"
|
|
41
|
-
"description": "
|
|
92
|
+
"fetch": {
|
|
93
|
+
"description": "Inspect Cloud instances and configuration (instances, config, status). Run \"powersync fetch --help\" to list subcommands."
|
|
94
|
+
},
|
|
95
|
+
"generate": {
|
|
96
|
+
"description": "Generate client artifacts from instance/config data (schema, token). Run \"powersync generate --help\" to list subcommands."
|
|
97
|
+
},
|
|
98
|
+
"init": {
|
|
99
|
+
"description": "Scaffold a new PowerSync project configuration from templates. Run \"powersync init --help\" to list subcommands."
|
|
100
|
+
},
|
|
101
|
+
"link": {
|
|
102
|
+
"description": "Bind this directory to a Cloud or self-hosted instance (writes cli.yaml). Run \"powersync link --help\" to list subcommands."
|
|
103
|
+
},
|
|
104
|
+
"migrate": {
|
|
105
|
+
"description": "Migrate config to newer formats (for example Sync Rules to Sync Streams). Run \"powersync migrate --help\" to list subcommands."
|
|
106
|
+
},
|
|
107
|
+
"pull": {
|
|
108
|
+
"description": "[Cloud only] Download Cloud instance configuration into local files. Run \"powersync pull --help\" to list subcommands."
|
|
42
109
|
}
|
|
43
|
-
}
|
|
44
|
-
"topicSeparator": " "
|
|
110
|
+
}
|
|
45
111
|
},
|
|
46
|
-
"repository":
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"@oclif/plugin-help": "^6.2.8",
|
|
50
|
-
"@oclif/plugin-not-found": "^3.1.4",
|
|
51
|
-
"@oclif/plugin-warn-if-update-available": "^3.1.11",
|
|
52
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
53
|
-
"clipboardy": "^4.0.0",
|
|
54
|
-
"dotenv": "^16.4.5",
|
|
55
|
-
"inquirer": "^9.3.6",
|
|
56
|
-
"ora": "^8.0.1"
|
|
112
|
+
"repository": {
|
|
113
|
+
"type": "git",
|
|
114
|
+
"url": "https://github.com/powersync-ja/powersync-cli"
|
|
57
115
|
},
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"@journeyapps-platform/sdk-accounts-hub": "^7.0.1",
|
|
62
|
-
"@journeyapps-platform/sdk-common": "^5.5.0",
|
|
63
|
-
"@journeyapps-platform/sdk-powersync": "^2.5.1",
|
|
64
|
-
"@journeyapps-platform/types-accounts-hub": "^7.0.1",
|
|
65
|
-
"@powersync/service-sync-rules": "^0.27.0",
|
|
66
|
-
"@rollup/plugin-commonjs": "^26.0.1",
|
|
67
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
68
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
69
|
-
"@types/inquirer": "^9.0.7",
|
|
70
|
-
"@types/node": "^20.16.1",
|
|
71
|
-
"esbuild": "^0.23.1",
|
|
72
|
-
"eslint": "^8.57.0",
|
|
73
|
-
"eslint-config-oclif": "^5",
|
|
74
|
-
"eslint-config-oclif-typescript": "^3.1.9",
|
|
75
|
-
"eslint-config-prettier": "^9.1.0",
|
|
76
|
-
"eslint-plugin-prettier": "^5.2.1",
|
|
77
|
-
"glob": "^11.0.0",
|
|
78
|
-
"oclif": "^4.14.29",
|
|
79
|
-
"prettier": "^3.3.3",
|
|
80
|
-
"rollup": "^4.21.2",
|
|
81
|
-
"rollup-plugin-esbuild": "^6.1.1",
|
|
82
|
-
"shx": "^0.3.4",
|
|
83
|
-
"strip-ansi": "^7.1.0",
|
|
84
|
-
"ts-node": "^10.9.2",
|
|
85
|
-
"typescript": "^5.5.4",
|
|
86
|
-
"vitest": "^2.0.5"
|
|
116
|
+
"publishConfig": {
|
|
117
|
+
"access": "public",
|
|
118
|
+
"registry": "https://registry.npmjs.org/"
|
|
87
119
|
},
|
|
120
|
+
"types": "dist/index.d.ts",
|
|
88
121
|
"scripts": {
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"lint": "eslint
|
|
93
|
-
"
|
|
94
|
-
"readme": "oclif readme &&
|
|
122
|
+
"dev": "tsx bin/dev.js",
|
|
123
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
124
|
+
"build": "tsc -b && pnpm prepack",
|
|
125
|
+
"lint": "eslint",
|
|
126
|
+
"pretest": "pnpm run build",
|
|
127
|
+
"readme:generate": "oclif readme && pnpm exec prettier --write README.md",
|
|
95
128
|
"test": "vitest",
|
|
96
|
-
"
|
|
97
|
-
"prettier": "prettier --write \"**/*.ts\"",
|
|
98
|
-
"version": "pnpm run readme && git add README.md",
|
|
99
|
-
"pack:tarballs": "oclif pack tarballs --parallel",
|
|
100
|
-
"changeset:version": "pnpm changeset version && pnpm readme"
|
|
129
|
+
"version": "pnpm run readme:generate && git add README.md"
|
|
101
130
|
}
|
|
102
131
|
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# PowerSync Cloud config – example template with all schema options documented.
|
|
2
|
+
# Uncomment one block per type (one connection type + optional client_auth). We recommend secrets as: secret: !env ENV_NAME (see ../../.vscode/settings.json).
|
|
3
|
+
# Docs: https://docs.powersync.com/usage/sync-rules
|
|
4
|
+
#
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
# TOP LEVEL
|
|
7
|
+
# -----------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
_type: cloud
|
|
10
|
+
name: my-cli-instance
|
|
11
|
+
|
|
12
|
+
# region (required): deployment region, e.g. us
|
|
13
|
+
# Note: This cannot be changed after the initial deployment
|
|
14
|
+
region: us
|
|
15
|
+
|
|
16
|
+
# -------------------------------------------------------------------------
|
|
17
|
+
# Replication (required): database connections for sync
|
|
18
|
+
# Note: only a single connection is currently supported.
|
|
19
|
+
# Connection: `uri` and `password` are required for a complete connection. Alternatively omit `uri`
|
|
20
|
+
# and provide individual fields (hostname, port, database, username, password, etc.); they are used
|
|
21
|
+
# to construct the connection URI. For MongoDB, `uri` is required.
|
|
22
|
+
# -------------------------------------------------------------------------
|
|
23
|
+
# -------------------------------------------------------------------------
|
|
24
|
+
# PostgreSQL – uncomment this entire block to use
|
|
25
|
+
# -------------------------------------------------------------------------
|
|
26
|
+
# replication:
|
|
27
|
+
# connections:
|
|
28
|
+
# - type: postgresql
|
|
29
|
+
# # Connection string (recommended). Omit and use hostname/port/database/username/password instead if you prefer.
|
|
30
|
+
# # [optional]
|
|
31
|
+
# uri: postgresql://user:pass@host:5432/dbname
|
|
32
|
+
# password:
|
|
33
|
+
# secret: !env POWERSYNC_DATABASE_PASSWORD
|
|
34
|
+
# # [optional] Alternative to uri: individual connection parameters.
|
|
35
|
+
# hostname: example.com
|
|
36
|
+
# port: 5432
|
|
37
|
+
# database: one
|
|
38
|
+
# username: postgres
|
|
39
|
+
# # [optional] Connection identifiers.
|
|
40
|
+
# name: string
|
|
41
|
+
# id: string
|
|
42
|
+
# tag: string
|
|
43
|
+
# # [optional] TLS mode. Options: verify-full | verify-ca. Default: verify-full. Use verify-full for production.
|
|
44
|
+
# sslmode: verify-full
|
|
45
|
+
# # [optional] TLS certificates (PEM). Required for verify-ca; optional for verify-full.
|
|
46
|
+
# cacert: string
|
|
47
|
+
# client_certificate: string
|
|
48
|
+
# client_private_key:
|
|
49
|
+
# secret: !env POWERSYNC_DATABASE_CLIENT_KEY
|
|
50
|
+
# # [optional] Cloud VPC endpoint hostname.
|
|
51
|
+
# vpc_endpoint_hostname: string
|
|
52
|
+
|
|
53
|
+
# -------------------------------------------------------------------------
|
|
54
|
+
# MongoDB – uncomment this entire block to use (comment out PostgreSQL above).
|
|
55
|
+
# uri is required for MongoDB; other fields are optional.
|
|
56
|
+
# -------------------------------------------------------------------------
|
|
57
|
+
# replication:
|
|
58
|
+
# connections:
|
|
59
|
+
# - type: mongodb
|
|
60
|
+
# # Connection string (required for MongoDB).
|
|
61
|
+
# uri: mongodb+srv://user:pass@host/db
|
|
62
|
+
# password:
|
|
63
|
+
# secret: !env POWERSYNC_MONGODB_PASSWORD
|
|
64
|
+
# # [optional] Connection parameters (if not in URI).
|
|
65
|
+
# username: string
|
|
66
|
+
# database: string
|
|
67
|
+
# # [optional] Connection identifiers.
|
|
68
|
+
# name: string
|
|
69
|
+
# id: string
|
|
70
|
+
# tag: string
|
|
71
|
+
# # [optional] Change-data-capture mode. Options: off | auto_configure | read_only. Default: off.
|
|
72
|
+
# post_images: off
|
|
73
|
+
# # [optional] Cloud VPC endpoint hostname.
|
|
74
|
+
# vpc_endpoint_hostname: string
|
|
75
|
+
|
|
76
|
+
# -------------------------------------------------------------------------
|
|
77
|
+
# MySQL – uncomment this entire block to use (comment out PostgreSQL above).
|
|
78
|
+
# -------------------------------------------------------------------------
|
|
79
|
+
# replication:
|
|
80
|
+
# connections:
|
|
81
|
+
# - type: mysql
|
|
82
|
+
# # [optional] Connection string. Omit and use hostname/port/database/username/password instead if you prefer.
|
|
83
|
+
# uri: string
|
|
84
|
+
# password:
|
|
85
|
+
# secret: !env POWERSYNC_MYSQL_PASSWORD
|
|
86
|
+
# # [optional] Alternative to uri: individual connection parameters.
|
|
87
|
+
# hostname: db.example.com
|
|
88
|
+
# port: 3306
|
|
89
|
+
# database: mydb
|
|
90
|
+
# username: sync
|
|
91
|
+
# # [optional] Connection identifiers.
|
|
92
|
+
# name: string
|
|
93
|
+
# id: string
|
|
94
|
+
# tag: string
|
|
95
|
+
# # [optional] TLS client certificate and key (PEM).
|
|
96
|
+
# client_certificate: string
|
|
97
|
+
# client_private_key:
|
|
98
|
+
# secret: !env POWERSYNC_MYSQL_CLIENT_KEY
|
|
99
|
+
|
|
100
|
+
# -------------------------------------------------------------------------
|
|
101
|
+
# MSSQL – uncomment this entire block to use (comment out PostgreSQL above).
|
|
102
|
+
# -------------------------------------------------------------------------
|
|
103
|
+
# replication:
|
|
104
|
+
# connections:
|
|
105
|
+
# - type: mssql
|
|
106
|
+
# # [optional] Connection string. Omit and use hostname/port/database/schema/username/password instead if you prefer.
|
|
107
|
+
# uri: string
|
|
108
|
+
# password:
|
|
109
|
+
# secret: !env POWERSYNC_MSSQL_PASSWORD
|
|
110
|
+
# # [optional] Alternative to uri: individual connection parameters.
|
|
111
|
+
# hostname: sql.example.com
|
|
112
|
+
# port: 1433
|
|
113
|
+
# database: mydb
|
|
114
|
+
# schema: dbo
|
|
115
|
+
# username: sync
|
|
116
|
+
# # [optional] Connection identifiers.
|
|
117
|
+
# name: string
|
|
118
|
+
# id: string
|
|
119
|
+
# tag: string
|
|
120
|
+
# # [optional] Auth type. Options: default | azure-active-directory-password | azure-active-directory-service-principal-secret.
|
|
121
|
+
# authentication:
|
|
122
|
+
# type: default
|
|
123
|
+
# options:
|
|
124
|
+
# password:
|
|
125
|
+
# secret: !env POWERSYNC_MSSQL_PASSWORD
|
|
126
|
+
# # [optional] Polling and TLS options.
|
|
127
|
+
# additionalConfig:
|
|
128
|
+
# pollingIntervalMs: 5000
|
|
129
|
+
# pollingBatchSize: 1000
|
|
130
|
+
# trustServerCertificate: false
|
|
131
|
+
|
|
132
|
+
# -----------------------------------------------------------------------------
|
|
133
|
+
# CLIENT AUTH (optional) – uncomment this entire block to enable
|
|
134
|
+
# -----------------------------------------------------------------------------
|
|
135
|
+
# client_auth:
|
|
136
|
+
# # [optional] Use the same JWT secret as Supabase. Default: false.
|
|
137
|
+
# supabase: false
|
|
138
|
+
# # [optional] Legacy: provide your Supabase project's legacy JWT secret from API settings in the Supabase Dashboard if not using new JWT signing keys.
|
|
139
|
+
# supabase_jwt_secret:
|
|
140
|
+
# secret: !env POWERSYNC_SUPABASE_JWT_SECRET
|
|
141
|
+
# # [optional] JWKS URL; instance fetches public keys to verify JWT signatures.
|
|
142
|
+
# jwks_uri: https://example.com/jwks.json
|
|
143
|
+
# # [optional] Inline JWKS; provide keys directly instead of or in addition to jwks_uri.
|
|
144
|
+
# jwks:
|
|
145
|
+
# keys:
|
|
146
|
+
# HMAC (symmetric) – Options: HS256 | HS384 | HS512
|
|
147
|
+
# - kty: oct
|
|
148
|
+
# alg: HS256
|
|
149
|
+
# kid: example-key
|
|
150
|
+
# k:
|
|
151
|
+
# secret: !env POWERSYNC_CLIENT_AUTH_KEY
|
|
152
|
+
# RSA – Options for alg: RS256 | RS384 | RS512
|
|
153
|
+
# - kty: RSA
|
|
154
|
+
# kid: my-rsa-key
|
|
155
|
+
# n: "<base64url-modulus>"
|
|
156
|
+
# e: "<base64url-exponent>"
|
|
157
|
+
# alg: RS256
|
|
158
|
+
# EC – Options for crv: P-256 | P-384 | P-512; alg: ES256 | ES384 | ES512
|
|
159
|
+
# - kty: EC
|
|
160
|
+
# kid: my-ec-key
|
|
161
|
+
# crv: P-256
|
|
162
|
+
# x: "<base64url-x>"
|
|
163
|
+
# y: "<base64url-y>"
|
|
164
|
+
# alg: ES256
|
|
165
|
+
# OKP (EdDSA) – Options for crv: Ed25519 | Ed448
|
|
166
|
+
# - kty: OKP
|
|
167
|
+
# kid: my-okp-key
|
|
168
|
+
# crv: Ed25519
|
|
169
|
+
# x: "<base64url-public-key>"
|
|
170
|
+
# alg: EdDSA
|
|
171
|
+
# # [optional] Additional audiences to accept (instance domain is always accepted). Default: [].
|
|
172
|
+
# additional_audiences: []
|
|
173
|
+
# # [optional] Allow development/temporary tokens. Default: false.
|
|
174
|
+
# allow_temporary_tokens: false
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# See https://docs.powersync.com/sync/advanced/compatibility
|
|
2
|
+
config:
|
|
3
|
+
edition: 3
|
|
4
|
+
|
|
5
|
+
# Define Sync Streams to control which data is synced to each user
|
|
6
|
+
# Docs: https://docs.powersync.com/sync/streams/overview
|
|
7
|
+
streams:
|
|
8
|
+
global:
|
|
9
|
+
# Streams without parameters sync the same data to all users
|
|
10
|
+
auto_subscribe: true
|
|
11
|
+
queries:
|
|
12
|
+
# Sync all rows
|
|
13
|
+
- SELECT * FROM mytable
|
|
14
|
+
# Only sync some rows
|
|
15
|
+
- SELECT * FROM mytable WHERE mycolumn = false
|
|
16
|
+
# Wildcards can be used, useful in development to quickly sync all tables
|
|
17
|
+
#- SELECT * FROM "%"
|
|
18
|
+
|
|
19
|
+
by_user:
|
|
20
|
+
# Only sync rows belonging to the user, using fields from the auth token
|
|
21
|
+
auto_subscribe: true
|
|
22
|
+
query: SELECT * FROM mytable WHERE mytable.user_id = auth.user_id()
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# PowerSync self-hosted config – example template with all schema options documented.
|
|
2
|
+
# Uncomment one block per type where applicable. We recommend secrets via !env ENV_NAME.
|
|
3
|
+
# Docs: https://docs.powersync.com/self-hosting
|
|
4
|
+
|
|
5
|
+
_type: self-hosted
|
|
6
|
+
|
|
7
|
+
# -----------------------------------------------------------------------------
|
|
8
|
+
# [optional] TELEMETRY – configuration for service telemetry and monitoring
|
|
9
|
+
# -----------------------------------------------------------------------------
|
|
10
|
+
# See https://docs.powersync.com/self-hosting/telemetry
|
|
11
|
+
telemetry:
|
|
12
|
+
# When true, disables sharing of anonymized telemetry data. Default: false.
|
|
13
|
+
disable_telemetry_sharing: false
|
|
14
|
+
# # [optional] Port for Prometheus metrics; when set, metrics are exposed for scraping.
|
|
15
|
+
# prometheus_port: 9090
|
|
16
|
+
|
|
17
|
+
# -----------------------------------------------------------------------------
|
|
18
|
+
# [required] REPLICATION – configuration for data replication; array of data source connections
|
|
19
|
+
# Connection: `uri` and `password` are required for a complete connection. Alternatively omit `uri`
|
|
20
|
+
# and provide individual fields (hostname, port, database, username, password, etc.); they are used
|
|
21
|
+
# to construct the connection URI. For MongoDB, `uri` is required.
|
|
22
|
+
# -----------------------------------------------------------------------------
|
|
23
|
+
replication:
|
|
24
|
+
# -------------------------------------------------------------------------
|
|
25
|
+
# PostgreSQL – uncomment this entire block to use
|
|
26
|
+
# -------------------------------------------------------------------------
|
|
27
|
+
# connections:
|
|
28
|
+
# - type: postgresql
|
|
29
|
+
# # Connection string (recommended). Omit and use hostname/port/database/username/password instead if you prefer.
|
|
30
|
+
# # [optional]
|
|
31
|
+
# uri: !env PS_DATA_SOURCE_URI
|
|
32
|
+
# password: !env PS_DATABASE_PASSWORD
|
|
33
|
+
# # [optional] Alternative to uri: individual connection parameters.
|
|
34
|
+
# hostname: string
|
|
35
|
+
# port: 5432
|
|
36
|
+
# database: string
|
|
37
|
+
# username: string
|
|
38
|
+
# # [optional] Connection identifiers.
|
|
39
|
+
# id: string
|
|
40
|
+
# tag: string
|
|
41
|
+
# # [optional] TLS mode. Options: verify-full | verify-ca | disable. Default: verify-full for production; disable is for local/private networks only.
|
|
42
|
+
# sslmode: disable
|
|
43
|
+
# # [optional] TLS certificates (PEM). Required for verify-ca; optional for verify-full.
|
|
44
|
+
# cacert: string
|
|
45
|
+
# client_certificate: string
|
|
46
|
+
# client_private_key: string
|
|
47
|
+
# # [optional] TLS SNI when connecting.
|
|
48
|
+
# tls_servername: string
|
|
49
|
+
# # [optional] IP ranges to reject for this connection.
|
|
50
|
+
# reject_ip_ranges: [ string ]
|
|
51
|
+
# # [optional] Replication slot name prefix.
|
|
52
|
+
# slot_name_prefix: string
|
|
53
|
+
# # [optional] Maximum connection pool size.
|
|
54
|
+
# max_pool_size: number
|
|
55
|
+
|
|
56
|
+
# -------------------------------------------------------------------------
|
|
57
|
+
# MongoDB – uncomment this entire block to use (comment out PostgreSQL above).
|
|
58
|
+
# uri is required for MongoDB; other fields are optional.
|
|
59
|
+
# -------------------------------------------------------------------------
|
|
60
|
+
# connections:
|
|
61
|
+
# - type: mongodb
|
|
62
|
+
# # Connection string (required for MongoDB).
|
|
63
|
+
# uri: !env PS_MONGODB_URI
|
|
64
|
+
# password: !env PS_MONGODB_PASSWORD
|
|
65
|
+
# # [optional] Connection parameters (if not in URI).
|
|
66
|
+
# username: string
|
|
67
|
+
# database: string
|
|
68
|
+
# # [optional] Connection identifiers.
|
|
69
|
+
# id: string
|
|
70
|
+
# tag: string
|
|
71
|
+
# # [optional] IP ranges to reject for this connection.
|
|
72
|
+
# reject_ip_ranges: []
|
|
73
|
+
# # [optional] Change-data-capture mode. Options: off | auto_configure | read_only. Default: off.
|
|
74
|
+
# post_images: off
|
|
75
|
+
|
|
76
|
+
# -------------------------------------------------------------------------
|
|
77
|
+
# MySQL – uncomment this entire block to use (comment out PostgreSQL above).
|
|
78
|
+
# -------------------------------------------------------------------------
|
|
79
|
+
# connections:
|
|
80
|
+
# - type: mysql
|
|
81
|
+
# # [optional] Connection string. Omit and use hostname/port/database/username/password instead if you prefer.
|
|
82
|
+
# uri: !env PS_MYSQL_URI
|
|
83
|
+
# password: !env PS_MYSQL_PASSWORD
|
|
84
|
+
# # [optional] Alternative to uri: individual connection parameters.
|
|
85
|
+
# hostname: db.example.com
|
|
86
|
+
# port: 3306
|
|
87
|
+
# database: mydb
|
|
88
|
+
# username: sync
|
|
89
|
+
# # [optional] Connection identifiers.
|
|
90
|
+
# id: string
|
|
91
|
+
# tag: string
|
|
92
|
+
# # [optional] MySQL server ID for replication.
|
|
93
|
+
# server_id: number
|
|
94
|
+
# # [optional] TLS: CA cert and client cert/key (PEM).
|
|
95
|
+
# cacert: string
|
|
96
|
+
# client_certificate: string
|
|
97
|
+
# client_private_key: string
|
|
98
|
+
# # [optional] IP ranges to reject for this connection.
|
|
99
|
+
# reject_ip_ranges: []
|
|
100
|
+
# # [optional] Binlog queue memory limit.
|
|
101
|
+
# binlog_queue_memory_limit: number
|
|
102
|
+
|
|
103
|
+
# -----------------------------------------------------------------------------
|
|
104
|
+
# MongoDB storage – configuration for the storage backend (sync bucket storage). Also see PostgreSQL storage below.
|
|
105
|
+
# -----------------------------------------------------------------------------
|
|
106
|
+
# storage:
|
|
107
|
+
# type: mongodb
|
|
108
|
+
# # Connection string (required for MongoDB storage).
|
|
109
|
+
# uri: !env PS_MONGO_URI
|
|
110
|
+
# # [optional] Connection parameters (if not in URI).
|
|
111
|
+
# database: string
|
|
112
|
+
# username: string
|
|
113
|
+
# password: !env PS_MONGO_PASSWORD
|
|
114
|
+
# # [optional] IP ranges to reject for this connection.
|
|
115
|
+
# reject_ip_ranges: []
|
|
116
|
+
|
|
117
|
+
# -----------------------------------------------------------------------------
|
|
118
|
+
# PostgreSQL storage – uncomment this block and comment out the MongoDB storage block above to use PostgreSQL.
|
|
119
|
+
# -----------------------------------------------------------------------------
|
|
120
|
+
# storage:
|
|
121
|
+
# type: postgresql
|
|
122
|
+
# # [optional] Connection string. Omit and use hostname/port/database/username/password instead if you prefer.
|
|
123
|
+
# uri: !env PS_STORAGE_URI
|
|
124
|
+
# # [optional] Alternative to uri: individual connection parameters.
|
|
125
|
+
# hostname: string
|
|
126
|
+
# port: 5432
|
|
127
|
+
# username: string
|
|
128
|
+
# password: !env PS_STORAGE_PASSWORD
|
|
129
|
+
# database: string
|
|
130
|
+
# # [optional] Connection identifiers.
|
|
131
|
+
# id: string
|
|
132
|
+
# tag: string
|
|
133
|
+
# # [optional] TLS mode. Options: verify-full | verify-ca | disable. Default: verify-full for production.
|
|
134
|
+
# sslmode: verify-full
|
|
135
|
+
# # [optional] TLS certificates (PEM).
|
|
136
|
+
# cacert: string
|
|
137
|
+
# client_certificate: string
|
|
138
|
+
# client_private_key: string
|
|
139
|
+
# # [optional] TLS SNI, IP rejection, slot prefix, pool size.
|
|
140
|
+
# tls_servername: string
|
|
141
|
+
# reject_ip_ranges: []
|
|
142
|
+
# slot_name_prefix: string
|
|
143
|
+
# max_pool_size: 8
|
|
144
|
+
# # [optional] Batch size limits.
|
|
145
|
+
# batch_limits:
|
|
146
|
+
# max_estimated_size: number
|
|
147
|
+
# max_record_count: number
|
|
148
|
+
# max_current_data_batch_size: number
|
|
149
|
+
|
|
150
|
+
# -----------------------------------------------------------------------------
|
|
151
|
+
# [optional] PORT – the port on which the service will listen for connections (number or string)
|
|
152
|
+
# -----------------------------------------------------------------------------
|
|
153
|
+
# port: !env PS_PORT
|
|
154
|
+
|
|
155
|
+
# -----------------------------------------------------------------------------
|
|
156
|
+
# SYNC CONFIG – configuration for Sync Streams/Sync Rules that define which data is synced to each user.
|
|
157
|
+
# -----------------------------------------------------------------------------
|
|
158
|
+
# One of path or content is supported. path is the most common (file reference).
|
|
159
|
+
sync_config:
|
|
160
|
+
# Path to the sync config YAML file (sync rules).
|
|
161
|
+
path: sync-config.yaml
|
|
162
|
+
# # [optional] Inline sync config content as a string; use this or path, not both.
|
|
163
|
+
# content: string
|
|
164
|
+
# # [optional] When true, exit the process if sync config fails to parse. Default: false.
|
|
165
|
+
# exit_on_error: false
|
|
166
|
+
|
|
167
|
+
# -----------------------------------------------------------------------------
|
|
168
|
+
# CLIENT AUTH (optional) – configuration for client authentication mechanisms
|
|
169
|
+
# -----------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
# client_auth:
|
|
172
|
+
# # [optional] Use the same JWT secret as Supabase. Default: false.
|
|
173
|
+
# supabase: false
|
|
174
|
+
# # [optional] Legacy: provide your Supabase project's legacy JWT secret from API settings in the Supabase Dashboard if not using new JWT signing keys.
|
|
175
|
+
# supabase_jwt_secret: !env PS_SUPABASE_JWT_SECRET
|
|
176
|
+
# # [optional] JWKS URL or array of URLs; instance fetches public keys to verify JWT signatures. Often used with custom auth.
|
|
177
|
+
# jwks_uri: https://example.com/jwks.json
|
|
178
|
+
# # [optional] Inline JWKS; provide keys directly instead of or in addition to jwks_uri.
|
|
179
|
+
# jwks:
|
|
180
|
+
# keys:
|
|
181
|
+
# HMAC (symmetric) – Options: HS256 | HS384 | HS512
|
|
182
|
+
# - kty: oct
|
|
183
|
+
# alg: HS256
|
|
184
|
+
# kid: example-key
|
|
185
|
+
# k: !env PS_CLIENT_AUTH_KEY
|
|
186
|
+
# RSA – Options for alg: RS256 | RS384 | RS512
|
|
187
|
+
# - kty: RSA
|
|
188
|
+
# kid: my-rsa-key
|
|
189
|
+
# n: "<base64url-modulus>"
|
|
190
|
+
# e: "<base64url-exponent>"
|
|
191
|
+
# alg: RS256
|
|
192
|
+
# EC – Options for crv: P-256 | P-384 | P-512; alg: ES256 | ES384 | ES512
|
|
193
|
+
# - kty: EC
|
|
194
|
+
# kid: my-ec-key
|
|
195
|
+
# crv: P-256
|
|
196
|
+
# x: "<base64url-x>"
|
|
197
|
+
# y: "<base64url-y>"
|
|
198
|
+
# alg: ES256
|
|
199
|
+
# OKP (EdDSA) – Options for crv: Ed25519 | Ed448
|
|
200
|
+
# - kty: OKP
|
|
201
|
+
# kid: my-okp-key
|
|
202
|
+
# crv: Ed25519
|
|
203
|
+
# x: "<base64url-public-key>"
|
|
204
|
+
# alg: EdDSA
|
|
205
|
+
# # [optional] Valid audiences for JWT validation. Example: ['authenticated'].
|
|
206
|
+
# audience: ['authenticated']
|
|
207
|
+
# # [optional] When true, block JWKS URIs that resolve to local network addresses. Default: false.
|
|
208
|
+
# block_local_jwks: false
|
|
209
|
+
# # [optional] IP ranges to reject when resolving JWKS URIs. Default: [].
|
|
210
|
+
# jwks_reject_ip_ranges: []
|
|
211
|
+
|
|
212
|
+
# -----------------------------------------------------------------------------
|
|
213
|
+
# [optional] API – API service configuration and parameters
|
|
214
|
+
# -----------------------------------------------------------------------------
|
|
215
|
+
api:
|
|
216
|
+
# API access tokens for administrative operations (e.g. CLI link). Use a strong token in production.
|
|
217
|
+
tokens:
|
|
218
|
+
- use_a_better_token_in_production
|
|
219
|
+
# # [optional] Performance and safety parameters. Defaults shown.
|
|
220
|
+
# parameters:
|
|
221
|
+
# max_concurrent_connections: 200 # Max connections (HTTP/websocket) per API process.
|
|
222
|
+
# max_data_fetch_concurrency: 10 # Should not exceed storage.max_pool_size. Default: 10.
|
|
223
|
+
# max_buckets_per_connection: 1000 # Hard limit; service errors if exceeded. Default: 1000.
|
|
224
|
+
# max_parameter_query_results: 1000 # Limit before converting to unique set. Default: 1000.
|
|
225
|
+
|
|
226
|
+
# -----------------------------------------------------------------------------
|
|
227
|
+
# [optional] HEALTHCHECK – mechanisms for exposing health check data
|
|
228
|
+
# -----------------------------------------------------------------------------
|
|
229
|
+
# healthcheck:
|
|
230
|
+
# probes:
|
|
231
|
+
# # [optional] Expose healthcheck status via filesystem files.
|
|
232
|
+
# use_filesystem: boolean
|
|
233
|
+
# # [optional] Expose healthcheck status via HTTP endpoints.
|
|
234
|
+
# use_http: boolean
|
|
235
|
+
# # [optional] Deprecated. HTTP probes for API and UNIFIED; filesystem probes are always enabled.
|
|
236
|
+
# use_legacy: boolean
|
|
237
|
+
|
|
238
|
+
# -----------------------------------------------------------------------------
|
|
239
|
+
# [optional] MIGRATIONS – configuration for database schema migrations
|
|
240
|
+
# -----------------------------------------------------------------------------
|
|
241
|
+
# migrations:
|
|
242
|
+
# # When true, disables automatic storage schema migrations; start them manually. Default: false.
|
|
243
|
+
# disable_auto_migration: false
|